* [PATCH]: Save DMI chassis information
@ 2006-02-06 13:08 Matthew Garrett
0 siblings, 0 replies; only message in thread
From: Matthew Garrett @ 2006-02-06 13:08 UTC (permalink / raw)
To: linux-kernel
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 <mjg59@srcf.ucam.org>
diff --git a/arch/i386/kernel/dmi_scan.c b/arch/i386/kernel/dmi_scan.c
index 58516e2..9c0d8c6 100644
--- a/arch/i386/kernel/dmi_scan.c
+++ b/arch/i386/kernel/dmi_scan.c
@@ -30,6 +30,50 @@ static char * __init dmi_string(struct d
return 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(struct
if (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 dmi
dmi_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;
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index 05f4132..5f425a7 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -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,
};
--
Matthew Garrett | mjg59@srcf.ucam.org
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2006-02-06 13:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-06 13:08 [PATCH]: Save DMI chassis information Matthew Garrett
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.