aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/acpi/resources/rsaddr.c99
-rw-r--r--drivers/acpi/resources/rscalc.c985
-rw-r--r--drivers/acpi/resources/rsdump.c1284
-rw-r--r--drivers/acpi/resources/rsio.c56
-rw-r--r--drivers/acpi/resources/rsirq.c57
-rw-r--r--drivers/acpi/resources/rslist.c533
-rw-r--r--drivers/acpi/resources/rsmemory.c68
-rw-r--r--drivers/acpi/resources/rsmisc.c234
-rw-r--r--drivers/acpi/resources/rsxface.c8
-rw-r--r--drivers/acpi/utilities/utmisc.c2
-rw-r--r--drivers/acpi/utilities/utmutex.c4
-rw-r--r--include/acpi/acconfig.h4
-rw-r--r--include/acpi/acdisasm.h36
-rw-r--r--include/acpi/aclocal.h23
-rw-r--r--include/acpi/acresrc.h46
-rw-r--r--include/acpi/actypes.h13
-rw-r--r--include/acpi/amlresrc.h56
-rw-r--r--include/acpi/platform/acenv.h1
18 files changed, 1701 insertions, 1808 deletions
diff --git a/drivers/acpi/resources/rsaddr.c b/drivers/acpi/resources/rsaddr.c
index 23b54baa0cb..798778261fb 100644
--- a/drivers/acpi/resources/rsaddr.c
+++ b/drivers/acpi/resources/rsaddr.c
@@ -270,7 +270,7 @@ acpi_rs_address16_resource(u8 * byte_stream_buffer,
}
*bytes_consumed = temp16 + 3;
- output_struct->id = ACPI_RSTYPE_ADDRESS16;
+ output_struct->type = ACPI_RSTYPE_ADDRESS16;
/* Get the Resource Type (Byte3) */
@@ -400,7 +400,7 @@ acpi_rs_address16_resource(u8 * byte_stream_buffer,
*
* FUNCTION: acpi_rs_address16_stream
*
- * PARAMETERS: linked_list - Pointer to the resource linked list
+ * PARAMETERS: Resource - Pointer to the resource linked list
* output_buffer - Pointer to the user's return buffer
* bytes_consumed - Pointer to where the number of bytes
* used in the output_buffer is returned
@@ -413,7 +413,7 @@ acpi_rs_address16_resource(u8 * byte_stream_buffer,
******************************************************************************/
acpi_status
-acpi_rs_address16_stream(struct acpi_resource *linked_list,
+acpi_rs_address16_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed)
{
u8 *buffer = *output_buffer;
@@ -434,59 +434,56 @@ acpi_rs_address16_stream(struct acpi_resource *linked_list,
/* Set the Resource Type (Memory, Io, bus_number) */
- *buffer = (u8) (linked_list->data.address16.resource_type & 0x03);
+ *buffer = (u8) (resource->data.address16.resource_type & 0x03);
buffer += 1;
/* Set the general flags */
- *buffer = acpi_rs_encode_general_flags(&linked_list->data);
+ *buffer = acpi_rs_encode_general_flags(&resource->data);
buffer += 1;
/* Set the type specific flags */
- *buffer = acpi_rs_encode_specific_flags(&linked_list->data);
+ *buffer = acpi_rs_encode_specific_flags(&resource->data);
buffer += 1;
/* Set the address space granularity */
- ACPI_MOVE_32_TO_16(buffer, &linked_list->data.address16.granularity);
+ ACPI_MOVE_32_TO_16(buffer, &resource->data.address16.granularity);
buffer += 2;
/* Set the address range minimum */
- ACPI_MOVE_32_TO_16(buffer,
- &linked_list->data.address16.min_address_range);
+ ACPI_MOVE_32_TO_16(buffer, &resource->data.address16.min_address_range);
buffer += 2;
/* Set the address range maximum */
- ACPI_MOVE_32_TO_16(buffer,
- &linked_list->data.address16.max_address_range);
+ ACPI_MOVE_32_TO_16(buffer, &resource->data.address16.max_address_range);
buffer += 2;
/* Set the address translation offset */
ACPI_MOVE_32_TO_16(buffer,
- &linked_list->data.address16.
+ &resource->data.address16.
address_translation_offset);
buffer += 2;
/* Set the address length */
- ACPI_MOVE_32_TO_16(buffer, &linked_list->data.address16.address_length);
+ ACPI_MOVE_32_TO_16(buffer, &resource->data.address16.address_length);
buffer += 2;
/* Resource Source Index and Resource Source are optional */
- if (linked_list->data.address16.resource_source.string_length) {
- *buffer =
- (u8) linked_list->data.address16.resource_source.index;
+ if (resource->data.address16.resource_source.string_length) {
+ *buffer = (u8) resource->data.address16.resource_source.index;
buffer += 1;
/* Copy the resource_source string */
ACPI_STRCPY((char *)buffer,
- linked_list->data.address16.resource_source.
+ resource->data.address16.resource_source.
string_ptr);
/*
@@ -495,7 +492,7 @@ acpi_rs_address16_stream(struct acpi_resource *linked_list,
*/
buffer +=
(acpi_size) (ACPI_STRLEN
- (linked_list->data.address16.resource_source.
+ (resource->data.address16.resource_source.
string_ptr) + 1);
}
@@ -562,7 +559,7 @@ acpi_rs_address32_resource(u8 * byte_stream_buffer,
}
*bytes_consumed = temp16 + 3;
- output_struct->id = ACPI_RSTYPE_ADDRESS32;
+ output_struct->type = ACPI_RSTYPE_ADDRESS32;
/* Get the Resource Type (Byte3) */
@@ -690,7 +687,7 @@ acpi_rs_address32_resource(u8 * byte_stream_buffer,
*
* FUNCTION: acpi_rs_address32_stream
*
- * PARAMETERS: linked_list - Pointer to the resource linked list
+ * PARAMETERS: Resource - Pointer to the resource linked list
* output_buffer - Pointer to the user's return buffer
* bytes_consumed - Pointer to where the number of bytes
* used in the output_buffer is returned
@@ -703,7 +700,7 @@ acpi_rs_address32_resource(u8 * byte_stream_buffer,
******************************************************************************/
acpi_status
-acpi_rs_address32_stream(struct acpi_resource *linked_list,
+acpi_rs_address32_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed)
{
u8 *buffer;
@@ -725,59 +722,56 @@ acpi_rs_address32_stream(struct acpi_resource *linked_list,
/* Set the Resource Type (Memory, Io, bus_number) */
- *buffer = (u8) (linked_list->data.address32.resource_type & 0x03);
+ *buffer = (u8) (resource->data.address32.resource_type & 0x03);
buffer += 1;
/* Set the general flags */
- *buffer = acpi_rs_encode_general_flags(&linked_list->data);
+ *buffer = acpi_rs_encode_general_flags(&resource->data);
buffer += 1;
/* Set the type specific flags */
- *buffer = acpi_rs_encode_specific_flags(&linked_list->data);
+ *buffer = acpi_rs_encode_specific_flags(&resource->data);
buffer += 1;
/* Set the address space granularity */
- ACPI_MOVE_32_TO_32(buffer, &linked_list->data.address32.granularity);
+ ACPI_MOVE_32_TO_32(buffer, &resource->data.address32.granularity);
buffer += 4;
/* Set the address range minimum */
- ACPI_MOVE_32_TO_32(buffer,
- &linked_list->data.address32.min_address_range);
+ ACPI_MOVE_32_TO_32(buffer, &resource->data.address32.min_address_range);
buffer += 4;
/* Set the address range maximum */
- ACPI_MOVE_32_TO_32(buffer,
- &linked_list->data.address32.max_address_range);
+ ACPI_MOVE_32_TO_32(buffer, &resource->data.address32.max_address_range);
buffer += 4;
/* Set the address translation offset */
ACPI_MOVE_32_TO_32(buffer,
- &linked_list->data.address32.
+ &resource->data.address32.
address_translation_offset);
buffer += 4;
/* Set the address length */
- ACPI_MOVE_32_TO_32(buffer, &linked_list->data.address32.address_length);
+ ACPI_MOVE_32_TO_32(buffer, &resource->data.address32.address_length);
buffer += 4;
/* Resource Source Index and Resource Source are optional */
- if (linked_list->data.address32.resource_source.string_length) {
- *buffer =
- (u8) linked_list->data.address32.resource_source.index;
+ if (resource->data.address32.resource_source.string_length) {
+ *buffer = (u8) resource->data.address32.resource_source.index;
buffer += 1;
/* Copy the resource_source string */
ACPI_STRCPY((char *)buffer,
- linked_list->data.address32.resource_source.
+ resource->data.address32.resource_source.
string_ptr);
/*
@@ -786,7 +780,7 @@ acpi_rs_address32_stream(struct acpi_resource *linked_list,
*/
buffer +=
(acpi_size) (ACPI_STRLEN
- (linked_list->data.address32.resource_source.
+ (resource->data.address32.resource_source.
string_ptr) + 1);
}
@@ -856,7 +850,7 @@ acpi_rs_address64_resource(u8 * byte_stream_buffer,
}
*bytes_consumed = temp16 + 3;
- output_struct->id = ACPI_RSTYPE_ADDRESS64;
+ output_struct->type = ACPI_RSTYPE_ADDRESS64;
/* Get the Resource Type (Byte3) */
@@ -1005,7 +999,7 @@ acpi_rs_address64_resource(u8 * byte_stream_buffer,
*
* FUNCTION: acpi_rs_address64_stream
*
- * PARAMETERS: linked_list - Pointer to the resource linked list
+ * PARAMETERS: Resource - Pointer to the resource linked list
* output_buffer - Pointer to the user's return buffer
* bytes_consumed - Pointer to where the number of bytes
* used in the output_buffer is returned
@@ -1018,7 +1012,7 @@ acpi_rs_address64_resource(u8 * byte_stream_buffer,
******************************************************************************/
acpi_status
-acpi_rs_address64_stream(struct acpi_resource *linked_list,
+acpi_rs_address64_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed)
{
u8 *buffer;
@@ -1040,59 +1034,56 @@ acpi_rs_address64_stream(struct acpi_resource *linked_list,
/* Set the Resource Type (Memory, Io, bus_number) */
- *buffer = (u8) (linked_list->data.address64.resource_type & 0x03);
+ *buffer = (u8) (resource->data.address64.resource_type & 0x03);
buffer += 1;
/* Set the general flags */
- *buffer = acpi_rs_encode_general_flags(&linked_list->data);
+ *buffer = acpi_rs_encode_general_flags(&resource->data);
buffer += 1;
/* Set the type specific flags */
- *buffer = acpi_rs_encode_specific_flags(&linked_list->data);
+ *buffer = acpi_rs_encode_specific_flags(&resource->data);
buffer += 1;
/* Set the address space granularity */
- ACPI_MOVE_64_TO_64(buffer, &linked_list->data.address64.granularity);
+ ACPI_MOVE_64_TO_64(buffer, &resource->data.address64.granularity);
buffer += 8;
/* Set the address range minimum */
- ACPI_MOVE_64_TO_64(buffer,
- &linked_list->data.address64.min_address_range);
+ ACPI_MOVE_64_TO_64(buffer, &resource->data.address64.min_address_range);
buffer += 8;
/* Set the address range maximum */
- ACPI_MOVE_64_TO_64(buffer,
- &linked_list->data.address64.max_address_range);
+ ACPI_MOVE_64_TO_64(buffer, &resource->data.address64.max_address_range);
buffer += 8;
/* Set the address translation offset */
ACPI_MOVE_64_TO_64(buffer,
- &linked_list->data.address64.
+ &resource->data.address64.
address_translation_offset);
buffer += 8;
/* Set the address length */
- ACPI_MOVE_64_TO_64(buffer, &linked_list->data.address64.address_length);
+ ACPI_MOVE_64_TO_64(buffer, &resource->data.address64.address_length);
buffer += 8;
/* Resource Source Index and Resource Source are optional */
- if (linked_list->data.address64.resource_source.string_length) {
- *buffer =
- (u8) linked_list->data.address64.resource_source.index;
+ if (resource->data.address64.resource_source.string_length) {
+ *buffer = (u8) resource->data.address64.resource_source.index;
buffer += 1;
/* Copy the resource_source string */
ACPI_STRCPY((char *)buffer,
- linked_list->data.address64.resource_source.
+ resource->data.address64.resource_source.
string_ptr);
/*
@@ -1101,7 +1092,7 @@ acpi_rs_address64_stream(struct acpi_resource *linked_list,
*/
buffer +=
(acpi_size) (ACPI_STRLEN
- (linked_list->data.address64.resource_source.
+ (resource->data.address64.resource_source.
string_ptr) + 1);
}
diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c
index 378f58390fc..cd051c97bf5 100644
--- a/drivers/acpi/resources/rscalc.c
+++ b/drivers/acpi/resources/rscalc.c
@@ -44,651 +44,620 @@
#include <acpi/acpi.h>
#include <acpi/acresrc.h>
#include <acpi/amlcode.h>
+#include <acpi/amlresrc.h>
#include <acpi/acnamesp.h>
#define _COMPONENT ACPI_RESOURCES
ACPI_MODULE_NAME("rscalc")
+/*
+ * Base sizes for external resource descriptors, indexed by internal type.
+ * Includes size of the descriptor header (1 byte for small descriptors,
+ * 3 bytes for large descriptors)
+ */
+static u8 acpi_gbl_stream_sizes[] = {
+ 4, /* ACPI_RSTYPE_IRQ (Byte 3 is optional, but always created) */
+ 3, /* ACPI_RSTYPE_DMA */
+ 2, /* ACPI_RSTYPE_START_DPF (Byte 1 is optional, but always created) */
+ 1, /* ACPI_RSTYPE_END_DPF */
+ 8, /* ACPI_RSTYPE_IO */
+ 4, /* ACPI_RSTYPE_FIXED_IO */
+ 1, /* ACPI_RSTYPE_VENDOR */
+ 2, /* ACPI_RSTYPE_END_TAG */
+ 12, /* ACPI_RSTYPE_MEM24 */
+ 20, /* ACPI_RSTYPE_MEM32 */
+ 12, /* ACPI_RSTYPE_FIXED_MEM32 */
+ 16, /* ACPI_RSTYPE_ADDRESS16 */
+ 26, /* ACPI_RSTYPE_ADDRESS32 */
+ 46, /* ACPI_RSTYPE_ADDRESS64 */
+ 9, /* ACPI_RSTYPE_EXT_IRQ */
+ 15 /* ACPI_RSTYPE_GENERIC_REG */
+};
+
+/*
+ * Base sizes of resource descriptors, both the actual AML stream length and
+ * size of the internal struct representation.
+ */
+typedef struct acpi_resource_sizes {
+ u8 minimum_stream_size;
+ u8 minimum_struct_size;
+
+} ACPI_RESOURCE_SIZES;
+
+static ACPI_RESOURCE_SIZES acpi_gbl_sm_resource_sizes[] = {
+ 0, 0, /* 0x00, Reserved */
+ 0, 0, /* 0x01, Reserved */
+ 0, 0, /* 0x02, Reserved */
+ 0, 0, /* 0x03, Reserved */
+ 3, ACPI_SIZEOF_RESOURCE(struct acpi_resource_irq), /* ACPI_RDESC_TYPE_IRQ_FORMAT */
+ 3, ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma), /* ACPI_RDESC_TYPE_DMA_FORMAT */
+ 1, ACPI_SIZEOF_RESOURCE(struct acpi_resource_start_dpf), /* ACPI_RDESC_TYPE_START_DEPENDENT */
+ 1, ACPI_RESOURCE_LENGTH, /* ACPI_RDESC_TYPE_END_DEPENDENT */
+ 8, ACPI_SIZEOF_RESOURCE(struct acpi_resource_io), /* ACPI_RDESC_TYPE_IO_PORT */
+ 4, ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io), /* ACPI_RDESC_TYPE_FIXED_IO_PORT */
+ 0, 0, /* 0x0A, Reserved */
+ 0, 0, /* 0x0B, Reserved */
+ 0, 0, /* 0x0C, Reserved */
+ 0, 0, /* 0x0D, Reserved */
+ 1, ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor), /* ACPI_RDESC_TYPE_SMALL_VENDOR */
+ 2, ACPI_RESOURCE_LENGTH, /* ACPI_RDESC_TYPE_END_TAG */
+};
+
+static ACPI_RESOURCE_SIZES acpi_gbl_lg_resource_sizes[] = {
+ 0, 0, /* 0x00, Reserved */
+ 12, ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem24), /* ACPI_RDESC_TYPE_MEMORY_24 */
+ 15, ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_reg), /* ACPI_RDESC_TYPE_GENERIC_REGISTER */
+ 0, 0, /* 0x03, Reserved */
+ 3, ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor), /* ACPI_RDESC_TYPE_LARGE_VENDOR */
+ 20, ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem32), /* ACPI_RDESC_TYPE_MEMORY_32 */
+ 12, ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_mem32), /* ACPI_RDESC_TYPE_FIXED_MEMORY_32 */
+ 26, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32), /* ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE */
+ 16, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16), /* ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE */
+ 9, ACPI_SIZEOF_RESOURCE(struct acpi_resource_ext_irq), /* ACPI_RDESC_TYPE_EXTENDED_XRUPT */
+ 46, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64), /* ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE */
+ 56, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64), /* ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE */
+};
+
+/* Local prototypes */
+
+static u8 acpi_rs_count_set_bits(u16 bit_field);
+
+static ACPI_RESOURCE_SIZES *acpi_rs_get_resource_sizes(u8 resource_type);
+
+static u16 acpi_rs_get_resource_length(u8 * resource);
+
+static acpi_size
+acpi_rs_struct_option_length(struct acpi_resource_source *resource_source);
+
+static u32
+acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length);
+
/*******************************************************************************
*
- * FUNCTION: acpi_rs_get_byte_stream_length
+ * FUNCTION: acpi_rs_count_set_bits
*
- * PARAMETERS: linked_list - Pointer to the resource linked list
- * size_needed - u32 pointer of the size buffer needed
- * to properly return the parsed data
+ * PARAMETERS: bit_field - Field in which to count bits
*
- * RETURN: Status
+ * RETURN: Number of bits set within the field
*
- * DESCRIPTION: Takes the resource byte stream and parses it once, calculating
- * the size buffer needed to hold the linked list that conveys
- * the resource data.
+ * DESCRIPTION: Count the number of bits set in a resource field. Used for
+ * (Short descriptor) interrupt and DMA lists.
*
******************************************************************************/
-acpi_status
-acpi_rs_get_byte_stream_length(struct acpi_resource *linked_list,
- acpi_size * size_needed)
-{
- acpi_size byte_stream_size_needed = 0;
- acpi_size segment_size;
- u8 done = FALSE;
-
- ACPI_FUNCTION_TRACE("rs_get_byte_stream_length");
- while (!done) {
- /* Init the variable that will hold the size to add to the total. */
+static u8 acpi_rs_count_set_bits(u16 bit_field)
+{
+ u8 bits_set;
- segment_size = 0;
+ ACPI_FUNCTION_ENTRY();
- switch (linked_list->id) {
- case ACPI_RSTYPE_IRQ:
- /*
- * IRQ Resource
- * For an IRQ Resource, Byte 3, although optional, will always be
- * created - it holds IRQ information.
- */
- segment_size = 4;
- break;
+ for (bits_set = 0; bit_field; bits_set++) {
+ /* Zero the least significant bit that is set */
- case ACPI_RSTYPE_DMA:
- /*
- * DMA Resource
- * For this resource the size is static
- */
- segment_size = 3;
- break;
-
- case ACPI_RSTYPE_START_DPF:
- /*
- * Start Dependent Functions Resource
- * For a start_dependent_functions Resource, Byte 1, although
- * optional, will always be created.
- */
- segment_size = 2;
- break;
+ bit_field &= (bit_field - 1);
+ }
- case ACPI_RSTYPE_END_DPF:
- /*
- * End Dependent Functions Resource
- * For this resource the size is static
- */
- segment_size = 1;
- break;
+ return (bits_set);
+}
- case ACPI_RSTYPE_IO:
- /*
- * IO Port Resource
- * For this resource the size is static
- */
- segment_size = 8;
- break;
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_rs_get_resource_sizes
+ *
+ * PARAMETERS: resource_type - Byte 0 of a resource descriptor
+ *
+ * RETURN: Pointer to the resource conversion handler
+ *
+ * DESCRIPTION: Extract the Resource Type/Name from the first byte of
+ * a resource descriptor.
+ *
+ ******************************************************************************/
- case ACPI_RSTYPE_FIXED_IO:
- /*
- * Fixed IO Port Resource
- * For this resource the size is static
- */
- segment_size = 4;
- break;
+static ACPI_RESOURCE_SIZES *acpi_rs_get_resource_sizes(u8 resource_type)
+{
+ ACPI_RESOURCE_SIZES *size_info;
- case ACPI_RSTYPE_VENDOR:
- /*
- * Vendor Defined Resource
- * For a Vendor Specific resource, if the Length is between 1 and 7
- * it will be created as a Small Resource data type, otherwise it
- * is a Large Resource data type.
- */
- if (linked_list->data.vendor_specific.length > 7) {
- segment_size = 3;
- } else {
- segment_size = 1;
- }
- segment_size +=
- linked_list->data.vendor_specific.length;
- break;
+ ACPI_FUNCTION_ENTRY();
- case ACPI_RSTYPE_END_TAG:
- /*
- * End Tag
- * For this resource the size is static
- */
- segment_size = 2;
- done = TRUE;
- break;
+ /* Determine if this is a small or large resource */
- case ACPI_RSTYPE_MEM24:
- /*
- * 24-Bit Memory Resource
- * For this resource the size is static
- */
- segment_size = 12;
- break;
+ if (resource_type & ACPI_RDESC_TYPE_LARGE) {
+ /* Large Resource Type -- bits 6:0 contain the name */
- case ACPI_RSTYPE_MEM32:
- /*
- * 32-Bit Memory Range Resource
- * For this resource the size is static
- */
- segment_size = 20;
- break;
+ if (resource_type > ACPI_RDESC_LARGE_MAX) {
+ return (NULL);
+ }
- case ACPI_RSTYPE_FIXED_MEM32:
- /*
- * 32-Bit Fixed Memory Resource
- * For this resource the size is static
- */
- segment_size = 12;
- break;
+ size_info = &acpi_gbl_lg_resource_sizes[(resource_type &
+ ACPI_RDESC_LARGE_MASK)];
+ } else {
+ /* Small Resource Type -- bits 6:3 contain the name */
- case ACPI_RSTYPE_ADDRESS16:
- /*
- * 16-Bit Address Resource
- * The base size of this byte stream is 16. If a Resource Source
- * string is not NULL, add 1 for the Index + the length of the null
- * terminated string Resource Source + 1 for the null.
- */
- segment_size = 16;
-
- if (linked_list->data.address16.resource_source.
- string_ptr) {
- segment_size +=
- linked_list->data.address16.resource_source.
- string_length;
- segment_size++;
- }
- break;
+ size_info = &acpi_gbl_sm_resource_sizes[((resource_type &
+ ACPI_RDESC_SMALL_MASK)
+ >> 3)];
+ }
- case ACPI_RSTYPE_ADDRESS32:
- /*
- * 32-Bit Address Resource
- * The base size of this byte stream is 26. If a Resource
- * Source string is not NULL, add 1 for the Index + the
- * length of the null terminated string Resource Source +
- * 1 for the null.
- */
- segment_size = 26;
-
- if (linked_list->data.address32.resource_source.
- string_ptr) {
- segment_size +=
- linked_list->data.address32.resource_source.
- string_length;
- segment_size++;
- }
- break;
+ /* Zero entry indicates an invalid resource type */
- case ACPI_RSTYPE_ADDRESS64:
- /*
- * 64-Bit Address Resource
- * The base size of this byte stream is 46. If a resource_source
- * string is not NULL, add 1 for the Index + the length of the null
- * terminated string Resource Source + 1 for the null.
- */
- segment_size = 46;
-
- if (linked_list->data.address64.resource_source.
- string_ptr) {
- segment_size +=
- linked_list->data.address64.resource_source.
- string_length;
- segment_size++;
- }
- break;
+ if (!size_info->minimum_stream_size) {
+ return (NULL);
+ }
- case ACPI_RSTYPE_EXT_IRQ:
- /*
- * Extended IRQ Resource
- * The base size of this byte stream is 9. This is for an Interrupt
- * table length of 1. For each additional interrupt, add 4.
- * If a Resource Source string is not NULL, add 1 for the
- * Index + the length of the null terminated string
- * Resource Source + 1 for the null.
- */
- segment_size = 9 + (((acpi_size)
- linked_list->data.extended_irq.
- number_of_interrupts - 1) * 4);
-
- if (linked_list->data.extended_irq.resource_source.
- string_ptr) {
- segment_size +=
- linked_list->data.extended_irq.
- resource_source.string_length;
- segment_size++;
- }
- break;
+ return (size_info);
+}
- default:
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_rs_get_resource_length
+ *
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ *
+ * RETURN: Byte length of the (AML byte stream) descriptor. By definition,
+ * this does not include the size of the descriptor header and the
+ * length field itself.
+ *
+ * DESCRIPTION: Extract the length of a resource descriptor.
+ *
+ ******************************************************************************/
- /* If we get here, everything is out of sync, exit with error */
+static u16 acpi_rs_get_resource_length(u8 * resource)
+{
+ u16 resource_length;
- return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
+ ACPI_FUNCTION_ENTRY();
- } /* switch (linked_list->Id) */
+ /* Determine if this is a small or large resource */
- /* Update the total */
+ if (*resource & ACPI_RDESC_TYPE_LARGE) {
+ /* Large Resource type -- length is in bytes 1-2 */
- byte_stream_size_needed += segment_size;
+ ACPI_MOVE_16_TO_16(&resource_length, (resource + 1));
- /* Point to the next object */
+ } else {
+ /* Small Resource Type -- bits 2:0 of byte 0 contain the length */
- linked_list = ACPI_PTR_ADD(struct acpi_resource,
- linked_list, linked_list->length);
+ resource_length =
+ (u16) (*resource & ACPI_RDESC_SMALL_LENGTH_MASK);
}
- /* This is the data the caller needs */
-
- *size_needed = byte_stream_size_needed;
- return_ACPI_STATUS(AE_OK);
+ return (resource_length);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_get_list_length
+ * FUNCTION: acpi_rs_struct_option_length
*
- * PARAMETERS: byte_stream_buffer - Pointer to the resource byte stream
- * byte_stream_buffer_length - Size of byte_stream_buffer
- * size_needed - u32 pointer of the size buffer
- * needed to properly return the
- * parsed data
+ * PARAMETERS: resource_source - Pointer to optional descriptor field
*
* RETURN: Status
*
- * DESCRIPTION: Takes the resource byte stream and parses it once, calculating
- * the size buffer needed to hold the linked list that conveys
- * the resource data.
+ * DESCRIPTION: Common code to handle optional resource_source_index and
+ * resource_source fields in some Large descriptors. Used during
+ * list-to-stream conversion
*
******************************************************************************/
-acpi_status
-acpi_rs_get_list_length(u8 * byte_stream_buffer,
- u32 byte_stream_buffer_length, acpi_size * size_needed)
+static acpi_size
+acpi_rs_struct_option_length(struct acpi_resource_source *resource_source)
{
- u32 buffer_size = 0;
- u32 bytes_parsed = 0;
- u8 number_of_interrupts = 0;
- u8 number_of_channels = 0;
- u8 resource_type;
- u32 structure_size;
- u32 bytes_consumed;
- u8 *buffer;
- u8 temp8;
- u16 temp16;
- u8 index;
- u8 additional_bytes;
-
- ACPI_FUNCTION_TRACE("rs_get_list_length");
-
- while (bytes_parsed < byte_stream_buffer_length) {
- /* The next byte in the stream is the resource type */
-
- resource_type = acpi_rs_get_resource_type(*byte_stream_buffer);
+ ACPI_FUNCTION_ENTRY();
- switch (resource_type) {
- case ACPI_RDESC_TYPE_MEMORY_24:
- /*
- * 24-Bit Memory Resource
- */
- bytes_consumed = 12;
-
- structure_size =
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem24);
- break;
+ /*
+ * If the resource_source string is valid, return the size of the string
+ * (string_length includes the NULL terminator) plus the size of the
+ * resource_source_index (1).
+ */
+ if (resource_source->string_ptr) {
+ return ((acpi_size) resource_source->string_length + 1);
+ }
- case ACPI_RDESC_TYPE_LARGE_VENDOR:
- /*
- * Vendor Defined Resource
- */
- buffer = byte_stream_buffer;
- ++buffer;
+ return (0);
+}
- ACPI_MOVE_16_TO_16(&temp16, buffer);
- bytes_consumed = temp16 + 3;
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_rs_stream_option_length
+ *
+ * PARAMETERS: resource_length - Length from the resource header
+ * minimum_total_length - Minimum length of this resource, before
+ * any optional fields. Includes header size
+ *
+ * RETURN: Length of optional string (0 if no string present)
+ *
+ * DESCRIPTION: Common code to handle optional resource_source_index and
+ * resource_source fields in some Large descriptors. Used during
+ * stream-to-list conversion
+ *
+ ******************************************************************************/
- /* Ensure a 32-bit boundary for the structure */
+static u32
+acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length)
+{
+ u32 string_length = 0;
+ u32 minimum_resource_length;
- temp16 = (u16) ACPI_ROUND_UP_to_32_bITS(temp16);
+ ACPI_FUNCTION_ENTRY();
- structure_size =
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor) +
- (temp16 * sizeof(u8));
- break;
+ /*
+ * The resource_source_index and resource_source are optional elements of some
+ * Large-type resource descriptors.
+ */
- case ACPI_RDESC_TYPE_MEMORY_32:
- /*
- * 32-Bit Memory Range Resource
- */
- bytes_consumed = 20;
+ /* Compute minimum size of the data part of the resource descriptor */
- structure_size =
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem32);
- break;
+ minimum_resource_length =
+ minimum_total_length - sizeof(struct asl_large_header);
- case ACPI_RDESC_TYPE_FIXED_MEMORY_32:
- /*
- * 32-Bit Fixed Memory Resource
- */
- bytes_consumed = 12;
+ /*
+ * If the length of the actual resource descriptor is greater than the ACPI
+ * spec-defined minimum length, it means that a resource_source_index exists
+ * and is followed by a (required) null terminated string. The string length
+ * (including the null terminator) is the resource length minus the minimum
+ * length, minus one byte for the resource_source_index itself.
+ */
+ if (resource_length > minimum_resource_length) {
+ /* Compute the length of the optional string */
- structure_size =
- ACPI_SIZEOF_RESOURCE(struct
- acpi_resource_fixed_mem32);
- break;
+ string_length = resource_length - minimum_resource_length - 1;
+ }
- case ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE:
- /*
- * 64-Bit Address Resource
- */
- buffer = byte_stream_buffer;
+ /* Round up length to 32 bits for internal structure alignment */
- ++buffer;
- ACPI_MOVE_16_TO_16(&temp16, buffer);
+ return (ACPI_ROUND_UP_to_32_bITS(string_length));
+}
- bytes_consumed = temp16 + 3;
- structure_size =
- ACPI_SIZEOF_RESOURCE(struct
- acpi_resource_address64);
- break;
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_rs_get_byte_stream_length
+ *
+ * PARAMETERS: Resource - Pointer to the resource linked list
+ * size_needed - Where the required size is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Takes a linked list of internal resource descriptors and
+ * calculates the size buffer needed to hold the corresponding
+ * external resource byte stream.
+ *
+ ******************************************************************************/
- case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE:
- /*
- * 64-Bit Address Resource
- */
- buffer = byte_stream_buffer;
+acpi_status
+acpi_rs_get_byte_stream_length(struct acpi_resource * resource,
+ acpi_size * size_needed)
+{
+ acpi_size byte_stream_size_needed = 0;
+ acpi_size segment_size;
- ++buffer;
- ACPI_MOVE_16_TO_16(&temp16, buffer);
+ ACPI_FUNCTION_TRACE("rs_get_byte_stream_length");
- bytes_consumed = temp16 + 3;
+ /* Traverse entire list of internal resource descriptors */
- /*
- * Resource Source Index and Resource Source are optional elements.
- * Check the length of the Bytestream. If it is greater than 43,
- * that means that an Index exists and is followed by a null
- * terminated string. Therefore, set the temp variable to the
- * length minus the minimum byte stream length plus the byte for
- * the Index to determine the size of the NULL terminated string.
- */
- if (43 < temp16) {
- temp8 = (u8) (temp16 - 44);
- } else {
- temp8 = 0;
- }
+ while (resource) {
+ /* Validate the descriptor type */
- /* Ensure a 64-bit boundary for the structure */
+ if (resource->type > ACPI_RSTYPE_MAX) {
+ return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
+ }
- temp8 = (u8) ACPI_ROUND_UP_to_64_bITS(temp8);
+ /* Get the base size of the (external stream) resource descriptor */
- structure_size =
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64)
- + (temp8 * sizeof(u8));
- break;
+ segment_size = acpi_gbl_stream_sizes[resource->type];
- case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE:
+ /*
+ * Augment the base size for descriptors with optional and/or
+ * variable-length fields
+ */
+ switch (resource->type) {
+ case ACPI_RSTYPE_VENDOR:
/*
- * 32-Bit Address Resource
+ * Vendor Defined Resource:
+ * For a Vendor Specific resource, if the Length is between 1 and 7
+ * it will be created as a Small Resource data type, otherwise it
+ * is a Large Resource data type.
*/
- buffer = byte_stream_buffer;
-
- ++buffer;
- ACPI_MOVE_16_TO_16(&temp16, buffer);
+ if (resource->data.vendor_specific.length > 7) {
+ /* Base size of a Large resource descriptor */
- bytes_consumed = temp16 + 3;
-
- /*
- * Resource Source Index and Resource Source are optional elements.
- * Check the length of the Bytestream. If it is greater than 23,
- * that means that an Index exists and is followed by a null
- * terminated string. Therefore, set the temp variable to the
- * length minus the minimum byte stream length plus the byte for
- * the Index to determine the size of the NULL terminated string.
- */
- if (23 < temp16) {
- temp8 = (u8) (temp16 - 24);
- } else {
- temp8 = 0;
+ segment_size = 3;
}
- /* Ensure a 32-bit boundary for the structure */
+ /* Add the size of the vendor-specific data */
- temp8 = (u8) ACPI_ROUND_UP_to_32_bITS(temp8);
-
- structure_size =
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32)
- + (temp8 * sizeof(u8));
+ segment_size += resource->data.vendor_specific.length;
break;
- case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE:
+ case ACPI_RSTYPE_END_TAG:
/*
- * 16-Bit Address Resource
+ * End Tag:
+ * We are done -- return the accumulated total size.
*/
- buffer = byte_stream_buffer;
+ *size_needed = byte_stream_size_needed + segment_size;
- ++buffer;
- ACPI_MOVE_16_TO_16(&temp16, buffer);
+ /* Normal exit */
- bytes_consumed = temp16 + 3;
+ return_ACPI_STATUS(AE_OK);
+ case ACPI_RSTYPE_ADDRESS16:
/*
- * Resource Source Index and Resource Source are optional elements.
- * Check the length of the Bytestream. If it is greater than 13,
- * that means that an Index exists and is followed by a null
- * terminated string. Therefore, set the temp variable to the
- * length minus the minimum byte stream length plus the byte for
- * the Index to determine the size of the NULL terminated string.
+ * 16-Bit Address Resource:
+ * Add the size of the optional resource_source info
*/
- if (13 < temp16) {
- temp8 = (u8) (temp16 - 14);
- } else {
- temp8 = 0;
- }
-
- /* Ensure a 32-bit boundary for the structure */
-
- temp8 = (u8) ACPI_ROUND_UP_to_32_bITS(temp8);
-
- structure_size =
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16)
- + (temp8 * sizeof(u8));
+ segment_size +=
+ acpi_rs_struct_option_length(&resource->data.
+ address16.
+ resource_source);
break;
- case ACPI_RDESC_TYPE_EXTENDED_XRUPT:
- /*
- * Extended IRQ
- */
- buffer = byte_stream_buffer;
-
- ++buffer;
- ACPI_MOVE_16_TO_16(&temp16, buffer);
-
- bytes_consumed = temp16 + 3;
-
+ case ACPI_RSTYPE_ADDRESS32:
/*
- * Point past the length field and the Interrupt vector flags to
- * save off the Interrupt table length to the Temp8 variable.
+ * 32-Bit Address Resource:
+ * Add the size of the optional resource_source info
*/
- buffer += 3;
- temp8 = *buffer;
+ segment_size +=
+ acpi_rs_struct_option_length(&resource->data.
+ address32.
+ resource_source);
+ break;
+ case ACPI_RSTYPE_ADDRESS64:
/*
- * To compensate for multiple interrupt numbers, add 4 bytes for
- * each additional interrupts greater than 1
+ * 64-Bit Address Resource:
+ * Add the size of the optional resource_source info
*/
- additional_bytes = (u8) ((temp8 - 1) * 4);
+ segment_size +=
+ acpi_rs_struct_option_length(&resource->data.
+ address64.
+ resource_source);
+ break;
+ case ACPI_RSTYPE_EXT_IRQ:
/*
- * Resource Source Index and Resource Source are optional elements.
- * Check the length of the Bytestream. If it is greater than 9,
- * that means that an Index exists and is followed by a null
- * terminated string. Therefore, set the temp variable to the
- * length minus the minimum byte stream length plus the byte for
- * the Index to determine the size of the NULL terminated string.
+ * Extended IRQ Resource:
+ * Add the size of each additional optional interrupt beyond the
+ * required 1 (4 bytes for each u32 interrupt number)
*/
- if (9 + additional_bytes < temp16) {
- temp8 = (u8) (temp16 - (9 + additional_bytes));
- } else {
- temp8 = 0;
- }
+ segment_size += (((acpi_size)
+ resource->data.extended_irq.
+ number_of_interrupts - 1) * 4);
- /* Ensure a 32-bit boundary for the structure */
+ /* Add the size of the optional resource_source info */
- temp8 = (u8) ACPI_ROUND_UP_to_32_bITS(temp8);
+ segment_size +=
+ acpi_rs_struct_option_length(&resource->data.
+ extended_irq.
+ resource_source);
+ break;
- structure_size =
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_ext_irq) +
- (additional_bytes * sizeof(u8)) +
- (temp8 * sizeof(u8));
+ default:
break;
+ }
- case ACPI_RDESC_TYPE_IRQ_FORMAT:
- /*
- * IRQ Resource.
- * Determine if it there are two or three trailing bytes
- */
- buffer = byte_stream_buffer;
- temp8 = *buffer;
+ /* Update the total */
- if (temp8 & 0x01) {
- bytes_consumed = 4;
- } else {
- bytes_consumed = 3;
- }
+ byte_stream_size_needed += segment_size;
- /* Point past the descriptor */
+ /* Point to the next object */
- ++buffer;
+ resource = ACPI_PTR_ADD(struct acpi_resource,
+ resource, resource->length);
+ }
- /* Look at the number of bits set */
+ /* Did not find an END_TAG descriptor */
- ACPI_MOVE_16_TO_16(&temp16, buffer);
+ return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
+}
- for (index = 0; index < 16; index++) {
- if (temp16 & 0x1) {
- ++number_of_interrupts;
- }
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_rs_get_list_length
+ *
+ * PARAMETERS: byte_stream_buffer - Pointer to the resource byte stream
+ * byte_stream_buffer_length - Size of byte_stream_buffer
+ * size_needed - Where the size needed is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Takes an external resource byte stream and calculates the size
+ * buffer needed to hold the corresponding internal resource
+ * descriptor linked list.
+ *
+ ******************************************************************************/
- temp16 >>= 1;
- }
+acpi_status
+acpi_rs_get_list_length(u8 * byte_stream_buffer,
+ u32 byte_stream_buffer_length, acpi_size * size_needed)
+{
+ u8 *buffer;
+ ACPI_RESOURCE_SIZES *resource_info;
+ u32 buffer_size = 0;
+ u32 bytes_parsed = 0;
+ u8 resource_type;
+ u16 temp16;
+ u16 resource_length;
+ u16 header_length;
+ u32 extra_struct_bytes;
- structure_size =
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_io) +
- (number_of_interrupts * sizeof(u32));
- break;
+ ACPI_FUNCTION_TRACE("rs_get_list_length");
- case ACPI_RDESC_TYPE_DMA_FORMAT:
- /*
- * DMA Resource
- */
- buffer = byte_stream_buffer;
- bytes_consumed = 3;
+ while (bytes_parsed < byte_stream_buffer_length) {
+ /* The next byte in the stream is the resource descriptor type */
- /* Point past the descriptor */
+ resource_type = acpi_rs_get_resource_type(*byte_stream_buffer);
- ++buffer;
+ /* Get the base stream size and structure sizes for the descriptor */
- /* Look at the number of bits set */
+ resource_info = acpi_rs_get_resource_sizes(resource_type);
+ if (!resource_info) {
+ return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
+ }
- temp8 = *buffer;
+ /* Get the Length field from the input resource descriptor */
- for (index = 0; index < 8; index++) {
- if (temp8 & 0x1) {
- ++number_of_channels;
- }
+ resource_length =
+ acpi_rs_get_resource_length(byte_stream_buffer);
- temp8 >>= 1;
- }
+ /* Augment the size for descriptors with optional fields */
- structure_size =
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma) +
- (number_of_channels * sizeof(u32));
- break;
+ extra_struct_bytes = 0;
- case ACPI_RDESC_TYPE_START_DEPENDENT:
+ if (!(resource_type & ACPI_RDESC_TYPE_LARGE)) {
/*
- * Start Dependent Functions Resource
- * Determine if it there are two or three trailing bytes
+ * Small resource descriptors
*/
- buffer = byte_stream_buffer;
- temp8 = *buffer;
+ header_length = 1;
+ buffer = byte_stream_buffer + header_length;
- if (temp8 & 0x01) {
- bytes_consumed = 2;
- } else {
- bytes_consumed = 1;
- }
+ switch (resource_type) {
+ case ACPI_RDESC_TYPE_IRQ_FORMAT:
+ /*
+ * IRQ Resource:
+ * Get the number of bits set in the IRQ word
+ */
+ ACPI_MOVE_16_TO_16(&temp16, buffer);
- structure_size =
- ACPI_SIZEOF_RESOURCE(struct
- acpi_resource_start_dpf);
- break;
+ extra_struct_bytes =
+ (acpi_rs_count_set_bits(temp16) *
+ sizeof(u32));
+ break;
- case ACPI_RDESC_TYPE_END_DEPENDENT:
- /*
- * End Dependent Functions Resource
- */
- bytes_consumed = 1;
- structure_size = ACPI_RESOURCE_LENGTH;
- break;
+ case ACPI_RDESC_TYPE_DMA_FORMAT:
+ /*
+ * DMA Resource:
+ * Get the number of bits set in the DMA channels byte
+ */
+ extra_struct_bytes =
+ (acpi_rs_count_set_bits((u16) * buffer) *
+ sizeof(u32));
+ break;
- case ACPI_RDESC_TYPE_IO_PORT:
- /*
- * IO Port Resource
- */
- bytes_consumed = 8;
- structure_size =
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_io);
- break;
+ case ACPI_RDESC_TYPE_SMALL_VENDOR:
+ /*
+ * Vendor Specific Resource:
+ * Ensure a 32-bit boundary for the structure
+ */
+ extra_struct_bytes =
+ ACPI_ROUND_UP_to_32_bITS(resource_length);
+ break;
- case ACPI_RDESC_TYPE_FIXED_IO_PORT:
- /*
- * Fixed IO Port Resource
- */
- bytes_consumed = 4;
- structure_size =
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io);
- break;
+ case ACPI_RDESC_TYPE_END_TAG:
+ /*
+ * End Tag:
+ * Terminate the loop now
+ */
+ byte_stream_buffer_length = bytes_parsed;
+ break;
- case ACPI_RDESC_TYPE_SMALL_VENDOR:
+ default:
+ break;
+ }
+ } else {
/*
- * Vendor Specific Resource
+ * Large resource descriptors
*/
- buffer = byte_stream_buffer;
+ header_length = sizeof(struct asl_large_header);
+ buffer = byte_stream_buffer + header_length;
- temp8 = *buffer;
- temp8 = (u8) (temp8 & 0x7);
- bytes_consumed = temp8 + 1;
+ switch (resource_type) {
+ case ACPI_RDESC_TYPE_LARGE_VENDOR:
+ /*
+ * Vendor Defined Resource:
+ * Add vendor data and ensure a 32-bit boundary for the structure
+ */
+ extra_struct_bytes =
+ ACPI_ROUND_UP_to_32_bITS(resource_length);
+ break;
- /* Ensure a 32-bit boundary for the structure */
+ case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE:
+ case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE:
+ /*
+ * 32-Bit or 16-bit Address Resource:
+ * Add the size of any optional data (resource_source)
+ */
+ extra_struct_bytes =
+ acpi_rs_stream_option_length
+ (resource_length,
+ resource_info->minimum_stream_size);
+ break;
- temp8 = (u8) ACPI_ROUND_UP_to_32_bITS(temp8);
- structure_size =
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor) +
- (temp8 * sizeof(u8));
- break;
+ case ACPI_RDESC_TYPE_EXTENDED_XRUPT:
+ /*
+ * Extended IRQ:
+ * Point past the interrupt_vector_flags to get the
+ * interrupt_table_length.
+ */
+ buffer++;
- case ACPI_RDESC_TYPE_END_TAG:
- /*
- * End Tag
- */
- bytes_consumed = 2;
- structure_size = ACPI_RESOURCE_LENGTH;
- byte_stream_buffer_length = bytes_parsed;
- break;
+ /*
+ * Add 4 bytes for each additional interrupt. Note: at least one
+ * interrupt is required and is included in the minimum
+ * descriptor size
+ */
+ extra_struct_bytes =
+ ((*buffer - 1) * sizeof(u32));
- default:
- /*
- * If we get here, everything is out of sync,
- * exit with an error
- */
- return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
- }
+ /* Add the size of any optional data (resource_source) */
- /* Update the return value and counter */
+ extra_struct_bytes +=
+ acpi_rs_stream_option_length(resource_length
+ -
+ extra_struct_bytes,
+ resource_info->
+ minimum_stream_size);
+ break;
- buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE(structure_size);
- bytes_parsed += bytes_consumed;
+ case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE:
+ /*
+ * 64-Bit Address Resource:
+ * Add the size of any optional data (resource_source)
+ * Ensure a 64-bit boundary for the structure
+ */
+ extra_struct_bytes =
+ ACPI_ROUND_UP_to_64_bITS
+ (acpi_rs_stream_option_length
+ (resource_length,
+ resource_info->minimum_stream_size));
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ /* Update the required buffer size for the internal descriptor structs */
- /* Set the byte stream to point to the next resource */
+ temp16 =
+ (u16) (resource_info->minimum_struct_size +
+ extra_struct_bytes);
+ buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE(temp16);
- byte_stream_buffer += bytes_consumed;
+ /*
+ * Update byte count and point to the next resource within the stream
+ * using the size of the header plus the length contained in the header
+ */
+ temp16 = (u16) (header_length + resource_length);
+ bytes_parsed += temp16;
+ byte_stream_buffer += temp16;
}
/* This is the data the caller needs */
diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c
index 75bd34d1783..9d93ee5f006 100644
--- a/drivers/acpi/resources/rsdump.c
+++ b/drivers/acpi/resources/rsdump.c
@@ -49,1021 +49,967 @@ ACPI_MODULE_NAME("rsdump")
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
/* Local prototypes */
-static void acpi_rs_dump_irq(union acpi_resource_data *data);
+static void acpi_rs_dump_irq(union acpi_resource_data *resource);
-static void acpi_rs_dump_address16(union acpi_resource_data *data);
+static void acpi_rs_dump_address16(union acpi_resource_data *resource);
-static void acpi_rs_dump_address32(union acpi_resource_data *data);
+static void acpi_rs_dump_address32(union acpi_resource_data *resource);
-static void acpi_rs_dump_address64(union acpi_resource_data *data);
+static void acpi_rs_dump_address64(union acpi_resource_data *resource);
-static void acpi_rs_dump_dma(union acpi_resource_data *data);
+static void acpi_rs_dump_dma(union acpi_resource_data *resource);
-static void acpi_rs_dump_io(union acpi_resource_data *data);
+static void acpi_rs_dump_io(union acpi_resource_data *resource);
-static void acpi_rs_dump_extended_irq(union acpi_resource_data *data);
+static void acpi_rs_dump_extended_irq(union acpi_resource_data *resource);
-static void acpi_rs_dump_fixed_io(union acpi_resource_data *data);
+static void acpi_rs_dump_fixed_io(union acpi_resource_data *resource);
-static void acpi_rs_dump_fixed_memory32(union acpi_resource_data *data);
+static void acpi_rs_dump_fixed_memory32(union acpi_resource_data *resource);
-static void acpi_rs_dump_memory24(union acpi_resource_data *data);
+static void acpi_rs_dump_memory24(union acpi_resource_data *resource);
-static void acpi_rs_dump_memory32(union acpi_resource_data *data);
+static void acpi_rs_dump_memory32(union acpi_resource_data *resource);
-static void acpi_rs_dump_start_depend_fns(union acpi_resource_data *data);
+static void acpi_rs_dump_start_depend_fns(union acpi_resource_data *resource);
-static void acpi_rs_dump_vendor_specific(union acpi_resource_data *data);
+static void acpi_rs_dump_vendor_specific(union acpi_resource_data *resource);
+
+static void acpi_rs_dump_generic_reg(union acpi_resource_data *resource);
+
+static void acpi_rs_dump_end_depend_fns(union acpi_resource_data *resource);
+
+static void acpi_rs_dump_end_tag(union acpi_resource_data *resource);
+
+static void acpi_rs_out_string(char *title, char *value);
+
+static void acpi_rs_out_integer8(char *title, u8 value);
+
+static void acpi_rs_out_integer16(char *title, u16 value);
+
+static void acpi_rs_out_integer32(char *title, u32 value);
+
+static void acpi_rs_out_integer64(char *title, u64 value);
+
+static void acpi_rs_out_title(char *title);
+
+static void acpi_rs_dump_byte_list(u32 length, u8 * data);
+
+static void acpi_rs_dump_dword_list(u32 length, u32 * data);
+
+static void acpi_rs_dump_short_byte_list(u32 length, u32 * data);
+
+static void
+acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source);
+
+static void acpi_rs_dump_address_common(union acpi_resource_data *resource);
+
+/* Dispatch table for resource dump functions */
+
+typedef
+void (*ACPI_DUMP_RESOURCE) (union acpi_resource_data * data);
+
+static ACPI_DUMP_RESOURCE acpi_gbl_dump_resource_dispatch[] = {
+ acpi_rs_dump_irq, /* ACPI_RSTYPE_IRQ */
+ acpi_rs_dump_dma, /* ACPI_RSTYPE_DMA */
+ acpi_rs_dump_start_depend_fns, /* ACPI_RSTYPE_START_DPF */
+ acpi_rs_dump_end_depend_fns, /* ACPI_RSTYPE_END_DPF */
+ acpi_rs_dump_io, /* ACPI_RSTYPE_IO */
+ acpi_rs_dump_fixed_io, /* ACPI_RSTYPE_FIXED_IO */
+ acpi_rs_dump_vendor_specific, /* ACPI_RSTYPE_VENDOR */
+ acpi_rs_dump_end_tag, /* ACPI_RSTYPE_END_TAG */
+ acpi_rs_dump_memory24, /* ACPI_RSTYPE_MEM24 */
+ acpi_rs_dump_memory32, /* ACPI_RSTYPE_MEM32 */
+ acpi_rs_dump_fixed_memory32, /* ACPI_RSTYPE_FIXED_MEM32 */
+ acpi_rs_dump_address16, /* ACPI_RSTYPE_ADDRESS16 */
+ acpi_rs_dump_address32, /* ACPI_RSTYPE_ADDRESS32 */
+ acpi_rs_dump_address64, /* ACPI_RSTYPE_ADDRESS64 */
+ acpi_rs_dump_extended_irq, /* ACPI_RSTYPE_EXT_IRQ */
+ acpi_rs_dump_generic_reg /* ACPI_RSTYPE_GENERIC_REG */
+};
/*******************************************************************************
*
- * FUNCTION: acpi_rs_dump_irq
+ * FUNCTION: acpi_rs_out*
+ *
+ * PARAMETERS: Title - Name of the resource field
+ * Value - Value of the resource field
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Miscellaneous helper functions to consistently format the
+ * output of the resource dump routines
+ *
+ ******************************************************************************/
+
+static void acpi_rs_out_string(char *title, char *value)
+{
+ acpi_os_printf("%30s : %s\n", title, value);
+}
+
+static void acpi_rs_out_integer8(char *title, u8 value)
+{
+ acpi_os_printf("%30s : %2.2X\n", title, value);
+}
+
+static void acpi_rs_out_integer16(char *title, u16 value)
+{
+ acpi_os_printf("%30s : %4.4X\n", title, value);
+}
+
+static void acpi_rs_out_integer32(char *title, u32 value)
+{
+ acpi_os_printf("%30s : %8.8X\n", title, value);
+}
+
+static void acpi_rs_out_integer64(char *title, u64 value)
+{
+ acpi_os_printf("%30s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value));
+}
+
+static void acpi_rs_out_title(char *title)
+{
+ acpi_os_printf("%30s : ", title);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_rs_dump*List
+ *
+ * PARAMETERS: Length - Number of elements in the list
+ * Data - Start of the list
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Miscellaneous functions to dump lists of raw data
+ *
+ ******************************************************************************/
+
+static void acpi_rs_dump_byte_list(u32 length, u8 * data)
+{
+ u32 i;
+
+ for (i = 0; i < length; i++) {
+ acpi_os_printf("%28s%2.2X : %2.2X\n", "Byte", i, data[i]);
+ }
+}
+
+static void acpi_rs_dump_dword_list(u32 length, u32 * data)
+{
+ u32 i;
+
+ for (i = 0; i < length; i++) {
+ acpi_os_printf("%28s%2.2X : %8.8X\n", "Dword", i, data[i]);
+ }
+}
+
+static void acpi_rs_dump_short_byte_list(u32 length, u32 * data)
+{
+ u32 i;
+
+ for (i = 0; i < length; i++) {
+ acpi_os_printf("%X ", data[i]);
+ }
+ acpi_os_printf("\n");
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_rs_dump_resource_source
*
- * PARAMETERS: Data - pointer to the resource structure to dump.
+ * PARAMETERS: resource_source - Pointer to a Resource Source struct
*
* RETURN: None
*
- * DESCRIPTION: Prints out the various members of the Data structure type.
+ * DESCRIPTION: Common routine for dumping the optional resource_source and the
+ * corresponding resource_source_index.
*
******************************************************************************/
-static void acpi_rs_dump_irq(union acpi_resource_data *data)
+static void
+acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source)
{
- struct acpi_resource_irq *irq_data = (struct acpi_resource_irq *)data;
- u8 index = 0;
+ if (resource_source->index == 0xFF) {
+ return;
+ }
+
+ acpi_rs_out_integer8("Resource Source Index",
+ (u8) resource_source->index);
+
+ acpi_rs_out_string("Resource Source",
+ resource_source->string_ptr ?
+ resource_source->string_ptr : "[Not Specified]");
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_rs_dump_address_common
+ *
+ * PARAMETERS: Resource - Pointer to an internal resource descriptor
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Dump the fields that are common to all Address resource
+ * descriptors
+ *
+ ******************************************************************************/
+
+static void acpi_rs_dump_address_common(union acpi_resource_data *resource)
+{
ACPI_FUNCTION_ENTRY();
- acpi_os_printf("IRQ Resource\n");
+ /* Decode the type-specific flags */
+
+ switch (resource->address.resource_type) {
+ case ACPI_MEMORY_RANGE:
- acpi_os_printf(" %s Triggered\n",
- ACPI_LEVEL_SENSITIVE ==
- irq_data->edge_level ? "Level" : "Edge");
+ acpi_rs_out_string("Resource Type", "Memory Range");
+
+ acpi_rs_out_title("Type-Specific Flags");
+
+ switch (resource->address.attribute.memory.cache_attribute) {
+ case ACPI_NON_CACHEABLE_MEMORY:
+ acpi_os_printf("Noncacheable memory\n");
+ break;
- acpi_os_printf(" Active %s\n",
- ACPI_ACTIVE_LOW ==
- irq_data->active_high_low ? "Low" : "High");
+ case ACPI_CACHABLE_MEMORY:
+ acpi_os_printf("Cacheable memory\n");
+ break;
- acpi_os_printf(" %s\n",
- ACPI_SHARED ==
- irq_data->shared_exclusive ? "Shared" : "Exclusive");
+ case ACPI_WRITE_COMBINING_MEMORY:
+ acpi_os_printf("Write-combining memory\n");
+ break;
- acpi_os_printf(" %X Interrupts ( ", irq_data->number_of_interrupts);
+ case ACPI_PREFETCHABLE_MEMORY:
+ acpi_os_printf("Prefetchable memory\n");
+ break;
+
+ default:
+ acpi_os_printf("Invalid cache attribute\n");
+ break;
+ }
+
+ acpi_rs_out_string("Read/Write Attribute",
+ ACPI_READ_WRITE_MEMORY ==
+ resource->address.attribute.memory.
+ read_write_attribute ? "Read/Write" :
+ "Read Only");
+ break;
+
+ case ACPI_IO_RANGE:
+
+ acpi_rs_out_string("Resource Type", "I/O Range");
+
+ acpi_rs_out_title("Type-Specific Flags");
+
+ switch (resource->address.attribute.io.range_attribute) {
+ case ACPI_NON_ISA_ONLY_RANGES:
+ acpi_os_printf("Non-ISA I/O Addresses\n");
+ break;
- for (index = 0; index < irq_data->number_of_interrupts; index++) {
- acpi_os_printf("%X ", irq_data->interrupts[index]);
+ case ACPI_ISA_ONLY_RANGES:
+ acpi_os_printf("ISA I/O Addresses\n");
+ break;
+
+ case ACPI_ENTIRE_RANGE:
+ acpi_os_printf("ISA and non-ISA I/O Addresses\n");
+ break;
+
+ default:
+ acpi_os_printf("Invalid range attribute\n");
+ break;
+ }
+
+ acpi_rs_out_string("Translation Attribute",
+ ACPI_SPARSE_TRANSLATION ==
+ resource->address.attribute.io.
+ translation_attribute ? "Sparse Translation"
+ : "Dense Translation");
+ break;
+
+ case ACPI_BUS_NUMBER_RANGE:
+
+ acpi_rs_out_string("Resource Type", "Bus Number Range");
+ break;
+
+ default:
+
+ acpi_rs_out_integer8("Resource Type",
+ (u8) resource->address.resource_type);
+ break;
}
- acpi_os_printf(")\n");
- return;
+ /* Decode the general flags */
+
+ acpi_rs_out_string("Resource",
+ ACPI_CONSUMER ==
+ resource->address.
+ producer_consumer ? "Consumer" : "Producer");
+
+ acpi_rs_out_string("Decode",
+ ACPI_SUB_DECODE == resource->address.decode ?
+ "Subtractive" : "Positive");
+
+ acpi_rs_out_string("Min Address",
+ ACPI_ADDRESS_FIXED ==
+ resource->address.
+ min_address_fixed ? "Fixed" : "Not Fixed");
+
+ acpi_rs_out_string("Max Address",
+ ACPI_ADDRESS_FIXED ==
+ resource->address.
+ max_address_fixed ? "Fixed" : "Not Fixed");
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_dump_dma
+ * FUNCTION: acpi_rs_dump_resource_list
*
- * PARAMETERS: Data - pointer to the resource structure to dump.
+ * PARAMETERS: resource_list - Pointer to a resource descriptor list
*
* RETURN: None
*
- * DESCRIPTION: Prints out the various members of the Data structure type.
+ * DESCRIPTION: Dispatches the structure to the correct dump routine.
*
******************************************************************************/
-static void acpi_rs_dump_dma(union acpi_resource_data *data)
+void acpi_rs_dump_resource_list(struct acpi_resource *resource_list)
{
- struct acpi_resource_dma *dma_data = (struct acpi_resource_dma *)data;
- u8 index = 0;
+ u32 count = 0;
ACPI_FUNCTION_ENTRY();
+ if (!(acpi_dbg_level & ACPI_LV_RESOURCES)
+ || !(_COMPONENT & acpi_dbg_layer)) {
+ return;
+ }
+
+ /* Dump all resource descriptors in the list */
+
+ while (resource_list) {
+ acpi_os_printf("\n[%02X] ", count);
+
+ /* Validate Type before dispatch */
+
+ if (resource_list->type > ACPI_RSTYPE_MAX) {
+ acpi_os_printf
+ ("Invalid descriptor type (%X) in resource list\n",
+ resource_list->type);
+ return;
+ }
+
+ /* Dump the resource descriptor */
+
+ acpi_gbl_dump_resource_dispatch[resource_list->
+ type] (&resource_list->data);
+
+ /* Exit on end tag */
+
+ if (resource_list->type == ACPI_RSTYPE_END_TAG) {
+ return;
+ }
+
+ /* Get the next resource structure */
+
+ resource_list =
+ ACPI_PTR_ADD(struct acpi_resource, resource_list,
+ resource_list->length);
+ count++;
+ }
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_rs_dump_irq
+ *
+ * PARAMETERS: Resource - Pointer to an internal resource descriptor
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Dump the field names and values of the resource descriptor
+ *
+ ******************************************************************************/
+
+static void acpi_rs_dump_irq(union acpi_resource_data *resource)
+{
+ ACPI_FUNCTION_ENTRY();
+
+ acpi_os_printf("IRQ Resource\n");
+
+ acpi_rs_out_string("Triggering",
+ ACPI_LEVEL_SENSITIVE ==
+ resource->irq.edge_level ? "Level" : "Edge");
+
+ acpi_rs_out_string("Active",
+ ACPI_ACTIVE_LOW ==
+ resource->irq.active_high_low ? "Low" : "High");
+
+ acpi_rs_out_string("Sharing",
+ ACPI_SHARED ==
+ resource->irq.
+ shared_exclusive ? "Shared" : "Exclusive");
+
+ acpi_rs_out_integer8("Interrupt Count",
+ (u8) resource->irq.number_of_interrupts);
+
+ acpi_rs_out_title("Interrupt List");
+ acpi_rs_dump_short_byte_list(resource->irq.number_of_interrupts,
+ resource->irq.interrupts);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_rs_dump_dma
+ *
+ * PARAMETERS: Resource - Pointer to an internal resource descriptor
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Dump the field names and values of the resource descriptor
+ *
+ ******************************************************************************/
+
+static void acpi_rs_dump_dma(union acpi_resource_data *resource)
+{
+ ACPI_FUNCTION_ENTRY();
+
acpi_os_printf("DMA Resource\n");
- switch (dma_data->type) {
+ acpi_rs_out_title("DMA Type");
+ switch (resource->dma.type) {
case ACPI_COMPATIBILITY:
- acpi_os_printf(" Compatibility mode\n");
+ acpi_os_printf("Compatibility mode\n");
break;
case ACPI_TYPE_A:
- acpi_os_printf(" Type A\n");
+ acpi_os_printf("Type A\n");
break;
case ACPI_TYPE_B:
- acpi_os_printf(" Type B\n");
+ acpi_os_printf("Type B\n");
break;
case ACPI_TYPE_F:
- acpi_os_printf(" Type F\n");
+ acpi_os_printf("Type F\n");
break;
default:
- acpi_os_printf(" Invalid DMA type\n");
+ acpi_os_printf("**** Invalid DMA type\n");
break;
}
- acpi_os_printf(" %sBus Master\n",
- ACPI_BUS_MASTER == dma_data->bus_master ? "" : "Not a ");
+ acpi_rs_out_string("Bus Master",
+ ACPI_BUS_MASTER ==
+ resource->dma.bus_master ? "Yes" : "No");
- switch (dma_data->transfer) {
+ acpi_rs_out_title("Transfer Type");
+ switch (resource->dma.transfer) {
case ACPI_TRANSFER_8:
- acpi_os_printf(" 8-bit only transfer\n");
+ acpi_os_printf("8-bit transfers only\n");
break;
case ACPI_TRANSFER_8_16:
- acpi_os_printf(" 8 and 16-bit transfer\n");
+ acpi_os_printf("8-bit and 16-bit transfers\n");
break;
case ACPI_TRANSFER_16:
- acpi_os_printf(" 16 bit only transfer\n");
+ acpi_os_printf("16-bit transfers only\n");
break;
default:
- acpi_os_printf(" Invalid transfer preference\n");
+ acpi_os_printf("**** Invalid transfer preference\n");
break;
}
- acpi_os_printf(" Number of Channels: %X ( ",
- dma_data->number_of_channels);
-
- for (index = 0; index < dma_data->number_of_channels; index++) {
- acpi_os_printf("%X ", dma_data->channels[index]);
- }
+ acpi_rs_out_integer8("DMA Channel Count",
+ (u8) resource->dma.number_of_channels);
- acpi_os_printf(")\n");
- return;
+ acpi_rs_out_title("Channel List");
+ acpi_rs_dump_short_byte_list(resource->dma.number_of_channels,
+ resource->dma.channels);
}
/*******************************************************************************
*
* FUNCTION: acpi_rs_dump_start_depend_fns
*
- * PARAMETERS: Data - pointer to the resource structure to dump.
+ * PARAMETERS: Resource - Pointer to an internal resource descriptor
*
* RETURN: None
*
- * DESCRIPTION: Prints out the various members of the Data structure type.
+ * DESCRIPTION: Dump the field names and values of the resource descriptor
*
******************************************************************************/
-static void acpi_rs_dump_start_depend_fns(union acpi_resource_data *data)
+static void acpi_rs_dump_start_depend_fns(union acpi_resource_data *resource)
{
- struct acpi_resource_start_dpf *sdf_data =
- (struct acpi_resource_start_dpf *)data;
-
ACPI_FUNCTION_ENTRY();
acpi_os_printf("Start Dependent Functions Resource\n");
- switch (sdf_data->compatibility_priority) {
+ acpi_rs_out_title("Compatibility Priority");
+ switch (resource->start_dpf.compatibility_priority) {
case ACPI_GOOD_CONFIGURATION:
- acpi_os_printf(" Good configuration\n");
+ acpi_os_printf("Good configuration\n");
break;
case ACPI_ACCEPTABLE_CONFIGURATION:
- acpi_os_printf(" Acceptable configuration\n");
+ acpi_os_printf("Acceptable configuration\n");
break;
case ACPI_SUB_OPTIMAL_CONFIGURATION:
- acpi_os_printf(" Sub-optimal configuration\n");
+ acpi_os_printf("Sub-optimal configuration\n");
break;
default:
- acpi_os_printf(" Invalid compatibility priority\n");
+ acpi_os_printf("**** Invalid compatibility priority\n");
break;
}
- switch (sdf_data->performance_robustness) {
+ acpi_rs_out_title("Performance/Robustness");
+ switch (resource->start_dpf.performance_robustness) {
case ACPI_GOOD_CONFIGURATION:
- acpi_os_printf(" Good configuration\n");
+ acpi_os_printf("Good configuration\n");
break;
case ACPI_ACCEPTABLE_CONFIGURATION:
- acpi_os_printf(" Acceptable configuration\n");
+ acpi_os_printf("Acceptable configuration\n");
break;
case ACPI_SUB_OPTIMAL_CONFIGURATION:
- acpi_os_printf(" Sub-optimal configuration\n");
+ acpi_os_printf("Sub-optimal configuration\n");
break;
default:
- acpi_os_printf(" Invalid performance robustness preference\n");
+ acpi_os_printf
+ ("**** Invalid performance robustness preference\n");
break;
}
-
- return;
}
/*******************************************************************************
*
* FUNCTION: acpi_rs_dump_io
*
- * PARAMETERS: Data - pointer to the resource structure to dump.
+ * PARAMETERS: Resource - Pointer to an internal resource descriptor
*
* RETURN: None
*
- * DESCRIPTION: Prints out the various members of the Data structure type.
+ * DESCRIPTION: Dump the field names and values of the resource descriptor
*
******************************************************************************/
-static void acpi_rs_dump_io(union acpi_resource_data *data)
+static void acpi_rs_dump_io(union acpi_resource_data *resource)
{
- struct acpi_resource_io *io_data = (struct acpi_resource_io *)data;
-
ACPI_FUNCTION_ENTRY();
- acpi_os_printf("Io Resource\n");
+ acpi_os_printf("I/O Resource\n");
- acpi_os_printf(" %d bit decode\n",
- ACPI_DECODE_16 == io_data->io_decode ? 16 : 10);
+ acpi_rs_out_string("Decode",
+ ACPI_DECODE_16 ==
+ resource->io.io_decode ? "16-bit" : "10-bit");
- acpi_os_printf(" Range minimum base: %08X\n",
- io_data->min_base_address);
+ acpi_rs_out_integer32("Range Minimum Base",
+ resource->io.min_base_address);
- acpi_os_printf(" Range maximum base: %08X\n",
- io_data->max_base_address);
+ acpi_rs_out_integer32("Range Maximum Base",
+ resource->io.max_base_address);
- acpi_os_printf(" Alignment: %08X\n", io_data->alignment);
+ acpi_rs_out_integer32("Alignment", resource->io.alignment);
- acpi_os_printf(" Range Length: %08X\n", io_data->range_length);
-
- return;
+ acpi_rs_out_integer32("Range Length", resource->io.range_length);
}
/*******************************************************************************
*
* FUNCTION: acpi_rs_dump_fixed_io
*
- * PARAMETERS: Data - pointer to the resource structure to dump.
+ * PARAMETERS: Resource - Pointer to an internal resource descriptor
*
* RETURN: None
*
- * DESCRIPTION: Prints out the various members of the Data structure type.
+ * DESCRIPTION: Dump the field names and values of the resource descriptor
*
******************************************************************************/
-static void acpi_rs_dump_fixed_io(union acpi_resource_data *data)
+static void acpi_rs_dump_fixed_io(union acpi_resource_data *resource)
{
- struct acpi_resource_fixed_io *fixed_io_data =
- (struct acpi_resource_fixed_io *)data;
-
ACPI_FUNCTION_ENTRY();
- acpi_os_printf("Fixed Io Resource\n");
- acpi_os_printf(" Range base address: %08X",
- fixed_io_data->base_address);
+ acpi_os_printf("Fixed I/O Resource\n");
- acpi_os_printf(" Range length: %08X", fixed_io_data->range_length);
+ acpi_rs_out_integer32("Range Base Address",
+ resource->fixed_io.base_address);
- return;
+ acpi_rs_out_integer32("Range Length", resource->fixed_io.range_length);
}
/*******************************************************************************
*
* FUNCTION: acpi_rs_dump_vendor_specific
*
- * PARAMETERS: Data - pointer to the resource structure to dump.
+ * PARAMETERS: Resource - Pointer to an internal resource descriptor
*
* RETURN: None
*
- * DESCRIPTION: Prints out the various members of the Data structure type.
+ * DESCRIPTION: Dump the field names and values of the resource descriptor
*
******************************************************************************/
-static void acpi_rs_dump_vendor_specific(union acpi_resource_data *data)
+static void acpi_rs_dump_vendor_specific(union acpi_resource_data *resource)
{
- struct acpi_resource_vendor *vendor_data =
- (struct acpi_resource_vendor *)data;
- u16 index = 0;
-
ACPI_FUNCTION_ENTRY();
acpi_os_printf("Vendor Specific Resource\n");
- acpi_os_printf(" Length: %08X\n", vendor_data->length);
+ acpi_rs_out_integer16("Length", (u16) resource->vendor_specific.length);
- for (index = 0; index < vendor_data->length; index++) {
- acpi_os_printf(" Byte %X: %08X\n",
- index, vendor_data->reserved[index]);
- }
-
- return;
+ acpi_rs_dump_byte_list(resource->vendor_specific.length,
+ resource->vendor_specific.reserved);
}
/*******************************************************************************
*
* FUNCTION: acpi_rs_dump_memory24
*
- * PARAMETERS: Data - pointer to the resource structure to dump.
+ * PARAMETERS: Resource - Pointer to an internal resource descriptor
*
* RETURN: None
*
- * DESCRIPTION: Prints out the various members of the Data structure type.
+ * DESCRIPTION: Dump the field names and values of the resource descriptor
*
******************************************************************************/
-static void acpi_rs_dump_memory24(union acpi_resource_data *data)
+static void acpi_rs_dump_memory24(union acpi_resource_data *resource)
{
- struct acpi_resource_mem24 *memory24_data =
- (struct acpi_resource_mem24 *)data;
-
ACPI_FUNCTION_ENTRY();
acpi_os_printf("24-Bit Memory Range Resource\n");
- acpi_os_printf(" Read%s\n",
- ACPI_READ_WRITE_MEMORY ==
- memory24_data->read_write_attribute ?
- "/Write" : " only");
-
- acpi_os_printf(" Range minimum base: %08X\n",
- memory24_data->min_base_address);
+ acpi_rs_out_string("Attribute",
+ ACPI_READ_WRITE_MEMORY ==
+ resource->memory24.read_write_attribute ?
+ "Read/Write" : "Read Only");
- acpi_os_printf(" Range maximum base: %08X\n",
- memory24_data->max_base_address);
+ acpi_rs_out_integer16("Range Minimum Base",
+ (u16) resource->memory24.min_base_address);
- acpi_os_printf(" Alignment: %08X\n", memory24_data->alignment);
+ acpi_rs_out_integer16("Range Maximum Base",
+ (u16) resource->memory24.max_base_address);
- acpi_os_printf(" Range length: %08X\n", memory24_data->range_length);
+ acpi_rs_out_integer16("Alignment", (u16) resource->memory24.alignment);
- return;
+ acpi_rs_out_integer16("Range Length",
+ (u16) resource->memory24.range_length);
}
/*******************************************************************************
*
* FUNCTION: acpi_rs_dump_memory32
*
- * PARAMETERS: Data - pointer to the resource structure to dump.
+ * PARAMETERS: Resource - Pointer to an internal resource descriptor
*
* RETURN: None
*
- * DESCRIPTION: Prints out the various members of the Data structure type.
+ * DESCRIPTION: Dump the field names and values of the resource descriptor
*
******************************************************************************/
-static void acpi_rs_dump_memory32(union acpi_resource_data *data)
+static void acpi_rs_dump_memory32(union acpi_resource_data *resource)
{
- struct acpi_resource_mem32 *memory32_data =
- (struct acpi_resource_mem32 *)data;
-
ACPI_FUNCTION_ENTRY();
acpi_os_printf("32-Bit Memory Range Resource\n");
- acpi_os_printf(" Read%s\n",
- ACPI_READ_WRITE_MEMORY ==
- memory32_data->read_write_attribute ?
- "/Write" : " only");
-
- acpi_os_printf(" Range minimum base: %08X\n",
- memory32_data->min_base_address);
+ acpi_rs_out_string("Attribute",
+ ACPI_READ_WRITE_MEMORY ==
+ resource->memory32.read_write_attribute ?
+ "Read/Write" : "Read Only");
- acpi_os_printf(" Range maximum base: %08X\n",
- memory32_data->max_base_address);
+ acpi_rs_out_integer32("Range Minimum Base",
+ resource->memory32.min_base_address);
- acpi_os_printf(" Alignment: %08X\n", memory32_data->alignment);
+ acpi_rs_out_integer32("Range Maximum Base",
+ resource->memory32.max_base_address);
- acpi_os_printf(" Range length: %08X\n", memory32_data->range_length);
+ acpi_rs_out_integer32("Alignment", resource->memory32.alignment);
- return;
+ acpi_rs_out_integer32("Range Length", resource->memory32.range_length);
}
/*******************************************************************************
*
* FUNCTION: acpi_rs_dump_fixed_memory32
*
- * PARAMETERS: Data - pointer to the resource structure to dump.
+ * PARAMETERS: Resource - Pointer to an internal resource descriptor
*
* RETURN:
*
- * DESCRIPTION: Prints out the various members of the Data structure type.
+ * DESCRIPTION: Dump the field names and values of the resource descriptor
*
******************************************************************************/
-static void acpi_rs_dump_fixed_memory32(union acpi_resource_data *data)
+static void acpi_rs_dump_fixed_memory32(union acpi_resource_data *resource)
{
- struct acpi_resource_fixed_mem32 *fixed_memory32_data =
- (struct acpi_resource_fixed_mem32 *)data;
-
ACPI_FUNCTION_ENTRY();
acpi_os_printf("32-Bit Fixed Location Memory Range Resource\n");
- acpi_os_printf(" Read%s\n",
- ACPI_READ_WRITE_MEMORY ==
- fixed_memory32_data->
- read_write_attribute ? "/Write" : " Only");
-
- acpi_os_printf(" Range base address: %08X\n",
- fixed_memory32_data->range_base_address);
+ acpi_rs_out_string("Attribute",
+ ACPI_READ_WRITE_MEMORY ==
+ resource->fixed_memory32.read_write_attribute ?
+ "Read/Write" : "Read Only");
- acpi_os_printf(" Range length: %08X\n",
- fixed_memory32_data->range_length);
+ acpi_rs_out_integer32("Range Base Address",
+ resource->fixed_memory32.range_base_address);
- return;
+ acpi_rs_out_integer32("Range Length",
+ resource->fixed_memory32.range_length);
}
/*******************************************************************************
*
* FUNCTION: acpi_rs_dump_address16
*
- * PARAMETERS: Data - pointer to the resource structure to dump.
+ * PARAMETERS: Resource - Pointer to an internal resource descriptor
*
* RETURN: None
*
- * DESCRIPTION: Prints out the various members of the Data structure type.
+ * DESCRIPTION: Dump the field names and values of the resource descriptor
*
******************************************************************************/
-static void acpi_rs_dump_address16(union acpi_resource_data *data)
+static void acpi_rs_dump_address16(union acpi_resource_data *resource)
{
- struct acpi_resource_address16 *address16_data =
- (struct acpi_resource_address16 *)data;
-
ACPI_FUNCTION_ENTRY();
acpi_os_printf("16-Bit Address Space Resource\n");
- acpi_os_printf(" Resource Type: ");
- switch (address16_data->resource_type) {
- case ACPI_MEMORY_RANGE:
+ acpi_rs_dump_address_common(resource);
- acpi_os_printf("Memory Range\n");
+ acpi_rs_out_integer16("Granularity",
+ (u16) resource->address16.granularity);
- switch (address16_data->attribute.memory.cache_attribute) {
- case ACPI_NON_CACHEABLE_MEMORY:
- acpi_os_printf
- (" Type Specific: Noncacheable memory\n");
- break;
+ acpi_rs_out_integer16("Address Range Min",
+ (u16) resource->address16.min_address_range);
- case ACPI_CACHABLE_MEMORY:
- acpi_os_printf(" Type Specific: Cacheable memory\n");
- break;
+ acpi_rs_out_integer16("Address Range Max",
+ (u16) resource->address16.max_address_range);
- case ACPI_WRITE_COMBINING_MEMORY:
- acpi_os_printf
- (" Type Specific: Write-combining memory\n");
- break;
+ acpi_rs_out_integer16("Address Translation Offset",
+ (u16) resource->address16.
+ address_translation_offset);
- case ACPI_PREFETCHABLE_MEMORY:
- acpi_os_printf
- (" Type Specific: Prefetchable memory\n");
- break;
+ acpi_rs_out_integer16("Address Length",
+ (u16) resource->address16.address_length);
- default:
- acpi_os_printf
- (" Type Specific: Invalid cache attribute\n");
- break;
- }
-
- acpi_os_printf(" Type Specific: Read%s\n",
- ACPI_READ_WRITE_MEMORY ==
- address16_data->attribute.memory.
- read_write_attribute ? "/Write" : " Only");
- break;
-
- case ACPI_IO_RANGE:
-
- acpi_os_printf("I/O Range\n");
-
- switch (address16_data->attribute.io.range_attribute) {
- case ACPI_NON_ISA_ONLY_RANGES:
- acpi_os_printf
- (" Type Specific: Non-ISA Io Addresses\n");
- break;
-
- case ACPI_ISA_ONLY_RANGES:
- acpi_os_printf(" Type Specific: ISA Io Addresses\n");
- break;
-
- case ACPI_ENTIRE_RANGE:
- acpi_os_printf
- (" Type Specific: ISA and non-ISA Io Addresses\n");
- break;
-
- default:
- acpi_os_printf
- (" Type Specific: Invalid range attribute\n");
- break;
- }
-
- acpi_os_printf(" Type Specific: %s Translation\n",
- ACPI_SPARSE_TRANSLATION ==
- address16_data->attribute.io.
- translation_attribute ? "Sparse" : "Dense");
- break;
-
- case ACPI_BUS_NUMBER_RANGE:
-
- acpi_os_printf("Bus Number Range\n");
- break;
-
- default:
-
- acpi_os_printf("0x%2.2X\n", address16_data->resource_type);
- break;
- }
-
- acpi_os_printf(" Resource %s\n",
- ACPI_CONSUMER == address16_data->producer_consumer ?
- "Consumer" : "Producer");
-
- acpi_os_printf(" %s decode\n",
- ACPI_SUB_DECODE == address16_data->decode ?
- "Subtractive" : "Positive");
-
- acpi_os_printf(" Min address is %s fixed\n",
- ACPI_ADDRESS_FIXED == address16_data->min_address_fixed ?
- "" : "not");
-
- acpi_os_printf(" Max address is %s fixed\n",
- ACPI_ADDRESS_FIXED == address16_data->max_address_fixed ?
- "" : "not");
-
- acpi_os_printf(" Granularity: %08X\n", address16_data->granularity);
-
- acpi_os_printf(" Address range min: %08X\n",
- address16_data->min_address_range);
-
- acpi_os_printf(" Address range max: %08X\n",
- address16_data->max_address_range);
-
- acpi_os_printf(" Address translation offset: %08X\n",
- address16_data->address_translation_offset);
-
- acpi_os_printf(" Address Length: %08X\n",
- address16_data->address_length);
-
- if (0xFF != address16_data->resource_source.index) {
- acpi_os_printf(" Resource Source Index: %X\n",
- address16_data->resource_source.index);
-
- acpi_os_printf(" Resource Source: %s\n",
- address16_data->resource_source.string_ptr);
- }
-
- return;
+ acpi_rs_dump_resource_source(&resource->address16.resource_source);
}
/*******************************************************************************
*
* FUNCTION: acpi_rs_dump_address32
*
- * PARAMETERS: Data - pointer to the resource structure to dump.
+ * PARAMETERS: Resource - Pointer to an internal resource descriptor
*
* RETURN: None
*
- * DESCRIPTION: Prints out the various members of the Data structure type.
+ * DESCRIPTION: Dump the field names and values of the resource descriptor
*
******************************************************************************/
-static void acpi_rs_dump_address32(union acpi_resource_data *data)
+static void acpi_rs_dump_address32(union acpi_resource_data *resource)
{
- struct acpi_resource_address32 *address32_data =
- (struct acpi_resource_address32 *)data;
-
ACPI_FUNCTION_ENTRY();
acpi_os_printf("32-Bit Address Space Resource\n");
- switch (address32_data->resource_type) {
- case ACPI_MEMORY_RANGE:
+ acpi_rs_dump_address_common(resource);
- acpi_os_printf(" Resource Type: Memory Range\n");
+ acpi_rs_out_integer32("Granularity", resource->address32.granularity);
- switch (address32_data->attribute.memory.cache_attribute) {
- case ACPI_NON_CACHEABLE_MEMORY:
- acpi_os_printf
- (" Type Specific: Noncacheable memory\n");
- break;
+ acpi_rs_out_integer32("Address Range Min",
+ resource->address32.min_address_range);
- case ACPI_CACHABLE_MEMORY:
- acpi_os_printf(" Type Specific: Cacheable memory\n");
- break;
+ acpi_rs_out_integer32("Address Range Max",
+ resource->address32.max_address_range);
- case ACPI_WRITE_COMBINING_MEMORY:
- acpi_os_printf
- (" Type Specific: Write-combining memory\n");
- break;
-
- case ACPI_PREFETCHABLE_MEMORY:
- acpi_os_printf
- (" Type Specific: Prefetchable memory\n");
- break;
-
- default:
- acpi_os_printf
- (" Type Specific: Invalid cache attribute\n");
- break;
- }
-
- acpi_os_printf(" Type Specific: Read%s\n",
- ACPI_READ_WRITE_MEMORY ==
- address32_data->attribute.memory.
- read_write_attribute ? "/Write" : " Only");
- break;
-
- case ACPI_IO_RANGE:
-
- acpi_os_printf(" Resource Type: Io Range\n");
-
- switch (address32_data->attribute.io.range_attribute) {
- case ACPI_NON_ISA_ONLY_RANGES:
- acpi_os_printf
- (" Type Specific: Non-ISA Io Addresses\n");
- break;
-
- case ACPI_ISA_ONLY_RANGES:
- acpi_os_printf(" Type Specific: ISA Io Addresses\n");
- break;
-
- case ACPI_ENTIRE_RANGE:
- acpi_os_printf
- (" Type Specific: ISA and non-ISA Io Addresses\n");
- break;
-
- default:
- acpi_os_printf
- (" Type Specific: Invalid Range attribute");
- break;
- }
-
- acpi_os_printf(" Type Specific: %s Translation\n",
- ACPI_SPARSE_TRANSLATION ==
- address32_data->attribute.io.
- translation_attribute ? "Sparse" : "Dense");
- break;
-
- case ACPI_BUS_NUMBER_RANGE:
-
- acpi_os_printf(" Resource Type: Bus Number Range\n");
- break;
+ acpi_rs_out_integer32("Address Translation Offset",
+ resource->address32.address_translation_offset);
- default:
-
- acpi_os_printf(" Resource Type: 0x%2.2X\n",
- address32_data->resource_type);
- break;
- }
+ acpi_rs_out_integer32("Address Length",
+ resource->address32.address_length);
- acpi_os_printf(" Resource %s\n",
- ACPI_CONSUMER == address32_data->producer_consumer ?
- "Consumer" : "Producer");
-
- acpi_os_printf(" %s decode\n",
- ACPI_SUB_DECODE == address32_data->decode ?
- "Subtractive" : "Positive");
-
- acpi_os_printf(" Min address is %s fixed\n",
- ACPI_ADDRESS_FIXED == address32_data->min_address_fixed ?
- "" : "not ");
-
- acpi_os_printf(" Max address is %s fixed\n",
- ACPI_ADDRESS_FIXED == address32_data->max_address_fixed ?
- "" : "not ");
-
- acpi_os_printf(" Granularity: %08X\n", address32_data->granularity);
-
- acpi_os_printf(" Address range min: %08X\n",
- address32_data->min_address_range);
-
- acpi_os_printf(" Address range max: %08X\n",
- address32_data->max_address_range);
-
- acpi_os_printf(" Address translation offset: %08X\n",
- address32_data->address_translation_offset);
-
- acpi_os_printf(" Address Length: %08X\n",
- address32_data->address_length);
-
- if (0xFF != address32_data->resource_source.index) {
- acpi_os_printf(" Resource Source Index: %X\n",
- address32_data->resource_source.index);
-
- acpi_os_printf(" Resource Source: %s\n",
- address32_data->resource_source.string_ptr);
- }
-
- return;
+ acpi_rs_dump_resource_source(&resource->address32.resource_source);
}
/*******************************************************************************
*
* FUNCTION: acpi_rs_dump_address64
*
- * PARAMETERS: Data - pointer to the resource structure to dump.
+ * PARAMETERS: Resource - Pointer to an internal resource descriptor
*
* RETURN: None
*
- * DESCRIPTION: Prints out the various members of the Data structure type.
+ * DESCRIPTION: Dump the field names and values of the resource descriptor
*
******************************************************************************/
-static void acpi_rs_dump_address64(union acpi_resource_data *data)
+static void acpi_rs_dump_address64(union acpi_resource_data *resource)
{
- struct acpi_resource_address64 *address64_data =
- (struct acpi_resource_address64 *)data;
-
ACPI_FUNCTION_ENTRY();
acpi_os_printf("64-Bit Address Space Resource\n");
- switch (address64_data->resource_type) {
- case ACPI_MEMORY_RANGE:
-
- acpi_os_printf(" Resource Type: Memory Range\n");
-
- switch (address64_data->attribute.memory.cache_attribute) {
- case ACPI_NON_CACHEABLE_MEMORY:
- acpi_os_printf
- (" Type Specific: Noncacheable memory\n");
- break;
-
- case ACPI_CACHABLE_MEMORY:
- acpi_os_printf(" Type Specific: Cacheable memory\n");
- break;
-
- case ACPI_WRITE_COMBINING_MEMORY:
- acpi_os_printf
- (" Type Specific: Write-combining memory\n");
- break;
-
- case ACPI_PREFETCHABLE_MEMORY:
- acpi_os_printf
- (" Type Specific: Prefetchable memory\n");
- break;
-
- default:
- acpi_os_printf
- (" Type Specific: Invalid cache attribute\n");
- break;
- }
-
- acpi_os_printf(" Type Specific: Read%s\n",
- ACPI_READ_WRITE_MEMORY ==
- address64_data->attribute.memory.
- read_write_attribute ? "/Write" : " Only");
- break;
-
- case ACPI_IO_RANGE:
-
- acpi_os_printf(" Resource Type: Io Range\n");
-
- switch (address64_data->attribute.io.range_attribute) {
- case ACPI_NON_ISA_ONLY_RANGES:
- acpi_os_printf
- (" Type Specific: Non-ISA Io Addresses\n");
- break;
-
- case ACPI_ISA_ONLY_RANGES:
- acpi_os_printf(" Type Specific: ISA Io Addresses\n");
- break;
-
- case ACPI_ENTIRE_RANGE:
- acpi_os_printf
- (" Type Specific: ISA and non-ISA Io Addresses\n");
- break;
-
- default:
- acpi_os_printf
- (" Type Specific: Invalid Range attribute");
- break;
- }
-
- acpi_os_printf(" Type Specific: %s Translation\n",
- ACPI_SPARSE_TRANSLATION ==
- address64_data->attribute.io.
- translation_attribute ? "Sparse" : "Dense");
- break;
-
- case ACPI_BUS_NUMBER_RANGE:
-
- acpi_os_printf(" Resource Type: Bus Number Range\n");
- break;
-
- default:
-
- acpi_os_printf(" Resource Type: 0x%2.2X\n",
- address64_data->resource_type);
- break;
- }
-
- acpi_os_printf(" Resource %s\n",
- ACPI_CONSUMER == address64_data->producer_consumer ?
- "Consumer" : "Producer");
+ acpi_rs_dump_address_common(resource);
- acpi_os_printf(" %s decode\n",
- ACPI_SUB_DECODE == address64_data->decode ?
- "Subtractive" : "Positive");
+ acpi_rs_out_integer64("Granularity", resource->address64.granularity);
- acpi_os_printf(" Min address is %s fixed\n",
- ACPI_ADDRESS_FIXED == address64_data->min_address_fixed ?
- "" : "not ");
+ acpi_rs_out_integer64("Address Range Min",
+ resource->address64.min_address_range);
- acpi_os_printf(" Max address is %s fixed\n",
- ACPI_ADDRESS_FIXED == address64_data->max_address_fixed ?
- "" : "not ");
+ acpi_rs_out_integer64("Address Range Max",
+ resource->address64.max_address_range);
- acpi_os_printf(" Granularity: %8.8X%8.8X\n",
- ACPI_FORMAT_UINT64(address64_data->granularity));
+ acpi_rs_out_integer64("Address Translation Offset",
+ resource->address64.address_translation_offset);
- acpi_os_printf(" Address range min: %8.8X%8.8X\n",
- ACPI_FORMAT_UINT64(address64_data->min_address_range));
+ acpi_rs_out_integer64("Address Length",
+ resource->address64.address_length);
- acpi_os_printf(" Address range max: %8.8X%8.8X\n",
- ACPI_FORMAT_UINT64(address64_data->max_address_range));
+ acpi_rs_out_integer64("Type Specific Attributes",
+ resource->address64.type_specific_attributes);
- acpi_os_printf(" Address translation offset: %8.8X%8.8X\n",
- ACPI_FORMAT_UINT64(address64_data->
- address_translation_offset));
-
- acpi_os_printf(" Address Length: %8.8X%8.8X\n",
- ACPI_FORMAT_UINT64(address64_data->address_length));
-
- acpi_os_printf(" Type Specific Attributes: %8.8X%8.8X\n",
- ACPI_FORMAT_UINT64(address64_data->
- type_specific_attributes));
-
- if (0xFF != address64_data->resource_source.index) {
- acpi_os_printf(" Resource Source Index: %X\n",
- address64_data->resource_source.index);
-
- acpi_os_printf(" Resource Source: %s\n",
- address64_data->resource_source.string_ptr);
- }
-
- return;
+ acpi_rs_dump_resource_source(&resource->address64.resource_source);
}
/*******************************************************************************
*
* FUNCTION: acpi_rs_dump_extended_irq
*
- * PARAMETERS: Data - pointer to the resource structure to dump.
+ * PARAMETERS: Resource - Pointer to an internal resource descriptor
*
* RETURN: None
*
- * DESCRIPTION: Prints out the various members of the Data structure type.
+ * DESCRIPTION: Dump the field names and values of the resource descriptor
*
******************************************************************************/
-static void acpi_rs_dump_extended_irq(union acpi_resource_data *data)
+static void acpi_rs_dump_extended_irq(union acpi_resource_data *resource)
{
- struct acpi_resource_ext_irq *ext_irq_data =
- (struct acpi_resource_ext_irq *)data;
- u8 index = 0;
-
ACPI_FUNCTION_ENTRY();
acpi_os_printf("Extended IRQ Resource\n");
- acpi_os_printf(" Resource %s\n",
- ACPI_CONSUMER == ext_irq_data->producer_consumer ?
- "Consumer" : "Producer");
+ acpi_rs_out_string("Resource",
+ ACPI_CONSUMER ==
+ resource->extended_irq.
+ producer_consumer ? "Consumer" : "Producer");
- acpi_os_printf(" %s\n",
- ACPI_LEVEL_SENSITIVE == ext_irq_data->edge_level ?
- "Level" : "Edge");
+ acpi_rs_out_string("Triggering",
+ ACPI_LEVEL_SENSITIVE ==
+ resource->extended_irq.
+ edge_level ? "Level" : "Edge");
- acpi_os_printf(" Active %s\n",
- ACPI_ACTIVE_LOW == ext_irq_data->active_high_low ?
- "low" : "high");
+ acpi_rs_out_string("Active",
+ ACPI_ACTIVE_LOW ==
+ resource->extended_irq.
+ active_high_low ? "Low" : "High");
- acpi_os_printf(" %s\n",
- ACPI_SHARED == ext_irq_data->shared_exclusive ?
- "Shared" : "Exclusive");
+ acpi_rs_out_string("Sharing",
+ ACPI_SHARED ==
+ resource->extended_irq.
+ shared_exclusive ? "Shared" : "Exclusive");
- acpi_os_printf(" Interrupts : %X ( ",
- ext_irq_data->number_of_interrupts);
+ acpi_rs_dump_resource_source(&resource->extended_irq.resource_source);
- for (index = 0; index < ext_irq_data->number_of_interrupts; index++) {
- acpi_os_printf("%X ", ext_irq_data->interrupts[index]);
- }
-
- acpi_os_printf(")\n");
+ acpi_rs_out_integer8("Interrupts",
+ (u8) resource->extended_irq.number_of_interrupts);
- if (0xFF != ext_irq_data->resource_source.index) {
- acpi_os_printf(" Resource Source Index: %X",
- ext_irq_data->resource_source.index);
-
- acpi_os_printf(" Resource Source: %s",
- ext_irq_data->resource_source.string_ptr);
- }
-
- return;
+ acpi_rs_dump_dword_list(resource->extended_irq.number_of_interrupts,
+ resource->extended_irq.interrupts);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_dump_resource_list
+ * FUNCTION: acpi_rs_dump_generic_reg
*
- * PARAMETERS: Resource - pointer to the resource structure to dump.
+ * PARAMETERS: Resource - Pointer to an internal resource descriptor
*
* RETURN: None
*
- * DESCRIPTION: Dispatches the structure to the correct dump routine.
+ * DESCRIPTION: Dump the field names and values of the resource descriptor
*
******************************************************************************/
-void acpi_rs_dump_resource_list(struct acpi_resource *resource)
+static void acpi_rs_dump_generic_reg(union acpi_resource_data *resource)
{
- u8 count = 0;
- u8 done = FALSE;
ACPI_FUNCTION_ENTRY();
- if (acpi_dbg_level & ACPI_LV_RESOURCES && _COMPONENT & acpi_dbg_layer) {
- while (!done) {
- acpi_os_printf("Resource structure %X.\n", count++);
-
- switch (resource->id) {
- case ACPI_RSTYPE_IRQ:
- acpi_rs_dump_irq(&resource->data);
- break;
-
- case ACPI_RSTYPE_DMA:
- acpi_rs_dump_dma(&resource->data);
- break;
-
- case ACPI_RSTYPE_START_DPF:
- acpi_rs_dump_start_depend_fns(&resource->data);
- break;
-
- case ACPI_RSTYPE_END_DPF:
- acpi_os_printf
- ("end_dependent_functions Resource\n");
- /* acpi_rs_dump_end_dependent_functions (Resource->Data); */
- break;
-
- case ACPI_RSTYPE_IO:
- acpi_rs_dump_io(&resource->data);
- break;
-
- case ACPI_RSTYPE_FIXED_IO:
- acpi_rs_dump_fixed_io(&resource->data);
- break;
+ acpi_os_printf("Generic Register Resource\n");
- case ACPI_RSTYPE_VENDOR:
- acpi_rs_dump_vendor_specific(&resource->data);
- break;
+ acpi_rs_out_integer8("Space ID", (u8) resource->generic_reg.space_id);
- case ACPI_RSTYPE_END_TAG:
- /*rs_dump_end_tag (Resource->Data); */
- acpi_os_printf("end_tag Resource\n");
- done = TRUE;
- break;
+ acpi_rs_out_integer8("Bit Width", (u8) resource->generic_reg.bit_width);
- case ACPI_RSTYPE_MEM24:
- acpi_rs_dump_memory24(&resource->data);
- break;
+ acpi_rs_out_integer8("Bit Offset",
+ (u8) resource->generic_reg.bit_offset);
- case ACPI_RSTYPE_MEM32:
- acpi_rs_dump_memory32(&resource->data);
- break;
+ acpi_rs_out_integer8("Address Size",
+ (u8) resource->generic_reg.address_size);
- case ACPI_RSTYPE_FIXED_MEM32:
- acpi_rs_dump_fixed_memory32(&resource->data);
- break;
-
- case ACPI_RSTYPE_ADDRESS16:
- acpi_rs_dump_address16(&resource->data);
- break;
-
- case ACPI_RSTYPE_ADDRESS32:
- acpi_rs_dump_address32(&resource->data);
- break;
+ acpi_rs_out_integer64("Address", resource->generic_reg.address);
+}
- case ACPI_RSTYPE_ADDRESS64:
- acpi_rs_dump_address64(&resource->data);
- break;
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_rs_dump_end_depend_fns
+ *
+ * PARAMETERS: Resource - Pointer to an internal resource descriptor
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Print type, no data.
+ *
+ ******************************************************************************/
- case ACPI_RSTYPE_EXT_IRQ:
- acpi_rs_dump_extended_irq(&resource->data);
- break;
+static void acpi_rs_dump_end_depend_fns(union acpi_resource_data *resource)
+{
+ ACPI_FUNCTION_ENTRY();
- default:
- acpi_os_printf("Invalid resource type\n");
- break;
+ acpi_os_printf("end_dependent_functions Resource\n");
+}
- }
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_rs_dump_end_tag
+ *
+ * PARAMETERS: Resource - Pointer to an internal resource descriptor
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Print type, no data.
+ *
+ ******************************************************************************/
- resource =
- ACPI_PTR_ADD(struct acpi_resource, resource,
- resource->length);
- }
- }
+static void acpi_rs_dump_end_tag(union acpi_resource_data *resource)
+{
+ ACPI_FUNCTION_ENTRY();
- return;
+ acpi_os_printf("end_tag Resource\n");
}
/*******************************************************************************
*
* FUNCTION: acpi_rs_dump_irq_list
*
- * PARAMETERS: route_table - pointer to the routing table to dump.
+ * PARAMETERS: route_table - Pointer to the routing table to dump.
*
* RETURN: None
*
- * DESCRIPTION: Dispatches the structures to the correct dump routine.
+ * DESCRIPTION: Print IRQ routing table
*
******************************************************************************/
@@ -1071,41 +1017,35 @@ void acpi_rs_dump_irq_list(u8 * route_table)
{
u8 *buffer = route_table;
u8 count = 0;
- u8 done = FALSE;
struct acpi_pci_routing_table *prt_element;
ACPI_FUNCTION_ENTRY();
- if (acpi_dbg_level & ACPI_LV_RESOURCES && _COMPONENT & acpi_dbg_layer) {
- prt_element =
- ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer);
+ if (!(acpi_dbg_level & ACPI_LV_RESOURCES)
+ || !(_COMPONENT & acpi_dbg_layer)) {
+ return;
+ }
- while (!done) {
- acpi_os_printf("PCI IRQ Routing Table structure %X.\n",
- count++);
+ prt_element = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer);
- acpi_os_printf(" Address: %8.8X%8.8X\n",
- ACPI_FORMAT_UINT64(prt_element->
- address));
+ /* Dump all table elements, Exit on null length element */
- acpi_os_printf(" Pin: %X\n", prt_element->pin);
+ while (prt_element->length) {
+ acpi_os_printf("\n[%02X] PCI IRQ Routing Table Package\n",
+ count);
- acpi_os_printf(" Source: %s\n", prt_element->source);
+ acpi_rs_out_integer64("Address", prt_element->address);
- acpi_os_printf(" source_index: %X\n",
- prt_element->source_index);
+ acpi_rs_out_integer32("Pin", prt_element->pin);
+ acpi_rs_out_string("Source", prt_element->source);
+ acpi_rs_out_integer32("Source Index",
+ prt_element->source_index);
- buffer += prt_element->length;
- prt_element =
- ACPI_CAST_PTR(struct acpi_pci_routing_table,
- buffer);
- if (0 == prt_element->length) {
- done = TRUE;
- }
- }
+ buffer += prt_element->length;
+ prt_element =
+ ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer);
+ count++;
}
-
- return;
}
#endif
diff --git a/drivers/acpi/resources/rsio.c b/drivers/acpi/resources/rsio.c
index d53bbe89e85..6574e2ae2e5 100644
--- a/drivers/acpi/resources/rsio.c
+++ b/drivers/acpi/resources/rsio.c
@@ -84,7 +84,7 @@ acpi_rs_io_resource(u8 * byte_stream_buffer,
*bytes_consumed = 8;
- output_struct->id = ACPI_RSTYPE_IO;
+ output_struct->type = ACPI_RSTYPE_IO;
/* Check Decode */
@@ -170,7 +170,7 @@ acpi_rs_fixed_io_resource(u8 * byte_stream_buffer,
*bytes_consumed = 4;
- output_struct->id = ACPI_RSTYPE_FIXED_IO;
+ output_struct->type = ACPI_RSTYPE_FIXED_IO;
/* Check Range Base Address */
@@ -200,7 +200,7 @@ acpi_rs_fixed_io_resource(u8 * byte_stream_buffer,
*
* FUNCTION: acpi_rs_io_stream
*
- * PARAMETERS: linked_list - Pointer to the resource linked list
+ * PARAMETERS: Resource - Pointer to the resource linked list
* output_buffer - Pointer to the user's return buffer
* bytes_consumed - Pointer to where the number of bytes
* used in the output_buffer is returned
@@ -213,7 +213,7 @@ acpi_rs_fixed_io_resource(u8 * byte_stream_buffer,
******************************************************************************/
acpi_status
-acpi_rs_io_stream(struct acpi_resource *linked_list,
+acpi_rs_io_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed)
{
u8 *buffer = *output_buffer;
@@ -222,42 +222,42 @@ acpi_rs_io_stream(struct acpi_resource *linked_list,
ACPI_FUNCTION_TRACE("rs_io_stream");
- /* The descriptor field is static */
+ /* The Descriptor Type field is static */
- *buffer = 0x47;
+ *buffer = ACPI_RDESC_TYPE_IO_PORT | 0x07;
buffer += 1;
/* Io Information Byte */
- temp8 = (u8) (linked_list->data.io.io_decode & 0x01);
+ temp8 = (u8) (resource->data.io.io_decode & 0x01);
*buffer = temp8;
buffer += 1;
/* Set the Range minimum base address */
- temp16 = (u16) linked_list->data.io.min_base_address;
+ temp16 = (u16) resource->data.io.min_base_address;
ACPI_MOVE_16_TO_16(buffer, &temp16);
buffer += 2;
/* Set the Range maximum base address */
- temp16 = (u16) linked_list->data.io.max_base_address;
+ temp16 = (u16) resource->data.io.max_base_address;
ACPI_MOVE_16_TO_16(buffer, &temp16);
buffer += 2;
/* Set the base alignment */
- temp8 = (u8) linked_list->data.io.alignment;
+ temp8 = (u8) resource->data.io.alignment;
*buffer = temp8;
buffer += 1;
/* Set the range length */
- temp8 = (u8) linked_list->data.io.range_length;
+ temp8 = (u8) resource->data.io.range_length;
*buffer = temp8;
buffer += 1;
@@ -272,7 +272,7 @@ acpi_rs_io_stream(struct acpi_resource *linked_list,
*
* FUNCTION: acpi_rs_fixed_io_stream
*
- * PARAMETERS: linked_list - Pointer to the resource linked list
+ * PARAMETERS: Resource - Pointer to the resource linked list
* output_buffer - Pointer to the user's return buffer
* bytes_consumed - Pointer to where the number of bytes
* used in the output_buffer is returned
@@ -285,7 +285,7 @@ acpi_rs_io_stream(struct acpi_resource *linked_list,
******************************************************************************/
acpi_status
-acpi_rs_fixed_io_stream(struct acpi_resource *linked_list,
+acpi_rs_fixed_io_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed)
{
u8 *buffer = *output_buffer;
@@ -294,22 +294,21 @@ acpi_rs_fixed_io_stream(struct acpi_resource *linked_list,
ACPI_FUNCTION_TRACE("rs_fixed_io_stream");
- /* The descriptor field is static */
-
- *buffer = 0x4B;
+ /* The Descriptor Type field is static */
+ *buffer = ACPI_RDESC_TYPE_FIXED_IO_PORT | 0x03;
buffer += 1;
/* Set the Range base address */
- temp16 = (u16) linked_list->data.fixed_io.base_address;
+ temp16 = (u16) resource->data.fixed_io.base_address;
ACPI_MOVE_16_TO_16(buffer, &temp16);
buffer += 2;
/* Set the range length */
- temp8 = (u8) linked_list->data.fixed_io.range_length;
+ temp8 = (u8) resource->data.fixed_io.range_length;
*buffer = temp8;
buffer += 1;
@@ -358,7 +357,7 @@ acpi_rs_dma_resource(u8 * byte_stream_buffer,
/* The number of bytes consumed are Constant */
*bytes_consumed = 3;
- output_struct->id = ACPI_RSTYPE_DMA;
+ output_struct->type = ACPI_RSTYPE_DMA;
/* Point to the 8-bits of Byte 1 */
@@ -420,7 +419,7 @@ acpi_rs_dma_resource(u8 * byte_stream_buffer,
*
* FUNCTION: acpi_rs_dma_stream
*
- * PARAMETERS: linked_list - Pointer to the resource linked list
+ * PARAMETERS: Resource - Pointer to the resource linked list
* output_buffer - Pointer to the user's return buffer
* bytes_consumed - Pointer to where the number of bytes
* used in the output_buffer is returned
@@ -433,7 +432,7 @@ acpi_rs_dma_resource(u8 * byte_stream_buffer,
******************************************************************************/
acpi_status
-acpi_rs_dma_stream(struct acpi_resource *linked_list,
+acpi_rs_dma_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed)
{
u8 *buffer = *output_buffer;
@@ -443,17 +442,16 @@ acpi_rs_dma_stream(struct acpi_resource *linked_list,
ACPI_FUNCTION_TRACE("rs_dma_stream");
- /* The descriptor field is static */
+ /* The Descriptor Type field is static */
- *buffer = 0x2A;
+ *buffer = ACPI_RDESC_TYPE_DMA_FORMAT | 0x02;
buffer += 1;
temp8 = 0;
/* Loop through all of the Channels and set the mask bits */
- for (index = 0;
- index < linked_list->data.dma.number_of_channels; index++) {
- temp16 = (u16) linked_list->data.dma.channels[index];
+ for (index = 0; index < resource->data.dma.number_of_channels; index++) {
+ temp16 = (u16) resource->data.dma.channels[index];
temp8 |= 0x1 << temp16;
}
@@ -462,9 +460,9 @@ acpi_rs_dma_stream(struct acpi_resource *linked_list,
/* Set the DMA Info */
- temp8 = (u8) ((linked_list->data.dma.type & 0x03) << 5);
- temp8 |= ((linked_list->data.dma.bus_master & 0x01) << 2);
- temp8 |= (linked_list->data.dma.transfer & 0x03);
+ temp8 = (u8) ((resource->data.dma.type & 0x03) << 5);
+ temp8 |= ((resource->data.dma.bus_master & 0x01) << 2);
+ temp8 |= (resource->data.dma.transfer & 0x03);
*buffer = temp8;
buffer += 1;
diff --git a/drivers/acpi/resources/rsirq.c b/drivers/acpi/resources/rsirq.c
index 56043fee96c..75df962115c 100644
--- a/drivers/acpi/resources/rsirq.c
+++ b/drivers/acpi/resources/rsirq.c
@@ -88,7 +88,7 @@ acpi_rs_irq_resource(u8 * byte_stream_buffer,
*/
temp8 = *buffer;
*bytes_consumed = (temp8 & 0x03) + 1;
- output_struct->id = ACPI_RSTYPE_IRQ;
+ output_struct->type = ACPI_RSTYPE_IRQ;
/* Point to the 16-bits of Bytes 1 and 2 */
@@ -177,7 +177,7 @@ acpi_rs_irq_resource(u8 * byte_stream_buffer,
*
* FUNCTION: acpi_rs_irq_stream
*
- * PARAMETERS: linked_list - Pointer to the resource linked list
+ * PARAMETERS: Resource - Pointer to the resource linked list
* output_buffer - Pointer to the user's return buffer
* bytes_consumed - Pointer to where the number of bytes
* used in the output_buffer is returned
@@ -190,7 +190,7 @@ acpi_rs_irq_resource(u8 * byte_stream_buffer,
******************************************************************************/
acpi_status
-acpi_rs_irq_stream(struct acpi_resource *linked_list,
+acpi_rs_irq_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed)
{
u8 *buffer = *output_buffer;
@@ -205,13 +205,13 @@ acpi_rs_irq_stream(struct acpi_resource *linked_list,
* The descriptor field is set based upon whether a third byte is
* needed to contain the IRQ Information.
*/
- if (ACPI_EDGE_SENSITIVE == linked_list->data.irq.edge_level &&
- ACPI_ACTIVE_HIGH == linked_list->data.irq.active_high_low &&
- ACPI_EXCLUSIVE == linked_list->data.irq.shared_exclusive) {
- *buffer = 0x22;
+ if (ACPI_EDGE_SENSITIVE == resource->data.irq.edge_level &&
+ ACPI_ACTIVE_HIGH == resource->data.irq.active_high_low &&
+ ACPI_EXCLUSIVE == resource->data.irq.shared_exclusive) {
+ *buffer = ACPI_RDESC_TYPE_IRQ_FORMAT | 0x02;
IRqinfo_byte_needed = FALSE;
} else {
- *buffer = 0x23;
+ *buffer = ACPI_RDESC_TYPE_IRQ_FORMAT | 0x03;
IRqinfo_byte_needed = TRUE;
}
@@ -221,8 +221,8 @@ acpi_rs_irq_stream(struct acpi_resource *linked_list,
/* Loop through all of the interrupts and set the mask bits */
for (index = 0;
- index < linked_list->data.irq.number_of_interrupts; index++) {
- temp8 = (u8) linked_list->data.irq.interrupts[index];
+ index < resource->data.irq.number_of_interrupts; index++) {
+ temp8 = (u8) resource->data.irq.interrupts[index];
temp16 |= 0x1 << temp8;
}
@@ -233,11 +233,11 @@ acpi_rs_irq_stream(struct acpi_resource *linked_list,
if (IRqinfo_byte_needed) {
temp8 = 0;
- temp8 = (u8) ((linked_list->data.irq.shared_exclusive &
+ temp8 = (u8) ((resource->data.irq.shared_exclusive &
0x01) << 4);
- if (ACPI_LEVEL_SENSITIVE == linked_list->data.irq.edge_level &&
- ACPI_ACTIVE_LOW == linked_list->data.irq.active_high_low) {
+ if (ACPI_LEVEL_SENSITIVE == resource->data.irq.edge_level &&
+ ACPI_ACTIVE_LOW == resource->data.irq.active_high_low) {
temp8 |= 0x08;
} else {
temp8 |= 0x01;
@@ -302,7 +302,7 @@ acpi_rs_extended_irq_resource(u8 * byte_stream_buffer,
}
*bytes_consumed = temp16 + 3;
- output_struct->id = ACPI_RSTYPE_EXT_IRQ;
+ output_struct->type = ACPI_RSTYPE_EXT_IRQ;
/* Point to the Byte3 */
@@ -441,7 +441,7 @@ acpi_rs_extended_irq_resource(u8 * byte_stream_buffer,
*
* FUNCTION: acpi_rs_extended_irq_stream
*
- * PARAMETERS: linked_list - Pointer to the resource linked list
+ * PARAMETERS: Resource - Pointer to the resource linked list
* output_buffer - Pointer to the user's return buffer
* bytes_consumed - Pointer to where the number of bytes
* used in the output_buffer is returned
@@ -454,7 +454,7 @@ acpi_rs_extended_irq_resource(u8 * byte_stream_buffer,
******************************************************************************/
acpi_status
-acpi_rs_extended_irq_stream(struct acpi_resource *linked_list,
+acpi_rs_extended_irq_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed)
{
u8 *buffer = *output_buffer;
@@ -476,9 +476,8 @@ acpi_rs_extended_irq_stream(struct acpi_resource *linked_list,
/* Set the Interrupt vector flags */
- temp8 = (u8) (linked_list->data.extended_irq.producer_consumer & 0x01);
- temp8 |=
- ((linked_list->data.extended_irq.shared_exclusive & 0x01) << 3);
+ temp8 = (u8) (resource->data.extended_irq.producer_consumer & 0x01);
+ temp8 |= ((resource->data.extended_irq.shared_exclusive & 0x01) << 3);
/*
* Set the Interrupt Mode
@@ -489,44 +488,44 @@ acpi_rs_extended_irq_stream(struct acpi_resource *linked_list,
*
* - Edge/Level are defined opposite in the table vs the headers
*/
- if (ACPI_EDGE_SENSITIVE == linked_list->data.extended_irq.edge_level) {
+ if (ACPI_EDGE_SENSITIVE == resource->data.extended_irq.edge_level) {
temp8 |= 0x2;
}
/* Set the Interrupt Polarity */
- temp8 |= ((linked_list->data.extended_irq.active_high_low & 0x1) << 2);
+ temp8 |= ((resource->data.extended_irq.active_high_low & 0x1) << 2);
*buffer = temp8;
buffer += 1;
/* Set the Interrupt table length */
- temp8 = (u8) linked_list->data.extended_irq.number_of_interrupts;
+ temp8 = (u8) resource->data.extended_irq.number_of_interrupts;
*buffer = temp8;
buffer += 1;
for (index = 0;
- index < linked_list->data.extended_irq.number_of_interrupts;
+ index < resource->data.extended_irq.number_of_interrupts;
index++) {
ACPI_MOVE_32_TO_32(buffer,
- &linked_list->data.extended_irq.
+ &resource->data.extended_irq.
interrupts[index]);
buffer += 4;
}
/* Resource Source Index and Resource Source are optional */
- if (0 != linked_list->data.extended_irq.resource_source.string_length) {
+ if (0 != resource->data.extended_irq.resource_source.string_length) {
*buffer =
- (u8) linked_list->data.extended_irq.resource_source.index;
+ (u8) resource->data.extended_irq.resource_source.index;
buffer += 1;
/* Copy the string */
ACPI_STRCPY((char *)buffer,
- linked_list->data.extended_irq.resource_source.
+ resource->data.extended_irq.resource_source.
string_ptr);
/*
@@ -535,8 +534,8 @@ acpi_rs_extended_irq_stream(struct acpi_resource *linked_list,
*/
buffer +=
(acpi_size) (ACPI_STRLEN
- (linked_list->data.extended_irq.
- resource_source.string_ptr) + 1);
+ (resource->data.extended_irq.resource_source.
+ string_ptr) + 1);
}
/* Return the number of bytes consumed in this operation */
diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c
index 103eb31c284..87e75349dd0 100644
--- a/drivers/acpi/resources/rslist.c
+++ b/drivers/acpi/resources/rslist.c
@@ -47,44 +47,143 @@
#define _COMPONENT ACPI_RESOURCES
ACPI_MODULE_NAME("rslist")
+/* Dispatch table for convert-to-stream functions */
+typedef
+acpi_status(*ACPI_STREAM_HANDLER) (struct acpi_resource * resource,
+ u8 ** output_buffer,
+ acpi_size * bytes_consumed);
+
+static ACPI_STREAM_HANDLER acpi_gbl_stream_dispatch[] = {
+ acpi_rs_irq_stream, /* ACPI_RSTYPE_IRQ */
+ acpi_rs_dma_stream, /* ACPI_RSTYPE_DMA */
+ acpi_rs_start_depend_fns_stream, /* ACPI_RSTYPE_START_DPF */
+ acpi_rs_end_depend_fns_stream, /* ACPI_RSTYPE_END_DPF */
+ acpi_rs_io_stream, /* ACPI_RSTYPE_IO */
+ acpi_rs_fixed_io_stream, /* ACPI_RSTYPE_FIXED_IO */
+ acpi_rs_vendor_stream, /* ACPI_RSTYPE_VENDOR */
+ acpi_rs_end_tag_stream, /* ACPI_RSTYPE_END_TAG */
+ acpi_rs_memory24_stream, /* ACPI_RSTYPE_MEM24 */
+ acpi_rs_memory32_range_stream, /* ACPI_RSTYPE_MEM32 */
+ acpi_rs_fixed_memory32_stream, /* ACPI_RSTYPE_FIXED_MEM32 */
+ acpi_rs_address16_stream, /* ACPI_RSTYPE_ADDRESS16 */
+ acpi_rs_address32_stream, /* ACPI_RSTYPE_ADDRESS32 */
+ acpi_rs_address64_stream, /* ACPI_RSTYPE_ADDRESS64 */
+ acpi_rs_extended_irq_stream, /* ACPI_RSTYPE_EXT_IRQ */
+ acpi_rs_generic_register_stream /* ACPI_RSTYPE_GENERIC_REG */
+};
+
+/* Dispatch tables for convert-to-resource functions */
+
+typedef
+acpi_status(*ACPI_RESOURCE_HANDLER) (u8 * byte_stream_buffer,
+ acpi_size * bytes_consumed,
+ u8 ** output_buffer,
+ acpi_size * structure_size);
+
+static ACPI_RESOURCE_HANDLER acpi_gbl_sm_resource_dispatch[] = {
+ NULL, /* 0x00, Reserved */
+ NULL, /* 0x01, Reserved */
+ NULL, /* 0x02, Reserved */
+ NULL, /* 0x03, Reserved */
+ acpi_rs_irq_resource, /* ACPI_RDESC_TYPE_IRQ_FORMAT */
+ acpi_rs_dma_resource, /* ACPI_RDESC_TYPE_DMA_FORMAT */
+ acpi_rs_start_depend_fns_resource, /* ACPI_RDESC_TYPE_START_DEPENDENT */
+ acpi_rs_end_depend_fns_resource, /* ACPI_RDESC_TYPE_END_DEPENDENT */
+ acpi_rs_io_resource, /* ACPI_RDESC_TYPE_IO_PORT */
+ acpi_rs_fixed_io_resource, /* ACPI_RDESC_TYPE_FIXED_IO_PORT */
+ NULL, /* 0x0A, Reserved */
+ NULL, /* 0x0B, Reserved */
+ NULL, /* 0x0C, Reserved */
+ NULL, /* 0x0D, Reserved */
+ acpi_rs_vendor_resource, /* ACPI_RDESC_TYPE_SMALL_VENDOR */
+ acpi_rs_end_tag_resource /* ACPI_RDESC_TYPE_END_TAG */
+};
+
+static ACPI_RESOURCE_HANDLER acpi_gbl_lg_resource_dispatch[] = {
+ NULL, /* 0x00, Reserved */
+ acpi_rs_memory24_resource, /* ACPI_RDESC_TYPE_MEMORY_24 */
+ acpi_rs_generic_register_resource, /* ACPI_RDESC_TYPE_GENERIC_REGISTER */
+ NULL, /* 0x03, Reserved */
+ acpi_rs_vendor_resource, /* ACPI_RDESC_TYPE_LARGE_VENDOR */
+ acpi_rs_memory32_range_resource, /* ACPI_RDESC_TYPE_MEMORY_32 */
+ acpi_rs_fixed_memory32_resource, /* ACPI_RDESC_TYPE_FIXED_MEMORY_32 */
+ acpi_rs_address32_resource, /* ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE */
+ acpi_rs_address16_resource, /* ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE */
+ acpi_rs_extended_irq_resource, /* ACPI_RDESC_TYPE_EXTENDED_XRUPT */
+ acpi_rs_address64_resource, /* ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE */
+ acpi_rs_address64_resource /* ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE */
+};
+
+/* Local prototypes */
+
+static ACPI_RESOURCE_HANDLER acpi_rs_get_resource_handler(u8 resource_type);
+
/*******************************************************************************
*
* FUNCTION: acpi_rs_get_resource_type
*
- * PARAMETERS: resource_start_byte - Byte 0 of a resource descriptor
+ * PARAMETERS: resource_type - Byte 0 of a resource descriptor
*
- * RETURN: The Resource Type with no extraneous bits
+ * RETURN: The Resource Type with no extraneous bits (except the large/
+ * small bit -- left alone)
*
* DESCRIPTION: Extract the Resource Type/Name from the first byte of
* a resource descriptor.
*
******************************************************************************/
-u8 acpi_rs_get_resource_type(u8 resource_start_byte)
-{
+u8 acpi_rs_get_resource_type(u8 resource_type)
+{
ACPI_FUNCTION_ENTRY();
/* Determine if this is a small or large resource */
- switch (resource_start_byte & ACPI_RDESC_TYPE_MASK) {
- case ACPI_RDESC_TYPE_SMALL:
+ if (resource_type & ACPI_RDESC_TYPE_LARGE) {
+ /* Large Resource Type -- bits 6:0 contain the name */
+
+ return (resource_type);
+ } else {
+ /* Small Resource Type -- bits 6:3 contain the name */
+
+ return ((u8) (resource_type & ACPI_RDESC_SMALL_MASK));
+ }
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_rs_get_resource_handler
+ *
+ * PARAMETERS: resource_type - Byte 0 of a resource descriptor
+ *
+ * RETURN: Pointer to the resource conversion handler
+ *
+ * DESCRIPTION: Extract the Resource Type/Name from the first byte of
+ * a resource descriptor.
+ *
+ ******************************************************************************/
- /* Small Resource Type -- Only bits 6:3 are valid */
+static ACPI_RESOURCE_HANDLER acpi_rs_get_resource_handler(u8 resource_type)
+{
+ ACPI_FUNCTION_ENTRY();
- return ((u8) (resource_start_byte & ACPI_RDESC_SMALL_MASK));
+ /* Determine if this is a small or large resource */
- case ACPI_RDESC_TYPE_LARGE:
+ if (resource_type & ACPI_RDESC_TYPE_LARGE) {
+ /* Large Resource Type -- bits 6:0 contain the name */
- /* Large Resource Type -- All bits are valid */
+ if (resource_type > ACPI_RDESC_LARGE_MAX) {
+ return (NULL);
+ }
- return (resource_start_byte);
+ return (acpi_gbl_lg_resource_dispatch[(resource_type &
+ ACPI_RDESC_LARGE_MASK)]);
+ } else {
+ /* Small Resource Type -- bits 6:3 contain the name */
- default:
- /* Invalid type */
- break;
+ return (acpi_gbl_sm_resource_dispatch[((resource_type &
+ ACPI_RDESC_SMALL_MASK)
+ >> 3)]);
}
-
- return (0xFF);
}
/*******************************************************************************
@@ -107,228 +206,70 @@ acpi_status
acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer,
u32 byte_stream_buffer_length, u8 * output_buffer)
{
+ u8 *buffer = output_buffer;
acpi_status status;
acpi_size bytes_parsed = 0;
- u8 resource_type = 0;
acpi_size bytes_consumed = 0;
- u8 *buffer = output_buffer;
acpi_size structure_size = 0;
- u8 end_tag_processed = FALSE;
struct acpi_resource *resource;
+ ACPI_RESOURCE_HANDLER handler;
ACPI_FUNCTION_TRACE("rs_byte_stream_to_list");
- while (bytes_parsed < byte_stream_buffer_length && !end_tag_processed) {
- /* The next byte in the stream is the resource type */
-
- resource_type = acpi_rs_get_resource_type(*byte_stream_buffer);
-
- switch (resource_type) {
- case ACPI_RDESC_TYPE_MEMORY_24:
- /*
- * 24-Bit Memory Resource
- */
- status = acpi_rs_memory24_resource(byte_stream_buffer,
- &bytes_consumed,
- &buffer,
- &structure_size);
- break;
-
- case ACPI_RDESC_TYPE_LARGE_VENDOR:
- /*
- * Vendor Defined Resource
- */
- status = acpi_rs_vendor_resource(byte_stream_buffer,
- &bytes_consumed,
- &buffer,
- &structure_size);
- break;
-
- case ACPI_RDESC_TYPE_MEMORY_32:
- /*
- * 32-Bit Memory Range Resource
- */
- status =
- acpi_rs_memory32_range_resource(byte_stream_buffer,
- &bytes_consumed,
- &buffer,
- &structure_size);
- break;
-
- case ACPI_RDESC_TYPE_FIXED_MEMORY_32:
- /*
- * 32-Bit Fixed Memory Resource
- */
- status =
- acpi_rs_fixed_memory32_resource(byte_stream_buffer,
- &bytes_consumed,
- &buffer,
- &structure_size);
- break;
-
- case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE:
- case ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE:
- /*
- * 64-Bit Address Resource
- */
- status = acpi_rs_address64_resource(byte_stream_buffer,
- &bytes_consumed,
- &buffer,
- &structure_size);
- break;
-
- case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE:
- /*
- * 32-Bit Address Resource
- */
- status = acpi_rs_address32_resource(byte_stream_buffer,
- &bytes_consumed,
- &buffer,
- &structure_size);
- break;
-
- case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE:
- /*
- * 16-Bit Address Resource
- */
- status = acpi_rs_address16_resource(byte_stream_buffer,
- &bytes_consumed,
- &buffer,
- &structure_size);
- break;
-
- case ACPI_RDESC_TYPE_EXTENDED_XRUPT:
- /*
- * Extended IRQ
- */
- status =
- acpi_rs_extended_irq_resource(byte_stream_buffer,
- &bytes_consumed,
- &buffer,
- &structure_size);
- break;
-
- case ACPI_RDESC_TYPE_IRQ_FORMAT:
- /*
- * IRQ Resource
- */
- status = acpi_rs_irq_resource(byte_stream_buffer,
- &bytes_consumed, &buffer,
- &structure_size);
- break;
-
- case ACPI_RDESC_TYPE_DMA_FORMAT:
- /*
- * DMA Resource
- */
- status = acpi_rs_dma_resource(byte_stream_buffer,
- &bytes_consumed, &buffer,
- &structure_size);
- break;
-
- case ACPI_RDESC_TYPE_START_DEPENDENT:
- /*
- * Start Dependent Functions Resource
- */
- status =
- acpi_rs_start_depend_fns_resource
- (byte_stream_buffer, &bytes_consumed, &buffer,
- &structure_size);
- break;
-
- case ACPI_RDESC_TYPE_END_DEPENDENT:
- /*
- * End Dependent Functions Resource
- */
- status =
- acpi_rs_end_depend_fns_resource(byte_stream_buffer,
- &bytes_consumed,
- &buffer,
- &structure_size);
- break;
-
- case ACPI_RDESC_TYPE_IO_PORT:
- /*
- * IO Port Resource
- */
- status = acpi_rs_io_resource(byte_stream_buffer,
- &bytes_consumed, &buffer,
- &structure_size);
- break;
-
- case ACPI_RDESC_TYPE_FIXED_IO_PORT:
- /*
- * Fixed IO Port Resource
- */
- status = acpi_rs_fixed_io_resource(byte_stream_buffer,
- &bytes_consumed,
- &buffer,
- &structure_size);
- break;
-
- case ACPI_RDESC_TYPE_SMALL_VENDOR:
- /*
- * Vendor Specific Resource
- */
- status = acpi_rs_vendor_resource(byte_stream_buffer,
- &bytes_consumed,
- &buffer,
- &structure_size);
- break;
-
- case ACPI_RDESC_TYPE_END_TAG:
- /*
- * End Tag
- */
- end_tag_processed = TRUE;
- status = acpi_rs_end_tag_resource(byte_stream_buffer,
- &bytes_consumed,
- &buffer,
- &structure_size);
- break;
-
- default:
- /*
- * Invalid/Unknown resource type
- */
+ /* Loop until end-of-buffer or an end_tag is found */
+
+ while (bytes_parsed < byte_stream_buffer_length) {
+ /* Get the handler associated with this Descriptor Type */
+
+ handler = acpi_rs_get_resource_handler(*byte_stream_buffer);
+ if (handler) {
+ /* Convert a byte stream resource to local resource struct */
+
+ status = handler(byte_stream_buffer, &bytes_consumed,
+ &buffer, &structure_size);
+ } else {
+ /* Invalid resource type */
+
status = AE_AML_INVALID_RESOURCE_TYPE;
- break;
}
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
- /* Update the return value and counter */
+ /* Set the aligned length of the new resource descriptor */
- bytes_parsed += bytes_consumed;
+ resource = ACPI_CAST_PTR(struct acpi_resource, buffer);
+ resource->length =
+ (u32) ACPI_ALIGN_RESOURCE_SIZE(resource->length);
- /* Set the byte stream to point to the next resource */
+ /* Normal exit on completion of an end_tag resource descriptor */
+ if (acpi_rs_get_resource_type(*byte_stream_buffer) ==
+ ACPI_RDESC_TYPE_END_TAG) {
+ return_ACPI_STATUS(AE_OK);
+ }
+
+ /* Update counter and point to the next input resource */
+
+ bytes_parsed += bytes_consumed;
byte_stream_buffer += bytes_consumed;
- /* Set the Buffer to the next structure */
+ /* Point to the next structure in the output buffer */
- resource = ACPI_CAST_PTR(struct acpi_resource, buffer);
- resource->length =
- (u32) ACPI_ALIGN_RESOURCE_SIZE(resource->length);
buffer += ACPI_ALIGN_RESOURCE_SIZE(structure_size);
}
- /* Check the reason for exiting the while loop */
+ /* Completed buffer, but did not find an end_tag resource descriptor */
- if (!end_tag_processed) {
- return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
- }
-
- return_ACPI_STATUS(AE_OK);
+ return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
}
/*******************************************************************************
*
* FUNCTION: acpi_rs_list_to_byte_stream
*
- * PARAMETERS: linked_list - Pointer to the resource linked list
+ * PARAMETERS: Resource - Pointer to the resource linked list
* byte_steam_size_needed - Calculated size of the byte stream
* needed from calling
* acpi_rs_get_byte_stream_length()
@@ -346,180 +287,52 @@ acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer,
******************************************************************************/
acpi_status
-acpi_rs_list_to_byte_stream(struct acpi_resource *linked_list,
+acpi_rs_list_to_byte_stream(struct acpi_resource *resource,
acpi_size byte_stream_size_needed,
u8 * output_buffer)
{
- acpi_status status;
u8 *buffer = output_buffer;
acpi_size bytes_consumed = 0;
- u8 done = FALSE;
+ acpi_status status;
ACPI_FUNCTION_TRACE("rs_list_to_byte_stream");
- while (!done) {
- switch (linked_list->id) {
- case ACPI_RSTYPE_IRQ:
- /*
- * IRQ Resource
- */
- status =
- acpi_rs_irq_stream(linked_list, &buffer,
- &bytes_consumed);
- break;
-
- case ACPI_RSTYPE_DMA:
- /*
- * DMA Resource
- */
- status =
- acpi_rs_dma_stream(linked_list, &buffer,
- &bytes_consumed);
- break;
-
- case ACPI_RSTYPE_START_DPF:
- /*
- * Start Dependent Functions Resource
- */
- status = acpi_rs_start_depend_fns_stream(linked_list,
- &buffer,
- &bytes_consumed);
- break;
-
- case ACPI_RSTYPE_END_DPF:
- /*
- * End Dependent Functions Resource
- */
- status = acpi_rs_end_depend_fns_stream(linked_list,
- &buffer,
- &bytes_consumed);
- break;
-
- case ACPI_RSTYPE_IO:
- /*
- * IO Port Resource
- */
- status =
- acpi_rs_io_stream(linked_list, &buffer,
- &bytes_consumed);
- break;
-
- case ACPI_RSTYPE_FIXED_IO:
- /*
- * Fixed IO Port Resource
- */
- status =
- acpi_rs_fixed_io_stream(linked_list, &buffer,
- &bytes_consumed);
- break;
-
- case ACPI_RSTYPE_VENDOR:
- /*
- * Vendor Defined Resource
- */
- status =
- acpi_rs_vendor_stream(linked_list, &buffer,
- &bytes_consumed);
- break;
-
- case ACPI_RSTYPE_END_TAG:
- /*
- * End Tag
- */
- status =
- acpi_rs_end_tag_stream(linked_list, &buffer,
- &bytes_consumed);
+ /* Convert each resource descriptor in the list */
- /* An End Tag indicates the end of the Resource Template */
+ while (1) {
+ /* Validate Type before dispatch */
- done = TRUE;
- break;
-
- case ACPI_RSTYPE_MEM24:
- /*
- * 24-Bit Memory Resource
- */
- status =
- acpi_rs_memory24_stream(linked_list, &buffer,
- &bytes_consumed);
- break;
-
- case ACPI_RSTYPE_MEM32:
- /*
- * 32-Bit Memory Range Resource
- */
- status =
- acpi_rs_memory32_range_stream(linked_list, &buffer,
- &bytes_consumed);
- break;
-
- case ACPI_RSTYPE_FIXED_MEM32:
- /*
- * 32-Bit Fixed Memory Resource
- */
- status =
- acpi_rs_fixed_memory32_stream(linked_list, &buffer,
- &bytes_consumed);
- break;
-
- case ACPI_RSTYPE_ADDRESS16:
- /*
- * 16-Bit Address Descriptor Resource
- */
- status = acpi_rs_address16_stream(linked_list, &buffer,
- &bytes_consumed);
- break;
-
- case ACPI_RSTYPE_ADDRESS32:
- /*
- * 32-Bit Address Descriptor Resource
- */
- status = acpi_rs_address32_stream(linked_list, &buffer,
- &bytes_consumed);
- break;
-
- case ACPI_RSTYPE_ADDRESS64:
- /*
- * 64-Bit Address Descriptor Resource
- */
- status = acpi_rs_address64_stream(linked_list, &buffer,
- &bytes_consumed);
- break;
-
- case ACPI_RSTYPE_EXT_IRQ:
- /*
- * Extended IRQ Resource
- */
- status =
- acpi_rs_extended_irq_stream(linked_list, &buffer,
- &bytes_consumed);
- break;
-
- default:
- /*
- * If we get here, everything is out of sync,
- * so exit with an error
- */
+ if (resource->type > ACPI_RSTYPE_MAX) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Invalid descriptor type (%X) in resource list\n",
- linked_list->id));
- status = AE_BAD_DATA;
- break;
+ resource->type));
+ return_ACPI_STATUS(AE_BAD_DATA);
}
+ /* Perform the conversion, per resource type */
+
+ status = acpi_gbl_stream_dispatch[resource->type] (resource,
+ &buffer,
+ &bytes_consumed);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
- /* Set the Buffer to point to the open byte */
+ /* Check for end-of-list */
+
+ if (resource->type == ACPI_RSTYPE_END_TAG) {
+ /* An End Tag indicates the end of the Resource Template */
+
+ return_ACPI_STATUS(AE_OK);
+ }
+
+ /* Set the Buffer to point to the next (output) resource descriptor */
buffer += bytes_consumed;
- /* Point to the next object */
+ /* Point to the next input resource object */
- linked_list = ACPI_PTR_ADD(struct acpi_resource,
- linked_list, linked_list->length);
+ resource = ACPI_PTR_ADD(struct acpi_resource,
+ resource, resource->length);
}
-
- return_ACPI_STATUS(AE_OK);
}
diff --git a/drivers/acpi/resources/rsmemory.c b/drivers/acpi/resources/rsmemory.c
index daba1a1ed46..418f1afb10a 100644
--- a/drivers/acpi/resources/rsmemory.c
+++ b/drivers/acpi/resources/rsmemory.c
@@ -84,11 +84,11 @@ acpi_rs_memory24_resource(u8 * byte_stream_buffer,
/* Point past the Descriptor to get the number of bytes consumed */
buffer += 1;
-
ACPI_MOVE_16_TO_16(&temp16, buffer);
+
buffer += 2;
*bytes_consumed = (acpi_size) temp16 + 3;
- output_struct->id = ACPI_RSTYPE_MEM24;
+ output_struct->type = ACPI_RSTYPE_MEM24;
/* Check Byte 3 the Read/Write bit */
@@ -133,7 +133,7 @@ acpi_rs_memory24_resource(u8 * byte_stream_buffer,
*
* FUNCTION: acpi_rs_memory24_stream
*
- * PARAMETERS: linked_list - Pointer to the resource linked list
+ * PARAMETERS: Resource - Pointer to the resource linked list
* output_buffer - Pointer to the user's return buffer
* bytes_consumed - Pointer to where the number of bytes
* used in the output_buffer is returned
@@ -146,7 +146,7 @@ acpi_rs_memory24_resource(u8 * byte_stream_buffer,
******************************************************************************/
acpi_status
-acpi_rs_memory24_stream(struct acpi_resource *linked_list,
+acpi_rs_memory24_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed)
{
u8 *buffer = *output_buffer;
@@ -155,9 +155,9 @@ acpi_rs_memory24_stream(struct acpi_resource *linked_list,
ACPI_FUNCTION_TRACE("rs_memory24_stream");
- /* The descriptor field is static */
+ /* The Descriptor Type field is static */
- *buffer = 0x81;
+ *buffer = ACPI_RDESC_TYPE_MEMORY_24;
buffer += 1;
/* The length field is static */
@@ -168,30 +168,28 @@ acpi_rs_memory24_stream(struct acpi_resource *linked_list,
/* Set the Information Byte */
- temp8 = (u8) (linked_list->data.memory24.read_write_attribute & 0x01);
+ temp8 = (u8) (resource->data.memory24.read_write_attribute & 0x01);
*buffer = temp8;
buffer += 1;
/* Set the Range minimum base address */
- ACPI_MOVE_32_TO_16(buffer,
- &linked_list->data.memory24.min_base_address);
+ ACPI_MOVE_32_TO_16(buffer, &resource->data.memory24.min_base_address);
buffer += 2;
/* Set the Range maximum base address */
- ACPI_MOVE_32_TO_16(buffer,
- &linked_list->data.memory24.max_base_address);
+ ACPI_MOVE_32_TO_16(buffer, &resource->data.memory24.max_base_address);
buffer += 2;
/* Set the base alignment */
- ACPI_MOVE_32_TO_16(buffer, &linked_list->data.memory24.alignment);
+ ACPI_MOVE_32_TO_16(buffer, &resource->data.memory24.alignment);
buffer += 2;
/* Set the range length */
- ACPI_MOVE_32_TO_16(buffer, &linked_list->data.memory24.range_length);
+ ACPI_MOVE_32_TO_16(buffer, &resource->data.memory24.range_length);
buffer += 2;
/* Return the number of bytes consumed in this operation */
@@ -238,12 +236,11 @@ acpi_rs_memory32_range_resource(u8 * byte_stream_buffer,
/* Point past the Descriptor to get the number of bytes consumed */
buffer += 1;
-
ACPI_MOVE_16_TO_16(&temp16, buffer);
+
buffer += 2;
*bytes_consumed = (acpi_size) temp16 + 3;
-
- output_struct->id = ACPI_RSTYPE_MEM32;
+ output_struct->type = ACPI_RSTYPE_MEM32;
/*
* Point to the place in the output buffer where the data portion will
@@ -335,8 +332,7 @@ acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer,
buffer += 2;
*bytes_consumed = (acpi_size) temp16 + 3;
-
- output_struct->id = ACPI_RSTYPE_FIXED_MEM32;
+ output_struct->type = ACPI_RSTYPE_FIXED_MEM32;
/* Check Byte 3 the Read/Write bit */
@@ -369,7 +365,7 @@ acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer,
*
* FUNCTION: acpi_rs_memory32_range_stream
*
- * PARAMETERS: linked_list - Pointer to the resource linked list
+ * PARAMETERS: Resource - Pointer to the resource linked list
* output_buffer - Pointer to the user's return buffer
* bytes_consumed - Pointer to where the number of bytes
* used in the output_buffer is returned
@@ -382,7 +378,7 @@ acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer,
******************************************************************************/
acpi_status
-acpi_rs_memory32_range_stream(struct acpi_resource *linked_list,
+acpi_rs_memory32_range_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed)
{
u8 *buffer = *output_buffer;
@@ -391,9 +387,9 @@ acpi_rs_memory32_range_stream(struct acpi_resource *linked_list,
ACPI_FUNCTION_TRACE("rs_memory32_range_stream");
- /* The descriptor field is static */
+ /* The Descriptor Type field is static */
- *buffer = 0x85;
+ *buffer = ACPI_RDESC_TYPE_MEMORY_32;
buffer += 1;
/* The length field is static */
@@ -405,30 +401,28 @@ acpi_rs_memory32_range_stream(struct acpi_resource *linked_list,
/* Set the Information Byte */
- temp8 = (u8) (linked_list->data.memory32.read_write_attribute & 0x01);
+ temp8 = (u8) (resource->data.memory32.read_write_attribute & 0x01);
*buffer = temp8;
buffer += 1;
/* Set the Range minimum base address */
- ACPI_MOVE_32_TO_32(buffer,
- &linked_list->data.memory32.min_base_address);
+ ACPI_MOVE_32_TO_32(buffer, &resource->data.memory32.min_base_address);
buffer += 4;
/* Set the Range maximum base address */
- ACPI_MOVE_32_TO_32(buffer,
- &linked_list->data.memory32.max_base_address);
+ ACPI_MOVE_32_TO_32(buffer, &resource->data.memory32.max_base_address);
buffer += 4;
/* Set the base alignment */
- ACPI_MOVE_32_TO_32(buffer, &linked_list->data.memory32.alignment);
+ ACPI_MOVE_32_TO_32(buffer, &resource->data.memory32.alignment);
buffer += 4;
/* Set the range length */
- ACPI_MOVE_32_TO_32(buffer, &linked_list->data.memory32.range_length);
+ ACPI_MOVE_32_TO_32(buffer, &resource->data.memory32.range_length);
buffer += 4;
/* Return the number of bytes consumed in this operation */
@@ -441,7 +435,7 @@ acpi_rs_memory32_range_stream(struct acpi_resource *linked_list,
*
* FUNCTION: acpi_rs_fixed_memory32_stream
*
- * PARAMETERS: linked_list - Pointer to the resource linked list
+ * PARAMETERS: Resource - Pointer to the resource linked list
* output_buffer - Pointer to the user's return buffer
* bytes_consumed - Pointer to where the number of bytes
* used in the output_buffer is returned
@@ -454,7 +448,7 @@ acpi_rs_memory32_range_stream(struct acpi_resource *linked_list,
******************************************************************************/
acpi_status
-acpi_rs_fixed_memory32_stream(struct acpi_resource *linked_list,
+acpi_rs_fixed_memory32_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed)
{
u8 *buffer = *output_buffer;
@@ -463,9 +457,9 @@ acpi_rs_fixed_memory32_stream(struct acpi_resource *linked_list,
ACPI_FUNCTION_TRACE("rs_fixed_memory32_stream");
- /* The descriptor field is static */
+ /* The Descriptor Type field is static */
- *buffer = 0x86;
+ *buffer = ACPI_RDESC_TYPE_FIXED_MEMORY_32;
buffer += 1;
/* The length field is static */
@@ -478,21 +472,19 @@ acpi_rs_fixed_memory32_stream(struct acpi_resource *linked_list,
/* Set the Information Byte */
temp8 =
- (u8) (linked_list->data.fixed_memory32.read_write_attribute & 0x01);
+ (u8) (resource->data.fixed_memory32.read_write_attribute & 0x01);
*buffer = temp8;
buffer += 1;
/* Set the Range base address */
ACPI_MOVE_32_TO_32(buffer,
- &linked_list->data.fixed_memory32.
- range_base_address);
+ &resource->data.fixed_memory32.range_base_address);
buffer += 4;
/* Set the range length */
- ACPI_MOVE_32_TO_32(buffer,
- &linked_list->data.fixed_memory32.range_length);
+ ACPI_MOVE_32_TO_32(buffer, &resource->data.fixed_memory32.range_length);
buffer += 4;
/* Return the number of bytes consumed in this operation */
diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c
index 7a8a34e757f..fa7f5a85b61 100644
--- a/drivers/acpi/resources/rsmisc.c
+++ b/drivers/acpi/resources/rsmisc.c
@@ -49,6 +49,169 @@ ACPI_MODULE_NAME("rsmisc")
/*******************************************************************************
*
+ * FUNCTION: acpi_rs_generic_register_resource
+ *
+ * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
+ * stream
+ * bytes_consumed - Pointer to where the number of bytes
+ * consumed the byte_stream_buffer is
+ * returned
+ * output_buffer - Pointer to the return data buffer
+ * structure_size - Pointer to where the number of bytes
+ * in the return data struct is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Take the resource byte stream and fill out the appropriate
+ * structure pointed to by the output_buffer. Return the
+ * number of bytes consumed from the byte stream.
+ *
+ ******************************************************************************/
+acpi_status
+acpi_rs_generic_register_resource(u8 * byte_stream_buffer,
+ acpi_size * bytes_consumed,
+ u8 ** output_buffer,
+ acpi_size * structure_size)
+{
+ u8 *buffer = byte_stream_buffer;
+ struct acpi_resource *output_struct = (void *)*output_buffer;
+ u16 temp16;
+ u8 temp8;
+ acpi_size struct_size =
+ ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_reg);
+
+ ACPI_FUNCTION_TRACE("rs_generic_register_resource");
+
+ /* Byte 0 is the Descriptor Type */
+
+ buffer += 1;
+
+ /* Get the Descriptor Length field (Bytes 1-2) */
+
+ ACPI_MOVE_16_TO_16(&temp16, buffer);
+ buffer += 2;
+
+ /* Validate the descriptor length */
+
+ if (temp16 != 12) {
+ return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH);
+ }
+
+ /* The number of bytes consumed is fixed (12 + 3) */
+
+ *bytes_consumed = 15;
+
+ /* Fill out the structure */
+
+ output_struct->type = ACPI_RSTYPE_GENERIC_REG;
+
+ /* Get space_id (Byte 3) */
+
+ temp8 = *buffer;
+ output_struct->data.generic_reg.space_id = temp8;
+ buffer += 1;
+
+ /* Get register_bit_width (Byte 4) */
+
+ temp8 = *buffer;
+ output_struct->data.generic_reg.bit_width = temp8;
+ buffer += 1;
+
+ /* Get register_bit_offset (Byte 5) */
+
+ temp8 = *buffer;
+ output_struct->data.generic_reg.bit_offset = temp8;
+ buffer += 1;
+
+ /* Get address_size (Byte 6) */
+
+ temp8 = *buffer;
+ output_struct->data.generic_reg.address_size = temp8;
+ buffer += 1;
+
+ /* Get register_address (Bytes 7-14) */
+
+ ACPI_MOVE_64_TO_64(&output_struct->data.generic_reg.address, buffer);
+
+ /* Set the Length parameter */
+
+ output_struct->length = (u32) struct_size;
+
+ /* Return the final size of the structure */
+
+ *structure_size = struct_size;
+ return_ACPI_STATUS(AE_OK);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_rs_generic_register_stream
+ *
+ * PARAMETERS: Resource - Pointer to the resource linked list
+ * output_buffer - Pointer to the user's return buffer
+ * bytes_consumed - Pointer to where the number of bytes
+ * used in the output_buffer is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Take the linked list resource structure and fills in the
+ * the appropriate bytes in a byte stream
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_rs_generic_register_stream(struct acpi_resource *resource,
+ u8 ** output_buffer, acpi_size * bytes_consumed)
+{
+ u8 *buffer = *output_buffer;
+ u16 temp16;
+
+ ACPI_FUNCTION_TRACE("rs_generic_register_stream");
+
+ /* Set the Descriptor Type (Byte 0) */
+
+ *buffer = ACPI_RDESC_TYPE_GENERIC_REGISTER;
+ buffer += 1;
+
+ /* Set the Descriptor Length (Bytes 1-2) */
+
+ temp16 = 12;
+ ACPI_MOVE_16_TO_16(buffer, &temp16);
+ buffer += 2;
+
+ /* Set space_id (Byte 3) */
+
+ *buffer = (u8) resource->data.generic_reg.space_id;
+ buffer += 1;
+
+ /* Set register_bit_width (Byte 4) */
+
+ *buffer = (u8) resource->data.generic_reg.bit_width;
+ buffer += 1;
+
+ /* Set register_bit_offset (Byte 5) */
+
+ *buffer = (u8) resource->data.generic_reg.bit_offset;
+ buffer += 1;
+
+ /* Set address_size (Byte 6) */
+
+ *buffer = (u8) resource->data.generic_reg.address_size;
+ buffer += 1;
+
+ /* Set register_address (Bytes 7-14) */
+
+ ACPI_MOVE_64_TO_64(buffer, &resource->data.generic_reg.address);
+ buffer += 8;
+
+ /* Return the number of bytes consumed in this operation */
+
+ *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
+ return_ACPI_STATUS(AE_OK);
+}
+
+/*******************************************************************************
+ *
* FUNCTION: acpi_rs_end_tag_resource
*
* PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
@@ -67,6 +230,7 @@ ACPI_MODULE_NAME("rsmisc")
* number of bytes consumed from the byte stream.
*
******************************************************************************/
+
acpi_status
acpi_rs_end_tag_resource(u8 * byte_stream_buffer,
acpi_size * bytes_consumed,
@@ -81,9 +245,9 @@ acpi_rs_end_tag_resource(u8 * byte_stream_buffer,
*bytes_consumed = 2;
- /* Fill out the structure */
+ /* Fill out the structure */
- output_struct->id = ACPI_RSTYPE_END_TAG;
+ output_struct->type = ACPI_RSTYPE_END_TAG;
/* Set the Length parameter */
@@ -99,7 +263,7 @@ acpi_rs_end_tag_resource(u8 * byte_stream_buffer,
*
* FUNCTION: acpi_rs_end_tag_stream
*
- * PARAMETERS: linked_list - Pointer to the resource linked list
+ * PARAMETERS: Resource - Pointer to the resource linked list
* output_buffer - Pointer to the user's return buffer
* bytes_consumed - Pointer to where the number of bytes
* used in the output_buffer is returned
@@ -112,7 +276,7 @@ acpi_rs_end_tag_resource(u8 * byte_stream_buffer,
******************************************************************************/
acpi_status
-acpi_rs_end_tag_stream(struct acpi_resource *linked_list,
+acpi_rs_end_tag_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed)
{
u8 *buffer = *output_buffer;
@@ -120,9 +284,9 @@ acpi_rs_end_tag_stream(struct acpi_resource *linked_list,
ACPI_FUNCTION_TRACE("rs_end_tag_stream");
- /* The descriptor field is static */
+ /* The Descriptor Type field is static */
- *buffer = 0x79;
+ *buffer = ACPI_RDESC_TYPE_END_TAG | 0x01;
buffer += 1;
/*
@@ -180,7 +344,7 @@ acpi_rs_vendor_resource(u8 * byte_stream_buffer,
temp8 = *buffer;
- if (temp8 & 0x80) {
+ if (temp8 & ACPI_RDESC_TYPE_LARGE) {
/* Large Item, point to the length field */
buffer += 1;
@@ -210,7 +374,7 @@ acpi_rs_vendor_resource(u8 * byte_stream_buffer,
buffer += 1;
}
- output_struct->id = ACPI_RSTYPE_VENDOR;
+ output_struct->type = ACPI_RSTYPE_VENDOR;
output_struct->data.vendor_specific.length = temp16;
for (index = 0; index < temp16; index++) {
@@ -239,7 +403,7 @@ acpi_rs_vendor_resource(u8 * byte_stream_buffer,
*
* FUNCTION: acpi_rs_vendor_stream
*
- * PARAMETERS: linked_list - Pointer to the resource linked list
+ * PARAMETERS: Resource - Pointer to the resource linked list
* output_buffer - Pointer to the user's return buffer
* bytes_consumed - Pointer to where the number of bytes
* used in the output_buffer is returned
@@ -252,7 +416,7 @@ acpi_rs_vendor_resource(u8 * byte_stream_buffer,
******************************************************************************/
acpi_status
-acpi_rs_vendor_stream(struct acpi_resource *linked_list,
+acpi_rs_vendor_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed)
{
u8 *buffer = *output_buffer;
@@ -264,21 +428,21 @@ acpi_rs_vendor_stream(struct acpi_resource *linked_list,
/* Dereference the length to find if this is a large or small item. */
- if (linked_list->data.vendor_specific.length > 7) {
+ if (resource->data.vendor_specific.length > 7) {
/* Large Item, Set the descriptor field and length bytes */
- *buffer = 0x84;
+ *buffer = ACPI_RDESC_TYPE_LARGE_VENDOR;
buffer += 1;
- temp16 = (u16) linked_list->data.vendor_specific.length;
+ temp16 = (u16) resource->data.vendor_specific.length;
ACPI_MOVE_16_TO_16(buffer, &temp16);
buffer += 2;
} else {
/* Small Item, Set the descriptor field */
- temp8 = 0x70;
- temp8 |= (u8) linked_list->data.vendor_specific.length;
+ temp8 = ACPI_RDESC_TYPE_SMALL_VENDOR;
+ temp8 |= (u8) resource->data.vendor_specific.length;
*buffer = temp8;
buffer += 1;
@@ -286,9 +450,8 @@ acpi_rs_vendor_stream(struct acpi_resource *linked_list,
/* Loop through all of the Vendor Specific fields */
- for (index = 0; index < linked_list->data.vendor_specific.length;
- index++) {
- temp8 = linked_list->data.vendor_specific.reserved[index];
+ for (index = 0; index < resource->data.vendor_specific.length; index++) {
+ temp8 = resource->data.vendor_specific.reserved[index];
*buffer = temp8;
buffer += 1;
@@ -341,7 +504,7 @@ acpi_rs_start_depend_fns_resource(u8 * byte_stream_buffer,
*bytes_consumed = (temp8 & 0x01) + 1;
- output_struct->id = ACPI_RSTYPE_START_DPF;
+ output_struct->type = ACPI_RSTYPE_START_DPF;
/* Point to Byte 1 if it is used */
@@ -421,7 +584,7 @@ acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer,
/* Fill out the structure */
- output_struct->id = ACPI_RSTYPE_END_DPF;
+ output_struct->type = ACPI_RSTYPE_END_DPF;
/* Set the Length parameter */
@@ -437,7 +600,7 @@ acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer,
*
* FUNCTION: acpi_rs_start_depend_fns_stream
*
- * PARAMETERS: linked_list - Pointer to the resource linked list
+ * PARAMETERS: Resource - Pointer to the resource linked list
* output_buffer - Pointer to the user's return buffer
* bytes_consumed - u32 pointer that is filled with
* the number of bytes of the
@@ -451,7 +614,7 @@ acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer,
******************************************************************************/
acpi_status
-acpi_rs_start_depend_fns_stream(struct acpi_resource *linked_list,
+acpi_rs_start_depend_fns_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed)
{
u8 *buffer = *output_buffer;
@@ -460,26 +623,25 @@ acpi_rs_start_depend_fns_stream(struct acpi_resource *linked_list,
ACPI_FUNCTION_TRACE("rs_start_depend_fns_stream");
/*
- * The descriptor field is set based upon whether a byte is needed
+ * The descriptor type field is set based upon whether a byte is needed
* to contain Priority data.
*/
if (ACPI_ACCEPTABLE_CONFIGURATION ==
- linked_list->data.start_dpf.compatibility_priority &&
+ resource->data.start_dpf.compatibility_priority &&
ACPI_ACCEPTABLE_CONFIGURATION ==
- linked_list->data.start_dpf.performance_robustness) {
- *buffer = 0x30;
+ resource->data.start_dpf.performance_robustness) {
+ *buffer = ACPI_RDESC_TYPE_START_DEPENDENT;
} else {
- *buffer = 0x31;
+ *buffer = ACPI_RDESC_TYPE_START_DEPENDENT | 0x01;
buffer += 1;
/* Set the Priority Byte Definition */
temp8 = 0;
- temp8 =
- (u8) ((linked_list->data.start_dpf.
- performance_robustness & 0x03) << 2);
- temp8 |=
- (linked_list->data.start_dpf.compatibility_priority & 0x03);
+ temp8 = (u8) ((resource->data.start_dpf.performance_robustness &
+ 0x03) << 2);
+ temp8 |= (resource->data.start_dpf.compatibility_priority &
+ 0x03);
*buffer = temp8;
}
@@ -495,7 +657,7 @@ acpi_rs_start_depend_fns_stream(struct acpi_resource *linked_list,
*
* FUNCTION: acpi_rs_end_depend_fns_stream
*
- * PARAMETERS: linked_list - Pointer to the resource linked list
+ * PARAMETERS: Resource - Pointer to the resource linked list
* output_buffer - Pointer to the user's return buffer
* bytes_consumed - Pointer to where the number of bytes
* used in the output_buffer is returned
@@ -508,16 +670,16 @@ acpi_rs_start_depend_fns_stream(struct acpi_resource *linked_list,
******************************************************************************/
acpi_status
-acpi_rs_end_depend_fns_stream(struct acpi_resource *linked_list,
+acpi_rs_end_depend_fns_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed)
{
u8 *buffer = *output_buffer;
ACPI_FUNCTION_TRACE("rs_end_depend_fns_stream");
- /* The descriptor field is static */
+ /* The Descriptor Type field is static */
- *buffer = 0x38;
+ *buffer = ACPI_RDESC_TYPE_END_DEPENDENT;
buffer += 1;
/* Return the number of bytes consumed in this operation */
diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c
index ee5a5c50919..1a87c4c7bd9 100644
--- a/drivers/acpi/resources/rsxface.c
+++ b/drivers/acpi/resources/rsxface.c
@@ -269,7 +269,7 @@ acpi_walk_resources(acpi_handle device_handle,
/* Walk the resource list */
for (;;) {
- if (!resource || resource->id == ACPI_RSTYPE_END_TAG) {
+ if (!resource || resource->type == ACPI_RSTYPE_END_TAG) {
break;
}
@@ -360,8 +360,8 @@ EXPORT_SYMBOL(acpi_set_current_resources);
*
* FUNCTION: acpi_resource_to_address64
*
- * PARAMETERS: resource - Pointer to a resource
- * out - Pointer to the users's return
+ * PARAMETERS: Resource - Pointer to a resource
+ * Out - Pointer to the users's return
* buffer (a struct
* struct acpi_resource_address64)
*
@@ -381,7 +381,7 @@ acpi_resource_to_address64(struct acpi_resource *resource,
struct acpi_resource_address16 *address16;
struct acpi_resource_address32 *address32;
- switch (resource->id) {
+ switch (resource->type) {
case ACPI_RSTYPE_ADDRESS16:
address16 = (struct acpi_resource_address16 *)&resource->data;
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c
index 0c5abc536c7..aa1dcd851f8 100644
--- a/drivers/acpi/utilities/utmisc.c
+++ b/drivers/acpi/utilities/utmisc.c
@@ -811,7 +811,7 @@ u8 *acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc)
while (buffer < end_buffer) {
buffer_byte = *buffer;
- if (buffer_byte & ACPI_RDESC_TYPE_MASK) {
+ if (buffer_byte & ACPI_RDESC_TYPE_LARGE) {
/* Large Descriptor - Length is next 2 bytes */
buffer += ((*(buffer + 1) | (*(buffer + 2) << 8)) + 3);
diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c
index 90134c56ece..e158b1b6313 100644
--- a/drivers/acpi/utilities/utmutex.c
+++ b/drivers/acpi/utilities/utmutex.c
@@ -214,7 +214,7 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
* the ACPI subsystem code.
*/
for (i = mutex_id; i < MAX_MUTEX; i++) {
- if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) {
+ if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) {
if (i == mutex_id) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Mutex [%s] already acquired by this thread [%X]\n",
@@ -313,7 +313,7 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
* the ACPI subsystem code.
*/
for (i = mutex_id; i < MAX_MUTEX; i++) {
- if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) {
+ if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) {
if (i == mutex_id) {
continue;
}
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h
index 427cff1a3f8..1427c5cf430 100644
--- a/include/acpi/acconfig.h
+++ b/include/acpi/acconfig.h
@@ -61,9 +61,9 @@
*
*/
-/* Version string */
+/* Current ACPICA subsystem version in YYYYMMDD format */
-#define ACPI_CA_VERSION 0x20050902
+#define ACPI_CA_VERSION 0x20050916
/*
* OS name, used for the _OS object. The _OS object is essentially obsolete,
diff --git a/include/acpi/acdisasm.h b/include/acpi/acdisasm.h
index 3d96dcb1bb4..759b4cff4f8 100644
--- a/include/acpi/acdisasm.h
+++ b/include/acpi/acdisasm.h
@@ -187,73 +187,73 @@ void acpi_dm_decode_attribute(u8 attribute);
* dmresrcl
*/
void
-acpi_dm_word_descriptor(struct asl_word_address_desc *resource,
+acpi_dm_word_descriptor(union asl_resource_desc *resource,
u32 length, u32 level);
void
-acpi_dm_dword_descriptor(struct asl_dword_address_desc *resource,
+acpi_dm_dword_descriptor(union asl_resource_desc *resource,
u32 length, u32 level);
void
-acpi_dm_extended_descriptor(struct asl_extended_address_desc *resource,
+acpi_dm_extended_descriptor(union asl_resource_desc *resource,
u32 length, u32 level);
void
-acpi_dm_qword_descriptor(struct asl_qword_address_desc *resource,
+acpi_dm_qword_descriptor(union asl_resource_desc *resource,
u32 length, u32 level);
void
-acpi_dm_memory24_descriptor(struct asl_memory_24_desc *resource,
+acpi_dm_memory24_descriptor(union asl_resource_desc *resource,
u32 length, u32 level);
void
-acpi_dm_memory32_descriptor(struct asl_memory_32_desc *resource,
+acpi_dm_memory32_descriptor(union asl_resource_desc *resource,
u32 length, u32 level);
void
-acpi_dm_fixed_mem32_descriptor(struct asl_fixed_memory_32_desc *resource,
- u32 length, u32 level);
+acpi_dm_fixed_memory32_descriptor(union asl_resource_desc *resource,
+ u32 length, u32 level);
void
-acpi_dm_generic_register_descriptor(struct asl_general_register_desc *resource,
+acpi_dm_generic_register_descriptor(union asl_resource_desc *resource,
u32 length, u32 level);
void
-acpi_dm_interrupt_descriptor(struct asl_extended_xrupt_desc *resource,
+acpi_dm_interrupt_descriptor(union asl_resource_desc *resource,
u32 length, u32 level);
void
-acpi_dm_vendor_large_descriptor(struct asl_large_vendor_desc *resource,
+acpi_dm_vendor_large_descriptor(union asl_resource_desc *resource,
u32 length, u32 level);
/*
* dmresrcs
*/
void
-acpi_dm_irq_descriptor(struct asl_irq_format_desc *resource,
+acpi_dm_irq_descriptor(union asl_resource_desc *resource,
u32 length, u32 level);
void
-acpi_dm_dma_descriptor(struct asl_dma_format_desc *resource,
+acpi_dm_dma_descriptor(union asl_resource_desc *resource,
u32 length, u32 level);
void
-acpi_dm_io_descriptor(struct asl_io_port_desc *resource, u32 length, u32 level);
+acpi_dm_io_descriptor(union asl_resource_desc *resource, u32 length, u32 level);
void
-acpi_dm_fixed_io_descriptor(struct asl_fixed_io_port_desc *resource,
+acpi_dm_fixed_io_descriptor(union asl_resource_desc *resource,
u32 length, u32 level);
void
-acpi_dm_start_dependent_descriptor(struct asl_start_dependent_desc *resource,
+acpi_dm_start_dependent_descriptor(union asl_resource_desc *resource,
u32 length, u32 level);
void
-acpi_dm_end_dependent_descriptor(struct asl_start_dependent_desc *resource,
+acpi_dm_end_dependent_descriptor(union asl_resource_desc *resource,
u32 length, u32 level);
void
-acpi_dm_vendor_small_descriptor(struct asl_small_vendor_desc *resource,
+acpi_dm_vendor_small_descriptor(union asl_resource_desc *resource,
u32 length, u32 level);
/*
diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h
index 9fba0fddda9..76ac1533c40 100644
--- a/include/acpi/aclocal.h
+++ b/include/acpi/aclocal.h
@@ -744,12 +744,13 @@ struct acpi_bit_register_info {
#define ACPI_RDESC_TYPE_LARGE 0x80
#define ACPI_RDESC_TYPE_SMALL 0x00
-#define ACPI_RDESC_TYPE_MASK 0x80
-#define ACPI_RDESC_SMALL_MASK 0x78 /* Only bits 6:3 contain the type */
+#define ACPI_RDESC_SMALL_MASK 0x78 /* Bits 6:3 contain the type */
+#define ACPI_RDESC_SMALL_LENGTH_MASK 0x07 /* Bits 2:0 contain the length */
+#define ACPI_RDESC_LARGE_MASK 0x7F /* Bits 6:0 contain the type */
/*
* Small resource descriptor types
- * Note: The 3 length bits (2:0) must be zero
+ * Note: Bits 2:0 are used for the descriptor length
*/
#define ACPI_RDESC_TYPE_IRQ_FORMAT 0x20
#define ACPI_RDESC_TYPE_DMA_FORMAT 0x28
@@ -757,6 +758,10 @@ struct acpi_bit_register_info {
#define ACPI_RDESC_TYPE_END_DEPENDENT 0x38
#define ACPI_RDESC_TYPE_IO_PORT 0x40
#define ACPI_RDESC_TYPE_FIXED_IO_PORT 0x48
+#define ACPI_RDESC_TYPE_RESERVED_S1 0x50
+#define ACPI_RDESC_TYPE_RESERVED_S2 0x58
+#define ACPI_RDESC_TYPE_RESERVED_S3 0x60
+#define ACPI_RDESC_TYPE_RESERVED_S4 0x68
#define ACPI_RDESC_TYPE_SMALL_VENDOR 0x70
#define ACPI_RDESC_TYPE_END_TAG 0x78
@@ -764,7 +769,8 @@ struct acpi_bit_register_info {
* Large resource descriptor types
*/
#define ACPI_RDESC_TYPE_MEMORY_24 0x81
-#define ACPI_RDESC_TYPE_GENERAL_REGISTER 0x82
+#define ACPI_RDESC_TYPE_GENERIC_REGISTER 0x82
+#define ACPI_RDESC_TYPE_RESERVED_L1 0x83
#define ACPI_RDESC_TYPE_LARGE_VENDOR 0x84
#define ACPI_RDESC_TYPE_MEMORY_32 0x85
#define ACPI_RDESC_TYPE_FIXED_MEMORY_32 0x86
@@ -773,6 +779,15 @@ struct acpi_bit_register_info {
#define ACPI_RDESC_TYPE_EXTENDED_XRUPT 0x89
#define ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE 0x8A
#define ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE 0x8B
+#define ACPI_RDESC_LARGE_MAX 0x8B
+
+/*
+ * Minimum lengths for descriptors with optional fields
+ */
+#define ACPI_RDESC_QWORD_MIN 43
+#define ACPI_RDESC_DWORD_MIN 23
+#define ACPI_RDESC_WORD_MIN 13
+#define ACPI_RDESC_EXT_XRUPT_MIN 6
/*****************************************************************************
*
diff --git a/include/acpi/acresrc.h b/include/acpi/acresrc.h
index 38e798b05d0..ce2cf72fd4c 100644
--- a/include/acpi/acresrc.h
+++ b/include/acpi/acresrc.h
@@ -110,7 +110,7 @@ acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer,
u32 byte_stream_buffer_length, u8 * output_buffer);
acpi_status
-acpi_rs_list_to_byte_stream(struct acpi_resource *linked_list,
+acpi_rs_list_to_byte_stream(struct acpi_resource *resource,
acpi_size byte_stream_size_needed,
u8 * output_buffer);
@@ -125,11 +125,11 @@ acpi_rs_fixed_io_resource(u8 * byte_stream_buffer,
u8 ** output_buffer, acpi_size * structure_size);
acpi_status
-acpi_rs_io_stream(struct acpi_resource *linked_list,
+acpi_rs_io_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed);
acpi_status
-acpi_rs_fixed_io_stream(struct acpi_resource *linked_list,
+acpi_rs_fixed_io_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed);
acpi_status
@@ -138,7 +138,7 @@ acpi_rs_irq_resource(u8 * byte_stream_buffer,
u8 ** output_buffer, acpi_size * structure_size);
acpi_status
-acpi_rs_irq_stream(struct acpi_resource *linked_list,
+acpi_rs_irq_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed);
acpi_status
@@ -147,7 +147,7 @@ acpi_rs_dma_resource(u8 * byte_stream_buffer,
u8 ** output_buffer, acpi_size * structure_size);
acpi_status
-acpi_rs_dma_stream(struct acpi_resource *linked_list,
+acpi_rs_dma_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed);
acpi_status
@@ -156,7 +156,7 @@ acpi_rs_address16_resource(u8 * byte_stream_buffer,
u8 ** output_buffer, acpi_size * structure_size);
acpi_status
-acpi_rs_address16_stream(struct acpi_resource *linked_list,
+acpi_rs_address16_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed);
acpi_status
@@ -165,7 +165,7 @@ acpi_rs_address32_resource(u8 * byte_stream_buffer,
u8 ** output_buffer, acpi_size * structure_size);
acpi_status
-acpi_rs_address32_stream(struct acpi_resource *linked_list,
+acpi_rs_address32_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed);
acpi_status
@@ -174,7 +174,7 @@ acpi_rs_address64_resource(u8 * byte_stream_buffer,
u8 ** output_buffer, acpi_size * structure_size);
acpi_status
-acpi_rs_address64_stream(struct acpi_resource *linked_list,
+acpi_rs_address64_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed);
acpi_status
@@ -190,12 +190,12 @@ acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer,
acpi_size * structure_size);
acpi_status
-acpi_rs_start_depend_fns_stream(struct acpi_resource *linked_list,
+acpi_rs_start_depend_fns_stream(struct acpi_resource *resource,
u8 ** output_buffer,
acpi_size * bytes_consumed);
acpi_status
-acpi_rs_end_depend_fns_stream(struct acpi_resource *linked_list,
+acpi_rs_end_depend_fns_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed);
acpi_status
@@ -204,7 +204,7 @@ acpi_rs_memory24_resource(u8 * byte_stream_buffer,
u8 ** output_buffer, acpi_size * structure_size);
acpi_status
-acpi_rs_memory24_stream(struct acpi_resource *linked_list,
+acpi_rs_memory24_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed);
acpi_status
@@ -220,11 +220,11 @@ acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer,
acpi_size * structure_size);
acpi_status
-acpi_rs_memory32_range_stream(struct acpi_resource *linked_list,
+acpi_rs_memory32_range_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed);
acpi_status
-acpi_rs_fixed_memory32_stream(struct acpi_resource *linked_list,
+acpi_rs_fixed_memory32_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed);
acpi_status
@@ -233,7 +233,7 @@ acpi_rs_extended_irq_resource(u8 * byte_stream_buffer,
u8 ** output_buffer, acpi_size * structure_size);
acpi_status
-acpi_rs_extended_irq_stream(struct acpi_resource *linked_list,
+acpi_rs_extended_irq_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed);
acpi_status
@@ -242,7 +242,7 @@ acpi_rs_end_tag_resource(u8 * byte_stream_buffer,
u8 ** output_buffer, acpi_size * structure_size);
acpi_status
-acpi_rs_end_tag_stream(struct acpi_resource *linked_list,
+acpi_rs_end_tag_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed);
acpi_status
@@ -251,9 +251,23 @@ acpi_rs_vendor_resource(u8 * byte_stream_buffer,
u8 ** output_buffer, acpi_size * structure_size);
acpi_status
-acpi_rs_vendor_stream(struct acpi_resource *linked_list,
+acpi_rs_vendor_stream(struct acpi_resource *resource,
u8 ** output_buffer, acpi_size * bytes_consumed);
u8 acpi_rs_get_resource_type(u8 resource_start_byte);
+/*
+ * rsmisc
+ */
+acpi_status
+acpi_rs_generic_register_resource(u8 * byte_stream_buffer,
+ acpi_size * bytes_consumed,
+ u8 ** output_buffer,
+ acpi_size * structure_size);
+
+acpi_status
+acpi_rs_generic_register_stream(struct acpi_resource *resource,
+ u8 ** output_buffer,
+ acpi_size * bytes_consumed);
+
#endif /* __ACRESRC_H__ */
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 6213b27516e..1dfa64fae4e 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -1125,6 +1125,14 @@ struct acpi_resource_ext_irq {
u32 interrupts[1];
};
+struct acpi_resource_generic_reg {
+ u32 space_id;
+ u32 bit_width;
+ u32 bit_offset;
+ u32 address_size;
+ u64 address;
+};
+
/* ACPI_RESOURCE_TYPEs */
#define ACPI_RSTYPE_IRQ 0
@@ -1142,6 +1150,8 @@ struct acpi_resource_ext_irq {
#define ACPI_RSTYPE_ADDRESS32 12
#define ACPI_RSTYPE_ADDRESS64 13
#define ACPI_RSTYPE_EXT_IRQ 14
+#define ACPI_RSTYPE_GENERIC_REG 15
+#define ACPI_RSTYPE_MAX 15
typedef u32 acpi_resource_type;
@@ -1161,10 +1171,11 @@ union acpi_resource_data {
struct acpi_resource_address32 address32;
struct acpi_resource_address64 address64;
struct acpi_resource_ext_irq extended_irq;
+ struct acpi_resource_generic_reg generic_reg;
};
struct acpi_resource {
- acpi_resource_type id;
+ acpi_resource_type type;
u32 length;
union acpi_resource_data data;
};
diff --git a/include/acpi/amlresrc.h b/include/acpi/amlresrc.h
index 051786e4b21..a3c46ba6358 100644
--- a/include/acpi/amlresrc.h
+++ b/include/acpi/amlresrc.h
@@ -157,10 +157,15 @@ struct asl_end_tag_desc {
/* LARGE descriptors */
+#define ASL_LARGE_HEADER_COMMON \
+ u8 descriptor_type;\
+ u16 length;
+
+struct asl_large_header {
+ASL_LARGE_HEADER_COMMON};
+
struct asl_memory_24_desc {
- u8 descriptor_type;
- u16 length;
- u8 information;
+ ASL_LARGE_HEADER_COMMON u8 information;
u16 address_min;
u16 address_max;
u16 alignment;
@@ -168,15 +173,11 @@ struct asl_memory_24_desc {
};
struct asl_large_vendor_desc {
- u8 descriptor_type;
- u16 length;
- u8 vendor_defined[1];
+ ASL_LARGE_HEADER_COMMON u8 vendor_defined[1];
};
struct asl_memory_32_desc {
- u8 descriptor_type;
- u16 length;
- u8 information;
+ ASL_LARGE_HEADER_COMMON u8 information;
u32 address_min;
u32 address_max;
u32 alignment;
@@ -184,17 +185,13 @@ struct asl_memory_32_desc {
};
struct asl_fixed_memory_32_desc {
- u8 descriptor_type;
- u16 length;
- u8 information;
+ ASL_LARGE_HEADER_COMMON u8 information;
u32 base_address;
u32 range_length;
};
struct asl_extended_address_desc {
- u8 descriptor_type;
- u16 length;
- u8 resource_type;
+ ASL_LARGE_HEADER_COMMON u8 resource_type;
u8 flags;
u8 specific_flags;
u8 revision_iD;
@@ -211,9 +208,7 @@ struct asl_extended_address_desc {
#define ASL_EXTENDED_ADDRESS_DESC_REVISION 1 /* ACPI 3.0 */
struct asl_qword_address_desc {
- u8 descriptor_type;
- u16 length;
- u8 resource_type;
+ ASL_LARGE_HEADER_COMMON u8 resource_type;
u8 flags;
u8 specific_flags;
u64 granularity;
@@ -225,9 +220,7 @@ struct asl_qword_address_desc {
};
struct asl_dword_address_desc {
- u8 descriptor_type;
- u16 length;
- u8 resource_type;
+ ASL_LARGE_HEADER_COMMON u8 resource_type;
u8 flags;
u8 specific_flags;
u32 granularity;
@@ -239,9 +232,7 @@ struct asl_dword_address_desc {
};
struct asl_word_address_desc {
- u8 descriptor_type;
- u16 length;
- u8 resource_type;
+ ASL_LARGE_HEADER_COMMON u8 resource_type;
u8 flags;
u8 specific_flags;
u16 granularity;
@@ -253,18 +244,14 @@ struct asl_word_address_desc {
};
struct asl_extended_xrupt_desc {
- u8 descriptor_type;
- u16 length;
- u8 flags;
+ ASL_LARGE_HEADER_COMMON u8 flags;
u8 table_length;
u32 interrupt_number[1];
/* res_source_index, res_source optional fields follow */
};
-struct asl_general_register_desc {
- u8 descriptor_type;
- u16 length;
- u8 address_space_id;
+struct asl_generic_register_desc {
+ ASL_LARGE_HEADER_COMMON u8 address_space_id;
u8 bit_width;
u8 bit_offset;
u8 access_size; /* ACPI 3.0, was Reserved */
@@ -280,13 +267,14 @@ struct asl_general_register_desc {
union asl_resource_desc {
struct asl_irq_format_desc irq;
struct asl_dma_format_desc dma;
- struct asl_start_dependent_desc std;
- struct asl_end_dependent_desc end;
struct asl_io_port_desc iop;
struct asl_fixed_io_port_desc fio;
+ struct asl_start_dependent_desc std;
+ struct asl_end_dependent_desc end;
struct asl_small_vendor_desc smv;
struct asl_end_tag_desc et;
+ struct asl_large_header lhd;
struct asl_memory_24_desc M24;
struct asl_large_vendor_desc lgv;
struct asl_memory_32_desc M32;
@@ -296,7 +284,7 @@ union asl_resource_desc {
struct asl_word_address_desc was;
struct asl_extended_address_desc eas;
struct asl_extended_xrupt_desc exx;
- struct asl_general_register_desc grg;
+ struct asl_generic_register_desc grg;
u32 u32_item;
u16 u16_item;
u8 U8item;
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index 16609c1ab2e..08539125696 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -68,6 +68,7 @@
#define ACPI_APPLICATION
#define ACPI_DEBUGGER
#define ACPI_DISASSEMBLER
+#define ACPI_MUTEX_DEBUG
#endif
#ifdef ACPI_ASL_COMPILER