]> xenbits.xensource.com Git - seabios.git/commitdiff
smbios: Use smbios_next() at smbios_romfile_setup()
authorEduardo Habkost <ehabkost@redhat.com>
Thu, 10 Dec 2020 17:32:37 +0000 (12:32 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Sat, 18 Dec 2021 16:39:13 +0000 (11:39 -0500)
Use smbios_next() instead of smbios_21_next(), to make the code
more generic and reusable for SMBIOS 3.0 support.

Note that `qtables_len` is initialized to `ftables->size` instead
of `ep.structure_table_length` now, but both fields are
guaranteed to have exactly the same value.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
src/fw/biostables.c

index 47463be9ac19b0c54db3356c2af421c84b397262..11eaeaeccf1689e43f6053f3c3e588c850772683 100644 (file)
@@ -477,16 +477,17 @@ smbios_romfile_setup(void)
         return 0;
     }
     f_tables->copy(f_tables, qtables, f_tables->size);
-    ep.structure_table_address = (u32)qtables; /* for smbios_21_next(), below */
+    qtables_len = f_tables->size;
 
     /* did we get a type 0 structure ? */
-    for (t0 = smbios_21_next(&ep, NULL); t0; t0 = smbios_21_next(&ep, t0))
+    for (t0 = smbios_next(qtables, qtables_len, NULL); t0;
+         t0 = smbios_next(qtables, qtables_len, t0)) {
         if (t0->header.type == 0) {
             need_t0 = 0;
             break;
         }
+    }
 
-    qtables_len = ep.structure_table_length;
     if (need_t0) {
         /* common case: add our own type 0, with 3 strings and 4 '\0's */
         u16 t0_len = sizeof(struct smbios_type_0) + strlen(BIOS_NAME) +