3 Copyright (c) 2004 - 2008, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 FrontPage routines to handle the callbacks and browser calls
23 #include "FrontPage.h"
25 EFI_GUID mFrontPageGuid
= FRONT_PAGE_FORMSET_GUID
;
27 BOOLEAN gConnectAllHappened
= FALSE
;
30 EFI_HII_DATABASE_PROTOCOL
*gHiiDatabase
;
31 EFI_HII_STRING_PROTOCOL
*gHiiString
;
32 EFI_FORM_BROWSER2_PROTOCOL
*gFormBrowser2
;
33 EFI_HII_CONFIG_ROUTING_PROTOCOL
*gHiiConfigRouting
;
35 FRONT_PAGE_CALLBACK_DATA gFrontPagePrivate
= {
36 FRONT_PAGE_CALLBACK_DATA_SIGNATURE
,
50 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
51 IN CONST EFI_STRING Request
,
52 OUT EFI_STRING
*Progress
,
53 OUT EFI_STRING
*Results
58 This function allows a caller to extract the current configuration for one
59 or more named elements from the target driver.
62 This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
63 Request - A null-terminated Unicode string in <ConfigRequest> format.
64 Progress - On return, points to a character in the Request string.
65 Points to the string's null terminator if request was successful.
66 Points to the most recent '&' before the first failing name/value
67 pair (or the beginning of the string if the failure is in the
68 first name/value pair) if the request was not successful.
69 Results - A null-terminated Unicode string in <ConfigAltResp> format which
70 has all values filled in for the names in the Request string.
71 String to be allocated by the called function.
74 EFI_SUCCESS - The Results is filled with the requested values.
75 EFI_OUT_OF_RESOURCES - Not enough memory to store the results.
76 EFI_INVALID_PARAMETER - Request is NULL, illegal syntax, or unknown name.
77 EFI_NOT_FOUND - Routing data doesn't match any storage in this driver.
87 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
88 IN CONST EFI_STRING Configuration
,
89 OUT EFI_STRING
*Progress
94 This function processes the results of changes in configuration.
97 This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
98 Configuration - A null-terminated Unicode string in <ConfigResp> format.
99 Progress - A pointer to a string filled in with the offset of the most
100 recent '&' before the first failing name/value pair (or the
101 beginning of the string if the failure is in the first
102 name/value pair) or the terminating NULL if all was successful.
105 EFI_SUCCESS - The Results is processed successfully.
106 EFI_INVALID_PARAMETER - Configuration is NULL.
107 EFI_NOT_FOUND - Routing data doesn't match any storage in this driver.
117 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
118 IN EFI_BROWSER_ACTION Action
,
119 IN EFI_QUESTION_ID QuestionId
,
121 IN EFI_IFR_TYPE_VALUE
*Value
,
122 OUT EFI_BROWSER_ACTION_REQUEST
*ActionRequest
127 This function processes the results of changes in configuration.
130 This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
131 Action - Specifies the type of action taken by the browser.
132 QuestionId - A unique value which is sent to the original exporting driver
133 so that it can identify the type of data to expect.
134 Type - The type of value for the question.
135 Value - A pointer to the data being sent to the original exporting driver.
136 ActionRequest - On return, points to the action requested by the callback function.
139 EFI_SUCCESS - The callback successfully handled the action.
140 EFI_OUT_OF_RESOURCES - Not enough storage is available to hold the variable and its data.
141 EFI_DEVICE_ERROR - The variable could not be saved.
142 EFI_UNSUPPORTED - The specified Action is not supported by the callback.
146 CHAR8
*LanguageString
;
148 CHAR8 Lang
[RFC_3066_ENTRY_SIZE
];
150 CHAR8 OldLang
[ISO_639_2_ENTRY_SIZE
];
155 if ((Value
== NULL
) || (ActionRequest
== NULL
)) {
156 return EFI_INVALID_PARAMETER
;
159 gCallbackKey
= QuestionId
;
162 // The first 4 entries in the Front Page are to be GUARANTEED to remain constant so IHV's can
163 // describe to their customers in documentation how to find their setup information (namely
164 // under the device manager and specific buckets)
166 switch (QuestionId
) {
167 case FRONT_PAGE_KEY_CONTINUE
:
169 // This is the continue - clear the screen and return an error to get out of FrontPage loop
173 case FRONT_PAGE_KEY_LANGUAGE
:
175 // Collect the languages from what our current Language support is based on our VFR
177 LanguageString
= HiiLibGetSupportedLanguages (gFrontPagePrivate
.HiiHandle
);
178 ASSERT (LanguageString
!= NULL
);
181 LangCode
= LanguageString
;
182 while (*LangCode
!= 0) {
183 HiiLibGetNextLanguage (&LangCode
, Lang
);
185 if (Index
== Value
->u8
) {
192 Status
= gRT
->SetVariable (
194 &gEfiGlobalVariableGuid
,
195 EFI_VARIABLE_NON_VOLATILE
| EFI_VARIABLE_BOOTSERVICE_ACCESS
| EFI_VARIABLE_RUNTIME_ACCESS
,
202 // Set UEFI deprecated variable "Lang" for backwards compatibility
204 Status
= ConvertRfc3066LanguageToIso639Language (Lang
, OldLang
);
205 if (!EFI_ERROR (Status
)) {
206 Status
= gRT
->SetVariable (
208 &gEfiGlobalVariableGuid
,
209 EFI_VARIABLE_NON_VOLATILE
| EFI_VARIABLE_BOOTSERVICE_ACCESS
| EFI_VARIABLE_RUNTIME_ACCESS
,
210 ISO_639_2_ENTRY_SIZE
,
216 FreePool (LanguageString
);
219 case FRONT_PAGE_KEY_BOOT_MANAGER
:
225 case FRONT_PAGE_KEY_DEVICE_MANAGER
:
231 case FRONT_PAGE_KEY_BOOT_MAINTAIN
:
233 // Boot Maintenance Manager
242 *ActionRequest
= EFI_BROWSER_ACTION_REQUEST_EXIT
;
248 InitializeFrontPage (
249 BOOLEAN ReInitializeStrings
254 Initialize HII information for the FrontPage
260 EFI_SUCCESS - The operation is successful.
261 EFI_DEVICE_ERROR - If the dynamic opcode creation failed.
266 EFI_HII_PACKAGE_LIST_HEADER
*PackageList
;
267 EFI_HII_UPDATE_DATA UpdateData
;
268 IFR_OPTION
*OptionList
;
269 CHAR8
*LanguageString
;
271 CHAR8 Lang
[RFC_3066_ENTRY_SIZE
];
272 CHAR8 CurrentLang
[RFC_3066_ENTRY_SIZE
];
275 CHAR16
*StringBuffer
;
278 EFI_HII_HANDLE HiiHandle
;
280 if (!ReInitializeStrings
) {
282 // Initialize the Device Manager
284 InitializeDeviceManager ();
287 // Initialize the Device Manager
289 InitializeBootManager ();
294 // Locate Hii relative protocols
296 Status
= gBS
->LocateProtocol (&gEfiHiiDatabaseProtocolGuid
, NULL
, (VOID
**) &gHiiDatabase
);
297 if (EFI_ERROR (Status
)) {
301 Status
= gBS
->LocateProtocol (&gEfiHiiStringProtocolGuid
, NULL
, (VOID
**) &gHiiString
);
302 if (EFI_ERROR (Status
)) {
306 Status
= gBS
->LocateProtocol (&gEfiFormBrowser2ProtocolGuid
, NULL
, (VOID
**) &gFormBrowser2
);
307 if (EFI_ERROR (Status
)) {
311 Status
= gBS
->LocateProtocol (&gEfiHiiConfigRoutingProtocolGuid
, NULL
, (VOID
**) &gHiiConfigRouting
);
312 if (EFI_ERROR (Status
)) {
317 // Create driver handle used by HII database
319 Status
= HiiLibCreateHiiDriverHandle (&gFrontPagePrivate
.DriverHandle
);
320 if (EFI_ERROR (Status
)) {
325 // Install Config Access protocol to driver handle
327 Status
= gBS
->InstallProtocolInterface (
328 &gFrontPagePrivate
.DriverHandle
,
329 &gEfiHiiConfigAccessProtocolGuid
,
330 EFI_NATIVE_INTERFACE
,
331 &gFrontPagePrivate
.ConfigAccess
333 ASSERT_EFI_ERROR (Status
);
336 // Publish our HII data
338 PackageList
= HiiLibPreparePackageList (2, &mFrontPageGuid
, FrontPageVfrBin
, BdsDxeStrings
);
339 ASSERT (PackageList
!= NULL
);
341 Status
= gHiiDatabase
->NewPackageList (
344 gFrontPagePrivate
.DriverHandle
,
345 &gFrontPagePrivate
.HiiHandle
347 FreePool (PackageList
);
348 if (EFI_ERROR (Status
)) {
354 // Get current language setting
356 HiiLibGetCurrentLanguage (CurrentLang
);
359 // Allocate space for creation of UpdateData Buffer
361 UpdateData
.BufferSize
= 0x1000;
362 UpdateData
.Data
= AllocateZeroPool (0x1000);
363 ASSERT (UpdateData
.Data
!= NULL
);
365 OptionList
= AllocateZeroPool (0x1000);
366 ASSERT (OptionList
!= NULL
);
369 // Collect the languages from what our current Language support is based on our VFR
371 HiiHandle
= gFrontPagePrivate
.HiiHandle
;
372 LanguageString
= HiiLibGetSupportedLanguages (HiiHandle
);
373 ASSERT (LanguageString
!= NULL
);
376 LangCode
= LanguageString
;
377 while (*LangCode
!= 0) {
378 HiiLibGetNextLanguage (&LangCode
, Lang
);
380 if (gFrontPagePrivate
.LanguageToken
== NULL
) {
382 // Get Language Name from String Package. The StringId of Printable Language
383 // Name is always 1 which is generated by StringGather Tool.
386 StringBuffer
= AllocatePool (BufferSize
);
387 Status
= gHiiString
->GetString (
391 PRINTABLE_LANGUAGE_NAME_STRING_ID
,
396 if (Status
== EFI_BUFFER_TOO_SMALL
) {
397 FreePool (StringBuffer
);
398 StringBuffer
= AllocatePool (BufferSize
);
399 Status
= gHiiString
->GetString (
403 PRINTABLE_LANGUAGE_NAME_STRING_ID
,
409 ASSERT_EFI_ERROR (Status
);
412 Status
= HiiLibNewString (HiiHandle
, &Token
, StringBuffer
);
413 FreePool (StringBuffer
);
415 Token
= gFrontPagePrivate
.LanguageToken
[OptionCount
];
418 if (AsciiStrCmp (Lang
, CurrentLang
) == 0) {
419 OptionList
[OptionCount
].Flags
= EFI_IFR_OPTION_DEFAULT
;
421 OptionList
[OptionCount
].Flags
= 0;
423 OptionList
[OptionCount
].StringToken
= Token
;
424 OptionList
[OptionCount
].Value
.u8
= (UINT8
) OptionCount
;
429 FreePool (LanguageString
);
431 UpdateData
.Offset
= 0;
433 FRONT_PAGE_KEY_LANGUAGE
,
436 STRING_TOKEN (STR_LANGUAGE_SELECT
),
437 STRING_TOKEN (STR_LANGUAGE_SELECT_HELP
),
438 EFI_IFR_FLAG_CALLBACK
,
439 EFI_IFR_NUMERIC_SIZE_1
,
445 Status
= IfrLibUpdateForm (
449 LABEL_SELECT_LANGUAGE
,
455 // Save the string Id for each language
457 gFrontPagePrivate
.LanguageToken
= AllocatePool (OptionCount
* sizeof (EFI_STRING_ID
));
458 ASSERT (gFrontPagePrivate
.LanguageToken
!= NULL
);
459 for (Index
= 0; Index
< OptionCount
; Index
++) {
460 gFrontPagePrivate
.LanguageToken
[Index
] = OptionList
[Index
].StringToken
;
463 FreePool (UpdateData
.Data
);
464 FreePool (OptionList
);
475 Call the browser and display the front page
485 EFI_BROWSER_ACTION_REQUEST ActionRequest
;
488 // Begin waiting for USER INPUT
492 (EFI_SOFTWARE_DXE_BS_DRIVER
| EFI_SW_PC_INPUT_WAIT
)
497 // Drop the TPL level from TPL_APPLICATION to TPL_APPLICATION
499 gBS
->RestoreTPL (TPL_APPLICATION
);
501 ActionRequest
= EFI_BROWSER_ACTION_REQUEST_NONE
;
502 Status
= gFormBrowser2
->SendForm (
504 &gFrontPagePrivate
.HiiHandle
,
512 // Check whether user change any option setting which needs a reset to be effective
514 if (ActionRequest
== EFI_BROWSER_ACTION_REQUEST_RESET
) {
515 EnableResetRequired ();
518 gBS
->RaiseTPL (TPL_APPLICATION
);
524 IN EFI_GUID
*ProducerGuid
,
525 IN EFI_STRING_ID Token
,
531 Acquire the string associated with the ProducerGuid and return it.
534 ProducerGuid - The Guid to search the HII database for
535 Token - The token value of the string to extract
536 String - The string that is extracted
539 EFI_SUCCESS - The function returns EFI_SUCCESS always.
545 Status
= HiiLibGetStringFromToken (ProducerGuid
, Token
, String
);
546 if (EFI_ERROR (Status
)) {
547 *String
= GetStringById (STRING_TOKEN (STR_MISSING_STRING
));
554 ConvertProcessorToString (
555 IN EFI_PROCESSOR_CORE_FREQUENCY_DATA
*ProcessorFrequency
,
561 Convert Processor Frequency Data to a string
564 ProcessorFrequency - The frequency data to process
565 String - The string that is created
571 CHAR16
*StringBuffer
;
575 if (ProcessorFrequency
->Exponent
>= 6) {
576 FreqMhz
= ProcessorFrequency
->Value
;
577 for (Index
= 0; Index
< (UINTN
) (ProcessorFrequency
->Exponent
- 6); Index
++) {
584 StringBuffer
= AllocateZeroPool (0x20);
585 ASSERT (StringBuffer
!= NULL
);
586 Index
= UnicodeValueToString (StringBuffer
, LEFT_JUSTIFY
, FreqMhz
/ 1000, 3);
587 StrCat (StringBuffer
, L
".");
588 UnicodeValueToString (StringBuffer
+ Index
+ 1, PREFIX_ZERO
, (FreqMhz
% 1000) / 10, 2);
589 StrCat (StringBuffer
, L
" GHz");
591 *String
= (CHAR16
*) StringBuffer
;
597 ConvertMemorySizeToString (
598 IN UINT32 MemorySize
,
604 Convert Memory Size to a string
607 MemorySize - The size of the memory to process
608 String - The string that is created
614 CHAR16
*StringBuffer
;
616 StringBuffer
= AllocateZeroPool (0x20);
617 ASSERT (StringBuffer
!= NULL
);
618 UnicodeValueToString (StringBuffer
, LEFT_JUSTIFY
, MemorySize
, 6);
619 StrCat (StringBuffer
, L
" MB RAM");
621 *String
= (CHAR16
*) StringBuffer
;
627 UpdateFrontPageStrings (
633 Update the banner information for the Front Page based on DataHub information
643 EFI_STRING_ID TokenToUpdate
;
645 UINT64 MonotonicCount
;
646 EFI_DATA_HUB_PROTOCOL
*DataHub
;
647 EFI_DATA_RECORD_HEADER
*Record
;
648 EFI_SUBCLASS_TYPE1_HEADER
*DataHeader
;
649 EFI_MISC_BIOS_VENDOR_DATA
*BiosVendor
;
650 EFI_MISC_SYSTEM_MANUFACTURER_DATA
*SystemManufacturer
;
651 EFI_PROCESSOR_VERSION_DATA
*ProcessorVersion
;
652 EFI_PROCESSOR_CORE_FREQUENCY_DATA
*ProcessorFrequency
;
653 EFI_MEMORY_ARRAY_START_ADDRESS_DATA
*MemoryArray
;
656 ZeroMem (Find
, sizeof (Find
));
659 // Update Front Page strings
661 Status
= gBS
->LocateProtocol (
662 &gEfiDataHubProtocolGuid
,
666 ASSERT_EFI_ERROR (Status
);
671 Status
= DataHub
->GetNextRecord (DataHub
, &MonotonicCount
, NULL
, &Record
);
672 if (Record
->DataRecordClass
== EFI_DATA_RECORD_CLASS_DATA
) {
673 DataHeader
= (EFI_SUBCLASS_TYPE1_HEADER
*) (Record
+ 1);
674 if (CompareGuid (&Record
->DataRecordGuid
, &gEfiMiscSubClassGuid
) &&
675 (DataHeader
->RecordType
== EFI_MISC_BIOS_VENDOR_RECORD_NUMBER
)
677 BiosVendor
= (EFI_MISC_BIOS_VENDOR_DATA
*) (DataHeader
+ 1);
678 GetProducerString (&Record
->ProducerName
, BiosVendor
->BiosVersion
, &NewString
);
679 TokenToUpdate
= STRING_TOKEN (STR_FRONT_PAGE_BIOS_VERSION
);
680 HiiLibSetString (gFrontPagePrivate
.HiiHandle
, TokenToUpdate
, NewString
);
681 FreePool (NewString
);
685 if (CompareGuid (&Record
->DataRecordGuid
, &gEfiMiscSubClassGuid
) &&
686 (DataHeader
->RecordType
== EFI_MISC_SYSTEM_MANUFACTURER_RECORD_NUMBER
)
688 SystemManufacturer
= (EFI_MISC_SYSTEM_MANUFACTURER_DATA
*) (DataHeader
+ 1);
689 GetProducerString (&Record
->ProducerName
, SystemManufacturer
->SystemProductName
, &NewString
);
690 TokenToUpdate
= STRING_TOKEN (STR_FRONT_PAGE_COMPUTER_MODEL
);
691 HiiLibSetString (gFrontPagePrivate
.HiiHandle
, TokenToUpdate
, NewString
);
692 FreePool (NewString
);
696 if (CompareGuid (&Record
->DataRecordGuid
, &gEfiProcessorSubClassGuid
) &&
697 (DataHeader
->RecordType
== ProcessorVersionRecordType
)
699 ProcessorVersion
= (EFI_PROCESSOR_VERSION_DATA
*) (DataHeader
+ 1);
700 GetProducerString (&Record
->ProducerName
, *ProcessorVersion
, &NewString
);
701 TokenToUpdate
= STRING_TOKEN (STR_FRONT_PAGE_CPU_MODEL
);
702 HiiLibSetString (gFrontPagePrivate
.HiiHandle
, TokenToUpdate
, NewString
);
703 FreePool (NewString
);
707 if (CompareGuid (&Record
->DataRecordGuid
, &gEfiProcessorSubClassGuid
) &&
708 (DataHeader
->RecordType
== ProcessorCoreFrequencyRecordType
)
710 ProcessorFrequency
= (EFI_PROCESSOR_CORE_FREQUENCY_DATA
*) (DataHeader
+ 1);
711 ConvertProcessorToString (ProcessorFrequency
, &NewString
);
712 TokenToUpdate
= STRING_TOKEN (STR_FRONT_PAGE_CPU_SPEED
);
713 HiiLibSetString (gFrontPagePrivate
.HiiHandle
, TokenToUpdate
, NewString
);
714 FreePool (NewString
);
718 if (CompareGuid (&Record
->DataRecordGuid
, &gEfiMemorySubClassGuid
) &&
719 (DataHeader
->RecordType
== EFI_MEMORY_ARRAY_START_ADDRESS_RECORD_NUMBER
)
721 MemoryArray
= (EFI_MEMORY_ARRAY_START_ADDRESS_DATA
*) (DataHeader
+ 1);
722 ConvertMemorySizeToString (
723 (UINT32
)(RShiftU64((MemoryArray
->MemoryArrayEndAddress
- MemoryArray
->MemoryArrayStartAddress
+ 1), 20)),
726 TokenToUpdate
= STRING_TOKEN (STR_FRONT_PAGE_MEMORY_SIZE
);
727 HiiLibSetString (gFrontPagePrivate
.HiiHandle
, TokenToUpdate
, NewString
);
728 FreePool (NewString
);
732 } while (!EFI_ERROR (Status
) && (MonotonicCount
!= 0) && !(Find
[0] && Find
[1] && Find
[2] && Find
[3] && Find
[4]));
740 IN UINT64 Timeout OPTIONAL
745 Function waits for a given event to fire, or for an optional timeout to expire.
748 Event - The event to wait for
749 Timeout - An optional timeout value in 100 ns units.
752 EFI_SUCCESS - Event fired before Timeout expired.
753 EFI_TIME_OUT - Timout expired before Event fired..
759 EFI_EVENT TimerEvent
;
760 EFI_EVENT WaitList
[2];
764 // Create a timer event
766 Status
= gBS
->CreateEvent (EVT_TIMER
, 0, NULL
, NULL
, &TimerEvent
);
767 if (!EFI_ERROR (Status
)) {
769 // Set the timer event
778 // Wait for the original event or the timer
781 WaitList
[1] = TimerEvent
;
782 Status
= gBS
->WaitForEvent (2, WaitList
, &Index
);
783 gBS
->CloseEvent (TimerEvent
);
786 // If the timer expired, change the return to timed out
788 if (!EFI_ERROR (Status
) && Index
== 1) {
789 Status
= EFI_TIMEOUT
;
794 // No timeout... just wait on the event
796 Status
= gBS
->WaitForEvent (1, &Event
, &Index
);
797 ASSERT (!EFI_ERROR (Status
));
806 IN UINT16 TimeoutDefault
811 Function show progress bar to wait for user input.
814 TimeoutDefault - The fault time out value before the system
818 EFI_SUCCESS - User pressed some key except "Enter"
819 EFI_TIME_OUT - Timout expired or user press "Enter"
825 EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground
;
826 EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background
;
827 EFI_GRAPHICS_OUTPUT_BLT_PIXEL Color
;
829 UINT16 TimeoutRemain
;
831 if (TimeoutDefault
== 0) {
835 SetMem (&Foreground
, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
), 0xff);
836 SetMem (&Background
, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
), 0x0);
837 SetMem (&Color
, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
), 0xff);
840 // Clear the progress status bar first
842 TmpStr
= GetStringById (STRING_TOKEN (STR_START_BOOT_OPTION
));
843 if (TmpStr
!= NULL
) {
844 PlatformBdsShowProgress (Foreground
, Background
, TmpStr
, Color
, 0, 0);
847 TimeoutRemain
= TimeoutDefault
;
848 while (TimeoutRemain
!= 0) {
849 Status
= WaitForSingleEvent (gST
->ConIn
->WaitForKey
, ONE_SECOND
);
850 if (Status
!= EFI_TIMEOUT
) {
858 if (TmpStr
!= NULL
) {
859 PlatformBdsShowProgress (
864 ((TimeoutDefault
- TimeoutRemain
) * 100 / TimeoutDefault
),
869 gBS
->FreePool (TmpStr
);
874 if (TimeoutRemain
== 0) {
879 // User pressed some key
881 Status
= gST
->ConIn
->ReadKeyStroke (gST
->ConIn
, &Key
);
882 if (EFI_ERROR (Status
)) {
886 if (Key
.UnicodeChar
== CHAR_CARRIAGE_RETURN
) {
888 // User pressed enter, equivalent to select "continue"
897 PlatformBdsEnterFrontPage (
898 IN UINT16 TimeoutDefault
,
899 IN BOOLEAN ConnectAllHappened
904 This function is the main entry of the platform setup entry.
905 The function will present the main menu of the system setup,
906 this is the platform reference part and can be customize.
909 TimeoutDefault - The fault time out value before the system
911 ConnectAllHappened - The indicater to check if the connect all have
920 EFI_CONSOLE_CONTROL_PROTOCOL
*ConsoleControl
;
922 PERF_START (0, "BdsTimeOut", "BDS", 0);
924 // Indicate if we need connect all in the platform setup
926 if (ConnectAllHappened
) {
927 gConnectAllHappened
= TRUE
;
930 if (TimeoutDefault
!= 0xffff) {
931 gBS
->RestoreTPL (TPL_APPLICATION
);
932 Status
= ShowProgress (TimeoutDefault
);
933 gBS
->RaiseTPL (TPL_APPLICATION
);
935 if (EFI_ERROR (Status
)) {
937 // Timeout or user press enter to continue
945 InitializeFrontPage (TRUE
);
948 // Update Front Page strings
950 UpdateFrontPageStrings ();
953 Status
= CallFrontPage ();
956 // If gCallbackKey is greater than 1 and less or equal to 5,
957 // it will lauch configuration utilities.
960 // 4 = device manager
961 // 5 = boot maintainenance manager
963 if (gCallbackKey
!= 0) {
966 (EFI_SOFTWARE_DXE_BS_DRIVER
| EFI_SW_PC_USER_SETUP
)
970 // Based on the key that was set, we can determine what to do
972 switch (gCallbackKey
) {
974 // The first 4 entries in the Front Page are to be GUARANTEED to remain constant so IHV's can
975 // describe to their customers in documentation how to find their setup information (namely
976 // under the device manager and specific buckets)
978 // These entries consist of the Continue, Select language, Boot Manager, and Device Manager
980 case FRONT_PAGE_KEY_CONTINUE
:
986 case FRONT_PAGE_KEY_LANGUAGE
:
988 // User made a language setting change - display front page again
992 case FRONT_PAGE_KEY_BOOT_MANAGER
:
994 // User chose to run the Boot Manager
999 case FRONT_PAGE_KEY_DEVICE_MANAGER
:
1001 // Display the Device Manager
1004 CallDeviceManager();
1005 } while (gCallbackKey
== FRONT_PAGE_KEY_DEVICE_MANAGER
);
1008 case FRONT_PAGE_KEY_BOOT_MAINTAIN
:
1010 // Display the Boot Maintenance Manager
1012 BdsStartBootMaint ();
1016 } while ((Status
== EFI_SUCCESS
) && (gCallbackKey
!= FRONT_PAGE_KEY_CONTINUE
));
1019 //Will leave browser, check any reset required change is applied? if yes, reset system
1021 gBS
->RestoreTPL (TPL_APPLICATION
);
1022 SetupResetReminder ();
1023 gBS
->RaiseTPL (TPL_APPLICATION
);
1027 // Automatically load current entry
1028 // Note: The following lines of code only execute when Auto boot
1031 PERF_END (0, "BdsTimeOut", "BDS", 0);
1032 Status
= gBS
->LocateProtocol (&gEfiConsoleControlProtocolGuid
, NULL
, (VOID
**) &ConsoleControl
);
1033 ConsoleControl
->SetMode (ConsoleControl
, EfiConsoleControlScreenText
);