summaryrefslogtreecommitdiff
path: root/Nt32Pkg/PlatformBdsDxe
diff options
context:
space:
mode:
authorAJFISH <AJFISH@6f19259b-4bc3-4df7-8a09-765794883524>2007-07-13 22:51:36 +0000
committerAJFISH <AJFISH@6f19259b-4bc3-4df7-8a09-765794883524>2007-07-13 22:51:36 +0000
commit7658d609a376be0fba1c2ba3496e016e55f7aa3a (patch)
treeac67473cb7ae96015ee316d3ee00ac5fb8c91c9e /Nt32Pkg/PlatformBdsDxe
parente9508cd2165b5e00d0200d15ac33dd4037e6c34f (diff)
downloadedk2-platforms-7658d609a376be0fba1c2ba3496e016e55f7aa3a.tar.xz
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
Diffstat (limited to 'Nt32Pkg/PlatformBdsDxe')
-rw-r--r--Nt32Pkg/PlatformBdsDxe/CommonHeader.h28
-rw-r--r--Nt32Pkg/PlatformBdsDxe/Generic/Language.c147
-rw-r--r--Nt32Pkg/PlatformBdsDxe/PlatformBds.inf9
-rw-r--r--Nt32Pkg/PlatformBdsDxe/PlatformData.c4
4 files changed, 101 insertions, 87 deletions
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