Re: [edk2] [PATCH v2 3/4] MdePkg/UefiLib: Simplify protocol un/installation abstraction

2019-01-06 Thread Ashish Singhal
Hello Liming,

I am not touching APIs for Install and am OK keeping Uninstall API same as what 
I had in patch 1/4. I thought it would be easier for the developer to keep the 
interface similar to install but I do not have a strong preference either way. 
If you are OK with the Uninstall API as in patch 1/4, I am OK submitting a new 
patch where I can squash 1/4 and 3/4 together into a single commit and keep API 
as in 1/4.

Thanks
Ashish

-Original Message-
From: Gao, Liming  
Sent: Sunday, January 6, 2019 5:33 PM
To: Ashish Singhal ; edk2-devel@lists.01.org
Subject: RE: [edk2] [PATCH v2 3/4] MdePkg/UefiLib: Simplify protocol 
un/installation abstraction

Ashish:
  UefiLib implementation simplification doesn't require to change library APIs. 
UninstallApi() interfaces are not required to be updated. Below Install API can 
still be kept. I don't think we need to keep the same interfaces for Install 
and Uninstall APIs. 

EfiLibUninstallAllDriverProtocols2 (
  IN EFI_DRIVER_BINDING_PROTOCOL  *DriverBinding,
  IN CONST EFI_COMPONENT_NAME_PROTOCOL*ComponentName,OPTIONAL
  IN CONST EFI_COMPONENT_NAME2_PROTOCOL   *ComponentName2,   OPTIONAL
  IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL  *DriverConfiguration,  OPTIONAL
  IN CONST EFI_DRIVER_CONFIGURATION2_PROTOCOL *DriverConfiguration2, OPTIONAL
  IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL*DriverDiagnostics,OPTIONAL
  IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL   *DriverDiagnostics2OPTIONAL
  );

