From: "Pranav Madhu" <pranav.madhu@arm.com>
To: devel@edk2.groups.io
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>,
Sami Mujawar <sami.mujawar@arm.com>
Subject: [edk2-platforms][PATCH V2 11/11] Platform/Sgi: Add SMBIOS Type32 Table
Date: Sun, 16 May 2021 14:59:17 +0530 [thread overview]
Message-ID: <20210516092917.21124-12-pranav.madhu@arm.com> (raw)
In-Reply-To: <20210516092917.21124-1-pranav.madhu@arm.com>
Add the SMBIOS type 32 table (System Boot Information) that includes
information about the System Boot Status.
Signed-off-by: Pranav Madhu <pranav.madhu@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 | 84 ++++++++++++++++++++
4 files changed, 92 insertions(+)
diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
index f81494114188..4258eb9deadb 100644
--- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
+++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
@@ -23,6 +23,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 c6dd72cb6b99..0bbda4b4b45d 100644
--- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h
+++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h
@@ -59,6 +59,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 d5d1e6393184..77b22678f62a 100644
--- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c
+++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c
@@ -34,6 +34,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..1d3eaab810eb
--- /dev/null
+++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type32SystemBootInformation.c
@@ -0,0 +1,84 @@
+/** @file
+ SMBIOS Type 32 (System Boot Information) table for ARM RD platforms.
+
+ This file installs SMBIOS Type 32 (System Boot Information) table for Arm's
+ Reference Design platforms. It includes information about the System Boot
+ Status.
+
+ Copyright (c) 2021, ARM Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Specification Reference:
+ - SMBIOS Reference Specification 3.4.0, Chapter 7.33
+**/
+
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.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 */
+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 system boot information
+
+ Install the SMBIOS system boot information (type 32) table for RD platforms.
+
+ @param[in] Smbios SMBIOS protocol.
+
+ @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;
+
+ /* Install type 32 table */
+ Status = Smbios->Add (
+ Smbios,
+ NULL,
+ &SmbiosHandle,
+ (EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType32
+ );
+ if (Status != EFI_SUCCESS) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "SMBIOS: Failed to install Type32 SMBIOS table.\n"
+ ));
+ }
+
+ return Status;
+}
--
2.17.1
next prev parent reply other threads:[~2021-05-16 9:29 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-16 9:29 [edk2-platforms][PATCH V2 00/11] Add SMBIOS tables for Arm's Reference Design platforms Pranav Madhu
2021-05-16 9:29 ` [edk2-platforms][PATCH V2 01/11] Platform/Sgi: Define RD-N2 platform id values Pranav Madhu
2021-05-17 15:32 ` Sami Mujawar
2021-05-16 9:29 ` [edk2-platforms][PATCH V2 02/11] Platform/Sgi: Add GetProductId API for SGI/RD Platforms Pranav Madhu
2021-05-17 15:32 ` Sami Mujawar
2021-05-16 9:29 ` [edk2-platforms][PATCH V2 03/11] Platform/Sgi: Add Initial SMBIOS support Pranav Madhu
2021-05-17 15:33 ` Sami Mujawar
2021-05-16 9:29 ` [edk2-platforms][PATCH V2 04/11] Platform/Sgi: Add SMBIOS Type1 Table Pranav Madhu
2021-05-17 15:33 ` Sami Mujawar
2021-05-16 9:29 ` [edk2-platforms][PATCH V2 05/11] Platform/Sgi: Add SMBIOS Type3 Table Pranav Madhu
2021-05-17 15:33 ` Sami Mujawar
2021-05-16 9:29 ` [edk2-platforms][PATCH V2 06/11] Platform/Sgi: Add SMBIOS Type4 Table Pranav Madhu
2021-05-17 15:33 ` Sami Mujawar
2021-05-16 9:29 ` [edk2-platforms][PATCH V2 07/11] Platform/Sgi: Add SMBIOS Type7 Table Pranav Madhu
2021-05-17 15:33 ` Sami Mujawar
2021-05-16 9:29 ` [edk2-platforms][PATCH V2 08/11] Platform/Sgi: Add SMBIOS Type16 Table Pranav Madhu
2021-05-17 15:33 ` Sami Mujawar
2021-05-16 9:29 ` [edk2-platforms][PATCH V2 09/11] Platform/Sgi: Add SMBIOS Type17 Table Pranav Madhu
2021-05-17 15:33 ` Sami Mujawar
2021-05-16 9:29 ` [edk2-platforms][PATCH V2 10/11] Platform/Sgi: Add SMBIOS Type19 Table Pranav Madhu
2021-05-17 15:33 ` Sami Mujawar
2021-05-16 9:29 ` Pranav Madhu [this message]
2021-05-17 15:33 ` [edk2-platforms][PATCH V2 11/11] Platform/Sgi: Add SMBIOS Type32 Table Sami Mujawar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210516092917.21124-12-pranav.madhu@arm.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox