summaryrefslogtreecommitdiff
path: root/src/include/smbios.h
diff options
context:
space:
mode:
authorAngel Pons <th3fanbus@gmail.com>2021-06-28 16:06:28 +0200
committerPatrick Georgi <pgeorgi@google.com>2021-07-01 07:37:04 +0000
commitca01baa065e25242945bdfa8631694a6e903f17f (patch)
treec23517071dfffc3ebacef30f970fc245db32bec7 /src/include/smbios.h
parent631cd29efbcd030d8c3fe3ce3c9d98562b306007 (diff)
SMBIOS: Introduce struct for SMBIOS table header
All SMBIOS `type X` tables start with the same 4-byte header. Add a struct definition for it, and use it where applicable. The union is temporary and allows doing the necessary changes in smaller commits. Change-Id: Ibd9a80010f83fd7ebefc014b981d430f5723808c Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/55906 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Diffstat (limited to 'src/include/smbios.h')
-rw-r--r--src/include/smbios.h189
1 files changed, 140 insertions, 49 deletions
diff --git a/src/include/smbios.h b/src/include/smbios.h
index e5e5df5fe3..1e307c8324 100644
--- a/src/include/smbios.h
+++ b/src/include/smbios.h
@@ -276,10 +276,21 @@ struct smbios_entry30 {
u64 struct_table_address;
} __packed;
-struct smbios_type0 {
+struct smbios_header {
u8 type;
u8 length;
u16 handle;
+} __packed;
+
+struct smbios_type0 {
+ union {
+ struct {
+ u8 type;
+ u8 length;
+ u16 handle;
+ };
+ struct smbios_header header;
+ };
u8 vendor;
u8 bios_version;
u16 bios_start_segment;
@@ -297,9 +308,14 @@ struct smbios_type0 {
} __packed;
struct smbios_type1 {
- u8 type;
- u8 length;
- u16 handle;
+ union {
+ struct {
+ u8 type;
+ u8 length;
+ u16 handle;
+ };
+ struct smbios_header header;
+ };
u8 manufacturer;
u8 product_name;
u8 version;
@@ -334,9 +350,14 @@ typedef enum {
} smbios_board_type;
struct smbios_type2 {
- u8 type;
- u8 length;
- u16 handle;
+ union {
+ struct {
+ u8 type;
+ u8 length;
+ u16 handle;
+ };
+ struct smbios_header header;
+ };
u8 manufacturer;
u8 product_name;
u8 version;
@@ -389,9 +410,14 @@ typedef enum {
} smbios_enclosure_type;
struct smbios_type3 {
- u8 type;
- u8 length;
- u16 handle;
+ union {
+ struct {
+ u8 type;
+ u8 length;
+ u16 handle;
+ };
+ struct smbios_header header;
+ };
u8 manufacturer;
u8 _type;
u8 version;
@@ -411,9 +437,14 @@ struct smbios_type3 {
} __packed;
struct smbios_type4 {
- u8 type;
- u8 length;
- u16 handle;
+ union {
+ struct {
+ u8 type;
+ u8 length;
+ u16 handle;
+ };
+ struct smbios_header header;
+ };
u8 socket_designation;
u8 processor_type;
u8 processor_family;
@@ -524,9 +555,14 @@ enum smbios_cache_associativity {
#define SMBIOS_CACHE_OP_MODE_UNKNOWN 3
struct smbios_type7 {
- u8 type;
- u8 length;
- u16 handle;
+ union {
+ struct {
+ u8 type;
+ u8 length;
+ u16 handle;
+ };
+ struct smbios_header header;
+ };
u8 socket_designation;
u16 cache_configuration;
u16 max_cache_size;
@@ -640,9 +676,14 @@ struct port_information {
};
struct smbios_type8 {
- u8 type;
- u8 length;
- u16 handle;
+ union {
+ struct {
+ u8 type;
+ u8 length;
+ u16 handle;
+ };
+ struct smbios_header header;
+ };
u8 internal_reference_designator;
u8 internal_connector_type;
u8 external_reference_designator;
@@ -777,9 +818,14 @@ struct slot_peer_groups {
} __packed;
struct smbios_type9 {
- u8 type;
- u8 length;
- u16 handle;
+ union {
+ struct {
+ u8 type;
+ u8 length;
+ u16 handle;
+ };
+ struct smbios_header header;
+ };
u8 slot_designation;
u8 slot_type;
u8 slot_data_bus_width;
@@ -798,17 +844,27 @@ struct smbios_type9 {
} __packed;
struct smbios_type11 {
- u8 type;
- u8 length;
- u16 handle;
+ union {
+ struct {
+ u8 type;
+ u8 length;
+ u16 handle;
+ };
+ struct smbios_header header;
+ };
u8 count;
u8 eos[2];
} __packed;
struct smbios_type15 {
- u8 type;
- u8 length;
- u16 handle;
+ union {
+ struct {
+ u8 type;
+ u8 length;
+ u16 handle;
+ };
+ struct smbios_header header;
+ };
u16 area_length;
u16 header_offset;
u16 data_offset;
@@ -838,9 +894,14 @@ enum {
#define SMBIOS_USE_EXTENDED_MAX_CAPACITY (1 << 31)
struct smbios_type16 {
- u8 type;
- u8 length;
- u16 handle;
+ union {
+ struct {
+ u8 type;
+ u8 length;
+ u16 handle;
+ };
+ struct smbios_header header;
+ };
u8 location;
u8 use;
u8 memory_error_correction;
@@ -852,9 +913,14 @@ struct smbios_type16 {
} __packed;
struct smbios_type17 {
- u8 type;
- u8 length;
- u16 handle;
+ union {
+ struct {
+ u8 type;
+ u8 length;
+ u16 handle;
+ };
+ struct smbios_header header;
+ };
u16 phys_memory_array_handle;
u16 memory_error_information_handle;
u16 total_width;
@@ -881,9 +947,14 @@ struct smbios_type17 {
} __packed;
struct smbios_type19 {
- u8 type;
- u8 length;
- u16 handle;
+ union {
+ struct {
+ u8 type;
+ u8 length;
+ u16 handle;
+ };
+ struct smbios_header header;
+ };
u32 starting_address;
u32 ending_address;
u16 memory_array_handle;
@@ -894,18 +965,28 @@ struct smbios_type19 {
} __packed;
struct smbios_type32 {
- u8 type;
- u8 length;
- u16 handle;
+ union {
+ struct {
+ u8 type;
+ u8 length;
+ u16 handle;
+ };
+ struct smbios_header header;
+ };
u8 reserved[6];
u8 boot_status;
u8 eos[2];
} __packed;
struct smbios_type38 {
- u8 type;
- u8 length;
- u16 handle;
+ union {
+ struct {
+ u8 type;
+ u8 length;
+ u16 handle;
+ };
+ struct smbios_header header;
+ };
u8 interface_type;
u8 ipmi_rev;
u8 i2c_slave_addr;
@@ -940,9 +1021,14 @@ typedef enum {
#define SMBIOS_DEVICE_TYPE_COUNT 10
struct smbios_type41 {
- u8 type;
- u8 length;
- u16 handle;
+ union {
+ struct {
+ u8 type;
+ u8 length;
+ u16 handle;
+ };
+ struct smbios_header header;
+ };
u8 reference_designation;
u8 device_type: 7;
u8 device_status: 1;
@@ -955,9 +1041,14 @@ struct smbios_type41 {
} __packed;
struct smbios_type127 {
- u8 type;
- u8 length;
- u16 handle;
+ union {
+ struct {
+ u8 type;
+ u8 length;
+ u16 handle;
+ };
+ struct smbios_header header;
+ };
u8 eos[2];
} __packed;