diff --git a/MdeModulePkg/Application/UiApp/FrontPage.c b/MdeModulePkg/Application/UiApp/FrontPage.c index 36cbee7428..bb9fd1bb28 100644 --- a/MdeModulePkg/Application/UiApp/FrontPage.c +++ b/MdeModulePkg/Application/UiApp/FrontPage.c @@ -247,6 +247,125 @@ UpdateFrontPageForm ( HiiFreeOpCodeHandle (EndOpCodeHandle); } +void UpdateFirmwareInfoForm(void) +{ + void *StartHandle; + void *EndHandle; + EFI_IFR_GUID_LABEL *StartLabel; + EFI_IFR_GUID_LABEL *EndLabel; + EFI_HII_HANDLE *HiiHandles; + EFI_HII_HANDLE HiiHandle = gFrontPagePrivate.HiiHandle; + UINTN Index; + EFI_STRING String; + EFI_STRING_ID Token; + EFI_STRING_ID TokenHelp; + EFI_IFR_FORM_SET *Buffer = NULL; + UINTN BufferSize = 0; + UINT8 ClassGuidNum; + EFI_GUID *ClassGuid; + UINTN TempSize = 0; + UINT8 *Ptr; + EFI_STATUS Status; + // XXX: Copied from SecureBootConfigDxe + EFI_GUID SecureBootConfigGuid = { 0x5daf50a5, 0xea81, 0x4de2, {0x8f, 0x9b, 0xca, 0xbd, 0xa9, 0xcf, 0x5c, 0x14}}; + + StartHandle = HiiAllocateOpCodeHandle(); + ASSERT(StartHandle != NULL); + + EndHandle = HiiAllocateOpCodeHandle(); + ASSERT(EndHandle != NULL); + + StartLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode(StartHandle, &gEfiIfrTianoGuid, NULL, sizeof(*StartLabel)); + StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL; + StartLabel->Number = LABEL_DEVICES_LIST; + + EndLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode(EndHandle, &gEfiIfrTianoGuid, NULL, sizeof(*EndLabel)); + EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL; + EndLabel->Number = LABEL_END; + + // FIXME: Copied from Device Manager; clean up + + // Get SecureBootConfig handle + HiiHandles = HiiGetHiiHandles(&SecureBootConfigGuid); + ASSERT(HiiHandles != NULL); + + // Search for formset of each class type + for (Index = 0; HiiHandles[Index] != NULL; Index++) { + Status = HiiGetFormSetFromHiiHandle(HiiHandles[Index], &Buffer, &BufferSize); + if (EFI_ERROR(Status)) { + continue; + } + + Ptr = (UINT8 *)Buffer; + while (TempSize < BufferSize) { + TempSize += ((EFI_IFR_OP_HEADER *)Ptr)->Length; + if (((EFI_IFR_OP_HEADER *)Ptr)->Length <= OFFSET_OF (EFI_IFR_FORM_SET, Flags)) { + Ptr += ((EFI_IFR_OP_HEADER *)Ptr)->Length; + continue; + } + + ClassGuidNum = (UINT8)(((EFI_IFR_FORM_SET *)Ptr)->Flags & 0x3); + ClassGuid = (EFI_GUID *)(VOID *)(Ptr + sizeof(EFI_IFR_FORM_SET)); + while (ClassGuidNum-- > 0) { + if (CompareGuid(&gEfiHiiPlatformSetupFormsetGuid, ClassGuid) == 0) { + ClassGuid++; + continue; + } + + String = HiiGetString(HiiHandles[Index], ((EFI_IFR_FORM_SET *)Ptr)->FormSetTitle, NULL); + if (String == NULL) { + String = HiiGetString(HiiHandle, STRING_TOKEN (STR_MISSING_STRING), NULL); + ASSERT (String != NULL); + } + + Token = HiiSetString(HiiHandle, 0, String, NULL); + FreePool(String); + + String = HiiGetString(HiiHandles[Index], ((EFI_IFR_FORM_SET *)Ptr)->Help, NULL); + if (String == NULL) { + String = HiiGetString(HiiHandle, STRING_TOKEN (STR_MISSING_STRING), NULL); + ASSERT(String != NULL); + } + + TokenHelp = HiiSetString(HiiHandle, 0, String, NULL); + FreePool(String); + + HiiCreateGotoExOpCode( + StartHandle, + 0, + Token, + TokenHelp, + 0, + 0, + 0, + &SecureBootConfigGuid, + 0 + ); + + break; + } + + Ptr += ((EFI_IFR_OP_HEADER *)Ptr)->Length; + } + + FreePool (Buffer); + Buffer = NULL; + TempSize = 0; + BufferSize = 0; + } + + HiiUpdateForm( + HiiHandle, + &mFrontPageGuid, + FIRMWARE_INFO_FORM_ID, + StartHandle, + EndHandle + ); + + HiiFreeOpCodeHandle(StartHandle); + HiiFreeOpCodeHandle(EndHandle); +} + /** Initialize HII information for the FrontPage @@ -305,6 +424,8 @@ InitializeFrontPage ( // UpdateFrontPageForm(); + UpdateFirmwareInfoForm(); + return Status; } diff --git a/MdeModulePkg/Application/UiApp/FrontPage.h b/MdeModulePkg/Application/UiApp/FrontPage.h index 44813122e9..78dd51f63a 100644 --- a/MdeModulePkg/Application/UiApp/FrontPage.h +++ b/MdeModulePkg/Application/UiApp/FrontPage.h @@ -33,8 +33,10 @@ extern EFI_FORM_BROWSER2_PROTOCOL *gFormBrowser2; // These are defined as the same with vfr file // #define FRONT_PAGE_FORM_ID 0x7600 +#define FIRMWARE_INFO_FORM_ID 0x7601 #define LABEL_FRONTPAGE_INFORMATION 0x1000 +#define LABEL_DEVICES_LIST 0x2000 #define LABEL_END 0xffff #define FRONT_PAGE_FORMSET_GUID \ diff --git a/MdeModulePkg/Application/UiApp/FrontPageVfr.Vfr b/MdeModulePkg/Application/UiApp/FrontPageVfr.Vfr index 39fd87f135..225206186d 100644 --- a/MdeModulePkg/Application/UiApp/FrontPageVfr.Vfr +++ b/MdeModulePkg/Application/UiApp/FrontPageVfr.Vfr @@ -13,6 +13,7 @@ #define FIRMWARE_INFO_FORM_ID 0x7601 #define LABEL_FRONTPAGE_INFORMATION 0x1000 +#define LABEL_DEVICES_LIST 0x2000 #define LABEL_END 0xffff formset @@ -56,6 +57,10 @@ formset subtitle text = STRING_TOKEN(STR_TPM_STATUS); subtitle text = STRING_TOKEN(STR_EMPTY_STRING); subtitle text = STRING_TOKEN(STR_ME_STATUS); + subtitle text = STRING_TOKEN(STR_EMPTY_STRING); + + label LABEL_DEVICES_LIST; + label LABEL_END; endform; endformset; diff --git a/MdeModulePkg/Application/UiApp/UiApp.inf b/MdeModulePkg/Application/UiApp/UiApp.inf index af7803aa96..0d77a9ce4f 100644 --- a/MdeModulePkg/Application/UiApp/UiApp.inf +++ b/MdeModulePkg/Application/UiApp/UiApp.inf @@ -60,6 +60,7 @@ gEfiIfrTianoGuid ## CONSUMES ## GUID (Extended IFR Guid Opcode) gEfiIfrFrontPageGuid ## CONSUMES ## GUID gEfiSmbiosTableGuid ## CONSUMES ## GUID + gEfiHiiPlatformSetupFormsetGuid ## CONSUMES ## GUID [Protocols] gEfiSmbiosProtocolGuid ## CONSUMES