13#define MAX_STRING_LEN 200
15EFI_GUID mFrontPageGuid = FRONT_PAGE_FORMSET_GUID;
17BOOLEAN mResetRequired =
FALSE;
20CHAR8 *mLanguageString;
21BOOLEAN mModeInitialized =
FALSE;
25UINT32 mBootHorizontalResolution = 0;
26UINT32 mBootVerticalResolution = 0;
27UINT32 mBootTextModeColumn = 0;
28UINT32 mBootTextModeRow = 0;
32UINT32 mSetupTextModeColumn = 0;
33UINT32 mSetupTextModeRow = 0;
34UINT32 mSetupHorizontalResolution = 0;
35UINT32 mSetupVerticalResolution = 0;
38 FRONT_PAGE_CALLBACK_DATA_SIGNATURE,
62 { 0x8e6d99ee, 0x7531, 0x48f8, { 0x87, 0x45, 0x7f, 0x61, 0x44, 0x46, 0x8f, 0xf2 }
67 END_ENTIRE_DEVICE_PATH_SUBTYPE,
69 (UINT8)(END_DEVICE_PATH_LENGTH),
70 (UINT8)((END_DEVICE_PATH_LENGTH) >> 8)
111 OUT EFI_STRING *Progress,
112 OUT EFI_STRING *Results
115 if ((Progress ==
NULL) || (Results ==
NULL)) {
116 return EFI_INVALID_PARAMETER;
120 return EFI_NOT_FOUND;
143 IN CONST EFI_STRING Configuration,
144 OUT EFI_STRING *Progress
147 if ((Configuration ==
NULL) || (Progress ==
NULL)) {
148 return EFI_INVALID_PARAMETER;
151 *Progress = Configuration;
153 return EFI_NOT_FOUND;
178 IN EFI_BROWSER_ACTION Action,
179 IN EFI_QUESTION_ID QuestionId,
182 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
198 VOID *StartOpCodeHandle;
199 VOID *EndOpCodeHandle;
207 ASSERT (StartOpCodeHandle !=
NULL);
210 ASSERT (EndOpCodeHandle !=
NULL);
216 StartGuidLabel->
Number = LABEL_FRONTPAGE_INFORMATION;
222 EndGuidLabel->
Number = LABEL_END;
228 gFrontPagePrivate.HiiHandle,
233 gFrontPagePrivate.HiiHandle,
262 Status =
gBS->LocateProtocol (&gEfiFormBrowser2ProtocolGuid,
NULL, (VOID **)&gFormBrowser2);
263 if (EFI_ERROR (Status)) {
270 gFrontPagePrivate.DriverHandle =
NULL;
271 Status =
gBS->InstallMultipleProtocolInterfaces (
272 &gFrontPagePrivate.DriverHandle,
273 &gEfiDevicePathProtocolGuid,
274 &mFrontPageHiiVendorDevicePath,
275 &gEfiHiiConfigAccessProtocolGuid,
276 &gFrontPagePrivate.ConfigAccess,
286 gFrontPagePrivate.DriverHandle,
291 ASSERT (gFrontPagePrivate.HiiHandle !=
NULL);
319 EFI_BROWSER_ACTION_REQUEST ActionRequest;
326 (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_INPUT_WAIT)
329 ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
330 Status = gFormBrowser2->SendForm (
332 &gFrontPagePrivate.HiiHandle,
342 if (ActionRequest == EFI_BROWSER_ACTION_REQUEST_RESET) {
360 Status =
gBS->UninstallMultipleProtocolInterfaces (
361 gFrontPagePrivate.DriverHandle,
362 &gEfiDevicePathProtocolGuid,
363 &mFrontPageHiiVendorDevicePath,
364 &gEfiHiiConfigAccessProtocolGuid,
365 &gFrontPagePrivate.ConfigAccess,
374 if (gFrontPagePrivate.LanguageToken !=
NULL) {
375 FreePool (gFrontPagePrivate.LanguageToken);
376 gFrontPagePrivate.LanguageToken =
NULL;
390 IN UINT16 ProcessorFrequency,
391 IN UINT16 Base10Exponent,
395 CHAR16 *StringBuffer;
400 if (Base10Exponent >= 6) {
401 FreqMhz = ProcessorFrequency;
402 for (Index = 0; Index < (UINT32)Base10Exponent - 6; Index++) {
409 DestMax = 0x20 /
sizeof (CHAR16);
411 ASSERT (StringBuffer !=
NULL);
413 Index =
StrnLenS (StringBuffer, DestMax);
414 StrCatS (StringBuffer, DestMax, L
".");
416 StringBuffer + Index + 1,
417 sizeof (CHAR16) * (DestMax - (Index + 1)),
419 (FreqMhz % 1000) / 10,
422 StrCatS (StringBuffer, DestMax, L
" GHz");
423 *String = (CHAR16 *)StringBuffer;
436 IN UINT32 MemorySize,
440 CHAR16 *StringBuffer;
443 ASSERT (StringBuffer !=
NULL);
445 StrCatS (StringBuffer, 0x24 /
sizeof (CHAR16), L
" MB RAM");
447 *String = (CHAR16 *)StringBuffer;
466 IN CHAR8 *OptionalStrStart,
483 }
while (OptionalStrStart[
StrSize] != 0 && Index != 0);
485 if ((Index != 0) || (
StrSize == 1)) {
511 CHAR16 *FirmwareVersionString;
513 EFI_SMBIOS_HANDLE SmbiosHandle;
520 UINT64 InstalledMemory;
552 Status =
gBS->LocateProtocol (&gEfiSmbiosProtocolGuid,
NULL, (VOID **)&Smbios);
553 if (EFI_ERROR (Status)) {
586 Status = Smbios->GetNext (Smbios, &SmbiosHandle,
NULL, &Record,
NULL);
587 while (!EFI_ERROR (Status)) {
588 if (Record->Type == SMBIOS_TYPE_BIOS_INFORMATION) {
590 StrIndex = Type0Record->BiosVersion;
593 FirmwareVersionString = (CHAR16 *)
PcdGetPtr (PcdFirmwareVersionString);
594 if (*FirmwareVersionString != 0x0000 ) {
606 if (Record->Type == SMBIOS_TYPE_SYSTEM_INFORMATION) {
608 StrIndex = Type1Record->ProductName;
615 if ((Record->Type == SMBIOS_TYPE_PROCESSOR_INFORMATION) && !FoundCpu) {
620 if ((Type4Record->Status & SMBIOS_TYPE4_CPU_SOCKET_POPULATED) == SMBIOS_TYPE4_CPU_SOCKET_POPULATED) {
621 StrIndex = Type4Record->ProcessorVersion;
636 if ( Record->Type == SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS ) {
638 if (Type19Record->StartingAddress != 0xFFFFFFFF ) {
640 Type19Record->EndingAddress -
641 Type19Record->StartingAddress + 1,
646 Type19Record->ExtendedEndingAddress -
647 Type19Record->ExtendedStartingAddress + 1,
653 Status = Smbios->GetNext (Smbios, &SmbiosHandle,
NULL, &Record,
NULL);
687 UINT32 NewHorizontalResolution;
688 UINT32 NewVerticalResolution;
704 Status =
gBS->HandleProtocol (
706 &gEfiGraphicsOutputProtocolGuid,
707 (VOID **)&GraphicsOutput
709 if (EFI_ERROR (Status)) {
710 GraphicsOutput =
NULL;
713 Status =
gBS->HandleProtocol (
715 &gEfiSimpleTextOutProtocolGuid,
716 (VOID **)&SimpleTextOut
718 if (EFI_ERROR (Status)) {
719 SimpleTextOut =
NULL;
722 if ((GraphicsOutput ==
NULL) || (SimpleTextOut ==
NULL)) {
723 return EFI_UNSUPPORTED;
730 NewHorizontalResolution = mSetupHorizontalResolution;
731 NewVerticalResolution = mSetupVerticalResolution;
732 NewColumns = mSetupTextModeColumn;
733 NewRows = mSetupTextModeRow;
738 NewHorizontalResolution = mBootHorizontalResolution;
739 NewVerticalResolution = mBootVerticalResolution;
740 NewColumns = mBootTextModeColumn;
741 NewRows = mBootTextModeRow;
744 if (GraphicsOutput !=
NULL) {
748 if (SimpleTextOut !=
NULL) {
759 for (ModeNumber = 0; ModeNumber < MaxGopMode; ModeNumber++) {
760 Status = GraphicsOutput->QueryMode (
766 if (!EFI_ERROR (Status)) {
776 Status = SimpleTextOut->QueryMode (SimpleTextOut, SimpleTextOut->
Mode->
Mode, &CurrentColumn, &CurrentRow);
778 if ((CurrentColumn == NewColumns) && (CurrentRow == NewRows)) {
788 for (Index = 0; Index < MaxTextMode; Index++) {
789 Status = SimpleTextOut->QueryMode (SimpleTextOut, Index, &CurrentColumn, &CurrentRow);
790 if (!EFI_ERROR (Status)) {
791 if ((CurrentColumn == NewColumns) && (CurrentRow == NewRows)) {
795 Status = SimpleTextOut->SetMode (SimpleTextOut, Index);
800 Status =
PcdSet32S (PcdConOutColumn, mSetupTextModeColumn);
802 Status =
PcdSet32S (PcdConOutRow, mSetupTextModeRow);
810 if (Index == MaxTextMode) {
815 return EFI_UNSUPPORTED;
823 Status = GraphicsOutput->SetMode (GraphicsOutput, ModeNumber);
824 if (!EFI_ERROR (Status)) {
835 if (ModeNumber == MaxGopMode) {
839 return EFI_UNSUPPORTED;
846 Status =
PcdSet32S (PcdVideoHorizontalResolution, NewHorizontalResolution);
848 Status =
PcdSet32S (PcdVideoVerticalResolution, NewVerticalResolution);
850 Status =
PcdSet32S (PcdConOutColumn, NewColumns);
852 Status =
PcdSet32S (PcdConOutRow, NewRows);
860 Status =
gBS->LocateHandleBuffer (
862 &gEfiSimpleTextOutProtocolGuid,
867 if (!EFI_ERROR (Status)) {
868 for (Index = 0; Index < HandleCount; Index++) {
869 gBS->DisconnectController (HandleBuffer[Index],
NULL,
NULL);
872 for (Index = 0; Index < HandleCount; Index++) {
876 if (HandleBuffer !=
NULL) {
907 UINTN BootTextColumn;
910 if (!mModeInitialized) {
915 Status =
gBS->HandleProtocol (
917 &gEfiGraphicsOutputProtocolGuid,
918 (VOID **)&GraphicsOutput
920 if (EFI_ERROR (Status)) {
921 GraphicsOutput =
NULL;
924 Status =
gBS->HandleProtocol (
926 &gEfiSimpleTextOutProtocolGuid,
927 (VOID **)&SimpleTextOut
929 if (EFI_ERROR (Status)) {
930 SimpleTextOut =
NULL;
933 if (GraphicsOutput !=
NULL) {
937 mBootHorizontalResolution = GraphicsOutput->Mode->Info->HorizontalResolution;
938 mBootVerticalResolution = GraphicsOutput->Mode->Info->VerticalResolution;
941 if (SimpleTextOut !=
NULL) {
942 Status = SimpleTextOut->QueryMode (
944 SimpleTextOut->Mode->Mode,
948 mBootTextModeColumn = (UINT32)BootTextColumn;
949 mBootTextModeRow = (UINT32)BootTextRow;
955 mSetupHorizontalResolution =
PcdGet32 (PcdSetupVideoHorizontalResolution);
956 mSetupVerticalResolution =
PcdGet32 (PcdSetupVideoVerticalResolution);
957 mSetupTextModeColumn =
PcdGet32 (PcdSetupConOutColumn);
958 mSetupTextModeRow =
PcdGet32 (PcdSetupConOutRow);
960 mModeInitialized =
TRUE;
963 gBS->SetWatchdogTimer (0x0000, 0x0000, 0x0000,
NULL);
970 ASSERT (HiiHandle !=
NULL);
994 IN BOOLEAN ConnectAllHappened
1005 (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_USER_SETUP)
1012 if (!ConnectAllHappened) {
1024 Status =
gBS->LocateProtocol (&gEfiBootLogoProtocolGuid,
NULL, (VOID **)&BootLogo);
1025 if (!EFI_ERROR (Status) && (BootLogo !=
NULL)) {
1026 BootLogo->SetBootLogo (BootLogo,
NULL, 0, 0, 0, 0);
1035 if (mLanguageString !=
NULL) {
1037 mLanguageString =
NULL;
1063 mResetRequired =
TRUE;
1076 return mResetRequired;
1092 CHAR16 *StringBuffer1;
1093 CHAR16 *StringBuffer2;
1100 ASSERT (StringBuffer1 !=
NULL);
1102 ASSERT (StringBuffer2 !=
NULL);
1103 StrCpyS (StringBuffer1, MAX_STRING_LEN, L
"Configuration changed. Reset to apply it Now.");
1104 StrCpyS (StringBuffer2, MAX_STRING_LEN, L
"Press ENTER to reset");
1109 CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, StringBuffer1, StringBuffer2,
NULL);
1110 }
while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
UINTN EFIAPI StrSize(IN CONST CHAR16 *String)
RETURN_STATUS EFIAPI StrCpyS(OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source)
RETURN_STATUS EFIAPI StrCatS(IN OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source)
UINTN EFIAPI StrnLenS(IN CONST CHAR16 *String, IN UINTN MaxSize)
UINT64 EFIAPI RShiftU64(IN UINT64 Operand, IN UINTN Count)
RETURN_STATUS EFIAPI AsciiStrToUnicodeStrS(IN CONST CHAR8 *Source, OUT CHAR16 *Destination, IN UINTN DestMax)
UINTN EFIAPI AsciiStrSize(IN CONST CHAR8 *String)
#define HARDWARE_DEVICE_PATH
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
EFI_STATUS InitializeFrontPage(VOID)
EFI_STATUS EFIAPI FrontPageCallback(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN EFI_BROWSER_ACTION Action, IN EFI_QUESTION_ID QuestionId, IN UINT8 Type, IN EFI_IFR_TYPE_VALUE *Value, OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest)
EFI_STATUS EFIAPI FakeRouteConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Configuration, OUT EFI_STRING *Progress)
VOID UpdateFrontPageForm(VOID)
VOID EFIAPI EnableResetRequired(VOID)
VOID ConvertProcessorToString(IN UINT16 ProcessorFrequency, IN UINT16 Base10Exponent, OUT CHAR16 **String)
VOID EFIAPI SetupResetReminder(VOID)
EFI_STATUS EFIAPI FakeExtractConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Request, OUT EFI_STRING *Progress, OUT EFI_STRING *Results)
VOID UpdateFrontPageBannerStrings(VOID)
BOOLEAN EFIAPI IsResetRequired(VOID)
EFI_STATUS UiSetConsoleMode(BOOLEAN IsSetupMode)
VOID ConvertMemorySizeToString(IN UINT32 MemorySize, OUT CHAR16 **String)
EFI_STATUS GetOptionalStringByIndex(IN CHAR8 *OptionalStrStart, IN UINT8 Index, OUT CHAR16 **String)
EFI_STATUS EFIAPI InitializeUserInterface(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
VOID EFIAPI UiEntry(IN BOOLEAN ConnectAllHappened)
EFI_STATUS CallFrontPage(VOID)
VOID UiCustomizeFrontPageBanner(IN UINTN LineIndex, IN BOOLEAN LeftOrRight, IN OUT EFI_STRING *BannerStr)
EFI_STATUS UiFrontPageCallbackHandler(IN EFI_HII_HANDLE HiiHandle, IN EFI_BROWSER_ACTION Action, IN EFI_QUESTION_ID QuestionId, IN UINT8 Type, IN EFI_IFR_TYPE_VALUE *Value, OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest)
VOID UiCustomizeFrontPage(IN EFI_HII_HANDLE HiiHandle, IN VOID *StartOpCodeHandle)
VOID *EFIAPI HiiAllocateOpCodeHandle(VOID)
VOID EFIAPI HiiFreeOpCodeHandle(VOID *OpCodeHandle)
EFI_HII_HANDLE EFIAPI HiiAddPackages(IN CONST EFI_GUID *PackageListGuid, IN EFI_HANDLE DeviceHandle OPTIONAL,...)
UINT8 *EFIAPI HiiCreateGuidOpCode(IN VOID *OpCodeHandle, IN CONST EFI_GUID *Guid, IN CONST VOID *GuidOpCode OPTIONAL, IN UINTN OpCodeSize)
EFI_STRING EFIAPI HiiGetString(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID StringId, IN CONST CHAR8 *Language OPTIONAL)
EFI_STATUS EFIAPI HiiUpdateForm(IN EFI_HII_HANDLE HiiHandle, IN EFI_GUID *FormSetGuid OPTIONAL, IN EFI_FORM_ID FormId, IN VOID *StartOpCodeHandle, IN VOID *EndOpCodeHandle OPTIONAL)
EFI_STRING_ID EFIAPI HiiSetString(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID StringId OPTIONAL, IN CONST EFI_STRING String, IN CONST CHAR8 *SupportedLanguages OPTIONAL)
VOID EFIAPI HiiRemovePackages(IN EFI_HII_HANDLE HiiHandle)
#define SMBIOS_HANDLE_PI_RESERVED
#define EFI_IFR_EXTEND_OP_LABEL
VOID InitializeStringSupport(VOID)
EFI_HII_HANDLE ExportFonts(VOID)
CHAR16 * GetStringById(IN EFI_STRING_ID Id)
VOID UninitializeStringSupport(VOID)
RETURN_STATUS EFIAPI UnicodeValueToStringS(IN OUT CHAR16 *Buffer, IN UINTN BufferSize, IN UINTN Flags, IN INT64 Value, IN UINTN Width)
EFI_RUNTIME_SERVICES * gRT
#define ASSERT_EFI_ERROR(StatusParameter)
#define REPORT_STATUS_CODE(Type, Value)
#define PcdGet32(TokenName)
#define PcdSet32S(TokenName, Value)
#define PcdGetPtr(TokenName)
#define EFI_PROGRESS_CODE
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
EFI_STRING_ID NewString(IN CHAR16 *String, IN EFI_HII_HANDLE HiiHandle)
VOID EFIAPI EfiBootManagerRefreshAllBootOption(VOID)
VOID EFIAPI EfiBootManagerConnectAll(VOID)
VOID EFIAPI CreatePopUp(IN UINTN Attribute, OUT EFI_INPUT_KEY *Key OPTIONAL,...)
EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE * Mode
EFI_SIMPLE_TEXT_OUTPUT_MODE * Mode
UINT32 VerticalResolution
UINT32 HorizontalResolution
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION * Info
EFI_HANDLE ConsoleOutHandle
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL * ConOut