diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-16 14:24:23 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-16 14:24:23 -0400 |
commit | 9bd47bf9324d4c6a49292d98019938b04791a35d (patch) | |
tree | 1788cb8c185366459658b49381be2ee2b87816ed | |
parent | 46a50661fc95d4acf5e4c203f7889234238ce642 (diff) | |
parent | d6a1cd4975a5ffaa21a961be04a469519edf50d6 (diff) |
Merge branch 'acpica' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
* 'acpica' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (27 commits)
ACPICA: Update version to 20090521.
ACPICA: Disable preservation of SCI enable bit (SCI_EN)
ACPICA: Region deletion: Ensure region object is removed from handler list
ACPICA: Eliminate extra call to NsGetParentNode
ACPICA: Simplify internal operation region interface
ACPICA: Update Load() to use operation region interfaces
ACPICA: New: AcpiInstallMethod - install a single control method
ACPICA: Invalidate DdbHandle after table unload
ACPICA: Fix reference count issues for DdbHandle object
ACPICA: Simplify and optimize NsGetNextNode function
ACPICA: Additional validation of _PRT packages (resource mgr)
ACPICA: Fix DebugObject output for DdbHandle objects
ACPICA: Fix allowable release order for ASL mutex objects
ACPICA: Mutex support: Fix release ordering issue and current sync level
ACPICA: Update version to 20090422.
ACPICA: Linux OSL: cleanup/update/merge
ACPICA: Fix implementation of AML BreakPoint operator (break to debugger)
ACPICA: Fix miscellaneous warnings under gcc 4+
ACPICA: Miscellaneous lint changes
ACPICA: Fix possible dereference of null pointer
...
38 files changed, 571 insertions, 198 deletions
diff --git a/drivers/acpi/acpica/acevents.h b/drivers/acpi/acpica/acevents.h index 07e20135f01b..0bba148a2c61 100644 --- a/drivers/acpi/acpica/acevents.h +++ b/drivers/acpi/acpica/acevents.h | |||
@@ -139,7 +139,7 @@ acpi_status acpi_ev_initialize_op_regions(void); | |||
139 | acpi_status | 139 | acpi_status |
140 | acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | 140 | acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, |
141 | u32 function, | 141 | u32 function, |
142 | acpi_physical_address address, | 142 | u32 region_offset, |
143 | u32 bit_width, acpi_integer * value); | 143 | u32 bit_width, acpi_integer * value); |
144 | 144 | ||
145 | acpi_status | 145 | acpi_status |
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h index 16e5210ae936..3d87362d17ed 100644 --- a/drivers/acpi/acpica/acglobal.h +++ b/drivers/acpi/acpica/acglobal.h | |||
@@ -362,9 +362,6 @@ extern u8 acpi_gbl_method_executing; | |||
362 | extern u8 acpi_gbl_abort_method; | 362 | extern u8 acpi_gbl_abort_method; |
363 | extern u8 acpi_gbl_db_terminate_threads; | 363 | extern u8 acpi_gbl_db_terminate_threads; |
364 | 364 | ||
365 | ACPI_EXTERN int optind; | ||
366 | ACPI_EXTERN char *optarg; | ||
367 | |||
368 | ACPI_EXTERN u8 acpi_gbl_db_opt_tables; | 365 | ACPI_EXTERN u8 acpi_gbl_db_opt_tables; |
369 | ACPI_EXTERN u8 acpi_gbl_db_opt_stats; | 366 | ACPI_EXTERN u8 acpi_gbl_db_opt_stats; |
370 | ACPI_EXTERN u8 acpi_gbl_db_opt_ini_methods; | 367 | ACPI_EXTERN u8 acpi_gbl_db_opt_ini_methods; |
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h index 2ec394a328e9..ee986edfa0da 100644 --- a/drivers/acpi/acpica/aclocal.h +++ b/drivers/acpi/acpica/aclocal.h | |||
@@ -205,6 +205,7 @@ struct acpi_namespace_node { | |||
205 | #define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */ | 205 | #define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */ |
206 | #define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */ | 206 | #define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */ |
207 | #define ANOBJ_EVALUATED 0x20 /* Set on first evaluation of node */ | 207 | #define ANOBJ_EVALUATED 0x20 /* Set on first evaluation of node */ |
208 | #define ANOBJ_ALLOCATED_BUFFER 0x40 /* Method AML buffer is dynamic (install_method) */ | ||
208 | 209 | ||
209 | #define ANOBJ_IS_EXTERNAL 0x08 /* i_aSL only: This object created via External() */ | 210 | #define ANOBJ_IS_EXTERNAL 0x08 /* i_aSL only: This object created via External() */ |
210 | #define ANOBJ_METHOD_NO_RETVAL 0x10 /* i_aSL only: Method has no return value */ | 211 | #define ANOBJ_METHOD_NO_RETVAL 0x10 /* i_aSL only: Method has no return value */ |
@@ -788,11 +789,14 @@ struct acpi_bit_register_info { | |||
788 | /* For control registers, both ignored and reserved bits must be preserved */ | 789 | /* For control registers, both ignored and reserved bits must be preserved */ |
789 | 790 | ||
790 | /* | 791 | /* |
791 | * The ACPI spec says to ignore PM1_CTL.SCI_EN (bit 0) | 792 | * For PM1 control, the SCI enable bit (bit 0, SCI_EN) is defined by the |
792 | * but we need to be able to write ACPI_BITREG_SCI_ENABLE directly | 793 | * ACPI specification to be a "preserved" bit - "OSPM always preserves this |
793 | * as a BIOS workaround on some machines. | 794 | * bit position", section 4.7.3.2.1. However, on some machines the OS must |
795 | * write a one to this bit after resume for the machine to work properly. | ||
796 | * To enable this, we no longer attempt to preserve this bit. No machines | ||
797 | * are known to fail if the bit is not preserved. (May 2009) | ||
794 | */ | 798 | */ |
795 | #define ACPI_PM1_CONTROL_IGNORED_BITS 0x0200 /* Bits 9 */ | 799 | #define ACPI_PM1_CONTROL_IGNORED_BITS 0x0200 /* Bit 9 */ |
796 | #define ACPI_PM1_CONTROL_RESERVED_BITS 0xC1F8 /* Bits 14-15, 3-8 */ | 800 | #define ACPI_PM1_CONTROL_RESERVED_BITS 0xC1F8 /* Bits 14-15, 3-8 */ |
797 | #define ACPI_PM1_CONTROL_PRESERVED_BITS \ | 801 | #define ACPI_PM1_CONTROL_PRESERVED_BITS \ |
798 | (ACPI_PM1_CONTROL_IGNORED_BITS | ACPI_PM1_CONTROL_RESERVED_BITS) | 802 | (ACPI_PM1_CONTROL_IGNORED_BITS | ACPI_PM1_CONTROL_RESERVED_BITS) |
diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h index 46cb5b46d280..94cdc2b8cb93 100644 --- a/drivers/acpi/acpica/acnamesp.h +++ b/drivers/acpi/acpica/acnamesp.h | |||
@@ -99,10 +99,19 @@ acpi_ns_walk_namespace(acpi_object_type type, | |||
99 | acpi_walk_callback user_function, | 99 | acpi_walk_callback user_function, |
100 | void *context, void **return_value); | 100 | void *context, void **return_value); |
101 | 101 | ||
102 | struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, struct acpi_namespace_node | 102 | struct acpi_namespace_node *acpi_ns_get_next_node(struct acpi_namespace_node |
103 | *parent, struct acpi_namespace_node | 103 | *parent, |
104 | struct acpi_namespace_node | ||
104 | *child); | 105 | *child); |
105 | 106 | ||
107 | struct acpi_namespace_node *acpi_ns_get_next_node_typed(acpi_object_type type, | ||
108 | struct | ||
109 | acpi_namespace_node | ||
110 | *parent, | ||
111 | struct | ||
112 | acpi_namespace_node | ||
113 | *child); | ||
114 | |||
106 | /* | 115 | /* |
107 | * nsparse - table parsing | 116 | * nsparse - table parsing |
108 | */ | 117 | */ |
diff --git a/drivers/acpi/acpica/amlcode.h b/drivers/acpi/acpica/amlcode.h index ff851c5df698..067f967eb389 100644 --- a/drivers/acpi/acpica/amlcode.h +++ b/drivers/acpi/acpica/amlcode.h | |||
@@ -483,7 +483,7 @@ typedef enum { | |||
483 | 483 | ||
484 | #define AML_METHOD_ARG_COUNT 0x07 | 484 | #define AML_METHOD_ARG_COUNT 0x07 |
485 | #define AML_METHOD_SERIALIZED 0x08 | 485 | #define AML_METHOD_SERIALIZED 0x08 |
486 | #define AML_METHOD_SYNCH_LEVEL 0xF0 | 486 | #define AML_METHOD_SYNC_LEVEL 0xF0 |
487 | 487 | ||
488 | /* METHOD_FLAGS_ARG_COUNT is not used internally, define additional flags */ | 488 | /* METHOD_FLAGS_ARG_COUNT is not used internally, define additional flags */ |
489 | 489 | ||
diff --git a/drivers/acpi/acpica/dsobject.c b/drivers/acpi/acpica/dsobject.c index dab3f48f0b42..02e6caad4a76 100644 --- a/drivers/acpi/acpica/dsobject.c +++ b/drivers/acpi/acpica/dsobject.c | |||
@@ -734,7 +734,8 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, | |||
734 | 734 | ||
735 | /* Local ID (0-7) is (AML opcode - base AML_LOCAL_OP) */ | 735 | /* Local ID (0-7) is (AML opcode - base AML_LOCAL_OP) */ |
736 | 736 | ||
737 | obj_desc->reference.value = opcode - AML_LOCAL_OP; | 737 | obj_desc->reference.value = |
738 | ((u32)opcode) - AML_LOCAL_OP; | ||
738 | obj_desc->reference.class = ACPI_REFCLASS_LOCAL; | 739 | obj_desc->reference.class = ACPI_REFCLASS_LOCAL; |
739 | 740 | ||
740 | #ifndef ACPI_NO_METHOD_EXECUTION | 741 | #ifndef ACPI_NO_METHOD_EXECUTION |
@@ -754,7 +755,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, | |||
754 | 755 | ||
755 | /* Arg ID (0-6) is (AML opcode - base AML_ARG_OP) */ | 756 | /* Arg ID (0-6) is (AML opcode - base AML_ARG_OP) */ |
756 | 757 | ||
757 | obj_desc->reference.value = opcode - AML_ARG_OP; | 758 | obj_desc->reference.value = ((u32)opcode) - AML_ARG_OP; |
758 | obj_desc->reference.class = ACPI_REFCLASS_ARG; | 759 | obj_desc->reference.class = ACPI_REFCLASS_ARG; |
759 | 760 | ||
760 | #ifndef ACPI_NO_METHOD_EXECUTION | 761 | #ifndef ACPI_NO_METHOD_EXECUTION |
diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c index b4c87b5053e6..584d766e6f12 100644 --- a/drivers/acpi/acpica/dsopcode.c +++ b/drivers/acpi/acpica/dsopcode.c | |||
@@ -1386,14 +1386,19 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, | |||
1386 | 1386 | ||
1387 | case AML_BREAK_POINT_OP: | 1387 | case AML_BREAK_POINT_OP: |
1388 | 1388 | ||
1389 | /* Call up to the OS service layer to handle this */ | 1389 | /* |
1390 | 1390 | * Set the single-step flag. This will cause the debugger (if present) | |
1391 | status = | 1391 | * to break to the console within the AML debugger at the start of the |
1392 | acpi_os_signal(ACPI_SIGNAL_BREAKPOINT, | 1392 | * next AML instruction. |
1393 | "Executed AML Breakpoint opcode"); | 1393 | */ |
1394 | ACPI_DEBUGGER_EXEC(acpi_gbl_cm_single_step = TRUE); | ||
1395 | ACPI_DEBUGGER_EXEC(acpi_os_printf | ||
1396 | ("**break** Executed AML BreakPoint opcode\n")); | ||
1394 | 1397 | ||
1395 | /* If and when it returns, all done. */ | 1398 | /* Call to the OSL in case OS wants a piece of the action */ |
1396 | 1399 | ||
1400 | status = acpi_os_signal(ACPI_SIGNAL_BREAKPOINT, | ||
1401 | "Executed AML Breakpoint opcode"); | ||
1397 | break; | 1402 | break; |
1398 | 1403 | ||
1399 | case AML_BREAK_OP: | 1404 | case AML_BREAK_OP: |
diff --git a/drivers/acpi/acpica/dswstate.c b/drivers/acpi/acpica/dswstate.c index 40f92bf7dce5..e46c821cf572 100644 --- a/drivers/acpi/acpica/dswstate.c +++ b/drivers/acpi/acpica/dswstate.c | |||
@@ -102,7 +102,7 @@ acpi_ds_result_pop(union acpi_operand_object **object, | |||
102 | /* Return object of the top element and clean that top element result stack */ | 102 | /* Return object of the top element and clean that top element result stack */ |
103 | 103 | ||
104 | walk_state->result_count--; | 104 | walk_state->result_count--; |
105 | index = walk_state->result_count % ACPI_RESULTS_FRAME_OBJ_NUM; | 105 | index = (u32)walk_state->result_count % ACPI_RESULTS_FRAME_OBJ_NUM; |
106 | 106 | ||
107 | *object = state->results.obj_desc[index]; | 107 | *object = state->results.obj_desc[index]; |
108 | if (!*object) { | 108 | if (!*object) { |
@@ -186,7 +186,7 @@ acpi_ds_result_push(union acpi_operand_object * object, | |||
186 | 186 | ||
187 | /* Assign the address of object to the top free element of result stack */ | 187 | /* Assign the address of object to the top free element of result stack */ |
188 | 188 | ||
189 | index = walk_state->result_count % ACPI_RESULTS_FRAME_OBJ_NUM; | 189 | index = (u32)walk_state->result_count % ACPI_RESULTS_FRAME_OBJ_NUM; |
190 | state->results.obj_desc[index] = object; | 190 | state->results.obj_desc[index] = object; |
191 | walk_state->result_count++; | 191 | walk_state->result_count++; |
192 | 192 | ||
diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c index 538d63264555..98c7f9c62653 100644 --- a/drivers/acpi/acpica/evregion.c +++ b/drivers/acpi/acpica/evregion.c | |||
@@ -275,7 +275,7 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) | |||
275 | * | 275 | * |
276 | * PARAMETERS: region_obj - Internal region object | 276 | * PARAMETERS: region_obj - Internal region object |
277 | * Function - Read or Write operation | 277 | * Function - Read or Write operation |
278 | * Address - Where in the space to read or write | 278 | * region_offset - Where in the region to read or write |
279 | * bit_width - Field width in bits (8, 16, 32, or 64) | 279 | * bit_width - Field width in bits (8, 16, 32, or 64) |
280 | * Value - Pointer to in or out value, must be | 280 | * Value - Pointer to in or out value, must be |
281 | * full 64-bit acpi_integer | 281 | * full 64-bit acpi_integer |
@@ -290,7 +290,7 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) | |||
290 | acpi_status | 290 | acpi_status |
291 | acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | 291 | acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, |
292 | u32 function, | 292 | u32 function, |
293 | acpi_physical_address address, | 293 | u32 region_offset, |
294 | u32 bit_width, acpi_integer * value) | 294 | u32 bit_width, acpi_integer * value) |
295 | { | 295 | { |
296 | acpi_status status; | 296 | acpi_status status; |
@@ -396,7 +396,8 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
396 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | 396 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, |
397 | "Handler %p (@%p) Address %8.8X%8.8X [%s]\n", | 397 | "Handler %p (@%p) Address %8.8X%8.8X [%s]\n", |
398 | ®ion_obj->region.handler->address_space, handler, | 398 | ®ion_obj->region.handler->address_space, handler, |
399 | ACPI_FORMAT_NATIVE_UINT(address), | 399 | ACPI_FORMAT_NATIVE_UINT(region_obj->region.address + |
400 | region_offset), | ||
400 | acpi_ut_get_region_name(region_obj->region. | 401 | acpi_ut_get_region_name(region_obj->region. |
401 | space_id))); | 402 | space_id))); |
402 | 403 | ||
@@ -412,8 +413,9 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
412 | 413 | ||
413 | /* Call the handler */ | 414 | /* Call the handler */ |
414 | 415 | ||
415 | status = handler(function, address, bit_width, value, | 416 | status = handler(function, |
416 | handler_desc->address_space.context, | 417 | (region_obj->region.address + region_offset), |
418 | bit_width, value, handler_desc->address_space.context, | ||
417 | region_obj2->extra.region_context); | 419 | region_obj2->extra.region_context); |
418 | 420 | ||
419 | if (ACPI_FAILURE(status)) { | 421 | if (ACPI_FAILURE(status)) { |
diff --git a/drivers/acpi/acpica/evxfevnt.c b/drivers/acpi/acpica/evxfevnt.c index d0a080747ec3..4721f58fe42c 100644 --- a/drivers/acpi/acpica/evxfevnt.c +++ b/drivers/acpi/acpica/evxfevnt.c | |||
@@ -51,7 +51,7 @@ | |||
51 | ACPI_MODULE_NAME("evxfevnt") | 51 | ACPI_MODULE_NAME("evxfevnt") |
52 | 52 | ||
53 | /* Local prototypes */ | 53 | /* Local prototypes */ |
54 | acpi_status | 54 | static acpi_status |
55 | acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | 55 | acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info, |
56 | struct acpi_gpe_block_info *gpe_block, void *context); | 56 | struct acpi_gpe_block_info *gpe_block, void *context); |
57 | 57 | ||
@@ -785,7 +785,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_gpe_device) | |||
785 | * block device. NULL if the GPE is one of the FADT-defined GPEs. | 785 | * block device. NULL if the GPE is one of the FADT-defined GPEs. |
786 | * | 786 | * |
787 | ******************************************************************************/ | 787 | ******************************************************************************/ |
788 | acpi_status | 788 | static acpi_status |
789 | acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | 789 | acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info, |
790 | struct acpi_gpe_block_info *gpe_block, void *context) | 790 | struct acpi_gpe_block_info *gpe_block, void *context) |
791 | { | 791 | { |
diff --git a/drivers/acpi/acpica/exconfig.c b/drivers/acpi/acpica/exconfig.c index 3deb20a126b2..277fd609611a 100644 --- a/drivers/acpi/acpica/exconfig.c +++ b/drivers/acpi/acpica/exconfig.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include "acnamesp.h" | 47 | #include "acnamesp.h" |
48 | #include "actables.h" | 48 | #include "actables.h" |
49 | #include "acdispat.h" | 49 | #include "acdispat.h" |
50 | #include "acevents.h" | ||
50 | 51 | ||
51 | #define _COMPONENT ACPI_EXECUTER | 52 | #define _COMPONENT ACPI_EXECUTER |
52 | ACPI_MODULE_NAME("exconfig") | 53 | ACPI_MODULE_NAME("exconfig") |
@@ -57,6 +58,10 @@ acpi_ex_add_table(u32 table_index, | |||
57 | struct acpi_namespace_node *parent_node, | 58 | struct acpi_namespace_node *parent_node, |
58 | union acpi_operand_object **ddb_handle); | 59 | union acpi_operand_object **ddb_handle); |
59 | 60 | ||
61 | static acpi_status | ||
62 | acpi_ex_region_read(union acpi_operand_object *obj_desc, | ||
63 | u32 length, u8 *buffer); | ||
64 | |||
60 | /******************************************************************************* | 65 | /******************************************************************************* |
61 | * | 66 | * |
62 | * FUNCTION: acpi_ex_add_table | 67 | * FUNCTION: acpi_ex_add_table |
@@ -91,6 +96,7 @@ acpi_ex_add_table(u32 table_index, | |||
91 | 96 | ||
92 | /* Init the table handle */ | 97 | /* Init the table handle */ |
93 | 98 | ||
99 | obj_desc->common.flags |= AOPOBJ_DATA_VALID; | ||
94 | obj_desc->reference.class = ACPI_REFCLASS_TABLE; | 100 | obj_desc->reference.class = ACPI_REFCLASS_TABLE; |
95 | *ddb_handle = obj_desc; | 101 | *ddb_handle = obj_desc; |
96 | 102 | ||
@@ -229,6 +235,8 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
229 | walk_state); | 235 | walk_state); |
230 | if (ACPI_FAILURE(status)) { | 236 | if (ACPI_FAILURE(status)) { |
231 | (void)acpi_ex_unload_table(ddb_handle); | 237 | (void)acpi_ex_unload_table(ddb_handle); |
238 | |||
239 | acpi_ut_remove_reference(ddb_handle); | ||
232 | return_ACPI_STATUS(status); | 240 | return_ACPI_STATUS(status); |
233 | } | 241 | } |
234 | } | 242 | } |
@@ -254,6 +262,47 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
254 | 262 | ||
255 | /******************************************************************************* | 263 | /******************************************************************************* |
256 | * | 264 | * |
265 | * FUNCTION: acpi_ex_region_read | ||
266 | * | ||
267 | * PARAMETERS: obj_desc - Region descriptor | ||
268 | * Length - Number of bytes to read | ||
269 | * Buffer - Pointer to where to put the data | ||
270 | * | ||
271 | * RETURN: Status | ||
272 | * | ||
273 | * DESCRIPTION: Read data from an operation region. The read starts from the | ||
274 | * beginning of the region. | ||
275 | * | ||
276 | ******************************************************************************/ | ||
277 | |||
278 | static acpi_status | ||
279 | acpi_ex_region_read(union acpi_operand_object *obj_desc, u32 length, u8 *buffer) | ||
280 | { | ||
281 | acpi_status status; | ||
282 | acpi_integer value; | ||
283 | u32 region_offset = 0; | ||
284 | u32 i; | ||
285 | |||
286 | /* Bytewise reads */ | ||
287 | |||
288 | for (i = 0; i < length; i++) { | ||
289 | status = acpi_ev_address_space_dispatch(obj_desc, ACPI_READ, | ||
290 | region_offset, 8, | ||
291 | &value); | ||
292 | if (ACPI_FAILURE(status)) { | ||
293 | return status; | ||
294 | } | ||
295 | |||
296 | *buffer = (u8)value; | ||
297 | buffer++; | ||
298 | region_offset++; | ||
299 | } | ||
300 | |||
301 | return AE_OK; | ||
302 | } | ||
303 | |||
304 | /******************************************************************************* | ||
305 | * | ||
257 | * FUNCTION: acpi_ex_load_op | 306 | * FUNCTION: acpi_ex_load_op |
258 | * | 307 | * |
259 | * PARAMETERS: obj_desc - Region or Buffer/Field where the table will be | 308 | * PARAMETERS: obj_desc - Region or Buffer/Field where the table will be |
@@ -314,18 +363,23 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
314 | } | 363 | } |
315 | } | 364 | } |
316 | 365 | ||
317 | /* | 366 | /* Get the table header first so we can get the table length */ |
318 | * Map the table header and get the actual table length. The region | 367 | |
319 | * length is not guaranteed to be the same as the table length. | 368 | table = ACPI_ALLOCATE(sizeof(struct acpi_table_header)); |
320 | */ | ||
321 | table = acpi_os_map_memory(obj_desc->region.address, | ||
322 | sizeof(struct acpi_table_header)); | ||
323 | if (!table) { | 369 | if (!table) { |
324 | return_ACPI_STATUS(AE_NO_MEMORY); | 370 | return_ACPI_STATUS(AE_NO_MEMORY); |
325 | } | 371 | } |
326 | 372 | ||
373 | status = | ||
374 | acpi_ex_region_read(obj_desc, | ||
375 | sizeof(struct acpi_table_header), | ||
376 | ACPI_CAST_PTR(u8, table)); | ||
327 | length = table->length; | 377 | length = table->length; |
328 | acpi_os_unmap_memory(table, sizeof(struct acpi_table_header)); | 378 | ACPI_FREE(table); |
379 | |||
380 | if (ACPI_FAILURE(status)) { | ||
381 | return_ACPI_STATUS(status); | ||
382 | } | ||
329 | 383 | ||
330 | /* Must have at least an ACPI table header */ | 384 | /* Must have at least an ACPI table header */ |
331 | 385 | ||
@@ -334,10 +388,19 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
334 | } | 388 | } |
335 | 389 | ||
336 | /* | 390 | /* |
337 | * The memory region is not guaranteed to remain stable and we must | 391 | * The original implementation simply mapped the table, with no copy. |
338 | * copy the table to a local buffer. For example, the memory region | 392 | * However, the memory region is not guaranteed to remain stable and |
339 | * is corrupted after suspend on some machines. Dynamically loaded | 393 | * we must copy the table to a local buffer. For example, the memory |
340 | * tables are usually small, so this overhead is minimal. | 394 | * region is corrupted after suspend on some machines. Dynamically |
395 | * loaded tables are usually small, so this overhead is minimal. | ||
396 | * | ||
397 | * The latest implementation (5/2009) does not use a mapping at all. | ||
398 | * We use the low-level operation region interface to read the table | ||
399 | * instead of the obvious optimization of using a direct mapping. | ||
400 | * This maintains a consistent use of operation regions across the | ||
401 | * entire subsystem. This is important if additional processing must | ||
402 | * be performed in the (possibly user-installed) operation region | ||
403 | * handler. For example, acpi_exec and ASLTS depend on this. | ||
341 | */ | 404 | */ |
342 | 405 | ||
343 | /* Allocate a buffer for the table */ | 406 | /* Allocate a buffer for the table */ |
@@ -347,17 +410,16 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
347 | return_ACPI_STATUS(AE_NO_MEMORY); | 410 | return_ACPI_STATUS(AE_NO_MEMORY); |
348 | } | 411 | } |
349 | 412 | ||
350 | /* Map the entire table and copy it */ | 413 | /* Read the entire table */ |
351 | 414 | ||
352 | table = acpi_os_map_memory(obj_desc->region.address, length); | 415 | status = acpi_ex_region_read(obj_desc, length, |
353 | if (!table) { | 416 | ACPI_CAST_PTR(u8, |
417 | table_desc.pointer)); | ||
418 | if (ACPI_FAILURE(status)) { | ||
354 | ACPI_FREE(table_desc.pointer); | 419 | ACPI_FREE(table_desc.pointer); |
355 | return_ACPI_STATUS(AE_NO_MEMORY); | 420 | return_ACPI_STATUS(status); |
356 | } | 421 | } |
357 | 422 | ||
358 | ACPI_MEMCPY(table_desc.pointer, table, length); | ||
359 | acpi_os_unmap_memory(table, length); | ||
360 | |||
361 | table_desc.address = obj_desc->region.address; | 423 | table_desc.address = obj_desc->region.address; |
362 | break; | 424 | break; |
363 | 425 | ||
@@ -454,6 +516,10 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
454 | return_ACPI_STATUS(status); | 516 | return_ACPI_STATUS(status); |
455 | } | 517 | } |
456 | 518 | ||
519 | /* Remove the reference by added by acpi_ex_store above */ | ||
520 | |||
521 | acpi_ut_remove_reference(ddb_handle); | ||
522 | |||
457 | /* Invoke table handler if present */ | 523 | /* Invoke table handler if present */ |
458 | 524 | ||
459 | if (acpi_gbl_table_handler) { | 525 | if (acpi_gbl_table_handler) { |
@@ -495,13 +561,18 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle) | |||
495 | 561 | ||
496 | /* | 562 | /* |
497 | * Validate the handle | 563 | * Validate the handle |
498 | * Although the handle is partially validated in acpi_ex_reconfiguration(), | 564 | * Although the handle is partially validated in acpi_ex_reconfiguration() |
499 | * when it calls acpi_ex_resolve_operands(), the handle is more completely | 565 | * when it calls acpi_ex_resolve_operands(), the handle is more completely |
500 | * validated here. | 566 | * validated here. |
567 | * | ||
568 | * Handle must be a valid operand object of type reference. Also, the | ||
569 | * ddb_handle must still be marked valid (table has not been previously | ||
570 | * unloaded) | ||
501 | */ | 571 | */ |
502 | if ((!ddb_handle) || | 572 | if ((!ddb_handle) || |
503 | (ACPI_GET_DESCRIPTOR_TYPE(ddb_handle) != ACPI_DESC_TYPE_OPERAND) || | 573 | (ACPI_GET_DESCRIPTOR_TYPE(ddb_handle) != ACPI_DESC_TYPE_OPERAND) || |
504 | (ddb_handle->common.type != ACPI_TYPE_LOCAL_REFERENCE)) { | 574 | (ddb_handle->common.type != ACPI_TYPE_LOCAL_REFERENCE) || |
575 | (!(ddb_handle->common.flags & AOPOBJ_DATA_VALID))) { | ||
505 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 576 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
506 | } | 577 | } |
507 | 578 | ||
@@ -509,6 +580,12 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle) | |||
509 | 580 | ||
510 | table_index = table_desc->reference.value; | 581 | table_index = table_desc->reference.value; |
511 | 582 | ||
583 | /* Ensure the table is still loaded */ | ||
584 | |||
585 | if (!acpi_tb_is_table_loaded(table_index)) { | ||
586 | return_ACPI_STATUS(AE_NOT_EXIST); | ||
587 | } | ||
588 | |||
512 | /* Invoke table handler if present */ | 589 | /* Invoke table handler if present */ |
513 | 590 | ||
514 | if (acpi_gbl_table_handler) { | 591 | if (acpi_gbl_table_handler) { |
@@ -530,8 +607,10 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle) | |||
530 | (void)acpi_tb_release_owner_id(table_index); | 607 | (void)acpi_tb_release_owner_id(table_index); |
531 | acpi_tb_set_table_loaded_flag(table_index, FALSE); | 608 | acpi_tb_set_table_loaded_flag(table_index, FALSE); |
532 | 609 | ||
533 | /* Table unloaded, remove a reference to the ddb_handle object */ | 610 | /* |
534 | 611 | * Invalidate the handle. We do this because the handle may be stored | |
535 | acpi_ut_remove_reference(ddb_handle); | 612 | * in a named object and may not be actually deleted until much later. |
613 | */ | ||
614 | ddb_handle->common.flags &= ~AOPOBJ_DATA_VALID; | ||
536 | return_ACPI_STATUS(AE_OK); | 615 | return_ACPI_STATUS(AE_OK); |
537 | } | 616 | } |
diff --git a/drivers/acpi/acpica/excreate.c b/drivers/acpi/acpica/excreate.c index a57ad2564ab0..02b25d233d99 100644 --- a/drivers/acpi/acpica/excreate.c +++ b/drivers/acpi/acpica/excreate.c | |||
@@ -502,7 +502,7 @@ acpi_ex_create_method(u8 * aml_start, | |||
502 | * ACPI 2.0: sync_level = sync_level in method declaration | 502 | * ACPI 2.0: sync_level = sync_level in method declaration |
503 | */ | 503 | */ |
504 | obj_desc->method.sync_level = (u8) | 504 | obj_desc->method.sync_level = (u8) |
505 | ((method_flags & AML_METHOD_SYNCH_LEVEL) >> 4); | 505 | ((method_flags & AML_METHOD_SYNC_LEVEL) >> 4); |
506 | } | 506 | } |
507 | 507 | ||
508 | /* Attach the new object to the method Node */ | 508 | /* Attach the new object to the method Node */ |
diff --git a/drivers/acpi/acpica/exdump.c b/drivers/acpi/acpica/exdump.c index 89d141fdae0b..ec524614e708 100644 --- a/drivers/acpi/acpica/exdump.c +++ b/drivers/acpi/acpica/exdump.c | |||
@@ -120,9 +120,11 @@ static struct acpi_exdump_info acpi_ex_dump_event[2] = { | |||
120 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(event.os_semaphore), "OsSemaphore"} | 120 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(event.os_semaphore), "OsSemaphore"} |
121 | }; | 121 | }; |
122 | 122 | ||
123 | static struct acpi_exdump_info acpi_ex_dump_method[8] = { | 123 | static struct acpi_exdump_info acpi_ex_dump_method[9] = { |
124 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_method), NULL}, | 124 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_method), NULL}, |
125 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.param_count), "ParamCount"}, | 125 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.method_flags), "Method Flags"}, |
126 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.param_count), | ||
127 | "Parameter Count"}, | ||
126 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.sync_level), "Sync Level"}, | 128 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.sync_level), "Sync Level"}, |
127 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.mutex), "Mutex"}, | 129 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.mutex), "Mutex"}, |
128 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.owner_id), "Owner Id"}, | 130 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.owner_id), "Owner Id"}, |
diff --git a/drivers/acpi/acpica/exfldio.c b/drivers/acpi/acpica/exfldio.c index 99cee61e655d..d4075b821021 100644 --- a/drivers/acpi/acpica/exfldio.c +++ b/drivers/acpi/acpica/exfldio.c | |||
@@ -222,7 +222,7 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc, | |||
222 | { | 222 | { |
223 | acpi_status status; | 223 | acpi_status status; |
224 | union acpi_operand_object *rgn_desc; | 224 | union acpi_operand_object *rgn_desc; |
225 | acpi_physical_address address; | 225 | u32 region_offset; |
226 | 226 | ||
227 | ACPI_FUNCTION_TRACE(ex_access_region); | 227 | ACPI_FUNCTION_TRACE(ex_access_region); |
228 | 228 | ||
@@ -243,7 +243,7 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc, | |||
243 | * 3) The current offset into the field | 243 | * 3) The current offset into the field |
244 | */ | 244 | */ |
245 | rgn_desc = obj_desc->common_field.region_obj; | 245 | rgn_desc = obj_desc->common_field.region_obj; |
246 | address = rgn_desc->region.address + | 246 | region_offset = |
247 | obj_desc->common_field.base_byte_offset + field_datum_byte_offset; | 247 | obj_desc->common_field.base_byte_offset + field_datum_byte_offset; |
248 | 248 | ||
249 | if ((function & ACPI_IO_MASK) == ACPI_READ) { | 249 | if ((function & ACPI_IO_MASK) == ACPI_READ) { |
@@ -260,16 +260,18 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc, | |||
260 | obj_desc->common_field.access_byte_width, | 260 | obj_desc->common_field.access_byte_width, |
261 | obj_desc->common_field.base_byte_offset, | 261 | obj_desc->common_field.base_byte_offset, |
262 | field_datum_byte_offset, ACPI_CAST_PTR(void, | 262 | field_datum_byte_offset, ACPI_CAST_PTR(void, |
263 | address))); | 263 | (rgn_desc-> |
264 | region. | ||
265 | address + | ||
266 | region_offset)))); | ||
264 | 267 | ||
265 | /* Invoke the appropriate address_space/op_region handler */ | 268 | /* Invoke the appropriate address_space/op_region handler */ |
266 | 269 | ||
267 | status = acpi_ev_address_space_dispatch(rgn_desc, function, | 270 | status = |
268 | address, | 271 | acpi_ev_address_space_dispatch(rgn_desc, function, region_offset, |
269 | ACPI_MUL_8(obj_desc-> | 272 | ACPI_MUL_8(obj_desc->common_field. |
270 | common_field. | 273 | access_byte_width), |
271 | access_byte_width), | 274 | value); |
272 | value); | ||
273 | 275 | ||
274 | if (ACPI_FAILURE(status)) { | 276 | if (ACPI_FAILURE(status)) { |
275 | if (status == AE_NOT_IMPLEMENTED) { | 277 | if (status == AE_NOT_IMPLEMENTED) { |
diff --git a/drivers/acpi/acpica/exmutex.c b/drivers/acpi/acpica/exmutex.c index d301c1f363ef..2f0114202b05 100644 --- a/drivers/acpi/acpica/exmutex.c +++ b/drivers/acpi/acpica/exmutex.c | |||
@@ -83,6 +83,15 @@ void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc) | |||
83 | 83 | ||
84 | if (obj_desc->mutex.prev) { | 84 | if (obj_desc->mutex.prev) { |
85 | (obj_desc->mutex.prev)->mutex.next = obj_desc->mutex.next; | 85 | (obj_desc->mutex.prev)->mutex.next = obj_desc->mutex.next; |
86 | |||
87 | /* | ||
88 | * Migrate the previous sync level associated with this mutex to the | ||
89 | * previous mutex on the list so that it may be preserved. This handles | ||
90 | * the case where several mutexes have been acquired at the same level, | ||
91 | * but are not released in opposite order. | ||
92 | */ | ||
93 | (obj_desc->mutex.prev)->mutex.original_sync_level = | ||
94 | obj_desc->mutex.original_sync_level; | ||
86 | } else { | 95 | } else { |
87 | thread->acquired_mutex_list = obj_desc->mutex.next; | 96 | thread->acquired_mutex_list = obj_desc->mutex.next; |
88 | } | 97 | } |
@@ -349,6 +358,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
349 | struct acpi_walk_state *walk_state) | 358 | struct acpi_walk_state *walk_state) |
350 | { | 359 | { |
351 | acpi_status status = AE_OK; | 360 | acpi_status status = AE_OK; |
361 | u8 previous_sync_level; | ||
352 | 362 | ||
353 | ACPI_FUNCTION_TRACE(ex_release_mutex); | 363 | ACPI_FUNCTION_TRACE(ex_release_mutex); |
354 | 364 | ||
@@ -373,11 +383,12 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
373 | walk_state->thread->thread_id) | 383 | walk_state->thread->thread_id) |
374 | && (obj_desc != acpi_gbl_global_lock_mutex)) { | 384 | && (obj_desc != acpi_gbl_global_lock_mutex)) { |
375 | ACPI_ERROR((AE_INFO, | 385 | ACPI_ERROR((AE_INFO, |
376 | "Thread %lX cannot release Mutex [%4.4s] acquired by thread %lX", | 386 | "Thread %p cannot release Mutex [%4.4s] acquired by thread %p", |
377 | (unsigned long)walk_state->thread->thread_id, | 387 | ACPI_CAST_PTR(void, walk_state->thread->thread_id), |
378 | acpi_ut_get_node_name(obj_desc->mutex.node), | 388 | acpi_ut_get_node_name(obj_desc->mutex.node), |
379 | (unsigned long)obj_desc->mutex.owner_thread-> | 389 | ACPI_CAST_PTR(void, |
380 | thread_id)); | 390 | obj_desc->mutex.owner_thread-> |
391 | thread_id))); | ||
381 | return_ACPI_STATUS(AE_AML_NOT_OWNER); | 392 | return_ACPI_STATUS(AE_AML_NOT_OWNER); |
382 | } | 393 | } |
383 | 394 | ||
@@ -391,10 +402,14 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
391 | } | 402 | } |
392 | 403 | ||
393 | /* | 404 | /* |
394 | * The sync level of the mutex must be less than or equal to the current | 405 | * The sync level of the mutex must be equal to the current sync level. In |
395 | * sync level | 406 | * other words, the current level means that at least one mutex at that |
407 | * level is currently being held. Attempting to release a mutex of a | ||
408 | * different level can only mean that the mutex ordering rule is being | ||
409 | * violated. This behavior is clarified in ACPI 4.0 specification. | ||
396 | */ | 410 | */ |
397 | if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) { | 411 | if (obj_desc->mutex.sync_level != |
412 | walk_state->thread->current_sync_level) { | ||
398 | ACPI_ERROR((AE_INFO, | 413 | ACPI_ERROR((AE_INFO, |
399 | "Cannot release Mutex [%4.4s], SyncLevel mismatch: mutex %d current %d", | 414 | "Cannot release Mutex [%4.4s], SyncLevel mismatch: mutex %d current %d", |
400 | acpi_ut_get_node_name(obj_desc->mutex.node), | 415 | acpi_ut_get_node_name(obj_desc->mutex.node), |
@@ -403,14 +418,24 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
403 | return_ACPI_STATUS(AE_AML_MUTEX_ORDER); | 418 | return_ACPI_STATUS(AE_AML_MUTEX_ORDER); |
404 | } | 419 | } |
405 | 420 | ||
421 | /* | ||
422 | * Get the previous sync_level from the head of the acquired mutex list. | ||
423 | * This handles the case where several mutexes at the same level have been | ||
424 | * acquired, but are not released in reverse order. | ||
425 | */ | ||
426 | previous_sync_level = | ||
427 | walk_state->thread->acquired_mutex_list->mutex.original_sync_level; | ||
428 | |||
406 | status = acpi_ex_release_mutex_object(obj_desc); | 429 | status = acpi_ex_release_mutex_object(obj_desc); |
430 | if (ACPI_FAILURE(status)) { | ||
431 | return_ACPI_STATUS(status); | ||
432 | } | ||
407 | 433 | ||
408 | if (obj_desc->mutex.acquisition_depth == 0) { | 434 | if (obj_desc->mutex.acquisition_depth == 0) { |
409 | 435 | ||
410 | /* Restore the original sync_level */ | 436 | /* Restore the previous sync_level */ |
411 | 437 | ||
412 | walk_state->thread->current_sync_level = | 438 | walk_state->thread->current_sync_level = previous_sync_level; |
413 | obj_desc->mutex.original_sync_level; | ||
414 | } | 439 | } |
415 | return_ACPI_STATUS(status); | 440 | return_ACPI_STATUS(status); |
416 | } | 441 | } |
diff --git a/drivers/acpi/acpica/exstore.c b/drivers/acpi/acpica/exstore.c index 90d606196c99..6efd07a4f779 100644 --- a/drivers/acpi/acpica/exstore.c +++ b/drivers/acpi/acpica/exstore.c | |||
@@ -193,10 +193,12 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, | |||
193 | 193 | ||
194 | case ACPI_REFCLASS_TABLE: | 194 | case ACPI_REFCLASS_TABLE: |
195 | 195 | ||
196 | /* Case for ddb_handle */ | ||
197 | |||
196 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, | 198 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, |
197 | "Table Index 0x%X\n", | 199 | "Table Index 0x%X\n", |
198 | source_desc->reference.value)); | 200 | source_desc->reference.value)); |
199 | break; | 201 | return; |
200 | 202 | ||
201 | default: | 203 | default: |
202 | break; | 204 | break; |
diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c index 7b2fb602b5cb..23d5505cb1f7 100644 --- a/drivers/acpi/acpica/hwregs.c +++ b/drivers/acpi/acpica/hwregs.c | |||
@@ -81,9 +81,9 @@ acpi_status acpi_hw_clear_acpi_status(void) | |||
81 | 81 | ||
82 | ACPI_FUNCTION_TRACE(hw_clear_acpi_status); | 82 | ACPI_FUNCTION_TRACE(hw_clear_acpi_status); |
83 | 83 | ||
84 | ACPI_DEBUG_PRINT((ACPI_DB_IO, "About to write %04X to %0llX\n", | 84 | ACPI_DEBUG_PRINT((ACPI_DB_IO, "About to write %04X to %8.8X%8.8X\n", |
85 | ACPI_BITMASK_ALL_FIXED_STATUS, | 85 | ACPI_BITMASK_ALL_FIXED_STATUS, |
86 | acpi_gbl_xpm1a_status.address)); | 86 | ACPI_FORMAT_UINT64(acpi_gbl_xpm1a_status.address))); |
87 | 87 | ||
88 | lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); | 88 | lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); |
89 | 89 | ||
diff --git a/drivers/acpi/acpica/nsalloc.c b/drivers/acpi/acpica/nsalloc.c index aceb93111967..efc971ab7d65 100644 --- a/drivers/acpi/acpica/nsalloc.c +++ b/drivers/acpi/acpica/nsalloc.c | |||
@@ -334,9 +334,7 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node) | |||
334 | 334 | ||
335 | /* Get the next node in this scope (NULL if none) */ | 335 | /* Get the next node in this scope (NULL if none) */ |
336 | 336 | ||
337 | child_node = | 337 | child_node = acpi_ns_get_next_node(parent_node, child_node); |
338 | acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node, | ||
339 | child_node); | ||
340 | if (child_node) { | 338 | if (child_node) { |
341 | 339 | ||
342 | /* Found a child node - detach any attached object */ | 340 | /* Found a child node - detach any attached object */ |
@@ -345,8 +343,7 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node) | |||
345 | 343 | ||
346 | /* Check if this node has any children */ | 344 | /* Check if this node has any children */ |
347 | 345 | ||
348 | if (acpi_ns_get_next_node | 346 | if (child_node->child) { |
349 | (ACPI_TYPE_ANY, child_node, NULL)) { | ||
350 | /* | 347 | /* |
351 | * There is at least one child of this node, | 348 | * There is at least one child of this node, |
352 | * visit the node | 349 | * visit the node |
@@ -432,9 +429,7 @@ void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id) | |||
432 | * Get the next child of this parent node. When child_node is NULL, | 429 | * Get the next child of this parent node. When child_node is NULL, |
433 | * the first child of the parent is returned | 430 | * the first child of the parent is returned |
434 | */ | 431 | */ |
435 | child_node = | 432 | child_node = acpi_ns_get_next_node(parent_node, child_node); |
436 | acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node, | ||
437 | child_node); | ||
438 | 433 | ||
439 | if (deletion_node) { | 434 | if (deletion_node) { |
440 | acpi_ns_delete_children(deletion_node); | 435 | acpi_ns_delete_children(deletion_node); |
@@ -452,8 +447,7 @@ void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id) | |||
452 | 447 | ||
453 | /* Check if this node has any children */ | 448 | /* Check if this node has any children */ |
454 | 449 | ||
455 | if (acpi_ns_get_next_node | 450 | if (child_node->child) { |
456 | (ACPI_TYPE_ANY, child_node, NULL)) { | ||
457 | /* | 451 | /* |
458 | * There is at least one child of this node, | 452 | * There is at least one child of this node, |
459 | * visit the node | 453 | * visit the node |
diff --git a/drivers/acpi/acpica/nsnames.c b/drivers/acpi/acpica/nsnames.c index ae3dc10a7e81..af8e6bcee07e 100644 --- a/drivers/acpi/acpica/nsnames.c +++ b/drivers/acpi/acpica/nsnames.c | |||
@@ -149,7 +149,7 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) | |||
149 | 149 | ||
150 | name_buffer = ACPI_ALLOCATE_ZEROED(size); | 150 | name_buffer = ACPI_ALLOCATE_ZEROED(size); |
151 | if (!name_buffer) { | 151 | if (!name_buffer) { |
152 | ACPI_ERROR((AE_INFO, "Allocation failure")); | 152 | ACPI_ERROR((AE_INFO, "Could not allocate %u bytes", (u32)size)); |
153 | return_PTR(NULL); | 153 | return_PTR(NULL); |
154 | } | 154 | } |
155 | 155 | ||
diff --git a/drivers/acpi/acpica/nsobject.c b/drivers/acpi/acpica/nsobject.c index 3eb20bfda9d8..60f3af08d28c 100644 --- a/drivers/acpi/acpica/nsobject.c +++ b/drivers/acpi/acpica/nsobject.c | |||
@@ -213,6 +213,15 @@ void acpi_ns_detach_object(struct acpi_namespace_node *node) | |||
213 | return_VOID; | 213 | return_VOID; |
214 | } | 214 | } |
215 | 215 | ||
216 | if (node->flags & ANOBJ_ALLOCATED_BUFFER) { | ||
217 | |||
218 | /* Free the dynamic aml buffer */ | ||
219 | |||
220 | if (obj_desc->common.type == ACPI_TYPE_METHOD) { | ||
221 | ACPI_FREE(obj_desc->method.aml_start); | ||
222 | } | ||
223 | } | ||
224 | |||
216 | /* Clear the entry in all cases */ | 225 | /* Clear the entry in all cases */ |
217 | 226 | ||
218 | node->object = NULL; | 227 | node->object = NULL; |
diff --git a/drivers/acpi/acpica/nspredef.c b/drivers/acpi/acpica/nspredef.c index d9e8cbc6e679..7f8e066b12a3 100644 --- a/drivers/acpi/acpica/nspredef.c +++ b/drivers/acpi/acpica/nspredef.c | |||
@@ -144,7 +144,7 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node, | |||
144 | 144 | ||
145 | pathname = acpi_ns_get_external_pathname(node); | 145 | pathname = acpi_ns_get_external_pathname(node); |
146 | if (!pathname) { | 146 | if (!pathname) { |
147 | pathname = ACPI_CAST_PTR(char, predefined->info.name); | 147 | return AE_OK; /* Could not get pathname, ignore */ |
148 | } | 148 | } |
149 | 149 | ||
150 | /* | 150 | /* |
@@ -230,10 +230,7 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node, | |||
230 | } | 230 | } |
231 | 231 | ||
232 | exit: | 232 | exit: |
233 | if (pathname != predefined->info.name) { | 233 | ACPI_FREE(pathname); |
234 | ACPI_FREE(pathname); | ||
235 | } | ||
236 | |||
237 | return (status); | 234 | return (status); |
238 | } | 235 | } |
239 | 236 | ||
diff --git a/drivers/acpi/acpica/nssearch.c b/drivers/acpi/acpica/nssearch.c index f9b4f51bf8f2..7e865639a928 100644 --- a/drivers/acpi/acpica/nssearch.c +++ b/drivers/acpi/acpica/nssearch.c | |||
@@ -45,6 +45,10 @@ | |||
45 | #include "accommon.h" | 45 | #include "accommon.h" |
46 | #include "acnamesp.h" | 46 | #include "acnamesp.h" |
47 | 47 | ||
48 | #ifdef ACPI_ASL_COMPILER | ||
49 | #include "amlcode.h" | ||
50 | #endif | ||
51 | |||
48 | #define _COMPONENT ACPI_NAMESPACE | 52 | #define _COMPONENT ACPI_NAMESPACE |
49 | ACPI_MODULE_NAME("nssearch") | 53 | ACPI_MODULE_NAME("nssearch") |
50 | 54 | ||
diff --git a/drivers/acpi/acpica/nswalk.c b/drivers/acpi/acpica/nswalk.c index 83e3aa6d4b9b..35539df5c75d 100644 --- a/drivers/acpi/acpica/nswalk.c +++ b/drivers/acpi/acpica/nswalk.c | |||
@@ -52,8 +52,7 @@ ACPI_MODULE_NAME("nswalk") | |||
52 | * | 52 | * |
53 | * FUNCTION: acpi_ns_get_next_node | 53 | * FUNCTION: acpi_ns_get_next_node |
54 | * | 54 | * |
55 | * PARAMETERS: Type - Type of node to be searched for | 55 | * PARAMETERS: parent_node - Parent node whose children we are |
56 | * parent_node - Parent node whose children we are | ||
57 | * getting | 56 | * getting |
58 | * child_node - Previous child that was found. | 57 | * child_node - Previous child that was found. |
59 | * The NEXT child will be returned | 58 | * The NEXT child will be returned |
@@ -66,27 +65,68 @@ ACPI_MODULE_NAME("nswalk") | |||
66 | * within Scope is returned. | 65 | * within Scope is returned. |
67 | * | 66 | * |
68 | ******************************************************************************/ | 67 | ******************************************************************************/ |
69 | struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, struct acpi_namespace_node | 68 | struct acpi_namespace_node *acpi_ns_get_next_node(struct acpi_namespace_node |
70 | *parent_node, struct acpi_namespace_node | 69 | *parent_node, |
70 | struct acpi_namespace_node | ||
71 | *child_node) | 71 | *child_node) |
72 | { | 72 | { |
73 | struct acpi_namespace_node *next_node = NULL; | ||
74 | |||
75 | ACPI_FUNCTION_ENTRY(); | 73 | ACPI_FUNCTION_ENTRY(); |
76 | 74 | ||
77 | if (!child_node) { | 75 | if (!child_node) { |
78 | 76 | ||
79 | /* It's really the parent's _scope_ that we want */ | 77 | /* It's really the parent's _scope_ that we want */ |
80 | 78 | ||
81 | next_node = parent_node->child; | 79 | return parent_node->child; |
82 | } | 80 | } |
83 | 81 | ||
84 | else { | 82 | /* |
85 | /* Start search at the NEXT node */ | 83 | * Get the next node. |
86 | 84 | * | |
87 | next_node = acpi_ns_get_next_valid_node(child_node); | 85 | * If we are at the end of this peer list, return NULL |
86 | */ | ||
87 | if (child_node->flags & ANOBJ_END_OF_PEER_LIST) { | ||
88 | return NULL; | ||
88 | } | 89 | } |
89 | 90 | ||
91 | /* Otherwise just return the next peer */ | ||
92 | |||
93 | return child_node->peer; | ||
94 | } | ||
95 | |||
96 | /******************************************************************************* | ||
97 | * | ||
98 | * FUNCTION: acpi_ns_get_next_node_typed | ||
99 | * | ||
100 | * PARAMETERS: Type - Type of node to be searched for | ||
101 | * parent_node - Parent node whose children we are | ||
102 | * getting | ||
103 | * child_node - Previous child that was found. | ||
104 | * The NEXT child will be returned | ||
105 | * | ||
106 | * RETURN: struct acpi_namespace_node - Pointer to the NEXT child or NULL if | ||
107 | * none is found. | ||
108 | * | ||
109 | * DESCRIPTION: Return the next peer node within the namespace. If Handle | ||
110 | * is valid, Scope is ignored. Otherwise, the first node | ||
111 | * within Scope is returned. | ||
112 | * | ||
113 | ******************************************************************************/ | ||
114 | |||
115 | struct acpi_namespace_node *acpi_ns_get_next_node_typed(acpi_object_type type, | ||
116 | struct | ||
117 | acpi_namespace_node | ||
118 | *parent_node, | ||
119 | struct | ||
120 | acpi_namespace_node | ||
121 | *child_node) | ||
122 | { | ||
123 | struct acpi_namespace_node *next_node = NULL; | ||
124 | |||
125 | ACPI_FUNCTION_ENTRY(); | ||
126 | |||
127 | next_node = acpi_ns_get_next_node(parent_node, child_node); | ||
128 | |||
129 | |||
90 | /* If any type is OK, we are done */ | 130 | /* If any type is OK, we are done */ |
91 | 131 | ||
92 | if (type == ACPI_TYPE_ANY) { | 132 | if (type == ACPI_TYPE_ANY) { |
@@ -186,9 +226,7 @@ acpi_ns_walk_namespace(acpi_object_type type, | |||
186 | /* Get the next node in this scope. Null if not found */ | 226 | /* Get the next node in this scope. Null if not found */ |
187 | 227 | ||
188 | status = AE_OK; | 228 | status = AE_OK; |
189 | child_node = | 229 | child_node = acpi_ns_get_next_node(parent_node, child_node); |
190 | acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node, | ||
191 | child_node); | ||
192 | if (child_node) { | 230 | if (child_node) { |
193 | 231 | ||
194 | /* Found next child, get the type if we are not searching for ANY */ | 232 | /* Found next child, get the type if we are not searching for ANY */ |
@@ -269,8 +307,7 @@ acpi_ns_walk_namespace(acpi_object_type type, | |||
269 | * function has specified that the maximum depth has been reached. | 307 | * function has specified that the maximum depth has been reached. |
270 | */ | 308 | */ |
271 | if ((level < max_depth) && (status != AE_CTRL_DEPTH)) { | 309 | if ((level < max_depth) && (status != AE_CTRL_DEPTH)) { |
272 | if (acpi_ns_get_next_node | 310 | if (child_node->child) { |
273 | (ACPI_TYPE_ANY, child_node, NULL)) { | ||
274 | 311 | ||
275 | /* There is at least one child of this node, visit it */ | 312 | /* There is at least one child of this node, visit it */ |
276 | 313 | ||
diff --git a/drivers/acpi/acpica/nsxfname.c b/drivers/acpi/acpica/nsxfname.c index 9589fea24997..f23593d6add4 100644 --- a/drivers/acpi/acpica/nsxfname.c +++ b/drivers/acpi/acpica/nsxfname.c | |||
@@ -45,6 +45,8 @@ | |||
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 "acparser.h" | ||
49 | #include "amlcode.h" | ||
48 | 50 | ||
49 | #define _COMPONENT ACPI_NAMESPACE | 51 | #define _COMPONENT ACPI_NAMESPACE |
50 | ACPI_MODULE_NAME("nsxfname") | 52 | ACPI_MODULE_NAME("nsxfname") |
@@ -358,3 +360,151 @@ acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) | |||
358 | } | 360 | } |
359 | 361 | ||
360 | ACPI_EXPORT_SYMBOL(acpi_get_object_info) | 362 | ACPI_EXPORT_SYMBOL(acpi_get_object_info) |
363 | |||
364 | /****************************************************************************** | ||
365 | * | ||
366 | * FUNCTION: acpi_install_method | ||
367 | * | ||
368 | * PARAMETERS: Buffer - An ACPI table containing one control method | ||
369 | * | ||
370 | * RETURN: Status | ||
371 | * | ||
372 | * DESCRIPTION: Install a control method into the namespace. If the method | ||
373 | * name already exists in the namespace, it is overwritten. The | ||
374 | * input buffer must contain a valid DSDT or SSDT containing a | ||
375 | * single control method. | ||
376 | * | ||
377 | ******************************************************************************/ | ||
378 | acpi_status acpi_install_method(u8 *buffer) | ||
379 | { | ||
380 | struct acpi_table_header *table = | ||
381 | ACPI_CAST_PTR(struct acpi_table_header, buffer); | ||
382 | u8 *aml_buffer; | ||
383 | u8 *aml_start; | ||
384 | char *path; | ||
385 | struct acpi_namespace_node *node; | ||
386 | union acpi_operand_object *method_obj; | ||
387 | struct acpi_parse_state parser_state; | ||
388 | u32 aml_length; | ||
389 | u16 opcode; | ||
390 | u8 method_flags; | ||
391 | acpi_status status; | ||
392 | |||
393 | /* Parameter validation */ | ||
394 | |||
395 | if (!buffer) { | ||
396 | return AE_BAD_PARAMETER; | ||
397 | } | ||
398 | |||
399 | /* Table must be a DSDT or SSDT */ | ||
400 | |||
401 | if (!ACPI_COMPARE_NAME(table->signature, ACPI_SIG_DSDT) && | ||
402 | !ACPI_COMPARE_NAME(table->signature, ACPI_SIG_SSDT)) { | ||
403 | return AE_BAD_HEADER; | ||
404 | } | ||
405 | |||
406 | /* First AML opcode in the table must be a control method */ | ||
407 | |||
408 | parser_state.aml = buffer + sizeof(struct acpi_table_header); | ||
409 | opcode = acpi_ps_peek_opcode(&parser_state); | ||
410 | if (opcode != AML_METHOD_OP) { | ||
411 | return AE_BAD_PARAMETER; | ||
412 | } | ||
413 | |||
414 | /* Extract method information from the raw AML */ | ||
415 | |||
416 | parser_state.aml += acpi_ps_get_opcode_size(opcode); | ||
417 | parser_state.pkg_end = acpi_ps_get_next_package_end(&parser_state); | ||
418 | path = acpi_ps_get_next_namestring(&parser_state); | ||
419 | method_flags = *parser_state.aml++; | ||
420 | aml_start = parser_state.aml; | ||
421 | aml_length = ACPI_PTR_DIFF(parser_state.pkg_end, aml_start); | ||
422 | |||
423 | /* | ||
424 | * Allocate resources up-front. We don't want to have to delete a new | ||
425 | * node from the namespace if we cannot allocate memory. | ||
426 | */ | ||
427 | aml_buffer = ACPI_ALLOCATE(aml_length); | ||
428 | if (!aml_buffer) { | ||
429 | return AE_NO_MEMORY; | ||
430 | } | ||
431 | |||
432 | method_obj = acpi_ut_create_internal_object(ACPI_TYPE_METHOD); | ||
433 | if (!method_obj) { | ||
434 | ACPI_FREE(aml_buffer); | ||
435 | return AE_NO_MEMORY; | ||
436 | } | ||
437 | |||
438 | /* Lock namespace for acpi_ns_lookup, we may be creating a new node */ | ||
439 | |||
440 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | ||
441 | if (ACPI_FAILURE(status)) { | ||
442 | goto error_exit; | ||
443 | } | ||
444 | |||
445 | /* The lookup either returns an existing node or creates a new one */ | ||
446 | |||
447 | status = | ||
448 | acpi_ns_lookup(NULL, path, ACPI_TYPE_METHOD, ACPI_IMODE_LOAD_PASS1, | ||
449 | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND, | ||
450 | NULL, &node); | ||
451 | |||
452 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
453 | |||
454 | if (ACPI_FAILURE(status)) { /* ns_lookup */ | ||
455 | if (status != AE_ALREADY_EXISTS) { | ||
456 | goto error_exit; | ||
457 | } | ||
458 | |||
459 | /* Node existed previously, make sure it is a method node */ | ||
460 | |||
461 | if (node->type != ACPI_TYPE_METHOD) { | ||
462 | status = AE_TYPE; | ||
463 | goto error_exit; | ||
464 | } | ||
465 | } | ||
466 | |||
467 | /* Copy the method AML to the local buffer */ | ||
468 | |||
469 | ACPI_MEMCPY(aml_buffer, aml_start, aml_length); | ||
470 | |||
471 | /* Initialize the method object with the new method's information */ | ||
472 | |||
473 | method_obj->method.aml_start = aml_buffer; | ||
474 | method_obj->method.aml_length = aml_length; | ||
475 | |||
476 | method_obj->method.param_count = (u8) | ||
477 | (method_flags & AML_METHOD_ARG_COUNT); | ||
478 | |||
479 | method_obj->method.method_flags = (u8) | ||
480 | (method_flags & ~AML_METHOD_ARG_COUNT); | ||
481 | |||
482 | if (method_flags & AML_METHOD_SERIALIZED) { | ||
483 | method_obj->method.sync_level = (u8) | ||
484 | ((method_flags & AML_METHOD_SYNC_LEVEL) >> 4); | ||
485 | } | ||
486 | |||
487 | /* | ||
488 | * Now that it is complete, we can attach the new method object to | ||
489 | * the method Node (detaches/deletes any existing object) | ||
490 | */ | ||
491 | status = acpi_ns_attach_object(node, method_obj, ACPI_TYPE_METHOD); | ||
492 | |||
493 | /* | ||
494 | * Flag indicates AML buffer is dynamic, must be deleted later. | ||
495 | * Must be set only after attach above. | ||
496 | */ | ||
497 | node->flags |= ANOBJ_ALLOCATED_BUFFER; | ||
498 | |||
499 | /* Remove local reference to the method object */ | ||
500 | |||
501 | acpi_ut_remove_reference(method_obj); | ||
502 | return status; | ||
503 | |||
504 | error_exit: | ||
505 | |||
506 | ACPI_FREE(aml_buffer); | ||
507 | ACPI_FREE(method_obj); | ||
508 | return status; | ||
509 | } | ||
510 | ACPI_EXPORT_SYMBOL(acpi_install_method) | ||
diff --git a/drivers/acpi/acpica/nsxfobj.c b/drivers/acpi/acpica/nsxfobj.c index 1c7efc15225f..4071bad4458e 100644 --- a/drivers/acpi/acpica/nsxfobj.c +++ b/drivers/acpi/acpica/nsxfobj.c | |||
@@ -162,6 +162,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_type) | |||
162 | acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle) | 162 | acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle) |
163 | { | 163 | { |
164 | struct acpi_namespace_node *node; | 164 | struct acpi_namespace_node *node; |
165 | struct acpi_namespace_node *parent_node; | ||
165 | acpi_status status; | 166 | acpi_status status; |
166 | 167 | ||
167 | if (!ret_handle) { | 168 | if (!ret_handle) { |
@@ -189,12 +190,12 @@ acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle) | |||
189 | 190 | ||
190 | /* Get the parent entry */ | 191 | /* Get the parent entry */ |
191 | 192 | ||
192 | *ret_handle = | 193 | parent_node = acpi_ns_get_parent_node(node); |
193 | acpi_ns_convert_entry_to_handle(acpi_ns_get_parent_node(node)); | 194 | *ret_handle = acpi_ns_convert_entry_to_handle(parent_node); |
194 | 195 | ||
195 | /* Return exception if parent is null */ | 196 | /* Return exception if parent is null */ |
196 | 197 | ||
197 | if (!acpi_ns_get_parent_node(node)) { | 198 | if (!parent_node) { |
198 | status = AE_NULL_ENTRY; | 199 | status = AE_NULL_ENTRY; |
199 | } | 200 | } |
200 | 201 | ||
@@ -268,7 +269,7 @@ acpi_get_next_object(acpi_object_type type, | |||
268 | 269 | ||
269 | /* Internal function does the real work */ | 270 | /* Internal function does the real work */ |
270 | 271 | ||
271 | node = acpi_ns_get_next_node(type, parent_node, child_node); | 272 | node = acpi_ns_get_next_node_typed(type, parent_node, child_node); |
272 | if (!node) { | 273 | if (!node) { |
273 | status = AE_NOT_FOUND; | 274 | status = AE_NOT_FOUND; |
274 | goto unlock_and_exit; | 275 | goto unlock_and_exit; |
diff --git a/drivers/acpi/acpica/rscalc.c b/drivers/acpi/acpica/rscalc.c index 88b5a2c4814d..3c4dcc3d1069 100644 --- a/drivers/acpi/acpica/rscalc.c +++ b/drivers/acpi/acpica/rscalc.c | |||
@@ -547,7 +547,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, | |||
547 | 547 | ||
548 | if (!package_element || | 548 | if (!package_element || |
549 | (package_element->common.type != ACPI_TYPE_PACKAGE)) { | 549 | (package_element->common.type != ACPI_TYPE_PACKAGE)) { |
550 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 550 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
551 | } | 551 | } |
552 | 552 | ||
553 | /* | 553 | /* |
@@ -593,9 +593,6 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, | |||
593 | } else { | 593 | } else { |
594 | temp_size_needed += | 594 | temp_size_needed += |
595 | acpi_ns_get_pathname_length((*sub_object_list)->reference.node); | 595 | acpi_ns_get_pathname_length((*sub_object_list)->reference.node); |
596 | if (!temp_size_needed) { | ||
597 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
598 | } | ||
599 | } | 596 | } |
600 | } else { | 597 | } else { |
601 | /* | 598 | /* |
diff --git a/drivers/acpi/acpica/rsxface.c b/drivers/acpi/acpica/rsxface.c index 69a2aa5b5d83..395212bcd19b 100644 --- a/drivers/acpi/acpica/rsxface.c +++ b/drivers/acpi/acpica/rsxface.c | |||
@@ -338,13 +338,17 @@ acpi_resource_to_address64(struct acpi_resource *resource, | |||
338 | switch (resource->type) { | 338 | switch (resource->type) { |
339 | case ACPI_RESOURCE_TYPE_ADDRESS16: | 339 | case ACPI_RESOURCE_TYPE_ADDRESS16: |
340 | 340 | ||
341 | address16 = (struct acpi_resource_address16 *)&resource->data; | 341 | address16 = |
342 | ACPI_CAST_PTR(struct acpi_resource_address16, | ||
343 | &resource->data); | ||
342 | ACPI_COPY_ADDRESS(out, address16); | 344 | ACPI_COPY_ADDRESS(out, address16); |
343 | break; | 345 | break; |
344 | 346 | ||
345 | case ACPI_RESOURCE_TYPE_ADDRESS32: | 347 | case ACPI_RESOURCE_TYPE_ADDRESS32: |
346 | 348 | ||
347 | address32 = (struct acpi_resource_address32 *)&resource->data; | 349 | address32 = |
350 | ACPI_CAST_PTR(struct acpi_resource_address32, | ||
351 | &resource->data); | ||
348 | ACPI_COPY_ADDRESS(out, address32); | 352 | ACPI_COPY_ADDRESS(out, address32); |
349 | break; | 353 | break; |
350 | 354 | ||
diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c index 71e655d14cb0..82b02dcb942e 100644 --- a/drivers/acpi/acpica/tbfadt.c +++ b/drivers/acpi/acpica/tbfadt.c | |||
@@ -284,9 +284,9 @@ void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length) | |||
284 | if (length > sizeof(struct acpi_table_fadt)) { | 284 | if (length > sizeof(struct acpi_table_fadt)) { |
285 | ACPI_WARNING((AE_INFO, | 285 | ACPI_WARNING((AE_INFO, |
286 | "FADT (revision %u) is longer than ACPI 2.0 version, " | 286 | "FADT (revision %u) is longer than ACPI 2.0 version, " |
287 | "truncating length 0x%X to 0x%zX", | 287 | "truncating length 0x%X to 0x%X", |
288 | table->revision, (unsigned)length, | 288 | table->revision, length, |
289 | sizeof(struct acpi_table_fadt))); | 289 | (u32)sizeof(struct acpi_table_fadt))); |
290 | } | 290 | } |
291 | 291 | ||
292 | /* Clear the entire local FADT */ | 292 | /* Clear the entire local FADT */ |
@@ -441,7 +441,7 @@ static void acpi_tb_convert_fadt(void) | |||
441 | &acpi_gbl_FADT, | 441 | &acpi_gbl_FADT, |
442 | fadt_info_table | 442 | fadt_info_table |
443 | [i].length), | 443 | [i].length), |
444 | address32); | 444 | (u64) address32); |
445 | } | 445 | } |
446 | } | 446 | } |
447 | } | 447 | } |
@@ -469,7 +469,6 @@ static void acpi_tb_convert_fadt(void) | |||
469 | static void acpi_tb_validate_fadt(void) | 469 | static void acpi_tb_validate_fadt(void) |
470 | { | 470 | { |
471 | char *name; | 471 | char *name; |
472 | u32 *address32; | ||
473 | struct acpi_generic_address *address64; | 472 | struct acpi_generic_address *address64; |
474 | u8 length; | 473 | u8 length; |
475 | u32 i; | 474 | u32 i; |
@@ -505,15 +504,12 @@ static void acpi_tb_validate_fadt(void) | |||
505 | 504 | ||
506 | for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) { | 505 | for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) { |
507 | /* | 506 | /* |
508 | * Generate pointers to the 32-bit and 64-bit addresses, get the | 507 | * Generate pointer to the 64-bit address, get the register |
509 | * register length (width), and the register name | 508 | * length (width) and the register name |
510 | */ | 509 | */ |
511 | address64 = ACPI_ADD_PTR(struct acpi_generic_address, | 510 | address64 = ACPI_ADD_PTR(struct acpi_generic_address, |
512 | &acpi_gbl_FADT, | 511 | &acpi_gbl_FADT, |
513 | fadt_info_table[i].address64); | 512 | fadt_info_table[i].address64); |
514 | address32 = | ||
515 | ACPI_ADD_PTR(u32, &acpi_gbl_FADT, | ||
516 | fadt_info_table[i].address32); | ||
517 | length = | 513 | length = |
518 | *ACPI_ADD_PTR(u8, &acpi_gbl_FADT, | 514 | *ACPI_ADD_PTR(u8, &acpi_gbl_FADT, |
519 | fadt_info_table[i].length); | 515 | fadt_info_table[i].length); |
diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c index f865d5a096de..63e82329a9e8 100644 --- a/drivers/acpi/acpica/tbinstal.c +++ b/drivers/acpi/acpica/tbinstal.c | |||
@@ -472,7 +472,7 @@ acpi_status acpi_tb_delete_namespace_by_owner(u32 table_index) | |||
472 | * lock may block, and also since the execution of a namespace walk | 472 | * lock may block, and also since the execution of a namespace walk |
473 | * must be allowed to use the interpreter. | 473 | * must be allowed to use the interpreter. |
474 | */ | 474 | */ |
475 | acpi_ut_release_mutex(ACPI_MTX_INTERPRETER); | 475 | (void)acpi_ut_release_mutex(ACPI_MTX_INTERPRETER); |
476 | status = acpi_ut_acquire_write_lock(&acpi_gbl_namespace_rw_lock); | 476 | status = acpi_ut_acquire_write_lock(&acpi_gbl_namespace_rw_lock); |
477 | 477 | ||
478 | acpi_ns_delete_namespace_by_owner(owner_id); | 478 | acpi_ns_delete_namespace_by_owner(owner_id); |
diff --git a/drivers/acpi/acpica/utcopy.c b/drivers/acpi/acpica/utcopy.c index 919624f123d5..0f0c64bf8ac9 100644 --- a/drivers/acpi/acpica/utcopy.c +++ b/drivers/acpi/acpica/utcopy.c | |||
@@ -676,6 +676,7 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc, | |||
676 | { | 676 | { |
677 | u16 reference_count; | 677 | u16 reference_count; |
678 | union acpi_operand_object *next_object; | 678 | union acpi_operand_object *next_object; |
679 | acpi_status status; | ||
679 | 680 | ||
680 | /* Save fields from destination that we don't want to overwrite */ | 681 | /* Save fields from destination that we don't want to overwrite */ |
681 | 682 | ||
@@ -768,6 +769,28 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc, | |||
768 | } | 769 | } |
769 | break; | 770 | break; |
770 | 771 | ||
772 | /* | ||
773 | * For Mutex and Event objects, we cannot simply copy the underlying | ||
774 | * OS object. We must create a new one. | ||
775 | */ | ||
776 | case ACPI_TYPE_MUTEX: | ||
777 | |||
778 | status = acpi_os_create_mutex(&dest_desc->mutex.os_mutex); | ||
779 | if (ACPI_FAILURE(status)) { | ||
780 | return status; | ||
781 | } | ||
782 | break; | ||
783 | |||
784 | case ACPI_TYPE_EVENT: | ||
785 | |||
786 | status = acpi_os_create_semaphore(ACPI_NO_UNIT_LIMIT, 0, | ||
787 | &dest_desc->event. | ||
788 | os_semaphore); | ||
789 | if (ACPI_FAILURE(status)) { | ||
790 | return status; | ||
791 | } | ||
792 | break; | ||
793 | |||
771 | default: | 794 | default: |
772 | /* Nothing to do for other simple objects */ | 795 | /* Nothing to do for other simple objects */ |
773 | break; | 796 | break; |
diff --git a/drivers/acpi/acpica/utdebug.c b/drivers/acpi/acpica/utdebug.c index 38821f53042c..527d729f6815 100644 --- a/drivers/acpi/acpica/utdebug.c +++ b/drivers/acpi/acpica/utdebug.c | |||
@@ -179,9 +179,9 @@ acpi_debug_print(u32 requested_debug_level, | |||
179 | if (thread_id != acpi_gbl_prev_thread_id) { | 179 | if (thread_id != acpi_gbl_prev_thread_id) { |
180 | if (ACPI_LV_THREADS & acpi_dbg_level) { | 180 | if (ACPI_LV_THREADS & acpi_dbg_level) { |
181 | acpi_os_printf | 181 | acpi_os_printf |
182 | ("\n**** Context Switch from TID %lX to TID %lX ****\n\n", | 182 | ("\n**** Context Switch from TID %p to TID %p ****\n\n", |
183 | (unsigned long)acpi_gbl_prev_thread_id, | 183 | ACPI_CAST_PTR(void, acpi_gbl_prev_thread_id), |
184 | (unsigned long)thread_id); | 184 | ACPI_CAST_PTR(void, thread_id)); |
185 | } | 185 | } |
186 | 186 | ||
187 | acpi_gbl_prev_thread_id = thread_id; | 187 | acpi_gbl_prev_thread_id = thread_id; |
@@ -194,7 +194,7 @@ acpi_debug_print(u32 requested_debug_level, | |||
194 | acpi_os_printf("%8s-%04ld ", module_name, line_number); | 194 | acpi_os_printf("%8s-%04ld ", module_name, line_number); |
195 | 195 | ||
196 | if (ACPI_LV_THREADS & acpi_dbg_level) { | 196 | if (ACPI_LV_THREADS & acpi_dbg_level) { |
197 | acpi_os_printf("[%04lX] ", (unsigned long)thread_id); | 197 | acpi_os_printf("[%p] ", ACPI_CAST_PTR(void, thread_id)); |
198 | } | 198 | } |
199 | 199 | ||
200 | acpi_os_printf("[%02ld] %-22.22s: ", | 200 | acpi_os_printf("[%02ld] %-22.22s: ", |
diff --git a/drivers/acpi/acpica/utdelete.c b/drivers/acpi/acpica/utdelete.c index a5ee23bc4f55..bc1710315088 100644 --- a/drivers/acpi/acpica/utdelete.c +++ b/drivers/acpi/acpica/utdelete.c | |||
@@ -75,6 +75,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) | |||
75 | union acpi_operand_object *handler_desc; | 75 | union acpi_operand_object *handler_desc; |
76 | union acpi_operand_object *second_desc; | 76 | union acpi_operand_object *second_desc; |
77 | union acpi_operand_object *next_desc; | 77 | union acpi_operand_object *next_desc; |
78 | union acpi_operand_object **last_obj_ptr; | ||
78 | 79 | ||
79 | ACPI_FUNCTION_TRACE_PTR(ut_delete_internal_obj, object); | 80 | ACPI_FUNCTION_TRACE_PTR(ut_delete_internal_obj, object); |
80 | 81 | ||
@@ -223,6 +224,26 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) | |||
223 | */ | 224 | */ |
224 | handler_desc = object->region.handler; | 225 | handler_desc = object->region.handler; |
225 | if (handler_desc) { | 226 | if (handler_desc) { |
227 | next_desc = | ||
228 | handler_desc->address_space.region_list; | ||
229 | last_obj_ptr = | ||
230 | &handler_desc->address_space.region_list; | ||
231 | |||
232 | /* Remove the region object from the handler's list */ | ||
233 | |||
234 | while (next_desc) { | ||
235 | if (next_desc == object) { | ||
236 | *last_obj_ptr = | ||
237 | next_desc->region.next; | ||
238 | break; | ||
239 | } | ||
240 | |||
241 | /* Walk the linked list of handler */ | ||
242 | |||
243 | last_obj_ptr = &next_desc->region.next; | ||
244 | next_desc = next_desc->region.next; | ||
245 | } | ||
246 | |||
226 | if (handler_desc->address_space.handler_flags & | 247 | if (handler_desc->address_space.handler_flags & |
227 | ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) { | 248 | ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) { |
228 | 249 | ||
diff --git a/drivers/acpi/acpica/utmisc.c b/drivers/acpi/acpica/utmisc.c index 1c9e250caefb..fbe782348b0b 100644 --- a/drivers/acpi/acpica/utmisc.c +++ b/drivers/acpi/acpica/utmisc.c | |||
@@ -1033,11 +1033,12 @@ acpi_error(const char *module_name, u32 line_number, const char *format, ...) | |||
1033 | { | 1033 | { |
1034 | va_list args; | 1034 | va_list args; |
1035 | 1035 | ||
1036 | acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); | 1036 | acpi_os_printf("ACPI Error: "); |
1037 | 1037 | ||
1038 | va_start(args, format); | 1038 | va_start(args, format); |
1039 | acpi_os_vprintf(format, args); | 1039 | acpi_os_vprintf(format, args); |
1040 | acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); | 1040 | acpi_os_printf(" %8.8X %s-%u\n", ACPI_CA_VERSION, module_name, |
1041 | line_number); | ||
1041 | va_end(args); | 1042 | va_end(args); |
1042 | } | 1043 | } |
1043 | 1044 | ||
@@ -1047,12 +1048,12 @@ acpi_exception(const char *module_name, | |||
1047 | { | 1048 | { |
1048 | va_list args; | 1049 | va_list args; |
1049 | 1050 | ||
1050 | acpi_os_printf("ACPI Exception (%s-%04d): %s, ", module_name, | 1051 | acpi_os_printf("ACPI Exception: %s, ", acpi_format_exception(status)); |
1051 | line_number, acpi_format_exception(status)); | ||
1052 | 1052 | ||
1053 | va_start(args, format); | 1053 | va_start(args, format); |
1054 | acpi_os_vprintf(format, args); | 1054 | acpi_os_vprintf(format, args); |
1055 | acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); | 1055 | acpi_os_printf(" %8.8X %s-%u\n", ACPI_CA_VERSION, module_name, |
1056 | line_number); | ||
1056 | va_end(args); | 1057 | va_end(args); |
1057 | } | 1058 | } |
1058 | 1059 | ||
@@ -1061,11 +1062,12 @@ acpi_warning(const char *module_name, u32 line_number, const char *format, ...) | |||
1061 | { | 1062 | { |
1062 | va_list args; | 1063 | va_list args; |
1063 | 1064 | ||
1064 | acpi_os_printf("ACPI Warning (%s-%04d): ", module_name, line_number); | 1065 | acpi_os_printf("ACPI Warning: "); |
1065 | 1066 | ||
1066 | va_start(args, format); | 1067 | va_start(args, format); |
1067 | acpi_os_vprintf(format, args); | 1068 | acpi_os_vprintf(format, args); |
1068 | acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); | 1069 | acpi_os_printf(" %8.8X %s-%u\n", ACPI_CA_VERSION, module_name, |
1070 | line_number); | ||
1069 | va_end(args); | 1071 | va_end(args); |
1070 | } | 1072 | } |
1071 | 1073 | ||
@@ -1074,10 +1076,6 @@ acpi_info(const char *module_name, u32 line_number, const char *format, ...) | |||
1074 | { | 1076 | { |
1075 | va_list args; | 1077 | va_list args; |
1076 | 1078 | ||
1077 | /* | ||
1078 | * Removed module_name, line_number, and acpica version, not needed | ||
1079 | * for info output | ||
1080 | */ | ||
1081 | acpi_os_printf("ACPI: "); | 1079 | acpi_os_printf("ACPI: "); |
1082 | 1080 | ||
1083 | va_start(args, format); | 1081 | va_start(args, format); |
diff --git a/drivers/acpi/acpica/utmutex.c b/drivers/acpi/acpica/utmutex.c index 26c93a748e64..80bb65154117 100644 --- a/drivers/acpi/acpica/utmutex.c +++ b/drivers/acpi/acpica/utmutex.c | |||
@@ -230,17 +230,18 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) | |||
230 | if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { | 230 | if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { |
231 | if (i == mutex_id) { | 231 | if (i == mutex_id) { |
232 | ACPI_ERROR((AE_INFO, | 232 | ACPI_ERROR((AE_INFO, |
233 | "Mutex [%s] already acquired by this thread [%X]", | 233 | "Mutex [%s] already acquired by this thread [%p]", |
234 | acpi_ut_get_mutex_name | 234 | acpi_ut_get_mutex_name |
235 | (mutex_id), | 235 | (mutex_id), |
236 | this_thread_id)); | 236 | ACPI_CAST_PTR(void, |
237 | this_thread_id))); | ||
237 | 238 | ||
238 | return (AE_ALREADY_ACQUIRED); | 239 | return (AE_ALREADY_ACQUIRED); |
239 | } | 240 | } |
240 | 241 | ||
241 | ACPI_ERROR((AE_INFO, | 242 | ACPI_ERROR((AE_INFO, |
242 | "Invalid acquire order: Thread %X owns [%s], wants [%s]", | 243 | "Invalid acquire order: Thread %p owns [%s], wants [%s]", |
243 | this_thread_id, | 244 | ACPI_CAST_PTR(void, this_thread_id), |
244 | acpi_ut_get_mutex_name(i), | 245 | acpi_ut_get_mutex_name(i), |
245 | acpi_ut_get_mutex_name(mutex_id))); | 246 | acpi_ut_get_mutex_name(mutex_id))); |
246 | 247 | ||
@@ -251,24 +252,24 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) | |||
251 | #endif | 252 | #endif |
252 | 253 | ||
253 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, | 254 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, |
254 | "Thread %lX attempting to acquire Mutex [%s]\n", | 255 | "Thread %p attempting to acquire Mutex [%s]\n", |
255 | (unsigned long)this_thread_id, | 256 | ACPI_CAST_PTR(void, this_thread_id), |
256 | acpi_ut_get_mutex_name(mutex_id))); | 257 | acpi_ut_get_mutex_name(mutex_id))); |
257 | 258 | ||
258 | status = acpi_os_acquire_mutex(acpi_gbl_mutex_info[mutex_id].mutex, | 259 | status = acpi_os_acquire_mutex(acpi_gbl_mutex_info[mutex_id].mutex, |
259 | ACPI_WAIT_FOREVER); | 260 | ACPI_WAIT_FOREVER); |
260 | if (ACPI_SUCCESS(status)) { | 261 | if (ACPI_SUCCESS(status)) { |
261 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, | 262 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, |
262 | "Thread %lX acquired Mutex [%s]\n", | 263 | "Thread %p acquired Mutex [%s]\n", |
263 | (unsigned long)this_thread_id, | 264 | ACPI_CAST_PTR(void, this_thread_id), |
264 | acpi_ut_get_mutex_name(mutex_id))); | 265 | acpi_ut_get_mutex_name(mutex_id))); |
265 | 266 | ||
266 | acpi_gbl_mutex_info[mutex_id].use_count++; | 267 | acpi_gbl_mutex_info[mutex_id].use_count++; |
267 | acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id; | 268 | acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id; |
268 | } else { | 269 | } else { |
269 | ACPI_EXCEPTION((AE_INFO, status, | 270 | ACPI_EXCEPTION((AE_INFO, status, |
270 | "Thread %lX could not acquire Mutex [%X]", | 271 | "Thread %p could not acquire Mutex [%X]", |
271 | (unsigned long)this_thread_id, mutex_id)); | 272 | ACPI_CAST_PTR(void, this_thread_id), mutex_id)); |
272 | } | 273 | } |
273 | 274 | ||
274 | return (status); | 275 | return (status); |
@@ -293,9 +294,8 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) | |||
293 | ACPI_FUNCTION_NAME(ut_release_mutex); | 294 | ACPI_FUNCTION_NAME(ut_release_mutex); |
294 | 295 | ||
295 | this_thread_id = acpi_os_get_thread_id(); | 296 | this_thread_id = acpi_os_get_thread_id(); |
296 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, | 297 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Thread %p releasing Mutex [%s]\n", |
297 | "Thread %lX releasing Mutex [%s]\n", | 298 | ACPI_CAST_PTR(void, this_thread_id), |
298 | (unsigned long)this_thread_id, | ||
299 | acpi_ut_get_mutex_name(mutex_id))); | 299 | acpi_ut_get_mutex_name(mutex_id))); |
300 | 300 | ||
301 | if (mutex_id > ACPI_MAX_MUTEX) { | 301 | if (mutex_id > ACPI_MAX_MUTEX) { |
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 4db89e98535d..82ec6a3c0500 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h | |||
@@ -47,7 +47,7 @@ | |||
47 | 47 | ||
48 | /* Current ACPICA subsystem version in YYYYMMDD format */ | 48 | /* Current ACPICA subsystem version in YYYYMMDD format */ |
49 | 49 | ||
50 | #define ACPI_CA_VERSION 0x20090320 | 50 | #define ACPI_CA_VERSION 0x20090521 |
51 | 51 | ||
52 | #include "actypes.h" | 52 | #include "actypes.h" |
53 | #include "actbl.h" | 53 | #include "actbl.h" |
@@ -201,6 +201,8 @@ acpi_evaluate_object_typed(acpi_handle object, | |||
201 | acpi_status | 201 | acpi_status |
202 | acpi_get_object_info(acpi_handle handle, struct acpi_buffer *return_buffer); | 202 | acpi_get_object_info(acpi_handle handle, struct acpi_buffer *return_buffer); |
203 | 203 | ||
204 | acpi_status acpi_install_method(u8 *buffer); | ||
205 | |||
204 | acpi_status | 206 | acpi_status |
205 | acpi_get_next_object(acpi_object_type type, | 207 | acpi_get_next_object(acpi_object_type type, |
206 | acpi_handle parent, | 208 | acpi_handle parent, |
@@ -375,7 +377,7 @@ acpi_status acpi_leave_sleep_state_prep(u8 sleep_state); | |||
375 | acpi_status acpi_leave_sleep_state(u8 sleep_state); | 377 | acpi_status acpi_leave_sleep_state(u8 sleep_state); |
376 | 378 | ||
377 | /* | 379 | /* |
378 | * Debug output | 380 | * Error/Warning output |
379 | */ | 381 | */ |
380 | void ACPI_INTERNAL_VAR_XFACE | 382 | void ACPI_INTERNAL_VAR_XFACE |
381 | acpi_error(const char *module_name, | 383 | acpi_error(const char *module_name, |
@@ -394,6 +396,9 @@ void ACPI_INTERNAL_VAR_XFACE | |||
394 | acpi_info(const char *module_name, | 396 | acpi_info(const char *module_name, |
395 | u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3); | 397 | u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3); |
396 | 398 | ||
399 | /* | ||
400 | * Debug output | ||
401 | */ | ||
397 | #ifdef ACPI_DEBUG_OUTPUT | 402 | #ifdef ACPI_DEBUG_OUTPUT |
398 | 403 | ||
399 | void ACPI_INTERNAL_VAR_XFACE | 404 | void ACPI_INTERNAL_VAR_XFACE |
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index f555d927f7c0..37ba576d06e8 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h | |||
@@ -429,20 +429,12 @@ typedef unsigned long long acpi_integer; | |||
429 | 429 | ||
430 | /* Data manipulation */ | 430 | /* Data manipulation */ |
431 | 431 | ||
432 | #define ACPI_LOWORD(l) ((u16)(u32)(l)) | 432 | #define ACPI_LOBYTE(integer) ((u8) (u16)(integer)) |
433 | #define ACPI_HIWORD(l) ((u16)((((u32)(l)) >> 16) & 0xFFFF)) | 433 | #define ACPI_HIBYTE(integer) ((u8) (((u16)(integer)) >> 8)) |
434 | #define ACPI_LOBYTE(l) ((u8)(u16)(l)) | 434 | #define ACPI_LOWORD(integer) ((u16) (u32)(integer)) |
435 | #define ACPI_HIBYTE(l) ((u8)((((u16)(l)) >> 8) & 0xFF)) | 435 | #define ACPI_HIWORD(integer) ((u16)(((u32)(integer)) >> 16)) |
436 | 436 | #define ACPI_LODWORD(integer64) ((u32) (u64)(integer64)) | |
437 | /* Full 64-bit integer must be available on both 32-bit and 64-bit platforms */ | 437 | #define ACPI_HIDWORD(integer64) ((u32)(((u64)(integer64)) >> 32)) |
438 | |||
439 | struct acpi_integer_overlay { | ||
440 | u32 lo_dword; | ||
441 | u32 hi_dword; | ||
442 | }; | ||
443 | |||
444 | #define ACPI_LODWORD(integer) (ACPI_CAST_PTR (struct acpi_integer_overlay, &integer)->lo_dword) | ||
445 | #define ACPI_HIDWORD(integer) (ACPI_CAST_PTR (struct acpi_integer_overlay, &integer)->hi_dword) | ||
446 | 438 | ||
447 | #define ACPI_SET_BIT(target,bit) ((target) |= (bit)) | 439 | #define ACPI_SET_BIT(target,bit) ((target) |= (bit)) |
448 | #define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit)) | 440 | #define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit)) |
diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h index 8e2cdc57b197..935c5d7fc86e 100644 --- a/include/acpi/platform/acgcc.h +++ b/include/acpi/platform/acgcc.h | |||
@@ -62,4 +62,8 @@ | |||
62 | */ | 62 | */ |
63 | #define ACPI_UNUSED_VAR __attribute__ ((unused)) | 63 | #define ACPI_UNUSED_VAR __attribute__ ((unused)) |
64 | 64 | ||
65 | #ifdef _ANSI | ||
66 | #define inline | ||
67 | #endif | ||
68 | |||
65 | #endif /* __ACGCC_H__ */ | 69 | #endif /* __ACGCC_H__ */ |
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h index 6d49b2a498c4..fcb8e4b159b1 100644 --- a/include/acpi/platform/aclinux.h +++ b/include/acpi/platform/aclinux.h | |||
@@ -1,11 +1,11 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | * | 2 | * |
3 | * Name: aclinux.h - OS specific defines, etc. | 3 | * Name: aclinux.h - OS specific defines, etc. for Linux |
4 | * | 4 | * |
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2009, 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 |
@@ -44,10 +44,13 @@ | |||
44 | #ifndef __ACLINUX_H__ | 44 | #ifndef __ACLINUX_H__ |
45 | #define __ACLINUX_H__ | 45 | #define __ACLINUX_H__ |
46 | 46 | ||
47 | /* Common (in-kernel/user-space) ACPICA configuration */ | ||
48 | |||
47 | #define ACPI_USE_SYSTEM_CLIBRARY | 49 | #define ACPI_USE_SYSTEM_CLIBRARY |
48 | #define ACPI_USE_DO_WHILE_0 | 50 | #define ACPI_USE_DO_WHILE_0 |
49 | #define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE | 51 | #define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE |
50 | 52 | ||
53 | |||
51 | #ifdef __KERNEL__ | 54 | #ifdef __KERNEL__ |
52 | 55 | ||
53 | #include <linux/string.h> | 56 | #include <linux/string.h> |
@@ -63,15 +66,18 @@ | |||
63 | #include <linux/spinlock_types.h> | 66 | #include <linux/spinlock_types.h> |
64 | #include <asm/current.h> | 67 | #include <asm/current.h> |
65 | 68 | ||
66 | /* Host-dependent types and defines */ | 69 | /* Host-dependent types and defines for in-kernel ACPICA */ |
67 | 70 | ||
68 | #define ACPI_MACHINE_WIDTH BITS_PER_LONG | 71 | #define ACPI_MACHINE_WIDTH BITS_PER_LONG |
69 | #define acpi_cache_t struct kmem_cache | ||
70 | #define acpi_spinlock spinlock_t * | ||
71 | #define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol); | 72 | #define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol); |
72 | #define strtoul simple_strtoul | 73 | #define strtoul simple_strtoul |
73 | 74 | ||
74 | #else /* !__KERNEL__ */ | 75 | #define acpi_cache_t struct kmem_cache |
76 | #define acpi_spinlock spinlock_t * | ||
77 | #define acpi_cpu_flags unsigned long | ||
78 | #define acpi_thread_id struct task_struct * | ||
79 | |||
80 | #else /* !__KERNEL__ */ | ||
75 | 81 | ||
76 | #include <stdarg.h> | 82 | #include <stdarg.h> |
77 | #include <string.h> | 83 | #include <string.h> |
@@ -79,6 +85,11 @@ | |||
79 | #include <ctype.h> | 85 | #include <ctype.h> |
80 | #include <unistd.h> | 86 | #include <unistd.h> |
81 | 87 | ||
88 | /* Host-dependent types and defines for user-space ACPICA */ | ||
89 | |||
90 | #define ACPI_FLUSH_CPU_CACHE() | ||
91 | #define acpi_thread_id pthread_t | ||
92 | |||
82 | #if defined(__ia64__) || defined(__x86_64__) | 93 | #if defined(__ia64__) || defined(__x86_64__) |
83 | #define ACPI_MACHINE_WIDTH 64 | 94 | #define ACPI_MACHINE_WIDTH 64 |
84 | #define COMPILER_DEPENDENT_INT64 long | 95 | #define COMPILER_DEPENDENT_INT64 long |
@@ -94,17 +105,17 @@ | |||
94 | #define __cdecl | 105 | #define __cdecl |
95 | #endif | 106 | #endif |
96 | 107 | ||
97 | #define ACPI_FLUSH_CPU_CACHE() | 108 | #endif /* __KERNEL__ */ |
98 | #endif /* __KERNEL__ */ | ||
99 | 109 | ||
100 | /* Linux uses GCC */ | 110 | /* Linux uses GCC */ |
101 | 111 | ||
102 | #include "acgcc.h" | 112 | #include "acgcc.h" |
103 | 113 | ||
104 | #define acpi_cpu_flags unsigned long | ||
105 | |||
106 | #define acpi_thread_id struct task_struct * | ||
107 | 114 | ||
115 | #ifdef __KERNEL__ | ||
116 | /* | ||
117 | * Overrides for in-kernel ACPICA | ||
118 | */ | ||
108 | static inline acpi_thread_id acpi_os_get_thread_id(void) | 119 | static inline acpi_thread_id acpi_os_get_thread_id(void) |
109 | { | 120 | { |
110 | return current; | 121 | return current; |
@@ -119,30 +130,32 @@ static inline acpi_thread_id acpi_os_get_thread_id(void) | |||
119 | #include <acpi/actypes.h> | 130 | #include <acpi/actypes.h> |
120 | static inline void *acpi_os_allocate(acpi_size size) | 131 | static inline void *acpi_os_allocate(acpi_size size) |
121 | { | 132 | { |
122 | return kmalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL); | 133 | return kmalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL); |
123 | } | 134 | } |
135 | |||
124 | static inline void *acpi_os_allocate_zeroed(acpi_size size) | 136 | static inline void *acpi_os_allocate_zeroed(acpi_size size) |
125 | { | 137 | { |
126 | return kzalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL); | 138 | return kzalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL); |
127 | } | 139 | } |
128 | 140 | ||
129 | static inline void *acpi_os_acquire_object(acpi_cache_t * cache) | 141 | static inline void *acpi_os_acquire_object(acpi_cache_t * cache) |
130 | { | 142 | { |
131 | return kmem_cache_zalloc(cache, | 143 | return kmem_cache_zalloc(cache, |
132 | irqs_disabled()? GFP_ATOMIC : GFP_KERNEL); | 144 | irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL); |
133 | } | 145 | } |
134 | 146 | ||
135 | #define ACPI_ALLOCATE(a) acpi_os_allocate(a) | 147 | #define ACPI_ALLOCATE(a) acpi_os_allocate(a) |
136 | #define ACPI_ALLOCATE_ZEROED(a) acpi_os_allocate_zeroed(a) | 148 | #define ACPI_ALLOCATE_ZEROED(a) acpi_os_allocate_zeroed(a) |
137 | #define ACPI_FREE(a) kfree(a) | 149 | #define ACPI_FREE(a) kfree(a) |
138 | 150 | ||
139 | /* | 151 | /* Used within ACPICA to show where it is safe to preempt execution */ |
140 | * We need to show where it is safe to preempt execution of ACPICA | 152 | |
141 | */ | 153 | #define ACPI_PREEMPTION_POINT() \ |
142 | #define ACPI_PREEMPTION_POINT() \ | 154 | do { \ |
143 | do { \ | 155 | if (!irqs_disabled()) \ |
144 | if (!irqs_disabled()) \ | 156 | cond_resched(); \ |
145 | cond_resched(); \ | ||
146 | } while (0) | 157 | } while (0) |
147 | 158 | ||
148 | #endif /* __ACLINUX_H__ */ | 159 | #endif /* __KERNEL__ */ |
160 | |||
161 | #endif /* __ACLINUX_H__ */ | ||