ACPI: ACPICA 20060608
authorBob Moore <robert.moore@intel.com>
Thu, 8 Jun 2006 20:29:00 +0000 (16:29 -0400)
committerLen Brown <len.brown@intel.com>
Wed, 14 Jun 2006 06:45:47 +0000 (02:45 -0400)
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>
16 files changed:
drivers/acpi/dispatcher/dsmethod.c
drivers/acpi/events/evgpe.c
drivers/acpi/executer/exfldio.c
drivers/acpi/executer/exoparg1.c
drivers/acpi/executer/exresnte.c
drivers/acpi/executer/exresolv.c
drivers/acpi/executer/exutils.c
drivers/acpi/hardware/hwregs.c
drivers/acpi/namespace/nsinit.c
drivers/acpi/osl.c
drivers/acpi/tables/tbutils.c
drivers/acpi/utilities/utglobal.c
drivers/acpi/utilities/utmutex.c
include/acpi/acconfig.h
include/acpi/acglobal.h
include/acpi/aclocal.h

index 21f0599862730ddeb77485dc99f635dc54c195ba..bc9aca4e74019ea34a43077904fe1809de789a6a 100644 (file)
@@ -507,7 +507,7 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,
         * If this is the last thread executing the method,
         * we have additional cleanup to perform
         */
-       status = acpi_ut_acquire_mutex(ACPI_MTX_PARSER);
+       status = acpi_ut_acquire_mutex(ACPI_MTX_CONTROL_METHOD);
        if (ACPI_FAILURE(status)) {
                return_VOID;
        }
@@ -600,7 +600,7 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,
        }
 
       exit:
-       (void)acpi_ut_release_mutex(ACPI_MTX_PARSER);
+       (void)acpi_ut_release_mutex(ACPI_MTX_CONTROL_METHOD);
        return_VOID;
 }
 
index 23fe53ba73758bf77c304699c824a238d2e4471c..f01d339407f8cc3c42e35b81f0a083ae32e5daf0 100644 (file)
@@ -382,6 +382,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
        u32 status_reg;
        u32 enable_reg;
        acpi_cpu_flags flags;
+       acpi_cpu_flags hw_flags;
        acpi_native_uint i;
        acpi_native_uint j;
 
@@ -393,9 +394,12 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
                return (int_status);
        }
 
-       /* Examine all GPE blocks attached to this interrupt level */
+       /* We need to hold the GPE lock now, hardware lock in the loop */
 
        flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
+
+       /* Examine all GPE blocks attached to this interrupt level */
+
        gpe_block = gpe_xrupt_list->gpe_block_list_head;
        while (gpe_block) {
                /*
@@ -409,6 +413,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
 
                        gpe_register_info = &gpe_block->register_info[i];
 
+                       hw_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
+
                        /* Read the Status Register */
 
                        status =
@@ -417,6 +423,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
                                                   &gpe_register_info->
                                                   status_address);
                        if (ACPI_FAILURE(status)) {
+                               acpi_os_release_lock(acpi_gbl_hardware_lock,
+                                                    hw_flags);
                                goto unlock_and_exit;
                        }
 
@@ -427,6 +435,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
                                                   &enable_reg,
                                                   &gpe_register_info->
                                                   enable_address);
+                       acpi_os_release_lock(acpi_gbl_hardware_lock, hw_flags);
+
                        if (ACPI_FAILURE(status)) {
                                goto unlock_and_exit;
                        }
@@ -499,7 +509,6 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
 static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
 {
        struct acpi_gpe_event_info *gpe_event_info = (void *)context;
-       u32 gpe_number = 0;
        acpi_status status;
        struct acpi_gpe_event_info local_gpe_event_info;
        struct acpi_evaluate_info *info;
@@ -565,10 +574,10 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
 
                if (ACPI_FAILURE(status)) {
                        ACPI_EXCEPTION((AE_INFO, status,
-                                       "While evaluating method [%4.4s] for GPE[%2X]",
+                                       "While evaluating GPE method [%4.4s]",
                                        acpi_ut_get_node_name
                                        (local_gpe_event_info.dispatch.
-                                        method_node), gpe_number));
+                                        method_node)));
                }
        }
 
