diff options
Diffstat (limited to 'drivers/acpi')
168 files changed, 2486 insertions, 2226 deletions
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index 66cc3f36a954..a8d8998dd5c5 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile | |||
| @@ -32,7 +32,7 @@ acpi-$(CONFIG_ACPI_SLEEP) += proc.o | |||
| 32 | # | 32 | # |
| 33 | acpi-y += bus.o glue.o | 33 | acpi-y += bus.o glue.o |
| 34 | acpi-y += scan.o | 34 | acpi-y += scan.o |
| 35 | acpi-y += processor_pdc.o | 35 | acpi-y += processor_core.o |
| 36 | acpi-y += ec.o | 36 | acpi-y += ec.o |
| 37 | acpi-$(CONFIG_ACPI_DOCK) += dock.o | 37 | acpi-$(CONFIG_ACPI_DOCK) += dock.o |
| 38 | acpi-y += pci_root.o pci_link.o pci_irq.o pci_bind.o | 38 | acpi-y += pci_root.o pci_link.o pci_irq.o pci_bind.o |
| @@ -61,7 +61,7 @@ obj-$(CONFIG_ACPI_SBS) += sbs.o | |||
| 61 | obj-$(CONFIG_ACPI_POWER_METER) += power_meter.o | 61 | obj-$(CONFIG_ACPI_POWER_METER) += power_meter.o |
| 62 | 62 | ||
| 63 | # processor has its own "processor." module_param namespace | 63 | # processor has its own "processor." module_param namespace |
| 64 | processor-y := processor_core.o processor_throttling.o | 64 | processor-y := processor_driver.o processor_throttling.o |
| 65 | processor-y += processor_idle.o processor_thermal.o | 65 | processor-y += processor_idle.o processor_thermal.o |
| 66 | processor-$(CONFIG_CPU_FREQ) += processor_perflib.o | 66 | processor-$(CONFIG_CPU_FREQ) += processor_perflib.o |
| 67 | 67 | ||
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c index 97991ac6f5fc..7e52295f1ecc 100644 --- a/drivers/acpi/acpi_pad.c +++ b/drivers/acpi/acpi_pad.c | |||
| @@ -208,7 +208,7 @@ static int power_saving_thread(void *data) | |||
| 208 | * the mechanism only works when all CPUs have RT task running, | 208 | * the mechanism only works when all CPUs have RT task running, |
| 209 | * as if one CPU hasn't RT task, RT task from other CPUs will | 209 | * as if one CPU hasn't RT task, RT task from other CPUs will |
| 210 | * borrow CPU time from this CPU and cause RT task use > 95% | 210 | * borrow CPU time from this CPU and cause RT task use > 95% |
| 211 | * CPU time. To make 'avoid staration' work, takes a nap here. | 211 | * CPU time. To make 'avoid starvation' work, takes a nap here. |
| 212 | */ | 212 | */ |
| 213 | if (do_sleep) | 213 | if (do_sleep) |
| 214 | schedule_timeout_killable(HZ * idle_pct / 100); | 214 | schedule_timeout_killable(HZ * idle_pct / 100); |
| @@ -222,14 +222,18 @@ static struct task_struct *ps_tsks[NR_CPUS]; | |||
| 222 | static unsigned int ps_tsk_num; | 222 | static unsigned int ps_tsk_num; |
| 223 | static int create_power_saving_task(void) | 223 | static int create_power_saving_task(void) |
| 224 | { | 224 | { |
| 225 | int rc = -ENOMEM; | ||
| 226 | |||
| 225 | ps_tsks[ps_tsk_num] = kthread_run(power_saving_thread, | 227 | ps_tsks[ps_tsk_num] = kthread_run(power_saving_thread, |
| 226 | (void *)(unsigned long)ps_tsk_num, | 228 | (void *)(unsigned long)ps_tsk_num, |
| 227 | "power_saving/%d", ps_tsk_num); | 229 | "power_saving/%d", ps_tsk_num); |
| 228 | if (ps_tsks[ps_tsk_num]) { | 230 | rc = IS_ERR(ps_tsks[ps_tsk_num]) ? PTR_ERR(ps_tsks[ps_tsk_num]) : 0; |
| 231 | if (!rc) | ||
| 229 | ps_tsk_num++; | 232 | ps_tsk_num++; |
| 230 | return 0; | 233 | else |
| 231 | } | 234 | ps_tsks[ps_tsk_num] = NULL; |
| 232 | return -EINVAL; | 235 | |
| 236 | return rc; | ||
| 233 | } | 237 | } |
| 234 | 238 | ||
| 235 | static void destroy_power_saving_task(void) | 239 | static void destroy_power_saving_task(void) |
| @@ -237,6 +241,7 @@ static void destroy_power_saving_task(void) | |||
| 237 | if (ps_tsk_num > 0) { | 241 | if (ps_tsk_num > 0) { |
| 238 | ps_tsk_num--; | 242 | ps_tsk_num--; |
| 239 | kthread_stop(ps_tsks[ps_tsk_num]); | 243 | kthread_stop(ps_tsks[ps_tsk_num]); |
| 244 | ps_tsks[ps_tsk_num] = NULL; | ||
| 240 | } | 245 | } |
| 241 | } | 246 | } |
| 242 | 247 | ||
| @@ -253,7 +258,7 @@ static void set_power_saving_task_num(unsigned int num) | |||
| 253 | } | 258 | } |
| 254 | } | 259 | } |
| 255 | 260 | ||
| 256 | static int acpi_pad_idle_cpus(unsigned int num_cpus) | 261 | static void acpi_pad_idle_cpus(unsigned int num_cpus) |
| 257 | { | 262 | { |
| 258 | get_online_cpus(); | 263 | get_online_cpus(); |
| 259 | 264 | ||
| @@ -261,7 +266,6 @@ static int acpi_pad_idle_cpus(unsigned int num_cpus) | |||
| 261 | set_power_saving_task_num(num_cpus); | 266 | set_power_saving_task_num(num_cpus); |
| 262 | 267 | ||
| 263 | put_online_cpus(); | 268 | put_online_cpus(); |
| 264 | return 0; | ||
| 265 | } | 269 | } |
| 266 | 270 | ||
| 267 | static uint32_t acpi_pad_idle_cpus_num(void) | 271 | static uint32_t acpi_pad_idle_cpus_num(void) |
| @@ -369,19 +373,21 @@ static void acpi_pad_remove_sysfs(struct acpi_device *device) | |||
| 369 | static int acpi_pad_pur(acpi_handle handle, int *num_cpus) | 373 | static int acpi_pad_pur(acpi_handle handle, int *num_cpus) |
| 370 | { | 374 | { |
| 371 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; | 375 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; |
| 372 | acpi_status status; | ||
| 373 | union acpi_object *package; | 376 | union acpi_object *package; |
| 374 | int rev, num, ret = -EINVAL; | 377 | int rev, num, ret = -EINVAL; |
| 375 | 378 | ||
| 376 | status = acpi_evaluate_object(handle, "_PUR", NULL, &buffer); | 379 | if (ACPI_FAILURE(acpi_evaluate_object(handle, "_PUR", NULL, &buffer))) |
| 377 | if (ACPI_FAILURE(status)) | 380 | return -EINVAL; |
| 381 | |||
| 382 | if (!buffer.length || !buffer.pointer) | ||
| 378 | return -EINVAL; | 383 | return -EINVAL; |
| 384 | |||
| 379 | package = buffer.pointer; | 385 | package = buffer.pointer; |
| 380 | if (package->type != ACPI_TYPE_PACKAGE || package->package.count != 2) | 386 | if (package->type != ACPI_TYPE_PACKAGE || package->package.count != 2) |
| 381 | goto out; | 387 | goto out; |
| 382 | rev = package->package.elements[0].integer.value; | 388 | rev = package->package.elements[0].integer.value; |
| 383 | num = package->package.elements[1].integer.value; | 389 | num = package->package.elements[1].integer.value; |
| 384 | if (rev != 1) | 390 | if (rev != 1 || num < 0) |
| 385 | goto out; | 391 | goto out; |
| 386 | *num_cpus = num; | 392 | *num_cpus = num; |
| 387 | ret = 0; | 393 | ret = 0; |
| @@ -410,7 +416,7 @@ static void acpi_pad_ost(acpi_handle handle, int stat, | |||
| 410 | 416 | ||
| 411 | static void acpi_pad_handle_notify(acpi_handle handle) | 417 | static void acpi_pad_handle_notify(acpi_handle handle) |
| 412 | { | 418 | { |
| 413 | int num_cpus, ret; | 419 | int num_cpus; |
| 414 | uint32_t idle_cpus; | 420 | uint32_t idle_cpus; |
| 415 | 421 | ||
| 416 | mutex_lock(&isolated_cpus_lock); | 422 | mutex_lock(&isolated_cpus_lock); |
| @@ -418,12 +424,9 @@ static void acpi_pad_handle_notify(acpi_handle handle) | |||
| 418 | mutex_unlock(&isolated_cpus_lock); | 424 | mutex_unlock(&isolated_cpus_lock); |
| 419 | return; | 425 | return; |
| 420 | } | 426 | } |
| 421 | ret = acpi_pad_idle_cpus(num_cpus); | 427 | acpi_pad_idle_cpus(num_cpus); |
| 422 | idle_cpus = acpi_pad_idle_cpus_num(); | 428 | idle_cpus = acpi_pad_idle_cpus_num(); |
| 423 | if (!ret) | 429 | acpi_pad_ost(handle, 0, idle_cpus); |
| 424 | acpi_pad_ost(handle, 0, idle_cpus); | ||
| 425 | else | ||
| 426 | acpi_pad_ost(handle, 1, 0); | ||
| 427 | mutex_unlock(&isolated_cpus_lock); | 430 | mutex_unlock(&isolated_cpus_lock); |
| 428 | } | 431 | } |
| 429 | 432 | ||
diff --git a/drivers/acpi/acpica/accommon.h b/drivers/acpi/acpica/accommon.h index 3b20786cbb0d..3e50c74ed4a1 100644 --- a/drivers/acpi/acpica/accommon.h +++ b/drivers/acpi/acpica/accommon.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/acconfig.h b/drivers/acpi/acpica/acconfig.h index a4471e3d3853..33181ad350d5 100644 --- a/drivers/acpi/acpica/acconfig.h +++ b/drivers/acpi/acpica/acconfig.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/acdebug.h b/drivers/acpi/acpica/acdebug.h index a4fb001d96f1..48faf3eba9fb 100644 --- a/drivers/acpi/acpica/acdebug.h +++ b/drivers/acpi/acpica/acdebug.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/acdispat.h b/drivers/acpi/acpica/acdispat.h index 6291904be01e..894a0ff2a946 100644 --- a/drivers/acpi/acpica/acdispat.h +++ b/drivers/acpi/acpica/acdispat.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/acevents.h b/drivers/acpi/acpica/acevents.h index 0bba148a2c61..3e6ba99e4053 100644 --- a/drivers/acpi/acpica/acevents.h +++ b/drivers/acpi/acpica/acevents.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -76,12 +76,9 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node *node, | |||
| 76 | * evgpe - GPE handling and dispatch | 76 | * evgpe - GPE handling and dispatch |
| 77 | */ | 77 | */ |
| 78 | acpi_status | 78 | acpi_status |
| 79 | acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info, | 79 | acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info); |
| 80 | u8 type); | ||
| 81 | 80 | ||
| 82 | acpi_status | 81 | acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info); |
| 83 | acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info, | ||
| 84 | u8 write_to_hardware); | ||
| 85 | 82 | ||
| 86 | acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info); | 83 | acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info); |
| 87 | 84 | ||
| @@ -122,9 +119,6 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, | |||
| 122 | u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info *gpe_xrupt_list); | 119 | u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info *gpe_xrupt_list); |
| 123 | 120 | ||
| 124 | acpi_status | 121 | acpi_status |
| 125 | acpi_ev_set_gpe_type(struct acpi_gpe_event_info *gpe_event_info, u8 type); | ||
| 126 | |||
| 127 | acpi_status | ||
| 128 | acpi_ev_check_for_wake_only_gpe(struct acpi_gpe_event_info *gpe_event_info); | 122 | acpi_ev_check_for_wake_only_gpe(struct acpi_gpe_event_info *gpe_event_info); |
| 129 | 123 | ||
| 130 | acpi_status acpi_ev_gpe_initialize(void); | 124 | acpi_status acpi_ev_gpe_initialize(void); |
| @@ -139,8 +133,7 @@ acpi_status acpi_ev_initialize_op_regions(void); | |||
| 139 | acpi_status | 133 | acpi_status |
| 140 | acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | 134 | acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, |
| 141 | u32 function, | 135 | u32 function, |
| 142 | u32 region_offset, | 136 | u32 region_offset, u32 bit_width, u64 *value); |
| 143 | u32 bit_width, acpi_integer * value); | ||
| 144 | 137 | ||
| 145 | acpi_status | 138 | acpi_status |
| 146 | acpi_ev_attach_region(union acpi_operand_object *handler_obj, | 139 | acpi_ev_attach_region(union acpi_operand_object *handler_obj, |
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h index 29ba66d5a790..f8dd8f250ac4 100644 --- a/drivers/acpi/acpica/acglobal.h +++ b/drivers/acpi/acpica/acglobal.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/achware.h b/drivers/acpi/acpica/achware.h index 36192f142fbb..5900f135dc6d 100644 --- a/drivers/acpi/acpica/achware.h +++ b/drivers/acpi/acpica/achware.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/acinterp.h b/drivers/acpi/acpica/acinterp.h index 5db9f2916f7c..6df3f8428168 100644 --- a/drivers/acpi/acpica/acinterp.h +++ b/drivers/acpi/acpica/acinterp.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -129,18 +129,17 @@ acpi_ex_common_buffer_setup(union acpi_operand_object *obj_desc, | |||
| 129 | 129 | ||
| 130 | acpi_status | 130 | acpi_status |
| 131 | acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, | 131 | acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, |
| 132 | acpi_integer mask, | 132 | u64 mask, |
| 133 | acpi_integer field_value, | 133 | u64 field_value, u32 field_datum_byte_offset); |
| 134 | u32 field_datum_byte_offset); | ||
| 135 | 134 | ||
| 136 | void | 135 | void |
| 137 | acpi_ex_get_buffer_datum(acpi_integer * datum, | 136 | acpi_ex_get_buffer_datum(u64 *datum, |
| 138 | void *buffer, | 137 | void *buffer, |
| 139 | u32 buffer_length, | 138 | u32 buffer_length, |
| 140 | u32 byte_granularity, u32 buffer_offset); | 139 | u32 byte_granularity, u32 buffer_offset); |
| 141 | 140 | ||
| 142 | void | 141 | void |
| 143 | acpi_ex_set_buffer_datum(acpi_integer merged_datum, | 142 | acpi_ex_set_buffer_datum(u64 merged_datum, |
| 144 | void *buffer, | 143 | void *buffer, |
| 145 | u32 buffer_length, | 144 | u32 buffer_length, |
| 146 | u32 byte_granularity, u32 buffer_offset); | 145 | u32 byte_granularity, u32 buffer_offset); |
| @@ -168,8 +167,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
| 168 | 167 | ||
| 169 | acpi_status | 168 | acpi_status |
| 170 | acpi_ex_access_region(union acpi_operand_object *obj_desc, | 169 | acpi_ex_access_region(union acpi_operand_object *obj_desc, |
| 171 | u32 field_datum_byte_offset, | 170 | u32 field_datum_byte_offset, u64 *value, u32 read_write); |
| 172 | acpi_integer * value, u32 read_write); | ||
| 173 | 171 | ||
| 174 | /* | 172 | /* |
| 175 | * exmisc - misc support routines | 173 | * exmisc - misc support routines |
| @@ -193,16 +191,14 @@ acpi_ex_do_concatenate(union acpi_operand_object *obj_desc, | |||
| 193 | 191 | ||
| 194 | acpi_status | 192 | acpi_status |
| 195 | acpi_ex_do_logical_numeric_op(u16 opcode, | 193 | acpi_ex_do_logical_numeric_op(u16 opcode, |
| 196 | acpi_integer integer0, | 194 | u64 integer0, u64 integer1, u8 *logical_result); |
| 197 | acpi_integer integer1, u8 * logical_result); | ||
| 198 | 195 | ||
| 199 | acpi_status | 196 | acpi_status |
| 200 | acpi_ex_do_logical_op(u16 opcode, | 197 | acpi_ex_do_logical_op(u16 opcode, |
| 201 | union acpi_operand_object *operand0, | 198 | union acpi_operand_object *operand0, |
| 202 | union acpi_operand_object *operand1, u8 * logical_result); | 199 | union acpi_operand_object *operand1, u8 *logical_result); |
| 203 | 200 | ||
| 204 | acpi_integer | 201 | u64 acpi_ex_do_math_op(u16 opcode, u64 operand0, u64 operand1); |
| 205 | acpi_ex_do_math_op(u16 opcode, acpi_integer operand0, acpi_integer operand1); | ||
| 206 | 202 | ||
| 207 | acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state); | 203 | acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state); |
| 208 | 204 | ||
| @@ -278,7 +274,7 @@ acpi_status | |||
| 278 | acpi_ex_system_do_notify_op(union acpi_operand_object *value, | 274 | acpi_ex_system_do_notify_op(union acpi_operand_object *value, |
| 279 | union acpi_operand_object *obj_desc); | 275 | union acpi_operand_object *obj_desc); |
| 280 | 276 | ||
| 281 | acpi_status acpi_ex_system_do_suspend(acpi_integer time); | 277 | acpi_status acpi_ex_system_do_suspend(u64 time); |
| 282 | 278 | ||
| 283 | acpi_status acpi_ex_system_do_stall(u32 time); | 279 | acpi_status acpi_ex_system_do_stall(u32 time); |
| 284 | 280 | ||
| @@ -461,9 +457,9 @@ void acpi_ex_acquire_global_lock(u32 rule); | |||
| 461 | 457 | ||
| 462 | void acpi_ex_release_global_lock(u32 rule); | 458 | void acpi_ex_release_global_lock(u32 rule); |
| 463 | 459 | ||
| 464 | void acpi_ex_eisa_id_to_string(char *dest, acpi_integer compressed_id); | 460 | void acpi_ex_eisa_id_to_string(char *dest, u64 compressed_id); |
| 465 | 461 | ||
| 466 | void acpi_ex_integer_to_string(char *dest, acpi_integer value); | 462 | void acpi_ex_integer_to_string(char *dest, u64 value); |
| 467 | 463 | ||
| 468 | /* | 464 | /* |
| 469 | * exregion - default op_region handlers | 465 | * exregion - default op_region handlers |
| @@ -472,7 +468,7 @@ acpi_status | |||
| 472 | acpi_ex_system_memory_space_handler(u32 function, | 468 | acpi_ex_system_memory_space_handler(u32 function, |
| 473 | acpi_physical_address address, | 469 | acpi_physical_address address, |
| 474 | u32 bit_width, | 470 | u32 bit_width, |
| 475 | acpi_integer * value, | 471 | u64 *value, |
| 476 | void *handler_context, | 472 | void *handler_context, |
| 477 | void *region_context); | 473 | void *region_context); |
| 478 | 474 | ||
| @@ -480,35 +476,35 @@ acpi_status | |||
| 480 | acpi_ex_system_io_space_handler(u32 function, | 476 | acpi_ex_system_io_space_handler(u32 function, |
| 481 | acpi_physical_address address, | 477 | acpi_physical_address address, |
| 482 | u32 bit_width, | 478 | u32 bit_width, |
| 483 | acpi_integer * value, | 479 | u64 *value, |
| 484 | void *handler_context, void *region_context); | 480 | void *handler_context, void *region_context); |
| 485 | 481 | ||
| 486 | acpi_status | 482 | acpi_status |
| 487 | acpi_ex_pci_config_space_handler(u32 function, | 483 | acpi_ex_pci_config_space_handler(u32 function, |
| 488 | acpi_physical_address address, | 484 | acpi_physical_address address, |
| 489 | u32 bit_width, | 485 | u32 bit_width, |
| 490 | acpi_integer * value, | 486 | u64 *value, |
| 491 | void *handler_context, void *region_context); | 487 | void *handler_context, void *region_context); |
| 492 | 488 | ||
| 493 | acpi_status | 489 | acpi_status |
| 494 | acpi_ex_cmos_space_handler(u32 function, | 490 | acpi_ex_cmos_space_handler(u32 function, |
| 495 | acpi_physical_address address, | 491 | acpi_physical_address address, |
| 496 | u32 bit_width, | 492 | u32 bit_width, |
| 497 | acpi_integer * value, | 493 | u64 *value, |
| 498 | void *handler_context, void *region_context); | 494 | void *handler_context, void *region_context); |
| 499 | 495 | ||
| 500 | acpi_status | 496 | acpi_status |
| 501 | acpi_ex_pci_bar_space_handler(u32 function, | 497 | acpi_ex_pci_bar_space_handler(u32 function, |
| 502 | acpi_physical_address address, | 498 | acpi_physical_address address, |
| 503 | u32 bit_width, | 499 | u32 bit_width, |
| 504 | acpi_integer * value, | 500 | u64 *value, |
| 505 | void *handler_context, void *region_context); | 501 | void *handler_context, void *region_context); |
| 506 | 502 | ||
| 507 | acpi_status | 503 | acpi_status |
| 508 | acpi_ex_embedded_controller_space_handler(u32 function, | 504 | acpi_ex_embedded_controller_space_handler(u32 function, |
| 509 | acpi_physical_address address, | 505 | acpi_physical_address address, |
| 510 | u32 bit_width, | 506 | u32 bit_width, |
| 511 | acpi_integer * value, | 507 | u64 *value, |
| 512 | void *handler_context, | 508 | void *handler_context, |
| 513 | void *region_context); | 509 | void *region_context); |
| 514 | 510 | ||
| @@ -516,14 +512,14 @@ acpi_status | |||
| 516 | acpi_ex_sm_bus_space_handler(u32 function, | 512 | acpi_ex_sm_bus_space_handler(u32 function, |
| 517 | acpi_physical_address address, | 513 | acpi_physical_address address, |
| 518 | u32 bit_width, | 514 | u32 bit_width, |
| 519 | acpi_integer * value, | 515 | u64 *value, |
| 520 | void *handler_context, void *region_context); | 516 | void *handler_context, void *region_context); |
| 521 | 517 | ||
| 522 | acpi_status | 518 | acpi_status |
| 523 | acpi_ex_data_table_space_handler(u32 function, | 519 | acpi_ex_data_table_space_handler(u32 function, |
| 524 | acpi_physical_address address, | 520 | acpi_physical_address address, |
| 525 | u32 bit_width, | 521 | u32 bit_width, |
| 526 | acpi_integer * value, | 522 | u64 *value, |
| 527 | void *handler_context, void *region_context); | 523 | void *handler_context, void *region_context); |
| 528 | 524 | ||
| 529 | #endif /* __INTERP_H__ */ | 525 | #endif /* __INTERP_H__ */ |
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h index 81e64f478679..24b8faa5c395 100644 --- a/drivers/acpi/acpica/aclocal.h +++ b/drivers/acpi/acpica/aclocal.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -374,6 +374,7 @@ union acpi_predefined_info { | |||
| 374 | struct acpi_predefined_data { | 374 | struct acpi_predefined_data { |
| 375 | char *pathname; | 375 | char *pathname; |
| 376 | const union acpi_predefined_info *predefined; | 376 | const union acpi_predefined_info *predefined; |
| 377 | union acpi_operand_object *parent_package; | ||
| 377 | u32 flags; | 378 | u32 flags; |
| 378 | u8 node_flags; | 379 | u8 node_flags; |
| 379 | }; | 380 | }; |
| @@ -426,6 +427,8 @@ struct acpi_gpe_event_info { | |||
| 426 | struct acpi_gpe_register_info *register_info; /* Backpointer to register info */ | 427 | struct acpi_gpe_register_info *register_info; /* Backpointer to register info */ |
| 427 | u8 flags; /* Misc info about this GPE */ | 428 | u8 flags; /* Misc info about this GPE */ |
| 428 | u8 gpe_number; /* This GPE */ | 429 | u8 gpe_number; /* This GPE */ |
| 430 | u8 runtime_count; | ||
| 431 | u8 wakeup_count; | ||
| 429 | }; | 432 | }; |
| 430 | 433 | ||
| 431 | /* Information about a GPE register pair, one per each status/enable pair in an array */ | 434 | /* Information about a GPE register pair, one per each status/enable pair in an array */ |
| @@ -649,8 +652,7 @@ struct acpi_opcode_info { | |||
| 649 | }; | 652 | }; |
| 650 | 653 | ||
| 651 | union acpi_parse_value { | 654 | union acpi_parse_value { |
| 652 | acpi_integer integer; /* Integer constant (Up to 64 bits) */ | 655 | u64 integer; /* Integer constant (Up to 64 bits) */ |
| 653 | struct uint64_struct integer64; /* Structure overlay for 2 32-bit Dwords */ | ||
| 654 | u32 size; /* bytelist or field size */ | 656 | u32 size; /* bytelist or field size */ |
| 655 | char *string; /* NULL terminated string */ | 657 | char *string; /* NULL terminated string */ |
| 656 | u8 *buffer; /* buffer or string */ | 658 | u8 *buffer; /* buffer or string */ |
diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h index 7d9ba6e57554..9894929a2abb 100644 --- a/drivers/acpi/acpica/acmacros.h +++ b/drivers/acpi/acpica/acmacros.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -272,8 +272,8 @@ | |||
| 272 | * MASK_BITS_ABOVE creates a mask starting AT the position and above | 272 | * MASK_BITS_ABOVE creates a mask starting AT the position and above |
| 273 | * MASK_BITS_BELOW creates a mask starting one bit BELOW the position | 273 | * MASK_BITS_BELOW creates a mask starting one bit BELOW the position |
| 274 | */ | 274 | */ |
| 275 | #define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((u32) (position)))) | 275 | #define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_UINT64_MAX) << ((u32) (position)))) |
| 276 | #define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((u32) (position))) | 276 | #define ACPI_MASK_BITS_BELOW(position) ((ACPI_UINT64_MAX) << ((u32) (position))) |
| 277 | 277 | ||
| 278 | /* Bitfields within ACPI registers */ | 278 | /* Bitfields within ACPI registers */ |
| 279 | 279 | ||
| @@ -414,16 +414,16 @@ | |||
| 414 | acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) _s); \ | 414 | acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) _s); \ |
| 415 | return (_s); }) | 415 | return (_s); }) |
| 416 | #define return_VALUE(s) ACPI_DO_WHILE0 ({ \ | 416 | #define return_VALUE(s) ACPI_DO_WHILE0 ({ \ |
| 417 | register acpi_integer _s = (s); \ | 417 | register u64 _s = (s); \ |
| 418 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \ | 418 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \ |
| 419 | return (_s); }) | 419 | return (_s); }) |
| 420 | #define return_UINT8(s) ACPI_DO_WHILE0 ({ \ | 420 | #define return_UINT8(s) ACPI_DO_WHILE0 ({ \ |
| 421 | register u8 _s = (u8) (s); \ | 421 | register u8 _s = (u8) (s); \ |
| 422 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) _s); \ | 422 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (u64) _s); \ |
| 423 | return (_s); }) | 423 | return (_s); }) |
| 424 | #define return_UINT32(s) ACPI_DO_WHILE0 ({ \ | 424 | #define return_UINT32(s) ACPI_DO_WHILE0 ({ \ |
| 425 | register u32 _s = (u32) (s); \ | 425 | register u32 _s = (u32) (s); \ |
| 426 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) _s); \ | 426 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (u64) _s); \ |
| 427 | return (_s); }) | 427 | return (_s); }) |
| 428 | #else /* Use original less-safe macros */ | 428 | #else /* Use original less-safe macros */ |
| 429 | 429 | ||
| @@ -434,7 +434,7 @@ | |||
| 434 | acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) (s)); \ | 434 | acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) (s)); \ |
| 435 | return((s)); }) | 435 | return((s)); }) |
| 436 | #define return_VALUE(s) ACPI_DO_WHILE0 ({ \ | 436 | #define return_VALUE(s) ACPI_DO_WHILE0 ({ \ |
| 437 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) (s)); \ | 437 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (u64) (s)); \ |
| 438 | return((s)); }) | 438 | return((s)); }) |
| 439 | #define return_UINT8(s) return_VALUE(s) | 439 | #define return_UINT8(s) return_VALUE(s) |
| 440 | #define return_UINT32(s) return_VALUE(s) | 440 | #define return_UINT32(s) return_VALUE(s) |
diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h index 61edb156e8d0..258159cfcdfa 100644 --- a/drivers/acpi/acpica/acnamesp.h +++ b/drivers/acpi/acpica/acnamesp.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -286,6 +286,17 @@ acpi_status | |||
| 286 | acpi_ns_repair_package_list(struct acpi_predefined_data *data, | 286 | acpi_ns_repair_package_list(struct acpi_predefined_data *data, |
| 287 | union acpi_operand_object **obj_desc_ptr); | 287 | union acpi_operand_object **obj_desc_ptr); |
| 288 | 288 | ||
| 289 | acpi_status | ||
| 290 | acpi_ns_repair_null_element(struct acpi_predefined_data *data, | ||
| 291 | u32 expected_btypes, | ||
| 292 | u32 package_index, | ||
| 293 | union acpi_operand_object **return_object_ptr); | ||
| 294 | |||
| 295 | void | ||
| 296 | acpi_ns_remove_null_elements(struct acpi_predefined_data *data, | ||
| 297 | u8 package_type, | ||
| 298 | union acpi_operand_object *obj_desc); | ||
| 299 | |||
| 289 | /* | 300 | /* |
| 290 | * nsrepair2 - Return object repair for specific | 301 | * nsrepair2 - Return object repair for specific |
| 291 | * predefined methods/objects | 302 | * predefined methods/objects |
| @@ -296,11 +307,6 @@ acpi_ns_complex_repairs(struct acpi_predefined_data *data, | |||
| 296 | acpi_status validate_status, | 307 | acpi_status validate_status, |
| 297 | union acpi_operand_object **return_object_ptr); | 308 | union acpi_operand_object **return_object_ptr); |
| 298 | 309 | ||
| 299 | void | ||
| 300 | acpi_ns_remove_null_elements(struct acpi_predefined_data *data, | ||
| 301 | u8 package_type, | ||
| 302 | union acpi_operand_object *obj_desc); | ||
| 303 | |||
| 304 | /* | 310 | /* |
| 305 | * nssearch - Namespace searching and entry | 311 | * nssearch - Namespace searching and entry |
| 306 | */ | 312 | */ |
diff --git a/drivers/acpi/acpica/acobject.h b/drivers/acpi/acpica/acobject.h index 64062b1be3ee..cde18ea82656 100644 --- a/drivers/acpi/acpica/acobject.h +++ b/drivers/acpi/acpica/acobject.h | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
| @@ -111,7 +111,7 @@ ACPI_OBJECT_COMMON_HEADER}; | |||
| 111 | 111 | ||
| 112 | struct acpi_object_integer { | 112 | struct acpi_object_integer { |
| 113 | ACPI_OBJECT_COMMON_HEADER u8 fill[3]; /* Prevent warning on some compilers */ | 113 | ACPI_OBJECT_COMMON_HEADER u8 fill[3]; /* Prevent warning on some compilers */ |
| 114 | acpi_integer value; | 114 | u64 value; |
| 115 | }; | 115 | }; |
| 116 | 116 | ||
| 117 | /* | 117 | /* |
| @@ -287,8 +287,10 @@ struct acpi_object_buffer_field { | |||
| 287 | 287 | ||
| 288 | struct acpi_object_notify_handler { | 288 | struct acpi_object_notify_handler { |
| 289 | ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *node; /* Parent device */ | 289 | ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *node; /* Parent device */ |
| 290 | u32 handler_type; | ||
| 290 | acpi_notify_handler handler; | 291 | acpi_notify_handler handler; |
| 291 | void *context; | 292 | void *context; |
| 293 | struct acpi_object_notify_handler *next; | ||
| 292 | }; | 294 | }; |
| 293 | 295 | ||
| 294 | struct acpi_object_addr_handler { | 296 | struct acpi_object_addr_handler { |
diff --git a/drivers/acpi/acpica/acopcode.h b/drivers/acpi/acpica/acopcode.h index dfdf63327885..8c15ff43f42b 100644 --- a/drivers/acpi/acpica/acopcode.h +++ b/drivers/acpi/acpica/acopcode.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/acparser.h b/drivers/acpi/acpica/acparser.h index 22881e8ce229..d0bb0fd3e57a 100644 --- a/drivers/acpi/acpica/acparser.h +++ b/drivers/acpi/acpica/acparser.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/acpredef.h b/drivers/acpi/acpica/acpredef.h index 57bdaf6ffab1..97116082cb6c 100644 --- a/drivers/acpi/acpica/acpredef.h +++ b/drivers/acpi/acpica/acpredef.h | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/acresrc.h b/drivers/acpi/acpica/acresrc.h index eef5bd7a59fa..528bcbaf4ce7 100644 --- a/drivers/acpi/acpica/acresrc.h +++ b/drivers/acpi/acpica/acresrc.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/acstruct.h b/drivers/acpi/acpica/acstruct.h index 7980a26bad35..161bc0e3d70a 100644 --- a/drivers/acpi/acpica/acstruct.h +++ b/drivers/acpi/acpica/acstruct.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/actables.h b/drivers/acpi/acpica/actables.h index 01c76b8ea7ba..8ff3b741df28 100644 --- a/drivers/acpi/acpica/actables.h +++ b/drivers/acpi/acpica/actables.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h index 3a451a21a3f9..35df755251ce 100644 --- a/drivers/acpi/acpica/acutils.h +++ b/drivers/acpi/acpica/acutils.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -134,7 +134,7 @@ char *acpi_ut_get_region_name(u8 space_id); | |||
| 134 | 134 | ||
| 135 | char *acpi_ut_get_event_name(u32 event_id); | 135 | char *acpi_ut_get_event_name(u32 event_id); |
| 136 | 136 | ||
| 137 | char acpi_ut_hex_to_ascii_char(acpi_integer integer, u32 position); | 137 | char acpi_ut_hex_to_ascii_char(u64 integer, u32 position); |
| 138 | 138 | ||
| 139 | u8 acpi_ut_valid_object_type(acpi_object_type type); | 139 | u8 acpi_ut_valid_object_type(acpi_object_type type); |
| 140 | 140 | ||
| @@ -279,8 +279,7 @@ acpi_ut_status_exit(u32 line_number, | |||
| 279 | void | 279 | void |
| 280 | acpi_ut_value_exit(u32 line_number, | 280 | acpi_ut_value_exit(u32 line_number, |
| 281 | const char *function_name, | 281 | const char *function_name, |
| 282 | const char *module_name, | 282 | const char *module_name, u32 component_id, u64 value); |
| 283 | u32 component_id, acpi_integer value); | ||
| 284 | 283 | ||
| 285 | void | 284 | void |
| 286 | acpi_ut_ptr_exit(u32 line_number, | 285 | acpi_ut_ptr_exit(u32 line_number, |
| @@ -324,7 +323,7 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, | |||
| 324 | acpi_status | 323 | acpi_status |
| 325 | acpi_ut_evaluate_numeric_object(char *object_name, | 324 | acpi_ut_evaluate_numeric_object(char *object_name, |
| 326 | struct acpi_namespace_node *device_node, | 325 | struct acpi_namespace_node *device_node, |
| 327 | acpi_integer *value); | 326 | u64 *value); |
| 328 | 327 | ||
| 329 | acpi_status | 328 | acpi_status |
| 330 | acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 *status_flags); | 329 | acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 *status_flags); |
| @@ -437,14 +436,12 @@ void acpi_ut_delete_generic_state(union acpi_generic_state *state); | |||
| 437 | * utmath | 436 | * utmath |
| 438 | */ | 437 | */ |
| 439 | acpi_status | 438 | acpi_status |
| 440 | acpi_ut_divide(acpi_integer in_dividend, | 439 | acpi_ut_divide(u64 in_dividend, |
| 441 | acpi_integer in_divisor, | 440 | u64 in_divisor, u64 *out_quotient, u64 *out_remainder); |
| 442 | acpi_integer * out_quotient, acpi_integer * out_remainder); | ||
| 443 | 441 | ||
| 444 | acpi_status | 442 | acpi_status |
| 445 | acpi_ut_short_divide(acpi_integer in_dividend, | 443 | acpi_ut_short_divide(u64 in_dividend, |
| 446 | u32 divisor, | 444 | u32 divisor, u64 *out_quotient, u32 *out_remainder); |
| 447 | acpi_integer * out_quotient, u32 * out_remainder); | ||
| 448 | 445 | ||
| 449 | /* | 446 | /* |
| 450 | * utmisc | 447 | * utmisc |
| @@ -474,8 +471,7 @@ acpi_name acpi_ut_repair_name(char *name); | |||
| 474 | 471 | ||
| 475 | u8 acpi_ut_valid_acpi_char(char character, u32 position); | 472 | u8 acpi_ut_valid_acpi_char(char character, u32 position); |
| 476 | 473 | ||
| 477 | acpi_status | 474 | acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 * ret_integer); |
| 478 | acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer); | ||
| 479 | 475 | ||
| 480 | void ACPI_INTERNAL_VAR_XFACE | 476 | void ACPI_INTERNAL_VAR_XFACE |
| 481 | acpi_ut_predefined_warning(const char *module_name, | 477 | acpi_ut_predefined_warning(const char *module_name, |
diff --git a/drivers/acpi/acpica/amlcode.h b/drivers/acpi/acpica/amlcode.h index 4940249f2524..1f484ba228fc 100644 --- a/drivers/acpi/acpica/amlcode.h +++ b/drivers/acpi/acpica/amlcode.h | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | *****************************************************************************/ | 7 | *****************************************************************************/ |
| 8 | 8 | ||
| 9 | /* | 9 | /* |
| 10 | * Copyright (C) 2000 - 2008, Intel Corp. | 10 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 11 | * All rights reserved. | 11 | * All rights reserved. |
| 12 | * | 12 | * |
| 13 | * Redistribution and use in source and binary forms, with or without | 13 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/amlresrc.h b/drivers/acpi/acpica/amlresrc.h index 7b070e42b7c5..0e5798fcbb19 100644 --- a/drivers/acpi/acpica/amlresrc.h +++ b/drivers/acpi/acpica/amlresrc.h | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dsfield.c b/drivers/acpi/acpica/dsfield.c index 54a225e56a64..bb13817e0c31 100644 --- a/drivers/acpi/acpica/dsfield.c +++ b/drivers/acpi/acpica/dsfield.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -220,7 +220,7 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, | |||
| 220 | union acpi_parse_object *arg) | 220 | union acpi_parse_object *arg) |
| 221 | { | 221 | { |
| 222 | acpi_status status; | 222 | acpi_status status; |
| 223 | acpi_integer position; | 223 | u64 position; |
| 224 | 224 | ||
| 225 | ACPI_FUNCTION_TRACE_PTR(ds_get_field_names, info); | 225 | ACPI_FUNCTION_TRACE_PTR(ds_get_field_names, info); |
| 226 | 226 | ||
| @@ -240,8 +240,8 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, | |||
| 240 | switch (arg->common.aml_opcode) { | 240 | switch (arg->common.aml_opcode) { |
| 241 | case AML_INT_RESERVEDFIELD_OP: | 241 | case AML_INT_RESERVEDFIELD_OP: |
| 242 | 242 | ||
| 243 | position = (acpi_integer) info->field_bit_position | 243 | position = (u64) info->field_bit_position |
| 244 | + (acpi_integer) arg->common.value.size; | 244 | + (u64) arg->common.value.size; |
| 245 | 245 | ||
| 246 | if (position > ACPI_UINT32_MAX) { | 246 | if (position > ACPI_UINT32_MAX) { |
| 247 | ACPI_ERROR((AE_INFO, | 247 | ACPI_ERROR((AE_INFO, |
| @@ -305,8 +305,8 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, | |||
| 305 | 305 | ||
| 306 | /* Keep track of bit position for the next field */ | 306 | /* Keep track of bit position for the next field */ |
| 307 | 307 | ||
| 308 | position = (acpi_integer) info->field_bit_position | 308 | position = (u64) info->field_bit_position |
| 309 | + (acpi_integer) arg->common.value.size; | 309 | + (u64) arg->common.value.size; |
| 310 | 310 | ||
| 311 | if (position > ACPI_UINT32_MAX) { | 311 | if (position > ACPI_UINT32_MAX) { |
| 312 | ACPI_ERROR((AE_INFO, | 312 | ACPI_ERROR((AE_INFO, |
diff --git a/drivers/acpi/acpica/dsinit.c b/drivers/acpi/acpica/dsinit.c index f23fa0be6fc2..abe140318a74 100644 --- a/drivers/acpi/acpica/dsinit.c +++ b/drivers/acpi/acpica/dsinit.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c index e786f9fd767f..721039233aa7 100644 --- a/drivers/acpi/acpica/dsmethod.c +++ b/drivers/acpi/acpica/dsmethod.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dsmthdat.c b/drivers/acpi/acpica/dsmthdat.c index 0ba19f84ad82..cc343b959540 100644 --- a/drivers/acpi/acpica/dsmthdat.c +++ b/drivers/acpi/acpica/dsmthdat.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dsobject.c b/drivers/acpi/acpica/dsobject.c index 9bc1ba076347..891e08bf560b 100644 --- a/drivers/acpi/acpica/dsobject.c +++ b/drivers/acpi/acpica/dsobject.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -684,7 +684,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, | |||
| 684 | 684 | ||
| 685 | case AML_ONES_OP: | 685 | case AML_ONES_OP: |
| 686 | 686 | ||
| 687 | obj_desc->integer.value = ACPI_INTEGER_MAX; | 687 | obj_desc->integer.value = ACPI_UINT64_MAX; |
| 688 | 688 | ||
| 689 | /* Truncate value if we are executing from a 32-bit ACPI table */ | 689 | /* Truncate value if we are executing from a 32-bit ACPI table */ |
| 690 | 690 | ||
diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c index b79978f7bc71..bf980cadb1e8 100644 --- a/drivers/acpi/acpica/dsopcode.c +++ b/drivers/acpi/acpica/dsopcode.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dsutils.c b/drivers/acpi/acpica/dsutils.c index dfa104102926..306c62ab2e88 100644 --- a/drivers/acpi/acpica/dsutils.c +++ b/drivers/acpi/acpica/dsutils.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dswexec.c b/drivers/acpi/acpica/dswexec.c index f0280856dc0e..6b76c486d784 100644 --- a/drivers/acpi/acpica/dswexec.c +++ b/drivers/acpi/acpica/dswexec.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dswload.c b/drivers/acpi/acpica/dswload.c index b40513dd6a6a..140a9d002959 100644 --- a/drivers/acpi/acpica/dswload.c +++ b/drivers/acpi/acpica/dswload.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dswscope.c b/drivers/acpi/acpica/dswscope.c index 908645e72f03..d1e701709dac 100644 --- a/drivers/acpi/acpica/dswscope.c +++ b/drivers/acpi/acpica/dswscope.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dswstate.c b/drivers/acpi/acpica/dswstate.c index e46c821cf572..050df8164165 100644 --- a/drivers/acpi/acpica/dswstate.c +++ b/drivers/acpi/acpica/dswstate.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/evevent.c b/drivers/acpi/acpica/evevent.c index cd55c774e882..c1e6f472d435 100644 --- a/drivers/acpi/acpica/evevent.c +++ b/drivers/acpi/acpica/evevent.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c index afacf4416c73..837de669743a 100644 --- a/drivers/acpi/acpica/evgpe.c +++ b/drivers/acpi/acpica/evgpe.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -54,54 +54,9 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context); | |||
| 54 | 54 | ||
| 55 | /******************************************************************************* | 55 | /******************************************************************************* |
| 56 | * | 56 | * |
| 57 | * FUNCTION: acpi_ev_set_gpe_type | ||
| 58 | * | ||
| 59 | * PARAMETERS: gpe_event_info - GPE to set | ||
| 60 | * Type - New type | ||
| 61 | * | ||
| 62 | * RETURN: Status | ||
| 63 | * | ||
| 64 | * DESCRIPTION: Sets the new type for the GPE (wake, run, or wake/run) | ||
| 65 | * | ||
| 66 | ******************************************************************************/ | ||
| 67 | |||
| 68 | acpi_status | ||
| 69 | acpi_ev_set_gpe_type(struct acpi_gpe_event_info *gpe_event_info, u8 type) | ||
| 70 | { | ||
| 71 | acpi_status status; | ||
| 72 | |||
| 73 | ACPI_FUNCTION_TRACE(ev_set_gpe_type); | ||
| 74 | |||
| 75 | /* Validate type and update register enable masks */ | ||
| 76 | |||
| 77 | switch (type) { | ||
| 78 | case ACPI_GPE_TYPE_WAKE: | ||
| 79 | case ACPI_GPE_TYPE_RUNTIME: | ||
| 80 | case ACPI_GPE_TYPE_WAKE_RUN: | ||
| 81 | break; | ||
| 82 | |||
| 83 | default: | ||
| 84 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
| 85 | } | ||
| 86 | |||
| 87 | /* Disable the GPE if currently enabled */ | ||
| 88 | |||
| 89 | status = acpi_ev_disable_gpe(gpe_event_info); | ||
| 90 | |||
| 91 | /* Clear the type bits and insert the new Type */ | ||
| 92 | |||
| 93 | gpe_event_info->flags &= ~ACPI_GPE_TYPE_MASK; | ||
| 94 | gpe_event_info->flags |= type; | ||
| 95 | return_ACPI_STATUS(status); | ||
| 96 | } | ||
| 97 | |||
| 98 | /******************************************************************************* | ||
| 99 | * | ||
| 100 | * FUNCTION: acpi_ev_update_gpe_enable_masks | 57 | * FUNCTION: acpi_ev_update_gpe_enable_masks |
| 101 | * | 58 | * |
| 102 | * PARAMETERS: gpe_event_info - GPE to update | 59 | * PARAMETERS: gpe_event_info - GPE to update |
| 103 | * Type - What to do: ACPI_GPE_DISABLE or | ||
| 104 | * ACPI_GPE_ENABLE | ||
| 105 | * | 60 | * |
| 106 | * RETURN: Status | 61 | * RETURN: Status |
| 107 | * | 62 | * |
| @@ -110,8 +65,7 @@ acpi_ev_set_gpe_type(struct acpi_gpe_event_info *gpe_event_info, u8 type) | |||
| 110 | ******************************************************************************/ | 65 | ******************************************************************************/ |
| 111 | 66 | ||
| 112 | acpi_status | 67 | acpi_status |
| 113 | acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info, | 68 | acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info) |
| 114 | u8 type) | ||
| 115 | { | 69 | { |
| 116 | struct acpi_gpe_register_info *gpe_register_info; | 70 | struct acpi_gpe_register_info *gpe_register_info; |
| 117 | u8 register_bit; | 71 | u8 register_bit; |
| @@ -127,37 +81,14 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info, | |||
| 127 | (1 << | 81 | (1 << |
| 128 | (gpe_event_info->gpe_number - gpe_register_info->base_gpe_number)); | 82 | (gpe_event_info->gpe_number - gpe_register_info->base_gpe_number)); |
| 129 | 83 | ||
| 130 | /* 1) Disable case. Simply clear all enable bits */ | 84 | ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake, register_bit); |
| 131 | 85 | ACPI_CLEAR_BIT(gpe_register_info->enable_for_run, register_bit); | |
| 132 | if (type == ACPI_GPE_DISABLE) { | ||
| 133 | ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake, | ||
| 134 | register_bit); | ||
| 135 | ACPI_CLEAR_BIT(gpe_register_info->enable_for_run, register_bit); | ||
| 136 | return_ACPI_STATUS(AE_OK); | ||
| 137 | } | ||
| 138 | |||
| 139 | /* 2) Enable case. Set/Clear the appropriate enable bits */ | ||
| 140 | 86 | ||
| 141 | switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) { | 87 | if (gpe_event_info->runtime_count) |
| 142 | case ACPI_GPE_TYPE_WAKE: | ||
| 143 | ACPI_SET_BIT(gpe_register_info->enable_for_wake, register_bit); | ||
| 144 | ACPI_CLEAR_BIT(gpe_register_info->enable_for_run, register_bit); | ||
| 145 | break; | ||
| 146 | |||
| 147 | case ACPI_GPE_TYPE_RUNTIME: | ||
| 148 | ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake, | ||
| 149 | register_bit); | ||
| 150 | ACPI_SET_BIT(gpe_register_info->enable_for_run, register_bit); | 88 | ACPI_SET_BIT(gpe_register_info->enable_for_run, register_bit); |
| 151 | break; | ||
| 152 | 89 | ||
| 153 | case ACPI_GPE_TYPE_WAKE_RUN: | 90 | if (gpe_event_info->wakeup_count) |
| 154 | ACPI_SET_BIT(gpe_register_info->enable_for_wake, register_bit); | 91 | ACPI_SET_BIT(gpe_register_info->enable_for_wake, register_bit); |
| 155 | ACPI_SET_BIT(gpe_register_info->enable_for_run, register_bit); | ||
| 156 | break; | ||
| 157 | |||
| 158 | default: | ||
| 159 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
| 160 | } | ||
| 161 | 92 | ||
| 162 | return_ACPI_STATUS(AE_OK); | 93 | return_ACPI_STATUS(AE_OK); |
| 163 | } | 94 | } |
| @@ -167,8 +98,6 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info, | |||
| 167 | * FUNCTION: acpi_ev_enable_gpe | 98 | * FUNCTION: acpi_ev_enable_gpe |
| 168 | * | 99 | * |
| 169 | * PARAMETERS: gpe_event_info - GPE to enable | 100 | * PARAMETERS: gpe_event_info - GPE to enable |
| 170 | * write_to_hardware - Enable now, or just mark data structs | ||
| 171 | * (WAKE GPEs should be deferred) | ||
| 172 | * | 101 | * |
| 173 | * RETURN: Status | 102 | * RETURN: Status |
| 174 | * | 103 | * |
| @@ -176,9 +105,7 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info, | |||
| 176 | * | 105 | * |
| 177 | ******************************************************************************/ | 106 | ******************************************************************************/ |
| 178 | 107 | ||
| 179 | acpi_status | 108 | acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info) |
| 180 | acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info, | ||
| 181 | u8 write_to_hardware) | ||
| 182 | { | 109 | { |
| 183 | acpi_status status; | 110 | acpi_status status; |
| 184 | 111 | ||
| @@ -186,47 +113,20 @@ acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info, | |||
| 186 | 113 | ||
| 187 | /* Make sure HW enable masks are updated */ | 114 | /* Make sure HW enable masks are updated */ |
| 188 | 115 | ||
| 189 | status = | 116 | status = acpi_ev_update_gpe_enable_masks(gpe_event_info); |
| 190 | acpi_ev_update_gpe_enable_masks(gpe_event_info, ACPI_GPE_ENABLE); | 117 | if (ACPI_FAILURE(status)) |
| 191 | if (ACPI_FAILURE(status)) { | ||
| 192 | return_ACPI_STATUS(status); | 118 | return_ACPI_STATUS(status); |
| 193 | } | ||
| 194 | 119 | ||
| 195 | /* Mark wake-enabled or HW enable, or both */ | 120 | /* Mark wake-enabled or HW enable, or both */ |
| 196 | 121 | ||
| 197 | switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) { | 122 | if (gpe_event_info->runtime_count) { |
| 198 | case ACPI_GPE_TYPE_WAKE: | 123 | /* Clear the GPE (of stale events), then enable it */ |
| 199 | 124 | status = acpi_hw_clear_gpe(gpe_event_info); | |
| 200 | ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED); | 125 | if (ACPI_FAILURE(status)) |
| 201 | break; | 126 | return_ACPI_STATUS(status); |
| 202 | |||
| 203 | case ACPI_GPE_TYPE_WAKE_RUN: | ||
| 204 | |||
| 205 | ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED); | ||
| 206 | |||
| 207 | /*lint -fallthrough */ | ||
| 208 | |||
| 209 | case ACPI_GPE_TYPE_RUNTIME: | ||
| 210 | |||
| 211 | ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED); | ||
| 212 | |||
| 213 | if (write_to_hardware) { | ||
| 214 | |||
| 215 | /* Clear the GPE (of stale events), then enable it */ | ||
| 216 | |||
| 217 | status = acpi_hw_clear_gpe(gpe_event_info); | ||
| 218 | if (ACPI_FAILURE(status)) { | ||
| 219 | return_ACPI_STATUS(status); | ||
| 220 | } | ||
| 221 | |||
| 222 | /* Enable the requested runtime GPE */ | ||
| 223 | |||
| 224 | status = acpi_hw_write_gpe_enable_reg(gpe_event_info); | ||
| 225 | } | ||
| 226 | break; | ||
| 227 | 127 | ||
| 228 | default: | 128 | /* Enable the requested runtime GPE */ |
| 229 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 129 | status = acpi_hw_write_gpe_enable_reg(gpe_event_info); |
| 230 | } | 130 | } |
| 231 | 131 | ||
| 232 | return_ACPI_STATUS(AE_OK); | 132 | return_ACPI_STATUS(AE_OK); |
| @@ -252,34 +152,9 @@ acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) | |||
| 252 | 152 | ||
| 253 | /* Make sure HW enable masks are updated */ | 153 | /* Make sure HW enable masks are updated */ |
| 254 | 154 | ||
| 255 | status = | 155 | status = acpi_ev_update_gpe_enable_masks(gpe_event_info); |
| 256 | acpi_ev_update_gpe_enable_masks(gpe_event_info, ACPI_GPE_DISABLE); | 156 | if (ACPI_FAILURE(status)) |
| 257 | if (ACPI_FAILURE(status)) { | ||
| 258 | return_ACPI_STATUS(status); | 157 | return_ACPI_STATUS(status); |
| 259 | } | ||
| 260 | |||
| 261 | /* Clear the appropriate enabled flags for this GPE */ | ||
| 262 | |||
| 263 | switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) { | ||
| 264 | case ACPI_GPE_TYPE_WAKE: | ||
| 265 | ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED); | ||
| 266 | break; | ||
| 267 | |||
| 268 | case ACPI_GPE_TYPE_WAKE_RUN: | ||
| 269 | ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED); | ||
| 270 | |||
| 271 | /* fallthrough */ | ||
| 272 | |||
| 273 | case ACPI_GPE_TYPE_RUNTIME: | ||
| 274 | |||
| 275 | /* Disable the requested runtime GPE */ | ||
| 276 | |||
| 277 | ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED); | ||
| 278 | break; | ||
| 279 | |||
| 280 | default: | ||
| 281 | break; | ||
| 282 | } | ||
| 283 | 158 | ||
| 284 | /* | 159 | /* |
| 285 | * Even if we don't know the GPE type, make sure that we always | 160 | * Even if we don't know the GPE type, make sure that we always |
| @@ -521,7 +396,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) | |||
| 521 | 396 | ||
| 522 | /* Set the GPE flags for return to enabled state */ | 397 | /* Set the GPE flags for return to enabled state */ |
| 523 | 398 | ||
| 524 | (void)acpi_ev_enable_gpe(gpe_event_info, FALSE); | 399 | (void)acpi_ev_update_gpe_enable_masks(gpe_event_info); |
| 525 | 400 | ||
| 526 | /* | 401 | /* |
| 527 | * Take a snapshot of the GPE info for this level - we copy the info to | 402 | * Take a snapshot of the GPE info for this level - we copy the info to |
diff --git a/drivers/acpi/acpica/evgpeblk.c b/drivers/acpi/acpica/evgpeblk.c index 247920900187..fef721917eaf 100644 --- a/drivers/acpi/acpica/evgpeblk.c +++ b/drivers/acpi/acpica/evgpeblk.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -258,7 +258,6 @@ acpi_ev_save_method_info(acpi_handle obj_handle, | |||
| 258 | u32 gpe_number; | 258 | u32 gpe_number; |
| 259 | char name[ACPI_NAME_SIZE + 1]; | 259 | char name[ACPI_NAME_SIZE + 1]; |
| 260 | u8 type; | 260 | u8 type; |
| 261 | acpi_status status; | ||
| 262 | 261 | ||
| 263 | ACPI_FUNCTION_TRACE(ev_save_method_info); | 262 | ACPI_FUNCTION_TRACE(ev_save_method_info); |
| 264 | 263 | ||
| @@ -325,26 +324,20 @@ acpi_ev_save_method_info(acpi_handle obj_handle, | |||
| 325 | 324 | ||
| 326 | /* | 325 | /* |
| 327 | * Now we can add this information to the gpe_event_info block for use | 326 | * Now we can add this information to the gpe_event_info block for use |
| 328 | * during dispatch of this GPE. Default type is RUNTIME, although this may | 327 | * during dispatch of this GPE. |
| 329 | * change when the _PRW methods are executed later. | ||
| 330 | */ | 328 | */ |
| 331 | gpe_event_info = | 329 | gpe_event_info = |
| 332 | &gpe_block->event_info[gpe_number - gpe_block->block_base_number]; | 330 | &gpe_block->event_info[gpe_number - gpe_block->block_base_number]; |
| 333 | 331 | ||
| 334 | gpe_event_info->flags = (u8) | 332 | gpe_event_info->flags = (u8) (type | ACPI_GPE_DISPATCH_METHOD); |
| 335 | (type | ACPI_GPE_DISPATCH_METHOD | ACPI_GPE_TYPE_RUNTIME); | ||
| 336 | 333 | ||
| 337 | gpe_event_info->dispatch.method_node = | 334 | gpe_event_info->dispatch.method_node = |
| 338 | (struct acpi_namespace_node *)obj_handle; | 335 | (struct acpi_namespace_node *)obj_handle; |
| 339 | 336 | ||
| 340 | /* Update enable mask, but don't enable the HW GPE as of yet */ | ||
| 341 | |||
| 342 | status = acpi_ev_enable_gpe(gpe_event_info, FALSE); | ||
| 343 | |||
| 344 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, | 337 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, |
| 345 | "Registered GPE method %s as GPE number 0x%.2X\n", | 338 | "Registered GPE method %s as GPE number 0x%.2X\n", |
| 346 | name, gpe_number)); | 339 | name, gpe_number)); |
| 347 | return_ACPI_STATUS(status); | 340 | return_ACPI_STATUS(AE_OK); |
| 348 | } | 341 | } |
| 349 | 342 | ||
| 350 | /******************************************************************************* | 343 | /******************************************************************************* |
| @@ -454,20 +447,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, | |||
| 454 | gpe_block-> | 447 | gpe_block-> |
| 455 | block_base_number]; | 448 | block_base_number]; |
| 456 | 449 | ||
| 457 | /* Mark GPE for WAKE-ONLY but WAKE_DISABLED */ | 450 | gpe_event_info->flags |= ACPI_GPE_CAN_WAKE; |
| 458 | |||
| 459 | gpe_event_info->flags &= | ||
| 460 | ~(ACPI_GPE_WAKE_ENABLED | ACPI_GPE_RUN_ENABLED); | ||
| 461 | |||
| 462 | status = | ||
| 463 | acpi_ev_set_gpe_type(gpe_event_info, ACPI_GPE_TYPE_WAKE); | ||
| 464 | if (ACPI_FAILURE(status)) { | ||
| 465 | goto cleanup; | ||
| 466 | } | ||
| 467 | |||
| 468 | status = | ||
| 469 | acpi_ev_update_gpe_enable_masks(gpe_event_info, | ||
| 470 | ACPI_GPE_DISABLE); | ||
| 471 | } | 451 | } |
| 472 | 452 | ||
| 473 | cleanup: | 453 | cleanup: |
| @@ -989,7 +969,6 @@ acpi_status | |||
| 989 | acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | 969 | acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, |
| 990 | struct acpi_gpe_block_info *gpe_block) | 970 | struct acpi_gpe_block_info *gpe_block) |
| 991 | { | 971 | { |
| 992 | acpi_status status; | ||
| 993 | struct acpi_gpe_event_info *gpe_event_info; | 972 | struct acpi_gpe_event_info *gpe_event_info; |
| 994 | struct acpi_gpe_walk_info gpe_info; | 973 | struct acpi_gpe_walk_info gpe_info; |
| 995 | u32 wake_gpe_count; | 974 | u32 wake_gpe_count; |
| @@ -1019,42 +998,50 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | |||
| 1019 | gpe_info.gpe_block = gpe_block; | 998 | gpe_info.gpe_block = gpe_block; |
| 1020 | gpe_info.gpe_device = gpe_device; | 999 | gpe_info.gpe_device = gpe_device; |
| 1021 | 1000 | ||
| 1022 | status = | 1001 | acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, |
| 1023 | acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, | ||
| 1024 | ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, | 1002 | ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, |
| 1025 | acpi_ev_match_prw_and_gpe, NULL, | 1003 | acpi_ev_match_prw_and_gpe, NULL, |
| 1026 | &gpe_info, NULL); | 1004 | &gpe_info, NULL); |
| 1027 | } | 1005 | } |
| 1028 | 1006 | ||
| 1029 | /* | 1007 | /* |
| 1030 | * Enable all GPEs in this block that have these attributes: | 1008 | * Enable all GPEs that have a corresponding method and aren't |
| 1031 | * 1) are "runtime" or "run/wake" GPEs, and | 1009 | * capable of generating wakeups. Any other GPEs within this block |
| 1032 | * 2) have a corresponding _Lxx or _Exx method | 1010 | * must be enabled via the acpi_enable_gpe() interface. |
| 1033 | * | ||
| 1034 | * Any other GPEs within this block must be enabled via the | ||
| 1035 | * acpi_enable_gpe() external interface. | ||
| 1036 | */ | 1011 | */ |
| 1037 | wake_gpe_count = 0; | 1012 | wake_gpe_count = 0; |
| 1038 | gpe_enabled_count = 0; | 1013 | gpe_enabled_count = 0; |
| 1014 | if (gpe_device == acpi_gbl_fadt_gpe_device) | ||
| 1015 | gpe_device = NULL; | ||
| 1039 | 1016 | ||
| 1040 | for (i = 0; i < gpe_block->register_count; i++) { | 1017 | for (i = 0; i < gpe_block->register_count; i++) { |
| 1041 | for (j = 0; j < 8; j++) { | 1018 | for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { |
| 1019 | acpi_status status; | ||
| 1020 | acpi_size gpe_index; | ||
| 1021 | int gpe_number; | ||
| 1042 | 1022 | ||
| 1043 | /* Get the info block for this particular GPE */ | 1023 | /* Get the info block for this particular GPE */ |
| 1024 | gpe_index = (acpi_size)i * ACPI_GPE_REGISTER_WIDTH + j; | ||
| 1025 | gpe_event_info = &gpe_block->event_info[gpe_index]; | ||
| 1044 | 1026 | ||
| 1045 | gpe_event_info = &gpe_block->event_info[((acpi_size) i * | 1027 | if (gpe_event_info->flags & ACPI_GPE_CAN_WAKE) { |
| 1046 | ACPI_GPE_REGISTER_WIDTH) | ||
| 1047 | + j]; | ||
| 1048 | |||
| 1049 | if (((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == | ||
| 1050 | ACPI_GPE_DISPATCH_METHOD) && | ||
| 1051 | (gpe_event_info->flags & ACPI_GPE_TYPE_RUNTIME)) { | ||
| 1052 | gpe_enabled_count++; | ||
| 1053 | } | ||
| 1054 | |||
| 1055 | if (gpe_event_info->flags & ACPI_GPE_TYPE_WAKE) { | ||
| 1056 | wake_gpe_count++; | 1028 | wake_gpe_count++; |
| 1029 | if (acpi_gbl_leave_wake_gpes_disabled) | ||
| 1030 | continue; | ||
| 1057 | } | 1031 | } |
| 1032 | |||
| 1033 | if (!(gpe_event_info->flags & ACPI_GPE_DISPATCH_METHOD)) | ||
| 1034 | continue; | ||
| 1035 | |||
| 1036 | gpe_number = gpe_index + gpe_block->block_base_number; | ||
| 1037 | status = acpi_enable_gpe(gpe_device, gpe_number, | ||
| 1038 | ACPI_GPE_TYPE_RUNTIME); | ||
| 1039 | if (ACPI_FAILURE(status)) | ||
| 1040 | ACPI_ERROR((AE_INFO, | ||
| 1041 | "Failed to enable GPE %02X\n", | ||
| 1042 | gpe_number)); | ||
| 1043 | else | ||
| 1044 | gpe_enabled_count++; | ||
| 1058 | } | 1045 | } |
| 1059 | } | 1046 | } |
| 1060 | 1047 | ||
| @@ -1062,15 +1049,7 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | |||
| 1062 | "Found %u Wake, Enabled %u Runtime GPEs in this block\n", | 1049 | "Found %u Wake, Enabled %u Runtime GPEs in this block\n", |
| 1063 | wake_gpe_count, gpe_enabled_count)); | 1050 | wake_gpe_count, gpe_enabled_count)); |
| 1064 | 1051 | ||
| 1065 | /* Enable all valid runtime GPEs found above */ | 1052 | return_ACPI_STATUS(AE_OK); |
| 1066 | |||
| 1067 | status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block, NULL); | ||
| 1068 | if (ACPI_FAILURE(status)) { | ||
| 1069 | ACPI_ERROR((AE_INFO, "Could not enable GPEs in GpeBlock %p", | ||
| 1070 | gpe_block)); | ||
| 1071 | } | ||
| 1072 | |||
| 1073 | return_ACPI_STATUS(status); | ||
| 1074 | } | 1053 | } |
| 1075 | 1054 | ||
| 1076 | /******************************************************************************* | 1055 | /******************************************************************************* |
diff --git a/drivers/acpi/acpica/evmisc.c b/drivers/acpi/acpica/evmisc.c index ce224e1eaa89..9a3cb7045a32 100644 --- a/drivers/acpi/acpica/evmisc.c +++ b/drivers/acpi/acpica/evmisc.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -259,9 +259,15 @@ static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context) | |||
| 259 | 259 | ||
| 260 | handler_obj = notify_info->notify.handler_obj; | 260 | handler_obj = notify_info->notify.handler_obj; |
| 261 | if (handler_obj) { | 261 | if (handler_obj) { |
| 262 | handler_obj->notify.handler(notify_info->notify.node, | 262 | struct acpi_object_notify_handler *notifier; |
| 263 | notify_info->notify.value, | 263 | |
| 264 | handler_obj->notify.context); | 264 | notifier = &handler_obj->notify; |
| 265 | while (notifier) { | ||
| 266 | notifier->handler(notify_info->notify.node, | ||
| 267 | notify_info->notify.value, | ||
| 268 | notifier->context); | ||
| 269 | notifier = notifier->next; | ||
| 270 | } | ||
| 265 | } | 271 | } |
| 266 | 272 | ||
| 267 | /* All done with the info object */ | 273 | /* All done with the info object */ |
diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c index 5336d911fbf0..98fd210e87b2 100644 --- a/drivers/acpi/acpica/evregion.c +++ b/drivers/acpi/acpica/evregion.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -329,7 +329,7 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) | |||
| 329 | * region_offset - Where in the region to read or write | 329 | * region_offset - Where in the region to read or write |
| 330 | * bit_width - Field width in bits (8, 16, 32, or 64) | 330 | * bit_width - Field width in bits (8, 16, 32, or 64) |
| 331 | * Value - Pointer to in or out value, must be | 331 | * Value - Pointer to in or out value, must be |
| 332 | * full 64-bit acpi_integer | 332 | * a full 64-bit integer |
| 333 | * | 333 | * |
| 334 | * RETURN: Status | 334 | * RETURN: Status |
| 335 | * | 335 | * |
| @@ -341,8 +341,7 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) | |||
| 341 | acpi_status | 341 | acpi_status |
| 342 | acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | 342 | acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, |
| 343 | u32 function, | 343 | u32 function, |
| 344 | u32 region_offset, | 344 | u32 region_offset, u32 bit_width, u64 *value) |
| 345 | u32 bit_width, acpi_integer * value) | ||
| 346 | { | 345 | { |
| 347 | acpi_status status; | 346 | acpi_status status; |
| 348 | acpi_adr_space_handler handler; | 347 | acpi_adr_space_handler handler; |
diff --git a/drivers/acpi/acpica/evrgnini.c b/drivers/acpi/acpica/evrgnini.c index ff168052a332..2e3b0334072f 100644 --- a/drivers/acpi/acpica/evrgnini.c +++ b/drivers/acpi/acpica/evrgnini.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -168,7 +168,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
| 168 | void *handler_context, void **region_context) | 168 | void *handler_context, void **region_context) |
| 169 | { | 169 | { |
| 170 | acpi_status status = AE_OK; | 170 | acpi_status status = AE_OK; |
| 171 | acpi_integer pci_value; | 171 | u64 pci_value; |
| 172 | struct acpi_pci_id *pci_id = *region_context; | 172 | struct acpi_pci_id *pci_id = *region_context; |
| 173 | union acpi_operand_object *handler_obj; | 173 | union acpi_operand_object *handler_obj; |
| 174 | struct acpi_namespace_node *parent_node; | 174 | struct acpi_namespace_node *parent_node; |
diff --git a/drivers/acpi/acpica/evsci.c b/drivers/acpi/acpica/evsci.c index 567b356c85af..8dfbaa96e422 100644 --- a/drivers/acpi/acpica/evsci.c +++ b/drivers/acpi/acpica/evsci.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | ******************************************************************************/ | 6 | ******************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/evxface.c b/drivers/acpi/acpica/evxface.c index 2fe0809d4eb2..b40757955f9b 100644 --- a/drivers/acpi/acpica/evxface.c +++ b/drivers/acpi/acpica/evxface.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -218,6 +218,72 @@ ACPI_EXPORT_SYMBOL(acpi_remove_fixed_event_handler) | |||
| 218 | 218 | ||
| 219 | /******************************************************************************* | 219 | /******************************************************************************* |
| 220 | * | 220 | * |
| 221 | * FUNCTION: acpi_populate_handler_object | ||
| 222 | * | ||
| 223 | * PARAMETERS: handler_obj - Handler object to populate | ||
| 224 | * handler_type - The type of handler: | ||
| 225 | * ACPI_SYSTEM_NOTIFY: system_handler (00-7f) | ||
| 226 | * ACPI_DEVICE_NOTIFY: driver_handler (80-ff) | ||
| 227 | * ACPI_ALL_NOTIFY: both system and device | ||
| 228 | * handler - Address of the handler | ||
| 229 | * context - Value passed to the handler on each GPE | ||
| 230 | * next - Address of a handler object to link to | ||
| 231 | * | ||
| 232 | * RETURN: None | ||
| 233 | * | ||
| 234 | * DESCRIPTION: Populate a handler object. | ||
| 235 | * | ||
| 236 | ******************************************************************************/ | ||
| 237 | static void | ||
| 238 | acpi_populate_handler_object(struct acpi_object_notify_handler *handler_obj, | ||
| 239 | u32 handler_type, | ||
| 240 | acpi_notify_handler handler, void *context, | ||
| 241 | struct acpi_object_notify_handler *next) | ||
| 242 | { | ||
| 243 | handler_obj->handler_type = handler_type; | ||
| 244 | handler_obj->handler = handler; | ||
| 245 | handler_obj->context = context; | ||
| 246 | handler_obj->next = next; | ||
| 247 | } | ||
| 248 | |||
| 249 | /******************************************************************************* | ||
| 250 | * | ||
| 251 | * FUNCTION: acpi_add_handler_object | ||
| 252 | * | ||
| 253 | * PARAMETERS: parent_obj - Parent of the new object | ||
| 254 | * handler - Address of the handler | ||
| 255 | * context - Value passed to the handler on each GPE | ||
| 256 | * | ||
| 257 | * RETURN: Status | ||
| 258 | * | ||
| 259 | * DESCRIPTION: Create a new handler object and populate it. | ||
| 260 | * | ||
| 261 | ******************************************************************************/ | ||
| 262 | static acpi_status | ||
| 263 | acpi_add_handler_object(struct acpi_object_notify_handler *parent_obj, | ||
| 264 | acpi_notify_handler handler, void *context) | ||
| 265 | { | ||
| 266 | struct acpi_object_notify_handler *handler_obj; | ||
| 267 | |||
| 268 | /* The parent must not be a defice notify handler object. */ | ||
| 269 | if (parent_obj->handler_type & ACPI_DEVICE_NOTIFY) | ||
| 270 | return AE_BAD_PARAMETER; | ||
| 271 | |||
| 272 | handler_obj = ACPI_ALLOCATE_ZEROED(sizeof(*handler_obj)); | ||
| 273 | if (!handler_obj) | ||
| 274 | return AE_NO_MEMORY; | ||
| 275 | |||
| 276 | acpi_populate_handler_object(handler_obj, | ||
| 277 | ACPI_SYSTEM_NOTIFY, | ||
| 278 | handler, context, | ||
| 279 | parent_obj->next); | ||
| 280 | parent_obj->next = handler_obj; | ||
| 281 | |||
| 282 | return AE_OK; | ||
| 283 | } | ||
| 284 | |||
| 285 | /******************************************************************************* | ||
| 286 | * | ||
| 221 | * FUNCTION: acpi_install_notify_handler | 287 | * FUNCTION: acpi_install_notify_handler |
| 222 | * | 288 | * |
| 223 | * PARAMETERS: Device - The device for which notifies will be handled | 289 | * PARAMETERS: Device - The device for which notifies will be handled |
| @@ -316,15 +382,32 @@ acpi_install_notify_handler(acpi_handle device, | |||
| 316 | obj_desc = acpi_ns_get_attached_object(node); | 382 | obj_desc = acpi_ns_get_attached_object(node); |
| 317 | if (obj_desc) { | 383 | if (obj_desc) { |
| 318 | 384 | ||
| 319 | /* Object exists - make sure there's no handler */ | 385 | /* Object exists. */ |
| 320 | 386 | ||
| 321 | if (((handler_type & ACPI_SYSTEM_NOTIFY) && | 387 | /* For a device notify, make sure there's no handler. */ |
| 322 | obj_desc->common_notify.system_notify) || | 388 | if ((handler_type & ACPI_DEVICE_NOTIFY) && |
| 323 | ((handler_type & ACPI_DEVICE_NOTIFY) && | 389 | obj_desc->common_notify.device_notify) { |
| 324 | obj_desc->common_notify.device_notify)) { | ||
| 325 | status = AE_ALREADY_EXISTS; | 390 | status = AE_ALREADY_EXISTS; |
| 326 | goto unlock_and_exit; | 391 | goto unlock_and_exit; |
| 327 | } | 392 | } |
| 393 | |||
| 394 | /* System notifies may have more handlers installed. */ | ||
| 395 | notify_obj = obj_desc->common_notify.system_notify; | ||
| 396 | |||
| 397 | if ((handler_type & ACPI_SYSTEM_NOTIFY) && notify_obj) { | ||
| 398 | struct acpi_object_notify_handler *parent_obj; | ||
| 399 | |||
| 400 | if (handler_type & ACPI_DEVICE_NOTIFY) { | ||
| 401 | status = AE_ALREADY_EXISTS; | ||
| 402 | goto unlock_and_exit; | ||
| 403 | } | ||
| 404 | |||
| 405 | parent_obj = ¬ify_obj->notify; | ||
| 406 | status = acpi_add_handler_object(parent_obj, | ||
| 407 | handler, | ||
| 408 | context); | ||
| 409 | goto unlock_and_exit; | ||
| 410 | } | ||
| 328 | } else { | 411 | } else { |
| 329 | /* Create a new object */ | 412 | /* Create a new object */ |
| 330 | 413 | ||
| @@ -356,9 +439,10 @@ acpi_install_notify_handler(acpi_handle device, | |||
| 356 | goto unlock_and_exit; | 439 | goto unlock_and_exit; |
| 357 | } | 440 | } |
| 358 | 441 | ||
| 359 | notify_obj->notify.node = node; | 442 | acpi_populate_handler_object(¬ify_obj->notify, |
| 360 | notify_obj->notify.handler = handler; | 443 | handler_type, |
| 361 | notify_obj->notify.context = context; | 444 | handler, context, |
| 445 | NULL); | ||
| 362 | 446 | ||
| 363 | if (handler_type & ACPI_SYSTEM_NOTIFY) { | 447 | if (handler_type & ACPI_SYSTEM_NOTIFY) { |
| 364 | obj_desc->common_notify.system_notify = notify_obj; | 448 | obj_desc->common_notify.system_notify = notify_obj; |
| @@ -418,6 +502,10 @@ acpi_remove_notify_handler(acpi_handle device, | |||
| 418 | goto exit; | 502 | goto exit; |
| 419 | } | 503 | } |
| 420 | 504 | ||
| 505 | |||
| 506 | /* Make sure all deferred tasks are completed */ | ||
| 507 | acpi_os_wait_events_complete(NULL); | ||
| 508 | |||
| 421 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 509 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
| 422 | if (ACPI_FAILURE(status)) { | 510 | if (ACPI_FAILURE(status)) { |
| 423 | goto exit; | 511 | goto exit; |
| @@ -445,15 +533,6 @@ acpi_remove_notify_handler(acpi_handle device, | |||
| 445 | goto unlock_and_exit; | 533 | goto unlock_and_exit; |
| 446 | } | 534 | } |
| 447 | 535 | ||
| 448 | /* Make sure all deferred tasks are completed */ | ||
| 449 | |||
| 450 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
| 451 | acpi_os_wait_events_complete(NULL); | ||
| 452 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | ||
| 453 | if (ACPI_FAILURE(status)) { | ||
| 454 | goto exit; | ||
| 455 | } | ||
| 456 | |||
| 457 | if (handler_type & ACPI_SYSTEM_NOTIFY) { | 536 | if (handler_type & ACPI_SYSTEM_NOTIFY) { |
| 458 | acpi_gbl_system_notify.node = NULL; | 537 | acpi_gbl_system_notify.node = NULL; |
| 459 | acpi_gbl_system_notify.handler = NULL; | 538 | acpi_gbl_system_notify.handler = NULL; |
| @@ -488,28 +567,60 @@ acpi_remove_notify_handler(acpi_handle device, | |||
| 488 | /* Object exists - make sure there's an existing handler */ | 567 | /* Object exists - make sure there's an existing handler */ |
| 489 | 568 | ||
| 490 | if (handler_type & ACPI_SYSTEM_NOTIFY) { | 569 | if (handler_type & ACPI_SYSTEM_NOTIFY) { |
| 570 | struct acpi_object_notify_handler *handler_obj; | ||
| 571 | struct acpi_object_notify_handler *parent_obj; | ||
| 572 | |||
| 491 | notify_obj = obj_desc->common_notify.system_notify; | 573 | notify_obj = obj_desc->common_notify.system_notify; |
| 492 | if (!notify_obj) { | 574 | if (!notify_obj) { |
| 493 | status = AE_NOT_EXIST; | 575 | status = AE_NOT_EXIST; |
| 494 | goto unlock_and_exit; | 576 | goto unlock_and_exit; |
| 495 | } | 577 | } |
| 496 | 578 | ||
| 497 | if (notify_obj->notify.handler != handler) { | 579 | handler_obj = ¬ify_obj->notify; |
| 580 | parent_obj = NULL; | ||
| 581 | while (handler_obj->handler != handler) { | ||
| 582 | if (handler_obj->next) { | ||
| 583 | parent_obj = handler_obj; | ||
| 584 | handler_obj = handler_obj->next; | ||
| 585 | } else { | ||
| 586 | break; | ||
| 587 | } | ||
| 588 | } | ||
| 589 | |||
| 590 | if (handler_obj->handler != handler) { | ||
| 498 | status = AE_BAD_PARAMETER; | 591 | status = AE_BAD_PARAMETER; |
| 499 | goto unlock_and_exit; | 592 | goto unlock_and_exit; |
| 500 | } | 593 | } |
| 501 | /* Make sure all deferred tasks are completed */ | ||
| 502 | 594 | ||
| 503 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 595 | /* |
| 504 | acpi_os_wait_events_complete(NULL); | 596 | * Remove the handler. There are three possible cases. |
| 505 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 597 | * First, we may need to remove a non-embedded object. |
| 506 | if (ACPI_FAILURE(status)) { | 598 | * Second, we may need to remove the embedded object's |
| 507 | goto exit; | 599 | * handler data, while non-embedded objects exist. |
| 600 | * Finally, we may need to remove the embedded object | ||
| 601 | * entirely along with its container. | ||
| 602 | */ | ||
| 603 | if (parent_obj) { | ||
| 604 | /* Non-embedded object is being removed. */ | ||
| 605 | parent_obj->next = handler_obj->next; | ||
| 606 | ACPI_FREE(handler_obj); | ||
| 607 | } else if (notify_obj->notify.next) { | ||
| 608 | /* | ||
| 609 | * The handler matches the embedded object, but | ||
| 610 | * there are more handler objects in the list. | ||
| 611 | * Replace the embedded object's data with the | ||
| 612 | * first next object's data and remove that | ||
| 613 | * object. | ||
| 614 | */ | ||
| 615 | parent_obj = ¬ify_obj->notify; | ||
| 616 | handler_obj = notify_obj->notify.next; | ||
| 617 | *parent_obj = *handler_obj; | ||
| 618 | ACPI_FREE(handler_obj); | ||
| 619 | } else { | ||
| 620 | /* No more handler objects in the list. */ | ||
| 621 | obj_desc->common_notify.system_notify = NULL; | ||
| 622 | acpi_ut_remove_reference(notify_obj); | ||
| 508 | } | 623 | } |
| 509 | |||
| 510 | /* Remove the handler */ | ||
| 511 | obj_desc->common_notify.system_notify = NULL; | ||
| 512 | acpi_ut_remove_reference(notify_obj); | ||
| 513 | } | 624 | } |
| 514 | 625 | ||
| 515 | if (handler_type & ACPI_DEVICE_NOTIFY) { | 626 | if (handler_type & ACPI_DEVICE_NOTIFY) { |
| @@ -523,14 +634,6 @@ acpi_remove_notify_handler(acpi_handle device, | |||
| 523 | status = AE_BAD_PARAMETER; | 634 | status = AE_BAD_PARAMETER; |
| 524 | goto unlock_and_exit; | 635 | goto unlock_and_exit; |
| 525 | } | 636 | } |
| 526 | /* Make sure all deferred tasks are completed */ | ||
| 527 | |||
| 528 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
| 529 | acpi_os_wait_events_complete(NULL); | ||
| 530 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | ||
| 531 | if (ACPI_FAILURE(status)) { | ||
| 532 | goto exit; | ||
| 533 | } | ||
| 534 | 637 | ||
| 535 | /* Remove the handler */ | 638 | /* Remove the handler */ |
| 536 | obj_desc->common_notify.device_notify = NULL; | 639 | obj_desc->common_notify.device_notify = NULL; |
| @@ -617,13 +720,6 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
| 617 | handler->context = context; | 720 | handler->context = context; |
| 618 | handler->method_node = gpe_event_info->dispatch.method_node; | 721 | handler->method_node = gpe_event_info->dispatch.method_node; |
| 619 | 722 | ||
| 620 | /* Disable the GPE before installing the handler */ | ||
| 621 | |||
| 622 | status = acpi_ev_disable_gpe(gpe_event_info); | ||
| 623 | if (ACPI_FAILURE(status)) { | ||
| 624 | goto unlock_and_exit; | ||
| 625 | } | ||
| 626 | |||
| 627 | /* Install the handler */ | 723 | /* Install the handler */ |
| 628 | 724 | ||
| 629 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | 725 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
| @@ -707,13 +803,6 @@ acpi_remove_gpe_handler(acpi_handle gpe_device, | |||
| 707 | goto unlock_and_exit; | 803 | goto unlock_and_exit; |
| 708 | } | 804 | } |
| 709 | 805 | ||
| 710 | /* Disable the GPE before removing the handler */ | ||
| 711 | |||
| 712 | status = acpi_ev_disable_gpe(gpe_event_info); | ||
| 713 | if (ACPI_FAILURE(status)) { | ||
| 714 | goto unlock_and_exit; | ||
| 715 | } | ||
| 716 | |||
| 717 | /* Make sure all deferred tasks are completed */ | 806 | /* Make sure all deferred tasks are completed */ |
| 718 | 807 | ||
| 719 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); | 808 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
diff --git a/drivers/acpi/acpica/evxfevnt.c b/drivers/acpi/acpica/evxfevnt.c index eed7a38d25f2..5ff32c78ea2d 100644 --- a/drivers/acpi/acpica/evxfevnt.c +++ b/drivers/acpi/acpica/evxfevnt.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -201,23 +201,27 @@ ACPI_EXPORT_SYMBOL(acpi_enable_event) | |||
| 201 | 201 | ||
| 202 | /******************************************************************************* | 202 | /******************************************************************************* |
| 203 | * | 203 | * |
| 204 | * FUNCTION: acpi_set_gpe_type | 204 | * FUNCTION: acpi_set_gpe |
| 205 | * | 205 | * |
| 206 | * PARAMETERS: gpe_device - Parent GPE Device | 206 | * PARAMETERS: gpe_device - Parent GPE Device |
| 207 | * gpe_number - GPE level within the GPE block | 207 | * gpe_number - GPE level within the GPE block |
| 208 | * Type - New GPE type | 208 | * action - Enable or disable |
| 209 | * Called from ISR or not | ||
| 209 | * | 210 | * |
| 210 | * RETURN: Status | 211 | * RETURN: Status |
| 211 | * | 212 | * |
| 212 | * DESCRIPTION: Set the type of an individual GPE | 213 | * DESCRIPTION: Enable or disable an ACPI event (general purpose) |
| 213 | * | 214 | * |
| 214 | ******************************************************************************/ | 215 | ******************************************************************************/ |
| 215 | acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type) | 216 | acpi_status acpi_set_gpe(acpi_handle gpe_device, u32 gpe_number, u8 action) |
| 216 | { | 217 | { |
| 217 | acpi_status status = AE_OK; | 218 | acpi_status status = AE_OK; |
| 219 | acpi_cpu_flags flags; | ||
| 218 | struct acpi_gpe_event_info *gpe_event_info; | 220 | struct acpi_gpe_event_info *gpe_event_info; |
| 219 | 221 | ||
| 220 | ACPI_FUNCTION_TRACE(acpi_set_gpe_type); | 222 | ACPI_FUNCTION_TRACE(acpi_set_gpe); |
| 223 | |||
| 224 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | ||
| 221 | 225 | ||
| 222 | /* Ensure that we have a valid GPE number */ | 226 | /* Ensure that we have a valid GPE number */ |
| 223 | 227 | ||
| @@ -227,19 +231,29 @@ acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type) | |||
| 227 | goto unlock_and_exit; | 231 | goto unlock_and_exit; |
| 228 | } | 232 | } |
| 229 | 233 | ||
| 230 | if ((gpe_event_info->flags & ACPI_GPE_TYPE_MASK) == type) { | 234 | /* Perform the action */ |
| 231 | return_ACPI_STATUS(AE_OK); | 235 | |
| 232 | } | 236 | switch (action) { |
| 237 | case ACPI_GPE_ENABLE: | ||
| 238 | status = acpi_ev_enable_gpe(gpe_event_info); | ||
| 239 | break; | ||
| 233 | 240 | ||
| 234 | /* Set the new type (will disable GPE if currently enabled) */ | 241 | case ACPI_GPE_DISABLE: |
| 242 | status = acpi_ev_disable_gpe(gpe_event_info); | ||
| 243 | break; | ||
| 235 | 244 | ||
| 236 | status = acpi_ev_set_gpe_type(gpe_event_info, type); | 245 | default: |
| 246 | ACPI_ERROR((AE_INFO, "Invalid action\n")); | ||
| 247 | status = AE_BAD_PARAMETER; | ||
| 248 | break; | ||
| 249 | } | ||
| 237 | 250 | ||
| 238 | unlock_and_exit: | 251 | unlock_and_exit: |
| 252 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | ||
| 239 | return_ACPI_STATUS(status); | 253 | return_ACPI_STATUS(status); |
| 240 | } | 254 | } |
| 241 | 255 | ||
| 242 | ACPI_EXPORT_SYMBOL(acpi_set_gpe_type) | 256 | ACPI_EXPORT_SYMBOL(acpi_set_gpe) |
| 243 | 257 | ||
| 244 | /******************************************************************************* | 258 | /******************************************************************************* |
| 245 | * | 259 | * |
| @@ -247,15 +261,14 @@ ACPI_EXPORT_SYMBOL(acpi_set_gpe_type) | |||
| 247 | * | 261 | * |
| 248 | * PARAMETERS: gpe_device - Parent GPE Device | 262 | * PARAMETERS: gpe_device - Parent GPE Device |
| 249 | * gpe_number - GPE level within the GPE block | 263 | * gpe_number - GPE level within the GPE block |
| 250 | * Flags - Just enable, or also wake enable? | 264 | * type - Purpose the GPE will be used for |
| 251 | * Called from ISR or not | ||
| 252 | * | 265 | * |
| 253 | * RETURN: Status | 266 | * RETURN: Status |
| 254 | * | 267 | * |
| 255 | * DESCRIPTION: Enable an ACPI event (general purpose) | 268 | * DESCRIPTION: Take a reference to a GPE and enable it if necessary |
| 256 | * | 269 | * |
| 257 | ******************************************************************************/ | 270 | ******************************************************************************/ |
| 258 | acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number) | 271 | acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 type) |
| 259 | { | 272 | { |
| 260 | acpi_status status = AE_OK; | 273 | acpi_status status = AE_OK; |
| 261 | acpi_cpu_flags flags; | 274 | acpi_cpu_flags flags; |
| @@ -263,6 +276,9 @@ acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number) | |||
| 263 | 276 | ||
| 264 | ACPI_FUNCTION_TRACE(acpi_enable_gpe); | 277 | ACPI_FUNCTION_TRACE(acpi_enable_gpe); |
| 265 | 278 | ||
| 279 | if (type & ~ACPI_GPE_TYPE_WAKE_RUN) | ||
| 280 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
| 281 | |||
| 266 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | 282 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
| 267 | 283 | ||
| 268 | /* Ensure that we have a valid GPE number */ | 284 | /* Ensure that we have a valid GPE number */ |
| @@ -273,15 +289,32 @@ acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number) | |||
| 273 | goto unlock_and_exit; | 289 | goto unlock_and_exit; |
| 274 | } | 290 | } |
| 275 | 291 | ||
| 276 | /* Perform the enable */ | 292 | if (type & ACPI_GPE_TYPE_RUNTIME) { |
| 293 | if (++gpe_event_info->runtime_count == 1) { | ||
| 294 | status = acpi_ev_enable_gpe(gpe_event_info); | ||
| 295 | if (ACPI_FAILURE(status)) | ||
| 296 | gpe_event_info->runtime_count--; | ||
| 297 | } | ||
| 298 | } | ||
| 299 | |||
| 300 | if (type & ACPI_GPE_TYPE_WAKE) { | ||
| 301 | if (!(gpe_event_info->flags & ACPI_GPE_CAN_WAKE)) { | ||
| 302 | status = AE_BAD_PARAMETER; | ||
| 303 | goto unlock_and_exit; | ||
| 304 | } | ||
| 277 | 305 | ||
| 278 | status = acpi_ev_enable_gpe(gpe_event_info, TRUE); | 306 | /* |
| 307 | * Wake-up GPEs are only enabled right prior to putting the | ||
| 308 | * system into a sleep state. | ||
| 309 | */ | ||
| 310 | if (++gpe_event_info->wakeup_count == 1) | ||
| 311 | acpi_ev_update_gpe_enable_masks(gpe_event_info); | ||
| 312 | } | ||
| 279 | 313 | ||
| 280 | unlock_and_exit: | 314 | unlock_and_exit: |
| 281 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | 315 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); |
| 282 | return_ACPI_STATUS(status); | 316 | return_ACPI_STATUS(status); |
| 283 | } | 317 | } |
| 284 | |||
| 285 | ACPI_EXPORT_SYMBOL(acpi_enable_gpe) | 318 | ACPI_EXPORT_SYMBOL(acpi_enable_gpe) |
| 286 | 319 | ||
| 287 | /******************************************************************************* | 320 | /******************************************************************************* |
| @@ -290,15 +323,14 @@ ACPI_EXPORT_SYMBOL(acpi_enable_gpe) | |||
| 290 | * | 323 | * |
| 291 | * PARAMETERS: gpe_device - Parent GPE Device | 324 | * PARAMETERS: gpe_device - Parent GPE Device |
| 292 | * gpe_number - GPE level within the GPE block | 325 | * gpe_number - GPE level within the GPE block |
| 293 | * Flags - Just disable, or also wake disable? | 326 | * type - Purpose the GPE won't be used for any more |
| 294 | * Called from ISR or not | ||
| 295 | * | 327 | * |
| 296 | * RETURN: Status | 328 | * RETURN: Status |
| 297 | * | 329 | * |
| 298 | * DESCRIPTION: Disable an ACPI event (general purpose) | 330 | * DESCRIPTION: Release a reference to a GPE and disable it if necessary |
| 299 | * | 331 | * |
| 300 | ******************************************************************************/ | 332 | ******************************************************************************/ |
| 301 | acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number) | 333 | acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 type) |
| 302 | { | 334 | { |
| 303 | acpi_status status = AE_OK; | 335 | acpi_status status = AE_OK; |
| 304 | acpi_cpu_flags flags; | 336 | acpi_cpu_flags flags; |
| @@ -306,6 +338,9 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number) | |||
| 306 | 338 | ||
| 307 | ACPI_FUNCTION_TRACE(acpi_disable_gpe); | 339 | ACPI_FUNCTION_TRACE(acpi_disable_gpe); |
| 308 | 340 | ||
| 341 | if (type & ~ACPI_GPE_TYPE_WAKE_RUN) | ||
| 342 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
| 343 | |||
| 309 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | 344 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
| 310 | /* Ensure that we have a valid GPE number */ | 345 | /* Ensure that we have a valid GPE number */ |
| 311 | 346 | ||
| @@ -315,13 +350,24 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number) | |||
| 315 | goto unlock_and_exit; | 350 | goto unlock_and_exit; |
| 316 | } | 351 | } |
| 317 | 352 | ||
| 318 | status = acpi_ev_disable_gpe(gpe_event_info); | 353 | if ((type & ACPI_GPE_TYPE_RUNTIME) && gpe_event_info->runtime_count) { |
| 354 | if (--gpe_event_info->runtime_count == 0) | ||
| 355 | status = acpi_ev_disable_gpe(gpe_event_info); | ||
| 356 | } | ||
| 357 | |||
| 358 | if ((type & ACPI_GPE_TYPE_WAKE) && gpe_event_info->wakeup_count) { | ||
| 359 | /* | ||
| 360 | * Wake-up GPEs are not enabled after leaving system sleep | ||
| 361 | * states, so we don't need to disable them here. | ||
| 362 | */ | ||
| 363 | if (--gpe_event_info->wakeup_count == 0) | ||
| 364 | acpi_ev_update_gpe_enable_masks(gpe_event_info); | ||
| 365 | } | ||
| 319 | 366 | ||
| 320 | unlock_and_exit: | 367 | unlock_and_exit: |
| 321 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | 368 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); |
| 322 | return_ACPI_STATUS(status); | 369 | return_ACPI_STATUS(status); |
| 323 | } | 370 | } |
| 324 | |||
| 325 | ACPI_EXPORT_SYMBOL(acpi_disable_gpe) | 371 | ACPI_EXPORT_SYMBOL(acpi_disable_gpe) |
| 326 | 372 | ||
| 327 | /******************************************************************************* | 373 | /******************************************************************************* |
diff --git a/drivers/acpi/acpica/evxfregn.c b/drivers/acpi/acpica/evxfregn.c index c98aa7c2d67c..541cbc1544d5 100644 --- a/drivers/acpi/acpica/evxfregn.c +++ b/drivers/acpi/acpica/evxfregn.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exconfig.c b/drivers/acpi/acpica/exconfig.c index 46adfa541cbc..7e8b3bedc376 100644 --- a/drivers/acpi/acpica/exconfig.c +++ b/drivers/acpi/acpica/exconfig.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -284,7 +284,7 @@ static acpi_status | |||
| 284 | acpi_ex_region_read(union acpi_operand_object *obj_desc, u32 length, u8 *buffer) | 284 | acpi_ex_region_read(union acpi_operand_object *obj_desc, u32 length, u8 *buffer) |
| 285 | { | 285 | { |
| 286 | acpi_status status; | 286 | acpi_status status; |
| 287 | acpi_integer value; | 287 | u64 value; |
| 288 | u32 region_offset = 0; | 288 | u32 region_offset = 0; |
| 289 | u32 i; | 289 | u32 i; |
| 290 | 290 | ||
| @@ -490,7 +490,11 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
| 490 | 490 | ||
| 491 | status = acpi_tb_add_table(&table_desc, &table_index); | 491 | status = acpi_tb_add_table(&table_desc, &table_index); |
| 492 | if (ACPI_FAILURE(status)) { | 492 | if (ACPI_FAILURE(status)) { |
| 493 | goto cleanup; | 493 | |
| 494 | /* Delete allocated table buffer */ | ||
| 495 | |||
| 496 | acpi_tb_delete_table(&table_desc); | ||
| 497 | return_ACPI_STATUS(status); | ||
| 494 | } | 498 | } |
| 495 | 499 | ||
| 496 | /* | 500 | /* |
| @@ -533,13 +537,6 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
| 533 | acpi_gbl_table_handler_context); | 537 | acpi_gbl_table_handler_context); |
| 534 | } | 538 | } |
| 535 | 539 | ||
| 536 | cleanup: | ||
| 537 | if (ACPI_FAILURE(status)) { | ||
| 538 | |||
| 539 | /* Delete allocated table buffer */ | ||
| 540 | |||
| 541 | acpi_tb_delete_table(&table_desc); | ||
| 542 | } | ||
| 543 | return_ACPI_STATUS(status); | 540 | return_ACPI_STATUS(status); |
| 544 | } | 541 | } |
| 545 | 542 | ||
diff --git a/drivers/acpi/acpica/exconvrt.c b/drivers/acpi/acpica/exconvrt.c index 51d5f224f9fa..bda7aed0404b 100644 --- a/drivers/acpi/acpica/exconvrt.c +++ b/drivers/acpi/acpica/exconvrt.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -51,8 +51,7 @@ ACPI_MODULE_NAME("exconvrt") | |||
| 51 | 51 | ||
| 52 | /* Local prototypes */ | 52 | /* Local prototypes */ |
| 53 | static u32 | 53 | static u32 |
| 54 | acpi_ex_convert_to_ascii(acpi_integer integer, | 54 | acpi_ex_convert_to_ascii(u64 integer, u16 base, u8 *string, u8 max_length); |
| 55 | u16 base, u8 * string, u8 max_length); | ||
| 56 | 55 | ||
| 57 | /******************************************************************************* | 56 | /******************************************************************************* |
| 58 | * | 57 | * |
| @@ -75,7 +74,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc, | |||
| 75 | { | 74 | { |
| 76 | union acpi_operand_object *return_desc; | 75 | union acpi_operand_object *return_desc; |
| 77 | u8 *pointer; | 76 | u8 *pointer; |
| 78 | acpi_integer result; | 77 | u64 result; |
| 79 | u32 i; | 78 | u32 i; |
| 80 | u32 count; | 79 | u32 count; |
| 81 | acpi_status status; | 80 | acpi_status status; |
| @@ -155,7 +154,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc, | |||
| 155 | * Little endian is used, meaning that the first byte of the buffer | 154 | * Little endian is used, meaning that the first byte of the buffer |
| 156 | * is the LSB of the integer | 155 | * is the LSB of the integer |
| 157 | */ | 156 | */ |
| 158 | result |= (((acpi_integer) pointer[i]) << (i * 8)); | 157 | result |= (((u64) pointer[i]) << (i * 8)); |
| 159 | } | 158 | } |
| 160 | break; | 159 | break; |
| 161 | 160 | ||
| @@ -285,10 +284,9 @@ acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc, | |||
| 285 | ******************************************************************************/ | 284 | ******************************************************************************/ |
| 286 | 285 | ||
| 287 | static u32 | 286 | static u32 |
| 288 | acpi_ex_convert_to_ascii(acpi_integer integer, | 287 | acpi_ex_convert_to_ascii(u64 integer, u16 base, u8 *string, u8 data_width) |
| 289 | u16 base, u8 * string, u8 data_width) | ||
| 290 | { | 288 | { |
| 291 | acpi_integer digit; | 289 | u64 digit; |
| 292 | u32 i; | 290 | u32 i; |
| 293 | u32 j; | 291 | u32 j; |
| 294 | u32 k = 0; | 292 | u32 k = 0; |
| @@ -531,10 +529,9 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc, | |||
| 531 | * (separated by commas or spaces) | 529 | * (separated by commas or spaces) |
| 532 | */ | 530 | */ |
| 533 | for (i = 0; i < obj_desc->buffer.length; i++) { | 531 | for (i = 0; i < obj_desc->buffer.length; i++) { |
| 534 | new_buf += acpi_ex_convert_to_ascii((acpi_integer) | 532 | new_buf += acpi_ex_convert_to_ascii((u64) obj_desc-> |
| 535 | obj_desc->buffer. | 533 | buffer.pointer[i], |
| 536 | pointer[i], base, | 534 | base, new_buf, 1); |
| 537 | new_buf, 1); | ||
| 538 | *new_buf++ = separator; /* each separated by a comma or space */ | 535 | *new_buf++ = separator; /* each separated by a comma or space */ |
| 539 | } | 536 | } |
| 540 | 537 | ||
diff --git a/drivers/acpi/acpica/excreate.c b/drivers/acpi/acpica/excreate.c index 02b25d233d99..0aa57d938698 100644 --- a/drivers/acpi/acpica/excreate.c +++ b/drivers/acpi/acpica/excreate.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exdump.c b/drivers/acpi/acpica/exdump.c index de3446372ddc..d39d438ba1e3 100644 --- a/drivers/acpi/acpica/exdump.c +++ b/drivers/acpi/acpica/exdump.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c index 1588a2d660e7..6c79fecbee42 100644 --- a/drivers/acpi/acpica/exfield.c +++ b/drivers/acpi/acpica/exfield.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -130,7 +130,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, | |||
| 130 | /* Call the region handler for the read */ | 130 | /* Call the region handler for the read */ |
| 131 | 131 | ||
| 132 | status = acpi_ex_access_region(obj_desc, 0, | 132 | status = acpi_ex_access_region(obj_desc, 0, |
| 133 | ACPI_CAST_PTR(acpi_integer, | 133 | ACPI_CAST_PTR(u64, |
| 134 | buffer_desc-> | 134 | buffer_desc-> |
| 135 | buffer.pointer), | 135 | buffer.pointer), |
| 136 | function); | 136 | function); |
| @@ -141,7 +141,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, | |||
| 141 | /* | 141 | /* |
| 142 | * Allocate a buffer for the contents of the field. | 142 | * Allocate a buffer for the contents of the field. |
| 143 | * | 143 | * |
| 144 | * If the field is larger than the size of an acpi_integer, create | 144 | * If the field is larger than the current integer width, create |
| 145 | * a BUFFER to hold it. Otherwise, use an INTEGER. This allows | 145 | * a BUFFER to hold it. Otherwise, use an INTEGER. This allows |
| 146 | * the use of arithmetic operators on the returned value if the | 146 | * the use of arithmetic operators on the returned value if the |
| 147 | * field size is equal or smaller than an Integer. | 147 | * field size is equal or smaller than an Integer. |
| @@ -306,8 +306,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
| 306 | * same buffer) | 306 | * same buffer) |
| 307 | */ | 307 | */ |
| 308 | status = acpi_ex_access_region(obj_desc, 0, | 308 | status = acpi_ex_access_region(obj_desc, 0, |
| 309 | (acpi_integer *) buffer, | 309 | (u64 *) buffer, function); |
| 310 | function); | ||
| 311 | acpi_ex_release_global_lock(obj_desc->common_field.field_flags); | 310 | acpi_ex_release_global_lock(obj_desc->common_field.field_flags); |
| 312 | 311 | ||
| 313 | *result_desc = buffer_desc; | 312 | *result_desc = buffer_desc; |
diff --git a/drivers/acpi/acpica/exfldio.c b/drivers/acpi/acpica/exfldio.c index d7b3b418fb45..f68a216168be 100644 --- a/drivers/acpi/acpica/exfldio.c +++ b/drivers/acpi/acpica/exfldio.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -55,11 +55,10 @@ ACPI_MODULE_NAME("exfldio") | |||
| 55 | static acpi_status | 55 | static acpi_status |
| 56 | acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, | 56 | acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, |
| 57 | u32 field_datum_byte_offset, | 57 | u32 field_datum_byte_offset, |
| 58 | acpi_integer * value, u32 read_write); | 58 | u64 *value, u32 read_write); |
| 59 | 59 | ||
| 60 | static u8 | 60 | static u8 |
| 61 | acpi_ex_register_overflow(union acpi_operand_object *obj_desc, | 61 | acpi_ex_register_overflow(union acpi_operand_object *obj_desc, u64 value); |
| 62 | acpi_integer value); | ||
| 63 | 62 | ||
| 64 | static acpi_status | 63 | static acpi_status |
| 65 | acpi_ex_setup_region(union acpi_operand_object *obj_desc, | 64 | acpi_ex_setup_region(union acpi_operand_object *obj_desc, |
| @@ -212,7 +211,7 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, | |||
| 212 | * field_datum_byte_offset - Byte offset of this datum within the | 211 | * field_datum_byte_offset - Byte offset of this datum within the |
| 213 | * parent field | 212 | * parent field |
| 214 | * Value - Where to store value (must at least | 213 | * Value - Where to store value (must at least |
| 215 | * the size of acpi_integer) | 214 | * 64 bits) |
| 216 | * Function - Read or Write flag plus other region- | 215 | * Function - Read or Write flag plus other region- |
| 217 | * dependent flags | 216 | * dependent flags |
| 218 | * | 217 | * |
| @@ -224,8 +223,7 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, | |||
| 224 | 223 | ||
| 225 | acpi_status | 224 | acpi_status |
| 226 | acpi_ex_access_region(union acpi_operand_object *obj_desc, | 225 | acpi_ex_access_region(union acpi_operand_object *obj_desc, |
| 227 | u32 field_datum_byte_offset, | 226 | u32 field_datum_byte_offset, u64 *value, u32 function) |
| 228 | acpi_integer * value, u32 function) | ||
| 229 | { | 227 | { |
| 230 | acpi_status status; | 228 | acpi_status status; |
| 231 | union acpi_operand_object *rgn_desc; | 229 | union acpi_operand_object *rgn_desc; |
| @@ -317,8 +315,7 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc, | |||
| 317 | ******************************************************************************/ | 315 | ******************************************************************************/ |
| 318 | 316 | ||
| 319 | static u8 | 317 | static u8 |
| 320 | acpi_ex_register_overflow(union acpi_operand_object *obj_desc, | 318 | acpi_ex_register_overflow(union acpi_operand_object *obj_desc, u64 value) |
| 321 | acpi_integer value) | ||
| 322 | { | 319 | { |
| 323 | 320 | ||
| 324 | if (obj_desc->common_field.bit_length >= ACPI_INTEGER_BIT_SIZE) { | 321 | if (obj_desc->common_field.bit_length >= ACPI_INTEGER_BIT_SIZE) { |
| @@ -329,7 +326,7 @@ acpi_ex_register_overflow(union acpi_operand_object *obj_desc, | |||
| 329 | return (FALSE); | 326 | return (FALSE); |
| 330 | } | 327 | } |
| 331 | 328 | ||
| 332 | if (value >= ((acpi_integer) 1 << obj_desc->common_field.bit_length)) { | 329 | if (value >= ((u64) 1 << obj_desc->common_field.bit_length)) { |
| 333 | /* | 330 | /* |
| 334 | * The Value is larger than the maximum value that can fit into | 331 | * The Value is larger than the maximum value that can fit into |
| 335 | * the register. | 332 | * the register. |
| @@ -362,11 +359,10 @@ acpi_ex_register_overflow(union acpi_operand_object *obj_desc, | |||
| 362 | 359 | ||
| 363 | static acpi_status | 360 | static acpi_status |
| 364 | acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, | 361 | acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, |
| 365 | u32 field_datum_byte_offset, | 362 | u32 field_datum_byte_offset, u64 *value, u32 read_write) |
| 366 | acpi_integer * value, u32 read_write) | ||
| 367 | { | 363 | { |
| 368 | acpi_status status; | 364 | acpi_status status; |
| 369 | acpi_integer local_value; | 365 | u64 local_value; |
| 370 | 366 | ||
| 371 | ACPI_FUNCTION_TRACE_U32(ex_field_datum_io, field_datum_byte_offset); | 367 | ACPI_FUNCTION_TRACE_U32(ex_field_datum_io, field_datum_byte_offset); |
| 372 | 368 | ||
| @@ -439,8 +435,8 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, | |||
| 439 | * the register | 435 | * the register |
| 440 | */ | 436 | */ |
| 441 | if (acpi_ex_register_overflow(obj_desc->bank_field.bank_obj, | 437 | if (acpi_ex_register_overflow(obj_desc->bank_field.bank_obj, |
| 442 | (acpi_integer) obj_desc-> | 438 | (u64) obj_desc->bank_field. |
| 443 | bank_field.value)) { | 439 | value)) { |
| 444 | return_ACPI_STATUS(AE_AML_REGISTER_LIMIT); | 440 | return_ACPI_STATUS(AE_AML_REGISTER_LIMIT); |
| 445 | } | 441 | } |
| 446 | 442 | ||
| @@ -481,8 +477,8 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, | |||
| 481 | * the register | 477 | * the register |
| 482 | */ | 478 | */ |
| 483 | if (acpi_ex_register_overflow(obj_desc->index_field.index_obj, | 479 | if (acpi_ex_register_overflow(obj_desc->index_field.index_obj, |
| 484 | (acpi_integer) obj_desc-> | 480 | (u64) obj_desc->index_field. |
| 485 | index_field.value)) { | 481 | value)) { |
| 486 | return_ACPI_STATUS(AE_AML_REGISTER_LIMIT); | 482 | return_ACPI_STATUS(AE_AML_REGISTER_LIMIT); |
| 487 | } | 483 | } |
| 488 | 484 | ||
| @@ -512,7 +508,7 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, | |||
| 512 | status = | 508 | status = |
| 513 | acpi_ex_extract_from_field(obj_desc->index_field. | 509 | acpi_ex_extract_from_field(obj_desc->index_field. |
| 514 | data_obj, value, | 510 | data_obj, value, |
| 515 | sizeof(acpi_integer)); | 511 | sizeof(u64)); |
| 516 | } else { | 512 | } else { |
| 517 | /* Write the datum to the data_register */ | 513 | /* Write the datum to the data_register */ |
| 518 | 514 | ||
| @@ -523,7 +519,7 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, | |||
| 523 | status = | 519 | status = |
| 524 | acpi_ex_insert_into_field(obj_desc->index_field. | 520 | acpi_ex_insert_into_field(obj_desc->index_field. |
| 525 | data_obj, value, | 521 | data_obj, value, |
| 526 | sizeof(acpi_integer)); | 522 | sizeof(u64)); |
| 527 | } | 523 | } |
| 528 | break; | 524 | break; |
| 529 | 525 | ||
| @@ -571,13 +567,12 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, | |||
| 571 | 567 | ||
| 572 | acpi_status | 568 | acpi_status |
| 573 | acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, | 569 | acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, |
| 574 | acpi_integer mask, | 570 | u64 mask, |
| 575 | acpi_integer field_value, | 571 | u64 field_value, u32 field_datum_byte_offset) |
| 576 | u32 field_datum_byte_offset) | ||
| 577 | { | 572 | { |
| 578 | acpi_status status = AE_OK; | 573 | acpi_status status = AE_OK; |
| 579 | acpi_integer merged_value; | 574 | u64 merged_value; |
| 580 | acpi_integer current_value; | 575 | u64 current_value; |
| 581 | 576 | ||
| 582 | ACPI_FUNCTION_TRACE_U32(ex_write_with_update_rule, mask); | 577 | ACPI_FUNCTION_TRACE_U32(ex_write_with_update_rule, mask); |
| 583 | 578 | ||
| @@ -587,7 +582,7 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, | |||
| 587 | 582 | ||
| 588 | /* If the mask is all ones, we don't need to worry about the update rule */ | 583 | /* If the mask is all ones, we don't need to worry about the update rule */ |
| 589 | 584 | ||
| 590 | if (mask != ACPI_INTEGER_MAX) { | 585 | if (mask != ACPI_UINT64_MAX) { |
| 591 | 586 | ||
| 592 | /* Decode the update rule */ | 587 | /* Decode the update rule */ |
| 593 | 588 | ||
| @@ -678,8 +673,8 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, | |||
| 678 | void *buffer, u32 buffer_length) | 673 | void *buffer, u32 buffer_length) |
| 679 | { | 674 | { |
| 680 | acpi_status status; | 675 | acpi_status status; |
| 681 | acpi_integer raw_datum; | 676 | u64 raw_datum; |
| 682 | acpi_integer merged_datum; | 677 | u64 merged_datum; |
| 683 | u32 field_offset = 0; | 678 | u32 field_offset = 0; |
| 684 | u32 buffer_offset = 0; | 679 | u32 buffer_offset = 0; |
| 685 | u32 buffer_tail_bits; | 680 | u32 buffer_tail_bits; |
| @@ -804,10 +799,10 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
| 804 | void *buffer, u32 buffer_length) | 799 | void *buffer, u32 buffer_length) |
| 805 | { | 800 | { |
| 806 | acpi_status status; | 801 | acpi_status status; |
| 807 | acpi_integer mask; | 802 | u64 mask; |
| 808 | acpi_integer width_mask; | 803 | u64 width_mask; |
| 809 | acpi_integer merged_datum; | 804 | u64 merged_datum; |
| 810 | acpi_integer raw_datum = 0; | 805 | u64 raw_datum = 0; |
| 811 | u32 field_offset = 0; | 806 | u32 field_offset = 0; |
| 812 | u32 buffer_offset = 0; | 807 | u32 buffer_offset = 0; |
| 813 | u32 buffer_tail_bits; | 808 | u32 buffer_tail_bits; |
| @@ -855,7 +850,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
| 855 | * shift operator | 850 | * shift operator |
| 856 | */ | 851 | */ |
| 857 | if (obj_desc->common_field.access_bit_width == ACPI_INTEGER_BIT_SIZE) { | 852 | if (obj_desc->common_field.access_bit_width == ACPI_INTEGER_BIT_SIZE) { |
| 858 | width_mask = ACPI_INTEGER_MAX; | 853 | width_mask = ACPI_UINT64_MAX; |
| 859 | } else { | 854 | } else { |
| 860 | width_mask = | 855 | width_mask = |
| 861 | ACPI_MASK_BITS_ABOVE(obj_desc->common_field. | 856 | ACPI_MASK_BITS_ABOVE(obj_desc->common_field. |
diff --git a/drivers/acpi/acpica/exmisc.c b/drivers/acpi/acpica/exmisc.c index 998eac329937..c5bb1eeed2df 100644 --- a/drivers/acpi/acpica/exmisc.c +++ b/drivers/acpi/acpica/exmisc.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
| @@ -409,8 +409,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, | |||
| 409 | * | 409 | * |
| 410 | ******************************************************************************/ | 410 | ******************************************************************************/ |
| 411 | 411 | ||
| 412 | acpi_integer | 412 | u64 acpi_ex_do_math_op(u16 opcode, u64 integer0, u64 integer1) |
| 413 | acpi_ex_do_math_op(u16 opcode, acpi_integer integer0, acpi_integer integer1) | ||
| 414 | { | 413 | { |
| 415 | 414 | ||
| 416 | ACPI_FUNCTION_ENTRY(); | 415 | ACPI_FUNCTION_ENTRY(); |
| @@ -498,8 +497,7 @@ acpi_ex_do_math_op(u16 opcode, acpi_integer integer0, acpi_integer integer1) | |||
| 498 | 497 | ||
| 499 | acpi_status | 498 | acpi_status |
| 500 | acpi_ex_do_logical_numeric_op(u16 opcode, | 499 | acpi_ex_do_logical_numeric_op(u16 opcode, |
| 501 | acpi_integer integer0, | 500 | u64 integer0, u64 integer1, u8 *logical_result) |
| 502 | acpi_integer integer1, u8 * logical_result) | ||
| 503 | { | 501 | { |
| 504 | acpi_status status = AE_OK; | 502 | acpi_status status = AE_OK; |
| 505 | u8 local_result = FALSE; | 503 | u8 local_result = FALSE; |
| @@ -564,8 +562,8 @@ acpi_ex_do_logical_op(u16 opcode, | |||
| 564 | union acpi_operand_object *operand1, u8 * logical_result) | 562 | union acpi_operand_object *operand1, u8 * logical_result) |
| 565 | { | 563 | { |
| 566 | union acpi_operand_object *local_operand1 = operand1; | 564 | union acpi_operand_object *local_operand1 = operand1; |
| 567 | acpi_integer integer0; | 565 | u64 integer0; |
| 568 | acpi_integer integer1; | 566 | u64 integer1; |
| 569 | u32 length0; | 567 | u32 length0; |
| 570 | u32 length1; | 568 | u32 length1; |
| 571 | acpi_status status = AE_OK; | 569 | acpi_status status = AE_OK; |
diff --git a/drivers/acpi/acpica/exmutex.c b/drivers/acpi/acpica/exmutex.c index 3c456bd575d0..7116bc86494d 100644 --- a/drivers/acpi/acpica/exmutex.c +++ b/drivers/acpi/acpica/exmutex.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
| @@ -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/acpica/exnames.c b/drivers/acpi/acpica/exnames.c index ffdae122d94a..679f308c5a89 100644 --- a/drivers/acpi/acpica/exnames.c +++ b/drivers/acpi/acpica/exnames.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exoparg1.c b/drivers/acpi/acpica/exoparg1.c index 752fe48b2d20..99adbab5acbf 100644 --- a/drivers/acpi/acpica/exoparg1.c +++ b/drivers/acpi/acpica/exoparg1.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
| @@ -261,8 +261,8 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
| 261 | union acpi_operand_object *return_desc2 = NULL; | 261 | union acpi_operand_object *return_desc2 = NULL; |
| 262 | u32 temp32; | 262 | u32 temp32; |
| 263 | u32 i; | 263 | u32 i; |
| 264 | acpi_integer power_of_ten; | 264 | u64 power_of_ten; |
| 265 | acpi_integer digit; | 265 | u64 digit; |
| 266 | 266 | ||
| 267 | ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_1T_1R, | 267 | ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_1T_1R, |
| 268 | acpi_ps_get_opcode_name(walk_state->opcode)); | 268 | acpi_ps_get_opcode_name(walk_state->opcode)); |
| @@ -362,7 +362,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
| 362 | /* Sum the digit into the result with the current power of 10 */ | 362 | /* Sum the digit into the result with the current power of 10 */ |
| 363 | 363 | ||
| 364 | return_desc->integer.value += | 364 | return_desc->integer.value += |
| 365 | (((acpi_integer) temp32) * power_of_ten); | 365 | (((u64) temp32) * power_of_ten); |
| 366 | 366 | ||
| 367 | /* Shift to next BCD digit */ | 367 | /* Shift to next BCD digit */ |
| 368 | 368 | ||
| @@ -392,7 +392,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
| 392 | * remainder from above | 392 | * remainder from above |
| 393 | */ | 393 | */ |
| 394 | return_desc->integer.value |= | 394 | return_desc->integer.value |= |
| 395 | (((acpi_integer) temp32) << ACPI_MUL_4(i)); | 395 | (((u64) temp32) << ACPI_MUL_4(i)); |
| 396 | } | 396 | } |
| 397 | 397 | ||
| 398 | /* Overflow if there is any data left in Digit */ | 398 | /* Overflow if there is any data left in Digit */ |
| @@ -439,7 +439,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
| 439 | 439 | ||
| 440 | /* The object exists in the namespace, return TRUE */ | 440 | /* The object exists in the namespace, return TRUE */ |
| 441 | 441 | ||
| 442 | return_desc->integer.value = ACPI_INTEGER_MAX; | 442 | return_desc->integer.value = ACPI_UINT64_MAX; |
| 443 | goto cleanup; | 443 | goto cleanup; |
| 444 | 444 | ||
| 445 | default: | 445 | default: |
| @@ -589,7 +589,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
| 589 | union acpi_operand_object *return_desc = NULL; | 589 | union acpi_operand_object *return_desc = NULL; |
| 590 | acpi_status status = AE_OK; | 590 | acpi_status status = AE_OK; |
| 591 | u32 type; | 591 | u32 type; |
| 592 | acpi_integer value; | 592 | u64 value; |
| 593 | 593 | ||
| 594 | ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_0T_1R, | 594 | ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_0T_1R, |
| 595 | acpi_ps_get_opcode_name(walk_state->opcode)); | 595 | acpi_ps_get_opcode_name(walk_state->opcode)); |
| @@ -610,7 +610,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
| 610 | * return_desc->Integer.Value is initially == 0 (FALSE) from above. | 610 | * return_desc->Integer.Value is initially == 0 (FALSE) from above. |
| 611 | */ | 611 | */ |
| 612 | if (!operand[0]->integer.value) { | 612 | if (!operand[0]->integer.value) { |
| 613 | return_desc->integer.value = ACPI_INTEGER_MAX; | 613 | return_desc->integer.value = ACPI_UINT64_MAX; |
| 614 | } | 614 | } |
| 615 | break; | 615 | break; |
| 616 | 616 | ||
diff --git a/drivers/acpi/acpica/exoparg2.c b/drivers/acpi/acpica/exoparg2.c index 85d95c92dfd3..22841bbbe63c 100644 --- a/drivers/acpi/acpica/exoparg2.c +++ b/drivers/acpi/acpica/exoparg2.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -282,7 +282,7 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) | |||
| 282 | { | 282 | { |
| 283 | union acpi_operand_object **operand = &walk_state->operands[0]; | 283 | union acpi_operand_object **operand = &walk_state->operands[0]; |
| 284 | union acpi_operand_object *return_desc = NULL; | 284 | union acpi_operand_object *return_desc = NULL; |
| 285 | acpi_integer index; | 285 | u64 index; |
| 286 | acpi_status status = AE_OK; | 286 | acpi_status status = AE_OK; |
| 287 | acpi_size length; | 287 | acpi_size length; |
| 288 | 288 | ||
| @@ -584,7 +584,7 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state) | |||
| 584 | * Default is FALSE (zero) | 584 | * Default is FALSE (zero) |
| 585 | */ | 585 | */ |
| 586 | if (logical_result) { | 586 | if (logical_result) { |
| 587 | return_desc->integer.value = ACPI_INTEGER_MAX; | 587 | return_desc->integer.value = ACPI_UINT64_MAX; |
| 588 | } | 588 | } |
| 589 | 589 | ||
| 590 | cleanup: | 590 | cleanup: |
diff --git a/drivers/acpi/acpica/exoparg3.c b/drivers/acpi/acpica/exoparg3.c index 253f9e122584..8bb1012ef44e 100644 --- a/drivers/acpi/acpica/exoparg3.c +++ b/drivers/acpi/acpica/exoparg3.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
| @@ -148,7 +148,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) | |||
| 148 | union acpi_operand_object *return_desc = NULL; | 148 | union acpi_operand_object *return_desc = NULL; |
| 149 | char *buffer = NULL; | 149 | char *buffer = NULL; |
| 150 | acpi_status status = AE_OK; | 150 | acpi_status status = AE_OK; |
| 151 | acpi_integer index; | 151 | u64 index; |
| 152 | acpi_size length; | 152 | acpi_size length; |
| 153 | 153 | ||
| 154 | ACPI_FUNCTION_TRACE_STR(ex_opcode_3A_1T_1R, | 154 | ACPI_FUNCTION_TRACE_STR(ex_opcode_3A_1T_1R, |
diff --git a/drivers/acpi/acpica/exoparg6.c b/drivers/acpi/acpica/exoparg6.c index 295542e6bd51..f256b6a25f2e 100644 --- a/drivers/acpi/acpica/exoparg6.c +++ b/drivers/acpi/acpica/exoparg6.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
| @@ -218,7 +218,7 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) | |||
| 218 | union acpi_operand_object **operand = &walk_state->operands[0]; | 218 | union acpi_operand_object **operand = &walk_state->operands[0]; |
| 219 | union acpi_operand_object *return_desc = NULL; | 219 | union acpi_operand_object *return_desc = NULL; |
| 220 | acpi_status status = AE_OK; | 220 | acpi_status status = AE_OK; |
| 221 | acpi_integer index; | 221 | u64 index; |
| 222 | union acpi_operand_object *this_element; | 222 | union acpi_operand_object *this_element; |
| 223 | 223 | ||
| 224 | ACPI_FUNCTION_TRACE_STR(ex_opcode_6A_0T_1R, | 224 | ACPI_FUNCTION_TRACE_STR(ex_opcode_6A_0T_1R, |
| @@ -253,9 +253,9 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) | |||
| 253 | } | 253 | } |
| 254 | 254 | ||
| 255 | /* Create an integer for the return value */ | 255 | /* Create an integer for the return value */ |
| 256 | /* Default return value is ACPI_INTEGER_MAX if no match found */ | 256 | /* Default return value is ACPI_UINT64_MAX if no match found */ |
| 257 | 257 | ||
| 258 | return_desc = acpi_ut_create_integer_object(ACPI_INTEGER_MAX); | 258 | return_desc = acpi_ut_create_integer_object(ACPI_UINT64_MAX); |
| 259 | if (!return_desc) { | 259 | if (!return_desc) { |
| 260 | status = AE_NO_MEMORY; | 260 | status = AE_NO_MEMORY; |
| 261 | goto cleanup; | 261 | goto cleanup; |
| @@ -270,7 +270,7 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) | |||
| 270 | * | 270 | * |
| 271 | * Upon finding a match, the loop will terminate via "break" at | 271 | * Upon finding a match, the loop will terminate via "break" at |
| 272 | * the bottom. If it terminates "normally", match_value will be | 272 | * the bottom. If it terminates "normally", match_value will be |
| 273 | * ACPI_INTEGER_MAX (Ones) (its initial value) indicating that no | 273 | * ACPI_UINT64_MAX (Ones) (its initial value) indicating that no |
| 274 | * match was found. | 274 | * match was found. |
| 275 | */ | 275 | */ |
| 276 | for (; index < operand[0]->package.count; index++) { | 276 | for (; index < operand[0]->package.count; index++) { |
diff --git a/drivers/acpi/acpica/exprep.c b/drivers/acpi/acpica/exprep.c index 52fec07064f0..edf62bf5b266 100644 --- a/drivers/acpi/acpica/exprep.c +++ b/drivers/acpi/acpica/exprep.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exregion.c b/drivers/acpi/acpica/exregion.c index 2bd83ac57c3a..486b2e5661b6 100644 --- a/drivers/acpi/acpica/exregion.c +++ b/drivers/acpi/acpica/exregion.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
| @@ -70,7 +70,7 @@ acpi_status | |||
| 70 | acpi_ex_system_memory_space_handler(u32 function, | 70 | acpi_ex_system_memory_space_handler(u32 function, |
| 71 | acpi_physical_address address, | 71 | acpi_physical_address address, |
| 72 | u32 bit_width, | 72 | u32 bit_width, |
| 73 | acpi_integer * value, | 73 | u64 *value, |
| 74 | void *handler_context, void *region_context) | 74 | void *handler_context, void *region_context) |
| 75 | { | 75 | { |
| 76 | acpi_status status = AE_OK; | 76 | acpi_status status = AE_OK; |
| @@ -115,8 +115,7 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
| 115 | * Hardware does not support non-aligned data transfers, we must verify | 115 | * Hardware does not support non-aligned data transfers, we must verify |
| 116 | * the request. | 116 | * the request. |
| 117 | */ | 117 | */ |
| 118 | (void)acpi_ut_short_divide((acpi_integer) address, length, NULL, | 118 | (void)acpi_ut_short_divide((u64) address, length, NULL, &remainder); |
| 119 | &remainder); | ||
| 120 | if (remainder != 0) { | 119 | if (remainder != 0) { |
| 121 | return_ACPI_STATUS(AE_AML_ALIGNMENT); | 120 | return_ACPI_STATUS(AE_AML_ALIGNMENT); |
| 122 | } | 121 | } |
| @@ -128,10 +127,9 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
| 128 | * 2) Address beyond the current mapping? | 127 | * 2) Address beyond the current mapping? |
| 129 | */ | 128 | */ |
| 130 | if ((address < mem_info->mapped_physical_address) || | 129 | if ((address < mem_info->mapped_physical_address) || |
| 131 | (((acpi_integer) address + length) > ((acpi_integer) | 130 | (((u64) address + length) > ((u64) |
| 132 | mem_info-> | 131 | mem_info->mapped_physical_address + |
| 133 | mapped_physical_address + | 132 | mem_info->mapped_length))) { |
| 134 | mem_info->mapped_length))) { | ||
| 135 | /* | 133 | /* |
| 136 | * The request cannot be resolved by the current memory mapping; | 134 | * The request cannot be resolved by the current memory mapping; |
| 137 | * Delete the existing mapping and create a new one. | 135 | * Delete the existing mapping and create a new one. |
| @@ -193,8 +191,7 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
| 193 | * access | 191 | * access |
| 194 | */ | 192 | */ |
| 195 | logical_addr_ptr = mem_info->mapped_logical_address + | 193 | logical_addr_ptr = mem_info->mapped_logical_address + |
| 196 | ((acpi_integer) address - | 194 | ((u64) address - (u64) mem_info->mapped_physical_address); |
| 197 | (acpi_integer) mem_info->mapped_physical_address); | ||
| 198 | 195 | ||
| 199 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 196 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 200 | "System-Memory (width %d) R/W %d Address=%8.8X%8.8X\n", | 197 | "System-Memory (width %d) R/W %d Address=%8.8X%8.8X\n", |
| @@ -215,19 +212,19 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
| 215 | *value = 0; | 212 | *value = 0; |
| 216 | switch (bit_width) { | 213 | switch (bit_width) { |
| 217 | case 8: | 214 | case 8: |
| 218 | *value = (acpi_integer) ACPI_GET8(logical_addr_ptr); | 215 | *value = (u64) ACPI_GET8(logical_addr_ptr); |
| 219 | break; | 216 | break; |
| 220 | 217 | ||
| 221 | case 16: | 218 | case 16: |
| 222 | *value = (acpi_integer) ACPI_GET16(logical_addr_ptr); | 219 | *value = (u64) ACPI_GET16(logical_addr_ptr); |
| 223 | break; | 220 | break; |
| 224 | 221 | ||
| 225 | case 32: | 222 | case 32: |
| 226 | *value = (acpi_integer) ACPI_GET32(logical_addr_ptr); | 223 | *value = (u64) ACPI_GET32(logical_addr_ptr); |
| 227 | break; | 224 | break; |
| 228 | 225 | ||
| 229 | case 64: | 226 | case 64: |
| 230 | *value = (acpi_integer) ACPI_GET64(logical_addr_ptr); | 227 | *value = (u64) ACPI_GET64(logical_addr_ptr); |
| 231 | break; | 228 | break; |
| 232 | 229 | ||
| 233 | default: | 230 | default: |
| @@ -291,7 +288,7 @@ acpi_status | |||
| 291 | acpi_ex_system_io_space_handler(u32 function, | 288 | acpi_ex_system_io_space_handler(u32 function, |
| 292 | acpi_physical_address address, | 289 | acpi_physical_address address, |
| 293 | u32 bit_width, | 290 | u32 bit_width, |
| 294 | acpi_integer * value, | 291 | u64 *value, |
| 295 | void *handler_context, void *region_context) | 292 | void *handler_context, void *region_context) |
| 296 | { | 293 | { |
| 297 | acpi_status status = AE_OK; | 294 | acpi_status status = AE_OK; |
| @@ -350,7 +347,7 @@ acpi_status | |||
| 350 | acpi_ex_pci_config_space_handler(u32 function, | 347 | acpi_ex_pci_config_space_handler(u32 function, |
| 351 | acpi_physical_address address, | 348 | acpi_physical_address address, |
| 352 | u32 bit_width, | 349 | u32 bit_width, |
| 353 | acpi_integer * value, | 350 | u64 *value, |
| 354 | void *handler_context, void *region_context) | 351 | void *handler_context, void *region_context) |
| 355 | { | 352 | { |
| 356 | acpi_status status = AE_OK; | 353 | acpi_status status = AE_OK; |
| @@ -425,7 +422,7 @@ acpi_status | |||
| 425 | acpi_ex_cmos_space_handler(u32 function, | 422 | acpi_ex_cmos_space_handler(u32 function, |
| 426 | acpi_physical_address address, | 423 | acpi_physical_address address, |
| 427 | u32 bit_width, | 424 | u32 bit_width, |
| 428 | acpi_integer * value, | 425 | u64 *value, |
| 429 | void *handler_context, void *region_context) | 426 | void *handler_context, void *region_context) |
| 430 | { | 427 | { |
| 431 | acpi_status status = AE_OK; | 428 | acpi_status status = AE_OK; |
| @@ -457,7 +454,7 @@ acpi_status | |||
| 457 | acpi_ex_pci_bar_space_handler(u32 function, | 454 | acpi_ex_pci_bar_space_handler(u32 function, |
| 458 | acpi_physical_address address, | 455 | acpi_physical_address address, |
| 459 | u32 bit_width, | 456 | u32 bit_width, |
| 460 | acpi_integer * value, | 457 | u64 *value, |
| 461 | void *handler_context, void *region_context) | 458 | void *handler_context, void *region_context) |
| 462 | { | 459 | { |
| 463 | acpi_status status = AE_OK; | 460 | acpi_status status = AE_OK; |
| @@ -489,7 +486,7 @@ acpi_status | |||
| 489 | acpi_ex_data_table_space_handler(u32 function, | 486 | acpi_ex_data_table_space_handler(u32 function, |
| 490 | acpi_physical_address address, | 487 | acpi_physical_address address, |
| 491 | u32 bit_width, | 488 | u32 bit_width, |
| 492 | acpi_integer * value, | 489 | u64 *value, |
| 493 | void *handler_context, void *region_context) | 490 | void *handler_context, void *region_context) |
| 494 | { | 491 | { |
| 495 | ACPI_FUNCTION_TRACE(ex_data_table_space_handler); | 492 | ACPI_FUNCTION_TRACE(ex_data_table_space_handler); |
diff --git a/drivers/acpi/acpica/exresnte.c b/drivers/acpi/acpica/exresnte.c index 607958ff467c..fdc1b27999ef 100644 --- a/drivers/acpi/acpica/exresnte.c +++ b/drivers/acpi/acpica/exresnte.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exresolv.c b/drivers/acpi/acpica/exresolv.c index c93b54ce7f78..fdd6a7079b97 100644 --- a/drivers/acpi/acpica/exresolv.c +++ b/drivers/acpi/acpica/exresolv.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exresop.c b/drivers/acpi/acpica/exresop.c index 5c729a9e9131..c5ecd615f145 100644 --- a/drivers/acpi/acpica/exresop.c +++ b/drivers/acpi/acpica/exresop.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exstore.c b/drivers/acpi/acpica/exstore.c index 6efd07a4f779..702b9ecfd44b 100644 --- a/drivers/acpi/acpica/exstore.c +++ b/drivers/acpi/acpica/exstore.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exstoren.c b/drivers/acpi/acpica/exstoren.c index 608e838d537e..d4af684620ca 100644 --- a/drivers/acpi/acpica/exstoren.c +++ b/drivers/acpi/acpica/exstoren.c | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | *****************************************************************************/ | 7 | *****************************************************************************/ |
| 8 | 8 | ||
| 9 | /* | 9 | /* |
| 10 | * Copyright (C) 2000 - 2008, Intel Corp. | 10 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 11 | * All rights reserved. | 11 | * All rights reserved. |
| 12 | * | 12 | * |
| 13 | * Redistribution and use in source and binary forms, with or without | 13 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exstorob.c b/drivers/acpi/acpica/exstorob.c index 257706e7734f..e972b667b09b 100644 --- a/drivers/acpi/acpica/exstorob.c +++ b/drivers/acpi/acpica/exstorob.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exsystem.c b/drivers/acpi/acpica/exsystem.c index 3d00b9357233..e11b6cb42a57 100644 --- a/drivers/acpi/acpica/exsystem.c +++ b/drivers/acpi/acpica/exsystem.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
| @@ -193,7 +193,7 @@ acpi_status acpi_ex_system_do_stall(u32 how_long) | |||
| 193 | * | 193 | * |
| 194 | ******************************************************************************/ | 194 | ******************************************************************************/ |
| 195 | 195 | ||
| 196 | acpi_status acpi_ex_system_do_suspend(acpi_integer how_long) | 196 | acpi_status acpi_ex_system_do_suspend(u64 how_long) |
| 197 | { | 197 | { |
| 198 | ACPI_FUNCTION_ENTRY(); | 198 | ACPI_FUNCTION_ENTRY(); |
| 199 | 199 | ||
diff --git a/drivers/acpi/acpica/exutils.c b/drivers/acpi/acpica/exutils.c index 7d41f99f7052..74c24d517f81 100644 --- a/drivers/acpi/acpica/exutils.c +++ b/drivers/acpi/acpica/exutils.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
| @@ -67,7 +67,7 @@ | |||
| 67 | ACPI_MODULE_NAME("exutils") | 67 | ACPI_MODULE_NAME("exutils") |
| 68 | 68 | ||
| 69 | /* Local prototypes */ | 69 | /* Local prototypes */ |
| 70 | static u32 acpi_ex_digits_needed(acpi_integer value, u32 base); | 70 | static u32 acpi_ex_digits_needed(u64 value, u32 base); |
| 71 | 71 | ||
| 72 | #ifndef ACPI_NO_METHOD_EXECUTION | 72 | #ifndef ACPI_NO_METHOD_EXECUTION |
| 73 | /******************************************************************************* | 73 | /******************************************************************************* |
| @@ -230,7 +230,7 @@ void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc) | |||
| 230 | * We are running a method that exists in a 32-bit ACPI table. | 230 | * We are running a method that exists in a 32-bit ACPI table. |
| 231 | * Truncate the value to 32 bits by zeroing out the upper 32-bit field | 231 | * Truncate the value to 32 bits by zeroing out the upper 32-bit field |
| 232 | */ | 232 | */ |
| 233 | obj_desc->integer.value &= (acpi_integer) ACPI_UINT32_MAX; | 233 | obj_desc->integer.value &= (u64) ACPI_UINT32_MAX; |
| 234 | } | 234 | } |
| 235 | } | 235 | } |
| 236 | 236 | ||
| @@ -327,14 +327,14 @@ void acpi_ex_release_global_lock(u32 field_flags) | |||
| 327 | * | 327 | * |
| 328 | ******************************************************************************/ | 328 | ******************************************************************************/ |
| 329 | 329 | ||
| 330 | static u32 acpi_ex_digits_needed(acpi_integer value, u32 base) | 330 | static u32 acpi_ex_digits_needed(u64 value, u32 base) |
| 331 | { | 331 | { |
| 332 | u32 num_digits; | 332 | u32 num_digits; |
| 333 | acpi_integer current_value; | 333 | u64 current_value; |
| 334 | 334 | ||
| 335 | ACPI_FUNCTION_TRACE(ex_digits_needed); | 335 | ACPI_FUNCTION_TRACE(ex_digits_needed); |
| 336 | 336 | ||
| 337 | /* acpi_integer is unsigned, so we don't worry about a '-' prefix */ | 337 | /* u64 is unsigned, so we don't worry about a '-' prefix */ |
| 338 | 338 | ||
| 339 | if (value == 0) { | 339 | if (value == 0) { |
| 340 | return_UINT32(1); | 340 | return_UINT32(1); |
| @@ -370,7 +370,7 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base) | |||
| 370 | * | 370 | * |
| 371 | ******************************************************************************/ | 371 | ******************************************************************************/ |
| 372 | 372 | ||
| 373 | void acpi_ex_eisa_id_to_string(char *out_string, acpi_integer compressed_id) | 373 | void acpi_ex_eisa_id_to_string(char *out_string, u64 compressed_id) |
| 374 | { | 374 | { |
| 375 | u32 swapped_id; | 375 | u32 swapped_id; |
| 376 | 376 | ||
| @@ -394,10 +394,10 @@ void acpi_ex_eisa_id_to_string(char *out_string, acpi_integer compressed_id) | |||
| 394 | (char)(0x40 + (((unsigned long)swapped_id >> 26) & 0x1F)); | 394 | (char)(0x40 + (((unsigned long)swapped_id >> 26) & 0x1F)); |
| 395 | out_string[1] = (char)(0x40 + ((swapped_id >> 21) & 0x1F)); | 395 | out_string[1] = (char)(0x40 + ((swapped_id >> 21) & 0x1F)); |
| 396 | out_string[2] = (char)(0x40 + ((swapped_id >> 16) & 0x1F)); | 396 | out_string[2] = (char)(0x40 + ((swapped_id >> 16) & 0x1F)); |
| 397 | out_string[3] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 12); | 397 | out_string[3] = acpi_ut_hex_to_ascii_char((u64) swapped_id, 12); |
| 398 | out_string[4] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 8); | 398 | out_string[4] = acpi_ut_hex_to_ascii_char((u64) swapped_id, 8); |
| 399 | out_string[5] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 4); | 399 | out_string[5] = acpi_ut_hex_to_ascii_char((u64) swapped_id, 4); |
| 400 | out_string[6] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 0); | 400 | out_string[6] = acpi_ut_hex_to_ascii_char((u64) swapped_id, 0); |
| 401 | out_string[7] = 0; | 401 | out_string[7] = 0; |
| 402 | } | 402 | } |
| 403 | 403 | ||
| @@ -418,7 +418,7 @@ void acpi_ex_eisa_id_to_string(char *out_string, acpi_integer compressed_id) | |||
| 418 | * | 418 | * |
| 419 | ******************************************************************************/ | 419 | ******************************************************************************/ |
| 420 | 420 | ||
| 421 | void acpi_ex_integer_to_string(char *out_string, acpi_integer value) | 421 | void acpi_ex_integer_to_string(char *out_string, u64 value) |
| 422 | { | 422 | { |
| 423 | u32 count; | 423 | u32 count; |
| 424 | u32 digits_needed; | 424 | u32 digits_needed; |
diff --git a/drivers/acpi/acpica/hwacpi.c b/drivers/acpi/acpica/hwacpi.c index 9af361a191e7..679a112a7d26 100644 --- a/drivers/acpi/acpica/hwacpi.c +++ b/drivers/acpi/acpica/hwacpi.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/hwgpe.c b/drivers/acpi/acpica/hwgpe.c index c28c41b3180b..bd72319a38f0 100644 --- a/drivers/acpi/acpica/hwgpe.c +++ b/drivers/acpi/acpica/hwgpe.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
| @@ -224,7 +224,7 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info, | |||
| 224 | 224 | ||
| 225 | status = acpi_hw_read(&in_byte, &gpe_register_info->status_address); | 225 | status = acpi_hw_read(&in_byte, &gpe_register_info->status_address); |
| 226 | if (ACPI_FAILURE(status)) { | 226 | if (ACPI_FAILURE(status)) { |
| 227 | goto unlock_and_exit; | 227 | return (status); |
| 228 | } | 228 | } |
| 229 | 229 | ||
| 230 | if (register_bit & in_byte) { | 230 | if (register_bit & in_byte) { |
| @@ -234,9 +234,7 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info, | |||
| 234 | /* Set return value */ | 234 | /* Set return value */ |
| 235 | 235 | ||
| 236 | (*event_status) = local_event_status; | 236 | (*event_status) = local_event_status; |
| 237 | 237 | return (AE_OK); | |
| 238 | unlock_and_exit: | ||
| 239 | return (status); | ||
| 240 | } | 238 | } |
| 241 | 239 | ||
| 242 | /****************************************************************************** | 240 | /****************************************************************************** |
diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c index 15c9ed2be853..ec7fc227b33f 100644 --- a/drivers/acpi/acpica/hwregs.c +++ b/drivers/acpi/acpica/hwregs.c | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | ******************************************************************************/ | 7 | ******************************************************************************/ |
| 8 | 8 | ||
| 9 | /* | 9 | /* |
| 10 | * Copyright (C) 2000 - 2008, Intel Corp. | 10 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 11 | * All rights reserved. | 11 | * All rights reserved. |
| 12 | * | 12 | * |
| 13 | * Redistribution and use in source and binary forms, with or without | 13 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c index cc22f9a585b0..5e6d4dbb8024 100644 --- a/drivers/acpi/acpica/hwsleep.c +++ b/drivers/acpi/acpica/hwsleep.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/hwtimer.c b/drivers/acpi/acpica/hwtimer.c index 6b282e85d039..1ef8e0bb250b 100644 --- a/drivers/acpi/acpica/hwtimer.c +++ b/drivers/acpi/acpica/hwtimer.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
| @@ -140,7 +140,7 @@ acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed) | |||
| 140 | { | 140 | { |
| 141 | acpi_status status; | 141 | acpi_status status; |
| 142 | u32 delta_ticks; | 142 | u32 delta_ticks; |
| 143 | acpi_integer quotient; | 143 | u64 quotient; |
| 144 | 144 | ||
| 145 | ACPI_FUNCTION_TRACE(acpi_get_timer_duration); | 145 | ACPI_FUNCTION_TRACE(acpi_get_timer_duration); |
| 146 | 146 | ||
diff --git a/drivers/acpi/acpica/hwvalid.c b/drivers/acpi/acpica/hwvalid.c index ec33f270c5b7..e26c17d4b716 100644 --- a/drivers/acpi/acpica/hwvalid.c +++ b/drivers/acpi/acpica/hwvalid.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2009, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/hwxface.c b/drivers/acpi/acpica/hwxface.c index 647c7b6e6756..50cc3be77724 100644 --- a/drivers/acpi/acpica/hwxface.c +++ b/drivers/acpi/acpica/hwxface.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsaccess.c b/drivers/acpi/acpica/nsaccess.c index d622ba770000..aa2b80132d0a 100644 --- a/drivers/acpi/acpica/nsaccess.c +++ b/drivers/acpi/acpica/nsaccess.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsalloc.c b/drivers/acpi/acpica/nsalloc.c index 8a58a1b85aa0..982269c1fa48 100644 --- a/drivers/acpi/acpica/nsalloc.c +++ b/drivers/acpi/acpica/nsalloc.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsdump.c b/drivers/acpi/acpica/nsdump.c index e37836e27e29..0689d36638d9 100644 --- a/drivers/acpi/acpica/nsdump.c +++ b/drivers/acpi/acpica/nsdump.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsdumpdv.c b/drivers/acpi/acpica/nsdumpdv.c index 36be7f0e97ec..d2a97921e249 100644 --- a/drivers/acpi/acpica/nsdumpdv.c +++ b/drivers/acpi/acpica/nsdumpdv.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nseval.c b/drivers/acpi/acpica/nseval.c index af9fe9103734..f52829cc294b 100644 --- a/drivers/acpi/acpica/nseval.c +++ b/drivers/acpi/acpica/nseval.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsinit.c b/drivers/acpi/acpica/nsinit.c index 4f8abac231d2..9bd6f050f299 100644 --- a/drivers/acpi/acpica/nsinit.c +++ b/drivers/acpi/acpica/nsinit.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsload.c b/drivers/acpi/acpica/nsload.c index a7234e60e985..df18be94fefe 100644 --- a/drivers/acpi/acpica/nsload.c +++ b/drivers/acpi/acpica/nsload.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsnames.c b/drivers/acpi/acpica/nsnames.c index 8f9a4875ce26..959372451635 100644 --- a/drivers/acpi/acpica/nsnames.c +++ b/drivers/acpi/acpica/nsnames.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsobject.c b/drivers/acpi/acpica/nsobject.c index 60f3af08d28c..41a9213dd5af 100644 --- a/drivers/acpi/acpica/nsobject.c +++ b/drivers/acpi/acpica/nsobject.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | ******************************************************************************/ | 6 | ******************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsparse.c b/drivers/acpi/acpica/nsparse.c index 662a4bd5b621..27cda52c76bc 100644 --- a/drivers/acpi/acpica/nsparse.c +++ b/drivers/acpi/acpica/nsparse.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nspredef.c b/drivers/acpi/acpica/nspredef.c index d34fa59548f7..7096bcda0c72 100644 --- a/drivers/acpi/acpica/nspredef.c +++ b/drivers/acpi/acpica/nspredef.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
| @@ -231,6 +231,7 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node, | |||
| 231 | * Note: Package may have been newly created by call above. | 231 | * Note: Package may have been newly created by call above. |
| 232 | */ | 232 | */ |
| 233 | if ((*return_object_ptr)->common.type == ACPI_TYPE_PACKAGE) { | 233 | if ((*return_object_ptr)->common.type == ACPI_TYPE_PACKAGE) { |
| 234 | data->parent_package = *return_object_ptr; | ||
| 234 | status = acpi_ns_check_package(data, return_object_ptr); | 235 | status = acpi_ns_check_package(data, return_object_ptr); |
| 235 | if (ACPI_FAILURE(status)) { | 236 | if (ACPI_FAILURE(status)) { |
| 236 | goto exit; | 237 | goto exit; |
| @@ -710,6 +711,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data, | |||
| 710 | for (i = 0; i < count; i++) { | 711 | for (i = 0; i < count; i++) { |
| 711 | sub_package = *elements; | 712 | sub_package = *elements; |
| 712 | sub_elements = sub_package->package.elements; | 713 | sub_elements = sub_package->package.elements; |
| 714 | data->parent_package = sub_package; | ||
| 713 | 715 | ||
| 714 | /* Each sub-object must be of type Package */ | 716 | /* Each sub-object must be of type Package */ |
| 715 | 717 | ||
| @@ -721,6 +723,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data, | |||
| 721 | 723 | ||
| 722 | /* Examine the different types of expected sub-packages */ | 724 | /* Examine the different types of expected sub-packages */ |
| 723 | 725 | ||
| 726 | data->parent_package = sub_package; | ||
| 724 | switch (package->ret_info.type) { | 727 | switch (package->ret_info.type) { |
| 725 | case ACPI_PTYPE2: | 728 | case ACPI_PTYPE2: |
| 726 | case ACPI_PTYPE2_PKG_COUNT: | 729 | case ACPI_PTYPE2_PKG_COUNT: |
| @@ -800,7 +803,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data, | |||
| 800 | 803 | ||
| 801 | /* | 804 | /* |
| 802 | * First element is the (Integer) count of elements, including | 805 | * First element is the (Integer) count of elements, including |
| 803 | * the count field. | 806 | * the count field (the ACPI name is num_elements) |
| 804 | */ | 807 | */ |
| 805 | status = acpi_ns_check_object_type(data, sub_elements, | 808 | status = acpi_ns_check_object_type(data, sub_elements, |
| 806 | ACPI_RTYPE_INTEGER, | 809 | ACPI_RTYPE_INTEGER, |
| @@ -822,6 +825,16 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data, | |||
| 822 | expected_count = package->ret_info.count1; | 825 | expected_count = package->ret_info.count1; |
| 823 | goto package_too_small; | 826 | goto package_too_small; |
| 824 | } | 827 | } |
| 828 | if (expected_count == 0) { | ||
| 829 | /* | ||
| 830 | * Either the num_entries element was originally zero or it was | ||
| 831 | * a NULL element and repaired to an Integer of value zero. | ||
| 832 | * In either case, repair it by setting num_entries to be the | ||
| 833 | * actual size of the subpackage. | ||
| 834 | */ | ||
| 835 | expected_count = sub_package->package.count; | ||
| 836 | (*sub_elements)->integer.value = expected_count; | ||
| 837 | } | ||
| 825 | 838 | ||
| 826 | /* Check the type of each sub-package element */ | 839 | /* Check the type of each sub-package element */ |
| 827 | 840 | ||
| @@ -945,10 +958,18 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data, | |||
| 945 | char type_buffer[48]; /* Room for 5 types */ | 958 | char type_buffer[48]; /* Room for 5 types */ |
| 946 | 959 | ||
| 947 | /* | 960 | /* |
| 948 | * If we get a NULL return_object here, it is a NULL package element, | 961 | * If we get a NULL return_object here, it is a NULL package element. |
| 949 | * and this is always an error. | 962 | * Since all extraneous NULL package elements were removed earlier by a |
| 963 | * call to acpi_ns_remove_null_elements, this is an unexpected NULL element. | ||
| 964 | * We will attempt to repair it. | ||
| 950 | */ | 965 | */ |
| 951 | if (!return_object) { | 966 | if (!return_object) { |
| 967 | status = acpi_ns_repair_null_element(data, expected_btypes, | ||
| 968 | package_index, | ||
| 969 | return_object_ptr); | ||
| 970 | if (ACPI_SUCCESS(status)) { | ||
| 971 | return (AE_OK); /* Repair was successful */ | ||
| 972 | } | ||
| 952 | goto type_error_exit; | 973 | goto type_error_exit; |
| 953 | } | 974 | } |
| 954 | 975 | ||
| @@ -1000,27 +1021,25 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data, | |||
| 1000 | 1021 | ||
| 1001 | /* Is the object one of the expected types? */ | 1022 | /* Is the object one of the expected types? */ |
| 1002 | 1023 | ||
| 1003 | if (!(return_btype & expected_btypes)) { | 1024 | if (return_btype & expected_btypes) { |
| 1004 | 1025 | ||
| 1005 | /* Type mismatch -- attempt repair of the returned object */ | 1026 | /* For reference objects, check that the reference type is correct */ |
| 1006 | 1027 | ||
| 1007 | status = acpi_ns_repair_object(data, expected_btypes, | 1028 | if (return_object->common.type == ACPI_TYPE_LOCAL_REFERENCE) { |
| 1008 | package_index, | 1029 | status = acpi_ns_check_reference(data, return_object); |
| 1009 | return_object_ptr); | ||
| 1010 | if (ACPI_SUCCESS(status)) { | ||
| 1011 | return (AE_OK); /* Repair was successful */ | ||
| 1012 | } | 1030 | } |
| 1013 | goto type_error_exit; | 1031 | |
| 1032 | return (status); | ||
| 1014 | } | 1033 | } |
| 1015 | 1034 | ||
| 1016 | /* For reference objects, check that the reference type is correct */ | 1035 | /* Type mismatch -- attempt repair of the returned object */ |
| 1017 | 1036 | ||
| 1018 | if (return_object->common.type == ACPI_TYPE_LOCAL_REFERENCE) { | 1037 | status = acpi_ns_repair_object(data, expected_btypes, |
| 1019 | status = acpi_ns_check_reference(data, return_object); | 1038 | package_index, return_object_ptr); |
| 1039 | if (ACPI_SUCCESS(status)) { | ||
| 1040 | return (AE_OK); /* Repair was successful */ | ||
| 1020 | } | 1041 | } |
| 1021 | 1042 | ||
| 1022 | return (status); | ||
| 1023 | |||
| 1024 | type_error_exit: | 1043 | type_error_exit: |
| 1025 | 1044 | ||
| 1026 | /* Create a string with all expected types for this predefined object */ | 1045 | /* Create a string with all expected types for this predefined object */ |
diff --git a/drivers/acpi/acpica/nsrepair.c b/drivers/acpi/acpica/nsrepair.c index 4fd1bdb056b2..d4be37751be4 100644 --- a/drivers/acpi/acpica/nsrepair.c +++ b/drivers/acpi/acpica/nsrepair.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2009, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -45,6 +45,7 @@ | |||
| 45 | #include "accommon.h" | 45 | #include "accommon.h" |
| 46 | #include "acnamesp.h" | 46 | #include "acnamesp.h" |
| 47 | #include "acinterp.h" | 47 | #include "acinterp.h" |
| 48 | #include "acpredef.h" | ||
| 48 | 49 | ||
| 49 | #define _COMPONENT ACPI_NAMESPACE | 50 | #define _COMPONENT ACPI_NAMESPACE |
| 50 | ACPI_MODULE_NAME("nsrepair") | 51 | ACPI_MODULE_NAME("nsrepair") |
| @@ -71,6 +72,12 @@ ACPI_MODULE_NAME("nsrepair") | |||
| 71 | * Buffer -> Package of Integers | 72 | * Buffer -> Package of Integers |
| 72 | * Package -> Package of one Package | 73 | * Package -> Package of one Package |
| 73 | * | 74 | * |
| 75 | * Additional possible repairs: | ||
| 76 | * | ||
| 77 | * Optional/unnecessary NULL package elements removed | ||
| 78 | * Required package elements that are NULL replaced by Integer/String/Buffer | ||
| 79 | * Incorrect standalone package wrapped with required outer package | ||
| 80 | * | ||
| 74 | ******************************************************************************/ | 81 | ******************************************************************************/ |
| 75 | /* Local prototypes */ | 82 | /* Local prototypes */ |
| 76 | static acpi_status | 83 | static acpi_status |
| @@ -506,6 +513,172 @@ acpi_ns_convert_to_package(union acpi_operand_object *original_object, | |||
| 506 | 513 | ||
| 507 | /******************************************************************************* | 514 | /******************************************************************************* |
| 508 | * | 515 | * |
| 516 | * FUNCTION: acpi_ns_repair_null_element | ||
| 517 | * | ||
| 518 | * PARAMETERS: Data - Pointer to validation data structure | ||
| 519 | * expected_btypes - Object types expected | ||
| 520 | * package_index - Index of object within parent package (if | ||
| 521 | * applicable - ACPI_NOT_PACKAGE_ELEMENT | ||
| 522 | * otherwise) | ||
| 523 | * return_object_ptr - Pointer to the object returned from the | ||
| 524 | * evaluation of a method or object | ||
| 525 | * | ||
| 526 | * RETURN: Status. AE_OK if repair was successful. | ||
| 527 | * | ||
| 528 | * DESCRIPTION: Attempt to repair a NULL element of a returned Package object. | ||
| 529 | * | ||
| 530 | ******************************************************************************/ | ||
| 531 | |||
| 532 | acpi_status | ||
| 533 | acpi_ns_repair_null_element(struct acpi_predefined_data *data, | ||
| 534 | u32 expected_btypes, | ||
| 535 | u32 package_index, | ||
| 536 | union acpi_operand_object **return_object_ptr) | ||
| 537 | { | ||
| 538 | union acpi_operand_object *return_object = *return_object_ptr; | ||
| 539 | union acpi_operand_object *new_object; | ||
| 540 | |||
| 541 | ACPI_FUNCTION_NAME(ns_repair_null_element); | ||
| 542 | |||
| 543 | /* No repair needed if return object is non-NULL */ | ||
| 544 | |||
| 545 | if (return_object) { | ||
| 546 | return (AE_OK); | ||
| 547 | } | ||
| 548 | |||
| 549 | /* | ||
| 550 | * Attempt to repair a NULL element of a Package object. This applies to | ||
| 551 | * predefined names that return a fixed-length package and each element | ||
| 552 | * is required. It does not apply to variable-length packages where NULL | ||
| 553 | * elements are allowed, especially at the end of the package. | ||
| 554 | */ | ||
| 555 | if (expected_btypes & ACPI_RTYPE_INTEGER) { | ||
| 556 | |||
| 557 | /* Need an Integer - create a zero-value integer */ | ||
| 558 | |||
| 559 | new_object = acpi_ut_create_integer_object(0); | ||
| 560 | } else if (expected_btypes & ACPI_RTYPE_STRING) { | ||
| 561 | |||
| 562 | /* Need a String - create a NULL string */ | ||
| 563 | |||
| 564 | new_object = acpi_ut_create_string_object(0); | ||
| 565 | } else if (expected_btypes & ACPI_RTYPE_BUFFER) { | ||
| 566 | |||
| 567 | /* Need a Buffer - create a zero-length buffer */ | ||
| 568 | |||
| 569 | new_object = acpi_ut_create_buffer_object(0); | ||
| 570 | } else { | ||
| 571 | /* Error for all other expected types */ | ||
| 572 | |||
| 573 | return (AE_AML_OPERAND_TYPE); | ||
| 574 | } | ||
| 575 | |||
| 576 | if (!new_object) { | ||
| 577 | return (AE_NO_MEMORY); | ||
| 578 | } | ||
| 579 | |||
| 580 | /* Set the reference count according to the parent Package object */ | ||
| 581 | |||
| 582 | new_object->common.reference_count = | ||
| 583 | data->parent_package->common.reference_count; | ||
| 584 | |||
| 585 | ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, | ||
| 586 | "%s: Converted NULL package element to expected %s at index %u\n", | ||
| 587 | data->pathname, | ||
| 588 | acpi_ut_get_object_type_name(new_object), | ||
| 589 | package_index)); | ||
| 590 | |||
| 591 | *return_object_ptr = new_object; | ||
| 592 | data->flags |= ACPI_OBJECT_REPAIRED; | ||
| 593 | return (AE_OK); | ||
| 594 | } | ||
| 595 | |||
| 596 | /****************************************************************************** | ||
| 597 | * | ||
| 598 | * FUNCTION: acpi_ns_remove_null_elements | ||
| 599 | * | ||
| 600 | * PARAMETERS: Data - Pointer to validation data structure | ||
| 601 | * package_type - An acpi_return_package_types value | ||
| 602 | * obj_desc - A Package object | ||
| 603 | * | ||
| 604 | * RETURN: None. | ||
| 605 | * | ||
| 606 | * DESCRIPTION: Remove all NULL package elements from packages that contain | ||
| 607 | * a variable number of sub-packages. For these types of | ||
| 608 | * packages, NULL elements can be safely removed. | ||
| 609 | * | ||
| 610 | *****************************************************************************/ | ||
| 611 | |||
| 612 | void | ||
| 613 | acpi_ns_remove_null_elements(struct acpi_predefined_data *data, | ||
| 614 | u8 package_type, | ||
| 615 | union acpi_operand_object *obj_desc) | ||
| 616 | { | ||
| 617 | union acpi_operand_object **source; | ||
| 618 | union acpi_operand_object **dest; | ||
| 619 | u32 count; | ||
| 620 | u32 new_count; | ||
| 621 | u32 i; | ||
| 622 | |||
| 623 | ACPI_FUNCTION_NAME(ns_remove_null_elements); | ||
| 624 | |||
| 625 | /* | ||
| 626 | * PTYPE1 packages contain no subpackages. | ||
| 627 | * PTYPE2 packages contain a variable number of sub-packages. We can | ||
| 628 | * safely remove all NULL elements from the PTYPE2 packages. | ||
| 629 | */ | ||
| 630 | switch (package_type) { | ||
| 631 | case ACPI_PTYPE1_FIXED: | ||
| 632 | case ACPI_PTYPE1_VAR: | ||
| 633 | case ACPI_PTYPE1_OPTION: | ||
| 634 | return; | ||
| 635 | |||
| 636 | case ACPI_PTYPE2: | ||
| 637 | case ACPI_PTYPE2_COUNT: | ||
| 638 | case ACPI_PTYPE2_PKG_COUNT: | ||
| 639 | case ACPI_PTYPE2_FIXED: | ||
| 640 | case ACPI_PTYPE2_MIN: | ||
| 641 | case ACPI_PTYPE2_REV_FIXED: | ||
| 642 | break; | ||
| 643 | |||
| 644 | default: | ||
| 645 | return; | ||
| 646 | } | ||
| 647 | |||
| 648 | count = obj_desc->package.count; | ||
| 649 | new_count = count; | ||
| 650 | |||
| 651 | source = obj_desc->package.elements; | ||
| 652 | dest = source; | ||
| 653 | |||
| 654 | /* Examine all elements of the package object, remove nulls */ | ||
| 655 | |||
| 656 | for (i = 0; i < count; i++) { | ||
| 657 | if (!*source) { | ||
| 658 | new_count--; | ||
| 659 | } else { | ||
| 660 | *dest = *source; | ||
| 661 | dest++; | ||
| 662 | } | ||
| 663 | source++; | ||
| 664 | } | ||
| 665 | |||
| 666 | /* Update parent package if any null elements were removed */ | ||
| 667 | |||
| 668 | if (new_count < count) { | ||
| 669 | ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, | ||
| 670 | "%s: Found and removed %u NULL elements\n", | ||
| 671 | data->pathname, (count - new_count))); | ||
| 672 | |||
| 673 | /* NULL terminate list and update the package count */ | ||
| 674 | |||
| 675 | *dest = NULL; | ||
| 676 | obj_desc->package.count = new_count; | ||
| 677 | } | ||
| 678 | } | ||
| 679 | |||
| 680 | /******************************************************************************* | ||
| 681 | * | ||
| 509 | * FUNCTION: acpi_ns_repair_package_list | 682 | * FUNCTION: acpi_ns_repair_package_list |
| 510 | * | 683 | * |
| 511 | * PARAMETERS: Data - Pointer to validation data structure | 684 | * PARAMETERS: Data - Pointer to validation data structure |
diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c index f13691c1cca5..61bd0f6755d2 100644 --- a/drivers/acpi/acpica/nsrepair2.c +++ b/drivers/acpi/acpica/nsrepair2.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2009, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
| @@ -45,7 +45,6 @@ | |||
| 45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
| 46 | #include "accommon.h" | 46 | #include "accommon.h" |
| 47 | #include "acnamesp.h" | 47 | #include "acnamesp.h" |
| 48 | #include "acpredef.h" | ||
| 49 | 48 | ||
| 50 | #define _COMPONENT ACPI_NAMESPACE | 49 | #define _COMPONENT ACPI_NAMESPACE |
| 51 | ACPI_MODULE_NAME("nsrepair2") | 50 | ACPI_MODULE_NAME("nsrepair2") |
| @@ -93,7 +92,7 @@ acpi_ns_check_sorted_list(struct acpi_predefined_data *data, | |||
| 93 | u32 sort_index, | 92 | u32 sort_index, |
| 94 | u8 sort_direction, char *sort_key_name); | 93 | u8 sort_direction, char *sort_key_name); |
| 95 | 94 | ||
| 96 | static acpi_status | 95 | static void |
| 97 | acpi_ns_sort_list(union acpi_operand_object **elements, | 96 | acpi_ns_sort_list(union acpi_operand_object **elements, |
| 98 | u32 count, u32 index, u8 sort_direction); | 97 | u32 count, u32 index, u8 sort_direction); |
| 99 | 98 | ||
| @@ -443,7 +442,6 @@ acpi_ns_check_sorted_list(struct acpi_predefined_data *data, | |||
| 443 | union acpi_operand_object *obj_desc; | 442 | union acpi_operand_object *obj_desc; |
| 444 | u32 i; | 443 | u32 i; |
| 445 | u32 previous_value; | 444 | u32 previous_value; |
| 446 | acpi_status status; | ||
| 447 | 445 | ||
| 448 | ACPI_FUNCTION_NAME(ns_check_sorted_list); | 446 | ACPI_FUNCTION_NAME(ns_check_sorted_list); |
| 449 | 447 | ||
| @@ -494,19 +492,15 @@ acpi_ns_check_sorted_list(struct acpi_predefined_data *data, | |||
| 494 | 492 | ||
| 495 | /* | 493 | /* |
| 496 | * The list must be sorted in the specified order. If we detect a | 494 | * The list must be sorted in the specified order. If we detect a |
| 497 | * discrepancy, issue a warning and sort the entire list | 495 | * discrepancy, sort the entire list. |
| 498 | */ | 496 | */ |
| 499 | if (((sort_direction == ACPI_SORT_ASCENDING) && | 497 | if (((sort_direction == ACPI_SORT_ASCENDING) && |
| 500 | (obj_desc->integer.value < previous_value)) || | 498 | (obj_desc->integer.value < previous_value)) || |
| 501 | ((sort_direction == ACPI_SORT_DESCENDING) && | 499 | ((sort_direction == ACPI_SORT_DESCENDING) && |
| 502 | (obj_desc->integer.value > previous_value))) { | 500 | (obj_desc->integer.value > previous_value))) { |
| 503 | status = | 501 | acpi_ns_sort_list(return_object->package.elements, |
| 504 | acpi_ns_sort_list(return_object->package.elements, | 502 | outer_element_count, sort_index, |
| 505 | outer_element_count, sort_index, | 503 | sort_direction); |
| 506 | sort_direction); | ||
| 507 | if (ACPI_FAILURE(status)) { | ||
| 508 | return (status); | ||
| 509 | } | ||
| 510 | 504 | ||
| 511 | data->flags |= ACPI_OBJECT_REPAIRED; | 505 | data->flags |= ACPI_OBJECT_REPAIRED; |
| 512 | 506 | ||
| @@ -525,89 +519,6 @@ acpi_ns_check_sorted_list(struct acpi_predefined_data *data, | |||
| 525 | 519 | ||
| 526 | /****************************************************************************** | 520 | /****************************************************************************** |
| 527 | * | 521 | * |
| 528 | * FUNCTION: acpi_ns_remove_null_elements | ||
| 529 | * | ||
| 530 | * PARAMETERS: Data - Pointer to validation data structure | ||
| 531 | * package_type - An acpi_return_package_types value | ||
| 532 | * obj_desc - A Package object | ||
| 533 | * | ||
| 534 | * RETURN: None. | ||
| 535 | * | ||
| 536 | * DESCRIPTION: Remove all NULL package elements from packages that contain | ||
| 537 | * a variable number of sub-packages. | ||
| 538 | * | ||
| 539 | *****************************************************************************/ | ||
| 540 | |||
| 541 | void | ||
| 542 | acpi_ns_remove_null_elements(struct acpi_predefined_data *data, | ||
| 543 | u8 package_type, | ||
| 544 | union acpi_operand_object *obj_desc) | ||
| 545 | { | ||
| 546 | union acpi_operand_object **source; | ||
| 547 | union acpi_operand_object **dest; | ||
| 548 | u32 count; | ||
| 549 | u32 new_count; | ||
| 550 | u32 i; | ||
| 551 | |||
| 552 | ACPI_FUNCTION_NAME(ns_remove_null_elements); | ||
| 553 | |||
| 554 | /* | ||
| 555 | * PTYPE1 packages contain no subpackages. | ||
| 556 | * PTYPE2 packages contain a variable number of sub-packages. We can | ||
| 557 | * safely remove all NULL elements from the PTYPE2 packages. | ||
| 558 | */ | ||
| 559 | switch (package_type) { | ||
| 560 | case ACPI_PTYPE1_FIXED: | ||
| 561 | case ACPI_PTYPE1_VAR: | ||
| 562 | case ACPI_PTYPE1_OPTION: | ||
| 563 | return; | ||
| 564 | |||
| 565 | case ACPI_PTYPE2: | ||
| 566 | case ACPI_PTYPE2_COUNT: | ||
| 567 | case ACPI_PTYPE2_PKG_COUNT: | ||
| 568 | case ACPI_PTYPE2_FIXED: | ||
| 569 | case ACPI_PTYPE2_MIN: | ||
| 570 | case ACPI_PTYPE2_REV_FIXED: | ||
| 571 | break; | ||
| 572 | |||
| 573 | default: | ||
| 574 | return; | ||
| 575 | } | ||
| 576 | |||
| 577 | count = obj_desc->package.count; | ||
| 578 | new_count = count; | ||
| 579 | |||
| 580 | source = obj_desc->package.elements; | ||
| 581 | dest = source; | ||
| 582 | |||
| 583 | /* Examine all elements of the package object, remove nulls */ | ||
| 584 | |||
| 585 | for (i = 0; i < count; i++) { | ||
| 586 | if (!*source) { | ||
| 587 | new_count--; | ||
| 588 | } else { | ||
| 589 | *dest = *source; | ||
| 590 | dest++; | ||
| 591 | } | ||
| 592 | source++; | ||
| 593 | } | ||
| 594 | |||
| 595 | /* Update parent package if any null elements were removed */ | ||
| 596 | |||
| 597 | if (new_count < count) { | ||
| 598 | ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, | ||
| 599 | "%s: Found and removed %u NULL elements\n", | ||
| 600 | data->pathname, (count - new_count))); | ||
| 601 | |||
| 602 | /* NULL terminate list and update the package count */ | ||
| 603 | |||
| 604 | *dest = NULL; | ||
| 605 | obj_desc->package.count = new_count; | ||
| 606 | } | ||
| 607 | } | ||
| 608 | |||
| 609 | /****************************************************************************** | ||
| 610 | * | ||
| 611 | * FUNCTION: acpi_ns_sort_list | 522 | * FUNCTION: acpi_ns_sort_list |
| 612 | * | 523 | * |
| 613 | * PARAMETERS: Elements - Package object element list | 524 | * PARAMETERS: Elements - Package object element list |
| @@ -615,15 +526,16 @@ acpi_ns_remove_null_elements(struct acpi_predefined_data *data, | |||
| 615 | * Index - Sort by which package element | 526 | * Index - Sort by which package element |
| 616 | * sort_direction - Ascending or Descending sort | 527 | * sort_direction - Ascending or Descending sort |
| 617 | * | 528 | * |
| 618 | * RETURN: Status | 529 | * RETURN: None |
| 619 | * | 530 | * |
| 620 | * DESCRIPTION: Sort the objects that are in a package element list. | 531 | * DESCRIPTION: Sort the objects that are in a package element list. |
| 621 | * | 532 | * |
| 622 | * NOTE: Assumes that all NULL elements have been removed from the package. | 533 | * NOTE: Assumes that all NULL elements have been removed from the package, |
| 534 | * and that all elements have been verified to be of type Integer. | ||
| 623 | * | 535 | * |
| 624 | *****************************************************************************/ | 536 | *****************************************************************************/ |
| 625 | 537 | ||
| 626 | static acpi_status | 538 | static void |
| 627 | acpi_ns_sort_list(union acpi_operand_object **elements, | 539 | acpi_ns_sort_list(union acpi_operand_object **elements, |
| 628 | u32 count, u32 index, u8 sort_direction) | 540 | u32 count, u32 index, u8 sort_direction) |
| 629 | { | 541 | { |
| @@ -652,6 +564,4 @@ acpi_ns_sort_list(union acpi_operand_object **elements, | |||
| 652 | } | 564 | } |
| 653 | } | 565 | } |
| 654 | } | 566 | } |
| 655 | |||
| 656 | return (AE_OK); | ||
| 657 | } | 567 | } |
diff --git a/drivers/acpi/acpica/nssearch.c b/drivers/acpi/acpica/nssearch.c index 7e865639a928..08f8b3f5ccaa 100644 --- a/drivers/acpi/acpica/nssearch.c +++ b/drivers/acpi/acpica/nssearch.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsutils.c b/drivers/acpi/acpica/nsutils.c index 47d91e668a1b..24d05a87a2a3 100644 --- a/drivers/acpi/acpica/nsutils.c +++ b/drivers/acpi/acpica/nsutils.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nswalk.c b/drivers/acpi/acpica/nswalk.c index d7e6b52b4482..00e79fb26029 100644 --- a/drivers/acpi/acpica/nswalk.c +++ b/drivers/acpi/acpica/nswalk.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsxfeval.c b/drivers/acpi/acpica/nsxfeval.c index f0c0892bc7e5..ebef8a7fd707 100644 --- a/drivers/acpi/acpica/nsxfeval.c +++ b/drivers/acpi/acpica/nsxfeval.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | ******************************************************************************/ | 6 | ******************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
| @@ -562,25 +562,20 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, | |||
| 562 | return (AE_BAD_PARAMETER); | 562 | return (AE_BAD_PARAMETER); |
| 563 | } | 563 | } |
| 564 | 564 | ||
| 565 | /* Run _STA to determine if device is present */ | 565 | /* |
| 566 | 566 | * First, filter based on the device HID and CID. | |
| 567 | status = acpi_ut_execute_STA(node, &flags); | 567 | * |
| 568 | if (ACPI_FAILURE(status)) { | 568 | * 01/2010: For this case where a specific HID is requested, we don't |
| 569 | return (AE_CTRL_DEPTH); | 569 | * want to run _STA until we have an actual HID match. Thus, we will |
| 570 | } | 570 | * not unnecessarily execute _STA on devices for which the caller |
| 571 | 571 | * doesn't care about. Previously, _STA was executed unconditionally | |
| 572 | if (!(flags & ACPI_STA_DEVICE_PRESENT) && | 572 | * on all devices found here. |
| 573 | !(flags & ACPI_STA_DEVICE_FUNCTIONING)) { | 573 | * |
| 574 | /* | 574 | * A side-effect of this change is that now we will continue to search |
| 575 | * Don't examine the children of the device only when the | 575 | * for a matching HID even under device trees where the parent device |
| 576 | * device is neither present nor functional. See ACPI spec, | 576 | * would have returned a _STA that indicates it is not present or |
| 577 | * description of _STA for more information. | 577 | * not functioning (thus aborting the search on that branch). |
| 578 | */ | 578 | */ |
| 579 | return (AE_CTRL_DEPTH); | ||
| 580 | } | ||
| 581 | |||
| 582 | /* Filter based on device HID & CID */ | ||
| 583 | |||
| 584 | if (info->hid != NULL) { | 579 | if (info->hid != NULL) { |
| 585 | status = acpi_ut_execute_HID(node, &hid); | 580 | status = acpi_ut_execute_HID(node, &hid); |
| 586 | if (status == AE_NOT_FOUND) { | 581 | if (status == AE_NOT_FOUND) { |
| @@ -620,6 +615,25 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, | |||
| 620 | } | 615 | } |
| 621 | } | 616 | } |
| 622 | 617 | ||
| 618 | /* Run _STA to determine if device is present */ | ||
| 619 | |||
| 620 | status = acpi_ut_execute_STA(node, &flags); | ||
| 621 | if (ACPI_FAILURE(status)) { | ||
| 622 | return (AE_CTRL_DEPTH); | ||
| 623 | } | ||
| 624 | |||
| 625 | if (!(flags & ACPI_STA_DEVICE_PRESENT) && | ||
| 626 | !(flags & ACPI_STA_DEVICE_FUNCTIONING)) { | ||
| 627 | /* | ||
| 628 | * Don't examine the children of the device only when the | ||
| 629 | * device is neither present nor functional. See ACPI spec, | ||
| 630 | * description of _STA for more information. | ||
| 631 | */ | ||
| 632 | return (AE_CTRL_DEPTH); | ||
| 633 | } | ||
| 634 | |||
| 635 | /* We have a valid device, invoke the user function */ | ||
| 636 | |||
| 623 | status = info->user_function(obj_handle, nesting_level, info->context, | 637 | status = info->user_function(obj_handle, nesting_level, info->context, |
| 624 | return_value); | 638 | return_value); |
| 625 | return (status); | 639 | return (status); |
diff --git a/drivers/acpi/acpica/nsxfname.c b/drivers/acpi/acpica/nsxfname.c index e611dd961b20..b01e45a415e3 100644 --- a/drivers/acpi/acpica/nsxfname.c +++ b/drivers/acpi/acpica/nsxfname.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsxfobj.c b/drivers/acpi/acpica/nsxfobj.c index 0cc6ba01a495..eafef24ea448 100644 --- a/drivers/acpi/acpica/nsxfobj.c +++ b/drivers/acpi/acpica/nsxfobj.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | ******************************************************************************/ | 6 | ******************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/psargs.c b/drivers/acpi/acpica/psargs.c index b161f3544b51..00493e108a01 100644 --- a/drivers/acpi/acpica/psargs.c +++ b/drivers/acpi/acpica/psargs.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -403,7 +403,7 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state, | |||
| 403 | /* Get 1 byte from the AML stream */ | 403 | /* Get 1 byte from the AML stream */ |
| 404 | 404 | ||
| 405 | opcode = AML_BYTE_OP; | 405 | opcode = AML_BYTE_OP; |
| 406 | arg->common.value.integer = (acpi_integer) * aml; | 406 | arg->common.value.integer = (u64) *aml; |
| 407 | length = 1; | 407 | length = 1; |
| 408 | break; | 408 | break; |
| 409 | 409 | ||
diff --git a/drivers/acpi/acpica/psloop.c b/drivers/acpi/acpica/psloop.c index 0988e4a8901d..59aabaeab1d3 100644 --- a/drivers/acpi/acpica/psloop.c +++ b/drivers/acpi/acpica/psloop.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/psopcode.c b/drivers/acpi/acpica/psopcode.c index 3bc3a60194d6..2b0c3be2b1b8 100644 --- a/drivers/acpi/acpica/psopcode.c +++ b/drivers/acpi/acpica/psopcode.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/psparse.c b/drivers/acpi/acpica/psparse.c index 4df8f139026c..8d81542194d4 100644 --- a/drivers/acpi/acpica/psparse.c +++ b/drivers/acpi/acpica/psparse.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/psscope.c b/drivers/acpi/acpica/psscope.c index 2feca5ca9581..40e2b279ea12 100644 --- a/drivers/acpi/acpica/psscope.c +++ b/drivers/acpi/acpica/psscope.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/pstree.c b/drivers/acpi/acpica/pstree.c index 4d3389118ec3..d4b970c3630b 100644 --- a/drivers/acpi/acpica/pstree.c +++ b/drivers/acpi/acpica/pstree.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/psutils.c b/drivers/acpi/acpica/psutils.c index e636e078ad3d..fe29eee5adb1 100644 --- a/drivers/acpi/acpica/psutils.c +++ b/drivers/acpi/acpica/psutils.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/pswalk.c b/drivers/acpi/acpica/pswalk.c index 78b8b791f2ae..8abb9629443d 100644 --- a/drivers/acpi/acpica/pswalk.c +++ b/drivers/acpi/acpica/pswalk.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/psxface.c b/drivers/acpi/acpica/psxface.c index d0c1b91eb8ca..6064dd4e94c2 100644 --- a/drivers/acpi/acpica/psxface.c +++ b/drivers/acpi/acpica/psxface.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rsaddr.c b/drivers/acpi/acpica/rsaddr.c index 1e437bfd8db5..226c806ae986 100644 --- a/drivers/acpi/acpica/rsaddr.c +++ b/drivers/acpi/acpica/rsaddr.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rscalc.c b/drivers/acpi/acpica/rscalc.c index 3c4dcc3d1069..d6ebf7ec622d 100644 --- a/drivers/acpi/acpica/rscalc.c +++ b/drivers/acpi/acpica/rscalc.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rscreate.c b/drivers/acpi/acpica/rscreate.c index a3c23d686d5f..f2ee3b548609 100644 --- a/drivers/acpi/acpica/rscreate.c +++ b/drivers/acpi/acpica/rscreate.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -182,7 +182,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
| 182 | 182 | ||
| 183 | /* | 183 | /* |
| 184 | * Loop through the ACPI_INTERNAL_OBJECTS - Each object should be a | 184 | * Loop through the ACPI_INTERNAL_OBJECTS - Each object should be a |
| 185 | * package that in turn contains an acpi_integer Address, a u8 Pin, | 185 | * package that in turn contains an u64 Address, a u8 Pin, |
| 186 | * a Name, and a u8 source_index. | 186 | * a Name, and a u8 source_index. |
| 187 | */ | 187 | */ |
| 188 | top_object_list = package_object->package.elements; | 188 | top_object_list = package_object->package.elements; |
diff --git a/drivers/acpi/acpica/rsdump.c b/drivers/acpi/acpica/rsdump.c index 3f0ca5a12d34..f859b0386fe4 100644 --- a/drivers/acpi/acpica/rsdump.c +++ b/drivers/acpi/acpica/rsdump.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rsinfo.c b/drivers/acpi/acpica/rsinfo.c index 77b25fdb459c..1fd868b964fd 100644 --- a/drivers/acpi/acpica/rsinfo.c +++ b/drivers/acpi/acpica/rsinfo.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rsio.c b/drivers/acpi/acpica/rsio.c index 35a49aa95609..33bff17c0bbc 100644 --- a/drivers/acpi/acpica/rsio.c +++ b/drivers/acpi/acpica/rsio.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rsirq.c b/drivers/acpi/acpica/rsirq.c index 2e0256983aa6..545da40d7fa7 100644 --- a/drivers/acpi/acpica/rsirq.c +++ b/drivers/acpi/acpica/rsirq.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rslist.c b/drivers/acpi/acpica/rslist.c index 1b1dbc69f087..fd057c72d252 100644 --- a/drivers/acpi/acpica/rslist.c +++ b/drivers/acpi/acpica/rslist.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rsmemory.c b/drivers/acpi/acpica/rsmemory.c index ddc76cebdc92..887b8ba8c432 100644 --- a/drivers/acpi/acpica/rsmemory.c +++ b/drivers/acpi/acpica/rsmemory.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rsmisc.c b/drivers/acpi/acpica/rsmisc.c index 5bc49a553284..07de352fa443 100644 --- a/drivers/acpi/acpica/rsmisc.c +++ b/drivers/acpi/acpica/rsmisc.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rsutils.c b/drivers/acpi/acpica/rsutils.c index bc03d5966829..22cfcfbd9fff 100644 --- a/drivers/acpi/acpica/rsutils.c +++ b/drivers/acpi/acpica/rsutils.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rsxface.c b/drivers/acpi/acpica/rsxface.c index f27feb4772f6..9f6a6e7e1c8e 100644 --- a/drivers/acpi/acpica/rsxface.c +++ b/drivers/acpi/acpica/rsxface.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c index c016335fb759..f43fbe0fc3fc 100644 --- a/drivers/acpi/acpica/tbfadt.c +++ b/drivers/acpi/acpica/tbfadt.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/tbfind.c b/drivers/acpi/acpica/tbfind.c index 1054dfd49207..e252180ce61c 100644 --- a/drivers/acpi/acpica/tbfind.c +++ b/drivers/acpi/acpica/tbfind.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c index 63e82329a9e8..7ec02b0f69e0 100644 --- a/drivers/acpi/acpica/tbinstal.c +++ b/drivers/acpi/acpica/tbinstal.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c index 1f15497f00d1..02723a9fb10c 100644 --- a/drivers/acpi/acpica/tbutils.c +++ b/drivers/acpi/acpica/tbutils.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/tbxface.c b/drivers/acpi/acpica/tbxface.c index a88f02bd6c94..5217a6159a31 100644 --- a/drivers/acpi/acpica/tbxface.c +++ b/drivers/acpi/acpica/tbxface.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/tbxfroot.c b/drivers/acpi/acpica/tbxfroot.c index 85ea834199e2..dda6e8c497d3 100644 --- a/drivers/acpi/acpica/tbxfroot.c +++ b/drivers/acpi/acpica/tbxfroot.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utalloc.c b/drivers/acpi/acpica/utalloc.c index 7580f6b3069e..3d706b8fd449 100644 --- a/drivers/acpi/acpica/utalloc.c +++ b/drivers/acpi/acpica/utalloc.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utcopy.c b/drivers/acpi/acpica/utcopy.c index f857c5efb79f..97ec3621e71d 100644 --- a/drivers/acpi/acpica/utcopy.c +++ b/drivers/acpi/acpica/utcopy.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utdebug.c b/drivers/acpi/acpica/utdebug.c index 527d729f6815..983510640059 100644 --- a/drivers/acpi/acpica/utdebug.c +++ b/drivers/acpi/acpica/utdebug.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -460,8 +460,7 @@ ACPI_EXPORT_SYMBOL(acpi_ut_status_exit) | |||
| 460 | void | 460 | void |
| 461 | acpi_ut_value_exit(u32 line_number, | 461 | acpi_ut_value_exit(u32 line_number, |
| 462 | const char *function_name, | 462 | const char *function_name, |
| 463 | const char *module_name, | 463 | const char *module_name, u32 component_id, u64 value) |
| 464 | u32 component_id, acpi_integer value) | ||
| 465 | { | 464 | { |
| 466 | 465 | ||
| 467 | acpi_debug_print(ACPI_LV_FUNCTIONS, | 466 | acpi_debug_print(ACPI_LV_FUNCTIONS, |
diff --git a/drivers/acpi/acpica/utdelete.c b/drivers/acpi/acpica/utdelete.c index 96e26e70c63d..16b51c69606a 100644 --- a/drivers/acpi/acpica/utdelete.c +++ b/drivers/acpi/acpica/utdelete.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/uteval.c b/drivers/acpi/acpica/uteval.c index 5d54e36ab453..7f5e734ce7f7 100644 --- a/drivers/acpi/acpica/uteval.c +++ b/drivers/acpi/acpica/uteval.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -348,7 +348,7 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, | |||
| 348 | acpi_status | 348 | acpi_status |
| 349 | acpi_ut_evaluate_numeric_object(char *object_name, | 349 | acpi_ut_evaluate_numeric_object(char *object_name, |
| 350 | struct acpi_namespace_node *device_node, | 350 | struct acpi_namespace_node *device_node, |
| 351 | acpi_integer *value) | 351 | u64 *value) |
| 352 | { | 352 | { |
| 353 | union acpi_operand_object *obj_desc; | 353 | union acpi_operand_object *obj_desc; |
| 354 | acpi_status status; | 354 | acpi_status status; |
diff --git a/drivers/acpi/acpica/utglobal.c b/drivers/acpi/acpica/utglobal.c index 3f2c68f4e959..eda3e656c4af 100644 --- a/drivers/acpi/acpica/utglobal.c +++ b/drivers/acpi/acpica/utglobal.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -234,7 +234,7 @@ static const char acpi_gbl_hex_to_ascii[] = { | |||
| 234 | * | 234 | * |
| 235 | ******************************************************************************/ | 235 | ******************************************************************************/ |
| 236 | 236 | ||
| 237 | char acpi_ut_hex_to_ascii_char(acpi_integer integer, u32 position) | 237 | char acpi_ut_hex_to_ascii_char(u64 integer, u32 position) |
| 238 | { | 238 | { |
| 239 | 239 | ||
| 240 | return (acpi_gbl_hex_to_ascii[(integer >> position) & 0xF]); | 240 | return (acpi_gbl_hex_to_ascii[(integer >> position) & 0xF]); |
diff --git a/drivers/acpi/acpica/utids.c b/drivers/acpi/acpica/utids.c index 52eaae404554..1397fadd0d4b 100644 --- a/drivers/acpi/acpica/utids.c +++ b/drivers/acpi/acpica/utids.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2009, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utinit.c b/drivers/acpi/acpica/utinit.c index 9d0919ebf7b0..a39c93dac719 100644 --- a/drivers/acpi/acpica/utinit.c +++ b/drivers/acpi/acpica/utinit.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utlock.c b/drivers/acpi/acpica/utlock.c index 25e03120686d..b081cd46a15f 100644 --- a/drivers/acpi/acpica/utlock.c +++ b/drivers/acpi/acpica/utlock.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2009, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utmath.c b/drivers/acpi/acpica/utmath.c index c9f682d640ef..35059a14eb72 100644 --- a/drivers/acpi/acpica/utmath.c +++ b/drivers/acpi/acpica/utmath.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -70,9 +70,8 @@ ACPI_MODULE_NAME("utmath") | |||
| 70 | * | 70 | * |
| 71 | ******************************************************************************/ | 71 | ******************************************************************************/ |
| 72 | acpi_status | 72 | acpi_status |
| 73 | acpi_ut_short_divide(acpi_integer dividend, | 73 | acpi_ut_short_divide(u64 dividend, |
| 74 | u32 divisor, | 74 | u32 divisor, u64 *out_quotient, u32 *out_remainder) |
| 75 | acpi_integer * out_quotient, u32 * out_remainder) | ||
| 76 | { | 75 | { |
| 77 | union uint64_overlay dividend_ovl; | 76 | union uint64_overlay dividend_ovl; |
| 78 | union uint64_overlay quotient; | 77 | union uint64_overlay quotient; |
| @@ -126,9 +125,8 @@ acpi_ut_short_divide(acpi_integer dividend, | |||
| 126 | ******************************************************************************/ | 125 | ******************************************************************************/ |
| 127 | 126 | ||
| 128 | acpi_status | 127 | acpi_status |
| 129 | acpi_ut_divide(acpi_integer in_dividend, | 128 | acpi_ut_divide(u64 in_dividend, |
| 130 | acpi_integer in_divisor, | 129 | u64 in_divisor, u64 *out_quotient, u64 *out_remainder) |
| 131 | acpi_integer * out_quotient, acpi_integer * out_remainder) | ||
| 132 | { | 130 | { |
| 133 | union uint64_overlay dividend; | 131 | union uint64_overlay dividend; |
| 134 | union uint64_overlay divisor; | 132 | union uint64_overlay divisor; |
| @@ -199,9 +197,8 @@ acpi_ut_divide(acpi_integer in_dividend, | |||
| 199 | * The 64-bit remainder must be generated. | 197 | * The 64-bit remainder must be generated. |
| 200 | */ | 198 | */ |
| 201 | partial1 = quotient.part.lo * divisor.part.hi; | 199 | partial1 = quotient.part.lo * divisor.part.hi; |
| 202 | partial2.full = | 200 | partial2.full = (u64) quotient.part.lo * divisor.part.lo; |
| 203 | (acpi_integer) quotient.part.lo * divisor.part.lo; | 201 | partial3.full = (u64) partial2.part.hi + partial1; |
| 204 | partial3.full = (acpi_integer) partial2.part.hi + partial1; | ||
| 205 | 202 | ||
| 206 | remainder.part.hi = partial3.part.lo; | 203 | remainder.part.hi = partial3.part.lo; |
| 207 | remainder.part.lo = partial2.part.lo; | 204 | remainder.part.lo = partial2.part.lo; |
| @@ -257,9 +254,8 @@ acpi_ut_divide(acpi_integer in_dividend, | |||
| 257 | * | 254 | * |
| 258 | ******************************************************************************/ | 255 | ******************************************************************************/ |
| 259 | acpi_status | 256 | acpi_status |
| 260 | acpi_ut_short_divide(acpi_integer in_dividend, | 257 | acpi_ut_short_divide(u64 in_dividend, |
| 261 | u32 divisor, | 258 | u32 divisor, u64 *out_quotient, u32 *out_remainder) |
| 262 | acpi_integer * out_quotient, u32 * out_remainder) | ||
| 263 | { | 259 | { |
| 264 | 260 | ||
| 265 | ACPI_FUNCTION_TRACE(ut_short_divide); | 261 | ACPI_FUNCTION_TRACE(ut_short_divide); |
| @@ -284,9 +280,8 @@ acpi_ut_short_divide(acpi_integer in_dividend, | |||
| 284 | } | 280 | } |
| 285 | 281 | ||
| 286 | acpi_status | 282 | acpi_status |
| 287 | acpi_ut_divide(acpi_integer in_dividend, | 283 | acpi_ut_divide(u64 in_dividend, |
| 288 | acpi_integer in_divisor, | 284 | u64 in_divisor, u64 *out_quotient, u64 *out_remainder) |
| 289 | acpi_integer * out_quotient, acpi_integer * out_remainder) | ||
| 290 | { | 285 | { |
| 291 | ACPI_FUNCTION_TRACE(ut_divide); | 286 | ACPI_FUNCTION_TRACE(ut_divide); |
| 292 | 287 | ||
diff --git a/drivers/acpi/acpica/utmisc.c b/drivers/acpi/acpica/utmisc.c index 6c6a5137b728..32982e2ac384 100644 --- a/drivers/acpi/acpica/utmisc.c +++ b/drivers/acpi/acpica/utmisc.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -724,13 +724,12 @@ acpi_name acpi_ut_repair_name(char *name) | |||
| 724 | * | 724 | * |
| 725 | ******************************************************************************/ | 725 | ******************************************************************************/ |
| 726 | 726 | ||
| 727 | acpi_status | 727 | acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 * ret_integer) |
| 728 | acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer) | ||
| 729 | { | 728 | { |
| 730 | u32 this_digit = 0; | 729 | u32 this_digit = 0; |
| 731 | acpi_integer return_value = 0; | 730 | u64 return_value = 0; |
| 732 | acpi_integer quotient; | 731 | u64 quotient; |
| 733 | acpi_integer dividend; | 732 | u64 dividend; |
| 734 | u32 to_integer_op = (base == ACPI_ANY_BASE); | 733 | u32 to_integer_op = (base == ACPI_ANY_BASE); |
| 735 | u32 mode32 = (acpi_gbl_integer_byte_width == 4); | 734 | u32 mode32 = (acpi_gbl_integer_byte_width == 4); |
| 736 | u8 valid_digits = 0; | 735 | u8 valid_digits = 0; |
| @@ -844,9 +843,8 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer) | |||
| 844 | 843 | ||
| 845 | /* Divide the digit into the correct position */ | 844 | /* Divide the digit into the correct position */ |
| 846 | 845 | ||
| 847 | (void) | 846 | (void)acpi_ut_short_divide((dividend - (u64) this_digit), |
| 848 | acpi_ut_short_divide((dividend - (acpi_integer) this_digit), | 847 | base, "ient, NULL); |
| 849 | base, "ient, NULL); | ||
| 850 | 848 | ||
| 851 | if (return_value > quotient) { | 849 | if (return_value > quotient) { |
| 852 | if (to_integer_op) { | 850 | if (to_integer_op) { |
diff --git a/drivers/acpi/acpica/utmutex.c b/drivers/acpi/acpica/utmutex.c index 80bb65154117..55d014ed6d55 100644 --- a/drivers/acpi/acpica/utmutex.c +++ b/drivers/acpi/acpica/utmutex.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -50,7 +50,7 @@ ACPI_MODULE_NAME("utmutex") | |||
| 50 | /* Local prototypes */ | 50 | /* Local prototypes */ |
| 51 | static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id); | 51 | static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id); |
| 52 | 52 | ||
| 53 | static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id); | 53 | static void acpi_ut_delete_mutex(acpi_mutex_handle mutex_id); |
| 54 | 54 | ||
| 55 | /******************************************************************************* | 55 | /******************************************************************************* |
| 56 | * | 56 | * |
| @@ -114,7 +114,7 @@ void acpi_ut_mutex_terminate(void) | |||
| 114 | /* Delete each predefined mutex object */ | 114 | /* Delete each predefined mutex object */ |
| 115 | 115 | ||
| 116 | for (i = 0; i < ACPI_NUM_MUTEX; i++) { | 116 | for (i = 0; i < ACPI_NUM_MUTEX; i++) { |
| 117 | (void)acpi_ut_delete_mutex(i); | 117 | acpi_ut_delete_mutex(i); |
| 118 | } | 118 | } |
| 119 | 119 | ||
| 120 | /* Delete the spinlocks */ | 120 | /* Delete the spinlocks */ |
| @@ -146,10 +146,6 @@ static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id) | |||
| 146 | 146 | ||
| 147 | ACPI_FUNCTION_TRACE_U32(ut_create_mutex, mutex_id); | 147 | ACPI_FUNCTION_TRACE_U32(ut_create_mutex, mutex_id); |
| 148 | 148 | ||
| 149 | if (mutex_id > ACPI_MAX_MUTEX) { | ||
| 150 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
| 151 | } | ||
| 152 | |||
| 153 | if (!acpi_gbl_mutex_info[mutex_id].mutex) { | 149 | if (!acpi_gbl_mutex_info[mutex_id].mutex) { |
| 154 | status = | 150 | status = |
| 155 | acpi_os_create_mutex(&acpi_gbl_mutex_info[mutex_id].mutex); | 151 | acpi_os_create_mutex(&acpi_gbl_mutex_info[mutex_id].mutex); |
| @@ -173,21 +169,15 @@ static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id) | |||
| 173 | * | 169 | * |
| 174 | ******************************************************************************/ | 170 | ******************************************************************************/ |
| 175 | 171 | ||
| 176 | static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id) | 172 | static void acpi_ut_delete_mutex(acpi_mutex_handle mutex_id) |
| 177 | { | 173 | { |
| 178 | 174 | ||
| 179 | ACPI_FUNCTION_TRACE_U32(ut_delete_mutex, mutex_id); | 175 | ACPI_FUNCTION_TRACE_U32(ut_delete_mutex, mutex_id); |
| 180 | 176 | ||
| 181 | if (mutex_id > ACPI_MAX_MUTEX) { | ||
| 182 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
| 183 | } | ||
| 184 | |||
| 185 | acpi_os_delete_mutex(acpi_gbl_mutex_info[mutex_id].mutex); | 177 | acpi_os_delete_mutex(acpi_gbl_mutex_info[mutex_id].mutex); |
| 186 | 178 | ||
| 187 | acpi_gbl_mutex_info[mutex_id].mutex = NULL; | 179 | acpi_gbl_mutex_info[mutex_id].mutex = NULL; |
| 188 | acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED; | 180 | acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED; |
| 189 | |||
| 190 | return_ACPI_STATUS(AE_OK); | ||
| 191 | } | 181 | } |
| 192 | 182 | ||
| 193 | /******************************************************************************* | 183 | /******************************************************************************* |
diff --git a/drivers/acpi/acpica/utobject.c b/drivers/acpi/acpica/utobject.c index 42e658b543f1..3356f0cb0745 100644 --- a/drivers/acpi/acpica/utobject.c +++ b/drivers/acpi/acpica/utobject.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utresrc.c b/drivers/acpi/acpica/utresrc.c index 91b7c00236f4..7965919000b1 100644 --- a/drivers/acpi/acpica/utresrc.c +++ b/drivers/acpi/acpica/utresrc.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utstate.c b/drivers/acpi/acpica/utstate.c index 0440c958f5a4..d35d109b8da2 100644 --- a/drivers/acpi/acpica/utstate.c +++ b/drivers/acpi/acpica/utstate.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utxface.c b/drivers/acpi/acpica/utxface.c index b1f5f680bc78..db9d8ca57987 100644 --- a/drivers/acpi/acpica/utxface.c +++ b/drivers/acpi/acpica/utxface.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 1ca0ea77115b..75f39f2c166d 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
| @@ -362,8 +362,8 @@ static int extract_package(struct acpi_battery *battery, | |||
| 362 | strncpy(ptr, element->string.pointer, 32); | 362 | strncpy(ptr, element->string.pointer, 32); |
| 363 | else if (element->type == ACPI_TYPE_INTEGER) { | 363 | else if (element->type == ACPI_TYPE_INTEGER) { |
| 364 | strncpy(ptr, (u8 *)&element->integer.value, | 364 | strncpy(ptr, (u8 *)&element->integer.value, |
| 365 | sizeof(acpi_integer)); | 365 | sizeof(u64)); |
| 366 | ptr[sizeof(acpi_integer)] = 0; | 366 | ptr[sizeof(u64)] = 0; |
| 367 | } else | 367 | } else |
| 368 | *ptr = 0; /* don't have value */ | 368 | *ptr = 0; /* don't have value */ |
| 369 | } else { | 369 | } else { |
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index cf761b904e4a..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; |
| @@ -490,9 +490,14 @@ static void acpi_bus_osc_support(void) | |||
| 490 | 490 | ||
| 491 | capbuf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE; | 491 | capbuf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE; |
| 492 | capbuf[OSC_SUPPORT_TYPE] = OSC_SB_PR3_SUPPORT; /* _PR3 is in use */ | 492 | capbuf[OSC_SUPPORT_TYPE] = OSC_SB_PR3_SUPPORT; /* _PR3 is in use */ |
| 493 | #ifdef CONFIG_ACPI_PROCESSOR_AGGREGATOR | 493 | #if defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR) ||\ |
| 494 | defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR_MODULE) | ||
| 494 | capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_PAD_SUPPORT; | 495 | capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_PAD_SUPPORT; |
| 495 | #endif | 496 | #endif |
| 497 | |||
| 498 | #if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE) | ||
| 499 | capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_PPC_OST_SUPPORT; | ||
| 500 | #endif | ||
| 496 | if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle))) | 501 | if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle))) |
| 497 | return; | 502 | return; |
| 498 | if (ACPI_SUCCESS(acpi_run_osc(handle, &context))) | 503 | if (ACPI_SUCCESS(acpi_run_osc(handle, &context))) |
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 8a95e8329df7..f53fbe307c9d 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
| @@ -422,11 +422,10 @@ static int acpi_button_add(struct acpi_device *device) | |||
| 422 | 422 | ||
| 423 | if (device->wakeup.flags.valid) { | 423 | if (device->wakeup.flags.valid) { |
| 424 | /* Button's GPE is run-wake GPE */ | 424 | /* Button's GPE is run-wake GPE */ |
| 425 | acpi_set_gpe_type(device->wakeup.gpe_device, | ||
| 426 | device->wakeup.gpe_number, | ||
| 427 | ACPI_GPE_TYPE_WAKE_RUN); | ||
| 428 | acpi_enable_gpe(device->wakeup.gpe_device, | 425 | acpi_enable_gpe(device->wakeup.gpe_device, |
| 429 | device->wakeup.gpe_number); | 426 | device->wakeup.gpe_number, |
| 427 | ACPI_GPE_TYPE_WAKE_RUN); | ||
| 428 | device->wakeup.run_wake_count++; | ||
| 430 | device->wakeup.state.enabled = 1; | 429 | device->wakeup.state.enabled = 1; |
| 431 | } | 430 | } |
| 432 | 431 | ||
| @@ -446,6 +445,14 @@ static int acpi_button_remove(struct acpi_device *device, int type) | |||
| 446 | { | 445 | { |
| 447 | struct acpi_button *button = acpi_driver_data(device); | 446 | struct acpi_button *button = acpi_driver_data(device); |
| 448 | 447 | ||
| 448 | if (device->wakeup.flags.valid) { | ||
| 449 | acpi_disable_gpe(device->wakeup.gpe_device, | ||
| 450 | device->wakeup.gpe_number, | ||
| 451 | ACPI_GPE_TYPE_WAKE_RUN); | ||
| 452 | device->wakeup.run_wake_count--; | ||
| 453 | device->wakeup.state.enabled = 0; | ||
| 454 | } | ||
| 455 | |||
| 449 | acpi_button_remove_fs(device); | 456 | acpi_button_remove_fs(device); |
| 450 | input_unregister_device(button->input); | 457 | input_unregister_device(button->input); |
| 451 | kfree(button); | 458 | kfree(button); |
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c index bbc2c1315c47..d9a85f1ddde6 100644 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.c | |||
| @@ -605,7 +605,7 @@ register_hotplug_dock_device(acpi_handle handle, struct acpi_dock_ops *ops, | |||
| 605 | list_for_each_entry(dock_station, &dock_stations, sibling) { | 605 | list_for_each_entry(dock_station, &dock_stations, sibling) { |
| 606 | /* | 606 | /* |
| 607 | * An ATA bay can be in a dock and itself can be ejected | 607 | * An ATA bay can be in a dock and itself can be ejected |
| 608 | * seperately, so there are two 'dock stations' which need the | 608 | * separately, so there are two 'dock stations' which need the |
| 609 | * ops | 609 | * ops |
| 610 | */ | 610 | */ |
| 611 | dd = find_dock_dependent_device(dock_station, handle); | 611 | dd = find_dock_dependent_device(dock_station, handle); |
| @@ -935,6 +935,7 @@ static int dock_add(acpi_handle handle) | |||
| 935 | struct platform_device *dd; | 935 | struct platform_device *dd; |
| 936 | 936 | ||
| 937 | id = dock_station_count; | 937 | id = dock_station_count; |
| 938 | memset(&ds, 0, sizeof(ds)); | ||
| 938 | dd = platform_device_register_data(NULL, "dock", id, &ds, sizeof(ds)); | 939 | dd = platform_device_register_data(NULL, "dock", id, &ds, sizeof(ds)); |
| 939 | if (IS_ERR(dd)) | 940 | if (IS_ERR(dd)) |
| 940 | return PTR_ERR(dd); | 941 | return PTR_ERR(dd); |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index fd1801bdee66..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 */ |
| @@ -201,14 +202,13 @@ unlock: | |||
| 201 | spin_unlock_irqrestore(&ec->curr_lock, flags); | 202 | spin_unlock_irqrestore(&ec->curr_lock, flags); |
| 202 | } | 203 | } |
| 203 | 204 | ||
| 204 | static void acpi_ec_gpe_query(void *ec_cxt); | 205 | static int acpi_ec_sync_query(struct acpi_ec *ec); |
| 205 | 206 | ||
| 206 | static int ec_check_sci(struct acpi_ec *ec, u8 state) | 207 | static int ec_check_sci_sync(struct acpi_ec *ec, u8 state) |
| 207 | { | 208 | { |
| 208 | if (state & ACPI_EC_FLAG_SCI) { | 209 | if (state & ACPI_EC_FLAG_SCI) { |
| 209 | if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) | 210 | if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) |
| 210 | return acpi_os_execute(OSL_EC_BURST_HANDLER, | 211 | return acpi_ec_sync_query(ec); |
| 211 | acpi_ec_gpe_query, ec); | ||
| 212 | } | 212 | } |
| 213 | return 0; | 213 | return 0; |
| 214 | } | 214 | } |
| @@ -249,11 +249,6 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, | |||
| 249 | { | 249 | { |
| 250 | unsigned long tmp; | 250 | unsigned long tmp; |
| 251 | int ret = 0; | 251 | int ret = 0; |
| 252 | pr_debug(PREFIX "transaction start\n"); | ||
| 253 | /* disable GPE during transaction if storm is detected */ | ||
| 254 | if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { | ||
| 255 | acpi_disable_gpe(NULL, ec->gpe); | ||
| 256 | } | ||
| 257 | if (EC_FLAGS_MSI) | 252 | if (EC_FLAGS_MSI) |
| 258 | udelay(ACPI_EC_MSI_UDELAY); | 253 | udelay(ACPI_EC_MSI_UDELAY); |
| 259 | /* start transaction */ | 254 | /* start transaction */ |
| @@ -265,20 +260,9 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, | |||
| 265 | clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); | 260 | clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); |
| 266 | spin_unlock_irqrestore(&ec->curr_lock, tmp); | 261 | spin_unlock_irqrestore(&ec->curr_lock, tmp); |
| 267 | ret = ec_poll(ec); | 262 | ret = ec_poll(ec); |
| 268 | pr_debug(PREFIX "transaction end\n"); | ||
| 269 | spin_lock_irqsave(&ec->curr_lock, tmp); | 263 | spin_lock_irqsave(&ec->curr_lock, tmp); |
| 270 | ec->curr = NULL; | 264 | ec->curr = NULL; |
| 271 | spin_unlock_irqrestore(&ec->curr_lock, tmp); | 265 | spin_unlock_irqrestore(&ec->curr_lock, tmp); |
| 272 | if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { | ||
| 273 | /* check if we received SCI during transaction */ | ||
| 274 | ec_check_sci(ec, acpi_ec_read_status(ec)); | ||
| 275 | /* it is safe to enable GPE outside of transaction */ | ||
| 276 | acpi_enable_gpe(NULL, ec->gpe); | ||
| 277 | } else if (t->irq_count > ACPI_EC_STORM_THRESHOLD) { | ||
| 278 | pr_info(PREFIX "GPE storm detected, " | ||
| 279 | "transactions will use polling mode\n"); | ||
| 280 | set_bit(EC_FLAGS_GPE_STORM, &ec->flags); | ||
| 281 | } | ||
| 282 | return ret; | 266 | return ret; |
| 283 | } | 267 | } |
| 284 | 268 | ||
| @@ -308,6 +292,10 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t) | |||
| 308 | if (t->rdata) | 292 | if (t->rdata) |
| 309 | memset(t->rdata, 0, t->rlen); | 293 | memset(t->rdata, 0, t->rlen); |
| 310 | 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 | } | ||
| 311 | if (ec->global_lock) { | 299 | if (ec->global_lock) { |
| 312 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); | 300 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); |
| 313 | if (ACPI_FAILURE(status)) { | 301 | if (ACPI_FAILURE(status)) { |
| @@ -321,7 +309,34 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t) | |||
| 321 | status = -ETIME; | 309 | status = -ETIME; |
| 322 | goto end; | 310 | goto end; |
| 323 | } | 311 | } |
| 312 | pr_debug(PREFIX "transaction start\n"); | ||
| 313 | /* disable GPE during transaction if storm is detected */ | ||
| 314 | if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { | ||
| 315 | /* | ||
| 316 | * It has to be disabled at the hardware level regardless of the | ||
| 317 | * GPE reference counting, so that it doesn't trigger. | ||
| 318 | */ | ||
| 319 | acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_DISABLE); | ||
| 320 | } | ||
| 321 | |||
| 324 | status = acpi_ec_transaction_unlocked(ec, t); | 322 | status = acpi_ec_transaction_unlocked(ec, t); |
| 323 | |||
| 324 | /* check if we received SCI during transaction */ | ||
| 325 | ec_check_sci_sync(ec, acpi_ec_read_status(ec)); | ||
| 326 | if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { | ||
| 327 | msleep(1); | ||
| 328 | /* | ||
| 329 | * It is safe to enable the GPE outside of the transaction. Use | ||
| 330 | * acpi_set_gpe() for that, since we used it to disable the GPE | ||
| 331 | * above. | ||
| 332 | */ | ||
| 333 | acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_ENABLE); | ||
| 334 | } else if (t->irq_count > ACPI_EC_STORM_THRESHOLD) { | ||
| 335 | pr_info(PREFIX "GPE storm detected, " | ||
| 336 | "transactions will use polling mode\n"); | ||
| 337 | set_bit(EC_FLAGS_GPE_STORM, &ec->flags); | ||
| 338 | } | ||
| 339 | pr_debug(PREFIX "transaction end\n"); | ||
| 325 | end: | 340 | end: |
| 326 | if (ec->global_lock) | 341 | if (ec->global_lock) |
| 327 | acpi_release_global_lock(glk); | 342 | acpi_release_global_lock(glk); |
| @@ -443,7 +458,33 @@ int ec_transaction(u8 command, | |||
| 443 | 458 | ||
| 444 | EXPORT_SYMBOL(ec_transaction); | 459 | EXPORT_SYMBOL(ec_transaction); |
| 445 | 460 | ||
| 446 | static int acpi_ec_query(struct acpi_ec *ec, u8 * data) | 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 | |||
| 487 | static int acpi_ec_query_unlocked(struct acpi_ec *ec, u8 * data) | ||
| 447 | { | 488 | { |
| 448 | int result; | 489 | int result; |
| 449 | u8 d; | 490 | u8 d; |
| @@ -452,20 +493,16 @@ static int acpi_ec_query(struct acpi_ec *ec, u8 * data) | |||
| 452 | .wlen = 0, .rlen = 1}; | 493 | .wlen = 0, .rlen = 1}; |
| 453 | if (!ec || !data) | 494 | if (!ec || !data) |
| 454 | return -EINVAL; | 495 | return -EINVAL; |
| 455 | |||
| 456 | /* | 496 | /* |
| 457 | * Query the EC to find out which _Qxx method we need to evaluate. | 497 | * Query the EC to find out which _Qxx method we need to evaluate. |
| 458 | * Note that successful completion of the query causes the ACPI_EC_SCI | 498 | * Note that successful completion of the query causes the ACPI_EC_SCI |
| 459 | * bit to be cleared (and thus clearing the interrupt source). | 499 | * bit to be cleared (and thus clearing the interrupt source). |
| 460 | */ | 500 | */ |
| 461 | 501 | result = acpi_ec_transaction_unlocked(ec, &t); | |
| 462 | result = acpi_ec_transaction(ec, &t); | ||
| 463 | if (result) | 502 | if (result) |
| 464 | return result; | 503 | return result; |
| 465 | |||
| 466 | if (!d) | 504 | if (!d) |
| 467 | return -ENODATA; | 505 | return -ENODATA; |
| 468 | |||
| 469 | *data = d; | 506 | *data = d; |
| 470 | return 0; | 507 | return 0; |
| 471 | } | 508 | } |
| @@ -509,43 +546,79 @@ void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit) | |||
| 509 | 546 | ||
| 510 | EXPORT_SYMBOL_GPL(acpi_ec_remove_query_handler); | 547 | EXPORT_SYMBOL_GPL(acpi_ec_remove_query_handler); |
| 511 | 548 | ||
| 512 | static void acpi_ec_gpe_query(void *ec_cxt) | 549 | static void acpi_ec_run(void *cxt) |
| 513 | { | 550 | { |
| 514 | struct acpi_ec *ec = ec_cxt; | 551 | struct acpi_ec_query_handler *handler = cxt; |
| 515 | u8 value = 0; | 552 | if (!handler) |
| 516 | struct acpi_ec_query_handler *handler, copy; | ||
| 517 | |||
| 518 | if (!ec || acpi_ec_query(ec, &value)) | ||
| 519 | return; | 553 | return; |
| 520 | mutex_lock(&ec->lock); | 554 | pr_debug(PREFIX "start query execution\n"); |
| 555 | if (handler->func) | ||
| 556 | handler->func(handler->data); | ||
| 557 | else if (handler->handle) | ||
| 558 | acpi_evaluate_object(handler->handle, NULL, NULL, NULL); | ||
| 559 | pr_debug(PREFIX "stop query execution\n"); | ||
| 560 | kfree(handler); | ||
| 561 | } | ||
| 562 | |||
| 563 | static int acpi_ec_sync_query(struct acpi_ec *ec) | ||
| 564 | { | ||
| 565 | u8 value = 0; | ||
| 566 | int status; | ||
| 567 | struct acpi_ec_query_handler *handler, *copy; | ||
| 568 | if ((status = acpi_ec_query_unlocked(ec, &value))) | ||
| 569 | return status; | ||
| 521 | list_for_each_entry(handler, &ec->list, node) { | 570 | list_for_each_entry(handler, &ec->list, node) { |
| 522 | if (value == handler->query_bit) { | 571 | if (value == handler->query_bit) { |
| 523 | /* have custom handler for this bit */ | 572 | /* have custom handler for this bit */ |
| 524 | memcpy(©, handler, sizeof(copy)); | 573 | copy = kmalloc(sizeof(*handler), GFP_KERNEL); |
| 525 | mutex_unlock(&ec->lock); | 574 | if (!copy) |
| 526 | if (copy.func) { | 575 | return -ENOMEM; |
| 527 | copy.func(copy.data); | 576 | memcpy(copy, handler, sizeof(*copy)); |
| 528 | } else if (copy.handle) { | 577 | pr_debug(PREFIX "push query execution (0x%2x) on queue\n", value); |
| 529 | acpi_evaluate_object(copy.handle, NULL, NULL, NULL); | 578 | return acpi_os_execute((copy->func) ? |
| 530 | } | 579 | OSL_NOTIFY_HANDLER : OSL_GPE_HANDLER, |
| 531 | return; | 580 | acpi_ec_run, copy); |
| 532 | } | 581 | } |
| 533 | } | 582 | } |
| 583 | return 0; | ||
| 584 | } | ||
| 585 | |||
| 586 | static void acpi_ec_gpe_query(void *ec_cxt) | ||
| 587 | { | ||
| 588 | struct acpi_ec *ec = ec_cxt; | ||
| 589 | if (!ec) | ||
| 590 | return; | ||
| 591 | mutex_lock(&ec->lock); | ||
| 592 | acpi_ec_sync_query(ec); | ||
| 534 | mutex_unlock(&ec->lock); | 593 | mutex_unlock(&ec->lock); |
| 535 | } | 594 | } |
| 536 | 595 | ||
| 596 | static void acpi_ec_gpe_query(void *ec_cxt); | ||
| 597 | |||
| 598 | static int ec_check_sci(struct acpi_ec *ec, u8 state) | ||
| 599 | { | ||
| 600 | if (state & ACPI_EC_FLAG_SCI) { | ||
| 601 | if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) { | ||
| 602 | pr_debug(PREFIX "push gpe query to the queue\n"); | ||
| 603 | return acpi_os_execute(OSL_NOTIFY_HANDLER, | ||
| 604 | acpi_ec_gpe_query, ec); | ||
| 605 | } | ||
| 606 | } | ||
| 607 | return 0; | ||
| 608 | } | ||
| 609 | |||
| 537 | static u32 acpi_ec_gpe_handler(void *data) | 610 | static u32 acpi_ec_gpe_handler(void *data) |
| 538 | { | 611 | { |
| 539 | struct acpi_ec *ec = data; | 612 | struct acpi_ec *ec = data; |
| 540 | u8 status; | ||
| 541 | 613 | ||
| 542 | pr_debug(PREFIX "~~~> interrupt\n"); | 614 | pr_debug(PREFIX "~~~> interrupt\n"); |
| 543 | status = acpi_ec_read_status(ec); | ||
| 544 | 615 | ||
| 545 | advance_transaction(ec, status); | 616 | advance_transaction(ec, acpi_ec_read_status(ec)); |
| 546 | if (ec_transaction_done(ec) && (status & ACPI_EC_FLAG_IBF) == 0) | 617 | if (ec_transaction_done(ec) && |
| 618 | (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) == 0) { | ||
| 547 | wake_up(&ec->wait); | 619 | wake_up(&ec->wait); |
| 548 | ec_check_sci(ec, status); | 620 | ec_check_sci(ec, acpi_ec_read_status(ec)); |
| 621 | } | ||
| 549 | return ACPI_INTERRUPT_HANDLED; | 622 | return ACPI_INTERRUPT_HANDLED; |
| 550 | } | 623 | } |
| 551 | 624 | ||
| @@ -555,7 +628,7 @@ static u32 acpi_ec_gpe_handler(void *data) | |||
| 555 | 628 | ||
| 556 | static acpi_status | 629 | static acpi_status |
| 557 | acpi_ec_space_handler(u32 function, acpi_physical_address address, | 630 | acpi_ec_space_handler(u32 function, acpi_physical_address address, |
| 558 | u32 bits, acpi_integer *value, | 631 | u32 bits, u64 *value, |
| 559 | void *handler_context, void *region_context) | 632 | void *handler_context, void *region_context) |
| 560 | { | 633 | { |
| 561 | struct acpi_ec *ec = handler_context; | 634 | struct acpi_ec *ec = handler_context; |
| @@ -586,7 +659,7 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address, | |||
| 586 | ++address; | 659 | ++address; |
| 587 | if (function == ACPI_READ) { | 660 | if (function == ACPI_READ) { |
| 588 | result = acpi_ec_read(ec, address, &temp); | 661 | result = acpi_ec_read(ec, address, &temp); |
| 589 | (*value) |= ((acpi_integer)temp) << i; | 662 | (*value) |= ((u64)temp) << i; |
| 590 | } else { | 663 | } else { |
| 591 | temp = 0xff & ((*value) >> i); | 664 | temp = 0xff & ((*value) >> i); |
| 592 | result = acpi_ec_write(ec, address, temp); | 665 | result = acpi_ec_write(ec, address, temp); |
| @@ -754,8 +827,8 @@ static int ec_install_handlers(struct acpi_ec *ec) | |||
| 754 | &acpi_ec_gpe_handler, ec); | 827 | &acpi_ec_gpe_handler, ec); |
| 755 | if (ACPI_FAILURE(status)) | 828 | if (ACPI_FAILURE(status)) |
| 756 | return -ENODEV; | 829 | return -ENODEV; |
| 757 | acpi_set_gpe_type(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME); | 830 | |
| 758 | acpi_enable_gpe(NULL, ec->gpe); | 831 | acpi_enable_gpe(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME); |
| 759 | status = acpi_install_address_space_handler(ec->handle, | 832 | status = acpi_install_address_space_handler(ec->handle, |
| 760 | ACPI_ADR_SPACE_EC, | 833 | ACPI_ADR_SPACE_EC, |
| 761 | &acpi_ec_space_handler, | 834 | &acpi_ec_space_handler, |
| @@ -772,6 +845,7 @@ static int ec_install_handlers(struct acpi_ec *ec) | |||
| 772 | } else { | 845 | } else { |
| 773 | acpi_remove_gpe_handler(NULL, ec->gpe, | 846 | acpi_remove_gpe_handler(NULL, ec->gpe, |
| 774 | &acpi_ec_gpe_handler); | 847 | &acpi_ec_gpe_handler); |
| 848 | acpi_disable_gpe(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME); | ||
| 775 | return -ENODEV; | 849 | return -ENODEV; |
| 776 | } | 850 | } |
| 777 | } | 851 | } |
| @@ -782,6 +856,7 @@ static int ec_install_handlers(struct acpi_ec *ec) | |||
| 782 | 856 | ||
| 783 | static void ec_remove_handlers(struct acpi_ec *ec) | 857 | static void ec_remove_handlers(struct acpi_ec *ec) |
| 784 | { | 858 | { |
| 859 | acpi_disable_gpe(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME); | ||
| 785 | if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle, | 860 | if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle, |
| 786 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler))) | 861 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler))) |
| 787 | pr_err(PREFIX "failed to remove space handler\n"); | 862 | pr_err(PREFIX "failed to remove space handler\n"); |
| @@ -1023,16 +1098,16 @@ error: | |||
| 1023 | static int acpi_ec_suspend(struct acpi_device *device, pm_message_t state) | 1098 | static int acpi_ec_suspend(struct acpi_device *device, pm_message_t state) |
| 1024 | { | 1099 | { |
| 1025 | struct acpi_ec *ec = acpi_driver_data(device); | 1100 | struct acpi_ec *ec = acpi_driver_data(device); |
| 1026 | /* Stop using GPE */ | 1101 | /* Stop using the GPE, but keep it reference counted. */ |
| 1027 | acpi_disable_gpe(NULL, ec->gpe); | 1102 | acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_DISABLE); |
| 1028 | return 0; | 1103 | return 0; |
| 1029 | } | 1104 | } |
| 1030 | 1105 | ||
| 1031 | static int acpi_ec_resume(struct acpi_device *device) | 1106 | static int acpi_ec_resume(struct acpi_device *device) |
| 1032 | { | 1107 | { |
| 1033 | struct acpi_ec *ec = acpi_driver_data(device); | 1108 | struct acpi_ec *ec = acpi_driver_data(device); |
| 1034 | /* Enable use of GPE back */ | 1109 | /* Enable the GPE again, but don't reference count it once more. */ |
| 1035 | acpi_enable_gpe(NULL, ec->gpe); | 1110 | acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_ENABLE); |
| 1036 | return 0; | 1111 | return 0; |
| 1037 | } | 1112 | } |
| 1038 | 1113 | ||
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index 4c8fcff662cf..6d5b64b7d526 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c | |||
| @@ -87,7 +87,7 @@ static int acpi_find_bridge_device(struct device *dev, acpi_handle * handle) | |||
| 87 | /* Get device's handler per its address under its parent */ | 87 | /* Get device's handler per its address under its parent */ |
| 88 | struct acpi_find_child { | 88 | struct acpi_find_child { |
| 89 | acpi_handle handle; | 89 | acpi_handle handle; |
| 90 | acpi_integer address; | 90 | u64 address; |
| 91 | }; | 91 | }; |
| 92 | 92 | ||
| 93 | static acpi_status | 93 | static acpi_status |
| @@ -106,7 +106,7 @@ do_acpi_find_child(acpi_handle handle, u32 lvl, void *context, void **rv) | |||
| 106 | return AE_OK; | 106 | return AE_OK; |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | acpi_handle acpi_get_child(acpi_handle parent, acpi_integer address) | 109 | acpi_handle acpi_get_child(acpi_handle parent, u64 address) |
| 110 | { | 110 | { |
| 111 | struct acpi_find_child find = { NULL, address }; | 111 | struct acpi_find_child find = { NULL, address }; |
| 112 | 112 | ||
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index cb28e0502acc..e28411367239 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h | |||
| @@ -36,8 +36,6 @@ static inline int acpi_debug_init(void) { return 0; } | |||
| 36 | int acpi_power_init(void); | 36 | int acpi_power_init(void); |
| 37 | int acpi_device_sleep_wake(struct acpi_device *dev, | 37 | int acpi_device_sleep_wake(struct acpi_device *dev, |
| 38 | int enable, int sleep_state, int dev_state); | 38 | int enable, int sleep_state, int dev_state); |
| 39 | int acpi_enable_wakeup_device_power(struct acpi_device *dev, int sleep_state); | ||
| 40 | int acpi_disable_wakeup_device_power(struct acpi_device *dev); | ||
| 41 | int acpi_power_get_inferred_state(struct acpi_device *device); | 39 | int acpi_power_get_inferred_state(struct acpi_device *device); |
| 42 | int acpi_power_transition(struct acpi_device *device, int state); | 40 | int acpi_power_transition(struct acpi_device *device, int state); |
| 43 | extern int acpi_power_nocheck; | 41 | extern int acpi_power_nocheck; |
| @@ -51,6 +49,8 @@ void acpi_early_processor_set_pdc(void); | |||
| 51 | int acpi_ec_init(void); | 49 | int acpi_ec_init(void); |
| 52 | int acpi_ec_ecdt_probe(void); | 50 | int acpi_ec_ecdt_probe(void); |
| 53 | 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); | ||
| 54 | 54 | ||
| 55 | /*-------------------------------------------------------------------------- | 55 | /*-------------------------------------------------------------------------- |
| 56 | Suspend/Resume | 56 | Suspend/Resume |
diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c index 7ad48dfc12db..b8725461d887 100644 --- a/drivers/acpi/numa.c +++ b/drivers/acpi/numa.c | |||
| @@ -279,9 +279,9 @@ int __init acpi_numa_init(void) | |||
| 279 | /* SRAT: Static Resource Affinity Table */ | 279 | /* SRAT: Static Resource Affinity Table */ |
| 280 | if (!acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat)) { | 280 | if (!acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat)) { |
| 281 | acpi_table_parse_srat(ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY, | 281 | acpi_table_parse_srat(ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY, |
| 282 | acpi_parse_x2apic_affinity, NR_CPUS); | 282 | acpi_parse_x2apic_affinity, nr_cpu_ids); |
| 283 | acpi_table_parse_srat(ACPI_SRAT_TYPE_CPU_AFFINITY, | 283 | acpi_table_parse_srat(ACPI_SRAT_TYPE_CPU_AFFINITY, |
| 284 | acpi_parse_processor_affinity, NR_CPUS); | 284 | acpi_parse_processor_affinity, nr_cpu_ids); |
| 285 | ret = acpi_table_parse_srat(ACPI_SRAT_TYPE_MEMORY_AFFINITY, | 285 | ret = acpi_table_parse_srat(ACPI_SRAT_TYPE_MEMORY_AFFINITY, |
| 286 | acpi_parse_memory_affinity, | 286 | acpi_parse_memory_affinity, |
| 287 | NR_NODE_MEMBLKS); | 287 | NR_NODE_MEMBLKS); |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 02e8464e480f..8e6d8665f0ae 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
| @@ -436,7 +436,7 @@ acpi_status acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler) | |||
| 436 | * Running in interpreter thread context, safe to sleep | 436 | * Running in interpreter thread context, safe to sleep |
| 437 | */ | 437 | */ |
| 438 | 438 | ||
| 439 | void acpi_os_sleep(acpi_integer ms) | 439 | void acpi_os_sleep(u64 ms) |
| 440 | { | 440 | { |
| 441 | schedule_timeout_interruptible(msecs_to_jiffies(ms)); | 441 | schedule_timeout_interruptible(msecs_to_jiffies(ms)); |
| 442 | } | 442 | } |
| @@ -603,7 +603,7 @@ acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, | |||
| 603 | 603 | ||
| 604 | acpi_status | 604 | acpi_status |
| 605 | acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, | 605 | acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, |
| 606 | acpi_integer value, u32 width) | 606 | u64 value, u32 width) |
| 607 | { | 607 | { |
| 608 | int result, size; | 608 | int result, size; |
| 609 | 609 | ||
diff --git a/drivers/acpi/pci_bind.c b/drivers/acpi/pci_bind.c index a5a77b78a723..2ef04098cc1d 100644 --- a/drivers/acpi/pci_bind.c +++ b/drivers/acpi/pci_bind.c | |||
| @@ -26,7 +26,9 @@ | |||
| 26 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
| 27 | #include <linux/types.h> | 27 | #include <linux/types.h> |
| 28 | #include <linux/pci.h> | 28 | #include <linux/pci.h> |
| 29 | #include <linux/pci-acpi.h> | ||
| 29 | #include <linux/acpi.h> | 30 | #include <linux/acpi.h> |
| 31 | #include <linux/pm_runtime.h> | ||
| 30 | #include <acpi/acpi_bus.h> | 32 | #include <acpi/acpi_bus.h> |
| 31 | #include <acpi/acpi_drivers.h> | 33 | #include <acpi/acpi_drivers.h> |
| 32 | 34 | ||
| @@ -38,7 +40,13 @@ static int acpi_pci_unbind(struct acpi_device *device) | |||
| 38 | struct pci_dev *dev; | 40 | struct pci_dev *dev; |
| 39 | 41 | ||
| 40 | dev = acpi_get_pci_dev(device->handle); | 42 | dev = acpi_get_pci_dev(device->handle); |
| 41 | if (!dev || !dev->subordinate) | 43 | if (!dev) |
| 44 | goto out; | ||
| 45 | |||
| 46 | device_set_run_wake(&dev->dev, false); | ||
| 47 | pci_acpi_remove_pm_notifier(device); | ||
| 48 | |||
| 49 | if (!dev->subordinate) | ||
| 42 | goto out; | 50 | goto out; |
| 43 | 51 | ||
| 44 | acpi_pci_irq_del_prt(dev->subordinate); | 52 | acpi_pci_irq_del_prt(dev->subordinate); |
| @@ -62,6 +70,10 @@ static int acpi_pci_bind(struct acpi_device *device) | |||
| 62 | if (!dev) | 70 | if (!dev) |
| 63 | return 0; | 71 | return 0; |
| 64 | 72 | ||
| 73 | pci_acpi_add_pm_notifier(device, dev); | ||
| 74 | if (device->wakeup.flags.run_wake) | ||
| 75 | device_set_run_wake(&dev->dev, true); | ||
| 76 | |||
| 65 | /* | 77 | /* |
| 66 | * Install the 'bind' function to facilitate callbacks for | 78 | * Install the 'bind' function to facilitate callbacks for |
| 67 | * children of the P2P bridge. | 79 | * children of the P2P bridge. |
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 394ae89409c2..04b0f007c9b7 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c | |||
| @@ -56,7 +56,7 @@ ACPI_MODULE_NAME("pci_link"); | |||
| 56 | static int acpi_pci_link_add(struct acpi_device *device); | 56 | static int acpi_pci_link_add(struct acpi_device *device); |
| 57 | static int acpi_pci_link_remove(struct acpi_device *device, int type); | 57 | static int acpi_pci_link_remove(struct acpi_device *device, int type); |
| 58 | 58 | ||
| 59 | static struct acpi_device_id link_device_ids[] = { | 59 | static const struct acpi_device_id link_device_ids[] = { |
| 60 | {"PNP0C0F", 0}, | 60 | {"PNP0C0F", 0}, |
| 61 | {"", 0}, | 61 | {"", 0}, |
| 62 | }; | 62 | }; |
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 101cce3681d1..d724736d56c8 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | #include <linux/proc_fs.h> | 30 | #include <linux/proc_fs.h> |
| 31 | #include <linux/spinlock.h> | 31 | #include <linux/spinlock.h> |
| 32 | #include <linux/pm.h> | 32 | #include <linux/pm.h> |
| 33 | #include <linux/pm_runtime.h> | ||
| 33 | #include <linux/pci.h> | 34 | #include <linux/pci.h> |
| 34 | #include <linux/pci-acpi.h> | 35 | #include <linux/pci-acpi.h> |
| 35 | #include <linux/acpi.h> | 36 | #include <linux/acpi.h> |
| @@ -46,7 +47,7 @@ static int acpi_pci_root_add(struct acpi_device *device); | |||
| 46 | static int acpi_pci_root_remove(struct acpi_device *device, int type); | 47 | static int acpi_pci_root_remove(struct acpi_device *device, int type); |
| 47 | static int acpi_pci_root_start(struct acpi_device *device); | 48 | static int acpi_pci_root_start(struct acpi_device *device); |
| 48 | 49 | ||
| 49 | static struct acpi_device_id root_device_ids[] = { | 50 | static const struct acpi_device_id root_device_ids[] = { |
| 50 | {"PNP0A03", 0}, | 51 | {"PNP0A03", 0}, |
| 51 | {"", 0}, | 52 | {"", 0}, |
| 52 | }; | 53 | }; |
| @@ -528,6 +529,10 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device) | |||
| 528 | if (flags != base_flags) | 529 | if (flags != base_flags) |
| 529 | acpi_pci_osc_support(root, flags); | 530 | acpi_pci_osc_support(root, flags); |
| 530 | 531 | ||
| 532 | pci_acpi_add_bus_pm_notifier(device, root->bus); | ||
| 533 | if (device->wakeup.flags.run_wake) | ||
| 534 | device_set_run_wake(root->bus->bridge, true); | ||
| 535 | |||
| 531 | return 0; | 536 | return 0; |
| 532 | 537 | ||
| 533 | end: | 538 | end: |
| @@ -549,6 +554,9 @@ static int acpi_pci_root_remove(struct acpi_device *device, int type) | |||
| 549 | { | 554 | { |
| 550 | struct acpi_pci_root *root = acpi_driver_data(device); | 555 | struct acpi_pci_root *root = acpi_driver_data(device); |
| 551 | 556 | ||
| 557 | device_set_run_wake(root->bus->bridge, false); | ||
| 558 | pci_acpi_remove_bus_pm_notifier(device); | ||
| 559 | |||
| 552 | kfree(root); | 560 | kfree(root); |
| 553 | return 0; | 561 | return 0; |
| 554 | } | 562 | } |
| @@ -558,6 +566,7 @@ static int __init acpi_pci_root_init(void) | |||
| 558 | if (acpi_pci_disabled) | 566 | if (acpi_pci_disabled) |
| 559 | return 0; | 567 | return 0; |
| 560 | 568 | ||
| 569 | pci_acpi_crs_quirks(); | ||
| 561 | if (acpi_bus_register_driver(&acpi_pci_root_driver) < 0) | 570 | if (acpi_bus_register_driver(&acpi_pci_root_driver) < 0) |
| 562 | return -ENODEV; | 571 | return -ENODEV; |
| 563 | 572 | ||
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 22b297916519..0f30c3c1eea4 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c | |||
| @@ -65,7 +65,7 @@ static int acpi_power_remove(struct acpi_device *device, int type); | |||
| 65 | static int acpi_power_resume(struct acpi_device *device); | 65 | static int acpi_power_resume(struct acpi_device *device); |
| 66 | static int acpi_power_open_fs(struct inode *inode, struct file *file); | 66 | static int acpi_power_open_fs(struct inode *inode, struct file *file); |
| 67 | 67 | ||
| 68 | static struct acpi_device_id power_device_ids[] = { | 68 | static const struct acpi_device_id power_device_ids[] = { |
| 69 | {ACPI_POWER_HID, 0}, | 69 | {ACPI_POWER_HID, 0}, |
| 70 | {"", 0}, | 70 | {"", 0}, |
| 71 | }; | 71 | }; |
diff --git a/drivers/acpi/power_meter.c b/drivers/acpi/power_meter.c index 2ef7030a0c28..834c5af0de4b 100644 --- a/drivers/acpi/power_meter.c +++ b/drivers/acpi/power_meter.c | |||
| @@ -64,24 +64,24 @@ static int can_cap_in_hardware(void) | |||
| 64 | return force_cap_on || cap_in_hardware; | 64 | return force_cap_on || cap_in_hardware; |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | static struct acpi_device_id power_meter_ids[] = { | 67 | static const struct acpi_device_id power_meter_ids[] = { |
| 68 | {"ACPI000D", 0}, | 68 | {"ACPI000D", 0}, |
| 69 | {"", 0}, | 69 | {"", 0}, |
| 70 | }; | 70 | }; |
| 71 | MODULE_DEVICE_TABLE(acpi, power_meter_ids); | 71 | MODULE_DEVICE_TABLE(acpi, power_meter_ids); |
| 72 | 72 | ||
| 73 | struct acpi_power_meter_capabilities { | 73 | struct acpi_power_meter_capabilities { |
| 74 | acpi_integer flags; | 74 | u64 flags; |
| 75 | acpi_integer units; | 75 | u64 units; |
| 76 | acpi_integer type; | 76 | u64 type; |
| 77 | acpi_integer accuracy; | 77 | u64 accuracy; |
| 78 | acpi_integer sampling_time; | 78 | u64 sampling_time; |
| 79 | acpi_integer min_avg_interval; | 79 | u64 min_avg_interval; |
| 80 | acpi_integer max_avg_interval; | 80 | u64 max_avg_interval; |
| 81 | acpi_integer hysteresis; | 81 | u64 hysteresis; |
| 82 | acpi_integer configurable_cap; | 82 | u64 configurable_cap; |
| 83 | acpi_integer min_cap; | 83 | u64 min_cap; |
| 84 | acpi_integer max_cap; | 84 | u64 max_cap; |
| 85 | }; | 85 | }; |
| 86 | 86 | ||
| 87 | struct acpi_power_meter_resource { | 87 | struct acpi_power_meter_resource { |
| @@ -93,9 +93,9 @@ struct acpi_power_meter_resource { | |||
| 93 | acpi_string model_number; | 93 | acpi_string model_number; |
| 94 | acpi_string serial_number; | 94 | acpi_string serial_number; |
| 95 | acpi_string oem_info; | 95 | acpi_string oem_info; |
| 96 | acpi_integer power; | 96 | u64 power; |
| 97 | acpi_integer cap; | 97 | u64 cap; |
| 98 | acpi_integer avg_interval; | 98 | u64 avg_interval; |
| 99 | int sensors_valid; | 99 | int sensors_valid; |
| 100 | unsigned long sensors_last_updated; | 100 | unsigned long sensors_last_updated; |
| 101 | struct sensor_device_attribute sensors[NUM_SENSORS]; | 101 | struct sensor_device_attribute sensors[NUM_SENSORS]; |
| @@ -402,7 +402,7 @@ static ssize_t show_val(struct device *dev, | |||
| 402 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 402 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
| 403 | struct acpi_device *acpi_dev = to_acpi_device(dev); | 403 | struct acpi_device *acpi_dev = to_acpi_device(dev); |
| 404 | struct acpi_power_meter_resource *resource = acpi_dev->driver_data; | 404 | struct acpi_power_meter_resource *resource = acpi_dev->driver_data; |
| 405 | acpi_integer val = 0; | 405 | u64 val = 0; |
| 406 | 406 | ||
| 407 | switch (attr->index) { | 407 | switch (attr->index) { |
| 408 | case 0: | 408 | case 0: |
| @@ -534,6 +534,7 @@ static void remove_domain_devices(struct acpi_power_meter_resource *resource) | |||
| 534 | 534 | ||
| 535 | kfree(resource->domain_devices); | 535 | kfree(resource->domain_devices); |
| 536 | kobject_put(resource->holders_dir); | 536 | kobject_put(resource->holders_dir); |
| 537 | resource->num_domain_devices = 0; | ||
| 537 | } | 538 | } |
| 538 | 539 | ||
| 539 | static int read_domain_devices(struct acpi_power_meter_resource *resource) | 540 | static int read_domain_devices(struct acpi_power_meter_resource *resource) |
| @@ -740,7 +741,6 @@ skip_unsafe_cap: | |||
| 740 | 741 | ||
| 741 | return res; | 742 | return res; |
| 742 | error: | 743 | error: |
| 743 | remove_domain_devices(resource); | ||
| 744 | remove_attrs(resource); | 744 | remove_attrs(resource); |
| 745 | return res; | 745 | return res; |
| 746 | } | 746 | } |
diff --git a/drivers/acpi/proc.c b/drivers/acpi/proc.c index d0d25e2e1ced..1ac678d2c51c 100644 --- a/drivers/acpi/proc.c +++ b/drivers/acpi/proc.c | |||
| @@ -435,7 +435,7 @@ acpi_system_write_wakeup_device(struct file *file, | |||
| 435 | found_dev->wakeup.gpe_device)) { | 435 | found_dev->wakeup.gpe_device)) { |
| 436 | printk(KERN_WARNING | 436 | printk(KERN_WARNING |
| 437 | "ACPI: '%s' and '%s' have the same GPE, " | 437 | "ACPI: '%s' and '%s' have the same GPE, " |
| 438 | "can't disable/enable one seperately\n", | 438 | "can't disable/enable one separately\n", |
| 439 | dev->pnp.bus_id, found_dev->pnp.bus_id); | 439 | dev->pnp.bus_id, found_dev->pnp.bus_id); |
| 440 | dev->wakeup.state.enabled = | 440 | dev->wakeup.state.enabled = |
| 441 | found_dev->wakeup.state.enabled; | 441 | found_dev->wakeup.state.enabled; |
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 9863c98c81ba..791ac7b0f8df 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
| @@ -1,381 +1,62 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * acpi_processor.c - ACPI Processor Driver ($Revision: 71 $) | 2 | * Copyright (C) 2005 Intel Corporation |
| 3 | * Copyright (C) 2009 Hewlett-Packard Development Company, L.P. | ||
| 3 | * | 4 | * |
| 4 | * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> | 5 | * Alex Chiang <achiang@hp.com> |
| 5 | * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> | 6 | * - Unified x86/ia64 implementations |
| 6 | * Copyright (C) 2004 Dominik Brodowski <linux@brodo.de> | 7 | * Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> |
| 7 | * Copyright (C) 2004 Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> | 8 | * - Added _PDC for platforms with Intel CPUs |
| 8 | * - Added processor hotplug support | ||
| 9 | * | ||
| 10 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 11 | * | ||
| 12 | * This program is free software; you can redistribute it and/or modify | ||
| 13 | * it under the terms of the GNU General Public License as published by | ||
| 14 | * the Free Software Foundation; either version 2 of the License, or (at | ||
| 15 | * your option) any later version. | ||
| 16 | * | ||
| 17 | * This program is distributed in the hope that it will be useful, but | ||
| 18 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 20 | * General Public License for more details. | ||
| 21 | * | ||
| 22 | * You should have received a copy of the GNU General Public License along | ||
| 23 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
| 24 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | ||
| 25 | * | ||
| 26 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 27 | * TBD: | ||
| 28 | * 1. Make # power states dynamic. | ||
| 29 | * 2. Support duty_cycle values that span bit 4. | ||
| 30 | * 3. Optimize by having scheduler determine business instead of | ||
| 31 | * having us try to calculate it here. | ||
| 32 | * 4. Need C1 timing -- must modify kernel (IRQ handler) to get this. | ||
| 33 | */ | 9 | */ |
| 34 | |||
| 35 | #include <linux/kernel.h> | ||
| 36 | #include <linux/module.h> | ||
| 37 | #include <linux/init.h> | ||
| 38 | #include <linux/types.h> | ||
| 39 | #include <linux/pci.h> | ||
| 40 | #include <linux/pm.h> | ||
| 41 | #include <linux/cpufreq.h> | ||
| 42 | #include <linux/cpu.h> | ||
| 43 | #include <linux/proc_fs.h> | ||
| 44 | #include <linux/seq_file.h> | ||
| 45 | #include <linux/dmi.h> | 10 | #include <linux/dmi.h> |
| 46 | #include <linux/moduleparam.h> | ||
| 47 | #include <linux/cpuidle.h> | ||
| 48 | 11 | ||
| 49 | #include <asm/io.h> | ||
| 50 | #include <asm/system.h> | ||
| 51 | #include <asm/cpu.h> | ||
| 52 | #include <asm/delay.h> | ||
| 53 | #include <asm/uaccess.h> | ||
| 54 | #include <asm/processor.h> | ||
| 55 | #include <asm/smp.h> | ||
| 56 | #include <asm/acpi.h> | ||
| 57 | |||
| 58 | #include <acpi/acpi_bus.h> | ||
| 59 | #include <acpi/acpi_drivers.h> | 12 | #include <acpi/acpi_drivers.h> |
| 60 | #include <acpi/processor.h> | 13 | #include <acpi/processor.h> |
| 61 | 14 | ||
| 62 | #define PREFIX "ACPI: " | 15 | #include "internal.h" |
| 63 | |||
| 64 | #define ACPI_PROCESSOR_CLASS "processor" | ||
| 65 | #define ACPI_PROCESSOR_DEVICE_NAME "Processor" | ||
| 66 | #define ACPI_PROCESSOR_FILE_INFO "info" | ||
| 67 | #define ACPI_PROCESSOR_FILE_THROTTLING "throttling" | ||
| 68 | #define ACPI_PROCESSOR_FILE_LIMIT "limit" | ||
| 69 | #define ACPI_PROCESSOR_NOTIFY_PERFORMANCE 0x80 | ||
| 70 | #define ACPI_PROCESSOR_NOTIFY_POWER 0x81 | ||
| 71 | #define ACPI_PROCESSOR_NOTIFY_THROTTLING 0x82 | ||
| 72 | |||
| 73 | #define ACPI_PROCESSOR_LIMIT_USER 0 | ||
| 74 | #define ACPI_PROCESSOR_LIMIT_THERMAL 1 | ||
| 75 | 16 | ||
| 17 | #define PREFIX "ACPI: " | ||
| 76 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT | 18 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT |
| 77 | ACPI_MODULE_NAME("processor_core"); | 19 | ACPI_MODULE_NAME("processor_core"); |
| 78 | 20 | ||
| 79 | MODULE_AUTHOR("Paul Diefenbaugh"); | 21 | static int set_no_mwait(const struct dmi_system_id *id) |
| 80 | MODULE_DESCRIPTION("ACPI Processor Driver"); | ||
| 81 | MODULE_LICENSE("GPL"); | ||
| 82 | |||
| 83 | static int acpi_processor_add(struct acpi_device *device); | ||
| 84 | static int acpi_processor_remove(struct acpi_device *device, int type); | ||
| 85 | #ifdef CONFIG_ACPI_PROCFS | ||
| 86 | static int acpi_processor_info_open_fs(struct inode *inode, struct file *file); | ||
| 87 | #endif | ||
| 88 | static void acpi_processor_notify(struct acpi_device *device, u32 event); | ||
| 89 | static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu); | ||
| 90 | static int acpi_processor_handle_eject(struct acpi_processor *pr); | ||
| 91 | |||
| 92 | |||
| 93 | static const struct acpi_device_id processor_device_ids[] = { | ||
| 94 | {ACPI_PROCESSOR_OBJECT_HID, 0}, | ||
| 95 | {"ACPI0007", 0}, | ||
| 96 | {"", 0}, | ||
| 97 | }; | ||
| 98 | MODULE_DEVICE_TABLE(acpi, processor_device_ids); | ||
| 99 | |||
| 100 | static struct acpi_driver acpi_processor_driver = { | ||
| 101 | .name = "processor", | ||
| 102 | .class = ACPI_PROCESSOR_CLASS, | ||
| 103 | .ids = processor_device_ids, | ||
| 104 | .ops = { | ||
| 105 | .add = acpi_processor_add, | ||
| 106 | .remove = acpi_processor_remove, | ||
| 107 | .suspend = acpi_processor_suspend, | ||
| 108 | .resume = acpi_processor_resume, | ||
| 109 | .notify = acpi_processor_notify, | ||
| 110 | }, | ||
| 111 | }; | ||
| 112 | |||
| 113 | #define INSTALL_NOTIFY_HANDLER 1 | ||
| 114 | #define UNINSTALL_NOTIFY_HANDLER 2 | ||
| 115 | #ifdef CONFIG_ACPI_PROCFS | ||
| 116 | static const struct file_operations acpi_processor_info_fops = { | ||
| 117 | .owner = THIS_MODULE, | ||
| 118 | .open = acpi_processor_info_open_fs, | ||
| 119 | .read = seq_read, | ||
| 120 | .llseek = seq_lseek, | ||
| 121 | .release = single_release, | ||
| 122 | }; | ||
| 123 | #endif | ||
| 124 | |||
| 125 | DEFINE_PER_CPU(struct acpi_processor *, processors); | ||
| 126 | struct acpi_processor_errata errata __read_mostly; | ||
| 127 | |||
| 128 | /* -------------------------------------------------------------------------- | ||
| 129 | Errata Handling | ||
| 130 | -------------------------------------------------------------------------- */ | ||
| 131 | |||
| 132 | static int acpi_processor_errata_piix4(struct pci_dev *dev) | ||
| 133 | { | 22 | { |
| 134 | u8 value1 = 0; | 23 | printk(KERN_NOTICE PREFIX "%s detected - " |
| 135 | u8 value2 = 0; | 24 | "disabling mwait for CPU C-states\n", id->ident); |
| 136 | 25 | idle_nomwait = 1; | |
| 137 | |||
| 138 | if (!dev) | ||
| 139 | return -EINVAL; | ||
| 140 | |||
| 141 | /* | ||
| 142 | * Note that 'dev' references the PIIX4 ACPI Controller. | ||
| 143 | */ | ||
| 144 | |||
| 145 | switch (dev->revision) { | ||
| 146 | case 0: | ||
| 147 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4 A-step\n")); | ||
| 148 | break; | ||
| 149 | case 1: | ||
| 150 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4 B-step\n")); | ||
| 151 | break; | ||
| 152 | case 2: | ||
| 153 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4E\n")); | ||
| 154 | break; | ||
| 155 | case 3: | ||
| 156 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4M\n")); | ||
| 157 | break; | ||
| 158 | default: | ||
| 159 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found unknown PIIX4\n")); | ||
| 160 | break; | ||
| 161 | } | ||
| 162 | |||
| 163 | switch (dev->revision) { | ||
| 164 | |||
| 165 | case 0: /* PIIX4 A-step */ | ||
| 166 | case 1: /* PIIX4 B-step */ | ||
| 167 | /* | ||
| 168 | * See specification changes #13 ("Manual Throttle Duty Cycle") | ||
| 169 | * and #14 ("Enabling and Disabling Manual Throttle"), plus | ||
| 170 | * erratum #5 ("STPCLK# Deassertion Time") from the January | ||
| 171 | * 2002 PIIX4 specification update. Applies to only older | ||
| 172 | * PIIX4 models. | ||
| 173 | */ | ||
| 174 | errata.piix4.throttle = 1; | ||
| 175 | |||
| 176 | case 2: /* PIIX4E */ | ||
| 177 | case 3: /* PIIX4M */ | ||
| 178 | /* | ||
| 179 | * See erratum #18 ("C3 Power State/BMIDE and Type-F DMA | ||
| 180 | * Livelock") from the January 2002 PIIX4 specification update. | ||
| 181 | * Applies to all PIIX4 models. | ||
| 182 | */ | ||
| 183 | |||
| 184 | /* | ||
| 185 | * BM-IDE | ||
| 186 | * ------ | ||
| 187 | * Find the PIIX4 IDE Controller and get the Bus Master IDE | ||
| 188 | * Status register address. We'll use this later to read | ||
| 189 | * each IDE controller's DMA status to make sure we catch all | ||
| 190 | * DMA activity. | ||
| 191 | */ | ||
| 192 | dev = pci_get_subsys(PCI_VENDOR_ID_INTEL, | ||
| 193 | PCI_DEVICE_ID_INTEL_82371AB, | ||
| 194 | PCI_ANY_ID, PCI_ANY_ID, NULL); | ||
| 195 | if (dev) { | ||
| 196 | errata.piix4.bmisx = pci_resource_start(dev, 4); | ||
| 197 | pci_dev_put(dev); | ||
| 198 | } | ||
| 199 | |||
| 200 | /* | ||
| 201 | * Type-F DMA | ||
| 202 | * ---------- | ||
| 203 | * Find the PIIX4 ISA Controller and read the Motherboard | ||
| 204 | * DMA controller's status to see if Type-F (Fast) DMA mode | ||
| 205 | * is enabled (bit 7) on either channel. Note that we'll | ||
| 206 | * disable C3 support if this is enabled, as some legacy | ||
| 207 | * devices won't operate well if fast DMA is disabled. | ||
| 208 | */ | ||
| 209 | dev = pci_get_subsys(PCI_VENDOR_ID_INTEL, | ||
| 210 | PCI_DEVICE_ID_INTEL_82371AB_0, | ||
| 211 | PCI_ANY_ID, PCI_ANY_ID, NULL); | ||
| 212 | if (dev) { | ||
| 213 | pci_read_config_byte(dev, 0x76, &value1); | ||
| 214 | pci_read_config_byte(dev, 0x77, &value2); | ||
| 215 | if ((value1 & 0x80) || (value2 & 0x80)) | ||
| 216 | errata.piix4.fdma = 1; | ||
| 217 | pci_dev_put(dev); | ||
| 218 | } | ||
| 219 | |||
| 220 | break; | ||
| 221 | } | ||
| 222 | |||
| 223 | if (errata.piix4.bmisx) | ||
| 224 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
| 225 | "Bus master activity detection (BM-IDE) erratum enabled\n")); | ||
| 226 | if (errata.piix4.fdma) | ||
| 227 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
| 228 | "Type-F DMA livelock erratum (C3 disabled)\n")); | ||
| 229 | |||
| 230 | return 0; | 26 | return 0; |
| 231 | } | 27 | } |
| 232 | 28 | ||
| 233 | static int acpi_processor_errata(struct acpi_processor *pr) | 29 | static struct dmi_system_id __cpuinitdata processor_idle_dmi_table[] = { |
| 234 | { | 30 | { |
| 235 | int result = 0; | 31 | set_no_mwait, "IFL91 board", { |
| 236 | struct pci_dev *dev = NULL; | 32 | DMI_MATCH(DMI_BIOS_VENDOR, "COMPAL"), |
| 237 | 33 | DMI_MATCH(DMI_SYS_VENDOR, "ZEPTO"), | |
| 238 | 34 | DMI_MATCH(DMI_PRODUCT_VERSION, "3215W"), | |
| 239 | if (!pr) | 35 | DMI_MATCH(DMI_BOARD_NAME, "IFL91") }, NULL}, |
| 240 | return -EINVAL; | 36 | { |
| 241 | 37 | set_no_mwait, "Extensa 5220", { | |
| 242 | /* | 38 | DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"), |
| 243 | * PIIX4 | 39 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
| 244 | */ | 40 | DMI_MATCH(DMI_PRODUCT_VERSION, "0100"), |
| 245 | dev = pci_get_subsys(PCI_VENDOR_ID_INTEL, | 41 | DMI_MATCH(DMI_BOARD_NAME, "Columbia") }, NULL}, |
| 246 | PCI_DEVICE_ID_INTEL_82371AB_3, PCI_ANY_ID, | 42 | {}, |
| 247 | PCI_ANY_ID, NULL); | 43 | }; |
| 248 | if (dev) { | ||
| 249 | result = acpi_processor_errata_piix4(dev); | ||
| 250 | pci_dev_put(dev); | ||
| 251 | } | ||
| 252 | |||
| 253 | return result; | ||
| 254 | } | ||
| 255 | |||
| 256 | /* -------------------------------------------------------------------------- | ||
| 257 | FS Interface (/proc) | ||
| 258 | -------------------------------------------------------------------------- */ | ||
| 259 | |||
| 260 | #ifdef CONFIG_ACPI_PROCFS | ||
| 261 | static struct proc_dir_entry *acpi_processor_dir = NULL; | ||
| 262 | |||
| 263 | static int acpi_processor_info_seq_show(struct seq_file *seq, void *offset) | ||
| 264 | { | ||
| 265 | struct acpi_processor *pr = seq->private; | ||
| 266 | |||
| 267 | |||
| 268 | if (!pr) | ||
| 269 | goto end; | ||
| 270 | |||
| 271 | seq_printf(seq, "processor id: %d\n" | ||
| 272 | "acpi id: %d\n" | ||
| 273 | "bus mastering control: %s\n" | ||
| 274 | "power management: %s\n" | ||
| 275 | "throttling control: %s\n" | ||
| 276 | "limit interface: %s\n", | ||
| 277 | pr->id, | ||
| 278 | pr->acpi_id, | ||
| 279 | pr->flags.bm_control ? "yes" : "no", | ||
| 280 | pr->flags.power ? "yes" : "no", | ||
| 281 | pr->flags.throttling ? "yes" : "no", | ||
| 282 | pr->flags.limit ? "yes" : "no"); | ||
| 283 | |||
| 284 | end: | ||
| 285 | return 0; | ||
| 286 | } | ||
| 287 | |||
| 288 | static int acpi_processor_info_open_fs(struct inode *inode, struct file *file) | ||
| 289 | { | ||
| 290 | return single_open(file, acpi_processor_info_seq_show, | ||
| 291 | PDE(inode)->data); | ||
| 292 | } | ||
| 293 | |||
| 294 | static int __cpuinit acpi_processor_add_fs(struct acpi_device *device) | ||
| 295 | { | ||
| 296 | struct proc_dir_entry *entry = NULL; | ||
| 297 | |||
| 298 | |||
| 299 | if (!acpi_device_dir(device)) { | ||
| 300 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), | ||
| 301 | acpi_processor_dir); | ||
| 302 | if (!acpi_device_dir(device)) | ||
| 303 | return -ENODEV; | ||
| 304 | } | ||
| 305 | |||
| 306 | /* 'info' [R] */ | ||
| 307 | entry = proc_create_data(ACPI_PROCESSOR_FILE_INFO, | ||
| 308 | S_IRUGO, acpi_device_dir(device), | ||
| 309 | &acpi_processor_info_fops, | ||
| 310 | acpi_driver_data(device)); | ||
| 311 | if (!entry) | ||
| 312 | return -EIO; | ||
| 313 | |||
| 314 | /* 'throttling' [R/W] */ | ||
| 315 | entry = proc_create_data(ACPI_PROCESSOR_FILE_THROTTLING, | ||
| 316 | S_IFREG | S_IRUGO | S_IWUSR, | ||
| 317 | acpi_device_dir(device), | ||
| 318 | &acpi_processor_throttling_fops, | ||
| 319 | acpi_driver_data(device)); | ||
| 320 | if (!entry) | ||
| 321 | return -EIO; | ||
| 322 | |||
| 323 | /* 'limit' [R/W] */ | ||
| 324 | entry = proc_create_data(ACPI_PROCESSOR_FILE_LIMIT, | ||
| 325 | S_IFREG | S_IRUGO | S_IWUSR, | ||
| 326 | acpi_device_dir(device), | ||
| 327 | &acpi_processor_limit_fops, | ||
| 328 | acpi_driver_data(device)); | ||
| 329 | if (!entry) | ||
| 330 | return -EIO; | ||
| 331 | return 0; | ||
| 332 | } | ||
| 333 | static int acpi_processor_remove_fs(struct acpi_device *device) | ||
| 334 | { | ||
| 335 | |||
| 336 | if (acpi_device_dir(device)) { | ||
| 337 | remove_proc_entry(ACPI_PROCESSOR_FILE_INFO, | ||
| 338 | acpi_device_dir(device)); | ||
| 339 | remove_proc_entry(ACPI_PROCESSOR_FILE_THROTTLING, | ||
| 340 | acpi_device_dir(device)); | ||
| 341 | remove_proc_entry(ACPI_PROCESSOR_FILE_LIMIT, | ||
| 342 | acpi_device_dir(device)); | ||
| 343 | remove_proc_entry(acpi_device_bid(device), acpi_processor_dir); | ||
| 344 | acpi_device_dir(device) = NULL; | ||
| 345 | } | ||
| 346 | |||
| 347 | return 0; | ||
| 348 | } | ||
| 349 | #else | ||
| 350 | static inline int acpi_processor_add_fs(struct acpi_device *device) | ||
| 351 | { | ||
| 352 | return 0; | ||
| 353 | } | ||
| 354 | static inline int acpi_processor_remove_fs(struct acpi_device *device) | ||
| 355 | { | ||
| 356 | return 0; | ||
| 357 | } | ||
| 358 | #endif | ||
| 359 | |||
| 360 | /* Use the acpiid in MADT to map cpus in case of SMP */ | ||
| 361 | |||
| 362 | #ifndef CONFIG_SMP | ||
| 363 | static int get_cpu_id(acpi_handle handle, int type, u32 acpi_id) { return -1; } | ||
| 364 | #else | ||
| 365 | |||
| 366 | static struct acpi_table_madt *madt; | ||
| 367 | 44 | ||
| 45 | #ifdef CONFIG_SMP | ||
| 368 | static int map_lapic_id(struct acpi_subtable_header *entry, | 46 | static int map_lapic_id(struct acpi_subtable_header *entry, |
| 369 | u32 acpi_id, int *apic_id) | 47 | u32 acpi_id, int *apic_id) |
| 370 | { | 48 | { |
| 371 | struct acpi_madt_local_apic *lapic = | 49 | struct acpi_madt_local_apic *lapic = |
| 372 | (struct acpi_madt_local_apic *)entry; | 50 | (struct acpi_madt_local_apic *)entry; |
| 373 | if ((lapic->lapic_flags & ACPI_MADT_ENABLED) && | 51 | |
| 374 | lapic->processor_id == acpi_id) { | 52 | if (!(lapic->lapic_flags & ACPI_MADT_ENABLED)) |
| 375 | *apic_id = lapic->id; | 53 | return 0; |
| 376 | return 1; | 54 | |
| 377 | } | 55 | if (lapic->processor_id != acpi_id) |
| 378 | return 0; | 56 | return 0; |
| 57 | |||
| 58 | *apic_id = lapic->id; | ||
| 59 | return 1; | ||
| 379 | } | 60 | } |
| 380 | 61 | ||
| 381 | static int map_x2apic_id(struct acpi_subtable_header *entry, | 62 | static int map_x2apic_id(struct acpi_subtable_header *entry, |
| @@ -383,22 +64,16 @@ static int map_x2apic_id(struct acpi_subtable_header *entry, | |||
| 383 | { | 64 | { |
| 384 | struct acpi_madt_local_x2apic *apic = | 65 | struct acpi_madt_local_x2apic *apic = |
| 385 | (struct acpi_madt_local_x2apic *)entry; | 66 | (struct acpi_madt_local_x2apic *)entry; |
| 386 | u32 tmp = apic->local_apic_id; | ||
| 387 | 67 | ||
| 388 | /* Only check enabled APICs*/ | ||
| 389 | if (!(apic->lapic_flags & ACPI_MADT_ENABLED)) | 68 | if (!(apic->lapic_flags & ACPI_MADT_ENABLED)) |
| 390 | return 0; | 69 | return 0; |
| 391 | 70 | ||
| 392 | /* Device statement declaration type */ | 71 | if (device_declaration && (apic->uid == acpi_id)) { |
| 393 | if (device_declaration) { | 72 | *apic_id = apic->local_apic_id; |
| 394 | if (apic->uid == acpi_id) | 73 | return 1; |
| 395 | goto found; | ||
| 396 | } | 74 | } |
| 397 | 75 | ||
| 398 | return 0; | 76 | return 0; |
| 399 | found: | ||
| 400 | *apic_id = tmp; | ||
| 401 | return 1; | ||
| 402 | } | 77 | } |
| 403 | 78 | ||
| 404 | static int map_lsapic_id(struct acpi_subtable_header *entry, | 79 | static int map_lsapic_id(struct acpi_subtable_header *entry, |
| @@ -406,35 +81,34 @@ static int map_lsapic_id(struct acpi_subtable_header *entry, | |||
| 406 | { | 81 | { |
| 407 | struct acpi_madt_local_sapic *lsapic = | 82 | struct acpi_madt_local_sapic *lsapic = |
| 408 | (struct acpi_madt_local_sapic *)entry; | 83 | (struct acpi_madt_local_sapic *)entry; |
| 409 | u32 tmp = (lsapic->id << 8) | lsapic->eid; | ||
| 410 | 84 | ||
| 411 | /* Only check enabled APICs*/ | ||
| 412 | if (!(lsapic->lapic_flags & ACPI_MADT_ENABLED)) | 85 | if (!(lsapic->lapic_flags & ACPI_MADT_ENABLED)) |
| 413 | return 0; | 86 | return 0; |
| 414 | 87 | ||
| 415 | /* Device statement declaration type */ | ||
| 416 | if (device_declaration) { | 88 | if (device_declaration) { |
| 417 | if (entry->length < 16) | 89 | if ((entry->length < 16) || (lsapic->uid != acpi_id)) |
| 418 | printk(KERN_ERR PREFIX | 90 | return 0; |
| 419 | "Invalid LSAPIC with Device type processor (SAPIC ID %#x)\n", | 91 | } else if (lsapic->processor_id != acpi_id) |
| 420 | tmp); | 92 | return 0; |
| 421 | else if (lsapic->uid == acpi_id) | ||
| 422 | goto found; | ||
| 423 | /* Processor statement declaration type */ | ||
| 424 | } else if (lsapic->processor_id == acpi_id) | ||
| 425 | goto found; | ||
| 426 | 93 | ||
| 427 | return 0; | 94 | *apic_id = (lsapic->id << 8) | lsapic->eid; |
| 428 | found: | ||
| 429 | *apic_id = tmp; | ||
| 430 | return 1; | 95 | return 1; |
| 431 | } | 96 | } |
| 432 | 97 | ||
| 433 | static int map_madt_entry(int type, u32 acpi_id) | 98 | static int map_madt_entry(int type, u32 acpi_id) |
| 434 | { | 99 | { |
| 435 | unsigned long madt_end, entry; | 100 | unsigned long madt_end, entry; |
| 101 | static struct acpi_table_madt *madt; | ||
| 102 | static int read_madt; | ||
| 436 | int apic_id = -1; | 103 | int apic_id = -1; |
| 437 | 104 | ||
| 105 | if (!read_madt) { | ||
| 106 | if (ACPI_FAILURE(acpi_get_table(ACPI_SIG_MADT, 0, | ||
| 107 | (struct acpi_table_header **)&madt))) | ||
| 108 | madt = NULL; | ||
| 109 | read_madt++; | ||
| 110 | } | ||
| 111 | |||
| 438 | if (!madt) | 112 | if (!madt) |
| 439 | return apic_id; | 113 | return apic_id; |
| 440 | 114 | ||
| @@ -494,7 +168,7 @@ exit: | |||
| 494 | return apic_id; | 168 | return apic_id; |
| 495 | } | 169 | } |
| 496 | 170 | ||
| 497 | static int get_cpu_id(acpi_handle handle, int type, u32 acpi_id) | 171 | int acpi_get_cpuid(acpi_handle handle, int type, u32 acpi_id) |
| 498 | { | 172 | { |
| 499 | int i; | 173 | int i; |
| 500 | int apic_id = -1; | 174 | int apic_id = -1; |
| @@ -511,630 +185,170 @@ static int get_cpu_id(acpi_handle handle, int type, u32 acpi_id) | |||
| 511 | } | 185 | } |
| 512 | return -1; | 186 | return -1; |
| 513 | } | 187 | } |
| 188 | EXPORT_SYMBOL_GPL(acpi_get_cpuid); | ||
| 514 | #endif | 189 | #endif |
| 515 | 190 | ||
| 516 | /* -------------------------------------------------------------------------- | 191 | static bool processor_physically_present(acpi_handle handle) |
| 517 | Driver Interface | ||
| 518 | -------------------------------------------------------------------------- */ | ||
| 519 | |||
| 520 | static int acpi_processor_get_info(struct acpi_device *device) | ||
| 521 | { | 192 | { |
| 522 | acpi_status status = 0; | 193 | int cpuid, type; |
| 194 | u32 acpi_id; | ||
| 195 | acpi_status status; | ||
| 196 | acpi_object_type acpi_type; | ||
| 197 | unsigned long long tmp; | ||
| 523 | union acpi_object object = { 0 }; | 198 | union acpi_object object = { 0 }; |
| 524 | struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; | 199 | struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; |
| 525 | struct acpi_processor *pr; | ||
| 526 | int cpu_index, device_declaration = 0; | ||
| 527 | static int cpu0_initialized; | ||
| 528 | |||
| 529 | pr = acpi_driver_data(device); | ||
| 530 | if (!pr) | ||
| 531 | return -EINVAL; | ||
| 532 | |||
| 533 | if (num_online_cpus() > 1) | ||
| 534 | errata.smp = TRUE; | ||
| 535 | |||
| 536 | acpi_processor_errata(pr); | ||
| 537 | |||
| 538 | /* | ||
| 539 | * Check to see if we have bus mastering arbitration control. This | ||
| 540 | * is required for proper C3 usage (to maintain cache coherency). | ||
| 541 | */ | ||
| 542 | if (acpi_gbl_FADT.pm2_control_block && acpi_gbl_FADT.pm2_control_length) { | ||
| 543 | pr->flags.bm_control = 1; | ||
| 544 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
| 545 | "Bus mastering arbitration control present\n")); | ||
| 546 | } else | ||
| 547 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
| 548 | "No bus mastering arbitration control\n")); | ||
| 549 | |||
| 550 | if (!strcmp(acpi_device_hid(device), ACPI_PROCESSOR_OBJECT_HID)) { | ||
| 551 | /* Declared with "Processor" statement; match ProcessorID */ | ||
| 552 | status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer); | ||
| 553 | if (ACPI_FAILURE(status)) { | ||
| 554 | printk(KERN_ERR PREFIX "Evaluating processor object\n"); | ||
| 555 | return -ENODEV; | ||
| 556 | } | ||
| 557 | |||
| 558 | /* | ||
| 559 | * TBD: Synch processor ID (via LAPIC/LSAPIC structures) on SMP. | ||
| 560 | * >>> 'acpi_get_processor_id(acpi_id, &id)' in | ||
| 561 | * arch/xxx/acpi.c | ||
| 562 | */ | ||
| 563 | pr->acpi_id = object.processor.proc_id; | ||
| 564 | } else { | ||
| 565 | /* | ||
| 566 | * Declared with "Device" statement; match _UID. | ||
| 567 | * Note that we don't handle string _UIDs yet. | ||
| 568 | */ | ||
| 569 | unsigned long long value; | ||
| 570 | status = acpi_evaluate_integer(pr->handle, METHOD_NAME__UID, | ||
| 571 | NULL, &value); | ||
| 572 | if (ACPI_FAILURE(status)) { | ||
| 573 | printk(KERN_ERR PREFIX | ||
| 574 | "Evaluating processor _UID [%#x]\n", status); | ||
| 575 | return -ENODEV; | ||
| 576 | } | ||
| 577 | device_declaration = 1; | ||
| 578 | pr->acpi_id = value; | ||
| 579 | } | ||
| 580 | cpu_index = get_cpu_id(pr->handle, device_declaration, pr->acpi_id); | ||
| 581 | |||
| 582 | /* Handle UP system running SMP kernel, with no LAPIC in MADT */ | ||
| 583 | if (!cpu0_initialized && (cpu_index == -1) && | ||
| 584 | (num_online_cpus() == 1)) { | ||
| 585 | cpu_index = 0; | ||
| 586 | } | ||
| 587 | |||
| 588 | cpu0_initialized = 1; | ||
| 589 | |||
| 590 | pr->id = cpu_index; | ||
| 591 | |||
| 592 | /* | ||
| 593 | * Extra Processor objects may be enumerated on MP systems with | ||
| 594 | * less than the max # of CPUs. They should be ignored _iff | ||
| 595 | * they are physically not present. | ||
| 596 | */ | ||
| 597 | if (pr->id == -1) { | ||
| 598 | if (ACPI_FAILURE | ||
| 599 | (acpi_processor_hotadd_init(pr->handle, &pr->id))) { | ||
| 600 | return -ENODEV; | ||
| 601 | } | ||
| 602 | } | ||
| 603 | /* | ||
| 604 | * On some boxes several processors use the same processor bus id. | ||
| 605 | * But they are located in different scope. For example: | ||
| 606 | * \_SB.SCK0.CPU0 | ||
| 607 | * \_SB.SCK1.CPU0 | ||
| 608 | * Rename the processor device bus id. And the new bus id will be | ||
| 609 | * generated as the following format: | ||
| 610 | * CPU+CPU ID. | ||
| 611 | */ | ||
| 612 | sprintf(acpi_device_bid(device), "CPU%X", pr->id); | ||
| 613 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Processor [%d:%d]\n", pr->id, | ||
| 614 | pr->acpi_id)); | ||
| 615 | |||
| 616 | if (!object.processor.pblk_address) | ||
| 617 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No PBLK (NULL address)\n")); | ||
| 618 | else if (object.processor.pblk_length != 6) | ||
| 619 | printk(KERN_ERR PREFIX "Invalid PBLK length [%d]\n", | ||
| 620 | object.processor.pblk_length); | ||
| 621 | else { | ||
| 622 | pr->throttling.address = object.processor.pblk_address; | ||
| 623 | pr->throttling.duty_offset = acpi_gbl_FADT.duty_offset; | ||
| 624 | pr->throttling.duty_width = acpi_gbl_FADT.duty_width; | ||
| 625 | |||
| 626 | pr->pblk = object.processor.pblk_address; | ||
| 627 | |||
| 628 | /* | ||
| 629 | * We don't care about error returns - we just try to mark | ||
| 630 | * these reserved so that nobody else is confused into thinking | ||
| 631 | * that this region might be unused.. | ||
| 632 | * | ||
| 633 | * (In particular, allocating the IO range for Cardbus) | ||
| 634 | */ | ||
| 635 | request_region(pr->throttling.address, 6, "ACPI CPU throttle"); | ||
| 636 | } | ||
| 637 | |||
| 638 | /* | ||
| 639 | * If ACPI describes a slot number for this CPU, we can use it | ||
| 640 | * ensure we get the right value in the "physical id" field | ||
| 641 | * of /proc/cpuinfo | ||
| 642 | */ | ||
| 643 | status = acpi_evaluate_object(pr->handle, "_SUN", NULL, &buffer); | ||
| 644 | if (ACPI_SUCCESS(status)) | ||
| 645 | arch_fix_phys_package_id(pr->id, object.integer.value); | ||
| 646 | |||
| 647 | return 0; | ||
| 648 | } | ||
| 649 | 200 | ||
| 650 | static DEFINE_PER_CPU(void *, processor_device_array); | 201 | status = acpi_get_type(handle, &acpi_type); |
| 651 | 202 | if (ACPI_FAILURE(status)) | |
| 652 | static void acpi_processor_notify(struct acpi_device *device, u32 event) | 203 | return false; |
| 653 | { | 204 | |
| 654 | struct acpi_processor *pr = acpi_driver_data(device); | 205 | switch (acpi_type) { |
| 655 | int saved; | 206 | case ACPI_TYPE_PROCESSOR: |
| 656 | 207 | status = acpi_evaluate_object(handle, NULL, NULL, &buffer); | |
| 657 | if (!pr) | 208 | if (ACPI_FAILURE(status)) |
| 658 | return; | 209 | return false; |
| 659 | 210 | acpi_id = object.processor.proc_id; | |
| 660 | switch (event) { | ||
| 661 | case ACPI_PROCESSOR_NOTIFY_PERFORMANCE: | ||
| 662 | saved = pr->performance_platform_limit; | ||
| 663 | acpi_processor_ppc_has_changed(pr, 1); | ||
| 664 | if (saved == pr->performance_platform_limit) | ||
| 665 | break; | ||
| 666 | acpi_bus_generate_proc_event(device, event, | ||
| 667 | pr->performance_platform_limit); | ||
| 668 | acpi_bus_generate_netlink_event(device->pnp.device_class, | ||
| 669 | dev_name(&device->dev), event, | ||
| 670 | pr->performance_platform_limit); | ||
| 671 | break; | 211 | break; |
| 672 | case ACPI_PROCESSOR_NOTIFY_POWER: | 212 | case ACPI_TYPE_DEVICE: |
| 673 | acpi_processor_cst_has_changed(pr); | 213 | status = acpi_evaluate_integer(handle, "_UID", NULL, &tmp); |
| 674 | acpi_bus_generate_proc_event(device, event, 0); | 214 | if (ACPI_FAILURE(status)) |
| 675 | acpi_bus_generate_netlink_event(device->pnp.device_class, | 215 | return false; |
| 676 | dev_name(&device->dev), event, 0); | 216 | acpi_id = tmp; |
| 677 | break; | 217 | break; |
| 678 | case ACPI_PROCESSOR_NOTIFY_THROTTLING: | ||
| 679 | acpi_processor_tstate_has_changed(pr); | ||
| 680 | acpi_bus_generate_proc_event(device, event, 0); | ||
| 681 | acpi_bus_generate_netlink_event(device->pnp.device_class, | ||
| 682 | dev_name(&device->dev), event, 0); | ||
| 683 | default: | 218 | default: |
| 684 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 219 | return false; |
| 685 | "Unsupported event [0x%x]\n", event)); | ||
| 686 | break; | ||
| 687 | } | 220 | } |
| 688 | 221 | ||
| 689 | return; | 222 | type = (acpi_type == ACPI_TYPE_DEVICE) ? 1 : 0; |
| 690 | } | 223 | cpuid = acpi_get_cpuid(handle, type, acpi_id); |
| 691 | 224 | ||
| 692 | static int acpi_cpu_soft_notify(struct notifier_block *nfb, | 225 | if (cpuid == -1) |
| 693 | unsigned long action, void *hcpu) | 226 | return false; |
| 694 | { | ||
| 695 | unsigned int cpu = (unsigned long)hcpu; | ||
| 696 | struct acpi_processor *pr = per_cpu(processors, cpu); | ||
| 697 | 227 | ||
| 698 | if (action == CPU_ONLINE && pr) { | 228 | return true; |
| 699 | acpi_processor_ppc_has_changed(pr, 0); | ||
| 700 | acpi_processor_cst_has_changed(pr); | ||
| 701 | acpi_processor_tstate_has_changed(pr); | ||
| 702 | } | ||
| 703 | return NOTIFY_OK; | ||
| 704 | } | 229 | } |
| 705 | 230 | ||
| 706 | static struct notifier_block acpi_cpu_notifier = | 231 | static void acpi_set_pdc_bits(u32 *buf) |
| 707 | { | 232 | { |
| 708 | .notifier_call = acpi_cpu_soft_notify, | 233 | buf[0] = ACPI_PDC_REVISION_ID; |
| 709 | }; | 234 | buf[1] = 1; |
| 710 | |||
| 711 | static int __cpuinit acpi_processor_add(struct acpi_device *device) | ||
| 712 | { | ||
| 713 | struct acpi_processor *pr = NULL; | ||
| 714 | int result = 0; | ||
| 715 | struct sys_device *sysdev; | ||
| 716 | |||
| 717 | pr = kzalloc(sizeof(struct acpi_processor), GFP_KERNEL); | ||
| 718 | if (!pr) | ||
| 719 | return -ENOMEM; | ||
| 720 | |||
| 721 | if (!zalloc_cpumask_var(&pr->throttling.shared_cpu_map, GFP_KERNEL)) { | ||
| 722 | kfree(pr); | ||
| 723 | return -ENOMEM; | ||
| 724 | } | ||
| 725 | |||
| 726 | pr->handle = device->handle; | ||
| 727 | strcpy(acpi_device_name(device), ACPI_PROCESSOR_DEVICE_NAME); | ||
| 728 | strcpy(acpi_device_class(device), ACPI_PROCESSOR_CLASS); | ||
| 729 | device->driver_data = pr; | ||
| 730 | |||
| 731 | result = acpi_processor_get_info(device); | ||
| 732 | if (result) { | ||
| 733 | /* Processor is physically not present */ | ||
| 734 | return 0; | ||
| 735 | } | ||
| 736 | |||
| 737 | BUG_ON((pr->id >= nr_cpu_ids) || (pr->id < 0)); | ||
| 738 | |||
| 739 | /* | ||
| 740 | * Buggy BIOS check | ||
| 741 | * ACPI id of processors can be reported wrongly by the BIOS. | ||
| 742 | * Don't trust it blindly | ||
| 743 | */ | ||
| 744 | if (per_cpu(processor_device_array, pr->id) != NULL && | ||
| 745 | per_cpu(processor_device_array, pr->id) != device) { | ||
| 746 | printk(KERN_WARNING "BIOS reported wrong ACPI id " | ||
| 747 | "for the processor\n"); | ||
| 748 | result = -ENODEV; | ||
| 749 | goto err_free_cpumask; | ||
| 750 | } | ||
| 751 | per_cpu(processor_device_array, pr->id) = device; | ||
| 752 | |||
| 753 | per_cpu(processors, pr->id) = pr; | ||
| 754 | |||
| 755 | result = acpi_processor_add_fs(device); | ||
| 756 | if (result) | ||
| 757 | goto err_free_cpumask; | ||
| 758 | |||
| 759 | sysdev = get_cpu_sysdev(pr->id); | ||
| 760 | if (sysfs_create_link(&device->dev.kobj, &sysdev->kobj, "sysdev")) { | ||
| 761 | result = -EFAULT; | ||
| 762 | goto err_remove_fs; | ||
| 763 | } | ||
| 764 | |||
| 765 | /* _PDC call should be done before doing anything else (if reqd.). */ | ||
| 766 | acpi_processor_set_pdc(pr->handle); | ||
| 767 | |||
| 768 | #ifdef CONFIG_CPU_FREQ | ||
| 769 | acpi_processor_ppc_has_changed(pr, 0); | ||
| 770 | #endif | ||
| 771 | acpi_processor_get_throttling_info(pr); | ||
| 772 | acpi_processor_get_limit_info(pr); | ||
| 773 | |||
| 774 | |||
| 775 | acpi_processor_power_init(pr, device); | ||
| 776 | |||
| 777 | pr->cdev = thermal_cooling_device_register("Processor", device, | ||
| 778 | &processor_cooling_ops); | ||
| 779 | if (IS_ERR(pr->cdev)) { | ||
| 780 | result = PTR_ERR(pr->cdev); | ||
| 781 | goto err_power_exit; | ||
| 782 | } | ||
| 783 | |||
| 784 | dev_dbg(&device->dev, "registered as cooling_device%d\n", | ||
| 785 | pr->cdev->id); | ||
| 786 | |||
| 787 | result = sysfs_create_link(&device->dev.kobj, | ||
| 788 | &pr->cdev->device.kobj, | ||
| 789 | "thermal_cooling"); | ||
| 790 | if (result) { | ||
| 791 | printk(KERN_ERR PREFIX "Create sysfs link\n"); | ||
| 792 | goto err_thermal_unregister; | ||
| 793 | } | ||
| 794 | result = sysfs_create_link(&pr->cdev->device.kobj, | ||
| 795 | &device->dev.kobj, | ||
| 796 | "device"); | ||
| 797 | if (result) { | ||
| 798 | printk(KERN_ERR PREFIX "Create sysfs link\n"); | ||
| 799 | goto err_remove_sysfs; | ||
| 800 | } | ||
| 801 | 235 | ||
| 802 | return 0; | 236 | /* Enable coordination with firmware's _TSD info */ |
| 803 | 237 | buf[2] = ACPI_PDC_SMP_T_SWCOORD; | |
| 804 | err_remove_sysfs: | ||
| 805 | sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); | ||
| 806 | err_thermal_unregister: | ||
| 807 | thermal_cooling_device_unregister(pr->cdev); | ||
| 808 | err_power_exit: | ||
| 809 | acpi_processor_power_exit(pr, device); | ||
| 810 | err_remove_fs: | ||
| 811 | acpi_processor_remove_fs(device); | ||
| 812 | err_free_cpumask: | ||
| 813 | free_cpumask_var(pr->throttling.shared_cpu_map); | ||
| 814 | 238 | ||
| 815 | return result; | 239 | /* Twiddle arch-specific bits needed for _PDC */ |
| 240 | arch_acpi_set_pdc_bits(buf); | ||
| 816 | } | 241 | } |
| 817 | 242 | ||
| 818 | static int acpi_processor_remove(struct acpi_device *device, int type) | 243 | static struct acpi_object_list *acpi_processor_alloc_pdc(void) |
| 819 | { | 244 | { |
| 820 | struct acpi_processor *pr = NULL; | 245 | struct acpi_object_list *obj_list; |
| 821 | 246 | union acpi_object *obj; | |
| 822 | 247 | u32 *buf; | |
| 823 | if (!device || !acpi_driver_data(device)) | ||
| 824 | return -EINVAL; | ||
| 825 | |||
| 826 | pr = acpi_driver_data(device); | ||
| 827 | |||
| 828 | if (pr->id >= nr_cpu_ids) | ||
| 829 | goto free; | ||
| 830 | 248 | ||
| 831 | if (type == ACPI_BUS_REMOVAL_EJECT) { | 249 | /* allocate and initialize pdc. It will be used later. */ |
| 832 | if (acpi_processor_handle_eject(pr)) | 250 | obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL); |
| 833 | return -EINVAL; | 251 | if (!obj_list) { |
| 252 | printk(KERN_ERR "Memory allocation error\n"); | ||
| 253 | return NULL; | ||
| 834 | } | 254 | } |
| 835 | 255 | ||
| 836 | acpi_processor_power_exit(pr, device); | 256 | obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL); |
| 837 | 257 | if (!obj) { | |
| 838 | sysfs_remove_link(&device->dev.kobj, "sysdev"); | 258 | printk(KERN_ERR "Memory allocation error\n"); |
| 839 | 259 | kfree(obj_list); | |
| 840 | acpi_processor_remove_fs(device); | 260 | return NULL; |
| 841 | |||
| 842 | if (pr->cdev) { | ||
| 843 | sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); | ||
| 844 | sysfs_remove_link(&pr->cdev->device.kobj, "device"); | ||
| 845 | thermal_cooling_device_unregister(pr->cdev); | ||
| 846 | pr->cdev = NULL; | ||
| 847 | } | 261 | } |
| 848 | 262 | ||
| 849 | per_cpu(processors, pr->id) = NULL; | 263 | buf = kmalloc(12, GFP_KERNEL); |
| 850 | per_cpu(processor_device_array, pr->id) = NULL; | 264 | if (!buf) { |
| 851 | 265 | printk(KERN_ERR "Memory allocation error\n"); | |
| 852 | free: | 266 | kfree(obj); |
| 853 | free_cpumask_var(pr->throttling.shared_cpu_map); | 267 | kfree(obj_list); |
| 854 | kfree(pr); | 268 | return NULL; |
| 855 | |||
| 856 | return 0; | ||
| 857 | } | ||
| 858 | |||
| 859 | #ifdef CONFIG_ACPI_HOTPLUG_CPU | ||
| 860 | /**************************************************************************** | ||
| 861 | * Acpi processor hotplug support * | ||
| 862 | ****************************************************************************/ | ||
| 863 | |||
| 864 | static int is_processor_present(acpi_handle handle) | ||
| 865 | { | ||
| 866 | acpi_status status; | ||
| 867 | unsigned long long sta = 0; | ||
| 868 | |||
| 869 | |||
| 870 | status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); | ||
| 871 | |||
| 872 | if (ACPI_SUCCESS(status) && (sta & ACPI_STA_DEVICE_PRESENT)) | ||
| 873 | return 1; | ||
| 874 | |||
| 875 | /* | ||
| 876 | * _STA is mandatory for a processor that supports hot plug | ||
| 877 | */ | ||
| 878 | if (status == AE_NOT_FOUND) | ||
| 879 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
| 880 | "Processor does not support hot plug\n")); | ||
| 881 | else | ||
| 882 | ACPI_EXCEPTION((AE_INFO, status, | ||
| 883 | "Processor Device is not present")); | ||
| 884 | return 0; | ||
| 885 | } | ||
| 886 | |||
| 887 | static | ||
| 888 | int acpi_processor_device_add(acpi_handle handle, struct acpi_device **device) | ||
| 889 | { | ||
| 890 | acpi_handle phandle; | ||
| 891 | struct acpi_device *pdev; | ||
| 892 | |||
| 893 | |||
| 894 | if (acpi_get_parent(handle, &phandle)) { | ||
| 895 | return -ENODEV; | ||
| 896 | } | 269 | } |
| 897 | 270 | ||
| 898 | if (acpi_bus_get_device(phandle, &pdev)) { | 271 | acpi_set_pdc_bits(buf); |
| 899 | return -ENODEV; | ||
| 900 | } | ||
| 901 | 272 | ||
| 902 | if (acpi_bus_add(device, pdev, handle, ACPI_BUS_TYPE_PROCESSOR)) { | 273 | obj->type = ACPI_TYPE_BUFFER; |
| 903 | return -ENODEV; | 274 | obj->buffer.length = 12; |
| 904 | } | 275 | obj->buffer.pointer = (u8 *) buf; |
| 276 | obj_list->count = 1; | ||
| 277 | obj_list->pointer = obj; | ||
| 905 | 278 | ||
| 906 | return 0; | 279 | return obj_list; |
| 907 | } | 280 | } |
| 908 | 281 | ||
| 909 | static void __ref acpi_processor_hotplug_notify(acpi_handle handle, | 282 | /* |
| 910 | u32 event, void *data) | 283 | * _PDC is required for a BIOS-OS handshake for most of the newer |
| 284 | * ACPI processor features. | ||
| 285 | */ | ||
| 286 | static int | ||
| 287 | acpi_processor_eval_pdc(acpi_handle handle, struct acpi_object_list *pdc_in) | ||
| 911 | { | 288 | { |
| 912 | struct acpi_processor *pr; | 289 | acpi_status status = AE_OK; |
| 913 | struct acpi_device *device = NULL; | ||
| 914 | int result; | ||
| 915 | |||
| 916 | 290 | ||
| 917 | switch (event) { | 291 | if (idle_nomwait) { |
| 918 | case ACPI_NOTIFY_BUS_CHECK: | 292 | /* |
| 919 | case ACPI_NOTIFY_DEVICE_CHECK: | 293 | * If mwait is disabled for CPU C-states, the C2C3_FFH access |
| 920 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 294 | * mode will be disabled in the parameter of _PDC object. |
| 921 | "Processor driver received %s event\n", | 295 | * Of course C1_FFH access mode will also be disabled. |
| 922 | (event == ACPI_NOTIFY_BUS_CHECK) ? | 296 | */ |
| 923 | "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK")); | 297 | union acpi_object *obj; |
| 924 | 298 | u32 *buffer = NULL; | |
| 925 | if (!is_processor_present(handle)) | ||
| 926 | break; | ||
| 927 | 299 | ||
| 928 | if (acpi_bus_get_device(handle, &device)) { | 300 | obj = pdc_in->pointer; |
| 929 | result = acpi_processor_device_add(handle, &device); | 301 | buffer = (u32 *)(obj->buffer.pointer); |
| 930 | if (result) | 302 | buffer[2] &= ~(ACPI_PDC_C_C2C3_FFH | ACPI_PDC_C_C1_FFH); |
| 931 | printk(KERN_ERR PREFIX | ||
| 932 | "Unable to add the device\n"); | ||
| 933 | break; | ||
| 934 | } | ||
| 935 | break; | ||
| 936 | case ACPI_NOTIFY_EJECT_REQUEST: | ||
| 937 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
| 938 | "received ACPI_NOTIFY_EJECT_REQUEST\n")); | ||
| 939 | 303 | ||
| 940 | if (acpi_bus_get_device(handle, &device)) { | ||
| 941 | printk(KERN_ERR PREFIX | ||
| 942 | "Device don't exist, dropping EJECT\n"); | ||
| 943 | break; | ||
| 944 | } | ||
| 945 | pr = acpi_driver_data(device); | ||
| 946 | if (!pr) { | ||
| 947 | printk(KERN_ERR PREFIX | ||
| 948 | "Driver data is NULL, dropping EJECT\n"); | ||
| 949 | return; | ||
| 950 | } | ||
| 951 | break; | ||
| 952 | default: | ||
| 953 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
| 954 | "Unsupported event [0x%x]\n", event)); | ||
| 955 | break; | ||
| 956 | } | 304 | } |
| 305 | status = acpi_evaluate_object(handle, "_PDC", pdc_in, NULL); | ||
| 957 | 306 | ||
| 958 | return; | ||
| 959 | } | ||
| 960 | |||
| 961 | static acpi_status | ||
| 962 | processor_walk_namespace_cb(acpi_handle handle, | ||
| 963 | u32 lvl, void *context, void **rv) | ||
| 964 | { | ||
| 965 | acpi_status status; | ||
| 966 | int *action = context; | ||
| 967 | acpi_object_type type = 0; | ||
| 968 | |||
| 969 | status = acpi_get_type(handle, &type); | ||
| 970 | if (ACPI_FAILURE(status)) | 307 | if (ACPI_FAILURE(status)) |
| 971 | return (AE_OK); | 308 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 972 | 309 | "Could not evaluate _PDC, using legacy perf. control.\n")); | |
| 973 | if (type != ACPI_TYPE_PROCESSOR) | ||
| 974 | return (AE_OK); | ||
| 975 | |||
| 976 | switch (*action) { | ||
| 977 | case INSTALL_NOTIFY_HANDLER: | ||
| 978 | acpi_install_notify_handler(handle, | ||
| 979 | ACPI_SYSTEM_NOTIFY, | ||
| 980 | acpi_processor_hotplug_notify, | ||
| 981 | NULL); | ||
| 982 | break; | ||
| 983 | case UNINSTALL_NOTIFY_HANDLER: | ||
| 984 | acpi_remove_notify_handler(handle, | ||
| 985 | ACPI_SYSTEM_NOTIFY, | ||
| 986 | acpi_processor_hotplug_notify); | ||
| 987 | break; | ||
| 988 | default: | ||
| 989 | break; | ||
| 990 | } | ||
| 991 | 310 | ||
| 992 | return (AE_OK); | 311 | return status; |
| 993 | } | 312 | } |
| 994 | 313 | ||
| 995 | static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu) | 314 | void acpi_processor_set_pdc(acpi_handle handle) |
| 996 | { | 315 | { |
| 316 | struct acpi_object_list *obj_list; | ||
| 997 | 317 | ||
| 998 | if (!is_processor_present(handle)) { | 318 | if (arch_has_acpi_pdc() == false) |
| 999 | return AE_ERROR; | 319 | return; |
| 1000 | } | ||
| 1001 | 320 | ||
| 1002 | if (acpi_map_lsapic(handle, p_cpu)) | 321 | obj_list = acpi_processor_alloc_pdc(); |
| 1003 | return AE_ERROR; | 322 | if (!obj_list) |
| 323 | return; | ||
| 1004 | 324 | ||
| 1005 | if (arch_register_cpu(*p_cpu)) { | 325 | acpi_processor_eval_pdc(handle, obj_list); |
| 1006 | acpi_unmap_lsapic(*p_cpu); | ||
| 1007 | return AE_ERROR; | ||
| 1008 | } | ||
| 1009 | 326 | ||
| 1010 | return AE_OK; | 327 | kfree(obj_list->pointer->buffer.pointer); |
| 328 | kfree(obj_list->pointer); | ||
| 329 | kfree(obj_list); | ||
| 1011 | } | 330 | } |
| 331 | EXPORT_SYMBOL_GPL(acpi_processor_set_pdc); | ||
| 1012 | 332 | ||
| 1013 | static int acpi_processor_handle_eject(struct acpi_processor *pr) | 333 | static acpi_status |
| 334 | early_init_pdc(acpi_handle handle, u32 lvl, void *context, void **rv) | ||
| 1014 | { | 335 | { |
| 1015 | if (cpu_online(pr->id)) | 336 | if (processor_physically_present(handle) == false) |
| 1016 | cpu_down(pr->id); | 337 | return AE_OK; |
| 1017 | 338 | ||
| 1018 | arch_unregister_cpu(pr->id); | 339 | acpi_processor_set_pdc(handle); |
| 1019 | acpi_unmap_lsapic(pr->id); | 340 | return AE_OK; |
| 1020 | return (0); | ||
| 1021 | } | ||
| 1022 | #else | ||
| 1023 | static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu) | ||
| 1024 | { | ||
| 1025 | return AE_ERROR; | ||
| 1026 | } | ||
| 1027 | static int acpi_processor_handle_eject(struct acpi_processor *pr) | ||
| 1028 | { | ||
| 1029 | return (-EINVAL); | ||
| 1030 | } | 341 | } |
| 1031 | #endif | ||
| 1032 | 342 | ||
| 1033 | static | 343 | void __init acpi_early_processor_set_pdc(void) |
| 1034 | void acpi_processor_install_hotplug_notify(void) | ||
| 1035 | { | 344 | { |
| 1036 | #ifdef CONFIG_ACPI_HOTPLUG_CPU | 345 | /* |
| 1037 | int action = INSTALL_NOTIFY_HANDLER; | 346 | * Check whether the system is DMI table. If yes, OSPM |
| 1038 | acpi_walk_namespace(ACPI_TYPE_PROCESSOR, | 347 | * should not use mwait for CPU-states. |
| 1039 | ACPI_ROOT_OBJECT, | 348 | */ |
| 1040 | ACPI_UINT32_MAX, | 349 | dmi_check_system(processor_idle_dmi_table); |
| 1041 | processor_walk_namespace_cb, NULL, &action, NULL); | ||
| 1042 | #endif | ||
| 1043 | register_hotcpu_notifier(&acpi_cpu_notifier); | ||
| 1044 | } | ||
| 1045 | 350 | ||
| 1046 | static | 351 | acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT, |
| 1047 | void acpi_processor_uninstall_hotplug_notify(void) | ||
| 1048 | { | ||
| 1049 | #ifdef CONFIG_ACPI_HOTPLUG_CPU | ||
| 1050 | int action = UNINSTALL_NOTIFY_HANDLER; | ||
| 1051 | acpi_walk_namespace(ACPI_TYPE_PROCESSOR, | ||
| 1052 | ACPI_ROOT_OBJECT, | ||
| 1053 | ACPI_UINT32_MAX, | 352 | ACPI_UINT32_MAX, |
| 1054 | processor_walk_namespace_cb, NULL, &action, NULL); | 353 | early_init_pdc, NULL, NULL, NULL); |
| 1055 | #endif | ||
| 1056 | unregister_hotcpu_notifier(&acpi_cpu_notifier); | ||
| 1057 | } | 354 | } |
| 1058 | |||
| 1059 | /* | ||
| 1060 | * We keep the driver loaded even when ACPI is not running. | ||
| 1061 | * This is needed for the powernow-k8 driver, that works even without | ||
| 1062 | * ACPI, but needs symbols from this driver | ||
| 1063 | */ | ||
| 1064 | |||
| 1065 | static int __init acpi_processor_init(void) | ||
| 1066 | { | ||
| 1067 | int result = 0; | ||
| 1068 | |||
| 1069 | if (acpi_disabled) | ||
| 1070 | return 0; | ||
| 1071 | |||
| 1072 | memset(&errata, 0, sizeof(errata)); | ||
| 1073 | |||
| 1074 | #ifdef CONFIG_SMP | ||
| 1075 | if (ACPI_FAILURE(acpi_get_table(ACPI_SIG_MADT, 0, | ||
| 1076 | (struct acpi_table_header **)&madt))) | ||
| 1077 | madt = NULL; | ||
| 1078 | #endif | ||
| 1079 | #ifdef CONFIG_ACPI_PROCFS | ||
| 1080 | acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir); | ||
| 1081 | if (!acpi_processor_dir) | ||
| 1082 | return -ENOMEM; | ||
| 1083 | #endif | ||
| 1084 | result = cpuidle_register_driver(&acpi_idle_driver); | ||
| 1085 | if (result < 0) | ||
| 1086 | goto out_proc; | ||
| 1087 | |||
| 1088 | result = acpi_bus_register_driver(&acpi_processor_driver); | ||
| 1089 | if (result < 0) | ||
| 1090 | goto out_cpuidle; | ||
| 1091 | |||
| 1092 | acpi_processor_install_hotplug_notify(); | ||
| 1093 | |||
| 1094 | acpi_thermal_cpufreq_init(); | ||
| 1095 | |||
| 1096 | acpi_processor_ppc_init(); | ||
| 1097 | |||
| 1098 | acpi_processor_throttling_init(); | ||
| 1099 | |||
| 1100 | return 0; | ||
| 1101 | |||
| 1102 | out_cpuidle: | ||
| 1103 | cpuidle_unregister_driver(&acpi_idle_driver); | ||
| 1104 | |||
| 1105 | out_proc: | ||
| 1106 | #ifdef CONFIG_ACPI_PROCFS | ||
| 1107 | remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); | ||
| 1108 | #endif | ||
| 1109 | |||
| 1110 | return result; | ||
| 1111 | } | ||
| 1112 | |||
| 1113 | static void __exit acpi_processor_exit(void) | ||
| 1114 | { | ||
| 1115 | if (acpi_disabled) | ||
| 1116 | return; | ||
| 1117 | |||
| 1118 | acpi_processor_ppc_exit(); | ||
| 1119 | |||
| 1120 | acpi_thermal_cpufreq_exit(); | ||
| 1121 | |||
| 1122 | acpi_processor_uninstall_hotplug_notify(); | ||
| 1123 | |||
| 1124 | acpi_bus_unregister_driver(&acpi_processor_driver); | ||
| 1125 | |||
| 1126 | cpuidle_unregister_driver(&acpi_idle_driver); | ||
| 1127 | |||
| 1128 | #ifdef CONFIG_ACPI_PROCFS | ||
| 1129 | remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); | ||
| 1130 | #endif | ||
| 1131 | |||
| 1132 | return; | ||
| 1133 | } | ||
| 1134 | |||
| 1135 | module_init(acpi_processor_init); | ||
| 1136 | module_exit(acpi_processor_exit); | ||
| 1137 | |||
| 1138 | EXPORT_SYMBOL(acpi_processor_set_thermal_limit); | ||
| 1139 | |||
| 1140 | MODULE_ALIAS("processor"); | ||
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c new file mode 100644 index 000000000000..b5658cdce27f --- /dev/null +++ b/drivers/acpi/processor_driver.c | |||
| @@ -0,0 +1,978 @@ | |||
| 1 | /* | ||
| 2 | * acpi_processor.c - ACPI Processor Driver ($Revision: 71 $) | ||
| 3 | * | ||
| 4 | * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> | ||
| 5 | * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> | ||
| 6 | * Copyright (C) 2004 Dominik Brodowski <linux@brodo.de> | ||
| 7 | * Copyright (C) 2004 Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> | ||
| 8 | * - Added processor hotplug support | ||
| 9 | * | ||
| 10 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 11 | * | ||
| 12 | * This program is free software; you can redistribute it and/or modify | ||
| 13 | * it under the terms of the GNU General Public License as published by | ||
| 14 | * the Free Software Foundation; either version 2 of the License, or (at | ||
| 15 | * your option) any later version. | ||
| 16 | * | ||
| 17 | * This program is distributed in the hope that it will be useful, but | ||
| 18 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 20 | * General Public License for more details. | ||
| 21 | * | ||
| 22 | * You should have received a copy of the GNU General Public License along | ||
| 23 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
| 24 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | ||
| 25 | * | ||
| 26 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 27 | * TBD: | ||
| 28 | * 1. Make # power states dynamic. | ||
| 29 | * 2. Support duty_cycle values that span bit 4. | ||
| 30 | * 3. Optimize by having scheduler determine business instead of | ||
| 31 | * having us try to calculate it here. | ||
| 32 | * 4. Need C1 timing -- must modify kernel (IRQ handler) to get this. | ||
| 33 | */ | ||
| 34 | |||
| 35 | #include <linux/kernel.h> | ||
| 36 | #include <linux/module.h> | ||
| 37 | #include <linux/init.h> | ||
| 38 | #include <linux/types.h> | ||
| 39 | #include <linux/pci.h> | ||
| 40 | #include <linux/pm.h> | ||
| 41 | #include <linux/cpufreq.h> | ||
| 42 | #include <linux/cpu.h> | ||
| 43 | #include <linux/proc_fs.h> | ||
| 44 | #include <linux/seq_file.h> | ||
| 45 | #include <linux/dmi.h> | ||
| 46 | #include <linux/moduleparam.h> | ||
| 47 | #include <linux/cpuidle.h> | ||
| 48 | |||
| 49 | #include <asm/io.h> | ||
| 50 | #include <asm/system.h> | ||
| 51 | #include <asm/cpu.h> | ||
| 52 | #include <asm/delay.h> | ||
| 53 | #include <asm/uaccess.h> | ||
| 54 | #include <asm/processor.h> | ||
| 55 | #include <asm/smp.h> | ||
| 56 | #include <asm/acpi.h> | ||
| 57 | |||
| 58 | #include <acpi/acpi_bus.h> | ||
| 59 | #include <acpi/acpi_drivers.h> | ||
| 60 | #include <acpi/processor.h> | ||
| 61 | |||
| 62 | #define PREFIX "ACPI: " | ||
| 63 | |||
| 64 | #define ACPI_PROCESSOR_CLASS "processor" | ||
| 65 | #define ACPI_PROCESSOR_DEVICE_NAME "Processor" | ||
| 66 | #define ACPI_PROCESSOR_FILE_INFO "info" | ||
| 67 | #define ACPI_PROCESSOR_FILE_THROTTLING "throttling" | ||
| 68 | #define ACPI_PROCESSOR_FILE_LIMIT "limit" | ||
| 69 | #define ACPI_PROCESSOR_NOTIFY_PERFORMANCE 0x80 | ||
| 70 | #define ACPI_PROCESSOR_NOTIFY_POWER 0x81 | ||
| 71 | #define ACPI_PROCESSOR_NOTIFY_THROTTLING 0x82 | ||
| 72 | |||
| 73 | #define ACPI_PROCESSOR_LIMIT_USER 0 | ||
| 74 | #define ACPI_PROCESSOR_LIMIT_THERMAL 1 | ||
| 75 | |||
| 76 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT | ||
| 77 | ACPI_MODULE_NAME("processor_driver"); | ||
| 78 | |||
| 79 | MODULE_AUTHOR("Paul Diefenbaugh"); | ||
| 80 | MODULE_DESCRIPTION("ACPI Processor Driver"); | ||
| 81 | MODULE_LICENSE("GPL"); | ||
| 82 | |||
| 83 | static int acpi_processor_add(struct acpi_device *device); | ||
| 84 | static int acpi_processor_remove(struct acpi_device *device, int type); | ||
| 85 | #ifdef CONFIG_ACPI_PROCFS | ||
| 86 | static int acpi_processor_info_open_fs(struct inode *inode, struct file *file); | ||
| 87 | #endif | ||
| 88 | static void acpi_processor_notify(struct acpi_device *device, u32 event); | ||
| 89 | static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu); | ||
| 90 | static int acpi_processor_handle_eject(struct acpi_processor *pr); | ||
| 91 | |||
| 92 | |||
| 93 | static const struct acpi_device_id processor_device_ids[] = { | ||
| 94 | {ACPI_PROCESSOR_OBJECT_HID, 0}, | ||
| 95 | {"ACPI0007", 0}, | ||
| 96 | {"", 0}, | ||
| 97 | }; | ||
| 98 | MODULE_DEVICE_TABLE(acpi, processor_device_ids); | ||
| 99 | |||
| 100 | static struct acpi_driver acpi_processor_driver = { | ||
| 101 | .name = "processor", | ||
| 102 | .class = ACPI_PROCESSOR_CLASS, | ||
| 103 | .ids = processor_device_ids, | ||
| 104 | .ops = { | ||
| 105 | .add = acpi_processor_add, | ||
| 106 | .remove = acpi_processor_remove, | ||
| 107 | .suspend = acpi_processor_suspend, | ||
| 108 | .resume = acpi_processor_resume, | ||
| 109 | .notify = acpi_processor_notify, | ||
| 110 | }, | ||
| 111 | }; | ||
| 112 | |||
| 113 | #define INSTALL_NOTIFY_HANDLER 1 | ||
| 114 | #define UNINSTALL_NOTIFY_HANDLER 2 | ||
| 115 | #ifdef CONFIG_ACPI_PROCFS | ||
| 116 | static const struct file_operations acpi_processor_info_fops = { | ||
| 117 | .owner = THIS_MODULE, | ||
| 118 | .open = acpi_processor_info_open_fs, | ||
| 119 | .read = seq_read, | ||
| 120 | .llseek = seq_lseek, | ||
| 121 | .release = single_release, | ||
| 122 | }; | ||
| 123 | #endif | ||
| 124 | |||
| 125 | DEFINE_PER_CPU(struct acpi_processor *, processors); | ||
| 126 | EXPORT_PER_CPU_SYMBOL(processors); | ||
| 127 | |||
| 128 | struct acpi_processor_errata errata __read_mostly; | ||
| 129 | |||
| 130 | /* -------------------------------------------------------------------------- | ||
| 131 | Errata Handling | ||
| 132 | -------------------------------------------------------------------------- */ | ||
| 133 | |||
| 134 | static int acpi_processor_errata_piix4(struct pci_dev *dev) | ||
| 135 | { | ||
| 136 | u8 value1 = 0; | ||
| 137 | u8 value2 = 0; | ||
| 138 | |||
| 139 | |||
| 140 | if (!dev) | ||
| 141 | return -EINVAL; | ||
| 142 | |||
| 143 | /* | ||
| 144 | * Note that 'dev' references the PIIX4 ACPI Controller. | ||
| 145 | */ | ||
| 146 | |||
| 147 | switch (dev->revision) { | ||
| 148 | case 0: | ||
| 149 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4 A-step\n")); | ||
| 150 | break; | ||
| 151 | case 1: | ||
| 152 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4 B-step\n")); | ||
| 153 | break; | ||
| 154 | case 2: | ||
| 155 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4E\n")); | ||
| 156 | break; | ||
| 157 | case 3: | ||
| 158 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4M\n")); | ||
| 159 | break; | ||
| 160 | default: | ||
| 161 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found unknown PIIX4\n")); | ||
| 162 | break; | ||
| 163 | } | ||
| 164 | |||
| 165 | switch (dev->revision) { | ||
| 166 | |||
| 167 | case 0: /* PIIX4 A-step */ | ||
| 168 | case 1: /* PIIX4 B-step */ | ||
| 169 | /* | ||
| 170 | * See specification changes #13 ("Manual Throttle Duty Cycle") | ||
| 171 | * and #14 ("Enabling and Disabling Manual Throttle"), plus | ||
| 172 | * erratum #5 ("STPCLK# Deassertion Time") from the January | ||
| 173 | * 2002 PIIX4 specification update. Applies to only older | ||
| 174 | * PIIX4 models. | ||
| 175 | */ | ||
| 176 | errata.piix4.throttle = 1; | ||
| 177 | |||
| 178 | case 2: /* PIIX4E */ | ||
| 179 | case 3: /* PIIX4M */ | ||
| 180 | /* | ||
| 181 | * See erratum #18 ("C3 Power State/BMIDE and Type-F DMA | ||
| 182 | * Livelock") from the January 2002 PIIX4 specification update. | ||
| 183 | * Applies to all PIIX4 models. | ||
| 184 | */ | ||
| 185 | |||
| 186 | /* | ||
| 187 | * BM-IDE | ||
| 188 | * ------ | ||
| 189 | * Find the PIIX4 IDE Controller and get the Bus Master IDE | ||
| 190 | * Status register address. We'll use this later to read | ||
| 191 | * each IDE controller's DMA status to make sure we catch all | ||
| 192 | * DMA activity. | ||
| 193 | */ | ||
| 194 | dev = pci_get_subsys(PCI_VENDOR_ID_INTEL, | ||
| 195 | PCI_DEVICE_ID_INTEL_82371AB, | ||
| 196 | PCI_ANY_ID, PCI_ANY_ID, NULL); | ||
| 197 | if (dev) { | ||
| 198 | errata.piix4.bmisx = pci_resource_start(dev, 4); | ||
| 199 | pci_dev_put(dev); | ||
| 200 | } | ||
| 201 | |||
| 202 | /* | ||
| 203 | * Type-F DMA | ||
| 204 | * ---------- | ||
| 205 | * Find the PIIX4 ISA Controller and read the Motherboard | ||
| 206 | * DMA controller's status to see if Type-F (Fast) DMA mode | ||
| 207 | * is enabled (bit 7) on either channel. Note that we'll | ||
| 208 | * disable C3 support if this is enabled, as some legacy | ||
| 209 | * devices won't operate well if fast DMA is disabled. | ||
| 210 | */ | ||
| 211 | dev = pci_get_subsys(PCI_VENDOR_ID_INTEL, | ||
| 212 | PCI_DEVICE_ID_INTEL_82371AB_0, | ||
| 213 | PCI_ANY_ID, PCI_ANY_ID, NULL); | ||
| 214 | if (dev) { | ||
| 215 | pci_read_config_byte(dev, 0x76, &value1); | ||
| 216 | pci_read_config_byte(dev, 0x77, &value2); | ||
| 217 | if ((value1 & 0x80) || (value2 & 0x80)) | ||
| 218 | errata.piix4.fdma = 1; | ||
| 219 | pci_dev_put(dev); | ||
| 220 | } | ||
| 221 | |||
| 222 | break; | ||
| 223 | } | ||
| 224 | |||
| 225 | if (errata.piix4.bmisx) | ||
| 226 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
| 227 | "Bus master activity detection (BM-IDE) erratum enabled\n")); | ||
| 228 | if (errata.piix4.fdma) | ||
| 229 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
| 230 | "Type-F DMA livelock erratum (C3 disabled)\n")); | ||
| 231 | |||
| 232 | return 0; | ||
| 233 | } | ||
| 234 | |||
| 235 | static int acpi_processor_errata(struct acpi_processor *pr) | ||
| 236 | { | ||
| 237 | int result = 0; | ||
| 238 | struct pci_dev *dev = NULL; | ||
| 239 | |||
| 240 | |||
| 241 | if (!pr) | ||
| 242 | return -EINVAL; | ||
| 243 | |||
| 244 | /* | ||
| 245 | * PIIX4 | ||
| 246 | */ | ||
| 247 | dev = pci_get_subsys(PCI_VENDOR_ID_INTEL, | ||
| 248 | PCI_DEVICE_ID_INTEL_82371AB_3, PCI_ANY_ID, | ||
| 249 | PCI_ANY_ID, NULL); | ||
| 250 | if (dev) { | ||
| 251 | result = acpi_processor_errata_piix4(dev); | ||
| 252 | pci_dev_put(dev); | ||
| 253 | } | ||
| 254 | |||
| 255 | return result; | ||
| 256 | } | ||
| 257 | |||
| 258 | /* -------------------------------------------------------------------------- | ||
| 259 | FS Interface (/proc) | ||
| 260 | -------------------------------------------------------------------------- */ | ||
| 261 | |||
| 262 | #ifdef CONFIG_ACPI_PROCFS | ||
| 263 | static struct proc_dir_entry *acpi_processor_dir = NULL; | ||
| 264 | |||
| 265 | static int acpi_processor_info_seq_show(struct seq_file *seq, void *offset) | ||
| 266 | { | ||
| 267 | struct acpi_processor *pr = seq->private; | ||
| 268 | |||
| 269 | |||
| 270 | if (!pr) | ||
| 271 | goto end; | ||
| 272 | |||
| 273 | seq_printf(seq, "processor id: %d\n" | ||
| 274 | "acpi id: %d\n" | ||
| 275 | "bus mastering control: %s\n" | ||
| 276 | "power management: %s\n" | ||
| 277 | "throttling control: %s\n" | ||
| 278 | "limit interface: %s\n", | ||
| 279 | pr->id, | ||
| 280 | pr->acpi_id, | ||
| 281 | pr->flags.bm_control ? "yes" : "no", | ||
| 282 | pr->flags.power ? "yes" : "no", | ||
| 283 | pr->flags.throttling ? "yes" : "no", | ||
| 284 | pr->flags.limit ? "yes" : "no"); | ||
| 285 | |||
| 286 | end: | ||
| 287 | return 0; | ||
| 288 | } | ||
| 289 | |||
| 290 | static int acpi_processor_info_open_fs(struct inode *inode, struct file *file) | ||
| 291 | { | ||
| 292 | return single_open(file, acpi_processor_info_seq_show, | ||
| 293 | PDE(inode)->data); | ||
| 294 | } | ||
| 295 | |||
| 296 | static int __cpuinit acpi_processor_add_fs(struct acpi_device *device) | ||
| 297 | { | ||
| 298 | struct proc_dir_entry *entry = NULL; | ||
| 299 | |||
| 300 | |||
| 301 | if (!acpi_device_dir(device)) { | ||
| 302 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), | ||
| 303 | acpi_processor_dir); | ||
| 304 | if (!acpi_device_dir(device)) | ||
| 305 | return -ENODEV; | ||
| 306 | } | ||
| 307 | |||
| 308 | /* 'info' [R] */ | ||
| 309 | entry = proc_create_data(ACPI_PROCESSOR_FILE_INFO, | ||
| 310 | S_IRUGO, acpi_device_dir(device), | ||
| 311 | &acpi_processor_info_fops, | ||
| 312 | acpi_driver_data(device)); | ||
| 313 | if (!entry) | ||
| 314 | return -EIO; | ||
| 315 | |||
| 316 | /* 'throttling' [R/W] */ | ||
| 317 | entry = proc_create_data(ACPI_PROCESSOR_FILE_THROTTLING, | ||
| 318 | S_IFREG | S_IRUGO | S_IWUSR, | ||
| 319 | acpi_device_dir(device), | ||
| 320 | &acpi_processor_throttling_fops, | ||
| 321 | acpi_driver_data(device)); | ||
| 322 | if (!entry) | ||
| 323 | return -EIO; | ||
| 324 | |||
| 325 | /* 'limit' [R/W] */ | ||
| 326 | entry = proc_create_data(ACPI_PROCESSOR_FILE_LIMIT, | ||
| 327 | S_IFREG | S_IRUGO | S_IWUSR, | ||
| 328 | acpi_device_dir(device), | ||
| 329 | &acpi_processor_limit_fops, | ||
| 330 | acpi_driver_data(device)); | ||
| 331 | if (!entry) | ||
| 332 | return -EIO; | ||
| 333 | return 0; | ||
| 334 | } | ||
| 335 | static int acpi_processor_remove_fs(struct acpi_device *device) | ||
| 336 | { | ||
| 337 | |||
| 338 | if (acpi_device_dir(device)) { | ||
| 339 | remove_proc_entry(ACPI_PROCESSOR_FILE_INFO, | ||
| 340 | acpi_device_dir(device)); | ||
| 341 | remove_proc_entry(ACPI_PROCESSOR_FILE_THROTTLING, | ||
| 342 | acpi_device_dir(device)); | ||
| 343 | remove_proc_entry(ACPI_PROCESSOR_FILE_LIMIT, | ||
| 344 | acpi_device_dir(device)); | ||
| 345 | remove_proc_entry(acpi_device_bid(device), acpi_processor_dir); | ||
| 346 | acpi_device_dir(device) = NULL; | ||
| 347 | } | ||
| 348 | |||
| 349 | return 0; | ||
| 350 | } | ||
| 351 | #else | ||
| 352 | static inline int acpi_processor_add_fs(struct acpi_device *device) | ||
| 353 | { | ||
| 354 | return 0; | ||
| 355 | } | ||
| 356 | static inline int acpi_processor_remove_fs(struct acpi_device *device) | ||
| 357 | { | ||
| 358 | return 0; | ||
| 359 | } | ||
| 360 | #endif | ||
| 361 | |||
| 362 | /* -------------------------------------------------------------------------- | ||
| 363 | Driver Interface | ||
| 364 | -------------------------------------------------------------------------- */ | ||
| 365 | |||
| 366 | static int acpi_processor_get_info(struct acpi_device *device) | ||
| 367 | { | ||
| 368 | acpi_status status = 0; | ||
| 369 | union acpi_object object = { 0 }; | ||
| 370 | struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; | ||
| 371 | struct acpi_processor *pr; | ||
| 372 | int cpu_index, device_declaration = 0; | ||
| 373 | static int cpu0_initialized; | ||
| 374 | |||
| 375 | pr = acpi_driver_data(device); | ||
| 376 | if (!pr) | ||
| 377 | return -EINVAL; | ||
| 378 | |||
| 379 | if (num_online_cpus() > 1) | ||
| 380 | errata.smp = TRUE; | ||
| 381 | |||
| 382 | acpi_processor_errata(pr); | ||
| 383 | |||
| 384 | /* | ||
| 385 | * Check to see if we have bus mastering arbitration control. This | ||
| 386 | * is required for proper C3 usage (to maintain cache coherency). | ||
| 387 | */ | ||
| 388 | if (acpi_gbl_FADT.pm2_control_block && acpi_gbl_FADT.pm2_control_length) { | ||
| 389 | pr->flags.bm_control = 1; | ||
| 390 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
| 391 | "Bus mastering arbitration control present\n")); | ||
| 392 | } else | ||
| 393 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
| 394 | "No bus mastering arbitration control\n")); | ||
| 395 | |||
| 396 | if (!strcmp(acpi_device_hid(device), ACPI_PROCESSOR_OBJECT_HID)) { | ||
| 397 | /* Declared with "Processor" statement; match ProcessorID */ | ||
| 398 | status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer); | ||
| 399 | if (ACPI_FAILURE(status)) { | ||
| 400 | printk(KERN_ERR PREFIX "Evaluating processor object\n"); | ||
| 401 | return -ENODEV; | ||
| 402 | } | ||
| 403 | |||
| 404 | /* | ||
| 405 | * TBD: Synch processor ID (via LAPIC/LSAPIC structures) on SMP. | ||
| 406 | * >>> 'acpi_get_processor_id(acpi_id, &id)' in | ||
| 407 | * arch/xxx/acpi.c | ||
| 408 | */ | ||
| 409 | pr->acpi_id = object.processor.proc_id; | ||
| 410 | } else { | ||
| 411 | /* | ||
| 412 | * Declared with "Device" statement; match _UID. | ||
| 413 | * Note that we don't handle string _UIDs yet. | ||
| 414 | */ | ||
| 415 | unsigned long long value; | ||
| 416 | status = acpi_evaluate_integer(pr->handle, METHOD_NAME__UID, | ||
| 417 | NULL, &value); | ||
| 418 | if (ACPI_FAILURE(status)) { | ||
| 419 | printk(KERN_ERR PREFIX | ||
| 420 | "Evaluating processor _UID [%#x]\n", status); | ||
| 421 | return -ENODEV; | ||
| 422 | } | ||
| 423 | device_declaration = 1; | ||
| 424 | pr->acpi_id = value; | ||
| 425 | } | ||
| 426 | cpu_index = acpi_get_cpuid(pr->handle, device_declaration, pr->acpi_id); | ||
| 427 | |||
| 428 | /* Handle UP system running SMP kernel, with no LAPIC in MADT */ | ||
| 429 | if (!cpu0_initialized && (cpu_index == -1) && | ||
| 430 | (num_online_cpus() == 1)) { | ||
| 431 | cpu_index = 0; | ||
| 432 | } | ||
| 433 | |||
| 434 | cpu0_initialized = 1; | ||
| 435 | |||
| 436 | pr->id = cpu_index; | ||
| 437 | |||
| 438 | /* | ||
| 439 | * Extra Processor objects may be enumerated on MP systems with | ||
| 440 | * less than the max # of CPUs. They should be ignored _iff | ||
| 441 | * they are physically not present. | ||
| 442 | */ | ||
| 443 | if (pr->id == -1) { | ||
| 444 | if (ACPI_FAILURE | ||
| 445 | (acpi_processor_hotadd_init(pr->handle, &pr->id))) { | ||
| 446 | return -ENODEV; | ||
| 447 | } | ||
| 448 | } | ||
| 449 | /* | ||
| 450 | * On some boxes several processors use the same processor bus id. | ||
| 451 | * But they are located in different scope. For example: | ||
| 452 | * \_SB.SCK0.CPU0 | ||
| 453 | * \_SB.SCK1.CPU0 | ||
| 454 | * Rename the processor device bus id. And the new bus id will be | ||
| 455 | * generated as the following format: | ||
| 456 | * CPU+CPU ID. | ||
| 457 | */ | ||
| 458 | sprintf(acpi_device_bid(device), "CPU%X", pr->id); | ||
| 459 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Processor [%d:%d]\n", pr->id, | ||
| 460 | pr->acpi_id)); | ||
| 461 | |||
| 462 | if (!object.processor.pblk_address) | ||
| 463 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No PBLK (NULL address)\n")); | ||
| 464 | else if (object.processor.pblk_length != 6) | ||
| 465 | printk(KERN_ERR PREFIX "Invalid PBLK length [%d]\n", | ||
| 466 | object.processor.pblk_length); | ||
| 467 | else { | ||
| 468 | pr->throttling.address = object.processor.pblk_address; | ||
| 469 | pr->throttling.duty_offset = acpi_gbl_FADT.duty_offset; | ||
| 470 | pr->throttling.duty_width = acpi_gbl_FADT.duty_width; | ||
| 471 | |||
| 472 | pr->pblk = object.processor.pblk_address; | ||
| 473 | |||
| 474 | /* | ||
| 475 | * We don't care about error returns - we just try to mark | ||
| 476 | * these reserved so that nobody else is confused into thinking | ||
| 477 | * that this region might be unused.. | ||
| 478 | * | ||
| 479 | * (In particular, allocating the IO range for Cardbus) | ||
| 480 | */ | ||
| 481 | request_region(pr->throttling.address, 6, "ACPI CPU throttle"); | ||
| 482 | } | ||
| 483 | |||
| 484 | /* | ||
| 485 | * If ACPI describes a slot number for this CPU, we can use it | ||
| 486 | * ensure we get the right value in the "physical id" field | ||
| 487 | * of /proc/cpuinfo | ||
| 488 | */ | ||
| 489 | status = acpi_evaluate_object(pr->handle, "_SUN", NULL, &buffer); | ||
| 490 | if (ACPI_SUCCESS(status)) | ||
| 491 | arch_fix_phys_package_id(pr->id, object.integer.value); | ||
| 492 | |||
| 493 | return 0; | ||
| 494 | } | ||
| 495 | |||
| 496 | static DEFINE_PER_CPU(void *, processor_device_array); | ||
| 497 | |||
| 498 | static void acpi_processor_notify(struct acpi_device *device, u32 event) | ||
| 499 | { | ||
| 500 | struct acpi_processor *pr = acpi_driver_data(device); | ||
| 501 | int saved; | ||
| 502 | |||
| 503 | if (!pr) | ||
| 504 | return; | ||
| 505 | |||
| 506 | switch (event) { | ||
| 507 | case ACPI_PROCESSOR_NOTIFY_PERFORMANCE: | ||
| 508 | saved = pr->performance_platform_limit; | ||
| 509 | acpi_processor_ppc_has_changed(pr, 1); | ||
| 510 | if (saved == pr->performance_platform_limit) | ||
| 511 | break; | ||
| 512 | acpi_bus_generate_proc_event(device, event, | ||
| 513 | pr->performance_platform_limit); | ||
| 514 | acpi_bus_generate_netlink_event(device->pnp.device_class, | ||
| 515 | dev_name(&device->dev), event, | ||
| 516 | pr->performance_platform_limit); | ||
| 517 | break; | ||
| 518 | case ACPI_PROCESSOR_NOTIFY_POWER: | ||
| 519 | acpi_processor_cst_has_changed(pr); | ||
| 520 | acpi_bus_generate_proc_event(device, event, 0); | ||
| 521 | acpi_bus_generate_netlink_event(device->pnp.device_class, | ||
| 522 | dev_name(&device->dev), event, 0); | ||
| 523 | break; | ||
| 524 | case ACPI_PROCESSOR_NOTIFY_THROTTLING: | ||
| 525 | acpi_processor_tstate_has_changed(pr); | ||
| 526 | acpi_bus_generate_proc_event(device, event, 0); | ||
| 527 | acpi_bus_generate_netlink_event(device->pnp.device_class, | ||
| 528 | dev_name(&device->dev), event, 0); | ||
| 529 | default: | ||
| 530 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
| 531 | "Unsupported event [0x%x]\n", event)); | ||
| 532 | break; | ||
| 533 | } | ||
| 534 | |||
| 535 | return; | ||
| 536 | } | ||
| 537 | |||
| 538 | static int acpi_cpu_soft_notify(struct notifier_block *nfb, | ||
| 539 | unsigned long action, void *hcpu) | ||
| 540 | { | ||
| 541 | unsigned int cpu = (unsigned long)hcpu; | ||
| 542 | struct acpi_processor *pr = per_cpu(processors, cpu); | ||
| 543 | |||
| 544 | if (action == CPU_ONLINE && pr) { | ||
| 545 | acpi_processor_ppc_has_changed(pr, 0); | ||
| 546 | acpi_processor_cst_has_changed(pr); | ||
| 547 | acpi_processor_tstate_has_changed(pr); | ||
| 548 | } | ||
| 549 | return NOTIFY_OK; | ||
| 550 | } | ||
| 551 | |||
| 552 | static struct notifier_block acpi_cpu_notifier = | ||
| 553 | { | ||
| 554 | .notifier_call = acpi_cpu_soft_notify, | ||
| 555 | }; | ||
| 556 | |||
| 557 | static int __cpuinit acpi_processor_add(struct acpi_device *device) | ||
| 558 | { | ||
| 559 | struct acpi_processor *pr = NULL; | ||
| 560 | int result = 0; | ||
| 561 | struct sys_device *sysdev; | ||
| 562 | |||
| 563 | pr = kzalloc(sizeof(struct acpi_processor), GFP_KERNEL); | ||
| 564 | if (!pr) | ||
| 565 | return -ENOMEM; | ||
| 566 | |||
| 567 | if (!zalloc_cpumask_var(&pr->throttling.shared_cpu_map, GFP_KERNEL)) { | ||
| 568 | kfree(pr); | ||
| 569 | return -ENOMEM; | ||
| 570 | } | ||
| 571 | |||
| 572 | pr->handle = device->handle; | ||
| 573 | strcpy(acpi_device_name(device), ACPI_PROCESSOR_DEVICE_NAME); | ||
| 574 | strcpy(acpi_device_class(device), ACPI_PROCESSOR_CLASS); | ||
| 575 | device->driver_data = pr; | ||
| 576 | |||
| 577 | result = acpi_processor_get_info(device); | ||
| 578 | if (result) { | ||
| 579 | /* Processor is physically not present */ | ||
| 580 | return 0; | ||
| 581 | } | ||
| 582 | |||
| 583 | BUG_ON((pr->id >= nr_cpu_ids) || (pr->id < 0)); | ||
| 584 | |||
| 585 | /* | ||
| 586 | * Buggy BIOS check | ||
| 587 | * ACPI id of processors can be reported wrongly by the BIOS. | ||
| 588 | * Don't trust it blindly | ||
| 589 | */ | ||
| 590 | if (per_cpu(processor_device_array, pr->id) != NULL && | ||
| 591 | per_cpu(processor_device_array, pr->id) != device) { | ||
| 592 | printk(KERN_WARNING "BIOS reported wrong ACPI id " | ||
| 593 | "for the processor\n"); | ||
| 594 | result = -ENODEV; | ||
| 595 | goto err_free_cpumask; | ||
| 596 | } | ||
| 597 | per_cpu(processor_device_array, pr->id) = device; | ||
| 598 | |||
| 599 | per_cpu(processors, pr->id) = pr; | ||
| 600 | |||
| 601 | result = acpi_processor_add_fs(device); | ||
| 602 | if (result) | ||
| 603 | goto err_free_cpumask; | ||
| 604 | |||
| 605 | sysdev = get_cpu_sysdev(pr->id); | ||
| 606 | if (sysfs_create_link(&device->dev.kobj, &sysdev->kobj, "sysdev")) { | ||
| 607 | result = -EFAULT; | ||
| 608 | goto err_remove_fs; | ||
| 609 | } | ||
| 610 | |||
| 611 | #ifdef CONFIG_CPU_FREQ | ||
| 612 | acpi_processor_ppc_has_changed(pr, 0); | ||
| 613 | #endif | ||
| 614 | acpi_processor_get_throttling_info(pr); | ||
| 615 | acpi_processor_get_limit_info(pr); | ||
| 616 | |||
| 617 | |||
| 618 | acpi_processor_power_init(pr, device); | ||
| 619 | |||
| 620 | pr->cdev = thermal_cooling_device_register("Processor", device, | ||
| 621 | &processor_cooling_ops); | ||
| 622 | if (IS_ERR(pr->cdev)) { | ||
| 623 | result = PTR_ERR(pr->cdev); | ||
| 624 | goto err_power_exit; | ||
| 625 | } | ||
| 626 | |||
| 627 | dev_dbg(&device->dev, "registered as cooling_device%d\n", | ||
| 628 | pr->cdev->id); | ||
| 629 | |||
| 630 | result = sysfs_create_link(&device->dev.kobj, | ||
| 631 | &pr->cdev->device.kobj, | ||
| 632 | "thermal_cooling"); | ||
| 633 | if (result) { | ||
| 634 | printk(KERN_ERR PREFIX "Create sysfs link\n"); | ||
| 635 | goto err_thermal_unregister; | ||
| 636 | } | ||
| 637 | result = sysfs_create_link(&pr->cdev->device.kobj, | ||
| 638 | &device->dev.kobj, | ||
| 639 | "device"); | ||
| 640 | if (result) { | ||
| 641 | printk(KERN_ERR PREFIX "Create sysfs link\n"); | ||
| 642 | goto err_remove_sysfs; | ||
| 643 | } | ||
| 644 | |||
| 645 | return 0; | ||
| 646 | |||
| 647 | err_remove_sysfs: | ||
| 648 | sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); | ||
| 649 | err_thermal_unregister: | ||
| 650 | thermal_cooling_device_unregister(pr->cdev); | ||
| 651 | err_power_exit: | ||
| 652 | acpi_processor_power_exit(pr, device); | ||
| 653 | err_remove_fs: | ||
| 654 | acpi_processor_remove_fs(device); | ||
| 655 | err_free_cpumask: | ||
| 656 | free_cpumask_var(pr->throttling.shared_cpu_map); | ||
| 657 | |||
| 658 | return result; | ||
| 659 | } | ||
| 660 | |||
| 661 | static int acpi_processor_remove(struct acpi_device *device, int type) | ||
| 662 | { | ||
| 663 | struct acpi_processor *pr = NULL; | ||
| 664 | |||
| 665 | |||
| 666 | if (!device || !acpi_driver_data(device)) | ||
| 667 | return -EINVAL; | ||
| 668 | |||
| 669 | pr = acpi_driver_data(device); | ||
| 670 | |||
| 671 | if (pr->id >= nr_cpu_ids) | ||
| 672 | goto free; | ||
| 673 | |||
| 674 | if (type == ACPI_BUS_REMOVAL_EJECT) { | ||
| 675 | if (acpi_processor_handle_eject(pr)) | ||
| 676 | return -EINVAL; | ||
| 677 | } | ||
| 678 | |||
| 679 | acpi_processor_power_exit(pr, device); | ||
| 680 | |||
| 681 | sysfs_remove_link(&device->dev.kobj, "sysdev"); | ||
| 682 | |||
| 683 | acpi_processor_remove_fs(device); | ||
| 684 | |||
| 685 | if (pr->cdev) { | ||
| 686 | sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); | ||
| 687 | sysfs_remove_link(&pr->cdev->device.kobj, "device"); | ||
| 688 | thermal_cooling_device_unregister(pr->cdev); | ||
| 689 | pr->cdev = NULL; | ||
| 690 | } | ||
| 691 | |||
| 692 | per_cpu(processors, pr->id) = NULL; | ||
| 693 | per_cpu(processor_device_array, pr->id) = NULL; | ||
| 694 | |||
| 695 | free: | ||
| 696 | free_cpumask_var(pr->throttling.shared_cpu_map); | ||
| 697 | kfree(pr); | ||
| 698 | |||
| 699 | return 0; | ||
| 700 | } | ||
| 701 | |||
| 702 | #ifdef CONFIG_ACPI_HOTPLUG_CPU | ||
| 703 | /**************************************************************************** | ||
| 704 | * Acpi processor hotplug support * | ||
| 705 | ****************************************************************************/ | ||
| 706 | |||
| 707 | static int is_processor_present(acpi_handle handle) | ||
| 708 | { | ||
| 709 | acpi_status status; | ||
| 710 | unsigned long long sta = 0; | ||
| 711 | |||
| 712 | |||
| 713 | status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); | ||
| 714 | |||
| 715 | if (ACPI_SUCCESS(status) && (sta & ACPI_STA_DEVICE_PRESENT)) | ||
| 716 | return 1; | ||
| 717 | |||
| 718 | /* | ||
| 719 | * _STA is mandatory for a processor that supports hot plug | ||
| 720 | */ | ||
| 721 | if (status == AE_NOT_FOUND) | ||
| 722 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
| 723 | "Processor does not support hot plug\n")); | ||
| 724 | else | ||
| 725 | ACPI_EXCEPTION((AE_INFO, status, | ||
| 726 | "Processor Device is not present")); | ||
| 727 | return 0; | ||
| 728 | } | ||
| 729 | |||
| 730 | static | ||
| 731 | int acpi_processor_device_add(acpi_handle handle, struct acpi_device **device) | ||
| 732 | { | ||
| 733 | acpi_handle phandle; | ||
| 734 | struct acpi_device *pdev; | ||
| 735 | |||
| 736 | |||
| 737 | if (acpi_get_parent(handle, &phandle)) { | ||
| 738 | return -ENODEV; | ||
| 739 | } | ||
| 740 | |||
| 741 | if (acpi_bus_get_device(phandle, &pdev)) { | ||
| 742 | return -ENODEV; | ||
| 743 | } | ||
| 744 | |||
| 745 | if (acpi_bus_add(device, pdev, handle, ACPI_BUS_TYPE_PROCESSOR)) { | ||
| 746 | return -ENODEV; | ||
| 747 | } | ||
| 748 | |||
| 749 | return 0; | ||
| 750 | } | ||
| 751 | |||
| 752 | static void __ref acpi_processor_hotplug_notify(acpi_handle handle, | ||
| 753 | u32 event, void *data) | ||
| 754 | { | ||
| 755 | struct acpi_processor *pr; | ||
| 756 | struct acpi_device *device = NULL; | ||
| 757 | int result; | ||
| 758 | |||
| 759 | |||
| 760 | switch (event) { | ||
| 761 | case ACPI_NOTIFY_BUS_CHECK: | ||
| 762 | case ACPI_NOTIFY_DEVICE_CHECK: | ||
| 763 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
| 764 | "Processor driver received %s event\n", | ||
| 765 | (event == ACPI_NOTIFY_BUS_CHECK) ? | ||
| 766 | "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK")); | ||
| 767 | |||
| 768 | if (!is_processor_present(handle)) | ||
| 769 | break; | ||
| 770 | |||
| 771 | if (acpi_bus_get_device(handle, &device)) { | ||
| 772 | result = acpi_processor_device_add(handle, &device); | ||
| 773 | if (result) | ||
| 774 | printk(KERN_ERR PREFIX | ||
| 775 | "Unable to add the device\n"); | ||
| 776 | break; | ||
| 777 | } | ||
| 778 | break; | ||
| 779 | case ACPI_NOTIFY_EJECT_REQUEST: | ||
| 780 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
| 781 | "received ACPI_NOTIFY_EJECT_REQUEST\n")); | ||
| 782 | |||
| 783 | if (acpi_bus_get_device(handle, &device)) { | ||
| 784 | printk(KERN_ERR PREFIX | ||
| 785 | "Device don't exist, dropping EJECT\n"); | ||
| 786 | break; | ||
| 787 | } | ||
| 788 | pr = acpi_driver_data(device); | ||
| 789 | if (!pr) { | ||
| 790 | printk(KERN_ERR PREFIX | ||
| 791 | "Driver data is NULL, dropping EJECT\n"); | ||
| 792 | return; | ||
| 793 | } | ||
| 794 | break; | ||
| 795 | default: | ||
| 796 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
| 797 | "Unsupported event [0x%x]\n", event)); | ||
| 798 | break; | ||
| 799 | } | ||
| 800 | |||
| 801 | return; | ||
| 802 | } | ||
| 803 | |||
| 804 | static acpi_status | ||
| 805 | processor_walk_namespace_cb(acpi_handle handle, | ||
| 806 | u32 lvl, void *context, void **rv) | ||
| 807 | { | ||
| 808 | acpi_status status; | ||
| 809 | int *action = context; | ||
| 810 | acpi_object_type type = 0; | ||
| 811 | |||
| 812 | status = acpi_get_type(handle, &type); | ||
| 813 | if (ACPI_FAILURE(status)) | ||
| 814 | return (AE_OK); | ||
| 815 | |||
| 816 | if (type != ACPI_TYPE_PROCESSOR) | ||
| 817 | return (AE_OK); | ||
| 818 | |||
| 819 | switch (*action) { | ||
| 820 | case INSTALL_NOTIFY_HANDLER: | ||
| 821 | acpi_install_notify_handler(handle, | ||
| 822 | ACPI_SYSTEM_NOTIFY, | ||
| 823 | acpi_processor_hotplug_notify, | ||
| 824 | NULL); | ||
| 825 | break; | ||
| 826 | case UNINSTALL_NOTIFY_HANDLER: | ||
| 827 | acpi_remove_notify_handler(handle, | ||
| 828 | ACPI_SYSTEM_NOTIFY, | ||
| 829 | acpi_processor_hotplug_notify); | ||
| 830 | break; | ||
| 831 | default: | ||
| 832 | break; | ||
| 833 | } | ||
| 834 | |||
| 835 | return (AE_OK); | ||
| 836 | } | ||
| 837 | |||
| 838 | static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu) | ||
| 839 | { | ||
| 840 | |||
| 841 | if (!is_processor_present(handle)) { | ||
| 842 | return AE_ERROR; | ||
| 843 | } | ||
| 844 | |||
| 845 | if (acpi_map_lsapic(handle, p_cpu)) | ||
| 846 | return AE_ERROR; | ||
| 847 | |||
| 848 | if (arch_register_cpu(*p_cpu)) { | ||
| 849 | acpi_unmap_lsapic(*p_cpu); | ||
| 850 | return AE_ERROR; | ||
| 851 | } | ||
| 852 | |||
| 853 | return AE_OK; | ||
| 854 | } | ||
| 855 | |||
| 856 | static int acpi_processor_handle_eject(struct acpi_processor *pr) | ||
| 857 | { | ||
| 858 | if (cpu_online(pr->id)) | ||
| 859 | cpu_down(pr->id); | ||
| 860 | |||
| 861 | arch_unregister_cpu(pr->id); | ||
| 862 | acpi_unmap_lsapic(pr->id); | ||
| 863 | return (0); | ||
| 864 | } | ||
| 865 | #else | ||
| 866 | static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu) | ||
| 867 | { | ||
| 868 | return AE_ERROR; | ||
| 869 | } | ||
| 870 | static int acpi_processor_handle_eject(struct acpi_processor *pr) | ||
| 871 | { | ||
| 872 | return (-EINVAL); | ||
| 873 | } | ||
| 874 | #endif | ||
| 875 | |||
| 876 | static | ||
| 877 | void acpi_processor_install_hotplug_notify(void) | ||
| 878 | { | ||
| 879 | #ifdef CONFIG_ACPI_HOTPLUG_CPU | ||
| 880 | int action = INSTALL_NOTIFY_HANDLER; | ||
| 881 | acpi_walk_namespace(ACPI_TYPE_PROCESSOR, | ||
| 882 | ACPI_ROOT_OBJECT, | ||
| 883 | ACPI_UINT32_MAX, | ||
| 884 | processor_walk_namespace_cb, NULL, &action, NULL); | ||
| 885 | #endif | ||
| 886 | register_hotcpu_notifier(&acpi_cpu_notifier); | ||
| 887 | } | ||
| 888 | |||
| 889 | static | ||
| 890 | void acpi_processor_uninstall_hotplug_notify(void) | ||
| 891 | { | ||
| 892 | #ifdef CONFIG_ACPI_HOTPLUG_CPU | ||
| 893 | int action = UNINSTALL_NOTIFY_HANDLER; | ||
| 894 | acpi_walk_namespace(ACPI_TYPE_PROCESSOR, | ||
| 895 | ACPI_ROOT_OBJECT, | ||
| 896 | ACPI_UINT32_MAX, | ||
| 897 | processor_walk_namespace_cb, NULL, &action, NULL); | ||
| 898 | #endif | ||
| 899 | unregister_hotcpu_notifier(&acpi_cpu_notifier); | ||
| 900 | } | ||
| 901 | |||
| 902 | /* | ||
| 903 | * We keep the driver loaded even when ACPI is not running. | ||
| 904 | * This is needed for the powernow-k8 driver, that works even without | ||
| 905 | * ACPI, but needs symbols from this driver | ||
| 906 | */ | ||
| 907 | |||
| 908 | static int __init acpi_processor_init(void) | ||
| 909 | { | ||
| 910 | int result = 0; | ||
| 911 | |||
| 912 | if (acpi_disabled) | ||
| 913 | return 0; | ||
| 914 | |||
| 915 | memset(&errata, 0, sizeof(errata)); | ||
| 916 | |||
| 917 | #ifdef CONFIG_ACPI_PROCFS | ||
| 918 | acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir); | ||
| 919 | if (!acpi_processor_dir) | ||
| 920 | return -ENOMEM; | ||
| 921 | #endif | ||
| 922 | result = cpuidle_register_driver(&acpi_idle_driver); | ||
| 923 | if (result < 0) | ||
| 924 | goto out_proc; | ||
| 925 | |||
| 926 | result = acpi_bus_register_driver(&acpi_processor_driver); | ||
| 927 | if (result < 0) | ||
| 928 | goto out_cpuidle; | ||
| 929 | |||
| 930 | acpi_processor_install_hotplug_notify(); | ||
| 931 | |||
| 932 | acpi_thermal_cpufreq_init(); | ||
| 933 | |||
| 934 | acpi_processor_ppc_init(); | ||
| 935 | |||
| 936 | acpi_processor_throttling_init(); | ||
| 937 | |||
| 938 | return 0; | ||
| 939 | |||
| 940 | out_cpuidle: | ||
| 941 | cpuidle_unregister_driver(&acpi_idle_driver); | ||
| 942 | |||
| 943 | out_proc: | ||
| 944 | #ifdef CONFIG_ACPI_PROCFS | ||
| 945 | remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); | ||
| 946 | #endif | ||
| 947 | |||
| 948 | return result; | ||
| 949 | } | ||
| 950 | |||
| 951 | static void __exit acpi_processor_exit(void) | ||
| 952 | { | ||
| 953 | if (acpi_disabled) | ||
| 954 | return; | ||
| 955 | |||
| 956 | acpi_processor_ppc_exit(); | ||
| 957 | |||
| 958 | acpi_thermal_cpufreq_exit(); | ||
| 959 | |||
| 960 | acpi_processor_uninstall_hotplug_notify(); | ||
| 961 | |||
| 962 | acpi_bus_unregister_driver(&acpi_processor_driver); | ||
| 963 | |||
| 964 | cpuidle_unregister_driver(&acpi_idle_driver); | ||
| 965 | |||
| 966 | #ifdef CONFIG_ACPI_PROCFS | ||
| 967 | remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); | ||
| 968 | #endif | ||
| 969 | |||
| 970 | return; | ||
| 971 | } | ||
| 972 | |||
| 973 | module_init(acpi_processor_init); | ||
| 974 | module_exit(acpi_processor_exit); | ||
| 975 | |||
| 976 | EXPORT_SYMBOL(acpi_processor_set_thermal_limit); | ||
| 977 | |||
| 978 | MODULE_ALIAS("processor"); | ||
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index d1676b1754d9..37dfce749398 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
| @@ -110,6 +110,14 @@ static struct dmi_system_id __cpuinitdata processor_power_dmi_table[] = { | |||
| 110 | DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"), | 110 | DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"), |
| 111 | DMI_MATCH(DMI_BIOS_VERSION,"SHE845M0.86C.0013.D.0302131307")}, | 111 | DMI_MATCH(DMI_BIOS_VERSION,"SHE845M0.86C.0013.D.0302131307")}, |
| 112 | (void *)2}, | 112 | (void *)2}, |
| 113 | { set_max_cstate, "Pavilion zv5000", { | ||
| 114 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
| 115 | DMI_MATCH(DMI_PRODUCT_NAME,"Pavilion zv5000 (DS502A#ABA)")}, | ||
| 116 | (void *)1}, | ||
| 117 | { set_max_cstate, "Asus L8400B", { | ||
| 118 | DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."), | ||
| 119 | DMI_MATCH(DMI_PRODUCT_NAME,"L8400B series Notebook PC")}, | ||
| 120 | (void *)1}, | ||
| 113 | {}, | 121 | {}, |
| 114 | }; | 122 | }; |
| 115 | 123 | ||
| @@ -305,6 +313,28 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) | |||
| 305 | pr->power.states[ACPI_STATE_C2].latency = acpi_gbl_FADT.C2latency; | 313 | pr->power.states[ACPI_STATE_C2].latency = acpi_gbl_FADT.C2latency; |
| 306 | pr->power.states[ACPI_STATE_C3].latency = acpi_gbl_FADT.C3latency; | 314 | pr->power.states[ACPI_STATE_C3].latency = acpi_gbl_FADT.C3latency; |
| 307 | 315 | ||
| 316 | /* | ||
| 317 | * FADT specified C2 latency must be less than or equal to | ||
| 318 | * 100 microseconds. | ||
| 319 | */ | ||
| 320 | if (acpi_gbl_FADT.C2latency > ACPI_PROCESSOR_MAX_C2_LATENCY) { | ||
| 321 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
| 322 | "C2 latency too large [%d]\n", acpi_gbl_FADT.C2latency)); | ||
| 323 | /* invalidate C2 */ | ||
| 324 | pr->power.states[ACPI_STATE_C2].address = 0; | ||
| 325 | } | ||
| 326 | |||
| 327 | /* | ||
| 328 | * FADT supplied C3 latency must be less than or equal to | ||
| 329 | * 1000 microseconds. | ||
| 330 | */ | ||
| 331 | if (acpi_gbl_FADT.C3latency > ACPI_PROCESSOR_MAX_C3_LATENCY) { | ||
| 332 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
| 333 | "C3 latency too large [%d]\n", acpi_gbl_FADT.C3latency)); | ||
| 334 | /* invalidate C3 */ | ||
| 335 | pr->power.states[ACPI_STATE_C3].address = 0; | ||
| 336 | } | ||
| 337 | |||
| 308 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 338 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 309 | "lvl2[0x%08x] lvl3[0x%08x]\n", | 339 | "lvl2[0x%08x] lvl3[0x%08x]\n", |
| 310 | pr->power.states[ACPI_STATE_C2].address, | 340 | pr->power.states[ACPI_STATE_C2].address, |
| @@ -330,7 +360,7 @@ static int acpi_processor_get_power_info_default(struct acpi_processor *pr) | |||
| 330 | static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) | 360 | static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) |
| 331 | { | 361 | { |
| 332 | acpi_status status = 0; | 362 | acpi_status status = 0; |
| 333 | acpi_integer count; | 363 | u64 count; |
| 334 | int current_count; | 364 | int current_count; |
| 335 | int i; | 365 | int i; |
| 336 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 366 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
| @@ -494,33 +524,6 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) | |||
| 494 | return status; | 524 | return status; |
| 495 | } | 525 | } |
| 496 | 526 | ||
| 497 | static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx) | ||
| 498 | { | ||
| 499 | |||
| 500 | if (!cx->address) | ||
| 501 | return; | ||
| 502 | |||
| 503 | /* | ||
| 504 | * C2 latency must be less than or equal to 100 | ||
| 505 | * microseconds. | ||
| 506 | */ | ||
| 507 | else if (cx->latency > ACPI_PROCESSOR_MAX_C2_LATENCY) { | ||
| 508 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
| 509 | "latency too large [%d]\n", cx->latency)); | ||
| 510 | return; | ||
| 511 | } | ||
| 512 | |||
| 513 | /* | ||
| 514 | * Otherwise we've met all of our C2 requirements. | ||
| 515 | * Normalize the C2 latency to expidite policy | ||
| 516 | */ | ||
| 517 | cx->valid = 1; | ||
| 518 | |||
| 519 | cx->latency_ticks = cx->latency; | ||
| 520 | |||
| 521 | return; | ||
| 522 | } | ||
| 523 | |||
| 524 | static void acpi_processor_power_verify_c3(struct acpi_processor *pr, | 527 | static void acpi_processor_power_verify_c3(struct acpi_processor *pr, |
| 525 | struct acpi_processor_cx *cx) | 528 | struct acpi_processor_cx *cx) |
| 526 | { | 529 | { |
| @@ -532,16 +535,6 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr, | |||
| 532 | return; | 535 | return; |
| 533 | 536 | ||
| 534 | /* | 537 | /* |
| 535 | * C3 latency must be less than or equal to 1000 | ||
| 536 | * microseconds. | ||
| 537 | */ | ||
| 538 | else if (cx->latency > ACPI_PROCESSOR_MAX_C3_LATENCY) { | ||
| 539 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
| 540 | "latency too large [%d]\n", cx->latency)); | ||
| 541 | return; | ||
| 542 | } | ||
| 543 | |||
| 544 | /* | ||
| 545 | * PIIX4 Erratum #18: We don't support C3 when Type-F (fast) | 538 | * PIIX4 Erratum #18: We don't support C3 when Type-F (fast) |
| 546 | * DMA transfers are used by any ISA device to avoid livelock. | 539 | * DMA transfers are used by any ISA device to avoid livelock. |
| 547 | * Note that we could disable Type-F DMA (as recommended by | 540 | * Note that we could disable Type-F DMA (as recommended by |
| @@ -629,7 +622,10 @@ static int acpi_processor_power_verify(struct acpi_processor *pr) | |||
| 629 | break; | 622 | break; |
| 630 | 623 | ||
| 631 | case ACPI_STATE_C2: | 624 | case ACPI_STATE_C2: |
| 632 | acpi_processor_power_verify_c2(cx); | 625 | if (!cx->address) |
| 626 | break; | ||
| 627 | cx->valid = 1; | ||
| 628 | cx->latency_ticks = cx->latency; /* Normalize latency */ | ||
| 633 | break; | 629 | break; |
| 634 | 630 | ||
| 635 | case ACPI_STATE_C3: | 631 | case ACPI_STATE_C3: |
| @@ -884,12 +880,14 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, | |||
| 884 | return(acpi_idle_enter_c1(dev, state)); | 880 | return(acpi_idle_enter_c1(dev, state)); |
| 885 | 881 | ||
| 886 | local_irq_disable(); | 882 | local_irq_disable(); |
| 887 | current_thread_info()->status &= ~TS_POLLING; | 883 | if (cx->entry_method != ACPI_CSTATE_FFH) { |
| 888 | /* | 884 | current_thread_info()->status &= ~TS_POLLING; |
| 889 | * TS_POLLING-cleared state must be visible before we test | 885 | /* |
| 890 | * NEED_RESCHED: | 886 | * TS_POLLING-cleared state must be visible before we test |
| 891 | */ | 887 | * NEED_RESCHED: |
| 892 | smp_mb(); | 888 | */ |
| 889 | smp_mb(); | ||
| 890 | } | ||
| 893 | 891 | ||
| 894 | if (unlikely(need_resched())) { | 892 | if (unlikely(need_resched())) { |
| 895 | current_thread_info()->status |= TS_POLLING; | 893 | current_thread_info()->status |= TS_POLLING; |
| @@ -969,12 +967,14 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
| 969 | } | 967 | } |
| 970 | 968 | ||
| 971 | local_irq_disable(); | 969 | local_irq_disable(); |
| 972 | current_thread_info()->status &= ~TS_POLLING; | 970 | if (cx->entry_method != ACPI_CSTATE_FFH) { |
| 973 | /* | 971 | current_thread_info()->status &= ~TS_POLLING; |
| 974 | * TS_POLLING-cleared state must be visible before we test | 972 | /* |
| 975 | * NEED_RESCHED: | 973 | * TS_POLLING-cleared state must be visible before we test |
| 976 | */ | 974 | * NEED_RESCHED: |
| 977 | smp_mb(); | 975 | */ |
| 976 | smp_mb(); | ||
| 977 | } | ||
| 978 | 978 | ||
| 979 | if (unlikely(need_resched())) { | 979 | if (unlikely(need_resched())) { |
| 980 | current_thread_info()->status |= TS_POLLING; | 980 | current_thread_info()->status |= TS_POLLING; |
diff --git a/drivers/acpi/processor_pdc.c b/drivers/acpi/processor_pdc.c deleted file mode 100644 index 30e4dc0cdf30..000000000000 --- a/drivers/acpi/processor_pdc.c +++ /dev/null | |||
| @@ -1,165 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2005 Intel Corporation | ||
| 3 | * Copyright (C) 2009 Hewlett-Packard Development Company, L.P. | ||
| 4 | * | ||
| 5 | * Alex Chiang <achiang@hp.com> | ||
| 6 | * - Unified x86/ia64 implementations | ||
| 7 | * Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> | ||
| 8 | * - Added _PDC for platforms with Intel CPUs | ||
| 9 | */ | ||
| 10 | #include <linux/dmi.h> | ||
| 11 | |||
| 12 | #include <acpi/acpi_drivers.h> | ||
| 13 | #include <acpi/processor.h> | ||
| 14 | |||
| 15 | #include "internal.h" | ||
| 16 | |||
| 17 | #define PREFIX "ACPI: " | ||
| 18 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT | ||
| 19 | ACPI_MODULE_NAME("processor_pdc"); | ||
| 20 | |||
| 21 | static int set_no_mwait(const struct dmi_system_id *id) | ||
| 22 | { | ||
| 23 | printk(KERN_NOTICE PREFIX "%s detected - " | ||
| 24 | "disabling mwait for CPU C-states\n", id->ident); | ||
| 25 | idle_nomwait = 1; | ||
| 26 | return 0; | ||
| 27 | } | ||
| 28 | |||
| 29 | static struct dmi_system_id __cpuinitdata processor_idle_dmi_table[] = { | ||
| 30 | { | ||
| 31 | set_no_mwait, "IFL91 board", { | ||
| 32 | DMI_MATCH(DMI_BIOS_VENDOR, "COMPAL"), | ||
| 33 | DMI_MATCH(DMI_SYS_VENDOR, "ZEPTO"), | ||
| 34 | DMI_MATCH(DMI_PRODUCT_VERSION, "3215W"), | ||
| 35 | DMI_MATCH(DMI_BOARD_NAME, "IFL91") }, NULL}, | ||
| 36 | { | ||
| 37 | set_no_mwait, "Extensa 5220", { | ||
| 38 | DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"), | ||
| 39 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | ||
| 40 | DMI_MATCH(DMI_PRODUCT_VERSION, "0100"), | ||
| 41 | DMI_MATCH(DMI_BOARD_NAME, "Columbia") }, NULL}, | ||
| 42 | {}, | ||
| 43 | }; | ||
| 44 | |||
| 45 | static void acpi_set_pdc_bits(u32 *buf) | ||
| 46 | { | ||
| 47 | buf[0] = ACPI_PDC_REVISION_ID; | ||
| 48 | buf[1] = 1; | ||
| 49 | |||
| 50 | /* Enable coordination with firmware's _TSD info */ | ||
| 51 | buf[2] = ACPI_PDC_SMP_T_SWCOORD; | ||
| 52 | |||
| 53 | /* Twiddle arch-specific bits needed for _PDC */ | ||
| 54 | arch_acpi_set_pdc_bits(buf); | ||
| 55 | } | ||
| 56 | |||
| 57 | static struct acpi_object_list *acpi_processor_alloc_pdc(void) | ||
| 58 | { | ||
| 59 | struct acpi_object_list *obj_list; | ||
| 60 | union acpi_object *obj; | ||
| 61 | u32 *buf; | ||
| 62 | |||
| 63 | /* allocate and initialize pdc. It will be used later. */ | ||
| 64 | obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL); | ||
| 65 | if (!obj_list) { | ||
| 66 | printk(KERN_ERR "Memory allocation error\n"); | ||
| 67 | return NULL; | ||
| 68 | } | ||
| 69 | |||
| 70 | obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL); | ||
| 71 | if (!obj) { | ||
| 72 | printk(KERN_ERR "Memory allocation error\n"); | ||
| 73 | kfree(obj_list); | ||
| 74 | return NULL; | ||
| 75 | } | ||
| 76 | |||
| 77 | buf = kmalloc(12, GFP_KERNEL); | ||
| 78 | if (!buf) { | ||
| 79 | printk(KERN_ERR "Memory allocation error\n"); | ||
| 80 | kfree(obj); | ||
| 81 | kfree(obj_list); | ||
| 82 | return NULL; | ||
| 83 | } | ||
| 84 | |||
| 85 | acpi_set_pdc_bits(buf); | ||
| 86 | |||
| 87 | obj->type = ACPI_TYPE_BUFFER; | ||
| 88 | obj->buffer.length = 12; | ||
| 89 | obj->buffer.pointer = (u8 *) buf; | ||
| 90 | obj_list->count = 1; | ||
| 91 | obj_list->pointer = obj; | ||
| 92 | |||
| 93 | return obj_list; | ||
| 94 | } | ||
| 95 | |||
| 96 | /* | ||
| 97 | * _PDC is required for a BIOS-OS handshake for most of the newer | ||
| 98 | * ACPI processor features. | ||
| 99 | */ | ||
| 100 | static int | ||
| 101 | acpi_processor_eval_pdc(acpi_handle handle, struct acpi_object_list *pdc_in) | ||
| 102 | { | ||
| 103 | acpi_status status = AE_OK; | ||
| 104 | |||
| 105 | if (idle_nomwait) { | ||
| 106 | /* | ||
| 107 | * If mwait is disabled for CPU C-states, the C2C3_FFH access | ||
| 108 | * mode will be disabled in the parameter of _PDC object. | ||
| 109 | * Of course C1_FFH access mode will also be disabled. | ||
| 110 | */ | ||
| 111 | union acpi_object *obj; | ||
| 112 | u32 *buffer = NULL; | ||
| 113 | |||
| 114 | obj = pdc_in->pointer; | ||
| 115 | buffer = (u32 *)(obj->buffer.pointer); | ||
| 116 | buffer[2] &= ~(ACPI_PDC_C_C2C3_FFH | ACPI_PDC_C_C1_FFH); | ||
| 117 | |||
| 118 | } | ||
| 119 | status = acpi_evaluate_object(handle, "_PDC", pdc_in, NULL); | ||
| 120 | |||
| 121 | if (ACPI_FAILURE(status)) | ||
| 122 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
| 123 | "Could not evaluate _PDC, using legacy perf. control.\n")); | ||
| 124 | |||
| 125 | return status; | ||
| 126 | } | ||
| 127 | |||
| 128 | void acpi_processor_set_pdc(acpi_handle handle) | ||
| 129 | { | ||
| 130 | struct acpi_object_list *obj_list; | ||
| 131 | |||
| 132 | if (arch_has_acpi_pdc() == false) | ||
| 133 | return; | ||
| 134 | |||
| 135 | obj_list = acpi_processor_alloc_pdc(); | ||
| 136 | if (!obj_list) | ||
| 137 | return; | ||
| 138 | |||
| 139 | acpi_processor_eval_pdc(handle, obj_list); | ||
| 140 | |||
| 141 | kfree(obj_list->pointer->buffer.pointer); | ||
| 142 | kfree(obj_list->pointer); | ||
| 143 | kfree(obj_list); | ||
| 144 | } | ||
| 145 | EXPORT_SYMBOL_GPL(acpi_processor_set_pdc); | ||
| 146 | |||
| 147 | static acpi_status | ||
| 148 | early_init_pdc(acpi_handle handle, u32 lvl, void *context, void **rv) | ||
| 149 | { | ||
| 150 | acpi_processor_set_pdc(handle); | ||
| 151 | return AE_OK; | ||
| 152 | } | ||
| 153 | |||
| 154 | void acpi_early_processor_set_pdc(void) | ||
| 155 | { | ||
| 156 | /* | ||
| 157 | * Check whether the system is DMI table. If yes, OSPM | ||
| 158 | * should not use mwait for CPU-states. | ||
| 159 | */ | ||
| 160 | dmi_check_system(processor_idle_dmi_table); | ||
| 161 | |||
| 162 | acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT, | ||
| 163 | ACPI_UINT32_MAX, | ||
| 164 | early_init_pdc, NULL, NULL, NULL); | ||
| 165 | } | ||
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index 2cabadcc4d8c..d648a9860b88 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c | |||
| @@ -413,7 +413,11 @@ static int acpi_processor_get_performance_info(struct acpi_processor *pr) | |||
| 413 | if (result) | 413 | if (result) |
| 414 | goto update_bios; | 414 | goto update_bios; |
| 415 | 415 | ||
| 416 | return 0; | 416 | /* We need to call _PPC once when cpufreq starts */ |
| 417 | if (ignore_ppc != 1) | ||
| 418 | result = acpi_processor_get_platform_limit(pr); | ||
| 419 | |||
| 420 | return result; | ||
| 417 | 421 | ||
| 418 | /* | 422 | /* |
| 419 | * Having _PPC but missing frequencies (_PSS, _PCT) is a very good hint that | 423 | * Having _PPC but missing frequencies (_PSS, _PCT) is a very good hint that |
| @@ -557,7 +561,7 @@ end: | |||
| 557 | } | 561 | } |
| 558 | 562 | ||
| 559 | int acpi_processor_preregister_performance( | 563 | int acpi_processor_preregister_performance( |
| 560 | struct acpi_processor_performance *performance) | 564 | struct acpi_processor_performance __percpu *performance) |
| 561 | { | 565 | { |
| 562 | int count, count_target; | 566 | int count, count_target; |
| 563 | int retval = 0; | 567 | int retval = 0; |
diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c index 140c5c5b423c..6deafb4aa0da 100644 --- a/drivers/acpi/processor_thermal.c +++ b/drivers/acpi/processor_thermal.c | |||
| @@ -443,8 +443,7 @@ struct thermal_cooling_device_ops processor_cooling_ops = { | |||
| 443 | #ifdef CONFIG_ACPI_PROCFS | 443 | #ifdef CONFIG_ACPI_PROCFS |
| 444 | static int acpi_processor_limit_seq_show(struct seq_file *seq, void *offset) | 444 | static int acpi_processor_limit_seq_show(struct seq_file *seq, void *offset) |
| 445 | { | 445 | { |
| 446 | struct acpi_processor *pr = (struct acpi_processor *)seq->private; | 446 | struct acpi_processor *pr = seq->private; |
| 447 | |||
| 448 | 447 | ||
| 449 | if (!pr) | 448 | if (!pr) |
| 450 | goto end; | 449 | goto end; |
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index 1c5d7a8b2fdf..29c6f5766dcf 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c | |||
| @@ -660,7 +660,7 @@ static int acpi_processor_get_throttling_fadt(struct acpi_processor *pr) | |||
| 660 | 660 | ||
| 661 | #ifdef CONFIG_X86 | 661 | #ifdef CONFIG_X86 |
| 662 | static int acpi_throttling_rdmsr(struct acpi_processor *pr, | 662 | static int acpi_throttling_rdmsr(struct acpi_processor *pr, |
| 663 | acpi_integer * value) | 663 | u64 *value) |
| 664 | { | 664 | { |
| 665 | struct cpuinfo_x86 *c; | 665 | struct cpuinfo_x86 *c; |
| 666 | u64 msr_high, msr_low; | 666 | u64 msr_high, msr_low; |
| @@ -681,13 +681,13 @@ static int acpi_throttling_rdmsr(struct acpi_processor *pr, | |||
| 681 | rdmsr_safe(MSR_IA32_THERM_CONTROL, | 681 | rdmsr_safe(MSR_IA32_THERM_CONTROL, |
| 682 | (u32 *)&msr_low , (u32 *) &msr_high); | 682 | (u32 *)&msr_low , (u32 *) &msr_high); |
| 683 | msr = (msr_high << 32) | msr_low; | 683 | msr = (msr_high << 32) | msr_low; |
| 684 | *value = (acpi_integer) msr; | 684 | *value = (u64) msr; |
| 685 | ret = 0; | 685 | ret = 0; |
| 686 | } | 686 | } |
| 687 | return ret; | 687 | return ret; |
| 688 | } | 688 | } |
| 689 | 689 | ||
| 690 | static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value) | 690 | static int acpi_throttling_wrmsr(struct acpi_processor *pr, u64 value) |
| 691 | { | 691 | { |
| 692 | struct cpuinfo_x86 *c; | 692 | struct cpuinfo_x86 *c; |
| 693 | unsigned int cpu; | 693 | unsigned int cpu; |
| @@ -711,14 +711,14 @@ static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value) | |||
| 711 | } | 711 | } |
| 712 | #else | 712 | #else |
| 713 | static int acpi_throttling_rdmsr(struct acpi_processor *pr, | 713 | static int acpi_throttling_rdmsr(struct acpi_processor *pr, |
| 714 | acpi_integer * value) | 714 | u64 *value) |
| 715 | { | 715 | { |
| 716 | printk(KERN_ERR PREFIX | 716 | printk(KERN_ERR PREFIX |
| 717 | "HARDWARE addr space,NOT supported yet\n"); | 717 | "HARDWARE addr space,NOT supported yet\n"); |
| 718 | return -1; | 718 | return -1; |
| 719 | } | 719 | } |
| 720 | 720 | ||
| 721 | static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value) | 721 | static int acpi_throttling_wrmsr(struct acpi_processor *pr, u64 value) |
| 722 | { | 722 | { |
| 723 | printk(KERN_ERR PREFIX | 723 | printk(KERN_ERR PREFIX |
| 724 | "HARDWARE addr space,NOT supported yet\n"); | 724 | "HARDWARE addr space,NOT supported yet\n"); |
| @@ -727,7 +727,7 @@ static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value) | |||
| 727 | #endif | 727 | #endif |
| 728 | 728 | ||
| 729 | static int acpi_read_throttling_status(struct acpi_processor *pr, | 729 | static int acpi_read_throttling_status(struct acpi_processor *pr, |
| 730 | acpi_integer *value) | 730 | u64 *value) |
| 731 | { | 731 | { |
| 732 | u32 bit_width, bit_offset; | 732 | u32 bit_width, bit_offset; |
| 733 | u64 ptc_value; | 733 | u64 ptc_value; |
| @@ -746,7 +746,7 @@ static int acpi_read_throttling_status(struct acpi_processor *pr, | |||
| 746 | address, (u32 *) &ptc_value, | 746 | address, (u32 *) &ptc_value, |
| 747 | (u32) (bit_width + bit_offset)); | 747 | (u32) (bit_width + bit_offset)); |
| 748 | ptc_mask = (1 << bit_width) - 1; | 748 | ptc_mask = (1 << bit_width) - 1; |
| 749 | *value = (acpi_integer) ((ptc_value >> bit_offset) & ptc_mask); | 749 | *value = (u64) ((ptc_value >> bit_offset) & ptc_mask); |
| 750 | ret = 0; | 750 | ret = 0; |
| 751 | break; | 751 | break; |
| 752 | case ACPI_ADR_SPACE_FIXED_HARDWARE: | 752 | case ACPI_ADR_SPACE_FIXED_HARDWARE: |
| @@ -760,7 +760,7 @@ static int acpi_read_throttling_status(struct acpi_processor *pr, | |||
| 760 | } | 760 | } |
| 761 | 761 | ||
| 762 | static int acpi_write_throttling_state(struct acpi_processor *pr, | 762 | static int acpi_write_throttling_state(struct acpi_processor *pr, |
| 763 | acpi_integer value) | 763 | u64 value) |
| 764 | { | 764 | { |
| 765 | u32 bit_width, bit_offset; | 765 | u32 bit_width, bit_offset; |
| 766 | u64 ptc_value; | 766 | u64 ptc_value; |
| @@ -793,7 +793,7 @@ static int acpi_write_throttling_state(struct acpi_processor *pr, | |||
| 793 | } | 793 | } |
| 794 | 794 | ||
| 795 | static int acpi_get_throttling_state(struct acpi_processor *pr, | 795 | static int acpi_get_throttling_state(struct acpi_processor *pr, |
| 796 | acpi_integer value) | 796 | u64 value) |
| 797 | { | 797 | { |
| 798 | int i; | 798 | int i; |
| 799 | 799 | ||
| @@ -808,7 +808,7 @@ static int acpi_get_throttling_state(struct acpi_processor *pr, | |||
| 808 | } | 808 | } |
| 809 | 809 | ||
| 810 | static int acpi_get_throttling_value(struct acpi_processor *pr, | 810 | static int acpi_get_throttling_value(struct acpi_processor *pr, |
| 811 | int state, acpi_integer *value) | 811 | int state, u64 *value) |
| 812 | { | 812 | { |
| 813 | int ret = -1; | 813 | int ret = -1; |
| 814 | 814 | ||
| @@ -826,7 +826,7 @@ static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr) | |||
| 826 | { | 826 | { |
| 827 | int state = 0; | 827 | int state = 0; |
| 828 | int ret; | 828 | int ret; |
| 829 | acpi_integer value; | 829 | u64 value; |
| 830 | 830 | ||
| 831 | if (!pr) | 831 | if (!pr) |
| 832 | return -EINVAL; | 832 | return -EINVAL; |
| @@ -993,7 +993,7 @@ static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr, | |||
| 993 | int state, bool force) | 993 | int state, bool force) |
| 994 | { | 994 | { |
| 995 | int ret; | 995 | int ret; |
| 996 | acpi_integer value; | 996 | u64 value; |
| 997 | 997 | ||
| 998 | if (!pr) | 998 | if (!pr) |
| 999 | return -EINVAL; | 999 | return -EINVAL; |
| @@ -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 38412ec2332d..89ad11138e48 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c | |||
| @@ -827,7 +827,10 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) | |||
| 827 | 827 | ||
| 828 | static void acpi_battery_remove(struct acpi_sbs *sbs, int id) | 828 | static void acpi_battery_remove(struct acpi_sbs *sbs, int id) |
| 829 | { | 829 | { |
| 830 | #if defined(CONFIG_ACPI_SYSFS_POWER) || defined(CONFIG_ACPI_PROCFS_POWER) | ||
| 830 | struct acpi_battery *battery = &sbs->battery[id]; | 831 | struct acpi_battery *battery = &sbs->battery[id]; |
| 832 | #endif | ||
| 833 | |||
| 831 | #ifdef CONFIG_ACPI_SYSFS_POWER | 834 | #ifdef CONFIG_ACPI_SYSFS_POWER |
| 832 | if (battery->bat.dev) { | 835 | if (battery->bat.dev) { |
| 833 | if (battery->have_sysfs_alarm) | 836 | if (battery->have_sysfs_alarm) |
diff --git a/drivers/acpi/sbshc.c b/drivers/acpi/sbshc.c index d9339806df45..fd09229282ea 100644 --- a/drivers/acpi/sbshc.c +++ b/drivers/acpi/sbshc.c | |||
| @@ -242,7 +242,7 @@ static int smbus_alarm(void *context) | |||
| 242 | case ACPI_SBS_CHARGER: | 242 | case ACPI_SBS_CHARGER: |
| 243 | case ACPI_SBS_MANAGER: | 243 | case ACPI_SBS_MANAGER: |
| 244 | case ACPI_SBS_BATTERY: | 244 | case ACPI_SBS_BATTERY: |
| 245 | acpi_os_execute(OSL_GPE_HANDLER, | 245 | acpi_os_execute(OSL_NOTIFY_HANDLER, |
| 246 | acpi_smbus_callback, hc); | 246 | acpi_smbus_callback, hc); |
| 247 | default:; | 247 | default:; |
| 248 | } | 248 | } |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index ff9f6226085d..fb7fc24fe727 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
| @@ -741,19 +741,40 @@ acpi_bus_extract_wakeup_device_power_package(struct acpi_device *device, | |||
| 741 | return AE_OK; | 741 | return AE_OK; |
| 742 | } | 742 | } |
| 743 | 743 | ||
| 744 | static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) | 744 | static void acpi_bus_set_run_wake_flags(struct acpi_device *device) |
| 745 | { | 745 | { |
| 746 | acpi_status status = 0; | ||
| 747 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
| 748 | union acpi_object *package = NULL; | ||
| 749 | int psw_error; | ||
| 750 | |||
| 751 | struct acpi_device_id button_device_ids[] = { | 746 | struct acpi_device_id button_device_ids[] = { |
| 752 | {"PNP0C0D", 0}, | 747 | {"PNP0C0D", 0}, |
| 753 | {"PNP0C0C", 0}, | 748 | {"PNP0C0C", 0}, |
| 754 | {"PNP0C0E", 0}, | 749 | {"PNP0C0E", 0}, |
| 755 | {"", 0}, | 750 | {"", 0}, |
| 756 | }; | 751 | }; |
| 752 | acpi_status status; | ||
| 753 | acpi_event_status event_status; | ||
| 754 | |||
| 755 | device->wakeup.run_wake_count = 0; | ||
| 756 | device->wakeup.flags.notifier_present = 0; | ||
| 757 | |||
| 758 | /* Power button, Lid switch always enable wakeup */ | ||
| 759 | if (!acpi_match_device_ids(device, button_device_ids)) { | ||
| 760 | device->wakeup.flags.run_wake = 1; | ||
| 761 | device->wakeup.flags.always_enabled = 1; | ||
| 762 | return; | ||
| 763 | } | ||
| 764 | |||
| 765 | status = acpi_get_gpe_status(NULL, device->wakeup.gpe_number, | ||
| 766 | ACPI_NOT_ISR, &event_status); | ||
| 767 | if (status == AE_OK) | ||
| 768 | device->wakeup.flags.run_wake = | ||
| 769 | !!(event_status & ACPI_EVENT_FLAG_HANDLE); | ||
| 770 | } | ||
| 771 | |||
| 772 | static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) | ||
| 773 | { | ||
| 774 | acpi_status status = 0; | ||
| 775 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
| 776 | union acpi_object *package = NULL; | ||
| 777 | int psw_error; | ||
| 757 | 778 | ||
| 758 | /* _PRW */ | 779 | /* _PRW */ |
| 759 | status = acpi_evaluate_object(device->handle, "_PRW", NULL, &buffer); | 780 | status = acpi_evaluate_object(device->handle, "_PRW", NULL, &buffer); |
| @@ -773,6 +794,7 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) | |||
| 773 | 794 | ||
| 774 | device->wakeup.flags.valid = 1; | 795 | device->wakeup.flags.valid = 1; |
| 775 | device->wakeup.prepare_count = 0; | 796 | device->wakeup.prepare_count = 0; |
| 797 | acpi_bus_set_run_wake_flags(device); | ||
| 776 | /* Call _PSW/_DSW object to disable its ability to wake the sleeping | 798 | /* Call _PSW/_DSW object to disable its ability to wake the sleeping |
| 777 | * system for the ACPI device with the _PRW object. | 799 | * system for the ACPI device with the _PRW object. |
| 778 | * The _PSW object is depreciated in ACPI 3.0 and is replaced by _DSW. | 800 | * The _PSW object is depreciated in ACPI 3.0 and is replaced by _DSW. |
| @@ -784,10 +806,6 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) | |||
| 784 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 806 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 785 | "error in _DSW or _PSW evaluation\n")); | 807 | "error in _DSW or _PSW evaluation\n")); |
| 786 | 808 | ||
| 787 | /* Power button, Lid switch always enable wakeup */ | ||
| 788 | if (!acpi_match_device_ids(device, button_device_ids)) | ||
| 789 | device->wakeup.flags.run_wake = 1; | ||
| 790 | |||
| 791 | end: | 809 | end: |
| 792 | if (ACPI_FAILURE(status)) | 810 | if (ACPI_FAILURE(status)) |
| 793 | device->flags.wake_capable = 0; | 811 | device->flags.wake_capable = 0; |
| @@ -1336,9 +1354,25 @@ static int acpi_bus_scan(acpi_handle handle, struct acpi_bus_ops *ops, | |||
| 1336 | 1354 | ||
| 1337 | if (child) | 1355 | if (child) |
| 1338 | *child = device; | 1356 | *child = device; |
| 1339 | return 0; | 1357 | |
| 1358 | if (device) | ||
| 1359 | return 0; | ||
| 1360 | else | ||
| 1361 | return -ENODEV; | ||
| 1340 | } | 1362 | } |
| 1341 | 1363 | ||
| 1364 | /* | ||
| 1365 | * acpi_bus_add and acpi_bus_start | ||
| 1366 | * | ||
| 1367 | * scan a given ACPI tree and (probably recently hot-plugged) | ||
| 1368 | * create and add or starts found devices. | ||
| 1369 | * | ||
| 1370 | * If no devices were found -ENODEV is returned which does not | ||
| 1371 | * mean that this is a real error, there just have been no suitable | ||
| 1372 | * ACPI objects in the table trunk from which the kernel could create | ||
| 1373 | * a device and add/start an appropriate driver. | ||
| 1374 | */ | ||
| 1375 | |||
| 1342 | int | 1376 | int |
| 1343 | acpi_bus_add(struct acpi_device **child, | 1377 | acpi_bus_add(struct acpi_device **child, |
| 1344 | struct acpi_device *parent, acpi_handle handle, int type) | 1378 | struct acpi_device *parent, acpi_handle handle, int type) |
| @@ -1348,8 +1382,7 @@ acpi_bus_add(struct acpi_device **child, | |||
| 1348 | memset(&ops, 0, sizeof(ops)); | 1382 | memset(&ops, 0, sizeof(ops)); |
| 1349 | ops.acpi_op_add = 1; | 1383 | ops.acpi_op_add = 1; |
| 1350 | 1384 | ||
| 1351 | acpi_bus_scan(handle, &ops, child); | 1385 | return acpi_bus_scan(handle, &ops, child); |
| 1352 | return 0; | ||
| 1353 | } | 1386 | } |
| 1354 | EXPORT_SYMBOL(acpi_bus_add); | 1387 | EXPORT_SYMBOL(acpi_bus_add); |
| 1355 | 1388 | ||
| @@ -1357,11 +1390,13 @@ int acpi_bus_start(struct acpi_device *device) | |||
| 1357 | { | 1390 | { |
| 1358 | struct acpi_bus_ops ops; | 1391 | struct acpi_bus_ops ops; |
| 1359 | 1392 | ||
| 1393 | if (!device) | ||
| 1394 | return -EINVAL; | ||
| 1395 | |||
| 1360 | memset(&ops, 0, sizeof(ops)); | 1396 | memset(&ops, 0, sizeof(ops)); |
| 1361 | ops.acpi_op_start = 1; | 1397 | ops.acpi_op_start = 1; |
| 1362 | 1398 | ||
| 1363 | acpi_bus_scan(device->handle, &ops, NULL); | 1399 | return acpi_bus_scan(device->handle, &ops, NULL); |
| 1364 | return 0; | ||
| 1365 | } | 1400 | } |
| 1366 | EXPORT_SYMBOL(acpi_bus_start); | 1401 | EXPORT_SYMBOL(acpi_bus_start); |
| 1367 | 1402 | ||
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 79d33d908b5a..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 */ |
| @@ -745,9 +754,18 @@ int acpi_pm_device_sleep_wake(struct device *dev, bool enable) | |||
| 745 | return -ENODEV; | 754 | return -ENODEV; |
| 746 | } | 755 | } |
| 747 | 756 | ||
| 748 | error = enable ? | 757 | if (enable) { |
| 749 | acpi_enable_wakeup_device_power(adev, acpi_target_sleep_state) : | 758 | error = acpi_enable_wakeup_device_power(adev, |
| 750 | acpi_disable_wakeup_device_power(adev); | 759 | acpi_target_sleep_state); |
| 760 | if (!error) | ||
| 761 | acpi_enable_gpe(adev->wakeup.gpe_device, | ||
| 762 | adev->wakeup.gpe_number, | ||
| 763 | ACPI_GPE_TYPE_WAKE); | ||
| 764 | } else { | ||
| 765 | acpi_disable_gpe(adev->wakeup.gpe_device, adev->wakeup.gpe_number, | ||
| 766 | ACPI_GPE_TYPE_WAKE); | ||
| 767 | error = acpi_disable_wakeup_device_power(adev); | ||
| 768 | } | ||
| 751 | if (!error) | 769 | if (!error) |
| 752 | dev_info(dev, "wake-up capability %s by ACPI\n", | 770 | dev_info(dev, "wake-up capability %s by ACPI\n", |
| 753 | enable ? "enabled" : "disabled"); | 771 | enable ? "enabled" : "disabled"); |
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index d11282975f35..743f2445e2a1 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c | |||
| @@ -101,6 +101,7 @@ static void acpi_table_attr_init(struct acpi_table_attr *table_attr, | |||
| 101 | struct acpi_table_header *header = NULL; | 101 | struct acpi_table_header *header = NULL; |
| 102 | struct acpi_table_attr *attr = NULL; | 102 | struct acpi_table_attr *attr = NULL; |
| 103 | 103 | ||
| 104 | sysfs_attr_init(&table_attr->attr.attr); | ||
| 104 | if (table_header->signature[0] != '\0') | 105 | if (table_header->signature[0] != '\0') |
| 105 | memcpy(table_attr->name, table_header->signature, | 106 | memcpy(table_attr->name, table_header->signature, |
| 106 | ACPI_NAME_SIZE); | 107 | ACPI_NAME_SIZE); |
| @@ -387,10 +388,10 @@ static ssize_t counter_set(struct kobject *kobj, | |||
| 387 | if (index < num_gpes) { | 388 | if (index < num_gpes) { |
| 388 | if (!strcmp(buf, "disable\n") && | 389 | if (!strcmp(buf, "disable\n") && |
| 389 | (status & ACPI_EVENT_FLAG_ENABLED)) | 390 | (status & ACPI_EVENT_FLAG_ENABLED)) |
| 390 | result = acpi_disable_gpe(handle, index); | 391 | result = acpi_set_gpe(handle, index, ACPI_GPE_DISABLE); |
| 391 | else if (!strcmp(buf, "enable\n") && | 392 | else if (!strcmp(buf, "enable\n") && |
| 392 | !(status & ACPI_EVENT_FLAG_ENABLED)) | 393 | !(status & ACPI_EVENT_FLAG_ENABLED)) |
| 393 | result = acpi_enable_gpe(handle, index); | 394 | result = acpi_set_gpe(handle, index, ACPI_GPE_ENABLE); |
| 394 | else if (!strcmp(buf, "clear\n") && | 395 | else if (!strcmp(buf, "clear\n") && |
| 395 | (status & ACPI_EVENT_FLAG_SET)) | 396 | (status & ACPI_EVENT_FLAG_SET)) |
| 396 | result = acpi_clear_gpe(handle, index, ACPI_NOT_ISR); | 397 | result = acpi_clear_gpe(handle, index, ACPI_NOT_ISR); |
| @@ -475,6 +476,7 @@ void acpi_irq_stats_init(void) | |||
| 475 | goto fail; | 476 | goto fail; |
| 476 | strncpy(name, buffer, strlen(buffer) + 1); | 477 | strncpy(name, buffer, strlen(buffer) + 1); |
| 477 | 478 | ||
| 479 | sysfs_attr_init(&counter_attrs[i].attr); | ||
| 478 | counter_attrs[i].attr.name = name; | 480 | counter_attrs[i].attr.name = name; |
| 479 | counter_attrs[i].attr.mode = 0644; | 481 | counter_attrs[i].attr.mode = 0644; |
| 480 | counter_attrs[i].show = counter_show; | 482 | counter_attrs[i].show = counter_show; |
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c index f336bca7c450..8a0ed2800e63 100644 --- a/drivers/acpi/tables.c +++ b/drivers/acpi/tables.c | |||
| @@ -213,7 +213,7 @@ acpi_table_parse_entries(char *id, | |||
| 213 | unsigned long table_end; | 213 | unsigned long table_end; |
| 214 | acpi_size tbl_size; | 214 | acpi_size tbl_size; |
| 215 | 215 | ||
| 216 | if (acpi_disabled) | 216 | if (acpi_disabled && !acpi_ht) |
| 217 | return -ENODEV; | 217 | return -ENODEV; |
| 218 | 218 | ||
| 219 | if (!handler) | 219 | if (!handler) |
| @@ -280,7 +280,7 @@ int __init acpi_table_parse(char *id, acpi_table_handler handler) | |||
| 280 | struct acpi_table_header *table = NULL; | 280 | struct acpi_table_header *table = NULL; |
| 281 | acpi_size tbl_size; | 281 | acpi_size tbl_size; |
| 282 | 282 | ||
| 283 | if (acpi_disabled) | 283 | if (acpi_disabled && !acpi_ht) |
| 284 | return -ENODEV; | 284 | return -ENODEV; |
| 285 | 285 | ||
| 286 | if (!handler) | 286 | if (!handler) |
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 811fec10462b..c9a49f4747e6 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c | |||
| @@ -107,12 +107,12 @@ acpi_extract_package(union acpi_object *package, | |||
| 107 | case ACPI_TYPE_INTEGER: | 107 | case ACPI_TYPE_INTEGER: |
| 108 | switch (format_string[i]) { | 108 | switch (format_string[i]) { |
| 109 | case 'N': | 109 | case 'N': |
| 110 | size_required += sizeof(acpi_integer); | 110 | size_required += sizeof(u64); |
| 111 | tail_offset += sizeof(acpi_integer); | 111 | tail_offset += sizeof(u64); |
| 112 | break; | 112 | break; |
| 113 | case 'S': | 113 | case 'S': |
| 114 | size_required += | 114 | size_required += |
| 115 | sizeof(char *) + sizeof(acpi_integer) + | 115 | sizeof(char *) + sizeof(u64) + |
| 116 | sizeof(char); | 116 | sizeof(char); |
| 117 | tail_offset += sizeof(char *); | 117 | tail_offset += sizeof(char *); |
| 118 | break; | 118 | break; |
| @@ -193,17 +193,17 @@ acpi_extract_package(union acpi_object *package, | |||
| 193 | case ACPI_TYPE_INTEGER: | 193 | case ACPI_TYPE_INTEGER: |
| 194 | switch (format_string[i]) { | 194 | switch (format_string[i]) { |
| 195 | case 'N': | 195 | case 'N': |
| 196 | *((acpi_integer *) head) = | 196 | *((u64 *) head) = |
| 197 | element->integer.value; | 197 | element->integer.value; |
| 198 | head += sizeof(acpi_integer); | 198 | head += sizeof(u64); |
| 199 | break; | 199 | break; |
| 200 | case 'S': | 200 | case 'S': |
| 201 | pointer = (u8 **) head; | 201 | pointer = (u8 **) head; |
| 202 | *pointer = tail; | 202 | *pointer = tail; |
| 203 | *((acpi_integer *) tail) = | 203 | *((u64 *) tail) = |
| 204 | element->integer.value; | 204 | element->integer.value; |
| 205 | head += sizeof(acpi_integer *); | 205 | head += sizeof(u64 *); |
| 206 | tail += sizeof(acpi_integer); | 206 | tail += sizeof(u64); |
| 207 | /* NULL terminate string */ | 207 | /* NULL terminate string */ |
| 208 | *tail = (char)0; | 208 | *tail = (char)0; |
| 209 | tail += sizeof(char); | 209 | tail += sizeof(char); |
| @@ -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 72e76b4b6538..2ff2b6ab5b6c 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
| @@ -78,6 +78,13 @@ MODULE_LICENSE("GPL"); | |||
| 78 | static int brightness_switch_enabled = 1; | 78 | static int brightness_switch_enabled = 1; |
| 79 | module_param(brightness_switch_enabled, bool, 0644); | 79 | module_param(brightness_switch_enabled, bool, 0644); |
| 80 | 80 | ||
| 81 | /* | ||
| 82 | * By default, we don't allow duplicate ACPI video bus devices | ||
| 83 | * under the same VGA controller | ||
| 84 | */ | ||
| 85 | static int allow_duplicates; | ||
| 86 | module_param(allow_duplicates, bool, 0644); | ||
| 87 | |||
| 81 | static int register_count = 0; | 88 | static int register_count = 0; |
| 82 | static int acpi_video_bus_add(struct acpi_device *device); | 89 | static int acpi_video_bus_add(struct acpi_device *device); |
| 83 | static int acpi_video_bus_remove(struct acpi_device *device, int type); | 90 | static int acpi_video_bus_remove(struct acpi_device *device, int type); |
| @@ -320,7 +327,7 @@ static int acpi_video_device_lcd_set_level(struct acpi_video_device *device, | |||
| 320 | int level); | 327 | int level); |
| 321 | static int acpi_video_device_lcd_get_level_current( | 328 | static int acpi_video_device_lcd_get_level_current( |
| 322 | struct acpi_video_device *device, | 329 | struct acpi_video_device *device, |
| 323 | unsigned long long *level); | 330 | unsigned long long *level, int init); |
| 324 | 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, |
| 325 | u32 level_current, u32 event); | 332 | u32 level_current, u32 event); |
| 326 | static int acpi_video_switch_brightness(struct acpi_video_device *device, | 333 | static int acpi_video_switch_brightness(struct acpi_video_device *device, |
| @@ -338,7 +345,7 @@ static int acpi_video_get_brightness(struct backlight_device *bd) | |||
| 338 | struct acpi_video_device *vd = | 345 | struct acpi_video_device *vd = |
| 339 | (struct acpi_video_device *)bl_get_data(bd); | 346 | (struct acpi_video_device *)bl_get_data(bd); |
| 340 | 347 | ||
| 341 | if (acpi_video_device_lcd_get_level_current(vd, &cur_level)) | 348 | if (acpi_video_device_lcd_get_level_current(vd, &cur_level, 0)) |
| 342 | return -EINVAL; | 349 | return -EINVAL; |
| 343 | for (i = 2; i < vd->brightness->count; i++) { | 350 | for (i = 2; i < vd->brightness->count; i++) { |
| 344 | if (vd->brightness->levels[i] == cur_level) | 351 | if (vd->brightness->levels[i] == cur_level) |
| @@ -407,7 +414,7 @@ static int video_get_cur_state(struct thermal_cooling_device *cooling_dev, unsig | |||
| 407 | unsigned long long level; | 414 | unsigned long long level; |
| 408 | int offset; | 415 | int offset; |
| 409 | 416 | ||
| 410 | if (acpi_video_device_lcd_get_level_current(video, &level)) | 417 | if (acpi_video_device_lcd_get_level_current(video, &level, 0)) |
| 411 | return -EINVAL; | 418 | return -EINVAL; |
| 412 | for (offset = 2; offset < video->brightness->count; offset++) | 419 | for (offset = 2; offset < video->brightness->count; offset++) |
| 413 | if (level == video->brightness->levels[offset]) { | 420 | if (level == video->brightness->levels[offset]) { |
| @@ -602,7 +609,7 @@ static struct dmi_system_id video_dmi_table[] __initdata = { | |||
| 602 | 609 | ||
| 603 | static int | 610 | static int |
| 604 | 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, |
| 605 | unsigned long long *level) | 612 | unsigned long long *level, int init) |
| 606 | { | 613 | { |
| 607 | acpi_status status = AE_OK; | 614 | acpi_status status = AE_OK; |
| 608 | int i; | 615 | int i; |
| @@ -626,10 +633,16 @@ acpi_video_device_lcd_get_level_current(struct acpi_video_device *device, | |||
| 626 | device->brightness->curr = *level; | 633 | device->brightness->curr = *level; |
| 627 | return 0; | 634 | return 0; |
| 628 | } | 635 | } |
| 629 | /* BQC returned an invalid level. Stop using it. */ | 636 | if (!init) { |
| 630 | ACPI_WARNING((AE_INFO, "%s returned an invalid level", | 637 | /* |
| 631 | buf)); | 638 | * BQC returned an invalid level. |
| 632 | 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 | } | ||
| 633 | } else { | 646 | } else { |
| 634 | /* Fixme: | 647 | /* Fixme: |
| 635 | * should we return an error or ignore this failure? | 648 | * should we return an error or ignore this failure? |
| @@ -752,7 +765,7 @@ acpi_video_bus_POST_options(struct acpi_video_bus *video, | |||
| 752 | static int | 765 | static int |
| 753 | acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag) | 766 | acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag) |
| 754 | { | 767 | { |
| 755 | acpi_integer status = 0; | 768 | u64 status = 0; |
| 756 | union acpi_object arg0 = { ACPI_TYPE_INTEGER }; | 769 | union acpi_object arg0 = { ACPI_TYPE_INTEGER }; |
| 757 | struct acpi_object_list args = { 1, &arg0 }; | 770 | struct acpi_object_list args = { 1, &arg0 }; |
| 758 | 771 | ||
| @@ -885,7 +898,7 @@ acpi_video_init_brightness(struct acpi_video_device *device) | |||
| 885 | if (!device->cap._BQC) | 898 | if (!device->cap._BQC) |
| 886 | goto set_level; | 899 | goto set_level; |
| 887 | 900 | ||
| 888 | result = acpi_video_device_lcd_get_level_current(device, &level_old); | 901 | result = acpi_video_device_lcd_get_level_current(device, &level_old, 1); |
| 889 | if (result) | 902 | if (result) |
| 890 | goto out_free_levels; | 903 | goto out_free_levels; |
| 891 | 904 | ||
| @@ -896,7 +909,7 @@ acpi_video_init_brightness(struct acpi_video_device *device) | |||
| 896 | if (result) | 909 | if (result) |
| 897 | goto out_free_levels; | 910 | goto out_free_levels; |
| 898 | 911 | ||
| 899 | result = acpi_video_device_lcd_get_level_current(device, &level); | 912 | result = acpi_video_device_lcd_get_level_current(device, &level, 0); |
| 900 | if (result) | 913 | if (result) |
| 901 | goto out_free_levels; | 914 | goto out_free_levels; |
| 902 | 915 | ||
| @@ -1989,7 +2002,7 @@ acpi_video_switch_brightness(struct acpi_video_device *device, int event) | |||
| 1989 | goto out; | 2002 | goto out; |
| 1990 | 2003 | ||
| 1991 | result = acpi_video_device_lcd_get_level_current(device, | 2004 | result = acpi_video_device_lcd_get_level_current(device, |
| 1992 | &level_current); | 2005 | &level_current, 0); |
| 1993 | if (result) | 2006 | if (result) |
| 1994 | goto out; | 2007 | goto out; |
| 1995 | 2008 | ||
| @@ -2239,11 +2252,47 @@ static int acpi_video_resume(struct acpi_device *device) | |||
| 2239 | return AE_OK; | 2252 | return AE_OK; |
| 2240 | } | 2253 | } |
| 2241 | 2254 | ||
| 2255 | static acpi_status | ||
| 2256 | acpi_video_bus_match(acpi_handle handle, u32 level, void *context, | ||
| 2257 | void **return_value) | ||
| 2258 | { | ||
| 2259 | struct acpi_device *device = context; | ||
| 2260 | struct acpi_device *sibling; | ||
| 2261 | int result; | ||
| 2262 | |||
| 2263 | if (handle == device->handle) | ||
| 2264 | return AE_CTRL_TERMINATE; | ||
| 2265 | |||
| 2266 | result = acpi_bus_get_device(handle, &sibling); | ||
| 2267 | if (result) | ||
| 2268 | return AE_OK; | ||
| 2269 | |||
| 2270 | if (!strcmp(acpi_device_name(sibling), ACPI_VIDEO_BUS_NAME)) | ||
| 2271 | return AE_ALREADY_EXISTS; | ||
| 2272 | |||
| 2273 | return AE_OK; | ||
| 2274 | } | ||
| 2275 | |||
| 2242 | static int acpi_video_bus_add(struct acpi_device *device) | 2276 | static int acpi_video_bus_add(struct acpi_device *device) |
| 2243 | { | 2277 | { |
| 2244 | struct acpi_video_bus *video; | 2278 | struct acpi_video_bus *video; |
| 2245 | struct input_dev *input; | 2279 | struct input_dev *input; |
| 2246 | int error; | 2280 | int error; |
| 2281 | acpi_status status; | ||
| 2282 | |||
| 2283 | status = acpi_walk_namespace(ACPI_TYPE_DEVICE, | ||
| 2284 | device->parent->handle, 1, | ||
| 2285 | acpi_video_bus_match, NULL, | ||
| 2286 | device, NULL); | ||
| 2287 | if (status == AE_ALREADY_EXISTS) { | ||
| 2288 | printk(KERN_WARNING FW_BUG | ||
| 2289 | "Duplicate ACPI video bus devices for the" | ||
| 2290 | " same VGA controller, please try module " | ||
| 2291 | "parameter \"video.allow_duplicates=1\"" | ||
| 2292 | "if the current driver doesn't work.\n"); | ||
| 2293 | if (!allow_duplicates) | ||
| 2294 | return -ENODEV; | ||
| 2295 | } | ||
| 2247 | 2296 | ||
| 2248 | video = kzalloc(sizeof(struct acpi_video_bus), GFP_KERNEL); | 2297 | video = kzalloc(sizeof(struct acpi_video_bus), GFP_KERNEL); |
| 2249 | if (!video) | 2298 | if (!video) |
diff --git a/drivers/acpi/wakeup.c b/drivers/acpi/wakeup.c index e0ee0c036f5a..4b9d339a6e28 100644 --- a/drivers/acpi/wakeup.c +++ b/drivers/acpi/wakeup.c | |||
| @@ -21,12 +21,12 @@ | |||
| 21 | ACPI_MODULE_NAME("wakeup_devices") | 21 | ACPI_MODULE_NAME("wakeup_devices") |
| 22 | 22 | ||
| 23 | /** | 23 | /** |
| 24 | * acpi_enable_wakeup_device_prep - prepare wakeup devices | 24 | * acpi_enable_wakeup_device_prep - Prepare wake-up devices. |
| 25 | * @sleep_state: ACPI state | 25 | * @sleep_state: ACPI system sleep state. |
| 26 | * Enable all wakup devices power if the devices' wakeup level | 26 | * |
| 27 | * is higher than requested sleep level | 27 | * Enable all wake-up devices' power, unless the requested system sleep state is |
| 28 | * too deep. | ||
| 28 | */ | 29 | */ |
| 29 | |||
| 30 | void acpi_enable_wakeup_device_prep(u8 sleep_state) | 30 | void acpi_enable_wakeup_device_prep(u8 sleep_state) |
| 31 | { | 31 | { |
| 32 | struct list_head *node, *next; | 32 | struct list_head *node, *next; |
| @@ -36,9 +36,8 @@ void acpi_enable_wakeup_device_prep(u8 sleep_state) | |||
| 36 | struct acpi_device, | 36 | struct acpi_device, |
| 37 | wakeup_list); | 37 | wakeup_list); |
| 38 | 38 | ||
| 39 | if (!dev->wakeup.flags.valid || | 39 | if (!dev->wakeup.flags.valid || !dev->wakeup.state.enabled |
| 40 | !dev->wakeup.state.enabled || | 40 | || (sleep_state > (u32) dev->wakeup.sleep_state)) |
| 41 | (sleep_state > (u32) dev->wakeup.sleep_state)) | ||
| 42 | continue; | 41 | continue; |
| 43 | 42 | ||
| 44 | acpi_enable_wakeup_device_power(dev, sleep_state); | 43 | acpi_enable_wakeup_device_power(dev, sleep_state); |
| @@ -46,9 +45,12 @@ void acpi_enable_wakeup_device_prep(u8 sleep_state) | |||
| 46 | } | 45 | } |
| 47 | 46 | ||
| 48 | /** | 47 | /** |
| 49 | * acpi_enable_wakeup_device - enable wakeup devices | 48 | * acpi_enable_wakeup_device - Enable wake-up device GPEs. |
| 50 | * @sleep_state: ACPI state | 49 | * @sleep_state: ACPI system sleep state. |
| 51 | * Enable all wakup devices's GPE | 50 | * |
| 51 | * Enable all wake-up devices' GPEs, with the assumption that | ||
| 52 | * acpi_disable_all_gpes() was executed before, so we don't need to disable any | ||
| 53 | * GPEs here. | ||
| 52 | */ | 54 | */ |
| 53 | void acpi_enable_wakeup_device(u8 sleep_state) | 55 | void acpi_enable_wakeup_device(u8 sleep_state) |
| 54 | { | 56 | { |
| @@ -65,29 +67,22 @@ void acpi_enable_wakeup_device(u8 sleep_state) | |||
| 65 | if (!dev->wakeup.flags.valid) | 67 | if (!dev->wakeup.flags.valid) |
| 66 | continue; | 68 | continue; |
| 67 | 69 | ||
| 68 | /* If users want to disable run-wake GPE, | ||
| 69 | * we only disable it for wake and leave it for runtime | ||
| 70 | */ | ||
| 71 | if ((!dev->wakeup.state.enabled && !dev->wakeup.prepare_count) | 70 | if ((!dev->wakeup.state.enabled && !dev->wakeup.prepare_count) |
| 72 | || sleep_state > (u32) dev->wakeup.sleep_state) { | 71 | || sleep_state > (u32) dev->wakeup.sleep_state) |
| 73 | if (dev->wakeup.flags.run_wake) { | ||
| 74 | /* set_gpe_type will disable GPE, leave it like that */ | ||
| 75 | acpi_set_gpe_type(dev->wakeup.gpe_device, | ||
| 76 | dev->wakeup.gpe_number, | ||
| 77 | ACPI_GPE_TYPE_RUNTIME); | ||
| 78 | } | ||
| 79 | continue; | 72 | continue; |
| 80 | } | 73 | |
| 81 | if (!dev->wakeup.flags.run_wake) | 74 | /* The wake-up power should have been enabled already. */ |
| 82 | acpi_enable_gpe(dev->wakeup.gpe_device, | 75 | acpi_set_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number, |
| 83 | dev->wakeup.gpe_number); | 76 | ACPI_GPE_ENABLE); |
| 84 | } | 77 | } |
| 85 | } | 78 | } |
| 86 | 79 | ||
| 87 | /** | 80 | /** |
| 88 | * acpi_disable_wakeup_device - disable devices' wakeup capability | 81 | * acpi_disable_wakeup_device - Disable devices' wakeup capability. |
| 89 | * @sleep_state: ACPI state | 82 | * @sleep_state: ACPI system sleep state. |
| 90 | * Disable all wakup devices's GPE and wakeup capability | 83 | * |
| 84 | * This function only affects devices with wakeup.state.enabled set, which means | ||
| 85 | * that it reverses the changes made by acpi_enable_wakeup_device_prep(). | ||
| 91 | */ | 86 | */ |
| 92 | void acpi_disable_wakeup_device(u8 sleep_state) | 87 | void acpi_disable_wakeup_device(u8 sleep_state) |
| 93 | { | 88 | { |
| @@ -97,30 +92,11 @@ void acpi_disable_wakeup_device(u8 sleep_state) | |||
| 97 | struct acpi_device *dev = | 92 | struct acpi_device *dev = |
| 98 | container_of(node, struct acpi_device, wakeup_list); | 93 | container_of(node, struct acpi_device, wakeup_list); |
| 99 | 94 | ||
| 100 | if (!dev->wakeup.flags.valid) | 95 | if (!dev->wakeup.flags.valid || !dev->wakeup.state.enabled |
| 101 | continue; | 96 | || (sleep_state > (u32) dev->wakeup.sleep_state)) |
| 102 | |||
| 103 | if ((!dev->wakeup.state.enabled && !dev->wakeup.prepare_count) | ||
| 104 | || sleep_state > (u32) dev->wakeup.sleep_state) { | ||
| 105 | if (dev->wakeup.flags.run_wake) { | ||
| 106 | acpi_set_gpe_type(dev->wakeup.gpe_device, | ||
| 107 | dev->wakeup.gpe_number, | ||
| 108 | ACPI_GPE_TYPE_WAKE_RUN); | ||
| 109 | /* Re-enable it, since set_gpe_type will disable it */ | ||
| 110 | acpi_enable_gpe(dev->wakeup.gpe_device, | ||
| 111 | dev->wakeup.gpe_number); | ||
| 112 | } | ||
| 113 | continue; | 97 | continue; |
| 114 | } | ||
| 115 | 98 | ||
| 116 | acpi_disable_wakeup_device_power(dev); | 99 | acpi_disable_wakeup_device_power(dev); |
| 117 | /* Never disable run-wake GPE */ | ||
| 118 | if (!dev->wakeup.flags.run_wake) { | ||
| 119 | acpi_disable_gpe(dev->wakeup.gpe_device, | ||
| 120 | dev->wakeup.gpe_number); | ||
| 121 | acpi_clear_gpe(dev->wakeup.gpe_device, | ||
| 122 | dev->wakeup.gpe_number, ACPI_NOT_ISR); | ||
| 123 | } | ||
| 124 | } | 100 | } |
| 125 | } | 101 | } |
| 126 | 102 | ||
| @@ -134,13 +110,11 @@ int __init acpi_wakeup_device_init(void) | |||
| 134 | struct acpi_device, | 110 | struct acpi_device, |
| 135 | wakeup_list); | 111 | wakeup_list); |
| 136 | /* In case user doesn't load button driver */ | 112 | /* In case user doesn't load button driver */ |
| 137 | if (!dev->wakeup.flags.run_wake || dev->wakeup.state.enabled) | 113 | if (!dev->wakeup.flags.always_enabled || |
| 114 | dev->wakeup.state.enabled) | ||
| 138 | continue; | 115 | continue; |
| 139 | acpi_set_gpe_type(dev->wakeup.gpe_device, | 116 | acpi_enable_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number, |
| 140 | dev->wakeup.gpe_number, | 117 | ACPI_GPE_TYPE_WAKE); |
| 141 | ACPI_GPE_TYPE_WAKE_RUN); | ||
| 142 | acpi_enable_gpe(dev->wakeup.gpe_device, | ||
| 143 | dev->wakeup.gpe_number); | ||
| 144 | dev->wakeup.state.enabled = 1; | 118 | dev->wakeup.state.enabled = 1; |
| 145 | } | 119 | } |
| 146 | mutex_unlock(&acpi_device_lock); | 120 | mutex_unlock(&acpi_device_lock); |
