Re: [edk2-devel] [PATCH v4] SecurityPkg/SecureBootConfigDxe: Update UI according to UEFI spec

2024-04-06 Thread Yao, Jiewen
Thanks.https://github.com/tianocore/edk2/pull/5533

> -Original Message-
> From: Bi, Dandan 
> Sent: Sunday, April 7, 2024 10:07 AM
> To: Tan, Ming ; devel@edk2.groups.io
> Cc: Xu, Min M ; Yao, Jiewen ;
> POLUDOV, FELIX 
> Subject: RE: [PATCH v4] SecurityPkg/SecureBootConfigDxe: Update UI according
> to UEFI spec
> 
> Reviewed-by: Dandan Bi 
> 
> -Original Message-
> From: Tan, Ming 
> Sent: Tuesday, April 2, 2024 4:32 PM
> To: devel@edk2.groups.io
> Cc: Xu, Min M ; Yao, Jiewen ; Bi,
> Dandan ; POLUDOV, FELIX 
> Subject: [PATCH v4] SecurityPkg/SecureBootConfigDxe: Update UI according to
> UEFI spec
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4713
> 
> In UEFI_Spec_2_10_Aug29.pdf page 1694 section 35.5.4 for
> EFI_BROWSER_ACTION_FORM_OPEN:
> NOTE: EFI_FORM_BROWSER2_PROTOCOL.BrowserCallback() cannot be used
> with this browser action because question values have not been retrieved yet.
> 
> So should not call HiiGetBrowserData() and HiiSetBrowserData() in FORM_OPEN
> call back function.
> 
> Now call SecureBootExtractConfigFromVariable() and update
> IfrNvData->ListCount to save the change to EFI variable, then HII use
> IfrNvData->EFI
> variable to control the UI.
> 
> Cc: Min Xu 
> Cc: Jiewen Yao 
> Cc: Dandan Bi 
> Cc: Felix Polyudov 
> Signed-off-by: Ming Tan 
> ---
>   PR: https://github.com/tianocore/edk2/pull/5411
> 
>   V4: Fix a Cc issue of miss a space.
>   V3: According to Dandan Bi's feedback, does not call
> SecureBootExtractConfigFromVariable() at last, but call it as needed.
>   And add more code for update IfrNvData->ListCount.
>   V2: Change code style to pass uncrustify check.
> 
>  .../SecureBootConfigImpl.c| 42 +++
>  1 file changed, 25 insertions(+), 17 deletions(-)
> 
> diff --git
> a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigIm
> pl.c
> b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigIm
> pl.c
> index 2c11129526..6d4560c39b 100644
> ---
> a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigIm
> pl.c
> +++ b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootCo
> +++ nfigImpl.c
> @@ -3366,6 +3366,8 @@ SecureBootExtractConfigFromVariable (
>  ConfigData->FileEnrollType = UNKNOWN_FILE_TYPE;   } +  ConfigData-
> >ListCount = Private->ListCount;+   //   // If it is Physical Presence User, 
> >set the
> PhysicalPresent to true.   //@@ -4541,12 +4543,13 @@ SecureBootCallback (
>EFI_HII_POPUP_PROTOCOL  *HiiPopup;   EFI_HII_POPUP_SELECTION
> UserSelection; -  Status = EFI_SUCCESS;-  SecureBootEnable   = 
> NULL;-
> SecureBootMode = NULL;-  SetupMode  = NULL;-  File   
> = NULL;-
> EnrollKeyErrorCode = None_Error;+  Status   = EFI_SUCCESS;+
> SecureBootEnable = NULL;+  SecureBootMode   = NULL;+  SetupMode
> = NULL;+  File = NULL;+  EnrollKeyErrorCode   = None_Error;+
> GetBrowserDataResult = FALSE;if ((This == NULL) || (Value == NULL) ||
> (ActionRequest == NULL)) { return EFI_INVALID_PARAMETER;@@ -4565,15
> +4568,12 @@ SecureBootCallback (
>  return EFI_OUT_OF_RESOURCES;   } -  GetBrowserDataResult =
> HiiGetBrowserData (,
> mSecureBootStorageName, BufferSize, (UINT8 *)IfrNvData);-   if (Action ==
> EFI_BROWSER_ACTION_FORM_OPEN) { if (QuestionId ==
> KEY_SECURE_BOOT_MODE) {   //   // Update secure boot strings when
> opening this form   //-  Status = UpdateSecureBootString (Private);-
> SecureBootExtractConfigFromVariable (Private, IfrNvData);+  Status
>  =
> UpdateSecureBootString (Private);   mIsEnterSecureBootForm = TRUE; } 
> else
> {   //@@ -4587,23 +4587,22 @@ SecureBootCallback (
>(QuestionId == KEY_SECURE_BOOT_DBT_OPTION))
> { CloseEnrolledFile (Private->FileContext);-  } else if 
> (QuestionId ==
> KEY_SECURE_BOOT_DELETE_ALL_LIST) {-//-// Update ListCount 
> field in
> varstore-// Button "Delete All Signature List" is-// enable 
> when ListCount
> is greater than 0.-//-IfrNvData->ListCount = 
> Private->ListCount;   } }
> goto EXIT;   } +  GetBrowserDataResult = HiiGetBrowserData
> (, mSecureBootStorageName, BufferSize,
> (UINT8 *)IfrNvData);+   if (Action == EFI_BROWSER_ACTION_RETRIEVE)
> { Status = EFI_UNSUPPORTED; if (QuestionId == KEY_SECURE_BOOT_MODE)
> {   if (mIsEnterSecureBootForm) {+if (GetBrowserDataResult) {+
> SecureBootExtractConfigFromVariable (Private, IfrNvData);+}+ 
> Value-
> >u8 = SECURE_BOOT_MODE_STANDARD; Status= EFI_SUCCESS;   }@@ -
> 4764,6 +4763,8 @@ SecureBootCallback (
>  L"Only Physical Presence User could delete PK in custom 
> mode!",
> NULL );+} else {+  
> SecureBootExtractConfigFromVariable
> (Private, IfrNvData); }   } }@@ -4827,6 +4828,7 

