: Save DMI chassis information
PATCH 1/1 : Save DMI chassis information
The included patch saves the DMI chassis vendor and type information at boot-time. This may be helpful for some drivers where there is no sensible way to probe for the hardware. Note that chassis information is not guaranteed to be correct - most vendors get this right, but some laptops may appear as desktops (or possibly vice-versa, though that seems less likely).
Signed-off-by Matthew Garrett <[email protected]>
arch/i386/kernel/dmi_scan.c +54 -1
@@ -30,6 +30,50 @@ static char * __init dmi_string(struct dreturn str; } +static char *__init dmi_chasis_type (struct dmi_header *dm,u8 s) +{ +char *str ="" ; +static const char *type[]={ +"Other" ,/* 0x01 */ +"Unknown" , +"Desktop" , +"Low Profile Desktop" , +"Pizza Box" , +"Mini Tower" , +"Tower" , +"Portable" , +"Laptop" , +"Notebook" , +"Hand Held" , +"Docking Station" , +"All In One" , +"Sub Notebook" , +"Space-saving" , +"Lunch Box" , +"Main Server Chassis" ,/* master.mif says System */ +"Expansion Chassis" , +"Sub Chassis" , +"Bus Expansion Chassis" , +"Peripheral Chassis" , +"RAID Chassis" , +"Rack Mount Chassis" , +"Sealed-case PC" , +"Multi-system" /* 0x19 */ + }; + +if (s>=0x01 && s<=0x19 ) { + str =alloc_bootmem (strlen (type[code-0x01 ])); +if (str !=NULL ) +strcpy (str, type[code-0x01 ]); +else +printk (KERN_ERR "dmi_chassis_type: out of memory.\n" ); + +return str; + } + +return NULL ; +} +/* * We have to be cautious here. We have seen BIOSes with DMI pointers * pointing to completely the wrong place for example
@@ -93,7 +137,11 @@ static void __init dmi_save_ident(structif (dmi_ident[slot])return ; - p =dmi_string (dm, d[string]); +if (slot ==DMI_CHASSIS_TYPE ) + p =dmi_chassis_type (string &0x7f ); +else + p =dmi_string (dm, d[string]); +if (p ==NULL )return ;
@@ -176,6 +224,11 @@ static void __init dmi_decode(struct dmidmi_save_ident (dm,DMI_BOARD_NAME ,5 );dmi_save_ident (dm,DMI_BOARD_VERSION ,6 );break ; +case 3 :/* Chassis Information */ +dmi_save_ident (dm,DMI_CHASSIS_VENDOR ,4 ); +dmi_save_ident (dm,DMI_CHASSIS_TYPE ,5 ); +break ; +case 10 :/* Onboard Devices Information */ dmi_save_devices (dm);break ;
include/linux/dmi.h +2 -0
@@ -15,6 +15,8 @@ enum dmi_field {DMI_BOARD_VENDOR ,DMI_BOARD_NAME ,DMI_BOARD_VERSION , +DMI_CHASSIS_VENDOR , +DMI_CHASSIS_TYPE , DMI_STRING_MAX, };
Signature · 1 line
Matthew Garrett | [email protected]