From b45ffe80ed050c7225a07eec50b53bb2c02a4b2a Mon Sep 17 00:00:00 2001 From: Graham Cantin Date: Tue, 3 Oct 2017 20:15:34 -0700 Subject: [PATCH 28/28] Add a struct for parsing BIOS information, differentiate board-product from product. Use the BIOS information struct to extract the bios version and revision. Tested against Supermicro H8 series motherboards only. --- src/include/ipxe/smbios.h | 19 +++++++++++++++++ src/interface/smbios/smbios_settings.c | 38 ++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/src/include/ipxe/smbios.h b/src/include/ipxe/smbios.h index c1d8fea..0a6d714 100644 --- a/src/include/ipxe/smbios.h +++ b/src/include/ipxe/smbios.h @@ -95,6 +95,25 @@ struct smbios_structure { size_t strings_len; }; +/** SMBIOS bios information structure */ +struct smbios_bios_information { + /** SMBIOS structure header */ + struct smbios_header header; + /** Manufacturer string */ + uint8_t manufacturer; + /** Version string */ + uint8_t version; + /** base address segment word */ + uint16_t segment; + /** Revision string */ + uint8_t revision; + /** Rom size string */ + uint8_t romsize; +} __attribute__ (( packed )); + +/** SMBIOS bios information structure type */ +#define SMBIOS_TYPE_BIOS_INFORMATION 0 + /** SMBIOS system information structure */ struct smbios_system_information { /** SMBIOS structure header */ diff --git a/src/interface/smbios/smbios_settings.c b/src/interface/smbios/smbios_settings.c index 2d571f2..e9cb0fd 100644 --- a/src/interface/smbios/smbios_settings.c +++ b/src/interface/smbios/smbios_settings.c @@ -257,3 +257,41 @@ const struct setting board_serial_setting __setting ( SETTING_HOST_EXTRA, .type = &setting_type_string, .scope = &smbios_settings_scope, }; + +/** Board product name setting (may differ from chassis product name) */ +const struct setting board_product_setting __setting ( SETTING_HOST_EXTRA, + product )={ + .name = "board-product", + .description = "Base board Product name", + .tag = SMBIOS_STRING_TAG ( SMBIOS_TYPE_BASE_BOARD_INFORMATION, + struct smbios_base_board_information, + product ), + .type = &setting_type_string, + .scope = &smbios_settings_scope, +}; + +/** BIOS Version setting */ +const struct setting bios_version_setting __setting ( SETTING_HOST_EXTRA, + bios-version )={ + .name = "bios-version", + .description = "BIOS Version", + .tag = SMBIOS_STRING_TAG ( SMBIOS_TYPE_BIOS_INFORMATION, + struct smbios_bios_information, + version ), + .type = &setting_type_string, + .scope = &smbios_settings_scope, +}; + +/** BIOS Revision setting */ +const struct setting bios_revision_setting __setting ( SETTING_HOST_EXTRA, + bios-revision )={ + .name = "bios-revision", + .description = "BIOS Revision", + .tag = SMBIOS_STRING_TAG ( SMBIOS_TYPE_BIOS_INFORMATION, + struct smbios_bios_information, + revision ), + .type = &setting_type_string, + .scope = &smbios_settings_scope, +}; + + -- 2.7.4