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 <ehabkost@redhat.com>
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 @@
*/
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 @@
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);