diff options
| -rw-r--r-- | drivers/acpi/acpica/evgpe.c | 19 | ||||
| -rw-r--r-- | drivers/acpi/acpica/exprep.c | 12 | ||||
| -rw-r--r-- | drivers/acpi/battery.c | 6 | ||||
| -rw-r--r-- | drivers/acpi/dock.c | 7 | ||||
| -rw-r--r-- | drivers/acpi/ec.c | 35 | ||||
| -rw-r--r-- | drivers/acpi/numa.c | 6 | ||||
| -rw-r--r-- | drivers/acpi/osl.c | 23 | ||||
| -rw-r--r-- | drivers/acpi/scan.c | 12 | ||||
| -rw-r--r-- | drivers/acpi/video.c | 29 | ||||
| -rw-r--r-- | drivers/pnp/pnpacpi/rsparser.c | 42 |
10 files changed, 101 insertions, 90 deletions
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c index 837de669743a..78c55508aff5 100644 --- a/drivers/acpi/acpica/evgpe.c +++ b/drivers/acpi/acpica/evgpe.c | |||
| @@ -117,19 +117,14 @@ acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info) | |||
| 117 | if (ACPI_FAILURE(status)) | 117 | if (ACPI_FAILURE(status)) |
| 118 | return_ACPI_STATUS(status); | 118 | return_ACPI_STATUS(status); |
| 119 | 119 | ||
| 120 | /* Mark wake-enabled or HW enable, or both */ | 120 | /* Clear the GPE (of stale events), then enable it */ |
| 121 | 121 | status = acpi_hw_clear_gpe(gpe_event_info); | |
| 122 | if (gpe_event_info->runtime_count) { | 122 | if (ACPI_FAILURE(status)) |
| 123 | /* Clear the GPE (of stale events), then enable it */ | 123 | return_ACPI_STATUS(status); |
| 124 | status = acpi_hw_clear_gpe(gpe_event_info); | ||
| 125 | if (ACPI_FAILURE(status)) | ||
| 126 | return_ACPI_STATUS(status); | ||
| 127 | |||
| 128 | /* Enable the requested runtime GPE */ | ||
| 129 | status = acpi_hw_write_gpe_enable_reg(gpe_event_info); | ||
| 130 | } | ||
| 131 | 124 | ||
| 132 | return_ACPI_STATUS(AE_OK); | 125 | /* Enable the requested GPE */ |
| 126 | status = acpi_hw_write_gpe_enable_reg(gpe_event_info); | ||
| 127 | return_ACPI_STATUS(status); | ||
| 133 | } | 128 | } |
| 134 | 129 | ||
| 135 | /******************************************************************************* | 130 | /******************************************************************************* |
diff --git a/drivers/acpi/acpica/exprep.c b/drivers/acpi/acpica/exprep.c index edf62bf5b266..a610ebe18edd 100644 --- a/drivers/acpi/acpica/exprep.c +++ b/drivers/acpi/acpica/exprep.c | |||
| @@ -468,6 +468,18 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | |||
| 468 | 468 | ||
| 469 | acpi_ut_add_reference(obj_desc->field.region_obj); | 469 | acpi_ut_add_reference(obj_desc->field.region_obj); |
| 470 | 470 | ||
| 471 | /* allow full data read from EC address space */ | ||
| 472 | if (obj_desc->field.region_obj->region.space_id == | ||
| 473 | ACPI_ADR_SPACE_EC) { | ||
| 474 | if (obj_desc->common_field.bit_length > 8) | ||
| 475 | obj_desc->common_field.access_bit_width = | ||
| 476 | ACPI_ROUND_UP(obj_desc->common_field. | ||
| 477 | bit_length, 8); | ||
| 478 | obj_desc->common_field.access_byte_width = | ||
| 479 | ACPI_DIV_8(obj_desc->common_field. | ||
| 480 | access_bit_width); | ||
| 481 | } | ||
| 482 | |||
| 471 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 483 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
| 472 | "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n", | 484 | "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n", |
| 473 | obj_desc->field.start_field_bit_offset, | 485 | obj_desc->field.start_field_bit_offset, |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 5717bd300869..3026e3fa83ef 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
| @@ -568,13 +568,13 @@ static int acpi_battery_update(struct acpi_battery *battery) | |||
| 568 | result = acpi_battery_get_status(battery); | 568 | result = acpi_battery_get_status(battery); |
| 569 | if (result) | 569 | if (result) |
| 570 | return result; | 570 | return result; |
| 571 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
| 572 | if (!acpi_battery_present(battery)) { | 571 | if (!acpi_battery_present(battery)) { |
| 572 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
| 573 | sysfs_remove_battery(battery); | 573 | sysfs_remove_battery(battery); |
| 574 | #endif | ||
| 574 | battery->update_time = 0; | 575 | battery->update_time = 0; |
| 575 | return 0; | 576 | return 0; |
| 576 | } | 577 | } |
| 577 | #endif | ||
| 578 | if (!battery->update_time || | 578 | if (!battery->update_time || |
| 579 | old_present != acpi_battery_present(battery)) { | 579 | old_present != acpi_battery_present(battery)) { |
| 580 | result = acpi_battery_get_info(battery); | 580 | result = acpi_battery_get_info(battery); |
| @@ -880,7 +880,7 @@ static void acpi_battery_notify(struct acpi_device *device, u32 event) | |||
| 880 | #ifdef CONFIG_ACPI_SYSFS_POWER | 880 | #ifdef CONFIG_ACPI_SYSFS_POWER |
| 881 | /* acpi_battery_update could remove power_supply object */ | 881 | /* acpi_battery_update could remove power_supply object */ |
| 882 | if (battery->bat.dev) | 882 | if (battery->bat.dev) |
| 883 | kobject_uevent(&battery->bat.dev->kobj, KOBJ_CHANGE); | 883 | power_supply_changed(&battery->bat); |
| 884 | #endif | 884 | #endif |
| 885 | } | 885 | } |
| 886 | 886 | ||
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c index a9c429c5d50f..3fe29e992be8 100644 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.c | |||
| @@ -1026,13 +1026,10 @@ static int dock_remove(struct dock_station *ds) | |||
| 1026 | static acpi_status | 1026 | static acpi_status |
| 1027 | find_dock(acpi_handle handle, u32 lvl, void *context, void **rv) | 1027 | find_dock(acpi_handle handle, u32 lvl, void *context, void **rv) |
| 1028 | { | 1028 | { |
| 1029 | acpi_status status = AE_OK; | ||
| 1030 | |||
| 1031 | if (is_dock(handle)) | 1029 | if (is_dock(handle)) |
| 1032 | if (dock_add(handle) >= 0) | 1030 | dock_add(handle); |
| 1033 | status = AE_CTRL_TERMINATE; | ||
| 1034 | 1031 | ||
| 1035 | return status; | 1032 | return AE_OK; |
| 1036 | } | 1033 | } |
| 1037 | 1034 | ||
| 1038 | static acpi_status | 1035 | static acpi_status |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 35ba2547f544..f2234db85da0 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
| @@ -629,12 +629,12 @@ static u32 acpi_ec_gpe_handler(void *data) | |||
| 629 | 629 | ||
| 630 | static acpi_status | 630 | static acpi_status |
| 631 | acpi_ec_space_handler(u32 function, acpi_physical_address address, | 631 | acpi_ec_space_handler(u32 function, acpi_physical_address address, |
| 632 | u32 bits, u64 *value, | 632 | u32 bits, u64 *value64, |
| 633 | void *handler_context, void *region_context) | 633 | void *handler_context, void *region_context) |
| 634 | { | 634 | { |
| 635 | struct acpi_ec *ec = handler_context; | 635 | struct acpi_ec *ec = handler_context; |
| 636 | int result = 0, i; | 636 | int result = 0, i, bytes = bits / 8; |
| 637 | u8 temp = 0; | 637 | u8 *value = (u8 *)value64; |
| 638 | 638 | ||
| 639 | if ((address > 0xFF) || !value || !handler_context) | 639 | if ((address > 0xFF) || !value || !handler_context) |
| 640 | return AE_BAD_PARAMETER; | 640 | return AE_BAD_PARAMETER; |
| @@ -642,32 +642,15 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address, | |||
| 642 | if (function != ACPI_READ && function != ACPI_WRITE) | 642 | if (function != ACPI_READ && function != ACPI_WRITE) |
| 643 | return AE_BAD_PARAMETER; | 643 | return AE_BAD_PARAMETER; |
| 644 | 644 | ||
| 645 | if (bits != 8 && acpi_strict) | 645 | if (EC_FLAGS_MSI || bits > 8) |
| 646 | return AE_BAD_PARAMETER; | ||
| 647 | |||
| 648 | if (EC_FLAGS_MSI) | ||
| 649 | acpi_ec_burst_enable(ec); | 646 | acpi_ec_burst_enable(ec); |
| 650 | 647 | ||
| 651 | if (function == ACPI_READ) { | 648 | for (i = 0; i < bytes; ++i, ++address, ++value) |
| 652 | result = acpi_ec_read(ec, address, &temp); | 649 | result = (function == ACPI_READ) ? |
| 653 | *value = temp; | 650 | acpi_ec_read(ec, address, value) : |
| 654 | } else { | 651 | acpi_ec_write(ec, address, *value); |
| 655 | temp = 0xff & (*value); | ||
| 656 | result = acpi_ec_write(ec, address, temp); | ||
| 657 | } | ||
| 658 | |||
| 659 | for (i = 8; unlikely(bits - i > 0); i += 8) { | ||
| 660 | ++address; | ||
| 661 | if (function == ACPI_READ) { | ||
| 662 | result = acpi_ec_read(ec, address, &temp); | ||
| 663 | (*value) |= ((u64)temp) << i; | ||
| 664 | } else { | ||
| 665 | temp = 0xff & ((*value) >> i); | ||
| 666 | result = acpi_ec_write(ec, address, temp); | ||
| 667 | } | ||
| 668 | } | ||
| 669 | 652 | ||
| 670 | if (EC_FLAGS_MSI) | 653 | if (EC_FLAGS_MSI || bits > 8) |
| 671 | acpi_ec_burst_disable(ec); | 654 | acpi_ec_burst_disable(ec); |
| 672 | 655 | ||
| 673 | switch (result) { | 656 | switch (result) { |
diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c index b8725461d887..b0337d314604 100644 --- a/drivers/acpi/numa.c +++ b/drivers/acpi/numa.c | |||
| @@ -61,8 +61,10 @@ int node_to_pxm(int node) | |||
| 61 | 61 | ||
| 62 | void __acpi_map_pxm_to_node(int pxm, int node) | 62 | void __acpi_map_pxm_to_node(int pxm, int node) |
| 63 | { | 63 | { |
| 64 | pxm_to_node_map[pxm] = node; | 64 | if (pxm_to_node_map[pxm] == NUMA_NO_NODE || node < pxm_to_node_map[pxm]) |
| 65 | node_to_pxm_map[node] = pxm; | 65 | pxm_to_node_map[pxm] = node; |
| 66 | if (node_to_pxm_map[node] == PXM_INVAL || pxm < node_to_pxm_map[node]) | ||
| 67 | node_to_pxm_map[node] = pxm; | ||
| 66 | } | 68 | } |
| 67 | 69 | ||
| 68 | int acpi_map_pxm_to_node(int pxm) | 70 | int acpi_map_pxm_to_node(int pxm) |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 8e6d8665f0ae..7594f65800cf 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
| @@ -758,7 +758,14 @@ static acpi_status __acpi_os_execute(acpi_execute_type type, | |||
| 758 | queue = hp ? kacpi_hotplug_wq : | 758 | queue = hp ? kacpi_hotplug_wq : |
| 759 | (type == OSL_NOTIFY_HANDLER ? kacpi_notify_wq : kacpid_wq); | 759 | (type == OSL_NOTIFY_HANDLER ? kacpi_notify_wq : kacpid_wq); |
| 760 | dpc->wait = hp ? 1 : 0; | 760 | dpc->wait = hp ? 1 : 0; |
| 761 | INIT_WORK(&dpc->work, acpi_os_execute_deferred); | 761 | |
| 762 | if (queue == kacpi_hotplug_wq) | ||
| 763 | INIT_WORK(&dpc->work, acpi_os_execute_deferred); | ||
| 764 | else if (queue == kacpi_notify_wq) | ||
| 765 | INIT_WORK(&dpc->work, acpi_os_execute_deferred); | ||
| 766 | else | ||
| 767 | INIT_WORK(&dpc->work, acpi_os_execute_deferred); | ||
| 768 | |||
| 762 | ret = queue_work(queue, &dpc->work); | 769 | ret = queue_work(queue, &dpc->work); |
| 763 | 770 | ||
| 764 | if (!ret) { | 771 | if (!ret) { |
| @@ -1151,16 +1158,10 @@ int acpi_check_resource_conflict(const struct resource *res) | |||
| 1151 | 1158 | ||
| 1152 | if (clash) { | 1159 | if (clash) { |
| 1153 | if (acpi_enforce_resources != ENFORCE_RESOURCES_NO) { | 1160 | if (acpi_enforce_resources != ENFORCE_RESOURCES_NO) { |
| 1154 | printk("%sACPI: %s resource %s [0x%llx-0x%llx]" | 1161 | printk(KERN_WARNING "ACPI: resource %s %pR" |
| 1155 | " conflicts with ACPI region %s" | 1162 | " conflicts with ACPI region %s %pR\n", |
| 1156 | " [0x%llx-0x%llx]\n", | 1163 | res->name, res, res_list_elem->name, |
| 1157 | acpi_enforce_resources == ENFORCE_RESOURCES_LAX | 1164 | res_list_elem); |
| 1158 | ? KERN_WARNING : KERN_ERR, | ||
| 1159 | ioport ? "I/O" : "Memory", res->name, | ||
| 1160 | (long long) res->start, (long long) res->end, | ||
| 1161 | res_list_elem->name, | ||
| 1162 | (long long) res_list_elem->start, | ||
| 1163 | (long long) res_list_elem->end); | ||
| 1164 | if (acpi_enforce_resources == ENFORCE_RESOURCES_LAX) | 1165 | if (acpi_enforce_resources == ENFORCE_RESOURCES_LAX) |
| 1165 | printk(KERN_NOTICE "ACPI: This conflict may" | 1166 | printk(KERN_NOTICE "ACPI: This conflict may" |
| 1166 | " cause random problems and system" | 1167 | " cause random problems and system" |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 0261b116d051..0338f513a010 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
| @@ -1081,12 +1081,6 @@ static void acpi_device_set_id(struct acpi_device *device) | |||
| 1081 | if (ACPI_IS_ROOT_DEVICE(device)) { | 1081 | if (ACPI_IS_ROOT_DEVICE(device)) { |
| 1082 | acpi_add_id(device, ACPI_SYSTEM_HID); | 1082 | acpi_add_id(device, ACPI_SYSTEM_HID); |
| 1083 | break; | 1083 | break; |
| 1084 | } else if (ACPI_IS_ROOT_DEVICE(device->parent)) { | ||
| 1085 | /* \_SB_, the only root-level namespace device */ | ||
| 1086 | acpi_add_id(device, ACPI_BUS_HID); | ||
| 1087 | strcpy(device->pnp.device_name, ACPI_BUS_DEVICE_NAME); | ||
| 1088 | strcpy(device->pnp.device_class, ACPI_BUS_CLASS); | ||
| 1089 | break; | ||
| 1090 | } | 1084 | } |
| 1091 | 1085 | ||
| 1092 | status = acpi_get_object_info(device->handle, &info); | 1086 | status = acpi_get_object_info(device->handle, &info); |
| @@ -1121,6 +1115,12 @@ static void acpi_device_set_id(struct acpi_device *device) | |||
| 1121 | acpi_add_id(device, ACPI_DOCK_HID); | 1115 | acpi_add_id(device, ACPI_DOCK_HID); |
| 1122 | else if (!acpi_ibm_smbus_match(device)) | 1116 | else if (!acpi_ibm_smbus_match(device)) |
| 1123 | acpi_add_id(device, ACPI_SMBUS_IBM_HID); | 1117 | acpi_add_id(device, ACPI_SMBUS_IBM_HID); |
| 1118 | else if (!acpi_device_hid(device) && | ||
| 1119 | ACPI_IS_ROOT_DEVICE(device->parent)) { | ||
| 1120 | acpi_add_id(device, ACPI_BUS_HID); /* \_SB, LNXSYBUS */ | ||
| 1121 | strcpy(device->pnp.device_name, ACPI_BUS_DEVICE_NAME); | ||
| 1122 | strcpy(device->pnp.device_class, ACPI_BUS_CLASS); | ||
| 1123 | } | ||
| 1124 | 1124 | ||
| 1125 | break; | 1125 | break; |
| 1126 | case ACPI_BUS_TYPE_POWER: | 1126 | case ACPI_BUS_TYPE_POWER: |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 416eb0303a83..a0c93b321482 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
| @@ -2130,7 +2130,7 @@ static void acpi_video_bus_notify(struct acpi_device *device, u32 event) | |||
| 2130 | { | 2130 | { |
| 2131 | struct acpi_video_bus *video = acpi_driver_data(device); | 2131 | struct acpi_video_bus *video = acpi_driver_data(device); |
| 2132 | struct input_dev *input; | 2132 | struct input_dev *input; |
| 2133 | int keycode; | 2133 | int keycode = 0; |
| 2134 | 2134 | ||
| 2135 | if (!video) | 2135 | if (!video) |
| 2136 | return; | 2136 | return; |
| @@ -2166,17 +2166,19 @@ static void acpi_video_bus_notify(struct acpi_device *device, u32 event) | |||
| 2166 | break; | 2166 | break; |
| 2167 | 2167 | ||
| 2168 | default: | 2168 | default: |
| 2169 | keycode = KEY_UNKNOWN; | ||
| 2170 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 2169 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 2171 | "Unsupported event [0x%x]\n", event)); | 2170 | "Unsupported event [0x%x]\n", event)); |
| 2172 | break; | 2171 | break; |
| 2173 | } | 2172 | } |
| 2174 | 2173 | ||
| 2175 | acpi_notifier_call_chain(device, event, 0); | 2174 | acpi_notifier_call_chain(device, event, 0); |
| 2176 | input_report_key(input, keycode, 1); | 2175 | |
| 2177 | input_sync(input); | 2176 | if (keycode) { |
| 2178 | input_report_key(input, keycode, 0); | 2177 | input_report_key(input, keycode, 1); |
| 2179 | input_sync(input); | 2178 | input_sync(input); |
| 2179 | input_report_key(input, keycode, 0); | ||
| 2180 | input_sync(input); | ||
| 2181 | } | ||
| 2180 | 2182 | ||
| 2181 | return; | 2183 | return; |
| 2182 | } | 2184 | } |
| @@ -2187,7 +2189,7 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) | |||
| 2187 | struct acpi_device *device = NULL; | 2189 | struct acpi_device *device = NULL; |
| 2188 | struct acpi_video_bus *bus; | 2190 | struct acpi_video_bus *bus; |
| 2189 | struct input_dev *input; | 2191 | struct input_dev *input; |
| 2190 | int keycode; | 2192 | int keycode = 0; |
| 2191 | 2193 | ||
| 2192 | if (!video_device) | 2194 | if (!video_device) |
| 2193 | return; | 2195 | return; |
| @@ -2228,17 +2230,19 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) | |||
| 2228 | keycode = KEY_DISPLAY_OFF; | 2230 | keycode = KEY_DISPLAY_OFF; |
| 2229 | break; | 2231 | break; |
| 2230 | default: | 2232 | default: |
| 2231 | keycode = KEY_UNKNOWN; | ||
| 2232 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 2233 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 2233 | "Unsupported event [0x%x]\n", event)); | 2234 | "Unsupported event [0x%x]\n", event)); |
| 2234 | break; | 2235 | break; |
| 2235 | } | 2236 | } |
| 2236 | 2237 | ||
| 2237 | acpi_notifier_call_chain(device, event, 0); | 2238 | acpi_notifier_call_chain(device, event, 0); |
| 2238 | input_report_key(input, keycode, 1); | 2239 | |
| 2239 | input_sync(input); | 2240 | if (keycode) { |
| 2240 | input_report_key(input, keycode, 0); | 2241 | input_report_key(input, keycode, 1); |
| 2241 | input_sync(input); | 2242 | input_sync(input); |
| 2243 | input_report_key(input, keycode, 0); | ||
| 2244 | input_sync(input); | ||
| 2245 | } | ||
| 2242 | 2246 | ||
| 2243 | return; | 2247 | return; |
| 2244 | } | 2248 | } |
| @@ -2374,7 +2378,6 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
| 2374 | set_bit(KEY_BRIGHTNESSDOWN, input->keybit); | 2378 | set_bit(KEY_BRIGHTNESSDOWN, input->keybit); |
| 2375 | set_bit(KEY_BRIGHTNESS_ZERO, input->keybit); | 2379 | set_bit(KEY_BRIGHTNESS_ZERO, input->keybit); |
| 2376 | set_bit(KEY_DISPLAY_OFF, input->keybit); | 2380 | set_bit(KEY_DISPLAY_OFF, input->keybit); |
| 2377 | set_bit(KEY_UNKNOWN, input->keybit); | ||
| 2378 | 2381 | ||
| 2379 | error = input_register_device(input); | 2382 | error = input_register_device(input); |
| 2380 | if (error) | 2383 | if (error) |
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index c6c552f681b7..35bb44af49b3 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
| @@ -274,12 +274,33 @@ static void pnpacpi_parse_allocated_busresource(struct pnp_dev *dev, | |||
| 274 | pnp_add_bus_resource(dev, start, end); | 274 | pnp_add_bus_resource(dev, start, end); |
| 275 | } | 275 | } |
| 276 | 276 | ||
| 277 | static u64 addr_space_length(struct pnp_dev *dev, u64 min, u64 max, u64 len) | ||
| 278 | { | ||
| 279 | u64 max_len; | ||
| 280 | |||
| 281 | max_len = max - min + 1; | ||
| 282 | if (len <= max_len) | ||
| 283 | return len; | ||
| 284 | |||
| 285 | /* | ||
| 286 | * Per 6.4.3.5, _LEN cannot exceed _MAX - _MIN + 1, but some BIOSes | ||
| 287 | * don't do this correctly, e.g., | ||
| 288 | * https://bugzilla.kernel.org/show_bug.cgi?id=15480 | ||
| 289 | */ | ||
| 290 | dev_info(&dev->dev, | ||
| 291 | "resource length %#llx doesn't fit in %#llx-%#llx, trimming\n", | ||
| 292 | (unsigned long long) len, (unsigned long long) min, | ||
| 293 | (unsigned long long) max); | ||
| 294 | return max_len; | ||
| 295 | } | ||
| 296 | |||
| 277 | static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev, | 297 | static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev, |
| 278 | struct acpi_resource *res) | 298 | struct acpi_resource *res) |
| 279 | { | 299 | { |
| 280 | struct acpi_resource_address64 addr, *p = &addr; | 300 | struct acpi_resource_address64 addr, *p = &addr; |
| 281 | acpi_status status; | 301 | acpi_status status; |
| 282 | int window; | 302 | int window; |
| 303 | u64 len; | ||
| 283 | 304 | ||
| 284 | status = acpi_resource_to_address64(res, p); | 305 | status = acpi_resource_to_address64(res, p); |
| 285 | if (!ACPI_SUCCESS(status)) { | 306 | if (!ACPI_SUCCESS(status)) { |
| @@ -288,20 +309,18 @@ static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev, | |||
| 288 | return; | 309 | return; |
| 289 | } | 310 | } |
| 290 | 311 | ||
| 312 | len = addr_space_length(dev, p->minimum, p->maximum, p->address_length); | ||
| 291 | window = (p->producer_consumer == ACPI_PRODUCER) ? 1 : 0; | 313 | window = (p->producer_consumer == ACPI_PRODUCER) ? 1 : 0; |
| 292 | 314 | ||
| 293 | if (p->resource_type == ACPI_MEMORY_RANGE) | 315 | if (p->resource_type == ACPI_MEMORY_RANGE) |
| 294 | pnpacpi_parse_allocated_memresource(dev, | 316 | pnpacpi_parse_allocated_memresource(dev, p->minimum, len, |
| 295 | p->minimum, p->address_length, | ||
| 296 | p->info.mem.write_protect, window); | 317 | p->info.mem.write_protect, window); |
| 297 | else if (p->resource_type == ACPI_IO_RANGE) | 318 | else if (p->resource_type == ACPI_IO_RANGE) |
| 298 | pnpacpi_parse_allocated_ioresource(dev, | 319 | pnpacpi_parse_allocated_ioresource(dev, p->minimum, len, |
| 299 | p->minimum, p->address_length, | ||
| 300 | p->granularity == 0xfff ? ACPI_DECODE_10 : | 320 | p->granularity == 0xfff ? ACPI_DECODE_10 : |
| 301 | ACPI_DECODE_16, window); | 321 | ACPI_DECODE_16, window); |
| 302 | else if (p->resource_type == ACPI_BUS_NUMBER_RANGE) | 322 | else if (p->resource_type == ACPI_BUS_NUMBER_RANGE) |
| 303 | pnpacpi_parse_allocated_busresource(dev, p->minimum, | 323 | pnpacpi_parse_allocated_busresource(dev, p->minimum, len); |
| 304 | p->address_length); | ||
| 305 | } | 324 | } |
| 306 | 325 | ||
| 307 | static void pnpacpi_parse_allocated_ext_address_space(struct pnp_dev *dev, | 326 | static void pnpacpi_parse_allocated_ext_address_space(struct pnp_dev *dev, |
| @@ -309,21 +328,20 @@ static void pnpacpi_parse_allocated_ext_address_space(struct pnp_dev *dev, | |||
| 309 | { | 328 | { |
| 310 | struct acpi_resource_extended_address64 *p = &res->data.ext_address64; | 329 | struct acpi_resource_extended_address64 *p = &res->data.ext_address64; |
| 311 | int window; | 330 | int window; |
| 331 | u64 len; | ||
| 312 | 332 | ||
| 333 | len = addr_space_length(dev, p->minimum, p->maximum, p->address_length); | ||
| 313 | window = (p->producer_consumer == ACPI_PRODUCER) ? 1 : 0; | 334 | window = (p->producer_consumer == ACPI_PRODUCER) ? 1 : 0; |
| 314 | 335 | ||
| 315 | if (p->resource_type == ACPI_MEMORY_RANGE) | 336 | if (p->resource_type == ACPI_MEMORY_RANGE) |
| 316 | pnpacpi_parse_allocated_memresource(dev, | 337 | pnpacpi_parse_allocated_memresource(dev, p->minimum, len, |
| 317 | p->minimum, p->address_length, | ||
| 318 | p->info.mem.write_protect, window); | 338 | p->info.mem.write_protect, window); |
| 319 | else if (p->resource_type == ACPI_IO_RANGE) | 339 | else if (p->resource_type == ACPI_IO_RANGE) |
| 320 | pnpacpi_parse_allocated_ioresource(dev, | 340 | pnpacpi_parse_allocated_ioresource(dev, p->minimum, len, |
| 321 | p->minimum, p->address_length, | ||
| 322 | p->granularity == 0xfff ? ACPI_DECODE_10 : | 341 | p->granularity == 0xfff ? ACPI_DECODE_10 : |
| 323 | ACPI_DECODE_16, window); | 342 | ACPI_DECODE_16, window); |
| 324 | else if (p->resource_type == ACPI_BUS_NUMBER_RANGE) | 343 | else if (p->resource_type == ACPI_BUS_NUMBER_RANGE) |
| 325 | pnpacpi_parse_allocated_busresource(dev, p->minimum, | 344 | pnpacpi_parse_allocated_busresource(dev, p->minimum, len); |
| 326 | p->address_length); | ||
| 327 | } | 345 | } |
| 328 | 346 | ||
| 329 | static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | 347 | static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, |
