From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.24050.1621866526017084704 for ; Mon, 24 May 2021 07:28:46 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: pranav.madhu@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9A0CCED1; Mon, 24 May 2021 07:28:45 -0700 (PDT) Received: from usa.arm.com (a074742.blr.arm.com [10.162.16.32]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 709533F719; Mon, 24 May 2021 07:28:44 -0700 (PDT) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-platforms][PATCH V4 11/11] Platform/Sgi: Add SMBIOS Type32 Table Date: Mon, 24 May 2021 19:58:16 +0530 Message-Id: <20210524142816.9967-12-pranav.madhu@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210524142816.9967-1-pranav.madhu@arm.com> References: <20210524142816.9967-1-pranav.madhu@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Add the SMBIOS type 32 table (System Boot Information) that includes information about the System Boot Status. Signed-off-by: Pranav Madhu Reviewed-by: Sami Mujawar --- Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf = | 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h = | 17 ++++ Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c = | 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type32SystemBootInformatio= n.c | 84 ++++++++++++++++++++ 4 files changed, 103 insertions(+) diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatform= Dxe.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 =20 [Packages] ArmPkg/ArmPkg.dec diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatform= Dxe.h b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h index d4b838689a32..f8f69f0785b9 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -158,6 +158,23 @@ InstallType19MemoryArrayMappedAddress ( IN EFI_SMBIOS_PROTOCOL *Smbios ); =20 +/** + Install SMBIOS system boot information + + Install the SMBIOS system boot information (type 32) table for RD plat= forms. + + @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 us= e. +**/ +EFI_STATUS +EFIAPI +InstallType32SystemBootInformation ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ); + typedef enum { SMBIOS_HANDLE_ENCLOSURE =3D 0x1000, SMBIOS_HANDLE_CLUSTER1, diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatform= Dxe.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c index bed5da77786d..29535b247b7c 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[] =3D= { &InstallType16PhysicalMemoryArray, &InstallType17MemoryDevice, &InstallType19MemoryArrayMappedAddress, + &InstallType32SystemBootInformation, }; =20 /** diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type32SystemBo= otInformation.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type32Sys= temBootInformation.c new file mode 100644 index 000000000000..e98e23fe8fe0 --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type32SystemBootInfor= mation.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 B= oot + 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 +#include +#include + +#include "SmbiosPlatformDxe.h" + +#define TYPE32_STRINGS \ + "\0" /* Null string */ + +/* SMBIOS Type32 structure */ +#pragma pack(1) +typedef struct { + SMBIOS_TABLE_TYPE32 Base; + CHAR8 Strings[sizeof (TYPE32_STRINGS)]; +} ARM_RD_SMBIOS_TYPE32; +#pragma pack() + +/* System Boot Information */ +STATIC ARM_RD_SMBIOS_TYPE32 mArmRdSmbiosType32 =3D { + { + { + // 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 plat= forms. + + @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 us= e. +**/ +EFI_STATUS +InstallType32SystemBootInformation ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ) +{ + EFI_STATUS Status; + EFI_SMBIOS_HANDLE SmbiosHandle; + + SmbiosHandle =3D ((EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType32)->Han= dle; + + /* Install type 32 table */ + Status =3D Smbios->Add ( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType32 + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "SMBIOS: Failed to install Type32 SMBIOS table.\n" + )); + } + + return Status; +} --=20 2.17.1