]> git.hungrycats.org Git - linux/commitdiff
[ACPI] Summary of changes for ACPICA version 20031002:
authorLen Brown <len.brown@intel.com>
Mon, 6 Oct 2003 12:48:05 +0000 (08:48 -0400)
committerLen Brown <len.brown@intel.com>
Mon, 6 Oct 2003 12:48:05 +0000 (08:48 -0400)
Fixed a problem with Index Fields where the index was not incremented
for fields that require multiple writes to the index/data registers
(Fields that are wider than the data register.)

Fixed a problem with all Field objects where a write could go beyond the
end-of-field if the field was larger than the access granularity and
therefore required multiple writes to complete the request.  An extra
write beyond the end of the field could happen inadvertently.

Fixed a problem with Index Fields where a BUFFER_OVERFLOW error would
incorrectly be returned if the width of the Data Register was larger
than the specified field access width.

Completed fixes for LoadTable() and Unload() and verified their
operation.  Implemented full support for the "DdbHandle" object
throughout the ACPI CA subsystem.

Implemented full support for the MADT and ECDT tables in the ACPI CA
header files.  Even though these tables are not directly consumed by
ACPI CA, the header definitions are useful for ACPI device drivers.

Integrated resource descriptor fixes posted to the Linux ACPI list.
This included checks for minimum descriptor length, and support for
trailing NULL strings within descriptors that have optional string
elements.

Fixed a problem where the SMI_CMD register could be written even if it
was not supported on the platform (when FADT.SMI_CMD is zero)

23 files changed:
drivers/acpi/executer/exconfig.c
drivers/acpi/executer/exfield.c
drivers/acpi/executer/exfldio.c
drivers/acpi/executer/exoparg1.c
drivers/acpi/executer/exprep.c
drivers/acpi/executer/exresnte.c
drivers/acpi/executer/exresolv.c
drivers/acpi/executer/exresop.c
drivers/acpi/executer/exstoren.c
drivers/acpi/executer/exsystem.c
drivers/acpi/hardware/hwacpi.c
drivers/acpi/resources/rsaddr.c
drivers/acpi/resources/rsirq.c
drivers/acpi/tables/tbconvrt.c
drivers/acpi/tables/tbinstal.c
drivers/acpi/utilities/utalloc.c
drivers/acpi/utilities/utglobal.c
include/acpi/acconfig.h
include/acpi/acexcep.h
include/acpi/actbl.h
include/acpi/actbl1.h
include/acpi/actbl2.h
include/acpi/actypes.h

index d6ae105579c8ee1fffc468d7bfb3365c4c771009..3d2559a4ed7257fcf94cf8baf7a3af3cb3bd8d2c 100644 (file)
@@ -92,6 +92,9 @@ acpi_ex_add_table (
 
        /* Install the new table into the local data structures */
 
+       ACPI_MEMSET (&table_info, 0, sizeof (struct acpi_table_desc));
+
+       table_info.type        = 5;
        table_info.pointer     = table;
        table_info.length      = (acpi_size) table->length;
        table_info.allocation  = ACPI_MEM_ALLOCATED;
@@ -178,7 +181,7 @@ acpi_ex_load_table_op (
                        return_ACPI_STATUS (status);
                }
 
-               /* Not found, return an Integer=0 and AE_OK */
+               /* Table not found, return an Integer=0 and AE_OK */
 
                ddb_handle = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
                if (!ddb_handle) {
@@ -248,9 +251,11 @@ acpi_ex_load_table_op (
                                 walk_state);
                if (ACPI_FAILURE (status)) {
                        (void) acpi_ex_unload_table (ddb_handle);
+                       return_ACPI_STATUS (status);
                }
        }
 
+       *return_desc = ddb_handle;
        return_ACPI_STATUS  (status);
 }
 
@@ -417,7 +422,7 @@ acpi_status
 acpi_ex_unload_table (
        union acpi_operand_object       *ddb_handle)
 {
-       acpi_status                     status = AE_NOT_IMPLEMENTED;
+       acpi_status                     status = AE_OK;
        union acpi_operand_object       *table_desc = ddb_handle;
        struct acpi_table_desc          *table_info;
 
index 906772cf52d6179b689e1d7fef60d78c42af9274..5dd32cfbf61c25228c2b9737a02e58a3b4c1b8af 100644 (file)
@@ -160,10 +160,10 @@ acpi_ex_read_data_from_field (
        }
 
        ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-               "Obj=%p Type=%X Buf=%p Len=%X\n",
+               "field_read [TO]:  Obj %p, Type %X, Buf %p, byte_len %X\n",
                obj_desc, ACPI_GET_OBJECT_TYPE (obj_desc), buffer, (u32) length));
        ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-               "field_write: bit_len=%X bit_off=%X byte_off=%X\n",
+               "field_read [FROM]: bit_len %X, bit_off %X, byte_off %X\n",
                obj_desc->common_field.bit_length,
                obj_desc->common_field.start_field_bit_offset,
                obj_desc->common_field.base_byte_offset));
@@ -335,10 +335,13 @@ acpi_ex_write_data_to_field (
        }
 
        ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-               "Obj=%p Type=%X Buf=%p Len=%X\n",
-               obj_desc, ACPI_GET_OBJECT_TYPE (obj_desc), buffer, length));
+               "field_write [FROM]: Obj %p (%s:%X), Buf %p, byte_len %X\n",
+               source_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (source_desc)),
+               ACPI_GET_OBJECT_TYPE (source_desc), buffer, length));
        ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-               "field_read: bit_len=%X bit_off=%X byte_off=%X\n",
+               "field_write [TO]:  Obj %p (%s:%X), bit_len %X, bit_off %X, byte_off %X\n",
+               obj_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (obj_desc)),
+               ACPI_GET_OBJECT_TYPE (obj_desc),
                obj_desc->common_field.bit_length,
                obj_desc->common_field.start_field_bit_offset,
                obj_desc->common_field.base_byte_offset));
index 7370bb7c714555e8ca38841b6fd603a4d50ac7fa..024ab420239de0cf4b7d8c89ebe1ca405b24edfe 100644 (file)
@@ -64,7 +64,8 @@
  * RETURN:      Status
  *
  * DESCRIPTION: Common processing for acpi_ex_extract_from_field and
- *              acpi_ex_insert_into_field. Initialize the
+ *              acpi_ex_insert_into_field. Initialize the Region if necessary and
+ *              validate the request.
  *
  ******************************************************************************/
 
