diff options
author | Angel Pons <th3fanbus@gmail.com> | 2021-06-28 17:18:06 +0200 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2021-07-01 07:37:21 +0000 |
commit | d62a5012d6e5904279eb56507bc2a021d2acce77 (patch) | |
tree | 2b8a4eb40ed8842ca8f237501182a3684931ac2a /src/drivers/wifi/generic | |
parent | ca01baa065e25242945bdfa8631694a6e903f17f (diff) |
SMBIOS: Introduce `smbios_carve_table` function
Factor out some boilerplate code into a helper `smbios_carve_table`
function, which zeroes out the table memory and fills in the header
fields common to all tables.
Change-Id: Iece2f64f9151d3c79813f6264dfb3a92d98c2035
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/55907
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-by: Michał Żygowski <michal.zygowski@3mdeb.com>
Diffstat (limited to 'src/drivers/wifi/generic')
-rw-r--r-- | src/drivers/wifi/generic/smbios.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/drivers/wifi/generic/smbios.c b/src/drivers/wifi/generic/smbios.c index 96b11d3051..e8936be386 100644 --- a/src/drivers/wifi/generic/smbios.c +++ b/src/drivers/wifi/generic/smbios.c @@ -22,17 +22,13 @@ static int smbios_write_intel_wifi(struct device *dev, int *handle, unsigned lon u8 eos[2]; } __packed; - struct smbios_type_intel_wifi *t = (struct smbios_type_intel_wifi *)*current; - int len = sizeof(*t); + struct smbios_type_intel_wifi *t = smbios_carve_table(*current, 0x85, + sizeof(*t), *handle); - memset(t, 0, sizeof(*t)); - t->type = 0x85; - t->length = len - 2; - t->handle = *handle; /* Intel wifi driver expects this string to be in the table 0x85. */ t->str = smbios_add_string(t->eos, "KHOIHGIUCCHHII"); - len = t->length + smbios_string_table_len(t->eos); + const int len = t->length + smbios_string_table_len(t->eos); *current += len; *handle += 1; return len; |