public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 0/4] Provide UEFILib functions for protocol uninstallation.
@ 2019-01-04 23:06 Ashish Singhal
  2019-01-04 23:06 ` [PATCH v2 1/4] MdePkg/UefiLib: Abstract driver model " Ashish Singhal
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Ashish Singhal @ 2019-01-04 23:06 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ashish Singhal

An issue was seen in IScsiDxe in NetworkPkg where driver cleanup after
initialization failure was not done right. Bug 1428 was filed in this regard.
As per discussions with Mike, it was also discussed that having UEFILib
provide protocol uninstallation abstraction would help to avoid these
issues in the future. Bug 1429 was found to track this. The first 2 patches
take care of this.

Patch number 3 simplifies the UEFILib protocol installation and
uninstallation abstraction by adding a helper function doing operations
instead of every public function.

Patch set 4 uses the updated uninstallation interfaces as a result of patch 3.


Ashish Singhal (4):
  MdePkg/UefiLib: Abstract driver model protocol uninstallation
  NetworkPkg/IScsiDxe: Use UEFILib APIs to uninstall protocols.
  MdePkg/UefiLib: Simplify protocol un/installation abstraction
  NetworkPkg/IScsiDxe: Update UEFILib Usage

 MdePkg/Include/Library/UefiLib.h         |  127 ++++
 MdePkg/Library/UefiLib/UefiDriverModel.c | 1210 +++++++++---------------------
 NetworkPkg/IScsiDxe/IScsiDriver.c        |   37 +-
 3 files changed, 489 insertions(+), 885 deletions(-)

-- 
2.7.4



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 1/4] MdePkg/UefiLib: Abstract driver model protocol uninstallation
  2019-01-04 23:06 [PATCH v2 0/4] Provide UEFILib functions for protocol uninstallation Ashish Singhal
@ 2019-01-04 23:06 ` Ashish Singhal
  2019-01-04 23:06 ` [PATCH v2 2/4] NetworkPkg/IScsiDxe: Use UEFILib APIs to uninstall protocols Ashish Singhal
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Ashish Singhal @ 2019-01-04 23:06 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ashish Singhal

Provided functions in UEFILib that abstract driver model protocol
uninstallation. This helps drivers to install and uninstall protocols
using a library to keep things seemless.

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

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ashish Singhal <ashishsingha@nvidia.com>
---
 MdePkg/Include/Library/UefiLib.h         | 103 ++++
 MdePkg/Library/UefiLib/UefiDriverModel.c | 972 ++++++++++++++++++++++++++++++-
 2 files changed, 1074 insertions(+), 1 deletion(-)

diff --git a/MdePkg/Include/Library/UefiLib.h b/MdePkg/Include/Library/UefiLib.h
index 468bffc..08222d4 100644
--- a/MdePkg/Include/Library/UefiLib.h
+++ b/MdePkg/Include/Library/UefiLib.h
@@ -12,6 +12,7 @@
   of size reduction when compiler optimization is disabled. If MDEPKG_NDEBUG is
   defined, then debug and assert related macros wrapped by it are the NULL implementations.
 
+Copyright (c) 2019, NVIDIA Corporation. All rights reserved.
 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under
 the terms and conditions of the BSD License that accompanies this distribution.
@@ -1283,6 +1284,7 @@ AsciiPrintXY (
   ...
   );
 
+
 /**
   Installs and completes the initialization of a Driver Binding Protocol instance.
 
@@ -1316,6 +1318,25 @@ EfiLibInstallDriverBinding (
 
 
 /**
+  Uninstalls a Driver Binding Protocol instance.
+
+  If DriverBinding is NULL, then ASSERT().
+  If DriverBinding can not be uninstalled, then ASSERT().
+
+  @param  DriverBinding        A Driver Binding Protocol instance that this driver produced.
+
+  @retval EFI_SUCCESS           The protocol uninstallation successfully completed.
+  @retval Others                Status from gBS->UninstallMultipleProtocolInterfaces().
+
+**/
+EFI_STATUS
+EFIAPI
+EfiLibUninstallDriverBinding (
+  IN EFI_DRIVER_BINDING_PROTOCOL  *DriverBinding
+  );
+
+
+/**
   Installs and completes the initialization of a Driver Binding Protocol instance and
   optionally installs the Component Name, Driver Configuration and Driver Diagnostics Protocols.
 
@@ -1354,6 +1375,31 @@ EfiLibInstallAllDriverProtocols (
   );
 
 
+/**
+  Uninstalls a Driver Binding Protocol instance and optionally uninstalls the
+  Component Name, Driver Configuration and Driver Diagnostics Protocols.
+
+  If DriverBinding is NULL, then ASSERT().
+  If the uninstallation fails, then ASSERT().
+
+  @param  DriverBinding        A Driver Binding Protocol instance that this driver produced.
+  @param  ComponentName        A Component Name Protocol instance that this driver produced.
+  @param  DriverConfiguration  A Driver Configuration Protocol instance that this driver produced.
+  @param  DriverDiagnostics    A Driver Diagnostics Protocol instance that this driver produced.
+
+  @retval EFI_SUCCESS           The protocol uninstallation successfully completed.
+  @retval Others                Status from gBS->UninstallMultipleProtocolInterfaces().
+
+**/
+EFI_STATUS
+EFIAPI
+EfiLibUninstallAllDriverProtocols (
+  IN EFI_DRIVER_BINDING_PROTOCOL              *DriverBinding,
+  IN CONST EFI_COMPONENT_NAME_PROTOCOL        *ComponentName,       OPTIONAL
+  IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL  *DriverConfiguration, OPTIONAL
+  IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL    *DriverDiagnostics    OPTIONAL
+  );
+
 
 /**
   Installs Driver Binding Protocol with optional Component Name and Component Name 2 Protocols.
@@ -1391,6 +1437,29 @@ EfiLibInstallDriverBindingComponentName2 (
 
 
 /**
+  Uninstalls Driver Binding Protocol with optional Component Name and Component Name 2 Protocols.
+
+  If DriverBinding is NULL, then ASSERT().
+  If the uninstallation fails, then ASSERT().
+
+  @param  DriverBinding        A Driver Binding Protocol instance that this driver produced.
+  @param  ComponentName        A Component Name Protocol instance that this driver produced.
+  @param  ComponentName2       A Component Name 2 Protocol instance that this driver produced.
+
+  @retval EFI_SUCCESS           The protocol installation successfully completed.
+  @retval Others                Status from gBS->UninstallMultipleProtocolInterfaces().
+
+**/
+EFI_STATUS
+EFIAPI
+EfiLibUninstallDriverBindingComponentName2 (
+  IN EFI_DRIVER_BINDING_PROTOCOL              *DriverBinding,
+  IN CONST EFI_COMPONENT_NAME_PROTOCOL        *ComponentName,       OPTIONAL
+  IN CONST EFI_COMPONENT_NAME2_PROTOCOL       *ComponentName2       OPTIONAL
+  );
+
+
+/**
   Installs Driver Binding Protocol with optional Component Name, Component Name 2, Driver
   Configuration, Driver Configuration 2, Driver Diagnostics, and Driver Diagnostics 2 Protocols.
 
@@ -1434,6 +1503,40 @@ EfiLibInstallAllDriverProtocols2 (
   IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL   *DriverDiagnostics2    OPTIONAL
   );
 
+
+/**
+  Uninstalls Driver Binding Protocol with optional Component Name, Component Name 2, Driver
+  Configuration, Driver Configuration 2, Driver Diagnostics, and Driver Diagnostics 2 Protocols.
+
+  If DriverBinding is NULL, then ASSERT().
+  If the installation fails, then ASSERT().
+
+
+  @param  DriverBinding         A Driver Binding Protocol instance that this driver produced.
+  @param  ComponentName         A Component Name Protocol instance that this driver produced.
+  @param  ComponentName2        A Component Name 2 Protocol instance that this driver produced.
+  @param  DriverConfiguration   A Driver Configuration Protocol instance that this driver produced.
+  @param  DriverConfiguration2  A Driver Configuration Protocol 2 instance that this driver produced.
+  @param  DriverDiagnostics     A Driver Diagnostics Protocol instance that this driver produced.
+  @param  DriverDiagnostics2    A Driver Diagnostics Protocol 2 instance that this driver produced.
+
+  @retval EFI_SUCCESS           The protocol uninstallation successfully completed.
+  @retval Others                Status from gBS->UninstallMultipleProtocolInterfaces().
+
+**/
+EFI_STATUS
+EFIAPI
+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   *DriverDiagnostics2    OPTIONAL
+  );
+
+
 /**
   Appends a formatted Unicode string to a Null-terminated Unicode string
 
diff --git a/MdePkg/Library/UefiLib/UefiDriverModel.c b/MdePkg/Library/UefiLib/UefiDriverModel.c
index 69581ae..262d8bc 100644
--- a/MdePkg/Library/UefiLib/UefiDriverModel.c
+++ b/MdePkg/Library/UefiLib/UefiDriverModel.c
@@ -1,7 +1,8 @@
 /** @file
   Library functions that abstract driver model protocols
-  installation.
+  installation and uninstallation.
 
+  Copyright (c) 2019, NVIDIA Corporation. All rights reserved.
   Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials are
   licensed and made available under the terms and conditions of the BSD License
@@ -71,6 +72,44 @@ EfiLibInstallDriverBinding (
 }
 
 
+
+/**
+  Uninstalls a Driver Binding Protocol instance.
+
+  If DriverBinding is NULL, then ASSERT().
+  If DriverBinding can not be uninstalled, then ASSERT().
+
+  @param  DriverBinding        A Driver Binding Protocol instance that this driver produced.
+
+  @retval EFI_SUCCESS           The protocol uninstallation successfully completed.
+  @retval Others                Status from gBS->UninstallMultipleProtocolInterfaces().
+
+**/
+EFI_STATUS
+EFIAPI
+EfiLibUninstallDriverBinding (
+  IN EFI_DRIVER_BINDING_PROTOCOL  *DriverBinding
+  )
+{
+  EFI_STATUS  Status;
+
+  ASSERT (DriverBinding != NULL);
+
+  Status = gBS->UninstallMultipleProtocolInterfaces (
+                  DriverBinding->DriverBindingHandle,
+                  &gEfiDriverBindingProtocolGuid, DriverBinding,
+                  NULL
+                  );
+  //
+  // ASSERT if the call to UninstallMultipleProtocolInterfaces() failed
+  //
+  ASSERT_EFI_ERROR (Status);
+
+  return Status;
+}
+
+
+
 /**
   Installs and completes the initialization of a Driver Binding Protocol instance and
   optionally installs the Component Name, Driver Configuration and Driver Diagnostics Protocols.
@@ -204,6 +243,119 @@ EfiLibInstallAllDriverProtocols (
 
 
 /**
+  Uninstalls a Driver Binding Protocol instance and optionally uninstalls the
+  Component Name, Driver Configuration and Driver Diagnostics Protocols.
+
+  If DriverBinding is NULL, then ASSERT().
+  If the uninstallation fails, then ASSERT().
+
+  @param  DriverBinding        A Driver Binding Protocol instance that this driver produced.
+  @param  ComponentName        A Component Name Protocol instance that this driver produced.
+  @param  DriverConfiguration  A Driver Configuration Protocol instance that this driver produced.
+  @param  DriverDiagnostics    A Driver Diagnostics Protocol instance that this driver produced.
+
+  @retval EFI_SUCCESS           The protocol uninstallation successfully completed.
+  @retval Others                Status from gBS->UninstallMultipleProtocolInterfaces().
+
+**/
+EFI_STATUS
+EFIAPI
+EfiLibUninstallAllDriverProtocols (
+  IN EFI_DRIVER_BINDING_PROTOCOL              *DriverBinding,
+  IN CONST EFI_COMPONENT_NAME_PROTOCOL        *ComponentName,       OPTIONAL
+  IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL  *DriverConfiguration, OPTIONAL
+  IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL    *DriverDiagnostics    OPTIONAL
+  )
+{
+  EFI_STATUS  Status;
+
+  ASSERT (DriverBinding != NULL);
+
+  if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
+    if (DriverConfiguration == NULL) {
+      if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
+        Status = gBS->UninstallMultipleProtocolInterfaces (
+                        DriverBinding->DriverBindingHandle,
+                        &gEfiDriverBindingProtocolGuid, DriverBinding,
+                        NULL
+                        );
+      } else {
+        Status = gBS->UninstallMultipleProtocolInterfaces (
+                        DriverBinding->DriverBindingHandle,
+                        &gEfiDriverBindingProtocolGuid, DriverBinding,
+                        &gEfiComponentNameProtocolGuid, ComponentName,
+                        NULL
+                        );
+      }
+    } else {
+      if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
+        Status = gBS->UninstallMultipleProtocolInterfaces (
+                        DriverBinding->DriverBindingHandle,
+                        &gEfiDriverBindingProtocolGuid,       DriverBinding,
+                        &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                        NULL
+                        );
+      } else {
+        Status = gBS->UninstallMultipleProtocolInterfaces (
+                        DriverBinding->DriverBindingHandle,
+                        &gEfiDriverBindingProtocolGuid,       DriverBinding,
+                        &gEfiComponentNameProtocolGuid,       ComponentName,
+                        &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                        NULL
+                        );
+      }
+    }
+  } else {
+    if (DriverConfiguration == NULL) {
+      if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
+        Status = gBS->UninstallMultipleProtocolInterfaces (
+                        DriverBinding->DriverBindingHandle,
+                        &gEfiDriverBindingProtocolGuid,     DriverBinding,
+                        &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                        NULL
+                        );
+      } else {
+        Status = gBS->UninstallMultipleProtocolInterfaces (
+                        DriverBinding->DriverBindingHandle,
+                        &gEfiDriverBindingProtocolGuid,     DriverBinding,
+                        &gEfiComponentNameProtocolGuid,     ComponentName,
+                        &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                        NULL
+                        );
+      }
+    } else {
+      if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
+       Status = gBS->UninstallMultipleProtocolInterfaces (
+                        DriverBinding->DriverBindingHandle,
+                        &gEfiDriverBindingProtocolGuid,       DriverBinding,
+                        &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                        &gEfiDriverDiagnosticsProtocolGuid,   DriverDiagnostics,
+                        NULL
+                        );
+      } else {
+        Status = gBS->UninstallMultipleProtocolInterfaces (
+                        DriverBinding->DriverBindingHandle,
+                        &gEfiDriverBindingProtocolGuid,       DriverBinding,
+                        &gEfiComponentNameProtocolGuid,       ComponentName,
+                        &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                        &gEfiDriverDiagnosticsProtocolGuid,   DriverDiagnostics,
+                        NULL
+                        );
+      }
+    }
+  }
+
+  //
+  // ASSERT if the call to UninstallMultipleProtocolInterfaces() failed
+  //
+  ASSERT_EFI_ERROR (Status);
+
+  return Status;
+}
+
+
+
+/**
   Installs Driver Binding Protocol with optional Component Name and Component Name 2 Protocols.
 
   Initializes a driver by installing the Driver Binding Protocol together with the
@@ -292,6 +444,76 @@ EfiLibInstallDriverBindingComponentName2 (
 
 
 /**
+  Uninstalls Driver Binding Protocol with optional Component Name and Component Name 2 Protocols.
+
+  If DriverBinding is NULL, then ASSERT().
+  If the uninstallation fails, then ASSERT().
+
+  @param  DriverBinding        A Driver Binding Protocol instance that this driver produced.
+  @param  ComponentName        A Component Name Protocol instance that this driver produced.
+  @param  ComponentName2       A Component Name 2 Protocol instance that this driver produced.
+
+  @retval EFI_SUCCESS           The protocol installation successfully completed.
+  @retval Others                Status from gBS->UninstallMultipleProtocolInterfaces().
+
+**/
+EFI_STATUS
+EFIAPI
+EfiLibUninstallDriverBindingComponentName2 (
+  IN EFI_DRIVER_BINDING_PROTOCOL              *DriverBinding,
+  IN CONST EFI_COMPONENT_NAME_PROTOCOL        *ComponentName,       OPTIONAL
+  IN CONST EFI_COMPONENT_NAME2_PROTOCOL       *ComponentName2       OPTIONAL
+  )
+{
+  EFI_STATUS  Status;
+
+  ASSERT (DriverBinding != NULL);
+
+  if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
+    if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+      Status = gBS->UninstallMultipleProtocolInterfaces (
+                      DriverBinding->DriverBindingHandle,
+                      &gEfiDriverBindingProtocolGuid, DriverBinding,
+                      NULL
+                      );
+      } else {
+      Status = gBS->UninstallMultipleProtocolInterfaces (
+                      DriverBinding->DriverBindingHandle,
+                      &gEfiDriverBindingProtocolGuid, DriverBinding,
+                      &gEfiComponentName2ProtocolGuid, ComponentName2,
+                      NULL
+                      );
+     }
+  } else {
+     if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+       Status = gBS->UninstallMultipleProtocolInterfaces (
+                       DriverBinding->DriverBindingHandle,
+                       &gEfiDriverBindingProtocolGuid, DriverBinding,
+                       &gEfiComponentNameProtocolGuid, ComponentName,
+                       NULL
+                       );
+     } else {
+       Status = gBS->UninstallMultipleProtocolInterfaces (
+                       DriverBinding->DriverBindingHandle,
+                       &gEfiDriverBindingProtocolGuid, DriverBinding,
+                       &gEfiComponentNameProtocolGuid, ComponentName,
+                       &gEfiComponentName2ProtocolGuid, ComponentName2,
+                       NULL
+                       );
+    }
+  }
+
+  //
+  // ASSERT if the call to UninstallMultipleProtocolInterfaces() failed
+  //
+  ASSERT_EFI_ERROR (Status);
+
+  return Status;
+}
+
+
+
+/**
   Installs Driver Binding Protocol with optional Component Name, Component Name 2, Driver
   Configuration, Driver Configuration 2, Driver Diagnostics, and Driver Diagnostics 2 Protocols.
 
@@ -1054,3 +1276,751 @@ EfiLibInstallAllDriverProtocols2 (
 
   return Status;
 }
+
+
+
+/**
+  Uninstalls Driver Binding Protocol with optional Component Name, Component Name 2, Driver
+  Configuration, Driver Configuration 2, Driver Diagnostics, and Driver Diagnostics 2 Protocols.
+
+  If DriverBinding is NULL, then ASSERT().
+  If the installation fails, then ASSERT().
+
+
+  @param  DriverBinding         A Driver Binding Protocol instance that this driver produced.
+  @param  ComponentName         A Component Name Protocol instance that this driver produced.
+  @param  ComponentName2        A Component Name 2 Protocol instance that this driver produced.
+  @param  DriverConfiguration   A Driver Configuration Protocol instance that this driver produced.
+  @param  DriverConfiguration2  A Driver Configuration Protocol 2 instance that this driver produced.
+  @param  DriverDiagnostics     A Driver Diagnostics Protocol instance that this driver produced.
+  @param  DriverDiagnostics2    A Driver Diagnostics Protocol 2 instance that this driver produced.
+
+  @retval EFI_SUCCESS           The protocol uninstallation successfully completed.
+  @retval Others                Status from gBS->UninstallMultipleProtocolInterfaces().
+
+**/
+EFI_STATUS
+EFIAPI
+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   *DriverDiagnostics2    OPTIONAL
+  )
+{
+  EFI_STATUS  Status;
+
+  ASSERT (DriverBinding != NULL);
+
+  if (DriverConfiguration2 == NULL) {
+    if (DriverConfiguration == NULL) {
+      if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
+        if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
+          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              NULL
+                              );
+            } else {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              NULL
+                              );
+            }
+          } else {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              NULL
+                              );
+            } else {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              NULL
+                              );
+            }
+          }
+        } else {
+          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            }
+          } else {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            }
+          }
+        }
+      } else {
+        if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
+          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              NULL
+                              );
+            } else {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              NULL
+                              );
+            }
+          } else {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              NULL
+                              );
+            } else {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              NULL
+                              );
+            }
+          }
+        } else {
+          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            }
+          } else {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            }
+          }
+        }
+      }
+    } else {
+      if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
+        if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
+          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              NULL
+                              );
+            } else {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              NULL
+                              );
+            }
+          } else {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              NULL
+                              );
+            } else {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              NULL
+                              );
+            }
+          }
+        } else {
+          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            }
+          } else {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            }
+          }
+        }
+      } else {
+        if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
+          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              NULL
+                              );
+            } else {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              NULL
+                              );
+            }
+          } else {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              NULL
+                              );
+            } else {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              NULL
+                              );
+            }
+          }
+        } else {
+          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            }
+          } else {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            }
+          }
+        }
+      }
+    }
+  } else {
+    if (DriverConfiguration == NULL) {
+      if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
+        if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
+          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              NULL
+                              );
+            }
+          } else {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              NULL
+                              );
+            }
+          }
+        } else {
+          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            }
+          } else {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            }
+          }
+        }
+      } else {
+        if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
+          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              NULL
+                              );
+            }
+          } else {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              NULL
+                              );
+            }
+          }
+        } else {
+          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            }
+          } else {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            }
+          }
+        }
+      }
+    } else {
+      if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
+        if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
+          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              NULL
+                              );
+            }
+          } else {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              NULL
+                              );
+            }
+          }
+        } else {
+          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            }
+          } else {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            }
+          }
+        }
+      } else {
+        if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
+          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              NULL
+                              );
+            } else {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              NULL
+                              );
+            }
+          } else {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              NULL
+                              );
+            } else {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              NULL
+                              );
+            }
+          }
+        } else {
+          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            }
+          } else {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->UninstallMultipleProtocolInterfaces (
+                              DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            }
+          }
+        }
+      }
+    }
+  }
+
+  //
+  // ASSERT if the call to UninstallMultipleProtocolInterfaces() failed
+  //
+  ASSERT_EFI_ERROR (Status);
+
+  return Status;
+}
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 2/4] NetworkPkg/IScsiDxe: Use UEFILib APIs to uninstall protocols.
  2019-01-04 23:06 [PATCH v2 0/4] Provide UEFILib functions for protocol uninstallation Ashish Singhal
  2019-01-04 23:06 ` [PATCH v2 1/4] MdePkg/UefiLib: Abstract driver model " Ashish Singhal