@@ -96,7 +97,7 @@ acpi_ex_setup_region (
         * If the Region Address and Length have not been previously evaluated,
         * evaluate them now and save the results.
         */
-       if (!(rgn_desc->region.flags & AOPOBJ_DATA_VALID)) {
+       if (!(rgn_desc->common.flags & AOPOBJ_DATA_VALID)) {
                status = acpi_ds_get_region_arguments (rgn_desc);
                if (ACPI_FAILURE (status)) {
                        return_ACPI_STATUS (status);
@@ -109,6 +110,18 @@ acpi_ex_setup_region (
                return_ACPI_STATUS (AE_OK);
        }
 
+#ifdef ACPI_UNDER_DEVELOPMENT
+       /*
+        * If the Field access is any_acc, we can now compute the optimal
+        * access (because we know know the length of the parent region)
+        */
+       if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) {
+               if (ACPI_FAILURE (status)) {
+                       return_ACPI_STATUS (status);
+               }
+       }
+#endif
+
        /*
         * Validate the request.  The entire request from the byte offset for a
         * length of one field datum (access width) must fit within the region.
@@ -242,7 +255,7 @@ acpi_ex_access_region (
        }
 
        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_BFIELD,
-               " Region[%s-%X] Access %X Base:Off %X:%X at %8.8X%8.8X\n",
+               " Region [%s:%X], Width %X, byte_base %X, Offset %X at %8.8X%8.8X\n",
                acpi_ut_get_region_name (rgn_desc->region.space_id),
                rgn_desc->region.space_id,
                obj_desc->common_field.access_byte_width,
@@ -365,10 +378,10 @@ acpi_ex_field_datum_io (
        /*
         * The four types of fields are:
         *
-        * buffer_fields - Read/write from/to a Buffer
-        * region_fields - Read/write from/to a Operation Region.
-        * bank_fields  - Write to a Bank Register, then read/write from/to an op_region
-        * index_fields - Write to an Index Register, then read/write from/to a Data Register
+        * buffer_field - Read/write from/to a Buffer
+        * region_field - Read/write from/to a Operation Region.
+        * bank_field  - Write to a Bank Register, then read/write from/to an op_region
+        * index_field - Write to an Index Register, then read/write from/to a Data Register
         */
        switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
        case ACPI_TYPE_BUFFER_FIELD:
@@ -458,24 +471,34 @@ acpi_ex_field_datum_io (
 
                /* Write the index value to the index_register (itself a region_field) */
 
+               field_datum_byte_offset += obj_desc->index_field.value;
+
+               ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
+                               "Write to Index Register: Value %8.8X\n",
+                               field_datum_byte_offset));
+
                status = acpi_ex_insert_into_field (obj_desc->index_field.index_obj,
-                                &obj_desc->index_field.value,
-                                sizeof (obj_desc->index_field.value));
+                                &field_datum_byte_offset,
+                                sizeof (field_datum_byte_offset));
                if (ACPI_FAILURE (status)) {
                        return_ACPI_STATUS (status);
                }
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
+                               "I/O to Data Register: value_ptr %p\n",
+                               value));
+
                if (read_write == ACPI_READ) {
                        /* Read the datum from the data_register */
 
                        status = acpi_ex_extract_from_field (obj_desc->index_field.data_obj,
-                                         value, obj_desc->common_field.access_byte_width);
+                                         value, sizeof (acpi_integer));
                }
                else {
-                       /* Write the datum to the Data register */
+                       /* Write the datum to the data_register */
 
                        status = acpi_ex_insert_into_field (obj_desc->index_field.data_obj,
-                                         value, obj_desc->common_field.access_byte_width);
+                                         value, sizeof (acpi_integer));
                }
                break;
 
@@ -490,12 +513,14 @@ acpi_ex_field_datum_io (
 
        if (ACPI_SUCCESS (status)) {
                if (read_write == ACPI_READ) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Read=%8.8X%8.8X\n",
-                                          ACPI_HIDWORD (*value), ACPI_LODWORD (*value)));
+                       ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Read %8.8X%8.8X, Width %d\n",
+                                          ACPI_HIDWORD (*value), ACPI_LODWORD (*value),
+                                          obj_desc->common_field.access_byte_width));
                }
                else {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Written=%8.8X%8.8X\n",
-                                          ACPI_HIDWORD (*value), ACPI_LODWORD (*value)));
+                       ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Written %8.8X%8.8X, Width %d\n",
+                                          ACPI_HIDWORD (*value), ACPI_LODWORD (*value),
+                                          obj_desc->common_field.access_byte_width));
                }
        }
 
@@ -554,6 +579,10 @@ acpi_ex_write_with_update_rule (
                                 */
                                status = acpi_ex_field_datum_io (obj_desc, field_datum_byte_offset,
                                                  &current_value, ACPI_READ);
+                               if (ACPI_FAILURE (status)) {
+                                       return_ACPI_STATUS (status);
+                               }
+
                                merged_value |= (current_value & ~mask);
                        }
                        break;
@@ -573,6 +602,7 @@ acpi_ex_write_with_update_rule (
                        break;
 
                default:
+
                        ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
                                "write_with_update_rule: Unknown update_rule setting: %X\n",
                                (obj_desc->common_field.field_flags & AML_FIELD_UPDATE_RULE_MASK)));
@@ -580,18 +610,19 @@ acpi_ex_write_with_update_rule (
                }
        }
 
-       /* Write the merged value */
-
-       status = acpi_ex_field_datum_io (obj_desc, field_datum_byte_offset,
-                         &merged_value, ACPI_WRITE);
-
        ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-               "Mask %8.8X%8.8X datum_offset %X Value %8.8X%8.8X, merged_value %8.8X%8.8X\n",
+               "Mask %8.8X%8.8X, datum_offset %X, Width %X, Value %8.8X%8.8X, merged_value %8.8X%8.8X\n",
                ACPI_HIDWORD (mask), ACPI_LODWORD (mask),
                field_datum_byte_offset,
+               obj_desc->common_field.access_byte_width,
                ACPI_HIDWORD (field_value), ACPI_LODWORD (field_value),
                ACPI_HIDWORD (merged_value),ACPI_LODWORD (merged_value)));
 
+       /* Write the merged value */
+
+       status = acpi_ex_field_datum_io (obj_desc, field_datum_byte_offset,
+                         &merged_value, ACPI_WRITE);
+
        return_ACPI_STATUS (status);
 }
 
@@ -625,7 +656,7 @@ acpi_ex_get_buffer_datum (
        u32                             index;
 
 
-       ACPI_FUNCTION_ENTRY ();
+       ACPI_FUNCTION_TRACE_U32 ("ex_get_buffer_datum", byte_granularity);
 
 
        /* Get proper index into buffer (handles big/little endian) */
@@ -659,6 +690,8 @@ acpi_ex_get_buffer_datum (
                /* Should not get here */
                break;
        }
+
+       return_VOID;
 }
 
 
@@ -690,7 +723,8 @@ acpi_ex_set_buffer_datum (
 {
        u32                             index;
 
-       ACPI_FUNCTION_ENTRY ();
+
+       ACPI_FUNCTION_TRACE_U32 ("ex_set_buffer_datum", byte_granularity);
 
 
        /* Get proper index into buffer (handles big/little endian) */
@@ -724,6 +758,8 @@ acpi_ex_set_buffer_datum (
                /* Should not get here */
                break;
        }
+
+       return_VOID;
 }
 
 
@@ -777,7 +813,7 @@ acpi_ex_extract_from_field (
                           obj_desc->common_field.access_byte_width);
 
        ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-               "byte_len=%X, datum_len=%X, byte_gran=%X\n",
+               "byte_len %X, datum_len %X, byte_gran %X\n",
                byte_field_length, datum_count,obj_desc->common_field.access_byte_width));
 
        /*
@@ -942,20 +978,27 @@ acpi_ex_insert_into_field (
         * larger than the field, this typically happens when an integer is
         * written to a field that is actually smaller than an integer.
         */
-       byte_field_length = ACPI_ROUND_BITS_UP_TO_BYTES (obj_desc->common_field.bit_length);
+       byte_field_length = ACPI_ROUND_BITS_UP_TO_BYTES (
+                        obj_desc->common_field.bit_length);
        if (buffer_length < byte_field_length) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Buffer length %X too small for field %X\n",
+               ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
+                       "Buffer length %X too small for field %X\n",
                        buffer_length, byte_field_length));
 
                return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
        }
 
+       byte_field_length = ACPI_ROUND_BITS_UP_TO_BYTES (
+                        obj_desc->common_field.start_field_bit_offset +
+                        obj_desc->common_field.bit_length);
+
        /* Convert byte count to datum count, round up if necessary */
 
-       datum_count = ACPI_ROUND_UP_TO (byte_field_length, obj_desc->common_field.access_byte_width);
+       datum_count = ACPI_ROUND_UP_TO (byte_field_length,
+                         obj_desc->common_field.access_byte_width);
 
        ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-               "byte_len=%X, datum_len=%X, byte_gran=%X\n",