index 3b7c4352ec570db6ae8969ef92782ae1c19177f7..051053f7cccb40c58931508c7347802cce084dfd 100644 (file)
@@ -785,6 +785,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
 {
        acpi_status status;
        acpi_integer mask;
+       acpi_integer width_mask;
        acpi_integer merged_datum;
        acpi_integer raw_datum = 0;
        u32 field_offset = 0;
@@ -809,8 +810,11 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
 
        /* Compute the number of datums (access width data items) */
 
+       width_mask =
+           ACPI_MASK_BITS_ABOVE(obj_desc->common_field.access_bit_width);
        mask =
-           ACPI_MASK_BITS_BELOW(obj_desc->common_field.start_field_bit_offset);
+           width_mask & ACPI_MASK_BITS_BELOW(obj_desc->common_field.
+                                             start_field_bit_offset);
 
        datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length,
                                       obj_desc->common_field.access_bit_width);
@@ -850,7 +854,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
                merged_datum = raw_datum >>
                    (obj_desc->common_field.access_bit_width -
                     obj_desc->common_field.start_field_bit_offset);
-               mask = ACPI_INTEGER_MAX;
+               mask = width_mask;
 
                if (i == datum_count) {
                        break;
index 8284c52875bedc91f56c591f9afcc7b29a8a203c..6374d8be88e0a5feb21d1fe2f73e100f915e6647 100644 (file)
@@ -322,8 +322,9 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
 
                        /* Since the bit position is one-based, subtract from 33 (65) */
 
-                       return_desc->integer.value = temp32 == 0 ? 0 :
-                           (ACPI_INTEGER_BIT_SIZE + 1) - temp32;
+                       return_desc->integer.value =
+                           temp32 ==
+                           0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - temp32;
                        break;
 
                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)
                if (ACPI_FAILURE(status)) {
                        goto cleanup;
                }
+
                /* Allocate a descriptor to hold the type. */
 
                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)
                                                acpi_ut_add_reference
                                                    (return_desc);
                                        }
-
                                        break;
 
                                default:
