mb/emulation/qemu-i440fx/fw_cfg.c: Use `smbios_header`

Replace uses of `smbios_type0` with `smbios_header` for correctness.

Change-Id: I2479984f5322f0fb474ff1707c1dd1f5885f30e9
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/55913
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
This commit is contained in:
Angel Pons 2021-06-28 19:09:22 +02:00 committed by Patrick Georgi
parent a37701afa3
commit fff1b2f547
1 changed files with 9 additions and 9 deletions

View File

@ -393,14 +393,14 @@ static void fw_cfg_smbios_init(void)
static unsigned long smbios_next(unsigned long current) static unsigned long smbios_next(unsigned long current)
{ {
struct smbios_type0 *t0; struct smbios_header *header;
int l, count = 0; int l, count = 0;
char *s; char *s;
t0 = (void*)current; header = (void *)current;
current += t0->length; current += header->length;
for (;;) { for (;;) {
s = (void*)current; s = (void *)current;
l = strlen(s); l = strlen(s);
if (!l) if (!l)
return current + (count ? 1 : 2); return current + (count ? 1 : 2);
@ -424,7 +424,7 @@ static unsigned long smbios_next(unsigned long current)
unsigned long fw_cfg_smbios_tables(int *handle, unsigned long *current) unsigned long fw_cfg_smbios_tables(int *handle, unsigned long *current)
{ {
FWCfgFile f; FWCfgFile f;
struct smbios_type0 *t0; struct smbios_header *header;
unsigned long start, end; unsigned long start, end;
int ret, i, count = 1; int ret, i, count = 1;
char *str; char *str;
@ -446,8 +446,8 @@ unsigned long fw_cfg_smbios_tables(int *handle, unsigned long *current)
if (i == 16384) if (i == 16384)
return 0; return 0;
i += sizeof(struct smbios_type0) - 2; i += sizeof(struct smbios_type0) - 2;
t0 = (struct smbios_type0*)(*current - i); header = (struct smbios_header *)(*current - i);
if (t0->type != SMBIOS_BIOS_INFORMATION || t0->handle != 0) if (header->type != SMBIOS_BIOS_INFORMATION || header->handle != 0)
return 0; return 0;
printk(BIOS_DEBUG, "QEMU: coreboot type0 table found at 0x%lx.\n", printk(BIOS_DEBUG, "QEMU: coreboot type0 table found at 0x%lx.\n",
*current - i); *current - i);
@ -461,8 +461,8 @@ unsigned long fw_cfg_smbios_tables(int *handle, unsigned long *current)
fw_cfg_get(f.select, (void *)start, f.size); fw_cfg_get(f.select, (void *)start, f.size);
end = start; end = start;
do { do {
t0 = (struct smbios_type0*)end; header = (struct smbios_header *)end;
if (t0->type == SMBIOS_END_OF_TABLE) if (header->type == SMBIOS_END_OF_TABLE)
break; break;
end = smbios_next(end); end = smbios_next(end);
count++; count++;