+               "Bytes %X, Datums %X, byte_gran %X\n",
                byte_field_length, datum_count, obj_desc->common_field.access_byte_width));
 
        /*
@@ -1006,6 +1049,10 @@ acpi_ex_insert_into_field (
                return_ACPI_STATUS (status);
        }
 
+       /* We just wrote the first datum */
+
+       datum_offset++;
+
        /* If the entire field fits within one datum, we are done. */
 
        if ((datum_count == 1) &&
@@ -1025,7 +1072,6 @@ acpi_ex_insert_into_field (
         * applied in Part3 below.
         */
        while (datum_offset < datum_count) {
-               datum_offset++;
                field_datum_byte_offset += obj_desc->common_field.access_byte_width;
 
                /*
@@ -1057,33 +1103,34 @@ acpi_ex_insert_into_field (
                 * a datum boundary.  Update Rule must be applied to the bits outside
                 * the field.
                 */
-               if (datum_offset == datum_count) {
+               datum_offset++;
+               if ((datum_offset == datum_count) &&
+                       (obj_desc->common_field.end_field_valid_bits)) {
                        /*
                         * If there are dangling non-aligned bits, perform one more merged write
                         * Else - field is aligned at the end, no need for any more writes
                         */
-                       if (obj_desc->common_field.end_field_valid_bits) {
-                               /*
-                                * Part3:
-                                * This is the last datum and the field does not end on a datum boundary.
-                                * Build the partial datum and write with the update rule.
-                                *
-                                * Mask off the unused bits above (after) the end-of-field
-                                */
-                               mask = ACPI_MASK_BITS_ABOVE (obj_desc->common_field.end_field_valid_bits);
-                               merged_datum &= mask;
 
-                               /* Write the last datum with the update rule */
+                       /*
+                        * Part3:
+                        * This is the last datum and the field does not end on a datum boundary.
+                        * Build the partial datum and write with the update rule.
+                        *
+                        * Mask off the unused bits above (after) the end-of-field
+                        */
+                       mask = ACPI_MASK_BITS_ABOVE (obj_desc->common_field.end_field_valid_bits);
+                       merged_datum &= mask;
+
+                       /* Write the last datum with the update rule */
 
-                               status = acpi_ex_write_with_update_rule (obj_desc, mask, merged_datum,
-                                                  field_datum_byte_offset);
-                               if (ACPI_FAILURE (status)) {
-                                       return_ACPI_STATUS (status);
-                               }
+                       status = acpi_ex_write_with_update_rule (obj_desc, mask, merged_datum,
+                                          field_datum_byte_offset);
+                       if (ACPI_FAILURE (status)) {
+                               return_ACPI_STATUS (status);
                        }
                }
                else {
-                       /* Normal case -- write the completed datum */
+                       /* Normal (aligned) case -- write the completed datum */
 
                        status = acpi_ex_field_datum_io (obj_desc, field_datum_byte_offset,
                                          &merged_datum, ACPI_WRITE);
index 85e2acdf3c1252a2a586e64b0795dfa4d28ad6a2..855821d8336636c60e378051fc3347e039fec707 100644 (file)
@@ -524,7 +524,7 @@ acpi_ex_opcode_1A_0T_1R (
        acpi_integer                    value;
 
 
-       ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_0R", acpi_ps_get_opcode_name (walk_state->opcode));
+       ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_1R", acpi_ps_get_opcode_name (walk_state->opcode));
 
 
        /* Examine the AML opcode */
index 3f0c00f189c9152e13033741ae3519c5c28a442d..add7ffdd56cdedba6d7a93e61dee5fe5872edfcc 100644 (file)
         ACPI_MODULE_NAME    ("exprep")
 
 
+#ifdef ACPI_UNDER_DEVELOPMENT
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ex_generate_access
+ *
+ * PARAMETERS:  field_bit_offset    - Start of field within parent region/buffer
+ *              field_bit_length    - Length of field in bits
+ *              region_length       - Length of parent in bytes
+ *
+ * RETURN:      Field granularity (8, 16, 32 or 64) and
+ *              byte_alignment (1, 2, 3, or 4)
+ *
+ * DESCRIPTION: Generate an optimal access width for fields defined with the
+ *              any_acc keyword.
+ *
+ * NOTE: Need to have the region_length in order to check for boundary
+ *       conditions (end-of-region).  However, the region_length is a deferred
+ *       operation.  Therefore, to complete this implementation, the generation
+ *       of this access width must be deferred until the region length has
+ *       been evaluated.
+ *
+ ******************************************************************************/
+
+static u32
+acpi_ex_generate_access (
+       u32                             field_bit_offset,
+       u32                             field_bit_length,
+       u32                             region_length)
+{
+       u32                             field_byte_length;
+       u32                             field_byte_offset;
+       u32                             field_byte_end_offset;
+       u32                             access_byte_width;
+       u32                             field_start_offset;
+       u32                             field_end_offset;
+       u32                             minimum_access_width = 0xFFFFFFFF;
+       u32                             minimum_accesses = 0xFFFFFFFF;
+       u32                             accesses;
+
+
+       ACPI_FUNCTION_TRACE ("ex_generate_access");
+
+
+       /* Round Field start offset and length to "minimal" byte boundaries */
+
+       field_byte_offset  = ACPI_DIV_8 (ACPI_ROUND_DOWN (field_bit_offset, 8));
+       field_byte_end_offset = ACPI_DIV_8 (ACPI_ROUND_UP (field_bit_length + field_bit_offset, 8));
+       field_byte_length  = field_byte_end_offset - field_byte_offset;
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
+                       "Bit length %d, Bit offset %d\n",
+                       field_bit_length, field_bit_offset));
+       ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
+                       "Byte Length %d, Byte Offset %d, End Offset %d\n",
+                       field_byte_length, field_byte_offset, field_byte_end_offset));
+
+       /*
+        * Iterative search for the maximum access width that is both aligned
+        * and does not go beyond the end of the region
+        *
+        * Start at byte_acc and work upwards to qword_acc max. (1,2,4,8 bytes)
+        */
+       for (access_byte_width = 1; access_byte_width <= 8; access_byte_width <<= 1) {
+               /*
+                * 1) Round end offset up to next access boundary and make sure that this
+                *    does not go beyond the end of the parent region.
+                * 2) When the Access width is greater than the field_byte_length, we are done.
+                *    (This does not optimize for the perfectly aligned case yet).
+                */
+               if (ACPI_ROUND_UP (field_byte_end_offset, access_byte_width) <= region_length) {
+                       field_start_offset = ACPI_ROUND_DOWN (field_byte_offset, access_byte_width) /
+                                         access_byte_width;
+                       field_end_offset = ACPI_ROUND_UP   ((field_byte_length + field_byte_offset),
+                                         access_byte_width) / access_byte_width;
+                       accesses         = field_end_offset - field_start_offset;
+
+                       ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
+                                       "access_width %d end is within region\n", access_byte_width));
+                       ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
+                                       "Field Start %d, Field End %d -- requires %d accesses\n",
+                                       field_start_offset, field_end_offset, accesses));
+
+                       /* Single access is optimal */
+
+                       if (accesses <= 1) {
+                               ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
+                                               "Entire field can be accessed with one operation of size %d\n",
+                                               access_byte_width));
+                               return_VALUE (access_byte_width);
+                       }
+
+                       /*
+                        * Fits in the region, but requires more than one read/write.
+                        * try the next wider access on next iteration
+                        */
+                       if (accesses < minimum_accesses) {
+                               minimum_accesses   = accesses;
+                               minimum_access_width = access_byte_width;
+                       }
+               }
+               else {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
+                                       "access_width %d end is NOT within region\n", access_byte_width));
+                       if (access_byte_width == 1) {
+                               ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
+                                               "Field goes beyond end-of-region!\n"));
+                               return_VALUE (0);     /* Field does not fit in the region at all */
+                       }
+
+                       /* This width goes beyond the end-of-region, back off to previous access */
+
+                       ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
+                                       "Backing off to previous optimal access width of %d\n",
+                                       minimum_access_width));
+                       return_VALUE (minimum_access_width);
+               }
+       }
+
+       /* Could not read/write field with one operation, just use max access width */
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
+                       "Cannot access field in one operation, using width 8\n"));
+       return_VALUE (8);
+}
+#endif /* ACPI_UNDER_DEVELOPMENT */
+
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_decode_field_access
@@ -74,12 +201,11 @@ acpi_ex_decode_field_access (
        u32                             *return_byte_alignment)
 {
        u32                             access;
-       u8                              byte_alignment;
-       u8                              bit_length;
-/*    u32                             Length; */
+       u32                             byte_alignment;
+       u32                             bit_length;
 
 
-       ACPI_FUNCTION_NAME ("ex_decode_field_access");
+       ACPI_FUNCTION_TRACE ("ex_decode_field_access");
 
 
        access = (field_flags & AML_FIELD_ACCESS_TYPE_MASK);
@@ -87,41 +213,15 @@ acpi_ex_decode_field_access (
        switch (access) {
        case AML_FIELD_ACCESS_ANY:
 
+#ifdef ACPI_UNDER_DEVELOPMENT
+               byte_alignment = acpi_ex_generate_access (obj_desc->common_field.start_field_bit_offset,
+                                obj_desc->common_field.bit_length,
+                                0xFFFFFFFF /* Temp until we pass region_length as param */);
+               bit_length = byte_alignment * 8;
+#endif
+
                byte_alignment = 1;
                bit_length = 8;
-
-#if 0
-               /*
-                * TBD: optimize
-                *
-                * Any attempt to optimize the access size to the size of the field
-                * must take into consideration the length of the region and take
-                * care that an access to the field will not attempt to access
-                * beyond the end of the region.
-                */
-
-               /* Use the length to set the access type */
-
-               length = obj_desc->common_field.bit_length;
-
-               if (length <= 8) {
-                       bit_length = 8;
-               }
-               else if (length <= 16) {
-                       bit_length = 16;
-               }
-               else if (length <= 32) {
-                       bit_length = 32;
-               }
-               else if (length <= 64) {
-                       bit_length = 64;
-               }
-               else {
-                       /* Larger than Qword - just use byte-size chunks */
-
-                       bit_length = 8;
-               }
-#endif
                break;
 
        case AML_FIELD_ACCESS_BYTE:
@@ -151,7 +251,7 @@ acpi_ex_decode_field_access (
                ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
                        "Unknown field access type %X\n",
                        access));
-               return (0);
+               return_VALUE (0);
        }
 
        if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
@@ -164,7 +264,7 @@ acpi_ex_decode_field_access (
        }
 
        *return_byte_alignment = byte_alignment;
-       return (bit_length);
+       return_VALUE (bit_length);
 }
 
 