@@ -987,7 +988,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
 
                                if (ACPI_GET_DESCRIPTOR_TYPE(return_desc) ==
                                    ACPI_DESC_TYPE_NAMED) {
-
                                        return_desc =
                                            acpi_ns_get_attached_object((struct
                                                                         acpi_namespace_node
@@ -1002,7 +1002,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
 
                        default:
                                ACPI_ERROR((AE_INFO,
-                                           "Unknown opcode in ref(%p) - %X",
+                                           "Unknown opcode in reference(%p) - %X",
                                            operand[0],
                                            operand[0]->reference.opcode));
 
index f9b9f50085960339f1b8ba235c37f253102a1595..3089b05a13687553258c5c0bf8d2288b313ee0b7 100644 (file)
@@ -114,10 +114,11 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
 
        /*
         * Several object types require no further processing:
-        * 1) Devices rarely have an attached object, return the Node
+        * 1) Device/Thermal objects don't have a "real" subobject, return the Node
         * 2) Method locals and arguments have a pseudo-Node
         */
-       if (entry_type == ACPI_TYPE_DEVICE ||
+       if ((entry_type == ACPI_TYPE_DEVICE) ||
+           (entry_type == ACPI_TYPE_THERMAL) ||
            (node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) {
                return_ACPI_STATUS(AE_OK);
        }
@@ -216,7 +217,6 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
        case ACPI_TYPE_METHOD:
        case ACPI_TYPE_POWER:
        case ACPI_TYPE_PROCESSOR:
-       case ACPI_TYPE_THERMAL:
        case ACPI_TYPE_EVENT:
        case ACPI_TYPE_REGION:
 
index 006bba035d517fc7d123adee670cf8117904de76..6499de8780173f44e19a41ef7bf2ac9fb30d9531 100644 (file)
@@ -257,10 +257,24 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
 
                case AML_INT_NAMEPATH_OP:       /* Reference to a named object */
 
-                       /* Get the object pointed to by the namespace node */
+                       /* Dereference the name */
+
+                       if ((stack_desc->reference.node->type ==
+                            ACPI_TYPE_DEVICE)
+                           || (stack_desc->reference.node->type ==
+                               ACPI_TYPE_THERMAL)) {
+
+                               /* These node types do not have 'real' subobjects */
+
+                               *stack_ptr = (void *)stack_desc->reference.node;
+                       } else {
+                               /* Get the object pointed to by the namespace node */
+
+                               *stack_ptr =
+                                   (stack_desc->reference.node)->object;
+                               acpi_ut_add_reference(*stack_ptr);
+                       }
 
-                       *stack_ptr = (stack_desc->reference.node)->object;
-                       acpi_ut_add_reference(*stack_ptr);
                        acpi_ut_remove_reference(stack_desc);
                        break;
 
index 3ef8cd703e06ed897a1968aae8c4380b2be51485..982c8b65876f33d562294f60160564eb3f5a4f00 100644 (file)
@@ -89,7 +89,7 @@ acpi_status acpi_ex_enter_interpreter(void)
 
        ACPI_FUNCTION_TRACE(ex_enter_interpreter);
 
-       status = acpi_ut_acquire_mutex(ACPI_MTX_EXECUTE);
+       status = acpi_ut_acquire_mutex(ACPI_MTX_INTERPRETER);
        if (ACPI_FAILURE(status)) {
                ACPI_ERROR((AE_INFO, "Could not acquire interpreter mutex"));
        }
@@ -125,7 +125,7 @@ void acpi_ex_exit_interpreter(void)
 
        ACPI_FUNCTION_TRACE(ex_exit_interpreter);
 
-       status = acpi_ut_release_mutex(ACPI_MTX_EXECUTE);
+       status = acpi_ut_release_mutex(ACPI_MTX_INTERPRETER);
        if (ACPI_FAILURE(status)) {
                ACPI_ERROR((AE_INFO, "Could not release interpreter mutex"));
        }
index 5a3aa8dd8cb7b60cf383569b7bdb17a72d8c1f3f..ae142de19507059639b49b3f2471f664c98d31a6 100644 (file)
@@ -61,10 +61,13 @@ ACPI_MODULE_NAME("hwregs")
  * DESCRIPTION: Clears all fixed and general purpose status bits
  *              THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
  *
+ * NOTE: TBD: Flags parameter is obsolete, to be removed
+ *
  ******************************************************************************/
 acpi_status acpi_hw_clear_acpi_status(u32 flags)
 {
        acpi_status status;
+       acpi_cpu_flags lock_flags = 0;
 
        ACPI_FUNCTION_TRACE(hw_clear_acpi_status);
 
@@ -72,12 +75,7 @@ acpi_status acpi_hw_clear_acpi_status(u32 flags)
                          ACPI_BITMASK_ALL_FIXED_STATUS,
                          (u16) acpi_gbl_FADT->xpm1a_evt_blk.address));
 
-       if (flags & ACPI_MTX_LOCK) {
-               status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE);
-               if (ACPI_FAILURE(status)) {
-                       return_ACPI_STATUS(status);
-               }
-       }
+       lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
 
        status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
                                        ACPI_REGISTER_PM1_STATUS,
@@ -102,9 +100,7 @@ acpi_status acpi_hw_clear_acpi_status(u32 flags)
        status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block);
 
       unlock_and_exit:
-       if (flags & ACPI_MTX_LOCK) {
-               (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE);
-       }
+       acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags);
        return_ACPI_STATUS(status);
 }
 
@@ -264,6 +260,8 @@ struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id)
  *
  * DESCRIPTION: ACPI bit_register read function.
  *
+ * NOTE: TBD: Flags parameter is obsolete, to be removed
+ *
  ******************************************************************************/
 
 acpi_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)
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       if (flags & ACPI_MTX_LOCK) {
-               status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE);
-               if (ACPI_FAILURE(status)) {
-                       return_ACPI_STATUS(status);
-               }
-       }
-
        /* Read from the register */
 