Re: [edk2-devel] [PATCH v4] SecurityPkg/SecureBootConfigDxe: Update UI according to UEFI spec

2024-04-06 Thread Dandan Bi
Reviewed-by: Dandan Bi 

-Original Message-
From: Tan, Ming  
Sent: Tuesday, April 2, 2024 4:32 PM
To: devel@edk2.groups.io
Cc: Xu, Min M ; Yao, Jiewen ; Bi, 
Dandan ; POLUDOV, FELIX 
Subject: [PATCH v4] SecurityPkg/SecureBootConfigDxe: Update UI according to 
UEFI spec

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4713

In UEFI_Spec_2_10_Aug29.pdf page 1694 section 35.5.4 for
EFI_BROWSER_ACTION_FORM_OPEN:
NOTE: EFI_FORM_BROWSER2_PROTOCOL.BrowserCallback() cannot be used with this 
browser action because question values have not been retrieved yet.

So should not call HiiGetBrowserData() and HiiSetBrowserData() in FORM_OPEN 
call back function.

Now call SecureBootExtractConfigFromVariable() and update
IfrNvData->ListCount to save the change to EFI variable, then HII use 
IfrNvData->EFI
variable to control the UI.

Cc: Min Xu 
Cc: Jiewen Yao 
Cc: Dandan Bi 
Cc: Felix Polyudov 
Signed-off-by: Ming Tan 
---
  PR: https://github.com/tianocore/edk2/pull/5411

  V4: Fix a Cc issue of miss a space.
  V3: According to Dandan Bi's feedback, does not call 
SecureBootExtractConfigFromVariable() at last, but call it as needed.
  And add more code for update IfrNvData->ListCount.
  V2: Change code style to pass uncrustify check.

 .../SecureBootConfigImpl.c| 42 +++
 1 file changed, 25 insertions(+), 17 deletions(-)

diff --git 
a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c 
b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c
index 2c11129526..6d4560c39b 100644
--- 
a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c
+++ b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootCo
+++ nfigImpl.c
@@ -3366,6 +3366,8 @@ SecureBootExtractConfigFromVariable (
 ConfigData->FileEnrollType = UNKNOWN_FILE_TYPE;   } +  
