Skip to content

Commit

Permalink
smbios: smbios_21_setup_entry_point() function
Browse files Browse the repository at this point in the history
Extract the code specific for building the SMBIOS 2.1 entry point
from smbios_romfile_setup() to a new
smbios_21_setup_entry_point() function.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
  • Loading branch information
ehabkost authored and KevinOConnor committed Dec 18, 2021
1 parent 4e99229 commit 1daafc8
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions src/fw/biostables.c
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,25 @@ smbios_build_tables(struct romfile_s *f_tables,
return 1;
}

static int
smbios_21_setup_entry_point(struct romfile_s *f_tables,
struct smbios_21_entry_point *ep)
{
if (!smbios_build_tables(f_tables,
&ep->structure_table_address,
&ep->structure_table_length,
&ep->max_structure_size,
&ep->number_of_structures))
return 0;

/* finalize entry point */
ep->checksum -= checksum(ep, 0x10);
ep->intermediate_checksum -= checksum((void *)ep + 0x10, ep->length - 0x10);

copy_smbios_21(ep);
return 1;
}

static int
smbios_romfile_setup(void)
{
Expand All @@ -535,19 +554,7 @@ smbios_romfile_setup(void)

f_anchor->copy(f_anchor, &ep, f_anchor->size);

if (!smbios_build_tables(f_tables,
&ep.structure_table_address,
&ep.structure_table_length,
&ep.max_structure_size,
&ep.number_of_structures))
return 0;

/* finalize entry point */
ep.checksum -= checksum(&ep, 0x10);
ep.intermediate_checksum -= checksum((void *)&ep + 0x10, ep.length - 0x10);

copy_smbios_21(&ep);
return 1;
return smbios_21_setup_entry_point(f_tables, &ep);
}

void
Expand Down

0 comments on commit 1daafc8

Please sign in to comment.