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.web08.4132.1621157372359591793 for ; Sun, 16 May 2021 02:29:32 -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 0D8F01063; Sun, 16 May 2021 02:29:32 -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 D70563F73B; Sun, 16 May 2021 02:29:30 -0700 (PDT) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-platforms][PATCH V2 05/11] Platform/Sgi: Add SMBIOS Type3 Table Date: Sun, 16 May 2021 14:59:11 +0530 Message-Id: <20210516092917.21124-6-pranav.madhu@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210516092917.21124-1-pranav.madhu@arm.com> References: <20210516092917.21124-1-pranav.madhu@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 --- Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | = 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h | 1= 0 ++ Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c | = 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type3SystemEnclosure.c | 9= 6 ++++++++++++++++++++ 4 files changed, 108 insertions(+) diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatform= Dxe.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 =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 d7b3aadba948..4a6f8be2a2c2 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -23,4 +23,14 @@ InstallSystemInformation ( IN EFI_SMBIOS_PROTOCOL *Smbios ); =20 +EFI_STATUS +EFIAPI +InstallSystemEnclosure ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ); + +enum SMBIOS_REFRENCE_HANDLES { + SMBIOS_HANDLE_ENCLOSURE =3D 0x1000, +}; + #endif // SMBIOS_PLATFORM_DXE_H_ diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatform= Dxe.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c index 7b478063e223..5f4b833dc9fe 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -28,6 +28,7 @@ STATIC ARM_RD_SMBIOS_TABLE_INSTALL_FPTR mSmbiosTableList[] =3D { &InstallBiosInformation, &InstallSystemInformation, + &InstallSystemEnclosure, }; =20 /** diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type3SystemEnc= losure.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type3SystemEnclo= sure.c new file mode 100644 index 000000000000..ef0c36d37923 --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type3SystemEnclosure.= c @@ -0,0 +1,96 @@ +/** @file + SMBIOS Type 3 (System enclosure) table for ARM RD platforms. + + This file installs SMBIOS Type 3 (System enclosure) table for Arm Refe= rence + Design platforms. SMBIOS Type 3 table (System Enclosure) includes info= rmation + 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 +#include + +#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 */ + +/* SMBIOS Type3 structure */ +#pragma pack(1) +struct ArmRdSmbiosType3 { + SMBIOS_TABLE_TYPE3 Base; + UINT8 Strings[sizeof (TYPE3_STRINGS)]; +}; +#pragma pack() + +/* System information */ +static struct ArmRdSmbiosType3 mArmRdSmbiosType3 =3D { + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_SYSTEM_ENCLOSURE, // Type 3 + sizeof (SMBIOS_TABLE_TYPE1), // Length + SMBIOS_HANDLE_ENCLOSURE, // Assign an unused handle num= ber + }, + 1, // Manufacturer + 2, // Enclosure type unknown + 2, // Version + 3, // Serial + 4, // 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 in is already in= use. +**/ +EFI_STATUS +InstallSystemEnclosure ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ) +{ + EFI_STATUS Status; + EFI_SMBIOS_HANDLE SmbiosHandle; + + SmbiosHandle =3D ((EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType3)->Hand= le; + + /* Install type 3 table */ + Status =3D Smbios->Add ( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType3 + ); + if (Status !=3D EFI_SUCCESS) { + DEBUG (( + DEBUG_ERROR, + "SMBIOS: Failed to install Type3 SMBIOS table.\n" + )); + } + + return Status; +} --=20 2.17.1