The code can also prove useful for other use-cases where smbios information needs to be accessed. Move it to a central place to allow for such future users.
Signed-off-by: Henning Schild <henning.sch...@siemens.com> --- drivers/watchdog/ipc4x7e_wdt.c | 25 ------------------------- include/utils.h | 3 +++ utils.c | 25 +++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 25 deletions(-) diff --git a/drivers/watchdog/ipc4x7e_wdt.c b/drivers/watchdog/ipc4x7e_wdt.c index 6a5c0f0f4632..f7e5e6a2ef9b 100644 --- a/drivers/watchdog/ipc4x7e_wdt.c +++ b/drivers/watchdog/ipc4x7e_wdt.c @@ -80,31 +80,6 @@ static UINT32 get_station_id(SMBIOS_STRUCTURE_POINTER oem_strct) return 0; } -static SMBIOS_STRUCTURE_POINTER -smbios_find_struct(SMBIOS_STRUCTURE_TABLE *table, UINT16 type) -{ - SMBIOS_STRUCTURE_POINTER strct; - UINT8 *str; - UINTN n; - - strct.Raw = (UINT8 *)(uintptr_t)table->TableAddress; - - for (n = 0; n < table->NumberOfSmbiosStructures; n++) { - if (strct.Hdr->Type == type) { - return strct; - } - /* Read over any appended strings. */ - str = strct.Raw + strct.Hdr->Length; - while (str[0] != 0 || str[1] != 0) { - str++; - } - strct.Raw = str + 2; - } - - strct.Raw = NULL; - return strct; -} - static UINTN mmcfg_address(UINTN bus, UINTN device, UINTN function, UINTN offset) { diff --git a/include/utils.h b/include/utils.h index 084796e23222..15d60fbdbc66 100644 --- a/include/utils.h +++ b/include/utils.h @@ -56,3 +56,6 @@ VOID PrintC(const UINT8 color, const CHAR16 *fmt, ...); #define INFO(fmt, ...) \ PrintC(EFI_LIGHTGRAY, fmt, ##__VA_ARGS__) + +SMBIOS_STRUCTURE_POINTER smbios_find_struct(SMBIOS_STRUCTURE_TABLE *table, + UINT16 type); diff --git a/utils.c b/utils.c index 0ae5a5e0b8dc..e065b6f5d800 100644 --- a/utils.c +++ b/utils.c @@ -295,3 +295,28 @@ CHAR16 *GetBootMediumPath(CHAR16 *input) return dst; } + +SMBIOS_STRUCTURE_POINTER smbios_find_struct(SMBIOS_STRUCTURE_TABLE *table, + UINT16 type) +{ + SMBIOS_STRUCTURE_POINTER strct; + UINT8 *str; + UINTN n; + + strct.Raw = (UINT8 *)(uintptr_t)table->TableAddress; + + for (n = 0; n < table->NumberOfSmbiosStructures; n++) { + if (strct.Hdr->Type == type) { + return strct; + } + /* Read over any appended strings. */ + str = strct.Raw + strct.Hdr->Length; + while (str[0] != 0 || str[1] != 0) { + str++; + } + strct.Raw = str + 2; + } + + strct.Raw = NULL; + return strct; +} -- 2.39.3 -- You received this message because you are subscribed to the Google Groups "EFI Boot Guard" group. To unsubscribe from this group and stop receiving emails from it, send an email to efibootguard-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/efibootguard-dev/20230601182052.25308-2-henning.schild%40siemens.com.