From d850121ecda615d7f5817c6cc429336ac2168360 Mon Sep 17 00:00:00 2001 From: qhuang8 Date: Tue, 8 Jul 2008 07:08:54 +0000 Subject: [PATCH] Some adjustment in ECP to make it compatible with EDK1.01(EDK1117) foundation in UEFI2.0+Framework0.9x build mode for silicon modules git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5418 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Library/Dxe/EfiDriverLib/EfiDriverLib.c | 5 + .../Dxe/EfiDriverLib/EfiDriverModelLib.c | 251 ++++++++++++++---- .../Library/Dxe/Include/EfiDriverLib.h | 61 ++++- 3 files changed, 261 insertions(+), 56 deletions(-) diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/EfiDriverLib/EfiDriverLib.c b/EdkCompatibilityPkg/Foundation/Library/Dxe/EfiDriverLib/EfiDriverLib.c index f1af8cc74d..9add9e7a56 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Dxe/EfiDriverLib/EfiDriverLib.c +++ b/EdkCompatibilityPkg/Foundation/Library/Dxe/EfiDriverLib/EfiDriverLib.c @@ -138,6 +138,11 @@ NextSupportedLanguage ( #ifdef LANGUAGE_RFC_3066 // LANGUAGE_RFC_3066 for (; (*Languages != 0) && (*Languages != ';'); Languages++) ; + + if (*Languages == ';') { + Languages++; + } + return Languages; #else // LANGUAGE_ISO_639_2 return (Languages + 3); diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/EfiDriverLib/EfiDriverModelLib.c b/EdkCompatibilityPkg/Foundation/Library/Dxe/EfiDriverLib/EfiDriverModelLib.c index 5c2b47b66e..eef61548b3 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Dxe/EfiDriverLib/EfiDriverModelLib.c +++ b/EdkCompatibilityPkg/Foundation/Library/Dxe/EfiDriverLib/EfiDriverModelLib.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2004 - 2007, Intel Corporation +Copyright (c) 2004 - 2008, 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 @@ -72,17 +72,149 @@ Returns: ); } +EFI_STATUS +InstallAllDriverProtocolsWorker ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE * SystemTable, + IN EFI_DRIVER_BINDING_PROTOCOL * DriverBinding, + IN EFI_HANDLE DriverBindingHandle, + IN EFI_COMPONENT_NAME_PROTOCOL * ComponentName, OPTIONAL + IN EFI_COMPONENT_NAME2_PROTOCOL * ComponentName2, OPTIONAL + IN EFI_DRIVER_CONFIGURATION_PROTOCOL * DriverConfiguration, OPTIONAL + IN EFI_DRIVER_CONFIGURATION2_PROTOCOL * DriverConfiguration2, OPTIONAL + IN EFI_DRIVER_DIAGNOSTICS_PROTOCOL * DriverDiagnostics, OPTIONAL + IN EFI_DRIVER_DIAGNOSTICS2_PROTOCOL * DriverDiagnostics2 OPTIONAL + ) +/*++ + +Routine Description: + + 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. This function also initializes the EFI Driver + Library that initializes the global variables gST, gBS, gRT. + +Arguments: + + ImageHandle - The image handle of the driver + + SystemTable - The EFI System Table that was passed to the driver's entry point + + DriverBinding - A Driver Binding Protocol instance that this driver is producing + + DriverBindingHandle - The handle that DriverBinding is to be installe onto. If this + parameter is NULL, then a new handle is created. + + ComponentName - A Component Name Protocol instance that this driver is producing + + ComponentName2 - A Component Name2 Protocol instance that this driver is producing + + DriverConfiguration - A Driver Configuration Protocol instance that this driver is producing + + DriverConfiguration2- A Driver Configuration2 Protocol instance that this driver is producing + + DriverDiagnostics - A Driver Diagnostics Protocol instance that this driver is producing + + DriverDiagnostics2 - A Driver Diagnostics2 Protocol instance that this driver is producing + +Returns: + + EFI_SUCCESS if all the protocols were installed onto DriverBindingHandle + + Otherwise, then return status from gBS->InstallProtocolInterface() + +--*/ +{ + EFI_STATUS Status; + + Status = EfiLibInstallDriverBinding (ImageHandle, SystemTable, DriverBinding, DriverBindingHandle); + if (EFI_ERROR (Status)) { + return Status; + } + + if (ComponentName != NULL) { + Status = gBS->InstallProtocolInterface ( + &DriverBinding->DriverBindingHandle, + &gEfiComponentNameProtocolGuid, + EFI_NATIVE_INTERFACE, + ComponentName + ); + if (EFI_ERROR (Status)) { + return Status; + } + } + + if (ComponentName2 != NULL) { + Status = gBS->InstallProtocolInterface ( + &DriverBinding->DriverBindingHandle, + &gEfiComponentName2ProtocolGuid, + EFI_NATIVE_INTERFACE, + ComponentName2 + ); + if (EFI_ERROR (Status)) { + return Status; + } + } + + if (DriverConfiguration != NULL) { + Status = gBS->InstallProtocolInterface ( + &DriverBinding->DriverBindingHandle, + &gEfiDriverConfigurationProtocolGuid, + EFI_NATIVE_INTERFACE, + DriverConfiguration + ); + if (EFI_ERROR (Status)) { + return Status; + } + } + + if (DriverConfiguration2 != NULL) { + Status = gBS->InstallProtocolInterface ( + &DriverBinding->DriverBindingHandle, + &gEfiDriverConfiguration2ProtocolGuid, + EFI_NATIVE_INTERFACE, + DriverConfiguration2 + ); + if (EFI_ERROR (Status)) { + return Status; + } + } + + if (DriverDiagnostics != NULL) { + Status = gBS->InstallProtocolInterface ( + &DriverBinding->DriverBindingHandle, + &gEfiDriverDiagnosticsProtocolGuid, + EFI_NATIVE_INTERFACE, + DriverDiagnostics + ); + if (EFI_ERROR (Status)) { + return Status; + } + } + + if (DriverDiagnostics2 != NULL) { + Status = gBS->InstallProtocolInterface ( + &DriverBinding->DriverBindingHandle, + &gEfiDriverDiagnostics2ProtocolGuid, + EFI_NATIVE_INTERFACE, + DriverDiagnostics2 + ); + if (EFI_ERROR (Status)) { + return Status; + } + } + + return EFI_SUCCESS; +} + EFI_STATUS EfiLibInstallAllDriverProtocols ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE * SystemTable, IN EFI_DRIVER_BINDING_PROTOCOL * DriverBinding, IN EFI_HANDLE DriverBindingHandle, -#if (EFI_SPECIFICATION_VERSION >= 0x00020000) - IN EFI_COMPONENT_NAME2_PROTOCOL * ComponentName, OPTIONAL -#else IN EFI_COMPONENT_NAME_PROTOCOL * ComponentName, OPTIONAL -#endif IN EFI_DRIVER_CONFIGURATION_PROTOCOL * DriverConfiguration, OPTIONAL IN EFI_DRIVER_DIAGNOSTICS_PROTOCOL * DriverDiagnostics OPTIONAL ) @@ -121,54 +253,77 @@ Returns: --*/ { - EFI_STATUS Status; + return InstallAllDriverProtocolsWorker ( + ImageHandle, + SystemTable, + DriverBinding, + DriverBindingHandle, + ComponentName, + NULL, + DriverConfiguration, + NULL, + DriverDiagnostics, + NULL + ); +} - Status = EfiLibInstallDriverBinding (ImageHandle, SystemTable, DriverBinding, DriverBindingHandle); - if (EFI_ERROR (Status)) { - return Status; - } +EFI_STATUS +EfiLibInstallAllDriverProtocols2 ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE * SystemTable, + IN EFI_DRIVER_BINDING_PROTOCOL * DriverBinding, + IN EFI_HANDLE DriverBindingHandle, + IN EFI_COMPONENT_NAME2_PROTOCOL * ComponentName2, OPTIONAL + IN EFI_DRIVER_CONFIGURATION2_PROTOCOL * DriverConfiguration2, OPTIONAL + IN EFI_DRIVER_DIAGNOSTICS2_PROTOCOL * DriverDiagnostics2 OPTIONAL + ) +/*++ - if (ComponentName != NULL) { - Status = gBS->InstallProtocolInterface ( - &DriverBinding->DriverBindingHandle, -#if (EFI_SPECIFICATION_VERSION >= 0x00020000) - &gEfiComponentName2ProtocolGuid, -#else - &gEfiComponentNameProtocolGuid, -#endif - EFI_NATIVE_INTERFACE, - ComponentName - ); - if (EFI_ERROR (Status)) { - return Status; - } - } +Routine Description: - if (DriverConfiguration != NULL) { - Status = gBS->InstallProtocolInterface ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverConfigurationProtocolGuid, - EFI_NATIVE_INTERFACE, - DriverConfiguration - ); - if (EFI_ERROR (Status)) { - return Status; - } - } + 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. This function also initializes the EFI Driver + Library that initializes the global variables gST, gBS, gRT. - if (DriverDiagnostics != NULL) { - Status = gBS->InstallProtocolInterface ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverDiagnosticsProtocolGuid, - EFI_NATIVE_INTERFACE, - DriverDiagnostics - ); - if (EFI_ERROR (Status)) { - return Status; - } - } +Arguments: - return EFI_SUCCESS; + ImageHandle - The image handle of the driver + + SystemTable - The EFI System Table that was passed to the driver's entry point + + DriverBinding - A Driver Binding Protocol instance that this driver is producing + + DriverBindingHandle - The handle that DriverBinding is to be installe onto. If this + parameter is NULL, then a new handle is created. + + ComponentName2 - A Component Name2 Protocol instance that this driver is producing + + DriverConfiguration2- A Driver Configuration2 Protocol instance that this driver is producing + + DriverDiagnostics2 - A Driver Diagnostics2 Protocol instance that this driver is producing + +Returns: + + EFI_SUCCESS if all the protocols were installed onto DriverBindingHandle + + Otherwise, then return status from gBS->InstallProtocolInterface() + +--*/ +{ + return InstallAllDriverProtocolsWorker ( + ImageHandle, + SystemTable, + DriverBinding, + DriverBindingHandle, + NULL, + ComponentName2, + NULL, + DriverConfiguration2, + NULL, + DriverDiagnostics2 + ); } EFI_STATUS diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/Include/EfiDriverLib.h b/EdkCompatibilityPkg/Foundation/Library/Dxe/Include/EfiDriverLib.h index 03e660b247..67110fff78 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Dxe/Include/EfiDriverLib.h +++ b/EdkCompatibilityPkg/Foundation/Library/Dxe/Include/EfiDriverLib.h @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2004 - 2007, Intel Corporation +Copyright (c) 2004 - 2008, 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 @@ -28,6 +28,7 @@ Abstract: #include "LinkedList.h" #include "GetImage.h" #include "EfiImageFormat.h" +#include "EfiCompNameSupport.h" #include EFI_GUID_DEFINITION (DxeServices) #include EFI_GUID_DEFINITION (EventGroup) @@ -40,7 +41,9 @@ Abstract: #include EFI_PROTOCOL_DEFINITION (ComponentName) #include EFI_PROTOCOL_DEFINITION (ComponentName2) #include EFI_PROTOCOL_DEFINITION (DriverConfiguration) +#include EFI_PROTOCOL_DEFINITION (DriverConfiguration2) #include EFI_PROTOCOL_DEFINITION (DriverDiagnostics) +#include EFI_PROTOCOL_DEFINITION (DriverDiagnostics2) #include EFI_PROTOCOL_DEFINITION (DebugMask) @@ -166,13 +169,9 @@ EfiLibInstallAllDriverProtocols ( IN EFI_SYSTEM_TABLE *SystemTable, IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding, IN EFI_HANDLE DriverBindingHandle, -#if (EFI_SPECIFICATION_VERSION >= 0x00020000) - IN EFI_COMPONENT_NAME2_PROTOCOL *ComponentName, -#else - IN EFI_COMPONENT_NAME_PROTOCOL *ComponentName, -#endif - IN EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, - IN EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics + IN EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL + IN EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL + IN EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics OPTIONAL ) /*++ @@ -210,6 +209,52 @@ Returns: --*/ ; +EFI_STATUS +EfiLibInstallAllDriverProtocols2 ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable, + IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding, + IN EFI_HANDLE DriverBindingHandle, + IN EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2, OPTIONAL + IN EFI_DRIVER_CONFIGURATION2_PROTOCOL *DriverConfiguration2, OPTIONAL + IN EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2 OPTIONAL + ) +/*++ + +Routine Description: + + 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. This function also initializes the EFI Driver + Library that initializes the global variables gST, gBS, gRT. + +Arguments: + + ImageHandle - The image handle of the driver + + SystemTable - The EFI System Table that was passed to the driver's entry point + + DriverBinding - A Driver Binding Protocol instance that this driver is producing + + DriverBindingHandle - The handle that DriverBinding is to be installe onto. If this + parameter is NULL, then a new handle is created. + + ComponentName2 - A Component Name2 Protocol instance that this driver is producing + + DriverConfiguration2- A Driver Configuration2 Protocol instance that this driver is producing + + DriverDiagnostics2 - A Driver Diagnostics2 Protocol instance that this driver is producing + +Returns: + + EFI_SUCCESS if all the protocols were installed onto DriverBindingHandle + + Otherwise, then return status from gBS->InstallProtocolInterface() + +--*/ +; + EFI_STATUS EfiLibGetSystemConfigurationTable ( IN EFI_GUID *TableGuid,