* [edk2-platform][PATCH v1 0/7] Platform/RaspberryPi : SMBIOS fixes and cleanup
@ 2020-07-20 18:16 Samer El-Haj-Mahmoud
2020-07-20 18:16 ` [edk2-platform][PATCH v1 1/7] Platforms/RaspberryPi: Fix NULL AssetTag in SMBIOS Samer El-Haj-Mahmoud
` (7 more replies)
0 siblings, 8 replies; 16+ messages in thread
From: Samer El-Haj-Mahmoud @ 2020-07-20 18:16 UTC (permalink / raw)
To: devel; +Cc: Leif Lindholm, Pete Batard, Andrei Warkentin, Ard Biesheuvel
Fixes and enhancements to RaspberryPi SMBIOS Types 0, 2, 3, 4, 7, 16, 17, and 19.
These were compared against SMBIOS spec ver 3.3, and SBBR ver 1.2, and tested
in UEFI Shell with smbiosview.
One issue found in smbiosview (for Type 17, "VolatileSize") and
will be fixed as a seperate patch.
This series addresses :
- Most items in https://github.com/pftf/RPi4/issues/16
- One of the issues in https://github.com/pftf/RPi4/issues/75
Series pushed to:
https://github.com/samerhaj/edk2-platforms/tree/rpi_smbios_fixes_v1
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Pete Batard <pete@akeo.ie>
Cc: Andrei Warkentin <awarkentin@vmware.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
Samer El-Haj-Mahmoud (7):
Platforms/RaspberryPi: Fix NULL AssetTag in SMBIOS
Platforms/RaspberryPi: SMBIOS Type 2 and Type 3 fixes
Platforms/RaspberryPi: SMBIOS Type 0 fixes
Platforms/RaspberryPi: SMBIOS Type 4 fixes
Platforms/RaspberryPi: SMBIOS Type 7 fixes
Platforms/RaspberryPi: SMBIOS Memory Types fixes
Platforms/RaspberryPi: SMBIOS minor cleanup
.../PlatformSmbiosDxe/PlatformSmbiosDxe.inf | 7 +-
.../PlatformSmbiosDxe/PlatformSmbiosDxe.c | 457 ++++++++++++------
2 files changed, 320 insertions(+), 144 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* [edk2-platform][PATCH v1 1/7] Platforms/RaspberryPi: Fix NULL AssetTag in SMBIOS
2020-07-20 18:16 [edk2-platform][PATCH v1 0/7] Platform/RaspberryPi : SMBIOS fixes and cleanup Samer El-Haj-Mahmoud
@ 2020-07-20 18:16 ` Samer El-Haj-Mahmoud
2020-07-20 21:52 ` Andrei Warkentin
2020-07-20 18:16 ` [edk2-platform][PATCH v1 2/7] Platforms/RaspberryPi: SMBIOS Type 2 and Type 3 fixes Samer El-Haj-Mahmoud
` (6 subsequent siblings)
7 siblings, 1 reply; 16+ messages in thread
From: Samer El-Haj-Mahmoud @ 2020-07-20 18:16 UTC (permalink / raw)
To: devel; +Cc: Leif Lindholm, Pete Batard, Andrei Warkentin, Ard Biesheuvel
Commit 6d4fed696d004a6aeb795369aa38d4ce1d39f308 added support for
reporting AssetTag in RPi SMBIOS Types 2 and 3. The default
AssetTag is an empty string. SMBIOS does not allow empty strings to be
referenced from the corresponding string field. This caused breakage in
parsing SMBIOS Types 2 and 3 fields that follow the AssetTag field.
The issue caused an FWTS test failure, as reported in:
https://github.com/pftf/RPi4/issues/75
The fix is to detect if no AssetTag is set in the UEFI variable, and if
so, change the AssetTag SMBIOS field to an empty blank space.
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Pete Batard <pete@akeo.ie>
Cc: Andrei Warkentin <awarkentin@vmware.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
---
Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
index d5fb843d43ce..6eef66f125f8 100644
--- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
+++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
@@ -793,7 +793,13 @@ BoardInfoUpdateSmbiosType2 (
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "Failed to get Asset Tag: %r\n", Status));
}
- UnicodeStrToAsciiStrS(AssetTagVar, mChassisAssetTag, sizeof(mChassisAssetTag));
+
+ if (AssetTagVar[0] == L'\0') {
+ // SMBIOS referenced strings cannot be NULL. If no AssetTag is set, default to a blank space.
+ UnicodeStrToAsciiStrS(L" ", mChassisAssetTag, sizeof(mChassisAssetTag));
+ } else {
+ UnicodeStrToAsciiStrS(AssetTagVar, mChassisAssetTag, sizeof(mChassisAssetTag));
+ }
DEBUG ((DEBUG_INFO, "System Asset Tag : %a\n", mChassisAssetTag));
LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mBoardInfoType2, mBoardInfoType2Strings, NULL);
--
2.17.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [edk2-platform][PATCH v1 2/7] Platforms/RaspberryPi: SMBIOS Type 2 and Type 3 fixes
2020-07-20 18:16 [edk2-platform][PATCH v1 0/7] Platform/RaspberryPi : SMBIOS fixes and cleanup Samer El-Haj-Mahmoud
2020-07-20 18:16 ` [edk2-platform][PATCH v1 1/7] Platforms/RaspberryPi: Fix NULL AssetTag in SMBIOS Samer El-Haj-Mahmoud
@ 2020-07-20 18:16 ` Samer El-Haj-Mahmoud
2020-07-20 21:53 ` Andrei Warkentin
2020-07-20 18:16 ` [edk2-platform][PATCH v1 3/7] Platforms/RaspberryPi: SMBIOS Type 0 fixes Samer El-Haj-Mahmoud
` (5 subsequent siblings)
7 siblings, 1 reply; 16+ messages in thread
From: Samer El-Haj-Mahmoud @ 2020-07-20 18:16 UTC (permalink / raw)
To: devel; +Cc: Leif Lindholm, Pete Batard, Andrei Warkentin, Ard Biesheuvel
Various fixes for SMBIOS Types 2 and 3:
- Add LocationInChassis string to Type 2
- Update Type 3 NumberofPowerCords to 1
- Add ChassisHandle refernce to Type2. This requires moving the
Type 3 population to happen before Type 2
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Pete Batard <pete@akeo.ie>
Cc: Andrei Warkentin <awarkentin@vmware.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
---
Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c | 41 ++++++++++++--------
1 file changed, 24 insertions(+), 17 deletions(-)
diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
index 6eef66f125f8..170f1843f90b 100644
--- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
+++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
@@ -176,7 +176,7 @@ SMBIOS_TABLE_TYPE2 mBoardInfoType2 = {
0, // HotSwappable :1;
0, // Reserved :3;
},
- 0, // LocationInChassis String
+ 6, // LocationInChassis String
0, // ChassisHandle;
BaseBoardTypeMotherBoard, // BoardType;
0, // NumberOfContainedObjectHandles;
@@ -191,6 +191,7 @@ CHAR8 *mBoardInfoType2Strings[] = {
mSysInfoVersionName,
mSysInfoSerial,
mChassisAssetTag,
+ "Internal",
NULL
};
@@ -210,7 +211,7 @@ SMBIOS_TABLE_TYPE3 mEnclosureInfoType3 = {
ChassisSecurityStatusNone,// SecurityStatus;
{ 0, 0, 0, 0 }, // OemDefined[4];
0, // Height;
- 0, // NumberofPowerCords;
+ 1, // NumberofPowerCords;
0, // ContainedElementCount;
0, // ContainedElementRecordLength;
{ { 0 } }, // ContainedElements[1];
@@ -782,9 +783,22 @@ BoardInfoUpdateSmbiosType2 (
VOID
)
{
- UINTN Size;
- CHAR16 AssetTagVar[ASSET_TAG_STR_STORAGE_SIZE] = L"";
- EFI_STATUS Status;
+
+ LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mBoardInfoType2, mBoardInfoType2Strings, NULL);
+}
+
+/***********************************************************************
+ SMBIOS data update TYPE3 Enclosure Information
+************************************************************************/
+VOID
+EnclosureInfoUpdateSmbiosType3 (
+ VOID
+ )
+{
+ UINTN Size;
+ EFI_STATUS Status;
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+ CHAR16 AssetTagVar[ASSET_TAG_STR_STORAGE_SIZE] = L"";
Size = sizeof(AssetTagVar);
Status = gRT->GetVariable(L"AssetTag",
@@ -802,18 +816,10 @@ BoardInfoUpdateSmbiosType2 (
}
DEBUG ((DEBUG_INFO, "System Asset Tag : %a\n", mChassisAssetTag));
- LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mBoardInfoType2, mBoardInfoType2Strings, NULL);
-}
+ LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mEnclosureInfoType3, mEnclosureInfoType3Strings, &SmbiosHandle);
-/***********************************************************************
- SMBIOS data update TYPE3 Enclosure Information
-************************************************************************/
-VOID
-EnclosureInfoUpdateSmbiosType3 (
- VOID
- )
-{
- LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mEnclosureInfoType3, mEnclosureInfoType3Strings, NULL);
+ // Set Type2 ChassisHandle to point to the newly added Type3 handle
+ mBoardInfoType2.ChassisHandle = (UINT16) SmbiosHandle;
}
/***********************************************************************
@@ -982,9 +988,10 @@ PlatformSmbiosDriverEntryPoint (
SysInfoUpdateSmbiosType1 ();
+ EnclosureInfoUpdateSmbiosType3 (); // Add Type 3 first to get chassis handle for use in Type 2
+
BoardInfoUpdateSmbiosType2 ();
- EnclosureInfoUpdateSmbiosType3 ();
ProcessorInfoUpdateSmbiosType4 (4); //One example for creating and updating
--
2.17.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [edk2-platform][PATCH v1 3/7] Platforms/RaspberryPi: SMBIOS Type 0 fixes
2020-07-20 18:16 [edk2-platform][PATCH v1 0/7] Platform/RaspberryPi : SMBIOS fixes and cleanup Samer El-Haj-Mahmoud
2020-07-20 18:16 ` [edk2-platform][PATCH v1 1/7] Platforms/RaspberryPi: Fix NULL AssetTag in SMBIOS Samer El-Haj-Mahmoud
2020-07-20 18:16 ` [edk2-platform][PATCH v1 2/7] Platforms/RaspberryPi: SMBIOS Type 2 and Type 3 fixes Samer El-Haj-Mahmoud
@ 2020-07-20 18:16 ` Samer El-Haj-Mahmoud
2020-07-20 21:53 ` Andrei Warkentin
2020-07-20 18:16 ` [edk2-platform][PATCH v1 4/7] Platforms/RaspberryPi: SMBIOS Type 4 fixes Samer El-Haj-Mahmoud
` (4 subsequent siblings)
7 siblings, 1 reply; 16+ messages in thread
From: Samer El-Haj-Mahmoud @ 2020-07-20 18:16 UTC (permalink / raw)
To: devel; +Cc: Leif Lindholm, Pete Batard, Andrei Warkentin, Ard Biesheuvel
Various fixes and enhancements for SMBIOS Type 0:
- Use PCDs to report the BIOS Segment and Size
- Report Extended BiosSize
- Set BiosIsUpgradable (it is!)
- Clear FunctionKeyNetworkBootIsSupported
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Pete Batard <pete@akeo.ie>
Cc: Andrei Warkentin <awarkentin@vmware.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
---
Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf | 6 +++++-
Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c | 17 +++++++++--------
2 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf
index 59b2fefdf0fd..817b902b1fad 100644
--- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf
+++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf
@@ -1,10 +1,11 @@
#/** @file
#
-# SMBIOS Table for ARM platform
+# SMBIOS Table for the RaspberryPi platform
#
# Copyright (c) 2017, Andrei Warkentin <andrey.warkentin@gmail.com>
# Copyright (c) Microsoft Corporation. All rights reserved.
# Copyright (c) 2013 Linaro.org
+# Copyright (c) 2020, ARM Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@@ -51,8 +52,11 @@ [Depex]
gEfiSmbiosProtocolGuid AND gRaspberryPiFirmwareProtocolGuid
[Pcd]
+ gArmTokenSpaceGuid.PcdFdBaseAddress
+ gArmTokenSpaceGuid.PcdFdSize
gArmTokenSpaceGuid.PcdSystemMemorySize
gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVendor
gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString
+ gRaspberryPiTokenSpaceGuid.PcdFdtSize
gRaspberryPiTokenSpaceGuid.PcdRamMoreThan3GB
gRaspberryPiTokenSpaceGuid.PcdRamLimitTo3GB
diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
index 170f1843f90b..21feab3e47a5 100644
--- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
+++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
@@ -54,11 +54,11 @@ STATIC RASPBERRY_PI_FIRMWARE_PROTOCOL *mFwProtocol;
************************************************************************/
SMBIOS_TABLE_TYPE0 mBIOSInfoType0 = {
{ EFI_SMBIOS_TYPE_BIOS_INFORMATION, sizeof (SMBIOS_TABLE_TYPE0), 0 },
- 1, // Vendor String
- 2, // BiosVersion String
- 0x0, // BiosSegment
- 3, // BiosReleaseDate String
- 0x1F, // BiosSize
+ 1, // Vendor String
+ 2, // BiosVersion String
+ (UINT16) (FixedPcdGet32 (PcdFdBaseAddress) / 0x10000), // BiosSegment
+ 3, // BiosReleaseDate String
+ (UINT8) (FixedPcdGet32 (PcdFdSize) / 0x10000), // BiosSize (in 64KB)
{ // BiosCharacteristics
0, // Reserved :2; ///< Bits 0-1.
0, // Unknown :1;
@@ -66,11 +66,11 @@ SMBIOS_TABLE_TYPE0 mBIOSInfoType0 = {
0, // IsaIsSupported :1;
0, // McaIsSupported :1;
0, // EisaIsSupported :1;
- 0, // PciIsSupported :1;
+ 0, // PciIsSupported :1; /// No PCIe support since we hide ECAM from the OS
0, // PcmciaIsSupported :1;
0, // PlugAndPlayIsSupported :1;
0, // ApmIsSupported :1;
- 0, // BiosIsUpgradable :1;
+ 1, // BiosIsUpgradable :1;
0, // BiosShadowingAllowed :1;
0, // VlVesaIsSupported :1;
0, // EscdSupportIsAvailable :1;
@@ -104,7 +104,7 @@ SMBIOS_TABLE_TYPE0 mBIOSInfoType0 = {
// Boot1394IsSupported :1;
// SmartBatteryIsSupported :1;
// BIOSCharacteristicsExtensionBytes[1]
- 0x0e, // BiosBootSpecIsSupported :1;
+ 0x0c, // BiosBootSpecIsSupported :1;
// FunctionKeyNetworkBootIsSupported :1;
// TargetContentDistributionEnabled :1;
// UefiSpecificationSupported :1;
@@ -115,6 +115,7 @@ SMBIOS_TABLE_TYPE0 mBIOSInfoType0 = {
0, // SystemBiosMinorRelease
0, // EmbeddedControllerFirmwareMajorRelease
0, // EmbeddedControllerFirmwareMinorRelease
+ { (UINT16) ((FixedPcdGet32 (PcdFdSize) + FixedPcdGet32 (PcdFdtSize)) / 0x100000) }, // BiosSize (in MB since Bits 15:14 = 00b)
};
CHAR8 mBiosVendor[128] = "EDK2";
--
2.17.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [edk2-platform][PATCH v1 4/7] Platforms/RaspberryPi: SMBIOS Type 4 fixes
2020-07-20 18:16 [edk2-platform][PATCH v1 0/7] Platform/RaspberryPi : SMBIOS fixes and cleanup Samer El-Haj-Mahmoud
` (2 preceding siblings ...)
2020-07-20 18:16 ` [edk2-platform][PATCH v1 3/7] Platforms/RaspberryPi: SMBIOS Type 0 fixes Samer El-Haj-Mahmoud
@ 2020-07-20 18:16 ` Samer El-Haj-Mahmoud
2020-07-20 21:55 ` Andrei Warkentin
2020-07-20 18:16 ` [edk2-platform][PATCH v1 5/7] Platforms/RaspberryPi: SMBIOS Type 7 fixes Samer El-Haj-Mahmoud
` (3 subsequent siblings)
7 siblings, 1 reply; 16+ messages in thread
From: Samer El-Haj-Mahmoud @ 2020-07-20 18:16 UTC (permalink / raw)
To: devel; +Cc: Leif Lindholm, Pete Batard, Andrei Warkentin, Ard Biesheuvel
Various fixes and enhancements for SMBIOS Type 4:
- Fix ProcessorId to correctly report the Arm64 MIDR_EL1 value
- Change ProcessorUpgrade from Other to None
- Add comments for ProcessorCharacteristics fields
- Add CoreCount2, EnabledCoreCount2, and ThreadCount2
- Set LxCacheHandle to 0xFFFF
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Pete Batard <pete@akeo.ie>
Cc: Andrei Warkentin <awarkentin@vmware.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
---
Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf | 1 +
Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c | 87 ++++++++------------
2 files changed, 34 insertions(+), 54 deletions(-)
diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf
index 817b902b1fad..2b24b22c25fc 100644
--- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf
+++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf
@@ -31,6 +31,7 @@ [Packages]
EmbeddedPkg/EmbeddedPkg.dec
[LibraryClasses]
+ ArmLib
UefiBootServicesTableLib
MemoryAllocationLib
BaseMemoryLib
diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
index 21feab3e47a5..4dcdec5615dc 100644
--- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
+++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
@@ -32,6 +32,7 @@
#include <Protocol/Smbios.h>
#include <Protocol/RpiFirmware.h>
#include <Guid/SmBios.h>
+#include <Library/ArmLib.h>
#include <Library/DebugLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiLib.h>
@@ -230,55 +231,13 @@ CHAR8 *mEnclosureInfoType3Strings[] = {
************************************************************************/
SMBIOS_TABLE_TYPE4 mProcessorInfoType4 = {
{ EFI_SMBIOS_TYPE_PROCESSOR_INFORMATION, sizeof (SMBIOS_TABLE_TYPE4), 0},
- 1, // Socket String
- CentralProcessor, // ProcessorType; ///< The enumeration value from PROCESSOR_TYPE_DATA.
+ 1, // Socket String
+ CentralProcessor, // ProcessorType; ///< The enumeration value from PROCESSOR_TYPE_DATA.
ProcessorFamilyIndicatorFamily2, // ProcessorFamily; ///< The enumeration value from PROCESSOR_FAMILY2_DATA.
- 2, // ProcessorManufacture String;
- { // ProcessorId;
- { // PROCESSOR_SIGNATURE
- 0, // ProcessorSteppingId:4;
- 0, // ProcessorModel: 4;
- 0, // ProcessorFamily: 4;
- 0, // ProcessorType: 2;
- 0, // ProcessorReserved1: 2;
- 0, // ProcessorXModel: 4;
- 0, // ProcessorXFamily: 8;
- 0, // ProcessorReserved2: 4;
- },
-
- { // PROCESSOR_FEATURE_FLAGS
- 0, // ProcessorFpu :1;
- 0, // ProcessorVme :1;
- 0, // ProcessorDe :1;
- 0, // ProcessorPse :1;
- 0, // ProcessorTsc :1;
- 0, // ProcessorMsr :1;
- 0, // ProcessorPae :1;
- 0, // ProcessorMce :1;
- 0, // ProcessorCx8 :1;
- 0, // ProcessorApic :1;
- 0, // ProcessorReserved1 :1;
- 0, // ProcessorSep :1;
- 0, // ProcessorMtrr :1;
- 0, // ProcessorPge :1;
- 0, // ProcessorMca :1;
- 0, // ProcessorCmov :1;
- 0, // ProcessorPat :1;
- 0, // ProcessorPse36 :1;
- 0, // ProcessorPsn :1;
- 0, // ProcessorClfsh :1;
- 0, // ProcessorReserved2 :1;
- 0, // ProcessorDs :1;
- 0, // ProcessorAcpi :1;
- 0, // ProcessorMmx :1;
- 0, // ProcessorFxsr :1;
- 0, // ProcessorSse :1;
- 0, // ProcessorSse2 :1;
- 0, // ProcessorSs :1;
- 0, // ProcessorReserved3 :1;
- 0, // ProcessorTm :1;
- 0, // ProcessorReserved4 :2;
- }
+ 2, // ProcessorManufacture String;
+ { // ProcessorId;
+ { 0x00, 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00, 0x00 }
},
3, // ProcessorVersion String;
{ // Voltage;
@@ -293,18 +252,31 @@ SMBIOS_TABLE_TYPE4 mProcessorInfoType4 = {
0, // MaxSpeed;
0, // CurrentSpeed;
0x41, // Status;
- ProcessorUpgradeOther, // ProcessorUpgrade; ///< The enumeration value from PROCESSOR_UPGRADE.
- 0, // L1CacheHandle;
- 0, // L2CacheHandle;
- 0, // L3CacheHandle;
+ ProcessorUpgradeNone, // ProcessorUpgrade; ///< The enumeration value from PROCESSOR_UPGRADE.
+ 0xFFFF, // L1CacheHandle;
+ 0xFFFF, // L2CacheHandle;
+ 0xFFFF, // L3CacheHandle;
0, // SerialNumber;
0, // AssetTag;
0, // PartNumber;
4, // CoreCount;
4, // EnabledCoreCount;
4, // ThreadCount;
- 0x6C, // ProcessorCharacteristics;
+ 0x6C, // ProcessorCharacteristics; ///< The enumeration value from PROCESSOR_CHARACTERISTIC_FLAGS
+ // ProcessorReserved1 :1;
+ // ProcessorUnknown :1;
+ // Processor64BitCapble :1;
+ // ProcessorMultiCore :1;
+ // ProcessorHardwareThread :1;
+ // ProcessorExecuteProtection :1;
+ // ProcessorEnhancedVirtualization :1;
+ // ProcessorPowerPerformanceCtrl :1;
+ // Processor128bitCapble :1;
+ // ProcessorReserved2 :7;
ProcessorFamilyARM, // ARM Processor Family;
+ 0, // CoreCount2;
+ 0, // EnabledCoreCount2;
+ 0, // ThreadCount2;
};
CHAR8 mCpuName[128] = "Unknown ARM CPU";
@@ -832,11 +804,15 @@ ProcessorInfoUpdateSmbiosType4 (
)
{
EFI_STATUS Status;
- UINT32 Rate;
+ UINT32 Rate;
+ UINT64 *ProcessorId;
mProcessorInfoType4.CoreCount = (UINT8)MaxCpus;
+ mProcessorInfoType4.CoreCount2 = (UINT8)MaxCpus;
mProcessorInfoType4.EnabledCoreCount = (UINT8)MaxCpus;
+ mProcessorInfoType4.EnabledCoreCount2 = (UINT8)MaxCpus;
mProcessorInfoType4.ThreadCount = (UINT8)MaxCpus;
+ mProcessorInfoType4.ThreadCount2 = (UINT8)MaxCpus;
Status = mFwProtocol->GetMaxClockRate (RPI_MBOX_CLOCK_RATE_ARM, &Rate);
if (Status != EFI_SUCCESS) {
@@ -856,6 +832,9 @@ ProcessorInfoUpdateSmbiosType4 (
AsciiStrCpyS (mCpuName, sizeof (mCpuName), mFwProtocol->GetCpuName (-1));
+ ProcessorId = (UINT64 *)&(mProcessorInfoType4.ProcessorId);
+ *ProcessorId = ArmReadMidr();
+
LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mProcessorInfoType4, mProcessorInfoType4Strings, NULL);
}
--
2.17.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [edk2-platform][PATCH v1 5/7] Platforms/RaspberryPi: SMBIOS Type 7 fixes
2020-07-20 18:16 [edk2-platform][PATCH v1 0/7] Platform/RaspberryPi : SMBIOS fixes and cleanup Samer El-Haj-Mahmoud
` (3 preceding siblings ...)
2020-07-20 18:16 ` [edk2-platform][PATCH v1 4/7] Platforms/RaspberryPi: SMBIOS Type 4 fixes Samer El-Haj-Mahmoud
@ 2020-07-20 18:16 ` Samer El-Haj-Mahmoud
2020-07-20 21:54 ` Andrei Warkentin
2020-07-20 18:16 ` [edk2-platform][PATCH v1 6/7] Platforms/RaspberryPi: SMBIOS Memory Types fixes Samer El-Haj-Mahmoud
` (2 subsequent siblings)
7 siblings, 1 reply; 16+ messages in thread
From: Samer El-Haj-Mahmoud @ 2020-07-20 18:16 UTC (permalink / raw)
To: devel; +Cc: Leif Lindholm, Pete Batard, Andrei Warkentin, Ard Biesheuvel
Various fixes and enhancements for SMBIOS Type 7:
- Break into 3 instances (L1 Instruction, L1 Data, and L2 cache)
- Use correct values for RPi4 and RPi3 SoCs
- Add Type 4 association with type 7 handles
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Pete Batard <pete@akeo.ie>
Cc: Andrei Warkentin <awarkentin@vmware.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
---
Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c | 146 ++++++++++++++++++--
1 file changed, 133 insertions(+), 13 deletions(-)
diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
index 4dcdec5615dc..4ee8ae6ebfc9 100644
--- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
+++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
@@ -291,12 +291,24 @@ CHAR8 *mProcessorInfoType4Strings[] = {
/***********************************************************************
SMBIOS data definition TYPE7 Cache Information
************************************************************************/
-SMBIOS_TABLE_TYPE7 mCacheInfoType7 = {
+SMBIOS_TABLE_TYPE7 mCacheInfoType7_L1I = {
{ EFI_SMBIOS_TYPE_CACHE_INFORMATION, sizeof (SMBIOS_TABLE_TYPE7), 0 },
1, // SocketDesignation String
- 0x018A, // Cache Configuration
- 0x00FF, // Maximum Size 256k
- 0x00FF, // Install Size 256k
+ 0x380, // Cache Configuration
+ //Cache Level :3 (L1)
+ //Cache Socketed :1 (Not Socketed)
+ //Reserved :1
+ //Location :2 (Internal)
+ //Enabled/Disabled :1 (Enabled)
+ //Operational Mode :2 (Unknown)
+ //Reserved :6
+#if (RPI_MODEL == 4)
+ 0x0030, // Maximum Size (RPi4: 48KB)
+ 0x0030, // Install Size (RPi4: 48KB)
+#else
+ 0x0010, // Maximum Size (RPi3: 16KB)
+ 0x0010, // Install Size (RPi3: 16KB)
+#endif
{ // Supported SRAM Type
0, //Other :1
0, //Unknown :1
@@ -317,16 +329,115 @@ SMBIOS_TABLE_TYPE7 mCacheInfoType7 = {
0, //Asynchronous :1
0 //Reserved :9
},
- 0, // Cache Speed unknown
- CacheErrorMultiBit, // Error Correction Multi
- CacheTypeUnknown, // System Cache Type
- CacheAssociativity2Way // Associativity
+ 0, // Cache Speed unknown
+ CacheErrorParity, // Error Correction
+ CacheTypeInstruction, // System Cache Type
+ CacheAssociativity2Way // Associativity (RPi4 L1 Instruction cache is 3-way set associative, but SMBIOS spec does not define that)
};
-CHAR8 *mCacheInfoType7Strings[] = {
- "Cache1",
+CHAR8 *mCacheInfoType7Strings_L1I[] = {
+ "L1 Instruction",
NULL
};
+SMBIOS_TABLE_TYPE7 mCacheInfoType7_L1D = {
+ { EFI_SMBIOS_TYPE_CACHE_INFORMATION, sizeof (SMBIOS_TABLE_TYPE7), 0 },
+ 1, // SocketDesignation String
+ 0x180, // Cache Configuration
+ //Cache Level :3 (L1)
+ //Cache Socketed :1 (Not Socketed)
+ //Reserved :1
+ //Location :2 (Internal)
+ //Enabled/Disabled :1 (Enabled)
+ //Operational Mode :2 (WB)
+ //Reserved :6
+#if (RPI_MODEL == 4)
+ 0x0020, // Maximum Size (RPi4: 32KB)
+ 0x0020, // Install Size (RPi4: 32KB)
+#else
+ 0x0010, // Maximum Size (RPi3: 16KB)
+ 0x0010, // Install Size (RPi3: 16KB)
+#endif
+ { // Supported SRAM Type
+ 0, //Other :1
+ 0, //Unknown :1
+ 0, //NonBurst :1
+ 1, //Burst :1
+ 0, //PiplelineBurst :1
+ 1, //Synchronous :1
+ 0, //Asynchronous :1
+ 0 //Reserved :9
+ },
+ { // Current SRAM Type
+ 0, //Other :1
+ 0, //Unknown :1
+ 0, //NonBurst :1
+ 1, //Burst :1
+ 0, //PiplelineBurst :1
+ 1, //Synchronous :1
+ 0, //Asynchronous :1
+ 0 //Reserved :9
+ },
+ 0, // Cache Speed unknown
+ CacheErrorSingleBit, // Error Correction
+ CacheTypeData, // System Cache Type
+#if (RPI_MODEL == 4)
+ CacheAssociativity2Way // Associativity
+#else
+ CacheAssociativity4Way // Associativity
+#endif
+};
+CHAR8 *mCacheInfoType7Strings_L1D[] = {
+ "L1 Data",
+ NULL
+};
+
+SMBIOS_TABLE_TYPE7 mCacheInfoType7_L2 = {
+ { EFI_SMBIOS_TYPE_CACHE_INFORMATION, sizeof (SMBIOS_TABLE_TYPE7), 0 },
+ 1, // SocketDesignation String
+ 0x0181, // Cache Configuration
+ //Cache Level :3 (L2)
+ //Cache Socketed :1 (Not Socketed)
+ //Reserved :1
+ //Location :2 (Internal)
+ //Enabled/Disabled :1 (Enabled)
+ //Operational Mode :2 (WB)
+ //Reserved :6
+#if (RPI_MODEL == 4)
+ 0x0400, // Maximum Size (RPi4: 1MB)
+ 0x0400, // Install Size (RPi4: 1MB)
+#else
+ 0x0200, // Maximum Size (RPi3: 512KB)
+ 0x0200, // Install Size (RPi3: 512KB)
+#endif
+ { // Supported SRAM Type
+ 0, //Other :1
+ 0, //Unknown :1
+ 0, //NonBurst :1
+ 1, //Burst :1
+ 0, //PiplelineBurst :1
+ 1, //Synchronous :1
+ 0, //Asynchronous :1
+ 0 //Reserved :9
+ },
+ { // Current SRAM Type
+ 0, //Other :1
+ 0, //Unknown :1
+ 0, //NonBurst :1
+ 1, //Burst :1
+ 0, //PiplelineBurst :1
+ 1, //Synchronous :1
+ 0, //Asynchronous :1
+ 0 //Reserved :9
+ },
+ 0, // Cache Speed unknown
+ CacheErrorSingleBit, // Error Correction Multi
+ CacheTypeUnified, // System Cache Type
+ CacheAssociativity16Way // Associativity
+};
+CHAR8 *mCacheInfoType7Strings_L2[] = {
+ "L2",
+ NULL
+};
/***********************************************************************
SMBIOS data definition TYPE9 System Slot Information
************************************************************************/
@@ -846,7 +957,17 @@ CacheInfoUpdateSmbiosType7 (
VOID
)
{
- LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mCacheInfoType7, mCacheInfoType7Strings, NULL);
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+
+ LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mCacheInfoType7_L1I, mCacheInfoType7Strings_L1I, NULL);
+
+ LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mCacheInfoType7_L1D, mCacheInfoType7Strings_L1D, &SmbiosHandle);
+ // Set Type4 L1CacheHandle to point to the newly added L1 Data Cache
+ mProcessorInfoType4.L1CacheHandle = (UINT16) SmbiosHandle;
+
+ LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mCacheInfoType7_L2, mCacheInfoType7Strings_L2, &SmbiosHandle);
+ // Set Type4 L2CacheHandle to point to the newly added L2 Cache
+ mProcessorInfoType4.L2CacheHandle = (UINT16) SmbiosHandle;
}
/***********************************************************************
@@ -972,11 +1093,10 @@ PlatformSmbiosDriverEntryPoint (
BoardInfoUpdateSmbiosType2 ();
+ CacheInfoUpdateSmbiosType7 (); // Add Type 7 first to get Cache handle for use in Type 4
ProcessorInfoUpdateSmbiosType4 (4); //One example for creating and updating
- CacheInfoUpdateSmbiosType7 ();
-
SysSlotInfoUpdateSmbiosType9 ();
OemStringsUpdateSmbiosType11 ();
--
2.17.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [edk2-platform][PATCH v1 6/7] Platforms/RaspberryPi: SMBIOS Memory Types fixes
2020-07-20 18:16 [edk2-platform][PATCH v1 0/7] Platform/RaspberryPi : SMBIOS fixes and cleanup Samer El-Haj-Mahmoud
` (4 preceding siblings ...)
2020-07-20 18:16 ` [edk2-platform][PATCH v1 5/7] Platforms/RaspberryPi: SMBIOS Type 7 fixes Samer El-Haj-Mahmoud
@ 2020-07-20 18:16 ` Samer El-Haj-Mahmoud
2020-07-20 21:55 ` Andrei Warkentin
2020-07-20 18:16 ` [edk2-platform][PATCH v1 7/7] Platforms/RaspberryPi: SMBIOS minor cleanup Samer El-Haj-Mahmoud
2020-08-13 13:47 ` [edk2-platform][PATCH v1 0/7] Platform/RaspberryPi : SMBIOS fixes and cleanup Ard Biesheuvel
7 siblings, 1 reply; 16+ messages in thread
From: Samer El-Haj-Mahmoud @ 2020-07-20 18:16 UTC (permalink / raw)
To: devel; +Cc: Leif Lindholm, Pete Batard, Andrei Warkentin, Ard Biesheuvel
Various fixes and enhancements for SMBIOS memory structures
(Types 16, 17, and 19):
- Type 16:
- Update MaximumCapacity dynamically
- Keep ExtendedMaximumCapacity at 0 (not used, per spec)
- Type 17:
- Update Size and VolatileSize dynamically
- Change FormFactor from Unknown to Chip
- Set DeviceSet to 0 (not part of set) instead of 0xFF (unknown)
- Fix the DeviceLocator, BankLocator, and Manufacturer strings
- Update MemoryType correctly for RPi4 and RPi3
- Add additional SMBIOS fields from 3.3 definition
- Type 19:
- Update MemoryArrayHandle to point to Type 16 handle
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Pete Batard <pete@akeo.ie>
Cc: Andrei Warkentin <awarkentin@vmware.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
---
Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c | 115 ++++++++++++++------
1 file changed, 83 insertions(+), 32 deletions(-)
diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
index 4ee8ae6ebfc9..d382797602ce 100644
--- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
+++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
@@ -496,10 +496,10 @@ SMBIOS_TABLE_TYPE16 mPhyMemArrayInfoType16 = {
MemoryArrayLocationSystemBoard, // Location; ///< The enumeration value from MEMORY_ARRAY_LOCATION.
MemoryArrayUseSystemMemory, // Use; ///< The enumeration value from MEMORY_ARRAY_USE.
MemoryErrorCorrectionUnknown, // MemoryErrorCorrection; ///< The enumeration value from MEMORY_ERROR_CORRECTION.
- 0x40000000, // MaximumCapacity;
+ 0x00000000, // MaximumCapacity;
0xFFFE, // MemoryErrorInformationHandle;
1, // NumberOfMemoryDevices;
- 0x40000000ULL, // ExtendedMaximumCapacity;
+ 0x00000000ULL, // ExtendedMaximumCapacity;
};
CHAR8 *mPhyMemArrayInfoType16Strings[] = {
NULL
@@ -510,18 +510,23 @@ CHAR8 *mPhyMemArrayInfoType16Strings[] = {
************************************************************************/
SMBIOS_TABLE_TYPE17 mMemDevInfoType17 = {
{ EFI_SMBIOS_TYPE_MEMORY_DEVICE, sizeof (SMBIOS_TABLE_TYPE17), 0 },
- 0, // MemoryArrayHandle; // Should match SMBIOS_TABLE_TYPE16.Handle, initialized at runtime, refer to PhyMemArrayInfoUpdateSmbiosType16()
- 0xFFFE, // MemoryErrorInformationHandle;
- 0xFFFF, // TotalWidth;
- 0xFFFF, // DataWidth;
- 0x0400, // Size; // When bit 15 is 0: Size in MB
- // When bit 15 is 1: Size in KB, and continues in ExtendedSize
- MemoryFormFactorUnknown, // FormFactor; ///< The enumeration value from MEMORY_FORM_FACTOR.
- 0xff, // DeviceSet;
- 1, // DeviceLocator String
- 2, // BankLocator String
- MemoryTypeDram, // MemoryType; ///< The enumeration value from MEMORY_DEVICE_TYPE.
- { // TypeDetail;
+ 0, // MemoryArrayHandle; // Should match SMBIOS_TABLE_TYPE16.Handle, initialized at runtime, refer to PhyMemArrayInfoUpdateSmbiosType16()
+ 0xFFFE, // MemoryErrorInformationHandle; (not provided)
+ 0xFFFF, // TotalWidth; (unknown)
+ 0xFFFF, // DataWidth; (unknown)
+ 0xFFFF, // Size; // When bit 15 is 0: Size in MB
+ // When bit 15 is 1: Size in KB, and continues in ExtendedSize
+ // initialized at runtime, refer to PhyMemArrayInfoUpdateSmbiosType16()
+ MemoryFormFactorChip, // FormFactor; ///< The enumeration value from MEMORY_FORM_FACTOR.
+ 0, // DeviceSet;
+ 1, // DeviceLocator String
+ 0, // BankLocator String
+#if (RPI_MODEL == 4)
+ MemoryTypeLpddr4, // MemoryType; ///< The enumeration value from MEMORY_DEVICE_TYPE.
+#else
+ MemoryTypeLpddr2, // MemoryType; ///< The enumeration value from MEMORY_DEVICE_TYPE.
+#endif
+ { // TypeDetail;
0, // Reserved :1;
0, // Other :1;
1, // Unknown :1;
@@ -539,19 +544,42 @@ SMBIOS_TABLE_TYPE17 mMemDevInfoType17 = {
0, // Unbuffered :1;
0, // Reserved1 :1;
},
- 0, // Speed;
- 3, // Manufacturer String
- 0, // SerialNumber String
- 0, // AssetTag String
- 0, // PartNumber String
- 0, // Attributes;
- 0, // ExtendedSize;
- 0, // ConfiguredMemoryClockSpeed;
+ 0, // Speed; (unknown)
+ 2, // Manufacturer String
+ 0, // SerialNumber String
+ 0, // AssetTag String
+ 0, // PartNumber String
+ 0, // Attributes; (unknown rank)
+ 0, // ExtendedSize; (since Size < 32GB-1)
+ 0, // ConfiguredMemoryClockSpeed; (unknown)
+ 0, // MinimumVoltage; (unknown)
+ 0, // MaximumVoltage; (unknown)
+ 0, // ConfiguredVoltage; (unknown)
+ MemoryTechnologyDram, // MemoryTechnology ///< The enumeration value from MEMORY_DEVICE_TECHNOLOGY
+ {{ // MemoryOperatingModeCapability
+ 0, // Reserved :1;
+ 0, // Other :1;
+ 0, // Unknown :1;
+ 1, // VolatileMemory :1;
+ 0, // ByteAccessiblePersistentMemory :1;
+ 0, // BlockAccessiblePersistentMemory :1;
+ 0 // Reserved :10;
+ }},
+ 0, // FirwareVersion
+ 0, // ModuleManufacturerID (unknown)
+ 0, // ModuleProductID (unknown)
+ 0, // MemorySubsystemControllerManufacturerID (unknown)
+ 0, // MemorySubsystemControllerProductID (unknown)
+ 0, // NonVolatileSize
+ 0xFFFFFFFFFFFFFFFFULL,// VolatileSize // initialized at runtime, refer to PhyMemArrayInfoUpdateSmbiosType16()
+ 0, // CacheSize
+ 0, // LogicalSize (since MemoryType is not MemoryTypeLogicalNonVolatileDevice)
+ 0, // ExtendedSpeed,
+ 0 // ExtendedConfiguredMemorySpeed
};
CHAR8 *mMemDevInfoType17Strings[] = {
- "OS Virtual Memory",
- "malloc",
- "OSV",
+ "SDRAM",
+ "Micron",
NULL
};
@@ -562,10 +590,10 @@ SMBIOS_TABLE_TYPE19 mMemArrMapInfoType19 = {
{ EFI_SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS, sizeof (SMBIOS_TABLE_TYPE19), 0 },
0x00000000, // StartingAddress;
0x00000000, // EndingAddress;
- 0, // MemoryArrayHandle;
+ 0, // MemoryArrayHandle; // Should match SMBIOS_TABLE_TYPE16.Handle, initialized at runtime, refer to PhyMemArrayInfoUpdateSmbiosType16()
1, // PartitionWidth;
- 0, // ExtendedStartingAddress;
- 0, // ExtendedEndingAddress;
+ 0, // ExtendedStartingAddress; // not used
+ 0, // ExtendedEndingAddress; // not used
};
CHAR8 *mMemArrMapInfoType19Strings[] = {
NULL
@@ -1000,14 +1028,37 @@ PhyMemArrayInfoUpdateSmbiosType16 (
VOID
)
{
- EFI_SMBIOS_HANDLE MemArraySmbiosHande;
+ EFI_SMBIOS_HANDLE MemArraySmbiosHandle;
+ EFI_STATUS Status;
+ UINT32 InstalledMB = 0;
- LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mPhyMemArrayInfoType16, mPhyMemArrayInfoType16Strings, &MemArraySmbiosHande);
+ //
+ // Update memory size fields:
+ // - Type 16 MaximumCapacity in KB
+ // - Type 17 size in MB (since bit 15 = 0)
+ // - Type 17 VolatileSize in Bytes
+ //
+
+ // The minimum RAM size used on any Raspberry Pi model is 256 MB
+ mMemDevInfoType17.Size = 256;
+
+ Status = mFwProtocol->GetModelInstalledMB (&InstalledMB);
+ if (Status != EFI_SUCCESS) {
+ DEBUG ((DEBUG_WARN, "Couldn't get the board memory size - defaulting to 256 MB: %r\n", Status));
+ } else {
+ mMemDevInfoType17.Size = InstalledMB; // Size in MB
+ }
+
+ mPhyMemArrayInfoType16.MaximumCapacity = mMemDevInfoType17.Size * 1024; // Size in KB
+ mMemDevInfoType17.VolatileSize = MultU64x32 (mMemDevInfoType17.Size, 1024 * 1024); // Size in Bytes
+
+ LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mPhyMemArrayInfoType16, mPhyMemArrayInfoType16Strings, &MemArraySmbiosHandle);
//
- // Update the memory device information
+ // Update the memory device information and memory array map with the newly added type 16 handle
//
- mMemDevInfoType17.MemoryArrayHandle = MemArraySmbiosHande;
+ mMemDevInfoType17.MemoryArrayHandle = MemArraySmbiosHandle;
+ mMemArrMapInfoType19.MemoryArrayHandle = MemArraySmbiosHandle;
}
/***********************************************************************
--
2.17.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [edk2-platform][PATCH v1 7/7] Platforms/RaspberryPi: SMBIOS minor cleanup
2020-07-20 18:16 [edk2-platform][PATCH v1 0/7] Platform/RaspberryPi : SMBIOS fixes and cleanup Samer El-Haj-Mahmoud
` (5 preceding siblings ...)
2020-07-20 18:16 ` [edk2-platform][PATCH v1 6/7] Platforms/RaspberryPi: SMBIOS Memory Types fixes Samer El-Haj-Mahmoud
@ 2020-07-20 18:16 ` Samer El-Haj-Mahmoud
2020-08-12 16:27 ` Pete Batard
2020-08-13 13:47 ` [edk2-platform][PATCH v1 0/7] Platform/RaspberryPi : SMBIOS fixes and cleanup Ard Biesheuvel
7 siblings, 1 reply; 16+ messages in thread
From: Samer El-Haj-Mahmoud @ 2020-07-20 18:16 UTC (permalink / raw)
To: devel; +Cc: Leif Lindholm, Pete Batard, Andrei Warkentin, Ard Biesheuvel
Minor code cleanup:
- Update file header to list SBBR required/recommended tables
- Rename DataSmbiosHande to DataSmbiosHandle
- Remove SMBIOS_HANDLE_PI_RESERVED from Type 11 template for
consistency. This is already done in LogSmbiosData().
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Pete Batard <pete@akeo.ie>
Cc: Andrei Warkentin <awarkentin@vmware.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
---
Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c | 43 ++++++++++++--------
1 file changed, 25 insertions(+), 18 deletions(-)
diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
index d382797602ce..d955291c5bb7 100644
--- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
+++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
@@ -1,20 +1,27 @@
/** @file
*
- * Static SMBIOS Table for ARM platform
+ * Static SMBIOS Table for the RaspberryPi platform
* Derived from EmulatorPkg package
*
- * Note SMBIOS 2.7.1 Required structures:
- * BIOS Information (Type 0)
- * System Information (Type 1)
- * Board Information (Type 2)
- * System Enclosure (Type 3)
- * Processor Information (Type 4) - CPU Driver
- * Cache Information (Type 7) - For cache that is external to processor
- * System Slots (Type 9) - If system has slots
- * Physical Memory Array (Type 16)
- * Memory Device (Type 17) - For each socketed system-memory Device
- * Memory Array Mapped Address (Type 19) - One per contiguous block per Physical Memroy Array
- * System Boot Information (Type 32)
+ * Note - Arm SBBR ver 1.2 required and recommended SMBIOS structures:
+ * BIOS Information (Type 0)
+ * System Information (Type 1)
+ * Board Information (Type 2) - Recommended
+ * System Enclosure (Type 3)
+ * Processor Information (Type 4) - CPU Driver
+ * Cache Information (Type 7) - For cache that is external to processor
+ * Port Information (Type 8) - Recommended for platforms with physical ports
+ * System Slots (Type 9) - If system has slots
+ * OEM Strings (Type 11) - Recommended
+ * BIOS Language Information (Type 13) - Recommended
+ * System Event Log (Type 15) - Recommended (does not exit on RPi)
+ * Physical Memory Array (Type 16)
+ * Memory Device (Type 17) - For each socketed system-memory Device
+ * Memory Array Mapped Address (Type 19) - One per contiguous block per Physical Memroy Array
+ * System Boot Information (Type 32)
+ * IPMI Device Information (Type 38) - Required for platforms with IPMIv1.0 BMC Host Interface (not applicable to RPi)
+ * Onboard Devices Extended Information (Type 41) - Recommended
+ * Redfish Host Interface (Type 42) - Required for platforms supporting Redfish Host Interface (not applicable to RPi)
*
* Copyright (c) 2017-2018, Andrey Warkentin <andrey.warkentin@gmail.com>
* Copyright (c) 2013, Linaro.org
@@ -480,7 +487,7 @@ CHAR8 *mSysSlotInfoType9Strings[] = {
************************************************************************/
SMBIOS_TABLE_TYPE11 mOemStringsType11 = {
- { EFI_SMBIOS_TYPE_OEM_STRINGS, sizeof (SMBIOS_TABLE_TYPE11), SMBIOS_HANDLE_PI_RESERVED },
+ { EFI_SMBIOS_TYPE_OEM_STRINGS, sizeof (SMBIOS_TABLE_TYPE11), 0 },
1 // StringCount
};
CHAR8 *mOemStringsType11Strings[] = {
@@ -641,7 +648,7 @@ CHAR8 *mBootInfoType32Strings[] = {
@param Template Fixed SMBIOS structure, required.
@param StringPack Array of strings to convert to an SMBIOS string pack.
NULL is OK.
- @param DataSmbiosHande The new SMBIOS record handle .
+ @param DataSmbiosHandle The new SMBIOS record handle.
NULL is OK.
**/
@@ -650,7 +657,7 @@ EFIAPI
LogSmbiosData (
IN EFI_SMBIOS_TABLE_HEADER *Template,
IN CHAR8 **StringPack,
- OUT EFI_SMBIOS_HANDLE *DataSmbiosHande
+ OUT EFI_SMBIOS_HANDLE *DataSmbiosHandle
)
{
EFI_STATUS Status;
@@ -716,8 +723,8 @@ LogSmbiosData (
Record
);
- if ((Status == EFI_SUCCESS) && (DataSmbiosHande != NULL)) {
- *DataSmbiosHande = SmbiosHandle;
+ if ((Status == EFI_SUCCESS) && (DataSmbiosHandle != NULL)) {
+ *DataSmbiosHandle = SmbiosHandle;
}
ASSERT_EFI_ERROR (Status);
--
2.17.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [edk2-platform][PATCH v1 1/7] Platforms/RaspberryPi: Fix NULL AssetTag in SMBIOS
2020-07-20 18:16 ` [edk2-platform][PATCH v1 1/7] Platforms/RaspberryPi: Fix NULL AssetTag in SMBIOS Samer El-Haj-Mahmoud
@ 2020-07-20 21:52 ` Andrei Warkentin
0 siblings, 0 replies; 16+ messages in thread
From: Andrei Warkentin @ 2020-07-20 21:52 UTC (permalink / raw)
To: Samer El-Haj-Mahmoud, devel@edk2.groups.io
Cc: Leif Lindholm, Pete Batard, Ard Biesheuvel
[-- Attachment #1: Type: text/plain, Size: 2790 bytes --]
Reviewed-by: Andrei Warkentin <awarkentin@vmware.com>
________________________________
From: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
Sent: Monday, July 20, 2020 1:16 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Leif Lindholm <leif@nuviainc.com>; Pete Batard <pete@akeo.ie>; Andrei Warkentin <awarkentin@vmware.com>; Ard Biesheuvel <ard.biesheuvel@arm.com>
Subject: [edk2-platform][PATCH v1 1/7] Platforms/RaspberryPi: Fix NULL AssetTag in SMBIOS
Commit 6d4fed696d004a6aeb795369aa38d4ce1d39f308 added support for
reporting AssetTag in RPi SMBIOS Types 2 and 3. The default
AssetTag is an empty string. SMBIOS does not allow empty strings to be
referenced from the corresponding string field. This caused breakage in
parsing SMBIOS Types 2 and 3 fields that follow the AssetTag field.
The issue caused an FWTS test failure, as reported in:
https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fpftf%2FRPi4%2Fissues%2F75&data=02%7C01%7Cawarkentin%40vmware.com%7C0eeb8c53c3b64e1e2fd008d82cd915f3%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C1%7C637308658172692193&sdata=QPQN3zqWXN4JSJqMK9kN5Ntx%2BFXVZ0Hn1PI1RXxWBt8%3D&reserved=0
The fix is to detect if no AssetTag is set in the UEFI variable, and if
so, change the AssetTag SMBIOS field to an empty blank space.
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Pete Batard <pete@akeo.ie>
Cc: Andrei Warkentin <awarkentin@vmware.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
---
Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
index d5fb843d43ce..6eef66f125f8 100644
--- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
+++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
@@ -793,7 +793,13 @@ BoardInfoUpdateSmbiosType2 (
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "Failed to get Asset Tag: %r\n", Status));
}
- UnicodeStrToAsciiStrS(AssetTagVar, mChassisAssetTag, sizeof(mChassisAssetTag));
+
+ if (AssetTagVar[0] == L'\0') {
+ // SMBIOS referenced strings cannot be NULL. If no AssetTag is set, default to a blank space.
+ UnicodeStrToAsciiStrS(L" ", mChassisAssetTag, sizeof(mChassisAssetTag));
+ } else {
+ UnicodeStrToAsciiStrS(AssetTagVar, mChassisAssetTag, sizeof(mChassisAssetTag));
+ }
DEBUG ((DEBUG_INFO, "System Asset Tag : %a\n", mChassisAssetTag));
LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mBoardInfoType2, mBoardInfoType2Strings, NULL);
--
2.17.1
[-- Attachment #2: Type: text/html, Size: 4400 bytes --]
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [edk2-platform][PATCH v1 2/7] Platforms/RaspberryPi: SMBIOS Type 2 and Type 3 fixes
2020-07-20 18:16 ` [edk2-platform][PATCH v1 2/7] Platforms/RaspberryPi: SMBIOS Type 2 and Type 3 fixes Samer El-Haj-Mahmoud
@ 2020-07-20 21:53 ` Andrei Warkentin
0 siblings, 0 replies; 16+ messages in thread
From: Andrei Warkentin @ 2020-07-20 21:53 UTC (permalink / raw)
To: Samer El-Haj-Mahmoud, devel@edk2.groups.io
Cc: Leif Lindholm, Pete Batard, Ard Biesheuvel
[-- Attachment #1: Type: text/plain, Size: 4481 bytes --]
Reviewed-by: Andrei Warkentin <awarkentin@vmware.com>
________________________________
From: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
Sent: Monday, July 20, 2020 1:16 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Leif Lindholm <leif@nuviainc.com>; Pete Batard <pete@akeo.ie>; Andrei Warkentin <awarkentin@vmware.com>; Ard Biesheuvel <ard.biesheuvel@arm.com>
Subject: [edk2-platform][PATCH v1 2/7] Platforms/RaspberryPi: SMBIOS Type 2 and Type 3 fixes
Various fixes for SMBIOS Types 2 and 3:
- Add LocationInChassis string to Type 2
- Update Type 3 NumberofPowerCords to 1
- Add ChassisHandle refernce to Type2. This requires moving the
Type 3 population to happen before Type 2
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Pete Batard <pete@akeo.ie>
Cc: Andrei Warkentin <awarkentin@vmware.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
---
Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c | 41 ++++++++++++--------
1 file changed, 24 insertions(+), 17 deletions(-)
diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
index 6eef66f125f8..170f1843f90b 100644
--- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
+++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
@@ -176,7 +176,7 @@ SMBIOS_TABLE_TYPE2 mBoardInfoType2 = {
0, // HotSwappable :1;
0, // Reserved :3;
},
- 0, // LocationInChassis String
+ 6, // LocationInChassis String
0, // ChassisHandle;
BaseBoardTypeMotherBoard, // BoardType;
0, // NumberOfContainedObjectHandles;
@@ -191,6 +191,7 @@ CHAR8 *mBoardInfoType2Strings[] = {
mSysInfoVersionName,
mSysInfoSerial,
mChassisAssetTag,
+ "Internal",
NULL
};
@@ -210,7 +211,7 @@ SMBIOS_TABLE_TYPE3 mEnclosureInfoType3 = {
ChassisSecurityStatusNone,// SecurityStatus;
{ 0, 0, 0, 0 }, // OemDefined[4];
0, // Height;
- 0, // NumberofPowerCords;
+ 1, // NumberofPowerCords;
0, // ContainedElementCount;
0, // ContainedElementRecordLength;
{ { 0 } }, // ContainedElements[1];
@@ -782,9 +783,22 @@ BoardInfoUpdateSmbiosType2 (
VOID
)
{
- UINTN Size;
- CHAR16 AssetTagVar[ASSET_TAG_STR_STORAGE_SIZE] = L"";
- EFI_STATUS Status;
+
+ LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mBoardInfoType2, mBoardInfoType2Strings, NULL);
+}
+
+/***********************************************************************
+ SMBIOS data update TYPE3 Enclosure Information
+************************************************************************/
+VOID
+EnclosureInfoUpdateSmbiosType3 (
+ VOID
+ )
+{
+ UINTN Size;
+ EFI_STATUS Status;
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+ CHAR16 AssetTagVar[ASSET_TAG_STR_STORAGE_SIZE] = L"";
Size = sizeof(AssetTagVar);
Status = gRT->GetVariable(L"AssetTag",
@@ -802,18 +816,10 @@ BoardInfoUpdateSmbiosType2 (
}
DEBUG ((DEBUG_INFO, "System Asset Tag : %a\n", mChassisAssetTag));
- LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mBoardInfoType2, mBoardInfoType2Strings, NULL);
-}
+ LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mEnclosureInfoType3, mEnclosureInfoType3Strings, &SmbiosHandle);
-/***********************************************************************
- SMBIOS data update TYPE3 Enclosure Information
-************************************************************************/
-VOID
-EnclosureInfoUpdateSmbiosType3 (
- VOID
- )
-{
- LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mEnclosureInfoType3, mEnclosureInfoType3Strings, NULL);
+ // Set Type2 ChassisHandle to point to the newly added Type3 handle
+ mBoardInfoType2.ChassisHandle = (UINT16) SmbiosHandle;
}
/***********************************************************************
@@ -982,9 +988,10 @@ PlatformSmbiosDriverEntryPoint (
SysInfoUpdateSmbiosType1 ();
+ EnclosureInfoUpdateSmbiosType3 (); // Add Type 3 first to get chassis handle for use in Type 2
+
BoardInfoUpdateSmbiosType2 ();
- EnclosureInfoUpdateSmbiosType3 ();
ProcessorInfoUpdateSmbiosType4 (4); //One example for creating and updating
--
2.17.1
[-- Attachment #2: Type: text/html, Size: 7440 bytes --]
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [edk2-platform][PATCH v1 3/7] Platforms/RaspberryPi: SMBIOS Type 0 fixes
2020-07-20 18:16 ` [edk2-platform][PATCH v1 3/7] Platforms/RaspberryPi: SMBIOS Type 0 fixes Samer El-Haj-Mahmoud
@ 2020-07-20 21:53 ` Andrei Warkentin
0 siblings, 0 replies; 16+ messages in thread
From: Andrei Warkentin @ 2020-07-20 21:53 UTC (permalink / raw)
To: Samer El-Haj-Mahmoud, devel@edk2.groups.io
Cc: Leif Lindholm, Pete Batard, Ard Biesheuvel
[-- Attachment #1: Type: text/plain, Size: 5524 bytes --]
Reviewed-by: Andrei Warkentin <awarkentin@vmware.com>
________________________________
From: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
Sent: Monday, July 20, 2020 1:16 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Leif Lindholm <leif@nuviainc.com>; Pete Batard <pete@akeo.ie>; Andrei Warkentin <awarkentin@vmware.com>; Ard Biesheuvel <ard.biesheuvel@arm.com>
Subject: [edk2-platform][PATCH v1 3/7] Platforms/RaspberryPi: SMBIOS Type 0 fixes
Various fixes and enhancements for SMBIOS Type 0:
- Use PCDs to report the BIOS Segment and Size
- Report Extended BiosSize
- Set BiosIsUpgradable (it is!)
- Clear FunctionKeyNetworkBootIsSupported
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Pete Batard <pete@akeo.ie>
Cc: Andrei Warkentin <awarkentin@vmware.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
---
Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf | 6 +++++-
Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c | 17 +++++++++--------
2 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf
index 59b2fefdf0fd..817b902b1fad 100644
--- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf
+++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf
@@ -1,10 +1,11 @@
#/** @file
#
-# SMBIOS Table for ARM platform
+# SMBIOS Table for the RaspberryPi platform
#
# Copyright (c) 2017, Andrei Warkentin <andrey.warkentin@gmail.com>
# Copyright (c) Microsoft Corporation. All rights reserved.
# Copyright (c) 2013 Linaro.org
+# Copyright (c) 2020, ARM Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@@ -51,8 +52,11 @@ [Depex]
gEfiSmbiosProtocolGuid AND gRaspberryPiFirmwareProtocolGuid
[Pcd]
+ gArmTokenSpaceGuid.PcdFdBaseAddress
+ gArmTokenSpaceGuid.PcdFdSize
gArmTokenSpaceGuid.PcdSystemMemorySize
gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVendor
gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString
+ gRaspberryPiTokenSpaceGuid.PcdFdtSize
gRaspberryPiTokenSpaceGuid.PcdRamMoreThan3GB
gRaspberryPiTokenSpaceGuid.PcdRamLimitTo3GB
diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
index 170f1843f90b..21feab3e47a5 100644
--- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
+++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
@@ -54,11 +54,11 @@ STATIC RASPBERRY_PI_FIRMWARE_PROTOCOL *mFwProtocol;
************************************************************************/
SMBIOS_TABLE_TYPE0 mBIOSInfoType0 = {
{ EFI_SMBIOS_TYPE_BIOS_INFORMATION, sizeof (SMBIOS_TABLE_TYPE0), 0 },
- 1, // Vendor String
- 2, // BiosVersion String
- 0x0, // BiosSegment
- 3, // BiosReleaseDate String
- 0x1F, // BiosSize
+ 1, // Vendor String
+ 2, // BiosVersion String
+ (UINT16) (FixedPcdGet32 (PcdFdBaseAddress) / 0x10000), // BiosSegment
+ 3, // BiosReleaseDate String
+ (UINT8) (FixedPcdGet32 (PcdFdSize) / 0x10000), // BiosSize (in 64KB)
{ // BiosCharacteristics
0, // Reserved :2; ///< Bits 0-1.
0, // Unknown :1;
@@ -66,11 +66,11 @@ SMBIOS_TABLE_TYPE0 mBIOSInfoType0 = {
0, // IsaIsSupported :1;
0, // McaIsSupported :1;
0, // EisaIsSupported :1;
- 0, // PciIsSupported :1;
+ 0, // PciIsSupported :1; /// No PCIe support since we hide ECAM from the OS
0, // PcmciaIsSupported :1;
0, // PlugAndPlayIsSupported :1;
0, // ApmIsSupported :1;
- 0, // BiosIsUpgradable :1;
+ 1, // BiosIsUpgradable :1;
0, // BiosShadowingAllowed :1;
0, // VlVesaIsSupported :1;
0, // EscdSupportIsAvailable :1;
@@ -104,7 +104,7 @@ SMBIOS_TABLE_TYPE0 mBIOSInfoType0 = {
// Boot1394IsSupported :1;
// SmartBatteryIsSupported :1;
// BIOSCharacteristicsExtensionBytes[1]
- 0x0e, // BiosBootSpecIsSupported :1;
+ 0x0c, // BiosBootSpecIsSupported :1;
// FunctionKeyNetworkBootIsSupported :1;
// TargetContentDistributionEnabled :1;
// UefiSpecificationSupported :1;
@@ -115,6 +115,7 @@ SMBIOS_TABLE_TYPE0 mBIOSInfoType0 = {
0, // SystemBiosMinorRelease
0, // EmbeddedControllerFirmwareMajorRelease
0, // EmbeddedControllerFirmwareMinorRelease
+ { (UINT16) ((FixedPcdGet32 (PcdFdSize) + FixedPcdGet32 (PcdFdtSize)) / 0x100000) }, // BiosSize (in MB since Bits 15:14 = 00b)
};
CHAR8 mBiosVendor[128] = "EDK2";
--
2.17.1
[-- Attachment #2: Type: text/html, Size: 11514 bytes --]
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [edk2-platform][PATCH v1 5/7] Platforms/RaspberryPi: SMBIOS Type 7 fixes
2020-07-20 18:16 ` [edk2-platform][PATCH v1 5/7] Platforms/RaspberryPi: SMBIOS Type 7 fixes Samer El-Haj-Mahmoud
@ 2020-07-20 21:54 ` Andrei Warkentin
0 siblings, 0 replies; 16+ messages in thread
From: Andrei Warkentin @ 2020-07-20 21:54 UTC (permalink / raw)
To: Samer El-Haj-Mahmoud, devel@edk2.groups.io
Cc: Leif Lindholm, Pete Batard, Ard Biesheuvel
[-- Attachment #1: Type: text/plain, Size: 8677 bytes --]
Reviewed-by: Andrei Warkentin <awarkentin@vmware.com>
________________________________
From: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
Sent: Monday, July 20, 2020 1:16 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Leif Lindholm <leif@nuviainc.com>; Pete Batard <pete@akeo.ie>; Andrei Warkentin <awarkentin@vmware.com>; Ard Biesheuvel <ard.biesheuvel@arm.com>
Subject: [edk2-platform][PATCH v1 5/7] Platforms/RaspberryPi: SMBIOS Type 7 fixes
Various fixes and enhancements for SMBIOS Type 7:
- Break into 3 instances (L1 Instruction, L1 Data, and L2 cache)
- Use correct values for RPi4 and RPi3 SoCs
- Add Type 4 association with type 7 handles
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Pete Batard <pete@akeo.ie>
Cc: Andrei Warkentin <awarkentin@vmware.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
---
Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c | 146 ++++++++++++++++++--
1 file changed, 133 insertions(+), 13 deletions(-)
diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
index 4dcdec5615dc..4ee8ae6ebfc9 100644
--- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
+++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
@@ -291,12 +291,24 @@ CHAR8 *mProcessorInfoType4Strings[] = {
/***********************************************************************
SMBIOS data definition TYPE7 Cache Information
************************************************************************/
-SMBIOS_TABLE_TYPE7 mCacheInfoType7 = {
+SMBIOS_TABLE_TYPE7 mCacheInfoType7_L1I = {
{ EFI_SMBIOS_TYPE_CACHE_INFORMATION, sizeof (SMBIOS_TABLE_TYPE7), 0 },
1, // SocketDesignation String
- 0x018A, // Cache Configuration
- 0x00FF, // Maximum Size 256k
- 0x00FF, // Install Size 256k
+ 0x380, // Cache Configuration
+ //Cache Level :3 (L1)
+ //Cache Socketed :1 (Not Socketed)
+ //Reserved :1
+ //Location :2 (Internal)
+ //Enabled/Disabled :1 (Enabled)
+ //Operational Mode :2 (Unknown)
+ //Reserved :6
+#if (RPI_MODEL == 4)
+ 0x0030, // Maximum Size (RPi4: 48KB)
+ 0x0030, // Install Size (RPi4: 48KB)
+#else
+ 0x0010, // Maximum Size (RPi3: 16KB)
+ 0x0010, // Install Size (RPi3: 16KB)
+#endif
{ // Supported SRAM Type
0, //Other :1
0, //Unknown :1
@@ -317,16 +329,115 @@ SMBIOS_TABLE_TYPE7 mCacheInfoType7 = {
0, //Asynchronous :1
0 //Reserved :9
},
- 0, // Cache Speed unknown
- CacheErrorMultiBit, // Error Correction Multi
- CacheTypeUnknown, // System Cache Type
- CacheAssociativity2Way // Associativity
+ 0, // Cache Speed unknown
+ CacheErrorParity, // Error Correction
+ CacheTypeInstruction, // System Cache Type
+ CacheAssociativity2Way // Associativity (RPi4 L1 Instruction cache is 3-way set associative, but SMBIOS spec does not define that)
};
-CHAR8 *mCacheInfoType7Strings[] = {
- "Cache1",
+CHAR8 *mCacheInfoType7Strings_L1I[] = {
+ "L1 Instruction",
NULL
};
+SMBIOS_TABLE_TYPE7 mCacheInfoType7_L1D = {
+ { EFI_SMBIOS_TYPE_CACHE_INFORMATION, sizeof (SMBIOS_TABLE_TYPE7), 0 },
+ 1, // SocketDesignation String
+ 0x180, // Cache Configuration
+ //Cache Level :3 (L1)
+ //Cache Socketed :1 (Not Socketed)
+ //Reserved :1
+ //Location :2 (Internal)
+ //Enabled/Disabled :1 (Enabled)
+ //Operational Mode :2 (WB)
+ //Reserved :6
+#if (RPI_MODEL == 4)
+ 0x0020, // Maximum Size (RPi4: 32KB)
+ 0x0020, // Install Size (RPi4: 32KB)
+#else
+ 0x0010, // Maximum Size (RPi3: 16KB)
+ 0x0010, // Install Size (RPi3: 16KB)
+#endif
+ { // Supported SRAM Type
+ 0, //Other :1
+ 0, //Unknown :1
+ 0, //NonBurst :1
+ 1, //Burst :1
+ 0, //PiplelineBurst :1
+ 1, //Synchronous :1
+ 0, //Asynchronous :1
+ 0 //Reserved :9
+ },
+ { // Current SRAM Type
+ 0, //Other :1
+ 0, //Unknown :1
+ 0, //NonBurst :1
+ 1, //Burst :1
+ 0, //PiplelineBurst :1
+ 1, //Synchronous :1
+ 0, //Asynchronous :1
+ 0 //Reserved :9
+ },
+ 0, // Cache Speed unknown
+ CacheErrorSingleBit, // Error Correction
+ CacheTypeData, // System Cache Type
+#if (RPI_MODEL == 4)
+ CacheAssociativity2Way // Associativity
+#else
+ CacheAssociativity4Way // Associativity
+#endif
+};
+CHAR8 *mCacheInfoType7Strings_L1D[] = {
+ "L1 Data",
+ NULL
+};
+
+SMBIOS_TABLE_TYPE7 mCacheInfoType7_L2 = {
+ { EFI_SMBIOS_TYPE_CACHE_INFORMATION, sizeof (SMBIOS_TABLE_TYPE7), 0 },
+ 1, // SocketDesignation String
+ 0x0181, // Cache Configuration
+ //Cache Level :3 (L2)
+ //Cache Socketed :1 (Not Socketed)
+ //Reserved :1
+ //Location :2 (Internal)
+ //Enabled/Disabled :1 (Enabled)
+ //Operational Mode :2 (WB)
+ //Reserved :6
+#if (RPI_MODEL == 4)
+ 0x0400, // Maximum Size (RPi4: 1MB)
+ 0x0400, // Install Size (RPi4: 1MB)
+#else
+ 0x0200, // Maximum Size (RPi3: 512KB)
+ 0x0200, // Install Size (RPi3: 512KB)
+#endif
+ { // Supported SRAM Type
+ 0, //Other :1
+ 0, //Unknown :1
+ 0, //NonBurst :1
+ 1, //Burst :1
+ 0, //PiplelineBurst :1
+ 1, //Synchronous :1
+ 0, //Asynchronous :1
+ 0 //Reserved :9
+ },
+ { // Current SRAM Type
+ 0, //Other :1
+ 0, //Unknown :1
+ 0, //NonBurst :1
+ 1, //Burst :1
+ 0, //PiplelineBurst :1
+ 1, //Synchronous :1
+ 0, //Asynchronous :1
+ 0 //Reserved :9
+ },
+ 0, // Cache Speed unknown
+ CacheErrorSingleBit, // Error Correction Multi
+ CacheTypeUnified, // System Cache Type
+ CacheAssociativity16Way // Associativity
+};
+CHAR8 *mCacheInfoType7Strings_L2[] = {
+ "L2",
+ NULL
+};
/***********************************************************************
SMBIOS data definition TYPE9 System Slot Information
************************************************************************/
@@ -846,7 +957,17 @@ CacheInfoUpdateSmbiosType7 (
VOID
)
{
- LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mCacheInfoType7, mCacheInfoType7Strings, NULL);
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+
+ LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mCacheInfoType7_L1I, mCacheInfoType7Strings_L1I, NULL);
+
+ LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mCacheInfoType7_L1D, mCacheInfoType7Strings_L1D, &SmbiosHandle);
+ // Set Type4 L1CacheHandle to point to the newly added L1 Data Cache
+ mProcessorInfoType4.L1CacheHandle = (UINT16) SmbiosHandle;
+
+ LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mCacheInfoType7_L2, mCacheInfoType7Strings_L2, &SmbiosHandle);
+ // Set Type4 L2CacheHandle to point to the newly added L2 Cache
+ mProcessorInfoType4.L2CacheHandle = (UINT16) SmbiosHandle;
}
/***********************************************************************
@@ -972,11 +1093,10 @@ PlatformSmbiosDriverEntryPoint (
BoardInfoUpdateSmbiosType2 ();
+ CacheInfoUpdateSmbiosType7 (); // Add Type 7 first to get Cache handle for use in Type 4
ProcessorInfoUpdateSmbiosType4 (4); //One example for creating and updating
- CacheInfoUpdateSmbiosType7 ();
-
SysSlotInfoUpdateSmbiosType9 ();
OemStringsUpdateSmbiosType11 ();
--
2.17.1
[-- Attachment #2: Type: text/html, Size: 18663 bytes --]
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [edk2-platform][PATCH v1 4/7] Platforms/RaspberryPi: SMBIOS Type 4 fixes
2020-07-20 18:16 ` [edk2-platform][PATCH v1 4/7] Platforms/RaspberryPi: SMBIOS Type 4 fixes Samer El-Haj-Mahmoud
@ 2020-07-20 21:55 ` Andrei Warkentin
0 siblings, 0 replies; 16+ messages in thread
From: Andrei Warkentin @ 2020-07-20 21:55 UTC (permalink / raw)
To: Samer El-Haj-Mahmoud, devel@edk2.groups.io
Cc: Leif Lindholm, Pete Batard, Ard Biesheuvel
[-- Attachment #1: Type: text/plain, Size: 7824 bytes --]
Reviewed-by: Andrei Warkentin <awarkentin@vmware.com>
________________________________
From: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
Sent: Monday, July 20, 2020 1:16 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Leif Lindholm <leif@nuviainc.com>; Pete Batard <pete@akeo.ie>; Andrei Warkentin <awarkentin@vmware.com>; Ard Biesheuvel <ard.biesheuvel@arm.com>
Subject: [edk2-platform][PATCH v1 4/7] Platforms/RaspberryPi: SMBIOS Type 4 fixes
Various fixes and enhancements for SMBIOS Type 4:
- Fix ProcessorId to correctly report the Arm64 MIDR_EL1 value
- Change ProcessorUpgrade from Other to None
- Add comments for ProcessorCharacteristics fields
- Add CoreCount2, EnabledCoreCount2, and ThreadCount2
- Set LxCacheHandle to 0xFFFF
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Pete Batard <pete@akeo.ie>
Cc: Andrei Warkentin <awarkentin@vmware.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
---
Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf | 1 +
Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c | 87 ++++++++------------
2 files changed, 34 insertions(+), 54 deletions(-)
diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf
index 817b902b1fad..2b24b22c25fc 100644
--- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf
+++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf
@@ -31,6 +31,7 @@ [Packages]
EmbeddedPkg/EmbeddedPkg.dec
[LibraryClasses]
+ ArmLib
UefiBootServicesTableLib
MemoryAllocationLib
BaseMemoryLib
diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
index 21feab3e47a5..4dcdec5615dc 100644
--- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
+++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
@@ -32,6 +32,7 @@
#include <Protocol/Smbios.h>
#include <Protocol/RpiFirmware.h>
#include <Guid/SmBios.h>
+#include <Library/ArmLib.h>
#include <Library/DebugLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiLib.h>
@@ -230,55 +231,13 @@ CHAR8 *mEnclosureInfoType3Strings[] = {
************************************************************************/
SMBIOS_TABLE_TYPE4 mProcessorInfoType4 = {
{ EFI_SMBIOS_TYPE_PROCESSOR_INFORMATION, sizeof (SMBIOS_TABLE_TYPE4), 0},
- 1, // Socket String
- CentralProcessor, // ProcessorType; ///< The enumeration value from PROCESSOR_TYPE_DATA.
+ 1, // Socket String
+ CentralProcessor, // ProcessorType; ///< The enumeration value from PROCESSOR_TYPE_DATA.
ProcessorFamilyIndicatorFamily2, // ProcessorFamily; ///< The enumeration value from PROCESSOR_FAMILY2_DATA.
- 2, // ProcessorManufacture String;
- { // ProcessorId;
- { // PROCESSOR_SIGNATURE
- 0, // ProcessorSteppingId:4;
- 0, // ProcessorModel: 4;
- 0, // ProcessorFamily: 4;
- 0, // ProcessorType: 2;
- 0, // ProcessorReserved1: 2;
- 0, // ProcessorXModel: 4;
- 0, // ProcessorXFamily: 8;
- 0, // ProcessorReserved2: 4;
- },
-
- { // PROCESSOR_FEATURE_FLAGS
- 0, // ProcessorFpu :1;
- 0, // ProcessorVme :1;
- 0, // ProcessorDe :1;
- 0, // ProcessorPse :1;
- 0, // ProcessorTsc :1;
- 0, // ProcessorMsr :1;
- 0, // ProcessorPae :1;
- 0, // ProcessorMce :1;
- 0, // ProcessorCx8 :1;
- 0, // ProcessorApic :1;
- 0, // ProcessorReserved1 :1;
- 0, // ProcessorSep :1;
- 0, // ProcessorMtrr :1;
- 0, // ProcessorPge :1;
- 0, // ProcessorMca :1;
- 0, // ProcessorCmov :1;
- 0, // ProcessorPat :1;
- 0, // ProcessorPse36 :1;
- 0, // ProcessorPsn :1;
- 0, // ProcessorClfsh :1;
- 0, // ProcessorReserved2 :1;
- 0, // ProcessorDs :1;
- 0, // ProcessorAcpi :1;
- 0, // ProcessorMmx :1;
- 0, // ProcessorFxsr :1;
- 0, // ProcessorSse :1;
- 0, // ProcessorSse2 :1;
- 0, // ProcessorSs :1;
- 0, // ProcessorReserved3 :1;
- 0, // ProcessorTm :1;
- 0, // ProcessorReserved4 :2;
- }
+ 2, // ProcessorManufacture String;
+ { // ProcessorId;
+ { 0x00, 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00, 0x00 }
},
3, // ProcessorVersion String;
{ // Voltage;
@@ -293,18 +252,31 @@ SMBIOS_TABLE_TYPE4 mProcessorInfoType4 = {
0, // MaxSpeed;
0, // CurrentSpeed;
0x41, // Status;
- ProcessorUpgradeOther, // ProcessorUpgrade; ///< The enumeration value from PROCESSOR_UPGRADE.
- 0, // L1CacheHandle;
- 0, // L2CacheHandle;
- 0, // L3CacheHandle;
+ ProcessorUpgradeNone, // ProcessorUpgrade; ///< The enumeration value from PROCESSOR_UPGRADE.
+ 0xFFFF, // L1CacheHandle;
+ 0xFFFF, // L2CacheHandle;
+ 0xFFFF, // L3CacheHandle;
0, // SerialNumber;
0, // AssetTag;
0, // PartNumber;
4, // CoreCount;
4, // EnabledCoreCount;
4, // ThreadCount;
- 0x6C, // ProcessorCharacteristics;
+ 0x6C, // ProcessorCharacteristics; ///< The enumeration value from PROCESSOR_CHARACTERISTIC_FLAGS
+ // ProcessorReserved1 :1;
+ // ProcessorUnknown :1;
+ // Processor64BitCapble :1;
+ // ProcessorMultiCore :1;
+ // ProcessorHardwareThread :1;
+ // ProcessorExecuteProtection :1;
+ // ProcessorEnhancedVirtualization :1;
+ // ProcessorPowerPerformanceCtrl :1;
+ // Processor128bitCapble :1;
+ // ProcessorReserved2 :7;
ProcessorFamilyARM, // ARM Processor Family;
+ 0, // CoreCount2;
+ 0, // EnabledCoreCount2;
+ 0, // ThreadCount2;
};
CHAR8 mCpuName[128] = "Unknown ARM CPU";
@@ -832,11 +804,15 @@ ProcessorInfoUpdateSmbiosType4 (
)
{
EFI_STATUS Status;
- UINT32 Rate;
+ UINT32 Rate;
+ UINT64 *ProcessorId;
mProcessorInfoType4.CoreCount = (UINT8)MaxCpus;
+ mProcessorInfoType4.CoreCount2 = (UINT8)MaxCpus;
mProcessorInfoType4.EnabledCoreCount = (UINT8)MaxCpus;
+ mProcessorInfoType4.EnabledCoreCount2 = (UINT8)MaxCpus;
mProcessorInfoType4.ThreadCount = (UINT8)MaxCpus;
+ mProcessorInfoType4.ThreadCount2 = (UINT8)MaxCpus;
Status = mFwProtocol->GetMaxClockRate (RPI_MBOX_CLOCK_RATE_ARM, &Rate);
if (Status != EFI_SUCCESS) {
@@ -856,6 +832,9 @@ ProcessorInfoUpdateSmbiosType4 (
AsciiStrCpyS (mCpuName, sizeof (mCpuName), mFwProtocol->GetCpuName (-1));
+ ProcessorId = (UINT64 *)&(mProcessorInfoType4.ProcessorId);
+ *ProcessorId = ArmReadMidr();
+
LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mProcessorInfoType4, mProcessorInfoType4Strings, NULL);
}
--
2.17.1
[-- Attachment #2: Type: text/html, Size: 16353 bytes --]
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [edk2-platform][PATCH v1 6/7] Platforms/RaspberryPi: SMBIOS Memory Types fixes
2020-07-20 18:16 ` [edk2-platform][PATCH v1 6/7] Platforms/RaspberryPi: SMBIOS Memory Types fixes Samer El-Haj-Mahmoud
@ 2020-07-20 21:55 ` Andrei Warkentin
0 siblings, 0 replies; 16+ messages in thread
From: Andrei Warkentin @ 2020-07-20 21:55 UTC (permalink / raw)
To: Samer El-Haj-Mahmoud, devel@edk2.groups.io
Cc: Leif Lindholm, Pete Batard, Ard Biesheuvel
[-- Attachment #1: Type: text/plain, Size: 9772 bytes --]
Reviewed-by: Andrei Warkentin <awarkentin@vmware.com>
________________________________
From: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
Sent: Monday, July 20, 2020 1:16 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Leif Lindholm <leif@nuviainc.com>; Pete Batard <pete@akeo.ie>; Andrei Warkentin <awarkentin@vmware.com>; Ard Biesheuvel <ard.biesheuvel@arm.com>
Subject: [edk2-platform][PATCH v1 6/7] Platforms/RaspberryPi: SMBIOS Memory Types fixes
Various fixes and enhancements for SMBIOS memory structures
(Types 16, 17, and 19):
- Type 16:
- Update MaximumCapacity dynamically
- Keep ExtendedMaximumCapacity at 0 (not used, per spec)
- Type 17:
- Update Size and VolatileSize dynamically
- Change FormFactor from Unknown to Chip
- Set DeviceSet to 0 (not part of set) instead of 0xFF (unknown)
- Fix the DeviceLocator, BankLocator, and Manufacturer strings
- Update MemoryType correctly for RPi4 and RPi3
- Add additional SMBIOS fields from 3.3 definition
- Type 19:
- Update MemoryArrayHandle to point to Type 16 handle
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Pete Batard <pete@akeo.ie>
Cc: Andrei Warkentin <awarkentin@vmware.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
---
Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c | 115 ++++++++++++++------
1 file changed, 83 insertions(+), 32 deletions(-)
diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
index 4ee8ae6ebfc9..d382797602ce 100644
--- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
+++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
@@ -496,10 +496,10 @@ SMBIOS_TABLE_TYPE16 mPhyMemArrayInfoType16 = {
MemoryArrayLocationSystemBoard, // Location; ///< The enumeration value from MEMORY_ARRAY_LOCATION.
MemoryArrayUseSystemMemory, // Use; ///< The enumeration value from MEMORY_ARRAY_USE.
MemoryErrorCorrectionUnknown, // MemoryErrorCorrection; ///< The enumeration value from MEMORY_ERROR_CORRECTION.
- 0x40000000, // MaximumCapacity;
+ 0x00000000, // MaximumCapacity;
0xFFFE, // MemoryErrorInformationHandle;
1, // NumberOfMemoryDevices;
- 0x40000000ULL, // ExtendedMaximumCapacity;
+ 0x00000000ULL, // ExtendedMaximumCapacity;
};
CHAR8 *mPhyMemArrayInfoType16Strings[] = {
NULL
@@ -510,18 +510,23 @@ CHAR8 *mPhyMemArrayInfoType16Strings[] = {
************************************************************************/
SMBIOS_TABLE_TYPE17 mMemDevInfoType17 = {
{ EFI_SMBIOS_TYPE_MEMORY_DEVICE, sizeof (SMBIOS_TABLE_TYPE17), 0 },
- 0, // MemoryArrayHandle; // Should match SMBIOS_TABLE_TYPE16.Handle, initialized at runtime, refer to PhyMemArrayInfoUpdateSmbiosType16()
- 0xFFFE, // MemoryErrorInformationHandle;
- 0xFFFF, // TotalWidth;
- 0xFFFF, // DataWidth;
- 0x0400, // Size; // When bit 15 is 0: Size in MB
- // When bit 15 is 1: Size in KB, and continues in ExtendedSize
- MemoryFormFactorUnknown, // FormFactor; ///< The enumeration value from MEMORY_FORM_FACTOR.
- 0xff, // DeviceSet;
- 1, // DeviceLocator String
- 2, // BankLocator String
- MemoryTypeDram, // MemoryType; ///< The enumeration value from MEMORY_DEVICE_TYPE.
- { // TypeDetail;
+ 0, // MemoryArrayHandle; // Should match SMBIOS_TABLE_TYPE16.Handle, initialized at runtime, refer to PhyMemArrayInfoUpdateSmbiosType16()
+ 0xFFFE, // MemoryErrorInformationHandle; (not provided)
+ 0xFFFF, // TotalWidth; (unknown)
+ 0xFFFF, // DataWidth; (unknown)
+ 0xFFFF, // Size; // When bit 15 is 0: Size in MB
+ // When bit 15 is 1: Size in KB, and continues in ExtendedSize
+ // initialized at runtime, refer to PhyMemArrayInfoUpdateSmbiosType16()
+ MemoryFormFactorChip, // FormFactor; ///< The enumeration value from MEMORY_FORM_FACTOR.
+ 0, // DeviceSet;
+ 1, // DeviceLocator String
+ 0, // BankLocator String
+#if (RPI_MODEL == 4)
+ MemoryTypeLpddr4, // MemoryType; ///< The enumeration value from MEMORY_DEVICE_TYPE.
+#else
+ MemoryTypeLpddr2, // MemoryType; ///< The enumeration value from MEMORY_DEVICE_TYPE.
+#endif
+ { // TypeDetail;
0, // Reserved :1;
0, // Other :1;
1, // Unknown :1;
@@ -539,19 +544,42 @@ SMBIOS_TABLE_TYPE17 mMemDevInfoType17 = {
0, // Unbuffered :1;
0, // Reserved1 :1;
},
- 0, // Speed;
- 3, // Manufacturer String
- 0, // SerialNumber String
- 0, // AssetTag String
- 0, // PartNumber String
- 0, // Attributes;
- 0, // ExtendedSize;
- 0, // ConfiguredMemoryClockSpeed;
+ 0, // Speed; (unknown)
+ 2, // Manufacturer String
+ 0, // SerialNumber String
+ 0, // AssetTag String
+ 0, // PartNumber String
+ 0, // Attributes; (unknown rank)
+ 0, // ExtendedSize; (since Size < 32GB-1)
+ 0, // ConfiguredMemoryClockSpeed; (unknown)
+ 0, // MinimumVoltage; (unknown)
+ 0, // MaximumVoltage; (unknown)
+ 0, // ConfiguredVoltage; (unknown)
+ MemoryTechnologyDram, // MemoryTechnology ///< The enumeration value from MEMORY_DEVICE_TECHNOLOGY
+ {{ // MemoryOperatingModeCapability
+ 0, // Reserved :1;
+ 0, // Other :1;
+ 0, // Unknown :1;
+ 1, // VolatileMemory :1;
+ 0, // ByteAccessiblePersistentMemory :1;
+ 0, // BlockAccessiblePersistentMemory :1;
+ 0 // Reserved :10;
+ }},
+ 0, // FirwareVersion
+ 0, // ModuleManufacturerID (unknown)
+ 0, // ModuleProductID (unknown)
+ 0, // MemorySubsystemControllerManufacturerID (unknown)
+ 0, // MemorySubsystemControllerProductID (unknown)
+ 0, // NonVolatileSize
+ 0xFFFFFFFFFFFFFFFFULL,// VolatileSize // initialized at runtime, refer to PhyMemArrayInfoUpdateSmbiosType16()
+ 0, // CacheSize
+ 0, // LogicalSize (since MemoryType is not MemoryTypeLogicalNonVolatileDevice)
+ 0, // ExtendedSpeed,
+ 0 // ExtendedConfiguredMemorySpeed
};
CHAR8 *mMemDevInfoType17Strings[] = {
- "OS Virtual Memory",
- "malloc",
- "OSV",
+ "SDRAM",
+ "Micron",
NULL
};
@@ -562,10 +590,10 @@ SMBIOS_TABLE_TYPE19 mMemArrMapInfoType19 = {
{ EFI_SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS, sizeof (SMBIOS_TABLE_TYPE19), 0 },
0x00000000, // StartingAddress;
0x00000000, // EndingAddress;
- 0, // MemoryArrayHandle;
+ 0, // MemoryArrayHandle; // Should match SMBIOS_TABLE_TYPE16.Handle, initialized at runtime, refer to PhyMemArrayInfoUpdateSmbiosType16()
1, // PartitionWidth;
- 0, // ExtendedStartingAddress;
- 0, // ExtendedEndingAddress;
+ 0, // ExtendedStartingAddress; // not used
+ 0, // ExtendedEndingAddress; // not used
};
CHAR8 *mMemArrMapInfoType19Strings[] = {
NULL
@@ -1000,14 +1028,37 @@ PhyMemArrayInfoUpdateSmbiosType16 (
VOID
)
{
- EFI_SMBIOS_HANDLE MemArraySmbiosHande;
+ EFI_SMBIOS_HANDLE MemArraySmbiosHandle;
+ EFI_STATUS Status;
+ UINT32 InstalledMB = 0;
- LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mPhyMemArrayInfoType16, mPhyMemArrayInfoType16Strings, &MemArraySmbiosHande);
+ //
+ // Update memory size fields:
+ // - Type 16 MaximumCapacity in KB
+ // - Type 17 size in MB (since bit 15 = 0)
+ // - Type 17 VolatileSize in Bytes
+ //
+
+ // The minimum RAM size used on any Raspberry Pi model is 256 MB
+ mMemDevInfoType17.Size = 256;
+
+ Status = mFwProtocol->GetModelInstalledMB (&InstalledMB);
+ if (Status != EFI_SUCCESS) {
+ DEBUG ((DEBUG_WARN, "Couldn't get the board memory size - defaulting to 256 MB: %r\n", Status));
+ } else {
+ mMemDevInfoType17.Size = InstalledMB; // Size in MB
+ }
+
+ mPhyMemArrayInfoType16.MaximumCapacity = mMemDevInfoType17.Size * 1024; // Size in KB
+ mMemDevInfoType17.VolatileSize = MultU64x32 (mMemDevInfoType17.Size, 1024 * 1024); // Size in Bytes
+
+ LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mPhyMemArrayInfoType16, mPhyMemArrayInfoType16Strings, &MemArraySmbiosHandle);
//
- // Update the memory device information
+ // Update the memory device information and memory array map with the newly added type 16 handle
//
- mMemDevInfoType17.MemoryArrayHandle = MemArraySmbiosHande;
+ mMemDevInfoType17.MemoryArrayHandle = MemArraySmbiosHandle;
+ mMemArrMapInfoType19.MemoryArrayHandle = MemArraySmbiosHandle;
}
/***********************************************************************
--
2.17.1
[-- Attachment #2: Type: text/html, Size: 19310 bytes --]
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [edk2-platform][PATCH v1 7/7] Platforms/RaspberryPi: SMBIOS minor cleanup
2020-07-20 18:16 ` [edk2-platform][PATCH v1 7/7] Platforms/RaspberryPi: SMBIOS minor cleanup Samer El-Haj-Mahmoud
@ 2020-08-12 16:27 ` Pete Batard
0 siblings, 0 replies; 16+ messages in thread
From: Pete Batard @ 2020-08-12 16:27 UTC (permalink / raw)
To: Samer El-Haj-Mahmoud, devel
Cc: Leif Lindholm, Andrei Warkentin, Ard Biesheuvel
From what I could see, Andrei already sent a R-b for 1-6, thus:
On 2020.07.20 19:16, Samer El-Haj-Mahmoud wrote:
> Minor code cleanup:
> - Update file header to list SBBR required/recommended tables
> - Rename DataSmbiosHande to DataSmbiosHandle
> - Remove SMBIOS_HANDLE_PI_RESERVED from Type 11 template for
> consistency. This is already done in LogSmbiosData().
>
> Cc: Leif Lindholm <leif@nuviainc.com>
> Cc: Pete Batard <pete@akeo.ie>
> Cc: Andrei Warkentin <awarkentin@vmware.com>
> Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
> Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
> ---
> Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c | 43 ++++++++++++--------
> 1 file changed, 25 insertions(+), 18 deletions(-)
>
> diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
> index d382797602ce..d955291c5bb7 100644
> --- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
> +++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
> @@ -1,20 +1,27 @@
> /** @file
> *
> - * Static SMBIOS Table for ARM platform
> + * Static SMBIOS Table for the RaspberryPi platform
> * Derived from EmulatorPkg package
> *
> - * Note SMBIOS 2.7.1 Required structures:
> - * BIOS Information (Type 0)
> - * System Information (Type 1)
> - * Board Information (Type 2)
> - * System Enclosure (Type 3)
> - * Processor Information (Type 4) - CPU Driver
> - * Cache Information (Type 7) - For cache that is external to processor
> - * System Slots (Type 9) - If system has slots
> - * Physical Memory Array (Type 16)
> - * Memory Device (Type 17) - For each socketed system-memory Device
> - * Memory Array Mapped Address (Type 19) - One per contiguous block per Physical Memroy Array
> - * System Boot Information (Type 32)
> + * Note - Arm SBBR ver 1.2 required and recommended SMBIOS structures:
> + * BIOS Information (Type 0)
> + * System Information (Type 1)
> + * Board Information (Type 2) - Recommended
> + * System Enclosure (Type 3)
> + * Processor Information (Type 4) - CPU Driver
> + * Cache Information (Type 7) - For cache that is external to processor
> + * Port Information (Type 8) - Recommended for platforms with physical ports
> + * System Slots (Type 9) - If system has slots
> + * OEM Strings (Type 11) - Recommended
> + * BIOS Language Information (Type 13) - Recommended
> + * System Event Log (Type 15) - Recommended (does not exit on RPi)
> + * Physical Memory Array (Type 16)
> + * Memory Device (Type 17) - For each socketed system-memory Device
> + * Memory Array Mapped Address (Type 19) - One per contiguous block per Physical Memroy Array
> + * System Boot Information (Type 32)
> + * IPMI Device Information (Type 38) - Required for platforms with IPMIv1.0 BMC Host Interface (not applicable to RPi)
> + * Onboard Devices Extended Information (Type 41) - Recommended
> + * Redfish Host Interface (Type 42) - Required for platforms supporting Redfish Host Interface (not applicable to RPi)
> *
> * Copyright (c) 2017-2018, Andrey Warkentin <andrey.warkentin@gmail.com>
> * Copyright (c) 2013, Linaro.org
> @@ -480,7 +487,7 @@ CHAR8 *mSysSlotInfoType9Strings[] = {
> ************************************************************************/
>
> SMBIOS_TABLE_TYPE11 mOemStringsType11 = {
> - { EFI_SMBIOS_TYPE_OEM_STRINGS, sizeof (SMBIOS_TABLE_TYPE11), SMBIOS_HANDLE_PI_RESERVED },
> + { EFI_SMBIOS_TYPE_OEM_STRINGS, sizeof (SMBIOS_TABLE_TYPE11), 0 },
> 1 // StringCount
> };
> CHAR8 *mOemStringsType11Strings[] = {
> @@ -641,7 +648,7 @@ CHAR8 *mBootInfoType32Strings[] = {
> @param Template Fixed SMBIOS structure, required.
> @param StringPack Array of strings to convert to an SMBIOS string pack.
> NULL is OK.
> - @param DataSmbiosHande The new SMBIOS record handle .
> + @param DataSmbiosHandle The new SMBIOS record handle.
> NULL is OK.
> **/
>
> @@ -650,7 +657,7 @@ EFIAPI
> LogSmbiosData (
> IN EFI_SMBIOS_TABLE_HEADER *Template,
> IN CHAR8 **StringPack,
> - OUT EFI_SMBIOS_HANDLE *DataSmbiosHande
> + OUT EFI_SMBIOS_HANDLE *DataSmbiosHandle
> )
> {
> EFI_STATUS Status;
> @@ -716,8 +723,8 @@ LogSmbiosData (
> Record
> );
>
> - if ((Status == EFI_SUCCESS) && (DataSmbiosHande != NULL)) {
> - *DataSmbiosHande = SmbiosHandle;
> + if ((Status == EFI_SUCCESS) && (DataSmbiosHandle != NULL)) {
> + *DataSmbiosHandle = SmbiosHandle;
> }
>
> ASSERT_EFI_ERROR (Status);
>
Reviewed-by: Pete Batard <pete@akeo.ie>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [edk2-platform][PATCH v1 0/7] Platform/RaspberryPi : SMBIOS fixes and cleanup
2020-07-20 18:16 [edk2-platform][PATCH v1 0/7] Platform/RaspberryPi : SMBIOS fixes and cleanup Samer El-Haj-Mahmoud
` (6 preceding siblings ...)
2020-07-20 18:16 ` [edk2-platform][PATCH v1 7/7] Platforms/RaspberryPi: SMBIOS minor cleanup Samer El-Haj-Mahmoud
@ 2020-08-13 13:47 ` Ard Biesheuvel
7 siblings, 0 replies; 16+ messages in thread
From: Ard Biesheuvel @ 2020-08-13 13:47 UTC (permalink / raw)
To: Samer El-Haj-Mahmoud, devel; +Cc: Leif Lindholm, Pete Batard, Andrei Warkentin
On 7/20/20 8:16 PM, Samer El-Haj-Mahmoud wrote:
> Fixes and enhancements to RaspberryPi SMBIOS Types 0, 2, 3, 4, 7, 16, 17, and 19.
> These were compared against SMBIOS spec ver 3.3, and SBBR ver 1.2, and tested
> in UEFI Shell with smbiosview.
>
> One issue found in smbiosview (for Type 17, "VolatileSize") and
> will be fixed as a seperate patch.
>
> This series addresses :
> - Most items in https://github.com/pftf/RPi4/issues/16
> - One of the issues in https://github.com/pftf/RPi4/issues/75
>
> Series pushed to:
> https://github.com/samerhaj/edk2-platforms/tree/rpi_smbios_fixes_v1
>
> Cc: Leif Lindholm <leif@nuviainc.com>
> Cc: Pete Batard <pete@akeo.ie>
> Cc: Andrei Warkentin <awarkentin@vmware.com>
> Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
> Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
>
> Samer El-Haj-Mahmoud (7):
> Platforms/RaspberryPi: Fix NULL AssetTag in SMBIOS
> Platforms/RaspberryPi: SMBIOS Type 2 and Type 3 fixes
> Platforms/RaspberryPi: SMBIOS Type 0 fixes
> Platforms/RaspberryPi: SMBIOS Type 4 fixes
> Platforms/RaspberryPi: SMBIOS Type 7 fixes
> Platforms/RaspberryPi: SMBIOS Memory Types fixes
> Platforms/RaspberryPi: SMBIOS minor cleanup
>
Thanks
Pushed as e28ea561e07b..f2e4f25b83bf
> .../PlatformSmbiosDxe/PlatformSmbiosDxe.inf | 7 +-
> .../PlatformSmbiosDxe/PlatformSmbiosDxe.c | 457 ++++++++++++------
> 2 files changed, 320 insertions(+), 144 deletions(-)
>
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2020-08-13 13:47 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-20 18:16 [edk2-platform][PATCH v1 0/7] Platform/RaspberryPi : SMBIOS fixes and cleanup Samer El-Haj-Mahmoud
2020-07-20 18:16 ` [edk2-platform][PATCH v1 1/7] Platforms/RaspberryPi: Fix NULL AssetTag in SMBIOS Samer El-Haj-Mahmoud
2020-07-20 21:52 ` Andrei Warkentin
2020-07-20 18:16 ` [edk2-platform][PATCH v1 2/7] Platforms/RaspberryPi: SMBIOS Type 2 and Type 3 fixes Samer El-Haj-Mahmoud
2020-07-20 21:53 ` Andrei Warkentin
2020-07-20 18:16 ` [edk2-platform][PATCH v1 3/7] Platforms/RaspberryPi: SMBIOS Type 0 fixes Samer El-Haj-Mahmoud
2020-07-20 21:53 ` Andrei Warkentin
2020-07-20 18:16 ` [edk2-platform][PATCH v1 4/7] Platforms/RaspberryPi: SMBIOS Type 4 fixes Samer El-Haj-Mahmoud
2020-07-20 21:55 ` Andrei Warkentin
2020-07-20 18:16 ` [edk2-platform][PATCH v1 5/7] Platforms/RaspberryPi: SMBIOS Type 7 fixes Samer El-Haj-Mahmoud
2020-07-20 21:54 ` Andrei Warkentin
2020-07-20 18:16 ` [edk2-platform][PATCH v1 6/7] Platforms/RaspberryPi: SMBIOS Memory Types fixes Samer El-Haj-Mahmoud
2020-07-20 21:55 ` Andrei Warkentin
2020-07-20 18:16 ` [edk2-platform][PATCH v1 7/7] Platforms/RaspberryPi: SMBIOS minor cleanup Samer El-Haj-Mahmoud
2020-08-12 16:27 ` Pete Batard
2020-08-13 13:47 ` [edk2-platform][PATCH v1 0/7] Platform/RaspberryPi : SMBIOS fixes and cleanup Ard Biesheuvel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox