From: BigfootACA Date: 星期三, 9 Feb 2022 18:36:32 +0000 (+0800) Subject: (TEST) PlatformSmbiosDxe: PlatformSmbiosDxe.c: get memory size and serial number... X-Git-Tag: v2.0rc1~21 X-Git-Url: https://git.renegade-project.org/?a=commitdiff_plain;h=3e996e0dd7de73d0f57d76b9dd945bf203ccc745;p=edk2-sdm845.git (TEST) PlatformSmbiosDxe: PlatformSmbiosDxe.c: get memory size and serial number from fdt --- diff --git a/sdm845Pkg/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c b/sdm845Pkg/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c index 434df15..c191fa1 100644 --- a/sdm845Pkg/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c +++ b/sdm845Pkg/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c @@ -29,6 +29,7 @@ #include #include #include +#include #include /*********************************************************************** @@ -843,8 +844,8 @@ SMBIOS_TABLE_TYPE19 mMemArrMapInfoType19 = { 0, // MemoryArrayHandle; // Should match SMBIOS_TABLE_TYPE16.Handle, // initialized at runtime, refer to PhyMemArrayInfoUpdateSmbiosType16() 1, // PartitionWidth; - 0x080000000, // ExtendedStartingAddress; // not used - 0x100000000, // ExtendedEndingAddress; // not used + 0, // ExtendedStartingAddress; // not used + 0, // ExtendedEndingAddress; // not used }; CHAR8 *mMemArrMapInfoType19Strings[] = {NULL}; @@ -971,6 +972,14 @@ PlatformSmbiosDriverEntryPoint( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) { EFI_SMBIOS_HANDLE SmbiosHandle; + UINTN Node = 0; + UINTN MemoryBase = 0; + UINTN MemorySize = 0; + VOID *Fdt; + CHAR8 *Serial; + + Fdt = GetFdt (); + ASSERT(Fdt != NULL); // TYPE0 BIOS Information AsciiSPrint( @@ -989,6 +998,14 @@ PlatformSmbiosDriverEntryPoint( AsciiStrCpyS( mSysInfoVersionName, sizeof(mSysInfoVersionName), (CHAR8 *)PcdGetPtr(PcdDeviceCodeName)); + Serial = param_get_android_serial_number (fdt_get_cmdline_items (Fdt, NULL)); + if (Serial != NULL) { + DEBUG((EFI_D_INFO, "Android Serial Number: %a\n", Serial)); + ZeroMem(mSysInfoSerial, sizeof(mSysInfoSerial)); + AsciiStrCpyS( + mSysInfoSerial, sizeof(mSysInfoSerial), + Serial); + } LogSmbiosData( (EFI_SMBIOS_TABLE_HEADER *)&mSysInfoType1, mSysInfoType1Strings, NULL); @@ -1071,12 +1088,15 @@ PlatformSmbiosDriverEntryPoint( NULL); // TYPE19 Memory Array Map Information - mMemArrMapInfoType19.ExtendedStartingAddress = PcdGet64(PcdSystemMemoryBase); - mMemArrMapInfoType19.ExtendedEndingAddress = - PcdGet64(PcdSystemMemoryBase) + PcdGet64(PcdSystemMemorySize); - LogSmbiosData( - (EFI_SMBIOS_TABLE_HEADER *)&mMemArrMapInfoType19, - mMemArrMapInfoType19Strings, NULL); + + while (fdt_get_memory(Fdt, (int)Node, (uint64_t*)&MemoryBase, (uint64_t*)&MemorySize)) { + mMemArrMapInfoType19.StartingAddress = MemoryBase; + mMemArrMapInfoType19.EndingAddress = MemorySize; + LogSmbiosData( + (EFI_SMBIOS_TABLE_HEADER *)&mMemArrMapInfoType19, + mMemArrMapInfoType19Strings, NULL); + Node++; + } // TYPE32 Boot Information LogSmbiosData( diff --git a/sdm845Pkg/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf b/sdm845Pkg/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf index 27d7e03..cf4d014 100644 --- a/sdm845Pkg/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf +++ b/sdm845Pkg/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf @@ -29,6 +29,7 @@ ArmPkg/ArmPkg.dec EmbeddedPkg/EmbeddedPkg.dec sdm845Pkg/sdm845Pkg.dec + SimpleInit.dec [LibraryClasses] ArmLib @@ -41,18 +42,19 @@ DebugLib PrintLib TimeBaseLib + SimpleInitLib [Guids] gEfiGlobalVariableGuid [FixedPcd] gArmTokenSpaceGuid.PcdSystemMemoryBase - gArmTokenSpaceGuid.PcdSystemMemorySize gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareRevision gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString gsdm845PkgTokenSpaceGuid.PcdDeviceVendor gsdm845PkgTokenSpaceGuid.PcdDeviceProduct gsdm845PkgTokenSpaceGuid.PcdDeviceCodeName + gsdm845PkgTokenSpaceGuid.DeviceTreeStore [Protocols] gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED