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
];
142 CHAR8 OldLang
[ISO_639_2_ENTRY_SIZE
];
146 if ((Value
== NULL
) || (ActionRequest
== NULL
)) {
147 return EFI_INVALID_PARAMETER
;
150 gCallbackKey
= QuestionId
;
153 // The first 4 entries in the Front Page are to be GUARANTEED to remain constant so IHV's can
154 // describe to their customers in documentation how to find their setup information (namely
155 // under the device manager and specific buckets)
157 switch (QuestionId
) {
158 case FRONT_PAGE_KEY_CONTINUE
:
160 // This is the continue - clear the screen and return an error to get out of FrontPage loop
164 case FRONT_PAGE_KEY_LANGUAGE
:
166 // Collect the languages from what our current Language support is based on our VFR
168 LanguageString
= HiiLibGetSupportedLanguages (gFrontPagePrivate
.HiiHandle
);
169 ASSERT (LanguageString
!= NULL
);
172 LangCode
= LanguageString
;
173 while (*LangCode
!= 0) {
174 HiiLibGetNextLanguage (&LangCode
, Lang
);
176 if (Index
== Value
->u8
) {
183 Status
= gRT
->SetVariable (
185 &gEfiGlobalVariableGuid
,
186 EFI_VARIABLE_NON_VOLATILE
| EFI_VARIABLE_BOOTSERVICE_ACCESS
| EFI_VARIABLE_RUNTIME_ACCESS
,
191 if (!FeaturePcdGet (PcdUefiVariableDefaultLangDepricate
)) {
193 // Set UEFI deprecated variable "Lang" for backwards compatibility
195 Status
= ConvertRfc3066LanguageToIso639Language (Lang
, OldLang
);
196 if (!EFI_ERROR (Status
)) {
197 Status
= gRT
->SetVariable (
199 &gEfiGlobalVariableGuid
,
200 EFI_VARIABLE_NON_VOLATILE
| EFI_VARIABLE_BOOTSERVICE_ACCESS
| EFI_VARIABLE_RUNTIME_ACCESS
,
201 ISO_639_2_ENTRY_SIZE
,
207 FreePool (LanguageString
);
210 case FRONT_PAGE_KEY_BOOT_MANAGER
:
216 case FRONT_PAGE_KEY_DEVICE_MANAGER
:
222 case FRONT_PAGE_KEY_BOOT_MAINTAIN
:
224 // Boot Maintenance Manager
233 *ActionRequest
= EFI_BROWSER_ACTION_REQUEST_EXIT
;
239 InitializeFrontPage (
240 BOOLEAN ReInitializeStrings
245 Initialize HII information for the FrontPage
251 EFI_SUCCESS - The operation is successful.
252 EFI_DEVICE_ERROR - If the dynamic opcode creation failed.
257 EFI_HII_PACKAGE_LIST_HEADER
*PackageList
;
258 EFI_HII_UPDATE_DATA UpdateData
;
259 IFR_OPTION
*OptionList
;
260 CHAR8
*LanguageString
;
262 CHAR8 Lang
[RFC_3066_ENTRY_SIZE
];
263 CHAR8 CurrentLang
[RFC_3066_ENTRY_SIZE
];
266 CHAR16
*StringBuffer
;
269 EFI_HII_HANDLE HiiHandle
;
271 if (!ReInitializeStrings
) {
273 // Initialize the Device Manager
275 InitializeDeviceManager ();
278 // Initialize the Device Manager
280 InitializeBootManager ();
285 // Locate Hii relative protocols
287 Status
= gBS
->LocateProtocol (&gEfiHiiDatabaseProtocolGuid
, NULL
, (VOID
**) &gHiiDatabase
);
288 if (EFI_ERROR (Status
)) {
292 Status
= gBS
->LocateProtocol (&gEfiHiiStringProtocolGuid
, NULL
, (VOID
**) &gHiiString
);
293 if (EFI_ERROR (Status
)) {
297 Status
= gBS
->LocateProtocol (&gEfiFormBrowser2ProtocolGuid
, NULL
, (VOID
**) &gFormBrowser2
);
298 if (EFI_ERROR (Status
)) {
302 Status
= gBS
->LocateProtocol (&gEfiHiiConfigRoutingProtocolGuid
, NULL
, (VOID
**) &gHiiConfigRouting
);
303 if (EFI_ERROR (Status
)) {
308 // Create driver handle used by HII database
310 Status
= HiiLibCreateHiiDriverHandle (&gFrontPagePrivate
.DriverHandle
);
311 if (EFI_ERROR (Status
)) {
316 // Install Config Access protocol to driver handle
318 Status
= gBS
->InstallProtocolInterface (
319 &gFrontPagePrivate
.DriverHandle
,
320 &gEfiHiiConfigAccessProtocolGuid
,
321 EFI_NATIVE_INTERFACE
,
322 &gFrontPagePrivate
.ConfigAccess
324 ASSERT_EFI_ERROR (Status
);
327 // Publish our HII data
329 PackageList
= HiiLibPreparePackageList (2, &mFrontPageGuid
, FrontPageVfrBin
, BdsDxeStrings
);
330 ASSERT (PackageList
!= NULL
);
332 Status
= gHiiDatabase
->NewPackageList (
335 gFrontPagePrivate
.DriverHandle
,
336 &gFrontPagePrivate
.HiiHandle
338 FreePool (PackageList
);
339 if (EFI_ERROR (Status
)) {
345 // Get current language setting
347 HiiLibGetCurrentLanguage (CurrentLang
);
350 // Allocate space for creation of UpdateData Buffer
352 UpdateData
.BufferSize
= 0x1000;
353 UpdateData
.Data
= AllocateZeroPool (0x1000);
354 ASSERT (UpdateData
.Data
!= NULL
);
356 OptionList
= AllocateZeroPool (0x1000);
357 ASSERT (OptionList
!= NULL
);
360 // Collect the languages from what our current Language support is based on our VFR
362 HiiHandle
= gFrontPagePrivate
.HiiHandle
;
363 LanguageString
= HiiLibGetSupportedLanguages (HiiHandle
);
364 ASSERT (LanguageString
!= NULL
);
367 LangCode
= LanguageString
;
368 while (*LangCode
!= 0) {
369 HiiLibGetNextLanguage (&LangCode
, Lang
);
371 if (gFrontPagePrivate
.LanguageToken
== NULL
) {
373 // Get Language Name from String Package. The StringId of Printable Language
374 // Name is always 1 which is generated by StringGather Tool.
377 StringBuffer
= AllocatePool (BufferSize
);
378 Status
= gHiiString
->GetString (
382 PRINTABLE_LANGUAGE_NAME_STRING_ID
,
387 if (Status
== EFI_BUFFER_TOO_SMALL
) {
388 FreePool (StringBuffer
);
389 StringBuffer
= AllocatePool (BufferSize
);
390 Status
= gHiiString
->GetString (
394 PRINTABLE_LANGUAGE_NAME_STRING_ID
,
400 ASSERT_EFI_ERROR (Status
);
403 Status
= HiiLibNewString (HiiHandle
, &Token
, StringBuffer
);
404 FreePool (StringBuffer
);
406 Token
= gFrontPagePrivate
.LanguageToken
[OptionCount
];
409 if (AsciiStrCmp (Lang
, CurrentLang
) == 0) {
410 OptionList
[OptionCount
].Flags
= EFI_IFR_OPTION_DEFAULT
;
412 OptionList
[OptionCount
].Flags
= 0;
414 OptionList
[OptionCount
].StringToken
= Token
;
415 OptionList
[OptionCount
].Value
.u8
= (UINT8
) OptionCount
;
420 FreePool (LanguageString
);
422 UpdateData
.Offset
= 0;
424 FRONT_PAGE_KEY_LANGUAGE
,
427 STRING_TOKEN (STR_LANGUAGE_SELECT
),
428 STRING_TOKEN (STR_LANGUAGE_SELECT_HELP
),
429 EFI_IFR_FLAG_CALLBACK
,
430 EFI_IFR_NUMERIC_SIZE_1
,
436 Status
= IfrLibUpdateForm (
440 LABEL_SELECT_LANGUAGE
,
446 // Save the string Id for each language
448 gFrontPagePrivate
.LanguageToken
= AllocatePool (OptionCount
* sizeof (EFI_STRING_ID
));
449 ASSERT (gFrontPagePrivate
.LanguageToken
!= NULL
);
450 for (Index
= 0; Index
< OptionCount
; Index
++) {
451 gFrontPagePrivate
.LanguageToken
[Index
] = OptionList
[Index
].StringToken
;
454 FreePool (UpdateData
.Data
);
455 FreePool (OptionList
);
466 Call the browser and display the front page
476 EFI_BROWSER_ACTION_REQUEST ActionRequest
;
479 // Begin waiting for USER INPUT
483 (EFI_SOFTWARE_DXE_BS_DRIVER
| EFI_SW_PC_INPUT_WAIT
)
488 // Drop the TPL level from TPL_APPLICATION to TPL_APPLICATION
490 gBS
->RestoreTPL (TPL_APPLICATION
);
492 ActionRequest
= EFI_BROWSER_ACTION_REQUEST_NONE
;
493 Status
= gFormBrowser2
->SendForm (
495 &gFrontPagePrivate
.HiiHandle
,
503 // Check whether user change any option setting which needs a reset to be effective
505 if (ActionRequest
== EFI_BROWSER_ACTION_REQUEST_RESET
) {
506 EnableResetRequired ();
509 gBS
->RaiseTPL (TPL_APPLICATION
);
515 IN EFI_GUID
*ProducerGuid
,
516 IN EFI_STRING_ID Token
,
522 Acquire the string associated with the ProducerGuid and return it.
525 ProducerGuid - The Guid to search the HII database for
526 Token - The token value of the string to extract
527 String - The string that is extracted
530 EFI_SUCCESS - The function returns EFI_SUCCESS always.
536 Status
= HiiLibGetStringFromToken (ProducerGuid
, Token
, String
);
537 if (EFI_ERROR (Status
)) {
538 *String
= GetStringById (STRING_TOKEN (STR_MISSING_STRING
));
545 ConvertProcessorToString (
546 IN EFI_PROCESSOR_CORE_FREQUENCY_DATA
*ProcessorFrequency
,
552 Convert Processor Frequency Data to a string
555 ProcessorFrequency - The frequency data to process
556 String - The string that is created
562 CHAR16
*StringBuffer
;
566 if (ProcessorFrequency
->Exponent
>= 6) {
567 FreqMhz
= ProcessorFrequency
->Value
;
568 for (Index
= 0; Index
< (UINTN
) (ProcessorFrequency
->Exponent
- 6); Index
++) {
575 StringBuffer
= AllocateZeroPool (0x20);
576 ASSERT (StringBuffer
!= NULL
);
577 Index
= UnicodeValueToString (StringBuffer
, LEFT_JUSTIFY
, FreqMhz
/ 1000, 3);
578 StrCat (StringBuffer
, L
".");
579 UnicodeValueToString (StringBuffer
+ Index
+ 1, PREFIX_ZERO
, (FreqMhz
% 1000) / 10, 2);
580 StrCat (StringBuffer
, L
" GHz");
582 *String
= (CHAR16
*) StringBuffer
;
588 ConvertMemorySizeToString (
589 IN UINT32 MemorySize
,
595 Convert Memory Size to a string
598 MemorySize - The size of the memory to process
599 String - The string that is created
605 CHAR16
*StringBuffer
;
607 StringBuffer
= AllocateZeroPool (0x20);
608 ASSERT (StringBuffer
!= NULL
);
609 UnicodeValueToString (StringBuffer
, LEFT_JUSTIFY
, MemorySize
, 6);
610 StrCat (StringBuffer
, L
" MB RAM");
612 *String
= (CHAR16
*) StringBuffer
;
618 UpdateFrontPageStrings (
624 Update the banner information for the Front Page based on DataHub information
634 EFI_STRING_ID TokenToUpdate
;
636 UINT64 MonotonicCount
;
637 EFI_DATA_HUB_PROTOCOL
*DataHub
;
638 EFI_DATA_RECORD_HEADER
*Record
;
639 EFI_SUBCLASS_TYPE1_HEADER
*DataHeader
;
640 EFI_MISC_BIOS_VENDOR_DATA
*BiosVendor
;
641 EFI_MISC_SYSTEM_MANUFACTURER_DATA
*SystemManufacturer
;
642 EFI_PROCESSOR_VERSION_DATA
*ProcessorVersion
;
643 EFI_PROCESSOR_CORE_FREQUENCY_DATA
*ProcessorFrequency
;
644 EFI_MEMORY_ARRAY_START_ADDRESS_DATA
*MemoryArray
;
647 ZeroMem (Find
, sizeof (Find
));
650 // Update Front Page strings
652 Status
= gBS
->LocateProtocol (
653 &gEfiDataHubProtocolGuid
,
657 ASSERT_EFI_ERROR (Status
);
662 Status
= DataHub
->GetNextRecord (DataHub
, &MonotonicCount
, NULL
, &Record
);
663 if (Record
->DataRecordClass
== EFI_DATA_RECORD_CLASS_DATA
) {
664 DataHeader
= (EFI_SUBCLASS_TYPE1_HEADER
*) (Record
+ 1);
665 if (CompareGuid (&Record
->DataRecordGuid
, &gEfiMiscSubClassGuid
) &&
666 (DataHeader
->RecordType
== EFI_MISC_BIOS_VENDOR_RECORD_NUMBER
)
668 BiosVendor
= (EFI_MISC_BIOS_VENDOR_DATA
*) (DataHeader
+ 1);
669 GetProducerString (&Record
->ProducerName
, BiosVendor
->BiosVersion
, &NewString
);
670 TokenToUpdate
= STRING_TOKEN (STR_FRONT_PAGE_BIOS_VERSION
);
671 HiiLibSetString (gFrontPagePrivate
.HiiHandle
, TokenToUpdate
, NewString
);
672 FreePool (NewString
);
676 if (CompareGuid (&Record
->DataRecordGuid
, &gEfiMiscSubClassGuid
) &&
677 (DataHeader
->RecordType
== EFI_MISC_SYSTEM_MANUFACTURER_RECORD_NUMBER
)
679 SystemManufacturer
= (EFI_MISC_SYSTEM_MANUFACTURER_DATA
*) (DataHeader
+ 1);
680 GetProducerString (&Record
->ProducerName
, SystemManufacturer
->SystemProductName
, &NewString
);
681 TokenToUpdate
= STRING_TOKEN (STR_FRONT_PAGE_COMPUTER_MODEL
);
682 HiiLibSetString (gFrontPagePrivate
.HiiHandle
, TokenToUpdate
, NewString
);
683 FreePool (NewString
);
687 if (CompareGuid (&Record
->DataRecordGuid
, &gEfiProcessorSubClassGuid
) &&
688 (DataHeader
->RecordType
== ProcessorVersionRecordType
)
690 ProcessorVersion
= (EFI_PROCESSOR_VERSION_DATA
*) (DataHeader
+ 1);
691 GetProducerString (&Record
->ProducerName
, *ProcessorVersion
, &NewString
);
692 TokenToUpdate
= STRING_TOKEN (STR_FRONT_PAGE_CPU_MODEL
);
693 HiiLibSetString (gFrontPagePrivate
.HiiHandle
, TokenToUpdate
, NewString
);
694 FreePool (NewString
);
698 if (CompareGuid (&Record
->DataRecordGuid
, &gEfiProcessorSubClassGuid
) &&
699 (DataHeader
->RecordType
== ProcessorCoreFrequencyRecordType
)
701 ProcessorFrequency
= (EFI_PROCESSOR_CORE_FREQUENCY_DATA
*) (DataHeader
+ 1);
702 ConvertProcessorToString (ProcessorFrequency
, &NewString
);
703 TokenToUpdate
= STRING_TOKEN (STR_FRONT_PAGE_CPU_SPEED
);
704 HiiLibSetString (gFrontPagePrivate
.HiiHandle
, TokenToUpdate
, NewString
);
705 FreePool (NewString
);
709 if (CompareGuid (&Record
->DataRecordGuid
, &gEfiMemorySubClassGuid
) &&
710 (DataHeader
->RecordType
== EFI_MEMORY_ARRAY_START_ADDRESS_RECORD_NUMBER
)
712 MemoryArray
= (EFI_MEMORY_ARRAY_START_ADDRESS_DATA
*) (DataHeader
+ 1);
713 ConvertMemorySizeToString (
714 (UINT32
)(RShiftU64((MemoryArray
->MemoryArrayEndAddress
- MemoryArray
->MemoryArrayStartAddress
+ 1), 20)),
717 TokenToUpdate
= STRING_TOKEN (STR_FRONT_PAGE_MEMORY_SIZE
);
718 HiiLibSetString (gFrontPagePrivate
.HiiHandle
, TokenToUpdate
, NewString
);
719 FreePool (NewString
);
723 } while (!EFI_ERROR (Status
) && (MonotonicCount
!= 0) && !(Find
[0] && Find
[1] && Find
[2] && Find
[3] && Find
[4]));
731 IN UINT64 Timeout OPTIONAL
736 Function waits for a given event to fire, or for an optional timeout to expire.
739 Event - The event to wait for
740 Timeout - An optional timeout value in 100 ns units.
743 EFI_SUCCESS - Event fired before Timeout expired.
744 EFI_TIME_OUT - Timout expired before Event fired..
750 EFI_EVENT TimerEvent
;
751 EFI_EVENT WaitList
[2];
755 // Create a timer event
757 Status
= gBS
->CreateEvent (EVT_TIMER
, 0, NULL
, NULL
, &TimerEvent
);
758 if (!EFI_ERROR (Status
)) {
760 // Set the timer event
769 // Wait for the original event or the timer
772 WaitList
[1] = TimerEvent
;
773 Status
= gBS
->WaitForEvent (2, WaitList
, &Index
);
774 gBS
->CloseEvent (TimerEvent
);
777 // If the timer expired, change the return to timed out
779 if (!EFI_ERROR (Status
) && Index
== 1) {
780 Status
= EFI_TIMEOUT
;
785 // No timeout... just wait on the event
787 Status
= gBS
->WaitForEvent (1, &Event
, &Index
);
788 ASSERT (!EFI_ERROR (Status
));
797 IN UINT16 TimeoutDefault
802 Function show progress bar to wait for user input.
805 TimeoutDefault - The fault time out value before the system
809 EFI_SUCCESS - User pressed some key except "Enter"
810 EFI_TIME_OUT - Timout expired or user press "Enter"
816 EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground
;
817 EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background
;
818 EFI_GRAPHICS_OUTPUT_BLT_PIXEL Color
;
820 UINT16 TimeoutRemain
;
822 if (TimeoutDefault
== 0) {
826 DEBUG ((EFI_D_INFO
, "\n\nStart showing progress bar... Press any key to stop it! ...Zzz....\n"));
828 SetMem (&Foreground
, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
), 0xff);
829 SetMem (&Background
, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
), 0x0);
830 SetMem (&Color
, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
), 0xff);
833 // Clear the progress status bar first
835 TmpStr
= GetStringById (STRING_TOKEN (STR_START_BOOT_OPTION
));
836 if (TmpStr
!= NULL
) {
837 PlatformBdsShowProgress (Foreground
, Background
, TmpStr
, Color
, 0, 0);
840 TimeoutRemain
= TimeoutDefault
;
841 while (TimeoutRemain
!= 0) {
842 DEBUG ((EFI_D_INFO
, "Showing progress bar...Remaining %d second!\n", TimeoutRemain
));
844 Status
= WaitForSingleEvent (gST
->ConIn
->WaitForKey
, ONE_SECOND
);
845 if (Status
!= EFI_TIMEOUT
) {
853 if (TmpStr
!= NULL
) {
854 PlatformBdsShowProgress (
859 ((TimeoutDefault
- TimeoutRemain
) * 100 / TimeoutDefault
),
864 gBS
->FreePool (TmpStr
);
869 if (TimeoutRemain
== 0) {
874 // User pressed some key
876 Status
= gST
->ConIn
->ReadKeyStroke (gST
->ConIn
, &Key
);
877 if (EFI_ERROR (Status
)) {
881 if (Key
.UnicodeChar
== CHAR_CARRIAGE_RETURN
) {
883 // User pressed enter, equivalent to select "continue"
892 PlatformBdsEnterFrontPage (
893 IN UINT16 TimeoutDefault
,
894 IN BOOLEAN ConnectAllHappened
899 This function is the main entry of the platform setup entry.
900 The function will present the main menu of the system setup,
901 this is the platform reference part and can be customize.
904 TimeoutDefault - The fault time out value before the system
906 ConnectAllHappened - The indicater to check if the connect all have
915 EFI_CONSOLE_CONTROL_PROTOCOL
*ConsoleControl
;
917 PERF_START (0, "BdsTimeOut", "BDS", 0);
919 // Indicate if we need connect all in the platform setup
921 if (ConnectAllHappened
) {
922 gConnectAllHappened
= TRUE
;
925 if (TimeoutDefault
!= 0xffff) {
926 gBS
->RestoreTPL (TPL_APPLICATION
);
927 Status
= ShowProgress (TimeoutDefault
);
928 gBS
->RaiseTPL (TPL_APPLICATION
);
930 if (EFI_ERROR (Status
)) {
932 // Timeout or user press enter to continue
934 gST
->ConOut
->EnableCursor (gST
->ConOut
, TRUE
);
935 gST
->ConOut
->ClearScreen (gST
->ConOut
);
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
);