-/*++\r
+/** @file\r
+ FrontPage routines to handle the callbacks and browser calls\r
\r
-Copyright (c) 2004 - 2008, Intel Corporation\r
+Copyright (c) 2004 - 2008, Intel Corporation. <BR>\r
All rights reserved. This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
-Module Name:\r
-\r
- FrontPage.c\r
-\r
-Abstract:\r
-\r
- FrontPage routines to handle the callbacks and browser calls\r
-\r
---*/\r
+**/\r
\r
#include "Bds.h"\r
#include "FrontPage.h"\r
}\r
};\r
\r
+/**\r
+ This function allows a caller to extract the current configuration for one\r
+ or more named elements from the target driver.\r
+\r
+\r
+ @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+ @param Request - A null-terminated Unicode string in <ConfigRequest> format.\r
+ @param Progress - On return, points to a character in the Request string.\r
+ Points to the string's null terminator if request was successful.\r
+ Points to the most recent '&' before the first failing name/value\r
+ pair (or the beginning of the string if the failure is in the\r
+ first name/value pair) if the request was not successful.\r
+ @param Results - A null-terminated Unicode string in <ConfigAltResp> format which\r
+ has all values filled in for the names in the Request string.\r
+ String to be allocated by the called function.\r
+\r
+ @retval EFI_SUCCESS The Results is filled with the requested values.\r
+ @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.\r
+ @retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.\r
+ @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
FakeExtractConfig (\r
OUT EFI_STRING *Progress,\r
OUT EFI_STRING *Results\r
)\r
-/*++\r
-\r
- Routine Description:\r
- This function allows a caller to extract the current configuration for one\r
- or more named elements from the target driver.\r
-\r
- Arguments:\r
- This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
- Request - A null-terminated Unicode string in <ConfigRequest> format.\r
- Progress - On return, points to a character in the Request string.\r
- Points to the string's null terminator if request was successful.\r
- Points to the most recent '&' before the first failing name/value\r
- pair (or the beginning of the string if the failure is in the\r
- first name/value pair) if the request was not successful.\r
- Results - A null-terminated Unicode string in <ConfigAltResp> format which\r
- has all values filled in for the names in the Request string.\r
- String to be allocated by the called function.\r
-\r
- Returns:\r
- EFI_SUCCESS - The Results is filled with the requested values.\r
- EFI_OUT_OF_RESOURCES - Not enough memory to store the results.\r
- EFI_INVALID_PARAMETER - Request is NULL, illegal syntax, or unknown name.\r
- EFI_NOT_FOUND - Routing data doesn't match any storage in this driver.\r
-\r
---*/\r
{\r
return EFI_NOT_FOUND;\r
}\r
\r
+/**\r
+ This function processes the results of changes in configuration.\r
+\r
+\r
+ @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+ @param Configuration - A null-terminated Unicode string in <ConfigResp> format.\r
+ @param Progress - A pointer to a string filled in with the offset of the most\r
+ recent '&' before the first failing name/value pair (or the\r
+ beginning of the string if the failure is in the first\r
+ name/value pair) or the terminating NULL if all was successful.\r
+\r
+ @retval EFI_SUCCESS The Results is processed successfully.\r
+ @retval EFI_INVALID_PARAMETER Configuration is NULL.\r
+ @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
FakeRouteConfig (\r
IN CONST EFI_STRING Configuration,\r
OUT EFI_STRING *Progress\r
)\r
-/*++\r
+{\r
+ return EFI_SUCCESS;\r
+}\r
\r
- Routine Description:\r
- This function processes the results of changes in configuration.\r
+/**\r
+ This function processes the results of changes in configuration.\r
\r
- Arguments:\r
- This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
- Configuration - A null-terminated Unicode string in <ConfigResp> format.\r
- Progress - A pointer to a string filled in with the offset of the most\r
- recent '&' before the first failing name/value pair (or the\r
- beginning of the string if the failure is in the first\r
- name/value pair) or the terminating NULL if all was successful.\r
\r
- Returns:\r
- EFI_SUCCESS - The Results is processed successfully.\r
- EFI_INVALID_PARAMETER - Configuration is NULL.\r
- EFI_NOT_FOUND - Routing data doesn't match any storage in this driver.\r
+ @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+ @param Action - Specifies the type of action taken by the browser.\r
+ @param QuestionId - A unique value which is sent to the original exporting driver\r
+ so that it can identify the type of data to expect.\r
+ @param Type - The type of value for the question.\r
+ @param Value - A pointer to the data being sent to the original exporting driver.\r
+ @param ActionRequest - On return, points to the action requested by the callback function.\r
\r
---*/\r
-{\r
- return EFI_SUCCESS;\r
-}\r
+ @retval EFI_SUCCESS The callback successfully handled the action.\r
+ @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.\r
+ @retval EFI_DEVICE_ERROR The variable could not be saved.\r
+ @retval EFI_UNSUPPORTED The specified Action is not supported by the callback.\r
\r
+**/\r
EFI_STATUS\r
EFIAPI\r
FrontPageCallback (\r
IN EFI_IFR_TYPE_VALUE *Value,\r
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest\r
)\r
-/*++\r
-\r
- Routine Description:\r
- This function processes the results of changes in configuration.\r
-\r
- Arguments:\r
- This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
- Action - Specifies the type of action taken by the browser.\r
- QuestionId - A unique value which is sent to the original exporting driver\r
- so that it can identify the type of data to expect.\r
- Type - The type of value for the question.\r
- Value - A pointer to the data being sent to the original exporting driver.\r
- ActionRequest - On return, points to the action requested by the callback function.\r
-\r
- Returns:\r
- EFI_SUCCESS - The callback successfully handled the action.\r
- EFI_OUT_OF_RESOURCES - Not enough storage is available to hold the variable and its data.\r
- EFI_DEVICE_ERROR - The variable could not be saved.\r
- EFI_UNSUPPORTED - The specified Action is not supported by the callback.\r
-\r
---*/\r
{\r
CHAR8 *LanguageString;\r
CHAR8 *LangCode;\r
CHAR8 Lang[RFC_3066_ENTRY_SIZE];\r
-#ifdef LANG_SUPPORT\r
CHAR8 OldLang[ISO_639_2_ENTRY_SIZE];\r
-#endif\r
UINTN Index;\r
EFI_STATUS Status;\r
\r
Lang\r
);\r
\r
-#ifdef LANG_SUPPORT\r
- //\r
- // Set UEFI deprecated variable "Lang" for backwards compatibility\r
- //\r
- Status = ConvertRfc3066LanguageToIso639Language (Lang, OldLang);\r
- if (!EFI_ERROR (Status)) {\r
- Status = gRT->SetVariable (\r
- L"Lang",\r
- &gEfiGlobalVariableGuid,\r
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
- ISO_639_2_ENTRY_SIZE,\r
- OldLang\r
- );\r
+ if (!FeaturePcdGet (PcdUefiVariableDefaultLangDeprecate)) {\r
+ //\r
+ // Set UEFI deprecated variable "Lang" for backwards compatibility\r
+ //\r
+ Status = ConvertRfc3066LanguageToIso639Language (Lang, OldLang);\r
+ if (!EFI_ERROR (Status)) {\r
+ Status = gRT->SetVariable (\r
+ L"Lang",\r
+ &gEfiGlobalVariableGuid,\r
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
+ ISO_639_2_ENTRY_SIZE,\r
+ OldLang\r
+ );\r
+ }\r
}\r
-#endif\r
\r
FreePool (LanguageString);\r
break;\r
return EFI_SUCCESS;\r
}\r
\r
-EFI_STATUS\r
-InitializeFrontPage (\r
- BOOLEAN ReInitializeStrings\r
- )\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
Initialize HII information for the FrontPage\r
\r
-Arguments:\r
- None\r
\r
-Returns:\r
- EFI_SUCCESS - The operation is successful.\r
- EFI_DEVICE_ERROR - If the dynamic opcode creation failed.\r
+ @param InitializeHiiData TRUE if HII elements need to be initialized.\r
+\r
+ @retval EFI_SUCCESS The operation is successful.\r
+ @retval EFI_DEVICE_ERROR If the dynamic opcode creation failed.\r
\r
---*/\r
+**/\r
+EFI_STATUS\r
+InitializeFrontPage (\r
+ IN BOOLEAN InitializeHiiData\r
+ )\r
{\r
EFI_STATUS Status;\r
EFI_HII_PACKAGE_LIST_HEADER *PackageList;\r
UINTN Index;\r
EFI_HII_HANDLE HiiHandle;\r
\r
- if (!ReInitializeStrings) {\r
+ if (InitializeHiiData) {\r
//\r
// Initialize the Device Manager\r
//\r
//\r
// Get current language setting\r
//\r
- HiiLibGetCurrentLanguage (CurrentLang);\r
+ GetCurrentLanguage (CurrentLang);\r
\r
//\r
// Allocate space for creation of UpdateData Buffer\r
return Status;\r
}\r
\r
+/**\r
+ Call the browser and display the front page\r
+\r
+ @return Status code that will be returned by\r
+ EFI_FORM_BROWSER2_PROTOCOL.SendForm ().\r
+\r
+**/\r
EFI_STATUS\r
CallFrontPage (\r
VOID\r
)\r
-/*++\r
-\r
-Routine Description:\r
- Call the browser and display the front page\r
-\r
-Arguments:\r
- None\r
-\r
-Returns:\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
EFI_BROWSER_ACTION_REQUEST ActionRequest;\r
(EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_INPUT_WAIT)\r
);\r
\r
-\r
- //\r
- // Drop the TPL level from TPL_APPLICATION to TPL_APPLICATION\r
- //\r
- gBS->RestoreTPL (TPL_APPLICATION);\r
-\r
ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;\r
Status = gFormBrowser2->SendForm (\r
gFormBrowser2,\r
EnableResetRequired ();\r
}\r
\r
- gBS->RaiseTPL (TPL_APPLICATION);\r
return Status;\r
}\r
\r
+/**\r
+ Acquire the string associated with the ProducerGuid and return it.\r
+\r
+\r
+ @param ProducerGuid - The Guid to search the HII database for\r
+ @param Token - The token value of the string to extract\r
+ @param String - The string that is extracted\r
+\r
+ @retval EFI_SUCCESS The function returns EFI_SUCCESS always.\r
+\r
+**/\r
EFI_STATUS\r
GetProducerString (\r
IN EFI_GUID *ProducerGuid,\r
IN EFI_STRING_ID Token,\r
OUT CHAR16 **String\r
)\r
-/*++\r
-\r
-Routine Description:\r
- Acquire the string associated with the ProducerGuid and return it.\r
-\r
-Arguments:\r
- ProducerGuid - The Guid to search the HII database for\r
- Token - The token value of the string to extract\r
- String - The string that is extracted\r
-\r
-Returns:\r
- EFI_SUCCESS - The function returns EFI_SUCCESS always.\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Convert Processor Frequency Data to a string\r
+\r
+\r
+ @param ProcessorFrequency - The frequency data to process\r
+ @param String - The string that is created\r
+\r
+ @return VOID.\r
+\r
+**/\r
VOID\r
ConvertProcessorToString (\r
IN EFI_PROCESSOR_CORE_FREQUENCY_DATA *ProcessorFrequency,\r
OUT CHAR16 **String\r
)\r
-/*++\r
-\r
-Routine Description:\r
- Convert Processor Frequency Data to a string\r
-\r
-Arguments:\r
- ProcessorFrequency - The frequency data to process\r
- String - The string that is created\r
-\r
-Returns:\r
-\r
---*/\r
{\r
CHAR16 *StringBuffer;\r
UINTN Index;\r
return ;\r
}\r
\r
+/**\r
+ Convert Memory Size to a string.\r
+\r
+\r
+ @param MemorySize - The size of the memory to process\r
+ @param String - The string that is created\r
+\r
+**/\r
VOID\r
ConvertMemorySizeToString (\r
IN UINT32 MemorySize,\r
OUT CHAR16 **String\r
)\r
-/*++\r
-\r
-Routine Description:\r
- Convert Memory Size to a string\r
-\r
-Arguments:\r
- MemorySize - The size of the memory to process\r
- String - The string that is created\r
-\r
-Returns:\r
-\r
---*/\r
{\r
CHAR16 *StringBuffer;\r
\r
return ;\r
}\r
\r
+/**\r
+ Update the banner information for the Front Page based on DataHub information.\r
+\r
+**/\r
VOID\r
UpdateFrontPageStrings (\r
VOID\r
)\r
-/*++\r
-\r
-Routine Description:\r
- Update the banner information for the Front Page based on DataHub information\r
-\r
-Arguments:\r
- None\r
-\r
-Returns:\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
EFI_STRING_ID TokenToUpdate;\r
return ;\r
}\r
\r
+/**\r
+ Function waits for a given event to fire, or for an optional timeout to expire.\r
+\r
+\r
+ @param Event The event to wait for\r
+ \r
+ @param Timeout An optional timeout value in 100 ns units.\r
+\r
+ @retval EFI_SUCCESS Event fired before Timeout expired.\r
+ @retval EFI_TIME_OUT Timout expired before Event fired..\r
+\r
+**/\r
EFI_STATUS\r
WaitForSingleEvent (\r
IN EFI_EVENT Event,\r
IN UINT64 Timeout OPTIONAL\r
)\r
-/*++\r
-\r
-Routine Description:\r
- Function waits for a given event to fire, or for an optional timeout to expire.\r
-\r
-Arguments:\r
- Event - The event to wait for\r
- Timeout - An optional timeout value in 100 ns units.\r
-\r
-Returns:\r
- EFI_SUCCESS - Event fired before Timeout expired.\r
- EFI_TIME_OUT - Timout expired before Event fired..\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
UINTN Index;\r
EFI_EVENT TimerEvent;\r
EFI_EVENT WaitList[2];\r
\r
- if (Timeout) {\r
+ if (Timeout != 0) {\r
//\r
// Create a timer event\r
//\r
return Status;\r
}\r
\r
-EFI_STATUS\r
-ShowProgress (\r
- IN UINT16 TimeoutDefault\r
- )\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
Function show progress bar to wait for user input.\r
\r
-Arguments:\r
- TimeoutDefault - The fault time out value before the system\r
- continue to boot.\r
\r
-Returns:\r
- EFI_SUCCESS - User pressed some key except "Enter"\r
- EFI_TIME_OUT - Timout expired or user press "Enter"\r
+ @param TimeoutDefault - The fault time out value before the system\r
+ continue to boot.\r
+\r
+ @retval EFI_SUCCESS User pressed some key except "Enter"\r
+ @retval EFI_TIME_OUT Timout expired or user press "Enter"\r
\r
---*/\r
+**/\r
+EFI_STATUS\r
+ShowProgress (\r
+ IN UINT16 TimeoutDefault\r
+ )\r
{\r
EFI_STATUS Status;\r
CHAR16 *TmpStr;\r
return EFI_TIMEOUT;\r
}\r
\r
+ DEBUG ((EFI_D_INFO, "\n\nStart showing progress bar... Press any key to stop it! ...Zzz....\n"));\r
+ \r
SetMem (&Foreground, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff);\r
SetMem (&Background, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0x0);\r
SetMem (&Color, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff);\r
\r
TimeoutRemain = TimeoutDefault;\r
while (TimeoutRemain != 0) {\r
+ DEBUG ((EFI_D_INFO, "Showing progress bar...Remaining %d second!\n", TimeoutRemain));\r
+ \r
Status = WaitForSingleEvent (gST->ConIn->WaitForKey, ONE_SECOND);\r
if (Status != EFI_TIMEOUT) {\r
break;\r
return EFI_SUCCESS;\r
}\r
\r
-VOID\r
-PlatformBdsEnterFrontPage (\r
- IN UINT16 TimeoutDefault,\r
- IN BOOLEAN ConnectAllHappened\r
- )\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
This function is the main entry of the platform setup entry.\r
The function will present the main menu of the system setup,\r
this is the platform reference part and can be customize.\r
\r
-Arguments:\r
- TimeoutDefault - The fault time out value before the system\r
- continue to boot.\r
- ConnectAllHappened - The indicater to check if the connect all have\r
- already happended.\r
\r
-Returns:\r
- None\r
+ @param TimeoutDefault - The fault time out value before the system\r
+ continue to boot.\r
+ @param ConnectAllHappened - The indicater to check if the connect all have\r
+ already happended.\r
+\r
+ @return VOID.\r
\r
---*/\r
+**/\r
+VOID\r
+PlatformBdsEnterFrontPage (\r
+ IN UINT16 TimeoutDefault,\r
+ IN BOOLEAN ConnectAllHappened\r
+ )\r
{\r
EFI_STATUS Status;\r
EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl;\r
}\r
\r
if (TimeoutDefault != 0xffff) {\r
- gBS->RestoreTPL (TPL_APPLICATION);\r
Status = ShowProgress (TimeoutDefault);\r
- gBS->RaiseTPL (TPL_APPLICATION);\r
+\r
+ //\r
+ // Ensure screen is clear when switch Console from Graphics mode to Text mode\r
+ //\r
+ gST->ConOut->EnableCursor (gST->ConOut, TRUE);\r
+ gST->ConOut->ClearScreen (gST->ConOut);\r
\r
if (EFI_ERROR (Status)) {\r
//\r
\r
do {\r
\r
- InitializeFrontPage (TRUE);\r
+ InitializeFrontPage (FALSE);\r
\r
//\r
// Update Front Page strings\r
//\r
//Will leave browser, check any reset required change is applied? if yes, reset system\r
//\r
- gBS->RestoreTPL (TPL_APPLICATION);\r
SetupResetReminder ();\r
- gBS->RaiseTPL (TPL_APPLICATION);\r
\r
Exit:\r
//\r