aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/osl.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/osl.c')
-rw-r--r--drivers/acpi/osl.c206
1 files changed, 145 insertions, 61 deletions
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index aabc6ca4a81..e96f3d933f6 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -77,11 +77,55 @@ static struct workqueue_struct *kacpi_notify_wq;
77#define OSI_STRING_LENGTH_MAX 64 /* arbitrary */ 77#define OSI_STRING_LENGTH_MAX 64 /* arbitrary */
78static char osi_additional_string[OSI_STRING_LENGTH_MAX]; 78static char osi_additional_string[OSI_STRING_LENGTH_MAX];
79 79
80static int osi_linux; /* disable _OSI(Linux) by default */ 80/*
81 * "Ode to _OSI(Linux)"
82 *
83 * osi_linux -- Control response to BIOS _OSI(Linux) query.
84 *
85 * As Linux evolves, the features that it supports change.
86 * So an OSI string such as "Linux" is not specific enough
87 * to be useful across multiple versions of Linux. It
88 * doesn't identify any particular feature, interface,
89 * or even any particular version of Linux...
90 *
91 * Unfortunately, Linux-2.6.22 and earlier responded "yes"
92 * to a BIOS _OSI(Linux) query. When
93 * a reference mobile BIOS started using it, its use
94 * started to spread to many vendor platforms.
95 * As it is not supportable, we need to halt that spread.
96 *
97 * Today, most BIOS references to _OSI(Linux) are noise --
98 * they have no functional effect and are just dead code
99 * carried over from the reference BIOS.
100 *
101 * The next most common case is that _OSI(Linux) harms Linux,
102 * usually by causing the BIOS to follow paths that are
103 * not tested during Windows validation.
104 *
105 * Finally, there is a short list of platforms
106 * where OSI(Linux) benefits Linux.
107 *
108 * In Linux-2.6.23, OSI(Linux) is first disabled by default.
109 * DMI is used to disable the dmesg warning about OSI(Linux)
110 * on platforms where it is known to have no effect.
111 * But a dmesg warning remains for systems where
112 * we do not know if OSI(Linux) is good or bad for the system.
113 * DMI is also used to enable OSI(Linux) for the machines
114 * that are known to need it.
115 *
116 * BIOS writers should NOT query _OSI(Linux) on future systems.
117 * It will be ignored by default, and to get Linux to
118 * not ignore it will require a kernel source update to
119 * add a DMI entry, or a boot-time "acpi_osi=Linux" invocation.
120 */
121#define OSI_LINUX_ENABLE 0
81 122
82#ifdef CONFIG_DMI 123struct osi_linux {
83static struct __initdata dmi_system_id acpi_osl_dmi_table[]; 124 unsigned int enable:1;
84#endif 125 unsigned int dmi:1;
126 unsigned int cmdline:1;
127 unsigned int known:1;
128} osi_linux = { OSI_LINUX_ENABLE, 0, 0, 0};
85 129
86static void __init acpi_request_region (struct acpi_generic_address *addr, 130static void __init acpi_request_region (struct acpi_generic_address *addr,
87 unsigned int length, char *desc) 131 unsigned int length, char *desc)
@@ -133,7 +177,6 @@ device_initcall(acpi_reserve_resources);
133 177
134acpi_status __init acpi_os_initialize(void) 178acpi_status __init acpi_os_initialize(void)
135{ 179{
136 dmi_check_system(acpi_osl_dmi_table);
137 return AE_OK; 180 return AE_OK;
138} 181}
139 182
@@ -207,8 +250,12 @@ acpi_physical_address __init acpi_os_get_root_pointer(void)
207 "System description tables not found\n"); 250 "System description tables not found\n");
208 return 0; 251 return 0;
209 } 252 }
210 } else 253 } else {
211 return acpi_find_rsdp(); 254 acpi_physical_address pa = 0;
255
256 acpi_find_root_pointer(&pa);
257 return pa;
258 }
212} 259}
213 260
214void __iomem *acpi_os_map_memory(acpi_physical_address phys, acpi_size size) 261void __iomem *acpi_os_map_memory(acpi_physical_address phys, acpi_size size)
@@ -387,17 +434,14 @@ acpi_status acpi_os_read_port(acpi_io_address port, u32 * value, u32 width)
387 if (!value) 434 if (!value)
388 value = &dummy; 435 value = &dummy;
389 436
390 switch (width) { 437 *value = 0;
391 case 8: 438 if (width <= 8) {
392 *(u8 *) value = inb(port); 439 *(u8 *) value = inb(port);
393 break; 440 } else if (width <= 16) {
394 case 16:
395 *(u16 *) value = inw(port); 441 *(u16 *) value = inw(port);
396 break; 442 } else if (width <= 32) {
397 case 32:
398 *(u32 *) value = inl(port); 443 *(u32 *) value = inl(port);
399 break; 444 } else {
400 default:
401 BUG(); 445 BUG();
402 } 446 }
403 447
@@ -408,17 +452,13 @@ EXPORT_SYMBOL(acpi_os_read_port);
408 452
409acpi_status acpi_os_write_port(acpi_io_address port, u32 value, u32 width) 453acpi_status acpi_os_write_port(acpi_io_address port, u32 value, u32 width)
410{ 454{
411 switch (width) { 455 if (width <= 8) {
412 case 8:
413 outb(value, port); 456 outb(value, port);
414 break; 457 } else if (width <= 16) {
415 case 16:
416 outw(value, port); 458 outw(value, port);
417 break; 459 } else if (width <= 32) {
418 case 32:
419 outl(value, port); 460 outl(value, port);
420 break; 461 } else {
421 default:
422 BUG(); 462 BUG();
423 } 463 }
424 464
@@ -971,13 +1011,37 @@ static int __init acpi_os_name_setup(char *str)
971 1011
972__setup("acpi_os_name=", acpi_os_name_setup); 1012__setup("acpi_os_name=", acpi_os_name_setup);
973 1013
974static void enable_osi_linux(int enable) { 1014static void __init set_osi_linux(unsigned int enable)
1015{
1016 if (osi_linux.enable != enable) {
1017 osi_linux.enable = enable;
1018 printk(KERN_NOTICE PREFIX "%sed _OSI(Linux)\n",
1019 enable ? "Add": "Delet");
1020 }
1021 return;
1022}
1023
1024static void __init acpi_cmdline_osi_linux(unsigned int enable)
1025{
1026 osi_linux.cmdline = 1; /* cmdline set the default */
1027 set_osi_linux(enable);
1028
1029 return;
1030}
1031
1032void __init acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d)
1033{
1034 osi_linux.dmi = 1; /* DMI knows that this box asks OSI(Linux) */
975 1035
976 if (osi_linux != enable) 1036 printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident);
977 printk(KERN_INFO PREFIX "%sabled _OSI(Linux)\n", 1037
978 enable ? "En": "Dis"); 1038 if (enable == -1)
1039 return;
1040
1041 osi_linux.known = 1; /* DMI knows which OSI(Linux) default needed */
1042
1043 set_osi_linux(enable);
979 1044
980 osi_linux = enable;
981 return; 1045 return;
982} 1046}
983 1047
@@ -994,12 +1058,12 @@ static int __init acpi_osi_setup(char *str)
994 printk(KERN_INFO PREFIX "_OSI method disabled\n"); 1058 printk(KERN_INFO PREFIX "_OSI method disabled\n");
995 acpi_gbl_create_osi_method = FALSE; 1059 acpi_gbl_create_osi_method = FALSE;
996 } else if (!strcmp("!Linux", str)) { 1060 } else if (!strcmp("!Linux", str)) {
997 enable_osi_linux(0); 1061 acpi_cmdline_osi_linux(0); /* !enable */
998 } else if (*str == '!') { 1062 } else if (*str == '!') {
999 if (acpi_osi_invalidate(++str) == AE_OK) 1063 if (acpi_osi_invalidate(++str) == AE_OK)
1000 printk(KERN_INFO PREFIX "Deleted _OSI(%s)\n", str); 1064 printk(KERN_INFO PREFIX "Deleted _OSI(%s)\n", str);
1001 } else if (!strcmp("Linux", str)) { 1065 } else if (!strcmp("Linux", str)) {
1002 enable_osi_linux(1); 1066 acpi_cmdline_osi_linux(1); /* enable */
1003 } else if (*osi_additional_string == '\0') { 1067 } else if (*osi_additional_string == '\0') {
1004 strncpy(osi_additional_string, str, OSI_STRING_LENGTH_MAX); 1068 strncpy(osi_additional_string, str, OSI_STRING_LENGTH_MAX);
1005 printk(KERN_INFO PREFIX "Added _OSI(%s)\n", str); 1069 printk(KERN_INFO PREFIX "Added _OSI(%s)\n", str);
@@ -1148,6 +1212,34 @@ acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object)
1148 return (AE_OK); 1212 return (AE_OK);
1149} 1213}
1150 1214
1215/**
1216 * acpi_dmi_dump - dump DMI slots needed for blacklist entry
1217 *
1218 * Returns 0 on success
1219 */
1220int acpi_dmi_dump(void)
1221{
1222
1223 if (!dmi_available)
1224 return -1;
1225
1226 printk(KERN_NOTICE PREFIX "DMI System Vendor: %s\n",
1227 dmi_get_slot(DMI_SYS_VENDOR));
1228 printk(KERN_NOTICE PREFIX "DMI Product Name: %s\n",
1229 dmi_get_slot(DMI_PRODUCT_NAME));
1230 printk(KERN_NOTICE PREFIX "DMI Product Version: %s\n",
1231 dmi_get_slot(DMI_PRODUCT_VERSION));
1232 printk(KERN_NOTICE PREFIX "DMI Board Name: %s\n",
1233 dmi_get_slot(DMI_BOARD_NAME));
1234 printk(KERN_NOTICE PREFIX "DMI BIOS Vendor: %s\n",
1235 dmi_get_slot(DMI_BIOS_VENDOR));
1236 printk(KERN_NOTICE PREFIX "DMI BIOS Date: %s\n",
1237 dmi_get_slot(DMI_BIOS_DATE));
1238
1239 return 0;
1240}
1241
1242
1151/****************************************************************************** 1243/******************************************************************************
1152 * 1244 *
1153 * FUNCTION: acpi_os_validate_interface 1245 * FUNCTION: acpi_os_validate_interface
@@ -1167,13 +1259,29 @@ acpi_os_validate_interface (char *interface)
1167 if (!strncmp(osi_additional_string, interface, OSI_STRING_LENGTH_MAX)) 1259 if (!strncmp(osi_additional_string, interface, OSI_STRING_LENGTH_MAX))
1168 return AE_OK; 1260 return AE_OK;
1169 if (!strcmp("Linux", interface)) { 1261 if (!strcmp("Linux", interface)) {
1170 printk(KERN_WARNING PREFIX 1262
1171 "System BIOS is requesting _OSI(Linux)\n"); 1263 printk(KERN_NOTICE PREFIX
1172 printk(KERN_WARNING PREFIX 1264 "BIOS _OSI(Linux) query %s%s\n",
1173 "If \"acpi_osi=Linux\" works better,\n" 1265 osi_linux.enable ? "honored" : "ignored",
1174 "Please send dmidecode " 1266 osi_linux.cmdline ? " via cmdline" :
1175 "to linux-acpi@vger.kernel.org\n"); 1267 osi_linux.dmi ? " via DMI" : "");
1176 if(osi_linux) 1268
1269 if (!osi_linux.dmi) {
1270 if (acpi_dmi_dump())
1271 printk(KERN_NOTICE PREFIX
1272 "[please extract dmidecode output]\n");
1273 printk(KERN_NOTICE PREFIX
1274 "Please send DMI info above to "
1275 "linux-acpi@vger.kernel.org\n");
1276 }
1277 if (!osi_linux.known && !osi_linux.cmdline) {
1278 printk(KERN_NOTICE PREFIX
1279 "If \"acpi_osi=%sLinux\" works better, "
1280 "please notify linux-acpi@vger.kernel.org\n",
1281 osi_linux.enable ? "!" : "");
1282 }
1283
1284 if (osi_linux.enable)
1177 return AE_OK; 1285 return AE_OK;
1178 } 1286 }
1179 return AE_SUPPORT; 1287 return AE_SUPPORT;
@@ -1205,28 +1313,4 @@ acpi_os_validate_address (
1205 return AE_OK; 1313 return AE_OK;
1206} 1314}
1207 1315
1208#ifdef CONFIG_DMI
1209static int dmi_osi_linux(const struct dmi_system_id *d)
1210{
1211 printk(KERN_NOTICE "%s detected: enabling _OSI(Linux)\n", d->ident);
1212 enable_osi_linux(1);
1213 return 0;
1214}
1215
1216static struct dmi_system_id acpi_osl_dmi_table[] __initdata = {
1217 /*
1218 * Boxes that need _OSI(Linux)
1219 */
1220 {
1221 .callback = dmi_osi_linux,
1222 .ident = "Intel Napa CRB",
1223 .matches = {
1224 DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"),
1225 DMI_MATCH(DMI_BOARD_NAME, "MPAD-MSAE Customer Reference Boards"),
1226 },
1227 },
1228 {}
1229};
1230#endif /* CONFIG_DMI */
1231
1232#endif 1316#endif