]> xenbits.xensource.com Git - seabios.git/commitdiff
smbios: Generic smbios_next() function
authorEduardo Habkost <ehabkost@redhat.com>
Thu, 10 Dec 2020 15:57:55 +0000 (10:57 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Sat, 18 Dec 2021 16:39:12 +0000 (11:39 -0500)
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>
src/fw/biostables.c

index 8e53ae2e18b173667aa89cc03d4e061619e33710..3c30331e5cd7e8f1af38f3204dcf173281776476 100644 (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