aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2006-06-08 16:29:00 -0400
committerLen Brown <len.brown@intel.com>2006-06-14 02:45:47 -0400
commit4c90ece249992c7a2e3fc921e5cdb8eb92193067 (patch)
treee145ffe472802ef870ba1eaea150b688c19e45ca /drivers/acpi
parent4119532c95547821dbe72d6916dfa1b2148475b3 (diff)
ACPI: ACPICA 20060608
Converted the locking mutex used for the ACPI hardware to a spinlock. This change should eliminate all problems caused by attempting to acquire a semaphore at interrupt level, and it means that all ACPICA external interfaces that directly access the ACPI hardware can be safely called from interrupt level. Fixed a regression introduced in 20060526 where the ACPI device initialization could be prematurely aborted with an AE_NOT_FOUND if a device did not have an optional _INI method. Fixed an IndexField issue where a write to the Data Register should be limited in size to the AccessSize (width) of the IndexField itself. (BZ 433, Fiodor Suietov) Fixed problem reports (Valery Podrezov) integrated: - Allow store of ThermalZone objects to Debug object. http://bugzilla.kernel.org/show_bug.cgi?id=5369 http://bugzilla.kernel.org/show_bug.cgi?id=5370 Fixed problem reports (Fiodor Suietov) integrated: - acpi_get_table_header() doesn't handle multiple instances correctly (BZ 364) Removed four global mutexes that were obsolete and were no longer being used. Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/dispatcher/dsmethod.c4
-rw-r--r--drivers/acpi/events/evgpe.c17
-rw-r--r--drivers/acpi/executer/exfldio.c8
-rw-r--r--drivers/acpi/executer/exoparg1.c10
-rw-r--r--drivers/acpi/executer/exresnte.c6
-rw-r--r--drivers/acpi/executer/exresolv.c20
-rw-r--r--drivers/acpi/executer/exutils.c4
-rw-r--r--drivers/acpi/hardware/hwregs.c59
-rw-r--r--drivers/acpi/namespace/nsinit.c5
-rw-r--r--drivers/acpi/osl.c3
-rw-r--r--drivers/acpi/tables/tbutils.c17
-rw-r--r--drivers/acpi/utilities/utglobal.c4
-rw-r--r--drivers/acpi/utilities/utmutex.c26
13 files changed, 96 insertions, 87 deletions
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c
index 21f059986273..bc9aca4e7401 100644
--- a/drivers/acpi/dispatcher/dsmethod.c
+++ b/drivers/acpi/dispatcher/dsmethod.c
@@ -507,7 +507,7 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,
507 * If this is the last thread executing the method, 507 * If this is the last thread executing the method,
508 * we have additional cleanup to perform 508 * we have additional cleanup to perform
509 */ 509 */
510 status = acpi_ut_acquire_mutex(ACPI_MTX_PARSER); 510 status = acpi_ut_acquire_mutex(ACPI_MTX_CONTROL_METHOD);
511 if (ACPI_FAILURE(status)) { 511 if (ACPI_FAILURE(status)) {
512 return_VOID; 512 return_VOID;
513 } 513 }
@@ -600,7 +600,7 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,
600 } 600 }
601 601
602 exit: 602 exit:
603 (void)acpi_ut_release_mutex(ACPI_MTX_PARSER); 603 (void)acpi_ut_release_mutex(ACPI_MTX_CONTROL_METHOD);
604 return_VOID; 604 return_VOID;
605} 605}
606 606
diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c
index 23fe53ba7375..f01d339407f8 100644
--- a/drivers/acpi/events/evgpe.c
+++ b/drivers/acpi/events/evgpe.c
@@ -382,6 +382,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
382 u32 status_reg; 382 u32 status_reg;
383 u32 enable_reg; 383 u32 enable_reg;
384 acpi_cpu_flags flags; 384 acpi_cpu_flags flags;
385 acpi_cpu_flags hw_flags;
385 acpi_native_uint i; 386 acpi_native_uint i;
386 acpi_native_uint j; 387 acpi_native_uint j;
387 388
@@ -393,9 +394,12 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
393 return (int_status); 394 return (int_status);
394 } 395 }
395 396
396 /* Examine all GPE blocks attached to this interrupt level */ 397 /* We need to hold the GPE lock now, hardware lock in the loop */
397 398
398 flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); 399 flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
400
401 /* Examine all GPE blocks attached to this interrupt level */
402
399 gpe_block = gpe_xrupt_list->gpe_block_list_head; 403 gpe_block = gpe_xrupt_list->gpe_block_list_head;
400 while (gpe_block) { 404 while (gpe_block) {
401 /* 405 /*
@@ -409,6 +413,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
409 413
410 gpe_register_info = &gpe_block->register_info[i]; 414 gpe_register_info = &gpe_block->register_info[i];
411 415
416 hw_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
417
412 /* Read the Status Register */ 418 /* Read the Status Register */
413 419
414 status = 420 status =
@@ -417,6 +423,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
417 &gpe_register_info-> 423 &gpe_register_info->
418 status_address); 424 status_address);
419 if (ACPI_FAILURE(status)) { 425 if (ACPI_FAILURE(status)) {
426 acpi_os_release_lock(acpi_gbl_hardware_lock,
427 hw_flags);
420 goto unlock_and_exit; 428 goto unlock_and_exit;
421 } 429 }
422 430
@@ -427,6 +435,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
427 &enable_reg, 435 &enable_reg,
428 &gpe_register_info-> 436 &gpe_register_info->
429 enable_address); 437 enable_address);
438 acpi_os_release_lock(acpi_gbl_hardware_lock, hw_flags);
439
430 if (ACPI_FAILURE(status)) { 440 if (ACPI_FAILURE(status)) {
431 goto unlock_and_exit; 441 goto unlock_and_exit;
432 } 442 }
@@ -499,7 +509,6 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
499static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) 509static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
500{ 510{
501 struct acpi_gpe_event_info *gpe_event_info = (void *)context; 511 struct acpi_gpe_event_info *gpe_event_info = (void *)context;
502 u32 gpe_number = 0;
503 acpi_status status; 512 acpi_status status;
504 struct acpi_gpe_event_info local_gpe_event_info; 513 struct acpi_gpe_event_info local_gpe_event_info;
505 struct acpi_evaluate_info *info; 514 struct acpi_evaluate_info *info;
@@ -565,10 +574,10 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
565 574
566 if (ACPI_FAILURE(status)) { 575 if (ACPI_FAILURE(status)) {
567 ACPI_EXCEPTION((AE_INFO, status, 576 ACPI_EXCEPTION((AE_INFO, status,
568 "While evaluating method [%4.4s] for GPE[%2X]", 577 "While evaluating GPE method [%4.4s]",
569 acpi_ut_get_node_name 578 acpi_ut_get_node_name
570 (local_gpe_event_info.dispatch. 579 (local_gpe_event_info.dispatch.
571 method_node), gpe_number)); 580 method_node)));
572 } 581 }
573 } 582 }
574 583
diff --git a/drivers/acpi/executer/exfldio.c b/drivers/acpi/executer/exfldio.c
index 3b7c4352ec57..051053f7cccb 100644
--- a/drivers/acpi/executer/exfldio.c
+++ b/drivers/acpi/executer/exfldio.c
@@ -785,6 +785,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
785{ 785{
786 acpi_status status; 786 acpi_status status;
787 acpi_integer mask; 787 acpi_integer mask;
788 acpi_integer width_mask;
788 acpi_integer merged_datum; 789 acpi_integer merged_datum;
789 acpi_integer raw_datum = 0; 790 acpi_integer raw_datum = 0;
790 u32 field_offset = 0; 791 u32 field_offset = 0;
@@ -809,8 +810,11 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
809 810
810 /* Compute the number of datums (access width data items) */ 811 /* Compute the number of datums (access width data items) */
811 812
813 width_mask =
814 ACPI_MASK_BITS_ABOVE(obj_desc->common_field.access_bit_width);
812 mask = 815 mask =
813 ACPI_MASK_BITS_BELOW(obj_desc->common_field.start_field_bit_offset); 816 width_mask & ACPI_MASK_BITS_BELOW(obj_desc->common_field.
817 start_field_bit_offset);
814 818
815 datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length, 819 datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length,
816 obj_desc->common_field.access_bit_width); 820 obj_desc->common_field.access_bit_width);
@@ -850,7 +854,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
850 merged_datum = raw_datum >> 854 merged_datum = raw_datum >>
851 (obj_desc->common_field.access_bit_width - 855 (obj_desc->common_field.access_bit_width -
852 obj_desc->common_field.start_field_bit_offset); 856 obj_desc->common_field.start_field_bit_offset);
853 mask = ACPI_INTEGER_MAX; 857 mask = width_mask;
854 858
855 if (i == datum_count) { 859 if (i == datum_count) {
856 break; 860 break;
diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c
index 8284c52875be..6374d8be88e0 100644
--- a/drivers/acpi/executer/exoparg1.c
+++ b/drivers/acpi/executer/exoparg1.c
@@ -322,8 +322,9 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
322 322
323 /* Since the bit position is one-based, subtract from 33 (65) */ 323 /* Since the bit position is one-based, subtract from 33 (65) */
324 324
325 return_desc->integer.value = temp32 == 0 ? 0 : 325 return_desc->integer.value =
326 (ACPI_INTEGER_BIT_SIZE + 1) - temp32; 326 temp32 ==
327 0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - temp32;
327 break; 328 break;
328 329
329 case AML_FROM_BCD_OP: /* from_bcd (BCDValue, Result) */ 330 case AML_FROM_BCD_OP: /* from_bcd (BCDValue, Result) */
@@ -698,6 +699,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
698 if (ACPI_FAILURE(status)) { 699 if (ACPI_FAILURE(status)) {
699 goto cleanup; 700 goto cleanup;
700 } 701 }
702
701 /* Allocate a descriptor to hold the type. */ 703 /* Allocate a descriptor to hold the type. */
702 704
703 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); 705 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
@@ -967,7 +969,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
967 acpi_ut_add_reference 969 acpi_ut_add_reference
968 (return_desc); 970 (return_desc);
969 } 971 }
970
971 break; 972 break;
972 973
973 default: 974 default:
@@ -987,7 +988,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
987 988
988 if (ACPI_GET_DESCRIPTOR_TYPE(return_desc) == 989 if (ACPI_GET_DESCRIPTOR_TYPE(return_desc) ==
989 ACPI_DESC_TYPE_NAMED) { 990 ACPI_DESC_TYPE_NAMED) {
990
991 return_desc = 991 return_desc =
992 acpi_ns_get_attached_object((struct 992 acpi_ns_get_attached_object((struct
993 acpi_namespace_node 993 acpi_namespace_node
@@ -1002,7 +1002,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
1002 1002
1003 default: 1003 default:
1004 ACPI_ERROR((AE_INFO, 1004 ACPI_ERROR((AE_INFO,
1005 "Unknown opcode in ref(%p) - %X", 1005 "Unknown opcode in reference(%p) - %X",
1006 operand[0], 1006 operand[0],
1007 operand[0]->reference.opcode)); 1007 operand[0]->reference.opcode));
1008 1008
diff --git a/drivers/acpi/executer/exresnte.c b/drivers/acpi/executer/exresnte.c
index f9b9f5008596..3089b05a1368 100644
--- a/drivers/acpi/executer/exresnte.c
+++ b/drivers/acpi/executer/exresnte.c
@@ -114,10 +114,11 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
114 114
115 /* 115 /*
116 * Several object types require no further processing: 116 * Several object types require no further processing:
117 * 1) Devices rarely have an attached object, return the Node 117 * 1) Device/Thermal objects don't have a "real" subobject, return the Node
118 * 2) Method locals and arguments have a pseudo-Node 118 * 2) Method locals and arguments have a pseudo-Node
119 */ 119 */
120 if (entry_type == ACPI_TYPE_DEVICE || 120 if ((entry_type == ACPI_TYPE_DEVICE) ||
121 (entry_type == ACPI_TYPE_THERMAL) ||
121 (node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) { 122 (node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) {
122 return_ACPI_STATUS(AE_OK); 123 return_ACPI_STATUS(AE_OK);
123 } 124 }
@@ -216,7 +217,6 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
216 case ACPI_TYPE_METHOD: 217 case ACPI_TYPE_METHOD:
217 case ACPI_TYPE_POWER: 218 case ACPI_TYPE_POWER:
218 case ACPI_TYPE_PROCESSOR: 219 case ACPI_TYPE_PROCESSOR:
219 case ACPI_TYPE_THERMAL:
220 case ACPI_TYPE_EVENT: 220 case ACPI_TYPE_EVENT:
221 case ACPI_TYPE_REGION: 221 case ACPI_TYPE_REGION:
222 222
diff --git a/drivers/acpi/executer/exresolv.c b/drivers/acpi/executer/exresolv.c
index 006bba035d51..6499de878017 100644
--- a/drivers/acpi/executer/exresolv.c
+++ b/drivers/acpi/executer/exresolv.c
@@ -257,10 +257,24 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
257 257
258 case AML_INT_NAMEPATH_OP: /* Reference to a named object */ 258 case AML_INT_NAMEPATH_OP: /* Reference to a named object */
259 259
260 /* Get the object pointed to by the namespace node */ 260 /* Dereference the name */
261
262 if ((stack_desc->reference.node->type ==
263 ACPI_TYPE_DEVICE)
264 || (stack_desc->reference.node->type ==
265 ACPI_TYPE_THERMAL)) {
266
267 /* These node types do not have 'real' subobjects */
268
269 *stack_ptr = (void *)stack_desc->reference.node;
270 } else {
271 /* Get the object pointed to by the namespace node */
272
273 *stack_ptr =
274 (stack_desc->reference.node)->object;
275 acpi_ut_add_reference(*stack_ptr);
276 }
261 277
262 *stack_ptr = (stack_desc->reference.node)->object;
263 acpi_ut_add_reference(*stack_ptr);
264 acpi_ut_remove_reference(stack_desc); 278 acpi_ut_remove_reference(stack_desc);
265 break; 279 break;
266 280
diff --git a/drivers/acpi/executer/exutils.c b/drivers/acpi/executer/exutils.c
index 3ef8cd703e06..982c8b65876f 100644
--- a/drivers/acpi/executer/exutils.c
+++ b/drivers/acpi/executer/exutils.c
@@ -89,7 +89,7 @@ acpi_status acpi_ex_enter_interpreter(void)
89 89
90 ACPI_FUNCTION_TRACE(ex_enter_interpreter); 90 ACPI_FUNCTION_TRACE(ex_enter_interpreter);
91 91
92 status = acpi_ut_acquire_mutex(ACPI_MTX_EXECUTE); 92 status = acpi_ut_acquire_mutex(ACPI_MTX_INTERPRETER);
93 if (ACPI_FAILURE(status)) { 93 if (ACPI_FAILURE(status)) {
94 ACPI_ERROR((AE_INFO, "Could not acquire interpreter mutex")); 94 ACPI_ERROR((AE_INFO, "Could not acquire interpreter mutex"));
95 } 95 }
@@ -125,7 +125,7 @@ void acpi_ex_exit_interpreter(void)
125 125
126 ACPI_FUNCTION_TRACE(ex_exit_interpreter); 126 ACPI_FUNCTION_TRACE(ex_exit_interpreter);
127 127
128 status = acpi_ut_release_mutex(ACPI_MTX_EXECUTE); 128 status = acpi_ut_release_mutex(ACPI_MTX_INTERPRETER);
129 if (ACPI_FAILURE(status)) { 129 if (ACPI_FAILURE(status)) {
130 ACPI_ERROR((AE_INFO, "Could not release interpreter mutex")); 130 ACPI_ERROR((AE_INFO, "Could not release interpreter mutex"));
131 } 131 }
diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c
index 5a3aa8dd8cb7..ae142de19507 100644
--- a/drivers/acpi/hardware/hwregs.c
+++ b/drivers/acpi/hardware/hwregs.c
@@ -61,10 +61,13 @@ ACPI_MODULE_NAME("hwregs")
61 * DESCRIPTION: Clears all fixed and general purpose status bits 61 * DESCRIPTION: Clears all fixed and general purpose status bits
62 * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED 62 * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
63 * 63 *
64 * NOTE: TBD: Flags parameter is obsolete, to be removed
65 *
64 ******************************************************************************/ 66 ******************************************************************************/
65acpi_status acpi_hw_clear_acpi_status(u32 flags) 67acpi_status acpi_hw_clear_acpi_status(u32 flags)
66{ 68{
67 acpi_status status; 69 acpi_status status;
70 acpi_cpu_flags lock_flags = 0;
68 71
69 ACPI_FUNCTION_TRACE(hw_clear_acpi_status); 72 ACPI_FUNCTION_TRACE(hw_clear_acpi_status);
70 73
@@ -72,12 +75,7 @@ acpi_status acpi_hw_clear_acpi_status(u32 flags)
72 ACPI_BITMASK_ALL_FIXED_STATUS, 75 ACPI_BITMASK_ALL_FIXED_STATUS,
73 (u16) acpi_gbl_FADT->xpm1a_evt_blk.address)); 76 (u16) acpi_gbl_FADT->xpm1a_evt_blk.address));
74 77
75 if (flags & ACPI_MTX_LOCK) { 78 lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
76 status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE);
77 if (ACPI_FAILURE(status)) {
78 return_ACPI_STATUS(status);
79 }
80 }
81 79
82 status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, 80 status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
83 ACPI_REGISTER_PM1_STATUS, 81 ACPI_REGISTER_PM1_STATUS,
@@ -102,9 +100,7 @@ acpi_status acpi_hw_clear_acpi_status(u32 flags)
102 status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block); 100 status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block);
103 101
104 unlock_and_exit: 102 unlock_and_exit:
105 if (flags & ACPI_MTX_LOCK) { 103 acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags);
106 (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE);
107 }
108 return_ACPI_STATUS(status); 104 return_ACPI_STATUS(status);
109} 105}
110 106
@@ -264,6 +260,8 @@ struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id)
264 * 260 *
265 * DESCRIPTION: ACPI bit_register read function. 261 * DESCRIPTION: ACPI bit_register read function.
266 * 262 *
263 * NOTE: TBD: Flags parameter is obsolete, to be removed
264 *
267 ******************************************************************************/ 265 ******************************************************************************/
268 266
269acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags) 267acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags)
@@ -281,23 +279,12 @@ acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags)
281 return_ACPI_STATUS(AE_BAD_PARAMETER); 279 return_ACPI_STATUS(AE_BAD_PARAMETER);
282 } 280 }
283 281
284 if (flags & ACPI_MTX_LOCK) {
285 status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE);
286 if (ACPI_FAILURE(status)) {
287 return_ACPI_STATUS(status);
288 }
289 }
290
291 /* Read from the register */ 282 /* Read from the register */
292 283
293 status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, 284 status = acpi_hw_register_read(ACPI_MTX_LOCK,
294 bit_reg_info->parent_register, 285 bit_reg_info->parent_register,
295 &register_value); 286 &register_value);
296 287
297 if (flags & ACPI_MTX_LOCK) {
298 (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE);
299 }
300
301 if (ACPI_SUCCESS(status)) { 288 if (ACPI_SUCCESS(status)) {
302 289
303 /* Normalize the value that was read */ 290 /* Normalize the value that was read */
@@ -331,12 +318,15 @@ ACPI_EXPORT_SYMBOL(acpi_get_register)
331 * 318 *
332 * DESCRIPTION: ACPI Bit Register write function. 319 * DESCRIPTION: ACPI Bit Register write function.
333 * 320 *
321 * NOTE: TBD: Flags parameter is obsolete, to be removed
322 *
334 ******************************************************************************/ 323 ******************************************************************************/
335acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags) 324acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags)
336{ 325{
337 u32 register_value = 0; 326 u32 register_value = 0;
338 struct acpi_bit_register_info *bit_reg_info; 327 struct acpi_bit_register_info *bit_reg_info;
339 acpi_status status; 328 acpi_status status;
329 acpi_cpu_flags lock_flags;
340 330
341 ACPI_FUNCTION_TRACE_U32(acpi_set_register, register_id); 331 ACPI_FUNCTION_TRACE_U32(acpi_set_register, register_id);
342 332
@@ -349,12 +339,7 @@ acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags)
349 return_ACPI_STATUS(AE_BAD_PARAMETER); 339 return_ACPI_STATUS(AE_BAD_PARAMETER);
350 } 340 }
351 341
352 if (flags & ACPI_MTX_LOCK) { 342 lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
353 status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE);
354 if (ACPI_FAILURE(status)) {
355 return_ACPI_STATUS(status);
356 }
357 }
358 343
359 /* Always do a register read first so we can insert the new bits */ 344 /* Always do a register read first so we can insert the new bits */
360 345
@@ -462,9 +447,7 @@ acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags)
462 447
463 unlock_and_exit: 448 unlock_and_exit:
464 449
465 if (flags & ACPI_MTX_LOCK) { 450 acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags);
466 (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE);
467 }
468 451
469 /* Normalize the value that was read */ 452 /* Normalize the value that was read */
470 453
@@ -500,14 +483,12 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
500 u32 value1 = 0; 483 u32 value1 = 0;
501 u32 value2 = 0; 484 u32 value2 = 0;
502 acpi_status status; 485 acpi_status status;
486 acpi_cpu_flags lock_flags = 0;
503 487
504 ACPI_FUNCTION_TRACE(hw_register_read); 488 ACPI_FUNCTION_TRACE(hw_register_read);
505 489
506 if (ACPI_MTX_LOCK == use_lock) { 490 if (ACPI_MTX_LOCK == use_lock) {
507 status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); 491 lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
508 if (ACPI_FAILURE(status)) {
509 return_ACPI_STATUS(status);
510 }
511 } 492 }
512 493
513 switch (register_id) { 494 switch (register_id) {
@@ -585,7 +566,7 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
585 566
586 unlock_and_exit: 567 unlock_and_exit:
587 if (ACPI_MTX_LOCK == use_lock) { 568 if (ACPI_MTX_LOCK == use_lock) {
588 (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); 569 acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags);
589 } 570 }
590 571
591 if (ACPI_SUCCESS(status)) { 572 if (ACPI_SUCCESS(status)) {
@@ -613,14 +594,12 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
613acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value) 594acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value)
614{ 595{
615 acpi_status status; 596 acpi_status status;
597 acpi_cpu_flags lock_flags = 0;
616 598
617 ACPI_FUNCTION_TRACE(hw_register_write); 599 ACPI_FUNCTION_TRACE(hw_register_write);
618 600
619 if (ACPI_MTX_LOCK == use_lock) { 601 if (ACPI_MTX_LOCK == use_lock) {
620 status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); 602 lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
621 if (ACPI_FAILURE(status)) {
622 return_ACPI_STATUS(status);
623 }
624 } 603 }
625 604
626 switch (register_id) { 605 switch (register_id) {
@@ -710,7 +689,7 @@ acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value)
710 689
711 unlock_and_exit: 690 unlock_and_exit:
712 if (ACPI_MTX_LOCK == use_lock) { 691 if (ACPI_MTX_LOCK == use_lock) {
713 (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); 692 acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags);
714 } 693 }
715 694
716 return_ACPI_STATUS(status); 695 return_ACPI_STATUS(status);
diff --git a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/namespace/nsinit.c
index 1c9ca6e05314..aec8488c0019 100644
--- a/drivers/acpi/namespace/nsinit.c
+++ b/drivers/acpi/namespace/nsinit.c
@@ -557,10 +557,13 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
557 ACPI_EXCEPTION((AE_INFO, status, "during %s._INI execution", 557 ACPI_EXCEPTION((AE_INFO, status, "during %s._INI execution",
558 scope_name)); 558 scope_name));
559 ACPI_FREE(scope_name); 559 ACPI_FREE(scope_name);
560 status = AE_OK;
561 } 560 }
562#endif 561#endif
563 562
563 /* Ignore errors from above */
564
565 status = AE_OK;
566
564 /* 567 /*
565 * The _INI method has been run if present; call the Global Initialization 568 * The _INI method has been run if present; call the Global Initialization
566 * Handler for this device. 569 * Handler for this device.
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index e80ca4730a44..1bb558adee66 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -795,9 +795,6 @@ acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout)
795 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n", 795 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n",
796 handle, units, timeout)); 796 handle, units, timeout));
797 797
798 if (in_atomic())
799 timeout = 0;
800
801 switch (timeout) { 798 switch (timeout) {
802 /* 799 /*
803 * No Wait: 800 * No Wait:
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c
index 5f1440376514..209a401801e3 100644
--- a/drivers/acpi/tables/tbutils.c
+++ b/drivers/acpi/tables/tbutils.c
@@ -160,12 +160,8 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header)
160 160
161 ACPI_MOVE_32_TO_32(&signature, table_header->signature); 161 ACPI_MOVE_32_TO_32(&signature, table_header->signature);
162 if (!acpi_ut_valid_acpi_name(signature)) { 162 if (!acpi_ut_valid_acpi_name(signature)) {
163 ACPI_ERROR((AE_INFO, 163 ACPI_ERROR((AE_INFO, "Invalid table signature 0x%8.8X",
164 "Table signature at %p [%p] has invalid characters", 164 signature));
165 table_header, &signature));
166
167 ACPI_WARNING((AE_INFO, "Invalid table signature found: [%4.4s]",
168 ACPI_CAST_PTR(char, &signature)));
169 165
170 ACPI_DUMP_BUFFER(table_header, 166 ACPI_DUMP_BUFFER(table_header,
171 sizeof(struct acpi_table_header)); 167 sizeof(struct acpi_table_header));
@@ -176,12 +172,9 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header)
176 172
177 if (table_header->length < sizeof(struct acpi_table_header)) { 173 if (table_header->length < sizeof(struct acpi_table_header)) {
178 ACPI_ERROR((AE_INFO, 174 ACPI_ERROR((AE_INFO,
179 "Invalid length in table header %p name %4.4s", 175 "Invalid length 0x%X in table with signature %4.4s",
180 table_header, (char *)&signature)); 176 (u32) table_header->length,
181 177 ACPI_CAST_PTR(char, &signature)));
182 ACPI_WARNING((AE_INFO,
183 "Invalid table header length (0x%X) found",
184 (u32) table_header->length));
185 178
186 ACPI_DUMP_BUFFER(table_header, 179 ACPI_DUMP_BUFFER(table_header,
187 sizeof(struct acpi_table_header)); 180 sizeof(struct acpi_table_header));
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c
index 9450f9b5bfb2..e5999c65c0b8 100644
--- a/drivers/acpi/utilities/utglobal.c
+++ b/drivers/acpi/utilities/utglobal.c
@@ -691,7 +691,7 @@ char *acpi_ut_get_descriptor_name(void *object)
691char *acpi_ut_get_mutex_name(u32 mutex_id) 691char *acpi_ut_get_mutex_name(u32 mutex_id)
692{ 692{
693 693
694 if (mutex_id > MAX_MUTEX) { 694 if (mutex_id > ACPI_MAX_MUTEX) {
695 return ("Invalid Mutex ID"); 695 return ("Invalid Mutex ID");
696 } 696 }
697 697
@@ -760,7 +760,7 @@ void acpi_ut_init_globals(void)
760 760
761 /* Mutex locked flags */ 761 /* Mutex locked flags */
762 762
763 for (i = 0; i < NUM_MUTEX; i++) { 763 for (i = 0; i < ACPI_NUM_MUTEX; i++) {
764 acpi_gbl_mutex_info[i].mutex = NULL; 764 acpi_gbl_mutex_info[i].mutex = NULL;
765 acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED; 765 acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
766 acpi_gbl_mutex_info[i].use_count = 0; 766 acpi_gbl_mutex_info[i].use_count = 0;
diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c
index b851f7be5d58..25eb34369afa 100644
--- a/drivers/acpi/utilities/utmutex.c
+++ b/drivers/acpi/utilities/utmutex.c
@@ -73,14 +73,21 @@ acpi_status acpi_ut_mutex_initialize(void)
73 /* 73 /*
74 * Create each of the predefined mutex objects 74 * Create each of the predefined mutex objects
75 */ 75 */
76 for (i = 0; i < NUM_MUTEX; i++) { 76 for (i = 0; i < ACPI_NUM_MUTEX; i++) {
77 status = acpi_ut_create_mutex(i); 77 status = acpi_ut_create_mutex(i);
78 if (ACPI_FAILURE(status)) { 78 if (ACPI_FAILURE(status)) {
79 return_ACPI_STATUS(status); 79 return_ACPI_STATUS(status);
80 } 80 }
81 } 81 }
82 82
83 /* Create the spinlocks for use at interrupt level */
84
83 status = acpi_os_create_lock(&acpi_gbl_gpe_lock); 85 status = acpi_os_create_lock(&acpi_gbl_gpe_lock);
86 if (ACPI_FAILURE(status)) {
87 return_ACPI_STATUS(status);
88 }
89
90 status = acpi_os_create_lock(&acpi_gbl_hardware_lock);
84 return_ACPI_STATUS(status); 91 return_ACPI_STATUS(status);
85} 92}
86 93
@@ -105,11 +112,14 @@ void acpi_ut_mutex_terminate(void)
105 /* 112 /*
106 * Delete each predefined mutex object 113 * Delete each predefined mutex object
107 */ 114 */
108 for (i = 0; i < NUM_MUTEX; i++) { 115 for (i = 0; i < ACPI_NUM_MUTEX; i++) {
109 (void)acpi_ut_delete_mutex(i); 116 (void)acpi_ut_delete_mutex(i);
110 } 117 }
111 118
119 /* Delete the spinlocks */
120
112 acpi_os_delete_lock(acpi_gbl_gpe_lock); 121 acpi_os_delete_lock(acpi_gbl_gpe_lock);
122 acpi_os_delete_lock(acpi_gbl_hardware_lock);
113 return_VOID; 123 return_VOID;
114} 124}
115 125
@@ -131,7 +141,7 @@ static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id)
131 141
132 ACPI_FUNCTION_TRACE_U32(ut_create_mutex, mutex_id); 142 ACPI_FUNCTION_TRACE_U32(ut_create_mutex, mutex_id);
133 143
134 if (mutex_id > MAX_MUTEX) { 144 if (mutex_id > ACPI_MAX_MUTEX) {
135 return_ACPI_STATUS(AE_BAD_PARAMETER); 145 return_ACPI_STATUS(AE_BAD_PARAMETER);
136 } 146 }
137 147
@@ -165,7 +175,7 @@ static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id)
165 175
166 ACPI_FUNCTION_TRACE_U32(ut_delete_mutex, mutex_id); 176 ACPI_FUNCTION_TRACE_U32(ut_delete_mutex, mutex_id);
167 177
168 if (mutex_id > MAX_MUTEX) { 178 if (mutex_id > ACPI_MAX_MUTEX) {
169 return_ACPI_STATUS(AE_BAD_PARAMETER); 179 return_ACPI_STATUS(AE_BAD_PARAMETER);
170 } 180 }
171 181
@@ -196,7 +206,7 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
196 206
197 ACPI_FUNCTION_NAME(ut_acquire_mutex); 207 ACPI_FUNCTION_NAME(ut_acquire_mutex);
198 208
199 if (mutex_id > MAX_MUTEX) { 209 if (mutex_id > ACPI_MAX_MUTEX) {
200 return (AE_BAD_PARAMETER); 210 return (AE_BAD_PARAMETER);
201 } 211 }
202 212
@@ -213,7 +223,7 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
213 * the mutex ordering rule. This indicates a coding error somewhere in 223 * the mutex ordering rule. This indicates a coding error somewhere in
214 * the ACPI subsystem code. 224 * the ACPI subsystem code.
215 */ 225 */
216 for (i = mutex_id; i < MAX_MUTEX; i++) { 226 for (i = mutex_id; i < ACPI_MAX_MUTEX; i++) {
217 if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { 227 if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) {
218 if (i == mutex_id) { 228 if (i == mutex_id) {
219 ACPI_ERROR((AE_INFO, 229 ACPI_ERROR((AE_INFO,
@@ -284,7 +294,7 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
284 "Thread %X releasing Mutex [%s]\n", this_thread_id, 294 "Thread %X releasing Mutex [%s]\n", this_thread_id,
285 acpi_ut_get_mutex_name(mutex_id))); 295 acpi_ut_get_mutex_name(mutex_id)));
286 296
287 if (mutex_id > MAX_MUTEX) { 297 if (mutex_id > ACPI_MAX_MUTEX) {
288 return (AE_BAD_PARAMETER); 298 return (AE_BAD_PARAMETER);
289 } 299 }
290 300
@@ -309,7 +319,7 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
309 * ordering rule. This indicates a coding error somewhere in 319 * ordering rule. This indicates a coding error somewhere in
310 * the ACPI subsystem code. 320 * the ACPI subsystem code.
311 */ 321 */
312 for (i = mutex_id; i < MAX_MUTEX; i++) { 322 for (i = mutex_id; i < ACPI_MAX_MUTEX; i++) {
313 if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { 323 if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) {
314 if (i == mutex_id) { 324 if (i == mutex_id) {
315 continue; 325 continue;