smbios: Refactor smbios library
Current smbios library does not fully match to the specification. It hardcodes values instead of exposing values from the device. It does not reserve the space to support dynamic length for contained object handles or elements and misses the handling of a few of fields. The refactoring of this patch includes: 1. Expose values from device via sysinfo interface. 2. Replace smbios_add_prop with smbios_add_prop_si to allow getting string values from sysinfo. 3. Add smbios_get_val_si to get values from sysinfo or device tree. 4. Use sysinfo_get_data to get data area. 5. Reserve the space of contained object handles and elements. 6. Miscellaneous fixes in smbios. Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
This commit is contained in:
@@ -122,6 +122,8 @@ struct __packed smbios_type1 {
|
||||
char eos[SMBIOS_STRUCT_EOS_BYTES];
|
||||
};
|
||||
|
||||
#define SMBIOS_TYPE2_CON_OBJ_HANDLE_SIZE sizeof(u16)
|
||||
|
||||
struct __packed smbios_type2 {
|
||||
struct smbios_header hdr;
|
||||
u8 manufacturer;
|
||||
@@ -134,6 +136,10 @@ struct __packed smbios_type2 {
|
||||
u16 chassis_handle;
|
||||
u8 board_type;
|
||||
u8 number_contained_objects;
|
||||
/*
|
||||
* Dynamic bytes will be inserted here to store the objects.
|
||||
* length is equal to 'number_contained_objects'.
|
||||
*/
|
||||
char eos[SMBIOS_STRUCT_EOS_BYTES];
|
||||
};
|
||||
|
||||
@@ -153,12 +159,17 @@ struct __packed smbios_type3 {
|
||||
u8 number_of_power_cords;
|
||||
u8 element_count;
|
||||
u8 element_record_length;
|
||||
/*
|
||||
* Dynamic bytes will be inserted here to store the elements.
|
||||
* length is equal to 'element_record_length' * 'element_record_length'
|
||||
*/
|
||||
u8 sku_number;
|
||||
char eos[SMBIOS_STRUCT_EOS_BYTES];
|
||||
};
|
||||
|
||||
struct __packed smbios_type4 {
|
||||
struct smbios_header hdr;
|
||||
u8 socket_designation;
|
||||
u8 socket_design;
|
||||
u8 processor_type;
|
||||
u8 processor_family;
|
||||
u8 processor_manufacturer;
|
||||
@@ -184,6 +195,7 @@ struct __packed smbios_type4 {
|
||||
u16 core_count2;
|
||||
u16 core_enabled2;
|
||||
u16 thread_count2;
|
||||
u16 thread_enabled;
|
||||
char eos[SMBIOS_STRUCT_EOS_BYTES];
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user