diff options
Diffstat (limited to 'MdeModulePkg/Application/UiApp/FrontPage.c')
-rw-r--r-- | MdeModulePkg/Application/UiApp/FrontPage.c | 662 |
1 files changed, 163 insertions, 499 deletions
diff --git a/MdeModulePkg/Application/UiApp/FrontPage.c b/MdeModulePkg/Application/UiApp/FrontPage.c index d6207b6fa3..8efe4d137b 100644 --- a/MdeModulePkg/Application/UiApp/FrontPage.c +++ b/MdeModulePkg/Application/UiApp/FrontPage.c @@ -13,8 +13,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/
#include "FrontPage.h"
-#include "Language.h"
-#define MAX_STRING_LEN 200
+#include "FrontPageCustomizedUi.h"
+
+#define MAX_STRING_LEN 200
EFI_GUID mFrontPageGuid = FRONT_PAGE_FORMSET_GUID;
@@ -82,7 +83,7 @@ HII_VENDOR_DEVICE_PATH mFrontPageHiiVendorDevicePath = { **/
VOID
-UpdateFrontPageStrings (
+UpdateFrontPageBannerStrings (
VOID
);
@@ -156,190 +157,6 @@ FakeRouteConfig ( }
/**
- Create oneof options for language.
-
-**/
-VOID
-InitializeLanguage (
- VOID
- )
-{
- EFI_STATUS Status;
- CHAR8 *LangCode;
- CHAR8 *Lang;
- CHAR8 *CurrentLang;
- UINTN OptionCount;
- CHAR16 *StringBuffer;
- EFI_HII_HANDLE HiiHandle;
- VOID *OptionsOpCodeHandle;
- VOID *StartOpCodeHandle;
- VOID *EndOpCodeHandle;
- EFI_IFR_GUID_LABEL *StartLabel;
- EFI_IFR_GUID_LABEL *EndLabel;
- EFI_HII_STRING_PROTOCOL *HiiString;
- UINTN StringSize;
-
- Lang = NULL;
- StringBuffer = NULL;
-
- //
- // Init OpCode Handle and Allocate space for creation of UpdateData Buffer
- //
- StartOpCodeHandle = HiiAllocateOpCodeHandle ();
- ASSERT (StartOpCodeHandle != NULL);
-
- EndOpCodeHandle = HiiAllocateOpCodeHandle ();
- ASSERT (EndOpCodeHandle != NULL);
-
- OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
- ASSERT (OptionsOpCodeHandle != NULL);
- //
- // Create Hii Extend Label OpCode as the start opcode
- //
- StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
- StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
- StartLabel->Number = LABEL_SELECT_LANGUAGE;
-
- //
- // Create Hii Extend Label OpCode as the end opcode
- //
- EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
- EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
- EndLabel->Number = LABEL_END;
- //
- // Collect the languages from what our current Language support is based on our VFR
- //
- HiiHandle = gFrontPagePrivate.HiiHandle;
-
- GetEfiGlobalVariable2 (L"PlatformLang", (VOID**)&CurrentLang, NULL);
-
- if (mLanguageString == NULL) {
- //
- // Get Support language list from variable.
- //
- GetEfiGlobalVariable2 (L"PlatformLangCodes", (VOID**)&mLanguageString, NULL);
- if (mLanguageString == NULL) {
- mLanguageString = AllocateCopyPool (
- AsciiStrSize ((CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes)),
- (CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes)
- );
- ASSERT (mLanguageString != NULL);
- }
- }
-
- if (gFrontPagePrivate.LanguageToken == NULL) {
- //
- // Count the language list number.
- //
- LangCode = mLanguageString;
- Lang = AllocatePool (AsciiStrSize (mLanguageString));
- ASSERT (Lang != NULL);
- OptionCount = 0;
- while (*LangCode != 0) {
- GetNextLanguage (&LangCode, Lang);
- OptionCount ++;
- }
-
- //
- // Allocate extra 1 as the end tag.
- //
- gFrontPagePrivate.LanguageToken = AllocateZeroPool ((OptionCount + 1) * sizeof (EFI_STRING_ID));
- ASSERT (gFrontPagePrivate.LanguageToken != NULL);
-
- Status = gBS->LocateProtocol (&gEfiHiiStringProtocolGuid, NULL, (VOID **) &HiiString);
- ASSERT_EFI_ERROR (Status);
-
- LangCode = mLanguageString;
- OptionCount = 0;
- while (*LangCode != 0) {
- GetNextLanguage (&LangCode, Lang);
-
- StringSize = 0;
- Status = HiiString->GetString (HiiString, Lang, HiiHandle, PRINTABLE_LANGUAGE_NAME_STRING_ID, StringBuffer, &StringSize, NULL);
- if (Status == EFI_BUFFER_TOO_SMALL) {
- StringBuffer = AllocateZeroPool (StringSize);
- ASSERT (StringBuffer != NULL);
- Status = HiiString->GetString (HiiString, Lang, HiiHandle, PRINTABLE_LANGUAGE_NAME_STRING_ID, StringBuffer, &StringSize, NULL);
- ASSERT_EFI_ERROR (Status);
- }
-
- if (EFI_ERROR (Status)) {
- StringBuffer = AllocatePool (AsciiStrSize (Lang) * sizeof (CHAR16));
- ASSERT (StringBuffer != NULL);
- AsciiStrToUnicodeStr (Lang, StringBuffer);
- }
-
- ASSERT (StringBuffer != NULL);
- gFrontPagePrivate.LanguageToken[OptionCount] = HiiSetString (HiiHandle, 0, StringBuffer, NULL);
- FreePool (StringBuffer);
-
- OptionCount++;
- }
- }
-
- ASSERT (gFrontPagePrivate.LanguageToken != NULL);
- LangCode = mLanguageString;
- OptionCount = 0;
- if (Lang == NULL) {
- Lang = AllocatePool (AsciiStrSize (mLanguageString));
- ASSERT (Lang != NULL);
- }
- while (*LangCode != 0) {
- GetNextLanguage (&LangCode, Lang);
-
- if (CurrentLang != NULL && AsciiStrCmp (Lang, CurrentLang) == 0) {
- HiiCreateOneOfOptionOpCode (
- OptionsOpCodeHandle,
- gFrontPagePrivate.LanguageToken[OptionCount],
- EFI_IFR_OPTION_DEFAULT,
- EFI_IFR_NUMERIC_SIZE_1,
- (UINT8) OptionCount
- );
- } else {
- HiiCreateOneOfOptionOpCode (
- OptionsOpCodeHandle,
- gFrontPagePrivate.LanguageToken[OptionCount],
- 0,
- EFI_IFR_NUMERIC_SIZE_1,
- (UINT8) OptionCount
- );
- }
-
- OptionCount++;
- }
-
- if (CurrentLang != NULL) {
- FreePool (CurrentLang);
- }
- FreePool (Lang);
-
- HiiCreateOneOfOpCode (
- StartOpCodeHandle,
- FRONT_PAGE_KEY_LANGUAGE,
- 0,
- 0,
- STRING_TOKEN (STR_LANGUAGE_SELECT),
- STRING_TOKEN (STR_LANGUAGE_SELECT_HELP),
- EFI_IFR_FLAG_CALLBACK,
- EFI_IFR_NUMERIC_SIZE_1,
- OptionsOpCodeHandle,
- NULL
- );
-
- Status = HiiUpdateForm (
- HiiHandle,
- &mFrontPageGuid,
- FRONT_PAGE_FORM_ID,
- StartOpCodeHandle, // LABEL_SELECT_LANGUAGE
- EndOpCodeHandle // LABEL_END
- );
-
- HiiFreeOpCodeHandle (StartOpCodeHandle);
- HiiFreeOpCodeHandle (EndOpCodeHandle);
- HiiFreeOpCodeHandle (OptionsOpCodeHandle);
-}
-
-/**
This function processes the results of changes in configuration.
@@ -368,82 +185,12 @@ FrontPageCallback ( OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
)
{
- CHAR8 *LangCode;
- CHAR8 *Lang;
- UINTN Index;
- EFI_STATUS Status;
-
- if (Action != EFI_BROWSER_ACTION_CHANGED) {
- //
- // Do nothing for other UEFI Action. Only do call back when data is changed.
- //
- return EFI_UNSUPPORTED;
- }
-
- if (Action == EFI_BROWSER_ACTION_CHANGED) {
- if ((Value == NULL) || (ActionRequest == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- switch (QuestionId) {
- case FRONT_PAGE_KEY_CONTINUE:
- //
- // This is the continue - clear the screen and return an error to get out of FrontPage loop
- //
- *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
- break;
-
- case FRONT_PAGE_KEY_LANGUAGE:
- //
- // Allocate working buffer for RFC 4646 language in supported LanguageString.
- //
- Lang = AllocatePool (AsciiStrSize (mLanguageString));
- ASSERT (Lang != NULL);
-
- Index = 0;
- LangCode = mLanguageString;
- while (*LangCode != 0) {
- GetNextLanguage (&LangCode, Lang);
-
- if (Index == Value->u8) {
- break;
- }
-
- Index++;
- }
-
- if (Index == Value->u8) {
- Status = gRT->SetVariable (
- L"PlatformLang",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- AsciiStrSize (Lang),
- Lang
- );
- if (EFI_ERROR (Status)) {
- FreePool (Lang);
- return EFI_DEVICE_ERROR;
- }
- } else {
- ASSERT (FALSE);
- }
- FreePool (Lang);
- //
- //Current language of platform is changed,recreate oneof options for language.
- //
- InitializeLanguage();
- break;
-
- default:
- break;
- }
- }
-
- return EFI_SUCCESS;
+ return UiFrontPageCallbackHandler (gFrontPagePrivate.HiiHandle, Action, QuestionId, Type, Value, ActionRequest);
}
/**
-Update front page form base on the ClassGuid in the formset in other modules.
+
+ Update the menus in the front page.
**/
VOID
@@ -451,32 +198,10 @@ UpdateFrontPageForm ( VOID
)
{
- EFI_STATUS Status;
- EFI_HII_HANDLE HiiHandle;
VOID *StartOpCodeHandle;
VOID *EndOpCodeHandle;
- EFI_IFR_GUID_LABEL *StartLabel;
- EFI_IFR_GUID_LABEL *EndLabel;
- UINTN Index;
- EFI_STRING String;
- EFI_STRING_ID Token;
- EFI_STRING_ID TokenHelp;
- EFI_HII_HANDLE *HiiHandles;
- EFI_GUID FormSetGuid;
- CHAR16 *DevicePathStr;
- EFI_STRING_ID DevicePathId;
- EFI_IFR_FORM_SET *Buffer;
- UINTN BufferSize;
- UINT8 ClassGuidNum;
- EFI_GUID *ClassGuid;
- UINTN TempSize;
- UINT8 *Ptr;
-
- TempSize =0;
- BufferSize = 0;
- Buffer = NULL;
-
- HiiHandle = gFrontPagePrivate.HiiHandle;
+ EFI_IFR_GUID_LABEL *StartGuidLabel;
+ EFI_IFR_GUID_LABEL *EndGuidLabel;
//
// Allocate space for creation of UpdateData Buffer
@@ -489,99 +214,26 @@ UpdateFrontPageForm ( //
// Create Hii Extend Label OpCode as the start opcode
//
- StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
- StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
- StartLabel->Number = LABEL_PLATFORM_INFORMATION;
+ StartGuidLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
+ StartGuidLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
+ StartGuidLabel->Number = LABEL_FRANTPAGE_INFORMATION;
//
// Create Hii Extend Label OpCode as the end opcode
//
- EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
- EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
- EndLabel->Number = LABEL_END;
+ EndGuidLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
+ EndGuidLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
+ EndGuidLabel->Number = LABEL_END;
//
- // Get all the Hii handles
- //
- HiiHandles = HiiGetHiiHandles (NULL);
- ASSERT (HiiHandles != NULL);
- //
- // Search for formset of each class type
+ //Updata Front Page form
//
- for (Index = 0; HiiHandles[Index] != NULL; Index++) {
- Status = HiiGetFormSetFromHiiHandle(HiiHandles[Index], &Buffer,&BufferSize);
- if (EFI_ERROR (Status)) {
- continue;
- }
-
- Ptr = (UINT8 *)Buffer;
- while(TempSize < BufferSize) {
- TempSize += ((EFI_IFR_OP_HEADER *) Ptr)->Length;
-
- if (((EFI_IFR_OP_HEADER *) Ptr)->Length <= OFFSET_OF (EFI_IFR_FORM_SET, Flags)){
- Ptr += ((EFI_IFR_OP_HEADER *) Ptr)->Length;
- continue;
- }
-
- //
- // Find Class Guid
- //
- ClassGuidNum = (UINT8) (((EFI_IFR_FORM_SET *)Ptr)->Flags & 0x3);
- ClassGuid = (EFI_GUID *) (VOID *)(Ptr + sizeof (EFI_IFR_FORM_SET));
- while (ClassGuidNum-- > 0) {
- if (CompareGuid (&gEfiIfrFrontPageGuid, ClassGuid) == 0){
- ClassGuid ++;
- continue;
- }
-
- String = HiiGetString (HiiHandles[Index], ((EFI_IFR_FORM_SET *)Ptr)->FormSetTitle, NULL);
- if (String == NULL) {
- String = HiiGetString (HiiHandle, STRING_TOKEN (STR_MISSING_STRING), NULL);
- ASSERT (String != NULL);
- }
- Token = HiiSetString (HiiHandle, 0, String, NULL);
- FreePool (String);
-
- String = HiiGetString (HiiHandles[Index], ((EFI_IFR_FORM_SET *)Ptr)->Help, NULL);
-
- if (String == NULL) {
- String = HiiGetString (HiiHandle, STRING_TOKEN (STR_MISSING_STRING), NULL);
- ASSERT (String != NULL);
- }
- TokenHelp = HiiSetString (HiiHandle, 0, String, NULL);
- FreePool (String);
-
- FormSetGuid = ((EFI_IFR_FORM_SET *)Ptr)->Guid;
-
- DevicePathStr = ExtractDevicePathFromHiiHandle(HiiHandles[Index]);
- DevicePathId = 0;
- if (DevicePathStr != NULL){
- DevicePathId = HiiSetString (HiiHandle, 0, DevicePathStr, NULL);
- FreePool (DevicePathStr);
- }
- HiiCreateGotoExOpCode (
- StartOpCodeHandle,
- 0,
- Token,
- TokenHelp,
- 0,
- (EFI_QUESTION_ID) (Index + FRONT_PAGE_KEY_OFFSET),
- 0,
- &FormSetGuid,
- DevicePathId
- );
- break;
- }
- Ptr += ((EFI_IFR_OP_HEADER *) Ptr)->Length;
- }
-
- FreePool(Buffer);
- Buffer = NULL;
- TempSize = 0;
- BufferSize = 0;
- }
+ UiCustomizeFrontPage (
+ gFrontPagePrivate.HiiHandle,
+ StartOpCodeHandle
+ );
HiiUpdateForm (
- HiiHandle,
+ gFrontPagePrivate.HiiHandle,
&mFrontPageGuid,
FRONT_PAGE_FORM_ID,
StartOpCodeHandle,
@@ -590,7 +242,6 @@ UpdateFrontPageForm ( HiiFreeOpCodeHandle (StartOpCodeHandle);
HiiFreeOpCodeHandle (EndOpCodeHandle);
- FreePool (HiiHandles);
}
/**
@@ -642,17 +293,12 @@ InitializeFrontPage ( ASSERT (gFrontPagePrivate.HiiHandle != NULL);
//
- //Updata Front Page strings
- //
- UpdateFrontPageStrings ();
-
- //
- // Initialize laguage options
+ //Updata Front Page banner strings
//
- InitializeLanguage ();
+ UpdateFrontPageBannerStrings ();
//
- //Updata Front Page form
+ // Update front page menus.
//
UpdateFrontPageForm();
@@ -846,10 +492,12 @@ GetOptionalStringByIndex ( /**
+
Update the banner information for the Front Page based on Smbios information.
+
**/
VOID
-UpdateFrontPageStrings (
+UpdateFrontPageBannerStrings (
VOID
)
{
@@ -857,7 +505,6 @@ UpdateFrontPageStrings ( CHAR16 *NewString;
CHAR16 *FirmwareVersionString;
EFI_STATUS Status;
- EFI_STRING_ID TokenToUpdate;
EFI_SMBIOS_HANDLE SmbiosHandle;
EFI_SMBIOS_PROTOCOL *Smbios;
SMBIOS_TABLE_TYPE0 *Type0Record;
@@ -872,92 +519,143 @@ UpdateFrontPageStrings ( FoundCpu = 0;
//
- // Update Front Page strings
+ // Update default banner string.
//
- Status = gBS->LocateProtocol (
- &gEfiSmbiosProtocolGuid,
- NULL,
- (VOID **) &Smbios
- );
- if (!EFI_ERROR (Status)) {
- SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
- Status = Smbios->GetNext (Smbios, &SmbiosHandle, NULL, &Record, NULL);
- while (!EFI_ERROR(Status)) {
- if (Record->Type == EFI_SMBIOS_TYPE_BIOS_INFORMATION) {
- Type0Record = (SMBIOS_TABLE_TYPE0 *) Record;
- StrIndex = Type0Record->BiosVersion;
- GetOptionalStringByIndex ((CHAR8*)((UINT8*)Type0Record + Type0Record->Hdr.Length), StrIndex, &NewString);
- TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_BIOS_VERSION);
- FirmwareVersionString = (CHAR16 *) PcdGetPtr (PcdFirmwareVersionString);
- if (*FirmwareVersionString != 0x0000 ) {
- FreePool (NewString);
- NewString = (CHAR16 *) PcdGetPtr (PcdFirmwareVersionString);
- HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, NewString, NULL);
- } else {
- HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, NewString, NULL);
- FreePool (NewString);
- }
- }
+ NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_CUSTOMIZE_BANNER_LINE4_LEFT), NULL);
+ UiCustomizeFrontPageBanner (4, TRUE, &NewString);
+ HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_CUSTOMIZE_BANNER_LINE4_LEFT), NewString, NULL);
+ FreePool (NewString);
+
+ NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_CUSTOMIZE_BANNER_LINE4_RIGHT), NULL);
+ UiCustomizeFrontPageBanner (4, FALSE, &NewString);
+ HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_CUSTOMIZE_BANNER_LINE4_RIGHT), NewString, NULL);
+ FreePool (NewString);
+
+ NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_CUSTOMIZE_BANNER_LINE5_LEFT), NULL);
+ UiCustomizeFrontPageBanner (5, TRUE, &NewString);
+ HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_CUSTOMIZE_BANNER_LINE5_LEFT), NewString, NULL);
+ FreePool (NewString);
+
+ NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_CUSTOMIZE_BANNER_LINE5_RIGHT), NULL);
+ UiCustomizeFrontPageBanner (5, FALSE, &NewString);
+ HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_CUSTOMIZE_BANNER_LINE5_RIGHT), NewString, NULL);
+ FreePool (NewString);
- if (Record->Type == EFI_SMBIOS_TYPE_SYSTEM_INFORMATION) {
- Type1Record = (SMBIOS_TABLE_TYPE1 *) Record;
- StrIndex = Type1Record->ProductName;
- GetOptionalStringByIndex ((CHAR8*)((UINT8*)Type1Record + Type1Record->Hdr.Length), StrIndex, &NewString);
- TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_COMPUTER_MODEL);
- HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, NewString, NULL);
+ //
+ // Update Front Page banner strings base on SmBios Table.
+ //
+ Status = gBS->LocateProtocol (&gEfiSmbiosProtocolGuid, NULL, (VOID **) &Smbios);
+ if (EFI_ERROR (Status)) {
+ //
+ // Smbios protocol not found, get the default value.
+ //
+ NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_COMPUTER_MODEL), NULL);
+ UiCustomizeFrontPageBanner (1, TRUE, &NewString);
+ HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_COMPUTER_MODEL), NewString, NULL);
+ FreePool (NewString);
+
+ NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_CPU_MODEL), NULL);
+ UiCustomizeFrontPageBanner (2, TRUE, &NewString);
+ HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_CPU_MODEL), NewString, NULL);
+ FreePool (NewString);
+
+ NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_CPU_SPEED), NULL);
+ UiCustomizeFrontPageBanner (2, FALSE, &NewString);
+ HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_CPU_SPEED), NewString, NULL);
+ FreePool (NewString);
+
+ NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_BIOS_VERSION), NULL);
+ UiCustomizeFrontPageBanner (3, TRUE, &NewString);
+ HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_BIOS_VERSION), NewString, NULL);
+ FreePool (NewString);
+
+ NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_MEMORY_SIZE), NULL);
+ UiCustomizeFrontPageBanner (3, FALSE, &NewString);
+ HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_MEMORY_SIZE), NewString, NULL);
+ FreePool (NewString);
+
+ return;
+ }
+
+ SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
+ Status = Smbios->GetNext (Smbios, &SmbiosHandle, NULL, &Record, NULL);
+ while (!EFI_ERROR(Status)) {
+ if (Record->Type == EFI_SMBIOS_TYPE_BIOS_INFORMATION) {
+ Type0Record = (SMBIOS_TABLE_TYPE0 *) Record;
+ StrIndex = Type0Record->BiosVersion;
+ GetOptionalStringByIndex ((CHAR8*)((UINT8*)Type0Record + Type0Record->Hdr.Length), StrIndex, &NewString);
+
+ FirmwareVersionString = (CHAR16 *) PcdGetPtr (PcdFirmwareVersionString);
+ if (*FirmwareVersionString != 0x0000 ) {
+ FreePool (NewString);
+ NewString = (CHAR16 *) PcdGetPtr (PcdFirmwareVersionString);
+ UiCustomizeFrontPageBanner (3, TRUE, &NewString);
+ HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_BIOS_VERSION), NewString, NULL);
+ } else {
+ UiCustomizeFrontPageBanner (3, TRUE, &NewString);
+ HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_BIOS_VERSION), NewString, NULL);
FreePool (NewString);
}
+ }
- if ((Record->Type == EFI_SMBIOS_TYPE_PROCESSOR_INFORMATION) && !FoundCpu) {
- Type4Record = (SMBIOS_TABLE_TYPE4 *) Record;
- //
- // The information in the record should be only valid when the CPU Socket is populated.
- //
- if ((Type4Record->Status & SMBIOS_TYPE4_CPU_SOCKET_POPULATED) == SMBIOS_TYPE4_CPU_SOCKET_POPULATED) {
- StrIndex = Type4Record->ProcessorVersion;
- GetOptionalStringByIndex ((CHAR8*)((UINT8*)Type4Record + Type4Record->Hdr.Length), StrIndex, &NewString);
- TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_CPU_MODEL);
- HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, NewString, NULL);
- FreePool (NewString);
-
- ConvertProcessorToString(Type4Record->CurrentSpeed, 6, &NewString);
- TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_CPU_SPEED);
- HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, NewString, NULL);
- FreePool (NewString);
-
- FoundCpu = TRUE;
- }
- }
+ if (Record->Type == EFI_SMBIOS_TYPE_SYSTEM_INFORMATION) {
+ Type1Record = (SMBIOS_TABLE_TYPE1 *) Record;
+ StrIndex = Type1Record->ProductName;
+ GetOptionalStringByIndex ((CHAR8*)((UINT8*)Type1Record + Type1Record->Hdr.Length), StrIndex, &NewString);
+ UiCustomizeFrontPageBanner (1, TRUE, &NewString);
+ HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_COMPUTER_MODEL), NewString, NULL);
+ FreePool (NewString);
+ }
- if ( Record->Type == EFI_SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS ) {
- Type19Record = (SMBIOS_TABLE_TYPE19 *) Record;
- if (Type19Record->StartingAddress != 0xFFFFFFFF ) {
- InstalledMemory += RShiftU64(Type19Record->EndingAddress -
- Type19Record->StartingAddress + 1, 10);
- } else {
- InstalledMemory += RShiftU64(Type19Record->ExtendedEndingAddress -
- Type19Record->ExtendedStartingAddress + 1, 20);
- }
+ if ((Record->Type == EFI_SMBIOS_TYPE_PROCESSOR_INFORMATION) && !FoundCpu) {
+ Type4Record = (SMBIOS_TABLE_TYPE4 *) Record;
+ //
+ // The information in the record should be only valid when the CPU Socket is populated.
+ //
+ if ((Type4Record->Status & SMBIOS_TYPE4_CPU_SOCKET_POPULATED) == SMBIOS_TYPE4_CPU_SOCKET_POPULATED) {
+ StrIndex = Type4Record->ProcessorVersion;
+ GetOptionalStringByIndex ((CHAR8*)((UINT8*)Type4Record + Type4Record->Hdr.Length), StrIndex, &NewString);
+ UiCustomizeFrontPageBanner (2, TRUE, &NewString);
+ HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_CPU_MODEL), NewString, NULL);
+ FreePool (NewString);
+
+ ConvertProcessorToString(Type4Record->CurrentSpeed, 6, &NewString);
+ UiCustomizeFrontPageBanner (2, FALSE, &NewString);
+ HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_CPU_SPEED), NewString, NULL);
+ FreePool (NewString);
+
+ FoundCpu = TRUE;
}
+ }
- Status = Smbios->GetNext (Smbios, &SmbiosHandle, NULL, &Record, NULL);
+ if ( Record->Type == EFI_SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS ) {
+ Type19Record = (SMBIOS_TABLE_TYPE19 *) Record;
+ if (Type19Record->StartingAddress != 0xFFFFFFFF ) {
+ InstalledMemory += RShiftU64(Type19Record->EndingAddress -
+ Type19Record->StartingAddress + 1, 10);
+ } else {
+ InstalledMemory += RShiftU64(Type19Record->ExtendedEndingAddress -
+ Type19Record->ExtendedStartingAddress + 1, 20);
+ }
}
- // now update the total installed RAM size
- ConvertMemorySizeToString ((UINT32)InstalledMemory, &NewString );
- TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_MEMORY_SIZE);
- HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, NewString, NULL);
- FreePool (NewString);
+ Status = Smbios->GetNext (Smbios, &SmbiosHandle, NULL, &Record, NULL);
}
- return ;
+ //
+ // Now update the total installed RAM size
+ //
+ ConvertMemorySizeToString ((UINT32)InstalledMemory, &NewString );
+ UiCustomizeFrontPageBanner (3, FALSE, &NewString);
+ HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_MEMORY_SIZE), NewString, NULL);
+ FreePool (NewString);
}
/**
This function will change video resolution and text mode
- according to defined setup mode or defined boot mode
+ according to defined setup mode or defined boot mode
- @param IsSetupMode Indicate mode is changed to setup mode or boot mode.
+ @param IsSetupMode Indicate mode is changed to setup mode or boot mode.
@retval EFI_SUCCESS Mode is changed successfully.
@retval Others Mode failed to be changed.
@@ -985,13 +683,13 @@ BdsSetConsoleMode ( EFI_STATUS Status;
UINTN Index;
UINTN CurrentColumn;
- UINTN CurrentRow;
+ UINTN CurrentRow;
MaxGopMode = 0;
MaxTextMode = 0;
//
- // Get current video resolution and text mode
+ // Get current video resolution and text mode
//
Status = gBS->HandleProtocol (
gST->ConsoleOutHandle,
@@ -1009,7 +707,7 @@ BdsSetConsoleMode ( );
if (EFI_ERROR (Status)) {
SimpleTextOut = NULL;
- }
+ }
if ((GraphicsOutput == NULL) || (SimpleTextOut == NULL)) {
return EFI_UNSUPPORTED;
@@ -1030,12 +728,12 @@ BdsSetConsoleMode ( NewHorizontalResolution = mBootHorizontalResolution;
NewVerticalResolution = mBootVerticalResolution;
NewColumns = mBootTextModeColumn;
- NewRows = mBootTextModeRow;
+ NewRows = mBootTextModeRow;
}
-
+
if (GraphicsOutput != NULL) {
MaxGopMode = GraphicsOutput->Mode->MaxMode;
- }
+ }
if (SimpleTextOut != NULL) {
MaxTextMode = SimpleTextOut->Mode->MaxMode;
@@ -1139,8 +837,7 @@ BdsSetConsoleMode ( ASSERT_EFI_ERROR (Status);
Status = PcdSet32S (PcdConOutRow, NewRows);
ASSERT_EFI_ERROR (Status);
-
-
+
//
// Video mode is changed, so restart graphics console driver and higher level driver.
// Reconnect graphics console driver and higher level driver.
@@ -1170,12 +867,12 @@ BdsSetConsoleMode ( /**
The user Entry Point for Application. The user code starts with this function
- as the real entry point for the image goes into a library that calls this
+ as the real entry point for the image goes into a library that calls this
function.
- @param[in] ImageHandle The firmware allocated handle for the EFI image.
+ @param[in] ImageHandle The firmware allocated handle for the EFI image.
@param[in] SystemTable A pointer to the EFI System Table.
-
+
@retval EFI_SUCCESS The entry point is executed successfully.
@retval other Some error occurs when executing this entry point.
@@ -1196,7 +893,7 @@ InitializeUserInterface ( if (!mModeInitialized) {
//
- // After the console is ready, get current video resolution
+ // After the console is ready, get current video resolution
// and text mode before launching setup at first time.
//
Status = gBS->HandleProtocol (
@@ -1207,7 +904,7 @@ InitializeUserInterface ( if (EFI_ERROR (Status)) {
GraphicsOutput = NULL;
}
-
+
Status = gBS->HandleProtocol (
gST->ConsoleOutHandle,
&gEfiSimpleTextOutProtocolGuid,
@@ -1215,7 +912,7 @@ InitializeUserInterface ( );
if (EFI_ERROR (Status)) {
SimpleTextOut = NULL;
- }
+ }
if (GraphicsOutput != NULL) {
//
@@ -1238,9 +935,9 @@ InitializeUserInterface ( //
// Get user defined text mode for setup.
- //
+ //
mSetupHorizontalResolution = PcdGet32 (PcdSetupVideoHorizontalResolution);
- mSetupVerticalResolution = PcdGet32 (PcdSetupVideoVerticalResolution);
+ mSetupVerticalResolution = PcdGet32 (PcdSetupVideoVerticalResolution);
mSetupTextModeColumn = PcdGet32 (PcdSetupConOutColumn);
mSetupTextModeRow = PcdGet32 (PcdSetupConOutRow);
@@ -1249,11 +946,10 @@ InitializeUserInterface ( gBS->SetWatchdogTimer (0x0000, 0x0000, 0x0000, NULL);
gST->ConOut->ClearScreen (gST->ConOut);
-
+
//
// Install customized fonts needed by Front Page
//
-
HiiHandle = ExportFonts ();
ASSERT (HiiHandle != NULL);
@@ -1322,38 +1018,6 @@ UiEntry ( SetupResetReminder ();
}
-/**
- Extract device path for given HII handle and class guid.
-
- @param Handle The HII handle.
-
- @retval NULL Fail to get the device path string.
- @return PathString Get the device path string.
-
-**/
-CHAR16 *
-ExtractDevicePathFromHiiHandle (
- IN EFI_HII_HANDLE Handle
- )
-{
- EFI_STATUS Status;
- EFI_HANDLE DriverHandle;
-
- ASSERT (Handle != NULL);
-
- if (Handle == NULL) {
- return NULL;
- }
-
- Status = gHiiDatabase->GetPackageListHandle (gHiiDatabase, Handle, &DriverHandle);
- if (EFI_ERROR (Status)) {
- return NULL;
- }
-
- return ConvertDevicePathToText(DevicePathFromHandle (DriverHandle), FALSE, FALSE);
-
-}
-
//
// Following are BDS Lib functions which contain all the code about setup browser reset reminder feature.
// Setup Browser reset reminder feature is that an reset reminder will be given before user leaves the setup browser if
|