diff options
-rw-r--r-- | Documentation/feature-removal-schedule.txt | 7 | ||||
-rw-r--r-- | arch/x86/kernel/acpi/boot.c | 97 | ||||
-rw-r--r-- | drivers/acpi/acpica/exmutex.c | 3 | ||||
-rw-r--r-- | drivers/acpi/battery.c | 86 | ||||
-rw-r--r-- | drivers/acpi/bus.c | 10 | ||||
-rw-r--r-- | drivers/acpi/ec.c | 33 | ||||
-rw-r--r-- | drivers/acpi/internal.h | 2 | ||||
-rw-r--r-- | drivers/acpi/processor_throttling.c | 3 | ||||
-rw-r--r-- | drivers/acpi/sbs.c | 5 | ||||
-rw-r--r-- | drivers/acpi/sleep.c | 19 | ||||
-rw-r--r-- | drivers/acpi/thermal.c | 36 | ||||
-rw-r--r-- | drivers/acpi/utils.c | 45 | ||||
-rw-r--r-- | drivers/acpi/video.c | 28 | ||||
-rw-r--r-- | drivers/pci/hotplug/acpiphp_glue.c | 19 | ||||
-rw-r--r-- | drivers/platform/x86/sony-laptop.c | 91 | ||||
-rw-r--r-- | drivers/pnp/base.h | 3 | ||||
-rw-r--r-- | drivers/pnp/interface.c | 7 | ||||
-rw-r--r-- | drivers/pnp/pnpacpi/rsparser.c | 49 | ||||
-rw-r--r-- | drivers/pnp/resource.c | 27 | ||||
-rw-r--r-- | drivers/pnp/support.c | 4 | ||||
-rw-r--r-- | drivers/power/power_supply_sysfs.c | 1 | ||||
-rw-r--r-- | include/linux/ioport.h | 18 | ||||
-rw-r--r-- | include/linux/power_supply.h | 1 | ||||
-rw-r--r-- | lib/vsprintf.c | 13 |
24 files changed, 342 insertions, 265 deletions
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index a5cc0db63d7a..ed511af0f79a 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -582,3 +582,10 @@ Why: The paravirt mmu host support is slower than non-paravirt mmu, both | |||
582 | Who: Avi Kivity <avi@redhat.com> | 582 | Who: Avi Kivity <avi@redhat.com> |
583 | 583 | ||
584 | ---------------------------- | 584 | ---------------------------- |
585 | |||
586 | What: "acpi=ht" boot option | ||
587 | When: 2.6.35 | ||
588 | Why: Useful in 2003, implementation is a hack. | ||
589 | Generally invoked by accident today. | ||
590 | Seen as doing more harm than good. | ||
591 | Who: Len Brown <len.brown@intel.com> | ||
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index d635a93ae59c..0061ea263061 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
@@ -1296,23 +1296,6 @@ static int __init dmi_disable_acpi(const struct dmi_system_id *d) | |||
1296 | } | 1296 | } |
1297 | 1297 | ||
1298 | /* | 1298 | /* |
1299 | * Limit ACPI to CPU enumeration for HT | ||
1300 | */ | ||
1301 | static int __init force_acpi_ht(const struct dmi_system_id *d) | ||
1302 | { | ||
1303 | if (!acpi_force) { | ||
1304 | printk(KERN_NOTICE "%s detected: force use of acpi=ht\n", | ||
1305 | d->ident); | ||
1306 | disable_acpi(); | ||
1307 | acpi_ht = 1; | ||
1308 | } else { | ||
1309 | printk(KERN_NOTICE | ||
1310 | "Warning: acpi=force overrules DMI blacklist: acpi=ht\n"); | ||
1311 | } | ||
1312 | return 0; | ||
1313 | } | ||
1314 | |||
1315 | /* | ||
1316 | * Force ignoring BIOS IRQ0 pin2 override | 1299 | * Force ignoring BIOS IRQ0 pin2 override |
1317 | */ | 1300 | */ |
1318 | static int __init dmi_ignore_irq0_timer_override(const struct dmi_system_id *d) | 1301 | static int __init dmi_ignore_irq0_timer_override(const struct dmi_system_id *d) |
@@ -1348,82 +1331,6 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = { | |||
1348 | }, | 1331 | }, |
1349 | 1332 | ||
1350 | /* | 1333 | /* |
1351 | * Boxes that need acpi=ht | ||
1352 | */ | ||
1353 | { | ||
1354 | .callback = force_acpi_ht, | ||
1355 | .ident = "FSC Primergy T850", | ||
1356 | .matches = { | ||
1357 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), | ||
1358 | DMI_MATCH(DMI_PRODUCT_NAME, "PRIMERGY T850"), | ||
1359 | }, | ||
1360 | }, | ||
1361 | { | ||
1362 | .callback = force_acpi_ht, | ||
1363 | .ident = "HP VISUALIZE NT Workstation", | ||
1364 | .matches = { | ||
1365 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), | ||
1366 | DMI_MATCH(DMI_PRODUCT_NAME, "HP VISUALIZE NT Workstation"), | ||
1367 | }, | ||
1368 | }, | ||
1369 | { | ||
1370 | .callback = force_acpi_ht, | ||
1371 | .ident = "Compaq Workstation W8000", | ||
1372 | .matches = { | ||
1373 | DMI_MATCH(DMI_SYS_VENDOR, "Compaq"), | ||
1374 | DMI_MATCH(DMI_PRODUCT_NAME, "Workstation W8000"), | ||
1375 | }, | ||
1376 | }, | ||
1377 | { | ||
1378 | .callback = force_acpi_ht, | ||
1379 | .ident = "ASUS CUR-DLS", | ||
1380 | .matches = { | ||
1381 | DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), | ||
1382 | DMI_MATCH(DMI_BOARD_NAME, "CUR-DLS"), | ||
1383 | }, | ||
1384 | }, | ||
1385 | { | ||
1386 | .callback = force_acpi_ht, | ||
1387 | .ident = "ABIT i440BX-W83977", | ||
1388 | .matches = { | ||
1389 | DMI_MATCH(DMI_BOARD_VENDOR, "ABIT <http://www.abit.com>"), | ||
1390 | DMI_MATCH(DMI_BOARD_NAME, "i440BX-W83977 (BP6)"), | ||
1391 | }, | ||
1392 | }, | ||
1393 | { | ||
1394 | .callback = force_acpi_ht, | ||
1395 | .ident = "IBM Bladecenter", | ||
1396 | .matches = { | ||
1397 | DMI_MATCH(DMI_BOARD_VENDOR, "IBM"), | ||
1398 | DMI_MATCH(DMI_BOARD_NAME, "IBM eServer BladeCenter HS20"), | ||
1399 | }, | ||
1400 | }, | ||
1401 | { | ||
1402 | .callback = force_acpi_ht, | ||
1403 | .ident = "IBM eServer xSeries 360", | ||
1404 | .matches = { | ||
1405 | DMI_MATCH(DMI_BOARD_VENDOR, "IBM"), | ||
1406 | DMI_MATCH(DMI_BOARD_NAME, "eServer xSeries 360"), | ||
1407 | }, | ||
1408 | }, | ||
1409 | { | ||
1410 | .callback = force_acpi_ht, | ||
1411 | .ident = "IBM eserver xSeries 330", | ||
1412 | .matches = { | ||
1413 | DMI_MATCH(DMI_BOARD_VENDOR, "IBM"), | ||
1414 | DMI_MATCH(DMI_BOARD_NAME, "eserver xSeries 330"), | ||
1415 | }, | ||
1416 | }, | ||
1417 | { | ||
1418 | .callback = force_acpi_ht, | ||
1419 | .ident = "IBM eserver xSeries 440", | ||
1420 | .matches = { | ||
1421 | DMI_MATCH(DMI_BOARD_VENDOR, "IBM"), | ||
1422 | DMI_MATCH(DMI_PRODUCT_NAME, "eserver xSeries 440"), | ||
1423 | }, | ||
1424 | }, | ||
1425 | |||
1426 | /* | ||
1427 | * Boxes that need ACPI PCI IRQ routing disabled | 1334 | * Boxes that need ACPI PCI IRQ routing disabled |
1428 | */ | 1335 | */ |
1429 | { | 1336 | { |
@@ -1655,8 +1562,10 @@ static int __init parse_acpi(char *arg) | |||
1655 | } | 1562 | } |
1656 | /* Limit ACPI just to boot-time to enable HT */ | 1563 | /* Limit ACPI just to boot-time to enable HT */ |
1657 | else if (strcmp(arg, "ht") == 0) { | 1564 | else if (strcmp(arg, "ht") == 0) { |
1658 | if (!acpi_force) | 1565 | if (!acpi_force) { |
1566 | printk(KERN_WARNING "acpi=ht will be removed in Linux-2.6.35\n"); | ||
1659 | disable_acpi(); | 1567 | disable_acpi(); |
1568 | } | ||
1660 | acpi_ht = 1; | 1569 | acpi_ht = 1; |
1661 | } | 1570 | } |
1662 | /* acpi=rsdt use RSDT instead of XSDT */ | 1571 | /* acpi=rsdt use RSDT instead of XSDT */ |
diff --git a/drivers/acpi/acpica/exmutex.c b/drivers/acpi/acpica/exmutex.c index cc8a10268f68..7116bc86494d 100644 --- a/drivers/acpi/acpica/exmutex.c +++ b/drivers/acpi/acpica/exmutex.c | |||
@@ -375,8 +375,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
375 | return_ACPI_STATUS(AE_AML_MUTEX_NOT_ACQUIRED); | 375 | return_ACPI_STATUS(AE_AML_MUTEX_NOT_ACQUIRED); |
376 | } | 376 | } |
377 | 377 | ||
378 | /* Must have a valid thread ID */ | 378 | /* Must have a valid thread. */ |
379 | |||
380 | if (!walk_state->thread) { | 379 | if (!walk_state->thread) { |
381 | ACPI_ERROR((AE_INFO, | 380 | ACPI_ERROR((AE_INFO, |
382 | "Cannot release Mutex [%4.4s], null thread info", | 381 | "Cannot release Mutex [%4.4s], null thread info", |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 58d2c91ba62b..75f39f2c166d 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -54,6 +54,7 @@ | |||
54 | #define ACPI_BATTERY_DEVICE_NAME "Battery" | 54 | #define ACPI_BATTERY_DEVICE_NAME "Battery" |
55 | #define ACPI_BATTERY_NOTIFY_STATUS 0x80 | 55 | #define ACPI_BATTERY_NOTIFY_STATUS 0x80 |
56 | #define ACPI_BATTERY_NOTIFY_INFO 0x81 | 56 | #define ACPI_BATTERY_NOTIFY_INFO 0x81 |
57 | #define ACPI_BATTERY_NOTIFY_THRESHOLD 0x82 | ||
57 | 58 | ||
58 | #define _COMPONENT ACPI_BATTERY_COMPONENT | 59 | #define _COMPONENT ACPI_BATTERY_COMPONENT |
59 | 60 | ||
@@ -88,10 +89,15 @@ static const struct acpi_device_id battery_device_ids[] = { | |||
88 | 89 | ||
89 | MODULE_DEVICE_TABLE(acpi, battery_device_ids); | 90 | MODULE_DEVICE_TABLE(acpi, battery_device_ids); |
90 | 91 | ||
91 | /* For buggy DSDTs that report negative 16-bit values for either charging | 92 | enum { |
92 | * or discharging current and/or report 0 as 65536 due to bad math. | 93 | ACPI_BATTERY_ALARM_PRESENT, |
93 | */ | 94 | ACPI_BATTERY_XINFO_PRESENT, |
94 | #define QUIRK_SIGNED16_CURRENT 0x0001 | 95 | /* For buggy DSDTs that report negative 16-bit values for either |
96 | * charging or discharging current and/or report 0 as 65536 | ||
97 | * due to bad math. | ||
98 | */ | ||
99 | ACPI_BATTERY_QUIRK_SIGNED16_CURRENT, | ||
100 | }; | ||
95 | 101 | ||
96 | struct acpi_battery { | 102 | struct acpi_battery { |
97 | struct mutex lock; | 103 | struct mutex lock; |
@@ -109,6 +115,12 @@ struct acpi_battery { | |||
109 | int design_voltage; | 115 | int design_voltage; |
110 | int design_capacity_warning; | 116 | int design_capacity_warning; |
111 | int design_capacity_low; | 117 | int design_capacity_low; |
118 | int cycle_count; | ||
119 | int measurement_accuracy; | ||
120 | int max_sampling_time; | ||
121 | int min_sampling_time; | ||
122 | int max_averaging_interval; | ||
123 | int min_averaging_interval; | ||
112 | int capacity_granularity_1; | 124 | int capacity_granularity_1; |
113 | int capacity_granularity_2; | 125 | int capacity_granularity_2; |
114 | int alarm; | 126 | int alarm; |
@@ -118,8 +130,7 @@ struct acpi_battery { | |||
118 | char oem_info[32]; | 130 | char oem_info[32]; |
119 | int state; | 131 | int state; |
120 | int power_unit; | 132 | int power_unit; |
121 | u8 alarm_present; | 133 | unsigned long flags; |
122 | long quirks; | ||
123 | }; | 134 | }; |
124 | 135 | ||
125 | #define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); | 136 | #define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); |
@@ -198,6 +209,9 @@ static int acpi_battery_get_property(struct power_supply *psy, | |||
198 | case POWER_SUPPLY_PROP_TECHNOLOGY: | 209 | case POWER_SUPPLY_PROP_TECHNOLOGY: |
199 | val->intval = acpi_battery_technology(battery); | 210 | val->intval = acpi_battery_technology(battery); |
200 | break; | 211 | break; |
212 | case POWER_SUPPLY_PROP_CYCLE_COUNT: | ||
213 | val->intval = battery->cycle_count; | ||
214 | break; | ||
201 | case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN: | 215 | case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN: |
202 | val->intval = battery->design_voltage * 1000; | 216 | val->intval = battery->design_voltage * 1000; |
203 | break; | 217 | break; |
@@ -239,6 +253,7 @@ static enum power_supply_property charge_battery_props[] = { | |||
239 | POWER_SUPPLY_PROP_STATUS, | 253 | POWER_SUPPLY_PROP_STATUS, |
240 | POWER_SUPPLY_PROP_PRESENT, | 254 | POWER_SUPPLY_PROP_PRESENT, |
241 | POWER_SUPPLY_PROP_TECHNOLOGY, | 255 | POWER_SUPPLY_PROP_TECHNOLOGY, |
256 | POWER_SUPPLY_PROP_CYCLE_COUNT, | ||
242 | POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, | 257 | POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, |
243 | POWER_SUPPLY_PROP_VOLTAGE_NOW, | 258 | POWER_SUPPLY_PROP_VOLTAGE_NOW, |
244 | POWER_SUPPLY_PROP_CURRENT_NOW, | 259 | POWER_SUPPLY_PROP_CURRENT_NOW, |
@@ -254,6 +269,7 @@ static enum power_supply_property energy_battery_props[] = { | |||
254 | POWER_SUPPLY_PROP_STATUS, | 269 | POWER_SUPPLY_PROP_STATUS, |
255 | POWER_SUPPLY_PROP_PRESENT, | 270 | POWER_SUPPLY_PROP_PRESENT, |
256 | POWER_SUPPLY_PROP_TECHNOLOGY, | 271 | POWER_SUPPLY_PROP_TECHNOLOGY, |
272 | POWER_SUPPLY_PROP_CYCLE_COUNT, | ||
257 | POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, | 273 | POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, |
258 | POWER_SUPPLY_PROP_VOLTAGE_NOW, | 274 | POWER_SUPPLY_PROP_VOLTAGE_NOW, |
259 | POWER_SUPPLY_PROP_CURRENT_NOW, | 275 | POWER_SUPPLY_PROP_CURRENT_NOW, |
@@ -305,6 +321,28 @@ static struct acpi_offsets info_offsets[] = { | |||
305 | {offsetof(struct acpi_battery, oem_info), 1}, | 321 | {offsetof(struct acpi_battery, oem_info), 1}, |
306 | }; | 322 | }; |
307 | 323 | ||
324 | static struct acpi_offsets extended_info_offsets[] = { | ||
325 | {offsetof(struct acpi_battery, power_unit), 0}, | ||
326 | {offsetof(struct acpi_battery, design_capacity), 0}, | ||
327 | {offsetof(struct acpi_battery, full_charge_capacity), 0}, | ||
328 | {offsetof(struct acpi_battery, technology), 0}, | ||
329 | {offsetof(struct acpi_battery, design_voltage), 0}, | ||
330 | {offsetof(struct acpi_battery, design_capacity_warning), 0}, | ||
331 | {offsetof(struct acpi_battery, design_capacity_low), 0}, | ||
332 | {offsetof(struct acpi_battery, cycle_count), 0}, | ||
333 | {offsetof(struct acpi_battery, measurement_accuracy), 0}, | ||
334 | {offsetof(struct acpi_battery, max_sampling_time), 0}, | ||
335 | {offsetof(struct acpi_battery, min_sampling_time), 0}, | ||
336 | {offsetof(struct acpi_battery, max_averaging_interval), 0}, | ||
337 | {offsetof(struct acpi_battery, min_averaging_interval), 0}, | ||
338 | {offsetof(struct acpi_battery, capacity_granularity_1), 0}, | ||
339 | {offsetof(struct acpi_battery, capacity_granularity_2), 0}, | ||
340 | {offsetof(struct acpi_battery, model_number), 1}, | ||
341 | {offsetof(struct acpi_battery, serial_number), 1}, | ||
342 | {offsetof(struct acpi_battery, type), 1}, | ||
343 | {offsetof(struct acpi_battery, oem_info), 1}, | ||
344 | }; | ||
345 | |||
308 | static int extract_package(struct acpi_battery *battery, | 346 | static int extract_package(struct acpi_battery *battery, |
309 | union acpi_object *package, | 347 | union acpi_object *package, |
310 | struct acpi_offsets *offsets, int num) | 348 | struct acpi_offsets *offsets, int num) |
@@ -350,22 +388,29 @@ static int acpi_battery_get_info(struct acpi_battery *battery) | |||
350 | { | 388 | { |
351 | int result = -EFAULT; | 389 | int result = -EFAULT; |
352 | acpi_status status = 0; | 390 | acpi_status status = 0; |
391 | char *name = test_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags)? | ||
392 | "_BIX" : "_BIF"; | ||
393 | |||
353 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 394 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
354 | 395 | ||
355 | if (!acpi_battery_present(battery)) | 396 | if (!acpi_battery_present(battery)) |
356 | return 0; | 397 | return 0; |
357 | mutex_lock(&battery->lock); | 398 | mutex_lock(&battery->lock); |
358 | status = acpi_evaluate_object(battery->device->handle, "_BIF", | 399 | status = acpi_evaluate_object(battery->device->handle, name, |
359 | NULL, &buffer); | 400 | NULL, &buffer); |
360 | mutex_unlock(&battery->lock); | 401 | mutex_unlock(&battery->lock); |
361 | 402 | ||
362 | if (ACPI_FAILURE(status)) { | 403 | if (ACPI_FAILURE(status)) { |
363 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF")); | 404 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating %s", name)); |
364 | return -ENODEV; | 405 | return -ENODEV; |
365 | } | 406 | } |
366 | 407 | if (test_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags)) | |
367 | result = extract_package(battery, buffer.pointer, | 408 | result = extract_package(battery, buffer.pointer, |
368 | info_offsets, ARRAY_SIZE(info_offsets)); | 409 | extended_info_offsets, |
410 | ARRAY_SIZE(extended_info_offsets)); | ||
411 | else | ||
412 | result = extract_package(battery, buffer.pointer, | ||
413 | info_offsets, ARRAY_SIZE(info_offsets)); | ||
369 | kfree(buffer.pointer); | 414 | kfree(buffer.pointer); |
370 | return result; | 415 | return result; |
371 | } | 416 | } |
@@ -399,7 +444,7 @@ static int acpi_battery_get_state(struct acpi_battery *battery) | |||
399 | battery->update_time = jiffies; | 444 | battery->update_time = jiffies; |
400 | kfree(buffer.pointer); | 445 | kfree(buffer.pointer); |
401 | 446 | ||
402 | if ((battery->quirks & QUIRK_SIGNED16_CURRENT) && | 447 | if (test_bit(ACPI_BATTERY_QUIRK_SIGNED16_CURRENT, &battery->flags) && |
403 | battery->rate_now != -1) | 448 | battery->rate_now != -1) |
404 | battery->rate_now = abs((s16)battery->rate_now); | 449 | battery->rate_now = abs((s16)battery->rate_now); |
405 | 450 | ||
@@ -412,7 +457,8 @@ static int acpi_battery_set_alarm(struct acpi_battery *battery) | |||
412 | union acpi_object arg0 = { .type = ACPI_TYPE_INTEGER }; | 457 | union acpi_object arg0 = { .type = ACPI_TYPE_INTEGER }; |
413 | struct acpi_object_list arg_list = { 1, &arg0 }; | 458 | struct acpi_object_list arg_list = { 1, &arg0 }; |
414 | 459 | ||
415 | if (!acpi_battery_present(battery)|| !battery->alarm_present) | 460 | if (!acpi_battery_present(battery) || |
461 | !test_bit(ACPI_BATTERY_ALARM_PRESENT, &battery->flags)) | ||
416 | return -ENODEV; | 462 | return -ENODEV; |
417 | 463 | ||
418 | arg0.integer.value = battery->alarm; | 464 | arg0.integer.value = battery->alarm; |
@@ -437,10 +483,10 @@ static int acpi_battery_init_alarm(struct acpi_battery *battery) | |||
437 | /* See if alarms are supported, and if so, set default */ | 483 | /* See if alarms are supported, and if so, set default */ |
438 | status = acpi_get_handle(battery->device->handle, "_BTP", &handle); | 484 | status = acpi_get_handle(battery->device->handle, "_BTP", &handle); |
439 | if (ACPI_FAILURE(status)) { | 485 | if (ACPI_FAILURE(status)) { |
440 | battery->alarm_present = 0; | 486 | clear_bit(ACPI_BATTERY_ALARM_PRESENT, &battery->flags); |
441 | return 0; | 487 | return 0; |
442 | } | 488 | } |
443 | battery->alarm_present = 1; | 489 | set_bit(ACPI_BATTERY_ALARM_PRESENT, &battery->flags); |
444 | if (!battery->alarm) | 490 | if (!battery->alarm) |
445 | battery->alarm = battery->design_capacity_warning; | 491 | battery->alarm = battery->design_capacity_warning; |
446 | return acpi_battery_set_alarm(battery); | 492 | return acpi_battery_set_alarm(battery); |
@@ -510,9 +556,8 @@ static void sysfs_remove_battery(struct acpi_battery *battery) | |||
510 | 556 | ||
511 | static void acpi_battery_quirks(struct acpi_battery *battery) | 557 | static void acpi_battery_quirks(struct acpi_battery *battery) |
512 | { | 558 | { |
513 | battery->quirks = 0; | ||
514 | if (dmi_name_in_vendors("Acer") && battery->power_unit) { | 559 | if (dmi_name_in_vendors("Acer") && battery->power_unit) { |
515 | battery->quirks |= QUIRK_SIGNED16_CURRENT; | 560 | set_bit(ACPI_BATTERY_QUIRK_SIGNED16_CURRENT, &battery->flags); |
516 | } | 561 | } |
517 | } | 562 | } |
518 | 563 | ||
@@ -590,6 +635,7 @@ static int acpi_battery_print_info(struct seq_file *seq, int result) | |||
590 | seq_printf(seq, "design capacity low: %d %sh\n", | 635 | seq_printf(seq, "design capacity low: %d %sh\n", |
591 | battery->design_capacity_low, | 636 | battery->design_capacity_low, |
592 | acpi_battery_units(battery)); | 637 | acpi_battery_units(battery)); |
638 | seq_printf(seq, "cycle count: %i\n", battery->cycle_count); | ||
593 | seq_printf(seq, "capacity granularity 1: %d %sh\n", | 639 | seq_printf(seq, "capacity granularity 1: %d %sh\n", |
594 | battery->capacity_granularity_1, | 640 | battery->capacity_granularity_1, |
595 | acpi_battery_units(battery)); | 641 | acpi_battery_units(battery)); |
@@ -841,6 +887,7 @@ static int acpi_battery_add(struct acpi_device *device) | |||
841 | { | 887 | { |
842 | int result = 0; | 888 | int result = 0; |
843 | struct acpi_battery *battery = NULL; | 889 | struct acpi_battery *battery = NULL; |
890 | acpi_handle handle; | ||
844 | if (!device) | 891 | if (!device) |
845 | return -EINVAL; | 892 | return -EINVAL; |
846 | battery = kzalloc(sizeof(struct acpi_battery), GFP_KERNEL); | 893 | battery = kzalloc(sizeof(struct acpi_battery), GFP_KERNEL); |
@@ -851,6 +898,9 @@ static int acpi_battery_add(struct acpi_device *device) | |||
851 | strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS); | 898 | strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS); |
852 | device->driver_data = battery; | 899 | device->driver_data = battery; |
853 | mutex_init(&battery->lock); | 900 | mutex_init(&battery->lock); |
901 | if (ACPI_SUCCESS(acpi_get_handle(battery->device->handle, | ||
902 | "_BIX", &handle))) | ||
903 | set_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags); | ||
854 | acpi_battery_update(battery); | 904 | acpi_battery_update(battery); |
855 | #ifdef CONFIG_ACPI_PROCFS_POWER | 905 | #ifdef CONFIG_ACPI_PROCFS_POWER |
856 | result = acpi_battery_add_fs(device); | 906 | result = acpi_battery_add_fs(device); |
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index a52126e46307..b70cd3756142 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -190,16 +190,16 @@ int acpi_bus_get_power(acpi_handle handle, int *state) | |||
190 | * Get the device's power state either directly (via _PSC) or | 190 | * Get the device's power state either directly (via _PSC) or |
191 | * indirectly (via power resources). | 191 | * indirectly (via power resources). |
192 | */ | 192 | */ |
193 | if (device->power.flags.explicit_get) { | 193 | if (device->power.flags.power_resources) { |
194 | result = acpi_power_get_inferred_state(device); | ||
195 | if (result) | ||
196 | return result; | ||
197 | } else if (device->power.flags.explicit_get) { | ||
194 | status = acpi_evaluate_integer(device->handle, "_PSC", | 198 | status = acpi_evaluate_integer(device->handle, "_PSC", |
195 | NULL, &psc); | 199 | NULL, &psc); |
196 | if (ACPI_FAILURE(status)) | 200 | if (ACPI_FAILURE(status)) |
197 | return -ENODEV; | 201 | return -ENODEV; |
198 | device->power.state = (int)psc; | 202 | device->power.state = (int)psc; |
199 | } else if (device->power.flags.power_resources) { | ||
200 | result = acpi_power_get_inferred_state(device); | ||
201 | if (result) | ||
202 | return result; | ||
203 | } | 203 | } |
204 | 204 | ||
205 | *state = device->power.state; | 205 | *state = device->power.state; |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index d7a6bbbb834c..1ac28c6a672e 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -76,8 +76,9 @@ enum ec_command { | |||
76 | enum { | 76 | enum { |
77 | EC_FLAGS_QUERY_PENDING, /* Query is pending */ | 77 | EC_FLAGS_QUERY_PENDING, /* Query is pending */ |
78 | EC_FLAGS_GPE_STORM, /* GPE storm detected */ | 78 | EC_FLAGS_GPE_STORM, /* GPE storm detected */ |
79 | EC_FLAGS_HANDLERS_INSTALLED /* Handlers for GPE and | 79 | EC_FLAGS_HANDLERS_INSTALLED, /* Handlers for GPE and |
80 | * OpReg are installed */ | 80 | * OpReg are installed */ |
81 | EC_FLAGS_FROZEN, /* Transactions are suspended */ | ||
81 | }; | 82 | }; |
82 | 83 | ||
83 | /* If we find an EC via the ECDT, we need to keep a ptr to its context */ | 84 | /* If we find an EC via the ECDT, we need to keep a ptr to its context */ |
@@ -291,6 +292,10 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t) | |||
291 | if (t->rdata) | 292 | if (t->rdata) |
292 | memset(t->rdata, 0, t->rlen); | 293 | memset(t->rdata, 0, t->rlen); |
293 | mutex_lock(&ec->lock); | 294 | mutex_lock(&ec->lock); |
295 | if (test_bit(EC_FLAGS_FROZEN, &ec->flags)) { | ||
296 | status = -EINVAL; | ||
297 | goto unlock; | ||
298 | } | ||
294 | if (ec->global_lock) { | 299 | if (ec->global_lock) { |
295 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); | 300 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); |
296 | if (ACPI_FAILURE(status)) { | 301 | if (ACPI_FAILURE(status)) { |
@@ -453,6 +458,32 @@ int ec_transaction(u8 command, | |||
453 | 458 | ||
454 | EXPORT_SYMBOL(ec_transaction); | 459 | EXPORT_SYMBOL(ec_transaction); |
455 | 460 | ||
461 | void acpi_ec_suspend_transactions(void) | ||
462 | { | ||
463 | struct acpi_ec *ec = first_ec; | ||
464 | |||
465 | if (!ec) | ||
466 | return; | ||
467 | |||
468 | mutex_lock(&ec->lock); | ||
469 | /* Prevent transactions from being carried out */ | ||
470 | set_bit(EC_FLAGS_FROZEN, &ec->flags); | ||
471 | mutex_unlock(&ec->lock); | ||
472 | } | ||
473 | |||
474 | void acpi_ec_resume_transactions(void) | ||
475 | { | ||
476 | struct acpi_ec *ec = first_ec; | ||
477 | |||
478 | if (!ec) | ||
479 | return; | ||
480 | |||
481 | mutex_lock(&ec->lock); | ||
482 | /* Allow transactions to be carried out again */ | ||
483 | clear_bit(EC_FLAGS_FROZEN, &ec->flags); | ||
484 | mutex_unlock(&ec->lock); | ||
485 | } | ||
486 | |||
456 | static int acpi_ec_query_unlocked(struct acpi_ec *ec, u8 * data) | 487 | static int acpi_ec_query_unlocked(struct acpi_ec *ec, u8 * data) |
457 | { | 488 | { |
458 | int result; | 489 | int result; |
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index 9c4c962e46e3..e28411367239 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h | |||
@@ -49,6 +49,8 @@ void acpi_early_processor_set_pdc(void); | |||
49 | int acpi_ec_init(void); | 49 | int acpi_ec_init(void); |
50 | int acpi_ec_ecdt_probe(void); | 50 | int acpi_ec_ecdt_probe(void); |
51 | int acpi_boot_ec_enable(void); | 51 | int acpi_boot_ec_enable(void); |
52 | void acpi_ec_suspend_transactions(void); | ||
53 | void acpi_ec_resume_transactions(void); | ||
52 | 54 | ||
53 | /*-------------------------------------------------------------------------- | 55 | /*-------------------------------------------------------------------------- |
54 | Suspend/Resume | 56 | Suspend/Resume |
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index 7ded7542fc9d..29c6f5766dcf 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c | |||
@@ -1133,9 +1133,6 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) | |||
1133 | int result = 0; | 1133 | int result = 0; |
1134 | struct acpi_processor_throttling *pthrottling; | 1134 | struct acpi_processor_throttling *pthrottling; |
1135 | 1135 | ||
1136 | if (!pr) | ||
1137 | return -EINVAL; | ||
1138 | |||
1139 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 1136 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
1140 | "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n", | 1137 | "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n", |
1141 | pr->throttling.address, | 1138 | pr->throttling.address, |
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index b16ddbf23a9c..89ad11138e48 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c | |||
@@ -217,6 +217,9 @@ static int acpi_sbs_battery_get_property(struct power_supply *psy, | |||
217 | case POWER_SUPPLY_PROP_TECHNOLOGY: | 217 | case POWER_SUPPLY_PROP_TECHNOLOGY: |
218 | val->intval = acpi_battery_technology(battery); | 218 | val->intval = acpi_battery_technology(battery); |
219 | break; | 219 | break; |
220 | case POWER_SUPPLY_PROP_CYCLE_COUNT: | ||
221 | val->intval = battery->cycle_count; | ||
222 | break; | ||
220 | case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN: | 223 | case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN: |
221 | val->intval = battery->design_voltage * | 224 | val->intval = battery->design_voltage * |
222 | acpi_battery_vscale(battery) * 1000; | 225 | acpi_battery_vscale(battery) * 1000; |
@@ -276,6 +279,7 @@ static enum power_supply_property sbs_charge_battery_props[] = { | |||
276 | POWER_SUPPLY_PROP_STATUS, | 279 | POWER_SUPPLY_PROP_STATUS, |
277 | POWER_SUPPLY_PROP_PRESENT, | 280 | POWER_SUPPLY_PROP_PRESENT, |
278 | POWER_SUPPLY_PROP_TECHNOLOGY, | 281 | POWER_SUPPLY_PROP_TECHNOLOGY, |
282 | POWER_SUPPLY_PROP_CYCLE_COUNT, | ||
279 | POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, | 283 | POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, |
280 | POWER_SUPPLY_PROP_VOLTAGE_NOW, | 284 | POWER_SUPPLY_PROP_VOLTAGE_NOW, |
281 | POWER_SUPPLY_PROP_CURRENT_NOW, | 285 | POWER_SUPPLY_PROP_CURRENT_NOW, |
@@ -560,6 +564,7 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset) | |||
560 | battery->design_voltage * acpi_battery_vscale(battery)); | 564 | battery->design_voltage * acpi_battery_vscale(battery)); |
561 | seq_printf(seq, "design capacity warning: unknown\n"); | 565 | seq_printf(seq, "design capacity warning: unknown\n"); |
562 | seq_printf(seq, "design capacity low: unknown\n"); | 566 | seq_printf(seq, "design capacity low: unknown\n"); |
567 | seq_printf(seq, "cycle count: %i\n", battery->cycle_count); | ||
563 | seq_printf(seq, "capacity granularity 1: unknown\n"); | 568 | seq_printf(seq, "capacity granularity 1: unknown\n"); |
564 | seq_printf(seq, "capacity granularity 2: unknown\n"); | 569 | seq_printf(seq, "capacity granularity 2: unknown\n"); |
565 | seq_printf(seq, "model number: %s\n", battery->device_name); | 570 | seq_printf(seq, "model number: %s\n", battery->device_name); |
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 3bde594a9979..f74834a544fd 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
@@ -552,8 +552,17 @@ static void acpi_hibernation_leave(void) | |||
552 | hibernate_nvs_restore(); | 552 | hibernate_nvs_restore(); |
553 | } | 553 | } |
554 | 554 | ||
555 | static void acpi_pm_enable_gpes(void) | 555 | static int acpi_pm_pre_restore(void) |
556 | { | 556 | { |
557 | acpi_disable_all_gpes(); | ||
558 | acpi_os_wait_events_complete(NULL); | ||
559 | acpi_ec_suspend_transactions(); | ||
560 | return 0; | ||
561 | } | ||
562 | |||
563 | static void acpi_pm_restore_cleanup(void) | ||
564 | { | ||
565 | acpi_ec_resume_transactions(); | ||
557 | acpi_enable_all_runtime_gpes(); | 566 | acpi_enable_all_runtime_gpes(); |
558 | } | 567 | } |
559 | 568 | ||
@@ -565,8 +574,8 @@ static struct platform_hibernation_ops acpi_hibernation_ops = { | |||
565 | .prepare = acpi_pm_prepare, | 574 | .prepare = acpi_pm_prepare, |
566 | .enter = acpi_hibernation_enter, | 575 | .enter = acpi_hibernation_enter, |
567 | .leave = acpi_hibernation_leave, | 576 | .leave = acpi_hibernation_leave, |
568 | .pre_restore = acpi_pm_disable_gpes, | 577 | .pre_restore = acpi_pm_pre_restore, |
569 | .restore_cleanup = acpi_pm_enable_gpes, | 578 | .restore_cleanup = acpi_pm_restore_cleanup, |
570 | }; | 579 | }; |
571 | 580 | ||
572 | /** | 581 | /** |
@@ -618,8 +627,8 @@ static struct platform_hibernation_ops acpi_hibernation_ops_old = { | |||
618 | .prepare = acpi_pm_disable_gpes, | 627 | .prepare = acpi_pm_disable_gpes, |
619 | .enter = acpi_hibernation_enter, | 628 | .enter = acpi_hibernation_enter, |
620 | .leave = acpi_hibernation_leave, | 629 | .leave = acpi_hibernation_leave, |
621 | .pre_restore = acpi_pm_disable_gpes, | 630 | .pre_restore = acpi_pm_pre_restore, |
622 | .restore_cleanup = acpi_pm_enable_gpes, | 631 | .restore_cleanup = acpi_pm_restore_cleanup, |
623 | .recover = acpi_pm_finish, | 632 | .recover = acpi_pm_finish, |
624 | }; | 633 | }; |
625 | #endif /* CONFIG_HIBERNATION */ | 634 | #endif /* CONFIG_HIBERNATION */ |
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 9073ada88835..5d3893558cf7 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -368,7 +368,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) | |||
368 | int valid = 0; | 368 | int valid = 0; |
369 | int i; | 369 | int i; |
370 | 370 | ||
371 | /* Critical Shutdown (required) */ | 371 | /* Critical Shutdown */ |
372 | if (flag & ACPI_TRIPS_CRITICAL) { | 372 | if (flag & ACPI_TRIPS_CRITICAL) { |
373 | status = acpi_evaluate_integer(tz->device->handle, | 373 | status = acpi_evaluate_integer(tz->device->handle, |
374 | "_CRT", NULL, &tmp); | 374 | "_CRT", NULL, &tmp); |
@@ -379,17 +379,19 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) | |||
379 | * Below zero (Celsius) values clearly aren't right for sure.. | 379 | * Below zero (Celsius) values clearly aren't right for sure.. |
380 | * ... so lets discard those as invalid. | 380 | * ... so lets discard those as invalid. |
381 | */ | 381 | */ |
382 | if (ACPI_FAILURE(status) || | 382 | if (ACPI_FAILURE(status)) { |
383 | tz->trips.critical.temperature <= 2732) { | 383 | tz->trips.critical.flags.valid = 0; |
384 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
385 | "No critical threshold\n")); | ||
386 | } else if (tmp <= 2732) { | ||
387 | printk(KERN_WARNING FW_BUG "Invalid critical threshold " | ||
388 | "(%llu)\n", tmp); | ||
384 | tz->trips.critical.flags.valid = 0; | 389 | tz->trips.critical.flags.valid = 0; |
385 | ACPI_EXCEPTION((AE_INFO, status, | ||
386 | "No or invalid critical threshold")); | ||
387 | return -ENODEV; | ||
388 | } else { | 390 | } else { |
389 | tz->trips.critical.flags.valid = 1; | 391 | tz->trips.critical.flags.valid = 1; |
390 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 392 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
391 | "Found critical threshold [%lu]\n", | 393 | "Found critical threshold [%lu]\n", |
392 | tz->trips.critical.temperature)); | 394 | tz->trips.critical.temperature)); |
393 | } | 395 | } |
394 | if (tz->trips.critical.flags.valid == 1) { | 396 | if (tz->trips.critical.flags.valid == 1) { |
395 | if (crt == -1) { | 397 | if (crt == -1) { |
@@ -575,7 +577,23 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) | |||
575 | 577 | ||
576 | static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) | 578 | static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) |
577 | { | 579 | { |
578 | return acpi_thermal_trips_update(tz, ACPI_TRIPS_INIT); | 580 | int i, valid, ret = acpi_thermal_trips_update(tz, ACPI_TRIPS_INIT); |
581 | |||
582 | if (ret) | ||
583 | return ret; | ||
584 | |||
585 | valid = tz->trips.critical.flags.valid | | ||
586 | tz->trips.hot.flags.valid | | ||
587 | tz->trips.passive.flags.valid; | ||
588 | |||
589 | for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) | ||
590 | valid |= tz->trips.active[i].flags.valid; | ||
591 | |||
592 | if (!valid) { | ||
593 | printk(KERN_WARNING FW_BUG "No valid trip found\n"); | ||
594 | return -ENODEV; | ||
595 | } | ||
596 | return 0; | ||
579 | } | 597 | } |
580 | 598 | ||
581 | static void acpi_thermal_check(void *data) | 599 | static void acpi_thermal_check(void *data) |
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 11882dbe2094..c9a49f4747e6 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c | |||
@@ -289,51 +289,6 @@ acpi_evaluate_integer(acpi_handle handle, | |||
289 | 289 | ||
290 | EXPORT_SYMBOL(acpi_evaluate_integer); | 290 | EXPORT_SYMBOL(acpi_evaluate_integer); |
291 | 291 | ||
292 | #if 0 | ||
293 | acpi_status | ||
294 | acpi_evaluate_string(acpi_handle handle, | ||
295 | acpi_string pathname, | ||
296 | acpi_object_list * arguments, acpi_string * data) | ||
297 | { | ||
298 | acpi_status status = AE_OK; | ||
299 | acpi_object *element = NULL; | ||
300 | acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
301 | |||
302 | |||
303 | if (!data) | ||
304 | return AE_BAD_PARAMETER; | ||
305 | |||
306 | status = acpi_evaluate_object(handle, pathname, arguments, &buffer); | ||
307 | if (ACPI_FAILURE(status)) { | ||
308 | acpi_util_eval_error(handle, pathname, status); | ||
309 | return status; | ||
310 | } | ||
311 | |||
312 | element = (acpi_object *) buffer.pointer; | ||
313 | |||
314 | if ((element->type != ACPI_TYPE_STRING) | ||
315 | || (element->type != ACPI_TYPE_BUFFER) | ||
316 | || !element->string.length) { | ||
317 | acpi_util_eval_error(handle, pathname, AE_BAD_DATA); | ||
318 | return AE_BAD_DATA; | ||
319 | } | ||
320 | |||
321 | *data = kzalloc(element->string.length + 1, GFP_KERNEL); | ||
322 | if (!data) { | ||
323 | printk(KERN_ERR PREFIX "Memory allocation\n"); | ||
324 | return -ENOMEM; | ||
325 | } | ||
326 | |||
327 | memcpy(*data, element->string.pointer, element->string.length); | ||
328 | |||
329 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Return value [%s]\n", *data)); | ||
330 | |||
331 | kfree(buffer.pointer); | ||
332 | |||
333 | return AE_OK; | ||
334 | } | ||
335 | #endif | ||
336 | |||
337 | acpi_status | 292 | acpi_status |
338 | acpi_evaluate_reference(acpi_handle handle, | 293 | acpi_evaluate_reference(acpi_handle handle, |
339 | acpi_string pathname, | 294 | acpi_string pathname, |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 6e9b49149fce..2ff2b6ab5b6c 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -327,7 +327,7 @@ static int acpi_video_device_lcd_set_level(struct acpi_video_device *device, | |||
327 | int level); | 327 | int level); |
328 | static int acpi_video_device_lcd_get_level_current( | 328 | static int acpi_video_device_lcd_get_level_current( |
329 | struct acpi_video_device *device, | 329 | struct acpi_video_device *device, |
330 | unsigned long long *level); | 330 | unsigned long long *level, int init); |
331 | static int acpi_video_get_next_level(struct acpi_video_device *device, | 331 | static int acpi_video_get_next_level(struct acpi_video_device *device, |
332 | u32 level_current, u32 event); | 332 | u32 level_current, u32 event); |
333 | static int acpi_video_switch_brightness(struct acpi_video_device *device, | 333 | static int acpi_video_switch_brightness(struct acpi_video_device *device, |
@@ -345,7 +345,7 @@ static int acpi_video_get_brightness(struct backlight_device *bd) | |||
345 | struct acpi_video_device *vd = | 345 | struct acpi_video_device *vd = |
346 | (struct acpi_video_device *)bl_get_data(bd); | 346 | (struct acpi_video_device *)bl_get_data(bd); |
347 | 347 | ||
348 | if (acpi_video_device_lcd_get_level_current(vd, &cur_level)) | 348 | if (acpi_video_device_lcd_get_level_current(vd, &cur_level, 0)) |
349 | return -EINVAL; | 349 | return -EINVAL; |
350 | for (i = 2; i < vd->brightness->count; i++) { | 350 | for (i = 2; i < vd->brightness->count; i++) { |
351 | if (vd->brightness->levels[i] == cur_level) | 351 | if (vd->brightness->levels[i] == cur_level) |
@@ -414,7 +414,7 @@ static int video_get_cur_state(struct thermal_cooling_device *cooling_dev, unsig | |||
414 | unsigned long long level; | 414 | unsigned long long level; |
415 | int offset; | 415 | int offset; |
416 | 416 | ||
417 | if (acpi_video_device_lcd_get_level_current(video, &level)) | 417 | if (acpi_video_device_lcd_get_level_current(video, &level, 0)) |
418 | return -EINVAL; | 418 | return -EINVAL; |
419 | for (offset = 2; offset < video->brightness->count; offset++) | 419 | for (offset = 2; offset < video->brightness->count; offset++) |
420 | if (level == video->brightness->levels[offset]) { | 420 | if (level == video->brightness->levels[offset]) { |
@@ -609,7 +609,7 @@ static struct dmi_system_id video_dmi_table[] __initdata = { | |||
609 | 609 | ||
610 | static int | 610 | static int |
611 | acpi_video_device_lcd_get_level_current(struct acpi_video_device *device, | 611 | acpi_video_device_lcd_get_level_current(struct acpi_video_device *device, |
612 | unsigned long long *level) | 612 | unsigned long long *level, int init) |
613 | { | 613 | { |
614 | acpi_status status = AE_OK; | 614 | acpi_status status = AE_OK; |
615 | int i; | 615 | int i; |
@@ -633,10 +633,16 @@ acpi_video_device_lcd_get_level_current(struct acpi_video_device *device, | |||
633 | device->brightness->curr = *level; | 633 | device->brightness->curr = *level; |
634 | return 0; | 634 | return 0; |
635 | } | 635 | } |
636 | /* BQC returned an invalid level. Stop using it. */ | 636 | if (!init) { |
637 | ACPI_WARNING((AE_INFO, "%s returned an invalid level", | 637 | /* |
638 | buf)); | 638 | * BQC returned an invalid level. |
639 | device->cap._BQC = device->cap._BCQ = 0; | 639 | * Stop using it. |
640 | */ | ||
641 | ACPI_WARNING((AE_INFO, | ||
642 | "%s returned an invalid level", | ||
643 | buf)); | ||
644 | device->cap._BQC = device->cap._BCQ = 0; | ||
645 | } | ||
640 | } else { | 646 | } else { |
641 | /* Fixme: | 647 | /* Fixme: |
642 | * should we return an error or ignore this failure? | 648 | * should we return an error or ignore this failure? |
@@ -892,7 +898,7 @@ acpi_video_init_brightness(struct acpi_video_device *device) | |||
892 | if (!device->cap._BQC) | 898 | if (!device->cap._BQC) |
893 | goto set_level; | 899 | goto set_level; |
894 | 900 | ||
895 | result = acpi_video_device_lcd_get_level_current(device, &level_old); | 901 | result = acpi_video_device_lcd_get_level_current(device, &level_old, 1); |
896 | if (result) | 902 | if (result) |
897 | goto out_free_levels; | 903 | goto out_free_levels; |
898 | 904 | ||
@@ -903,7 +909,7 @@ acpi_video_init_brightness(struct acpi_video_device *device) | |||
903 | if (result) | 909 | if (result) |
904 | goto out_free_levels; | 910 | goto out_free_levels; |
905 | 911 | ||
906 | result = acpi_video_device_lcd_get_level_current(device, &level); | 912 | result = acpi_video_device_lcd_get_level_current(device, &level, 0); |
907 | if (result) | 913 | if (result) |
908 | goto out_free_levels; | 914 | goto out_free_levels; |
909 | 915 | ||
@@ -1996,7 +2002,7 @@ acpi_video_switch_brightness(struct acpi_video_device *device, int event) | |||
1996 | goto out; | 2002 | goto out; |
1997 | 2003 | ||
1998 | result = acpi_video_device_lcd_get_level_current(device, | 2004 | result = acpi_video_device_lcd_get_level_current(device, |
1999 | &level_current); | 2005 | &level_current, 0); |
2000 | if (result) | 2006 | if (result) |
2001 | goto out; | 2007 | goto out; |
2002 | 2008 | ||
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index cb2fd01eddae..b5dad9f37453 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
@@ -749,6 +749,24 @@ static int acpiphp_bus_trim(acpi_handle handle) | |||
749 | return retval; | 749 | return retval; |
750 | } | 750 | } |
751 | 751 | ||
752 | static void acpiphp_set_acpi_region(struct acpiphp_slot *slot) | ||
753 | { | ||
754 | struct acpiphp_func *func; | ||
755 | union acpi_object params[2]; | ||
756 | struct acpi_object_list arg_list; | ||
757 | |||
758 | list_for_each_entry(func, &slot->funcs, sibling) { | ||
759 | arg_list.count = 2; | ||
760 | arg_list.pointer = params; | ||
761 | params[0].type = ACPI_TYPE_INTEGER; | ||
762 | params[0].integer.value = ACPI_ADR_SPACE_PCI_CONFIG; | ||
763 | params[1].type = ACPI_TYPE_INTEGER; | ||
764 | params[1].integer.value = 1; | ||
765 | /* _REG is optional, we don't care about if there is failure */ | ||
766 | acpi_evaluate_object(func->handle, "_REG", &arg_list, NULL); | ||
767 | } | ||
768 | } | ||
769 | |||
752 | /** | 770 | /** |
753 | * enable_device - enable, configure a slot | 771 | * enable_device - enable, configure a slot |
754 | * @slot: slot to be enabled | 772 | * @slot: slot to be enabled |
@@ -805,6 +823,7 @@ static int __ref enable_device(struct acpiphp_slot *slot) | |||
805 | pci_bus_assign_resources(bus); | 823 | pci_bus_assign_resources(bus); |
806 | acpiphp_sanitize_bus(bus); | 824 | acpiphp_sanitize_bus(bus); |
807 | acpiphp_set_hpp_values(bus); | 825 | acpiphp_set_hpp_values(bus); |
826 | acpiphp_set_acpi_region(slot); | ||
808 | pci_enable_bridges(bus); | 827 | pci_enable_bridges(bus); |
809 | pci_bus_add_devices(bus); | 828 | pci_bus_add_devices(bus); |
810 | 829 | ||
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index 3f71a605a492..5a3d8514c66d 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c | |||
@@ -145,7 +145,7 @@ struct sony_laptop_input_s { | |||
145 | struct input_dev *key_dev; | 145 | struct input_dev *key_dev; |
146 | struct kfifo fifo; | 146 | struct kfifo fifo; |
147 | spinlock_t fifo_lock; | 147 | spinlock_t fifo_lock; |
148 | struct workqueue_struct *wq; | 148 | struct timer_list release_key_timer; |
149 | }; | 149 | }; |
150 | 150 | ||
151 | static struct sony_laptop_input_s sony_laptop_input = { | 151 | static struct sony_laptop_input_s sony_laptop_input = { |
@@ -299,20 +299,26 @@ static int sony_laptop_input_keycode_map[] = { | |||
299 | }; | 299 | }; |
300 | 300 | ||
301 | /* release buttons after a short delay if pressed */ | 301 | /* release buttons after a short delay if pressed */ |
302 | static void do_sony_laptop_release_key(struct work_struct *work) | 302 | static void do_sony_laptop_release_key(unsigned long unused) |
303 | { | 303 | { |
304 | struct sony_laptop_keypress kp; | 304 | struct sony_laptop_keypress kp; |
305 | unsigned long flags; | ||
306 | |||
307 | spin_lock_irqsave(&sony_laptop_input.fifo_lock, flags); | ||
305 | 308 | ||
306 | while (kfifo_out_locked(&sony_laptop_input.fifo, (unsigned char *)&kp, | 309 | if (kfifo_out(&sony_laptop_input.fifo, |
307 | sizeof(kp), &sony_laptop_input.fifo_lock) | 310 | (unsigned char *)&kp, sizeof(kp)) == sizeof(kp)) { |
308 | == sizeof(kp)) { | ||
309 | msleep(10); | ||
310 | input_report_key(kp.dev, kp.key, 0); | 311 | input_report_key(kp.dev, kp.key, 0); |
311 | input_sync(kp.dev); | 312 | input_sync(kp.dev); |
312 | } | 313 | } |
314 | |||
315 | /* If there is something in the fifo schedule next release. */ | ||
316 | if (kfifo_len(&sony_laptop_input.fifo) != 0) | ||
317 | mod_timer(&sony_laptop_input.release_key_timer, | ||
318 | jiffies + msecs_to_jiffies(10)); | ||
319 | |||
320 | spin_unlock_irqrestore(&sony_laptop_input.fifo_lock, flags); | ||
313 | } | 321 | } |
314 | static DECLARE_WORK(sony_laptop_release_key_work, | ||
315 | do_sony_laptop_release_key); | ||
316 | 322 | ||
317 | /* forward event to the input subsystem */ | 323 | /* forward event to the input subsystem */ |
318 | static void sony_laptop_report_input_event(u8 event) | 324 | static void sony_laptop_report_input_event(u8 event) |
@@ -366,13 +372,13 @@ static void sony_laptop_report_input_event(u8 event) | |||
366 | /* we emit the scancode so we can always remap the key */ | 372 | /* we emit the scancode so we can always remap the key */ |
367 | input_event(kp.dev, EV_MSC, MSC_SCAN, event); | 373 | input_event(kp.dev, EV_MSC, MSC_SCAN, event); |
368 | input_sync(kp.dev); | 374 | input_sync(kp.dev); |
369 | kfifo_in_locked(&sony_laptop_input.fifo, | ||
370 | (unsigned char *)&kp, sizeof(kp), | ||
371 | &sony_laptop_input.fifo_lock); | ||
372 | 375 | ||
373 | if (!work_pending(&sony_laptop_release_key_work)) | 376 | /* schedule key release */ |
374 | queue_work(sony_laptop_input.wq, | 377 | kfifo_in_locked(&sony_laptop_input.fifo, |
375 | &sony_laptop_release_key_work); | 378 | (unsigned char *)&kp, sizeof(kp), |
379 | &sony_laptop_input.fifo_lock); | ||
380 | mod_timer(&sony_laptop_input.release_key_timer, | ||
381 | jiffies + msecs_to_jiffies(10)); | ||
376 | } else | 382 | } else |
377 | dprintk("unknown input event %.2x\n", event); | 383 | dprintk("unknown input event %.2x\n", event); |
378 | } | 384 | } |
@@ -390,27 +396,21 @@ static int sony_laptop_setup_input(struct acpi_device *acpi_device) | |||
390 | 396 | ||
391 | /* kfifo */ | 397 | /* kfifo */ |
392 | spin_lock_init(&sony_laptop_input.fifo_lock); | 398 | spin_lock_init(&sony_laptop_input.fifo_lock); |
393 | error = | 399 | error = kfifo_alloc(&sony_laptop_input.fifo, |
394 | kfifo_alloc(&sony_laptop_input.fifo, SONY_LAPTOP_BUF_SIZE, GFP_KERNEL); | 400 | SONY_LAPTOP_BUF_SIZE, GFP_KERNEL); |
395 | if (error) { | 401 | if (error) { |
396 | printk(KERN_ERR DRV_PFX "kfifo_alloc failed\n"); | 402 | printk(KERN_ERR DRV_PFX "kfifo_alloc failed\n"); |
397 | goto err_dec_users; | 403 | goto err_dec_users; |
398 | } | 404 | } |
399 | 405 | ||
400 | /* init workqueue */ | 406 | setup_timer(&sony_laptop_input.release_key_timer, |
401 | sony_laptop_input.wq = create_singlethread_workqueue("sony-laptop"); | 407 | do_sony_laptop_release_key, 0); |
402 | if (!sony_laptop_input.wq) { | ||
403 | printk(KERN_ERR DRV_PFX | ||
404 | "Unable to create workqueue.\n"); | ||
405 | error = -ENXIO; | ||
406 | goto err_free_kfifo; | ||
407 | } | ||
408 | 408 | ||
409 | /* input keys */ | 409 | /* input keys */ |
410 | key_dev = input_allocate_device(); | 410 | key_dev = input_allocate_device(); |
411 | if (!key_dev) { | 411 | if (!key_dev) { |
412 | error = -ENOMEM; | 412 | error = -ENOMEM; |
413 | goto err_destroy_wq; | 413 | goto err_free_kfifo; |
414 | } | 414 | } |
415 | 415 | ||
416 | key_dev->name = "Sony Vaio Keys"; | 416 | key_dev->name = "Sony Vaio Keys"; |
@@ -419,18 +419,15 @@ static int sony_laptop_setup_input(struct acpi_device *acpi_device) | |||
419 | key_dev->dev.parent = &acpi_device->dev; | 419 | key_dev->dev.parent = &acpi_device->dev; |
420 | 420 | ||
421 | /* Initialize the Input Drivers: special keys */ | 421 | /* Initialize the Input Drivers: special keys */ |
422 | set_bit(EV_KEY, key_dev->evbit); | 422 | input_set_capability(key_dev, EV_MSC, MSC_SCAN); |
423 | set_bit(EV_MSC, key_dev->evbit); | 423 | |
424 | set_bit(MSC_SCAN, key_dev->mscbit); | 424 | __set_bit(EV_KEY, key_dev->evbit); |
425 | key_dev->keycodesize = sizeof(sony_laptop_input_keycode_map[0]); | 425 | key_dev->keycodesize = sizeof(sony_laptop_input_keycode_map[0]); |
426 | key_dev->keycodemax = ARRAY_SIZE(sony_laptop_input_keycode_map); | 426 | key_dev->keycodemax = ARRAY_SIZE(sony_laptop_input_keycode_map); |
427 | key_dev->keycode = &sony_laptop_input_keycode_map; | 427 | key_dev->keycode = &sony_laptop_input_keycode_map; |
428 | for (i = 0; i < ARRAY_SIZE(sony_laptop_input_keycode_map); i++) { | 428 | for (i = 0; i < ARRAY_SIZE(sony_laptop_input_keycode_map); i++) |
429 | if (sony_laptop_input_keycode_map[i] != KEY_RESERVED) { | 429 | __set_bit(sony_laptop_input_keycode_map[i], key_dev->keybit); |
430 | set_bit(sony_laptop_input_keycode_map[i], | 430 | __clear_bit(KEY_RESERVED, key_dev->keybit); |
431 | key_dev->keybit); | ||
432 | } | ||
433 | } | ||
434 | 431 | ||
435 | error = input_register_device(key_dev); | 432 | error = input_register_device(key_dev); |
436 | if (error) | 433 | if (error) |
@@ -450,9 +447,8 @@ static int sony_laptop_setup_input(struct acpi_device *acpi_device) | |||
450 | jog_dev->id.vendor = PCI_VENDOR_ID_SONY; | 447 | jog_dev->id.vendor = PCI_VENDOR_ID_SONY; |
451 | key_dev->dev.parent = &acpi_device->dev; | 448 | key_dev->dev.parent = &acpi_device->dev; |
452 | 449 | ||
453 | jog_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); | 450 | input_set_capability(jog_dev, EV_KEY, BTN_MIDDLE); |
454 | jog_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_MIDDLE); | 451 | input_set_capability(jog_dev, EV_REL, REL_WHEEL); |
455 | jog_dev->relbit[0] = BIT_MASK(REL_WHEEL); | ||
456 | 452 | ||
457 | error = input_register_device(jog_dev); | 453 | error = input_register_device(jog_dev); |
458 | if (error) | 454 | if (error) |
@@ -473,9 +469,6 @@ err_unregister_keydev: | |||
473 | err_free_keydev: | 469 | err_free_keydev: |
474 | input_free_device(key_dev); | 470 | input_free_device(key_dev); |
475 | 471 | ||
476 | err_destroy_wq: | ||
477 | destroy_workqueue(sony_laptop_input.wq); | ||
478 | |||
479 | err_free_kfifo: | 472 | err_free_kfifo: |
480 | kfifo_free(&sony_laptop_input.fifo); | 473 | kfifo_free(&sony_laptop_input.fifo); |
481 | 474 | ||
@@ -486,12 +479,23 @@ err_dec_users: | |||
486 | 479 | ||
487 | static void sony_laptop_remove_input(void) | 480 | static void sony_laptop_remove_input(void) |
488 | { | 481 | { |
489 | /* cleanup only after the last user has gone */ | 482 | struct sony_laptop_keypress kp = { NULL }; |
483 | |||
484 | /* Cleanup only after the last user has gone */ | ||
490 | if (!atomic_dec_and_test(&sony_laptop_input.users)) | 485 | if (!atomic_dec_and_test(&sony_laptop_input.users)) |
491 | return; | 486 | return; |
492 | 487 | ||
493 | /* flush workqueue first */ | 488 | del_timer_sync(&sony_laptop_input.release_key_timer); |
494 | flush_workqueue(sony_laptop_input.wq); | 489 | |
490 | /* | ||
491 | * Generate key-up events for remaining keys. Note that we don't | ||
492 | * need locking since nobody is adding new events to the kfifo. | ||
493 | */ | ||
494 | while (kfifo_out(&sony_laptop_input.fifo, | ||
495 | (unsigned char *)&kp, sizeof(kp)) == sizeof(kp)) { | ||
496 | input_report_key(kp.dev, kp.key, 0); | ||
497 | input_sync(kp.dev); | ||
498 | } | ||
495 | 499 | ||
496 | /* destroy input devs */ | 500 | /* destroy input devs */ |
497 | input_unregister_device(sony_laptop_input.key_dev); | 501 | input_unregister_device(sony_laptop_input.key_dev); |
@@ -502,7 +506,6 @@ static void sony_laptop_remove_input(void) | |||
502 | sony_laptop_input.jog_dev = NULL; | 506 | sony_laptop_input.jog_dev = NULL; |
503 | } | 507 | } |
504 | 508 | ||
505 | destroy_workqueue(sony_laptop_input.wq); | ||
506 | kfifo_free(&sony_laptop_input.fifo); | 509 | kfifo_free(&sony_laptop_input.fifo); |
507 | } | 510 | } |
508 | 511 | ||
diff --git a/drivers/pnp/base.h b/drivers/pnp/base.h index 0b8d14050efa..0bab84ebb15d 100644 --- a/drivers/pnp/base.h +++ b/drivers/pnp/base.h | |||
@@ -166,6 +166,9 @@ struct pnp_resource *pnp_add_io_resource(struct pnp_dev *dev, | |||
166 | struct pnp_resource *pnp_add_mem_resource(struct pnp_dev *dev, | 166 | struct pnp_resource *pnp_add_mem_resource(struct pnp_dev *dev, |
167 | resource_size_t start, | 167 | resource_size_t start, |
168 | resource_size_t end, int flags); | 168 | resource_size_t end, int flags); |
169 | struct pnp_resource *pnp_add_bus_resource(struct pnp_dev *dev, | ||
170 | resource_size_t start, | ||
171 | resource_size_t end); | ||
169 | 172 | ||
170 | extern int pnp_debug; | 173 | extern int pnp_debug; |
171 | 174 | ||
diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c index 68b0c04987e4..cfaf5b73540b 100644 --- a/drivers/pnp/interface.c +++ b/drivers/pnp/interface.c | |||
@@ -278,9 +278,12 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, | |||
278 | switch (pnp_resource_type(res)) { | 278 | switch (pnp_resource_type(res)) { |
279 | case IORESOURCE_IO: | 279 | case IORESOURCE_IO: |
280 | case IORESOURCE_MEM: | 280 | case IORESOURCE_MEM: |
281 | pnp_printf(buffer, " %#llx-%#llx\n", | 281 | case IORESOURCE_BUS: |
282 | pnp_printf(buffer, " %#llx-%#llx%s\n", | ||
282 | (unsigned long long) res->start, | 283 | (unsigned long long) res->start, |
283 | (unsigned long long) res->end); | 284 | (unsigned long long) res->end, |
285 | res->flags & IORESOURCE_WINDOW ? | ||
286 | " window" : ""); | ||
284 | break; | 287 | break; |
285 | case IORESOURCE_IRQ: | 288 | case IORESOURCE_IRQ: |
286 | case IORESOURCE_DMA: | 289 | case IORESOURCE_DMA: |
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 5702b2c8691f..54514aa35b09 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
@@ -177,7 +177,8 @@ static int dma_flags(struct pnp_dev *dev, int type, int bus_master, | |||
177 | } | 177 | } |
178 | 178 | ||
179 | static void pnpacpi_parse_allocated_ioresource(struct pnp_dev *dev, u64 start, | 179 | static void pnpacpi_parse_allocated_ioresource(struct pnp_dev *dev, u64 start, |
180 | u64 len, int io_decode) | 180 | u64 len, int io_decode, |
181 | int window) | ||
181 | { | 182 | { |
182 | int flags = 0; | 183 | int flags = 0; |
183 | u64 end = start + len - 1; | 184 | u64 end = start + len - 1; |
@@ -186,6 +187,8 @@ static void pnpacpi_parse_allocated_ioresource(struct pnp_dev *dev, u64 start, | |||
186 | flags |= IORESOURCE_IO_16BIT_ADDR; | 187 | flags |= IORESOURCE_IO_16BIT_ADDR; |
187 | if (len == 0 || end >= 0x10003) | 188 | if (len == 0 || end >= 0x10003) |
188 | flags |= IORESOURCE_DISABLED; | 189 | flags |= IORESOURCE_DISABLED; |
190 | if (window) | ||
191 | flags |= IORESOURCE_WINDOW; | ||
189 | 192 | ||
190 | pnp_add_io_resource(dev, start, end, flags); | 193 | pnp_add_io_resource(dev, start, end, flags); |
191 | } | 194 | } |
@@ -247,7 +250,7 @@ static void pnpacpi_parse_allocated_vendor(struct pnp_dev *dev, | |||
247 | 250 | ||
248 | static void pnpacpi_parse_allocated_memresource(struct pnp_dev *dev, | 251 | static void pnpacpi_parse_allocated_memresource(struct pnp_dev *dev, |
249 | u64 start, u64 len, | 252 | u64 start, u64 len, |
250 | int write_protect) | 253 | int write_protect, int window) |
251 | { | 254 | { |
252 | int flags = 0; | 255 | int flags = 0; |
253 | u64 end = start + len - 1; | 256 | u64 end = start + len - 1; |
@@ -256,15 +259,26 @@ static void pnpacpi_parse_allocated_memresource(struct pnp_dev *dev, | |||
256 | flags |= IORESOURCE_DISABLED; | 259 | flags |= IORESOURCE_DISABLED; |
257 | if (write_protect == ACPI_READ_WRITE_MEMORY) | 260 | if (write_protect == ACPI_READ_WRITE_MEMORY) |
258 | flags |= IORESOURCE_MEM_WRITEABLE; | 261 | flags |= IORESOURCE_MEM_WRITEABLE; |
262 | if (window) | ||
263 | flags |= IORESOURCE_WINDOW; | ||
259 | 264 | ||
260 | pnp_add_mem_resource(dev, start, end, flags); | 265 | pnp_add_mem_resource(dev, start, end, flags); |
261 | } | 266 | } |
262 | 267 | ||
268 | static void pnpacpi_parse_allocated_busresource(struct pnp_dev *dev, | ||
269 | u64 start, u64 len) | ||
270 | { | ||
271 | u64 end = start + len - 1; | ||
272 | |||
273 | pnp_add_bus_resource(dev, start, end); | ||
274 | } | ||
275 | |||
263 | static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev, | 276 | static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev, |
264 | struct acpi_resource *res) | 277 | struct acpi_resource *res) |
265 | { | 278 | { |
266 | struct acpi_resource_address64 addr, *p = &addr; | 279 | struct acpi_resource_address64 addr, *p = &addr; |
267 | acpi_status status; | 280 | acpi_status status; |
281 | int window; | ||
268 | 282 | ||
269 | status = acpi_resource_to_address64(res, p); | 283 | status = acpi_resource_to_address64(res, p); |
270 | if (!ACPI_SUCCESS(status)) { | 284 | if (!ACPI_SUCCESS(status)) { |
@@ -273,37 +287,42 @@ static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev, | |||
273 | return; | 287 | return; |
274 | } | 288 | } |
275 | 289 | ||
276 | if (p->producer_consumer == ACPI_PRODUCER) | 290 | window = (p->producer_consumer == ACPI_PRODUCER) ? 1 : 0; |
277 | return; | ||
278 | 291 | ||
279 | if (p->resource_type == ACPI_MEMORY_RANGE) | 292 | if (p->resource_type == ACPI_MEMORY_RANGE) |
280 | pnpacpi_parse_allocated_memresource(dev, | 293 | pnpacpi_parse_allocated_memresource(dev, |
281 | p->minimum, p->address_length, | 294 | p->minimum, p->address_length, |
282 | p->info.mem.write_protect); | 295 | p->info.mem.write_protect, window); |
283 | else if (p->resource_type == ACPI_IO_RANGE) | 296 | else if (p->resource_type == ACPI_IO_RANGE) |
284 | pnpacpi_parse_allocated_ioresource(dev, | 297 | pnpacpi_parse_allocated_ioresource(dev, |
285 | p->minimum, p->address_length, | 298 | p->minimum, p->address_length, |
286 | p->granularity == 0xfff ? ACPI_DECODE_10 : | 299 | p->granularity == 0xfff ? ACPI_DECODE_10 : |
287 | ACPI_DECODE_16); | 300 | ACPI_DECODE_16, window); |
301 | else if (p->resource_type == ACPI_BUS_NUMBER_RANGE) | ||
302 | pnpacpi_parse_allocated_busresource(dev, p->minimum, | ||
303 | p->address_length); | ||
288 | } | 304 | } |
289 | 305 | ||
290 | static void pnpacpi_parse_allocated_ext_address_space(struct pnp_dev *dev, | 306 | static void pnpacpi_parse_allocated_ext_address_space(struct pnp_dev *dev, |
291 | struct acpi_resource *res) | 307 | struct acpi_resource *res) |
292 | { | 308 | { |
293 | struct acpi_resource_extended_address64 *p = &res->data.ext_address64; | 309 | struct acpi_resource_extended_address64 *p = &res->data.ext_address64; |
310 | int window; | ||
294 | 311 | ||
295 | if (p->producer_consumer == ACPI_PRODUCER) | 312 | window = (p->producer_consumer == ACPI_PRODUCER) ? 1 : 0; |
296 | return; | ||
297 | 313 | ||
298 | if (p->resource_type == ACPI_MEMORY_RANGE) | 314 | if (p->resource_type == ACPI_MEMORY_RANGE) |
299 | pnpacpi_parse_allocated_memresource(dev, | 315 | pnpacpi_parse_allocated_memresource(dev, |
300 | p->minimum, p->address_length, | 316 | p->minimum, p->address_length, |
301 | p->info.mem.write_protect); | 317 | p->info.mem.write_protect, window); |
302 | else if (p->resource_type == ACPI_IO_RANGE) | 318 | else if (p->resource_type == ACPI_IO_RANGE) |
303 | pnpacpi_parse_allocated_ioresource(dev, | 319 | pnpacpi_parse_allocated_ioresource(dev, |
304 | p->minimum, p->address_length, | 320 | p->minimum, p->address_length, |
305 | p->granularity == 0xfff ? ACPI_DECODE_10 : | 321 | p->granularity == 0xfff ? ACPI_DECODE_10 : |
306 | ACPI_DECODE_16); | 322 | ACPI_DECODE_16, window); |
323 | else if (p->resource_type == ACPI_BUS_NUMBER_RANGE) | ||
324 | pnpacpi_parse_allocated_busresource(dev, p->minimum, | ||
325 | p->address_length); | ||
307 | } | 326 | } |
308 | 327 | ||
309 | static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | 328 | static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, |
@@ -368,7 +387,7 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
368 | pnpacpi_parse_allocated_ioresource(dev, | 387 | pnpacpi_parse_allocated_ioresource(dev, |
369 | io->minimum, | 388 | io->minimum, |
370 | io->address_length, | 389 | io->address_length, |
371 | io->io_decode); | 390 | io->io_decode, 0); |
372 | break; | 391 | break; |
373 | 392 | ||
374 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: | 393 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: |
@@ -380,7 +399,7 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
380 | pnpacpi_parse_allocated_ioresource(dev, | 399 | pnpacpi_parse_allocated_ioresource(dev, |
381 | fixed_io->address, | 400 | fixed_io->address, |
382 | fixed_io->address_length, | 401 | fixed_io->address_length, |
383 | ACPI_DECODE_10); | 402 | ACPI_DECODE_10, 0); |
384 | break; | 403 | break; |
385 | 404 | ||
386 | case ACPI_RESOURCE_TYPE_VENDOR: | 405 | case ACPI_RESOURCE_TYPE_VENDOR: |
@@ -396,21 +415,21 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
396 | pnpacpi_parse_allocated_memresource(dev, | 415 | pnpacpi_parse_allocated_memresource(dev, |
397 | memory24->minimum, | 416 | memory24->minimum, |
398 | memory24->address_length, | 417 | memory24->address_length, |
399 | memory24->write_protect); | 418 | memory24->write_protect, 0); |
400 | break; | 419 | break; |
401 | case ACPI_RESOURCE_TYPE_MEMORY32: | 420 | case ACPI_RESOURCE_TYPE_MEMORY32: |
402 | memory32 = &res->data.memory32; | 421 | memory32 = &res->data.memory32; |
403 | pnpacpi_parse_allocated_memresource(dev, | 422 | pnpacpi_parse_allocated_memresource(dev, |
404 | memory32->minimum, | 423 | memory32->minimum, |
405 | memory32->address_length, | 424 | memory32->address_length, |
406 | memory32->write_protect); | 425 | memory32->write_protect, 0); |
407 | break; | 426 | break; |
408 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: | 427 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: |
409 | fixed_memory32 = &res->data.fixed_memory32; | 428 | fixed_memory32 = &res->data.fixed_memory32; |
410 | pnpacpi_parse_allocated_memresource(dev, | 429 | pnpacpi_parse_allocated_memresource(dev, |
411 | fixed_memory32->address, | 430 | fixed_memory32->address, |
412 | fixed_memory32->address_length, | 431 | fixed_memory32->address_length, |
413 | fixed_memory32->write_protect); | 432 | fixed_memory32->write_protect, 0); |
414 | break; | 433 | break; |
415 | case ACPI_RESOURCE_TYPE_ADDRESS16: | 434 | case ACPI_RESOURCE_TYPE_ADDRESS16: |
416 | case ACPI_RESOURCE_TYPE_ADDRESS32: | 435 | case ACPI_RESOURCE_TYPE_ADDRESS32: |
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c index 64d0596bafb5..5b277dbaacde 100644 --- a/drivers/pnp/resource.c +++ b/drivers/pnp/resource.c | |||
@@ -470,7 +470,8 @@ int pnp_check_dma(struct pnp_dev *dev, struct resource *res) | |||
470 | unsigned long pnp_resource_type(struct resource *res) | 470 | unsigned long pnp_resource_type(struct resource *res) |
471 | { | 471 | { |
472 | return res->flags & (IORESOURCE_IO | IORESOURCE_MEM | | 472 | return res->flags & (IORESOURCE_IO | IORESOURCE_MEM | |
473 | IORESOURCE_IRQ | IORESOURCE_DMA); | 473 | IORESOURCE_IRQ | IORESOURCE_DMA | |
474 | IORESOURCE_BUS); | ||
474 | } | 475 | } |
475 | 476 | ||
476 | struct resource *pnp_get_resource(struct pnp_dev *dev, | 477 | struct resource *pnp_get_resource(struct pnp_dev *dev, |
@@ -590,6 +591,30 @@ struct pnp_resource *pnp_add_mem_resource(struct pnp_dev *dev, | |||
590 | return pnp_res; | 591 | return pnp_res; |
591 | } | 592 | } |
592 | 593 | ||
594 | struct pnp_resource *pnp_add_bus_resource(struct pnp_dev *dev, | ||
595 | resource_size_t start, | ||
596 | resource_size_t end) | ||
597 | { | ||
598 | struct pnp_resource *pnp_res; | ||
599 | struct resource *res; | ||
600 | |||
601 | pnp_res = pnp_new_resource(dev); | ||
602 | if (!pnp_res) { | ||
603 | dev_err(&dev->dev, "can't add resource for BUS %#llx-%#llx\n", | ||
604 | (unsigned long long) start, | ||
605 | (unsigned long long) end); | ||
606 | return NULL; | ||
607 | } | ||
608 | |||
609 | res = &pnp_res->res; | ||
610 | res->flags = IORESOURCE_BUS; | ||
611 | res->start = start; | ||
612 | res->end = end; | ||
613 | |||
614 | pnp_dbg(&dev->dev, " add %pr\n", res); | ||
615 | return pnp_res; | ||
616 | } | ||
617 | |||
593 | /* | 618 | /* |
594 | * Determine whether the specified resource is a possible configuration | 619 | * Determine whether the specified resource is a possible configuration |
595 | * for this device. | 620 | * for this device. |
diff --git a/drivers/pnp/support.c b/drivers/pnp/support.c index 9585c1c1cc36..f5beb24d036a 100644 --- a/drivers/pnp/support.c +++ b/drivers/pnp/support.c | |||
@@ -69,8 +69,10 @@ char *pnp_resource_type_name(struct resource *res) | |||
69 | return "irq"; | 69 | return "irq"; |
70 | case IORESOURCE_DMA: | 70 | case IORESOURCE_DMA: |
71 | return "dma"; | 71 | return "dma"; |
72 | case IORESOURCE_BUS: | ||
73 | return "bus"; | ||
72 | } | 74 | } |
73 | return NULL; | 75 | return "unknown"; |
74 | } | 76 | } |
75 | 77 | ||
76 | void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc) | 78 | void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc) |
diff --git a/drivers/power/power_supply_sysfs.c b/drivers/power/power_supply_sysfs.c index c790e0c77d4b..ff05e6189768 100644 --- a/drivers/power/power_supply_sysfs.c +++ b/drivers/power/power_supply_sysfs.c | |||
@@ -99,6 +99,7 @@ static struct device_attribute power_supply_attrs[] = { | |||
99 | POWER_SUPPLY_ATTR(present), | 99 | POWER_SUPPLY_ATTR(present), |
100 | POWER_SUPPLY_ATTR(online), | 100 | POWER_SUPPLY_ATTR(online), |
101 | POWER_SUPPLY_ATTR(technology), | 101 | POWER_SUPPLY_ATTR(technology), |
102 | POWER_SUPPLY_ATTR(cycle_count), | ||
102 | POWER_SUPPLY_ATTR(voltage_max), | 103 | POWER_SUPPLY_ATTR(voltage_max), |
103 | POWER_SUPPLY_ATTR(voltage_min), | 104 | POWER_SUPPLY_ATTR(voltage_min), |
104 | POWER_SUPPLY_ATTR(voltage_max_design), | 105 | POWER_SUPPLY_ATTR(voltage_max_design), |
diff --git a/include/linux/ioport.h b/include/linux/ioport.h index dda98410d588..71ab79da7e7f 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h | |||
@@ -34,22 +34,24 @@ struct resource_list { | |||
34 | */ | 34 | */ |
35 | #define IORESOURCE_BITS 0x000000ff /* Bus-specific bits */ | 35 | #define IORESOURCE_BITS 0x000000ff /* Bus-specific bits */ |
36 | 36 | ||
37 | #define IORESOURCE_TYPE_BITS 0x00000f00 /* Resource type */ | 37 | #define IORESOURCE_TYPE_BITS 0x00001f00 /* Resource type */ |
38 | #define IORESOURCE_IO 0x00000100 | 38 | #define IORESOURCE_IO 0x00000100 |
39 | #define IORESOURCE_MEM 0x00000200 | 39 | #define IORESOURCE_MEM 0x00000200 |
40 | #define IORESOURCE_IRQ 0x00000400 | 40 | #define IORESOURCE_IRQ 0x00000400 |
41 | #define IORESOURCE_DMA 0x00000800 | 41 | #define IORESOURCE_DMA 0x00000800 |
42 | #define IORESOURCE_BUS 0x00001000 | ||
42 | 43 | ||
43 | #define IORESOURCE_PREFETCH 0x00001000 /* No side effects */ | 44 | #define IORESOURCE_PREFETCH 0x00002000 /* No side effects */ |
44 | #define IORESOURCE_READONLY 0x00002000 | 45 | #define IORESOURCE_READONLY 0x00004000 |
45 | #define IORESOURCE_CACHEABLE 0x00004000 | 46 | #define IORESOURCE_CACHEABLE 0x00008000 |
46 | #define IORESOURCE_RANGELENGTH 0x00008000 | 47 | #define IORESOURCE_RANGELENGTH 0x00010000 |
47 | #define IORESOURCE_SHADOWABLE 0x00010000 | 48 | #define IORESOURCE_SHADOWABLE 0x00020000 |
48 | 49 | ||
49 | #define IORESOURCE_SIZEALIGN 0x00020000 /* size indicates alignment */ | 50 | #define IORESOURCE_SIZEALIGN 0x00040000 /* size indicates alignment */ |
50 | #define IORESOURCE_STARTALIGN 0x00040000 /* start field is alignment */ | 51 | #define IORESOURCE_STARTALIGN 0x00080000 /* start field is alignment */ |
51 | 52 | ||
52 | #define IORESOURCE_MEM_64 0x00100000 | 53 | #define IORESOURCE_MEM_64 0x00100000 |
54 | #define IORESOURCE_WINDOW 0x00200000 /* forwarded by bridge */ | ||
53 | 55 | ||
54 | #define IORESOURCE_EXCLUSIVE 0x08000000 /* Userland may not map this resource */ | 56 | #define IORESOURCE_EXCLUSIVE 0x08000000 /* Userland may not map this resource */ |
55 | #define IORESOURCE_DISABLED 0x10000000 | 57 | #define IORESOURCE_DISABLED 0x10000000 |
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index b5d096d3a9be..ebd2b8fb00d0 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h | |||
@@ -82,6 +82,7 @@ enum power_supply_property { | |||
82 | POWER_SUPPLY_PROP_PRESENT, | 82 | POWER_SUPPLY_PROP_PRESENT, |
83 | POWER_SUPPLY_PROP_ONLINE, | 83 | POWER_SUPPLY_PROP_ONLINE, |
84 | POWER_SUPPLY_PROP_TECHNOLOGY, | 84 | POWER_SUPPLY_PROP_TECHNOLOGY, |
85 | POWER_SUPPLY_PROP_CYCLE_COUNT, | ||
85 | POWER_SUPPLY_PROP_VOLTAGE_MAX, | 86 | POWER_SUPPLY_PROP_VOLTAGE_MAX, |
86 | POWER_SUPPLY_PROP_VOLTAGE_MIN, | 87 | POWER_SUPPLY_PROP_VOLTAGE_MIN, |
87 | POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN, | 88 | POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN, |
diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 0d461c7c14db..24112e5a5780 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c | |||
@@ -609,6 +609,12 @@ static char *resource_string(char *buf, char *end, struct resource *res, | |||
609 | .precision = -1, | 609 | .precision = -1, |
610 | .flags = SPECIAL | SMALL | ZEROPAD, | 610 | .flags = SPECIAL | SMALL | ZEROPAD, |
611 | }; | 611 | }; |
612 | static const struct printf_spec bus_spec = { | ||
613 | .base = 16, | ||
614 | .field_width = 2, | ||
615 | .precision = -1, | ||
616 | .flags = SMALL | ZEROPAD, | ||
617 | }; | ||
612 | static const struct printf_spec dec_spec = { | 618 | static const struct printf_spec dec_spec = { |
613 | .base = 10, | 619 | .base = 10, |
614 | .precision = -1, | 620 | .precision = -1, |
@@ -629,7 +635,7 @@ static char *resource_string(char *buf, char *end, struct resource *res, | |||
629 | * 64-bit res (sizeof==8): 20 chars in dec, 18 in hex ("0x" + 16) */ | 635 | * 64-bit res (sizeof==8): 20 chars in dec, 18 in hex ("0x" + 16) */ |
630 | #define RSRC_BUF_SIZE ((2 * sizeof(resource_size_t)) + 4) | 636 | #define RSRC_BUF_SIZE ((2 * sizeof(resource_size_t)) + 4) |
631 | #define FLAG_BUF_SIZE (2 * sizeof(res->flags)) | 637 | #define FLAG_BUF_SIZE (2 * sizeof(res->flags)) |
632 | #define DECODED_BUF_SIZE sizeof("[mem - 64bit pref disabled]") | 638 | #define DECODED_BUF_SIZE sizeof("[mem - 64bit pref window disabled]") |
633 | #define RAW_BUF_SIZE sizeof("[mem - flags 0x]") | 639 | #define RAW_BUF_SIZE sizeof("[mem - flags 0x]") |
634 | char sym[max(2*RSRC_BUF_SIZE + DECODED_BUF_SIZE, | 640 | char sym[max(2*RSRC_BUF_SIZE + DECODED_BUF_SIZE, |
635 | 2*RSRC_BUF_SIZE + FLAG_BUF_SIZE + RAW_BUF_SIZE)]; | 641 | 2*RSRC_BUF_SIZE + FLAG_BUF_SIZE + RAW_BUF_SIZE)]; |
@@ -651,6 +657,9 @@ static char *resource_string(char *buf, char *end, struct resource *res, | |||
651 | } else if (res->flags & IORESOURCE_DMA) { | 657 | } else if (res->flags & IORESOURCE_DMA) { |
652 | p = string(p, pend, "dma ", str_spec); | 658 | p = string(p, pend, "dma ", str_spec); |
653 | specp = &dec_spec; | 659 | specp = &dec_spec; |
660 | } else if (res->flags & IORESOURCE_BUS) { | ||
661 | p = string(p, pend, "bus ", str_spec); | ||
662 | specp = &bus_spec; | ||
654 | } else { | 663 | } else { |
655 | p = string(p, pend, "??? ", str_spec); | 664 | p = string(p, pend, "??? ", str_spec); |
656 | specp = &mem_spec; | 665 | specp = &mem_spec; |
@@ -666,6 +675,8 @@ static char *resource_string(char *buf, char *end, struct resource *res, | |||
666 | p = string(p, pend, " 64bit", str_spec); | 675 | p = string(p, pend, " 64bit", str_spec); |
667 | if (res->flags & IORESOURCE_PREFETCH) | 676 | if (res->flags & IORESOURCE_PREFETCH) |
668 | p = string(p, pend, " pref", str_spec); | 677 | p = string(p, pend, " pref", str_spec); |
678 | if (res->flags & IORESOURCE_WINDOW) | ||
679 | p = string(p, pend, " window", str_spec); | ||
669 | if (res->flags & IORESOURCE_DISABLED) | 680 | if (res->flags & IORESOURCE_DISABLED) |
670 | p = string(p, pend, " disabled", str_spec); | 681 | p = string(p, pend, " disabled", str_spec); |
671 | } else { | 682 | } else { |