-       status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
+       status = acpi_hw_register_read(ACPI_MTX_LOCK,
                                       bit_reg_info->parent_register,
                                       &register_value);
 
-       if (flags & ACPI_MTX_LOCK) {
-               (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE);
-       }
-
        if (ACPI_SUCCESS(status)) {
 
                /* Normalize the value that was read */
@@ -331,12 +318,15 @@ ACPI_EXPORT_SYMBOL(acpi_get_register)
  *
  * DESCRIPTION: ACPI Bit Register write function.
  *
+ * NOTE: TBD: Flags parameter is obsolete, to be removed
+ *
  ******************************************************************************/
 acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags)
 {
        u32 register_value = 0;
        struct acpi_bit_register_info *bit_reg_info;
        acpi_status status;
+       acpi_cpu_flags lock_flags;
 
        ACPI_FUNCTION_TRACE_U32(acpi_set_register, register_id);
 
@@ -349,12 +339,7 @@ acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags)
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       if (flags & ACPI_MTX_LOCK) {
-               status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE);
-               if (ACPI_FAILURE(status)) {
-                       return_ACPI_STATUS(status);
-               }
-       }
+       lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
 
        /* Always do a register read first so we can insert the new bits  */
 
@@ -462,9 +447,7 @@ acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags)
 
       unlock_and_exit:
 
-       if (flags & ACPI_MTX_LOCK) {
-               (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE);
-       }
+       acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags);
 
        /* Normalize the value that was read */
 
@@ -500,14 +483,12 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
        u32 value1 = 0;
        u32 value2 = 0;
        acpi_status status;
+       acpi_cpu_flags lock_flags = 0;
 
        ACPI_FUNCTION_TRACE(hw_register_read);
 
        if (ACPI_MTX_LOCK == use_lock) {
-               status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE);
-               if (ACPI_FAILURE(status)) {
-                       return_ACPI_STATUS(status);
-               }
+               lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
        }
 
        switch (register_id) {
@@ -585,7 +566,7 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
 
       unlock_and_exit:
        if (ACPI_MTX_LOCK == use_lock) {
-               (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE);
+               acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags);
        }
 
        if (ACPI_SUCCESS(status)) {
@@ -613,14 +594,12 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
 acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value)
 {
        acpi_status status;
+       acpi_cpu_flags lock_flags = 0;
 
        ACPI_FUNCTION_TRACE(hw_register_write);
 
        if (ACPI_MTX_LOCK == use_lock) {
-               status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE);
-               if (ACPI_FAILURE(status)) {
-                       return_ACPI_STATUS(status);
-               }
+               lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
        }
 
        switch (register_id) {
@@ -710,7 +689,7 @@ acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value)
 
       unlock_and_exit:
        if (ACPI_MTX_LOCK == use_lock) {
-               (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE);
+               acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags);
        }
 
        return_ACPI_STATUS(status);
index 1c9ca6e053147a6d5386612892bfaf1a93f8015e..aec8488c001951b514b290784883e4e045ca7d72 100644 (file)
@@ -557,10 +557,13 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
                ACPI_EXCEPTION((AE_INFO, status, "during %s._INI execution",
                                scope_name));
                ACPI_FREE(scope_name);
-               status = AE_OK;
        }
 #endif
 
