From ddd0f7b877695bc15a88f5f0077868329518d7bf Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Thu, 10 Dec 2020 14:07:16 -0500 Subject: [PATCH] smbios: Make smbios_build_tables() ready for 64-bit tables Make smbios_build_tables() get u64 address and u32 length arguments, making it usable for SMBIOS 3.0. Adapt smbios_21_setup_entry_point() to use intermediate variables when calling smbios_build_tables(). Signed-off-by: Eduardo Habkost --- src/fw/biostables.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/fw/biostables.c b/src/fw/biostables.c index d65d91a..91fe747 100644 --- a/src/fw/biostables.c +++ b/src/fw/biostables.c @@ -462,7 +462,7 @@ smbios_new_type_0(void *start, */ static int smbios_build_tables(struct romfile_s *f_tables, - u32 *address, u16 *length, + u64 *address, u32 *length, u16 *max_structure_size, u16 *number_of_structures) { @@ -531,14 +531,24 @@ static int smbios_21_setup_entry_point(struct romfile_s *f_tables, struct smbios_21_entry_point *ep) { + u64 address = ep->structure_table_address; + u32 length = ep->structure_table_length; + if (!smbios_build_tables(f_tables, - &ep->structure_table_address, - &ep->structure_table_length, + &address, + &length, &ep->max_structure_size, &ep->number_of_structures)) return 0; + if ((u32)address != address || (u16)length != length) { + warn_internalerror(); + return 0; + } + /* finalize entry point */ + ep->structure_table_address = address; + ep->structure_table_length = length; ep->checksum -= checksum(ep, 0x10); ep->intermediate_checksum -= checksum((void *)ep + 0x10, ep->length - 0x10); -- 2.39.5