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 V4 05/11] Platform/Sgi: Add SMBIOS Type3 Table
Date: Mon, 24 May 2021 19:58:10 +0530 [thread overview]
Message-ID: <20210524142816.9967-6-pranav.madhu@arm.com> (raw)
In-Reply-To: <20210524142816.9967-1-pranav.madhu@arm.com>
Add the SMBIOS type 3 table (System Enclosure) that includes information
about manufacturer, type, serial number and other information related to
system enclosure.
Signed-off-by: Pranav Madhu <pranav.madhu@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
---
Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 1 +
Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h | 22 +++++
Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 1 +
Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type3SystemEnclosure.c | 103 ++++++++++++++++++++
4 files changed, 127 insertions(+)
diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
index f7beb1c66c80..b3c1619ddc66 100644
--- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
+++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
@@ -17,6 +17,7 @@
SmbiosPlatformDxe.c
Type0BiosInformation.c
Type1SystemInformation.c
+ Type3SystemEnclosure.c
[Packages]
ArmPkg/ArmPkg.dec
diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h
index e2437b109899..fc18cfc9f369 100644
--- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h
+++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h
@@ -48,4 +48,26 @@ InstallType1SystemInformation (
IN EFI_SMBIOS_PROTOCOL *Smbios
);
+/**
+ Install SMBIOS System Enclosure Table
+
+ Install the SMBIOS System Enclosure (type 3) table for Arm's Reference Design
+ 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 is already in use.
+**/
+EFI_STATUS
+EFIAPI
+InstallType3SystemEnclosure (
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ );
+
+typedef enum {
+ SMBIOS_HANDLE_ENCLOSURE = 0x1000,
+} SMBIOS_REFRENCE_HANDLES;
+
#endif // SMBIOS_PLATFORM_DXE_H_
diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c
index b9ce50c82b4c..ac4c6120841f 100644
--- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c
+++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c
@@ -28,6 +28,7 @@ STATIC CONST
ARM_RD_SMBIOS_TABLE_INSTALL_FPTR mSmbiosTableList[] = {
&InstallType0BiosInformation,
&InstallType1SystemInformation,
+ &InstallType3SystemEnclosure,
};
/**
diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type3SystemEnclosure.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type3SystemEnclosure.c
new file mode 100644
index 000000000000..146852eb4ae6
--- /dev/null
+++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type3SystemEnclosure.c
@@ -0,0 +1,103 @@
+/** @file
+ SMBIOS Type 3 (System enclosure) table for ARM RD platforms.
+
+ This file installs SMBIOS Type 3 (System enclosure) table for Arm Reference
+ Design platforms. SMBIOS Type 3 table (System Enclosure) includes information
+ about manufacturer, type, serial number and other information related to
+ system enclosure.
+
+ 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.4
+**/
+
+#include <Library/DebugLib.h>
+#include <Protocol/Smbios.h>
+
+#include "SmbiosPlatformDxe.h"
+
+#define TYPE3_STRINGS \
+ "ARM LTD\0" /* Manufacturer */ \
+ "Version not set\0" /* Version */ \
+ "Serial not set\0" /* Serial */ \
+ "Asset Tag not set\0" /* Asset Tag */
+
+typedef enum {
+ ManufacturerName = 1,
+ Version,
+ SerialNumber,
+ AssetTag
+} TYPE3_STRING_ELEMENTS;
+
+/* SMBIOS Type3 structure */
+#pragma pack(1)
+typedef struct {
+ SMBIOS_TABLE_TYPE3 Base;
+ CHAR8 Strings[sizeof (TYPE3_STRINGS)];
+} ARM_RD_SMBIOS_TYPE3;
+#pragma pack()
+
+/* System information */
+STATIC ARM_RD_SMBIOS_TYPE3 mArmRdSmbiosType3 = {
+ {
+ {
+ // SMBIOS header
+ EFI_SMBIOS_TYPE_SYSTEM_ENCLOSURE, // Type 3
+ sizeof (SMBIOS_TABLE_TYPE1), // Length
+ SMBIOS_HANDLE_ENCLOSURE, // Assign an unused handle number
+ },
+ ManufacturerName, // Manufacturer
+ 2, // Enclosure type unknown
+ Version, // Version
+ SerialNumber, // Serial
+ AssetTag, // Asset Tag
+ ChassisStateSafe, // Boot chassis state
+ ChassisStateSafe, // Power supply state
+ ChassisStateSafe, // Thermal state
+ ChassisSecurityStatusUnknown, // Security Status
+ {0}, // BIOS vendor specific Information
+ },
+ // Text strings (unformatted)
+ TYPE3_STRINGS
+};
+
+/**
+ Install SMBIOS System Enclosure Table
+
+ Install the SMBIOS System Enclosure (type 3) table for Arm's Reference Design
+ 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 is already in use.
+**/
+EFI_STATUS
+InstallType3SystemEnclosure (
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ )
+{
+ EFI_STATUS Status;
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+
+ SmbiosHandle = ((EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType3)->Handle;
+
+ /* Install type 3 table */
+ Status = Smbios->Add (
+ Smbios,
+ NULL,
+ &SmbiosHandle,
+ (EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType3
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "SMBIOS: Failed to install Type3 SMBIOS table.\n"
+ ));
+ }
+
+ return Status;
+}
--
2.17.1
next prev parent reply other threads:[~2021-05-24 14:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-24 14:28 [edk2-platforms][PATCH V4 00/11] Add SMBIOS tables for Arm's Reference Design platforms Pranav Madhu
2021-05-24 14:28 ` [edk2-platforms][PATCH V4 01/11] Platform/Sgi: Define RD-N2 platform id values Pranav Madhu
2021-05-24 14:28 ` [edk2-platforms][PATCH V4 02/11] Platform/Sgi: Add GetProductId API for SGI/RD Platforms Pranav Madhu
2021-05-24 14:28 ` [edk2-platforms][PATCH V4 03/11] Platform/Sgi: Add Initial SMBIOS support Pranav Madhu
2021-05-24 14:28 ` [edk2-platforms][PATCH V4 04/11] Platform/Sgi: Add SMBIOS Type1 Table Pranav Madhu
2021-05-24 14:28 ` Pranav Madhu [this message]
2021-05-24 14:28 ` [edk2-platforms][PATCH V4 06/11] Platform/Sgi: Add SMBIOS Type4 Table Pranav Madhu
2021-05-24 14:28 ` [edk2-platforms][PATCH V4 07/11] Platform/Sgi: Add SMBIOS Type7 Table Pranav Madhu
2021-05-24 14:28 ` [edk2-platforms][PATCH V4 08/11] Platform/Sgi: Add SMBIOS Type16 Table Pranav Madhu
2021-05-24 14:28 ` [edk2-platforms][PATCH V4 09/11] Platform/Sgi: Add SMBIOS Type17 Table Pranav Madhu
2021-05-24 14:28 ` [edk2-platforms][PATCH V4 10/11] Platform/Sgi: Add SMBIOS Type19 Table Pranav Madhu
2021-05-24 14:28 ` [edk2-platforms][PATCH V4 11/11] Platform/Sgi: Add SMBIOS Type32 Table Pranav Madhu
2021-05-24 15:16 ` [edk2-platforms][PATCH V4 00/11] Add SMBIOS tables for Arm's Reference Design platforms Sami Mujawar
2021-06-01 14:29 ` 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=20210524142816.9967-6-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