diff --git a/Platform/Sophgo/SG2044Pkg/Drivers/SmbiosPlatformDxe/Type00/PlatformBiosFunction.c b/Platform/Sophgo/SG2044Pkg/Drivers/SmbiosPlatformDxe/Type00/PlatformBiosFunction.c index d3dce3d8bc..f7ed297676 100644 --- a/Platform/Sophgo/SG2044Pkg/Drivers/SmbiosPlatformDxe/Type00/PlatformBiosFunction.c +++ b/Platform/Sophgo/SG2044Pkg/Drivers/SmbiosPlatformDxe/Type00/PlatformBiosFunction.c @@ -35,20 +35,20 @@ SMBIOS_PLATFORM_DXE_TABLE_FUNCTION (PlatformBios) { return Status; } - if (IniGetValueBySectionAndName ("BIOS Information", "vendor", value) == 0) { + if (IniGetValueBySectionAndName ("BIOS Information", "bios_vendor", value) == 0) { AsciiStrToUnicodeStrS (value, UnicodeStr, SMBIOS_UNICODE_STRING_MAX_LENGTH); HiiSetString (mSmbiosPlatformDxeHiiHandle, InputStrToken->TokenArray[0], UnicodeStr, NULL); } - if (IniGetValueBySectionAndName ("BIOS Information", "version", value) == 0) { + if (IniGetValueBySectionAndName ("BIOS Information", "bios_version", value) == 0) { AsciiStrToUnicodeStrS (value, UnicodeStr, SMBIOS_UNICODE_STRING_MAX_LENGTH); HiiSetString (mSmbiosPlatformDxeHiiHandle, InputStrToken->TokenArray[1], UnicodeStr, NULL); } - if (IniGetValueBySectionAndName ("Date Time", "date", value) == 0) { + if (IniGetValueBySectionAndName ("BIOS Information", "date", value) == 0) { AsciiStrToUnicodeStrS (value, UnicodeStr, SMBIOS_UNICODE_STRING_MAX_LENGTH); - if (IniGetValueBySectionAndName ("Date Time", "time", value) == 0) { + if (IniGetValueBySectionAndName ("BIOS Information", "time", value) == 0) { AsciiStrToUnicodeStrS (value, UnicodeStrTmp, SMBIOS_UNICODE_STRING_MAX_LENGTH); } StrCatS(UnicodeStr, sizeof (UnicodeStr), L" "); diff --git a/Platform/Sophgo/SG2044Pkg/Drivers/SmbiosPlatformDxe/Type01/PlatformSystemFunction.c b/Platform/Sophgo/SG2044Pkg/Drivers/SmbiosPlatformDxe/Type01/PlatformSystemFunction.c index c226fe6275..1b4acff331 100644 --- a/Platform/Sophgo/SG2044Pkg/Drivers/SmbiosPlatformDxe/Type01/PlatformSystemFunction.c +++ b/Platform/Sophgo/SG2044Pkg/Drivers/SmbiosPlatformDxe/Type01/PlatformSystemFunction.c @@ -38,7 +38,7 @@ SMBIOS_PLATFORM_DXE_TABLE_FUNCTION (PlatformSystem) { HiiSetString (mSmbiosPlatformDxeHiiHandle, InputStrToken->TokenArray[0], UnicodeStr, NULL); } - if (IniGetValueBySectionAndName ("product", "name", value) == 0) { + if (IniGetValueBySectionAndName ("product", "product_name", value) == 0) { AsciiStrToUnicodeStrS (value, UnicodeStr, SMBIOS_UNICODE_STRING_MAX_LENGTH); HiiSetString (mSmbiosPlatformDxeHiiHandle, InputStrToken->TokenArray[1], UnicodeStr, NULL); } diff --git a/Platform/Sophgo/SG2044Pkg/Drivers/SmbiosPlatformDxe/Type02/PlatformBoardFunction.c b/Platform/Sophgo/SG2044Pkg/Drivers/SmbiosPlatformDxe/Type02/PlatformBoardFunction.c index 33c2ea2ba2..c044981c77 100644 --- a/Platform/Sophgo/SG2044Pkg/Drivers/SmbiosPlatformDxe/Type02/PlatformBoardFunction.c +++ b/Platform/Sophgo/SG2044Pkg/Drivers/SmbiosPlatformDxe/Type02/PlatformBoardFunction.c @@ -34,7 +34,7 @@ SMBIOS_PLATFORM_DXE_TABLE_FUNCTION (PlatformBoard) { return Status; } - if (IniGetValueBySectionAndName ("board", "name", value) == 0) { + if (IniGetValueBySectionAndName ("board", "product_name", value) == 0) { AsciiStrToUnicodeStrS (value, UnicodeStr, SMBIOS_UNICODE_STRING_MAX_LENGTH); HiiSetString (mSmbiosPlatformDxeHiiHandle, InputStrToken->TokenArray[1], UnicodeStr, NULL); } diff --git a/Platform/Sophgo/SG2044Pkg/Drivers/SmbiosPlatformDxe/Type04/PlatformProcessorFunction.c b/Platform/Sophgo/SG2044Pkg/Drivers/SmbiosPlatformDxe/Type04/PlatformProcessorFunction.c index ea0011a599..256d29eca2 100644 --- a/Platform/Sophgo/SG2044Pkg/Drivers/SmbiosPlatformDxe/Type04/PlatformProcessorFunction.c +++ b/Platform/Sophgo/SG2044Pkg/Drivers/SmbiosPlatformDxe/Type04/PlatformProcessorFunction.c @@ -37,7 +37,7 @@ SMBIOS_PLATFORM_DXE_TABLE_FUNCTION (PlatformProcessor) { return Status; } - if (IniGetValueBySectionAndName ("CPU", "type", value) == 0) { + if (IniGetValueBySectionAndName ("CPU", "processor_version", value) == 0) { AsciiStrToUnicodeStrS (value, UnicodeStr, SMBIOS_UNICODE_STRING_MAX_LENGTH); HiiSetString (mSmbiosPlatformDxeHiiHandle, InputStrToken->TokenArray[2], UnicodeStr, NULL); } diff --git a/Platform/Sophgo/SG2044Pkg/SG2044.dsc b/Platform/Sophgo/SG2044Pkg/SG2044.dsc index 86408e5ee9..1d5c4a5d66 100644 --- a/Platform/Sophgo/SG2044Pkg/SG2044.dsc +++ b/Platform/Sophgo/SG2044Pkg/SG2044.dsc @@ -795,6 +795,7 @@ } Silicon/Sophgo/SG2044Pkg/Drivers/Settime/ShowTime.inf Silicon/Sophgo/SG2044Pkg/Drivers/FirmwareManagerUiDxe/FirmwareManagerUiDxe.inf + Silicon/Sophgo/SG2044Pkg/Drivers/Information/ShowInformation.inf # # ACPI Support diff --git a/Platform/Sophgo/SG2044Pkg/SG2044.fdf b/Platform/Sophgo/SG2044Pkg/SG2044.fdf index 5a5e5e586b..97f201759a 100644 --- a/Platform/Sophgo/SG2044Pkg/SG2044.fdf +++ b/Platform/Sophgo/SG2044Pkg/SG2044.fdf @@ -236,7 +236,7 @@ INF Silicon/Sophgo/SG2044Pkg/Drivers/UiApp/UiApp.inf INF MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf INF Silicon/Sophgo/SG2044Pkg/Drivers/Settime/ShowTime.inf INF Silicon/Sophgo/SG2044Pkg/Drivers/FirmwareManagerUiDxe/FirmwareManagerUiDxe.inf - +INF Silicon/Sophgo/SG2044Pkg/Drivers/Information/ShowInformation.inf # # ACPI Support # diff --git a/Silicon/Sophgo/SG2044Pkg/Drivers/Information/Information.c b/Silicon/Sophgo/SG2044Pkg/Drivers/Information/Information.c new file mode 100644 index 0000000000..c1d77d20e3 --- /dev/null +++ b/Silicon/Sophgo/SG2044Pkg/Drivers/Information/Information.c @@ -0,0 +1,543 @@ +/** @file + Driver to dynamically update HII forms for system information display. + + Copyright (c) 2024 Sophgo Corporation. All rights reserved. +**/ + +#include "Information.h" +#include + +EFI_HANDLE DriverHandle; +INFORMATION_PAGE_CALLBACK_DATA *PrivateData; +INFORMATION_DATA gInformationData; +SMBIOS_PARSED_DATA ParsedData; +EFI_GUID mConfiginiGuid = CONFIG_INI_FORMSET_GUID; + +HII_VENDOR_DEVICE_PATH mInformationHiiVendorDevicePath = { + { + { + HARDWARE_DEVICE_PATH, + HW_VENDOR_DP, + { + (UINT8)(sizeof(VENDOR_DEVICE_PATH)), + (UINT8)((sizeof(VENDOR_DEVICE_PATH)) >> 8) + } + }, + CONFIG_INI_FORMSET_GUID + }, + { + END_DEVICE_PATH_TYPE, + END_ENTIRE_DEVICE_PATH_SUBTYPE, + { + (UINT8)(END_DEVICE_PATH_LENGTH), + (UINT8)((END_DEVICE_PATH_LENGTH) >> 8) + } + } +}; + +EFI_STATUS +EFIAPI +DriverCallback( + 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 +) { + + if (Action != EFI_BROWSER_ACTION_CHANGED && Action != EFI_BROWSER_ACTION_SUBMITTED) { + return EFI_UNSUPPORTED; + } + + return EFI_SUCCESS; +} + +EFI_STATUS +ExtractString( + IN CHAR8 *OptionalStrStart, + IN UINT8 Index, + OUT CHAR16 **String + ) +{ + UINTN StrSize; + CHAR8 *CurrentStrPtr; + + if (String == NULL) { + return EFI_INVALID_PARAMETER; + } + *String = NULL; + + if (Index == 0) { + *String = AllocateZeroPool(sizeof(CHAR16)); + if (*String == NULL) { + return EFI_OUT_OF_RESOURCES; + } + return EFI_SUCCESS; + } + + CurrentStrPtr = OptionalStrStart; + while (Index > 1 && *CurrentStrPtr != '\0') { + CurrentStrPtr += AsciiStrSize(CurrentStrPtr); + Index--; + } + + if (Index != 1 || *CurrentStrPtr == '\0') { + *String = AllocateZeroPool(sizeof(CHAR16)); + if (*String == NULL) { + return EFI_OUT_OF_RESOURCES; + } + return EFI_NOT_FOUND; + } + + StrSize = AsciiStrSize(CurrentStrPtr); + *String = AllocatePool(StrSize * sizeof(CHAR16)); + if (*String == NULL) { + return EFI_OUT_OF_RESOURCES; + } + + if (EFI_ERROR(AsciiStrToUnicodeStrS(CurrentStrPtr, *String, StrSize))) { + FreePool(*String); + *String = NULL; + return EFI_DEVICE_ERROR; + } + + return EFI_SUCCESS; +} + +EFI_STATUS +EFIAPI +ExtractConfig ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN CONST EFI_STRING Request, + OUT EFI_STRING *Progress, + OUT EFI_STRING *Results +) { + EFI_STATUS Status; + EFI_STRING ConfigRequestHdr; + EFI_STRING ConfigRequest; + UINTN BufferSize; + + if (Request == NULL || Results == NULL) { + return EFI_INVALID_PARAMETER; + } + *Progress = Request; + ConfigRequestHdr = HiiConstructConfigHdr( + &mConfiginiGuid, + L"InformationData", + PrivateData->DriverHandle + ); + + if (ConfigRequestHdr == NULL) { + return EFI_OUT_OF_RESOURCES; + } + + if (Request == NULL) { + BufferSize = StrSize(ConfigRequestHdr) + 32; + ConfigRequest = AllocateZeroPool(BufferSize); + if (ConfigRequest == NULL) { + FreePool(ConfigRequestHdr); + return EFI_OUT_OF_RESOURCES; + } + UnicodeSPrint( + ConfigRequest, + BufferSize, + L"%s&OFFSET=0&WIDTH=%016LX", + ConfigRequestHdr, + (UINT64)sizeof(INFORMATION_DATA) + ); + FreePool(ConfigRequestHdr); + } else { + if (!HiiIsConfigHdrMatch(Request, &mConfiginiGuid, L"InformationData")) { + FreePool(ConfigRequestHdr); + return EFI_NOT_FOUND; + } + ConfigRequest = Request; + } + + Status = gHiiConfigRouting->BlockToConfig( + gHiiConfigRouting, + ConfigRequest, + (UINT8 *)&gInformationData, + sizeof(INFORMATION_DATA), + Results, + Progress + ); + if (ConfigRequest != Request) { + FreePool(ConfigRequest); + } + if (EFI_ERROR(Status)) { + DEBUG((DEBUG_ERROR, "ExtractConfig: BlockToConfig failed: %r\n", Status)); + } + return Status; +} + +EFI_STATUS +EFIAPI +RouteConfig ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN CONST EFI_STRING Configuration, + OUT EFI_STRING *Progress +) { + EFI_STATUS Status; + UINTN BufferSize; + + if (Configuration == NULL || Progress == NULL) { + return EFI_INVALID_PARAMETER; + } + *Progress = Configuration; + + if (!HiiIsConfigHdrMatch(Configuration, &mConfiginiGuid, L"InformationData")) { + return EFI_NOT_FOUND; + } + BufferSize = sizeof(INFORMATION_DATA); + Status = gHiiConfigRouting->ConfigToBlock( + gHiiConfigRouting, + Configuration, + (UINT8 *)&gInformationData, + &BufferSize, + Progress + ); + if (EFI_ERROR(Status)) { + DEBUG((DEBUG_ERROR, "RouteConfig: ConfigToBlock failed: %r\n", Status)); + } + + return Status; +} + +EFI_STATUS +ParseSmbiosTable (VOID) { + EFI_SMBIOS_PROTOCOL *Smbios; + EFI_SMBIOS_HANDLE SmbiosHandle; + EFI_SMBIOS_TABLE_HEADER *Record; + EFI_STATUS Status; + + ZeroMem(&ParsedData, sizeof(SMBIOS_PARSED_DATA)); + Status = gBS->LocateProtocol(&gEfiSmbiosProtocolGuid, NULL, (VOID **)&Smbios); + if (EFI_ERROR(Status)) { + DEBUG((DEBUG_ERROR, "Failed to locate SMBIOS protocol: %r\n", Status)); + return Status; + } + + SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED; + while (TRUE) { + Status = Smbios->GetNext(Smbios, &SmbiosHandle, NULL, &Record, NULL); + if (EFI_ERROR(Status)) { + break; + } + + switch (Record->Type) { + case SMBIOS_TYPE_BIOS_INFORMATION: { + SMBIOS_TABLE_TYPE0 *Type0 = (SMBIOS_TABLE_TYPE0 *)Record; + ExtractString((CHAR8 *)((UINT8 *)Type0 + Type0->Hdr.Length), Type0->BiosVersion, &ParsedData.BiosVersion); + ExtractString((CHAR8 *)((UINT8 *)Type0 + Type0->Hdr.Length), Type0->BiosReleaseDate, &ParsedData.BiosReleaseDate); + ExtractString((CHAR8 *)((UINT8 *)Type0 + Type0->Hdr.Length), Type0->Vendor, &ParsedData.BiosVendor); + break; + } + + case SMBIOS_TYPE_SYSTEM_INFORMATION: { + SMBIOS_TABLE_TYPE1 *Type1 = (SMBIOS_TABLE_TYPE1 *)Record; + ExtractString((CHAR8 *)((UINT8 *)Type1 + Type1->Hdr.Length), Type1->Manufacturer, &ParsedData.SystemManufacturer); + ExtractString((CHAR8 *)((UINT8 *)Type1 + Type1->Hdr.Length), Type1->ProductName, &ParsedData.SystemProductName); + ExtractString((CHAR8 *)((UINT8 *)Type1 + Type1->Hdr.Length), Type1->SerialNumber, &ParsedData.SystemSerialNumber); + ExtractString((CHAR8 *)((UINT8 *)Type1 + Type1->Hdr.Length), Type1->Version, &ParsedData.SystemVersion); + break; + } + + case SMBIOS_TYPE_BASEBOARD_INFORMATION: { + SMBIOS_TABLE_TYPE2 *Type2 = (SMBIOS_TABLE_TYPE2 *)Record; + ExtractString((CHAR8 *)((UINT8 *)Type2 + Type2->Hdr.Length), Type2->Manufacturer, &ParsedData.BaseboardManufacturer); + ExtractString((CHAR8 *)((UINT8 *)Type2 + Type2->Hdr.Length), Type2->ProductName, &ParsedData.BaseboardProductName); + break; + } + + case SMBIOS_TYPE_SYSTEM_ENCLOSURE: { + SMBIOS_TABLE_TYPE3 *Type3 = (SMBIOS_TABLE_TYPE3 *)Record; + ExtractString((CHAR8 *)((UINT8 *)Type3 + Type3->Hdr.Length), Type3->Manufacturer, &ParsedData.ChassisManufacturer); + break; + } + + case SMBIOS_TYPE_PROCESSOR_INFORMATION: { + SMBIOS_TABLE_TYPE4 *Type4 = (SMBIOS_TABLE_TYPE4 *)Record; + ExtractString((CHAR8 *)((UINT8 *)Type4 + Type4->Hdr.Length), Type4->ProcessorVersion, &ParsedData.ProcessorVersion); + ParsedData.ProcessorCurrentSpeed = Type4->CurrentSpeed; + ParsedData.ProcessorCoreCount = Type4->CoreCount; + ParsedData.ProcessorThreadCount = Type4->ThreadCount; + break; + } + + case SMBIOS_TYPE_CACHE_INFORMATION: { + SMBIOS_TABLE_TYPE7 *Type7 = (SMBIOS_TABLE_TYPE7 *)Record; + UINT8 RawLevel = (UINT8)(Type7->CacheConfiguration & 0x7); + UINT64 CacheSizeInKB = 0; + + if (Record->Length >= 0x18 && Type7->InstalledSize2 != 0) { + UINT32 InstalledSizeInBytes = Type7->InstalledSize2; + CacheSizeInKB = InstalledSizeInBytes / 1024; + } else { + UINT16 RawSize = Type7->InstalledSize; + if (RawSize & 0x8000) { + CacheSizeInKB = ((RawSize & 0x7FFF) * 64ULL); + } else { + CacheSizeInKB = (RawSize & 0x7FFF); + } + } + CHAR16 *LevelStr; + switch (RawLevel) { + case 0: LevelStr = L"L1"; break; + case 1: LevelStr = L"L2"; break; + case 2: LevelStr = L"L3"; break; + default: LevelStr = L"Unknown"; break; + } + + UINT8 CacheType = Type7->SystemCacheType; + CHAR16 *CacheTypeStr = L"Unknown"; + if (CacheType == CacheTypeInstruction) { + CacheTypeStr = L"Instruction"; + } else if (CacheType == CacheTypeData) { + CacheTypeStr = L"Data"; + } else if (CacheType == CacheTypeUnified) { + CacheTypeStr = L"Unified"; + } + + if (RawLevel == 0) { + if (CacheType == CacheTypeInstruction) { + ParsedData.L1ICacheSize = (UINT16)CacheSizeInKB; + } else if (CacheType == CacheTypeData) { + ParsedData.L1DCacheSize = (UINT16)CacheSizeInKB; + } else if (CacheType == CacheTypeUnified) { + ParsedData.L1ICacheSize = (UINT16)CacheSizeInKB; + ParsedData.L1DCacheSize = (UINT16)CacheSizeInKB; + } + } else if (RawLevel == 1) { + ParsedData.L2CacheSize = (UINT16)CacheSizeInKB; + } else if (RawLevel == 2) { + ParsedData.L3CacheSize = (UINT32)CacheSizeInKB; + } + break; + } + + case SMBIOS_TYPE_BIOS_LANGUAGE_INFORMATION: { + SMBIOS_TABLE_TYPE13 *Type13 = (SMBIOS_TABLE_TYPE13 *)Record; + ParsedData.InstallableLanguages = Type13->InstallableLanguages; + ParsedData.BiosLanguageFlags = Type13->Flags; + break; + } + + case SMBIOS_TYPE_PHYSICAL_MEMORY_ARRAY: { + SMBIOS_TABLE_TYPE16 *Type16 = (SMBIOS_TABLE_TYPE16 *)Record; + ParsedData.MemoryArrayLocation = Type16->Location; + ParsedData.MemoryArrayUse = Type16->Use; + break; + } + + case SMBIOS_TYPE_MEMORY_DEVICE: { + SMBIOS_TABLE_TYPE17 *Type17 = (SMBIOS_TABLE_TYPE17 *)Record; + + ExtractString((CHAR8 *)((UINT8 *)Type17 + Type17->Hdr.Length), Type17->Manufacturer, &ParsedData.MemoryManufacturer); + ParsedData.MemorySize = (Type17->Size & 0x7FFF); + if (Type17->Size & 0x8000) { + ParsedData.MemorySize *= 1024; + } + + ParsedData.ExtendedSpeed = Type17->ExtendedSpeed; + switch (Type17->MemoryType) { + case 0x1E: + StrCpyS(ParsedData.MemoryType, MAX_STRING_LENGTH, L"LPDDR4"); + break; + case 0x23: + StrCpyS(ParsedData.MemoryType, MAX_STRING_LENGTH, L"LPDDR5"); + break; + case 0x18: + StrCpyS(ParsedData.MemoryType, MAX_STRING_LENGTH, L"DDR3"); + break; + case 0x1A: + StrCpyS(ParsedData.MemoryType, MAX_STRING_LENGTH, L"DDR4"); + break; + default: + UnicodeSPrint(ParsedData.MemoryType, MAX_STRING_LENGTH * sizeof(CHAR16), L"Unknown (0x%X)", Type17->MemoryType); + break; + } + ParsedData.MemoryRank = Type17->Attributes & 0x0F; + break; + } + + case SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS: { + SMBIOS_TABLE_TYPE19 *Type19 = (SMBIOS_TABLE_TYPE19 *)Record; + ParsedData.MemoryArrayMappedStartingAddress = Type19->StartingAddress; + ParsedData.MemoryArrayMappedEndingAddress = Type19->EndingAddress; + break; + } + + case SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION: { + SMBIOS_TABLE_TYPE32 *Type32 = (SMBIOS_TABLE_TYPE32 *)Record; + ParsedData.BootStatus = Type32->BootStatus; + break; + } + + case SMBIOS_TYPE_IPMI_DEVICE_INFORMATION: { + SMBIOS_TABLE_TYPE38 *Type38 = (SMBIOS_TABLE_TYPE38 *)Record; + ParsedData.IPMIInterfaceType = Type38->InterfaceType; + break; + } + + default: + break; + } + } + + return EFI_SUCCESS; +} + +VOID +FillInformationData ( + IN SMBIOS_PARSED_DATA *ParsedData, + OUT INFORMATION_DATA *InformationData +) { + StrCpyS(InformationData->BiosVendor, MAX_STRING_LENGTH, ParsedData->BiosVendor); + StrCpyS(InformationData->BiosVersion, MAX_STRING_LENGTH, ParsedData->BiosVersion); + StrCpyS(InformationData->BiosReleaseDate, MAX_STRING_LENGTH, ParsedData->BiosReleaseDate); + StrCpyS(InformationData->ProcessorVersion, MAX_STRING_LENGTH, ParsedData->ProcessorVersion); + InformationData->ProcessorMaxSpeed = ParsedData->ProcessorCurrentSpeed; + InformationData->L1ICacheSize = ParsedData->L1ICacheSize; + InformationData->L1DCacheSize = ParsedData->L1DCacheSize; + InformationData->L2CacheSize = ParsedData->L2CacheSize; + InformationData->L3CacheSize = ParsedData->L3CacheSize; + StrCpyS(InformationData->MemoryType, MAX_STRING_LENGTH, ParsedData->MemoryType); + InformationData->ExtendedSpeed = ParsedData->ExtendedSpeed; + InformationData->MemoryRank = ParsedData->MemoryRank; + StrCpyS(InformationData->BoardProductName, MAX_STRING_LENGTH, ParsedData->BaseboardProductName); + StrCpyS(InformationData->BoardVersion, MAX_STRING_LENGTH, ParsedData->BaseboardManufacturer); + StrCpyS(InformationData->ProductName, MAX_STRING_LENGTH, ParsedData->SystemProductName); + StrCpyS(InformationData->ProductVersion, MAX_STRING_LENGTH, ParsedData->SystemVersion); + StrCpyS(InformationData->Manufacturer, MAX_STRING_LENGTH, ParsedData->SystemManufacturer); +} + +EFI_STATUS +SyncToVarStore ( + IN INFORMATION_DATA *InformationData +) { + EFI_STATUS Status; + + Status = gRT->SetVariable( + L"InformationData", + &mConfiginiGuid, + EFI_VARIABLE_NON_VOLATILE | + EFI_VARIABLE_BOOTSERVICE_ACCESS, + sizeof(INFORMATION_DATA), + InformationData + ); + + if (EFI_ERROR(Status)) { + DEBUG((DEBUG_ERROR, "Failed to set VarStore: %r\n", Status)); + return Status; + } + + return EFI_SUCCESS; +} + + +EFI_STATUS +UpdateHiiBrowserData ( + VOID +) { + EFI_STATUS Status; + + Status = HiiSetBrowserData( + &mConfiginiGuid, + L"InformationData", + sizeof(INFORMATION_DATA), + (UINT8 *)&gInformationData, + NULL + ); + + if (EFI_ERROR(Status)) { + DEBUG((DEBUG_ERROR, "Failed to update HII browser data: %r\n", Status)); + return Status; + } + + return EFI_SUCCESS; +} + +EFI_STATUS +EFIAPI +InformationInit( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable +) { + EFI_STATUS Status; + EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; + + ParseSmbiosTable(); + FillInformationData(&ParsedData, &gInformationData); + SyncToVarStore(&gInformationData); + PrivateData = AllocateZeroPool(sizeof(INFORMATION_PAGE_CALLBACK_DATA)); + if (PrivateData == NULL) { + return EFI_OUT_OF_RESOURCES; + } + + PrivateData->Signature = INFORMATION_PAGE_CALLBACK_DATA_SIGNATURE; + PrivateData->ConfigAccess.ExtractConfig = ExtractConfig; + PrivateData->ConfigAccess.RouteConfig = RouteConfig; + PrivateData->ConfigAccess.Callback = DriverCallback; + + Status = gBS->LocateProtocol(&gEfiHiiConfigRoutingProtocolGuid, NULL, (VOID **)&HiiConfigRouting); + if (EFI_ERROR(Status)) { + return Status; + } + PrivateData->HiiConfigRouting = HiiConfigRouting; + + Status = gBS->InstallMultipleProtocolInterfaces( + &DriverHandle, + &gEfiDevicePathProtocolGuid, + &mInformationHiiVendorDevicePath, + &gEfiHiiConfigAccessProtocolGuid, + &PrivateData->ConfigAccess, + NULL + ); + ASSERT_EFI_ERROR(Status); + + PrivateData->DriverHandle = DriverHandle; + + PrivateData->HiiHandle = HiiAddPackages( + &mConfiginiGuid, + DriverHandle, + ShowInformationVfrBin, + InformationStrings, + NULL + ); + + if (PrivateData->HiiHandle == NULL) { + return EFI_OUT_OF_RESOURCES; + } + UpdateHiiBrowserData(); + return EFI_SUCCESS; +} + +EFI_STATUS +EFIAPI +InformationUnload( + IN EFI_HANDLE ImageHandle +) { + if (DriverHandle != NULL) { + gBS->UninstallMultipleProtocolInterfaces( + DriverHandle, + &gEfiDevicePathProtocolGuid, + &mInformationHiiVendorDevicePath, + &gEfiHiiConfigAccessProtocolGuid, + &PrivateData->ConfigAccess, + NULL + ); + DriverHandle = NULL; + } + + if (PrivateData->HiiHandle != NULL) { + HiiRemovePackages(PrivateData->HiiHandle); + } + + FreePool(PrivateData); + PrivateData = NULL; + + return EFI_SUCCESS; +} + diff --git a/Silicon/Sophgo/SG2044Pkg/Drivers/Information/Information.h b/Silicon/Sophgo/SG2044Pkg/Drivers/Information/Information.h new file mode 100755 index 0000000000..f67a617bfd --- /dev/null +++ b/Silicon/Sophgo/SG2044Pkg/Drivers/Information/Information.h @@ -0,0 +1,262 @@ +/** @file +Head file for front page. +Copyright (c) 2024, Sophgo. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef _FRONT_PAGE_H_ +#define _FRONT_PAGE_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "InformationNVDataStruc.h" + +#define CONFIG_SIZE 1000 +#define MAX_HW_NUMS 500 +#define MAX_HW_NAME_LENGTH 500 +#define MAX_KEY_NAME_LENGTH 500 +#define MAX_VALUE_NAME_LENGTH 500 +#define PRINTABLE_LANGUAGE_NAME_STRING_ID 0x0001 +#define INFORMATION_PAGE_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('S', 'G', 'I', 'S') +#define END_DEVICE_PATH_LENGTH (sizeof(EFI_DEVICE_PATH_PROTOCOL)) + +extern UINT8 ShowInformationVfrBin[]; +extern EFI_FORM_BROWSER2_PROTOCOL *gFormBrowser2; +extern EFI_HII_CONFIG_ROUTING_PROTOCOL *gHiiConfigRouting; + +typedef struct { + VENDOR_DEVICE_PATH VendorDevicePath; + EFI_DEVICE_PATH_PROTOCOL End; +} HII_VENDOR_DEVICE_PATH; + +typedef struct { + CHAR8 Key[MAX_KEY_NAME_LENGTH]; + CHAR8 Value[MAX_VALUE_NAME_LENGTH]; +} CONFIG_ENTRY; + +typedef struct { + CHAR8 SectionName[MAX_HW_NAME_LENGTH]; + CONFIG_ENTRY Entries[CONFIG_SIZE]; + UINTN EntryCount; +} CONFIG_SECTION; + +typedef struct { + UINTN SectionCount; + CONFIG_SECTION Sections[MAX_HW_NUMS]; +} PARSED_INI_DATA; + +typedef struct { + CHAR8 Section[MAX_HW_NAME_LENGTH]; + CHAR8 Name[MAX_KEY_NAME_LENGTH]; + CHAR8 Value[MAX_VALUE_NAME_LENGTH]; +} INI_ENTRY; + +typedef struct { + UINTN Signature; + EFI_HII_HANDLE HiiHandle; + EFI_HANDLE DriverHandle; + EFI_STRING_ID *LanguageToken; + EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess; + EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; +} INFORMATION_PAGE_CALLBACK_DATA; + +typedef struct { + CHAR16 *BiosVendor; + CHAR16 *BiosVersion; + CHAR16 *BiosReleaseDate; + CHAR16 *SystemManufacturer; + CHAR16 *SystemProductName; + CHAR16 *SystemSerialNumber; + CHAR16 *BaseboardManufacturer; + CHAR16 *BaseboardProductName; + CHAR16 *ChassisManufacturer; + CHAR16 *ProcessorVersion; + UINT16 ProcessorCurrentSpeed; + UINT8 ProcessorCoreCount; + UINT8 ProcessorThreadCount; + UINT16 L1ICacheSize; + UINT16 L1DCacheSize; + UINT16 L2CacheSize; + UINT32 L3CacheSize; + UINT8 InstallableLanguages; + UINT8 BiosLanguageFlags; + UINT8 MemoryArrayLocation; + UINT8 MemoryArrayUse; + CHAR16 *MemoryManufacturer; + UINT32 MemorySize; + UINT16 ExtendedSpeed; + UINT8 MemoryRank; + CHAR16 MemoryType[MAX_STRING_LENGTH]; + UINT64 MemoryArrayMappedStartingAddress; + UINT64 MemoryArrayMappedEndingAddress; + UINT8 BootStatus; + UINT8 IPMIInterfaceType; + CHAR16 *SystemVersion; +} SMBIOS_PARSED_DATA; + +/** + This function allows a caller to extract the current configuration for one + or more named elements from the target driver. + + + @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. + @param Request - A null-terminated Unicode string in format. + @param Progress - On return, points to a character in the Request string. + Points to the string's null terminator if request was successful. + Points to the most recent '&' before the first failing name/value + pair (or the beginning of the string if the failure is in the + first name/value pair) if the request was not successful. + @param Results - A null-terminated Unicode string in format which + has all values filled in for the names in the Request string. + String to be allocated by the called function. + + @retval EFI_SUCCESS The Results is filled with the requested values. + @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results. + @retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name. + @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver. + +**/ +EFI_STATUS +EFIAPI +ExtractConfig ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN CONST EFI_STRING Request, + OUT EFI_STRING *Progress, + OUT EFI_STRING *Results +); +/** + This function processes the results of changes in configuration. + + + @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. + @param Configuration - A null-terminated Unicode string in format. + @param Progress - A pointer to a string filled in with the offset of the most + recent '&' before the first failing name/value pair (or the + beginning of the string if the failure is in the first + name/value pair) or the terminating NULL if all was successful. + + @retval EFI_SUCCESS The Results is processed successfully. + @retval EFI_INVALID_PARAMETER Configuration is NULL. + @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver. + +**/ +EFI_STATUS +EFIAPI +RouteConfig ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN CONST EFI_STRING Configuration, + OUT EFI_STRING *Progress + +); + +/** + This function processes the results of changes in configuration. + + + @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. + @param Action - Specifies the type of action taken by the browser. + @param QuestionId - A unique value which is sent to the original exporting driver + so that it can identify the type of data to expect. + @param Type - The type of value for the question. + @param Value - A pointer to the data being sent to the original exporting driver. + @param ActionRequest - On return, points to the action requested by the callback function. + + @retval EFI_SUCCESS The callback successfully handled the action. + @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data. + @retval EFI_DEVICE_ERROR The variable could not be saved. + @retval EFI_UNSUPPORTED The specified Action is not supported by the callback. + +**/ +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 + ); + +/** + Initialize HII information for the FrontPage + + @retval EFI_SUCCESS The operation is successful. + @retval EFI_DEVICE_ERROR If the dynamic opcode creation failed. + +**/ +EFI_STATUS +InitializeFrontPage ( + VOID + ); + +/** + Acquire the string associated with the ProducerGuid and return it. + + + @param ProducerGuid - The Guid to search the HII database for + @param Token - The token value of the string to extract + @param String - The string that is extracted + + @retval EFI_SUCCESS The function returns EFI_SUCCESS always. + +**/ +EFI_STATUS +GetProducerString ( + IN EFI_GUID *ProducerGuid, + IN EFI_STRING_ID Token, + OUT CHAR16 **String + ); + +/** + This function is the main entry of the UI entry. + The function will present the main menu of the system UI. + + @param ConnectAllHappened Caller passes the value to UI to avoid unnecessary connect-all. + +**/ +VOID +EFIAPI +UiEntry ( + IN BOOLEAN ConnectAllHappened + ); + +/** + Extract device path for given HII handle and class guid. + + @param Handle The HII handle. + + @retval NULL Fail to get the device path string. + @return PathString Get the device path string. + +**/ +CHAR16 * +ExtractDevicePathFromHiiHandle ( + IN EFI_HII_HANDLE Handle + ); + +#endif // _FRONT_PAGE_H_ diff --git a/Silicon/Sophgo/SG2044Pkg/Drivers/Information/InformationNVDataStruc.h b/Silicon/Sophgo/SG2044Pkg/Drivers/Information/InformationNVDataStruc.h new file mode 100755 index 0000000000..daa7f12e1f --- /dev/null +++ b/Silicon/Sophgo/SG2044Pkg/Drivers/Information/InformationNVDataStruc.h @@ -0,0 +1,47 @@ +/** @file + Header file for vfr definition. + + Copyright (c) 2024, Sophgo. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ +#ifndef FRONT_PAGE_NV_DATA_STRUC_H_ +#define FRONT_PAGE_NV_DATA_STRUC_H_ + +#define CONFIG_INI_FORMSET_GUID {0x4a618233, 0x07f9, 0x4d73, {0x91, 0x53, 0x51, 0x1f, 0x28, 0x93, 0xa0, 0x1e}} +#define LABEL_START 0x1000 +#define LABEL_END 0xffff +#define CONFIG_FORM_ID 0x1000 +#define BIOS_INFORMATION_FORM_ID 0x1001 +#define DDR_FORM_ID 0x1002 +#define CPU_FORM_ID 0x1003 +#define CHASSIS_FORM_ID 0x1004 +#define PRODUCT_FORM_ID 0x1005 +#define BOARD_FORM_ID 0x1006 +#define VAR_INFORMATION_VARID 0x1007 +#define MAX_STRING_LENGTH 64 + +#pragma pack(2) +typedef struct { + UINT16 ProcessorMaxSpeed; + UINT32 L1ICacheSize; + UINT32 L1DCacheSize; + UINT32 L2CacheSize; + UINT32 L3CacheSize; + UINT16 ExtendedSpeed; + UINT8 MemoryRank; + CHAR16 BiosVersion[MAX_STRING_LENGTH]; + CHAR16 BiosReleaseDate[MAX_STRING_LENGTH]; + CHAR16 BiosVendor[MAX_STRING_LENGTH]; + CHAR16 ProcessorVersion[MAX_STRING_LENGTH]; + CHAR16 PartNumber[MAX_STRING_LENGTH]; + CHAR16 MemoryType[MAX_STRING_LENGTH]; + CHAR16 BoardProductName[MAX_STRING_LENGTH]; + CHAR16 BoardVersion[MAX_STRING_LENGTH]; + CHAR16 ProductName[MAX_STRING_LENGTH]; + CHAR16 ProductVersion[MAX_STRING_LENGTH]; + CHAR16 Manufacturer[MAX_STRING_LENGTH]; +} INFORMATION_DATA; +#pragma pack() +#endif diff --git a/Silicon/Sophgo/SG2044Pkg/Drivers/Information/InformationStrings.uni b/Silicon/Sophgo/SG2044Pkg/Drivers/Information/InformationStrings.uni new file mode 100755 index 0000000000..b85906efad --- /dev/null +++ b/Silicon/Sophgo/SG2044Pkg/Drivers/Information/InformationStrings.uni @@ -0,0 +1,49 @@ +// *++ +// This resource file provides the Unicode string definitions used by the SetDateAndTime UEFI driver. +// +// Copyright (c) 2024, Sophgo Corporation. All rights reserved.
+// --*/ + +#langdef en-US "English" + +#string STR_CONFIG_FORM_TITLE #language en-US "Configuration Form" +#string STR_GOTO_BIOS_INFORMATION #language en-US "BIOS Information" +#string STR_GOTO_BIOS_INFORMATION_HELP #language en-US "Click to view BIOS Information" +#string STR_GOTO_CPU #language en-US "CPU Configuration" +#string STR_GOTO_CPU_HELP #language en-US "Click to view CPU Configuration" +#string STR_GOTO_DDR #language en-US "DDR Configuration" +#string STR_GOTO_DDR_HELP #language en-US "Click to view DDR Configuration" +#string STR_GOTO_BOARD #language en-US "Board Configuration" +#string STR_GOTO_BOARD_HELP #language en-US "Click to view Board Configuration" +#string STR_GOTO_PRODUCT #language en-US "Product Information" +#string STR_GOTO_PRODUCT_HELP #language en-US "Click to view Product Information" +#string STR_CONFIG_BIOS_INFORMATION_FORM_TITLE #language en-US "BIOS Configuration" +#string STR_CONFIG_CPU_FORM_TITLE #language en-US "CPU Configuration" +#string STR_CONFIG_DDR_FORM_TITLE #language en-US "DDR Configuration" +#string STR_CONFIG_BOARD_FORM_TITLE #language en-US "Board Configuration" +#string STR_CONFIG_PRODUCT_FORM_TITLE #language en-US "Product Configuration" +#string STR_NULL_STRING #language en-US "" +#string STR_BIOS_VERSION #language en-US "BIOS Version: " +#string STR_BIOS_RELEASE_DATE #language en-US "BIOS Release Date: " +#string STR_PROCESSOR_VERSION #language en-US "CPU Name: " +#string STR_PROCESSOR_CORES #language en-US "CPU Count: " +#string STR_PROCESSOR_THREADS #language en-US "CPU Threads: " +#string STR_L1_ICACHE_SIZE #language en-US "L1-ICache-Size(kB): " +#string STR_L1_DCACHE_SIZE #language en-US "L1-DCache-Size(kB): " +#string STR_L2_CACHE_SIZE #language en-US "L2-Cache-Size(KB): " +#string STR_L3_CACHE_SIZE #language en-US "L3-Cache-Size(KB): " +#string STR_MEMORY_SIZE #language en-US "DDR Size: " +#string STR_MEMORY_SPEED #language en-US "DDR Speed(MT/s): " +#string STR_MEMORY_RANK #language en-US "DDR Rank: " +#string STR_MEMORY_TYPE #language en-US "DDR Type: " +#string STR_PRODUCT_NAME #language en-US "Product Name: " +#string STR_PRODUCT_MANUFACTURER #language en-US "Product Manufacturer: " +#string STR_SERIAL_NUMBER #language en-US "Product Number: " +#string STR_PART_NUMBER #language en-US "Part Number: " +#string STR_BIOS_VENDOR #language en-US "BIOS Vendor: " +#string STR_PROCESSOR_MAX_SPEED #language en-US "CPU Frequency(MHz):" +#string STR_BOARD_PRODUCT_NAME #language en-US "Board Product Name: " +#string STR_BOARD_VERSION #language en-US "Board Version:" +#string STR_PRODUCT_VERSION #language en-US "Product Version:" +#string STR_MANUFACTURER #language en-US "Manufacturer: " + diff --git a/Silicon/Sophgo/SG2044Pkg/Drivers/Information/ShowInformation.inf b/Silicon/Sophgo/SG2044Pkg/Drivers/Information/ShowInformation.inf new file mode 100755 index 0000000000..00b134380d --- /dev/null +++ b/Silicon/Sophgo/SG2044Pkg/Drivers/Information/ShowInformation.inf @@ -0,0 +1,73 @@ +## @file +# UiApp module is driver for BDS phase. +# Copyright (c) 2024, Sophgo. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = Information + MODULE_UNI_FILE = InformationStrings.uni + FILE_GUID = 405f9bfd-f602-494e-bd46-c009fa963f9d + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = InformationInit + +[Sources] + ShowInformationVfr.Vfr + InformationStrings.uni + Information.c + Information.h + InformationNVDataStruc.h + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Silicon/Sophgo/SG2044Pkg/SG2044Pkg.dec + Silicon/Sophgo/Sophgo.dec + +[LibraryClasses] + DevicePathLib + BaseLib + UefiRuntimeServicesTableLib + ReportStatusCodeLib + MemoryAllocationLib + UefiLib + UefiBootServicesTableLib + BaseMemoryLib + DebugLib + PrintLib + HiiLib + #UefiApplicationEntryPoint + UefiDriverEntryPoint + PcdLib + UefiHiiServicesLib + UefiBootManagerLib + IniParserLib + +[Guids] + gEfiIfrTianoGuid ## CONSUMES ## GUID (Extended IFR Guid Opcode) + gEfiIfrFrontPageGuid ## CONSUMES ## GUID + +[Protocols] + gEfiSmbiosProtocolGuid ## CONSUMES + gEfiHiiConfigAccessProtocolGuid ## CONSUMES + +[FeaturePcd] + +[Pcd] + gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLangCodes ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow ## PRODUCES + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn ## PRODUCES + gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution ## PRODUCES + gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution ## PRODUCES + gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutColumn ## CONSUMES ## SOMETIMES_PRODUCES + gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutRow ## CONSUMES ## SOMETIMES_PRODUCES + gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdTestKeyUsed ## CONSUMES + +[Depex] + gEfiHiiConfigRoutingProtocolGuid AND + gEfiHiiDatabaseProtocolGuid diff --git a/Silicon/Sophgo/SG2044Pkg/Drivers/Information/ShowInformationVfr.Vfr b/Silicon/Sophgo/SG2044Pkg/Drivers/Information/ShowInformationVfr.Vfr new file mode 100755 index 0000000000..4960786fab --- /dev/null +++ b/Silicon/Sophgo/SG2044Pkg/Drivers/Information/ShowInformationVfr.Vfr @@ -0,0 +1,200 @@ +///** @file +// Information page formset. +// Copyright (c) 2024, Sophgo. All rights reserved.
+//**/ + +#include "InformationNVDataStruc.h" + +formset + guid = CONFIG_INI_FORMSET_GUID, + title = STRING_TOKEN(STR_CONFIG_FORM_TITLE), + help = STRING_TOKEN(STR_NULL_STRING), + classguid = CONFIG_INI_FORMSET_GUID, + + varstore INFORMATION_DATA, + varid = VAR_INFORMATION_VARID, + name = InformationData, + guid = CONFIG_INI_FORMSET_GUID; + + form formid = CONFIG_FORM_ID, + title = STRING_TOKEN(STR_CONFIG_FORM_TITLE); + + goto BIOS_INFORMATION_FORM_ID, + prompt = STRING_TOKEN(STR_GOTO_BIOS_INFORMATION), + help = STRING_TOKEN(STR_GOTO_BIOS_INFORMATION_HELP), + flags = INTERACTIVE, + key = BIOS_INFORMATION_FORM_ID; + goto CPU_FORM_ID, + prompt = STRING_TOKEN(STR_GOTO_CPU), + help = STRING_TOKEN(STR_GOTO_CPU_HELP), + flags = INTERACTIVE, + key = CPU_FORM_ID; + goto DDR_FORM_ID, + prompt = STRING_TOKEN(STR_GOTO_DDR), + help = STRING_TOKEN(STR_GOTO_DDR_HELP), + flags = INTERACTIVE, + key = DDR_FORM_ID; + goto BOARD_FORM_ID, + prompt = STRING_TOKEN(STR_GOTO_BOARD), + help = STRING_TOKEN(STR_GOTO_BOARD_HELP), + flags = INTERACTIVE, + key = BOARD_FORM_ID; + goto PRODUCT_FORM_ID, + prompt = STRING_TOKEN(STR_GOTO_PRODUCT), + help = STRING_TOKEN(STR_GOTO_PRODUCT_HELP), + flags = INTERACTIVE, + key = PRODUCT_FORM_ID; + endform; + + form formid = BIOS_INFORMATION_FORM_ID, + title = STRING_TOKEN(STR_CONFIG_BIOS_INFORMATION_FORM_TITLE); + + string varid = InformationData.BiosVersion, + prompt = STRING_TOKEN(STR_BIOS_VERSION), + help = STRING_TOKEN(STR_NULL_STRING), + flags = READ_ONLY, + minsize = 1, + maxsize = MAX_STRING_LENGTH, + endstring; + string varid = InformationData.BiosReleaseDate, + prompt = STRING_TOKEN(STR_BIOS_RELEASE_DATE), + help = STRING_TOKEN(STR_NULL_STRING), + flags = READ_ONLY, + minsize = 1, + maxsize = MAX_STRING_LENGTH, + endstring; + string varid = InformationData.BiosVendor, + prompt = STRING_TOKEN(STR_BIOS_VENDOR), + help = STRING_TOKEN(STR_NULL_STRING), + flags = READ_ONLY, + minsize = 1, + maxsize = MAX_STRING_LENGTH, + endstring; + endform; + + form formid = CPU_FORM_ID, + title = STRING_TOKEN(STR_CONFIG_CPU_FORM_TITLE); + + string varid = InformationData.ProcessorVersion, + prompt = STRING_TOKEN(STR_PROCESSOR_VERSION), + help = STRING_TOKEN(STR_NULL_STRING), + flags = READ_ONLY, + minsize = 1, + maxsize = MAX_STRING_LENGTH, + endstring; + numeric varid = InformationData.ProcessorMaxSpeed, + prompt = STRING_TOKEN(STR_PROCESSOR_MAX_SPEED), + help = STRING_TOKEN(STR_NULL_STRING), + flags = READ_ONLY, + minimum = 0, + maximum = 5000, + step = 1, + endnumeric; + numeric varid = InformationData.L1ICacheSize, + prompt = STRING_TOKEN(STR_L1_ICACHE_SIZE), + help = STRING_TOKEN(STR_NULL_STRING), + flags = READ_ONLY, + minimum = 0, + maximum = 65536, + step = 1, + endnumeric; + numeric varid = InformationData.L1DCacheSize, + prompt = STRING_TOKEN(STR_L1_DCACHE_SIZE), + help = STRING_TOKEN(STR_NULL_STRING), + flags = READ_ONLY, + minimum = 0, + maximum = 65536, + step = 1, + endnumeric; + numeric varid = InformationData.L2CacheSize, + prompt = STRING_TOKEN(STR_L2_CACHE_SIZE), + help = STRING_TOKEN(STR_NULL_STRING), + flags = READ_ONLY, + minimum = 0, + maximum = 2048, + step = 1, + endnumeric; + numeric varid = InformationData.L3CacheSize, + prompt = STRING_TOKEN(STR_L3_CACHE_SIZE), + help = STRING_TOKEN(STR_NULL_STRING), + flags = READ_ONLY, + minimum = 0, + maximum = 65537, + step = 1, + endnumeric; + endform; + + form formid = DDR_FORM_ID, + title = STRING_TOKEN(STR_CONFIG_DDR_FORM_TITLE); + + string varid = InformationData.MemoryType, + prompt = STRING_TOKEN(STR_MEMORY_TYPE), + help = STRING_TOKEN(STR_NULL_STRING), + flags = READ_ONLY, + minsize = 1, + maxsize = MAX_STRING_LENGTH, + endstring; + numeric varid = InformationData.ExtendedSpeed, + prompt = STRING_TOKEN(STR_MEMORY_SPEED), + help = STRING_TOKEN(STR_NULL_STRING), + flags = READ_ONLY, + minimum = 0, + maximum = 10000, + step = 1, + endnumeric; + numeric varid = InformationData.MemoryRank, + prompt = STRING_TOKEN(STR_MEMORY_RANK), + help = STRING_TOKEN(STR_NULL_STRING), + flags = READ_ONLY, + minimum = 0, + maximum = 4, + step = 1, + endnumeric; + endform; + + form formid = BOARD_FORM_ID, + title = STRING_TOKEN(STR_CONFIG_BOARD_FORM_TITLE); + + string varid = InformationData.BoardProductName, + prompt = STRING_TOKEN(STR_BOARD_PRODUCT_NAME), + help = STRING_TOKEN(STR_NULL_STRING), + flags = READ_ONLY, + minsize = 1, + maxsize = MAX_STRING_LENGTH, + endstring; + string varid = InformationData.BoardVersion, + prompt = STRING_TOKEN(STR_BOARD_VERSION), + help = STRING_TOKEN(STR_NULL_STRING), + flags = READ_ONLY, + minsize = 1, + maxsize = MAX_STRING_LENGTH, + endstring; + endform; + + form formid = PRODUCT_FORM_ID, + title = STRING_TOKEN(STR_CONFIG_PRODUCT_FORM_TITLE); + + string varid = InformationData.ProductName, + prompt = STRING_TOKEN(STR_PRODUCT_NAME), + help = STRING_TOKEN(STR_NULL_STRING), + flags = READ_ONLY, + minsize = 1, + maxsize = MAX_STRING_LENGTH, + endstring; + string varid = InformationData.ProductVersion, + prompt = STRING_TOKEN(STR_PRODUCT_VERSION), + help = STRING_TOKEN(STR_NULL_STRING), + flags = READ_ONLY, + minsize = 1, + maxsize = MAX_STRING_LENGTH, + endstring; + string varid = InformationData.Manufacturer, + prompt = STRING_TOKEN(STR_MANUFACTURER), + help = STRING_TOKEN(STR_NULL_STRING), + flags = READ_ONLY, + minsize = 1, + maxsize = MAX_STRING_LENGTH, + endstring; + endform; +endformset; + diff --git a/Silicon/Sophgo/SG2044Pkg/Drivers/UiApp/ConfiginiStrings.uni b/Silicon/Sophgo/SG2044Pkg/Drivers/UiApp/ConfiginiStrings.uni deleted file mode 100644 index efb8c758c5..0000000000 --- a/Silicon/Sophgo/SG2044Pkg/Drivers/UiApp/ConfiginiStrings.uni +++ /dev/null @@ -1,13 +0,0 @@ -///** @file -// String definitions for BdsPlatform formset. -// Copyright (c) 2024, Sophgo. All rights reserved.
-// SPDX-License-Identifier: BSD-2-Clause-Patent -//**/ - -/=# - -#langdef en-US "English" - -#string STR_CONFIG_FORM_TITLE #language en-US "product information" -#string STR_EMPTY_STRING #language en-US "" -#string STR_BOOT_OPTIONS #language en-US "test" diff --git a/Silicon/Sophgo/SG2044Pkg/Drivers/UiApp/ConfiginiVfr.vfr b/Silicon/Sophgo/SG2044Pkg/Drivers/UiApp/ConfiginiVfr.vfr deleted file mode 100644 index d7fcbce15a..0000000000 --- a/Silicon/Sophgo/SG2044Pkg/Drivers/UiApp/ConfiginiVfr.vfr +++ /dev/null @@ -1,26 +0,0 @@ -///** @file -// String definitions for BdsPlatform formset. -// Copyright (c) 2024, Sophgo. All rights reserved.
-// SPDX-License-Identifier: BSD-2-Clause-Patent -//**/ - -#define CONFIG_INI_FORMSET_GUID {0x4a618233, 0x07f9, 0x4d73, { 0x91, 0x53, 0x51, 0x1f, 0x28, 0x93, 0xa0, 0x1e } } -#define CONFIG_FORM_ID 0x1000 -#define LABEL_UPDATE_START 0x1000 -#define LABEL_UPDATE_END 0xffff - -formset - guid = CONFIG_INI_FORMSET_GUID, - title = STRING_TOKEN(STR_CONFIG_FORM_TITLE), - help = STRING_TOKEN(STR_NULL_STRING ), - - form formid = CONFIG_FORM_ID, - title = STRING_TOKEN(STR_CONFIG_FORM_TITLE); - - label LABEL_UPDATE_START; - - label LABEL_UPDATE_END; - - endform; - -endformset; diff --git a/Silicon/Sophgo/SG2044Pkg/Drivers/UiApp/FrontPage.c b/Silicon/Sophgo/SG2044Pkg/Drivers/UiApp/FrontPage.c old mode 100644 new mode 100755 index 304efc9cce..2baffa4bae --- a/Silicon/Sophgo/SG2044Pkg/Drivers/UiApp/FrontPage.c +++ b/Silicon/Sophgo/SG2044Pkg/Drivers/UiApp/FrontPage.c @@ -9,17 +9,13 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #define MAX_STRING_LEN 500 #define DEVICE_PATH_0_GUID { 0x8e6d99ee, 0x7531, 0x48f8, { 0x87, 0x45, 0x7f, 0x61, 0x44, 0x46, 0x8f, 0xf2} } -#define DEVICE_PATH_1_GUID { 0x398b9173, 0xf5ed, 0x499a, { 0xa0, 0xbc, 0x8b, 0x51, 0x98, 0x7b, 0x55, 0xf9} } EFI_FORM_BROWSER2_PROTOCOL *gFormBrowser2; -INI_ENTRY gIniEntries[CONFIG_SIZE]; CHAR8 *mLanguageString; -EFI_GUID mFrontPageGuid = FORMSET_GUID; -EFI_GUID mConfiginiGuid = CONFIG_INI_FORMSET_GUID; -UINTN EntryCount = 0; +EFI_GUID mFrontPageGuid = FORMSET_GUID; BOOLEAN mResetRequired = FALSE; -BOOLEAN mModeInitialized = FALSE; +BOOLEAN mModeInitialized = FALSE; UINT32 mBootHorizontalResolution = 0; UINT32 mBootVerticalResolution = 0; UINT32 mBootTextModeColumn = 0; @@ -32,17 +28,14 @@ CHAR16 VariableName[] = L"DynamicTimeData"; CHAR16 TimeData[] = L"DynamicTimeData"; FRONT_PAGE_CALLBACK_DATA gFrontPagePrivate = { FRONT_PAGE_CALLBACK_DATA_SIGNATURE, - {NULL,NULL}, - {NULL,NULL}, + NULL, + NULL, NULL, { ExtractConfig, RouteConfig, FrontPageCallback - }, - NULL, - &mFrontPageGuid, - VariableName + } }; HII_VENDOR_DEVICE_PATH mFrontPageHiiVendorDevicePath0 = { @@ -67,28 +60,6 @@ HII_VENDOR_DEVICE_PATH mFrontPageHiiVendorDevicePath0 = { } }; -HII_VENDOR_DEVICE_PATH mFrontPageHiiVendorDevicePath1 = { - { - { - HARDWARE_DEVICE_PATH, - HW_VENDOR_DP, - { - (UINT8)(sizeof (VENDOR_DEVICE_PATH)), - (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8) - } - }, - DEVICE_PATH_1_GUID - }, - { - END_DEVICE_PATH_TYPE, - END_ENTIRE_DEVICE_PATH_SUBTYPE, - { - (UINT8)(END_DEVICE_PATH_LENGTH), - (UINT8)((END_DEVICE_PATH_LENGTH) >> 8) - } - } -}; - /** This function processes the results of changes in configuration. @@ -118,7 +89,7 @@ FrontPageCallback ( OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest ) { - return UiFrontPageCallbackHandler(gFrontPagePrivate.HiiHandle[0], Action, QuestionId, Type, Value, ActionRequest); + return UiFrontPageCallbackHandler(gFrontPagePrivate.HiiHandle, Action, QuestionId, Type, Value, ActionRequest); } EFI_STATUS @@ -127,17 +98,15 @@ InitializeFrontPage ( ) { EFI_STATUS Status; - EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; Status = gBS->LocateProtocol (&gEfiFormBrowser2ProtocolGuid, NULL, (VOID **)&gFormBrowser2); if (EFI_ERROR (Status)) { return Status; } - gFrontPagePrivate.DriverHandle[0] = NULL; - gFrontPagePrivate.DriverHandle[1] = NULL; + gFrontPagePrivate.DriverHandle = NULL; Status = gBS->InstallMultipleProtocolInterfaces ( - &gFrontPagePrivate.DriverHandle[0], + &gFrontPagePrivate.DriverHandle, &gEfiDevicePathProtocolGuid, &mFrontPageHiiVendorDevicePath0, &gEfiHiiConfigAccessProtocolGuid, @@ -145,41 +114,15 @@ InitializeFrontPage ( NULL ); ASSERT_EFI_ERROR(Status); - - Status = gBS->InstallMultipleProtocolInterfaces ( - &gFrontPagePrivate.DriverHandle[1], - &gEfiDevicePathProtocolGuid, - &mFrontPageHiiVendorDevicePath1, - &gEfiHiiConfigAccessProtocolGuid, - &gFrontPagePrivate.ConfigAccess, - NULL - ); - ASSERT_EFI_ERROR(Status); - - Status = gBS->LocateProtocol (&gEfiHiiConfigRoutingProtocolGuid, NULL, (VOID **)&HiiConfigRouting); - if (EFI_ERROR (Status)) { - return Status; - } - - gFrontPagePrivate.HiiConfigRouting = HiiConfigRouting; - gFrontPagePrivate.HiiHandle[0] = HiiAddPackages ( + gFrontPagePrivate.HiiHandle = HiiAddPackages ( &mFrontPageGuid, - gFrontPagePrivate.DriverHandle[0], + gFrontPagePrivate.DriverHandle, FrontPageVfrBin, UiAppStrings, NULL ); - ASSERT (gFrontPagePrivate.HiiHandle[0] != NULL); - gFrontPagePrivate.HiiHandle[1] = HiiAddPackages ( - &mConfiginiGuid, - gFrontPagePrivate.DriverHandle[1], - ConfiginiVfrBin, - UiAppStrings, - NULL - ); - ASSERT (gFrontPagePrivate.HiiHandle[1] != NULL); + ASSERT (gFrontPagePrivate.HiiHandle != NULL); UpdateFrontPageForm (); - UpdateHiiData (); return Status; } @@ -190,27 +133,25 @@ CallFrontPage ( { EFI_STATUS Status; EFI_BROWSER_ACTION_REQUEST ActionRequest; - EFI_HII_HANDLE HiiHandles[2]; REPORT_STATUS_CODE ( EFI_PROGRESS_CODE, (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_INPUT_WAIT) ); - + ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE; - HiiHandles[0] = gFrontPagePrivate.HiiHandle[0]; - HiiHandles[1] = gFrontPagePrivate.HiiHandle[1]; Status = gFormBrowser2->SendForm ( gFormBrowser2, - HiiHandles, - 2, + &gFrontPagePrivate.HiiHandle, + 1, &mFrontPageGuid, 0, NULL, - &ActionRequest); + &ActionRequest + ); if (ActionRequest == EFI_BROWSER_ACTION_REQUEST_RESET) { EnableResetRequired (); } - + return Status; } @@ -222,7 +163,7 @@ FreeFrontPage ( EFI_STATUS Status; Status = gBS->UninstallMultipleProtocolInterfaces ( - gFrontPagePrivate.DriverHandle[0], + gFrontPagePrivate.DriverHandle, &gEfiDevicePathProtocolGuid, &mFrontPageHiiVendorDevicePath0, &gEfiHiiConfigAccessProtocolGuid, @@ -230,17 +171,7 @@ FreeFrontPage ( NULL ); ASSERT_EFI_ERROR (Status); - Status = gBS->UninstallMultipleProtocolInterfaces ( - gFrontPagePrivate.DriverHandle[1], - &gEfiDevicePathProtocolGuid, - &mFrontPageHiiVendorDevicePath1, - &gEfiHiiConfigAccessProtocolGuid, - &gFrontPagePrivate.ConfigAccess, - NULL - ); - ASSERT_EFI_ERROR (Status); - HiiRemovePackages (gFrontPagePrivate.HiiHandle[0]); - HiiRemovePackages (gFrontPagePrivate.HiiHandle[1]); + HiiRemovePackages (gFrontPagePrivate.HiiHandle); if (gFrontPagePrivate.LanguageToken != NULL) { FreePool (gFrontPagePrivate.LanguageToken); gFrontPagePrivate.LanguageToken = NULL; @@ -405,7 +336,7 @@ UiSetConsoleMode ( if (EFI_ERROR (Status)) { GraphicsOutput = NULL; } - + Status = gBS->HandleProtocol ( gST->ConsoleOutHandle, &gEfiSimpleTextOutProtocolGuid, @@ -529,103 +460,6 @@ UiSetConsoleMode ( return EFI_SUCCESS; } -INT32 -IniHandler ( - VOID *User, - CONST CHAR8 *Section, - CONST CHAR8 *Name, - CONST CHAR8 *Value - ) -{ - if (!AsciiStrCmp(Section, "eof")) - return 0; - if (EntryCount >= CONFIG_SIZE) - return 0; - AsciiStrCpyS(gIniEntries[EntryCount].Section, sizeof(gIniEntries[EntryCount].Section), Section); - AsciiStrCpyS(gIniEntries[EntryCount].Name, sizeof(gIniEntries[EntryCount].Name), Name); - AsciiStrCpyS(gIniEntries[EntryCount].Value, sizeof(gIniEntries[EntryCount].Value), Value); - EntryCount++; - - return 1; -} - -INT32 -IniConfIniParse ( - IN INI_HANDLER Handler, - IN VOID *User - ) -{ - INT32 result = -1; - if (IsIniFileExist ()) - result = IniParseString(MemoryData, Handler, User); - - return result; -} - -EFI_STATUS -EFIAPI -UpdateHiiData ( - VOID - ) -{ - VOID *StartOpCodeHandle; - VOID *EndOpCodeHandle; - EFI_STRING_ID StringId; - EFI_STATUS Status; - EFI_STRING_ID HelpToken; - UINTN Index; - EFI_IFR_GUID_LABEL *StartLabel; - EFI_IFR_GUID_LABEL *EndLabel; - - CHAR16 DisplayBuffer[256]; - ZeroMem(DisplayBuffer, sizeof(DisplayBuffer)); - StartOpCodeHandle = HiiAllocateOpCodeHandle(); - ASSERT(StartOpCodeHandle != NULL); - EndOpCodeHandle = HiiAllocateOpCodeHandle(); - ASSERT(EndOpCodeHandle != NULL); - gST->ConOut->ClearScreen(gST->ConOut); - StartLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode( - StartOpCodeHandle, - &gEfiIfrTianoGuid, - NULL, - sizeof(EFI_IFR_GUID_LABEL) - ); - StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL; - StartLabel->Number = LABEL_CONFIG_START; - EndLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode( - EndOpCodeHandle, - &gEfiIfrTianoGuid, - NULL, - sizeof(EFI_IFR_GUID_LABEL) - ); - EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL; - EndLabel->Number = LABEL_CONFIG_END; - for (Index = 0; Index < EntryCount; Index++) { - INI_ENTRY *Entry = &gIniEntries[Index]; - if (Index == 0 || AsciiStrCmp(gIniEntries[Index - 1].Section, Entry->Section) != 0) { - UnicodeSPrint(DisplayBuffer, sizeof(DisplayBuffer), L"Section: %a\n", Entry->Section); - StringId = HiiSetString(gFrontPagePrivate.HiiHandle[1], 0, DisplayBuffer, NULL); - HelpToken = 0; - HiiCreateTextOpCode(StartOpCodeHandle, StringId, HelpToken, 0); - } - UnicodeSPrint(DisplayBuffer, sizeof(DisplayBuffer), L"%a: %a\n", Entry->Name, Entry->Value); - StringId = HiiSetString(gFrontPagePrivate.HiiHandle[1], 0, DisplayBuffer, NULL); - HelpToken = 0; - HiiCreateTextOpCode(StartOpCodeHandle, StringId, HelpToken, 0); - } - Status = HiiUpdateForm( - gFrontPagePrivate.HiiHandle[1], - &mConfiginiGuid, - CONFIG_FORM_ID, - StartOpCodeHandle, - EndOpCodeHandle - ); - - HiiFreeOpCodeHandle(StartOpCodeHandle); - HiiFreeOpCodeHandle(EndOpCodeHandle); - return EFI_SUCCESS; -} - EFI_STATUS EFIAPI ExtractConfig ( @@ -654,15 +488,15 @@ RouteConfig ( return EFI_UNSUPPORTED; // Return unsupported to signify fake implementation. } -EFI_STATUS +EFI_STATUS UpdateTimeRegion ( EFI_HII_HANDLE HiiHandle -) -{ +) +{ EFI_STATUS Status; VOID *StartOpCodeHandle; - VOID *EndOpCodeHandle; - + VOID *EndOpCodeHandle; + StartOpCodeHandle = HiiAllocateOpCodeHandle(); if (StartOpCodeHandle == NULL) { return EFI_OUT_OF_RESOURCES; @@ -723,15 +557,15 @@ EFI_HII_HANDLE HiiHandle return Status; } -EFI_STATUS +EFI_STATUS UpdateLanguageRegion ( EFI_HII_HANDLE HiiHandle -) +) { EFI_STATUS Status; VOID *StartOpCodeHandle; VOID *EndOpCodeHandle; - + StartOpCodeHandle = HiiAllocateOpCodeHandle(); if (StartOpCodeHandle == NULL) { return EFI_OUT_OF_RESOURCES; @@ -774,10 +608,10 @@ EFI_HII_HANDLE HiiHandle return Status; } -EFI_STATUS +EFI_STATUS UpdateBootRegion ( EFI_HII_HANDLE HiiHandle -) +) { EFI_STATUS Status; VOID *StartOpCodeHandle; @@ -824,14 +658,14 @@ EFI_HII_HANDLE HiiHandle return Status; } -VOID +VOID UpdateFrontPageForm ( VOID ) { EFI_STATUS Status; - Status = UpdateBootRegion(gFrontPagePrivate.HiiHandle[0]); - Status = UpdateTimeRegion(gFrontPagePrivate.HiiHandle[0]); - Status = UpdateLanguageRegion(gFrontPagePrivate.HiiHandle[0]); + Status = UpdateBootRegion(gFrontPagePrivate.HiiHandle); + Status = UpdateTimeRegion(gFrontPagePrivate.HiiHandle); + Status = UpdateLanguageRegion(gFrontPagePrivate.HiiHandle); } /** @@ -947,7 +781,6 @@ UiEntry ( BootLogo->SetBootLogo (BootLogo, NULL, 0, 0, 0, 0); } - IniConfIniParse(IniHandler, NULL); InitializeFrontPage (); CallFrontPage (); FreeFrontPage (); diff --git a/Silicon/Sophgo/SG2044Pkg/Drivers/UiApp/FrontPage.h b/Silicon/Sophgo/SG2044Pkg/Drivers/UiApp/FrontPage.h old mode 100644 new mode 100755 index 65acad0983..fcd6fa8ea8 --- a/Silicon/Sophgo/SG2044Pkg/Drivers/UiApp/FrontPage.h +++ b/Silicon/Sophgo/SG2044Pkg/Drivers/UiApp/FrontPage.h @@ -28,16 +28,16 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include -#include -#include +#include +#include #include "FrontPageNVDataStruc.h" #include "FrontPageCustomizedUiSupport.h" -#define CONFIG_SIZE 1000 -#define MAX_HW_NUMS 500 -#define MAX_HW_NAME_LENGTH 500 -#define MAX_KEY_NAME_LENGTH 500 -#define MAX_VALUE_NAME_LENGTH 500 +#define CONFIG_SIZE 1000 +#define MAX_HW_NUMS 500 +#define MAX_HW_NAME_LENGTH 500 +#define MAX_KEY_NAME_LENGTH 500 +#define MAX_VALUE_NAME_LENGTH 500 #define SMBIOS_TYPE4_CPU_SOCKET_POPULATED BIT6 #define PRINTABLE_LANGUAGE_NAME_STRING_ID 0x0001 #define FRONT_PAGE_FORM_ID 0x1000 @@ -52,40 +52,17 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #define QF_DATE_STORAGE_TIME 0x10 extern UINT8 FrontPageVfrBin[]; -extern UINT8 ConfiginiVfrBin[]; extern EFI_FORM_BROWSER2_PROTOCOL *gFormBrowser2; -typedef struct { - CHAR8 Key[MAX_KEY_NAME_LENGTH]; - CHAR8 Value[MAX_VALUE_NAME_LENGTH]; -} CONFIG_ENTRY; - -typedef struct { - CHAR8 SectionName[MAX_HW_NAME_LENGTH]; - CONFIG_ENTRY Entries[CONFIG_SIZE]; - UINTN EntryCount; -} CONFIG_SECTION; - -typedef struct { - UINTN SectionCount; - CONFIG_SECTION Sections[MAX_HW_NUMS]; -} PARSED_INI_DATA; - -typedef struct { - CHAR8 Section[MAX_HW_NAME_LENGTH]; - CHAR8 Name[MAX_KEY_NAME_LENGTH]; - CHAR8 Value[MAX_VALUE_NAME_LENGTH]; -} INI_ENTRY; - typedef struct { UINTN Signature; - EFI_HII_HANDLE HiiHandle[2]; - EFI_HANDLE DriverHandle[2]; + EFI_HII_HANDLE HiiHandle; + EFI_HANDLE DriverHandle; EFI_STRING_ID *LanguageToken; EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess; EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; - EFI_GUID *FormSetGuid; - CHAR16 *VariableName; + EFI_GUID *FormSetGuid; + CHAR16 *VariableName; } FRONT_PAGE_CALLBACK_DATA; /** @@ -116,7 +93,7 @@ ExtractConfig ( IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Request, OUT EFI_STRING *Progress, - OUT EFI_STRING *Results + OUT EFI_STRING *Results ); /** @@ -141,7 +118,7 @@ RouteConfig ( IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Configuration, OUT EFI_STRING *Progress - + ); /** @@ -245,22 +222,16 @@ IniConfIniParse ( ); EFI_STATUS -EFIAPI -UpdateHiiData ( - VOID -); - -EFI_STATUS SetupTimerEvent ( EFI_HII_HANDLE HiiHandle ); -VOID -UpdateFrontPageForm ( +VOID +UpdateFrontPageForm ( VOID ); -EFI_STATUS +EFI_STATUS UpdateBootRegion ( EFI_HII_HANDLE HiiHandle ); diff --git a/Silicon/Sophgo/SG2044Pkg/Drivers/UiApp/UiApp.inf b/Silicon/Sophgo/SG2044Pkg/Drivers/UiApp/UiApp.inf old mode 100644 new mode 100755 index 1acb630b21..9a6aa5690c --- a/Silicon/Sophgo/SG2044Pkg/Drivers/UiApp/UiApp.inf +++ b/Silicon/Sophgo/SG2044Pkg/Drivers/UiApp/UiApp.inf @@ -8,7 +8,7 @@ INF_VERSION = 0x00010005 BASE_NAME = UiApp MODULE_UNI_FILE = UiApp.uni - FILE_GUID = 462CAA21-7614-4503-836E-8AB6F4662331 + FILE_GUID = 462CAA21-7614-4503-836E-8AB6F4662331 MODULE_TYPE = UEFI_APPLICATION VERSION_STRING = 1.0 ENTRY_POINT = InitializeUserInterface @@ -18,9 +18,7 @@ String.h Ui.h FrontPageVfr.Vfr - ConfiginiVfr.vfr FrontPageStrings.uni - ConfiginiStrings.uni FrontPage.c String.c FrontPageCustomizedUi.c