Signed-off-by: Ivan Mironov mironov.ivan@gmail.com --- src/fw/smbios.c | 56 +++++++++++++++++++++++++++++++++++++++++++------------- src/std/smbios.h | 11 +++++++++++ 2 files changed, 54 insertions(+), 13 deletions(-)
diff --git a/src/fw/smbios.c b/src/fw/smbios.c index a9137b8..d4dbc6d 100644 --- a/src/fw/smbios.c +++ b/src/fw/smbios.c @@ -17,6 +17,19 @@
struct smbios_entry_point *SMBiosAddr;
+static int +get_fields_sets_cnt(int type) +{ + char name[128]; + snprintf(name, sizeof(name), "smbios/fields-set-cnt-%d", type); + struct romfile_s *file = romfile_find(name); + if (!file) + return 0; + u16 cnt; + file->copy(file, &cnt, file->size); + return cnt; +} + static void smbios_entry_point_setup(u16 max_structure_size, u16 structure_table_length, @@ -63,19 +76,6 @@ smbios_entry_point_setup(u16 max_structure_size, }
static int -get_fields_sets_cnt(int type) -{ - char name[128]; - snprintf(name, sizeof(name), "smbios/fields-set-cnt-%d", type); - struct romfile_s *file = romfile_find(name); - if (!file) - return 0; - u16 cnt; - file->copy(file, &cnt, file->size); - return cnt; -} - -static int get_field(int type, int offset, int index, void *dest) { char name[128]; @@ -502,6 +502,34 @@ smbios_init_type_32(void *start) return start+2; }
+/* Type 41 -- Onboard Devices Extended Information */ +static void * +smbios_init_type_41(int instance, void *start) +{ + struct smbios_type_41 *p = (struct smbios_type_41 *)start; + char *end = (char *)start + sizeof(struct smbios_type_41); + size_t size; + int str_index = 0; + + p->header.type = 41; + p->header.length = sizeof(struct smbios_type_41); + p->header.handle = 0x3000 + instance; + + load_str_field_with_default(41, reference_designation_str, instance + , "No reference designation string specified"); + set_field_with_default(41, device_type, instance + , (1 << 7) | 0x02) /* enabled unknown device */; + set_field_with_default(41, device_type_instance, instance, 0); /* invalid */ + set_field_with_default(41, segment_group_number, instance, 0); + set_field_with_default(41, bus_number, instance, 0); + set_field_with_default(41, device_function_number, instance, 0); + + *end = 0; + end++; + + return end; +} + /* Type 127 -- End of Table */ static void * smbios_init_type_127(void *start) @@ -602,6 +630,8 @@ smbios_setup(void) }
add_struct(32, p); + add_structs(41, 1, p); + /* Add any remaining provided entries before the end marker */ for (i = 0; i < 256; i++) get_external(i, &p, &nr_structs, &max_struct_size, end); diff --git a/src/std/smbios.h b/src/std/smbios.h index 0513716..02bc1c1 100644 --- a/src/std/smbios.h +++ b/src/std/smbios.h @@ -157,6 +157,17 @@ struct smbios_type_32 { u8 boot_status; } PACKED;
+/* SMBIOS type 41 - Onboard Devices Extended Information */ +struct smbios_type_41 { + struct smbios_structure_header header; + u8 reference_designation_str; + u8 device_type; + u8 device_type_instance; + u16 segment_group_number; + u8 bus_number; + u8 device_function_number; +} PACKED; + /* SMBIOS type 127 -- End-of-table */ struct smbios_type_127 { struct smbios_structure_header header;