]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkPkg/Library/FrameworkUefiLib/UefiDriverModel.c
IntelFrameworkPkg: Clean up source files
[mirror_edk2.git] / IntelFrameworkPkg / Library / FrameworkUefiLib / UefiDriverModel.c
index 19af4965c20830fa674ce5cb4bab4a4197a5d191..83482dad1ca2b38d00678eb1b3629f0b8851130f 100644 (file)
@@ -2,51 +2,63 @@
   Library functions that abstract driver model protocols\r
   installation.\r
 \r
-  Copyright (c) 2006 - 2008, Intel Corporation<BR> All rights\r
-  reserved. This program and the accompanying materials are\r
+  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  This program and the accompanying materials are\r
   licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
   http://opensource.org/licenses/bsd-license.php\r
-  \r
+\r
   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-**/ \r
+**/\r
+\r
 \r
-#include "FrameworkUefiLib.h"\r
+#include "UefiLibInternal.h"\r
 \r
 /**\r
-  Intialize a driver by installing the Driver Binding Protocol onto the driver's\r
-  DriverBindingHandle.  This is typically the same as the driver's ImageHandle, but\r
-  it can be different if the driver produces multiple DriverBinding Protocols. \r
-  If the Drvier Binding Protocol interface is NULL, then ASSERT (). \r
-  If the installation fails, then ASSERT ().\r
+  Installs and completes the initialization of a Driver Binding Protocol instance.\r
 \r
-  @param  ImageHandle                 The image handle of the driver.\r
-  @param  SystemTable                 The EFI System Table that was passed to the driver's entry point.\r
-  @param  DriverBinding               A Driver Binding Protocol instance that this driver is producing.\r
-  @param  DriverBindingHandle         The handle that DriverBinding is to be installe onto.  If this\r
-                                      parameter is NULL, then a new handle is created.\r
+  Installs the Driver Binding Protocol specified by DriverBinding onto the handle\r
+  specified by DriverBindingHandle. If DriverBindingHandle is NULL, then DriverBinding\r
+  is installed onto a newly created handle. DriverBindingHandle is typically the same\r
+  as the driver's ImageHandle, but it can be different if the driver produces multiple\r
+  Driver Binding Protocols.\r
+  If DriverBinding is NULL, then ASSERT().\r
+  If DriverBinding can not be installed onto a handle, then ASSERT().\r
 \r
-  @retval EFI_SUCCESS                 The protocol installation is completed successfully.\r
-  @retval Others                      Status from gBS->InstallMultipleProtocolInterfaces().\r
+  @param  ImageHandle          The image handle of the driver.\r
+  @param  SystemTable          The EFI System Table that was passed to the driver's entry point.\r
+  @param  DriverBinding        A Driver Binding Protocol instance that this driver is producing.\r
+  @param  DriverBindingHandle  The handle that DriverBinding is to be installed onto.  If this\r
+                               parameter is NULL, then a new handle is created.\r
+\r
+  @retval EFI_SUCCESS           The protocol installation is completed successfully.\r
+  @retval EFI_OUT_OF_RESOURCES  There was not enough system resources to install the protocol.\r
+  @retval Others                Status from gBS->InstallMultipleProtocolInterfaces().\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 EfiLibInstallDriverBinding (\r
-  IN CONST EFI_HANDLE             ImageHandle,\r
-  IN CONST EFI_SYSTEM_TABLE       *SystemTable,\r
-  IN EFI_DRIVER_BINDING_PROTOCOL  *DriverBinding,\r
-  IN EFI_HANDLE                   DriverBindingHandle\r
+  IN CONST EFI_HANDLE               ImageHandle,\r
+  IN CONST EFI_SYSTEM_TABLE         *SystemTable,\r
+  IN EFI_DRIVER_BINDING_PROTOCOL    *DriverBinding,\r
+  IN EFI_HANDLE                     DriverBindingHandle\r
   )\r
 {\r
-  EFI_STATUS  Status;\r
+  EFI_STATUS                        Status;\r
 \r
   ASSERT (DriverBinding != NULL);\r
 \r
+  //\r
+  // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol\r
+  //\r
+  DriverBinding->ImageHandle         = ImageHandle;\r
+  DriverBinding->DriverBindingHandle = DriverBindingHandle;\r
+\r
   Status = gBS->InstallMultipleProtocolInterfaces (\r
-                  &DriverBindingHandle,\r
+                  &DriverBinding->DriverBindingHandle,\r
                   &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                   NULL\r
                   );\r
@@ -55,35 +67,34 @@ EfiLibInstallDriverBinding (
   //\r
   ASSERT_EFI_ERROR (Status);\r
 \r
-  //\r
-  // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol\r
-  //\r
-  DriverBinding->ImageHandle         = ImageHandle;\r
-  DriverBinding->DriverBindingHandle = DriverBindingHandle;\r
-\r
   return Status;\r
 }\r
 \r
 \r
 /**\r
-  Intialize a driver by installing the Driver Binding Protocol together with the optional Component Name,\r
-  Driver Configure and Driver Diagnostic Protocols onto the driver's DriverBindingHandle.  This is\r
-  typically the same as the driver's ImageHandle, but it can be different if the driver produces multiple\r
-  DriverBinding Protocols. \r
-  If the Drvier Binding Protocol interface is NULL, then ASSERT (). \r
-  If the installation fails, then ASSERT ().\r
+  Installs and completes the initialization of a Driver Binding Protocol instance and\r
+  optionally installs the Component Name, Driver Configuration and Driver Diagnostics Protocols.\r
+\r
+  Initializes a driver by installing the Driver Binding Protocol together with the\r
+  optional Component Name, optional Driver Configure and optional Driver Diagnostic\r
+  Protocols onto the driver's DriverBindingHandle. If DriverBindingHandle is NULL,\r
+  then the protocols are  installed onto a newly created handle. DriverBindingHandle\r
+  is typically the same as the driver's ImageHandle, but it can be different if the\r
+  driver produces multiple Driver Binding Protocols.\r
+  If DriverBinding is NULL, then ASSERT().\r
+  If the installation fails, then ASSERT().\r
 \r
-  @param  ImageHandle                 The image handle of the driver.\r
-  @param  SystemTable                 The EFI System Table that was passed to the driver's entry point.\r
-  @param  DriverBinding               A Driver Binding Protocol instance that this driver is producing.\r
-  @param  DriverBindingHandle         The handle that DriverBinding is to be installe onto.  If this\r
-                                      parameter is NULL, then a new handle is created.\r
-  @param  ComponentName               A Component Name Protocol instance that this driver is producing.\r
-  @param  DriverConfiguration         A Driver Configuration Protocol instance that this driver is producing.\r
-  @param  DriverDiagnostics           A Driver Diagnostics Protocol instance that this driver is producing.\r
+  @param  ImageHandle          The image handle of the driver.\r
+  @param  SystemTable          The EFI System Table that was passed to the driver's entry point.\r
+  @param  DriverBinding        A Driver Binding Protocol instance that this driver is producing.\r
+  @param  DriverBindingHandle  The handle that DriverBinding is to be installed onto.  If this\r
+                               parameter is NULL, then a new handle is created.\r
+  @param  ComponentName        A Component Name Protocol instance that this driver is producing.\r
+  @param  DriverConfiguration  A Driver Configuration Protocol instance that this driver is producing.\r
+  @param  DriverDiagnostics    A Driver Diagnostics Protocol instance that this driver is producing.\r
 \r
-  @retval EFI_SUCCESS                 The protocol installation is completed successfully.\r
-  @retval Others                      Status from gBS->InstallMultipleProtocolInterfaces().\r
+  @retval EFI_SUCCESS           The protocol installation is completed successfully.\r
+  @retval EFI_OUT_OF_RESOURCES  There was not enough memory in pool to install all the protocols.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -98,21 +109,27 @@ EfiLibInstallAllDriverProtocols (
   IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL    *DriverDiagnostics    OPTIONAL\r
   )\r
 {\r
-  EFI_STATUS  Status;\r
+  EFI_STATUS                                  Status;\r
 \r
   ASSERT (DriverBinding != NULL);\r
 \r
+  //\r
+  // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol\r
+  //\r
+  DriverBinding->ImageHandle         = ImageHandle;\r
+  DriverBinding->DriverBindingHandle = DriverBindingHandle;\r
+\r
   if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {\r
     if (DriverConfiguration == NULL) {\r
       if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {\r
         Status = gBS->InstallMultipleProtocolInterfaces (\r
-                        &DriverBindingHandle,\r
+                        &DriverBinding->DriverBindingHandle,\r
                         &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                         NULL\r
                         );\r
       } else {\r
         Status = gBS->InstallMultipleProtocolInterfaces (\r
-                        &DriverBindingHandle,\r
+                        &DriverBinding->DriverBindingHandle,\r
                         &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                         &gEfiComponentNameProtocolGuid, ComponentName,\r
                         NULL\r
@@ -121,14 +138,14 @@ EfiLibInstallAllDriverProtocols (
     } else {\r
       if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {\r
         Status = gBS->InstallMultipleProtocolInterfaces (\r
-                        &DriverBindingHandle,\r
+                        &DriverBinding->DriverBindingHandle,\r
                         &gEfiDriverBindingProtocolGuid,       DriverBinding,\r
                         &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
                         NULL\r
                         );\r
       } else {\r
         Status = gBS->InstallMultipleProtocolInterfaces (\r
-                        &DriverBindingHandle,\r
+                        &DriverBinding->DriverBindingHandle,\r
                         &gEfiDriverBindingProtocolGuid,       DriverBinding,\r
                         &gEfiComponentNameProtocolGuid,       ComponentName,\r
                         &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
@@ -140,14 +157,14 @@ EfiLibInstallAllDriverProtocols (
     if (DriverConfiguration == NULL) {\r
       if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {\r
         Status = gBS->InstallMultipleProtocolInterfaces (\r
-                        &DriverBindingHandle,\r
+                        &DriverBinding->DriverBindingHandle,\r
                         &gEfiDriverBindingProtocolGuid,     DriverBinding,\r
                         &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,\r
                         NULL\r
                         );\r
       } else {\r
         Status = gBS->InstallMultipleProtocolInterfaces (\r
-                        &DriverBindingHandle,\r
+                        &DriverBinding->DriverBindingHandle,\r
                         &gEfiDriverBindingProtocolGuid,     DriverBinding,\r
                         &gEfiComponentNameProtocolGuid,     ComponentName,\r
                         &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,\r
@@ -157,7 +174,7 @@ EfiLibInstallAllDriverProtocols (
     } else {\r
       if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {\r
        Status = gBS->InstallMultipleProtocolInterfaces (\r
-                        &DriverBindingHandle,\r
+                        &DriverBinding->DriverBindingHandle,\r
                         &gEfiDriverBindingProtocolGuid,       DriverBinding,\r
                         &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
                         &gEfiDriverDiagnosticsProtocolGuid,   DriverDiagnostics,\r
@@ -165,7 +182,7 @@ EfiLibInstallAllDriverProtocols (
                         );\r
       } else {\r
         Status = gBS->InstallMultipleProtocolInterfaces (\r
-                        &DriverBindingHandle,\r
+                        &DriverBinding->DriverBindingHandle,\r
                         &gEfiDriverBindingProtocolGuid,       DriverBinding,\r
                         &gEfiComponentNameProtocolGuid,       ComponentName,\r
                         &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
@@ -181,61 +198,65 @@ EfiLibInstallAllDriverProtocols (
   //\r
   ASSERT_EFI_ERROR (Status);\r
 \r
-  //\r
-  // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol\r
-  //\r
-  DriverBinding->ImageHandle         = ImageHandle;\r
-  DriverBinding->DriverBindingHandle = DriverBindingHandle;\r
-\r
   return Status;\r
 }\r
 \r
 \r
 \r
 /**\r
-  Intialize a driver by installing the Driver Binding Protocol together with the optional Component Name,\r
-  Component Name 2 onto the driver's DriverBindingHandle.  This is typically the same as the driver's\r
-  ImageHandle, but it can be different if the driver produces multiple DriverBinding Protocols. \r
-  If the Drvier Binding Protocol interface is NULL, then ASSERT (). \r
-  If the installation fails, then ASSERT ().\r
+  Installs Driver Binding Protocol with optional Component Name and Component Name 2 Protocols.\r
 \r
-  @param  ImageHandle                 The image handle of the driver.\r
-  @param  SystemTable                 The EFI System Table that was passed to the driver's entry point.\r
-  @param  DriverBinding               A Driver Binding Protocol instance that this driver is producing.\r
-  @param  DriverBindingHandle         The handle that DriverBinding is to be installe onto.  If this\r
-                                      parameter is NULL, then a new handle is created.\r
-  @param  ComponentName               A Component Name Protocol instance that this driver is producing.\r
-  @param  ComponentName2              A Component Name 2 Protocol instance that this driver is producing.\r
+  Initializes a driver by installing the Driver Binding Protocol together with the\r
+  optional Component Name and optional Component Name 2 protocols onto the driver's\r
+  DriverBindingHandle.  If DriverBindingHandle is NULL, then the protocols are installed\r
+  onto a newly created handle.  DriverBindingHandle is typically the same as the driver's\r
+  ImageHandle, but it can be different if the driver produces multiple Driver Binding Protocols.\r
+  If DriverBinding is NULL, then ASSERT().\r
+  If the installation fails, then ASSERT().\r
 \r
-  @retval EFI_SUCCESS                 The protocol installation is completed successfully.\r
-  @retval Others                      Status from gBS->InstallMultipleProtocolInterfaces().\r
+  @param  ImageHandle          The image handle of the driver.\r
+  @param  SystemTable          The EFI System Table that was passed to the driver's entry point.\r
+  @param  DriverBinding        A Driver Binding Protocol instance that this driver is producing.\r
+  @param  DriverBindingHandle  The handle that DriverBinding is to be installed onto.  If this\r
+                               parameter is NULL, then a new handle is created.\r
+  @param  ComponentName        A Component Name Protocol instance that this driver is producing.\r
+  @param  ComponentName2       A Component Name 2 Protocol instance that this driver is producing.\r
+\r
+  @retval EFI_SUCCESS           The protocol installation is completed successfully.\r
+  @retval EFI_OUT_OF_RESOURCES  There was not enough memory in pool to install all the protocols.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 EfiLibInstallDriverBindingComponentName2 (\r
-  IN CONST EFI_HANDLE                         ImageHandle,\r
-  IN CONST EFI_SYSTEM_TABLE                   *SystemTable,\r
-  IN EFI_DRIVER_BINDING_PROTOCOL              *DriverBinding,\r
-  IN EFI_HANDLE                               DriverBindingHandle,\r
-  IN CONST EFI_COMPONENT_NAME_PROTOCOL        *ComponentName,       OPTIONAL\r
-  IN CONST EFI_COMPONENT_NAME2_PROTOCOL       *ComponentName2       OPTIONAL\r
+  IN CONST EFI_HANDLE                    ImageHandle,\r
+  IN CONST EFI_SYSTEM_TABLE              *SystemTable,\r
+  IN EFI_DRIVER_BINDING_PROTOCOL         *DriverBinding,\r
+  IN EFI_HANDLE                          DriverBindingHandle,\r
+  IN CONST EFI_COMPONENT_NAME_PROTOCOL   *ComponentName,  OPTIONAL\r
+  IN CONST EFI_COMPONENT_NAME2_PROTOCOL  *ComponentName2  OPTIONAL\r
   )\r
 {\r
-  EFI_STATUS  Status;\r
+  EFI_STATUS                             Status;\r
 \r
   ASSERT (DriverBinding != NULL);\r
 \r
+  //\r
+  // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol\r
+  //\r
+  DriverBinding->ImageHandle         = ImageHandle;\r
+  DriverBinding->DriverBindingHandle = DriverBindingHandle;\r
+\r
   if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {\r
     if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
       Status = gBS->InstallMultipleProtocolInterfaces (\r
-                      &DriverBindingHandle,\r
+                      &DriverBinding->DriverBindingHandle,\r
                       &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                       NULL\r
                       );\r
       } else {\r
       Status = gBS->InstallMultipleProtocolInterfaces (\r
-                      &DriverBindingHandle,\r
+                      &DriverBinding->DriverBindingHandle,\r
                       &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                       &gEfiComponentName2ProtocolGuid, ComponentName2,\r
                       NULL\r
@@ -244,14 +265,14 @@ EfiLibInstallDriverBindingComponentName2 (
   } else {\r
      if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
        Status = gBS->InstallMultipleProtocolInterfaces (\r
-                       &DriverBindingHandle,\r
+                       &DriverBinding->DriverBindingHandle,\r
                        &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                        &gEfiComponentNameProtocolGuid, ComponentName,\r
                        NULL\r
                        );\r
      } else {\r
        Status = gBS->InstallMultipleProtocolInterfaces (\r
-                       &DriverBindingHandle,\r
+                       &DriverBinding->DriverBindingHandle,\r
                        &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                        &gEfiComponentNameProtocolGuid, ComponentName,\r
                        &gEfiComponentName2ProtocolGuid, ComponentName2,\r
@@ -259,44 +280,44 @@ EfiLibInstallDriverBindingComponentName2 (
                        );\r
     }\r
   }\r
+\r
   //\r
   // ASSERT if the call to InstallMultipleProtocolInterfaces() failed\r
   //\r
   ASSERT_EFI_ERROR (Status);\r
 \r
-  //\r
-  // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol\r
-  //\r
-  DriverBinding->ImageHandle         = ImageHandle;\r
-  DriverBinding->DriverBindingHandle = DriverBindingHandle;\r
-\r
   return Status;\r
 }\r
 \r
 \r
 \r
 /**\r
-  Intialize a driver by installing the Driver Binding Protocol together with the optional Component Name,\r
-  Component Name 2, Driver Configure, Driver Diagnostic and Driver Diagnostic 2 Protocols onto the driver's\r
-  DriverBindingHandle.  This is typically the same as the driver's ImageHandle, but it can be different if\r
-  the driver produces multiple DriverBinding Protocols. \r
-  If the Drvier Binding Protocol interface is NULL, then ASSERT (). \r
-  If the installation fails, then ASSERT ().\r
+  Installs Driver Binding Protocol with optional Component Name, Component Name 2, Driver\r
+  Configuration, Driver Configuration 2, Driver Diagnostics, and Driver Diagnostics 2 Protocols.\r
+\r
+  Initializes a driver by installing the Driver Binding Protocol together with the optional\r
+  Component Name, optional Component Name 2, optional Driver Configuration, optional Driver Configuration 2,\r
+  optional Driver Diagnostic, and optional Driver Diagnostic 2 Protocols onto the driver's DriverBindingHandle.\r
+  DriverBindingHandle is typically the same as the driver's ImageHandle, but it can be different if the driver\r
+  produces multiple Driver Binding Protocols.\r
+  If DriverBinding is NULL, then ASSERT().\r
+  If the installation fails, then ASSERT().\r
 \r
-  @param  ImageHandle                 The image handle of the driver.\r
-  @param  SystemTable                 The EFI System Table that was passed to the driver's entry point.\r
-  @param  DriverBinding               A Driver Binding Protocol instance that this driver is producing.\r
-  @param  DriverBindingHandle         The handle that DriverBinding is to be installe onto.  If this\r
-                                      parameter is NULL, then a new handle is created.\r
-  @param  ComponentName               A Component Name Protocol instance that this driver is producing.\r
-  @param  ComponentName2              A Component Name 2 Protocol instance that this driver is producing.\r
-  @param  DriverConfiguration         A Driver Configuration Protocol instance that this driver is producing.\r
-  @param  DriverConfiguration2        A Driver Configuration Protocol 2 instance that this driver is producing.\r
-  @param  DriverDiagnostics           A Driver Diagnostics Protocol instance that this driver is producing.\r
-  @param  DriverDiagnostics2          A Driver Diagnostics Protocol 2 instance that this driver is producing.\r
 \r
-  @retval EFI_SUCCESS                 The protocol installation is completed successfully.\r
-  @retval Others                      Status from gBS->InstallMultipleProtocolInterfaces().\r
+  @param  ImageHandle           The image handle of the driver.\r
+  @param  SystemTable           The EFI System Table that was passed to the driver's entry point.\r
+  @param  DriverBinding         A Driver Binding Protocol instance that this driver is producing.\r
+  @param  DriverBindingHandle   The handle that DriverBinding is to be installed onto.  If this\r
+                                parameter is NULL, then a new handle is created.\r
+  @param  ComponentName         A Component Name Protocol instance that this driver is producing.\r
+  @param  ComponentName2        A Component Name 2 Protocol instance that this driver is producing.\r
+  @param  DriverConfiguration   A Driver Configuration Protocol instance that this driver is producing.\r
+  @param  DriverConfiguration2  A Driver Configuration Protocol 2 instance that this driver is producing.\r
+  @param  DriverDiagnostics     A Driver Diagnostics Protocol instance that this driver is producing.\r
+  @param  DriverDiagnostics2    A Driver Diagnostics Protocol 2 instance that this driver is producing.\r
+\r
+  @retval EFI_SUCCESS           The protocol installation is completed successfully.\r
+  @retval EFI_OUT_OF_RESOURCES  There was not enough memory in pool to install all the protocols.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -309,14 +330,20 @@ EfiLibInstallAllDriverProtocols2 (
   IN CONST EFI_COMPONENT_NAME_PROTOCOL        *ComponentName,        OPTIONAL\r
   IN CONST EFI_COMPONENT_NAME2_PROTOCOL       *ComponentName2,       OPTIONAL\r
   IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL  *DriverConfiguration,  OPTIONAL\r
-  IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL  *DriverConfiguration2, OPTIONAL\r
+  IN CONST EFI_DRIVER_CONFIGURATION2_PROTOCOL *DriverConfiguration2, OPTIONAL\r
   IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL    *DriverDiagnostics,    OPTIONAL\r
   IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL   *DriverDiagnostics2    OPTIONAL\r
   )\r
 {\r
   EFI_STATUS  Status;\r
 \r
-  ASSERT (DriverBinding != NULL); \r
+  ASSERT (DriverBinding != NULL);\r
+\r
+  //\r
+  // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol\r
+  //\r
+  DriverBinding->ImageHandle         = ImageHandle;\r
+  DriverBinding->DriverBindingHandle = DriverBindingHandle;\r
 \r
   if (DriverConfiguration2 == NULL) {\r
     if (DriverConfiguration == NULL) {\r
@@ -325,13 +352,13 @@ EfiLibInstallAllDriverProtocols2 (
           if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {\r
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               NULL\r
                               );\r
             } else {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentName2ProtocolGuid, ComponentName2,\r
                               NULL\r
@@ -340,14 +367,14 @@ EfiLibInstallAllDriverProtocols2 (
           } else {\r
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentNameProtocolGuid, ComponentName,\r
                               NULL\r
                               );\r
             } else {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentNameProtocolGuid, ComponentName,\r
                               &gEfiComponentName2ProtocolGuid, ComponentName2,\r
@@ -359,14 +386,14 @@ EfiLibInstallAllDriverProtocols2 (
           if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {\r
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,\r
                               NULL\r
                               );\r
             } else {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentName2ProtocolGuid, ComponentName2,\r
                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,\r
@@ -376,7 +403,7 @@ EfiLibInstallAllDriverProtocols2 (
           } else {\r
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentNameProtocolGuid, ComponentName,\r
                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,\r
@@ -384,7 +411,7 @@ EfiLibInstallAllDriverProtocols2 (
                               );\r
             } else {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentNameProtocolGuid, ComponentName,\r
                               &gEfiComponentName2ProtocolGuid, ComponentName2,\r
@@ -399,14 +426,14 @@ EfiLibInstallAllDriverProtocols2 (
           if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {\r
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,\r
                               NULL\r
                               );\r
             } else {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentName2ProtocolGuid, ComponentName2,\r
                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,\r
@@ -416,7 +443,7 @@ EfiLibInstallAllDriverProtocols2 (
           } else {\r
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentNameProtocolGuid, ComponentName,\r
                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,\r
@@ -424,7 +451,7 @@ EfiLibInstallAllDriverProtocols2 (
                               );\r
             } else {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentNameProtocolGuid, ComponentName,\r
                               &gEfiComponentName2ProtocolGuid, ComponentName2,\r
@@ -437,7 +464,7 @@ EfiLibInstallAllDriverProtocols2 (
           if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {\r
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,\r
                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,\r
@@ -445,7 +472,7 @@ EfiLibInstallAllDriverProtocols2 (
                               );\r
             } else {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentName2ProtocolGuid, ComponentName2,\r
                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,\r
@@ -456,7 +483,7 @@ EfiLibInstallAllDriverProtocols2 (
           } else {\r
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentNameProtocolGuid, ComponentName,\r
                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,\r
@@ -465,7 +492,7 @@ EfiLibInstallAllDriverProtocols2 (
                               );\r
             } else {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentNameProtocolGuid, ComponentName,\r
                               &gEfiComponentName2ProtocolGuid, ComponentName2,\r
@@ -483,14 +510,14 @@ EfiLibInstallAllDriverProtocols2 (
           if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {\r
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
                               NULL\r
                               );\r
             } else {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentName2ProtocolGuid, ComponentName2,\r
                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
@@ -500,7 +527,7 @@ EfiLibInstallAllDriverProtocols2 (
           } else {\r
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentNameProtocolGuid, ComponentName,\r
                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
@@ -508,7 +535,7 @@ EfiLibInstallAllDriverProtocols2 (
                               );\r
             } else {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentNameProtocolGuid, ComponentName,\r
                               &gEfiComponentName2ProtocolGuid, ComponentName2,\r
@@ -521,7 +548,7 @@ EfiLibInstallAllDriverProtocols2 (
           if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {\r
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,\r
@@ -529,7 +556,7 @@ EfiLibInstallAllDriverProtocols2 (
                               );\r
             } else {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentName2ProtocolGuid, ComponentName2,\r
                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
@@ -540,7 +567,7 @@ EfiLibInstallAllDriverProtocols2 (
           } else {\r
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentNameProtocolGuid, ComponentName,\r
                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
@@ -549,7 +576,7 @@ EfiLibInstallAllDriverProtocols2 (
                               );\r
             } else {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentNameProtocolGuid, ComponentName,\r
                               &gEfiComponentName2ProtocolGuid, ComponentName2,\r
@@ -565,7 +592,7 @@ EfiLibInstallAllDriverProtocols2 (
           if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {\r
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,\r
@@ -573,7 +600,7 @@ EfiLibInstallAllDriverProtocols2 (
                               );\r
             } else {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentName2ProtocolGuid, ComponentName2,\r
                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
@@ -584,7 +611,7 @@ EfiLibInstallAllDriverProtocols2 (
           } else {\r
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentNameProtocolGuid, ComponentName,\r
                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
@@ -593,7 +620,7 @@ EfiLibInstallAllDriverProtocols2 (
                               );\r
             } else {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentNameProtocolGuid, ComponentName,\r
                               &gEfiComponentName2ProtocolGuid, ComponentName2,\r
@@ -607,7 +634,7 @@ EfiLibInstallAllDriverProtocols2 (
           if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {\r
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,\r
@@ -616,7 +643,7 @@ EfiLibInstallAllDriverProtocols2 (
                               );\r
             } else {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentName2ProtocolGuid, ComponentName2,\r
                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
@@ -628,7 +655,7 @@ EfiLibInstallAllDriverProtocols2 (
           } else {\r
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentNameProtocolGuid, ComponentName,\r
                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
@@ -638,7 +665,7 @@ EfiLibInstallAllDriverProtocols2 (
                               );\r
             } else {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentNameProtocolGuid, ComponentName,\r
                               &gEfiComponentName2ProtocolGuid, ComponentName2,\r
@@ -659,14 +686,14 @@ EfiLibInstallAllDriverProtocols2 (
           if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {\r
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,\r
                               NULL\r
                               );\r
             } else {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentName2ProtocolGuid, ComponentName2,\r
                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,\r
@@ -676,7 +703,7 @@ EfiLibInstallAllDriverProtocols2 (
           } else {\r
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentNameProtocolGuid, ComponentName,\r
                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,\r
@@ -684,7 +711,7 @@ EfiLibInstallAllDriverProtocols2 (
                               );\r
             } else {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentNameProtocolGuid, ComponentName,\r
                               &gEfiComponentName2ProtocolGuid, ComponentName2,\r
@@ -697,7 +724,7 @@ EfiLibInstallAllDriverProtocols2 (
           if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {\r
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,\r
                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,\r
@@ -705,7 +732,7 @@ EfiLibInstallAllDriverProtocols2 (
                               );\r
             } else {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentName2ProtocolGuid, ComponentName2,\r
                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,\r
@@ -716,7 +743,7 @@ EfiLibInstallAllDriverProtocols2 (
           } else {\r
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentNameProtocolGuid, ComponentName,\r
                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,\r
@@ -725,7 +752,7 @@ EfiLibInstallAllDriverProtocols2 (
                               );\r
             } else {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentNameProtocolGuid, ComponentName,\r
                               &gEfiComponentName2ProtocolGuid, ComponentName2,\r
@@ -741,7 +768,7 @@ EfiLibInstallAllDriverProtocols2 (
           if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {\r
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,\r
                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,\r
@@ -749,7 +776,7 @@ EfiLibInstallAllDriverProtocols2 (
                               );\r
             } else {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentName2ProtocolGuid, ComponentName2,\r
                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,\r
@@ -760,7 +787,7 @@ EfiLibInstallAllDriverProtocols2 (
           } else {\r
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentNameProtocolGuid, ComponentName,\r
                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,\r
@@ -769,7 +796,7 @@ EfiLibInstallAllDriverProtocols2 (
                               );\r
             } else {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentNameProtocolGuid, ComponentName,\r
                               &gEfiComponentName2ProtocolGuid, ComponentName2,\r
@@ -783,7 +810,7 @@ EfiLibInstallAllDriverProtocols2 (
           if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {\r
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,\r
                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,\r
@@ -792,7 +819,7 @@ EfiLibInstallAllDriverProtocols2 (
                               );\r
             } else {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentName2ProtocolGuid, ComponentName2,\r
                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,\r
@@ -804,7 +831,7 @@ EfiLibInstallAllDriverProtocols2 (
           } else {\r
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentNameProtocolGuid, ComponentName,\r
                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,\r
@@ -814,7 +841,7 @@ EfiLibInstallAllDriverProtocols2 (
                               );\r
             } else {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentNameProtocolGuid, ComponentName,\r
                               &gEfiComponentName2ProtocolGuid, ComponentName2,\r
@@ -833,7 +860,7 @@ EfiLibInstallAllDriverProtocols2 (
           if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {\r
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,\r
@@ -841,7 +868,7 @@ EfiLibInstallAllDriverProtocols2 (
                               );\r
             } else {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentName2ProtocolGuid, ComponentName2,\r
                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
@@ -852,7 +879,7 @@ EfiLibInstallAllDriverProtocols2 (
           } else {\r
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentNameProtocolGuid, ComponentName,\r
                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
@@ -861,7 +888,7 @@ EfiLibInstallAllDriverProtocols2 (
                               );\r
             } else {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentNameProtocolGuid, ComponentName,\r
                               &gEfiComponentName2ProtocolGuid, ComponentName2,\r
@@ -875,7 +902,7 @@ EfiLibInstallAllDriverProtocols2 (
           if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {\r
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,\r
@@ -884,7 +911,7 @@ EfiLibInstallAllDriverProtocols2 (
                               );\r
             } else {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentName2ProtocolGuid, ComponentName2,\r
                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
@@ -896,7 +923,7 @@ EfiLibInstallAllDriverProtocols2 (
           } else {\r
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentNameProtocolGuid, ComponentName,\r
                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
@@ -906,7 +933,7 @@ EfiLibInstallAllDriverProtocols2 (
                               );\r
             } else {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentNameProtocolGuid, ComponentName,\r
                               &gEfiComponentName2ProtocolGuid, ComponentName2,\r
@@ -923,7 +950,7 @@ EfiLibInstallAllDriverProtocols2 (
           if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {\r
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,\r
@@ -932,7 +959,7 @@ EfiLibInstallAllDriverProtocols2 (
                               );\r
             } else {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentName2ProtocolGuid, ComponentName2,\r
                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
@@ -944,7 +971,7 @@ EfiLibInstallAllDriverProtocols2 (
           } else {\r
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentNameProtocolGuid, ComponentName,\r
                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
@@ -954,7 +981,7 @@ EfiLibInstallAllDriverProtocols2 (
                               );\r
             } else {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentNameProtocolGuid, ComponentName,\r
                               &gEfiComponentName2ProtocolGuid, ComponentName2,\r
@@ -969,7 +996,7 @@ EfiLibInstallAllDriverProtocols2 (
           if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {\r
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,\r
@@ -979,7 +1006,7 @@ EfiLibInstallAllDriverProtocols2 (
                               );\r
             } else {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentName2ProtocolGuid, ComponentName2,\r
                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
@@ -992,7 +1019,7 @@ EfiLibInstallAllDriverProtocols2 (
           } else {\r
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentNameProtocolGuid, ComponentName,\r
                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
@@ -1003,7 +1030,7 @@ EfiLibInstallAllDriverProtocols2 (
                               );\r
             } else {\r
               Status = gBS->InstallMultipleProtocolInterfaces (\r
-                              &DriverBindingHandle,\r
+                              &DriverBinding->DriverBindingHandle,\r
                               &gEfiDriverBindingProtocolGuid, DriverBinding,\r
                               &gEfiComponentNameProtocolGuid, ComponentName,\r
                               &gEfiComponentName2ProtocolGuid, ComponentName2,\r
@@ -1020,19 +1047,10 @@ EfiLibInstallAllDriverProtocols2 (
     }\r
   }\r
 \r
-\r
   //\r
   // ASSERT if the call to InstallMultipleProtocolInterfaces() failed\r
   //\r
   ASSERT_EFI_ERROR (Status);\r
 \r
-  //\r
-  // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol\r
-  //\r
-  DriverBinding->ImageHandle         = ImageHandle;\r
-  DriverBinding->DriverBindingHandle = DriverBindingHandle;\r
-\r
   return Status;\r
 }\r
-\r
-\r