mirror of https://github.com/acidanthera/audk.git
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
This commit is contained in:
parent
e9508cd216
commit
7658d609a3
|
@ -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
|
||||
|
|
|
@ -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!!!
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
CHAR8 *PlatformLang;
|
||||
CHAR8 *PlatformLangCodes;
|
||||
UINTN Index;
|
||||
BOOLEAN Invalid;
|
||||
|
||||
LanguageString = NULL;
|
||||
LangCodes = NULL;
|
||||
|
||||
//
|
||||
// Collect the languages from what our current Language support is based on our VFR
|
||||
//
|
||||
gHii->GetPrimaryLanguages (gHii, gStringPackHandle, &LanguageString);
|
||||
|
||||
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[Index] = 0;
|
||||
|
||||
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
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
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,
|
||||
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)) {
|
||||
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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
ISO_639_2_ENTRY_SIZE,
|
||||
mDefaultLangCode
|
||||
AsciiStrSize (PlatformLang),
|
||||
PlatformLang
|
||||
);
|
||||
}
|
||||
|
||||
if (LangCodes) {
|
||||
FreePool (LangCodes);
|
||||
}
|
||||
|
||||
if (LanguageString != NULL) {
|
||||
FreePool (LanguageString);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue