/** @file\r
FrontPage routines to handle the callbacks and browser calls\r
\r
-Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>\r
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
#include "Bds.h"\r
#include "FrontPage.h"\r
#include "Language.h"\r
+#include "Hotkey.h"\r
\r
EFI_GUID mFrontPageGuid = FRONT_PAGE_FORMSET_GUID;\r
\r
CHAR8 *PlatformSupportedLanguages;\r
CHAR8 *BestLanguage;\r
\r
- if ((Action == EFI_BROWSER_ACTION_FORM_OPEN) || (Action == EFI_BROWSER_ACTION_FORM_CLOSE)) {\r
- //\r
- // Do nothing for UEFI OPEN/CLOSE Action\r
- //\r
- return EFI_SUCCESS;\r
- }\r
-\r
- if ((Value == NULL) || (ActionRequest == NULL)) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
+ if (Action == EFI_BROWSER_ACTION_CHANGING) {\r
+ if ((Value == NULL) || (ActionRequest == NULL)) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
\r
- gCallbackKey = QuestionId;\r
+ gCallbackKey = QuestionId;\r
\r
- //\r
- // The first 4 entries in the Front Page are to be GUARANTEED to remain constant so IHV's can\r
- // describe to their customers in documentation how to find their setup information (namely\r
- // under the device manager and specific buckets)\r
- //\r
- switch (QuestionId) {\r
- case FRONT_PAGE_KEY_CONTINUE:\r
//\r
- // This is the continue - clear the screen and return an error to get out of FrontPage loop\r
+ // The first 4 entries in the Front Page are to be GUARANTEED to remain constant so IHV's can\r
+ // describe to their customers in documentation how to find their setup information (namely\r
+ // under the device manager and specific buckets)\r
//\r
- break;\r
+ switch (QuestionId) {\r
+ case FRONT_PAGE_KEY_CONTINUE:\r
+ //\r
+ // This is the continue - clear the screen and return an error to get out of FrontPage loop\r
+ //\r
+ break;\r
\r
- case FRONT_PAGE_KEY_LANGUAGE:\r
- //\r
- // Collect the languages from what our current Language support is based on our VFR\r
- //\r
- LanguageString = HiiGetSupportedLanguages (gFrontPagePrivate.HiiHandle);\r
- ASSERT (LanguageString != NULL);\r
- //\r
- // Allocate working buffer for RFC 4646 language in supported LanguageString.\r
- //\r
- Lang = AllocatePool (AsciiStrSize (LanguageString));\r
- ASSERT (Lang != NULL);\r
+ case FRONT_PAGE_KEY_LANGUAGE:\r
+ //\r
+ // Collect the languages from what our current Language support is based on our VFR\r
+ //\r
+ LanguageString = HiiGetSupportedLanguages (gFrontPagePrivate.HiiHandle);\r
+ ASSERT (LanguageString != NULL);\r
+ //\r
+ // Allocate working buffer for RFC 4646 language in supported LanguageString.\r
+ //\r
+ Lang = AllocatePool (AsciiStrSize (LanguageString));\r
+ ASSERT (Lang != NULL);\r
\r
- Index = 0;\r
- LangCode = LanguageString;\r
- while (*LangCode != 0) {\r
- GetNextLanguage (&LangCode, Lang);\r
+ Index = 0;\r
+ LangCode = LanguageString;\r
+ while (*LangCode != 0) {\r
+ GetNextLanguage (&LangCode, Lang);\r
+\r
+ if (Index == Value->u8) {\r
+ break;\r
+ }\r
\r
- if (Index == Value->u8) {\r
- break;\r
+ Index++;\r
}\r
\r
- Index++;\r
- }\r
+ PlatformSupportedLanguages = GetEfiGlobalVariable (L"PlatformLangCodes");\r
+ if (PlatformSupportedLanguages == NULL) {\r
+ PlatformSupportedLanguages = AllocateCopyPool (\r
+ AsciiStrSize ((CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes)),\r
+ (CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes)\r
+ );\r
+ ASSERT (PlatformSupportedLanguages != NULL);\r
+ }\r
\r
- PlatformSupportedLanguages = GetEfiGlobalVariable (L"PlatformLangCodes");\r
- if (PlatformSupportedLanguages == NULL) {\r
- PlatformSupportedLanguages = AllocateCopyPool (\r
- AsciiStrSize ((CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes)),\r
- (CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes)\r
- );\r
- ASSERT (PlatformSupportedLanguages != NULL);\r
- }\r
+ //\r
+ // Select the best language in platform supported Language.\r
+ //\r
+ BestLanguage = GetBestLanguage (\r
+ PlatformSupportedLanguages,\r
+ FALSE,\r
+ Lang,\r
+ NULL\r
+ );\r
+ if (BestLanguage != NULL) {\r
+ Status = gRT->SetVariable (\r
+ L"PlatformLang",\r
+ &gEfiGlobalVariableGuid,\r
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
+ AsciiStrSize (BestLanguage),\r
+ Lang\r
+ );\r
+ ASSERT_EFI_ERROR(Status);\r
+ FreePool (BestLanguage);\r
+ } else {\r
+ ASSERT (FALSE);\r
+ }\r
\r
- //\r
- // Select the best language in platform supported Language.\r
- //\r
- BestLanguage = GetBestLanguage (\r
- PlatformSupportedLanguages,\r
- FALSE,\r
- Lang,\r
- NULL\r
- );\r
- if (BestLanguage != NULL) {\r
- Status = gRT->SetVariable (\r
- L"PlatformLang",\r
- &gEfiGlobalVariableGuid,\r
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
- AsciiStrSize (BestLanguage),\r
- Lang\r
- );\r
- ASSERT_EFI_ERROR(Status);\r
- FreePool (BestLanguage);\r
- } else {\r
- ASSERT (FALSE);\r
- }\r
+ FreePool (PlatformSupportedLanguages);\r
+ FreePool (Lang);\r
+ FreePool (LanguageString);\r
+ break;\r
\r
- FreePool (PlatformSupportedLanguages);\r
- FreePool (Lang);\r
- FreePool (LanguageString);\r
- break;\r
+ case FRONT_PAGE_KEY_BOOT_MANAGER:\r
+ //\r
+ // Boot Manager\r
+ //\r
+ break;\r
\r
- case FRONT_PAGE_KEY_BOOT_MANAGER:\r
- //\r
- // Boot Manager\r
- //\r
- break;\r
+ case FRONT_PAGE_KEY_DEVICE_MANAGER:\r
+ //\r
+ // Device Manager\r
+ //\r
+ break;\r
\r
- case FRONT_PAGE_KEY_DEVICE_MANAGER:\r
- //\r
- // Device Manager\r
- //\r
- break;\r
+ case FRONT_PAGE_KEY_BOOT_MAINTAIN:\r
+ //\r
+ // Boot Maintenance Manager\r
+ //\r
+ break;\r
\r
- case FRONT_PAGE_KEY_BOOT_MAINTAIN:\r
- //\r
- // Boot Maintenance Manager\r
- //\r
- break;\r
+ default:\r
+ gCallbackKey = 0;\r
+ break;\r
+ }\r
\r
- default:\r
- gCallbackKey = 0;\r
- break;\r
- }\r
+ *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;\r
\r
- *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;\r
+ return EFI_SUCCESS;\r
+ }\r
\r
- return EFI_SUCCESS;\r
+ //\r
+ // All other action return unsupported.\r
+ //\r
+ return EFI_UNSUPPORTED;\r
}\r
\r
/**\r
StrSize = AsciiStrSize (OptionalStrStart);\r
} while (OptionalStrStart[StrSize] != 0 && Index != 0);\r
\r
- if (Index != 0) {\r
+ if ((Index != 0) || (StrSize == 1)) {\r
+ //\r
+ // Meet the end of strings set but Index is non-zero, or\r
+ // Find an empty string\r
+ //\r
*String = GetStringById (STRING_TOKEN (STR_MISSING_STRING));\r
} else {\r
*String = AllocatePool (StrSize * sizeof (CHAR16));\r
gConnectAllHappened = TRUE;\r
}\r
\r
+ HotkeyBoot ();\r
if (TimeoutDefault != 0xffff) {\r
Status = ShowProgress (TimeoutDefault);\r
+ HotkeyBoot ();\r
\r
//\r
// Ensure screen is clear when switch Console from Graphics mode to Text mode\r