smbios: Generic smbios_next() function

Extract generic code from smbios_21_next(), so it can be reused
for SMBIOS 3.0 support.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
Eduardo Habkost 2020-12-10 10:57:55 -05:00 committed by Kevin O'Connor
parent 97f6c5b024
commit cfd1ef3ab9
1 changed files with 12 additions and 4 deletions

View File

@ -265,12 +265,11 @@ find_acpi_features(void)
// Iterator for each sub-table in the smbios blob.
void *
smbios_21_next(struct smbios_21_entry_point *smbios, void *prev)
smbios_next(void *start, u32 length, void *prev)
{
if (!smbios)
if (!start)
return NULL;
void *start = (void*)smbios->structure_table_address;
void *end = start + smbios->structure_table_length;
void *end = start + length;
if (!prev) {
prev = start;
@ -288,6 +287,15 @@ smbios_21_next(struct smbios_21_entry_point *smbios, void *prev)
return prev;
}
void *
smbios_21_next(struct smbios_21_entry_point *smbios, void *prev)
{
if (!smbios)
return NULL;
return smbios_next((void*)smbios->structure_table_address,
smbios->structure_table_length, prev);
}
struct smbios_21_entry_point *SMBios21Addr;
void