summaryrefslogtreecommitdiffstats
path: root/src/arch/x86/smbios.c
diff options
context:
space:
mode:
authorMichał Żygowski <michal.zygowski@3mdeb.com>2022-05-04 14:10:45 +0200
committerMichał Żygowski <michal.zygowski@3mdeb.com>2022-09-30 08:20:23 +0000
commite779523193bc61c475c3207f650bd840a808cb04 (patch)
tree6448c9589088c047fb11817a507b00a62b2ce1ce /src/arch/x86/smbios.c
parent7ac796c7b2a75fc6de7692114c6c9f2ad0755428 (diff)
downloadcoreboot-e779523193bc61c475c3207f650bd840a808cb04.tar.gz
coreboot-e779523193bc61c475c3207f650bd840a808cb04.tar.bz2
coreboot-e779523193bc61c475c3207f650bd840a808cb04.zip
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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/64048 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Christian Walter <christian.walter@9elements.com>
Diffstat (limited to 'src/arch/x86/smbios.c')
-rw-r--r--src/arch/x86/smbios.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/arch/x86/smbios.c b/src/arch/x86/smbios.c
index 4f8de420c365..0c1a877899dd 100644
--- a/src/arch/x86/smbios.c
+++ b/src/arch/x86/smbios.c
@@ -1108,6 +1108,29 @@ int smbios_write_type41(unsigned long *current, int *handle,
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;
+}
+
static int smbios_write_type127(unsigned long *current, int handle)
{
struct smbios_type127 *t = smbios_carve_table(*current, SMBIOS_END_OF_TABLE,