From: Matthew Garrett <mjg59@srcf.ucam.org>
To: linux-kernel@vger.kernel.org
Subject: [PATCH]: Save DMI chassis information
Date: Mon, 6 Feb 2006 13:08:42 +0000 [thread overview]
Message-ID: <20060206130842.GA11062@srcf.ucam.org> (raw)
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
reply other threads:[~2006-02-06 13:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060206130842.GA11062@srcf.ucam.org \
--to=mjg59@srcf.ucam.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.