Home | History | Annotate | Download | only in UefiLib
      1 /** @file
      2   Library functions that abstract driver model protocols
      3   installation.
      4 
      5   Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
      6   This program and the accompanying materials are
      7   licensed and made available under the terms and conditions of the BSD License
      8   which accompanies this distribution.  The full text of the license may be found at
      9   http://opensource.org/licenses/bsd-license.php.
     10 
     11   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     12   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     13 
     14 **/
     15 
     16 
     17 #include "UefiLibInternal.h"
     18 
     19 /**
     20   Installs and completes the initialization of a Driver Binding Protocol instance.
     21 
     22   Installs the Driver Binding Protocol specified by DriverBinding onto the handle
     23   specified by DriverBindingHandle. If DriverBindingHandle is NULL, then DriverBinding
     24   is installed onto a newly created handle. DriverBindingHandle is typically the same
     25   as the driver's ImageHandle, but it can be different if the driver produces multiple
     26   Driver Binding Protocols.
     27   If DriverBinding is NULL, then ASSERT().
     28   If DriverBinding can not be installed onto a handle, then ASSERT().
     29 
     30   @param  ImageHandle          The image handle of the driver.
     31   @param  SystemTable          The EFI System Table that was passed to the driver's entry point.
     32   @param  DriverBinding        A Driver Binding Protocol instance that this driver is producing.
     33   @param  DriverBindingHandle  The handle that DriverBinding is to be installed onto.  If this
     34                                parameter is NULL, then a new handle is created.
     35 
     36   @retval EFI_SUCCESS           The protocol installation successfully completed.
     37   @retval EFI_OUT_OF_RESOURCES  There was not enough system resources to install the protocol.
     38   @retval Others                Status from gBS->InstallMultipleProtocolInterfaces().
     39 
     40 **/
     41 EFI_STATUS
     42 EFIAPI
     43 EfiLibInstallDriverBinding (
     44   IN CONST EFI_HANDLE             ImageHandle,
     45   IN CONST EFI_SYSTEM_TABLE       *SystemTable,
     46   IN EFI_DRIVER_BINDING_PROTOCOL  *DriverBinding,
     47   IN EFI_HANDLE                   DriverBindingHandle
     48   )
     49 {
     50   EFI_STATUS  Status;
     51 
     52   ASSERT (DriverBinding != NULL);
     53 
     54   //
     55   // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol
     56   //
     57   DriverBinding->ImageHandle         = ImageHandle;
     58   DriverBinding->DriverBindingHandle = DriverBindingHandle;
     59 
     60   Status = gBS->InstallMultipleProtocolInterfaces (
     61                   &DriverBinding->DriverBindingHandle,
     62                   &gEfiDriverBindingProtocolGuid, DriverBinding,
     63                   NULL
     64                   );
     65   //
     66   // ASSERT if the call to InstallMultipleProtocolInterfaces() failed
     67   //
     68   ASSERT_EFI_ERROR (Status);
     69 
     70   return Status;
     71 }
     72 
     73 
     74 /**
     75   Installs and completes the initialization of a Driver Binding Protocol instance and
     76   optionally installs the Component Name, Driver Configuration and Driver Diagnostics Protocols.
     77 
     78   Initializes a driver by installing the Driver Binding Protocol together with the
     79   optional Component Name, optional Driver Configure and optional Driver Diagnostic
     80   Protocols onto the driver's DriverBindingHandle. If DriverBindingHandle is NULL,
     81   then the protocols are  installed onto a newly created handle. DriverBindingHandle
     82   is typically the same as the driver's ImageHandle, but it can be different if the
     83   driver produces multiple Driver Binding Protocols.
     84   If DriverBinding is NULL, then ASSERT().
     85   If the installation fails, then ASSERT().
     86 
     87   @param  ImageHandle          The image handle of the driver.
     88   @param  SystemTable          The EFI System Table that was passed to the driver's entry point.
     89   @param  DriverBinding        A Driver Binding Protocol instance that this driver is producing.
     90   @param  DriverBindingHandle  The handle that DriverBinding is to be installed onto.  If this
     91                                parameter is NULL, then a new handle is created.
     92   @param  ComponentName        A Component Name Protocol instance that this driver is producing.
     93   @param  DriverConfiguration  A Driver Configuration Protocol instance that this driver is producing.
     94   @param  DriverDiagnostics    A Driver Diagnostics Protocol instance that this driver is producing.
     95 
     96   @retval EFI_SUCCESS           The protocol installation successfully completed.
     97   @retval EFI_OUT_OF_RESOURCES  There was not enough memory in pool to install all the protocols.
     98 
     99 **/
    100 EFI_STATUS
    101 EFIAPI
    102 EfiLibInstallAllDriverProtocols (
    103   IN CONST EFI_HANDLE                         ImageHandle,
    104   IN CONST EFI_SYSTEM_TABLE                   *SystemTable,
    105   IN EFI_DRIVER_BINDING_PROTOCOL              *DriverBinding,
    106   IN EFI_HANDLE                               DriverBindingHandle,
    107   IN CONST EFI_COMPONENT_NAME_PROTOCOL        *ComponentName,       OPTIONAL
    108   IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL  *DriverConfiguration, OPTIONAL
    109   IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL    *DriverDiagnostics    OPTIONAL
    110   )
    111 {
    112   EFI_STATUS  Status;
    113 
    114   ASSERT (DriverBinding != NULL);
    115 
    116   //
    117   // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol
    118   //
    119   DriverBinding->ImageHandle         = ImageHandle;
    120   DriverBinding->DriverBindingHandle = DriverBindingHandle;
    121 
    122   if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
    123     if (DriverConfiguration == NULL) {
    124       if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
    125         Status = gBS->InstallMultipleProtocolInterfaces (
    126                         &DriverBinding->DriverBindingHandle,
    127                         &gEfiDriverBindingProtocolGuid, DriverBinding,
    128                         NULL
    129                         );
    130       } else {
    131         Status = gBS->InstallMultipleProtocolInterfaces (
    132                         &DriverBinding->DriverBindingHandle,
    133                         &gEfiDriverBindingProtocolGuid, DriverBinding,
    134                         &gEfiComponentNameProtocolGuid, ComponentName,
    135                         NULL
    136                         );
    137       }
    138     } else {
    139       if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
    140         Status = gBS->InstallMultipleProtocolInterfaces (
    141                         &DriverBinding->DriverBindingHandle,
    142                         &gEfiDriverBindingProtocolGuid,       DriverBinding,
    143                         &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
    144                         NULL
    145                         );
    146       } else {
    147         Status = gBS->InstallMultipleProtocolInterfaces (
    148                         &DriverBinding->DriverBindingHandle,
    149                         &gEfiDriverBindingProtocolGuid,       DriverBinding,
    150                         &gEfiComponentNameProtocolGuid,       ComponentName,
    151                         &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
    152                         NULL
    153                         );
    154       }
    155     }
    156   } else {
    157     if (DriverConfiguration == NULL) {
    158       if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
    159         Status = gBS->InstallMultipleProtocolInterfaces (
    160                         &DriverBinding->DriverBindingHandle,
    161                         &gEfiDriverBindingProtocolGuid,     DriverBinding,
    162                         &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
    163                         NULL
    164                         );
    165       } else {
    166         Status = gBS->InstallMultipleProtocolInterfaces (
    167                         &DriverBinding->DriverBindingHandle,
    168                         &gEfiDriverBindingProtocolGuid,     DriverBinding,
    169                         &gEfiComponentNameProtocolGuid,     ComponentName,
    170                         &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
    171                         NULL
    172                         );
    173       }
    174     } else {
    175       if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
    176        Status = gBS->InstallMultipleProtocolInterfaces (
    177                         &DriverBinding->DriverBindingHandle,
    178                         &gEfiDriverBindingProtocolGuid,       DriverBinding,
    179                         &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
    180                         &gEfiDriverDiagnosticsProtocolGuid,   DriverDiagnostics,
    181                         NULL
    182                         );
    183       } else {
    184         Status = gBS->InstallMultipleProtocolInterfaces (
    185                         &DriverBinding->DriverBindingHandle,
    186                         &gEfiDriverBindingProtocolGuid,       DriverBinding,
    187                         &gEfiComponentNameProtocolGuid,       ComponentName,
    188                         &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
    189                         &gEfiDriverDiagnosticsProtocolGuid,   DriverDiagnostics,
    190                         NULL
    191                         );
    192       }
    193     }
    194   }
    195 
    196   //
    197   // ASSERT if the call to InstallMultipleProtocolInterfaces() failed
    198   //
    199   ASSERT_EFI_ERROR (Status);
    200 
    201   return Status;
    202 }
    203 
    204 
    205 
    206 /**
    207   Installs Driver Binding Protocol with optional Component Name and Component Name 2 Protocols.
    208 
    209   Initializes a driver by installing the Driver Binding Protocol together with the
    210   optional Component Name and optional Component Name 2 protocols onto the driver's
    211   DriverBindingHandle.  If DriverBindingHandle is NULL, then the protocols are installed
    212   onto a newly created handle.  DriverBindingHandle is typically the same as the driver's
    213   ImageHandle, but it can be different if the driver produces multiple Driver Binding Protocols.
    214   If DriverBinding is NULL, then ASSERT().
    215   If the installation fails, then ASSERT().
    216 
    217   @param  ImageHandle          The image handle of the driver.
    218   @param  SystemTable          The EFI System Table that was passed to the driver's entry point.
    219   @param  DriverBinding        A Driver Binding Protocol instance that this driver is producing.
    220   @param  DriverBindingHandle  The handle that DriverBinding is to be installed onto.  If this
    221                                parameter is NULL, then a new handle is created.
    222   @param  ComponentName        A Component Name Protocol instance that this driver is producing.
    223   @param  ComponentName2       A Component Name 2 Protocol instance that this driver is producing.
    224 
    225   @retval EFI_SUCCESS           The protocol installation successfully completed.
    226   @retval EFI_OUT_OF_RESOURCES  There was not enough memory in pool to install all the protocols.
    227 
    228 **/
    229 EFI_STATUS
    230 EFIAPI
    231 EfiLibInstallDriverBindingComponentName2 (
    232   IN CONST EFI_HANDLE                         ImageHandle,
    233   IN CONST EFI_SYSTEM_TABLE                   *SystemTable,
    234   IN EFI_DRIVER_BINDING_PROTOCOL              *DriverBinding,
    235   IN EFI_HANDLE                               DriverBindingHandle,
    236   IN CONST EFI_COMPONENT_NAME_PROTOCOL        *ComponentName,       OPTIONAL
    237   IN CONST EFI_COMPONENT_NAME2_PROTOCOL       *ComponentName2       OPTIONAL
    238   )
    239 {
    240   EFI_STATUS  Status;
    241 
    242   ASSERT (DriverBinding != NULL);
    243 
    244   //
    245   // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol
    246   //
    247   DriverBinding->ImageHandle         = ImageHandle;
    248   DriverBinding->DriverBindingHandle = DriverBindingHandle;
    249 
    250   if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
    251     if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
    252       Status = gBS->InstallMultipleProtocolInterfaces (
    253                       &DriverBinding->DriverBindingHandle,
    254                       &gEfiDriverBindingProtocolGuid, DriverBinding,
    255                       NULL
    256                       );
    257       } else {
    258       Status = gBS->InstallMultipleProtocolInterfaces (
    259                       &DriverBinding->DriverBindingHandle,
    260                       &gEfiDriverBindingProtocolGuid, DriverBinding,
    261                       &gEfiComponentName2ProtocolGuid, ComponentName2,
    262                       NULL
    263                       );
    264      }
    265   } else {
    266      if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
    267        Status = gBS->InstallMultipleProtocolInterfaces (
    268                        &DriverBinding->DriverBindingHandle,
    269                        &gEfiDriverBindingProtocolGuid, DriverBinding,
    270                        &gEfiComponentNameProtocolGuid, ComponentName,
    271                        NULL
    272                        );
    273      } else {
    274        Status = gBS->InstallMultipleProtocolInterfaces (
    275                        &DriverBinding->DriverBindingHandle,
    276                        &gEfiDriverBindingProtocolGuid, DriverBinding,
    277                        &gEfiComponentNameProtocolGuid, ComponentName,
    278                        &gEfiComponentName2ProtocolGuid, ComponentName2,
    279                        NULL
    280                        );
    281     }
    282   }
    283 
    284   //
    285   // ASSERT if the call to InstallMultipleProtocolInterfaces() failed
    286   //
    287   ASSERT_EFI_ERROR (Status);
    288 
    289   return Status;
    290 }
    291 
    292 
    293 
    294 /**
    295   Installs Driver Binding Protocol with optional Component Name, Component Name 2, Driver
    296   Configuration, Driver Configuration 2, Driver Diagnostics, and Driver Diagnostics 2 Protocols.
    297 
    298   Initializes a driver by installing the Driver Binding Protocol together with the optional
    299   Component Name, optional Component Name 2, optional Driver Configuration, optional Driver Configuration 2,
    300   optional Driver Diagnostic, and optional Driver Diagnostic 2 Protocols onto the driver's DriverBindingHandle.
    301   DriverBindingHandle is typically the same as the driver's ImageHandle, but it can be different if the driver
    302   produces multiple Driver Binding Protocols.
    303   If DriverBinding is NULL, then ASSERT().
    304   If the installation fails, then ASSERT().
    305 
    306 
    307   @param  ImageHandle           The image handle of the driver.
    308   @param  SystemTable           The EFI System Table that was passed to the driver's entry point.
    309   @param  DriverBinding         A Driver Binding Protocol instance that this driver is producing.
    310   @param  DriverBindingHandle   The handle that DriverBinding is to be installed onto.  If this
    311                                 parameter is NULL, then a new handle is created.
    312   @param  ComponentName         A Component Name Protocol instance that this driver is producing.
    313   @param  ComponentName2        A Component Name 2 Protocol instance that this driver is producing.
    314   @param  DriverConfiguration   A Driver Configuration Protocol instance that this driver is producing.
    315   @param  DriverConfiguration2  A Driver Configuration Protocol 2 instance that this driver is producing.
    316   @param  DriverDiagnostics     A Driver Diagnostics Protocol instance that this driver is producing.
    317   @param  DriverDiagnostics2    A Driver Diagnostics Protocol 2 instance that this driver is producing.
    318 
    319   @retval EFI_SUCCESS           The protocol installation successfully completed.
    320   @retval EFI_OUT_OF_RESOURCES  There was not enough memory in pool to install all the protocols.
    321 
    322 **/
    323 EFI_STATUS
    324 EFIAPI
    325 EfiLibInstallAllDriverProtocols2 (
    326   IN CONST EFI_HANDLE                         ImageHandle,
    327   IN CONST EFI_SYSTEM_TABLE                   *SystemTable,
    328   IN EFI_DRIVER_BINDING_PROTOCOL              *DriverBinding,
    329   IN EFI_HANDLE                               DriverBindingHandle,
    330   IN CONST EFI_COMPONENT_NAME_PROTOCOL        *ComponentName,        OPTIONAL
    331   IN CONST EFI_COMPONENT_NAME2_PROTOCOL       *ComponentName2,       OPTIONAL
    332   IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL  *DriverConfiguration,  OPTIONAL
    333   IN CONST EFI_DRIVER_CONFIGURATION2_PROTOCOL *DriverConfiguration2, OPTIONAL
    334   IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL    *DriverDiagnostics,    OPTIONAL
    335   IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL   *DriverDiagnostics2    OPTIONAL
    336   )
    337 {
    338   EFI_STATUS  Status;
    339 
    340   ASSERT (DriverBinding != NULL);
    341 
    342   //
    343   // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol
    344   //
    345   DriverBinding->ImageHandle         = ImageHandle;
    346   DriverBinding->DriverBindingHandle = DriverBindingHandle;
    347 
    348   if (DriverConfiguration2 == NULL) {
    349     if (DriverConfiguration == NULL) {
    350       if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
    351         if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
    352           if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
    353             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
    354               Status = gBS->InstallMultipleProtocolInterfaces (
    355                               &DriverBinding->DriverBindingHandle,
    356                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    357                               NULL
    358                               );
    359             } else {
    360               Status = gBS->InstallMultipleProtocolInterfaces (
    361                               &DriverBinding->DriverBindingHandle,
    362                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    363                               &gEfiComponentName2ProtocolGuid, ComponentName2,
    364                               NULL
    365                               );
    366             }
    367           } else {
    368             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
    369               Status = gBS->InstallMultipleProtocolInterfaces (
    370                               &DriverBinding->DriverBindingHandle,
    371                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    372                               &gEfiComponentNameProtocolGuid, ComponentName,
    373                               NULL
    374                               );
    375             } else {
    376               Status = gBS->InstallMultipleProtocolInterfaces (
    377                               &DriverBinding->DriverBindingHandle,
    378                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    379                               &gEfiComponentNameProtocolGuid, ComponentName,
    380                               &gEfiComponentName2ProtocolGuid, ComponentName2,
    381                               NULL
    382                               );
    383             }
    384           }
    385         } else {
    386           if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
    387             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
    388               Status = gBS->InstallMultipleProtocolInterfaces (
    389                               &DriverBinding->DriverBindingHandle,
    390                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    391                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
    392                               NULL
    393                               );
    394             } else {
    395               Status = gBS->InstallMultipleProtocolInterfaces (
    396                               &DriverBinding->DriverBindingHandle,
    397                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    398                               &gEfiComponentName2ProtocolGuid, ComponentName2,
    399                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
    400                               NULL
    401                               );
    402             }
    403           } else {
    404             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
    405               Status = gBS->InstallMultipleProtocolInterfaces (
    406                               &DriverBinding->DriverBindingHandle,
    407                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    408                               &gEfiComponentNameProtocolGuid, ComponentName,
    409                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
    410                               NULL
    411                               );
    412             } else {
    413               Status = gBS->InstallMultipleProtocolInterfaces (
    414                               &DriverBinding->DriverBindingHandle,
    415                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    416                               &gEfiComponentNameProtocolGuid, ComponentName,
    417                               &gEfiComponentName2ProtocolGuid, ComponentName2,
    418                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
    419                               NULL
    420                               );
    421             }
    422           }
    423         }
    424       } else {
    425         if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
    426           if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
    427             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
    428               Status = gBS->InstallMultipleProtocolInterfaces (
    429                               &DriverBinding->DriverBindingHandle,
    430                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    431                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
    432                               NULL
    433                               );
    434             } else {
    435               Status = gBS->InstallMultipleProtocolInterfaces (
    436                               &DriverBinding->DriverBindingHandle,
    437                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    438                               &gEfiComponentName2ProtocolGuid, ComponentName2,
    439                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
    440                               NULL
    441                               );
    442             }
    443           } else {
    444             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
    445               Status = gBS->InstallMultipleProtocolInterfaces (
    446                               &DriverBinding->DriverBindingHandle,
    447                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    448                               &gEfiComponentNameProtocolGuid, ComponentName,
    449                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
    450                               NULL
    451                               );
    452             } else {
    453               Status = gBS->InstallMultipleProtocolInterfaces (
    454                               &DriverBinding->DriverBindingHandle,
    455                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    456                               &gEfiComponentNameProtocolGuid, ComponentName,
    457                               &gEfiComponentName2ProtocolGuid, ComponentName2,
    458                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
    459                               NULL
    460                               );
    461             }
    462           }
    463         } else {
    464           if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
    465             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
    466               Status = gBS->InstallMultipleProtocolInterfaces (
    467                               &DriverBinding->DriverBindingHandle,
    468                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    469                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
    470                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
    471                               NULL
    472                               );
    473             } else {
    474               Status = gBS->InstallMultipleProtocolInterfaces (
    475                               &DriverBinding->DriverBindingHandle,
    476                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    477                               &gEfiComponentName2ProtocolGuid, ComponentName2,
    478                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
    479                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
    480                               NULL
    481                               );
    482             }
    483           } else {
    484             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
    485               Status = gBS->InstallMultipleProtocolInterfaces (
    486                               &DriverBinding->DriverBindingHandle,
    487                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    488                               &gEfiComponentNameProtocolGuid, ComponentName,
    489                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
    490                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
    491                               NULL
    492                               );
    493             } else {
    494               Status = gBS->InstallMultipleProtocolInterfaces (
    495                               &DriverBinding->DriverBindingHandle,
    496                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    497                               &gEfiComponentNameProtocolGuid, ComponentName,
    498                               &gEfiComponentName2ProtocolGuid, ComponentName2,
    499                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
    500                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
    501                               NULL
    502                               );
    503             }
    504           }
    505         }
    506       }
    507     } else {
    508       if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
    509         if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
    510           if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
    511             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
    512               Status = gBS->InstallMultipleProtocolInterfaces (
    513                               &DriverBinding->DriverBindingHandle,
    514                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    515                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
    516                               NULL
    517                               );
    518             } else {
    519               Status = gBS->InstallMultipleProtocolInterfaces (
    520                               &DriverBinding->DriverBindingHandle,
    521                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    522                               &gEfiComponentName2ProtocolGuid, ComponentName2,
    523                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
    524                               NULL
    525                               );
    526             }
    527           } else {
    528             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
    529               Status = gBS->InstallMultipleProtocolInterfaces (
    530                               &DriverBinding->DriverBindingHandle,
    531                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    532                               &gEfiComponentNameProtocolGuid, ComponentName,
    533                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
    534                               NULL
    535                               );
    536             } else {
    537               Status = gBS->InstallMultipleProtocolInterfaces (
    538                               &DriverBinding->DriverBindingHandle,
    539                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    540                               &gEfiComponentNameProtocolGuid, ComponentName,
    541                               &gEfiComponentName2ProtocolGuid, ComponentName2,
    542                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
    543                               NULL
    544                               );
    545             }
    546           }
    547         } else {
    548           if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
    549             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
    550               Status = gBS->InstallMultipleProtocolInterfaces (
    551                               &DriverBinding->DriverBindingHandle,
    552                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    553                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
    554                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
    555                               NULL
    556                               );
    557             } else {
    558               Status = gBS->InstallMultipleProtocolInterfaces (
    559                               &DriverBinding->DriverBindingHandle,
    560                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    561                               &gEfiComponentName2ProtocolGuid, ComponentName2,
    562                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
    563                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
    564                               NULL
    565                               );
    566             }
    567           } else {
    568             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
    569               Status = gBS->InstallMultipleProtocolInterfaces (
    570                               &DriverBinding->DriverBindingHandle,
    571                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    572                               &gEfiComponentNameProtocolGuid, ComponentName,
    573                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
    574                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
    575                               NULL
    576                               );
    577             } else {
    578               Status = gBS->InstallMultipleProtocolInterfaces (
    579                               &DriverBinding->DriverBindingHandle,
    580                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    581                               &gEfiComponentNameProtocolGuid, ComponentName,
    582                               &gEfiComponentName2ProtocolGuid, ComponentName2,
    583                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
    584                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
    585                               NULL
    586                               );
    587             }
    588           }
    589         }
    590       } else {
    591         if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
    592           if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
    593             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
    594               Status = gBS->InstallMultipleProtocolInterfaces (
    595                               &DriverBinding->DriverBindingHandle,
    596                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    597                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
    598                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
    599                               NULL
    600                               );
    601             } else {
    602               Status = gBS->InstallMultipleProtocolInterfaces (
    603                               &DriverBinding->DriverBindingHandle,
    604                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    605                               &gEfiComponentName2ProtocolGuid, ComponentName2,
    606                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
    607                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
    608                               NULL
    609                               );
    610             }
    611           } else {
    612             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
    613               Status = gBS->InstallMultipleProtocolInterfaces (
    614                               &DriverBinding->DriverBindingHandle,
    615                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    616                               &gEfiComponentNameProtocolGuid, ComponentName,
    617                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
    618                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
    619                               NULL
    620                               );
    621             } else {
    622               Status = gBS->InstallMultipleProtocolInterfaces (
    623                               &DriverBinding->DriverBindingHandle,
    624                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    625                               &gEfiComponentNameProtocolGuid, ComponentName,
    626                               &gEfiComponentName2ProtocolGuid, ComponentName2,
    627                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
    628                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
    629                               NULL
    630                               );
    631             }
    632           }
    633         } else {
    634           if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
    635             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
    636               Status = gBS->InstallMultipleProtocolInterfaces (
    637                               &DriverBinding->DriverBindingHandle,
    638                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    639                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
    640                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
    641                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
    642                               NULL
    643                               );
    644             } else {
    645               Status = gBS->InstallMultipleProtocolInterfaces (
    646                               &DriverBinding->DriverBindingHandle,
    647                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    648                               &gEfiComponentName2ProtocolGuid, ComponentName2,
    649                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
    650                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
    651                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
    652                               NULL
    653                               );
    654             }
    655           } else {
    656             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
    657               Status = gBS->InstallMultipleProtocolInterfaces (
    658                               &DriverBinding->DriverBindingHandle,
    659                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    660                               &gEfiComponentNameProtocolGuid, ComponentName,
    661                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
    662                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
    663                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
    664                               NULL
    665                               );
    666             } else {
    667               Status = gBS->InstallMultipleProtocolInterfaces (
    668                               &DriverBinding->DriverBindingHandle,
    669                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    670                               &gEfiComponentNameProtocolGuid, ComponentName,
    671                               &gEfiComponentName2ProtocolGuid, ComponentName2,
    672                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
    673                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
    674                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
    675                               NULL
    676                               );
    677             }
    678           }
    679         }
    680       }
    681     }
    682   } else {
    683     if (DriverConfiguration == NULL) {
    684       if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
    685         if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
    686           if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
    687             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
    688               Status = gBS->InstallMultipleProtocolInterfaces (
    689                               &DriverBinding->DriverBindingHandle,
    690                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    691                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
    692                               NULL
    693                               );
    694             } else {
    695               Status = gBS->InstallMultipleProtocolInterfaces (
    696                               &DriverBinding->DriverBindingHandle,
    697                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    698                               &gEfiComponentName2ProtocolGuid, ComponentName2,
    699                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
    700                               NULL
    701                               );
    702             }
    703           } else {
    704             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
    705               Status = gBS->InstallMultipleProtocolInterfaces (
    706                               &DriverBinding->DriverBindingHandle,
    707                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    708                               &gEfiComponentNameProtocolGuid, ComponentName,
    709                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
    710                               NULL
    711                               );
    712             } else {
    713               Status = gBS->InstallMultipleProtocolInterfaces (
    714                               &DriverBinding->DriverBindingHandle,
    715                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    716                               &gEfiComponentNameProtocolGuid, ComponentName,
    717                               &gEfiComponentName2ProtocolGuid, ComponentName2,
    718                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
    719                               NULL
    720                               );
    721             }
    722           }
    723         } else {
    724           if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
    725             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
    726               Status = gBS->InstallMultipleProtocolInterfaces (
    727                               &DriverBinding->DriverBindingHandle,
    728                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    729                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
    730                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
    731                               NULL
    732                               );
    733             } else {
    734               Status = gBS->InstallMultipleProtocolInterfaces (
    735                               &DriverBinding->DriverBindingHandle,
    736                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    737                               &gEfiComponentName2ProtocolGuid, ComponentName2,
    738                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
    739                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
    740                               NULL
    741                               );
    742             }
    743           } else {
    744             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
    745               Status = gBS->InstallMultipleProtocolInterfaces (
    746                               &DriverBinding->DriverBindingHandle,
    747                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    748                               &gEfiComponentNameProtocolGuid, ComponentName,
    749                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
    750                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
    751                               NULL
    752                               );
    753             } else {
    754               Status = gBS->InstallMultipleProtocolInterfaces (
    755                               &DriverBinding->DriverBindingHandle,
    756                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    757                               &gEfiComponentNameProtocolGuid, ComponentName,
    758                               &gEfiComponentName2ProtocolGuid, ComponentName2,
    759                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
    760                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
    761                               NULL
    762                               );
    763             }
    764           }
    765         }
    766       } else {
    767         if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
    768           if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
    769             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
    770               Status = gBS->InstallMultipleProtocolInterfaces (
    771                               &DriverBinding->DriverBindingHandle,
    772                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    773                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
    774                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
    775                               NULL
    776                               );
    777             } else {
    778               Status = gBS->InstallMultipleProtocolInterfaces (
    779                               &DriverBinding->DriverBindingHandle,
    780                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    781                               &gEfiComponentName2ProtocolGuid, ComponentName2,
    782                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
    783                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
    784                               NULL
    785                               );
    786             }
    787           } else {
    788             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
    789               Status = gBS->InstallMultipleProtocolInterfaces (
    790                               &DriverBinding->DriverBindingHandle,
    791                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    792                               &gEfiComponentNameProtocolGuid, ComponentName,
    793                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
    794                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
    795                               NULL
    796                               );
    797             } else {
    798               Status = gBS->InstallMultipleProtocolInterfaces (
    799                               &DriverBinding->DriverBindingHandle,
    800                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    801                               &gEfiComponentNameProtocolGuid, ComponentName,
    802                               &gEfiComponentName2ProtocolGuid, ComponentName2,
    803                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
    804                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
    805                               NULL
    806                               );
    807             }
    808           }
    809         } else {
    810           if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
    811             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
    812               Status = gBS->InstallMultipleProtocolInterfaces (
    813                               &DriverBinding->DriverBindingHandle,
    814                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    815                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
    816                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
    817                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
    818                               NULL
    819                               );
    820             } else {
    821               Status = gBS->InstallMultipleProtocolInterfaces (
    822                               &DriverBinding->DriverBindingHandle,
    823                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    824                               &gEfiComponentName2ProtocolGuid, ComponentName2,
    825                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
    826                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
    827                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
    828                               NULL
    829                               );
    830             }
    831           } else {
    832             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
    833               Status = gBS->InstallMultipleProtocolInterfaces (
    834                               &DriverBinding->DriverBindingHandle,
    835                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    836                               &gEfiComponentNameProtocolGuid, ComponentName,
    837                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
    838                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
    839                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
    840                               NULL
    841                               );
    842             } else {
    843               Status = gBS->InstallMultipleProtocolInterfaces (
    844                               &DriverBinding->DriverBindingHandle,
    845                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    846                               &gEfiComponentNameProtocolGuid, ComponentName,
    847                               &gEfiComponentName2ProtocolGuid, ComponentName2,
    848                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
    849                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
    850                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
    851                               NULL
    852                               );
    853             }
    854           }
    855         }
    856       }
    857     } else {
    858       if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
    859         if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
    860           if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
    861             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
    862               Status = gBS->InstallMultipleProtocolInterfaces (
    863                               &DriverBinding->DriverBindingHandle,
    864                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    865                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
    866                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
    867                               NULL
    868                               );
    869             } else {
    870               Status = gBS->InstallMultipleProtocolInterfaces (
    871                               &DriverBinding->DriverBindingHandle,
    872                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    873                               &gEfiComponentName2ProtocolGuid, ComponentName2,
    874                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
    875                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
    876                               NULL
    877                               );
    878             }
    879           } else {
    880             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
    881               Status = gBS->InstallMultipleProtocolInterfaces (
    882                               &DriverBinding->DriverBindingHandle,
    883                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    884                               &gEfiComponentNameProtocolGuid, ComponentName,
    885                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
    886                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
    887                               NULL
    888                               );
    889             } else {
    890               Status = gBS->InstallMultipleProtocolInterfaces (
    891                               &DriverBinding->DriverBindingHandle,
    892                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    893                               &gEfiComponentNameProtocolGuid, ComponentName,
    894                               &gEfiComponentName2ProtocolGuid, ComponentName2,
    895                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
    896                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
    897                               NULL
    898                               );
    899             }
    900           }
    901         } else {
    902           if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
    903             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
    904               Status = gBS->InstallMultipleProtocolInterfaces (
    905                               &DriverBinding->DriverBindingHandle,
    906                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    907                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
    908                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
    909                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
    910                               NULL
    911                               );
    912             } else {
    913               Status = gBS->InstallMultipleProtocolInterfaces (
    914                               &DriverBinding->DriverBindingHandle,
    915                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    916                               &gEfiComponentName2ProtocolGuid, ComponentName2,
    917                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
    918                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
    919                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
    920                               NULL
    921                               );
    922             }
    923           } else {
    924             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
    925               Status = gBS->InstallMultipleProtocolInterfaces (
    926                               &DriverBinding->DriverBindingHandle,
    927                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    928                               &gEfiComponentNameProtocolGuid, ComponentName,
    929                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
    930                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
    931                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
    932                               NULL
    933                               );
    934             } else {
    935               Status = gBS->InstallMultipleProtocolInterfaces (
    936                               &DriverBinding->DriverBindingHandle,
    937                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    938                               &gEfiComponentNameProtocolGuid, ComponentName,
    939                               &gEfiComponentName2ProtocolGuid, ComponentName2,
    940                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
    941                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
    942                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
    943                               NULL
    944                               );
    945             }
    946           }
    947         }
    948       } else {
    949         if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
    950           if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
    951             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
    952               Status = gBS->InstallMultipleProtocolInterfaces (
    953                               &DriverBinding->DriverBindingHandle,
    954                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    955                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
    956                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
    957                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
    958                               NULL
    959                               );
    960             } else {
    961               Status = gBS->InstallMultipleProtocolInterfaces (
    962                               &DriverBinding->DriverBindingHandle,
    963                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    964                               &gEfiComponentName2ProtocolGuid, ComponentName2,
    965                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
    966                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
    967                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
    968                               NULL
    969                               );
    970             }
    971           } else {
    972             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
    973               Status = gBS->InstallMultipleProtocolInterfaces (
    974                               &DriverBinding->DriverBindingHandle,
    975                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    976                               &gEfiComponentNameProtocolGuid, ComponentName,
    977                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
    978                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
    979                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
    980                               NULL
    981                               );
    982             } else {
    983               Status = gBS->InstallMultipleProtocolInterfaces (
    984                               &DriverBinding->DriverBindingHandle,
    985                               &gEfiDriverBindingProtocolGuid, DriverBinding,
    986                               &gEfiComponentNameProtocolGuid, ComponentName,
    987                               &gEfiComponentName2ProtocolGuid, ComponentName2,
    988                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
    989                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
    990                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
    991                               NULL
    992                               );
    993             }
    994           }
    995         } else {
    996           if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
    997             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
    998               Status = gBS->InstallMultipleProtocolInterfaces (
    999                               &DriverBinding->DriverBindingHandle,
   1000                               &gEfiDriverBindingProtocolGuid, DriverBinding,
   1001                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
   1002                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
   1003                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
   1004                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
   1005                               NULL
   1006                               );
   1007             } else {
   1008               Status = gBS->InstallMultipleProtocolInterfaces (
   1009                               &DriverBinding->DriverBindingHandle,
   1010                               &gEfiDriverBindingProtocolGuid, DriverBinding,
   1011                               &gEfiComponentName2ProtocolGuid, ComponentName2,
   1012                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
   1013                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
   1014                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
   1015                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
   1016                               NULL
   1017                               );
   1018             }
   1019           } else {
   1020             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
   1021               Status = gBS->InstallMultipleProtocolInterfaces (
   1022                               &DriverBinding->DriverBindingHandle,
   1023                               &gEfiDriverBindingProtocolGuid, DriverBinding,
   1024                               &gEfiComponentNameProtocolGuid, ComponentName,
   1025                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
   1026                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
   1027                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
   1028                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
   1029                               NULL
   1030                               );
   1031             } else {
   1032               Status = gBS->InstallMultipleProtocolInterfaces (
   1033                               &DriverBinding->DriverBindingHandle,
   1034                               &gEfiDriverBindingProtocolGuid, DriverBinding,
   1035                               &gEfiComponentNameProtocolGuid, ComponentName,
   1036                               &gEfiComponentName2ProtocolGuid, ComponentName2,
   1037                               &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
   1038                               &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
   1039                               &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
   1040                               &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
   1041                               NULL
   1042                               );
   1043             }
   1044           }
   1045         }
   1046       }
   1047     }
   1048   }
   1049 
   1050   //
   1051   // ASSERT if the call to InstallMultipleProtocolInterfaces() failed
   1052   //
   1053   ASSERT_EFI_ERROR (Status);
   1054 
   1055   return Status;
   1056 }
   1057