@@ -336,7 +436,7 @@ acpi_ex_prep_field_value (
                type = acpi_ns_get_type (info->region_node);
                if (type != ACPI_TYPE_REGION) {
                        ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Needed Region, found type %X %s\n",
+                               "Needed Region, found type %X (%s)\n",
                                type, acpi_ut_get_type_name (type)));
 
                        return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -372,7 +472,7 @@ acpi_ex_prep_field_value (
                acpi_ut_add_reference (obj_desc->field.region_obj);
 
                ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-                       "region_field: Bitoff=%X Off=%X Gran=%X Region %p\n",
+                       "region_field: bit_off %X, Off %X, Gran %X, Region %p\n",
                        obj_desc->field.start_field_bit_offset, obj_desc->field.base_byte_offset,
                        obj_desc->field.access_byte_width, obj_desc->field.region_obj));
                break;
@@ -390,7 +490,7 @@ acpi_ex_prep_field_value (
                acpi_ut_add_reference (obj_desc->bank_field.bank_obj);
 
                ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-                       "Bank Field: bit_off=%X Off=%X Gran=%X Region %p bank_reg %p\n",
+                       "Bank Field: bit_off %X, Off %X, Gran %X, Region %p, bank_reg %p\n",
                        obj_desc->bank_field.start_field_bit_offset,
                        obj_desc->bank_field.base_byte_offset,
                        obj_desc->field.access_byte_width,
@@ -417,9 +517,10 @@ acpi_ex_prep_field_value (
                acpi_ut_add_reference (obj_desc->index_field.index_obj);
 
                ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-                       "index_field: bitoff=%X off=%X gran=%X Index %p Data %p\n",
+                       "index_field: bit_off %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n",
                        obj_desc->index_field.start_field_bit_offset,
                        obj_desc->index_field.base_byte_offset,
+                       obj_desc->index_field.value,
                        obj_desc->field.access_byte_width,
                        obj_desc->index_field.index_obj,
                        obj_desc->index_field.data_obj));
@@ -437,7 +538,7 @@ acpi_ex_prep_field_value (
        status = acpi_ns_attach_object (info->field_node, obj_desc,
                          acpi_ns_get_type (info->field_node));
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "set named_obj %p (%4.4s) val = %p\n",
+       ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Set named_obj %p [%4.4s], obj_desc %p\n",
                        info->field_node, info->field_node->name.ascii, obj_desc));
 
        /* Remove local reference to the object */
index 8b6da6099a41eb96e2de3df082c82b4fb335ecee..03159e91645d978c44d9d4489021bab8e5a25b5f 100644 (file)
@@ -47,6 +47,8 @@
 #include <acpi/acdispat.h>
 #include <acpi/acinterp.h>
 #include <acpi/acnamesp.h>
+#include <acpi/acparser.h>
+#include <acpi/amlcode.h>
 
 
 #define _COMPONENT          ACPI_EXECUTER
@@ -243,12 +245,26 @@ acpi_ex_resolve_node_to_value (
 
        case ACPI_TYPE_LOCAL_REFERENCE:
 
-               /* No named references are allowed here */
+               switch (source_desc->reference.opcode) {
+               case AML_LOAD_OP:
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported Reference opcode %X\n",
-                       source_desc->reference.opcode));
+                       /* This is a ddb_handle */
+                       /* Return an additional reference to the object */
 
-               return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+                       obj_desc = source_desc;
+                       acpi_ut_add_reference (obj_desc);
+                       break;
+
+               default:
+                       /* No named references are allowed here */
+
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported Reference opcode %X (%s)\n",
+                               source_desc->reference.opcode,
+                               acpi_ps_get_opcode_name (source_desc->reference.opcode)));
+
+                       return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+               }
+               break;
 
 
        /* Default case is for unknown types */
index 38f220cc0c4a3b7ad2f48959cec49b79c21e5d18..16ab6d11f8cb2033d2f9f5cb6fe6fe2896f17873 100644 (file)
@@ -48,6 +48,7 @@
 #include <acpi/acdispat.h>
 #include <acpi/acinterp.h>
 #include <acpi/acnamesp.h>
+#include <acpi/acparser.h>
 
 
 #define _COMPONENT          ACPI_EXECUTER
@@ -248,6 +249,7 @@ acpi_ex_resolve_object_to_value (
 
                case AML_REF_OF_OP:
                case AML_DEBUG_OP:
+               case AML_LOAD_OP:
 
                        /* Just leave the object as-is */
 
@@ -256,8 +258,8 @@ acpi_ex_resolve_object_to_value (
 
                default:
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Reference opcode %X in %p\n",
-                               opcode, stack_desc));
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Reference opcode %X (%s) in %p\n",
+                               opcode, acpi_ps_get_opcode_name (opcode), stack_desc));
                        status = AE_AML_INTERNAL;
                        break;
                }
index f1a320df454bfcab6c748ead373fa3d79d11fea2..8eb3381052e38f9914d81cbf4c4fa6f48e1f328d 100644 (file)
@@ -224,6 +224,7 @@ acpi_ex_resolve_operands (
                                case AML_REF_OF_OP:
                                case AML_ARG_OP:
                                case AML_LOCAL_OP:
+                               case AML_LOAD_OP:   /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */
 
                                        ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
                                                "Reference Opcode: %s\n", op_info->name)));
@@ -231,8 +232,9 @@ acpi_ex_resolve_operands (
 
                                default:
                                        ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                               "Unknown Reference Opcode %X\n",
-                                               obj_desc->reference.opcode));
+                                               "Unknown Reference Opcode %X [%s]\n",
+                                               obj_desc->reference.opcode,
+                                               (acpi_ps_get_opcode_info (obj_desc->reference.opcode))->name));
 
                                        return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
                                }
