From 8db9d51d787bc6ead2522c78a111e763a9162a7e Mon Sep 17 00:00:00 2001 From: qhuang8 Date: Thu, 27 Nov 2008 13:15:24 +0000 Subject: [PATCH] Make HiiDatabase module not depend on HiiLib; otherwise it will inherit HII_DATABASE_PROTOCOL to its own dependency. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6764 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Universal/HiiDatabaseDxe/HiiDatabase.h | 3 +- .../HiiDatabaseDxe/HiiDatabaseDxe.inf | 9 +++- MdeModulePkg/Universal/HiiDatabaseDxe/R8Lib.c | 45 +++++++++++++++++++ MdeModulePkg/Universal/HiiDatabaseDxe/R8Lib.h | 21 ++++++++- 4 files changed, 75 insertions(+), 3 deletions(-) diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h index c2917a9233..8b0b5a3fb3 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h @@ -40,7 +40,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include -#include +#include + #define HII_DATABASE_NOTIFY_GUID \ { \ diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf index 6d2ce944a5..00f209df07 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf @@ -59,7 +59,8 @@ DebugLib IfrSupportLib UefiLib - HiiLib + PcdLib + UefiRuntimeServicesTableLib [Protocols] gEfiConsoleControlProtocolGuid @@ -74,6 +75,12 @@ [FeaturePcd.common] gEfiMdeModulePkgTokenSpaceGuid.PcdSupportHiiImageProtocol gEfiMdeModulePkgTokenSpaceGuid.PcdSupportFullConfigRoutingProtocol + +[Pcd.common] + gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang + +[Guids] + gEfiGlobalVariableGuid [Depex] TRUE diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/R8Lib.c b/MdeModulePkg/Universal/HiiDatabaseDxe/R8Lib.c index 7c3e9b8b35..789627f222 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/R8Lib.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/R8Lib.c @@ -57,4 +57,49 @@ R8_EfiLibCompareLanguage ( } +/** + Determine what is the current language setting. The space reserved for Lang + must be at least RFC_3066_ENTRY_SIZE bytes; + + If Lang is NULL, then ASSERT. + + @param Lang Pointer of system language. Lang will always be filled with + a valid RFC 3066 language string. If "PlatformLang" is not + set in the system, the default language specifed by PcdUefiVariableDefaultPlatformLang + is returned. + + @return EFI_SUCCESS If the EFI Variable with "PlatformLang" is set and return in Lang. + @return EFI_NOT_FOUND If the EFI Variable with "PlatformLang" is not set, but a valid default language is return in Lang. + +**/ +EFI_STATUS +EFIAPI +GetCurrentLanguage ( + OUT CHAR8 *Lang + ) +{ + EFI_STATUS Status; + UINTN Size; + + ASSERT (Lang != NULL); + + // + // Get current language setting + // + Size = RFC_3066_ENTRY_SIZE; + Status = gRT->GetVariable ( + L"PlatformLang", + &gEfiGlobalVariableGuid, + NULL, + &Size, + Lang + ); + + if (EFI_ERROR (Status)) { + AsciiStrCpy (Lang, (CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLang)); + } + + return Status; +} + diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/R8Lib.h b/MdeModulePkg/Universal/HiiDatabaseDxe/R8Lib.h index 7c1c9f051e..e971dc264b 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/R8Lib.h +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/R8Lib.h @@ -17,7 +17,6 @@ Implement a utility function named R8_EfiLibCompareLanguage. #ifndef __R8_LIB_H__ #define __R8_LIB_H__ - /** Compare whether two names of languages are identical. @@ -35,6 +34,26 @@ R8_EfiLibCompareLanguage ( ) ; +/** + Determine what is the current language setting. The space reserved for Lang + must be at least RFC_3066_ENTRY_SIZE bytes; + + If Lang is NULL, then ASSERT. + + @param Lang Pointer of system language. Lang will always be filled with + a valid RFC 3066 language string. If "PlatformLang" is not + set in the system, the default language specifed by PcdUefiVariableDefaultPlatformLang + is returned. + + @return EFI_SUCCESS If the EFI Variable with "PlatformLang" is set and return in Lang. + @return EFI_NOT_FOUND If the EFI Variable with "PlatformLang" is not set, but a valid default language is return in Lang. + +**/ +EFI_STATUS +EFIAPI +GetCurrentLanguage ( + OUT CHAR8 *Lang + ); #endif -- 2.39.2