diff options
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/acpica/Makefile | 1 | ||||
-rw-r--r-- | drivers/acpi/acpica/achware.h | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/aclocal.h | 23 | ||||
-rw-r--r-- | drivers/acpi/acpica/acmacros.h | 29 | ||||
-rw-r--r-- | drivers/acpi/acpica/dswload.c | 14 | ||||
-rw-r--r-- | drivers/acpi/acpica/dswload2.c | 14 | ||||
-rw-r--r-- | drivers/acpi/acpica/evgpe.c | 24 | ||||
-rw-r--r-- | drivers/acpi/acpica/evxfgpe.c | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/hwgpe.c | 15 | ||||
-rw-r--r-- | drivers/acpi/acpica/hwxfsleep.c | 1 | ||||
-rw-r--r-- | drivers/acpi/acpica/nsdump.c | 2 | ||||
-rw-r--r-- | drivers/acpi/acpica/tbinstal.c | 20 | ||||
-rw-r--r-- | drivers/acpi/acpica/tbxface.c | 41 | ||||
-rw-r--r-- | drivers/acpi/acpica/utosi.c | 1 | ||||
-rw-r--r-- | drivers/acpi/acpica/utxface.c | 354 | ||||
-rw-r--r-- | drivers/acpi/acpica/utxfinit.c | 317 | ||||
-rw-r--r-- | drivers/acpi/bus.c | 8 | ||||
-rw-r--r-- | drivers/acpi/button.c | 13 | ||||
-rw-r--r-- | drivers/acpi/fan.c | 22 | ||||
-rw-r--r-- | drivers/acpi/glue.c | 135 | ||||
-rw-r--r-- | drivers/acpi/hed.c | 20 | ||||
-rw-r--r-- | drivers/acpi/proc.c | 57 | ||||
-rw-r--r-- | drivers/acpi/sbshc.c | 18 | ||||
-rw-r--r-- | drivers/acpi/scan.c | 56 | ||||
-rw-r--r-- | drivers/acpi/tables.c | 18 | ||||
-rw-r--r-- | drivers/acpi/utils.c | 11 |
26 files changed, 729 insertions, 491 deletions
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile index 0a1b3435f920..7f1d40797e80 100644 --- a/drivers/acpi/acpica/Makefile +++ b/drivers/acpi/acpica/Makefile | |||
@@ -158,5 +158,6 @@ acpi-y += \ | |||
158 | utresrc.o \ | 158 | utresrc.o \ |
159 | utstate.o \ | 159 | utstate.o \ |
160 | utxface.o \ | 160 | utxface.o \ |
161 | utxfinit.o \ | ||
161 | utxferror.o \ | 162 | utxferror.o \ |
162 | utxfmutex.o | 163 | utxfmutex.o |
diff --git a/drivers/acpi/acpica/achware.h b/drivers/acpi/acpica/achware.h index 5de4ec72766d..d902d31abc6c 100644 --- a/drivers/acpi/acpica/achware.h +++ b/drivers/acpi/acpica/achware.h | |||
@@ -110,8 +110,7 @@ acpi_status acpi_hw_write_port(acpi_io_address address, u32 value, u32 width); | |||
110 | /* | 110 | /* |
111 | * hwgpe - GPE support | 111 | * hwgpe - GPE support |
112 | */ | 112 | */ |
113 | u32 acpi_hw_get_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info, | 113 | u32 acpi_hw_get_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info); |
114 | struct acpi_gpe_register_info *gpe_register_info); | ||
115 | 114 | ||
116 | acpi_status | 115 | acpi_status |
117 | acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action); | 116 | acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action); |
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h index cc80fe10e8ea..c816ee675094 100644 --- a/drivers/acpi/acpica/aclocal.h +++ b/drivers/acpi/acpica/aclocal.h | |||
@@ -707,15 +707,18 @@ union acpi_parse_value { | |||
707 | u8 disasm_opcode; /* Subtype used for disassembly */\ | 707 | u8 disasm_opcode; /* Subtype used for disassembly */\ |
708 | char aml_op_name[16]) /* Op name (debug only) */ | 708 | char aml_op_name[16]) /* Op name (debug only) */ |
709 | 709 | ||
710 | #define ACPI_DASM_BUFFER 0x00 | 710 | /* Flags for disasm_flags field above */ |
711 | #define ACPI_DASM_RESOURCE 0x01 | 711 | |
712 | #define ACPI_DASM_STRING 0x02 | 712 | #define ACPI_DASM_BUFFER 0x00 /* Buffer is a simple data buffer */ |
713 | #define ACPI_DASM_UNICODE 0x03 | 713 | #define ACPI_DASM_RESOURCE 0x01 /* Buffer is a Resource Descriptor */ |
714 | #define ACPI_DASM_EISAID 0x04 | 714 | #define ACPI_DASM_STRING 0x02 /* Buffer is a ASCII string */ |
715 | #define ACPI_DASM_MATCHOP 0x05 | 715 | #define ACPI_DASM_UNICODE 0x03 /* Buffer is a Unicode string */ |
716 | #define ACPI_DASM_LNOT_PREFIX 0x06 | 716 | #define ACPI_DASM_PLD_METHOD 0x04 /* Buffer is a _PLD method bit-packed buffer */ |
717 | #define ACPI_DASM_LNOT_SUFFIX 0x07 | 717 | #define ACPI_DASM_EISAID 0x05 /* Integer is an EISAID */ |
718 | #define ACPI_DASM_IGNORE 0x08 | 718 | #define ACPI_DASM_MATCHOP 0x06 /* Parent opcode is a Match() operator */ |
719 | #define ACPI_DASM_LNOT_PREFIX 0x07 /* Start of a Lnot_equal (etc.) pair of opcodes */ | ||
720 | #define ACPI_DASM_LNOT_SUFFIX 0x08 /* End of a Lnot_equal (etc.) pair of opcodes */ | ||
721 | #define ACPI_DASM_IGNORE 0x09 /* Not used at this time */ | ||
719 | 722 | ||
720 | /* | 723 | /* |
721 | * Generic operation (for example: If, While, Store) | 724 | * Generic operation (for example: If, While, Store) |
@@ -932,6 +935,7 @@ struct acpi_bit_register_info { | |||
932 | #define ACPI_OSI_WIN_VISTA_SP1 0x09 | 935 | #define ACPI_OSI_WIN_VISTA_SP1 0x09 |
933 | #define ACPI_OSI_WIN_VISTA_SP2 0x0A | 936 | #define ACPI_OSI_WIN_VISTA_SP2 0x0A |
934 | #define ACPI_OSI_WIN_7 0x0B | 937 | #define ACPI_OSI_WIN_7 0x0B |
938 | #define ACPI_OSI_WIN_8 0x0C | ||
935 | 939 | ||
936 | #define ACPI_ALWAYS_ILLEGAL 0x00 | 940 | #define ACPI_ALWAYS_ILLEGAL 0x00 |
937 | 941 | ||
@@ -1024,6 +1028,7 @@ struct acpi_port_info { | |||
1024 | ****************************************************************************/ | 1028 | ****************************************************************************/ |
1025 | 1029 | ||
1026 | struct acpi_db_method_info { | 1030 | struct acpi_db_method_info { |
1031 | acpi_handle method; | ||
1027 | acpi_handle main_thread_gate; | 1032 | acpi_handle main_thread_gate; |
1028 | acpi_handle thread_complete_gate; | 1033 | acpi_handle thread_complete_gate; |
1029 | acpi_thread_id *threads; | 1034 | acpi_thread_id *threads; |
diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h index 832b6198652e..a7f68c47f517 100644 --- a/drivers/acpi/acpica/acmacros.h +++ b/drivers/acpi/acpica/acmacros.h | |||
@@ -277,10 +277,33 @@ | |||
277 | 277 | ||
278 | /* Bitfields within ACPI registers */ | 278 | /* Bitfields within ACPI registers */ |
279 | 279 | ||
280 | #define ACPI_REGISTER_PREPARE_BITS(val, pos, mask) ((val << pos) & mask) | 280 | #define ACPI_REGISTER_PREPARE_BITS(val, pos, mask) \ |
281 | #define ACPI_REGISTER_INSERT_VALUE(reg, pos, mask, val) reg = (reg & (~(mask))) | ACPI_REGISTER_PREPARE_BITS(val, pos, mask) | 281 | ((val << pos) & mask) |
282 | 282 | ||
283 | #define ACPI_INSERT_BITS(target, mask, source) target = ((target & (~(mask))) | (source & mask)) | 283 | #define ACPI_REGISTER_INSERT_VALUE(reg, pos, mask, val) \ |
284 | reg = (reg & (~(mask))) | ACPI_REGISTER_PREPARE_BITS(val, pos, mask) | ||
285 | |||
286 | #define ACPI_INSERT_BITS(target, mask, source) \ | ||
287 | target = ((target & (~(mask))) | (source & mask)) | ||
288 | |||
289 | /* Generic bitfield macros and masks */ | ||
290 | |||
291 | #define ACPI_GET_BITS(source_ptr, position, mask) \ | ||
292 | ((*source_ptr >> position) & mask) | ||
293 | |||
294 | #define ACPI_SET_BITS(target_ptr, position, mask, value) \ | ||
295 | (*target_ptr |= ((value & mask) << position)) | ||
296 | |||
297 | #define ACPI_1BIT_MASK 0x00000001 | ||
298 | #define ACPI_2BIT_MASK 0x00000003 | ||
299 | #define ACPI_3BIT_MASK 0x00000007 | ||
300 | #define ACPI_4BIT_MASK 0x0000000F | ||
301 | #define ACPI_5BIT_MASK 0x0000001F | ||
302 | #define ACPI_6BIT_MASK 0x0000003F | ||
303 | #define ACPI_7BIT_MASK 0x0000007F | ||
304 | #define ACPI_8BIT_MASK 0x000000FF | ||
305 | #define ACPI_16BIT_MASK 0x0000FFFF | ||
306 | #define ACPI_24BIT_MASK 0x00FFFFFF | ||
284 | 307 | ||
285 | /* | 308 | /* |
286 | * An object of type struct acpi_namespace_node can appear in some contexts | 309 | * An object of type struct acpi_namespace_node can appear in some contexts |
diff --git a/drivers/acpi/acpica/dswload.c b/drivers/acpi/acpica/dswload.c index 552aa3a50c84..557510084c7a 100644 --- a/drivers/acpi/acpica/dswload.c +++ b/drivers/acpi/acpica/dswload.c | |||
@@ -230,6 +230,20 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, | |||
230 | walk_state->scope_info->common.value = ACPI_TYPE_ANY; | 230 | walk_state->scope_info->common.value = ACPI_TYPE_ANY; |
231 | break; | 231 | break; |
232 | 232 | ||
233 | case ACPI_TYPE_METHOD: | ||
234 | |||
235 | /* | ||
236 | * Allow scope change to root during execution of module-level | ||
237 | * code. Root is typed METHOD during this time. | ||
238 | */ | ||
239 | if ((node == acpi_gbl_root_node) && | ||
240 | (walk_state-> | ||
241 | parse_flags & ACPI_PARSE_MODULE_LEVEL)) { | ||
242 | break; | ||
243 | } | ||
244 | |||
245 | /*lint -fallthrough */ | ||
246 | |||
233 | default: | 247 | default: |
234 | 248 | ||
235 | /* All other types are an error */ | 249 | /* All other types are an error */ |
diff --git a/drivers/acpi/acpica/dswload2.c b/drivers/acpi/acpica/dswload2.c index ae7147724763..89c0114210c0 100644 --- a/drivers/acpi/acpica/dswload2.c +++ b/drivers/acpi/acpica/dswload2.c | |||
@@ -230,6 +230,20 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | |||
230 | walk_state->scope_info->common.value = ACPI_TYPE_ANY; | 230 | walk_state->scope_info->common.value = ACPI_TYPE_ANY; |
231 | break; | 231 | break; |
232 | 232 | ||
233 | case ACPI_TYPE_METHOD: | ||
234 | |||
235 | /* | ||
236 | * Allow scope change to root during execution of module-level | ||
237 | * code. Root is typed METHOD during this time. | ||
238 | */ | ||
239 | if ((node == acpi_gbl_root_node) && | ||
240 | (walk_state-> | ||
241 | parse_flags & ACPI_PARSE_MODULE_LEVEL)) { | ||
242 | break; | ||
243 | } | ||
244 | |||
245 | /*lint -fallthrough */ | ||
246 | |||
233 | default: | 247 | default: |
234 | 248 | ||
235 | /* All other types are an error */ | 249 | /* All other types are an error */ |
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c index afbd5cb391f6..ef0193d74b5d 100644 --- a/drivers/acpi/acpica/evgpe.c +++ b/drivers/acpi/acpica/evgpe.c | |||
@@ -80,8 +80,7 @@ acpi_ev_update_gpe_enable_mask(struct acpi_gpe_event_info *gpe_event_info) | |||
80 | return_ACPI_STATUS(AE_NOT_EXIST); | 80 | return_ACPI_STATUS(AE_NOT_EXIST); |
81 | } | 81 | } |
82 | 82 | ||
83 | register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info, | 83 | register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info); |
84 | gpe_register_info); | ||
85 | 84 | ||
86 | /* Clear the run bit up front */ | 85 | /* Clear the run bit up front */ |
87 | 86 | ||
@@ -379,6 +378,18 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
379 | */ | 378 | */ |
380 | if (!(gpe_register_info->enable_for_run | | 379 | if (!(gpe_register_info->enable_for_run | |
381 | gpe_register_info->enable_for_wake)) { | 380 | gpe_register_info->enable_for_wake)) { |
381 | ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS, | ||
382 | "Ignore disabled registers for GPE%02X-GPE%02X: " | ||
383 | "RunEnable=%02X, WakeEnable=%02X\n", | ||
384 | gpe_register_info-> | ||
385 | base_gpe_number, | ||
386 | gpe_register_info-> | ||
387 | base_gpe_number + | ||
388 | (ACPI_GPE_REGISTER_WIDTH - 1), | ||
389 | gpe_register_info-> | ||
390 | enable_for_run, | ||
391 | gpe_register_info-> | ||
392 | enable_for_wake)); | ||
382 | continue; | 393 | continue; |
383 | } | 394 | } |
384 | 395 | ||
@@ -401,9 +412,14 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
401 | } | 412 | } |
402 | 413 | ||
403 | ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS, | 414 | ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS, |
404 | "Read GPE Register at GPE%02X: Status=%02X, Enable=%02X\n", | 415 | "Read registers for GPE%02X-GPE%02X: Status=%02X, Enable=%02X, " |
416 | "RunEnable=%02X, WakeEnable=%02X\n", | ||
405 | gpe_register_info->base_gpe_number, | 417 | gpe_register_info->base_gpe_number, |
406 | status_reg, enable_reg)); | 418 | gpe_register_info->base_gpe_number + |
419 | (ACPI_GPE_REGISTER_WIDTH - 1), | ||
420 | status_reg, enable_reg, | ||
421 | gpe_register_info->enable_for_run, | ||
422 | gpe_register_info->enable_for_wake)); | ||
407 | 423 | ||
408 | /* Check if there is anything active at all in this register */ | 424 | /* Check if there is anything active at all in this register */ |
409 | 425 | ||
diff --git a/drivers/acpi/acpica/evxfgpe.c b/drivers/acpi/acpica/evxfgpe.c index 6affbdb4b88c..87c5f2332260 100644 --- a/drivers/acpi/acpica/evxfgpe.c +++ b/drivers/acpi/acpica/evxfgpe.c | |||
@@ -357,8 +357,7 @@ acpi_status acpi_set_gpe_wake_mask(acpi_handle gpe_device, u32 gpe_number, u8 ac | |||
357 | goto unlock_and_exit; | 357 | goto unlock_and_exit; |
358 | } | 358 | } |
359 | 359 | ||
360 | register_bit = | 360 | register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info); |
361 | acpi_hw_get_gpe_register_bit(gpe_event_info, gpe_register_info); | ||
362 | 361 | ||
363 | /* Perform the action */ | 362 | /* Perform the action */ |
364 | 363 | ||
diff --git a/drivers/acpi/acpica/hwgpe.c b/drivers/acpi/acpica/hwgpe.c index 25bd28c4ae8d..db4076580e2b 100644 --- a/drivers/acpi/acpica/hwgpe.c +++ b/drivers/acpi/acpica/hwgpe.c | |||
@@ -60,7 +60,6 @@ acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
60 | * FUNCTION: acpi_hw_get_gpe_register_bit | 60 | * FUNCTION: acpi_hw_get_gpe_register_bit |
61 | * | 61 | * |
62 | * PARAMETERS: gpe_event_info - Info block for the GPE | 62 | * PARAMETERS: gpe_event_info - Info block for the GPE |
63 | * gpe_register_info - Info block for the GPE register | ||
64 | * | 63 | * |
65 | * RETURN: Register mask with a one in the GPE bit position | 64 | * RETURN: Register mask with a one in the GPE bit position |
66 | * | 65 | * |
@@ -69,11 +68,10 @@ acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
69 | * | 68 | * |
70 | ******************************************************************************/ | 69 | ******************************************************************************/ |
71 | 70 | ||
72 | u32 acpi_hw_get_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info, | 71 | u32 acpi_hw_get_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info) |
73 | struct acpi_gpe_register_info *gpe_register_info) | ||
74 | { | 72 | { |
75 | return (u32)1 << (gpe_event_info->gpe_number - | 73 | return (u32)1 << (gpe_event_info->gpe_number - |
76 | gpe_register_info->base_gpe_number); | 74 | gpe_event_info->register_info->base_gpe_number); |
77 | } | 75 | } |
78 | 76 | ||
79 | /****************************************************************************** | 77 | /****************************************************************************** |
@@ -115,8 +113,7 @@ acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action) | |||
115 | 113 | ||
116 | /* Set or clear just the bit that corresponds to this GPE */ | 114 | /* Set or clear just the bit that corresponds to this GPE */ |
117 | 115 | ||
118 | register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info, | 116 | register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info); |
119 | gpe_register_info); | ||
120 | switch (action) { | 117 | switch (action) { |
121 | case ACPI_GPE_CONDITIONAL_ENABLE: | 118 | case ACPI_GPE_CONDITIONAL_ENABLE: |
122 | 119 | ||
@@ -178,8 +175,7 @@ acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info) | |||
178 | * Write a one to the appropriate bit in the status register to | 175 | * Write a one to the appropriate bit in the status register to |
179 | * clear this GPE. | 176 | * clear this GPE. |
180 | */ | 177 | */ |
181 | register_bit = | 178 | register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info); |
182 | acpi_hw_get_gpe_register_bit(gpe_event_info, gpe_register_info); | ||
183 | 179 | ||
184 | status = acpi_hw_write(register_bit, | 180 | status = acpi_hw_write(register_bit, |
185 | &gpe_register_info->status_address); | 181 | &gpe_register_info->status_address); |
@@ -222,8 +218,7 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info, | |||
222 | 218 | ||
223 | /* Get the register bitmask for this GPE */ | 219 | /* Get the register bitmask for this GPE */ |
224 | 220 | ||
225 | register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info, | 221 | register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info); |
226 | gpe_register_info); | ||
227 | 222 | ||
228 | /* GPE currently enabled? (enabled for runtime?) */ | 223 | /* GPE currently enabled? (enabled for runtime?) */ |
229 | 224 | ||
diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c index 1f165a750ae2..0ff1ecea5c3a 100644 --- a/drivers/acpi/acpica/hwxfsleep.c +++ b/drivers/acpi/acpica/hwxfsleep.c | |||
@@ -381,7 +381,6 @@ ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state) | |||
381 | * FUNCTION: acpi_leave_sleep_state_prep | 381 | * FUNCTION: acpi_leave_sleep_state_prep |
382 | * | 382 | * |
383 | * PARAMETERS: sleep_state - Which sleep state we are exiting | 383 | * PARAMETERS: sleep_state - Which sleep state we are exiting |
384 | * flags - ACPI_EXECUTE_BFS to run optional method | ||
385 | * | 384 | * |
386 | * RETURN: Status | 385 | * RETURN: Status |
387 | * | 386 | * |
diff --git a/drivers/acpi/acpica/nsdump.c b/drivers/acpi/acpica/nsdump.c index 7ee4e6aeb0a2..2526aaf945ee 100644 --- a/drivers/acpi/acpica/nsdump.c +++ b/drivers/acpi/acpica/nsdump.c | |||
@@ -264,7 +264,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, | |||
264 | switch (type) { | 264 | switch (type) { |
265 | case ACPI_TYPE_PROCESSOR: | 265 | case ACPI_TYPE_PROCESSOR: |
266 | 266 | ||
267 | acpi_os_printf("ID %X Len %.4X Addr %p\n", | 267 | acpi_os_printf("ID %02X Len %02X Addr %p\n", |
268 | obj_desc->processor.proc_id, | 268 | obj_desc->processor.proc_id, |
269 | obj_desc->processor.length, | 269 | obj_desc->processor.length, |
270 | ACPI_CAST_PTR(void, | 270 | ACPI_CAST_PTR(void, |
diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c index 74f97d74db1c..70f9d787c82c 100644 --- a/drivers/acpi/acpica/tbinstal.c +++ b/drivers/acpi/acpica/tbinstal.c | |||
@@ -350,6 +350,7 @@ struct acpi_table_header *acpi_tb_table_override(struct acpi_table_header | |||
350 | acpi_status acpi_tb_resize_root_table_list(void) | 350 | acpi_status acpi_tb_resize_root_table_list(void) |
351 | { | 351 | { |
352 | struct acpi_table_desc *tables; | 352 | struct acpi_table_desc *tables; |
353 | u32 table_count; | ||
353 | 354 | ||
354 | ACPI_FUNCTION_TRACE(tb_resize_root_table_list); | 355 | ACPI_FUNCTION_TRACE(tb_resize_root_table_list); |
355 | 356 | ||
@@ -363,8 +364,13 @@ acpi_status acpi_tb_resize_root_table_list(void) | |||
363 | 364 | ||
364 | /* Increase the Table Array size */ | 365 | /* Increase the Table Array size */ |
365 | 366 | ||
366 | tables = ACPI_ALLOCATE_ZEROED(((acpi_size) acpi_gbl_root_table_list. | 367 | if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) { |
367 | max_table_count + | 368 | table_count = acpi_gbl_root_table_list.max_table_count; |
369 | } else { | ||
370 | table_count = acpi_gbl_root_table_list.current_table_count; | ||
371 | } | ||
372 | |||
373 | tables = ACPI_ALLOCATE_ZEROED(((acpi_size) table_count + | ||
368 | ACPI_ROOT_TABLE_SIZE_INCREMENT) * | 374 | ACPI_ROOT_TABLE_SIZE_INCREMENT) * |
369 | sizeof(struct acpi_table_desc)); | 375 | sizeof(struct acpi_table_desc)); |
370 | if (!tables) { | 376 | if (!tables) { |
@@ -377,8 +383,8 @@ acpi_status acpi_tb_resize_root_table_list(void) | |||
377 | 383 | ||
378 | if (acpi_gbl_root_table_list.tables) { | 384 | if (acpi_gbl_root_table_list.tables) { |
379 | ACPI_MEMCPY(tables, acpi_gbl_root_table_list.tables, | 385 | ACPI_MEMCPY(tables, acpi_gbl_root_table_list.tables, |
380 | (acpi_size) acpi_gbl_root_table_list. | 386 | (acpi_size) table_count * |
381 | max_table_count * sizeof(struct acpi_table_desc)); | 387 | sizeof(struct acpi_table_desc)); |
382 | 388 | ||
383 | if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) { | 389 | if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) { |
384 | ACPI_FREE(acpi_gbl_root_table_list.tables); | 390 | ACPI_FREE(acpi_gbl_root_table_list.tables); |
@@ -386,9 +392,9 @@ acpi_status acpi_tb_resize_root_table_list(void) | |||
386 | } | 392 | } |
387 | 393 | ||
388 | acpi_gbl_root_table_list.tables = tables; | 394 | acpi_gbl_root_table_list.tables = tables; |
389 | acpi_gbl_root_table_list.max_table_count += | 395 | acpi_gbl_root_table_list.max_table_count = |
390 | ACPI_ROOT_TABLE_SIZE_INCREMENT; | 396 | table_count + ACPI_ROOT_TABLE_SIZE_INCREMENT; |
391 | acpi_gbl_root_table_list.flags |= (u8)ACPI_ROOT_ORIGIN_ALLOCATED; | 397 | acpi_gbl_root_table_list.flags |= ACPI_ROOT_ORIGIN_ALLOCATED; |
392 | 398 | ||
393 | return_ACPI_STATUS(AE_OK); | 399 | return_ACPI_STATUS(AE_OK); |
394 | } | 400 | } |
diff --git a/drivers/acpi/acpica/tbxface.c b/drivers/acpi/acpica/tbxface.c index 29e51bc01383..21101262e47a 100644 --- a/drivers/acpi/acpica/tbxface.c +++ b/drivers/acpi/acpica/tbxface.c | |||
@@ -159,14 +159,12 @@ acpi_initialize_tables(struct acpi_table_desc * initial_table_array, | |||
159 | * DESCRIPTION: Reallocate Root Table List into dynamic memory. Copies the | 159 | * DESCRIPTION: Reallocate Root Table List into dynamic memory. Copies the |
160 | * root list from the previously provided scratch area. Should | 160 | * root list from the previously provided scratch area. Should |
161 | * be called once dynamic memory allocation is available in the | 161 | * be called once dynamic memory allocation is available in the |
162 | * kernel | 162 | * kernel. |
163 | * | 163 | * |
164 | ******************************************************************************/ | 164 | ******************************************************************************/ |
165 | acpi_status acpi_reallocate_root_table(void) | 165 | acpi_status acpi_reallocate_root_table(void) |
166 | { | 166 | { |
167 | struct acpi_table_desc *tables; | 167 | acpi_status status; |
168 | acpi_size new_size; | ||
169 | acpi_size current_size; | ||
170 | 168 | ||
171 | ACPI_FUNCTION_TRACE(acpi_reallocate_root_table); | 169 | ACPI_FUNCTION_TRACE(acpi_reallocate_root_table); |
172 | 170 | ||
@@ -178,39 +176,10 @@ acpi_status acpi_reallocate_root_table(void) | |||
178 | return_ACPI_STATUS(AE_SUPPORT); | 176 | return_ACPI_STATUS(AE_SUPPORT); |
179 | } | 177 | } |
180 | 178 | ||
181 | /* | 179 | acpi_gbl_root_table_list.flags |= ACPI_ROOT_ALLOW_RESIZE; |
182 | * Get the current size of the root table and add the default | ||
183 | * increment to create the new table size. | ||
184 | */ | ||
185 | current_size = (acpi_size) | ||
186 | acpi_gbl_root_table_list.current_table_count * | ||
187 | sizeof(struct acpi_table_desc); | ||
188 | |||
189 | new_size = current_size + | ||
190 | (ACPI_ROOT_TABLE_SIZE_INCREMENT * sizeof(struct acpi_table_desc)); | ||
191 | |||
192 | /* Create new array and copy the old array */ | ||
193 | |||
194 | tables = ACPI_ALLOCATE_ZEROED(new_size); | ||
195 | if (!tables) { | ||
196 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
197 | } | ||
198 | 180 | ||
199 | ACPI_MEMCPY(tables, acpi_gbl_root_table_list.tables, current_size); | 181 | status = acpi_tb_resize_root_table_list(); |
200 | 182 | return_ACPI_STATUS(status); | |
201 | /* | ||
202 | * Update the root table descriptor. The new size will be the current | ||
203 | * number of tables plus the increment, independent of the reserved | ||
204 | * size of the original table list. | ||
205 | */ | ||
206 | acpi_gbl_root_table_list.tables = tables; | ||
207 | acpi_gbl_root_table_list.max_table_count = | ||
208 | acpi_gbl_root_table_list.current_table_count + | ||
209 | ACPI_ROOT_TABLE_SIZE_INCREMENT; | ||
210 | acpi_gbl_root_table_list.flags = | ||
211 | ACPI_ROOT_ORIGIN_ALLOCATED | ACPI_ROOT_ALLOW_RESIZE; | ||
212 | |||
213 | return_ACPI_STATUS(AE_OK); | ||
214 | } | 183 | } |
215 | 184 | ||
216 | /******************************************************************************* | 185 | /******************************************************************************* |
diff --git a/drivers/acpi/acpica/utosi.c b/drivers/acpi/acpica/utosi.c index 34ef0bd7e4b4..676285d6116d 100644 --- a/drivers/acpi/acpica/utosi.c +++ b/drivers/acpi/acpica/utosi.c | |||
@@ -73,6 +73,7 @@ static struct acpi_interface_info acpi_default_supported_interfaces[] = { | |||
73 | {"Windows 2006 SP1", NULL, 0, ACPI_OSI_WIN_VISTA_SP1}, /* Windows Vista SP1 - Added 09/2009 */ | 73 | {"Windows 2006 SP1", NULL, 0, ACPI_OSI_WIN_VISTA_SP1}, /* Windows Vista SP1 - Added 09/2009 */ |
74 | {"Windows 2006 SP2", NULL, 0, ACPI_OSI_WIN_VISTA_SP2}, /* Windows Vista SP2 - Added 09/2010 */ | 74 | {"Windows 2006 SP2", NULL, 0, ACPI_OSI_WIN_VISTA_SP2}, /* Windows Vista SP2 - Added 09/2010 */ |
75 | {"Windows 2009", NULL, 0, ACPI_OSI_WIN_7}, /* Windows 7 and Server 2008 R2 - Added 09/2009 */ | 75 | {"Windows 2009", NULL, 0, ACPI_OSI_WIN_7}, /* Windows 7 and Server 2008 R2 - Added 09/2009 */ |
76 | {"Windows 2012", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8 and Server 2012 - Added 08/2012 */ | ||
76 | 77 | ||
77 | /* Feature Group Strings */ | 78 | /* Feature Group Strings */ |
78 | 79 | ||
diff --git a/drivers/acpi/acpica/utxface.c b/drivers/acpi/acpica/utxface.c index 534179f1177b..b09632b4f5b3 100644 --- a/drivers/acpi/acpica/utxface.c +++ b/drivers/acpi/acpica/utxface.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | * | 2 | * |
3 | * Module Name: utxface - External interfaces for "global" ACPI functions | 3 | * Module Name: utxface - External interfaces, miscellaneous utility functions |
4 | * | 4 | * |
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
@@ -53,271 +53,6 @@ | |||
53 | #define _COMPONENT ACPI_UTILITIES | 53 | #define _COMPONENT ACPI_UTILITIES |
54 | ACPI_MODULE_NAME("utxface") | 54 | ACPI_MODULE_NAME("utxface") |
55 | 55 | ||
56 | #ifndef ACPI_ASL_COMPILER | ||
57 | /******************************************************************************* | ||
58 | * | ||
59 | * FUNCTION: acpi_initialize_subsystem | ||
60 | * | ||
61 | * PARAMETERS: None | ||
62 | * | ||
63 | * RETURN: Status | ||
64 | * | ||
65 | * DESCRIPTION: Initializes all global variables. This is the first function | ||
66 | * called, so any early initialization belongs here. | ||
67 | * | ||
68 | ******************************************************************************/ | ||
69 | acpi_status __init acpi_initialize_subsystem(void) | ||
70 | { | ||
71 | acpi_status status; | ||
72 | |||
73 | ACPI_FUNCTION_TRACE(acpi_initialize_subsystem); | ||
74 | |||
75 | acpi_gbl_startup_flags = ACPI_SUBSYSTEM_INITIALIZE; | ||
76 | ACPI_DEBUG_EXEC(acpi_ut_init_stack_ptr_trace()); | ||
77 | |||
78 | /* Initialize the OS-Dependent layer */ | ||
79 | |||
80 | status = acpi_os_initialize(); | ||
81 | if (ACPI_FAILURE(status)) { | ||
82 | ACPI_EXCEPTION((AE_INFO, status, "During OSL initialization")); | ||
83 | return_ACPI_STATUS(status); | ||
84 | } | ||
85 | |||
86 | /* Initialize all globals used by the subsystem */ | ||
87 | |||
88 | status = acpi_ut_init_globals(); | ||
89 | if (ACPI_FAILURE(status)) { | ||
90 | ACPI_EXCEPTION((AE_INFO, status, | ||
91 | "During initialization of globals")); | ||
92 | return_ACPI_STATUS(status); | ||
93 | } | ||
94 | |||
95 | /* Create the default mutex objects */ | ||
96 | |||
97 | status = acpi_ut_mutex_initialize(); | ||
98 | if (ACPI_FAILURE(status)) { | ||
99 | ACPI_EXCEPTION((AE_INFO, status, | ||
100 | "During Global Mutex creation")); | ||
101 | return_ACPI_STATUS(status); | ||
102 | } | ||
103 | |||
104 | /* | ||
105 | * Initialize the namespace manager and | ||
106 | * the root of the namespace tree | ||
107 | */ | ||
108 | status = acpi_ns_root_initialize(); | ||
109 | if (ACPI_FAILURE(status)) { | ||
110 | ACPI_EXCEPTION((AE_INFO, status, | ||
111 | "During Namespace initialization")); | ||
112 | return_ACPI_STATUS(status); | ||
113 | } | ||
114 | |||
115 | /* Initialize the global OSI interfaces list with the static names */ | ||
116 | |||
117 | status = acpi_ut_initialize_interfaces(); | ||
118 | if (ACPI_FAILURE(status)) { | ||
119 | ACPI_EXCEPTION((AE_INFO, status, | ||
120 | "During OSI interfaces initialization")); | ||
121 | return_ACPI_STATUS(status); | ||
122 | } | ||
123 | |||
124 | /* If configured, initialize the AML debugger */ | ||
125 | |||
126 | ACPI_DEBUGGER_EXEC(status = acpi_db_initialize()); | ||
127 | return_ACPI_STATUS(status); | ||
128 | } | ||
129 | |||
130 | /******************************************************************************* | ||
131 | * | ||
132 | * FUNCTION: acpi_enable_subsystem | ||
133 | * | ||
134 | * PARAMETERS: flags - Init/enable Options | ||
135 | * | ||
136 | * RETURN: Status | ||
137 | * | ||
138 | * DESCRIPTION: Completes the subsystem initialization including hardware. | ||
139 | * Puts system into ACPI mode if it isn't already. | ||
140 | * | ||
141 | ******************************************************************************/ | ||
142 | acpi_status acpi_enable_subsystem(u32 flags) | ||
143 | { | ||
144 | acpi_status status = AE_OK; | ||
145 | |||
146 | ACPI_FUNCTION_TRACE(acpi_enable_subsystem); | ||
147 | |||
148 | #if (!ACPI_REDUCED_HARDWARE) | ||
149 | |||
150 | /* Enable ACPI mode */ | ||
151 | |||
152 | if (!(flags & ACPI_NO_ACPI_ENABLE)) { | ||
153 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
154 | "[Init] Going into ACPI mode\n")); | ||
155 | |||
156 | acpi_gbl_original_mode = acpi_hw_get_mode(); | ||
157 | |||
158 | status = acpi_enable(); | ||
159 | if (ACPI_FAILURE(status)) { | ||
160 | ACPI_WARNING((AE_INFO, "AcpiEnable failed")); | ||
161 | return_ACPI_STATUS(status); | ||
162 | } | ||
163 | } | ||
164 | |||
165 | /* | ||
166 | * Obtain a permanent mapping for the FACS. This is required for the | ||
167 | * Global Lock and the Firmware Waking Vector | ||
168 | */ | ||
169 | status = acpi_tb_initialize_facs(); | ||
170 | if (ACPI_FAILURE(status)) { | ||
171 | ACPI_WARNING((AE_INFO, "Could not map the FACS table")); | ||
172 | return_ACPI_STATUS(status); | ||
173 | } | ||
174 | #endif /* !ACPI_REDUCED_HARDWARE */ | ||
175 | |||
176 | /* | ||
177 | * Install the default op_region handlers. These are installed unless | ||
178 | * other handlers have already been installed via the | ||
179 | * install_address_space_handler interface. | ||
180 | */ | ||
181 | if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { | ||
182 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
183 | "[Init] Installing default address space handlers\n")); | ||
184 | |||
185 | status = acpi_ev_install_region_handlers(); | ||
186 | if (ACPI_FAILURE(status)) { | ||
187 | return_ACPI_STATUS(status); | ||
188 | } | ||
189 | } | ||
190 | #if (!ACPI_REDUCED_HARDWARE) | ||
191 | /* | ||
192 | * Initialize ACPI Event handling (Fixed and General Purpose) | ||
193 | * | ||
194 | * Note1: We must have the hardware and events initialized before we can | ||
195 | * execute any control methods safely. Any control method can require | ||
196 | * ACPI hardware support, so the hardware must be fully initialized before | ||
197 | * any method execution! | ||
198 | * | ||
199 | * Note2: Fixed events are initialized and enabled here. GPEs are | ||
200 | * initialized, but cannot be enabled until after the hardware is | ||
201 | * completely initialized (SCI and global_lock activated) | ||
202 | */ | ||
203 | if (!(flags & ACPI_NO_EVENT_INIT)) { | ||
204 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
205 | "[Init] Initializing ACPI events\n")); | ||
206 | |||
207 | status = acpi_ev_initialize_events(); | ||
208 | if (ACPI_FAILURE(status)) { | ||
209 | return_ACPI_STATUS(status); | ||
210 | } | ||
211 | } | ||
212 | |||
213 | /* | ||
214 | * Install the SCI handler and Global Lock handler. This completes the | ||
215 | * hardware initialization. | ||
216 | */ | ||
217 | if (!(flags & ACPI_NO_HANDLER_INIT)) { | ||
218 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
219 | "[Init] Installing SCI/GL handlers\n")); | ||
220 | |||
221 | status = acpi_ev_install_xrupt_handlers(); | ||
222 | if (ACPI_FAILURE(status)) { | ||
223 | return_ACPI_STATUS(status); | ||
224 | } | ||
225 | } | ||
226 | #endif /* !ACPI_REDUCED_HARDWARE */ | ||
227 | |||
228 | return_ACPI_STATUS(status); | ||
229 | } | ||
230 | |||
231 | ACPI_EXPORT_SYMBOL(acpi_enable_subsystem) | ||
232 | |||
233 | /******************************************************************************* | ||
234 | * | ||
235 | * FUNCTION: acpi_initialize_objects | ||
236 | * | ||
237 | * PARAMETERS: flags - Init/enable Options | ||
238 | * | ||
239 | * RETURN: Status | ||
240 | * | ||
241 | * DESCRIPTION: Completes namespace initialization by initializing device | ||
242 | * objects and executing AML code for Regions, buffers, etc. | ||
243 | * | ||
244 | ******************************************************************************/ | ||
245 | acpi_status acpi_initialize_objects(u32 flags) | ||
246 | { | ||
247 | acpi_status status = AE_OK; | ||
248 | |||
249 | ACPI_FUNCTION_TRACE(acpi_initialize_objects); | ||
250 | |||
251 | /* | ||
252 | * Run all _REG methods | ||
253 | * | ||
254 | * Note: Any objects accessed by the _REG methods will be automatically | ||
255 | * initialized, even if they contain executable AML (see the call to | ||
256 | * acpi_ns_initialize_objects below). | ||
257 | */ | ||
258 | if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { | ||
259 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
260 | "[Init] Executing _REG OpRegion methods\n")); | ||
261 | |||
262 | status = acpi_ev_initialize_op_regions(); | ||
263 | if (ACPI_FAILURE(status)) { | ||
264 | return_ACPI_STATUS(status); | ||
265 | } | ||
266 | } | ||
267 | |||
268 | /* | ||
269 | * Execute any module-level code that was detected during the table load | ||
270 | * phase. Although illegal since ACPI 2.0, there are many machines that | ||
271 | * contain this type of code. Each block of detected executable AML code | ||
272 | * outside of any control method is wrapped with a temporary control | ||
273 | * method object and placed on a global list. The methods on this list | ||
274 | * are executed below. | ||
275 | */ | ||
276 | acpi_ns_exec_module_code_list(); | ||
277 | |||
278 | /* | ||
279 | * Initialize the objects that remain uninitialized. This runs the | ||
280 | * executable AML that may be part of the declaration of these objects: | ||
281 | * operation_regions, buffer_fields, Buffers, and Packages. | ||
282 | */ | ||
283 | if (!(flags & ACPI_NO_OBJECT_INIT)) { | ||
284 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
285 | "[Init] Completing Initialization of ACPI Objects\n")); | ||
286 | |||
287 | status = acpi_ns_initialize_objects(); | ||
288 | if (ACPI_FAILURE(status)) { | ||
289 | return_ACPI_STATUS(status); | ||
290 | } | ||
291 | } | ||
292 | |||
293 | /* | ||
294 | * Initialize all device objects in the namespace. This runs the device | ||
295 | * _STA and _INI methods. | ||
296 | */ | ||
297 | if (!(flags & ACPI_NO_DEVICE_INIT)) { | ||
298 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
299 | "[Init] Initializing ACPI Devices\n")); | ||
300 | |||
301 | status = acpi_ns_initialize_devices(); | ||
302 | if (ACPI_FAILURE(status)) { | ||
303 | return_ACPI_STATUS(status); | ||
304 | } | ||
305 | } | ||
306 | |||
307 | /* | ||
308 | * Empty the caches (delete the cached objects) on the assumption that | ||
309 | * the table load filled them up more than they will be at runtime -- | ||
310 | * thus wasting non-paged memory. | ||
311 | */ | ||
312 | status = acpi_purge_cached_objects(); | ||
313 | |||
314 | acpi_gbl_startup_flags |= ACPI_INITIALIZED_OK; | ||
315 | return_ACPI_STATUS(status); | ||
316 | } | ||
317 | |||
318 | ACPI_EXPORT_SYMBOL(acpi_initialize_objects) | ||
319 | |||
320 | #endif | ||
321 | /******************************************************************************* | 56 | /******************************************************************************* |
322 | * | 57 | * |
323 | * FUNCTION: acpi_terminate | 58 | * FUNCTION: acpi_terminate |
@@ -683,3 +418,90 @@ acpi_check_address_range(acpi_adr_space_type space_id, | |||
683 | 418 | ||
684 | ACPI_EXPORT_SYMBOL(acpi_check_address_range) | 419 | ACPI_EXPORT_SYMBOL(acpi_check_address_range) |
685 | #endif /* !ACPI_ASL_COMPILER */ | 420 | #endif /* !ACPI_ASL_COMPILER */ |
421 | /******************************************************************************* | ||
422 | * | ||
423 | * FUNCTION: acpi_decode_pld_buffer | ||
424 | * | ||
425 | * PARAMETERS: in_buffer - Buffer returned by _PLD method | ||
426 | * length - Length of the in_buffer | ||
427 | * return_buffer - Where the decode buffer is returned | ||
428 | * | ||
429 | * RETURN: Status and the decoded _PLD buffer. User must deallocate | ||
430 | * the buffer via ACPI_FREE. | ||
431 | * | ||
432 | * DESCRIPTION: Decode the bit-packed buffer returned by the _PLD method into | ||
433 | * a local struct that is much more useful to an ACPI driver. | ||
434 | * | ||
435 | ******************************************************************************/ | ||
436 | acpi_status | ||
437 | acpi_decode_pld_buffer(u8 *in_buffer, | ||
438 | acpi_size length, struct acpi_pld_info ** return_buffer) | ||
439 | { | ||
440 | struct acpi_pld_info *pld_info; | ||
441 | u32 *buffer = ACPI_CAST_PTR(u32, in_buffer); | ||
442 | u32 dword; | ||
443 | |||
444 | /* Parameter validation */ | ||
445 | |||
446 | if (!in_buffer || !return_buffer || (length < 16)) { | ||
447 | return (AE_BAD_PARAMETER); | ||
448 | } | ||
449 | |||
450 | pld_info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pld_info)); | ||
451 | if (!pld_info) { | ||
452 | return (AE_NO_MEMORY); | ||
453 | } | ||
454 | |||
455 | /* First 32-bit DWord */ | ||
456 | |||
457 | ACPI_MOVE_32_TO_32(&dword, &buffer[0]); | ||
458 | pld_info->revision = ACPI_PLD_GET_REVISION(&dword); | ||
459 | pld_info->ignore_color = ACPI_PLD_GET_IGNORE_COLOR(&dword); | ||
460 | pld_info->color = ACPI_PLD_GET_COLOR(&dword); | ||
461 | |||
462 | /* Second 32-bit DWord */ | ||
463 | |||
464 | ACPI_MOVE_32_TO_32(&dword, &buffer[1]); | ||
465 | pld_info->width = ACPI_PLD_GET_WIDTH(&dword); | ||
466 | pld_info->height = ACPI_PLD_GET_HEIGHT(&dword); | ||
467 | |||
468 | /* Third 32-bit DWord */ | ||
469 | |||
470 | ACPI_MOVE_32_TO_32(&dword, &buffer[2]); | ||
471 | pld_info->user_visible = ACPI_PLD_GET_USER_VISIBLE(&dword); | ||
472 | pld_info->dock = ACPI_PLD_GET_DOCK(&dword); | ||
473 | pld_info->lid = ACPI_PLD_GET_LID(&dword); | ||
474 | pld_info->panel = ACPI_PLD_GET_PANEL(&dword); | ||
475 | pld_info->vertical_position = ACPI_PLD_GET_VERTICAL(&dword); | ||
476 | pld_info->horizontal_position = ACPI_PLD_GET_HORIZONTAL(&dword); | ||
477 | pld_info->shape = ACPI_PLD_GET_SHAPE(&dword); | ||
478 | pld_info->group_orientation = ACPI_PLD_GET_ORIENTATION(&dword); | ||
479 | pld_info->group_token = ACPI_PLD_GET_TOKEN(&dword); | ||
480 | pld_info->group_position = ACPI_PLD_GET_POSITION(&dword); | ||
481 | pld_info->bay = ACPI_PLD_GET_BAY(&dword); | ||
482 | |||
483 | /* Fourth 32-bit DWord */ | ||
484 | |||
485 | ACPI_MOVE_32_TO_32(&dword, &buffer[3]); | ||
486 | pld_info->ejectable = ACPI_PLD_GET_EJECTABLE(&dword); | ||
487 | pld_info->ospm_eject_required = ACPI_PLD_GET_OSPM_EJECT(&dword); | ||
488 | pld_info->cabinet_number = ACPI_PLD_GET_CABINET(&dword); | ||
489 | pld_info->card_cage_number = ACPI_PLD_GET_CARD_CAGE(&dword); | ||
490 | pld_info->reference = ACPI_PLD_GET_REFERENCE(&dword); | ||
491 | pld_info->rotation = ACPI_PLD_GET_ROTATION(&dword); | ||
492 | pld_info->order = ACPI_PLD_GET_ORDER(&dword); | ||
493 | |||
494 | if (length >= ACPI_PLD_BUFFER_SIZE) { | ||
495 | |||
496 | /* Fifth 32-bit DWord (Revision 2 of _PLD) */ | ||
497 | |||
498 | ACPI_MOVE_32_TO_32(&dword, &buffer[4]); | ||
499 | pld_info->vertical_offset = ACPI_PLD_GET_VERT_OFFSET(&dword); | ||
500 | pld_info->horizontal_offset = ACPI_PLD_GET_HORIZ_OFFSET(&dword); | ||
501 | } | ||
502 | |||
503 | *return_buffer = pld_info; | ||
504 | return (AE_OK); | ||
505 | } | ||
506 | |||
507 | ACPI_EXPORT_SYMBOL(acpi_decode_pld_buffer) | ||
diff --git a/drivers/acpi/acpica/utxfinit.c b/drivers/acpi/acpica/utxfinit.c new file mode 100644 index 000000000000..14f523627a5e --- /dev/null +++ b/drivers/acpi/acpica/utxfinit.c | |||
@@ -0,0 +1,317 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Module Name: utxfinit - External interfaces for ACPICA initialization | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2012, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #include <linux/export.h> | ||
45 | #include <acpi/acpi.h> | ||
46 | #include "accommon.h" | ||
47 | #include "acevents.h" | ||
48 | #include "acnamesp.h" | ||
49 | #include "acdebug.h" | ||
50 | #include "actables.h" | ||
51 | |||
52 | #define _COMPONENT ACPI_UTILITIES | ||
53 | ACPI_MODULE_NAME("utxfinit") | ||
54 | |||
55 | /******************************************************************************* | ||
56 | * | ||
57 | * FUNCTION: acpi_initialize_subsystem | ||
58 | * | ||
59 | * PARAMETERS: None | ||
60 | * | ||
61 | * RETURN: Status | ||
62 | * | ||
63 | * DESCRIPTION: Initializes all global variables. This is the first function | ||
64 | * called, so any early initialization belongs here. | ||
65 | * | ||
66 | ******************************************************************************/ | ||
67 | acpi_status acpi_initialize_subsystem(void) | ||
68 | { | ||
69 | acpi_status status; | ||
70 | |||
71 | ACPI_FUNCTION_TRACE(acpi_initialize_subsystem); | ||
72 | |||
73 | acpi_gbl_startup_flags = ACPI_SUBSYSTEM_INITIALIZE; | ||
74 | ACPI_DEBUG_EXEC(acpi_ut_init_stack_ptr_trace()); | ||
75 | |||
76 | /* Initialize the OS-Dependent layer */ | ||
77 | |||
78 | status = acpi_os_initialize(); | ||
79 | if (ACPI_FAILURE(status)) { | ||
80 | ACPI_EXCEPTION((AE_INFO, status, "During OSL initialization")); | ||
81 | return_ACPI_STATUS(status); | ||
82 | } | ||
83 | |||
84 | /* Initialize all globals used by the subsystem */ | ||
85 | |||
86 | status = acpi_ut_init_globals(); | ||
87 | if (ACPI_FAILURE(status)) { | ||
88 | ACPI_EXCEPTION((AE_INFO, status, | ||
89 | "During initialization of globals")); | ||
90 | return_ACPI_STATUS(status); | ||
91 | } | ||
92 | |||
93 | /* Create the default mutex objects */ | ||
94 | |||
95 | status = acpi_ut_mutex_initialize(); | ||
96 | if (ACPI_FAILURE(status)) { | ||
97 | ACPI_EXCEPTION((AE_INFO, status, | ||
98 | "During Global Mutex creation")); | ||
99 | return_ACPI_STATUS(status); | ||
100 | } | ||
101 | |||
102 | /* | ||
103 | * Initialize the namespace manager and | ||
104 | * the root of the namespace tree | ||
105 | */ | ||
106 | status = acpi_ns_root_initialize(); | ||
107 | if (ACPI_FAILURE(status)) { | ||
108 | ACPI_EXCEPTION((AE_INFO, status, | ||
109 | "During Namespace initialization")); | ||
110 | return_ACPI_STATUS(status); | ||
111 | } | ||
112 | |||
113 | /* Initialize the global OSI interfaces list with the static names */ | ||
114 | |||
115 | status = acpi_ut_initialize_interfaces(); | ||
116 | if (ACPI_FAILURE(status)) { | ||
117 | ACPI_EXCEPTION((AE_INFO, status, | ||
118 | "During OSI interfaces initialization")); | ||
119 | return_ACPI_STATUS(status); | ||
120 | } | ||
121 | |||
122 | /* If configured, initialize the AML debugger */ | ||
123 | |||
124 | ACPI_DEBUGGER_EXEC(status = acpi_db_initialize()); | ||
125 | return_ACPI_STATUS(status); | ||
126 | } | ||
127 | ACPI_EXPORT_SYMBOL(acpi_initialize_subsystem) | ||
128 | |||
129 | /******************************************************************************* | ||
130 | * | ||
131 | * FUNCTION: acpi_enable_subsystem | ||
132 | * | ||
133 | * PARAMETERS: flags - Init/enable Options | ||
134 | * | ||
135 | * RETURN: Status | ||
136 | * | ||
137 | * DESCRIPTION: Completes the subsystem initialization including hardware. | ||
138 | * Puts system into ACPI mode if it isn't already. | ||
139 | * | ||
140 | ******************************************************************************/ | ||
141 | acpi_status acpi_enable_subsystem(u32 flags) | ||
142 | { | ||
143 | acpi_status status = AE_OK; | ||
144 | |||
145 | ACPI_FUNCTION_TRACE(acpi_enable_subsystem); | ||
146 | |||
147 | #if (!ACPI_REDUCED_HARDWARE) | ||
148 | |||
149 | /* Enable ACPI mode */ | ||
150 | |||
151 | if (!(flags & ACPI_NO_ACPI_ENABLE)) { | ||
152 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
153 | "[Init] Going into ACPI mode\n")); | ||
154 | |||
155 | acpi_gbl_original_mode = acpi_hw_get_mode(); | ||
156 | |||
157 | status = acpi_enable(); | ||
158 | if (ACPI_FAILURE(status)) { | ||
159 | ACPI_WARNING((AE_INFO, "AcpiEnable failed")); | ||
160 | return_ACPI_STATUS(status); | ||
161 | } | ||
162 | } | ||
163 | |||
164 | /* | ||
165 | * Obtain a permanent mapping for the FACS. This is required for the | ||
166 | * Global Lock and the Firmware Waking Vector | ||
167 | */ | ||
168 | status = acpi_tb_initialize_facs(); | ||
169 | if (ACPI_FAILURE(status)) { | ||
170 | ACPI_WARNING((AE_INFO, "Could not map the FACS table")); | ||
171 | return_ACPI_STATUS(status); | ||
172 | } | ||
173 | #endif /* !ACPI_REDUCED_HARDWARE */ | ||
174 | |||
175 | /* | ||
176 | * Install the default op_region handlers. These are installed unless | ||
177 | * other handlers have already been installed via the | ||
178 | * install_address_space_handler interface. | ||
179 | */ | ||
180 | if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { | ||
181 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
182 | "[Init] Installing default address space handlers\n")); | ||
183 | |||
184 | status = acpi_ev_install_region_handlers(); | ||
185 | if (ACPI_FAILURE(status)) { | ||
186 | return_ACPI_STATUS(status); | ||
187 | } | ||
188 | } | ||
189 | #if (!ACPI_REDUCED_HARDWARE) | ||
190 | /* | ||
191 | * Initialize ACPI Event handling (Fixed and General Purpose) | ||
192 | * | ||
193 | * Note1: We must have the hardware and events initialized before we can | ||
194 | * execute any control methods safely. Any control method can require | ||
195 | * ACPI hardware support, so the hardware must be fully initialized before | ||
196 | * any method execution! | ||
197 | * | ||
198 | * Note2: Fixed events are initialized and enabled here. GPEs are | ||
199 | * initialized, but cannot be enabled until after the hardware is | ||
200 | * completely initialized (SCI and global_lock activated) and the various | ||
201 | * initialization control methods are run (_REG, _STA, _INI) on the | ||
202 | * entire namespace. | ||
203 | */ | ||
204 | if (!(flags & ACPI_NO_EVENT_INIT)) { | ||
205 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
206 | "[Init] Initializing ACPI events\n")); | ||
207 | |||
208 | status = acpi_ev_initialize_events(); | ||
209 | if (ACPI_FAILURE(status)) { | ||
210 | return_ACPI_STATUS(status); | ||
211 | } | ||
212 | } | ||
213 | |||
214 | /* | ||
215 | * Install the SCI handler and Global Lock handler. This completes the | ||
216 | * hardware initialization. | ||
217 | */ | ||
218 | if (!(flags & ACPI_NO_HANDLER_INIT)) { | ||
219 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
220 | "[Init] Installing SCI/GL handlers\n")); | ||
221 | |||
222 | status = acpi_ev_install_xrupt_handlers(); | ||
223 | if (ACPI_FAILURE(status)) { | ||
224 | return_ACPI_STATUS(status); | ||
225 | } | ||
226 | } | ||
227 | #endif /* !ACPI_REDUCED_HARDWARE */ | ||
228 | |||
229 | return_ACPI_STATUS(status); | ||
230 | } | ||
231 | ACPI_EXPORT_SYMBOL(acpi_enable_subsystem) | ||
232 | |||
233 | /******************************************************************************* | ||
234 | * | ||
235 | * FUNCTION: acpi_initialize_objects | ||
236 | * | ||
237 | * PARAMETERS: flags - Init/enable Options | ||
238 | * | ||
239 | * RETURN: Status | ||
240 | * | ||
241 | * DESCRIPTION: Completes namespace initialization by initializing device | ||
242 | * objects and executing AML code for Regions, buffers, etc. | ||
243 | * | ||
244 | ******************************************************************************/ | ||
245 | acpi_status acpi_initialize_objects(u32 flags) | ||
246 | { | ||
247 | acpi_status status = AE_OK; | ||
248 | |||
249 | ACPI_FUNCTION_TRACE(acpi_initialize_objects); | ||
250 | |||
251 | /* | ||
252 | * Run all _REG methods | ||
253 | * | ||
254 | * Note: Any objects accessed by the _REG methods will be automatically | ||
255 | * initialized, even if they contain executable AML (see the call to | ||
256 | * acpi_ns_initialize_objects below). | ||
257 | */ | ||
258 | if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { | ||
259 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
260 | "[Init] Executing _REG OpRegion methods\n")); | ||
261 | |||
262 | status = acpi_ev_initialize_op_regions(); | ||
263 | if (ACPI_FAILURE(status)) { | ||
264 | return_ACPI_STATUS(status); | ||
265 | } | ||
266 | } | ||
267 | |||
268 | /* | ||
269 | * Execute any module-level code that was detected during the table load | ||
270 | * phase. Although illegal since ACPI 2.0, there are many machines that | ||
271 | * contain this type of code. Each block of detected executable AML code | ||
272 | * outside of any control method is wrapped with a temporary control | ||
273 | * method object and placed on a global list. The methods on this list | ||
274 | * are executed below. | ||
275 | */ | ||
276 | acpi_ns_exec_module_code_list(); | ||
277 | |||
278 | /* | ||
279 | * Initialize the objects that remain uninitialized. This runs the | ||
280 | * executable AML that may be part of the declaration of these objects: | ||
281 | * operation_regions, buffer_fields, Buffers, and Packages. | ||
282 | */ | ||
283 | if (!(flags & ACPI_NO_OBJECT_INIT)) { | ||
284 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
285 | "[Init] Completing Initialization of ACPI Objects\n")); | ||
286 | |||
287 | status = acpi_ns_initialize_objects(); | ||
288 | if (ACPI_FAILURE(status)) { | ||
289 | return_ACPI_STATUS(status); | ||
290 | } | ||
291 | } | ||
292 | |||
293 | /* | ||
294 | * Initialize all device objects in the namespace. This runs the device | ||
295 | * _STA and _INI methods. | ||
296 | */ | ||
297 | if (!(flags & ACPI_NO_DEVICE_INIT)) { | ||
298 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
299 | "[Init] Initializing ACPI Devices\n")); | ||
300 | |||
301 | status = acpi_ns_initialize_devices(); | ||
302 | if (ACPI_FAILURE(status)) { | ||
303 | return_ACPI_STATUS(status); | ||
304 | } | ||
305 | } | ||
306 | |||
307 | /* | ||
308 | * Empty the caches (delete the cached objects) on the assumption that | ||
309 | * the table load filled them up more than they will be at runtime -- | ||
310 | * thus wasting non-paged memory. | ||
311 | */ | ||
312 | status = acpi_purge_cached_objects(); | ||
313 | |||
314 | acpi_gbl_startup_flags |= ACPI_INITIALIZED_OK; | ||
315 | return_ACPI_STATUS(status); | ||
316 | } | ||
317 | ACPI_EXPORT_SYMBOL(acpi_initialize_objects) | ||
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index e0596954290b..d59175efc428 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -994,8 +994,6 @@ static int __init acpi_bus_init(void) | |||
994 | status = acpi_ec_ecdt_probe(); | 994 | status = acpi_ec_ecdt_probe(); |
995 | /* Ignore result. Not having an ECDT is not fatal. */ | 995 | /* Ignore result. Not having an ECDT is not fatal. */ |
996 | 996 | ||
997 | acpi_bus_osc_support(); | ||
998 | |||
999 | status = acpi_initialize_objects(ACPI_FULL_INITIALIZATION); | 997 | status = acpi_initialize_objects(ACPI_FULL_INITIALIZATION); |
1000 | if (ACPI_FAILURE(status)) { | 998 | if (ACPI_FAILURE(status)) { |
1001 | printk(KERN_ERR PREFIX "Unable to initialize ACPI objects\n"); | 999 | printk(KERN_ERR PREFIX "Unable to initialize ACPI objects\n"); |
@@ -1003,6 +1001,12 @@ static int __init acpi_bus_init(void) | |||
1003 | } | 1001 | } |
1004 | 1002 | ||
1005 | /* | 1003 | /* |
1004 | * _OSC method may exist in module level code, | ||
1005 | * so it must be run after ACPI_FULL_INITIALIZATION | ||
1006 | */ | ||
1007 | acpi_bus_osc_support(); | ||
1008 | |||
1009 | /* | ||
1006 | * _PDC control method may load dynamic SSDT tables, | 1010 | * _PDC control method may load dynamic SSDT tables, |
1007 | * and we need to install the table handler before that. | 1011 | * and we need to install the table handler before that. |
1008 | */ | 1012 | */ |
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 314a3b84bbc7..f0d936b65e37 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
@@ -450,15 +450,4 @@ static int acpi_button_remove(struct acpi_device *device, int type) | |||
450 | return 0; | 450 | return 0; |
451 | } | 451 | } |
452 | 452 | ||
453 | static int __init acpi_button_init(void) | 453 | module_acpi_driver(acpi_button_driver); |
454 | { | ||
455 | return acpi_bus_register_driver(&acpi_button_driver); | ||
456 | } | ||
457 | |||
458 | static void __exit acpi_button_exit(void) | ||
459 | { | ||
460 | acpi_bus_unregister_driver(&acpi_button_driver); | ||
461 | } | ||
462 | |||
463 | module_init(acpi_button_init); | ||
464 | module_exit(acpi_button_exit); | ||
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index bc36a476f1ab..3bd6a54702d6 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c | |||
@@ -212,24 +212,4 @@ static int acpi_fan_resume(struct device *dev) | |||
212 | } | 212 | } |
213 | #endif | 213 | #endif |
214 | 214 | ||
215 | static int __init acpi_fan_init(void) | 215 | module_acpi_driver(acpi_fan_driver); |
216 | { | ||
217 | int result = 0; | ||
218 | |||
219 | result = acpi_bus_register_driver(&acpi_fan_driver); | ||
220 | if (result < 0) | ||
221 | return -ENODEV; | ||
222 | |||
223 | return 0; | ||
224 | } | ||
225 | |||
226 | static void __exit acpi_fan_exit(void) | ||
227 | { | ||
228 | |||
229 | acpi_bus_unregister_driver(&acpi_fan_driver); | ||
230 | |||
231 | return; | ||
232 | } | ||
233 | |||
234 | module_init(acpi_fan_init); | ||
235 | module_exit(acpi_fan_exit); | ||
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index 243ee85e4d2e..d1a2d74033e9 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c | |||
@@ -25,6 +25,8 @@ | |||
25 | static LIST_HEAD(bus_type_list); | 25 | static LIST_HEAD(bus_type_list); |
26 | static DECLARE_RWSEM(bus_type_sem); | 26 | static DECLARE_RWSEM(bus_type_sem); |
27 | 27 | ||
28 | #define PHYSICAL_NODE_STRING "physical_node" | ||
29 | |||
28 | int register_acpi_bus_type(struct acpi_bus_type *type) | 30 | int register_acpi_bus_type(struct acpi_bus_type *type) |
29 | { | 31 | { |
30 | if (acpi_disabled) | 32 | if (acpi_disabled) |
@@ -124,84 +126,119 @@ acpi_handle acpi_get_child(acpi_handle parent, u64 address) | |||
124 | 126 | ||
125 | EXPORT_SYMBOL(acpi_get_child); | 127 | EXPORT_SYMBOL(acpi_get_child); |
126 | 128 | ||
127 | /* Link ACPI devices with physical devices */ | ||
128 | static void acpi_glue_data_handler(acpi_handle handle, | ||
129 | void *context) | ||
130 | { | ||
131 | /* we provide an empty handler */ | ||
132 | } | ||
133 | |||
134 | /* Note: a success call will increase reference count by one */ | ||
135 | struct device *acpi_get_physical_device(acpi_handle handle) | ||
136 | { | ||
137 | acpi_status status; | ||
138 | struct device *dev; | ||
139 | |||
140 | status = acpi_get_data(handle, acpi_glue_data_handler, (void **)&dev); | ||
141 | if (ACPI_SUCCESS(status)) | ||
142 | return get_device(dev); | ||
143 | return NULL; | ||
144 | } | ||
145 | |||
146 | EXPORT_SYMBOL(acpi_get_physical_device); | ||
147 | |||
148 | static int acpi_bind_one(struct device *dev, acpi_handle handle) | 129 | static int acpi_bind_one(struct device *dev, acpi_handle handle) |
149 | { | 130 | { |
150 | struct acpi_device *acpi_dev; | 131 | struct acpi_device *acpi_dev; |
151 | acpi_status status; | 132 | acpi_status status; |
133 | struct acpi_device_physical_node *physical_node; | ||
134 | char physical_node_name[sizeof(PHYSICAL_NODE_STRING) + 2]; | ||
135 | int retval = -EINVAL; | ||
152 | 136 | ||
153 | if (dev->archdata.acpi_handle) { | 137 | if (dev->archdata.acpi_handle) { |
154 | dev_warn(dev, "Drivers changed 'acpi_handle'\n"); | 138 | dev_warn(dev, "Drivers changed 'acpi_handle'\n"); |
155 | return -EINVAL; | 139 | return -EINVAL; |
156 | } | 140 | } |
141 | |||
157 | get_device(dev); | 142 | get_device(dev); |
158 | status = acpi_attach_data(handle, acpi_glue_data_handler, dev); | 143 | status = acpi_bus_get_device(handle, &acpi_dev); |
159 | if (ACPI_FAILURE(status)) { | 144 | if (ACPI_FAILURE(status)) |
160 | put_device(dev); | 145 | goto err; |
161 | return -EINVAL; | 146 | |
147 | physical_node = kzalloc(sizeof(struct acpi_device_physical_node), | ||
148 | GFP_KERNEL); | ||
149 | if (!physical_node) { | ||
150 | retval = -ENOMEM; | ||
151 | goto err; | ||
162 | } | 152 | } |
163 | dev->archdata.acpi_handle = handle; | ||
164 | 153 | ||
165 | status = acpi_bus_get_device(handle, &acpi_dev); | 154 | mutex_lock(&acpi_dev->physical_node_lock); |
166 | if (!ACPI_FAILURE(status)) { | 155 | /* allocate physical node id according to physical_node_id_bitmap */ |
167 | int ret; | 156 | physical_node->node_id = |
168 | 157 | find_first_zero_bit(acpi_dev->physical_node_id_bitmap, | |
169 | ret = sysfs_create_link(&dev->kobj, &acpi_dev->dev.kobj, | 158 | ACPI_MAX_PHYSICAL_NODE); |
170 | "firmware_node"); | 159 | if (physical_node->node_id >= ACPI_MAX_PHYSICAL_NODE) { |
171 | ret = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj, | 160 | retval = -ENOSPC; |
172 | "physical_node"); | 161 | mutex_unlock(&acpi_dev->physical_node_lock); |
173 | if (acpi_dev->wakeup.flags.valid) | 162 | goto err; |
174 | device_set_wakeup_capable(dev, true); | ||
175 | } | 163 | } |
176 | 164 | ||
165 | set_bit(physical_node->node_id, acpi_dev->physical_node_id_bitmap); | ||
166 | physical_node->dev = dev; | ||
167 | list_add_tail(&physical_node->node, &acpi_dev->physical_node_list); | ||
168 | acpi_dev->physical_node_count++; | ||
169 | mutex_unlock(&acpi_dev->physical_node_lock); | ||
170 | |||
171 | dev->archdata.acpi_handle = handle; | ||
172 | |||
173 | if (!physical_node->node_id) | ||
174 | strcpy(physical_node_name, PHYSICAL_NODE_STRING); | ||
175 | else | ||
176 | sprintf(physical_node_name, | ||
177 | "physical_node%d", physical_node->node_id); | ||
178 | retval = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj, | ||
179 | physical_node_name); | ||
180 | retval = sysfs_create_link(&dev->kobj, &acpi_dev->dev.kobj, | ||
181 | "firmware_node"); | ||
182 | |||
183 | if (acpi_dev->wakeup.flags.valid) | ||
184 | device_set_wakeup_capable(dev, true); | ||
185 | |||
177 | return 0; | 186 | return 0; |
187 | |||
188 | err: | ||
189 | put_device(dev); | ||
190 | return retval; | ||
178 | } | 191 | } |
179 | 192 | ||
180 | static int acpi_unbind_one(struct device *dev) | 193 | static int acpi_unbind_one(struct device *dev) |
181 | { | 194 | { |
195 | struct acpi_device_physical_node *entry; | ||
196 | struct acpi_device *acpi_dev; | ||
197 | acpi_status status; | ||
198 | struct list_head *node, *next; | ||
199 | |||
182 | if (!dev->archdata.acpi_handle) | 200 | if (!dev->archdata.acpi_handle) |
183 | return 0; | 201 | return 0; |
184 | if (dev == acpi_get_physical_device(dev->archdata.acpi_handle)) { | ||
185 | struct acpi_device *acpi_dev; | ||
186 | 202 | ||
187 | /* acpi_get_physical_device increase refcnt by one */ | 203 | status = acpi_bus_get_device(dev->archdata.acpi_handle, |
188 | put_device(dev); | 204 | &acpi_dev); |
205 | if (ACPI_FAILURE(status)) | ||
206 | goto err; | ||
189 | 207 | ||
190 | if (!acpi_bus_get_device(dev->archdata.acpi_handle, | 208 | mutex_lock(&acpi_dev->physical_node_lock); |
191 | &acpi_dev)) { | 209 | list_for_each_safe(node, next, &acpi_dev->physical_node_list) { |
192 | sysfs_remove_link(&dev->kobj, "firmware_node"); | 210 | char physical_node_name[sizeof(PHYSICAL_NODE_STRING) + 2]; |
193 | sysfs_remove_link(&acpi_dev->dev.kobj, "physical_node"); | 211 | |
194 | } | 212 | entry = list_entry(node, struct acpi_device_physical_node, |
213 | node); | ||
214 | if (entry->dev != dev) | ||
215 | continue; | ||
216 | |||
217 | list_del(node); | ||
218 | clear_bit(entry->node_id, acpi_dev->physical_node_id_bitmap); | ||
195 | 219 | ||
196 | acpi_detach_data(dev->archdata.acpi_handle, | 220 | acpi_dev->physical_node_count--; |
197 | acpi_glue_data_handler); | 221 | |
222 | if (!entry->node_id) | ||
223 | strcpy(physical_node_name, PHYSICAL_NODE_STRING); | ||
224 | else | ||
225 | sprintf(physical_node_name, | ||
226 | "physical_node%d", entry->node_id); | ||
227 | |||
228 | sysfs_remove_link(&acpi_dev->dev.kobj, physical_node_name); | ||
229 | sysfs_remove_link(&dev->kobj, "firmware_node"); | ||
198 | dev->archdata.acpi_handle = NULL; | 230 | dev->archdata.acpi_handle = NULL; |
199 | /* acpi_bind_one increase refcnt by one */ | 231 | /* acpi_bind_one increase refcnt by one */ |
200 | put_device(dev); | 232 | put_device(dev); |
201 | } else { | 233 | kfree(entry); |
202 | dev_err(dev, "Oops, 'acpi_handle' corrupt\n"); | ||
203 | } | 234 | } |
235 | mutex_unlock(&acpi_dev->physical_node_lock); | ||
236 | |||
204 | return 0; | 237 | return 0; |
238 | |||
239 | err: | ||
240 | dev_err(dev, "Oops, 'acpi_handle' corrupt\n"); | ||
241 | return -EINVAL; | ||
205 | } | 242 | } |
206 | 243 | ||
207 | static int acpi_platform_notify(struct device *dev) | 244 | static int acpi_platform_notify(struct device *dev) |
diff --git a/drivers/acpi/hed.c b/drivers/acpi/hed.c index d0c1967f7597..20a0f2c3ca3b 100644 --- a/drivers/acpi/hed.c +++ b/drivers/acpi/hed.c | |||
@@ -86,25 +86,7 @@ static struct acpi_driver acpi_hed_driver = { | |||
86 | .notify = acpi_hed_notify, | 86 | .notify = acpi_hed_notify, |
87 | }, | 87 | }, |
88 | }; | 88 | }; |
89 | 89 | module_acpi_driver(acpi_hed_driver); | |
90 | static int __init acpi_hed_init(void) | ||
91 | { | ||
92 | if (acpi_disabled) | ||
93 | return -ENODEV; | ||
94 | |||
95 | if (acpi_bus_register_driver(&acpi_hed_driver) < 0) | ||
96 | return -ENODEV; | ||
97 | |||
98 | return 0; | ||
99 | } | ||
100 | |||
101 | static void __exit acpi_hed_exit(void) | ||
102 | { | ||
103 | acpi_bus_unregister_driver(&acpi_hed_driver); | ||
104 | } | ||
105 | |||
106 | module_init(acpi_hed_init); | ||
107 | module_exit(acpi_hed_exit); | ||
108 | 90 | ||
109 | ACPI_MODULE_NAME("hed"); | 91 | ACPI_MODULE_NAME("hed"); |
110 | MODULE_AUTHOR("Huang Ying"); | 92 | MODULE_AUTHOR("Huang Ying"); |
diff --git a/drivers/acpi/proc.c b/drivers/acpi/proc.c index 251c7b6273a9..27adb090bb30 100644 --- a/drivers/acpi/proc.c +++ b/drivers/acpi/proc.c | |||
@@ -302,26 +302,41 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset) | |||
302 | list_for_each_safe(node, next, &acpi_wakeup_device_list) { | 302 | list_for_each_safe(node, next, &acpi_wakeup_device_list) { |
303 | struct acpi_device *dev = | 303 | struct acpi_device *dev = |
304 | container_of(node, struct acpi_device, wakeup_list); | 304 | container_of(node, struct acpi_device, wakeup_list); |
305 | struct device *ldev; | 305 | struct acpi_device_physical_node *entry; |
306 | 306 | ||
307 | if (!dev->wakeup.flags.valid) | 307 | if (!dev->wakeup.flags.valid) |
308 | continue; | 308 | continue; |
309 | 309 | ||
310 | ldev = acpi_get_physical_device(dev->handle); | 310 | seq_printf(seq, "%s\t S%d\t", |
311 | seq_printf(seq, "%s\t S%d\t%c%-8s ", | ||
312 | dev->pnp.bus_id, | 311 | dev->pnp.bus_id, |
313 | (u32) dev->wakeup.sleep_state, | 312 | (u32) dev->wakeup.sleep_state); |
314 | dev->wakeup.flags.run_wake ? '*' : ' ', | 313 | |
315 | (device_may_wakeup(&dev->dev) | 314 | if (!dev->physical_node_count) |
316 | || (ldev && device_may_wakeup(ldev))) ? | 315 | seq_printf(seq, "%c%-8s\n", |
317 | "enabled" : "disabled"); | 316 | dev->wakeup.flags.run_wake ? |
318 | if (ldev) | 317 | '*' : ' ', "disabled"); |
319 | seq_printf(seq, "%s:%s", | 318 | else { |
320 | ldev->bus ? ldev->bus->name : "no-bus", | 319 | struct device *ldev; |
321 | dev_name(ldev)); | 320 | list_for_each_entry(entry, &dev->physical_node_list, |
322 | seq_printf(seq, "\n"); | 321 | node) { |
323 | put_device(ldev); | 322 | ldev = get_device(entry->dev); |
324 | 323 | if (!ldev) | |
324 | continue; | ||
325 | |||
326 | if (&entry->node != | ||
327 | dev->physical_node_list.next) | ||
328 | seq_printf(seq, "\t\t"); | ||
329 | |||
330 | seq_printf(seq, "%c%-8s %s:%s\n", | ||
331 | dev->wakeup.flags.run_wake ? '*' : ' ', | ||
332 | (device_may_wakeup(&dev->dev) || | ||
333 | (ldev && device_may_wakeup(ldev))) ? | ||
334 | "enabled" : "disabled", | ||
335 | ldev->bus ? ldev->bus->name : | ||
336 | "no-bus", dev_name(ldev)); | ||
337 | put_device(ldev); | ||
338 | } | ||
339 | } | ||
325 | } | 340 | } |
326 | mutex_unlock(&acpi_device_lock); | 341 | mutex_unlock(&acpi_device_lock); |
327 | return 0; | 342 | return 0; |
@@ -329,12 +344,14 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset) | |||
329 | 344 | ||
330 | static void physical_device_enable_wakeup(struct acpi_device *adev) | 345 | static void physical_device_enable_wakeup(struct acpi_device *adev) |
331 | { | 346 | { |
332 | struct device *dev = acpi_get_physical_device(adev->handle); | 347 | struct acpi_device_physical_node *entry; |
333 | 348 | ||
334 | if (dev && device_can_wakeup(dev)) { | 349 | list_for_each_entry(entry, |
335 | bool enable = !device_may_wakeup(dev); | 350 | &adev->physical_node_list, node) |
336 | device_set_wakeup_enable(dev, enable); | 351 | if (entry->dev && device_can_wakeup(entry->dev)) { |
337 | } | 352 | bool enable = !device_may_wakeup(entry->dev); |
353 | device_set_wakeup_enable(entry->dev, enable); | ||
354 | } | ||
338 | } | 355 | } |
339 | 356 | ||
340 | static ssize_t | 357 | static ssize_t |
diff --git a/drivers/acpi/sbshc.c b/drivers/acpi/sbshc.c index f8d2a472795c..cf6129a8af7c 100644 --- a/drivers/acpi/sbshc.c +++ b/drivers/acpi/sbshc.c | |||
@@ -310,23 +310,7 @@ static int acpi_smbus_hc_remove(struct acpi_device *device, int type) | |||
310 | return 0; | 310 | return 0; |
311 | } | 311 | } |
312 | 312 | ||
313 | static int __init acpi_smb_hc_init(void) | 313 | module_acpi_driver(acpi_smb_hc_driver); |
314 | { | ||
315 | int result; | ||
316 | |||
317 | result = acpi_bus_register_driver(&acpi_smb_hc_driver); | ||
318 | if (result < 0) | ||
319 | return -ENODEV; | ||
320 | return 0; | ||
321 | } | ||
322 | |||
323 | static void __exit acpi_smb_hc_exit(void) | ||
324 | { | ||
325 | acpi_bus_unregister_driver(&acpi_smb_hc_driver); | ||
326 | } | ||
327 | |||
328 | module_init(acpi_smb_hc_init); | ||
329 | module_exit(acpi_smb_hc_exit); | ||
330 | 314 | ||
331 | MODULE_LICENSE("GPL"); | 315 | MODULE_LICENSE("GPL"); |
332 | MODULE_AUTHOR("Alexey Starikovskiy"); | 316 | MODULE_AUTHOR("Alexey Starikovskiy"); |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index d1ecca2b641a..1fcb8678665c 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/signal.h> | 10 | #include <linux/signal.h> |
11 | #include <linux/kthread.h> | 11 | #include <linux/kthread.h> |
12 | #include <linux/dmi.h> | 12 | #include <linux/dmi.h> |
13 | #include <linux/nls.h> | ||
13 | 14 | ||
14 | #include <acpi/acpi_drivers.h> | 15 | #include <acpi/acpi_drivers.h> |
15 | 16 | ||
@@ -232,8 +233,35 @@ end: | |||
232 | } | 233 | } |
233 | static DEVICE_ATTR(path, 0444, acpi_device_path_show, NULL); | 234 | static DEVICE_ATTR(path, 0444, acpi_device_path_show, NULL); |
234 | 235 | ||
236 | /* sysfs file that shows description text from the ACPI _STR method */ | ||
237 | static ssize_t description_show(struct device *dev, | ||
238 | struct device_attribute *attr, | ||
239 | char *buf) { | ||
240 | struct acpi_device *acpi_dev = to_acpi_device(dev); | ||
241 | int result; | ||
242 | |||
243 | if (acpi_dev->pnp.str_obj == NULL) | ||
244 | return 0; | ||
245 | |||
246 | /* | ||
247 | * The _STR object contains a Unicode identifier for a device. | ||
248 | * We need to convert to utf-8 so it can be displayed. | ||
249 | */ | ||
250 | result = utf16s_to_utf8s( | ||
251 | (wchar_t *)acpi_dev->pnp.str_obj->buffer.pointer, | ||
252 | acpi_dev->pnp.str_obj->buffer.length, | ||
253 | UTF16_LITTLE_ENDIAN, buf, | ||
254 | PAGE_SIZE); | ||
255 | |||
256 | buf[result++] = '\n'; | ||
257 | |||
258 | return result; | ||
259 | } | ||
260 | static DEVICE_ATTR(description, 0444, description_show, NULL); | ||
261 | |||
235 | static int acpi_device_setup_files(struct acpi_device *dev) | 262 | static int acpi_device_setup_files(struct acpi_device *dev) |
236 | { | 263 | { |
264 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; | ||
237 | acpi_status status; | 265 | acpi_status status; |
238 | acpi_handle temp; | 266 | acpi_handle temp; |
239 | int result = 0; | 267 | int result = 0; |
@@ -257,6 +285,21 @@ static int acpi_device_setup_files(struct acpi_device *dev) | |||
257 | goto end; | 285 | goto end; |
258 | } | 286 | } |
259 | 287 | ||
288 | /* | ||
289 | * If device has _STR, 'description' file is created | ||
290 | */ | ||
291 | status = acpi_get_handle(dev->handle, "_STR", &temp); | ||
292 | if (ACPI_SUCCESS(status)) { | ||
293 | status = acpi_evaluate_object(dev->handle, "_STR", | ||
294 | NULL, &buffer); | ||
295 | if (ACPI_FAILURE(status)) | ||
296 | buffer.pointer = NULL; | ||
297 | dev->pnp.str_obj = buffer.pointer; | ||
298 | result = device_create_file(&dev->dev, &dev_attr_description); | ||
299 | if (result) | ||
300 | goto end; | ||
301 | } | ||
302 | |||
260 | /* | 303 | /* |
261 | * If device has _EJ0, 'eject' file is created that is used to trigger | 304 | * If device has _EJ0, 'eject' file is created that is used to trigger |
262 | * hot-removal function from userland. | 305 | * hot-removal function from userland. |
@@ -274,8 +317,15 @@ static void acpi_device_remove_files(struct acpi_device *dev) | |||
274 | acpi_handle temp; | 317 | acpi_handle temp; |
275 | 318 | ||
276 | /* | 319 | /* |
277 | * If device has _EJ0, 'eject' file is created that is used to trigger | 320 | * If device has _STR, remove 'description' file |
278 | * hot-removal function from userland. | 321 | */ |
322 | status = acpi_get_handle(dev->handle, "_STR", &temp); | ||
323 | if (ACPI_SUCCESS(status)) { | ||
324 | kfree(dev->pnp.str_obj); | ||
325 | device_remove_file(&dev->dev, &dev_attr_description); | ||
326 | } | ||
327 | /* | ||
328 | * If device has _EJ0, remove 'eject' file. | ||
279 | */ | 329 | */ |
280 | status = acpi_get_handle(dev->handle, "_EJ0", &temp); | 330 | status = acpi_get_handle(dev->handle, "_EJ0", &temp); |
281 | if (ACPI_SUCCESS(status)) | 331 | if (ACPI_SUCCESS(status)) |
@@ -481,6 +531,8 @@ static int acpi_device_register(struct acpi_device *device) | |||
481 | INIT_LIST_HEAD(&device->children); | 531 | INIT_LIST_HEAD(&device->children); |
482 | INIT_LIST_HEAD(&device->node); | 532 | INIT_LIST_HEAD(&device->node); |
483 | INIT_LIST_HEAD(&device->wakeup_list); | 533 | INIT_LIST_HEAD(&device->wakeup_list); |
534 | INIT_LIST_HEAD(&device->physical_node_list); | ||
535 | mutex_init(&device->physical_node_lock); | ||
484 | 536 | ||
485 | new_bus_id = kzalloc(sizeof(struct acpi_device_bus_id), GFP_KERNEL); | 537 | new_bus_id = kzalloc(sizeof(struct acpi_device_bus_id), GFP_KERNEL); |
486 | if (!new_bus_id) { | 538 | if (!new_bus_id) { |
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c index f336bca7c450..2572d9715bda 100644 --- a/drivers/acpi/tables.c +++ b/drivers/acpi/tables.c | |||
@@ -240,10 +240,17 @@ acpi_table_parse_entries(char *id, | |||
240 | table_end) { | 240 | table_end) { |
241 | if (entry->type == entry_id | 241 | if (entry->type == entry_id |
242 | && (!max_entries || count++ < max_entries)) | 242 | && (!max_entries || count++ < max_entries)) |
243 | if (handler(entry, table_end)) { | 243 | if (handler(entry, table_end)) |
244 | early_acpi_os_unmap_memory((char *)table_header, tbl_size); | 244 | goto err; |
245 | return -EINVAL; | 245 | |
246 | } | 246 | /* |
247 | * If entry->length is 0, break from this loop to avoid | ||
248 | * infinite loop. | ||
249 | */ | ||
250 | if (entry->length == 0) { | ||
251 | pr_err(PREFIX "[%4.4s:0x%02x] Invalid zero length\n", id, entry_id); | ||
252 | goto err; | ||
253 | } | ||
247 | 254 | ||
248 | entry = (struct acpi_subtable_header *) | 255 | entry = (struct acpi_subtable_header *) |
249 | ((unsigned long)entry + entry->length); | 256 | ((unsigned long)entry + entry->length); |
@@ -255,6 +262,9 @@ acpi_table_parse_entries(char *id, | |||
255 | 262 | ||
256 | early_acpi_os_unmap_memory((char *)table_header, tbl_size); | 263 | early_acpi_os_unmap_memory((char *)table_header, tbl_size); |
257 | return count; | 264 | return count; |
265 | err: | ||
266 | early_acpi_os_unmap_memory((char *)table_header, tbl_size); | ||
267 | return -EINVAL; | ||
258 | } | 268 | } |
259 | 269 | ||
260 | int __init | 270 | int __init |
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 3e87c9c538aa..462f7e300363 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c | |||
@@ -384,7 +384,7 @@ acpi_evaluate_reference(acpi_handle handle, | |||
384 | EXPORT_SYMBOL(acpi_evaluate_reference); | 384 | EXPORT_SYMBOL(acpi_evaluate_reference); |
385 | 385 | ||
386 | acpi_status | 386 | acpi_status |
387 | acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld *pld) | 387 | acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld) |
388 | { | 388 | { |
389 | acpi_status status; | 389 | acpi_status status; |
390 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 390 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
@@ -400,13 +400,16 @@ acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld *pld) | |||
400 | if (!output || output->type != ACPI_TYPE_PACKAGE | 400 | if (!output || output->type != ACPI_TYPE_PACKAGE |
401 | || !output->package.count | 401 | || !output->package.count |
402 | || output->package.elements[0].type != ACPI_TYPE_BUFFER | 402 | || output->package.elements[0].type != ACPI_TYPE_BUFFER |
403 | || output->package.elements[0].buffer.length > sizeof(*pld)) { | 403 | || output->package.elements[0].buffer.length < ACPI_PLD_REV1_BUFFER_SIZE) { |
404 | status = AE_TYPE; | 404 | status = AE_TYPE; |
405 | goto out; | 405 | goto out; |
406 | } | 406 | } |
407 | 407 | ||
408 | memcpy(pld, output->package.elements[0].buffer.pointer, | 408 | status = acpi_decode_pld_buffer( |
409 | output->package.elements[0].buffer.length); | 409 | output->package.elements[0].buffer.pointer, |
410 | output->package.elements[0].buffer.length, | ||
411 | pld); | ||
412 | |||
410 | out: | 413 | out: |
411 | kfree(buffer.pointer); | 414 | kfree(buffer.pointer); |
412 | return status; | 415 | return status; |