Michał Żygowski has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/64048 )
Change subject: smbios: Add API to generate SMBIOS type 43 TPM Device ......................................................................
smbios: Add API to generate SMBIOS type 43 TPM Device
Based on DMTF SMBIOS Specification 3.1.0.
Signed-off-by: Michał Żygowski michal.zygowski@3mdeb.com Change-Id: Ia2db29f8bc4cfbc6648bb2cabad074d9ea583ca9 --- M src/arch/x86/smbios.c M src/include/smbios.h 2 files changed, 48 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/48/64048/1
diff --git a/src/arch/x86/smbios.c b/src/arch/x86/smbios.c index c48ce86..0998bbe 100644 --- a/src/arch/x86/smbios.c +++ b/src/arch/x86/smbios.c @@ -1287,6 +1287,29 @@ return len; }
+int smbios_write_type43(unsigned long *current, int *handle, const u32 vendor_id, + const u8 major_spec_ver, const u8 minor_spec_ver, + const u32 fw_ver1, const u32 fw_ver2, const char *description, + const u64 characteristics, const u32 oem_defined) +{ + struct smbios_type43 *t = smbios_carve_table(*current, SMBIOS_TPM_DEVICE, + sizeof(*t), *handle); + + t->vendor_id = vendor_id; + t->major_spec_ver = major_spec_ver; + t->minor_spec_ver = minor_spec_ver; + t->fw_ver1 = fw_ver1; + t->fw_ver2 = fw_ver2; + t->characteristics = characteristics; + t->oem_defined = oem_defined; + t->description = smbios_add_string(t->eos, description); + + const int len = smbios_full_table_len(&t->header, t->eos); + *current += len; + *handle += 1; + return len; +} + unsigned long smbios_write_tables(unsigned long current) { struct smbios_entry *se; diff --git a/src/include/smbios.h b/src/include/smbios.h index 4e53771..0210665 100644 --- a/src/include/smbios.h +++ b/src/include/smbios.h @@ -35,6 +35,11 @@ const char *name, u8 instance, u16 segment, u8 bus, u8 device, u8 function, u8 device_type);
+int smbios_write_type43(unsigned long *current, int *handle, const u32 vendor_id, + const u8 major_spec_ver, const u8 minor_spec_ver, + const u32 fw_ver1, const u32 fw_ver2, const char *description, + const u64 characteristics, const u32 oem_defined); + struct device; int get_smbios_data(struct device *dev, int *handle, unsigned long *current);
@@ -253,6 +258,7 @@ SMBIOS_SYSTEM_BOOT_INFORMATION = 32, SMBIOS_IPMI_DEVICE_INFORMATION = 38, SMBIOS_ONBOARD_DEVICES_EXTENDED_INFORMATION = 41, + SMBIOS_TPM_DEVICE = 43, SMBIOS_END_OF_TABLE = 127, } smbios_struct_type_t;
@@ -970,6 +976,25 @@ u8 eos[2]; } __packed;
+ +#define SMBIOS_TPM_DEVICE_CHARACTERISTICS_NOT_SUPPORTED (1ULL << 2) +#define SMBIOS_TPM_DEVICE_FAMILY_CONFIGURABLE_VIA_FW_UPD (1ULL << 3) +#define SMBIOS_TPM_DEVICE_FAMILY_CONFIGURABLE_VIA_PLATFORM_SW_SUPPORT (1ULL << 4) +#define SMBIOS_TPM_DEVICE_FAMILY_CONFIGURABLE_VIA_OEM_PROPRIETARY (1ULL << 5) + +struct smbios_type43 { + struct smbios_header header; + u32 vendor_id; + u8 major_spec_ver; + u8 minor_spec_ver; + u32 fw_ver1; + u32 fw_ver2; + u8 description; + u64 characteristics; + u32 oem_defined; + u8 eos[2]; +} __packed; + struct smbios_type127 { struct smbios_header header; u8 eos[2];