From 6313f115aa718cee90c9bc7f80effcfd6835a5c6 Mon Sep 17 00:00:00 2001 From: qhuang8 Date: Mon, 17 Sep 2007 03:41:47 +0000 Subject: [PATCH] 1. Add Missing UefiDrvierModel APIs in UefiLibFramework instances. 2. Fix the bug to judge Media Device Path. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3863 6f19259b-4bc3-4df7-8a09-765794883524 --- .../UefiLibFramework/UefiDriverModel.c | 670 ++++++++++++++++++ .../UefiLibFramework/UefiLibFramework.inf | 2 +- .../Library/UefiLibFramework/UefiNotTiano.c | 2 +- 3 files changed, 672 insertions(+), 2 deletions(-) create mode 100644 IntelFrameworkPkg/Library/UefiLibFramework/UefiDriverModel.c diff --git a/IntelFrameworkPkg/Library/UefiLibFramework/UefiDriverModel.c b/IntelFrameworkPkg/Library/UefiLibFramework/UefiDriverModel.c new file mode 100644 index 0000000000..2153aad337 --- /dev/null +++ b/IntelFrameworkPkg/Library/UefiLibFramework/UefiDriverModel.c @@ -0,0 +1,670 @@ +/** @file + Library functions that abstract driver model protocols + installation. + + Copyright (c) 2006 - 2007, Intel Corporation
All rights + reserved. This program and the accompanying materials are + licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +// +// Include common header file for this module. +// +#include "UefiLibInternal.h" + +/** + Intialize a driver by installing the Driver Binding Protocol onto the driver's + DriverBindingHandle. This is typically the same as the driver's ImageHandle, but + it can be different if the driver produces multiple DriverBinding Protocols. + If the Drvier Binding Protocol interface is NULL, then ASSERT (). + If the installation fails, then ASSERT (). + + @param ImageHandle The image handle of the driver. + @param SystemTable The EFI System Table that was passed to the driver's entry point. + @param DriverBinding A Driver Binding Protocol instance that this driver is producing. + @param DriverBindingHandle The handle that DriverBinding is to be installe onto. If this + parameter is NULL, then a new handle is created. + + @retval EFI_SUCCESS The protocol installation is completed successfully. + @retval Others Status from gBS->InstallMultipleProtocolInterfaces(). + +**/ +EFI_STATUS +EFIAPI +EfiLibInstallDriverBinding ( + IN CONST EFI_HANDLE ImageHandle, + IN CONST EFI_SYSTEM_TABLE *SystemTable, + IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding, + IN EFI_HANDLE DriverBindingHandle + ) +{ + EFI_STATUS Status; + + ASSERT (NULL != DriverBinding); + + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + NULL + ); + // + // ASSERT if the call to InstallMultipleProtocolInterfaces() failed + // + ASSERT_EFI_ERROR (Status); + + // + // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol + // + DriverBinding->ImageHandle = ImageHandle; + DriverBinding->DriverBindingHandle = DriverBindingHandle; + + return Status; +} + + +/** + Intialize a driver by installing the Driver Binding Protocol together with the optional Component Name, + Driver Configure and Driver Diagnostic Protocols onto the driver's DriverBindingHandle. This is + typically the same as the driver's ImageHandle, but it can be different if the driver produces multiple + DriverBinding Protocols. + If the Drvier Binding Protocol interface is NULL, then ASSERT (). + If the installation fails, then ASSERT (). + + @param ImageHandle The image handle of the driver. + @param SystemTable The EFI System Table that was passed to the driver's entry point. + @param DriverBinding A Driver Binding Protocol instance that this driver is producing. + @param DriverBindingHandle The handle that DriverBinding is to be installe onto. If this + parameter is NULL, then a new handle is created. + @param ComponentName A Component Name Protocol instance that this driver is producing. + @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing. + @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing. + + @retval EFI_SUCCESS The protocol installation is completed successfully. + @retval Others Status from gBS->InstallMultipleProtocolInterfaces(). + +**/ +EFI_STATUS +EFIAPI +EfiLibInstallAllDriverProtocols ( + IN CONST EFI_HANDLE ImageHandle, + IN CONST EFI_SYSTEM_TABLE *SystemTable, + IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding, + IN EFI_HANDLE DriverBindingHandle, + IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL + IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL + IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics OPTIONAL + ) +{ + EFI_STATUS Status; + + ASSERT (NULL != DriverBinding); + + if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) { + if (DriverConfiguration == NULL) { + if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + NULL + ); + } else { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiComponentNameProtocolGuid, ComponentName, + NULL + ); + } + } else { + if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, + NULL + ); + } else { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiComponentNameProtocolGuid, ComponentName, + &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, + NULL + ); + } + } + } else { + if (DriverConfiguration == NULL) { + if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, + NULL + ); + } else { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiComponentNameProtocolGuid, ComponentName, + &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, + NULL + ); + } + } else { + if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, + &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, + NULL + ); + } else { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiComponentNameProtocolGuid, ComponentName, + &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, + &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, + NULL + ); + } + } + } + + // + // ASSERT if the call to InstallMultipleProtocolInterfaces() failed + // + ASSERT_EFI_ERROR (Status); + + // + // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol + // + DriverBinding->ImageHandle = ImageHandle; + DriverBinding->DriverBindingHandle = DriverBindingHandle; + + return Status; +} + + + +/** + Intialize a driver by installing the Driver Binding Protocol together with the optional Component Name, + Component Name 2 onto the driver's DriverBindingHandle. This is typically the same as the driver's + ImageHandle, but it can be different if the driver produces multiple DriverBinding Protocols. + If the Drvier Binding Protocol interface is NULL, then ASSERT (). + If the installation fails, then ASSERT (). + + @param ImageHandle The image handle of the driver. + @param SystemTable The EFI System Table that was passed to the driver's entry point. + @param DriverBinding A Driver Binding Protocol instance that this driver is producing. + @param DriverBindingHandle The handle that DriverBinding is to be installe onto. If this + parameter is NULL, then a new handle is created. + @param ComponentName A Component Name Protocol instance that this driver is producing. + @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing. + + @retval EFI_SUCCESS The protocol installation is completed successfully. + @retval Others Status from gBS->InstallMultipleProtocolInterfaces(). + +**/ +EFI_STATUS +EFIAPI +EfiLibInstallDriverBindingComponentName2 ( + IN CONST EFI_HANDLE ImageHandle, + IN CONST EFI_SYSTEM_TABLE *SystemTable, + IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding, + IN EFI_HANDLE DriverBindingHandle, + IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL + IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL + ) +{ + EFI_STATUS Status; + + ASSERT (NULL != DriverBinding); + + if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { + if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + NULL + ); + } else { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiComponentName2ProtocolGuid, ComponentName2, + NULL + ); + } + } else { + if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiComponentNameProtocolGuid, ComponentName, + NULL + ); + } else { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiComponentNameProtocolGuid, ComponentName, + &gEfiComponentName2ProtocolGuid, ComponentName2, + NULL + ); + } + } + // + // ASSERT if the call to InstallMultipleProtocolInterfaces() failed + // + ASSERT_EFI_ERROR (Status); + + // + // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol + // + DriverBinding->ImageHandle = ImageHandle; + DriverBinding->DriverBindingHandle = DriverBindingHandle; + + return Status; +} + + + +/** + Intialize a driver by installing the Driver Binding Protocol together with the optional Component Name, + Component Name 2, Driver Configure, Driver Diagnostic and Driver Diagnostic 2 Protocols onto the driver's + DriverBindingHandle. This is typically the same as the driver's ImageHandle, but it can be different if + the driver produces multiple DriverBinding Protocols. + If the Drvier Binding Protocol interface is NULL, then ASSERT (). + If the installation fails, then ASSERT (). + + @param ImageHandle The image handle of the driver. + @param SystemTable The EFI System Table that was passed to the driver's entry point. + @param DriverBinding A Driver Binding Protocol instance that this driver is producing. + @param DriverBindingHandle The handle that DriverBinding is to be installe onto. If this + parameter is NULL, then a new handle is created. + @param ComponentName A Component Name Protocol instance that this driver is producing. + @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing. + @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing. + @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing. + @param DriverDiagnostics2 A Driver Diagnostics Protocol 2 instance that this driver is producing. + + @retval EFI_SUCCESS The protocol installation is completed successfully. + @retval Others Status from gBS->InstallMultipleProtocolInterfaces(). + +**/ +EFI_STATUS +EFIAPI +EfiLibInstallAllDriverProtocols2 ( + IN CONST EFI_HANDLE ImageHandle, + IN CONST EFI_SYSTEM_TABLE *SystemTable, + IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding, + IN EFI_HANDLE DriverBindingHandle, + IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL + IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2, OPTIONAL + IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL + IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics, OPTIONAL + IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2 OPTIONAL + ) +{ + EFI_STATUS Status; + + ASSERT (NULL != DriverBinding); + + if (DriverConfiguration == NULL) { + if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) { + if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) { + if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { + if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + NULL + ); + } else { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiComponentName2ProtocolGuid, ComponentName2, + NULL + ); + } + } else { + if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiComponentNameProtocolGuid, ComponentName, + NULL + ); + } else { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiComponentNameProtocolGuid, ComponentName, + &gEfiComponentName2ProtocolGuid, ComponentName2, + NULL + ); + } + } + } else { + if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { + if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, + NULL + ); + } else { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiComponentName2ProtocolGuid, ComponentName2, + &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, + NULL + ); + } + } else { + if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiComponentNameProtocolGuid, ComponentName, + &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, + NULL + ); + } else { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiComponentNameProtocolGuid, ComponentName, + &gEfiComponentName2ProtocolGuid, ComponentName2, + &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, + NULL + ); + } + } + } + } else { + if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) { + if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { + if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, + NULL + ); + } else { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiComponentName2ProtocolGuid, ComponentName2, + &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, + NULL + ); + } + } else { + if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiComponentNameProtocolGuid, ComponentName, + &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, + NULL + ); + } else { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiComponentNameProtocolGuid, ComponentName, + &gEfiComponentName2ProtocolGuid, ComponentName2, + &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, + NULL + ); + } + } + } else { + if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { + if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, + &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, + NULL + ); + } else { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiComponentName2ProtocolGuid, ComponentName2, + &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, + &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, + NULL + ); + } + } else { + if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiComponentNameProtocolGuid, ComponentName, + &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, + &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, + NULL + ); + } else { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiComponentNameProtocolGuid, ComponentName, + &gEfiComponentName2ProtocolGuid, ComponentName2, + &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, + &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, + NULL + ); + } + } + } + } + } else { + if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) { + if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) { + if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { + if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, + NULL + ); + } else { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiComponentName2ProtocolGuid, ComponentName2, + &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, + NULL + ); + } + } else { + if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiComponentNameProtocolGuid, ComponentName, + &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, + NULL + ); + } else { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiComponentNameProtocolGuid, ComponentName, + &gEfiComponentName2ProtocolGuid, ComponentName2, + &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, + NULL + ); + } + } + } else { + if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { + if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, + &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, + NULL + ); + } else { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiComponentName2ProtocolGuid, ComponentName2, + &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, + &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, + NULL + ); + } + } else { + if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiComponentNameProtocolGuid, ComponentName, + &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, + &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, + NULL + ); + } else { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiComponentNameProtocolGuid, ComponentName, + &gEfiComponentName2ProtocolGuid, ComponentName2, + &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, + &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, + NULL + ); + } + } + } + } else { + if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) { + if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { + if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, + &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, + NULL + ); + } else { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiComponentName2ProtocolGuid, ComponentName2, + &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, + &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, + NULL + ); + } + } else { + if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiComponentNameProtocolGuid, ComponentName, + &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, + &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, + NULL + ); + } else { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiComponentNameProtocolGuid, ComponentName, + &gEfiComponentName2ProtocolGuid, ComponentName2, + &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, + &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, + NULL + ); + } + } + } else { + if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { + if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, + &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, + &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, + NULL + ); + } else { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiComponentName2ProtocolGuid, ComponentName2, + &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, + &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, + &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, + NULL + ); + } + } else { + if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiComponentNameProtocolGuid, ComponentName, + &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, + &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, + &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, + NULL + ); + } else { + Status = gBS->InstallMultipleProtocolInterfaces ( + &DriverBindingHandle, + &gEfiDriverBindingProtocolGuid, DriverBinding, + &gEfiComponentNameProtocolGuid, ComponentName, + &gEfiComponentName2ProtocolGuid, ComponentName2, + &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, + &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, + &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, + NULL + ); + } + } + } + } + } + + // + // ASSERT if the call to InstallMultipleProtocolInterfaces() failed + // + ASSERT_EFI_ERROR (Status); + + // + // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol + // + DriverBinding->ImageHandle = ImageHandle; + DriverBinding->DriverBindingHandle = DriverBindingHandle; + + return Status; +} + + diff --git a/IntelFrameworkPkg/Library/UefiLibFramework/UefiLibFramework.inf b/IntelFrameworkPkg/Library/UefiLibFramework/UefiLibFramework.inf index 9084cb6d04..396c4c9f70 100644 --- a/IntelFrameworkPkg/Library/UefiLibFramework/UefiLibFramework.inf +++ b/IntelFrameworkPkg/Library/UefiLibFramework/UefiLibFramework.inf @@ -39,7 +39,7 @@ UefiNotTiano.c Console.c UefiLib.c - + UefiDriverModel.c [Packages] MdePkg/MdePkg.dec diff --git a/IntelFrameworkPkg/Library/UefiLibFramework/UefiNotTiano.c b/IntelFrameworkPkg/Library/UefiLibFramework/UefiNotTiano.c index 59c533d8ba..d3c832ff7e 100644 --- a/IntelFrameworkPkg/Library/UefiLibFramework/UefiNotTiano.c +++ b/IntelFrameworkPkg/Library/UefiLibFramework/UefiNotTiano.c @@ -297,7 +297,7 @@ EfiGetNameGuidFromFwVolDevicePathNode ( // // Use the new Device path that does not conflict with the UEFI // - if (FrameworkFvDevicePathNode->Tiano.Header.Type == MEDIA_DEVICE_PATH || + if (FrameworkFvDevicePathNode->Tiano.Header.Type == MEDIA_DEVICE_PATH && FrameworkFvDevicePathNode->Tiano.Header.SubType == MEDIA_VENDOR_DP) { if (CompareGuid (&gEfiFrameworkDevicePathGuid, &FrameworkFvDevicePathNode->Tiano.TianoSpecificDevicePath)) { if (FrameworkFvDevicePathNode->Tiano.Type == TIANO_MEDIA_FW_VOL_FILEPATH_DEVICE_PATH_TYPE) { -- 2.39.2