@@ -378,6 +380,13 @@ acpi_ex_resolve_operands (
                        type_needed = ACPI_TYPE_ANY;
                        break;
 
+               case ARGI_DDBHANDLE:
+
+                       /* Need an operand of type ACPI_TYPE_DDB_HANDLE */
+
+                       type_needed = ACPI_TYPE_LOCAL_REFERENCE;
+                       break;
+
 
                /*
                 * The more complex cases allow multiple resolved object types
index 7c9e28c3ff0ee3ad6f40d81ec7f11daa7ec9d3bb..c76b337d587c2aef868e759e058d598778fb9357 100644 (file)
@@ -46,6 +46,7 @@
 
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
+#include <acpi/amlcode.h>
 
 
 #define _COMPONENT          ACPI_EXECUTER
@@ -114,9 +115,10 @@ acpi_ex_resolve_object (
                /*
                 * Must have a Integer, Buffer, or String
                 */
-               if ((ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_INTEGER)    &&
-                       (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER)     &&
-                       (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_STRING)) {
+               if ((ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_INTEGER)   &&
+                       (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER)    &&
+                       (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_STRING)    &&
+                       !((ACPI_GET_OBJECT_TYPE (source_desc) == ACPI_TYPE_LOCAL_REFERENCE) && (source_desc->reference.opcode == AML_LOAD_OP))) {
                        /*
                         * Conversion successful but still not a valid type
                         */
index 8d4c003ac195f51a48e98e6d39b527b9449a9c9e..da30f91948e3db998ddd7219d51eeecc027a157b 100644 (file)
@@ -129,18 +129,13 @@ acpi_ex_system_do_stall (
        ACPI_FUNCTION_ENTRY ();
 
 
-       if (how_long > 1000) /* 1 millisecond */ {
-               /* Since this thread will sleep, we must release the interpreter */
-
-               acpi_ex_exit_interpreter ();
-
-               acpi_os_sleep (0, (how_long / 1000) + 1);
-
-               /* And now we must get the interpreter again */
-
-               status = acpi_ex_enter_interpreter ();
+       if (how_long > 100) /* 100 microseconds */ {
+               /*
+                * Longer than 100 usec, use sleep instead
+                * (according to ACPI specification)
+                */
+               status = acpi_ex_system_do_suspend ((how_long / 1000) + 1);
        }
-
        else {
                acpi_os_stall (how_long);
        }
index 2d8ec3be45b11233705e12dbb10365ab4f2e7490..87c4b95621348dd09f1db33c52d18618e9ba6856 100644 (file)
@@ -208,6 +208,15 @@ acpi_hw_get_mode (void)
 
        ACPI_FUNCTION_TRACE ("hw_get_mode");
 
+
+       /*
+        * ACPI 2.0 clarified that if SMI_CMD in FADT is zero,
+        * system does not support mode transition.
+        */
+       if (!acpi_gbl_FADT->smi_cmd) {
+               return_VALUE (ACPI_SYS_MODE_ACPI);
+       }
+
        status = acpi_get_register (ACPI_BITREG_SCI_ENABLE, &value, ACPI_MTX_LOCK);
        if (ACPI_FAILURE (status)) {
                return_VALUE (ACPI_SYS_MODE_LEGACY);
index f0aaf6130138d2c1be98f797d7eb08b26d08c62e..61653d9ca2d7b95d6ae881848e77c3057de39c49 100644 (file)
@@ -94,6 +94,12 @@ acpi_rs_address16_resource (
        buffer += 1;
        ACPI_MOVE_16_TO_16 (&temp16, buffer);
 
+       /* Validate minimum descriptor length */
+
+       if (temp16 < 13) {
+               return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH);
+       }
+
        *bytes_consumed = temp16 + 3;
        output_struct->id = ACPI_RSTYPE_ADDRESS16;
 
@@ -199,8 +205,11 @@ acpi_rs_address16_resource (
         * pointer to where the null terminated string goes:
         * Each Interrupt takes 32-bits + the 5 bytes of the
         * stream that are default.
+        *
+        * Note: Some resource descriptors will have an additional null, so
+        * we add 1 to the length.
         */
-       if (*bytes_consumed > 16) {
+       if (*bytes_consumed > (16 + 1)) {
                /* Dereference the Index */
 
                temp8 = *buffer;
@@ -401,7 +410,7 @@ acpi_rs_address16_stream (
 
                /*
                 * Buffer needs to be set to the length of the sting + one for the
-                *  terminating null
+                * terminating null
                 */
                buffer += (acpi_size)(ACPI_STRLEN (linked_list->data.address16.resource_source.string_ptr) + 1);
        }
@@ -470,8 +479,14 @@ acpi_rs_address32_resource (
         */
        buffer += 1;
        ACPI_MOVE_16_TO_16 (&temp16, buffer);
-       *bytes_consumed = temp16 + 3;
 
+       /* Validate minimum descriptor length */
+
+       if (temp16 < 23) {
+               return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH);
+       }
+
+       *bytes_consumed = temp16 + 3;
        output_struct->id = ACPI_RSTYPE_ADDRESS32;
 
        /*
@@ -578,8 +593,11 @@ acpi_rs_address32_resource (
         * This will leave us pointing to the Resource Source Index
         * If it is present, then save it off and calculate the
         * pointer to where the null terminated string goes:
+        *
+        * Note: Some resource descriptors will have an additional null, so
+        * we add 1 to the length.
         */
-       if (*bytes_consumed > 26) {
+       if (*bytes_consumed > (26 + 1)) {
                /* Dereference the Index */
 
                temp8 = *buffer;
@@ -616,8 +634,8 @@ acpi_rs_address32_resource (
 
                /*
                 * In order for the struct_size to fall on a 32-bit boundary,
-                *  calculate the length of the string and expand the
-                *  struct_size to the next 32-bit boundary.
+                * calculate the length of the string and expand the
+                * struct_size to the next 32-bit boundary.
                 */
                temp8 = (u8) (index + 1);
                struct_size += ACPI_ROUND_UP_to_32_bITS (temp8);
@@ -848,6 +866,12 @@ acpi_rs_address64_resource (
        buffer += 1;
        ACPI_MOVE_16_TO_16 (&temp16, buffer);
 
+       /* Validate minimum descriptor length */
+
+       if (temp16 < 43) {
+               return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH);
+       }
+
        *bytes_consumed = temp16 + 3;
        output_struct->id = ACPI_RSTYPE_ADDRESS64;
 
@@ -958,8 +982,11 @@ acpi_rs_address64_resource (
         * pointer to where the null terminated string goes:
         * Each Interrupt takes 32-bits + the 5 bytes of the
         * stream that are default.
+        *
+        * Note: Some resource descriptors will have an additional null, so
+        * we add 1 to the length.
         */
-       if (*bytes_consumed > 46) {
+       if (*bytes_consumed > (46 + 1)) {
                /* Dereference the Index */
 
                temp8 = *buffer;
@@ -992,7 +1019,6 @@ acpi_rs_address64_resource (
                 * Add the terminating null
                 */
                *temp_ptr = 0x00;
-
                output_struct->data.address64.resource_source.string_length = index + 1;
 
                /*
@@ -1064,7 +1090,6 @@ acpi_rs_address64_stream (
        /*
         * Set a pointer to the Length field - to be filled in later
         */
-
        length_field = ACPI_CAST_PTR (u16, buffer);
        buffer += 2;
 
@@ -1161,7 +1186,7 @@ acpi_rs_address64_stream (
 
                /*
                 * Buffer needs to be set to the length of the sting + one for the
-                *  terminating null
+                * terminating null
                 */
                buffer += (acpi_size)(ACPI_STRLEN (linked_list->data.address64.resource_source.string_ptr) + 1);
        }
index 02efcffac0f24e3b6f789ce16696c6657967feeb..b44e55bbfd1427560745859d51fb736d3f5ff606 100644 (file)
@@ -319,6 +319,12 @@ acpi_rs_extended_irq_resource (
        buffer += 1;
        ACPI_MOVE_16_TO_16 (&temp16, buffer);
 
+       /* Validate minimum descriptor length */
+
+       if (temp16 < 6) {
+               return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH);
+       }
+
        *bytes_consumed = temp16 + 3;
        output_struct->id = ACPI_RSTYPE_EXT_IRQ;
 
@@ -357,6 +363,12 @@ acpi_rs_extended_irq_resource (
        buffer += 1;
        temp8 = *buffer;
 
+       /* Must have at least one IRQ */
+
+       if (temp8 < 1) {
+               return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH);
+       }
+
        output_struct->data.extended_irq.number_of_interrupts = temp8;
 
        /*
@@ -388,9 +400,12 @@ acpi_rs_extended_irq_resource (
         * pointer to where the null terminated string goes:
         * Each Interrupt takes 32-bits + the 5 bytes of the
         * stream that are default.
+        *
+        * Note: Some resource descriptors will have an additional null, so
+        * we add 1 to the length.
         */
        if (*bytes_consumed >
-               ((acpi_size) output_struct->data.extended_irq.number_of_interrupts * 4) + 5) {
+               ((acpi_size) output_struct->data.extended_irq.number_of_interrupts * 4) + (5 + 1)) {
                /* Dereference the Index */
 
                temp8 = *buffer;
index 6efdcac88e618c00075de142afbe569165120ca6..f786bc21cf54bde094dac5a057c94706d844c291 100644 (file)
@@ -131,7 +131,7 @@ acpi_tb_convert_to_xsdt (
        /* Copy the header and set the length */
 
        ACPI_MEMCPY (new_table, table_info->pointer, sizeof (struct acpi_table_header));
-       new_table->header.length = (u32) table_size;
+       new_table->length = (u32) table_size;
 
        /* Copy the table pointers */
 
@@ -430,17 +430,17 @@ acpi_tb_convert_table_fadt (void)
         * FADT length and version validation.  The table must be at least as
         * long as the version 1.0 FADT
         */
-       if (acpi_gbl_FADT->header.length < sizeof (struct fadt_descriptor_rev1)) {
-               ACPI_REPORT_ERROR (("Invalid FADT table length: 0x%X\n", acpi_gbl_FADT->header.length));
+       if (acpi_gbl_FADT->length < sizeof (struct fadt_descriptor_rev1)) {
+               ACPI_REPORT_ERROR (("Invalid FADT table length: 0x%X\n", acpi_gbl_FADT->length));
                return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH);
        }
 
-       if (acpi_gbl_FADT->header.revision >= FADT2_REVISION_ID) {
-               if (acpi_gbl_FADT->header.length < sizeof (struct fadt_descriptor_rev2)) {
+       if (acpi_gbl_FADT->revision >= FADT2_REVISION_ID) {
+               if (acpi_gbl_FADT->length < sizeof (struct fadt_descriptor_rev2)) {
                        /* Length is too short to be a V2.0 table */
 
                        ACPI_REPORT_WARNING (("Inconsistent FADT length (0x%X) and revision (0x%X), using FADT V1.0 portion of table\n",
-                                        acpi_gbl_FADT->header.length, acpi_gbl_FADT->header.revision));
+                                        acpi_gbl_FADT->length, acpi_gbl_FADT->revision));
 
                        acpi_tb_convert_fadt1 (local_fadt, (void *) acpi_gbl_FADT);
                }
@@ -460,7 +460,7 @@ acpi_tb_convert_table_fadt (void)
         * Global FADT pointer will point to the new common V2.0 FADT
         */
        acpi_gbl_FADT = local_fadt;
-       acpi_gbl_FADT->header.length = sizeof (FADT_DESCRIPTOR);
+       acpi_gbl_FADT->length = sizeof (FADT_DESCRIPTOR);
 
        /* Free the original table */
 
@@ -477,8 +477,8 @@ acpi_tb_convert_table_fadt (void)
 
        ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
                "Hex dump of common internal FADT, size %d (%X)\n",
-               acpi_gbl_FADT->header.length, acpi_gbl_FADT->header.length));
-       ACPI_DUMP_BUFFER ((u8 *) (acpi_gbl_FADT), acpi_gbl_FADT->header.length);
+               acpi_gbl_FADT->length, acpi_gbl_FADT->length));
+       ACPI_DUMP_BUFFER ((u8 *) (acpi_gbl_FADT), acpi_gbl_FADT->length);
 
        return_ACPI_STATUS (AE_OK);
 }
index 8ab152398483e3fdd6b8cbd76cf9bef2b0a44544..fea19c0e4b6fe8470c3f02495afeba11b291b330 100644 (file)
@@ -350,7 +350,7 @@ acpi_tb_init_table_descriptor (
 void
 acpi_tb_delete_all_tables (void)
 {
-       acpi_table_type                     type;
+       acpi_table_type                 type;
 
 
        /*
@@ -378,7 +378,7 @@ acpi_tb_delete_all_tables (void)
 
 void
 acpi_tb_delete_tables_by_type (
-       acpi_table_type                     type)
+       acpi_table_type                 type)
 {
        struct acpi_table_desc          *table_desc;
        u32                             count;
@@ -425,15 +425,16 @@ acpi_tb_delete_tables_by_type (
                break;
        }
 
-       /* Free the table */
-       /* Get the head of the list */
-
+       /*
+        * Free the table
+        * 1) Get the head of the list
+        */
        table_desc = acpi_gbl_table_lists[type].next;
        count     = acpi_gbl_table_lists[type].count;
 
        /*
-        * Walk the entire list, deleting both the allocated tables
-        * and the table descriptors
+        * 2) Walk the entire list, deleting both the allocated tables
+        *    and the table descriptors
         */
        for (i = 0; i < count; i++) {
                table_desc = acpi_tb_uninstall_table (table_desc);
index 148b5403a5ef6137fb28369f63eca640ab9e4dc6..1ba30ab2bc86229cfef67d6802d5a10855a44891 100644 (file)
@@ -795,7 +795,7 @@ acpi_ut_remove_allocation (
 
        ACPI_MEMSET (&allocation->user_space, 0xEA, allocation->size);
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing size %X\n", allocation->size));
+       ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n", allocation->size));
 
        status = acpi_ut_release_mutex (ACPI_MTX_MEMORY);
        return_ACPI_STATUS (status);
index 752a79541b9526c248d28e350a28a235942d95b2..b0773550a0432592b69c41e4a9779d8cfb1f8595 100644 (file)
@@ -307,8 +307,8 @@ struct acpi_table_support           acpi_gbl_table_data[NUM_ACPI_TABLE_TYPES] =
        /***********    Name,   Signature, Global typed pointer     Signature size,      Type                  How many allowed?,    Contains valid AML? */
 
        /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL,                    sizeof (RSDP_SIG)-1, ACPI_TABLE_ROOT     | ACPI_TABLE_SINGLE},
-       /* DSDT 1 */ {DSDT_SIG,  DSDT_SIG, (void *) &acpi_gbl_DSDT, sizeof (DSDT_SIG)-1, ACPI_TABLE_SECONDARY| ACPI_TABLE_SINGLE  | ACPI_TABLE_EXECUTABLE},
-       /* FADT 2 */ {FADT_SIG,  FADT_SIG, (void *) &acpi_gbl_FADT, sizeof (FADT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_SINGLE},
+       /* DSDT 1 */ {DSDT_SIG,  DSDT_SIG, (void *) &acpi_gbl_DSDT, sizeof (DSDT_SIG)-1, ACPI_TABLE_SECONDARY| ACPI_TABLE_SINGLE   | ACPI_TABLE_EXECUTABLE},
+       /* FADT 2 */ {FADT_SIG,  FADT_SIG, (void *) &acpi_gbl_FADT, sizeof (FADT_SIG)-1, ACPI_TABLE_PRIMARY  | ACPI_TABLE_SINGLE},
        /* FACS 3 */ {FACS_SIG,  FACS_SIG, (void *) &acpi_gbl_FACS, sizeof (FACS_SIG)-1, ACPI_TABLE_SECONDARY| ACPI_TABLE_SINGLE},
        /* PSDT 4 */ {PSDT_SIG,  PSDT_SIG, NULL,                    sizeof (PSDT_SIG)-1, ACPI_TABLE_PRIMARY  | ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE},
        /* SSDT 5 */ {SSDT_SIG,  SSDT_SIG, NULL,                    sizeof (SSDT_SIG)-1, ACPI_TABLE_PRIMARY  | ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE},
index 3a6ad7ab98dd245fae177584cd15fd0a8892106e..cb2f15ca05e06c62d61f8ad9b17edeb0538ea00c 100644 (file)
@@ -64,7 +64,7 @@
 
 /* Version string */
 
-#define ACPI_CA_VERSION                 0x20030918
+#define ACPI_CA_VERSION                 0x20031002
 
 /* Maximum objects in the various object caches */
 
index d225bdd2b9b9136ed66b38d00825807f84438320..97df33f30f1709a7ca90d1d6eb8a2c45e7546ea7 100644 (file)
 #define AE_AML_NO_RESOURCE_END_TAG      (acpi_status) (0x001E | AE_CODE_AML)
 #define AE_AML_BAD_RESOURCE_VALUE       (acpi_status) (0x001F | AE_CODE_AML)
 #define AE_AML_CIRCULAR_REFERENCE       (acpi_status) (0x0020 | AE_CODE_AML)
+#define AE_AML_BAD_RESOURCE_LENGTH      (acpi_status) (0x0021 | AE_CODE_AML)
 
 #define AE_CODE_AML_MAX                 0x0020
 
@@ -280,7 +281,8 @@ char const   *acpi_gbl_exception_names_aml[] =
        "AE_AML_ALIGNMENT",
        "AE_AML_NO_RESOURCE_END_TAG",
        "AE_AML_BAD_RESOURCE_VALUE",
-       "AE_AML_CIRCULAR_REFERENCE"
+       "AE_AML_CIRCULAR_REFERENCE",
+       "AE_AML_BAD_RESOURCE_LENGTH"
 };
 
 char const   *acpi_gbl_exception_names_ctrl[] =
index de509b9fd4ec68f88f2b2d08656c2febb0a9b299..5ad72cfbac29a38aa11178745cf8c23bfae6a4af 100644 (file)
 
 #define GL_OWNED                0x02        /* Ownership of global lock is bit 1 */
 
-/* values of Mapic.Model */
-
-#define DUAL_PIC                0
-#define MULTIPLE_APIC           1
-
-/* values of Type in struct apic_header */
-
-#define APIC_PROC               0
-#define APIC_IO                 1
-
 
 /*
  * Common table types.  The base code can remain
 #pragma pack(1)
 
 /*
- * Architecture-independent tables
- * The architecture dependent tables are in separate files
+ * ACPI Version-independent tables
+ *
+ * NOTE: The tables that are specific to ACPI versions (1.0, 2.0, etc.)
+ * are in separate files.
  */
 struct rsdp_descriptor         /* Root System Descriptor Pointer */
 {
@@ -106,20 +98,6 @@ struct rsdp_descriptor         /* Root System Descriptor Pointer */
 };
 
 
-struct acpi_table_header         /* ACPI common table header */
-{
-       char                            signature [4];          /* ACPI signature (4 ASCII characters) */
-       u32                             length;                 /* Length of table, in bytes, including header */
-       u8                              revision;               /* ACPI Specification minor version # */
-       u8                              checksum;               /* To make sum of entire table == 0 */
-       char                            oem_id [6];             /* OEM identification */
-       char                            oem_table_id [8];       /* OEM table identification */
-       u32                             oem_revision;           /* OEM revision number */
-       char                            asl_compiler_id [4];    /* ASL compiler vendor ID */
-       u32                             asl_compiler_revision;  /* ASL compiler revision number */
-};
-
-
 struct acpi_common_facs          /* Common FACS for internal use */
 {
        u32                             *global_lock;
@@ -128,68 +106,196 @@ struct acpi_common_facs          /* Common FACS for internal use */
 };
 
 
-struct apic_table
+#define ACPI_TABLE_HEADER_DEF   /* ACPI common table header */ \
+       char                            signature [4];          /* ACPI signature (4 ASCII characters) */\
+       u32                             length;                 /* Length of table, in bytes, including header */\
+       u8                              revision;               /* ACPI Specification minor version # */\
+       u8                              checksum;               /* To make sum of entire table == 0 */\
+       char                            oem_id [6];             /* OEM identification */\
+       char                            oem_table_id [8];       /* OEM table identification */\
+       u32                             oem_revision;           /* OEM revision number */\
+       char                            asl_compiler_id [4];    /* ASL compiler vendor ID */\
+       u32                             asl_compiler_revision;  /* ASL compiler revision number */
+
+
+struct acpi_table_header         /* ACPI common table header */
 {
-       struct acpi_table_header        header;                 /* ACPI table header */
-       u32                             local_apic_address;     /* Physical address for accessing local APICs */
-       u32                             PCATcompat      : 1;    /* a one indicates system also has dual 8259s */
-       u32                             reserved1       : 31;
+       ACPI_TABLE_HEADER_DEF
 };
 
 
-struct apic_header
+/*
+ * MADT values and structures
+ */
+
+/* Values for MADT PCATCompat */
+
+#define DUAL_PIC                0
+#define MULTIPLE_APIC           1
+
+
+/* Master MADT */
+
+struct multiple_apic_table
 {
-       u8                              type;                   /* APIC type.  Either APIC_PROC or APIC_IO */
-       u8                              length;                 /* Length of APIC structure */
+       ACPI_TABLE_HEADER_DEF                           /* ACPI common table header */
+       u32                             local_apic_address;     /* Physical address of local APIC */
+       u32                             PCATcompat      : 1;    /* A one indicates system also has dual 8259s */
+       u32                             reserved1       : 31;
 };
 
 
-struct processor_apic
+/* Values for Type in APIC_HEADER_DEF */
+
+#define APIC_PROCESSOR          0
+#define APIC_IO                 1
+#define APIC_XRUPT_OVERRIDE     2
+#define APIC_NMI                3
+#define APIC_LOCAL_NMI          4
+#define APIC_ADDRESS_OVERRIDE   5
+#define APIC_IO_SAPIC           6
+#define APIC_LOCAL_SAPIC        7
+#define APIC_XRUPT_SOURCE       8
+#define APIC_RESERVED           9           /* 9 and greater are reserved */
+
+/*
+ * MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE)
+ */
+#define APIC_HEADER_DEF                     /* Common APIC sub-structure header */\
+       u8                              type; \
+       u8                              length;
+
+/* Values for MPS INTI flags */
+
+#define POLARITY_CONFORMS       0
+#define POLARITY_ACTIVE_HIGH    1
+#define POLARITY_RESERVED       2
+#define POLARITY_ACTIVE_LOW     3
+
+#define TRIGGER_CONFORMS        0
+#define TRIGGER_EDGE            1
+#define TRIGGER_RESERVED        2
+#define TRIGGER_LEVEL           3
+
+/* Common flag definitions */
+
+#define MPS_INTI_FLAGS \
+       u16                             polarity        : 2;    /* Polarity of APIC I/O input signals */\
+       u16                             trigger_mode    : 2;    /* Trigger mode of APIC input signals */\
+       u16                             reserved1       : 12;   /* Reserved, must be zero */
+
+#define LOCAL_APIC_FLAGS \
+       u32                             processor_enabled: 1;   /* Processor is usable if set */\
+       u32                             reserved2       : 31;   /* Reserved, must be zero */
+
+/* Sub-structures for MADT */
+
+struct madt_processor_apic
 {
-       struct apic_header              header;
-       u8                              processor_apic_id;      /* ACPI processor id */
+       APIC_HEADER_DEF
+       u8                              processor_id;           /* ACPI processor id */
        u8                              local_apic_id;          /* Processor's local APIC id */
-       u32                             processor_enabled: 1;   /* Processor is usable if set */
-       u32                             reserved1       : 31;
+       LOCAL_APIC_FLAGS
 };
 
-
-struct io_apic
+struct madt_io_apic
 {
-       struct apic_header              header;
+       APIC_HEADER_DEF
        u8                              io_apic_id;             /* I/O APIC ID */
        u8                              reserved;               /* Reserved - must be zero */
-       u32                             io_apic_address;        /* APIC's physical address */
-       u32                             vector;                 /* Interrupt vector index where INTI
+       u32                             address;                /* APIC physical address */
+       u32                             interrupt;              /* Global system interrupt where INTI
                          * lines start */
 };
 
+struct madt_interrupt_override
+{
+       APIC_HEADER_DEF
+       u8                              bus;                    /* 0 - ISA */
+       u8                              source;                 /* Interrupt source (IRQ) */
+       u32                             interrupt;              /* Global system interrupt */
+       MPS_INTI_FLAGS
+};
+
+struct madt_nmi_source
+{
+       APIC_HEADER_DEF
+       MPS_INTI_FLAGS
+       u32                             interrupt;              /* Global system interrupt */
+};
+
+struct madt_local_apic_nmi
+{
+       APIC_HEADER_DEF
+       u8                              processor_id;           /* ACPI processor id */
+       MPS_INTI_FLAGS
+       u8                              lint;                   /* LINTn to which NMI is connected */
+};
+
+struct madt_address_override
+{
+       APIC_HEADER_DEF
+       u16                             reserved;               /* Reserved - must be zero */
+       u32                             address;                /* APIC physical address */
+};
+
+struct madt_io_sapic
+{
+       APIC_HEADER_DEF
+       u8                              io_sapic_id;            /* I/O SAPIC ID */
+       u8                              reserved;               /* Reserved - must be zero */
+       u32                             interrupt_base;         /* Glocal interrupt for SAPIC start */
+       u64                             address;                /* SAPIC physical address */
+};
+
+struct madt_local_sapic
+{
+       APIC_HEADER_DEF
+       u8                              processor_id;           /* ACPI processor id */
+       u8                              local_sapic_id;         /* SAPIC ID */
+       u8                              local_sapic_eid;        /* SAPIC EID */
+       u8                              reserved [3];           /* Reserved - must be zero */
+       LOCAL_APIC_FLAGS
+};
+
+struct madt_interrupt_source
+{
+       APIC_HEADER_DEF
+       MPS_INTI_FLAGS
+       u8                              interrupt_type;         /* 1=PMI, 2=INIT, 3=corrected */
+       u8                              processor_id;           /* Processor ID */
+       u8                              processor_eid;          /* Processor EID */
+       u8                              io_sapic_vector;        /* Vector value for PMI interrupts */
+       u32                             interrupt;              /* Global system interrupt */
+       u32                             reserved;               /* Reserved - must be zero */
+};
 
-/*
- *  IA64 TBD:  Add SAPIC Tables
- */
 
 /*
- *  IA64 TBD:   Modify Smart Battery Description to comply with ACPI IA64
- *              extensions.
+ * Smart Battery
  */
-struct smart_battery_description_table
+struct smart_battery_table
 {
-       struct acpi_table_header        header;
+       ACPI_TABLE_HEADER_DEF
        u32                             warning_level;
        u32                             low_level;
        u32                             critical_level;
 };
 
-struct hpet_description_table
+
+/*
+ * High performance timer
+ */
+struct hpet_table
 {
-       struct acpi_table_header        header;
+       ACPI_TABLE_HEADER_DEF
        u32                             hardware_id;
-       u32                             base_address[3];
+       u32                             base_address [3];
        u8                              hpet_number;
        u16                             clock_tick;
        u8                              attributes;
 };
+
 #pragma pack()
 
 
@@ -227,9 +333,10 @@ struct acpi_table_support
 
 
 /*
- * Get the architecture-specific tables
+ * Get the ACPI version-specific tables
  */
 #include "actbl1.h"   /* Acpi 1.0 table definitions */
 #include "actbl2.h"   /* Acpi 2.0 table definitions */
 
+
 #endif /* __ACTBL_H__ */
index 91e5ba7cdd505c103a5cc691bfc1d47118d69de0..8067eb2c37bcbabc9a288e7b1c05542c34a66b26 100644 (file)
@@ -51,7 +51,7 @@
  */
 struct rsdt_descriptor_rev1
 {
-       struct acpi_table_header        header;                 /* ACPI Table header */
+       ACPI_TABLE_HEADER_DEF                           /* ACPI common table header */
        u32                             table_offset_entry [1]; /* Array of pointers to other */
                         /* ACPI tables */
 };
@@ -78,7 +78,7 @@ struct facs_descriptor_rev1
  */
 struct fadt_descriptor_rev1
 {
-       struct acpi_table_header        header;                 /* ACPI Table header */
+       ACPI_TABLE_HEADER_DEF                           /* ACPI common table header */
        u32                             firmware_ctrl;          /* Physical address of FACS */
        u32                             dsdt;                   /* Physical address of DSDT */
        u8                              model;                  /* System Interrupt Model */
index 65a762b49d8fba1689972c20e32752521538c1b9..d68627efc0e11da17cca8b13d45c6b4d481f03f0 100644 (file)
@@ -71,7 +71,7 @@
  */
 struct rsdt_descriptor_rev2
 {
-       struct acpi_table_header        header;                 /* ACPI table header */
+       ACPI_TABLE_HEADER_DEF                           /* ACPI common table header */
        u32                             table_offset_entry [1]; /* Array of pointers to  */
                         /* ACPI table headers */
 };
@@ -82,7 +82,7 @@ struct rsdt_descriptor_rev2
  */
 struct xsdt_descriptor_rev2
 {
-       struct acpi_table_header        header;                 /* ACPI table header */
+       ACPI_TABLE_HEADER_DEF                           /* ACPI common table header */
        u64                             table_offset_entry [1]; /* Array of pointers to  */
                         /* ACPI table headers */
 };
@@ -124,7 +124,7 @@ struct acpi_generic_address
  */
 struct fadt_descriptor_rev2
 {
-       struct acpi_table_header        header;             /* ACPI table header */
+       ACPI_TABLE_HEADER_DEF                       /* ACPI common table header */
        u32                             V1_firmware_ctrl;   /* 32-bit physical address of FACS */
        u32                             V1_dsdt;            /* 32-bit physical address of DSDT */
        u8                              reserved1;          /* System Interrupt Model isn't used in ACPI 2.0*/
@@ -195,6 +195,19 @@ struct fadt_descriptor_rev2
 };
 
 
+/* Embedded Controller */
+
+struct ec_boot_resources
+{
+       ACPI_TABLE_HEADER_DEF
+       struct acpi_generic_address     ec_control;         /* Address of EC command/status register */
+       struct acpi_generic_address     ec_data;            /* Address of EC data register */
+       u32                             uid;                /* Unique ID - must be same as the EC _UID method */
+       u8                              gpe_bit;            /* The GPE for the EC */
+       u8                              ec_id[1];           /* Full namepath of the EC in the ACPI namespace */
+};
+
+
 #pragma pack()
 
 #endif /* __ACTBL2_H__ */
index beec737952a32dc3e7a21f79a0ceb63d443d5808..24c930c9c7242504ee282d46175e5f3d72a0eb54 100644 (file)
@@ -207,6 +207,7 @@ typedef u32                                     acpi_size;
 /*
  * Miscellaneous common types
  */
+typedef u16                                     UINT16_BIT;
 typedef u32                                     UINT32_BIT;
 typedef acpi_native_uint                        ACPI_PTRDIFF;