Thanks
Liming
>-Original Message-
>From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
>Ashish Singhal
>Sent: Saturday, January 05, 2019 7:07 AM
>To: edk2-devel@lists.01.org
>Cc: Ashish Singhal 
>Subject: [edk2] [PATCH v2 3/4] MdePkg/UefiLib: Simplify protocol
>un/installation abstraction
>
>Add a helper function to operate upon protocol installation and
>uninstallation instead of every function doing it by itself.
>
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Ashish Singhal 
>---
> MdePkg/Include/Library/UefiLib.h |   26 +-
> MdePkg/Library/UefiLib/UefiDriverModel.c | 1980 --
> 2 files changed, 270 insertions(+), 1736 deletions(-)
>
>diff --git a/MdePkg/Include/Library/UefiLib.h
>b/MdePkg/Include/Library/UefiLib.h
>index 08222d4..fbc9739 100644
>--- a/MdePkg/Include/Library/UefiLib.h
>+++ b/MdePkg/Include/Library/UefiLib.h
>@@ -1323,7 +1323,10 @@ EfiLibInstallDriverBinding (
>   If DriverBinding is NULL, then ASSERT().
>   If DriverBinding can not be uninstalled, then ASSERT().
>
>+  @param  ImageHandle  The image handle of the driver.
>+  @param  SystemTable  The EFI System Table that was passed to the
>driver's entry point.
>   @param  DriverBindingA Driver Binding Protocol instance that this 
> driver
>produced.
>+  @param  DriverBindingHandle  The handle that DriverBinding is to be
>installed onto.
>
>   @retval EFI_SUCCESS   The protocol uninstallation successfully
>completed.
>   @retval OthersStatus from gBS-
>>UninstallMultipleProtocolInterfaces().
>@@ -1332,7 +1335,10 @@ EfiLibInstallDriverBinding (
> EFI_STATUS
> EFIAPI
> EfiLibUninstallDriverBinding (
>-  IN EFI_DRIVER_BINDING_PROTOCOL  *DriverBinding
>+  IN CONST EFI_HANDLE ImageHandle,
>+  IN CONST EFI_SYSTEM_TABLE   *SystemTable,
>+  IN EFI_DRIVER_BINDING_PROTOCOL  *DriverBinding,
>+  IN EFI_HANDLE   DriverBindingHandle
>   );
>
>
>@@ -1382,7 +1388,10 @@ EfiLibInstallAllDriverProtocols (
>   If DriverBinding is NULL, then ASSERT().
>   If the uninstallation fails, then ASSERT().
>
>+  @param  ImageHandle  The image handle of the driver.
>+  @param  SystemTable  The EFI System Table that was passed to the
>driver's entry point.
>   @param  DriverBindingA Driver Binding Protocol instance that this 
> driver
>produced.
>+  @param  DriverBindingHandle  The handle that DriverBinding is to be
>installed onto.
>   @param  ComponentNameA Component Name Protocol instance that
>this driver produced.
>   @param  DriverConfiguration  A Driver Configuration Protocol instance that
>this driver produced.
>   @param  DriverDiagnosticsA Driver Diagnostics Protocol instance that 
> this
>driver produced.
>@@ -1394,7 +1403,10 @@ EfiLibInstallAllDriverProtocols (
> EFI_STATUS
> EFIAPI
> EfiLibUninstallAllDriverProtocols (
>+  IN CONST EFI_HANDLE ImageHandle,
>+  IN CONST EFI_SYSTEM_TABLE   *SystemTable,
>   IN EFI_DRIVER_BINDING_PROTOCOL  *DriverBinding,
>+  IN EFI_HANDLE   DriverBindingHandle,
>   IN CONST EFI_COMPONENT_NA

Re: [edk2] [PATCH v2 3/4] MdePkg/UefiLib: Simplify protocol un/installation abstraction

2019-01-06 Thread Gao, Liming
Ashish:
  UefiLib implementation simplification doesn't require to change library APIs. 
UninstallApi() interfaces are not required to be updated. Below Install API can 
still be kept. I don't think we need to keep the same interfaces for Install 
and Uninstall APIs. 

EfiLibUninstallAllDriverProtocols2 (
  IN EFI_DRIVER_BINDING_PROTOCOL  *DriverBinding,
  IN CONST EFI_COMPONENT_NAME_PROTOCOL*ComponentName,OPTIONAL
  IN CONST EFI_COMPONENT_NAME2_PROTOCOL   *ComponentName2,   OPTIONAL
  IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL  *DriverConfiguration,  OPTIONAL
  IN CONST EFI_DRIVER_CONFIGURATION2_PROTOCOL *DriverConfiguration2, OPTIONAL
  IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL*DriverDiagnostics,OPTIONAL
  IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL   *DriverDiagnostics2OPTIONAL
  );

Thanks
Liming
>-Original Message-
>From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
>Ashish Singhal
>Sent: Saturday, January 05, 2019 7:07 AM
>To: edk2-devel@lists.01.org
>Cc: Ashish Singhal 
>Subject: [edk2] [PATCH v2 3/4] MdePkg/UefiLib: Simplify protocol
>un/installation abstraction
>
>Add a helper function to operate upon protocol installation and
>uninstallation instead of every function doing it by itself.
>
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Ashish Singhal 
>---
> MdePkg/Include/Library/UefiLib.h |   26 +-
> MdePkg/Library/UefiLib/UefiDriverModel.c | 1980 --
> 2 files changed, 270 insertions(+), 1736 deletions(-)
>
>diff --git a/MdePkg/Include/Library/UefiLib.h
>b/MdePkg/Include/Library/UefiLib.h
>index 08222d4..fbc9739 100644
>--- a/MdePkg/Include/Library/UefiLib.h
>+++ b/MdePkg/Include/Library/UefiLib.h
>@@ -1323,7 +1323,10 @@ EfiLibInstallDriverBinding (
>   If DriverBinding is NULL, then ASSERT().
>   If DriverBinding can not be uninstalled, then ASSERT().
>
>+  @param  ImageHandle  The image handle of the driver.
>+  @param  SystemTable  The EFI System Table that was passed to the
>driver's entry point.
>   @param  DriverBindingA Driver Binding Protocol instance that this 
> driver
>produced.
>+  @param  DriverBindingHandle  The handle that DriverBinding is to be
>installed onto.
>
>   @retval EFI_SUCCESS   The protocol uninstallation successfully
>completed.
>   @retval OthersStatus from gBS-
>>UninstallMultipleProtocolInterfaces().
>@@ -1332,7 +1335,10 @@ EfiLibInstallDriverBinding (
> EFI_STATUS
> EFIAPI
> EfiLibUninstallDriverBinding (
>-  IN EFI_DRIVER_BINDING_PROTOCOL  *DriverBinding
>+  IN CONST EFI_HANDLE ImageHandle,
>+  IN CONST EFI_SYSTEM_TABLE   *SystemTable,
>+  IN EFI_DRIVER_BINDING_PROTOCOL  *DriverBinding,
>+  IN EFI_HANDLE   DriverBindingHandle
>   );
>
>
>@@ -1382,7 +1388,10 @@ EfiLibInstallAllDriverProtocols (
>   If DriverBinding is NULL, then ASSERT().
>   If the uninstallation fails, then ASSERT().
>
>+  @param  ImageHandle  The image handle of the driver.
>+  @param  SystemTable  The EFI System Table that was passed to the
>driver's entry point.
>   @param  DriverBindingA Driver Binding Protocol instance that this 
> driver
>produced.
>+  @param  DriverBindingHandle  The handle that DriverBinding is to be
>installed onto.
>   @param  ComponentNameA Component Name Protocol instance that
>this driver produced.
>   @param  DriverConfiguration  A Driver Configuration Protocol instance that
>this driver produced.
>   @param  DriverDiagnosticsA Driver Diagnostics Protocol instance that 
> this
>driver produced.
>@@ -1394,7 +1403,10 @@ EfiLibInstallAllDriverProtocols (
> EFI_STATUS
> EFIAPI
> EfiLibUninstallAllDriverProtocols (
>+  IN CONST EFI_HANDLE ImageHandle,
>+  IN CONST EFI_SYSTEM_TABLE   *SystemTable,
>   IN EFI_DRIVER_BINDING_PROTOCOL  *DriverBinding,
>+  IN EFI_HANDLE   DriverBindingHandle,
>   IN CONST EFI_COMPONENT_NAME_PROTOCOL*ComponentName,
>OPTIONAL
>   IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL  *DriverConfiguration,
>OPTIONAL
>   IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL*DriverDiagnostics
>OPTIONAL
>@@ -1442,7 +1454,10 @@ EfiLibInstallDriverBindingComponentName2 (
>   If DriverBinding is NULL, then ASSERT().
>   If the uninstallation fails, then ASSERT().
>
>+  @param  ImageHandle  The image handle of the driver.
>+  @param  SystemTable  The EFI System Table that was passed to the
>driver's entry point.
>   @param  DriverBindingA Driver Binding Protocol instance that this 
> driver
>

[edk2] [PATCH v2 3/4] MdePkg/UefiLib: Simplify protocol un/installation abstraction

2019-01-04 Thread Ashish Singhal
Add a helper function to operate upon protocol installation and
uninstallation instead of every function doing it by itself.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ashish Singhal 
---
 MdePkg/Include/Library/UefiLib.h |   26 +-
 MdePkg/Library/UefiLib/UefiDriverModel.c | 1980 --
 2 files changed, 270 insertions(+), 1736 deletions(-)

diff --git a/MdePkg/Include/Library/UefiLib.h b/MdePkg/Include/Library/UefiLib.h
index 08222d4..fbc9739 100644
--- a/MdePkg/Include/Library/UefiLib.h
+++ b/MdePkg/Include/Library/UefiLib.h
@@ -1323,7 +1323,10 @@ EfiLibInstallDriverBinding (
   If DriverBinding is NULL, then ASSERT().
   If DriverBinding can not be uninstalled, then ASSERT().
 
+  @param  ImageHandle  The image handle of the driver.
+  @param  SystemTable  The EFI System Table that was passed to the 
driver's entry point.
   @param  DriverBindingA Driver Binding Protocol instance that this 
driver produced.
+  @param  DriverBindingHandle  The handle that DriverBinding is to be 
installed onto.
 
   @retval EFI_SUCCESS   The protocol uninstallation successfully 
completed.
   @retval OthersStatus from 
gBS->UninstallMultipleProtocolInterfaces().
@@ -1332,7 +1335,10 @@ EfiLibInstallDriverBinding (
 EFI_STATUS
 EFIAPI
 EfiLibUninstallDriverBinding (
-  IN EFI_DRIVER_BINDING_PROTOCOL  *DriverBinding
+  IN CONST EFI_HANDLE ImageHandle,
+  IN CONST EFI_SYSTEM_TABLE   *SystemTable,
+  IN EFI_DRIVER_BINDING_PROTOCOL  *DriverBinding,
+  IN EFI_HANDLE   DriverBindingHandle
   );
 
 
@@ -1382,7 +1388,10 @@ EfiLibInstallAllDriverProtocols (
   If DriverBinding is NULL, then ASSERT().
   If the uninstallation fails, then ASSERT().
 
+  @param  ImageHandle  The image handle of the driver.
+  @param  SystemTable  The EFI System Table that was passed to the 
driver's entry point.
   @param  DriverBindingA Driver Binding Protocol instance that this 
driver produced.
+  @param  DriverBindingHandle  The handle that DriverBinding is to be 
installed onto.
   @param  ComponentNameA Component Name Protocol instance that this 
driver produced.
   @param  DriverConfiguration  A Driver Configuration Protocol instance that 
this driver produced.
   @param  DriverDiagnosticsA Driver Diagnostics Protocol instance that 
this driver produced.
@@ -1394,7 +1403,10 @@ EfiLibInstallAllDriverProtocols (
 EFI_STATUS
 EFIAPI
 EfiLibUninstallAllDriverProtocols (
+  IN CONST EFI_HANDLE ImageHandle,
+  IN CONST EFI_SYSTEM_TABLE   *SystemTable,
   IN EFI_DRIVER_BINDING_PROTOCOL  *DriverBinding,
+  IN EFI_HANDLE   DriverBindingHandle,
   IN CONST EFI_COMPONENT_NAME_PROTOCOL*ComponentName,   OPTIONAL
   IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL  *DriverConfiguration, OPTIONAL
   IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL*DriverDiagnosticsOPTIONAL
@@ -1442,7 +1454,10 @@ EfiLibInstallDriverBindingComponentName2 (
   If DriverBinding is NULL, then ASSERT().
   If the uninstallation fails, then ASSERT().
 
+  @param  ImageHandle  The image handle of the driver.
+  @param  SystemTable  The EFI System Table that was passed to the 
driver's entry point.
   @param  DriverBindingA Driver Binding Protocol instance that this 
driver produced.
+  @param  DriverBindingHandle  The handle that DriverBinding is to be 
installed onto.
   @param  ComponentNameA Component Name Protocol instance that this 
driver produced.
   @param  ComponentName2   A Component Name 2 Protocol instance that this 
driver produced.
 
@@ -1453,7 +1468,10 @@ EfiLibInstallDriverBindingComponentName2 (
 EFI_STATUS
 EFIAPI
 EfiLibUninstallDriverBindingComponentName2 (
+  IN CONST EFI_HANDLE ImageHandle,
+  IN CONST EFI_SYSTEM_TABLE   *SystemTable,
   IN EFI_DRIVER_BINDING_PROTOCOL  *DriverBinding,
+  IN EFI_HANDLE   DriverBindingHandle,
   IN CONST EFI_COMPONENT_NAME_PROTOCOL*ComponentName,   OPTIONAL
   IN CONST EFI_COMPONENT_NAME2_PROTOCOL   *ComponentName2   OPTIONAL
   );
@@ -1512,7 +1530,10 @@ EfiLibInstallAllDriverProtocols2 (
   If the installation fails, then ASSERT().
 
 
+  @param  ImageHandle   The image handle of the driver.
+  @param  SystemTable   The EFI System Table that was passed to the 
driver's entry point.
   @param  DriverBinding A Driver Binding Protocol instance that this 
driver produced.
+  @param  DriverBindingHandle   The handle that DriverBinding is to be 
installed onto.
   @param  ComponentName A Component Name Protocol instance that this 
driver produced.
   @param  ComponentName2A Component Name 2 Protocol instance that this 
driver produced.
   @param  DriverConfiguration   A Driver Configuration Protocol insta