[edk2-devel] [edk2-platforms][PATCH V1 11/11] Platform/ARM/SgiPkg: Add SMBIOS Type32 Table
Pranav Madhu
pranav.madhu at arm.com
Fri Jan 15 18:26:48 UTC 2021
Add the SMBIOS type 32 table (System Boot Information) that includes
information about the System Boot Status.
Signed-off-by: Pranav Madhu <pranav.madhu at arm.com>
---
Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 1 +
Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h | 6 ++
Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 1 +
Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type32SystemBootInformation.c | 66 ++++++++++++++++++++
4 files changed, 74 insertions(+)
diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
index 15db3d05b6b6..bb4cbbaf9ddd 100644
--- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
+++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
@@ -33,6 +33,7 @@
Type16PhysicalMemoryArray.c
Type17MemoryDevice.c
Type19MemoryArrayMappedAddress.c
+ Type32SystemBootInformation.c
[Packages]
ArmPkg/ArmPkg.dec
diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h
index 1cd66b759446..924b4f77f5f5 100644
--- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h
+++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h
@@ -57,6 +57,12 @@ InstallMemoryArrayMappedAddress (
IN EFI_SMBIOS_PROTOCOL *Smbios
);
+EFI_STATUS
+EFIAPI
+InstallSystemBootInformation (
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ );
+
enum SMBIOS_REFRENCE_HANDLES {
SMBIOS_HANDLE_ENCLOSURE = 0x1000,
SMBIOS_HANDLE_CLUSTER1,
diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c
index 847260b24750..3b56edc13ef2 100644
--- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c
+++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c
@@ -29,6 +29,7 @@ ARM_RD_SMBIOS_TABLE_INSTALL_FPTR mSmbiosTableList[] = {
&InstallPhysicalMemoryArray,
&InstallMemoryDevice,
&InstallMemoryArrayMappedAddress,
+ &InstallSystemBootInformation,
};
/**
diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type32SystemBootInformation.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type32SystemBootInformation.c
new file mode 100644
index 000000000000..4fec8a833141
--- /dev/null
+++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type32SystemBootInformation.c
@@ -0,0 +1,66 @@
+/** @file
+ SMBIOS Type 32 (System Boot Information) table for ARM RD platforms.
+
+ Copyright (c) 2020-2021, ARM Limited. All rights reserved.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Library/BaseMemoryLib.h>
+#include <Protocol/Smbios.h>
+
+#include "SmbiosPlatformDxe.h"
+
+#define TYPE32_STRINGS \
+ "\0" /* Null string */
+
+/* SMBIOS Type32 structure */
+#pragma pack(1)
+struct ArmRdSmbiosType32 {
+ SMBIOS_TABLE_TYPE32 Base;
+ UINT8 Strings[sizeof (TYPE32_STRINGS)];
+};
+#pragma pack()
+
+/* System Boot Information (SMBIOS 3.4 spec, section 7.33) */
+static struct ArmRdSmbiosType32 mArmRdSmbiosType32 = {
+ {
+ {
+ // SMBIOS header
+ EFI_SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION, // Type 32
+ sizeof (SMBIOS_TABLE_TYPE32), // Length
+ SMBIOS_HANDLE_PI_RESERVED
+ },
+ {0}, // Reserved field
+ BootInformationStatusNoError // Boot status
+ },
+ // Text strings (unformatted area)
+ TYPE32_STRINGS
+};
+
+/**
+ Install SMBIOS Bios information Table
+
+ @retval EFI_SUCCESS Record was added.
+ @retval EFI_OUT_OF_RESOURCES Record was not added.
+ @retval EFI_ALREADY_STARTED The SmbiosHandle passed in is already in use.
+**/
+EFI_STATUS
+InstallSystemBootInformation (
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ )
+{
+ EFI_STATUS Status;
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+
+ SmbiosHandle = ((EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType32)->Handle;
+
+ Status = Smbios->Add (
+ Smbios,
+ NULL,
+ &SmbiosHandle,
+ (EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType32
+ );
+ return Status;
+}
--
2.17.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70448): https://edk2.groups.io/g/devel/message/70448
Mute This Topic: https://groups.io/mt/79709200/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list