+       /* Ignore errors from above */
+
+       status = AE_OK;
+
        /*
         * The _INI method has been run if present; call the Global Initialization
         * Handler for this device.
index e80ca4730a4451c9f7540a270db9345f41a3d5fc..1bb558adee66cbf90fa930ce93165d6a1d99ba6f 100644 (file)
@@ -795,9 +795,6 @@ acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout)
        ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n",
                          handle, units, timeout));
 
-       if (in_atomic())
-               timeout = 0;
-
        switch (timeout) {
                /*
                 * No Wait:
index 5f14403765140a4affad0235162eacbc337c6be5..209a401801e3aba9ad3715247c9efe0cc58ca59c 100644 (file)
@@ -160,12 +160,8 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header)
 
        ACPI_MOVE_32_TO_32(&signature, table_header->signature);
        if (!acpi_ut_valid_acpi_name(signature)) {
-               ACPI_ERROR((AE_INFO,
-                           "Table signature at %p [%p] has invalid characters",
-                           table_header, &signature));
-
-               ACPI_WARNING((AE_INFO, "Invalid table signature found: [%4.4s]",
-                             ACPI_CAST_PTR(char, &signature)));
+               ACPI_ERROR((AE_INFO, "Invalid table signature 0x%8.8X",
+                           signature));
 
                ACPI_DUMP_BUFFER(table_header,
                                 sizeof(struct acpi_table_header));
@@ -176,12 +172,9 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header)
 
        if (table_header->length < sizeof(struct acpi_table_header)) {
                ACPI_ERROR((AE_INFO,
-                           "Invalid length in table header %p name %4.4s",
-                           table_header, (char *)&signature));
-
-               ACPI_WARNING((AE_INFO,
-                             "Invalid table header length (0x%X) found",
-                             (u32) table_header->length));
+                           "Invalid length 0x%X in table with signature %4.4s",
+                           (u32) table_header->length,
+                           ACPI_CAST_PTR(char, &signature)));
 
                ACPI_DUMP_BUFFER(table_header,
                                 sizeof(struct acpi_table_header));
index 9450f9b5bfb2aa51b3ab3d3af0fa768b12954cbc..e5999c65c0b8c851fc021e39650c0de01854a74d 100644 (file)
@@ -691,7 +691,7 @@ char *acpi_ut_get_descriptor_name(void *object)
 char *acpi_ut_get_mutex_name(u32 mutex_id)
 {
 
-       if (mutex_id > MAX_MUTEX) {
+       if (mutex_id > ACPI_MAX_MUTEX) {
                return ("Invalid Mutex ID");
        }
 
@@ -760,7 +760,7 @@ void acpi_ut_init_globals(void)
 
        /* Mutex locked flags */
 
-       for (i = 0; i < NUM_MUTEX; i++) {
+       for (i = 0; i < ACPI_NUM_MUTEX; i++) {
                acpi_gbl_mutex_info[i].mutex = NULL;
                acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
                acpi_gbl_mutex_info[i].use_count = 0;
index b851f7be5d586a50b95a83a49fe403adb9a5b1d9..25eb34369afa22738ee48f8d11826ecf55068088 100644 (file)
@@ -73,14 +73,21 @@ acpi_status acpi_ut_mutex_initialize(void)
        /*
         * Create each of the predefined mutex objects
         */
-       for (i = 0; i < NUM_MUTEX; i++) {
+       for (i = 0; i < ACPI_NUM_MUTEX; i++) {
                status = acpi_ut_create_mutex(i);
                if (ACPI_FAILURE(status)) {
                        return_ACPI_STATUS(status);
                }
        }
 
+       /* Create the spinlocks for use at interrupt level */
+
        status = acpi_os_create_lock(&acpi_gbl_gpe_lock);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
+       }
+
+       status = acpi_os_create_lock(&acpi_gbl_hardware_lock);
        return_ACPI_STATUS(status);
 }
 
@@ -105,11 +112,14 @@ void acpi_ut_mutex_terminate(void)
        /*
         * Delete each predefined mutex object
         */
-       for (i = 0; i < NUM_MUTEX; i++) {
+       for (i = 0; i < ACPI_NUM_MUTEX; i++) {
                (void)acpi_ut_delete_mutex(i);
        }
 
+       /* Delete the spinlocks */
+
        acpi_os_delete_lock(acpi_gbl_gpe_lock);
+       acpi_os_delete_lock(acpi_gbl_hardware_lock);
        return_VOID;
 }
 
@@ -131,7 +141,7 @@ static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id)
 
        ACPI_FUNCTION_TRACE_U32(ut_create_mutex, mutex_id);
 