@ 2019-01-04 23:06 ` Ashish Singhal
  2019-01-07  1:21   ` Fu, Siyuan
  2019-01-04 23:06 ` [PATCH v2 3/4] MdePkg/UefiLib: Simplify protocol un/installation abstraction Ashish Singhal
  2019-01-04 23:06 ` [PATCH v2 4/4] NetworkPkg/IScsiDxe: Update UEFILib Usage Ashish Singhal
  3 siblings, 1 reply; 9+ messages in thread
From: Ashish Singhal @ 2019-01-04 23:06 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ashish Singhal

During cleanup in case of initialization failure, some driver
bindings are not installed. Using abstractions in UEFILib takes
care of it.

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

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ashish Singhal <ashishsingha@nvidia.com>
---
 NetworkPkg/IScsiDxe/IScsiDriver.c | 31 +++++++++++--------------------
 1 file changed, 11 insertions(+), 20 deletions(-)

diff --git a/NetworkPkg/IScsiDxe/IScsiDriver.c b/NetworkPkg/IScsiDxe/IScsiDriver.c
index 91176e6..8747de7 100644
--- a/NetworkPkg/IScsiDxe/IScsiDriver.c
+++ b/NetworkPkg/IScsiDxe/IScsiDriver.c
@@ -1,6 +1,7 @@
 /** @file
   The entry point of IScsi driver.
 
+Copyright (c) 2019, NVIDIA Corporation. All rights reserved.
 Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
 (C) Copyright 2017 Hewlett Packard Enterprise Development LP<BR>
 
@@ -1861,28 +1862,18 @@ Error3:
          );
 
 Error2:
-  gBS->UninstallMultipleProtocolInterfaces (
-         gIScsiIp6DriverBinding.DriverBindingHandle,
-         &gEfiDriverBindingProtocolGuid,
-         &gIScsiIp6DriverBinding,
-         &gEfiComponentName2ProtocolGuid,
-         &gIScsiComponentName2,
-         &gEfiComponentNameProtocolGuid,
-         &gIScsiComponentName,
-         NULL
-         );
+  EfiLibUninstallDriverBindingComponentName2 (
+    &gIScsiIp6DriverBinding,
+    &gIScsiComponentName,
+    &gIScsiComponentName2
+    );
 
 Error1:
-  gBS->UninstallMultipleProtocolInterfaces (
-         ImageHandle,
-         &gEfiDriverBindingProtocolGuid,
-         &gIScsiIp4DriverBinding,
-         &gEfiComponentName2ProtocolGuid,
-         &gIScsiComponentName2,
-         &gEfiComponentNameProtocolGuid,
-         &gIScsiComponentName,
-         NULL
-         );
+  EfiLibUninstallDriverBindingComponentName2 (
+    &gIScsiIp4DriverBinding,
+    &gIScsiComponentName,
+    &gIScsiComponentName2
+    );
 
   return Status;
 }
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 3/4] MdePkg/UefiLib: Simplify protocol un/installation abstraction
  2019-01-04 23:06 [PATCH v2 0/4] Provide UEFILib functions for protocol uninstallation Ashish Singhal
  2019-01-04 23:06 ` [PATCH v2 1/4] MdePkg/UefiLib: Abstract driver model " Ashish Singhal
  2019-01-04 23:06 ` [PATCH v2 2/4] NetworkPkg/IScsiDxe: Use UEFILib APIs to uninstall protocols Ashish Singhal
@ 2019-01-04 23:06 ` Ashish Singhal
  2019-01-07  0:32   ` Gao, Liming
  2019-01-04 23:06 ` [PATCH v2 4/4] NetworkPkg/IScsiDxe: Update UEFILib Usage Ashish Singhal
  3 siblings, 1 reply; 9+ messages in thread
From: Ashish Singhal @ 2019-01-04 23:06 UTC (permalink / raw)
  To: edk2-devel; +Cc: 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 <ashishsingha@nvidia.com>
---
 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  DriverBinding        A 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 Others                Status 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  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  DriverConfiguration  A Driver Configuration Protocol instance that this driver produced.
   @param  DriverDiagnostics    A 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  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  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  ComponentName2        A Component Name 2 Protocol instance that this driver produced.
   @param  DriverConfiguration   A Driver Configuration Protocol instance that this driver produced.
@@ -1527,7 +1548,10 @@ EfiLibInstallAllDriverProtocols2 (
 EFI_STATUS
 EFIAPI
 EfiLibUninstallAllDriverProtocols2 (
+  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
   IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL  *DriverConfiguration,  OPTIONAL
diff --git a/MdePkg/Library/UefiLib/UefiDriverModel.c b/MdePkg/Library/UefiLib/UefiDriverModel.c
index 262d8bc..600a2be 100644
--- a/MdePkg/Library/UefiLib/UefiDriverModel.c
+++ b/MdePkg/Library/UefiLib/UefiDriverModel.c
@@ -17,6 +17,130 @@
 
 #include "UefiLibInternal.h"
 
+
+#define MAX_SUPPORTED_PROTOCOLS 7
+typedef struct {
+  EFI_GUID *Guid;
+  VOID     *Interface;
+} EFI_PROCESS_PROTOCOL;
+
+
+static
+EFI_STATUS
+EFIAPI
+EfiLibProcessProtocol (
+  IN CONST EFI_HANDLE                         ImageHandle,
+  IN EFI_DRIVER_BINDING_PROTOCOL              *DriverBinding,
+  IN EFI_HANDLE                               DriverBindingHandle,
+  IN BOOLEAN                                  Install,
+  IN CONST EFI_COMPONENT_NAME_PROTOCOL        *ComponentName,
+  IN CONST EFI_COMPONENT_NAME2_PROTOCOL       *ComponentName2,
+  IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL  *DriverConfiguration,
+  IN CONST EFI_DRIVER_CONFIGURATION2_PROTOCOL *DriverConfiguration2,
+  IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL    *DriverDiagnostics,
+  IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL   *DriverDiagnostics2
+  )
+{
+  EFI_STATUS           Status;
+  EFI_PROCESS_PROTOCOL ProtocolArray[MAX_SUPPORTED_PROTOCOLS];
+  UINT8                ProtocolCount;
+
+  ASSERT (DriverBinding != NULL);
+
+  //
+  // ZI the ProtocolArray structure. Both InstallMultipleProtocolInterfaces
+  // and UninstallMultipleProtocolInterfaces would stop processing ProtocolArray
+  // elements as soon as they encounter a NULL.
+  //
+  ZeroMem(ProtocolArray, sizeof(ProtocolArray));
+  ProtocolCount = 0;
+
+  //
+  // Populate ProtocolArray with valid protocol interfaces.
+  //
+  ProtocolArray[ProtocolCount].Guid = &gEfiDriverBindingProtocolGuid;
+  ProtocolArray[ProtocolCount].Interface = DriverBinding;
+  ProtocolCount++;
+
+  if (ComponentName != NULL && !FeaturePcdGet(PcdComponentNameDisable)) {
+    ProtocolArray[ProtocolCount].Guid = &gEfiComponentNameProtocolGuid;
+    ProtocolArray[ProtocolCount].Interface = (VOID *)ComponentName;
+    ProtocolCount++;
+  }
+
+  if (ComponentName2 != NULL && !FeaturePcdGet(PcdComponentName2Disable)) {
+    ProtocolArray[ProtocolCount].Guid = &gEfiComponentName2ProtocolGuid;
+    ProtocolArray[ProtocolCount].Interface = (VOID *)ComponentName2;
+    ProtocolCount++;
+  }
+
+  if (DriverConfiguration != NULL) {
+    ProtocolArray[ProtocolCount].Guid = &gEfiDriverConfigurationProtocolGuid;
+    ProtocolArray[ProtocolCount].Interface = (VOID *)DriverConfiguration;
+    ProtocolCount++;
+  }
+
+  if (DriverConfiguration2 != NULL) {
+    ProtocolArray[ProtocolCount].Guid = &gEfiDriverConfiguration2ProtocolGuid;
+    ProtocolArray[ProtocolCount].Interface = (VOID *)DriverConfiguration2;
+    ProtocolCount++;
+  }
+
+  if (DriverDiagnostics != NULL && !FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
+    ProtocolArray[ProtocolCount].Guid = &gEfiDriverDiagnosticsProtocolGuid;
+    ProtocolArray[ProtocolCount].Interface = (VOID *)DriverDiagnostics;
+    ProtocolCount++;
+  }
+
+  if (DriverDiagnostics2 != NULL && !FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
+    ProtocolArray[ProtocolCount].Guid = &gEfiDriverDiagnostics2ProtocolGuid;
+    ProtocolArray[ProtocolCount].Interface = (VOID *)DriverDiagnostics2;
+    ProtocolCount++;
+  }
+
+  if (Install) {
+    //
+    // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol
+    //
+    DriverBinding->ImageHandle         = ImageHandle;
+    DriverBinding->DriverBindingHandle = DriverBindingHandle;
+
+    Status = gBS->InstallMultipleProtocolInterfaces (
+                    &DriverBinding->DriverBindingHandle,
+                    ProtocolArray[0].Guid, ProtocolArray[0].Interface,
+                    ProtocolArray[1].Guid, ProtocolArray[1].Interface,
+                    ProtocolArray[2].Guid, ProtocolArray[2].Interface,
+                    ProtocolArray[3].Guid, ProtocolArray[3].Interface,
+                    ProtocolArray[4].Guid, ProtocolArray[4].Interface,
+                    ProtocolArray[5].Guid, ProtocolArray[5].Interface,
+                    ProtocolArray[6].Guid, ProtocolArray[6].Interface,
+                    NULL
+                    );
+  } else {
+    Status = gBS->UninstallMultipleProtocolInterfaces (
+                    DriverBinding->DriverBindingHandle,
+                    ProtocolArray[0].Guid, ProtocolArray[0].Interface,
+                    ProtocolArray[1].Guid, ProtocolArray[1].Interface,
+                    ProtocolArray[2].Guid, ProtocolArray[2].Interface,
+                    ProtocolArray[3].Guid, ProtocolArray[3].Interface,
+                    ProtocolArray[4].Guid, ProtocolArray[4].Interface,
+                    ProtocolArray[5].Guid, ProtocolArray[5].Interface,
+                    ProtocolArray[6].Guid, ProtocolArray[6].Interface,
+                    NULL
+                    );
+  }
+
+  //
+  // ASSERT if the call to InstallMultipleProtocolInterfaces() or
+  // UninstallMultipleProtocolInterfaces() failed
+  //
+  ASSERT_EFI_ERROR (Status);
+
+  return Status;
+}
+
+
+
 /**
   Installs and completes the initialization of a Driver Binding Protocol instance.
 
@@ -48,27 +172,18 @@ EfiLibInstallDriverBinding (
   IN EFI_HANDLE                   DriverBindingHandle
   )
 {
-  EFI_STATUS  Status;
-
-  ASSERT (DriverBinding != NULL);
-
-  //
-  // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol
-  //
-  DriverBinding->ImageHandle         = ImageHandle;
-  DriverBinding->DriverBindingHandle = DriverBindingHandle;
-
-  Status = gBS->InstallMultipleProtocolInterfaces (
-                  &DriverBinding->DriverBindingHandle,
-                  &gEfiDriverBindingProtocolGuid, DriverBinding,
-                  NULL
-                  );
-  //
-  // ASSERT if the call to InstallMultipleProtocolInterfaces() failed
-  //
-  ASSERT_EFI_ERROR (Status);
-
-  return Status;
+  return EfiLibProcessProtocol (
+           ImageHandle,
+           DriverBinding,
+           DriverBindingHandle,
+           TRUE,
+           NULL,
+           NULL,
+           NULL,
+           NULL,
+           NULL,
+           NULL
+           );
 }
 
 
@@ -79,7 +194,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  DriverBinding        A 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 Others                Status from gBS->UninstallMultipleProtocolInterfaces().
@@ -88,24 +206,24 @@ 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
   )
 {
-  EFI_STATUS  Status;
-
-  ASSERT (DriverBinding != NULL);
-
-  Status = gBS->UninstallMultipleProtocolInterfaces (
-                  DriverBinding->DriverBindingHandle,
-                  &gEfiDriverBindingProtocolGuid, DriverBinding,
-                  NULL
-                  );
-  //
-  // ASSERT if the call to UninstallMultipleProtocolInterfaces() failed
-  //
-  ASSERT_EFI_ERROR (Status);
-
-  return Status;
+  return EfiLibProcessProtocol (
+           ImageHandle,
+           DriverBinding,
+           DriverBindingHandle,
+           FALSE,
+           NULL,
+           NULL,
+           NULL,
+           NULL,
+           NULL,
+           NULL
+           );
 }
 
 
@@ -148,96 +266,18 @@ EfiLibInstallAllDriverProtocols (
   IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL    *DriverDiagnostics    OPTIONAL
   )
 {
-  EFI_STATUS  Status;
-
-  ASSERT (DriverBinding != NULL);
-
-  //
-  // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol
-  //
-  DriverBinding->ImageHandle         = ImageHandle;
-  DriverBinding->DriverBindingHandle = DriverBindingHandle;
-
-  if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
-    if (DriverConfiguration == NULL) {
-      if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-        Status = gBS->InstallMultipleProtocolInterfaces (
-                        &DriverBinding->DriverBindingHandle,
-                        &gEfiDriverBindingProtocolGuid, DriverBinding,
-                        NULL
-                        );
-      } else {
-        Status = gBS->InstallMultipleProtocolInterfaces (
-                        &DriverBinding->DriverBindingHandle,
-                        &gEfiDriverBindingProtocolGuid, DriverBinding,
-                        &gEfiComponentNameProtocolGuid, ComponentName,
-                        NULL
-                        );
-      }
-    } else {
-      if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-        Status = gBS->InstallMultipleProtocolInterfaces (
-                        &DriverBinding->DriverBindingHandle,
-                        &gEfiDriverBindingProtocolGuid,       DriverBinding,
-                        &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                        NULL
-                        );
-      } else {
-        Status = gBS->InstallMultipleProtocolInterfaces (
-                        &DriverBinding->DriverBindingHandle,
-                        &gEfiDriverBindingProtocolGuid,       DriverBinding,
-                        &gEfiComponentNameProtocolGuid,       ComponentName,
-                        &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                        NULL
-                        );
-      }
-    }
-  } else {
-    if (DriverConfiguration == NULL) {
-      if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-        Status = gBS->InstallMultipleProtocolInterfaces (
-                        &DriverBinding->DriverBindingHandle,
-                        &gEfiDriverBindingProtocolGuid,     DriverBinding,
-                        &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                        NULL
-                        );
-      } else {
-        Status = gBS->InstallMultipleProtocolInterfaces (
-                        &DriverBinding->DriverBindingHandle,
-                        &gEfiDriverBindingProtocolGuid,     DriverBinding,
-                        &gEfiComponentNameProtocolGuid,     ComponentName,
-                        &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                        NULL
-                        );
-      }
-    } else {
-      if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-       Status = gBS->InstallMultipleProtocolInterfaces (
-                        &DriverBinding->DriverBindingHandle,
-                        &gEfiDriverBindingProtocolGuid,       DriverBinding,
-                        &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                        &gEfiDriverDiagnosticsProtocolGuid,   DriverDiagnostics,
-                        NULL
-                        );
-      } else {
-        Status = gBS->InstallMultipleProtocolInterfaces (
-                        &DriverBinding->DriverBindingHandle,
-                        &gEfiDriverBindingProtocolGuid,       DriverBinding,
-                        &gEfiComponentNameProtocolGuid,       ComponentName,
-                        &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                        &gEfiDriverDiagnosticsProtocolGuid,   DriverDiagnostics,
-                        NULL
-                        );
-      }
-    }
-  }
-
-  //
-  // ASSERT if the call to InstallMultipleProtocolInterfaces() failed
-  //
-  ASSERT_EFI_ERROR (Status);
-
-  return Status;
+  return EfiLibProcessProtocol (
+           ImageHandle,
+           DriverBinding,
+           DriverBindingHandle,
+           TRUE,
+           ComponentName,
+           NULL,
+           DriverConfiguration,
+           NULL,
+           DriverDiagnostics,
+           NULL
+           );
 }
 
 
@@ -249,7 +289,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  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  DriverConfiguration  A Driver Configuration Protocol instance that this driver produced.
   @param  DriverDiagnostics    A Driver Diagnostics Protocol instance that this driver produced.
@@ -261,96 +304,27 @@ 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
   )
 {
-  EFI_STATUS  Status;
-
-  ASSERT (DriverBinding != NULL);
-
-  if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
-    if (DriverConfiguration == NULL) {
-      if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-        Status = gBS->UninstallMultipleProtocolInterfaces (
-                        DriverBinding->DriverBindingHandle,
-                        &gEfiDriverBindingProtocolGuid, DriverBinding,
-                        NULL
-                        );
-      } else {
-        Status = gBS->UninstallMultipleProtocolInterfaces (
-                        DriverBinding->DriverBindingHandle,
-                        &gEfiDriverBindingProtocolGuid, DriverBinding,
-                        &gEfiComponentNameProtocolGuid, ComponentName,
-                        NULL
-                        );
-      }
-    } else {
-      if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-        Status = gBS->UninstallMultipleProtocolInterfaces (
-                        DriverBinding->DriverBindingHandle,
-                        &gEfiDriverBindingProtocolGuid,       DriverBinding,
-                        &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                        NULL
-                        );
-      } else {
-        Status = gBS->UninstallMultipleProtocolInterfaces (
-                        DriverBinding->DriverBindingHandle,
-                        &gEfiDriverBindingProtocolGuid,       DriverBinding,
-                        &gEfiComponentNameProtocolGuid,       ComponentName,
-                        &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                        NULL
-                        );
-      }
-    }
-  } else {
-    if (DriverConfiguration == NULL) {
-      if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-        Status = gBS->UninstallMultipleProtocolInterfaces (
-                        DriverBinding->DriverBindingHandle,
-                        &gEfiDriverBindingProtocolGuid,     DriverBinding,
-                        &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                        NULL
-                        );
-      } else {
-        Status = gBS->UninstallMultipleProtocolInterfaces (
-                        DriverBinding->DriverBindingHandle,
-                        &gEfiDriverBindingProtocolGuid,     DriverBinding,
-                        &gEfiComponentNameProtocolGuid,     ComponentName,
-                        &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                        NULL
-                        );
-      }
-    } else {
-      if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-       Status = gBS->UninstallMultipleProtocolInterfaces (
-                        DriverBinding->DriverBindingHandle,
-                        &gEfiDriverBindingProtocolGuid,       DriverBinding,
-                        &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                        &gEfiDriverDiagnosticsProtocolGuid,   DriverDiagnostics,
-                        NULL
-                        );
-      } else {
-        Status = gBS->UninstallMultipleProtocolInterfaces (
-                        DriverBinding->DriverBindingHandle,
-                        &gEfiDriverBindingProtocolGuid,       DriverBinding,
-                        &gEfiComponentNameProtocolGuid,       ComponentName,
-                        &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                        &gEfiDriverDiagnosticsProtocolGuid,   DriverDiagnostics,
-                        NULL
-                        );
-      }
-    }
-  }
-
-  //
-  // ASSERT if the call to UninstallMultipleProtocolInterfaces() failed
-  //
-  ASSERT_EFI_ERROR (Status);
-
-  return Status;
+  return EfiLibProcessProtocol (
+           ImageHandle,
+           DriverBinding,
+           DriverBindingHandle,
+           FALSE,
+           ComponentName,
+           NULL,
+           DriverConfiguration,
+           NULL,
+           DriverDiagnostics,
+           NULL
+           );
 }
 
 
@@ -389,56 +363,18 @@ EfiLibInstallDriverBindingComponentName2 (
   IN CONST EFI_COMPONENT_NAME2_PROTOCOL       *ComponentName2       OPTIONAL
   )
 {
-  EFI_STATUS  Status;
-
-  ASSERT (DriverBinding != NULL);
-
-  //
-  // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol
-  //
-  DriverBinding->ImageHandle         = ImageHandle;
-  DriverBinding->DriverBindingHandle = DriverBindingHandle;
-
-  if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-    if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-      Status = gBS->InstallMultipleProtocolInterfaces (
-                      &DriverBinding->DriverBindingHandle,
-                      &gEfiDriverBindingProtocolGuid, DriverBinding,
-                      NULL
-                      );
-      } else {
-      Status = gBS->InstallMultipleProtocolInterfaces (
-                      &DriverBinding->DriverBindingHandle,
-                      &gEfiDriverBindingProtocolGuid, DriverBinding,
-                      &gEfiComponentName2ProtocolGuid, ComponentName2,
-                      NULL
-                      );
-     }
-  } else {
-     if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-       Status = gBS->InstallMultipleProtocolInterfaces (
-                       &DriverBinding->DriverBindingHandle,
-                       &gEfiDriverBindingProtocolGuid, DriverBinding,
-                       &gEfiComponentNameProtocolGuid, ComponentName,
-                       NULL
-                       );
-     } else {
-       Status = gBS->InstallMultipleProtocolInterfaces (
-                       &DriverBinding->DriverBindingHandle,
-                       &gEfiDriverBindingProtocolGuid, DriverBinding,
-                       &gEfiComponentNameProtocolGuid, ComponentName,
-                       &gEfiComponentName2ProtocolGuid, ComponentName2,
-                       NULL
-                       );
-    }
-  }
-
-  //
-  // ASSERT if the call to InstallMultipleProtocolInterfaces() failed
-  //
-  ASSERT_EFI_ERROR (Status);
-
-  return Status;
+  return EfiLibProcessProtocol (
+           ImageHandle,
+           DriverBinding,
+           DriverBindingHandle,
+           TRUE,
+           ComponentName,
+           ComponentName2,
+           NULL,
+           NULL,
+           NULL,
+           NULL
+           );
 }
 
 
@@ -449,7 +385,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  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  ComponentName2       A Component Name 2 Protocol instance that this driver produced.
 
@@ -460,55 +399,26 @@ 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
   )
 {
-  EFI_STATUS  Status;
-
-  ASSERT (DriverBinding != NULL);
-
-  if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-    if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-      Status = gBS->UninstallMultipleProtocolInterfaces (
-                      DriverBinding->DriverBindingHandle,
-                      &gEfiDriverBindingProtocolGuid, DriverBinding,
-                      NULL
-                      );
-      } else {
-      Status = gBS->UninstallMultipleProtocolInterfaces (
-                      DriverBinding->DriverBindingHandle,
-                      &gEfiDriverBindingProtocolGuid, DriverBinding,
-                      &gEfiComponentName2ProtocolGuid, ComponentName2,
-                      NULL
-                      );
-     }
-  } else {
-     if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-       Status = gBS->UninstallMultipleProtocolInterfaces (
-                       DriverBinding->DriverBindingHandle,
-                       &gEfiDriverBindingProtocolGuid, DriverBinding,
-                       &gEfiComponentNameProtocolGuid, ComponentName,
-                       NULL
-                       );
-     } else {
-       Status = gBS->UninstallMultipleProtocolInterfaces (
-                       DriverBinding->DriverBindingHandle,
-                       &gEfiDriverBindingProtocolGuid, DriverBinding,
-                       &gEfiComponentNameProtocolGuid, ComponentName,
-                       &gEfiComponentName2ProtocolGuid, ComponentName2,
-                       NULL
-                       );
-    }
-  }
-
-  //
-  // ASSERT if the call to UninstallMultipleProtocolInterfaces() failed
-  //
-  ASSERT_EFI_ERROR (Status);
-
-  return Status;
+  return EfiLibProcessProtocol (
+           ImageHandle,
+           DriverBinding,
+           DriverBindingHandle,
+           FALSE,
+           ComponentName,
+           ComponentName2,
+           NULL,
+           NULL,
+           NULL,
+           NULL
+           );
 }
 
 
@@ -557,724 +467,18 @@ EfiLibInstallAllDriverProtocols2 (
   IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL   *DriverDiagnostics2    OPTIONAL
   )
 {
-  EFI_STATUS  Status;
-
-  ASSERT (DriverBinding != NULL);
-
-  //
-  // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol
-  //
-  DriverBinding->ImageHandle         = ImageHandle;
-  DriverBinding->DriverBindingHandle = DriverBindingHandle;
-
-  if (DriverConfiguration2 == NULL) {
-    if (DriverConfiguration == NULL) {
-      if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
-        if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
-          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              NULL
-                              );
-            }
-          }
-        } else {
-          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          }
-        }
-      } else {
-        if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
-          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            }
-          }
-        } else {
-          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          }
-        }
-      }
-    } else {
-      if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
-        if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
-          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              NULL
-                              );
-            }
-          }
-        } else {
-          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          }
-        }
-      } else {
-        if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
-          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            }
-          }
-        } else {
-          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          }
-        }
-      }
-    }
-  } else {
-    if (DriverConfiguration == NULL) {
-      if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
-        if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
-          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              NULL
-                              );
-            }
-          }
-        } else {
-          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          }
-        }
-      } else {
-        if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
-          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            }
-          }
-        } else {
-          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          }
-        }
-      }
-    } else {
-      if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
-        if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
-          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              NULL
-                              );
-            }
-          }
-        } else {
-          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          }
-        }
-      } else {
-        if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
-          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            }
-          }
-        } else {
-          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          }
-        }
-      }
-    }
-  }
-
-  //
-  // ASSERT if the call to InstallMultipleProtocolInterfaces() failed
-  //
-  ASSERT_EFI_ERROR (Status);
-
-  return Status;
+  return EfiLibProcessProtocol (
+           ImageHandle,
+           DriverBinding,
+           DriverBindingHandle,
+           TRUE,
+           ComponentName,
+           ComponentName2,
+           DriverConfiguration,
+           DriverConfiguration2,
+           DriverDiagnostics,
+           DriverDiagnostics2
+           );
 }
 
 
@@ -1287,7 +491,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  ComponentName2        A Component Name 2 Protocol instance that this driver produced.
   @param  DriverConfiguration   A Driver Configuration Protocol instance that this driver produced.
@@ -1302,7 +509,10 @@ EfiLibInstallAllDriverProtocols2 (
 EFI_STATUS
 EFIAPI
 EfiLibUninstallAllDriverProtocols2 (
+  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
   IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL  *DriverConfiguration,  OPTIONAL
@@ -1311,716 +521,16 @@ EfiLibUninstallAllDriverProtocols2 (
   IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL   *DriverDiagnostics2    OPTIONAL
   )
 {
-  EFI_STATUS  Status;
-
-  ASSERT (DriverBinding != NULL);
-
-  if (DriverConfiguration2 == NULL) {
-    if (DriverConfiguration == NULL) {
-      if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
-        if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
-          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              NULL
-                              );
-            } else {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              NULL
-                              );
-            } else {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              NULL
-                              );
-            }
-          }
-        } else {
-          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          }
-        }
-      } else {
-        if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
-          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            } else {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            } else {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            }
-          }
-        } else {
-          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          }
-        }
-      }
-    } else {
-      if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
-        if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
-          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              NULL
-                              );
-            } else {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              NULL
-                              );
-            } else {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              NULL
-                              );
-            }
-          }
-        } else {
-          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          }
-        }
-      } else {
-        if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
-          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            } else {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            } else {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            }
-          }
-        } else {
-          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          }
-        }
-      }
-    }
-  } else {
-    if (DriverConfiguration == NULL) {
-      if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
-        if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
-          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              NULL
-                              );
-            }
-          }
-        } else {
-          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          }
-        }
-      } else {
-        if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
-          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            }
-          }
-        } else {
-          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          }
-        }
-      }
-    } else {
-      if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
-        if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
-          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              NULL
-                              );
-            }
-          }
-        } else {
-          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          }
-        }
-      } else {
-        if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
-          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            } else {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            } else {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            }
-          }
-        } else {
-          if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->UninstallMultipleProtocolInterfaces (
-                              DriverBinding->DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          }
-        }
-      }
-    }
-  }
-
-  //
-  // ASSERT if the call to UninstallMultipleProtocolInterfaces() failed
-  //
-  ASSERT_EFI_ERROR (Status);
-
-  return Status;
+  return EfiLibProcessProtocol (
+           ImageHandle,
+           DriverBinding,
+           DriverBindingHandle,
+           FALSE,
+           ComponentName,
+           ComponentName2,
+           DriverConfiguration,
+           DriverConfiguration2,
+           DriverDiagnostics,
+           DriverDiagnostics2
+           );
 }
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 4/4] NetworkPkg/IScsiDxe: Update UEFILib Usage
  2019-01-04 23:06 [PATCH v2 0/4] Provide UEFILib functions for protocol uninstallation Ashish Singhal
                   ` (2 preceding siblings ...)
  2019-01-04 23:06 ` [PATCH v2 3/4] MdePkg/UefiLib: Simplify protocol un/installation abstraction Ashish Singhal
@ 2019-01-04 23:06 ` Ashish Singhal
  2019-01-07  1:21   ` Fu, Siyuan
  3 siblings, 1 reply; 9+ messages in thread
From: Ashish Singhal @ 2019-01-04 23:06 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ashish Singhal

Update interfaces as exposed by UEFILib for protocol
installation and uninstallation abstraction.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ashish Singhal <ashishsingha@nvidia.com>
---
 NetworkPkg/IScsiDxe/IScsiDriver.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/NetworkPkg/IScsiDxe/IScsiDriver.c b/NetworkPkg/IScsiDxe/IScsiDriver.c
index 8747de7..fa0ea00 100644
--- a/NetworkPkg/IScsiDxe/IScsiDriver.c
+++ b/NetworkPkg/IScsiDxe/IScsiDriver.c
@@ -1863,14 +1863,20 @@ Error3:
 
 Error2:
   EfiLibUninstallDriverBindingComponentName2 (
+    ImageHandle,
+    SystemTable,
     &gIScsiIp6DriverBinding,
+    NULL,
     &gIScsiComponentName,
     &gIScsiComponentName2
     );
 
 Error1:
   EfiLibUninstallDriverBindingComponentName2 (
+    ImageHandle,
+    SystemTable,
     &gIScsiIp4DriverBinding,
+    NULL,
     &gIScsiComponentName,
     &gIScsiComponentName2
     );
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 3/4] MdePkg/UefiLib: Simplify protocol un/installation abstraction
  2019-01-04 23:06 ` [PATCH v2 3/4] MdePkg/UefiLib: Simplify protocol un/installation abstraction Ashish Singhal
@ 2019-01-07  0:32   ` Gao, Liming
  2019-01-07  3:00     ` Ashish Singhal
  0 siblings, 1 reply; 9+ messages in thread
From: Gao, Liming @ 2019-01-07  0:32 UTC (permalink / raw)
  To: Ashish Singhal, edk2-devel@lists.01.org

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   *DriverDiagnostics2    OPTIONAL
  );

Thanks
Liming
>-----Original Message-----
>From: edk2-devel [mailto:edk2-devel-bounces@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 <ashishsingha@nvidia.com>
>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 <ashishsingha@nvidia.com>
>---
> 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  DriverBinding        A 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 Others                Status 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  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  DriverConfiguration  A Driver Configuration Protocol instance that
>this driver produced.
>   @param  DriverDiagnostics    A 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  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  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  ComponentName2        A Component Name 2 Protocol instance
>that this driver produced.
>   @param  DriverConfiguration   A Driver Configuration Protocol instance that
>this driver produced.
>@@ -1527,7 +1548,10 @@ EfiLibInstallAllDriverProtocols2 (
> EFI_STATUS
> EFIAPI
> EfiLibUninstallAllDriverProtocols2 (
>+  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
>   IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL  *DriverConfiguration,
>OPTIONAL
>diff --git a/MdePkg/Library/UefiLib/UefiDriverModel.c
>b/MdePkg/Library/UefiLib/UefiDriverModel.c
>index 262d8bc..600a2be 100644
>--- a/MdePkg/Library/UefiLib/UefiDriverModel.c
>+++ b/MdePkg/Library/UefiLib/UefiDriverModel.c
>@@ -17,6 +17,130 @@
>
> #include "UefiLibInternal.h"
>
>+
>+#define MAX_SUPPORTED_PROTOCOLS 7
>+typedef struct {
>+  EFI_GUID *Guid;
>+  VOID     *Interface;
>+} EFI_PROCESS_PROTOCOL;
>+
>+
>+static
>+EFI_STATUS
>+EFIAPI
>+EfiLibProcessProtocol (
>+  IN CONST EFI_HANDLE                         ImageHandle,
>+  IN EFI_DRIVER_BINDING_PROTOCOL              *DriverBinding,
>+  IN EFI_HANDLE                               DriverBindingHandle,
>+  IN BOOLEAN                                  Install,
>+  IN CONST EFI_COMPONENT_NAME_PROTOCOL        *ComponentName,
>+  IN CONST EFI_COMPONENT_NAME2_PROTOCOL       *ComponentName2,
>+  IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL  *DriverConfiguration,
>+  IN CONST EFI_DRIVER_CONFIGURATION2_PROTOCOL
>*DriverConfiguration2,
>+  IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL    *DriverDiagnostics,
>+  IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL   *DriverDiagnostics2
>+  )
>+{
>+  EFI_STATUS           Status;
>+  EFI_PROCESS_PROTOCOL ProtocolArray[MAX_SUPPORTED_PROTOCOLS];
>+  UINT8                ProtocolCount;
>+
>+  ASSERT (DriverBinding != NULL);
>+
>+  //
>+  // ZI the ProtocolArray structure. Both InstallMultipleProtocolInterfaces
>+  // and UninstallMultipleProtocolInterfaces would stop processing
>ProtocolArray
>+  // elements as soon as they encounter a NULL.
>+  //
>+  ZeroMem(ProtocolArray, sizeof(ProtocolArray));
>+  ProtocolCount = 0;
>+
>+  //
>+  // Populate ProtocolArray with valid protocol interfaces.
>+  //
>+  ProtocolArray[ProtocolCount].Guid = &gEfiDriverBindingProtocolGuid;
>+  ProtocolArray[ProtocolCount].Interface = DriverBinding;
>+  ProtocolCount++;
>+
>+  if (ComponentName != NULL
>&& !FeaturePcdGet(PcdComponentNameDisable)) {
>+    ProtocolArray[ProtocolCount].Guid = &gEfiComponentNameProtocolGuid;
>+    ProtocolArray[ProtocolCount].Interface = (VOID *)ComponentName;
>+    ProtocolCount++;
>+  }
>+
>+  if (ComponentName2 != NULL
>&& !FeaturePcdGet(PcdComponentName2Disable)) {
>+    ProtocolArray[ProtocolCount].Guid =
>&gEfiComponentName2ProtocolGuid;
>+    ProtocolArray[ProtocolCount].Interface = (VOID *)ComponentName2;
>+    ProtocolCount++;
>+  }
>+
>+  if (DriverConfiguration != NULL) {
>+    ProtocolArray[ProtocolCount].Guid =
>&gEfiDriverConfigurationProtocolGuid;
>+    ProtocolArray[ProtocolCount].Interface = (VOID *)DriverConfiguration;
>+    ProtocolCount++;
>+  }
>+
>+  if (DriverConfiguration2 != NULL) {
>+    ProtocolArray[ProtocolCount].Guid =
>&gEfiDriverConfiguration2ProtocolGuid;
>+    ProtocolArray[ProtocolCount].Interface = (VOID *)DriverConfiguration2;
>+    ProtocolCount++;
>+  }
>+
>+  if (DriverDiagnostics != NULL
>&& !FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
>+    ProtocolArray[ProtocolCount].Guid = &gEfiDriverDiagnosticsProtocolGuid;
>+    ProtocolArray[ProtocolCount].Interface = (VOID *)DriverDiagnostics;
>+    ProtocolCount++;
>+  }
>+
>+  if (DriverDiagnostics2 != NULL
>&& !FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
>+    ProtocolArray[ProtocolCount].Guid = &gEfiDriverDiagnostics2ProtocolGuid;
>+    ProtocolArray[ProtocolCount].Interface = (VOID *)DriverDiagnostics2;
>+    ProtocolCount++;
>+  }
>+
>+  if (Install) {
>+    //
>+    // Update the ImageHandle and DriverBindingHandle fields of the Driver
>Binding Protocol
>+    //
>+    DriverBinding->ImageHandle         = ImageHandle;
>+    DriverBinding->DriverBindingHandle = DriverBindingHandle;
>+
>+    Status = gBS->InstallMultipleProtocolInterfaces (
>+                    &DriverBinding->DriverBindingHandle,
>+                    ProtocolArray[0].Guid, ProtocolArray[0].Interface,
>+                    ProtocolArray[1].Guid, ProtocolArray[1].Interface,
>+                    ProtocolArray[2].Guid, ProtocolArray[2].Interface,
>+                    ProtocolArray[3].Guid, ProtocolArray[3].Interface,
>+                    ProtocolArray[4].Guid, ProtocolArray[4].Interface,
>+                    ProtocolArray[5].Guid, ProtocolArray[5].Interface,
>+                    ProtocolArray[6].Guid, ProtocolArray[6].Interface,
>+                    NULL
>+                    );
>+  } else {
>+    Status = gBS->UninstallMultipleProtocolInterfaces (
>+                    DriverBinding->DriverBindingHandle,
>+                    ProtocolArray[0].Guid, ProtocolArray[0].Interface,
>+                    ProtocolArray[1].Guid, ProtocolArray[1].Interface,
>+                    ProtocolArray[2].Guid, ProtocolArray[2].Interface,
>+                    ProtocolArray[3].Guid, ProtocolArray[3].Interface,
>+                    ProtocolArray[4].Guid, ProtocolArray[4].Interface,
>+                    ProtocolArray[5].Guid, ProtocolArray[5].Interface,
>+                    ProtocolArray[6].Guid, ProtocolArray[6].Interface,
>+                    NULL
>+                    );
>+  }
>+
>+  //
>+  // ASSERT if the call to InstallMultipleProtocolInterfaces() or
>+  // UninstallMultipleProtocolInterfaces() failed
>+  //
>+  ASSERT_EFI_ERROR (Status);
>+
>+  return Status;
>+}
>+
>+
>+
> /**
>   Installs and completes the initialization of a Driver Binding Protocol instance.
>
>@@ -48,27 +172,18 @@ EfiLibInstallDriverBinding (
>   IN EFI_HANDLE                   DriverBindingHandle
>   )
> {
>-  EFI_STATUS  Status;
>-
>-  ASSERT (DriverBinding != NULL);
>-
>-  //
>-  // Update the ImageHandle and DriverBindingHandle fields of the Driver
>Binding Protocol
>-  //
>-  DriverBinding->ImageHandle         = ImageHandle;
>-  DriverBinding->DriverBindingHandle = DriverBindingHandle;
>-
>-  Status = gBS->InstallMultipleProtocolInterfaces (
>-                  &DriverBinding->DriverBindingHandle,
>-                  &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                  NULL
>-                  );
>-  //
>-  // ASSERT if the call to InstallMultipleProtocolInterfaces() failed
>-  //
>-  ASSERT_EFI_ERROR (Status);
>-
>-  return Status;
>+  return EfiLibProcessProtocol (
>+           ImageHandle,
>+           DriverBinding,
>+           DriverBindingHandle,
>+           TRUE,
>+           NULL,
>+           NULL,
>+           NULL,
>+           NULL,
>+           NULL,
>+           NULL
>+           );
> }
>
>
>@@ -79,7 +194,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  DriverBinding        A 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 Others                Status from gBS-
>>UninstallMultipleProtocolInterfaces().
>@@ -88,24 +206,24 @@ 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
>   )
> {
>-  EFI_STATUS  Status;
>-
>-  ASSERT (DriverBinding != NULL);
>-
>-  Status = gBS->UninstallMultipleProtocolInterfaces (
>-                  DriverBinding->DriverBindingHandle,
>-                  &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                  NULL
>-                  );
>-  //
>-  // ASSERT if the call to UninstallMultipleProtocolInterfaces() failed
>-  //
>-  ASSERT_EFI_ERROR (Status);
>-
>-  return Status;
>+  return EfiLibProcessProtocol (
>+           ImageHandle,
>+           DriverBinding,
>+           DriverBindingHandle,
>+           FALSE,
>+           NULL,
>+           NULL,
>+           NULL,
>+           NULL,
>+           NULL,
>+           NULL
>+           );
> }
>
>
>@@ -148,96 +266,18 @@ EfiLibInstallAllDriverProtocols (
>   IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL    *DriverDiagnostics
>OPTIONAL
>   )
> {
>-  EFI_STATUS  Status;
>-
>-  ASSERT (DriverBinding != NULL);
>-
>-  //
>-  // Update the ImageHandle and DriverBindingHandle fields of the Driver
>Binding Protocol
>-  //
>-  DriverBinding->ImageHandle         = ImageHandle;
>-  DriverBinding->DriverBindingHandle = DriverBindingHandle;
>-
>-  if (DriverDiagnostics == NULL ||
>FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
>-    if (DriverConfiguration == NULL) {
>-      if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-        Status = gBS->InstallMultipleProtocolInterfaces (
>-                        &DriverBinding->DriverBindingHandle,
>-                        &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                        NULL
>-                        );
>-      } else {
>-        Status = gBS->InstallMultipleProtocolInterfaces (
>-                        &DriverBinding->DriverBindingHandle,
>-                        &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                        &gEfiComponentNameProtocolGuid, ComponentName,
>-                        NULL
>-                        );
>-      }
>-    } else {
>-      if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-        Status = gBS->InstallMultipleProtocolInterfaces (
>-                        &DriverBinding->DriverBindingHandle,
>-                        &gEfiDriverBindingProtocolGuid,       DriverBinding,
>-                        &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                        NULL
>-                        );
>-      } else {
>-        Status = gBS->InstallMultipleProtocolInterfaces (
>-                        &DriverBinding->DriverBindingHandle,
>-                        &gEfiDriverBindingProtocolGuid,       DriverBinding,
>-                        &gEfiComponentNameProtocolGuid,       ComponentName,
>-                        &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                        NULL
>-                        );
>-      }
>-    }
>-  } else {
>-    if (DriverConfiguration == NULL) {
>-      if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-        Status = gBS->InstallMultipleProtocolInterfaces (
>-                        &DriverBinding->DriverBindingHandle,
>-                        &gEfiDriverBindingProtocolGuid,     DriverBinding,
>-                        &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                        NULL
>-                        );
>-      } else {
>-        Status = gBS->InstallMultipleProtocolInterfaces (
>-                        &DriverBinding->DriverBindingHandle,
>-                        &gEfiDriverBindingProtocolGuid,     DriverBinding,
>-                        &gEfiComponentNameProtocolGuid,     ComponentName,
>-                        &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                        NULL
>-                        );
>-      }
>-    } else {
>-      if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-       Status = gBS->InstallMultipleProtocolInterfaces (
>-                        &DriverBinding->DriverBindingHandle,
>-                        &gEfiDriverBindingProtocolGuid,       DriverBinding,
>-                        &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                        &gEfiDriverDiagnosticsProtocolGuid,   DriverDiagnostics,
>-                        NULL
>-                        );
>-      } else {
>-        Status = gBS->InstallMultipleProtocolInterfaces (
>-                        &DriverBinding->DriverBindingHandle,
>-                        &gEfiDriverBindingProtocolGuid,       DriverBinding,
>-                        &gEfiComponentNameProtocolGuid,       ComponentName,
>-                        &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                        &gEfiDriverDiagnosticsProtocolGuid,   DriverDiagnostics,
>-                        NULL
>-                        );
>-      }
>-    }
>-  }
>-
>-  //
>-  // ASSERT if the call to InstallMultipleProtocolInterfaces() failed
>-  //
>-  ASSERT_EFI_ERROR (Status);
>-
>-  return Status;
>+  return EfiLibProcessProtocol (
>+           ImageHandle,
>+           DriverBinding,
>+           DriverBindingHandle,
>+           TRUE,
>+           ComponentName,
>+           NULL,
>+           DriverConfiguration,
>+           NULL,
>+           DriverDiagnostics,
>+           NULL
>+           );
> }
>
>
>@@ -249,7 +289,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  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  DriverConfiguration  A Driver Configuration Protocol instance that
>this driver produced.
>   @param  DriverDiagnostics    A Driver Diagnostics Protocol instance that this
>driver produced.
>@@ -261,96 +304,27 @@ 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
>   )
> {
>-  EFI_STATUS  Status;
>-
>-  ASSERT (DriverBinding != NULL);
>-
>-  if (DriverDiagnostics == NULL ||
>FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
>-    if (DriverConfiguration == NULL) {
>-      if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-        Status = gBS->UninstallMultipleProtocolInterfaces (
>-                        DriverBinding->DriverBindingHandle,
>-                        &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                        NULL
>-                        );
>-      } else {
>-        Status = gBS->UninstallMultipleProtocolInterfaces (
>-                        DriverBinding->DriverBindingHandle,
>-                        &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                        &gEfiComponentNameProtocolGuid, ComponentName,
>-                        NULL
>-                        );
>-      }
>-    } else {
>-      if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-        Status = gBS->UninstallMultipleProtocolInterfaces (
>-                        DriverBinding->DriverBindingHandle,
>-                        &gEfiDriverBindingProtocolGuid,       DriverBinding,
>-                        &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                        NULL
>-                        );
>-      } else {
>-        Status = gBS->UninstallMultipleProtocolInterfaces (
>-                        DriverBinding->DriverBindingHandle,
>-                        &gEfiDriverBindingProtocolGuid,       DriverBinding,
>-                        &gEfiComponentNameProtocolGuid,       ComponentName,
>-                        &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                        NULL
>-                        );
>-      }
>-    }
>-  } else {
>-    if (DriverConfiguration == NULL) {
>-      if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-        Status = gBS->UninstallMultipleProtocolInterfaces (
>-                        DriverBinding->DriverBindingHandle,
>-                        &gEfiDriverBindingProtocolGuid,     DriverBinding,
>-                        &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                        NULL
>-                        );
>-      } else {
>-        Status = gBS->UninstallMultipleProtocolInterfaces (
>-                        DriverBinding->DriverBindingHandle,
>-                        &gEfiDriverBindingProtocolGuid,     DriverBinding,
>-                        &gEfiComponentNameProtocolGuid,     ComponentName,
>-                        &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                        NULL
>-                        );
>-      }
>-    } else {
>-      if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-       Status = gBS->UninstallMultipleProtocolInterfaces (
>-                        DriverBinding->DriverBindingHandle,
>-                        &gEfiDriverBindingProtocolGuid,       DriverBinding,
>-                        &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                        &gEfiDriverDiagnosticsProtocolGuid,   DriverDiagnostics,
>-                        NULL
>-                        );
>-      } else {
>-        Status = gBS->UninstallMultipleProtocolInterfaces (
>-                        DriverBinding->DriverBindingHandle,
>-                        &gEfiDriverBindingProtocolGuid,       DriverBinding,
>-                        &gEfiComponentNameProtocolGuid,       ComponentName,
>-                        &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                        &gEfiDriverDiagnosticsProtocolGuid,   DriverDiagnostics,
>-                        NULL
>-                        );
>-      }
>-    }
>-  }
>-
>-  //
>-  // ASSERT if the call to UninstallMultipleProtocolInterfaces() failed
>-  //
>-  ASSERT_EFI_ERROR (Status);
>-
>-  return Status;
>+  return EfiLibProcessProtocol (
>+           ImageHandle,
>+           DriverBinding,
>+           DriverBindingHandle,
>+           FALSE,
>+           ComponentName,
>+           NULL,
>+           DriverConfiguration,
>+           NULL,
>+           DriverDiagnostics,
>+           NULL
>+           );
> }
>
>
>@@ -389,56 +363,18 @@ EfiLibInstallDriverBindingComponentName2 (
>   IN CONST EFI_COMPONENT_NAME2_PROTOCOL       *ComponentName2
>OPTIONAL
>   )
> {
>-  EFI_STATUS  Status;
>-
>-  ASSERT (DriverBinding != NULL);
>-
>-  //
>-  // Update the ImageHandle and DriverBindingHandle fields of the Driver
>Binding Protocol
>-  //
>-  DriverBinding->ImageHandle         = ImageHandle;
>-  DriverBinding->DriverBindingHandle = DriverBindingHandle;
>-
>-  if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-    if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-      Status = gBS->InstallMultipleProtocolInterfaces (
>-                      &DriverBinding->DriverBindingHandle,
>-                      &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                      NULL
>-                      );
>-      } else {
>-      Status = gBS->InstallMultipleProtocolInterfaces (
>-                      &DriverBinding->DriverBindingHandle,
>-                      &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                      &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                      NULL
>-                      );
>-     }
>-  } else {
>-     if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-       Status = gBS->InstallMultipleProtocolInterfaces (
>-                       &DriverBinding->DriverBindingHandle,
>-                       &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                       &gEfiComponentNameProtocolGuid, ComponentName,
>-                       NULL
>-                       );
>-     } else {
>-       Status = gBS->InstallMultipleProtocolInterfaces (
>-                       &DriverBinding->DriverBindingHandle,
>-                       &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                       &gEfiComponentNameProtocolGuid, ComponentName,
>-                       &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                       NULL
>-                       );
>-    }
>-  }
>-
>-  //
>-  // ASSERT if the call to InstallMultipleProtocolInterfaces() failed
>-  //
>-  ASSERT_EFI_ERROR (Status);
>-
>-  return Status;
>+  return EfiLibProcessProtocol (
>+           ImageHandle,
>+           DriverBinding,
>+           DriverBindingHandle,
>+           TRUE,
>+           ComponentName,
>+           ComponentName2,
>+           NULL,
>+           NULL,
>+           NULL,
>+           NULL
>+           );
> }
>
>
>@@ -449,7 +385,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  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  ComponentName2       A Component Name 2 Protocol instance that
>this driver produced.
>
>@@ -460,55 +399,26 @@ 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
>   )
> {
>-  EFI_STATUS  Status;
>-
>-  ASSERT (DriverBinding != NULL);
>-
>-  if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-    if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-      Status = gBS->UninstallMultipleProtocolInterfaces (
>-                      DriverBinding->DriverBindingHandle,
>-                      &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                      NULL
>-                      );
>-      } else {
>-      Status = gBS->UninstallMultipleProtocolInterfaces (
>-                      DriverBinding->DriverBindingHandle,
>-                      &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                      &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                      NULL
>-                      );
>-     }
>-  } else {
>-     if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-       Status = gBS->UninstallMultipleProtocolInterfaces (
>-                       DriverBinding->DriverBindingHandle,
>-                       &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                       &gEfiComponentNameProtocolGuid, ComponentName,
>-                       NULL
>-                       );
>-     } else {
>-       Status = gBS->UninstallMultipleProtocolInterfaces (
>-                       DriverBinding->DriverBindingHandle,
>-                       &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                       &gEfiComponentNameProtocolGuid, ComponentName,
>-                       &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                       NULL
>-                       );
>-    }
>-  }
>-
>-  //
>-  // ASSERT if the call to UninstallMultipleProtocolInterfaces() failed
>-  //
>-  ASSERT_EFI_ERROR (Status);
>-
>-  return Status;
>+  return EfiLibProcessProtocol (
>+           ImageHandle,
>+           DriverBinding,
>+           DriverBindingHandle,
>+           FALSE,
>+           ComponentName,
>+           ComponentName2,
>+           NULL,
>+           NULL,
>+           NULL,
>+           NULL
>+           );
> }
>
>
>@@ -557,724 +467,18 @@ EfiLibInstallAllDriverProtocols2 (
>   IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL   *DriverDiagnostics2
>OPTIONAL
>   )
> {
>-  EFI_STATUS  Status;
>-
>-  ASSERT (DriverBinding != NULL);
>-
>-  //
>-  // Update the ImageHandle and DriverBindingHandle fields of the Driver
>Binding Protocol
>-  //
>-  DriverBinding->ImageHandle         = ImageHandle;
>-  DriverBinding->DriverBindingHandle = DriverBindingHandle;
>-
>-  if (DriverConfiguration2 == NULL) {
>-    if (DriverConfiguration == NULL) {
>-      if (DriverDiagnostics == NULL ||
>FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
>-        if (DriverDiagnostics2 == NULL ||
>FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        } else {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        }
>-      } else {
>-        if (DriverDiagnostics2 == NULL ||
>FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            }
>-          }
>-        } else {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        }
>-      }
>-    } else {
>-      if (DriverDiagnostics == NULL ||
>FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
>-        if (DriverDiagnostics2 == NULL ||
>FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              NULL
>-                              );
>-            }
>-          }
>-        } else {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        }
>-      } else {
>-        if (DriverDiagnostics2 == NULL ||
>FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            }
>-          }
>-        } else {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        }
>-      }
>-    }
>-  } else {
>-    if (DriverConfiguration == NULL) {
>-      if (DriverDiagnostics == NULL ||
>FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
>-        if (DriverDiagnostics2 == NULL ||
>FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        } else {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        }
>-      } else {
>-        if (DriverDiagnostics2 == NULL ||
>FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            }
>-          }
>-        } else {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        }
>-      }
>-    } else {
>-      if (DriverDiagnostics == NULL ||
>FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
>-        if (DriverDiagnostics2 == NULL ||
>FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        } else {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        }
>-      } else {
>-        if (DriverDiagnostics2 == NULL ||
>FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            }
>-          }
>-        } else {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        }
>-      }
>-    }
>-  }
>-
>-  //
>-  // ASSERT if the call to InstallMultipleProtocolInterfaces() failed
>-  //
>-  ASSERT_EFI_ERROR (Status);
>-
>-  return Status;
>+  return EfiLibProcessProtocol (
>+           ImageHandle,
>+           DriverBinding,
>+           DriverBindingHandle,
>+           TRUE,
>+           ComponentName,
>+           ComponentName2,
>+           DriverConfiguration,
>+           DriverConfiguration2,
>+           DriverDiagnostics,
>+           DriverDiagnostics2
>+           );
> }
>
>
>@@ -1287,7 +491,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  ComponentName2        A Component Name 2 Protocol instance
>that this driver produced.
>   @param  DriverConfiguration   A Driver Configuration Protocol instance that
>this driver produced.
>@@ -1302,7 +509,10 @@ EfiLibInstallAllDriverProtocols2 (
> EFI_STATUS
> EFIAPI
> EfiLibUninstallAllDriverProtocols2 (
>+  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
>   IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL  *DriverConfiguration,
>OPTIONAL
>@@ -1311,716 +521,16 @@ EfiLibUninstallAllDriverProtocols2 (
>   IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL   *DriverDiagnostics2
>OPTIONAL
>   )
> {
>-  EFI_STATUS  Status;
>-
>-  ASSERT (DriverBinding != NULL);
>-
>-  if (DriverConfiguration2 == NULL) {
>-    if (DriverConfiguration == NULL) {
>-      if (DriverDiagnostics == NULL ||
>FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
>-        if (DriverDiagnostics2 == NULL ||
>FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        } else {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        }
>-      } else {
>-        if (DriverDiagnostics2 == NULL ||
>FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            }
>-          }
>-        } else {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        }
>-      }
>-    } else {
>-      if (DriverDiagnostics == NULL ||
>FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
>-        if (DriverDiagnostics2 == NULL ||
>FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              NULL
>-                              );
>-            }
>-          }
>-        } else {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        }
>-      } else {
>-        if (DriverDiagnostics2 == NULL ||
>FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            }
>-          }
>-        } else {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        }
>-      }
>-    }
>-  } else {
>-    if (DriverConfiguration == NULL) {
>-      if (DriverDiagnostics == NULL ||
>FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
>-        if (DriverDiagnostics2 == NULL ||
>FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        } else {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        }
>-      } else {
>-        if (DriverDiagnostics2 == NULL ||
>FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            }
>-          }
>-        } else {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        }
>-      }
>-    } else {
>-      if (DriverDiagnostics == NULL ||
>FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
>-        if (DriverDiagnostics2 == NULL ||
>FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        } else {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        }
>-      } else {
>-        if (DriverDiagnostics2 == NULL ||
>FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            }
>-          }
>-        } else {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        }
>-      }
>-    }
>-  }
>-
>-  //
>-  // ASSERT if the call to UninstallMultipleProtocolInterfaces() failed
>-  //
>-  ASSERT_EFI_ERROR (Status);
>-
>-  return Status;
>+  return EfiLibProcessProtocol (
>+           ImageHandle,
>+           DriverBinding,
>+           DriverBindingHandle,
>+           FALSE,
>+           ComponentName,
>+           ComponentName2,
>+           DriverConfiguration,
>+           DriverConfiguration2,
>+           DriverDiagnostics,
>+           DriverDiagnostics2
>+           );
> }
>--
>2.7.4
>
>_______________________________________________
>edk2-devel mailing list
>edk2-devel@lists.01.org
>https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 2/4] NetworkPkg/IScsiDxe: Use UEFILib APIs to uninstall protocols.
  2019-01-04 23:06 ` [PATCH v2 2/4] NetworkPkg/IScsiDxe: Use UEFILib APIs to uninstall protocols Ashish Singhal
@ 2019-01-07  1:21   ` Fu, Siyuan
  0 siblings, 0 replies; 9+ messages in thread
From: Fu, Siyuan @ 2019-01-07  1:21 UTC (permalink / raw)
  To: Ashish Singhal, edk2-devel@lists.01.org

Hi, Ashish

The changes to NetworkPkg is good to me. Please add the package maintainer's name to the cc list of the patch mail in future, thanks.

Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>


> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ashish
> Singhal
> Sent: Saturday, January 5, 2019 7:07 AM
> To: edk2-devel@lists.01.org
> Cc: Ashish Singhal <ashishsingha@nvidia.com>
> Subject: [edk2] [PATCH v2 2/4] NetworkPkg/IScsiDxe: Use UEFILib APIs to
> uninstall protocols.
> 
> During cleanup in case of initialization failure, some driver
> bindings are not installed. Using abstractions in UEFILib takes
> care of it.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1428
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ashish Singhal <ashishsingha@nvidia.com>
> ---
>  NetworkPkg/IScsiDxe/IScsiDriver.c | 31 +++++++++++--------------------
>  1 file changed, 11 insertions(+), 20 deletions(-)
> 
> diff --git a/NetworkPkg/IScsiDxe/IScsiDriver.c
> b/NetworkPkg/IScsiDxe/IScsiDriver.c
> index 91176e6..8747de7 100644
> --- a/NetworkPkg/IScsiDxe/IScsiDriver.c
> +++ b/NetworkPkg/IScsiDxe/IScsiDriver.c
> @@ -1,6 +1,7 @@
>  /** @file
>    The entry point of IScsi driver.
> 
> +Copyright (c) 2019, NVIDIA Corporation. All rights reserved.
>  Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
>  (C) Copyright 2017 Hewlett Packard Enterprise Development LP<BR>
> 
> @@ -1861,28 +1862,18 @@ Error3:
>           );
> 
>  Error2:
> -  gBS->UninstallMultipleProtocolInterfaces (
> -         gIScsiIp6DriverBinding.DriverBindingHandle,
> -         &gEfiDriverBindingProtocolGuid,
> -         &gIScsiIp6DriverBinding,
> -         &gEfiComponentName2ProtocolGuid,
> -         &gIScsiComponentName2,
> -         &gEfiComponentNameProtocolGuid,
> -         &gIScsiComponentName,
> -         NULL
> -         );
> +  EfiLibUninstallDriverBindingComponentName2 (
> +    &gIScsiIp6DriverBinding,
> +    &gIScsiComponentName,
> +    &gIScsiComponentName2
> +    );
> 
>  Error1:
> -  gBS->UninstallMultipleProtocolInterfaces (
> -         ImageHandle,
> -         &gEfiDriverBindingProtocolGuid,
> -         &gIScsiIp4DriverBinding,
> -         &gEfiComponentName2ProtocolGuid,
> -         &gIScsiComponentName2,
> -         &gEfiComponentNameProtocolGuid,
> -         &gIScsiComponentName,
> -         NULL
> -         );
> +  EfiLibUninstallDriverBindingComponentName2 (
> +    &gIScsiIp4DriverBinding,
> +    &gIScsiComponentName,
> +    &gIScsiComponentName2
> +    );
> 
>    return Status;
>  }
> --
> 2.7.4
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 4/4] NetworkPkg/IScsiDxe: Update UEFILib Usage
  2019-01-04 23:06 ` [PATCH v2 4/4] NetworkPkg/IScsiDxe: Update UEFILib Usage Ashish Singhal
@ 2019-01-07  1:21   ` Fu, Siyuan
  0 siblings, 0 replies; 9+ messages in thread
From: Fu, Siyuan @ 2019-01-07  1:21 UTC (permalink / raw)
  To: Ashish Singhal, edk2-devel@lists.01.org

Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>


> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ashish
> Singhal
> Sent: Saturday, January 5, 2019 7:07 AM
> To: edk2-devel@lists.01.org
> Cc: Ashish Singhal <ashishsingha@nvidia.com>
> Subject: [edk2] [PATCH v2 4/4] NetworkPkg/IScsiDxe: Update UEFILib Usage
> 
> Update interfaces as exposed by UEFILib for protocol
> installation and uninstallation abstraction.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ashish Singhal <ashishsingha@nvidia.com>
> ---
>  NetworkPkg/IScsiDxe/IScsiDriver.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/NetworkPkg/IScsiDxe/IScsiDriver.c
> b/NetworkPkg/IScsiDxe/IScsiDriver.c
> index 8747de7..fa0ea00 100644
> --- a/NetworkPkg/IScsiDxe/IScsiDriver.c
> +++ b/NetworkPkg/IScsiDxe/IScsiDriver.c
> @@ -1863,14 +1863,20 @@ Error3:
> 
>  Error2:
>    EfiLibUninstallDriverBindingComponentName2 (
> +    ImageHandle,
> +    SystemTable,
>      &gIScsiIp6DriverBinding,
> +    NULL,
>      &gIScsiComponentName,
>      &gIScsiComponentName2
>      );
> 
>  Error1:
>    EfiLibUninstallDriverBindingComponentName2 (
> +    ImageHandle,
> +    SystemTable,
>      &gIScsiIp4DriverBinding,
> +    NULL,
>      &gIScsiComponentName,
>      &gIScsiComponentName2
>      );
> --
> 2.7.4
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 3/4] MdePkg/UefiLib: Simplify protocol un/installation abstraction
  2019-01-07  0:32   ` Gao, Liming
@ 2019-01-07  3:00     ` Ashish Singhal
  0 siblings, 0 replies; 9+ messages in thread
From: Ashish Singhal @ 2019-01-07  3:00 UTC (permalink / raw)
  To: Gao, Liming, edk2-devel@lists.01.org

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 <liming.gao@intel.com> 
Sent: Sunday, January 6, 2019 5:33 PM
To: Ashish Singhal <ashishsingha@nvidia.com>; 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   *DriverDiagnostics2    OPTIONAL
  );

Thanks
Liming
>-----Original Message-----
>From: edk2-devel [mailto:edk2-devel-bounces@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 <ashishsingha@nvidia.com>
>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 <ashishsingha@nvidia.com>
>---
> 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  DriverBinding        A 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 Others                Status 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  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  DriverConfiguration  A Driver Configuration Protocol instance that
>this driver produced.
>   @param  DriverDiagnostics    A 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  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  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  ComponentName2        A Component Name 2 Protocol instance
>that this driver produced.
>   @param  DriverConfiguration   A Driver Configuration Protocol instance that
>this driver produced.
>@@ -1527,7 +1548,10 @@ EfiLibInstallAllDriverProtocols2 (
> EFI_STATUS
> EFIAPI
> EfiLibUninstallAllDriverProtocols2 (
>+  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
>   IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL  *DriverConfiguration,
>OPTIONAL
>diff --git a/MdePkg/Library/UefiLib/UefiDriverModel.c
>b/MdePkg/Library/UefiLib/UefiDriverModel.c
>index 262d8bc..600a2be 100644
>--- a/MdePkg/Library/UefiLib/UefiDriverModel.c
>+++ b/MdePkg/Library/UefiLib/UefiDriverModel.c
>@@ -17,6 +17,130 @@
>
> #include "UefiLibInternal.h"
>
>+
>+#define MAX_SUPPORTED_PROTOCOLS 7
>+typedef struct {
>+  EFI_GUID *Guid;
>+  VOID     *Interface;
>+} EFI_PROCESS_PROTOCOL;
>+
>+
>+static
>+EFI_STATUS
>+EFIAPI
>+EfiLibProcessProtocol (
>+  IN CONST EFI_HANDLE                         ImageHandle,
>+  IN EFI_DRIVER_BINDING_PROTOCOL              *DriverBinding,
>+  IN EFI_HANDLE                               DriverBindingHandle,
>+  IN BOOLEAN                                  Install,
>+  IN CONST EFI_COMPONENT_NAME_PROTOCOL        *ComponentName,
>+  IN CONST EFI_COMPONENT_NAME2_PROTOCOL       *ComponentName2,
>+  IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL  *DriverConfiguration,
>+  IN CONST EFI_DRIVER_CONFIGURATION2_PROTOCOL
>*DriverConfiguration2,
>+  IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL    *DriverDiagnostics,
>+  IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL   *DriverDiagnostics2
>+  )
>+{
>+  EFI_STATUS           Status;
>+  EFI_PROCESS_PROTOCOL ProtocolArray[MAX_SUPPORTED_PROTOCOLS];
>+  UINT8                ProtocolCount;
>+
>+  ASSERT (DriverBinding != NULL);
>+
>+  //
>+  // ZI the ProtocolArray structure. Both InstallMultipleProtocolInterfaces
>+  // and UninstallMultipleProtocolInterfaces would stop processing
>ProtocolArray
>+  // elements as soon as they encounter a NULL.
>+  //
>+  ZeroMem(ProtocolArray, sizeof(ProtocolArray));
>+  ProtocolCount = 0;
>+
>+  //
>+  // Populate ProtocolArray with valid protocol interfaces.
>+  //
>+  ProtocolArray[ProtocolCount].Guid = &gEfiDriverBindingProtocolGuid;
>+  ProtocolArray[ProtocolCount].Interface = DriverBinding;
>+  ProtocolCount++;
>+
>+  if (ComponentName != NULL
>&& !FeaturePcdGet(PcdComponentNameDisable)) {
>+    ProtocolArray[ProtocolCount].Guid = &gEfiComponentNameProtocolGuid;
>+    ProtocolArray[ProtocolCount].Interface = (VOID *)ComponentName;
>+    ProtocolCount++;
>+  }
>+
>+  if (ComponentName2 != NULL
>&& !FeaturePcdGet(PcdComponentName2Disable)) {
>+    ProtocolArray[ProtocolCount].Guid =
>&gEfiComponentName2ProtocolGuid;
>+    ProtocolArray[ProtocolCount].Interface = (VOID *)ComponentName2;
>+    ProtocolCount++;
>+  }
>+
>+  if (DriverConfiguration != NULL) {
>+    ProtocolArray[ProtocolCount].Guid =
>&gEfiDriverConfigurationProtocolGuid;
>+    ProtocolArray[ProtocolCount].Interface = (VOID *)DriverConfiguration;
>+    ProtocolCount++;
>+  }
>+
>+  if (DriverConfiguration2 != NULL) {
>+    ProtocolArray[ProtocolCount].Guid =
>&gEfiDriverConfiguration2ProtocolGuid;
>+    ProtocolArray[ProtocolCount].Interface = (VOID *)DriverConfiguration2;
>+    ProtocolCount++;
>+  }
>+
>+  if (DriverDiagnostics != NULL
>&& !FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
>+    ProtocolArray[ProtocolCount].Guid = &gEfiDriverDiagnosticsProtocolGuid;
>+    ProtocolArray[ProtocolCount].Interface = (VOID *)DriverDiagnostics;
>+    ProtocolCount++;
>+  }
>+
>+  if (DriverDiagnostics2 != NULL
>&& !FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
>+    ProtocolArray[ProtocolCount].Guid = &gEfiDriverDiagnostics2ProtocolGuid;
>+    ProtocolArray[ProtocolCount].Interface = (VOID *)DriverDiagnostics2;
>+    ProtocolCount++;
>+  }
>+
>+  if (Install) {
>+    //
>+    // Update the ImageHandle and DriverBindingHandle fields of the Driver
>Binding Protocol
>+    //
>+    DriverBinding->ImageHandle         = ImageHandle;
>+    DriverBinding->DriverBindingHandle = DriverBindingHandle;
>+
>+    Status = gBS->InstallMultipleProtocolInterfaces (
>+                    &DriverBinding->DriverBindingHandle,
>+                    ProtocolArray[0].Guid, ProtocolArray[0].Interface,
>+                    ProtocolArray[1].Guid, ProtocolArray[1].Interface,
>+                    ProtocolArray[2].Guid, ProtocolArray[2].Interface,
>+                    ProtocolArray[3].Guid, ProtocolArray[3].Interface,
>+                    ProtocolArray[4].Guid, ProtocolArray[4].Interface,
>+                    ProtocolArray[5].Guid, ProtocolArray[5].Interface,
>+                    ProtocolArray[6].Guid, ProtocolArray[6].Interface,
>+                    NULL
>+                    );
>+  } else {
>+    Status = gBS->UninstallMultipleProtocolInterfaces (
>+                    DriverBinding->DriverBindingHandle,
>+                    ProtocolArray[0].Guid, ProtocolArray[0].Interface,
>+                    ProtocolArray[1].Guid, ProtocolArray[1].Interface,
>+                    ProtocolArray[2].Guid, ProtocolArray[2].Interface,
>+                    ProtocolArray[3].Guid, ProtocolArray[3].Interface,
>+                    ProtocolArray[4].Guid, ProtocolArray[4].Interface,
>+                    ProtocolArray[5].Guid, ProtocolArray[5].Interface,
>+                    ProtocolArray[6].Guid, ProtocolArray[6].Interface,
>+                    NULL
>+                    );
>+  }
>+
>+  //
>+  // ASSERT if the call to InstallMultipleProtocolInterfaces() or
>+  // UninstallMultipleProtocolInterfaces() failed
>+  //
>+  ASSERT_EFI_ERROR (Status);
>+
>+  return Status;
>+}
>+
>+
>+
> /**
>   Installs and completes the initialization of a Driver Binding Protocol instance.
>
>@@ -48,27 +172,18 @@ EfiLibInstallDriverBinding (
>   IN EFI_HANDLE                   DriverBindingHandle
>   )
> {
>-  EFI_STATUS  Status;
>-
>-  ASSERT (DriverBinding != NULL);
>-
>-  //
>-  // Update the ImageHandle and DriverBindingHandle fields of the Driver
>Binding Protocol
>-  //
>-  DriverBinding->ImageHandle         = ImageHandle;
>-  DriverBinding->DriverBindingHandle = DriverBindingHandle;
>-
>-  Status = gBS->InstallMultipleProtocolInterfaces (
>-                  &DriverBinding->DriverBindingHandle,
>-                  &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                  NULL
>-                  );
>-  //
>-  // ASSERT if the call to InstallMultipleProtocolInterfaces() failed
>-  //
>-  ASSERT_EFI_ERROR (Status);
>-
>-  return Status;
>+  return EfiLibProcessProtocol (
>+           ImageHandle,
>+           DriverBinding,
>+           DriverBindingHandle,
>+           TRUE,
>+           NULL,
>+           NULL,
>+           NULL,
>+           NULL,
>+           NULL,
>+           NULL
>+           );
> }
>
>
>@@ -79,7 +194,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  DriverBinding        A 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 Others                Status from gBS-
>>UninstallMultipleProtocolInterfaces().
>@@ -88,24 +206,24 @@ 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
>   )
> {
>-  EFI_STATUS  Status;
>-
>-  ASSERT (DriverBinding != NULL);
>-
>-  Status = gBS->UninstallMultipleProtocolInterfaces (
>-                  DriverBinding->DriverBindingHandle,
>-                  &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                  NULL
>-                  );
>-  //
>-  // ASSERT if the call to UninstallMultipleProtocolInterfaces() failed
>-  //
>-  ASSERT_EFI_ERROR (Status);
>-
>-  return Status;
>+  return EfiLibProcessProtocol (
>+           ImageHandle,
>+           DriverBinding,
>+           DriverBindingHandle,
>+           FALSE,
>+           NULL,
>+           NULL,
>+           NULL,
>+           NULL,
>+           NULL,
>+           NULL
>+           );
> }
>
>
>@@ -148,96 +266,18 @@ EfiLibInstallAllDriverProtocols (
>   IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL    *DriverDiagnostics
>OPTIONAL
>   )
> {
>-  EFI_STATUS  Status;
>-
>-  ASSERT (DriverBinding != NULL);
>-
>-  //
>-  // Update the ImageHandle and DriverBindingHandle fields of the Driver
>Binding Protocol
>-  //
>-  DriverBinding->ImageHandle         = ImageHandle;
>-  DriverBinding->DriverBindingHandle = DriverBindingHandle;
>-
>-  if (DriverDiagnostics == NULL ||
>FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
>-    if (DriverConfiguration == NULL) {
>-      if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-        Status = gBS->InstallMultipleProtocolInterfaces (
>-                        &DriverBinding->DriverBindingHandle,
>-                        &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                        NULL
>-                        );
>-      } else {
>-        Status = gBS->InstallMultipleProtocolInterfaces (
>-                        &DriverBinding->DriverBindingHandle,
>-                        &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                        &gEfiComponentNameProtocolGuid, ComponentName,
>-                        NULL
>-                        );
>-      }
>-    } else {
>-      if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-        Status = gBS->InstallMultipleProtocolInterfaces (
>-                        &DriverBinding->DriverBindingHandle,
>-                        &gEfiDriverBindingProtocolGuid,       DriverBinding,
>-                        &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                        NULL
>-                        );
>-      } else {
>-        Status = gBS->InstallMultipleProtocolInterfaces (
>-                        &DriverBinding->DriverBindingHandle,
>-                        &gEfiDriverBindingProtocolGuid,       DriverBinding,
>-                        &gEfiComponentNameProtocolGuid,       ComponentName,
>-                        &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                        NULL
>-                        );
>-      }
>-    }
>-  } else {
>-    if (DriverConfiguration == NULL) {
>-      if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-        Status = gBS->InstallMultipleProtocolInterfaces (
>-                        &DriverBinding->DriverBindingHandle,
>-                        &gEfiDriverBindingProtocolGuid,     DriverBinding,
>-                        &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                        NULL
>-                        );
>-      } else {
>-        Status = gBS->InstallMultipleProtocolInterfaces (
>-                        &DriverBinding->DriverBindingHandle,
>-                        &gEfiDriverBindingProtocolGuid,     DriverBinding,
>-                        &gEfiComponentNameProtocolGuid,     ComponentName,
>-                        &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                        NULL
>-                        );
>-      }
>-    } else {
>-      if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-       Status = gBS->InstallMultipleProtocolInterfaces (
>-                        &DriverBinding->DriverBindingHandle,
>-                        &gEfiDriverBindingProtocolGuid,       DriverBinding,
>-                        &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                        &gEfiDriverDiagnosticsProtocolGuid,   DriverDiagnostics,
>-                        NULL
>-                        );
>-      } else {
>-        Status = gBS->InstallMultipleProtocolInterfaces (
>-                        &DriverBinding->DriverBindingHandle,
>-                        &gEfiDriverBindingProtocolGuid,       DriverBinding,
>-                        &gEfiComponentNameProtocolGuid,       ComponentName,
>-                        &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                        &gEfiDriverDiagnosticsProtocolGuid,   DriverDiagnostics,
>-                        NULL
>-                        );
>-      }
>-    }
>-  }
>-
>-  //
>-  // ASSERT if the call to InstallMultipleProtocolInterfaces() failed
>-  //
>-  ASSERT_EFI_ERROR (Status);
>-
>-  return Status;
>+  return EfiLibProcessProtocol (
>+           ImageHandle,
>+           DriverBinding,
>+           DriverBindingHandle,
>+           TRUE,
>+           ComponentName,
>+           NULL,
>+           DriverConfiguration,
>+           NULL,
>+           DriverDiagnostics,
>+           NULL
>+           );
> }
>
>
>@@ -249,7 +289,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  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  DriverConfiguration  A Driver Configuration Protocol instance that
>this driver produced.
>   @param  DriverDiagnostics    A Driver Diagnostics Protocol instance that this
>driver produced.
>@@ -261,96 +304,27 @@ 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
>   )
> {
>-  EFI_STATUS  Status;
>-
>-  ASSERT (DriverBinding != NULL);
>-
>-  if (DriverDiagnostics == NULL ||
>FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
>-    if (DriverConfiguration == NULL) {
>-      if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-        Status = gBS->UninstallMultipleProtocolInterfaces (
>-                        DriverBinding->DriverBindingHandle,
>-                        &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                        NULL
>-                        );
>-      } else {
>-        Status = gBS->UninstallMultipleProtocolInterfaces (
>-                        DriverBinding->DriverBindingHandle,
>-                        &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                        &gEfiComponentNameProtocolGuid, ComponentName,
>-                        NULL
>-                        );
>-      }
>-    } else {
>-      if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-        Status = gBS->UninstallMultipleProtocolInterfaces (
>-                        DriverBinding->DriverBindingHandle,
>-                        &gEfiDriverBindingProtocolGuid,       DriverBinding,
>-                        &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                        NULL
>-                        );
>-      } else {
>-        Status = gBS->UninstallMultipleProtocolInterfaces (
>-                        DriverBinding->DriverBindingHandle,
>-                        &gEfiDriverBindingProtocolGuid,       DriverBinding,
>-                        &gEfiComponentNameProtocolGuid,       ComponentName,
>-                        &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                        NULL
>-                        );
>-      }
>-    }
>-  } else {
>-    if (DriverConfiguration == NULL) {
>-      if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-        Status = gBS->UninstallMultipleProtocolInterfaces (
>-                        DriverBinding->DriverBindingHandle,
>-                        &gEfiDriverBindingProtocolGuid,     DriverBinding,
>-                        &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                        NULL
>-                        );
>-      } else {
>-        Status = gBS->UninstallMultipleProtocolInterfaces (
>-                        DriverBinding->DriverBindingHandle,
>-                        &gEfiDriverBindingProtocolGuid,     DriverBinding,
>-                        &gEfiComponentNameProtocolGuid,     ComponentName,
>-                        &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                        NULL
>-                        );
>-      }
>-    } else {
>-      if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-       Status = gBS->UninstallMultipleProtocolInterfaces (
>-                        DriverBinding->DriverBindingHandle,
>-                        &gEfiDriverBindingProtocolGuid,       DriverBinding,
>-                        &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                        &gEfiDriverDiagnosticsProtocolGuid,   DriverDiagnostics,
>-                        NULL
>-                        );
>-      } else {
>-        Status = gBS->UninstallMultipleProtocolInterfaces (
>-                        DriverBinding->DriverBindingHandle,
>-                        &gEfiDriverBindingProtocolGuid,       DriverBinding,
>-                        &gEfiComponentNameProtocolGuid,       ComponentName,
>-                        &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                        &gEfiDriverDiagnosticsProtocolGuid,   DriverDiagnostics,
>-                        NULL
>-                        );
>-      }
>-    }
>-  }
>-
>-  //
>-  // ASSERT if the call to UninstallMultipleProtocolInterfaces() failed
>-  //
>-  ASSERT_EFI_ERROR (Status);
>-
>-  return Status;
>+  return EfiLibProcessProtocol (
>+           ImageHandle,
>+           DriverBinding,
>+           DriverBindingHandle,
>+           FALSE,
>+           ComponentName,
>+           NULL,
>+           DriverConfiguration,
>+           NULL,
>+           DriverDiagnostics,
>+           NULL
>+           );
> }
>
>
>@@ -389,56 +363,18 @@ EfiLibInstallDriverBindingComponentName2 (
>   IN CONST EFI_COMPONENT_NAME2_PROTOCOL       *ComponentName2
>OPTIONAL
>   )
> {
>-  EFI_STATUS  Status;
>-
>-  ASSERT (DriverBinding != NULL);
>-
>-  //
>-  // Update the ImageHandle and DriverBindingHandle fields of the Driver
>Binding Protocol
>-  //
>-  DriverBinding->ImageHandle         = ImageHandle;
>-  DriverBinding->DriverBindingHandle = DriverBindingHandle;
>-
>-  if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-    if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-      Status = gBS->InstallMultipleProtocolInterfaces (
>-                      &DriverBinding->DriverBindingHandle,
>-                      &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                      NULL
>-                      );
>-      } else {
>-      Status = gBS->InstallMultipleProtocolInterfaces (
>-                      &DriverBinding->DriverBindingHandle,
>-                      &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                      &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                      NULL
>-                      );
>-     }
>-  } else {
>-     if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-       Status = gBS->InstallMultipleProtocolInterfaces (
>-                       &DriverBinding->DriverBindingHandle,
>-                       &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                       &gEfiComponentNameProtocolGuid, ComponentName,
>-                       NULL
>-                       );
>-     } else {
>-       Status = gBS->InstallMultipleProtocolInterfaces (
>-                       &DriverBinding->DriverBindingHandle,
>-                       &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                       &gEfiComponentNameProtocolGuid, ComponentName,
>-                       &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                       NULL
>-                       );
>-    }
>-  }
>-
>-  //
>-  // ASSERT if the call to InstallMultipleProtocolInterfaces() failed
>-  //
>-  ASSERT_EFI_ERROR (Status);
>-
>-  return Status;
>+  return EfiLibProcessProtocol (
>+           ImageHandle,
>+           DriverBinding,
>+           DriverBindingHandle,
>+           TRUE,
>+           ComponentName,
>+           ComponentName2,
>+           NULL,
>+           NULL,
>+           NULL,
>+           NULL
>+           );
> }
>
>
>@@ -449,7 +385,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  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  ComponentName2       A Component Name 2 Protocol instance that
>this driver produced.
>
>@@ -460,55 +399,26 @@ 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
>   )
> {
>-  EFI_STATUS  Status;
>-
>-  ASSERT (DriverBinding != NULL);
>-
>-  if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-    if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-      Status = gBS->UninstallMultipleProtocolInterfaces (
>-                      DriverBinding->DriverBindingHandle,
>-                      &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                      NULL
>-                      );
>-      } else {
>-      Status = gBS->UninstallMultipleProtocolInterfaces (
>-                      DriverBinding->DriverBindingHandle,
>-                      &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                      &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                      NULL
>-                      );
>-     }
>-  } else {
>-     if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-       Status = gBS->UninstallMultipleProtocolInterfaces (
>-                       DriverBinding->DriverBindingHandle,
>-                       &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                       &gEfiComponentNameProtocolGuid, ComponentName,
>-                       NULL
>-                       );
>-     } else {
>-       Status = gBS->UninstallMultipleProtocolInterfaces (
>-                       DriverBinding->DriverBindingHandle,
>-                       &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                       &gEfiComponentNameProtocolGuid, ComponentName,
>-                       &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                       NULL
>-                       );
>-    }
>-  }
>-
>-  //
>-  // ASSERT if the call to UninstallMultipleProtocolInterfaces() failed
>-  //
>-  ASSERT_EFI_ERROR (Status);
>-
>-  return Status;
>+  return EfiLibProcessProtocol (
>+           ImageHandle,
>+           DriverBinding,
>+           DriverBindingHandle,
>+           FALSE,
>+           ComponentName,
>+           ComponentName2,
>+           NULL,
>+           NULL,
>+           NULL,
>+           NULL
>+           );
> }
>
>
>@@ -557,724 +467,18 @@ EfiLibInstallAllDriverProtocols2 (
>   IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL   *DriverDiagnostics2
>OPTIONAL
>   )
> {
>-  EFI_STATUS  Status;
>-
>-  ASSERT (DriverBinding != NULL);
>-
>-  //
>-  // Update the ImageHandle and DriverBindingHandle fields of the Driver
>Binding Protocol
>-  //
>-  DriverBinding->ImageHandle         = ImageHandle;
>-  DriverBinding->DriverBindingHandle = DriverBindingHandle;
>-
>-  if (DriverConfiguration2 == NULL) {
>-    if (DriverConfiguration == NULL) {
>-      if (DriverDiagnostics == NULL ||
>FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
>-        if (DriverDiagnostics2 == NULL ||
>FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        } else {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        }
>-      } else {
>-        if (DriverDiagnostics2 == NULL ||
>FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            }
>-          }
>-        } else {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        }
>-      }
>-    } else {
>-      if (DriverDiagnostics == NULL ||
>FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
>-        if (DriverDiagnostics2 == NULL ||
>FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              NULL
>-                              );
>-            }
>-          }
>-        } else {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        }
>-      } else {
>-        if (DriverDiagnostics2 == NULL ||
>FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            }
>-          }
>-        } else {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        }
>-      }
>-    }
>-  } else {
>-    if (DriverConfiguration == NULL) {
>-      if (DriverDiagnostics == NULL ||
>FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
>-        if (DriverDiagnostics2 == NULL ||
>FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        } else {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        }
>-      } else {
>-        if (DriverDiagnostics2 == NULL ||
>FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            }
>-          }
>-        } else {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        }
>-      }
>-    } else {
>-      if (DriverDiagnostics == NULL ||
>FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
>-        if (DriverDiagnostics2 == NULL ||
>FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        } else {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        }
>-      } else {
>-        if (DriverDiagnostics2 == NULL ||
>FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            }
>-          }
>-        } else {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->InstallMultipleProtocolInterfaces (
>-                              &DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        }
>-      }
>-    }
>-  }
>-
>-  //
>-  // ASSERT if the call to InstallMultipleProtocolInterfaces() failed
>-  //
>-  ASSERT_EFI_ERROR (Status);
>-
>-  return Status;
>+  return EfiLibProcessProtocol (
>+           ImageHandle,
>+           DriverBinding,
>+           DriverBindingHandle,
>+           TRUE,
>+           ComponentName,
>+           ComponentName2,
>+           DriverConfiguration,
>+           DriverConfiguration2,
>+           DriverDiagnostics,
>+           DriverDiagnostics2
>+           );
> }
>
>
>@@ -1287,7 +491,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  ComponentName2        A Component Name 2 Protocol instance
>that this driver produced.
>   @param  DriverConfiguration   A Driver Configuration Protocol instance that
>this driver produced.
>@@ -1302,7 +509,10 @@ EfiLibInstallAllDriverProtocols2 (
> EFI_STATUS
> EFIAPI
> EfiLibUninstallAllDriverProtocols2 (
>+  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
>   IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL  *DriverConfiguration,
>OPTIONAL
>@@ -1311,716 +521,16 @@ EfiLibUninstallAllDriverProtocols2 (
>   IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL   *DriverDiagnostics2
>OPTIONAL
>   )
> {
>-  EFI_STATUS  Status;
>-
>-  ASSERT (DriverBinding != NULL);
>-
>-  if (DriverConfiguration2 == NULL) {
>-    if (DriverConfiguration == NULL) {
>-      if (DriverDiagnostics == NULL ||
>FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
>-        if (DriverDiagnostics2 == NULL ||
>FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        } else {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        }
>-      } else {
>-        if (DriverDiagnostics2 == NULL ||
>FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            }
>-          }
>-        } else {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        }
>-      }
>-    } else {
>-      if (DriverDiagnostics == NULL ||
>FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
>-        if (DriverDiagnostics2 == NULL ||
>FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              NULL
>-                              );
>-            }
>-          }
>-        } else {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        }
>-      } else {
>-        if (DriverDiagnostics2 == NULL ||
>FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            }
>-          }
>-        } else {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        }
>-      }
>-    }
>-  } else {
>-    if (DriverConfiguration == NULL) {
>-      if (DriverDiagnostics == NULL ||
>FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
>-        if (DriverDiagnostics2 == NULL ||
>FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        } else {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        }
>-      } else {
>-        if (DriverDiagnostics2 == NULL ||
>FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            }
>-          }
>-        } else {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        }
>-      }
>-    } else {
>-      if (DriverDiagnostics == NULL ||
>FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
>-        if (DriverDiagnostics2 == NULL ||
>FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        } else {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        }
>-      } else {
>-        if (DriverDiagnostics2 == NULL ||
>FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              NULL
>-                              );
>-            }
>-          }
>-        } else {
>-          if (ComponentName == NULL ||
>FeaturePcdGet(PcdComponentNameDisable)) {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          } else {
>-            if (ComponentName2 == NULL ||
>FeaturePcdGet(PcdComponentName2Disable)) {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            } else {
>-              Status = gBS->UninstallMultipleProtocolInterfaces (
>-                              DriverBinding->DriverBindingHandle,
>-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
>-                              &gEfiComponentNameProtocolGuid, ComponentName,
>-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
>-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
>-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
>-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
>-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
>-                              NULL
>-                              );
>-            }
>-          }
>-        }
>-      }
>-    }
>-  }
>-
>-  //
>-  // ASSERT if the call to UninstallMultipleProtocolInterfaces() failed
>-  //
>-  ASSERT_EFI_ERROR (Status);
>-
>-  return Status;
>+  return EfiLibProcessProtocol (
>+           ImageHandle,
>+           DriverBinding,
>+           DriverBindingHandle,
>+           FALSE,
>+           ComponentName,
>+           ComponentName2,
>+           DriverConfiguration,
>+           DriverConfiguration2,
>+           DriverDiagnostics,
>+           DriverDiagnostics2
>+           );
> }
>--
>2.7.4
>
>_______________________________________________
>edk2-devel mailing list
>edk2-devel@lists.01.org
>https://lists.01.org/mailman/listinfo/edk2-devel
-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-01-07  3:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-04 23:06 [PATCH v2 0/4] Provide UEFILib functions for protocol uninstallation Ashish Singhal
2019-01-04 23:06 ` [PATCH v2 1/4] MdePkg/UefiLib: Abstract driver model " Ashish Singhal
2019-01-04 23:06 ` [PATCH v2 2/4] NetworkPkg/IScsiDxe: Use UEFILib APIs to uninstall protocols Ashish Singhal
2019-01-07  1:21   ` Fu, Siyuan
2019-01-04 23:06 ` [PATCH v2 3/4] MdePkg/UefiLib: Simplify protocol un/installation abstraction Ashish Singhal
2019-01-07  0:32   ` Gao, Liming
2019-01-07  3:00     ` Ashish Singhal
2019-01-04 23:06 ` [PATCH v2 4/4] NetworkPkg/IScsiDxe: Update UEFILib Usage Ashish Singhal
2019-01-07  1:21   ` Fu, Siyuan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox