aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/asus_acpi.c55
-rw-r--r--drivers/acpi/battery.c5
-rw-r--r--drivers/acpi/bay.c6
-rw-r--r--drivers/acpi/blacklist.c58
-rw-r--r--drivers/acpi/debug.c57
-rw-r--r--drivers/acpi/dock.c6
-rw-r--r--drivers/acpi/ec.c19
-rw-r--r--drivers/acpi/events/evgpe.c25
-rw-r--r--drivers/acpi/hardware/hwsleep.c2
-rw-r--r--drivers/acpi/namespace/nsxfeval.c10
-rw-r--r--drivers/acpi/osl.c69
-rw-r--r--drivers/acpi/pci_irq.c5
-rw-r--r--drivers/acpi/power.c6
-rw-r--r--drivers/acpi/processor_core.c17
-rw-r--r--drivers/acpi/processor_idle.c47
-rw-r--r--drivers/acpi/processor_perflib.c16
-rw-r--r--drivers/acpi/scan.c100
-rw-r--r--drivers/acpi/sleep/main.c17
-rw-r--r--drivers/acpi/sleep/proc.c46
-rw-r--r--drivers/acpi/tables/Makefile2
-rw-r--r--drivers/acpi/tables/tbxfroot.c4
-rw-r--r--drivers/acpi/thermal.c17
-rw-r--r--drivers/acpi/video.c49
23 files changed, 452 insertions, 186 deletions
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c
index d915fec9bf63..d25ef961415c 100644
--- a/drivers/acpi/asus_acpi.c
+++ b/drivers/acpi/asus_acpi.c
@@ -142,6 +142,7 @@ struct asus_hotk {
142 xxN, //M2400N, M3700N, M5200N, M6800N, S1300N, S5200N 142 xxN, //M2400N, M3700N, M5200N, M6800N, S1300N, S5200N
143 A4S, //Z81sp 143 A4S, //Z81sp
144 //(Centrino) 144 //(Centrino)
145 F3Sa,
145 END_MODEL 146 END_MODEL
146 } model; //Models currently supported 147 } model; //Models currently supported
147 u16 event_count[128]; //count for each event TODO make this better 148 u16 event_count[128]; //count for each event TODO make this better
@@ -405,7 +406,20 @@ static struct model_data model_conf[END_MODEL] = {
405 .brightness_get = "GPLV", 406 .brightness_get = "GPLV",
406 .mt_bt_switch = "BLED", 407 .mt_bt_switch = "BLED",
407 .mt_wled = "WLED" 408 .mt_wled = "WLED"
408 } 409 },
410
411 {
412 .name = "F3Sa",
413 .mt_bt_switch = "BLED",
414 .mt_wled = "WLED",
415 .mt_mled = "MLED",
416 .brightness_get = "GPLV",
417 .brightness_set = "SPLV",
418 .mt_lcd_switch = "\\_SB.PCI0.SBRG.EC0._Q10",
419 .lcd_status = "\\_SB.PCI0.SBRG.EC0.RPIN",
420 .display_get = "\\ADVG",
421 .display_set = "SDSP",
422 },
409 423
410}; 424};
411 425
@@ -710,15 +724,8 @@ static int get_lcd_state(void)
710{ 724{
711 int lcd = 0; 725 int lcd = 0;
712 726
713 if (hotk->model != L3H) { 727 if (hotk->model == L3H) {
714 /* We don't have to check anything if we are here */ 728 /* L3H and the like have to be handled differently */
715 if (!read_acpi_int(NULL, hotk->methods->lcd_status, &lcd))
716 printk(KERN_WARNING
717 "Asus ACPI: Error reading LCD status\n");
718
719 if (hotk->model == L2D)
720 lcd = ~lcd;
721 } else { /* L3H and the like have to be handled differently */
722 acpi_status status = 0; 729 acpi_status status = 0;
723 struct acpi_object_list input; 730 struct acpi_object_list input;
724 union acpi_object mt_params[2]; 731 union acpi_object mt_params[2];
@@ -745,6 +752,32 @@ static int get_lcd_state(void)
745 if (out_obj.type == ACPI_TYPE_INTEGER) 752 if (out_obj.type == ACPI_TYPE_INTEGER)
746 /* That's what the AML code does */ 753 /* That's what the AML code does */
747 lcd = out_obj.integer.value >> 8; 754 lcd = out_obj.integer.value >> 8;
755 } else if (hotk->model == F3Sa) {
756 unsigned long tmp;
757 union acpi_object param;
758 struct acpi_object_list input;
759 acpi_status status;
760
761 /* Read pin 11 */
762 param.type = ACPI_TYPE_INTEGER;
763 param.integer.value = 0x11;
764 input.count = 1;
765 input.pointer = &param;
766
767 status = acpi_evaluate_integer(NULL, hotk->methods->lcd_status,
768 &input, &tmp);
769 if (status != AE_OK)
770 return -1;
771
772 lcd = tmp;
773 } else {
774 /* We don't have to check anything if we are here */
775 if (!read_acpi_int(NULL, hotk->methods->lcd_status, &lcd))
776 printk(KERN_WARNING
777 "Asus ACPI: Error reading LCD status\n");
778
779 if (hotk->model == L2D)
780 lcd = ~lcd;
748 } 781 }
749 782
750 return (lcd & 1); 783 return (lcd & 1);
@@ -1134,6 +1167,8 @@ static int asus_model_match(char *model)
1134 return W5A; 1167 return W5A;
1135 else if (strncmp(model, "A4S", 3) == 0) 1168 else if (strncmp(model, "A4S", 3) == 0)
1136 return A4S; 1169 return A4S;
1170 else if (strncmp(model, "F3Sa", 4) == 0)
1171 return F3Sa;
1137 else 1172 else
1138 return END_MODEL; 1173 return END_MODEL;
1139} 1174}
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index c4a769d1ba85..f6215e809808 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -194,6 +194,9 @@ static int acpi_battery_get_property(struct power_supply *psy,
194 case POWER_SUPPLY_PROP_MANUFACTURER: 194 case POWER_SUPPLY_PROP_MANUFACTURER:
195 val->strval = battery->oem_info; 195 val->strval = battery->oem_info;
196 break; 196 break;
197 case POWER_SUPPLY_PROP_SERIAL_NUMBER:
198 val->strval = battery->serial_number;
199 break;
197 default: 200 default:
198 return -EINVAL; 201 return -EINVAL;
199 } 202 }
@@ -212,6 +215,7 @@ static enum power_supply_property charge_battery_props[] = {
212 POWER_SUPPLY_PROP_CHARGE_NOW, 215 POWER_SUPPLY_PROP_CHARGE_NOW,
213 POWER_SUPPLY_PROP_MODEL_NAME, 216 POWER_SUPPLY_PROP_MODEL_NAME,
214 POWER_SUPPLY_PROP_MANUFACTURER, 217 POWER_SUPPLY_PROP_MANUFACTURER,
218 POWER_SUPPLY_PROP_SERIAL_NUMBER,
215}; 219};
216 220
217static enum power_supply_property energy_battery_props[] = { 221static enum power_supply_property energy_battery_props[] = {
@@ -226,6 +230,7 @@ static enum power_supply_property energy_battery_props[] = {
226 POWER_SUPPLY_PROP_ENERGY_NOW, 230 POWER_SUPPLY_PROP_ENERGY_NOW,
227 POWER_SUPPLY_PROP_MODEL_NAME, 231 POWER_SUPPLY_PROP_MODEL_NAME,
228 POWER_SUPPLY_PROP_MANUFACTURER, 232 POWER_SUPPLY_PROP_MANUFACTURER,
233 POWER_SUPPLY_PROP_SERIAL_NUMBER,
229}; 234};
230#endif 235#endif
231 236
diff --git a/drivers/acpi/bay.c b/drivers/acpi/bay.c
index 6daf6088ac88..477711435b24 100644
--- a/drivers/acpi/bay.c
+++ b/drivers/acpi/bay.c
@@ -46,6 +46,12 @@ MODULE_LICENSE("GPL");
46 printk(KERN_DEBUG PREFIX "%s: %s\n", prefix, s); } 46 printk(KERN_DEBUG PREFIX "%s: %s\n", prefix, s); }
47static void bay_notify(acpi_handle handle, u32 event, void *data); 47static void bay_notify(acpi_handle handle, u32 event, void *data);
48 48
49static const struct acpi_device_id bay_device_ids[] = {
50 {"LNXIOBAY", 0},
51 {"", 0},
52};
53MODULE_DEVICE_TABLE(acpi, bay_device_ids);
54
49struct bay { 55struct bay {
50 acpi_handle handle; 56 acpi_handle handle;
51 char *name; 57 char *name;
diff --git a/drivers/acpi/blacklist.c b/drivers/acpi/blacklist.c
index 8809654d6cc9..6dbaa2d15fe0 100644
--- a/drivers/acpi/blacklist.c
+++ b/drivers/acpi/blacklist.c
@@ -70,8 +70,6 @@ static struct acpi_blacklist_item acpi_blacklist[] __initdata = {
70 /* IBM 600E - _ADR should return 7, but it returns 1 */ 70 /* IBM 600E - _ADR should return 7, but it returns 1 */
71 {"IBM ", "TP600E ", 0x00000105, ACPI_SIG_DSDT, less_than_or_equal, 71 {"IBM ", "TP600E ", 0x00000105, ACPI_SIG_DSDT, less_than_or_equal,
72 "Incorrect _ADR", 1}, 72 "Incorrect _ADR", 1},
73 {"ASUS\0\0", "P2B-S ", 0, ACPI_SIG_DSDT, all_versions,
74 "Bogus PCI routing", 1},
75 73
76 {""} 74 {""}
77}; 75};
@@ -208,33 +206,35 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
208 * Disable OSI(Linux) warnings on all "Acer, inc." 206 * Disable OSI(Linux) warnings on all "Acer, inc."
209 * 207 *
210 * _OSI(Linux) disables the latest Windows BIOS code: 208 * _OSI(Linux) disables the latest Windows BIOS code:
209 * DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 3100"),
211 * DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5050"), 210 * DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5050"),
211 * DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5100"),
212 * DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5580"), 212 * DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5580"),
213 * DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 3010"), 213 * DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 3010"),
214 * _OSI(Linux) effect unknown: 214 * _OSI(Linux) effect unknown:
215 * DMI_MATCH(DMI_PRODUCT_NAME, "Ferrari 5000"), 215 * DMI_MATCH(DMI_PRODUCT_NAME, "Ferrari 5000"),
216 */ 216 */
217 { 217 /*
218 .callback = dmi_disable_osi_linux, 218 * note that dmi_check_system() uses strstr()
219 .ident = "Acer, inc.", 219 * to match sub-strings rather than !strcmp(),
220 .matches = { 220 * so "Acer" below matches "Acer, inc." above.
221 DMI_MATCH(DMI_SYS_VENDOR, "Acer, inc."), 221 */
222 },
223 },
224 /* 222 /*
225 * Disable OSI(Linux) warnings on all "Acer" 223 * Disable OSI(Linux) warnings on all "Acer"
226 * 224 *
227 * _OSI(Linux) effect unknown: 225 * _OSI(Linux) effect unknown:
228 * DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5100"),
229 * DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5610"), 226 * DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5610"),
230 * DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 7720Z"), 227 * DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 7720Z"),
231 * DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 5520"), 228 * DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 5520"),
232 * DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 6460"), 229 * DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 6460"),
233 * DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 7510"), 230 * DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 7510"),
234 * DMI_MATCH(DMI_PRODUCT_NAME, "Extensa 5220"), 231 * DMI_MATCH(DMI_PRODUCT_NAME, "Extensa 5220"),
232 *
233 * _OSI(Linux) is a NOP:
234 * DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5315"),
235 */ 235 */
236 { 236 {
237 .callback = dmi_unknown_osi_linux, 237 .callback = dmi_disable_osi_linux,
238 .ident = "Acer", 238 .ident = "Acer",
239 .matches = { 239 .matches = {
240 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 240 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
@@ -242,21 +242,22 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
242 }, 242 },
243 /* 243 /*
244 * Disable OSI(Linux) warnings on all "Apple Computer, Inc." 244 * Disable OSI(Linux) warnings on all "Apple Computer, Inc."
245 * Disable OSI(Linux) warnings on all "Apple Inc."
245 * 246 *
246 * _OSI(Linux) confirmed to be a NOP: 247 * _OSI(Linux) confirmed to be a NOP:
247 * DMI_MATCH(DMI_PRODUCT_NAME, "MacBook1,1"), 248 * DMI_MATCH(DMI_PRODUCT_NAME, "MacBook1,1"),
248 * DMI_MATCH(DMI_PRODUCT_NAME, "MacBook2,1"), 249 * DMI_MATCH(DMI_PRODUCT_NAME, "MacBook2,1"),
249 * DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro2,2"), 250 * DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro2,2"),
251 * DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro3,1"),
250 * _OSI(Linux) effect unknown: 252 * _OSI(Linux) effect unknown:
251 * DMI_MATCH(DMI_PRODUCT_NAME, "MacPro2,1"), 253 * DMI_MATCH(DMI_PRODUCT_NAME, "MacPro2,1"),
252 * DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro1,1"), 254 * DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro1,1"),
253 * DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro3,1"),
254 */ 255 */
255 { 256 {
256 .callback = dmi_disable_osi_linux, 257 .callback = dmi_disable_osi_linux,
257 .ident = "Apple", 258 .ident = "Apple",
258 .matches = { 259 .matches = {
259 DMI_MATCH(DMI_SYS_VENDOR, "Apple Computer, Inc."), 260 DMI_MATCH(DMI_SYS_VENDOR, "Apple"),
260 }, 261 },
261 }, 262 },
262 /* 263 /*
@@ -294,13 +295,13 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
294 * DMI_MATCH(DMI_BOARD_NAME, "IFL91"), 295 * DMI_MATCH(DMI_BOARD_NAME, "IFL91"),
295 */ 296 */
296 { 297 {
297 .callback = dmi_unknown_osi_linux, 298 .callback = dmi_disable_osi_linux,
298 .ident = "Compal", 299 .ident = "Compal",
299 .matches = { 300 .matches = {
300 DMI_MATCH(DMI_BIOS_VENDOR, "COMPAL"), 301 DMI_MATCH(DMI_BIOS_VENDOR, "COMPAL"),
301 }, 302 },
302 }, 303 },
303 { /* OSI(Linux) touches USB, breaks suspend to disk */ 304 { /* OSI(Linux) touches USB, unknown side-effect */
304 .callback = dmi_disable_osi_linux, 305 .callback = dmi_disable_osi_linux,
305 .ident = "Dell Dimension 5150", 306 .ident = "Dell Dimension 5150",
306 .matches = { 307 .matches = {
@@ -310,7 +311,7 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
310 }, 311 },
311 { /* OSI(Linux) is a NOP */ 312 { /* OSI(Linux) is a NOP */
312 .callback = dmi_disable_osi_linux, 313 .callback = dmi_disable_osi_linux,
313 .ident = "Dell", 314 .ident = "Dell i1501",
314 .matches = { 315 .matches = {
315 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 316 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
316 DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 1501"), 317 DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 1501"),
@@ -318,7 +319,7 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
318 }, 319 },
319 { /* OSI(Linux) effect unknown */ 320 { /* OSI(Linux) effect unknown */
320 .callback = dmi_unknown_osi_linux, 321 .callback = dmi_unknown_osi_linux,
321 .ident = "Dell", 322 .ident = "Dell Latitude D830",
322 .matches = { 323 .matches = {
323 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 324 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
324 DMI_MATCH(DMI_PRODUCT_NAME, "Latitude D830"), 325 DMI_MATCH(DMI_PRODUCT_NAME, "Latitude D830"),
@@ -326,7 +327,7 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
326 }, 327 },
327 { /* OSI(Linux) effect unknown */ 328 { /* OSI(Linux) effect unknown */
328 .callback = dmi_unknown_osi_linux, 329 .callback = dmi_unknown_osi_linux,
329 .ident = "Dell", 330 .ident = "Dell OP GX620",
330 .matches = { 331 .matches = {
331 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 332 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
332 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex GX620"), 333 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex GX620"),
@@ -334,15 +335,23 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
334 }, 335 },
335 { /* OSI(Linux) effect unknown */ 336 { /* OSI(Linux) effect unknown */
336 .callback = dmi_unknown_osi_linux, 337 .callback = dmi_unknown_osi_linux,
337 .ident = "Dell", 338 .ident = "Dell PE 1900",
338 .matches = { 339 .matches = {
339 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 340 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
340 DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 1900"), 341 DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 1900"),
341 }, 342 },
342 }, 343 },
344 { /* OSI(Linux) is a NOP */
345 .callback = dmi_disable_osi_linux,
346 .ident = "Dell PE R200",
347 .matches = {
348 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
349 DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge R200"),
350 },
351 },
343 { /* OSI(Linux) touches USB */ 352 { /* OSI(Linux) touches USB */
344 .callback = dmi_disable_osi_linux, 353 .callback = dmi_disable_osi_linux,
345 .ident = "Dell", 354 .ident = "Dell PR 390",
346 .matches = { 355 .matches = {
347 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 356 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
348 DMI_MATCH(DMI_PRODUCT_NAME, "Precision WorkStation 390"), 357 DMI_MATCH(DMI_PRODUCT_NAME, "Precision WorkStation 390"),
@@ -358,7 +367,7 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
358 }, 367 },
359 { /* OSI(Linux) effect unknown */ 368 { /* OSI(Linux) effect unknown */
360 .callback = dmi_unknown_osi_linux, 369 .callback = dmi_unknown_osi_linux,
361 .ident = "Dell", 370 .ident = "Dell PE SC440",
362 .matches = { 371 .matches = {
363 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 372 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
364 DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge SC440"), 373 DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge SC440"),
@@ -474,6 +483,11 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
474 * 483 *
475 * _OSI(Linux) confirmed to be a NOP: 484 * _OSI(Linux) confirmed to be a NOP:
476 * DMI_MATCH(DMI_PRODUCT_NAME, "P1-J150B"), 485 * DMI_MATCH(DMI_PRODUCT_NAME, "P1-J150B"),
486 * with DMI_MATCH(DMI_BOARD_NAME, "ROCKY"),
487 *
488 * unknown:
489 * DMI_MATCH(DMI_PRODUCT_NAME, "S1-MDGDG"),
490 * with DMI_MATCH(DMI_BOARD_NAME, "ROCKY"),
477 */ 491 */
478 { 492 {
479 .callback = dmi_disable_osi_linux, 493 .callback = dmi_disable_osi_linux,
@@ -516,7 +530,7 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
516 * DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FZ11M"), 530 * DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FZ11M"),
517 */ 531 */
518 { 532 {
519 .callback = dmi_unknown_osi_linux, 533 .callback = dmi_disable_osi_linux,
520 .ident = "Sony", 534 .ident = "Sony",
521 .matches = { 535 .matches = {
522 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), 536 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
diff --git a/drivers/acpi/debug.c b/drivers/acpi/debug.c
index bf513e07b773..6df564f4ca6e 100644
--- a/drivers/acpi/debug.c
+++ b/drivers/acpi/debug.c
@@ -130,6 +130,63 @@ static int param_get_debug_level(char *buffer, struct kernel_param *kp) {
130module_param_call(debug_layer, param_set_uint, param_get_debug_layer, &acpi_dbg_layer, 0644); 130module_param_call(debug_layer, param_set_uint, param_get_debug_layer, &acpi_dbg_layer, 0644);
131module_param_call(debug_level, param_set_uint, param_get_debug_level, &acpi_dbg_level, 0644); 131module_param_call(debug_level, param_set_uint, param_get_debug_level, &acpi_dbg_level, 0644);
132 132
133static char trace_method_name[6];
134module_param_string(trace_method_name, trace_method_name, 6, 0644);
135static unsigned int trace_debug_layer;
136module_param(trace_debug_layer, uint, 0644);
137static unsigned int trace_debug_level;
138module_param(trace_debug_level, uint, 0644);
139
140static int param_set_trace_state(const char *val, struct kernel_param *kp)
141{
142 int result = 0;
143
144 if (!strncmp(val, "enable", strlen("enable") - 1)) {
145 result = acpi_debug_trace(trace_method_name, trace_debug_level,
146 trace_debug_layer, 0);
147 if (result)
148 result = -EBUSY;
149 goto exit;
150 }
151
152 if (!strncmp(val, "disable", strlen("disable") - 1)) {
153 int name = 0;
154 result = acpi_debug_trace((char *)&name, trace_debug_level,
155 trace_debug_layer, 0);
156 if (result)
157 result = -EBUSY;
158 goto exit;
159 }
160
161 if (!strncmp(val, "1", 1)) {
162 result = acpi_debug_trace(trace_method_name, trace_debug_level,
163 trace_debug_layer, 1);
164 if (result)
165 result = -EBUSY;
166 goto exit;
167 }
168
169 result = -EINVAL;
170exit:
171 return result;
172}
173
174static int param_get_trace_state(char *buffer, struct kernel_param *kp)
175{
176 if (!acpi_gbl_trace_method_name)
177 return sprintf(buffer, "disable");
178 else {
179 if (acpi_gbl_trace_flags & 1)
180 return sprintf(buffer, "1");
181 else
182 return sprintf(buffer, "enable");
183 }
184 return 0;
185}
186
187module_param_call(trace_state, param_set_trace_state, param_get_trace_state,
188 NULL, 0644);
189
133/* -------------------------------------------------------------------------- 190/* --------------------------------------------------------------------------
134 FS Interface (/proc) 191 FS Interface (/proc)
135 -------------------------------------------------------------------------- */ 192 -------------------------------------------------------------------------- */
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
index 1dabdf4c07b3..b3dec2101e2e 100644
--- a/drivers/acpi/dock.c
+++ b/drivers/acpi/dock.c
@@ -51,6 +51,12 @@ static struct atomic_notifier_head dock_notifier_list;
51static struct platform_device *dock_device; 51static struct platform_device *dock_device;
52static char dock_device_name[] = "dock"; 52static char dock_device_name[] = "dock";
53 53
54static const struct acpi_device_id dock_device_ids[] = {
55 {"LNXDOCK", 0},
56 {"", 0},
57};
58MODULE_DEVICE_TABLE(acpi, dock_device_ids);
59
54struct dock_station { 60struct dock_station {
55 acpi_handle handle; 61 acpi_handle handle;
56 unsigned long last_dock_time; 62 unsigned long last_dock_time;
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 987b967c7467..7222a18a0319 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -573,7 +573,7 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address,
573 void *handler_context, void *region_context) 573 void *handler_context, void *region_context)
574{ 574{
575 struct acpi_ec *ec = handler_context; 575 struct acpi_ec *ec = handler_context;
576 int result = 0, i = 0; 576 int result = 0, i;
577 u8 temp = 0; 577 u8 temp = 0;
578 578
579 if ((address > 0xFF) || !value || !handler_context) 579 if ((address > 0xFF) || !value || !handler_context)
@@ -585,7 +585,18 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address,
585 if (bits != 8 && acpi_strict) 585 if (bits != 8 && acpi_strict)
586 return AE_BAD_PARAMETER; 586 return AE_BAD_PARAMETER;
587 587
588 while (bits - i > 0) { 588 acpi_ec_burst_enable(ec);
589
590 if (function == ACPI_READ) {
591 result = acpi_ec_read(ec, address, &temp);
592 *value = temp;
593 } else {
594 temp = 0xff & (*value);
595 result = acpi_ec_write(ec, address, temp);
596 }
597
598 for (i = 8; unlikely(bits - i > 0); i += 8) {
599 ++address;
589 if (function == ACPI_READ) { 600 if (function == ACPI_READ) {
590 result = acpi_ec_read(ec, address, &temp); 601 result = acpi_ec_read(ec, address, &temp);
591 (*value) |= ((acpi_integer)temp) << i; 602 (*value) |= ((acpi_integer)temp) << i;
@@ -593,10 +604,10 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address,
593 temp = 0xff & ((*value) >> i); 604 temp = 0xff & ((*value) >> i);
594 result = acpi_ec_write(ec, address, temp); 605 result = acpi_ec_write(ec, address, temp);
595 } 606 }
596 i += 8;
597 ++address;
598 } 607 }
599 608
609 acpi_ec_burst_disable(ec);
610
600 switch (result) { 611 switch (result) {
601 case -EINVAL: 612 case -EINVAL:
602 return AE_BAD_PARAMETER; 613 return AE_BAD_PARAMETER;
diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c
index 4bd9e2291bd9..0dadd2adc800 100644
--- a/drivers/acpi/events/evgpe.c
+++ b/drivers/acpi/events/evgpe.c
@@ -270,18 +270,18 @@ acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info)
270 case ACPI_GPE_TYPE_WAKE_RUN: 270 case ACPI_GPE_TYPE_WAKE_RUN:
271 ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED); 271 ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
272 272
273 /*lint -fallthrough */ 273 /* fallthrough */
274 274
275 case ACPI_GPE_TYPE_RUNTIME: 275 case ACPI_GPE_TYPE_RUNTIME:
276 276
277 /* Disable the requested runtime GPE */ 277 /* Disable the requested runtime GPE */
278 278
279 ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED); 279 ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED);
280 status = acpi_hw_write_gpe_enable_reg(gpe_event_info); 280
281 break; 281 /* fallthrough */
282 282
283 default: 283 default:
284 return_ACPI_STATUS(AE_BAD_PARAMETER); 284 acpi_hw_write_gpe_enable_reg(gpe_event_info);
285 } 285 }
286 286
287 return_ACPI_STATUS(AE_OK); 287 return_ACPI_STATUS(AE_OK);
@@ -501,6 +501,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
501 * an interrupt handler. 501 * an interrupt handler.
502 * 502 *
503 ******************************************************************************/ 503 ******************************************************************************/
504static void acpi_ev_asynch_enable_gpe(void *context);
504 505
505static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) 506static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
506{ 507{
@@ -576,22 +577,30 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
576 method_node))); 577 method_node)));
577 } 578 }
578 } 579 }
580 /* Defer enabling of GPE until all notify handlers are done */
581 acpi_os_execute(OSL_NOTIFY_HANDLER, acpi_ev_asynch_enable_gpe,
582 gpe_event_info);
583 return_VOID;
584}
579 585
580 if ((local_gpe_event_info.flags & ACPI_GPE_XRUPT_TYPE_MASK) == 586static void acpi_ev_asynch_enable_gpe(void *context)
587{
588 struct acpi_gpe_event_info *gpe_event_info = context;
589 acpi_status status;
590 if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
581 ACPI_GPE_LEVEL_TRIGGERED) { 591 ACPI_GPE_LEVEL_TRIGGERED) {
582 /* 592 /*
583 * GPE is level-triggered, we clear the GPE status bit after 593 * GPE is level-triggered, we clear the GPE status bit after
584 * handling the event. 594 * handling the event.
585 */ 595 */
586 status = acpi_hw_clear_gpe(&local_gpe_event_info); 596 status = acpi_hw_clear_gpe(gpe_event_info);
587 if (ACPI_FAILURE(status)) { 597 if (ACPI_FAILURE(status)) {
588 return_VOID; 598 return_VOID;
589 } 599 }
590 } 600 }
591 601
592 /* Enable this GPE */ 602 /* Enable this GPE */
593 603 (void)acpi_hw_write_gpe_enable_reg(gpe_event_info);
594 (void)acpi_hw_write_gpe_enable_reg(&local_gpe_event_info);
595 return_VOID; 604 return_VOID;
596} 605}
597 606
diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c
index fd1c4ba63367..058d0be5cbe2 100644
--- a/drivers/acpi/hardware/hwsleep.c
+++ b/drivers/acpi/hardware/hwsleep.c
@@ -286,13 +286,13 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
286 } 286 }
287 287
288 /* 288 /*
289 * 1) Disable/Clear all GPEs
289 * 2) Enable all wakeup GPEs 290 * 2) Enable all wakeup GPEs
290 */ 291 */
291 status = acpi_hw_disable_all_gpes(); 292 status = acpi_hw_disable_all_gpes();
292 if (ACPI_FAILURE(status)) { 293 if (ACPI_FAILURE(status)) {
293 return_ACPI_STATUS(status); 294 return_ACPI_STATUS(status);
294 } 295 }
295
296 acpi_gbl_system_awake_and_running = FALSE; 296 acpi_gbl_system_awake_and_running = FALSE;
297 297
298 status = acpi_hw_enable_all_wakeup_gpes(); 298 status = acpi_hw_enable_all_wakeup_gpes();
diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c
index f39fbc6b9237..b92133faf5b7 100644
--- a/drivers/acpi/namespace/nsxfeval.c
+++ b/drivers/acpi/namespace/nsxfeval.c
@@ -443,6 +443,7 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
443 struct acpica_device_id hid; 443 struct acpica_device_id hid;
444 struct acpi_compatible_id_list *cid; 444 struct acpi_compatible_id_list *cid;
445 acpi_native_uint i; 445 acpi_native_uint i;
446 int found;
446 447
447 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); 448 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
448 if (ACPI_FAILURE(status)) { 449 if (ACPI_FAILURE(status)) {
@@ -496,16 +497,19 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
496 497
497 /* Walk the CID list */ 498 /* Walk the CID list */
498 499
500 found = 0;
499 for (i = 0; i < cid->count; i++) { 501 for (i = 0; i < cid->count; i++) {
500 if (ACPI_STRNCMP(cid->id[i].value, info->hid, 502 if (ACPI_STRNCMP(cid->id[i].value, info->hid,
501 sizeof(struct 503 sizeof(struct
502 acpi_compatible_id)) != 504 acpi_compatible_id)) ==
503 0) { 505 0) {
504 ACPI_FREE(cid); 506 found = 1;
505 return (AE_OK); 507 break;
506 } 508 }
507 } 509 }
508 ACPI_FREE(cid); 510 ACPI_FREE(cid);
511 if (!found)
512 return (AE_OK);
509 } 513 }
510 } 514 }
511 515
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 1087efeca9b1..3b8aef3aefe5 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -120,7 +120,7 @@ static char osi_additional_string[OSI_STRING_LENGTH_MAX];
120 */ 120 */
121#define OSI_LINUX_ENABLE 0 121#define OSI_LINUX_ENABLE 0
122 122
123struct osi_linux { 123static struct osi_linux {
124 unsigned int enable:1; 124 unsigned int enable:1;
125 unsigned int dmi:1; 125 unsigned int dmi:1;
126 unsigned int cmdline:1; 126 unsigned int cmdline:1;
@@ -250,11 +250,16 @@ acpi_physical_address __init acpi_os_get_root_pointer(void)
250 "System description tables not found\n"); 250 "System description tables not found\n");
251 return 0; 251 return 0;
252 } 252 }
253 } else 253 } else {
254 return acpi_find_rsdp(); 254 acpi_physical_address pa = 0;
255
256 acpi_find_root_pointer(&pa);
257 return pa;
258 }
255} 259}
256 260
257void __iomem *acpi_os_map_memory(acpi_physical_address phys, acpi_size size) 261void __iomem *__init_refok
262acpi_os_map_memory(acpi_physical_address phys, acpi_size size)
258{ 263{
259 if (phys > ULONG_MAX) { 264 if (phys > ULONG_MAX) {
260 printk(KERN_ERR PREFIX "Cannot map memory that high\n"); 265 printk(KERN_ERR PREFIX "Cannot map memory that high\n");
@@ -671,25 +676,6 @@ static void acpi_os_execute_deferred(struct work_struct *work)
671 dpc->function(dpc->context); 676 dpc->function(dpc->context);
672 kfree(dpc); 677 kfree(dpc);
673 678
674 /* Yield cpu to notify thread */
675 cond_resched();
676
677 return;
678}
679
680static void acpi_os_execute_notify(struct work_struct *work)
681{
682 struct acpi_os_dpc *dpc = container_of(work, struct acpi_os_dpc, work);
683
684 if (!dpc) {
685 printk(KERN_ERR PREFIX "Invalid (NULL) context\n");
686 return;
687 }
688
689 dpc->function(dpc->context);
690
691 kfree(dpc);
692
693 return; 679 return;
694} 680}
695 681
@@ -713,7 +699,7 @@ acpi_status acpi_os_execute(acpi_execute_type type,
713{ 699{
714 acpi_status status = AE_OK; 700 acpi_status status = AE_OK;
715 struct acpi_os_dpc *dpc; 701 struct acpi_os_dpc *dpc;
716 702 struct workqueue_struct *queue;
717 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 703 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
718 "Scheduling function [%p(%p)] for deferred execution.\n", 704 "Scheduling function [%p(%p)] for deferred execution.\n",
719 function, context)); 705 function, context));
@@ -737,20 +723,13 @@ acpi_status acpi_os_execute(acpi_execute_type type,
737 dpc->function = function; 723 dpc->function = function;
738 dpc->context = context; 724 dpc->context = context;
739 725
740 if (type == OSL_NOTIFY_HANDLER) { 726 INIT_WORK(&dpc->work, acpi_os_execute_deferred);
741 INIT_WORK(&dpc->work, acpi_os_execute_notify); 727 queue = (type == OSL_NOTIFY_HANDLER) ? kacpi_notify_wq : kacpid_wq;
742 if (!queue_work(kacpi_notify_wq, &dpc->work)) { 728 if (!queue_work(queue, &dpc->work)) {
743 status = AE_ERROR; 729 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
744 kfree(dpc); 730 "Call to queue_work() failed.\n"));
745 } 731 status = AE_ERROR;
746 } else { 732 kfree(dpc);
747 INIT_WORK(&dpc->work, acpi_os_execute_deferred);
748 if (!queue_work(kacpid_wq, &dpc->work)) {
749 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
750 "Call to queue_work() failed.\n"));
751 status = AE_ERROR;
752 kfree(dpc);
753 }
754 } 733 }
755 return_ACPI_STATUS(status); 734 return_ACPI_STATUS(status);
756} 735}
@@ -1223,24 +1202,24 @@ acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object)
1223 * 1202 *
1224 * Returns 0 on success 1203 * Returns 0 on success
1225 */ 1204 */
1226int acpi_dmi_dump(void) 1205static int acpi_dmi_dump(void)
1227{ 1206{
1228 1207
1229 if (!dmi_available) 1208 if (!dmi_available)
1230 return -1; 1209 return -1;
1231 1210
1232 printk(KERN_NOTICE PREFIX "DMI System Vendor: %s\n", 1211 printk(KERN_NOTICE PREFIX "DMI System Vendor: %s\n",
1233 dmi_get_slot(DMI_SYS_VENDOR)); 1212 dmi_get_system_info(DMI_SYS_VENDOR));
1234 printk(KERN_NOTICE PREFIX "DMI Product Name: %s\n", 1213 printk(KERN_NOTICE PREFIX "DMI Product Name: %s\n",
1235 dmi_get_slot(DMI_PRODUCT_NAME)); 1214 dmi_get_system_info(DMI_PRODUCT_NAME));
1236 printk(KERN_NOTICE PREFIX "DMI Product Version: %s\n", 1215 printk(KERN_NOTICE PREFIX "DMI Product Version: %s\n",
1237 dmi_get_slot(DMI_PRODUCT_VERSION)); 1216 dmi_get_system_info(DMI_PRODUCT_VERSION));
1238 printk(KERN_NOTICE PREFIX "DMI Board Name: %s\n", 1217 printk(KERN_NOTICE PREFIX "DMI Board Name: %s\n",
1239 dmi_get_slot(DMI_BOARD_NAME)); 1218 dmi_get_system_info(DMI_BOARD_NAME));
1240 printk(KERN_NOTICE PREFIX "DMI BIOS Vendor: %s\n", 1219 printk(KERN_NOTICE PREFIX "DMI BIOS Vendor: %s\n",
1241 dmi_get_slot(DMI_BIOS_VENDOR)); 1220 dmi_get_system_info(DMI_BIOS_VENDOR));
1242 printk(KERN_NOTICE PREFIX "DMI BIOS Date: %s\n", 1221 printk(KERN_NOTICE PREFIX "DMI BIOS Date: %s\n",
1243 dmi_get_slot(DMI_BIOS_DATE)); 1222 dmi_get_system_info(DMI_BIOS_DATE));
1244 1223
1245 return 0; 1224 return 0;
1246} 1225}
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c
index 62010c2481b3..76d9c669d2d8 100644
--- a/drivers/acpi/pci_irq.c
+++ b/drivers/acpi/pci_irq.c
@@ -51,10 +51,8 @@ static struct acpi_prt_entry *acpi_pci_irq_find_prt_entry(int segment,
51 int bus, 51 int bus,
52 int device, int pin) 52 int device, int pin)
53{ 53{
54 struct list_head *node = NULL;
55 struct acpi_prt_entry *entry = NULL; 54 struct acpi_prt_entry *entry = NULL;
56 55
57
58 if (!acpi_prt.count) 56 if (!acpi_prt.count)
59 return NULL; 57 return NULL;
60 58
@@ -64,8 +62,7 @@ static struct acpi_prt_entry *acpi_pci_irq_find_prt_entry(int segment,
64 * 62 *
65 */ 63 */
66 spin_lock(&acpi_prt_lock); 64 spin_lock(&acpi_prt_lock);
67 list_for_each(node, &acpi_prt.entries) { 65 list_for_each_entry(entry, &acpi_prt.entries, node) {
68 entry = list_entry(node, struct acpi_prt_entry, node);
69 if ((segment == entry->id.segment) 66 if ((segment == entry->id.segment)
70 && (bus == entry->id.bus) 67 && (bus == entry->id.bus)
71 && (device == entry->id.device) 68 && (device == entry->id.device)
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index af1769a20c7a..76bf6d90c700 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -458,11 +458,9 @@ int acpi_power_transition(struct acpi_device *device, int state)
458 } 458 }
459 459
460 end: 460 end:
461 if (result) { 461 if (result)
462 device->power.state = ACPI_STATE_UNKNOWN; 462 device->power.state = ACPI_STATE_UNKNOWN;
463 printk(KERN_WARNING PREFIX "Transitioning device [%s] to D%d\n", 463 else {
464 device->pnp.bus_id, state);
465 } else {
466 /* We shouldn't change the state till all above operations succeed */ 464 /* We shouldn't change the state till all above operations succeed */
467 device->power.state = state; 465 device->power.state = state;
468 } 466 }
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index e48ee4f8749f..c53113e18004 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -812,11 +812,18 @@ static int is_processor_present(acpi_handle handle)
812 812
813 813
814 status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); 814 status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
815 if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_PRESENT)) { 815 /*
816 ACPI_EXCEPTION((AE_INFO, status, "Processor Device is not present")); 816 * if a processor object does not have an _STA object,
817 return 0; 817 * OSPM assumes that the processor is present.
818 } 818 */
819 return 1; 819 if (status == AE_NOT_FOUND)
820 return 1;
821
822 if (ACPI_SUCCESS(status) && (sta & ACPI_STA_DEVICE_PRESENT))
823 return 1;
824
825 ACPI_EXCEPTION((AE_INFO, status, "Processor Device is not present"));
826 return 0;
820} 827}
821 828
822static 829static
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 199ea2146153..32003fdc91e8 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -98,6 +98,9 @@ module_param(bm_history, uint, 0644);
98 98
99static int acpi_processor_set_power_policy(struct acpi_processor *pr); 99static int acpi_processor_set_power_policy(struct acpi_processor *pr);
100 100
101#else /* CONFIG_CPU_IDLE */
102static unsigned int latency_factor __read_mostly = 2;
103module_param(latency_factor, uint, 0644);
101#endif 104#endif
102 105
103/* 106/*
@@ -201,6 +204,10 @@ static inline u32 ticks_elapsed_in_us(u32 t1, u32 t2)
201 return PM_TIMER_TICKS_TO_US((0xFFFFFFFF - t1) + t2); 204 return PM_TIMER_TICKS_TO_US((0xFFFFFFFF - t1) + t2);
202} 205}
203 206
207/*
208 * Callers should disable interrupts before the call and enable
209 * interrupts after return.
210 */
204static void acpi_safe_halt(void) 211static void acpi_safe_halt(void)
205{ 212{
206 current_thread_info()->status &= ~TS_POLLING; 213 current_thread_info()->status &= ~TS_POLLING;
@@ -261,7 +268,7 @@ static atomic_t c3_cpu_count;
261/* Common C-state entry for C2, C3, .. */ 268/* Common C-state entry for C2, C3, .. */
262static void acpi_cstate_enter(struct acpi_processor_cx *cstate) 269static void acpi_cstate_enter(struct acpi_processor_cx *cstate)
263{ 270{
264 if (cstate->space_id == ACPI_CSTATE_FFH) { 271 if (cstate->entry_method == ACPI_CSTATE_FFH) {
265 /* Call into architectural FFH based C-state */ 272 /* Call into architectural FFH based C-state */
266 acpi_processor_ffh_cstate_enter(cstate); 273 acpi_processor_ffh_cstate_enter(cstate);
267 } else { 274 } else {
@@ -413,6 +420,8 @@ static void acpi_processor_idle(void)
413 pm_idle_save(); 420 pm_idle_save();
414 else 421 else
415 acpi_safe_halt(); 422 acpi_safe_halt();
423
424 local_irq_enable();
416 return; 425 return;
417 } 426 }
418 427
@@ -521,6 +530,7 @@ static void acpi_processor_idle(void)
521 * skew otherwise. 530 * skew otherwise.
522 */ 531 */
523 sleep_ticks = 0xFFFFFFFF; 532 sleep_ticks = 0xFFFFFFFF;
533 local_irq_enable();
524 break; 534 break;
525 535
526 case ACPI_STATE_C2: 536 case ACPI_STATE_C2:
@@ -922,20 +932,20 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
922 cx.address = reg->address; 932 cx.address = reg->address;
923 cx.index = current_count + 1; 933 cx.index = current_count + 1;
924 934
925 cx.space_id = ACPI_CSTATE_SYSTEMIO; 935 cx.entry_method = ACPI_CSTATE_SYSTEMIO;
926 if (reg->space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) { 936 if (reg->space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) {
927 if (acpi_processor_ffh_cstate_probe 937 if (acpi_processor_ffh_cstate_probe
928 (pr->id, &cx, reg) == 0) { 938 (pr->id, &cx, reg) == 0) {
929 cx.space_id = ACPI_CSTATE_FFH; 939 cx.entry_method = ACPI_CSTATE_FFH;
930 } else if (cx.type != ACPI_STATE_C1) { 940 } else if (cx.type == ACPI_STATE_C1) {
931 /* 941 /*
932 * C1 is a special case where FIXED_HARDWARE 942 * C1 is a special case where FIXED_HARDWARE
933 * can be handled in non-MWAIT way as well. 943 * can be handled in non-MWAIT way as well.
934 * In that case, save this _CST entry info. 944 * In that case, save this _CST entry info.
935 * That is, we retain space_id of SYSTEM_IO for
936 * halt based C1.
937 * Otherwise, ignore this info and continue. 945 * Otherwise, ignore this info and continue.
938 */ 946 */
947 cx.entry_method = ACPI_CSTATE_HALT;
948 } else {
939 continue; 949 continue;
940 } 950 }
941 } 951 }
@@ -1369,12 +1379,16 @@ static inline void acpi_idle_update_bm_rld(struct acpi_processor *pr,
1369/** 1379/**
1370 * acpi_idle_do_entry - a helper function that does C2 and C3 type entry 1380 * acpi_idle_do_entry - a helper function that does C2 and C3 type entry
1371 * @cx: cstate data 1381 * @cx: cstate data
1382 *
1383 * Caller disables interrupt before call and enables interrupt after return.
1372 */ 1384 */
1373static inline void acpi_idle_do_entry(struct acpi_processor_cx *cx) 1385static inline void acpi_idle_do_entry(struct acpi_processor_cx *cx)
1374{ 1386{
1375 if (cx->space_id == ACPI_CSTATE_FFH) { 1387 if (cx->entry_method == ACPI_CSTATE_FFH) {
1376 /* Call into architectural FFH based C-state */ 1388 /* Call into architectural FFH based C-state */
1377 acpi_processor_ffh_cstate_enter(cx); 1389 acpi_processor_ffh_cstate_enter(cx);
1390 } else if (cx->entry_method == ACPI_CSTATE_HALT) {
1391 acpi_safe_halt();
1378 } else { 1392 } else {
1379 int unused; 1393 int unused;
1380 /* IO port based C-state */ 1394 /* IO port based C-state */
@@ -1396,21 +1410,27 @@ static inline void acpi_idle_do_entry(struct acpi_processor_cx *cx)
1396static int acpi_idle_enter_c1(struct cpuidle_device *dev, 1410static int acpi_idle_enter_c1(struct cpuidle_device *dev,
1397 struct cpuidle_state *state) 1411 struct cpuidle_state *state)
1398{ 1412{
1413 u32 t1, t2;
1399 struct acpi_processor *pr; 1414 struct acpi_processor *pr;
1400 struct acpi_processor_cx *cx = cpuidle_get_statedata(state); 1415 struct acpi_processor_cx *cx = cpuidle_get_statedata(state);
1416
1401 pr = processors[smp_processor_id()]; 1417 pr = processors[smp_processor_id()];
1402 1418
1403 if (unlikely(!pr)) 1419 if (unlikely(!pr))
1404 return 0; 1420 return 0;
1405 1421
1422 local_irq_disable();
1406 if (pr->flags.bm_check) 1423 if (pr->flags.bm_check)
1407 acpi_idle_update_bm_rld(pr, cx); 1424 acpi_idle_update_bm_rld(pr, cx);
1408 1425
1409 acpi_safe_halt(); 1426 t1 = inl(acpi_gbl_FADT.xpm_timer_block.address);
1427 acpi_idle_do_entry(cx);
1428 t2 = inl(acpi_gbl_FADT.xpm_timer_block.address);
1410 1429
1430 local_irq_enable();
1411 cx->usage++; 1431 cx->usage++;
1412 1432
1413 return 0; 1433 return ticks_elapsed_in_us(t1, t2);
1414} 1434}
1415 1435
1416/** 1436/**
@@ -1517,7 +1537,9 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
1517 if (dev->safe_state) { 1537 if (dev->safe_state) {
1518 return dev->safe_state->enter(dev, dev->safe_state); 1538 return dev->safe_state->enter(dev, dev->safe_state);
1519 } else { 1539 } else {
1540 local_irq_disable();
1520 acpi_safe_halt(); 1541 acpi_safe_halt();
1542 local_irq_enable();
1521 return 0; 1543 return 0;
1522 } 1544 }
1523 } 1545 }
@@ -1609,7 +1631,7 @@ struct cpuidle_driver acpi_idle_driver = {
1609 */ 1631 */
1610static int acpi_processor_setup_cpuidle(struct acpi_processor *pr) 1632static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
1611{ 1633{
1612 int i, count = 0; 1634 int i, count = CPUIDLE_DRIVER_STATE_START;
1613 struct acpi_processor_cx *cx; 1635 struct acpi_processor_cx *cx;
1614 struct cpuidle_state *state; 1636 struct cpuidle_state *state;
1615 struct cpuidle_device *dev = &pr->power.dev; 1637 struct cpuidle_device *dev = &pr->power.dev;
@@ -1638,13 +1660,14 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
1638 1660
1639 snprintf(state->name, CPUIDLE_NAME_LEN, "C%d", i); 1661 snprintf(state->name, CPUIDLE_NAME_LEN, "C%d", i);
1640 state->exit_latency = cx->latency; 1662 state->exit_latency = cx->latency;
1641 state->target_residency = cx->latency * 6; 1663 state->target_residency = cx->latency * latency_factor;
1642 state->power_usage = cx->power; 1664 state->power_usage = cx->power;
1643 1665
1644 state->flags = 0; 1666 state->flags = 0;
1645 switch (cx->type) { 1667 switch (cx->type) {
1646 case ACPI_STATE_C1: 1668 case ACPI_STATE_C1:
1647 state->flags |= CPUIDLE_FLAG_SHALLOW; 1669 state->flags |= CPUIDLE_FLAG_SHALLOW;
1670 state->flags |= CPUIDLE_FLAG_TIME_VALID;
1648 state->enter = acpi_idle_enter_c1; 1671 state->enter = acpi_idle_enter_c1;
1649 dev->safe_state = state; 1672 dev->safe_state = state;
1650 break; 1673 break;
@@ -1667,6 +1690,8 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
1667 } 1690 }
1668 1691
1669 count++; 1692 count++;
1693 if (count == CPUIDLE_STATE_MAX)
1694 break;
1670 } 1695 }
1671 1696
1672 dev->state_count = count; 1697 dev->state_count = count;
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c
index 463b0247cbc5..f32010bee4d5 100644
--- a/drivers/acpi/processor_perflib.c
+++ b/drivers/acpi/processor_perflib.c
@@ -60,6 +60,11 @@ static DEFINE_MUTEX(performance_mutex);
60 * policy is adjusted accordingly. 60 * policy is adjusted accordingly.
61 */ 61 */
62 62
63static unsigned int ignore_ppc = 0;
64module_param(ignore_ppc, uint, 0644);
65MODULE_PARM_DESC(ignore_ppc, "If the frequency of your machine gets wrongly" \
66 "limited by BIOS, this should help");
67
63#define PPC_REGISTERED 1 68#define PPC_REGISTERED 1
64#define PPC_IN_USE 2 69#define PPC_IN_USE 2
65 70
@@ -72,6 +77,9 @@ static int acpi_processor_ppc_notifier(struct notifier_block *nb,
72 struct acpi_processor *pr; 77 struct acpi_processor *pr;
73 unsigned int ppc = 0; 78 unsigned int ppc = 0;
74 79
80 if (ignore_ppc)
81 return 0;
82
75 mutex_lock(&performance_mutex); 83 mutex_lock(&performance_mutex);
76 84
77 if (event != CPUFREQ_INCOMPATIBLE) 85 if (event != CPUFREQ_INCOMPATIBLE)
@@ -130,7 +138,13 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
130 138
131int acpi_processor_ppc_has_changed(struct acpi_processor *pr) 139int acpi_processor_ppc_has_changed(struct acpi_processor *pr)
132{ 140{
133 int ret = acpi_processor_get_platform_limit(pr); 141 int ret;
142
143 if (ignore_ppc)
144 return 0;
145
146 ret = acpi_processor_get_platform_limit(pr);
147
134 if (ret < 0) 148 if (ret < 0)
135 return (ret); 149 return (ret);
136 else 150 else
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index d9d531cce27f..c7b0aa52dd23 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -941,6 +941,15 @@ static int acpi_bay_match(struct acpi_device *device){
941 return -ENODEV; 941 return -ENODEV;
942} 942}
943 943
944/*
945 * acpi_dock_match - see if a device has a _DCK method
946 */
947static int acpi_dock_match(struct acpi_device *device)
948{
949 acpi_handle tmp;
950 return acpi_get_handle(device->handle, "_DCK", &tmp);
951}
952
944static void acpi_device_set_id(struct acpi_device *device, 953static void acpi_device_set_id(struct acpi_device *device,
945 struct acpi_device *parent, acpi_handle handle, 954 struct acpi_device *parent, acpi_handle handle,
946 int type) 955 int type)
@@ -950,6 +959,7 @@ static void acpi_device_set_id(struct acpi_device *device,
950 char *hid = NULL; 959 char *hid = NULL;
951 char *uid = NULL; 960 char *uid = NULL;
952 struct acpi_compatible_id_list *cid_list = NULL; 961 struct acpi_compatible_id_list *cid_list = NULL;
962 const char *cid_add = NULL;
953 acpi_status status; 963 acpi_status status;
954 964
955 switch (type) { 965 switch (type) {
@@ -972,15 +982,18 @@ static void acpi_device_set_id(struct acpi_device *device,
972 device->flags.bus_address = 1; 982 device->flags.bus_address = 1;
973 } 983 }
974 984
975 if(!(info->valid & (ACPI_VALID_HID | ACPI_VALID_CID))){ 985 /* If we have a video/bay/dock device, add our selfdefined
976 status = acpi_video_bus_match(device); 986 HID to the CID list. Like that the video/bay/dock drivers
977 if(ACPI_SUCCESS(status)) 987 will get autoloaded and the device might still match
978 hid = ACPI_VIDEO_HID; 988 against another driver.
989 */
990 if (ACPI_SUCCESS(acpi_video_bus_match(device)))
991 cid_add = ACPI_VIDEO_HID;
992 else if (ACPI_SUCCESS(acpi_bay_match(device)))
993 cid_add = ACPI_BAY_HID;
994 else if (ACPI_SUCCESS(acpi_dock_match(device)))
995 cid_add = ACPI_DOCK_HID;
979 996
980 status = acpi_bay_match(device);
981 if (ACPI_SUCCESS(status))
982 hid = ACPI_BAY_HID;
983 }
984 break; 997 break;
985 case ACPI_BUS_TYPE_POWER: 998 case ACPI_BUS_TYPE_POWER:
986 hid = ACPI_POWER_HID; 999 hid = ACPI_POWER_HID;
@@ -1021,11 +1034,44 @@ static void acpi_device_set_id(struct acpi_device *device,
1021 strcpy(device->pnp.unique_id, uid); 1034 strcpy(device->pnp.unique_id, uid);
1022 device->flags.unique_id = 1; 1035 device->flags.unique_id = 1;
1023 } 1036 }
1024 if (cid_list) { 1037 if (cid_list || cid_add) {
1025 device->pnp.cid_list = kmalloc(cid_list->size, GFP_KERNEL); 1038 struct acpi_compatible_id_list *list;
1026 if (device->pnp.cid_list) 1039 int size = 0;
1027 memcpy(device->pnp.cid_list, cid_list, cid_list->size); 1040 int count = 0;
1028 else 1041
1042 if (cid_list) {
1043 size = cid_list->size;
1044 } else if (cid_add) {
1045 size = sizeof(struct acpi_compatible_id_list);
1046 cid_list = ACPI_ALLOCATE_ZEROED((acpi_size) size);
1047 if (!cid_list) {
1048 printk(KERN_ERR "Memory allocation error\n");
1049 kfree(buffer.pointer);
1050 return;
1051 } else {
1052 cid_list->count = 0;
1053 cid_list->size = size;
1054 }
1055 }
1056 if (cid_add)
1057 size += sizeof(struct acpi_compatible_id);
1058 list = kmalloc(size, GFP_KERNEL);
1059
1060 if (list) {
1061 if (cid_list) {
1062 memcpy(list, cid_list, cid_list->size);
1063 count = cid_list->count;
1064 }
1065 if (cid_add) {
1066 strncpy(list->id[count].value, cid_add,
1067 ACPI_MAX_CID_LENGTH);
1068 count++;
1069 device->flags.compatible_ids = 1;
1070 }
1071 list->size = size;
1072 list->count = count;
1073 device->pnp.cid_list = list;
1074 } else
1029 printk(KERN_ERR "Memory allocation error\n"); 1075 printk(KERN_ERR "Memory allocation error\n");
1030 } 1076 }
1031 1077
@@ -1081,6 +1127,20 @@ static int acpi_bus_remove(struct acpi_device *dev, int rmdevice)
1081} 1127}
1082 1128
1083static int 1129static int
1130acpi_is_child_device(struct acpi_device *device,
1131 int (*matcher)(struct acpi_device *))
1132{
1133 int result = -ENODEV;
1134
1135 do {
1136 if (ACPI_SUCCESS(matcher(device)))
1137 return AE_OK;
1138 } while ((device = device->parent));
1139
1140 return result;
1141}
1142
1143static int
1084acpi_add_single_object(struct acpi_device **child, 1144acpi_add_single_object(struct acpi_device **child,
1085 struct acpi_device *parent, acpi_handle handle, int type, 1145 struct acpi_device *parent, acpi_handle handle, int type,
1086 struct acpi_bus_ops *ops) 1146 struct acpi_bus_ops *ops)
@@ -1131,10 +1191,20 @@ acpi_add_single_object(struct acpi_device **child,
1131 case ACPI_BUS_TYPE_PROCESSOR: 1191 case ACPI_BUS_TYPE_PROCESSOR:
1132 case ACPI_BUS_TYPE_DEVICE: 1192 case ACPI_BUS_TYPE_DEVICE:
1133 result = acpi_bus_get_status(device); 1193 result = acpi_bus_get_status(device);
1134 if (ACPI_FAILURE(result) || !device->status.present) { 1194 if (ACPI_FAILURE(result)) {
1135 result = -ENOENT; 1195 result = -ENODEV;
1136 goto end; 1196 goto end;
1137 } 1197 }
1198 if (!device->status.present) {
1199 /* Bay and dock should be handled even if absent */
1200 if (!ACPI_SUCCESS(
1201 acpi_is_child_device(device, acpi_bay_match)) &&
1202 !ACPI_SUCCESS(
1203 acpi_is_child_device(device, acpi_dock_match))) {
1204 result = -ENODEV;
1205 goto end;
1206 }
1207 }
1138 break; 1208 break;
1139 default: 1209 default:
1140 STRUCT_TO_INT(device->status) = 1210 STRUCT_TO_INT(device->status) =
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c
index 485de1347075..293a1cbb47c0 100644
--- a/drivers/acpi/sleep/main.c
+++ b/drivers/acpi/sleep/main.c
@@ -170,7 +170,7 @@ static int acpi_pm_enter(suspend_state_t pm_state)
170 /* Reprogram control registers and execute _BFS */ 170 /* Reprogram control registers and execute _BFS */
171 acpi_leave_sleep_state_prep(acpi_state); 171 acpi_leave_sleep_state_prep(acpi_state);
172 172
173 /* ACPI 3.0 specs (P62) says that it's the responsabilty 173 /* ACPI 3.0 specs (P62) says that it's the responsibility
174 * of the OSPM to clear the status bit [ implying that the 174 * of the OSPM to clear the status bit [ implying that the
175 * POWER_BUTTON event should not reach userspace ] 175 * POWER_BUTTON event should not reach userspace ]
176 */ 176 */
@@ -472,11 +472,20 @@ int acpi_pm_device_sleep_state(struct device *dev, int wake, int *d_min_p)
472 if (acpi_target_sleep_state == ACPI_STATE_S0 || 472 if (acpi_target_sleep_state == ACPI_STATE_S0 ||
473 (wake && adev->wakeup.state.enabled && 473 (wake && adev->wakeup.state.enabled &&
474 adev->wakeup.sleep_state <= acpi_target_sleep_state)) { 474 adev->wakeup.sleep_state <= acpi_target_sleep_state)) {
475 acpi_status status;
476
475 acpi_method[3] = 'W'; 477 acpi_method[3] = 'W';
476 acpi_evaluate_integer(handle, acpi_method, NULL, &d_max); 478 status = acpi_evaluate_integer(handle, acpi_method, NULL,
477 /* Sanity check */ 479 &d_max);
478 if (d_max < d_min) 480 if (ACPI_FAILURE(status)) {
481 d_max = d_min;
482 } else if (d_max < d_min) {
483 /* Warn the user of the broken DSDT */
484 printk(KERN_WARNING "ACPI: Wrong value from %s\n",
485 acpi_method);
486 /* Sanitize it */
479 d_min = d_max; 487 d_min = d_max;
488 }
480 } 489 }
481 490
482 if (d_min_p) 491 if (d_min_p)
diff --git a/drivers/acpi/sleep/proc.c b/drivers/acpi/sleep/proc.c
index 1538355c266b..f8df5217d477 100644
--- a/drivers/acpi/sleep/proc.c
+++ b/drivers/acpi/sleep/proc.c
@@ -178,6 +178,9 @@ static int get_date_field(char **p, u32 * value)
178 * Try to find delimeter, only to insert null. The end of the 178 * Try to find delimeter, only to insert null. The end of the
179 * string won't have one, but is still valid. 179 * string won't have one, but is still valid.
180 */ 180 */
181 if (*p == NULL)
182 return result;
183
181 next = strpbrk(*p, "- :"); 184 next = strpbrk(*p, "- :");
182 if (next) 185 if (next)
183 *next++ = '\0'; 186 *next++ = '\0';
@@ -190,6 +193,8 @@ static int get_date_field(char **p, u32 * value)
190 193
191 if (next) 194 if (next)
192 *p = next; 195 *p = next;
196 else
197 *p = NULL;
193 198
194 return result; 199 return result;
195} 200}
@@ -251,27 +256,6 @@ acpi_system_write_alarm(struct file *file,
251 if ((result = get_date_field(&p, &sec))) 256 if ((result = get_date_field(&p, &sec)))
252 goto end; 257 goto end;
253 258
254 if (sec > 59) {
255 min += 1;
256 sec -= 60;
257 }
258 if (min > 59) {
259 hr += 1;
260 min -= 60;
261 }
262 if (hr > 23) {
263 day += 1;
264 hr -= 24;
265 }
266 if (day > 31) {
267 mo += 1;
268 day -= 31;
269 }
270 if (mo > 12) {
271 yr += 1;
272 mo -= 12;
273 }
274
275 spin_lock_irq(&rtc_lock); 259 spin_lock_irq(&rtc_lock);
276 260
277 rtc_control = CMOS_READ(RTC_CONTROL); 261 rtc_control = CMOS_READ(RTC_CONTROL);
@@ -288,24 +272,24 @@ acpi_system_write_alarm(struct file *file,
288 spin_unlock_irq(&rtc_lock); 272 spin_unlock_irq(&rtc_lock);
289 273
290 if (sec > 59) { 274 if (sec > 59) {
291 min++; 275 min += sec/60;
292 sec -= 60; 276 sec = sec%60;
293 } 277 }
294 if (min > 59) { 278 if (min > 59) {
295 hr++; 279 hr += min/60;
296 min -= 60; 280 min = min%60;
297 } 281 }
298 if (hr > 23) { 282 if (hr > 23) {
299 day++; 283 day += hr/24;
300 hr -= 24; 284 hr = hr%24;
301 } 285 }
302 if (day > 31) { 286 if (day > 31) {
303 mo++; 287 mo += day/32;
304 day -= 31; 288 day = day%32;
305 } 289 }
306 if (mo > 12) { 290 if (mo > 12) {
307 yr++; 291 yr += mo/13;
308 mo -= 12; 292 mo = mo%13;
309 } 293 }
310 294
311 spin_lock_irq(&rtc_lock); 295 spin_lock_irq(&rtc_lock);
diff --git a/drivers/acpi/tables/Makefile b/drivers/acpi/tables/Makefile
index 0a7d7afac255..7385efa61622 100644
--- a/drivers/acpi/tables/Makefile
+++ b/drivers/acpi/tables/Makefile
@@ -2,6 +2,6 @@
2# Makefile for all Linux ACPI interpreter subdirectories 2# Makefile for all Linux ACPI interpreter subdirectories
3# 3#
4 4
5obj-y := tbxface.o tbinstal.o tbutils.o tbfind.o tbfadt.o 5obj-y := tbxface.o tbinstal.o tbutils.o tbfind.o tbfadt.o tbxfroot.o
6 6
7EXTRA_CFLAGS += $(ACPI_CFLAGS) 7EXTRA_CFLAGS += $(ACPI_CFLAGS)
diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c
index cf8fa514189f..9ecb4b6c1e7d 100644
--- a/drivers/acpi/tables/tbxfroot.c
+++ b/drivers/acpi/tables/tbxfroot.c
@@ -100,7 +100,7 @@ static acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp)
100 100
101/******************************************************************************* 101/*******************************************************************************
102 * 102 *
103 * FUNCTION: acpi_tb_find_rsdp 103 * FUNCTION: acpi_find_root_pointer
104 * 104 *
105 * PARAMETERS: table_address - Where the table pointer is returned 105 * PARAMETERS: table_address - Where the table pointer is returned
106 * 106 *
@@ -219,8 +219,6 @@ acpi_status acpi_find_root_pointer(acpi_native_uint * table_address)
219 return_ACPI_STATUS(AE_NOT_FOUND); 219 return_ACPI_STATUS(AE_NOT_FOUND);
220} 220}
221 221
222ACPI_EXPORT_SYMBOL(acpi_find_root_pointer)
223
224/******************************************************************************* 222/*******************************************************************************
225 * 223 *
226 * FUNCTION: acpi_tb_scan_memory_for_rsdp 224 * FUNCTION: acpi_tb_scan_memory_for_rsdp
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 5f79b4451212..3a0af9a8cd27 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -492,7 +492,7 @@ static int acpi_thermal_get_devices(struct acpi_thermal *tz)
492 492
493static int acpi_thermal_critical(struct acpi_thermal *tz) 493static int acpi_thermal_critical(struct acpi_thermal *tz)
494{ 494{
495 if (!tz || !tz->trips.critical.flags.valid || nocrt) 495 if (!tz || !tz->trips.critical.flags.valid)
496 return -EINVAL; 496 return -EINVAL;
497 497
498 if (tz->temperature >= tz->trips.critical.temperature) { 498 if (tz->temperature >= tz->trips.critical.temperature) {
@@ -501,9 +501,6 @@ static int acpi_thermal_critical(struct acpi_thermal *tz)
501 } else if (tz->trips.critical.flags.enabled) 501 } else if (tz->trips.critical.flags.enabled)
502 tz->trips.critical.flags.enabled = 0; 502 tz->trips.critical.flags.enabled = 0;
503 503
504 printk(KERN_EMERG
505 "Critical temperature reached (%ld C), shutting down.\n",
506 KELVIN_TO_CELSIUS(tz->temperature));
507 acpi_bus_generate_proc_event(tz->device, ACPI_THERMAL_NOTIFY_CRITICAL, 504 acpi_bus_generate_proc_event(tz->device, ACPI_THERMAL_NOTIFY_CRITICAL,
508 tz->trips.critical.flags.enabled); 505 tz->trips.critical.flags.enabled);
509 acpi_bus_generate_netlink_event(tz->device->pnp.device_class, 506 acpi_bus_generate_netlink_event(tz->device->pnp.device_class,
@@ -511,14 +508,20 @@ static int acpi_thermal_critical(struct acpi_thermal *tz)
511 ACPI_THERMAL_NOTIFY_CRITICAL, 508 ACPI_THERMAL_NOTIFY_CRITICAL,
512 tz->trips.critical.flags.enabled); 509 tz->trips.critical.flags.enabled);
513 510
514 orderly_poweroff(true); 511 /* take no action if nocrt is set */
512 if(!nocrt) {
513 printk(KERN_EMERG
514 "Critical temperature reached (%ld C), shutting down.\n",
515 KELVIN_TO_CELSIUS(tz->temperature));
516 orderly_poweroff(true);
517 }
515 518
516 return 0; 519 return 0;
517} 520}
518 521
519static int acpi_thermal_hot(struct acpi_thermal *tz) 522static int acpi_thermal_hot(struct acpi_thermal *tz)
520{ 523{
521 if (!tz || !tz->trips.hot.flags.valid || nocrt) 524 if (!tz || !tz->trips.hot.flags.valid)
522 return -EINVAL; 525 return -EINVAL;
523 526
524 if (tz->temperature >= tz->trips.hot.temperature) { 527 if (tz->temperature >= tz->trips.hot.temperature) {
@@ -534,7 +537,7 @@ static int acpi_thermal_hot(struct acpi_thermal *tz)
534 ACPI_THERMAL_NOTIFY_HOT, 537 ACPI_THERMAL_NOTIFY_HOT,
535 tz->trips.hot.flags.enabled); 538 tz->trips.hot.flags.enabled);
536 539
537 /* TBD: Call user-mode "sleep(S4)" function */ 540 /* TBD: Call user-mode "sleep(S4)" function if nocrt is cleared */
538 541
539 return 0; 542 return 0;
540} 543}
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index bd77e81e81c1..a54ff6bce8fa 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -292,18 +292,26 @@ static int acpi_video_device_set_state(struct acpi_video_device *device, int sta
292static int acpi_video_get_brightness(struct backlight_device *bd) 292static int acpi_video_get_brightness(struct backlight_device *bd)
293{ 293{
294 unsigned long cur_level; 294 unsigned long cur_level;
295 int i;
295 struct acpi_video_device *vd = 296 struct acpi_video_device *vd =
296 (struct acpi_video_device *)bl_get_data(bd); 297 (struct acpi_video_device *)bl_get_data(bd);
297 acpi_video_device_lcd_get_level_current(vd, &cur_level); 298 acpi_video_device_lcd_get_level_current(vd, &cur_level);
298 return (int) cur_level; 299 for (i = 2; i < vd->brightness->count; i++) {
300 if (vd->brightness->levels[i] == cur_level)
301 /* The first two entries are special - see page 575
302 of the ACPI spec 3.0 */
303 return i-2;
304 }
305 return 0;
299} 306}
300 307
301static int acpi_video_set_brightness(struct backlight_device *bd) 308static int acpi_video_set_brightness(struct backlight_device *bd)
302{ 309{
303 int request_level = bd->props.brightness; 310 int request_level = bd->props.brightness+2;
304 struct acpi_video_device *vd = 311 struct acpi_video_device *vd =
305 (struct acpi_video_device *)bl_get_data(bd); 312 (struct acpi_video_device *)bl_get_data(bd);
306 acpi_video_device_lcd_set_level(vd, request_level); 313 acpi_video_device_lcd_set_level(vd,
314 vd->brightness->levels[request_level]);
307 return 0; 315 return 0;
308} 316}
309 317
@@ -652,7 +660,6 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
652 kfree(obj); 660 kfree(obj);
653 661
654 if (device->cap._BCL && device->cap._BCM && device->cap._BQC && max_level > 0){ 662 if (device->cap._BCL && device->cap._BCM && device->cap._BQC && max_level > 0){
655 unsigned long tmp;
656 static int count = 0; 663 static int count = 0;
657 char *name; 664 char *name;
658 name = kzalloc(MAX_NAME_LEN, GFP_KERNEL); 665 name = kzalloc(MAX_NAME_LEN, GFP_KERNEL);
@@ -660,11 +667,10 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
660 return; 667 return;
661 668
662 sprintf(name, "acpi_video%d", count++); 669 sprintf(name, "acpi_video%d", count++);
663 acpi_video_device_lcd_get_level_current(device, &tmp);
664 device->backlight = backlight_device_register(name, 670 device->backlight = backlight_device_register(name,
665 NULL, device, &acpi_backlight_ops); 671 NULL, device, &acpi_backlight_ops);
666 device->backlight->props.max_brightness = max_level; 672 device->backlight->props.max_brightness = device->brightness->count-3;
667 device->backlight->props.brightness = (int)tmp; 673 device->backlight->props.brightness = acpi_video_get_brightness(device->backlight);
668 backlight_update_status(device->backlight); 674 backlight_update_status(device->backlight);
669 675
670 kfree(name); 676 kfree(name);
@@ -1256,8 +1262,37 @@ acpi_video_bus_write_DOS(struct file *file,
1256 1262
1257static int acpi_video_bus_add_fs(struct acpi_device *device) 1263static int acpi_video_bus_add_fs(struct acpi_device *device)
1258{ 1264{
1265 long device_id;
1266 int status;
1259 struct proc_dir_entry *entry = NULL; 1267 struct proc_dir_entry *entry = NULL;
1260 struct acpi_video_bus *video; 1268 struct acpi_video_bus *video;
1269 struct device *dev;
1270
1271 status =
1272 acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id);
1273
1274 if (!ACPI_SUCCESS(status))
1275 return -ENODEV;
1276
1277 /* We need to attempt to determine whether the _ADR refers to a
1278 PCI device or not. There's no terribly good way to do this,
1279 so the best we can hope for is to assume that there'll never
1280 be a video device in the host bridge */
1281 if (device_id >= 0x10000) {
1282 /* It looks like a PCI device. Does it exist? */
1283 dev = acpi_get_physical_device(device->handle);
1284 } else {
1285 /* It doesn't look like a PCI device. Does its parent
1286 exist? */
1287 acpi_handle phandle;
1288 if (acpi_get_parent(device->handle, &phandle))
1289 return -ENODEV;
1290 dev = acpi_get_physical_device(phandle);
1291 }
1292 if (!dev)
1293 return -ENODEV;
1294 put_device(dev);
1295
1261 1296
1262 1297
1263 video = acpi_driver_data(device); 1298 video = acpi_driver_data(device);