-       if (mutex_id > MAX_MUTEX) {
+       if (mutex_id > ACPI_MAX_MUTEX) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
@@ -165,7 +175,7 @@ static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id)
 
        ACPI_FUNCTION_TRACE_U32(ut_delete_mutex, mutex_id);
 
-       if (mutex_id > MAX_MUTEX) {
+       if (mutex_id > ACPI_MAX_MUTEX) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
@@ -196,7 +206,7 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
 
        ACPI_FUNCTION_NAME(ut_acquire_mutex);
 
-       if (mutex_id > MAX_MUTEX) {
+       if (mutex_id > ACPI_MAX_MUTEX) {
                return (AE_BAD_PARAMETER);
        }
 
@@ -213,7 +223,7 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
                 * the mutex ordering rule.  This indicates a coding error somewhere in
                 * the ACPI subsystem code.
                 */
-               for (i = mutex_id; i < MAX_MUTEX; i++) {
+               for (i = mutex_id; i < ACPI_MAX_MUTEX; i++) {
                        if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) {
                                if (i == mutex_id) {
                                        ACPI_ERROR((AE_INFO,
@@ -284,7 +294,7 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
                          "Thread %X releasing Mutex [%s]\n", this_thread_id,
                          acpi_ut_get_mutex_name(mutex_id)));
 
-       if (mutex_id > MAX_MUTEX) {
+       if (mutex_id > ACPI_MAX_MUTEX) {
                return (AE_BAD_PARAMETER);
        }
 
@@ -309,7 +319,7 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
                 * ordering rule.  This indicates a coding error somewhere in
                 * the ACPI subsystem code.
                 */
-               for (i = mutex_id; i < MAX_MUTEX; i++) {
+               for (i = mutex_id; i < ACPI_MAX_MUTEX; i++) {
                        if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) {
                                if (i == mutex_id) {
                                        continue;
index 8b52e44ad2ab1f7297fc17bafe4449d3a90517df..b9beceb33141706bbf755792299d113b8dccd11e 100644 (file)
@@ -63,7 +63,7 @@
 
 /* Current ACPICA subsystem version in YYYYMMDD format */
 
-#define ACPI_CA_VERSION                 0x20060526
+#define ACPI_CA_VERSION                 0x20060608
 
 /*
  * OS name, used for the _OS object.  The _OS object is essentially obsolete,
 #define ACPI_MAX_ADDRESS_SPACE          255
 
 /* Array sizes.  Used for range checking also */
-#define ACPI_MAX_MATCH_OPCODE           5
 
-#if 0
-#define ACPI_NUM_ACCESS_TYPES           6
-#define ACPI_NUM_UPDATE_RULES           3
-#define ACPI_NUM_LOCK_RULES             2
-#define ACPI_NUM_FIELD_NAMES            2
-#define ACPI_NUM_OPCODES                256
-#endif
+#define ACPI_MAX_MATCH_OPCODE           5
 
 /* RSDP checksums */
 
index 9297f293b2c0f5c521aad21ec7a7ef58c99d12bc..14531d48f6b63e48bd3c873741b3ccd5e99fed9f 100644 (file)
@@ -186,7 +186,7 @@ extern struct acpi_table_support acpi_gbl_table_data[ACPI_TABLE_ID_MAX + 1];
  * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs.
  * (The table maps local handles to the real OS handles)
  */
-ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[NUM_MUTEX];
+ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[ACPI_NUM_MUTEX];
 
 /*****************************************************************************
  *
@@ -314,7 +314,11 @@ ACPI_EXTERN struct acpi_fixed_event_handler
 ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head;
 ACPI_EXTERN struct acpi_gpe_block_info
     *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS];
+
+/* Spinlocks */
+
 ACPI_EXTERN acpi_handle acpi_gbl_gpe_lock;
+ACPI_EXTERN acpi_handle acpi_gbl_hardware_lock;
 
 /*****************************************************************************
  *
index 98c697e3c486acbe7a32f321ce79fa9ea7916eed..1eeca7adca9535c0549e94a13cca4f2362f9b91e 100644 (file)
@@ -72,52 +72,55 @@ union acpi_parse_object;
  * Predefined handles for the mutex objects used within the subsystem
  * All mutex objects are automatically created by acpi_ut_mutex_initialize.
  *
- * The acquire/release ordering protocol is implied via this list.  Mutexes
+ * The acquire/release ordering protocol is implied via this list. Mutexes
  * with a lower value must be acquired before mutexes with a higher value.
  *
- * NOTE: any changes here must be reflected in the acpi_gbl_mutex_names table also!
+ * NOTE: any changes here must be reflected in the acpi_gbl_mutex_names
+ * table below also!
  */
-#define ACPI_MTX_EXECUTE                0
-#define ACPI_MTX_INTERPRETER            1
-#define ACPI_MTX_PARSER                 2
-#define ACPI_MTX_DISPATCHER             3
-#define ACPI_MTX_TABLES                 4
-#define ACPI_MTX_OP_REGIONS             5
-#define ACPI_MTX_NAMESPACE              6
-#define ACPI_MTX_EVENTS                 7
-#define ACPI_MTX_HARDWARE               8
-#define ACPI_MTX_CACHES                 9
-#define ACPI_MTX_MEMORY                 10
-#define ACPI_MTX_DEBUG_CMD_COMPLETE     11
-#define ACPI_MTX_DEBUG_CMD_READY        12
-
-#define MAX_MUTEX                       12
-#define NUM_MUTEX                       MAX_MUTEX+1
+#define ACPI_MTX_INTERPRETER            0      /* AML Interpreter, main lock */
+#define ACPI_MTX_CONTROL_METHOD         1      /* Control method termination [TBD: may no longer be necessary] */
+#define ACPI_MTX_TABLES                 2      /* Data for ACPI tables */
+#define ACPI_MTX_NAMESPACE              3      /* ACPI Namespace */
+#define ACPI_MTX_EVENTS                 4      /* Data for ACPI events */
+#define ACPI_MTX_CACHES                 5      /* Internal caches, general purposes */
+#define ACPI_MTX_MEMORY                 6      /* Debug memory tracking lists */
+#define ACPI_MTX_DEBUG_CMD_COMPLETE     7      /* AML debugger */
+#define ACPI_MTX_DEBUG_CMD_READY        8      /* AML debugger */
+
+#define ACPI_MAX_MUTEX                  8
+#define ACPI_NUM_MUTEX                  ACPI_MAX_MUTEX+1
 
 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
 #ifdef DEFINE_ACPI_GLOBALS
 
-/* Names for the mutexes used in the subsystem */
+/* Debug names for the mutexes above */
 
-static char *acpi_gbl_mutex_names[] = {
-       "ACPI_MTX_Execute",
+static char *acpi_gbl_mutex_names[ACPI_NUM_MUTEX] = {
        "ACPI_MTX_Interpreter",
-       "ACPI_MTX_Parser",
-       "ACPI_MTX_Dispatcher",
+       "ACPI_MTX_Method",
        "ACPI_MTX_Tables",
-       "ACPI_MTX_OpRegions",
        "ACPI_MTX_Namespace",
        "ACPI_MTX_Events",
-       "ACPI_MTX_Hardware",
        "ACPI_MTX_Caches",
        "ACPI_MTX_Memory",
        "ACPI_MTX_DebugCmdComplete",
-       "ACPI_MTX_DebugCmdReady",
+       "ACPI_MTX_DebugCmdReady"
 };
 
 #endif
 #endif
 
+/*
+ * Predefined handles for spinlocks used within the subsystem.
+ * These spinlocks are created by acpi_ut_mutex_initialize
+ */
+#define ACPI_LOCK_GPES                  0
+#define ACPI_LOCK_HARDWARE              1
+
+#define ACPI_MAX_LOCK                   1
+#define ACPI_NUM_LOCK                   ACPI_MAX_LOCK+1
+
 /* Owner IDs are used to track namespace nodes for selective deletion */
 
 typedef u8 acpi_owner_id;