2 FrontPage routines to handle the callbacks and browser calls
4 Copyright (c) 2004 - 2008, Intel Corporation. <BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include "FrontPage.h"
18 EFI_GUID mFrontPageGuid
= FRONT_PAGE_FORMSET_GUID
;
20 BOOLEAN gConnectAllHappened
= FALSE
;
23 EFI_HII_DATABASE_PROTOCOL
*gHiiDatabase
;
24 EFI_HII_STRING_PROTOCOL
*gHiiString
;
25 EFI_FORM_BROWSER2_PROTOCOL
*gFormBrowser2
;
26 EFI_HII_CONFIG_ROUTING_PROTOCOL
*gHiiConfigRouting
;
28 FRONT_PAGE_CALLBACK_DATA gFrontPagePrivate
= {
29 FRONT_PAGE_CALLBACK_DATA_SIGNATURE
,
43 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
44 IN CONST EFI_STRING Request
,
45 OUT EFI_STRING
*Progress
,
46 OUT EFI_STRING
*Results
51 This function allows a caller to extract the current configuration for one
52 or more named elements from the target driver.
55 This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
56 Request - A null-terminated Unicode string in <ConfigRequest> format.
57 Progress - On return, points to a character in the Request string.
58 Points to the string's null terminator if request was successful.
59 Points to the most recent '&' before the first failing name/value
60 pair (or the beginning of the string if the failure is in the
61 first name/value pair) if the request was not successful.
62 Results - A null-terminated Unicode string in <ConfigAltResp> format which
63 has all values filled in for the names in the Request string.
64 String to be allocated by the called function.
67 EFI_SUCCESS - The Results is filled with the requested values.
68 EFI_OUT_OF_RESOURCES - Not enough memory to store the results.
69 EFI_INVALID_PARAMETER - Request is NULL, illegal syntax, or unknown name.
70 EFI_NOT_FOUND - Routing data doesn't match any storage in this driver.
80 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
81 IN CONST EFI_STRING Configuration
,
82 OUT EFI_STRING
*Progress
87 This function processes the results of changes in configuration.
90 This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
91 Configuration - A null-terminated Unicode string in <ConfigResp> format.
92 Progress - A pointer to a string filled in with the offset of the most
93 recent '&' before the first failing name/value pair (or the
94 beginning of the string if the failure is in the first
95 name/value pair) or the terminating NULL if all was successful.
98 EFI_SUCCESS - The Results is processed successfully.
99 EFI_INVALID_PARAMETER - Configuration is NULL.
100 EFI_NOT_FOUND - Routing data doesn't match any storage in this driver.
110 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
111 IN EFI_BROWSER_ACTION Action
,
112 IN EFI_QUESTION_ID QuestionId
,
114 IN EFI_IFR_TYPE_VALUE
*Value
,
115 OUT EFI_BROWSER_ACTION_REQUEST
*ActionRequest
120 This function processes the results of changes in configuration.
123 This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
124 Action - Specifies the type of action taken by the browser.
125 QuestionId - A unique value which is sent to the original exporting driver
126 so that it can identify the type of data to expect.
127 Type - The type of value for the question.
128 Value - A pointer to the data being sent to the original exporting driver.
129 ActionRequest - On return, points to the action requested by the callback function.
132 EFI_SUCCESS - The callback successfully handled the action.
133 EFI_OUT_OF_RESOURCES - Not enough storage is available to hold the variable and its data.
134 EFI_DEVICE_ERROR - The variable could not be saved.
135 EFI_UNSUPPORTED - The specified Action is not supported by the callback.
139 CHAR8
*LanguageString
;
141 CHAR8 Lang
[RFC_3066_ENTRY_SIZE
];
143 CHAR8 OldLang
[ISO_639_2_ENTRY_SIZE
];
148 if ((Value
== NULL
) || (ActionRequest
== NULL
)) {
149 return EFI_INVALID_PARAMETER
;
152 gCallbackKey
= QuestionId
;
155 // The first 4 entries in the Front Page are to be GUARANTEED to remain constant so IHV's can
156 // describe to their customers in documentation how to find their setup information (namely
157 // under the device manager and specific buckets)
159 switch (QuestionId
) {
160 case FRONT_PAGE_KEY_CONTINUE
:
162 // This is the continue - clear the screen and return an error to get out of FrontPage loop
166 case FRONT_PAGE_KEY_LANGUAGE
:
168 // Collect the languages from what our current Language support is based on our VFR
170 LanguageString
= HiiLibGetSupportedLanguages (gFrontPagePrivate
.HiiHandle
);
171 ASSERT (LanguageString
!= NULL
);
174 LangCode
= LanguageString
;
175 while (*LangCode
!= 0) {
176 HiiLibGetNextLanguage (&LangCode
, Lang
);
178 if (Index
== Value
->u8
) {
185 Status
= gRT
->SetVariable (
187 &gEfiGlobalVariableGuid
,
188 EFI_VARIABLE_NON_VOLATILE
| EFI_VARIABLE_BOOTSERVICE_ACCESS
| EFI_VARIABLE_RUNTIME_ACCESS
,
195 // Set UEFI deprecated variable "Lang" for backwards compatibility
197 Status
= ConvertRfc3066LanguageToIso639Language (Lang
, OldLang
);
198 if (!EFI_ERROR (Status
)) {
199 Status
= gRT
->SetVariable (
201 &gEfiGlobalVariableGuid
,
202 EFI_VARIABLE_NON_VOLATILE
| EFI_VARIABLE_BOOTSERVICE_ACCESS
| EFI_VARIABLE_RUNTIME_ACCESS
,
203 ISO_639_2_ENTRY_SIZE
,
209 FreePool (LanguageString
);
212 case FRONT_PAGE_KEY_BOOT_MANAGER
:
218 case FRONT_PAGE_KEY_DEVICE_MANAGER
:
224 case FRONT_PAGE_KEY_BOOT_MAINTAIN
:
226 // Boot Maintenance Manager
235 *ActionRequest
= EFI_BROWSER_ACTION_REQUEST_EXIT
;
241 InitializeFrontPage (
242 BOOLEAN ReInitializeStrings
247 Initialize HII information for the FrontPage
253 EFI_SUCCESS - The operation is successful.
254 EFI_DEVICE_ERROR - If the dynamic opcode creation failed.
259 EFI_HII_PACKAGE_LIST_HEADER
*PackageList
;
260 EFI_HII_UPDATE_DATA UpdateData
;
261 IFR_OPTION
*OptionList
;
262 CHAR8
*LanguageString
;
264 CHAR8 Lang
[RFC_3066_ENTRY_SIZE
];
265 CHAR8 CurrentLang
[RFC_3066_ENTRY_SIZE
];
268 CHAR16
*StringBuffer
;
271 EFI_HII_HANDLE HiiHandle
;
273 if (!ReInitializeStrings
) {
275 // Initialize the Device Manager
277 InitializeDeviceManager ();
280 // Initialize the Device Manager
282 InitializeBootManager ();
287 // Locate Hii relative protocols
289 Status
= gBS
->LocateProtocol (&gEfiHiiDatabaseProtocolGuid
, NULL
, (VOID
**) &gHiiDatabase
);
290 if (EFI_ERROR (Status
)) {
294 Status
= gBS
->LocateProtocol (&gEfiHiiStringProtocolGuid
, NULL
, (VOID
**) &gHiiString
);
295 if (EFI_ERROR (Status
)) {
299 Status
= gBS
->LocateProtocol (&gEfiFormBrowser2ProtocolGuid
, NULL
, (VOID
**) &gFormBrowser2
);
300 if (EFI_ERROR (Status
)) {
304 Status
= gBS
->LocateProtocol (&gEfiHiiConfigRoutingProtocolGuid
, NULL
, (VOID
**) &gHiiConfigRouting
);
305 if (EFI_ERROR (Status
)) {
310 // Create driver handle used by HII database
312 Status
= HiiLibCreateHiiDriverHandle (&gFrontPagePrivate
.DriverHandle
);
313 if (EFI_ERROR (Status
)) {
318 // Install Config Access protocol to driver handle
320 Status
= gBS
->InstallProtocolInterface (
321 &gFrontPagePrivate
.DriverHandle
,
322 &gEfiHiiConfigAccessProtocolGuid
,
323 EFI_NATIVE_INTERFACE
,
324 &gFrontPagePrivate
.ConfigAccess
326 ASSERT_EFI_ERROR (Status
);
329 // Publish our HII data
331 PackageList
= HiiLibPreparePackageList (2, &mFrontPageGuid
, FrontPageVfrBin
, BdsDxeStrings
);
332 ASSERT (PackageList
!= NULL
);
334 Status
= gHiiDatabase
->NewPackageList (
337 gFrontPagePrivate
.DriverHandle
,
338 &gFrontPagePrivate
.HiiHandle
340 FreePool (PackageList
);
341 if (EFI_ERROR (Status
)) {
347 // Get current language setting
349 HiiLibGetCurrentLanguage (CurrentLang
);
352 // Allocate space for creation of UpdateData Buffer
354 UpdateData
.BufferSize
= 0x1000;
355 UpdateData
.Data
= AllocateZeroPool (0x1000);
356 ASSERT (UpdateData
.Data
!= NULL
);
358 OptionList
= AllocateZeroPool (0x1000);
359 ASSERT (OptionList
!= NULL
);
362 // Collect the languages from what our current Language support is based on our VFR
364 HiiHandle
= gFrontPagePrivate
.HiiHandle
;
365 LanguageString
= HiiLibGetSupportedLanguages (HiiHandle
);
366 ASSERT (LanguageString
!= NULL
);
369 LangCode
= LanguageString
;
370 while (*LangCode
!= 0) {
371 HiiLibGetNextLanguage (&LangCode
, Lang
);
373 if (gFrontPagePrivate
.LanguageToken
== NULL
) {
375 // Get Language Name from String Package. The StringId of Printable Language
376 // Name is always 1 which is generated by StringGather Tool.
379 StringBuffer
= AllocatePool (BufferSize
);
380 Status
= gHiiString
->GetString (
384 PRINTABLE_LANGUAGE_NAME_STRING_ID
,
389 if (Status
== EFI_BUFFER_TOO_SMALL
) {
390 FreePool (StringBuffer
);
391 StringBuffer
= AllocatePool (BufferSize
);
392 Status
= gHiiString
->GetString (
396 PRINTABLE_LANGUAGE_NAME_STRING_ID
,
402 ASSERT_EFI_ERROR (Status
);
405 Status
= HiiLibNewString (HiiHandle
, &Token
, StringBuffer
);
406 FreePool (StringBuffer
);
408 Token
= gFrontPagePrivate
.LanguageToken
[OptionCount
];
411 if (AsciiStrCmp (Lang
, CurrentLang
) == 0) {
412 OptionList
[OptionCount
].Flags
= EFI_IFR_OPTION_DEFAULT
;
414 OptionList
[OptionCount
].Flags
= 0;
416 OptionList
[OptionCount
].StringToken
= Token
;
417 OptionList
[OptionCount
].Value
.u8
= (UINT8
) OptionCount
;
422 FreePool (LanguageString
);
424 UpdateData
.Offset
= 0;
426 FRONT_PAGE_KEY_LANGUAGE
,
429 STRING_TOKEN (STR_LANGUAGE_SELECT
),
430 STRING_TOKEN (STR_LANGUAGE_SELECT_HELP
),
431 EFI_IFR_FLAG_CALLBACK
,
432 EFI_IFR_NUMERIC_SIZE_1
,
438 Status
= IfrLibUpdateForm (
442 LABEL_SELECT_LANGUAGE
,
448 // Save the string Id for each language
450 gFrontPagePrivate
.LanguageToken
= AllocatePool (OptionCount
* sizeof (EFI_STRING_ID
));
451 ASSERT (gFrontPagePrivate
.LanguageToken
!= NULL
);
452 for (Index
= 0; Index
< OptionCount
; Index
++) {
453 gFrontPagePrivate
.LanguageToken
[Index
] = OptionList
[Index
].StringToken
;
456 FreePool (UpdateData
.Data
);
457 FreePool (OptionList
);
468 Call the browser and display the front page
478 EFI_BROWSER_ACTION_REQUEST ActionRequest
;
481 // Begin waiting for USER INPUT
485 (EFI_SOFTWARE_DXE_BS_DRIVER
| EFI_SW_PC_INPUT_WAIT
)
490 // Drop the TPL level from TPL_APPLICATION to TPL_APPLICATION
492 gBS
->RestoreTPL (TPL_APPLICATION
);
494 ActionRequest
= EFI_BROWSER_ACTION_REQUEST_NONE
;
495 Status
= gFormBrowser2
->SendForm (
497 &gFrontPagePrivate
.HiiHandle
,
505 // Check whether user change any option setting which needs a reset to be effective
507 if (ActionRequest
== EFI_BROWSER_ACTION_REQUEST_RESET
) {
508 EnableResetRequired ();
511 gBS
->RaiseTPL (TPL_APPLICATION
);
517 IN EFI_GUID
*ProducerGuid
,
518 IN EFI_STRING_ID Token
,
524 Acquire the string associated with the ProducerGuid and return it.
527 ProducerGuid - The Guid to search the HII database for
528 Token - The token value of the string to extract
529 String - The string that is extracted
532 EFI_SUCCESS - The function returns EFI_SUCCESS always.
538 Status
= HiiLibGetStringFromToken (ProducerGuid
, Token
, String
);
539 if (EFI_ERROR (Status
)) {
540 *String
= GetStringById (STRING_TOKEN (STR_MISSING_STRING
));
547 ConvertProcessorToString (
548 IN EFI_PROCESSOR_CORE_FREQUENCY_DATA
*ProcessorFrequency
,
554 Convert Processor Frequency Data to a string
557 ProcessorFrequency - The frequency data to process
558 String - The string that is created
564 CHAR16
*StringBuffer
;
568 if (ProcessorFrequency
->Exponent
>= 6) {
569 FreqMhz
= ProcessorFrequency
->Value
;
570 for (Index
= 0; Index
< (UINTN
) (ProcessorFrequency
->Exponent
- 6); Index
++) {
577 StringBuffer
= AllocateZeroPool (0x20);
578 ASSERT (StringBuffer
!= NULL
);
579 Index
= UnicodeValueToString (StringBuffer
, LEFT_JUSTIFY
, FreqMhz
/ 1000, 3);
580 StrCat (StringBuffer
, L
".");
581 UnicodeValueToString (StringBuffer
+ Index
+ 1, PREFIX_ZERO
, (FreqMhz
% 1000) / 10, 2);
582 StrCat (StringBuffer
, L
" GHz");
584 *String
= (CHAR16
*) StringBuffer
;
590 ConvertMemorySizeToString (
591 IN UINT32 MemorySize
,
597 Convert Memory Size to a string
600 MemorySize - The size of the memory to process
601 String - The string that is created
607 CHAR16
*StringBuffer
;
609 StringBuffer
= AllocateZeroPool (0x20);
610 ASSERT (StringBuffer
!= NULL
);
611 UnicodeValueToString (StringBuffer
, LEFT_JUSTIFY
, MemorySize
, 6);
612 StrCat (StringBuffer
, L
" MB RAM");
614 *String
= (CHAR16
*) StringBuffer
;
620 UpdateFrontPageStrings (
626 Update the banner information for the Front Page based on DataHub information
636 EFI_STRING_ID TokenToUpdate
;
638 UINT64 MonotonicCount
;
639 EFI_DATA_HUB_PROTOCOL
*DataHub
;
640 EFI_DATA_RECORD_HEADER
*Record
;
641 EFI_SUBCLASS_TYPE1_HEADER
*DataHeader
;
642 EFI_MISC_BIOS_VENDOR_DATA
*BiosVendor
;
643 EFI_MISC_SYSTEM_MANUFACTURER_DATA
*SystemManufacturer
;
644 EFI_PROCESSOR_VERSION_DATA
*ProcessorVersion
;
645 EFI_PROCESSOR_CORE_FREQUENCY_DATA
*ProcessorFrequency
;
646 EFI_MEMORY_ARRAY_START_ADDRESS_DATA
*MemoryArray
;
649 ZeroMem (Find
, sizeof (Find
));
652 // Update Front Page strings
654 Status
= gBS
->LocateProtocol (
655 &gEfiDataHubProtocolGuid
,
659 ASSERT_EFI_ERROR (Status
);
664 Status
= DataHub
->GetNextRecord (DataHub
, &MonotonicCount
, NULL
, &Record
);
665 if (Record
->DataRecordClass
== EFI_DATA_RECORD_CLASS_DATA
) {
666 DataHeader
= (EFI_SUBCLASS_TYPE1_HEADER
*) (Record
+ 1);
667 if (CompareGuid (&Record
->DataRecordGuid
, &gEfiMiscSubClassGuid
) &&
668 (DataHeader
->RecordType
== EFI_MISC_BIOS_VENDOR_RECORD_NUMBER
)
670 BiosVendor
= (EFI_MISC_BIOS_VENDOR_DATA
*) (DataHeader
+ 1);
671 GetProducerString (&Record
->ProducerName
, BiosVendor
->BiosVersion
, &NewString
);
672 TokenToUpdate
= STRING_TOKEN (STR_FRONT_PAGE_BIOS_VERSION
);
673 HiiLibSetString (gFrontPagePrivate
.HiiHandle
, TokenToUpdate
, NewString
);
674 FreePool (NewString
);
678 if (CompareGuid (&Record
->DataRecordGuid
, &gEfiMiscSubClassGuid
) &&
679 (DataHeader
->RecordType
== EFI_MISC_SYSTEM_MANUFACTURER_RECORD_NUMBER
)
681 SystemManufacturer
= (EFI_MISC_SYSTEM_MANUFACTURER_DATA
*) (DataHeader
+ 1);
682 GetProducerString (&Record
->ProducerName
, SystemManufacturer
->SystemProductName
, &NewString
);
683 TokenToUpdate
= STRING_TOKEN (STR_FRONT_PAGE_COMPUTER_MODEL
);
684 HiiLibSetString (gFrontPagePrivate
.HiiHandle
, TokenToUpdate
, NewString
);
685 FreePool (NewString
);
689 if (CompareGuid (&Record
->DataRecordGuid
, &gEfiProcessorSubClassGuid
) &&
690 (DataHeader
->RecordType
== ProcessorVersionRecordType
)
692 ProcessorVersion
= (EFI_PROCESSOR_VERSION_DATA
*) (DataHeader
+ 1);
693 GetProducerString (&Record
->ProducerName
, *ProcessorVersion
, &NewString
);
694 TokenToUpdate
= STRING_TOKEN (STR_FRONT_PAGE_CPU_MODEL
);
695 HiiLibSetString (gFrontPagePrivate
.HiiHandle
, TokenToUpdate
, NewString
);
696 FreePool (NewString
);
700 if (CompareGuid (&Record
->DataRecordGuid
, &gEfiProcessorSubClassGuid
) &&
701 (DataHeader
->RecordType
== ProcessorCoreFrequencyRecordType
)
703 ProcessorFrequency
= (EFI_PROCESSOR_CORE_FREQUENCY_DATA
*) (DataHeader
+ 1);
704 ConvertProcessorToString (ProcessorFrequency
, &NewString
);
705 TokenToUpdate
= STRING_TOKEN (STR_FRONT_PAGE_CPU_SPEED
);
706 HiiLibSetString (gFrontPagePrivate
.HiiHandle
, TokenToUpdate
, NewString
);
707 FreePool (NewString
);
711 if (CompareGuid (&Record
->DataRecordGuid
, &gEfiMemorySubClassGuid
) &&
712 (DataHeader
->RecordType
== EFI_MEMORY_ARRAY_START_ADDRESS_RECORD_NUMBER
)
714 MemoryArray
= (EFI_MEMORY_ARRAY_START_ADDRESS_DATA
*) (DataHeader
+ 1);
715 ConvertMemorySizeToString (
716 (UINT32
)(RShiftU64((MemoryArray
->MemoryArrayEndAddress
- MemoryArray
->MemoryArrayStartAddress
+ 1), 20)),
719 TokenToUpdate
= STRING_TOKEN (STR_FRONT_PAGE_MEMORY_SIZE
);
720 HiiLibSetString (gFrontPagePrivate
.HiiHandle
, TokenToUpdate
, NewString
);
721 FreePool (NewString
);
725 } while (!EFI_ERROR (Status
) && (MonotonicCount
!= 0) && !(Find
[0] && Find
[1] && Find
[2] && Find
[3] && Find
[4]));
733 IN UINT64 Timeout OPTIONAL
738 Function waits for a given event to fire, or for an optional timeout to expire.
741 Event - The event to wait for
742 Timeout - An optional timeout value in 100 ns units.
745 EFI_SUCCESS - Event fired before Timeout expired.
746 EFI_TIME_OUT - Timout expired before Event fired..
752 EFI_EVENT TimerEvent
;
753 EFI_EVENT WaitList
[2];
757 // Create a timer event
759 Status
= gBS
->CreateEvent (EVT_TIMER
, 0, NULL
, NULL
, &TimerEvent
);
760 if (!EFI_ERROR (Status
)) {
762 // Set the timer event
771 // Wait for the original event or the timer
774 WaitList
[1] = TimerEvent
;
775 Status
= gBS
->WaitForEvent (2, WaitList
, &Index
);
776 gBS
->CloseEvent (TimerEvent
);
779 // If the timer expired, change the return to timed out
781 if (!EFI_ERROR (Status
) && Index
== 1) {
782 Status
= EFI_TIMEOUT
;
787 // No timeout... just wait on the event
789 Status
= gBS
->WaitForEvent (1, &Event
, &Index
);
790 ASSERT (!EFI_ERROR (Status
));
799 IN UINT16 TimeoutDefault
804 Function show progress bar to wait for user input.
807 TimeoutDefault - The fault time out value before the system
811 EFI_SUCCESS - User pressed some key except "Enter"
812 EFI_TIME_OUT - Timout expired or user press "Enter"
818 EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground
;
819 EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background
;
820 EFI_GRAPHICS_OUTPUT_BLT_PIXEL Color
;
822 UINT16 TimeoutRemain
;
824 if (TimeoutDefault
== 0) {
828 DEBUG ((EFI_D_INFO
, "\n\nStart showing progress bar... Press any key to stop it! ...Zzz....\n"));
830 SetMem (&Foreground
, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
), 0xff);
831 SetMem (&Background
, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
), 0x0);
832 SetMem (&Color
, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
), 0xff);
835 // Clear the progress status bar first
837 TmpStr
= GetStringById (STRING_TOKEN (STR_START_BOOT_OPTION
));
838 if (TmpStr
!= NULL
) {
839 PlatformBdsShowProgress (Foreground
, Background
, TmpStr
, Color
, 0, 0);
842 TimeoutRemain
= TimeoutDefault
;
843 while (TimeoutRemain
!= 0) {
844 DEBUG ((EFI_D_INFO
, "Showing progress bar...Remaining %d second!\n", TimeoutRemain
));
846 Status
= WaitForSingleEvent (gST
->ConIn
->WaitForKey
, ONE_SECOND
);
847 if (Status
!= EFI_TIMEOUT
) {
855 if (TmpStr
!= NULL
) {
856 PlatformBdsShowProgress (
861 ((TimeoutDefault
- TimeoutRemain
) * 100 / TimeoutDefault
),
866 gBS
->FreePool (TmpStr
);
871 if (TimeoutRemain
== 0) {
876 // User pressed some key
878 Status
= gST
->ConIn
->ReadKeyStroke (gST
->ConIn
, &Key
);
879 if (EFI_ERROR (Status
)) {
883 if (Key
.UnicodeChar
== CHAR_CARRIAGE_RETURN
) {
885 // User pressed enter, equivalent to select "continue"
894 PlatformBdsEnterFrontPage (
895 IN UINT16 TimeoutDefault
,
896 IN BOOLEAN ConnectAllHappened
901 This function is the main entry of the platform setup entry.
902 The function will present the main menu of the system setup,
903 this is the platform reference part and can be customize.
906 TimeoutDefault - The fault time out value before the system
908 ConnectAllHappened - The indicater to check if the connect all have
917 EFI_CONSOLE_CONTROL_PROTOCOL
*ConsoleControl
;
919 PERF_START (0, "BdsTimeOut", "BDS", 0);
921 // Indicate if we need connect all in the platform setup
923 if (ConnectAllHappened
) {
924 gConnectAllHappened
= TRUE
;
927 if (TimeoutDefault
!= 0xffff) {
928 gBS
->RestoreTPL (TPL_APPLICATION
);
929 Status
= ShowProgress (TimeoutDefault
);
930 gBS
->RaiseTPL (TPL_APPLICATION
);
932 if (EFI_ERROR (Status
)) {
934 // Timeout or user press enter to continue
942 InitializeFrontPage (TRUE
);
945 // Update Front Page strings
947 UpdateFrontPageStrings ();
950 Status
= CallFrontPage ();
953 // If gCallbackKey is greater than 1 and less or equal to 5,
954 // it will lauch configuration utilities.
957 // 4 = device manager
958 // 5 = boot maintainenance manager
960 if (gCallbackKey
!= 0) {
963 (EFI_SOFTWARE_DXE_BS_DRIVER
| EFI_SW_PC_USER_SETUP
)
967 // Based on the key that was set, we can determine what to do
969 switch (gCallbackKey
) {
971 // The first 4 entries in the Front Page are to be GUARANTEED to remain constant so IHV's can
972 // describe to their customers in documentation how to find their setup information (namely
973 // under the device manager and specific buckets)
975 // These entries consist of the Continue, Select language, Boot Manager, and Device Manager
977 case FRONT_PAGE_KEY_CONTINUE
:
983 case FRONT_PAGE_KEY_LANGUAGE
:
985 // User made a language setting change - display front page again
989 case FRONT_PAGE_KEY_BOOT_MANAGER
:
991 // User chose to run the Boot Manager
996 case FRONT_PAGE_KEY_DEVICE_MANAGER
:
998 // Display the Device Manager
1001 CallDeviceManager();
1002 } while (gCallbackKey
== FRONT_PAGE_KEY_DEVICE_MANAGER
);
1005 case FRONT_PAGE_KEY_BOOT_MAINTAIN
:
1007 // Display the Boot Maintenance Manager
1009 BdsStartBootMaint ();
1013 } while ((Status
== EFI_SUCCESS
) && (gCallbackKey
!= FRONT_PAGE_KEY_CONTINUE
));
1016 //Will leave browser, check any reset required change is applied? if yes, reset system
1018 gBS
->RestoreTPL (TPL_APPLICATION
);
1019 SetupResetReminder ();
1020 gBS
->RaiseTPL (TPL_APPLICATION
);
1024 // Automatically load current entry
1025 // Note: The following lines of code only execute when Auto boot
1028 PERF_END (0, "BdsTimeOut", "BDS", 0);
1029 Status
= gBS
->LocateProtocol (&gEfiConsoleControlProtocolGuid
, NULL
, (VOID
**) &ConsoleControl
);
1030 ConsoleControl
->SetMode (ConsoleControl
, EfiConsoleControlScreenText
);