ConfigData->ListCount = Private->ListCount;+   //   // If it is Physical 
Presence User, set the PhysicalPresent to true.   //@@ -4541,12 +4543,13 @@ 
SecureBootCallback (
   EFI_HII_POPUP_PROTOCOL  *HiiPopup;   EFI_HII_POPUP_SELECTION 
UserSelection; -  Status = EFI_SUCCESS;-  SecureBootEnable   = 
NULL;-  SecureBootMode = NULL;-  SetupMode  = NULL;-  File  
 = NULL;-  EnrollKeyErrorCode = None_Error;+  Status   = 
EFI_SUCCESS;+  SecureBootEnable = NULL;+  SecureBootMode   = NULL;+  
SetupMode= NULL;+  File = NULL;+  
EnrollKeyErrorCode   = None_Error;+  GetBrowserDataResult = FALSE;if ((This 
== NULL) || (Value == NULL) || (ActionRequest == NULL)) { return 
EFI_INVALID_PARAMETER;@@ -4565,15 +4568,12 @@ SecureBootCallback (
 return EFI_OUT_OF_RESOURCES;   } -  GetBrowserDataResult = 
HiiGetBrowserData (, mSecureBootStorageName, 
BufferSize, (UINT8 *)IfrNvData);-   if (Action == EFI_BROWSER_ACTION_FORM_OPEN) 
{ if (QuestionId == KEY_SECURE_BOOT_MODE) {   //   // Update secure 
boot strings when opening this form   //-  Status = 
UpdateSecureBootString (Private);-  SecureBootExtractConfigFromVariable 
(Private, IfrNvData);+  Status = UpdateSecureBootString 
(Private);   mIsEnterSecureBootForm = TRUE; } else {   //@@ 
-4587,23 +4587,22 @@ SecureBootCallback (
   (QuestionId == KEY_SECURE_BOOT_DBT_OPTION))   { 
CloseEnrolledFile (Private->FileContext);-  } else if (QuestionId == 
KEY_SECURE_BOOT_DELETE_ALL_LIST) {-//-// Update ListCount field 
in varstore-// Button "Delete All Signature List" is-// enable 
when ListCount is greater than 0.-//-IfrNvData->ListCount = 
Private->ListCount;   } }  goto EXIT;   } +  GetBrowserDataResult = 
HiiGetBrowserData (, mSecureBootStorageName, 
BufferSize, (UINT8 *)IfrNvData);+   if (Action == EFI_BROWSER_ACTION_RETRIEVE) 
{ Status = EFI_UNSUPPORTED; if (QuestionId == KEY_SECURE_BOOT_MODE) {   
if (mIsEnterSecureBootForm) {+if (GetBrowserDataResult) {+  
SecureBootExtractConfigFromVariable (Private, IfrNvData);+}+ 
Value->u8 = SECURE_BOOT_MODE_STANDARD; Status= EFI_SUCCESS;   
}@@ -4764,6 +4763,8 @@ SecureBootCallback (
 L"Only Physical Presence User could delete PK in custom 
mode!", NULL );+} else {+   
   SecureBootExtractConfigFromVariable (Private, IfrNvData); }  
 } }@@ -4827,6 +4828,7 @@ SecureBootCallback (
   SECUREBOOT_DELETE_SIGNATURE_LIST_FORM,   
OPTION_SIGNATURE_LIST_QUESTION_ID   );+IfrNvData->ListCount = 
Private->ListCount; break;//@@ -4851,6 +4853,7 @@ 
SecureBootCallback (
   SECUREBOOT_DELETE_SIGNATURE_LIST_FORM,   
OPTION_SIGNATURE_LIST_QUESTION_ID   );+IfrNvData->ListCount = 
Private->ListCount; break;//@@ -4875,6 

Re: [edk2-devel] [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to avoid using ACPI reclaim memory

2024-04-06 Thread Aaron Li
Hi Liming,

Can you help merge the patch? Thanks.

Best,
Aaron

-Original Message-
From: gaoliming  
Sent: Tuesday, April 2, 2024 9:26 AM
To: devel@edk2.groups.io; Li, Aaron 
Cc: Bi, Dandan ; Liu, Yun Y ; Yao, 
Jiewen ; Ni, Ray ; Kinney, Michael D 
; Liu, Zhiguang 
Subject: 回复: [edk2-devel] [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch 
to avoid using ACPI reclaim memory

Aaron:
  Per the specification, it is valid to publish all ACPI table in
EfiAcpiMemoryNVS. 
  So, I have no other comments for this patch. Reviewed-by: Liming Gao


Thanks
Liming
> -邮件原件-
> 发件人: devel@edk2.groups.io  代表 Aaron Li
> 发送时间: 2024年4月1日 10:32
> 收件人: devel@edk2.groups.io; Liming Gao 
> 抄送: Bi, Dandan ; Liu, Yun Y ;
> Yao, Jiewen ; Ni, Ray ; Kinney,
> Michael D ; Liu, Zhiguang
> 
> 主题: Re: [edk2-devel] [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD
> switch to avoid using ACPI reclaim memory
> 
> Hi Liming,
> 
> Could you please help review and merge it? Thanks.
> 
> Best,
> Aaron
> 
> -Original Message-
> From: Liu, Zhiguang 
> Sent: Monday, April 1, 2024 10:06 AM
> To: Li, Aaron ; devel@edk2.groups.io
> Cc: Bi, Dandan ; Liming Gao
> ; Liu, Yun Y ; Yao, Jiewen
> ; Ni, Ray ; Kinney, Michael D
> 
> Subject: RE: [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to
> avoid using ACPI reclaim memory
> 
> Reviewed-by: Zhiguang Liu 
> 
> > -Original Message-
> > From: Li, Aaron 
> > Sent: Tuesday, March 26, 2024 3:58 PM
> > To: devel@edk2.groups.io
> > Cc: Liu, Zhiguang ; Bi, Dandan
> > ; Liming Gao ; Liu, Yun
> Y
> > ; Yao, Jiewen ; Ni, Ray
> > ; Kinney, Michael D 
> > Subject: [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to avoid
> > using ACPI reclaim memory
> >
> > UEFI spec defined ACPI Tables at boot time can be contained in memory of
> > type EfiACPIReclaimMemory or EfiAcpiMemoryNVS, although
> InstallAcpiTable
> > with AcpiTableProtocol will only allocate memory with type
> > EfiACPIReclaimMemory (Except FACS).
> >
> > This patch provides an optional method controlled by PCD to avoid using
> > EfiACPIReclaimMemory, by setting the PCD PcdNoACPIReclaimMemory to
> > TRUE, all ACPI allocated memory will use EfiAcpiMemoryNVS instead.
> >
> > Cc: Zhiguang Liu 
> > Cc: Dandan Bi 
> > Cc: Liming Gao 
> > Cc: Liu Yun 
> > Cc: Jiewen Yao 
> > Cc: Ray Ni 
> > Cc: Michael D Kinney 
> > Signed-off-by: Aaron Li 
> > ---
> >  MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c | 37
> > +++-
> >  MdeModulePkg/MdeModulePkg.dec
> |  7 
> >  MdeModulePkg/MdeModulePkg.uni
> |  8 +
> >  MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf|  1
> +
> >  4 files changed, 45 insertions(+), 8 deletions(-)
> >
> > diff --git
> a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
> > b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
> > index e09bc9b704f5..080768033cfa 100644
> > --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
> > +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
> > @@ -340,6 +340,7 @@ ReallocateAcpiTableBuffer (
> >EFI_ACPI_TABLE_INSTANCE  TempPrivateData;
> >EFI_STATUS   Status;
> >UINT64   CurrentData;
> > +  EFI_MEMORY_TYPE  AcpiAllocateMemoryType;
> >
> >CopyMem (, AcpiTableInstance, sizeof
> > (EFI_ACPI_TABLE_INSTANCE));
> >//
> > @@ -359,6 +360,12 @@ ReallocateAcpiTableBuffer (
> >   NewMaxTableNumber * sizeof (UINT32);
> >}
> >
> > +  if (PcdGetBool (PcdNoACPIReclaimMemory)) {
> > +AcpiAllocateMemoryType = EfiACPIMemoryNVS;  } else {
> > +AcpiAllocateMemoryType = EfiACPIReclaimMemory;  }
> > +
> >if (mAcpiTableAllocType != AllocateAnyPages) {
> >  //
> >  // Allocate memory in the lower 32 bit of address range for @@
> -372,13
> > +379,13 @@ ReallocateAcpiTableBuffer (
> >  PageAddress = 0x;
> >  Status  = gBS->AllocatePages (
> >   mAcpiTableAllocType,
> > - EfiACPIReclaimMemory,
> > + AcpiAllocateMemoryType,
> >   EFI_SIZE_TO_PAGES (TotalSize),
> >   
> >   );
> >} else {
> >  Status = gBS->AllocatePool (
> > -EfiACPIReclaimMemory,
> > +AcpiAllocateMemoryType,
> >  TotalSize,
> >  (VOID **)
> >  );
> > @@ -512,6 +519,7 @@ AddTableToList (
> >EFI_PHYSICAL_ADDRESS  AllocPhysAddress;
> >UINT64Buffer64;
> >BOOLEAN   AddToRsdt;
> > +  EFI_MEMORY_TYPE   AcpiAllocateMemoryType;
> >
> >//
> >// Check for invalid input parameters @@ -550,6 +558,12 @@
> > AddTableToList (
> >CurrentTableList->TableSize  = CurrentTableSize;
> >CurrentTableList->PoolAllocation = FALSE;
> >
> > +  if (PcdGetBool (PcdNoACPIReclaimMemory)) {
> > +AcpiAllocateMemoryType = 

[edk2-devel] [PATCH v2] NetworkPkg/HttpBootDxe: Correctly uninstall HttpBootCallbackProtocol

2024-04-06 Thread Mike Beaton
The existing uninstall call was passing the wrong handle (parent object,
not the correct child object) and additionally passing the address
of a pointer to the interface to be removed rather than the pointer
itself, so always failed with EFI_NOT_FOUND.

While it might seem attractive to ASSERT to ensure that the uninstall
proceeds as expected, uninstallation of protocol interfaces is allowed
to fail under the UEFI model. An ASSERT could therefore result in a
sequence of events which is perfectly valid - or at least is out of
the control of this driver - resulting in an ASSERT() failure.

Cc: Michael Brown 
Cc: Maciej Rabeda 
Cc: Jiaxin Wu 
Signed-off-by: Mike Beaton 

xyz
---
 NetworkPkg/HttpBootDxe/HttpBootImpl.c | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootImpl.c 
b/NetworkPkg/HttpBootDxe/HttpBootImpl.c
index b4c61925b9..f78eef4a83 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootImpl.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootImpl.c
@@ -77,11 +77,19 @@ HttpBootUninstallCallback (
   IN HTTP_BOOT_PRIVATE_DATA  *Private
   )
 {
+  EFI_HANDLE  ControllerHandle;
+
   if (Private->HttpBootCallback == >LoadFileCallback) {
+if (!Private->UsingIpv6) {
+  ControllerHandle = Private->Ip4Nic->Controller;
+} else {
+  ControllerHandle = Private->Ip6Nic->Controller;
+}
+
 gBS->UninstallProtocolInterface (
-   Private->Controller,
+   ControllerHandle,
,
-   >HttpBootCallback
+   Private->HttpBootCallback
);
 Private->HttpBootCallback = NULL;
   }
-- 
2.44.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117470): https://edk2.groups.io/g/devel/message/117470
Mute This Topic: https://groups.io/mt/105371091/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH] NetworkPkg/HttpBootDxe: Correctly uninstall HttpBootCallbackProtocol

2024-04-06 Thread Michael Brown

On 06/04/2024 16:53, Mike Beaton wrote:

The existing uninstall call was passing the wrong handle (parent object,
not the correct child object) and additionally passing the address
of a pointer to the interface to be removed rather than the pointer
itself, so always failed with EFI_NOT_FOUND. After altering these, we
add an ASSERT which confirms that the modified uninstall is succeeding.

Cc: Maciej Rabeda 
Cc: Jiaxin Wu 
Cc: Siyuan Fu 
Signed-off-by: Mike Beaton 
---
  NetworkPkg/HttpBootDxe/HttpBootImpl.c | 21 -
  1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootImpl.c 
b/NetworkPkg/HttpBootDxe/HttpBootImpl.c
index b4c61925b9..100b721ad4 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootImpl.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootImpl.c
@@ -77,12 +77,23 @@ HttpBootUninstallCallback (
IN HTTP_BOOT_PRIVATE_DATA  *Private
)
  {
+  EFI_STATUS  Status;
+  EFI_HANDLE  ControllerHandle;
+
if (Private->HttpBootCallback == >LoadFileCallback) {
-gBS->UninstallProtocolInterface (
-   Private->Controller,
-   ,
-   >HttpBootCallback
-   );
+if (!Private->UsingIpv6) {
+  ControllerHandle = Private->Ip4Nic->Controller;
+} else {
+  ControllerHandle = Private->Ip6Nic->Controller;
+}
+
+Status = gBS->UninstallProtocolInterface (
+ControllerHandle,
+,
+Private->HttpBootCallback
+);
+ASSERT_EFI_ERROR (Status);


This assertion is not necessarily safe.  Uninstallation of protocol 
interfaces is allowed to fail under the UEFI model.  (This is arguably 
insane, but that's a separate discussion.)  This could therefore 
potentially result in a perfectly valid sequence of events leading to an 
ASSERT() failure.


Thanks,

Michael



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117469): https://edk2.groups.io/g/devel/message/117469
Mute This Topic: https://groups.io/mt/105368366/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] NetworkPkg/HttpBootDxe: Correctly uninstall HttpBootCallbackProtocol

2024-04-06 Thread Mike Beaton
The existing uninstall call was passing the wrong handle (parent object,
not the correct child object) and additionally passing the address
of a pointer to the interface to be removed rather than the pointer
itself, so always failed with EFI_NOT_FOUND. After altering these, we
add an ASSERT which confirms that the modified uninstall is succeeding.

Cc: Maciej Rabeda 
Cc: Jiaxin Wu 
Cc: Siyuan Fu 
Signed-off-by: Mike Beaton 
---
 NetworkPkg/HttpBootDxe/HttpBootImpl.c | 21 -
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootImpl.c 
b/NetworkPkg/HttpBootDxe/HttpBootImpl.c
index b4c61925b9..100b721ad4 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootImpl.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootImpl.c
@@ -77,12 +77,23 @@ HttpBootUninstallCallback (
   IN HTTP_BOOT_PRIVATE_DATA  *Private
   )
 {
+  EFI_STATUS  Status;
+  EFI_HANDLE  ControllerHandle;
+
   if (Private->HttpBootCallback == >LoadFileCallback) {
-gBS->UninstallProtocolInterface (
-   Private->Controller,
-   ,
-   >HttpBootCallback
-   );
+if (!Private->UsingIpv6) {
+  ControllerHandle = Private->Ip4Nic->Controller;
+} else {
+  ControllerHandle = Private->Ip6Nic->Controller;
+}
+
+Status = gBS->UninstallProtocolInterface (
+ControllerHandle,
+,
+Private->HttpBootCallback
+);
+ASSERT_EFI_ERROR (Status);
+
 Private->HttpBootCallback = NULL;
   }
 }
-- 
2.44.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117468): https://edk2.groups.io/g/devel/message/117468
Mute This Topic: https://groups.io/mt/105368366/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v2 1/1] OvmfPkg: OVMF supports USB mouses

2024-04-06 Thread Heinrich Schuchardt
From: Phillip Tennen 

From: Phillip Tennen 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4747

UsbMouseDxe was missing from the OVMF build description, so=20
the Simple Pointer Protocol wasn't usable from within QEMU.

Here's an example of someone getting tripped up by this:
https://forum.osdev.org/viewtopic.php?f=1=31572.

Signed-off-by: Phillip Tennen 
Reviewed-by: Heinrich Schuchardt 
---
v2:
fix formatting problems leading to the patch not being applicable
move both insertions below UsbKbDxe
update commit message
---
 OvmfPkg/OvmfPkgX64.dsc | 1 +
 OvmfPkg/OvmfPkgX64.fdf | 1 +
 2 files changed, 2 insertions(+)

diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 56c920168d25..b775db6e0919 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -952,6 +952,7 @@ [Components]
   MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
   MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf
   MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
+  MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf
   MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
 
 !include OvmfPkg/Include/Dsc/ShellComponents.dsc.inc
diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
index eb3fb90cb8b6..bfe201a352d0 100644
--- a/OvmfPkg/OvmfPkgX64.fdf
+++ b/OvmfPkg/OvmfPkgX64.fdf
@@ -342,6 +342,7 @@ [FV.DXEFV]
 INF  MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
 INF  MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf
 INF  MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
+INF  MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf
 INF  MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
 
 INF  OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf
-- 
2.43.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117467): https://edk2.groups.io/g/devel/message/117467
Mute This Topic: https://groups.io/mt/105365480/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-