diff options
author | AJFISH <AJFISH@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-07-13 22:51:36 +0000 |
---|---|---|
committer | AJFISH <AJFISH@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-07-13 22:51:36 +0000 |
commit | 7658d609a376be0fba1c2ba3496e016e55f7aa3a (patch) | |
tree | ac67473cb7ae96015ee316d3ee00ac5fb8c91c9e | |
parent | e9508cd2165b5e00d0200d15ac33dd4037e6c34f (diff) | |
download | edk2-7658d609a376be0fba1c2ba3496e016e55f7aa3a.tar.gz edk2-7658d609a376be0fba1c2ba3496e016e55f7aa3a.tar.bz2 edk2-7658d609a376be0fba1c2ba3496e016e55f7aa3a.zip |
Convert NT32 to use PCD settings for UEFI Timeout and language variables as a POC for new BDS.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3241 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r-- | MdePkg/MdePkg.dec | 6 | ||||
-rw-r--r-- | Nt32Pkg/Library/EdkGenericBdsLib/BdsMisc.c | 4 | ||||
-rw-r--r-- | Nt32Pkg/Library/EdkGenericBdsLib/EdkGenericBdsLib.inf | 3 | ||||
-rw-r--r-- | Nt32Pkg/Library/EdkGenericBdsLib/EdkGenericBdsLibInternal.h | 15 | ||||
-rw-r--r-- | Nt32Pkg/Nt32Pkg.dsc | 8 | ||||
-rw-r--r-- | Nt32Pkg/PlatformBdsDxe/CommonHeader.h | 28 | ||||
-rw-r--r-- | Nt32Pkg/PlatformBdsDxe/Generic/Language.c | 147 | ||||
-rw-r--r-- | Nt32Pkg/PlatformBdsDxe/PlatformBds.inf | 9 | ||||
-rw-r--r-- | Nt32Pkg/PlatformBdsDxe/PlatformData.c | 4 |
9 files changed, 124 insertions, 100 deletions
diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index 5680f85127..f07e4a7ef3 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -305,6 +305,7 @@ PcdDriverDiagnosticsDisable|0x0000000e|gEfiMdePkgTokenSpaceGuid|BOOLEAN|FALSE
PcdComponentName2Disable|0x0000000f|gEfiMdePkgTokenSpaceGuid|BOOLEAN|FALSE
PcdDriverDiagnostics2Disable|0x00000010|gEfiMdePkgTokenSpaceGuid|BOOLEAN|FALSE
+ PcdUefiVariableDefaultLangDepricate|0x0000001a|gEfiMdePkgTokenSpaceGuid|BOOLEAN|FALSE
[PcdsFixedAtBuild.common]
PcdMaximumUnicodeStringLength|0x00000001|gEfiMdePkgTokenSpaceGuid|UINT32|1000000
@@ -328,6 +329,11 @@ PcdStatusCodeValueRemoteConsoleReset|0x00000012|gEfiMdePkgTokenSpaceGuid|UINT32|0x01040001 # EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_PC_RESET
PcdStatusCodeValueRemoteConsoleInputError|0x00000013|gEfiMdePkgTokenSpaceGuid|UINT32|0x01040007 # EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_INPUT_ERROR
PcdStatusCodeValueRemoteConsoleOutputError|0x00000014|gEfiMdePkgTokenSpaceGuid|UINT32|0x01040008 # EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_OUTPUT_ERROR
+ PcdUefiVariableDefaultTimeout|0x00000015|gEfiMdePkgTokenSpaceGuid|UINT16|0x0008
+ PcdUefiVariableDefaultLangCodes|0x00000016|gEfiMdePkgTokenSpaceGuid|VOID*|"engfra"
+ PcdUefiVariableDefaultLang|0x00000017|gEfiMdePkgTokenSpaceGuid|VOID*|"eng"
+ PcdUefiVariableDefaultPlatformLangCodes|0x00000018|gEfiMdePkgTokenSpaceGuid|VOID*|"en"
+ PcdUefiVariableDefaultPlatformLang|0x00000019|gEfiMdePkgTokenSpaceGuid|VOID*|"en;fr"
[PcdsPatchableInModule.common]
PcdDebugPrintErrorLevel|0x00000006|gEfiMdePkgTokenSpaceGuid|UINT32|0x80000000
diff --git a/Nt32Pkg/Library/EdkGenericBdsLib/BdsMisc.c b/Nt32Pkg/Library/EdkGenericBdsLib/BdsMisc.c index 13ec89f501..9fa05ffd6d 100644 --- a/Nt32Pkg/Library/EdkGenericBdsLib/BdsMisc.c +++ b/Nt32Pkg/Library/EdkGenericBdsLib/BdsMisc.c @@ -25,7 +25,7 @@ Abstract: #define MAX_STRING_LEN 200
static BOOLEAN mFeaturerSwitch = TRUE;
static BOOLEAN mResetRequired = FALSE;
-extern UINT16 gPlatformBootTimeOutDefault;
+
UINT16
BdsLibGetTimeout (
@@ -66,7 +66,7 @@ Returns: // present.
// This code should be removed later.
//
- Timeout = gPlatformBootTimeOutDefault;
+ Timeout = PcdGet16 (PcdUefiVariableDefaultTimeout);
//
// Notes: Platform should set default variable if non exists on all error cases!!!
diff --git a/Nt32Pkg/Library/EdkGenericBdsLib/EdkGenericBdsLib.inf b/Nt32Pkg/Library/EdkGenericBdsLib/EdkGenericBdsLib.inf index ca25796624..b4d579f36e 100644 --- a/Nt32Pkg/Library/EdkGenericBdsLib/EdkGenericBdsLib.inf +++ b/Nt32Pkg/Library/EdkGenericBdsLib/EdkGenericBdsLib.inf @@ -63,6 +63,7 @@ DxeServicesTableLib
UefiLib
BaseLib
+ PcdLib
[Guids]
gEfiGlobalVariableGuid # ALWAYS_CONSUMED
@@ -85,3 +86,5 @@ gEfiFirmwareVolumeProtocolGuid # PROTOCOL SOMETIMES_CONSUMED
gEfiLoadedImageProtocolGuid # PROTOCOL ALWAYS_CONSUMED
+[PcdsFixedAtBuild.common]
+ PcdUefiVariableDefaultTimeout|gEfiMdePkgTokenSpaceGuid
diff --git a/Nt32Pkg/Library/EdkGenericBdsLib/EdkGenericBdsLibInternal.h b/Nt32Pkg/Library/EdkGenericBdsLib/EdkGenericBdsLibInternal.h index 9d07a5c88b..2b49ce4fe6 100644 --- a/Nt32Pkg/Library/EdkGenericBdsLib/EdkGenericBdsLibInternal.h +++ b/Nt32Pkg/Library/EdkGenericBdsLib/EdkGenericBdsLibInternal.h @@ -21,20 +21,14 @@ //
#include <PiDxe.h>
#include <WinNtDxe.h>
-//
-// The protocols, PPI and GUID defintions for this module
-//
#include <Protocol/Cpu.h>
#include <Protocol/SimpleTextIn.h>
#include <Protocol/SimpleTextOut.h>
#include <Protocol/LoadedImage.h>
-#include <Guid/GenericPlatformVariable.h>
-#include <Guid/ShellFile.h>
#include <Protocol/SimpleFileSystem.h>
#include <Protocol/BlockIo.h>
#include <Protocol/SimpleNetwork.h>
#include <Protocol/AcpiS3Save.h>
-#include <Guid/GlobalVariable.h>
#include <Protocol/FormBrowserFramework.h>
#include <Protocol/LegacyBios.h>
#include <Protocol/DriverBinding.h>
@@ -44,10 +38,9 @@ #include <Protocol/Performance.h>
#include <Protocol/WinNtIo.h>
#include <Guid/PcAnsi.h>
-
-//
-// The Library classes this module consumes
-//
+#include <Guid/GlobalVariable.h>
+#include <Guid/GenericPlatformVariable.h>
+#include <Guid/ShellFile.h>
#include <Library/EdkGenericBdsLib.h>
#include <Library/BaseLib.h>
#include <Library/UefiLib.h>
@@ -62,6 +55,8 @@ #include <Library/DevicePathLib.h>
#include <Library/PerformanceLib.h>
#include <Library/PeCoffLib.h>
+#include <Library/PcdLib.h>
+
#define PERF_TOKEN_LENGTH 28
#define PERF_PEI_ENTRY_MAX_NUM 50
diff --git a/Nt32Pkg/Nt32Pkg.dsc b/Nt32Pkg/Nt32Pkg.dsc index 043e2bebb6..33ef254d76 100644 --- a/Nt32Pkg/Nt32Pkg.dsc +++ b/Nt32Pkg/Nt32Pkg.dsc @@ -236,13 +236,14 @@ PcdDxeIplSupportEfiDecompress|gEfiMdeModulePkgTokenSpaceGuid|TRUE
PcdDxeIplSupportTianoDecompress|gEfiMdeModulePkgTokenSpaceGuid|TRUE
PcdDxeIplSupportCustomDecompress|gEfiMdeModulePkgTokenSpaceGuid|TRUE
+ PcdUefiVariableDefaultLangDepricate|gEfiMdePkgTokenSpaceGuid|FALSE
[PcdsPatchableInModule.IA32]
PcdStatusCodeMemorySize|gEfiIntelFrameworkModulePkgTokenSpaceGuid|1
PcdStatusCodeRuntimeMemorySize|gEfiIntelFrameworkModulePkgTokenSpaceGuid|128
[PcdsFixedAtBuild.IA32]
- PcdWinNtMemorySizeForSecMain|gEfiNt32PkgTokenSpaceGuid|L"64!64"|10
+ PcdWinNtMemorySizeForSecMain|gEfiNt32PkgTokenSpaceGuid|L"64!64"|12
PcdWinNtFirmwareVolume|gEfiNt32PkgTokenSpaceGuid|L"..\\Fv\\Fv_Recovery.fd"|52
PcdWinNtBootMode|gEfiNt32PkgTokenSpaceGuid|1
PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000
@@ -267,6 +268,11 @@ PcdStatusCodeValueRemoteConsoleReset|gEfiMdePkgTokenSpaceGuid|0x01040001 # EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_PC_RESET
PcdStatusCodeValueRemoteConsoleInputError|gEfiMdePkgTokenSpaceGuid|0x01040007 # EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_INPUT_ERROR
PcdStatusCodeValueRemoteConsoleOutputError|gEfiMdePkgTokenSpaceGuid|0x01040008 # EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_OUTPUT_ERROR
+ PcdUefiVariableDefaultTimeout|gEfiMdePkgTokenSpaceGuid|0x0008
+ PcdUefiVariableDefaultLangCodes|gEfiMdePkgTokenSpaceGuid|"engfra"|7
+ PcdUefiVariableDefaultLang|gEfiMdePkgTokenSpaceGuid|"eng"|4
+ PcdUefiVariableDefaultPlatformLangCodes|gEfiMdePkgTokenSpaceGuid|"en;fr"|6
+ PcdUefiVariableDefaultPlatformLang|gEfiMdePkgTokenSpaceGuid|"en"|2
[PcdsFeatureFlag.IA32]
PcdPeiPcdDatabaseTraverseEnabled|gEfiMdeModulePkgTokenSpaceGuid|TRUE
diff --git a/Nt32Pkg/PlatformBdsDxe/CommonHeader.h b/Nt32Pkg/PlatformBdsDxe/CommonHeader.h index c4fb48eeee..8f9a6d63ca 100644 --- a/Nt32Pkg/PlatformBdsDxe/CommonHeader.h +++ b/Nt32Pkg/PlatformBdsDxe/CommonHeader.h @@ -15,45 +15,34 @@ #ifndef __COMMON_HEADER_H_
#define __COMMON_HEADER_H_
-
-//
-// The package level header files this module uses
-//
#include <PiDxe.h>
-
-//
-// The protocols, PPI and GUID defintions for this module
-//
+#include <Common/MaxBbsEntries.h>
#include <Protocol/FormCallbackFramework.h>
-#include <Guid/FileSystemVolumeLabelInfo.h>
#include <Protocol/DevicePath.h>
-#include <Guid/BootState.h>
#include <Protocol/LoadFile.h>
#include <Protocol/CpuIo.h>
-#include <Guid/FileInfo.h>
#include <Protocol/Bds.h>
#include <Protocol/DataHub.h>
#include <Protocol/FormBrowserFramework.h>
-#include <Guid/Bmp.h>
#include <Protocol/UgaDraw.h>
#include <Protocol/BlockIo.h>
-#include <Guid/GlobalVariable.h>
#include <Protocol/ConsoleControl.h>
#include <Protocol/GenericMemoryTest.h>
#include <Protocol/GraphicsOutput.h>
#include <Protocol/SimpleFileSystem.h>
#include <Protocol/HiiFramework.h>
-#include <Guid/GenericPlatformVariable.h>
#include <Protocol/SerialIo.h>
#include <Protocol/LegacyBios.h>
-#include <Common/MaxBbsEntries.h>
+#include <Protocol/Performance.h>
#include <Guid/PcAnsi.h>
#include <Guid/DataHubRecords.h>
-#include <Protocol/Performance.h>
+#include <Guid/Bmp.h>
+#include <Guid/FileInfo.h>
+#include <Guid/BootState.h>
+#include <Guid/FileSystemVolumeLabelInfo.h>
+#include <Guid/GenericPlatformVariable.h>
+#include <Guid/GlobalVariable.h>
-//
-// The Library classes this module consumes
-//
#include <Library/DebugLib.h>
#include <Library/UefiLib.h>
#include <Library/UefiDriverEntryPoint.h>
@@ -73,6 +62,7 @@ #include <Library/DevicePathLib.h>
#include <Library/HiiLibFramework.h>
#include <Library/PeCoffLib.h>
+#include <Library/PcdLib.h>
//
// The rest of the includes
diff --git a/Nt32Pkg/PlatformBdsDxe/Generic/Language.c b/Nt32Pkg/PlatformBdsDxe/Generic/Language.c index 60b92f0c7e..c8e73a21bc 100644 --- a/Nt32Pkg/PlatformBdsDxe/Generic/Language.c +++ b/Nt32Pkg/PlatformBdsDxe/Generic/Language.c @@ -29,11 +29,6 @@ Revision History #include "BdsString.h"
#include "Language.h"
-//
-// Default language code, currently is English
-//
-CHAR8 *mDefaultLangCode = "eng";
-
VOID
InitializeLanguage (
@@ -53,83 +48,107 @@ Returns: --*/
{
EFI_STATUS Status;
- UINTN Index;
UINTN Size;
+ CHAR8 *Lang;
CHAR8 LangCode[ISO_639_2_ENTRY_SIZE];
CHAR8 *LangCodes;
- CHAR16 *LanguageString;
-
- LanguageString = NULL;
- LangCodes = NULL;
-
- //
- // Collect the languages from what our current Language support is based on our VFR
- //
- gHii->GetPrimaryLanguages (gHii, gStringPackHandle, &LanguageString);
+ CHAR8 *PlatformLang;
+ CHAR8 *PlatformLangCodes;
+ UINTN Index;
+ BOOLEAN Invalid;
- LangCodes = AllocatePool (StrLen (LanguageString));
- ASSERT (LangCodes);
- //
- // Convert LanguageString from Unicode to EFI defined ASCII LangCodes
- //
- for (Index = 0; LanguageString[Index] != 0x0000; Index++) {
- LangCodes[Index] = (CHAR8) LanguageString[Index];
- }
+ LangCodes = (CHAR8 *)PcdGetPtr (PcdUefiVariableDefaultLangCodes);
+ if (LangCodesSettingRequired) {
+ if (!FeaturePcdGet (PcdUefiVariableDefaultLangDepricate)) {
+ //
+ // UEFI 2.1 depricated this variable so we support turning it off
+ //
+ Status = gRT->SetVariable (
+ L"LangCodes",
+ &gEfiGlobalVariableGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
+ AsciiStrLen (LangCodes),
+ LangCodes
+ );
+ }
- LangCodes[Index] = 0;
- if (LangCodesSettingRequired) {
+ PlatformLangCodes = (CHAR8 *)PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes);
Status = gRT->SetVariable (
- L"LangCodes",
+ L"PlatformLangCodes",
&gEfiGlobalVariableGuid,
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- AsciiStrLen (LangCodes),
- LangCodes
+ AsciiStrSize (PlatformLangCodes),
+ PlatformLangCodes
);
}
- //
- // Find current LangCode from Lang NV Variable
- //
- Size = ISO_639_2_ENTRY_SIZE;
- Status = gRT->GetVariable (
- L"Lang",
- &gEfiGlobalVariableGuid,
- NULL,
- &Size,
- &LangCode
- );
-
- if (!EFI_ERROR (Status)) {
- Status = EFI_NOT_FOUND;
- for (Index = 0; LangCodes[Index] != 0; Index += ISO_639_2_ENTRY_SIZE) {
- if (CompareMem (&LangCodes[Index], LangCode, ISO_639_2_ENTRY_SIZE) == 0) {
- Status = EFI_SUCCESS;
- break;
- }
- }
- }
- //
- // If we cannot get language code from Lang variable,
- // or LangCode cannot be found from language table,
- // set the mDefaultLangCode to Lang variable.
- //
- if (EFI_ERROR (Status)) {
- Status = gRT->SetVariable (
+
+ if (!FeaturePcdGet (PcdUefiVariableDefaultLangDepricate)) {
+ //
+ // UEFI 2.1 depricated this variable so we support turning it off
+ //
+
+ //
+ // Find current LangCode from Lang NV Variable
+ //
+ Size = ISO_639_2_ENTRY_SIZE;
+ Status = gRT->GetVariable (
L"Lang",
&gEfiGlobalVariableGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- ISO_639_2_ENTRY_SIZE,
- mDefaultLangCode
+ NULL,
+ &Size,
+ &LangCode
);
- }
+ if (!EFI_ERROR (Status)) {
+ Status = EFI_NOT_FOUND;
+ for (Index = 0; LangCodes[Index] != 0; Index += ISO_639_2_ENTRY_SIZE) {
+ if (CompareMem (&LangCodes[Index], LangCode, ISO_639_2_ENTRY_SIZE) == 0) {
+ Status = EFI_SUCCESS;
+ break;
+ }
+ }
+ }
- if (LangCodes) {
- FreePool (LangCodes);
+ //
+ // If we cannot get language code from Lang variable,
+ // or LangCode cannot be found from language table,
+ // set the mDefaultLangCode to Lang variable.
+ //
+ if (EFI_ERROR (Status)) {
+ Lang = (CHAR8 *)PcdGetPtr (PcdUefiVariableDefaultLang);
+ Status = gRT->SetVariable (
+ L"Lang",
+ &gEfiGlobalVariableGuid,
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
+ ISO_639_2_ENTRY_SIZE,
+ Lang
+ );
+ }
}
- if (LanguageString != NULL) {
- FreePool (LanguageString);
+ Invalid = FALSE;
+ PlatformLang = BdsLibGetVariableAndSize (L"PlatformLang", &gEfiGlobalVariableGuid, &Size);
+ if (PlatformLang != NULL) {
+ //
+ // Check Current PlatformLang value against PlatformLangCode. Need a library that is TBD
+ // Set Invalid based on state of PlatformLang.
+ //
+
+ FreePool (PlatformLang);
+ } else {
+ // No valid variable is set
+ Invalid = TRUE;
}
+ if (Invalid) {
+ PlatformLang = (CHAR8 *)PcdGetPtr (PcdUefiVariableDefaultPlatformLang);
+ Status = gRT->SetVariable (
+ L"PlatformLang",
+ &gEfiGlobalVariableGuid,
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
+ AsciiStrSize (PlatformLang),
+ PlatformLang
+ );
+ }
}
diff --git a/Nt32Pkg/PlatformBdsDxe/PlatformBds.inf b/Nt32Pkg/PlatformBdsDxe/PlatformBds.inf index 7e2442365b..1e084a3f18 100644 --- a/Nt32Pkg/PlatformBdsDxe/PlatformBds.inf +++ b/Nt32Pkg/PlatformBdsDxe/PlatformBds.inf @@ -172,6 +172,15 @@ gEfiLegacyBiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiBdsArchProtocolGuid # PROTOCOL ALWAYS_PRODUCED
+[PcdsFeatureFlag.common]
+ PcdUefiVariableDefaultLangDepricate|gEfiMdePkgTokenSpaceGuid|
+
+[PcdsFixedAtBuild.common]
+ PcdUefiVariableDefaultLangCodes|gEfiMdePkgTokenSpaceGuid
+ PcdUefiVariableDefaultLang|gEfiMdePkgTokenSpaceGuid
+ PcdUefiVariableDefaultPlatformLangCodes|gEfiMdePkgTokenSpaceGuid
+ PcdUefiVariableDefaultPlatformLang|gEfiMdePkgTokenSpaceGuid
+
[depex]
gEfiHiiProtocolGuid
\ No newline at end of file diff --git a/Nt32Pkg/PlatformBdsDxe/PlatformData.c b/Nt32Pkg/PlatformBdsDxe/PlatformData.c index 68818ef34b..5b1d7c55c5 100644 --- a/Nt32Pkg/PlatformBdsDxe/PlatformData.c +++ b/Nt32Pkg/PlatformBdsDxe/PlatformData.c @@ -30,10 +30,6 @@ Abstract: #include <Protocol/WinNtThunk.h>
#include <Protocol/WinNtIo.h>
-//
-// Predefined platform default time out value
-//
-UINT16 gPlatformBootTimeOutDefault = 10;
//
// Platform specific keyboard device path
|