summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2005-10-21 00:00:00 -0400
committerLen Brown <len.brown@intel.com>2005-12-10 00:22:54 -0500
commit0897831bb54eb36fd9e2a22da7f0f64be1b20d09 (patch)
tree8d77687ce8ebcfb62d6012d2d3c44f6a904b3c15
parent50eca3eb89d73d9f0aa070b126c7ee6a616016ab (diff)
[ACPI] ACPICA 20051021
Implemented support for the EM64T and other x86_64 processors. This essentially entails recognizing that these processors support non-aligned memory transfers. Previously, all 64-bit processors were assumed to lack hardware support for non-aligned transfers. Completed conversion of the Resource Manager to nearly full table-driven operation. Specifically, the resource conversion code (convert AML to internal format and the reverse) and the debug code to dump internal resource descriptors are fully table-driven, reducing code and data size and improving maintainability. The OSL interfaces for Acquire and Release Lock now use a 64-bit flag word on 64-bit processors instead of a fixed 32-bit word. (Alexey Starikovskiy) Implemented support within the resource conversion code for the Type-Specific byte within the various ACPI 3.0 *WordSpace macros. Fixed some issues within the resource conversion code for the type-specific flags for both Memory and I/O address resource descriptors. For Memory, implemented support for the MTP and TTP flags. For I/O, split the TRS and TTP flags into two separate fields. Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r--arch/ia64/pci/pci.c2
-rw-r--r--drivers/acpi/events/evgpe.c8
-rw-r--r--drivers/acpi/events/evgpeblk.c10
-rw-r--r--drivers/acpi/events/evxface.c4
-rw-r--r--drivers/acpi/executer/exmisc.c5
-rw-r--r--drivers/acpi/executer/exregion.c4
-rw-r--r--drivers/acpi/osl.c6
-rw-r--r--drivers/acpi/resources/rsaddr.c745
-rw-r--r--drivers/acpi/resources/rscalc.c71
-rw-r--r--drivers/acpi/resources/rsdump.c1207
-rw-r--r--drivers/acpi/resources/rsinfo.c115
-rw-r--r--drivers/acpi/resources/rsio.c333
-rw-r--r--drivers/acpi/resources/rsirq.c393
-rw-r--r--drivers/acpi/resources/rslist.c92
-rw-r--r--drivers/acpi/resources/rsmemory.c303
-rw-r--r--drivers/acpi/resources/rsmisc.c814
-rw-r--r--drivers/acpi/resources/rsutils.c269
-rw-r--r--drivers/acpi/resources/rsxface.c2
-rw-r--r--drivers/acpi/tables/tbutils.c5
-rw-r--r--drivers/acpi/utilities/utalloc.c2
-rw-r--r--drivers/acpi/utilities/utglobal.c64
-rw-r--r--drivers/acpi/utilities/utmisc.c146
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c12
-rw-r--r--include/acpi/acconfig.h2
-rw-r--r--include/acpi/acdisasm.h17
-rw-r--r--include/acpi/acmacros.h6
-rw-r--r--include/acpi/acpiosxf.h4
-rw-r--r--include/acpi/acresrc.h401
-rw-r--r--include/acpi/actypes.h183
-rw-r--r--include/acpi/acutils.h7
-rw-r--r--include/acpi/amlresrc.h14
-rw-r--r--include/acpi/platform/acenv.h11
32 files changed, 2275 insertions, 2982 deletions
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 25f923d050e..5536027da9d 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -195,7 +195,7 @@ add_io_space (struct pci_root_info *info, struct acpi_resource_address64 *addr)
min = addr->minimum;
max = min + addr->address_length - 1;
- if (addr->attribute.io.translation_attribute == ACPI_SPARSE_TRANSLATION)
+ if (addr->info.io.translation_type == ACPI_SPARSE_TRANSLATION)
sparse = 1;
space_nr = new_space(addr->translation_offset, sparse);
diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c
index f51c3b16c60..bdd86537738 100644
--- a/drivers/acpi/events/evgpe.c
+++ b/drivers/acpi/events/evgpe.c
@@ -372,14 +372,14 @@ struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
{
+ acpi_status status;
+ struct acpi_gpe_block_info *gpe_block;
+ struct acpi_gpe_register_info *gpe_register_info;
u32 int_status = ACPI_INTERRUPT_NOT_HANDLED;
u8 enabled_status_byte;
- struct acpi_gpe_register_info *gpe_register_info;
u32 status_reg;
u32 enable_reg;
- u32 flags;
- acpi_status status;
- struct acpi_gpe_block_info *gpe_block;
+ acpi_native_uint flags;
acpi_native_uint i;
acpi_native_uint j;
diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/events/evgpeblk.c
index b312eb33c43..7ca10c5f291 100644
--- a/drivers/acpi/events/evgpeblk.c
+++ b/drivers/acpi/events/evgpeblk.c
@@ -136,7 +136,7 @@ acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback)
struct acpi_gpe_block_info *gpe_block;
struct acpi_gpe_xrupt_info *gpe_xrupt_info;
acpi_status status = AE_OK;
- u32 flags;
+ acpi_native_uint flags;
ACPI_FUNCTION_TRACE("ev_walk_gpe_list");
@@ -479,7 +479,7 @@ static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32
struct acpi_gpe_xrupt_info *next_gpe_xrupt;
struct acpi_gpe_xrupt_info *gpe_xrupt;
acpi_status status;
- u32 flags;
+ acpi_native_uint flags;
ACPI_FUNCTION_TRACE("ev_get_gpe_xrupt_block");
@@ -553,7 +553,7 @@ static acpi_status
acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt)
{
acpi_status status;
- u32 flags;
+ acpi_native_uint flags;
ACPI_FUNCTION_TRACE("ev_delete_gpe_xrupt");
@@ -610,7 +610,7 @@ acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block,
struct acpi_gpe_block_info *next_gpe_block;
struct acpi_gpe_xrupt_info *gpe_xrupt_block;
acpi_status status;
- u32 flags;
+ acpi_native_uint flags;
ACPI_FUNCTION_TRACE("ev_install_gpe_block");
@@ -663,7 +663,7 @@ acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block,
acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block)
{
acpi_status status;
- u32 flags;
+ acpi_native_uint flags;
ACPI_FUNCTION_TRACE("ev_install_gpe_block");
diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c
index 43b33d19cdf..57d73299298 100644
--- a/drivers/acpi/events/evxface.c
+++ b/drivers/acpi/events/evxface.c
@@ -562,7 +562,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
struct acpi_gpe_event_info *gpe_event_info;
struct acpi_handler_info *handler;
acpi_status status;
- u32 flags;
+ acpi_native_uint flags;
ACPI_FUNCTION_TRACE("acpi_install_gpe_handler");
@@ -653,7 +653,7 @@ acpi_remove_gpe_handler(acpi_handle gpe_device,
struct acpi_gpe_event_info *gpe_event_info;
struct acpi_handler_info *handler;
acpi_status status;
- u32 flags;
+ acpi_native_uint flags;
ACPI_FUNCTION_TRACE("acpi_remove_gpe_handler");
diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c
index a3f4d72bedc..1899ab25139 100644
--- a/drivers/acpi/executer/exmisc.c
+++ b/drivers/acpi/executer/exmisc.c
@@ -625,9 +625,8 @@ acpi_ex_do_logical_op(u16 opcode,
/* Lexicographic compare: compare the data bytes */
- compare = ACPI_MEMCMP((const char *)operand0->buffer.pointer,
- (const char *)local_operand1->buffer.
- pointer,
+ compare = ACPI_MEMCMP(operand0->buffer.pointer,
+ local_operand1->buffer.pointer,
(length0 > length1) ? length1 : length0);
switch (opcode) {
diff --git a/drivers/acpi/executer/exregion.c b/drivers/acpi/executer/exregion.c
index 9a2f5bea3af..1897379b5f9 100644
--- a/drivers/acpi/executer/exregion.c
+++ b/drivers/acpi/executer/exregion.c
@@ -77,7 +77,7 @@ acpi_ex_system_memory_space_handler(u32 function,
struct acpi_mem_space_context *mem_info = region_context;
u32 length;
acpi_size window_size;
-#ifndef ACPI_MISALIGNED_TRANSFERS
+#ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED
u32 remainder;
#endif
@@ -109,7 +109,7 @@ acpi_ex_system_memory_space_handler(u32 function,
return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
}
-#ifndef ACPI_MISALIGNED_TRANSFERS
+#ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED
/*
* Hardware does not support non-aligned data transfers, we must verify
* the request.
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index e3cd0b16031..4ece850b2af 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -1058,11 +1058,9 @@ EXPORT_SYMBOL(max_cstate);
* Acquire a spinlock.
*
* handle is a pointer to the spinlock_t.
- * flags is *not* the result of save_flags - it is an ACPI-specific flag variable
- * that indicates whether we are at interrupt level.
*/
-unsigned long acpi_os_acquire_lock(acpi_handle handle)
+acpi_native_uint acpi_os_acquire_lock(acpi_handle handle)
{
unsigned long flags;
spin_lock_irqsave((spinlock_t *) handle, flags);
@@ -1073,7 +1071,7 @@ unsigned long acpi_os_acquire_lock(acpi_handle handle)
* Release a spinlock. See above.
*/
-void acpi_os_release_lock(acpi_handle handle, unsigned long flags)
+void acpi_os_release_lock(acpi_handle handle, acpi_native_uint flags)
{
spin_unlock_irqrestore((spinlock_t *) handle, flags);
}
diff --git a/drivers/acpi/resources/rsaddr.c b/drivers/acpi/resources/rsaddr.c
index 6f48ebf3304..4ac942badbc 100644
--- a/drivers/acpi/resources/rsaddr.c
+++ b/drivers/acpi/resources/rsaddr.c
@@ -47,683 +47,334 @@
#define _COMPONENT ACPI_RESOURCES
ACPI_MODULE_NAME("rsaddr")
-/* Local prototypes */
-static void
-acpi_rs_decode_general_flags(union acpi_resource_data *resource, u8 flags);
-
-static u8 acpi_rs_encode_general_flags(union acpi_resource_data *resource);
-
-static void
-acpi_rs_decode_specific_flags(union acpi_resource_data *resource, u8 flags);
-
-static u8 acpi_rs_encode_specific_flags(union acpi_resource_data *resource);
-
-static void
-acpi_rs_set_address_common(union aml_resource *aml,
- struct acpi_resource *resource);
-
-static u8
-acpi_rs_get_address_common(struct acpi_resource *resource,
- union aml_resource *aml);
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_rs_decode_general_flags
- *
- * PARAMETERS: Resource - Address resource data struct
- * Flags - Raw AML flag byte
- *
- * RETURN: Decoded flag bits in resource struct
- *
- * DESCRIPTION: Decode a general flag byte to an address resource struct
- *
- ******************************************************************************/
-
-static void
-acpi_rs_decode_general_flags(union acpi_resource_data *resource, u8 flags)
-{
- ACPI_FUNCTION_ENTRY();
-
- /* Producer / Consumer - flag bit[0] */
-
- resource->address.producer_consumer = (u32) (flags & 0x01);
-
- /* Decode (_DEC) - flag bit[1] */
-
- resource->address.decode = (u32) ((flags >> 1) & 0x01);
-
- /* Min Address Fixed (_MIF) - flag bit[2] */
-
- resource->address.min_address_fixed = (u32) ((flags >> 2) & 0x01);
-
- /* Max Address Fixed (_MAF) - flag bit[3] */
-
- resource->address.max_address_fixed = (u32) ((flags >> 3) & 0x01);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_rs_encode_general_flags
- *
- * PARAMETERS: Resource - Address resource data struct
- *
- * RETURN: Encoded general flag byte
- *
- * DESCRIPTION: Construct a general flag byte from an address resource struct
- *
- ******************************************************************************/
-
-static u8 acpi_rs_encode_general_flags(union acpi_resource_data *resource)
-{
- ACPI_FUNCTION_ENTRY();
-
- return ((u8)
-
- /* Producer / Consumer - flag bit[0] */
- ((resource->address.producer_consumer & 0x01) |
- /* Decode (_DEC) - flag bit[1] */
- ((resource->address.decode & 0x01) << 1) |
- /* Min Address Fixed (_MIF) - flag bit[2] */
- ((resource->address.min_address_fixed & 0x01) << 2) |
- /* Max Address Fixed (_MAF) - flag bit[3] */
- ((resource->address.max_address_fixed & 0x01) << 3))
- );
-}
-
/*******************************************************************************
*
- * FUNCTION: acpi_rs_decode_specific_flags
- *
- * PARAMETERS: Resource - Address resource data struct
- * Flags - Raw AML flag byte
- *
- * RETURN: Decoded flag bits in attribute struct
- *
- * DESCRIPTION: Decode a type-specific flag byte to an attribute struct.
- * Type-specific flags are only defined for the Memory and IO
- * resource types.
+ * acpi_rs_convert_address16 - All WORD (16-bit) address resources
*
******************************************************************************/
+struct acpi_rsconvert_info acpi_rs_convert_address16[5] = {
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_ADDRESS16,
+ ACPI_RS_SIZE(struct acpi_resource_address16),
+ ACPI_RSC_TABLE_SIZE(acpi_rs_convert_address16)},
-static void
-acpi_rs_decode_specific_flags(union acpi_resource_data *resource, u8 flags)
-{
- ACPI_FUNCTION_ENTRY();
-
- if (resource->address.resource_type == ACPI_MEMORY_RANGE) {
- /* Write Status (_RW) - flag bit[0] */
-
- resource->address.attribute.memory.read_write_attribute =
- (u16) (flags & 0x01);
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_ADDRESS16,
+ sizeof(struct aml_resource_address16),
+ 0},
- /* Memory Attributes (_MEM) - flag bits[2:1] */
+ /* Resource Type, General Flags, and Type-Specific Flags */
- resource->address.attribute.memory.cache_attribute =
- (u16) ((flags >> 1) & 0x03);
- } else if (resource->address.resource_type == ACPI_IO_RANGE) {
- /* Ranges (_RNG) - flag bits[1:0] */
-
- resource->address.attribute.io.range_attribute =
- (u16) (flags & 0x03);
-
- /* Translations (_TTP and _TRS) - flag bits[5:4] */
-
- resource->address.attribute.io.translation_attribute =
- (u16) ((flags >> 4) & 0x03);
- }
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_rs_encode_specific_flags
- *
- * PARAMETERS: Resource - Address resource data struct
- *
- * RETURN: Encoded type-specific flag byte
- *
- * DESCRIPTION: Construct a type-specific flag byte from an attribute struct.
- * Type-specific flags are only defined for the Memory and IO
- * resource types.
- *
- ******************************************************************************/
-
-static u8 acpi_rs_encode_specific_flags(union acpi_resource_data *resource)
-{
- ACPI_FUNCTION_ENTRY();
-
- if (resource->address.resource_type == ACPI_MEMORY_RANGE) {
- return ((u8)
-
- /* Write Status (_RW) - flag bit[0] */
- ((resource->address.attribute.memory.
- read_write_attribute & 0x01) |
- /* Memory Attributes (_MEM) - flag bits[2:1] */
- ((resource->address.attribute.memory.
- cache_attribute & 0x03) << 1)));
- } else if (resource->address.resource_type == ACPI_IO_RANGE) {
- return ((u8)
-
- /* Ranges (_RNG) - flag bits[1:0] */
- ((resource->address.attribute.io.
- range_attribute & 0x03) |
- /* Translations (_TTP and _TRS) - flag bits[5:4] */
- ((resource->address.attribute.io.
- translation_attribute & 0x03) << 4)));
- }
-
- return (0);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_rs_set_address_common
- *
- * PARAMETERS: Aml - Pointer to the AML resource descriptor
- * Resource - Pointer to the internal resource struct
- *
- * RETURN: None
- *
- * DESCRIPTION: Convert common flag fields from a resource descriptor to an
- * AML descriptor
- *
- ******************************************************************************/
-
-static void
-acpi_rs_set_address_common(union aml_resource *aml,
- struct acpi_resource *resource)
-{
- ACPI_FUNCTION_ENTRY();
-
- /* Set the Resource Type (Memory, Io, bus_number, etc.) */
-
- aml->address.resource_type = (u8) resource->data.address.resource_type;
-
- /* Set the general flags */
-
- aml->address.flags = acpi_rs_encode_general_flags(&resource->data);
-
- /* Set the type-specific flags */
-
- aml->address.specific_flags =
- acpi_rs_encode_specific_flags(&resource->data);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_rs_get_address_common
- *
- * PARAMETERS: Resource - Pointer to the internal resource struct
- * Aml - Pointer to the AML resource descriptor
- *
- * RETURN: TRUE if the resource_type field is OK, FALSE otherwise
- *
- * DESCRIPTION: Convert common flag fields from a raw AML resource descriptor
- * to an internal resource descriptor
- *
- ******************************************************************************/
-
-static u8
-acpi_rs_get_address_common(struct acpi_resource *resource,
- union aml_resource *aml)
-{
- ACPI_FUNCTION_ENTRY();
-
- /* Validate resource type */
-
- if ((aml->address.resource_type > 2)
- && (aml->address.resource_type < 0xC0)) {
- return (FALSE);
- }
-
- /* Get the Resource Type (Memory, Io, bus_number, etc.) */
-
- resource->data.address.resource_type = aml->address.resource_type;
-
- /* Get the General Flags */
-
- acpi_rs_decode_general_flags(&resource->data, aml->address.flags);
-
- /* Get the Type-Specific Flags */
-
- acpi_rs_decode_specific_flags(&resource->data,
- aml->address.specific_flags);
- return (TRUE);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_rs_get_address16
- *
- * PARAMETERS: Aml - Pointer to the AML resource descriptor
- * aml_resource_length - Length of the resource from the AML header
- * Resource - Where the internal resource is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
- * internal resource descriptor, simplifying bitflags and handling
- * alignment and endian issues if necessary.
- *
- ******************************************************************************/
-
-acpi_status
-acpi_rs_get_address16(union aml_resource * aml,
- u16 aml_resource_length, struct acpi_resource * resource)
-{
- ACPI_FUNCTION_TRACE("rs_get_address16");
-
- /* Get the Resource Type, general flags, and type-specific flags */
-
- if (!acpi_rs_get_address_common(resource, aml)) {
- return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
- }
+ {ACPI_RSC_ADDRESS, 0, 0, 0},
/*
- * Get the following contiguous fields from the AML descriptor:
+ * These fields are contiguous in both the source and destination:
* Address Granularity
* Address Range Minimum
* Address Range Maximum
* Address Translation Offset
* Address Length
*/
- acpi_rs_move_data(&resource->data.address16.granularity,
- &aml->address16.granularity, 5,
- ACPI_MOVE_TYPE_16_TO_32);
-
- /* Get the optional resource_source (index and string) */
-
- resource->length =
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16) +
- acpi_rs_get_resource_source(aml_resource_length,
- sizeof(struct aml_resource_address16),
- &resource->data.address16.
- resource_source, aml, NULL);
+ {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.address16.granularity),
+ AML_OFFSET(address16.granularity),
+ 5},
- /* Complete the resource header */
+ /* Optional resource_source (Index and String) */
- resource->type = ACPI_RESOURCE_TYPE_ADDRESS16;
- return_ACPI_STATUS(AE_OK);
-}
+ {ACPI_RSC_SOURCE, ACPI_RS_OFFSET(data.address16.resource_source),
+ 0,
+ sizeof(struct aml_resource_address16)}
+};
/*******************************************************************************
*
- * FUNCTION: acpi_rs_set_address16
- *
- * PARAMETERS: Resource - Pointer to the resource descriptor
- * Aml - Where the AML descriptor is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert an internal resource descriptor to the corresponding
- * external AML resource descriptor.
+ * acpi_rs_convert_address32 - All DWORD (32-bit) address resources
*
******************************************************************************/
-acpi_status
-acpi_rs_set_address16(struct acpi_resource *resource, union aml_resource *aml)
-{
- acpi_size descriptor_length;
+struct acpi_rsconvert_info acpi_rs_convert_address32[5] = {
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_ADDRESS32,
+ ACPI_RS_SIZE(struct acpi_resource_address32),
+ ACPI_RSC_TABLE_SIZE(acpi_rs_convert_address32)},
- ACPI_FUNCTION_TRACE("rs_set_address16");
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_ADDRESS32,
+ sizeof(struct aml_resource_address32),
+ 0},
- /* Set the Resource Type, General Flags, and Type-Specific Flags */
+ /* Resource Type, General Flags, and Type-Specific Flags */
- acpi_rs_set_address_common(aml, resource);
+ {ACPI_RSC_ADDRESS, 0, 0, 0},
/*
- * Set the following contiguous fields in the AML descriptor:
+ * These fields are contiguous in both the source and destination:
* Address Granularity
* Address Range Minimum
* Address Range Maximum
* Address Translation Offset
* Address Length
*/
- acpi_rs_move_data(&aml->address16.granularity,
- &resource->data.address16.granularity, 5,
- ACPI_MOVE_TYPE_32_TO_16);
-
- /* Resource Source Index and Resource Source are optional */
+ {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.address32.granularity),
+ AML_OFFSET(address32.granularity),
+ 5},
- descriptor_length = acpi_rs_set_resource_source(aml,
- sizeof(struct
- aml_resource_address16),
- &resource->data.
- address16.
- resource_source);
+ /* Optional resource_source (Index and String) */
- /* Complete the AML descriptor header */
-
- acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_ADDRESS16,
- descriptor_length, aml);
- return_ACPI_STATUS(AE_OK);
-}
+ {ACPI_RSC_SOURCE, ACPI_RS_OFFSET(data.address32.resource_source),
+ 0,
+ sizeof(struct aml_resource_address32)}
+};
/*******************************************************************************
*
- * FUNCTION: acpi_rs_get_address32
- *
- * PARAMETERS: Aml - Pointer to the AML resource descriptor
- * aml_resource_length - Length of the resource from the AML header
- * Resource - Where the internal resource is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
- * internal resource descriptor, simplifying bitflags and handling
- * alignment and endian issues if necessary.
+ * acpi_rs_convert_address64 - All QWORD (64-bit) address resources
*
******************************************************************************/
-acpi_status
-acpi_rs_get_address32(union aml_resource *aml,
- u16 aml_resource_length, struct acpi_resource *resource)
-{
+struct acpi_rsconvert_info acpi_rs_convert_address64[5] = {
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_ADDRESS64,
+ ACPI_RS_SIZE(struct acpi_resource_address64),
+ ACPI_RSC_TABLE_SIZE(acpi_rs_convert_address64)},
- ACPI_FUNCTION_TRACE("rs_get_address32");
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_ADDRESS64,
+ sizeof(struct aml_resource_address64),
+ 0},
- /* Get the Resource Type, general flags, and type-specific flags */
+ /* Resource Type, General Flags, and Type-Specific Flags */
- if (!acpi_rs_get_address_common(resource, (void *)aml)) {
- return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
- }
+ {ACPI_RSC_ADDRESS, 0, 0, 0},
/*
- * Get the following contiguous fields from the AML descriptor:
+ * These fields are contiguous in both the source and destination:
* Address Granularity
* Address Range Minimum
* Address Range Maximum
* Address Translation Offset
* Address Length
*/
- acpi_rs_move_data(&resource->data.address32.granularity,
- &aml->address32.granularity, 5,
- ACPI_MOVE_TYPE_32_TO_32);
+ {ACPI_RSC_MOVE64, ACPI_RS_OFFSET(data.address64.granularity),
+ AML_OFFSET(address64.granularity),
+ 5},
- /* Get the optional resource_source (index and string) */
+ /* Optional resource_source (Index and String) */
- resource->length =
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32) +
- acpi_rs_get_resource_source(aml_resource_length,
- sizeof(struct aml_resource_address32),
- &resource->data.address32.
- resource_source, aml, NULL);
-
- /* Complete the resource header */
-
- resource->type = ACPI_RESOURCE_TYPE_ADDRESS32;
- return_ACPI_STATUS(AE_OK);
-}
+ {ACPI_RSC_SOURCE, ACPI_RS_OFFSET(data.address64.resource_source),
+ 0,
+ sizeof(struct aml_resource_address64)}
+};
/*******************************************************************************
*
- * FUNCTION: acpi_rs_set_address32
- *
- * PARAMETERS: Resource - Pointer to the resource descriptor
- * Aml - Where the AML descriptor is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert an internal resource descriptor to the corresponding
- * external AML resource descriptor.
+ * acpi_rs_convert_ext_address64 - All Extended (64-bit) address resources
*
******************************************************************************/
-acpi_status
-acpi_rs_set_address32(struct acpi_resource *resource, union aml_resource *aml)
-{
- acpi_size descriptor_length;
+struct acpi_rsconvert_info acpi_rs_convert_ext_address64[5] = {
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64,
+ ACPI_RS_SIZE(struct acpi_resource_extended_address64),
+ ACPI_RSC_TABLE_SIZE(acpi_rs_convert_ext_address64)},
+
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64,
+ sizeof(struct aml_resource_extended_address64),
+ 0},
- ACPI_FUNCTION_TRACE("rs_set_address32");
+ /* Resource Type, General Flags, and Type-Specific Flags */
- /* Set the Resource Type, General Flags, and Type-Specific Flags */
+ {ACPI_RSC_ADDRESS, 0, 0, 0},
- acpi_rs_set_address_common(aml, resource);
+ /* Revision ID */
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.ext_address64.revision_iD),
+ AML_OFFSET(ext_address64.revision_iD),
+ 1},
/*
- * Set the following contiguous fields in the AML descriptor:
+ * These fields are contiguous in both the source and destination:
* Address Granularity
* Address Range Minimum
* Address Range Maximum
* Address Translation Offset
* Address Length
+ * Type-Specific Attribute
*/
- acpi_rs_move_data(&aml->address32.granularity,
- &resource->data.address32.granularity, 5,
- ACPI_MOVE_TYPE_32_TO_32);
-
- /* Resource Source Index and Resource Source are optional */
-
- descriptor_length = acpi_rs_set_resource_source(aml,
- sizeof(struct
- aml_resource_address32),
- &resource->data.
- address32.
- resource_source);
-
- /* Complete the AML descriptor header */
-
- acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_ADDRESS32,
- descriptor_length, aml);
- return_ACPI_STATUS(AE_OK);
-}
+ {ACPI_RSC_MOVE64, ACPI_RS_OFFSET(data.ext_address64.granularity),
+ AML_OFFSET(ext_address64.granularity),
+ 6}
+};
/*******************************************************************************
*
- * FUNCTION: acpi_rs_get_address64
- *
- * PARAMETERS: Aml - Pointer to the AML resource descriptor
- * aml_resource_length - Length of the resource from the AML header
- * Resource - Where the internal resource is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
- * internal resource descriptor, simplifying bitflags and handling
- * alignment and endian issues if necessary.
+ * acpi_rs_convert_general_flags - Flags common to all address descriptors
*
******************************************************************************/
-acpi_status
-acpi_rs_get_address64(union aml_resource *aml,
- u16 aml_resource_length, struct acpi_resource *resource)
-{
- ACPI_FUNCTION_TRACE("rs_get_address64");
+static struct acpi_rsconvert_info acpi_rs_convert_general_flags[6] = {
+ {ACPI_RSC_FLAGINIT, 0, AML_OFFSET(address.flags),
+ ACPI_RSC_TABLE_SIZE(acpi_rs_convert_general_flags)},
- /* Get the Resource Type, general Flags, and type-specific Flags */
+ /* Resource Type (Memory, Io, bus_number, etc.) */
- if (!acpi_rs_get_address_common(resource, aml)) {
- return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
- }
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.address.resource_type),
+ AML_OFFSET(address.resource_type),
+ 1},
- /*
- * Get the following contiguous fields from the AML descriptor:
- * Address Granularity
- * Address Range Minimum
- * Address Range Maximum
- * Address Translation Offset
- * Address Length
- */
- acpi_rs_move_data(&resource->data.address64.granularity,
- &aml->address64.granularity, 5,
- ACPI_MOVE_TYPE_64_TO_64);
+ /* General Flags - Consume, Decode, min_fixed, max_fixed */
- /* Get the optional resource_source (index and string) */
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.producer_consumer),
+ AML_OFFSET(address.flags),
+ 0},
- resource->length =
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64) +
- acpi_rs_get_resource_source(aml_resource_length,
- sizeof(struct aml_resource_address64),
- &resource->data.address64.
- resource_source, aml, NULL);
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.decode),
+ AML_OFFSET(address.flags),
+ 1},
- /* Complete the resource header */
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.min_address_fixed),
+ AML_OFFSET(address.flags),
+ 2},
- resource->type = ACPI_RESOURCE_TYPE_ADDRESS64;
- return_ACPI_STATUS(AE_OK);
-}
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.max_address_fixed),
+ AML_OFFSET(address.flags),
+ 3}
+};
/*******************************************************************************
*
- * FUNCTION: acpi_rs_set_address64
- *
- * PARAMETERS: Resource - Pointer to the resource descriptor
- * Aml - Where the AML descriptor is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert an internal resource descriptor to the corresponding
- * external AML resource descriptor.
+ * acpi_rs_convert_mem_flags - Flags common to Memory address descriptors
*
******************************************************************************/
-acpi_status
-acpi_rs_set_address64(struct acpi_resource *resource, union aml_resource *aml)
-{
- acpi_size descriptor_length;
+static struct acpi_rsconvert_info acpi_rs_convert_mem_flags[5] = {
+ {ACPI_RSC_FLAGINIT, 0, AML_OFFSET(address.specific_flags),
+ ACPI_RSC_TABLE_SIZE(acpi_rs_convert_mem_flags)},
- ACPI_FUNCTION_TRACE("rs_set_address64");
+ /* Memory-specific flags */
- /* Set the Resource Type, General Flags, and Type-Specific Flags */
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.info.mem.write_protect),
+ AML_OFFSET(address.specific_flags),
+ 0},
- acpi_rs_set_address_common(aml, resource);
+ {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.address.info.mem.caching),
+ AML_OFFSET(address.specific_flags),
+ 1},
- /*
- * Set the following contiguous fields in the AML descriptor:
- * Address Granularity
- * Address Range Minimum
- * Address Range Maximum
- * Address Translation Offset
- * Address Length
- */
- acpi_rs_move_data(&aml->address64.granularity,
- &resource->data.address64.granularity, 5,
- ACPI_MOVE_TYPE_64_TO_64);
+ {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.address.info.mem.range_type),
+ AML_OFFSET(address.specific_flags),
+ 3},
+
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.info.mem.translation),
+ AML_OFFSET(address.specific_flags),
+ 5}
+};
+
+/*******************************************************************************
+ *
+ * acpi_rs_convert_io_flags - Flags common to I/O address descriptors
+ *
+ ******************************************************************************/
- /* Resource Source Index and Resource Source are optional */
+static struct acpi_rsconvert_info acpi_rs_convert_io_flags[4] = {
+ {ACPI_RSC_FLAGINIT, 0, AML_OFFSET(address.specific_flags),
+ ACPI_RSC_TABLE_SIZE(acpi_rs_convert_io_flags)},
- descriptor_length = acpi_rs_set_resource_source(aml,
- sizeof(struct
- aml_resource_address64),
- &resource->data.
- address64.
- resource_source);
+ /* I/O-specific flags */
- /* Complete the AML descriptor header */
+ {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.address.info.io.range_type),
+ AML_OFFSET(address.specific_flags),
+ 0},
- acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_ADDRESS64,
- descriptor_length, aml);
- return_ACPI_STATUS(AE_OK);
-}
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.info.io.translation),
+ AML_OFFSET(address.specific_flags),
+ 4},
+
+ {ACPI_RSC_1BITFLAG,
+ ACPI_RS_OFFSET(data.address.info.io.translation_type),
+ AML_OFFSET(address.specific_flags),
+ 5}
+};
/*******************************************************************************
*
- * FUNCTION: acpi_rs_get_ext_address64
+ * FUNCTION: acpi_rs_get_address_common
*
- * PARAMETERS: Aml - Pointer to the AML resource descriptor
- * aml_resource_length - Length of the resource from the AML header
- * Resource - Where the internal resource is returned
+ * PARAMETERS: Resource - Pointer to the internal resource struct
+ * Aml - Pointer to the AML resource descriptor
*
- * RETURN: Status
+ * RETURN: TRUE if the resource_type field is OK, FALSE otherwise
*
- * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
- * internal resource descriptor, simplifying bitflags and handling
- * alignment and endian issues if necessary.
+ * DESCRIPTION: Convert common flag fields from a raw AML resource descriptor
+ * to an internal resource descriptor
*
******************************************************************************/
-acpi_status
-acpi_rs_get_ext_address64(union aml_resource *aml,
- u16 aml_resource_length,
- struct acpi_resource *resource)
+u8
+acpi_rs_get_address_common(struct acpi_resource *resource,
+ union aml_resource *aml)
{
+ ACPI_FUNCTION_ENTRY();
- ACPI_FUNCTION_TRACE("rs_get_ext_address64");
-
- /* Get the Resource Type, general flags, and type-specific flags */
+ /* Validate the Resource Type */
- if (!acpi_rs_get_address_common(resource, aml)) {
- return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
+ if ((aml->address.resource_type > 2)
+ && (aml->address.resource_type < 0xC0)) {
+ return (FALSE);
}
- /*
- * Get and validate the Revision ID
- * Note: Only one revision ID is currently supported
- */
- resource->data.ext_address64.revision_iD =
- aml->ext_address64.revision_iD;
- if (aml->ext_address64.revision_iD !=
- AML_RESOURCE_EXTENDED_ADDRESS_REVISION) {
- return_ACPI_STATUS(AE_SUPPORT);
- }
+ /* Get the Resource Type and General Flags */
- /*
- * Get the following contiguous fields from the AML descriptor:
- * Address Granularity
- * Address Range Minimum
- * Address Range Maximum
- * Address Translation Offset
- * Address Length
- * Type-Specific Attribute
- */
- acpi_rs_move_data(&resource->data.ext_address64.granularity,
- &aml->ext_address64.granularity, 6,
- ACPI_MOVE_TYPE_64_TO_64);
+ (void)acpi_rs_convert_aml_to_resource(resource, aml,
+ acpi_rs_convert_general_flags);
+
+ /* Get the Type-Specific Flags (Memory and I/O descriptors only) */
- /* Complete the resource header */
+ if (resource->data.address.resource_type == ACPI_MEMORY_RANGE) {
+ (void)acpi_rs_convert_aml_to_resource(resource, aml,
+ acpi_rs_convert_mem_flags);
+ } else if (resource->data.address.resource_type == ACPI_IO_RANGE) {
+ (void)acpi_rs_convert_aml_to_resource(resource, aml,
+ acpi_rs_convert_io_flags);
+ } else {
+ /* Generic resource type, just grab the type_specific byte */
- resource->type = ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64;
- resource->length =
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_extended_address64);
- return_ACPI_STATUS(AE_OK);
+ resource->data.address.info.type_specific =
+ aml->address.specific_flags;
+ }
+
+ return (TRUE);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_set_ext_address64
+ * FUNCTION: acpi_rs_set_address_common
*
- * PARAMETERS: Resource - Pointer to the resource descriptor
- * Aml - Where the AML descriptor is returned
+ * PARAMETERS: Aml - Pointer to the AML resource descriptor
+ * Resource - Pointer to the internal resource struct
*
- * RETURN: Status
+ * RETURN: None
*
- * DESCRIPTION: Convert an internal resource descriptor to the corresponding
- * external AML resource descriptor.
+ * DESCRIPTION: Convert common flag fields from a resource descriptor to an
+ * AML descriptor
*
******************************************************************************/
-acpi_status
-acpi_rs_set_ext_address64(struct acpi_resource *resource,
- union aml_resource *aml)
+void
+acpi_rs_set_address_common(union aml_resource *aml,
+ struct acpi_resource *resource)
{
- ACPI_FUNCTION_TRACE("rs_set_ext_address64");
+ ACPI_FUNCTION_ENTRY();
- /* Set the Resource Type, General Flags, and Type-Specific Flags */
+ /* Set the Resource Type and General Flags */
- acpi_rs_set_address_common(aml, resource);
+ (void)acpi_rs_convert_resource_to_aml(resource, aml,
+ acpi_rs_convert_general_flags);
- /* Only one Revision ID is currently supported */
+ /* Set the Type-Specific Flags (Memory and I/O descriptors only) */
- aml->ext_address64.revision_iD = AML_RESOURCE_EXTENDED_ADDRESS_REVISION;
- aml->ext_address64.reserved = 0;
+ if (resource->data.address.resource_type == ACPI_MEMORY_RANGE) {
+ (void)acpi_rs_convert_resource_to_aml(resource, aml,
+ acpi_rs_convert_mem_flags);
+ } else if (resource->data.address.resource_type == ACPI_IO_RANGE) {
+ (void)acpi_rs_convert_resource_to_aml(resource, aml,
+ acpi_rs_convert_io_flags);
+ } else {
+ /* Generic resource type, just copy the type_specific byte */
- /*
- * Set the following contiguous fields in the AML descriptor:
- * Address Granularity
- * Address Range Minimum
- * Address Range Maximum
- * Address Translation Offset
- * Address Length
- * Type-Specific Attribute
- */
- acpi_rs_move_data(&aml->ext_address64.granularity,
- &resource->data.address64.granularity, 6,
- ACPI_MOVE_TYPE_64_TO_64);
-
- /* Complete the AML descriptor header */
-
- acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64,
- sizeof(struct
- aml_resource_extended_address64),
- aml);
- return_ACPI_STATUS(AE_OK);
+ aml->address.specific_flags =
+ resource->data.address.info.type_specific;
+ }
}
diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c
index d170dee07ce..c29d3a44727 100644
--- a/drivers/acpi/resources/rscalc.c
+++ b/drivers/acpi/resources/rscalc.c
@@ -52,7 +52,7 @@ ACPI_MODULE_NAME("rscalc")
/* Local prototypes */
static u8 acpi_rs_count_set_bits(u16 bit_field);
-static acpi_size
+static acpi_rs_length
acpi_rs_struct_option_length(struct acpi_resource_source *resource_source);
static u32
@@ -100,7 +100,7 @@ static u8 acpi_rs_count_set_bits(u16 bit_field)
*
******************************************************************************/
-static acpi_size
+static acpi_rs_length
acpi_rs_struct_option_length(struct acpi_resource_source *resource_source)
{
ACPI_FUNCTION_ENTRY();
@@ -111,7 +111,7 @@ acpi_rs_struct_option_length(struct acpi_resource_source *resource_source)
* resource_source_index (1).
*/
if (resource_source->string_ptr) {
- return ((acpi_size) resource_source->string_length + 1);
+ return ((acpi_rs_length) (resource_source->string_length + 1));
}
return (0);
@@ -184,7 +184,7 @@ acpi_status
acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed)
{
acpi_size aml_size_needed = 0;
- acpi_size segment_size;
+ acpi_rs_length total_size;
ACPI_FUNCTION_TRACE("rs_get_aml_length");
@@ -199,7 +199,7 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed)
/* Get the base size of the (external stream) resource descriptor */
- segment_size = acpi_gbl_aml_resource_sizes[resource->type];
+ total_size = acpi_gbl_aml_resource_sizes[resource->type];
/*
* Augment the base size for descriptors with optional and/or
@@ -216,13 +216,14 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed)
if (resource->data.vendor.byte_length > 7) {
/* Base size of a Large resource descriptor */
- segment_size =
+ total_size =
sizeof(struct aml_resource_large_header);
}
/* Add the size of the vendor-specific data */
- segment_size += resource->data.vendor.byte_length;
+ total_size = (acpi_rs_length)
+ (total_size + resource->data.vendor.byte_length);
break;
case ACPI_RESOURCE_TYPE_END_TAG:
@@ -230,7 +231,7 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed)
* End Tag:
* We are done -- return the accumulated total size.
*/
- *size_needed = aml_size_needed + segment_size;
+ *size_needed = aml_size_needed + total_size;
/* Normal exit */
@@ -241,10 +242,11 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed)
* 16-Bit Address Resource:
* Add the size of the optional resource_source info
*/
- segment_size +=
- acpi_rs_struct_option_length(&resource->data.
- address16.
- resource_source);
+ total_size = (acpi_rs_length)
+ (total_size +
+ acpi_rs_struct_option_length(&resource->data.
+ address16.
+ resource_source));
break;
case ACPI_RESOURCE_TYPE_ADDRESS32:
@@ -252,10 +254,11 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed)
* 32-Bit Address Resource:
* Add the size of the optional resource_source info
*/
- segment_size +=
- acpi_rs_struct_option_length(&resource->data.
- address32.
- resource_source);
+ total_size = (acpi_rs_length)
+ (total_size +
+ acpi_rs_struct_option_length(&resource->data.
+ address32.
+ resource_source));
break;
case ACPI_RESOURCE_TYPE_ADDRESS64:
@@ -263,10 +266,11 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed)
* 64-Bit Address Resource:
* Add the size of the optional resource_source info
*/
- segment_size +=
- acpi_rs_struct_option_length(&resource->data.
- address64.
- resource_source);
+ total_size = (acpi_rs_length)
+ (total_size +
+ acpi_rs_struct_option_length(&resource->data.
+ address64.
+ resource_source));
break;
case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
@@ -275,16 +279,14 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed)
* Add the size of each additional optional interrupt beyond the
* required 1 (4 bytes for each u32 interrupt number)
*/
- segment_size += (((acpi_size)
- resource->data.extended_irq.
- interrupt_count - 1) * 4);
-
- /* Add the size of the optional resource_source info */
-
- segment_size +=
- acpi_rs_struct_option_length(&resource->data.
- extended_irq.
- resource_source);
+ total_size = (acpi_rs_length)
+ (total_size +
+ ((resource->data.extended_irq.interrupt_count -
+ 1) * 4) +
+ /* Add the size of the optional resource_source info */
+ acpi_rs_struct_option_length(&resource->data.
+ extended_irq.
+ resource_source));
break;
default:
@@ -293,7 +295,7 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed)
/* Update the total */
- aml_size_needed += segment_size;
+ aml_size_needed += total_size;
/* Point to the next object */
@@ -341,7 +343,7 @@ acpi_rs_get_list_length(u8 * aml_buffer,
while (bytes_parsed < aml_buffer_length) {
/* The next byte in the stream is the resource descriptor type */
- resource_type = acpi_rs_get_resource_type(*aml_buffer);
+ resource_type = acpi_ut_get_resource_type(aml_buffer);
/* Get the base stream size and structure sizes for the descriptor */
@@ -352,10 +354,7 @@ acpi_rs_get_list_length(u8 * aml_buffer,
/* Get the Length field from the input resource descriptor */
- resource_length =
- acpi_rs_get_resource_length(ACPI_CAST_PTR
- (union aml_resource,
- aml_buffer));
+ resource_length = acpi_ut_get_resource_length(aml_buffer);
/* Augment the size for descriptors with optional fields */
diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c
index 2f8990845b2..27172a3d55d 100644
--- a/drivers/acpi/resources/rsdump.c
+++ b/drivers/acpi/resources/rsdump.c
@@ -43,6 +43,7 @@
#include <acpi/acpi.h>
#include <acpi/acresrc.h>
+#include <acpi/acdisasm.h>
#define _COMPONENT ACPI_RESOURCES
ACPI_MODULE_NAME("rsdump")
@@ -61,108 +62,448 @@ 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_byte_list(u16 length, u8 * data);
-static void acpi_rs_dump_dword_list(u32 length, u32 * data);
+static void acpi_rs_dump_dword_list(u8 length, u32 * data);
-static void acpi_rs_dump_short_byte_list(u32 length, u32 * data);
+static void acpi_rs_dump_short_byte_list(u8 length, u8 * 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);
+static void
+acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table);
+
+#define ACPI_RSD_OFFSET(f) (u8) ACPI_OFFSET (union acpi_resource_data,f)
+#define ACPI_PRT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_pci_routing_table,f)
+#define ACPI_RSD_TABLE_SIZE(name) (sizeof(name) / sizeof (struct acpi_rsdump_info))
+
/*******************************************************************************
*
- * FUNCTION: acpi_rs_out*
- *
- * PARAMETERS: Title - Name of the resource field
- * Value - Value of the resource field
- *
- * RETURN: None
+ * Resource Descriptor info tables
*
- * DESCRIPTION: Miscellaneous helper functions to consistently format the
- * output of the resource dump routines
+ * Note: The first table entry must be a Title or Literal and must contain
+ * the table length (number of table entries)
*
******************************************************************************/
-static void acpi_rs_out_string(char *title, char *value)
-{
- acpi_os_printf("%27s : %s\n", title, value);
-}
+struct acpi_rsdump_info acpi_rs_dump_irq[6] = {
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_irq), "IRQ", NULL},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.triggering), "Triggering",
+ acpi_gbl_HEdecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.polarity), "Polarity",
+ acpi_gbl_LLdecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.sharable), "Sharing",
+ acpi_gbl_SHRdecode},
+ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(irq.interrupt_count),
+ "Interrupt Count", NULL},
+ {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(irq.interrupts[0]),
+ "Interrupt List", NULL}
+};
+
+struct acpi_rsdump_info acpi_rs_dump_dma[6] = {
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_dma), "DMA", NULL},
+ {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.type), "Speed",
+ acpi_gbl_TYPdecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(dma.bus_master), "Mastering",
+ acpi_gbl_BMdecode},
+ {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.transfer), "Transfer Type",
+ acpi_gbl_SIZdecode},
+ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(dma.channel_count), "Channel Count",
+ NULL},
+ {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(dma.channels[0]), "Channel List",
+ NULL}
+};
+
+struct acpi_rsdump_info acpi_rs_dump_start_dpf[3] = {
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_start_dpf),
+ "Start-Dependent-Functions", NULL},
+ {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(start_dpf.compatibility_priority),
+ "Compatibility Priority", acpi_gbl_config_decode},
+ {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(start_dpf.performance_robustness),
+ "Performance/Robustness", acpi_gbl_config_decode}
+};
+
+struct acpi_rsdump_info acpi_rs_dump_end_dpf[1] = {
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_dpf),
+ "End-Dependent-Functions", NULL}
+};
+
+struct acpi_rsdump_info acpi_rs_dump_io[6] = {
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io), "I/O", NULL},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(io.io_decode), "Address Decoding",
+ acpi_gbl_io_decode},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(io.minimum), "Address Minimum", NULL},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(io.maximum), "Address Maximum", NULL},
+ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(io.alignment), "Alignment", NULL},
+ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(io.address_length), "Address Length",
+ NULL}
+};
+
+struct acpi_rsdump_info acpi_rs_dump_fixed_io[3] = {
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_io),
+ "Fixed I/O", NULL},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(fixed_io.address), "Address", NULL},
+ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(fixed_io.address_length),
+ "Address Length", NULL}
+};
+
+struct acpi_rsdump_info acpi_rs_dump_vendor[3] = {
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_vendor),
+ "Vendor Specific", NULL},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(vendor.byte_length), "Length", NULL},
+ {ACPI_RSD_LONGLIST, ACPI_RSD_OFFSET(vendor.byte_data[0]), "Vendor Data",
+ NULL}
+};
+
+struct acpi_rsdump_info acpi_rs_dump_end_tag[1] = {
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_tag), "end_tag",
+ NULL}
+};
+
+struct acpi_rsdump_info acpi_rs_dump_memory24[6] = {
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory24),
+ "24-Bit Memory Range", NULL},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory24.write_protect),
+ "Write Protect", acpi_gbl_RWdecode},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.minimum), "Address Minimum",
+ NULL},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.maximum), "Address Maximum",
+ NULL},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.alignment), "Alignment",
+ NULL},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.address_length),
+ "Address Length", NULL}
+};
+
+struct acpi_rsdump_info acpi_rs_dump_memory32[6] = {
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory32),
+ "32-Bit Memory Range", NULL},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory32.write_protect),
+ "Write Protect", acpi_gbl_RWdecode},
+ {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.minimum), "Address Minimum",
+ NULL},
+ {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.maximum), "Address Maximum",
+ NULL},
+ {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.alignment), "Alignment",
+ NULL},
+ {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.address_length),
+ "Address Length", NULL}
+};
+
+struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[4] = {
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_memory32),
+ "32-Bit Fixed Memory Range", NULL},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(fixed_memory32.write_protect),
+ "Write Protect", acpi_gbl_RWdecode},
+ {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address), "Address",
+ NULL},
+ {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address_length),
+ "Address Length", NULL}
+};
+
+struct acpi_rsdump_info acpi_rs_dump_address16[8] = {
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address16),
+ "16-Bit WORD Address Space", NULL},
+ {ACPI_RSD_ADDRESS, 0, NULL, NULL},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.granularity), "Granularity",
+ NULL},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.minimum), "Address Minimum",
+ NULL},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.maximum), "Address Maximum",
+ NULL},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.translation_offset),
+ "Translation Offset", NULL},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.address_length),
+ "Address Length", NULL},
+ {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address16.resource_source), NULL, NULL}
+};
+
+struct acpi_rsdump_info acpi_rs_dump_address32[8] = {
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address32),
+ "32-Bit DWORD Address Space", NULL},
+ {ACPI_RSD_ADDRESS, 0, NULL, NULL},
+ {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.granularity), "Granularity",
+ NULL},
+ {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.minimum), "Address Minimum",
+ NULL},
+ {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.maximum), "Address Maximum",
+ NULL},
+ {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.translation_offset),
+ "Translation Offset", NULL},
+ {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.address_length),
+ "Address Length", NULL},
+ {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address32.resource_source), NULL, NULL}
+};
+
+struct acpi_rsdump_info acpi_rs_dump_address64[8] = {
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address64),
+ "64-Bit QWORD Address Space", NULL},
+ {ACPI_RSD_ADDRESS, 0, NULL, NULL},
+ {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.granularity), "Granularity",
+ NULL},
+ {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.minimum), "Address Minimum",
+ NULL},
+ {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.maximum), "Address Maximum",
+ NULL},
+ {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.translation_offset),
+ "Translation Offset", NULL},
+ {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.address_length),
+ "Address Length", NULL},
+ {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address64.resource_source), NULL, NULL}
+};
+
+struct acpi_rsdump_info acpi_rs_dump_ext_address64[8] = {
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_ext_address64),
+ "64-Bit Extended Address Space", NULL},
+ {ACPI_RSD_ADDRESS, 0, NULL, NULL},
+ {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.granularity),
+ "Granularity", NULL},
+ {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.minimum),
+ "Address Minimum", NULL},
+ {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.maximum),
+ "Address Maximum", NULL},
+ {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.translation_offset),
+ "Translation Offset", NULL},
+ {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.address_length),
+ "Address Length", NULL},
+ {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.type_specific),
+ "Type-Specific Attribute", NULL}
+};
+
+struct acpi_rsdump_info acpi_rs_dump_ext_irq[8] = {
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_ext_irq),
+ "Extended IRQ", NULL},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.producer_consumer),
+ "Type", acpi_gbl_consume_decode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.triggering),
+ "Triggering", acpi_gbl_HEdecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.polarity), "Polarity",
+ acpi_gbl_LLdecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.sharable), "Sharing",
+ acpi_gbl_SHRdecode},
+ {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(extended_irq.resource_source), NULL,
+ NULL},
+ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(extended_irq.interrupt_count),
+ "Interrupt Count", NULL},
+ {ACPI_RSD_DWORDLIST, ACPI_RSD_OFFSET(extended_irq.interrupts[0]),
+ "Interrupt List", NULL}
+};
+
+struct acpi_rsdump_info acpi_rs_dump_generic_reg[6] = {
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_generic_reg),
+ "Generic Register", NULL},
+ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.space_id), "Space ID",
+ NULL},
+ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.bit_width), "Bit Width",
+ NULL},
+ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.bit_offset), "Bit Offset",
+ NULL},
+ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.access_size),
+ "Access Size", NULL},
+ {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(generic_reg.address), "Address", NULL}
+};
-static void acpi_rs_out_integer8(char *title, u8 value)
-{
- acpi_os_printf("%27s : %2.2X\n", title, value);
-}
-
-static void acpi_rs_out_integer16(char *title, u16 value)
-{
- acpi_os_printf("%27s : %4.4X\n", title, value);
-}
-
-static void acpi_rs_out_integer32(char *title, u32 value)
-{
- acpi_os_printf("%27s : %8.8X\n", title, value);
-}
-
-static void acpi_rs_out_integer64(char *title, u64 value)
-{
- acpi_os_printf("%27s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value));
-}
+/*
+ * Tables used for common address descriptor flag fields
+ */
+static struct acpi_rsdump_info acpi_rs_dump_general_flags[5] = {
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_general_flags), NULL,
+ NULL},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.producer_consumer),
+ "Consumer/Producer", acpi_gbl_consume_decode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.decode), "Address Decode",
+ acpi_gbl_DECdecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.min_address_fixed),
+ "Min Relocatability", acpi_gbl_min_decode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.max_address_fixed),
+ "Max Relocatability", acpi_gbl_max_decode}
+};
+
+static struct acpi_rsdump_info acpi_rs_dump_memory_flags[5] = {
+ {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory_flags),
+ "Resource Type", "Memory Range"},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.write_protect),
+ "Write Protect", acpi_gbl_RWdecode},
+ {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.caching),
+ "Caching", acpi_gbl_MEMdecode},
+ {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.range_type),
+ "Range Type", acpi_gbl_MTPdecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.translation),
+ "Translation", acpi_gbl_TTPdecode}
+};
+
+static struct acpi_rsdump_info acpi_rs_dump_io_flags[4] = {
+ {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io_flags),
+ "Resource Type", "I/O Range"},
+ {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.io.range_type),
+ "Range Type", acpi_gbl_RNGdecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation),
+ "Translation", acpi_gbl_TTPdecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation_type),
+ "Translation Type", acpi_gbl_TRSdecode}
+};
-static void acpi_rs_out_title(char *title)
-{
- acpi_os_printf("%27s : ", title);
-}
+/*
+ * Table used to dump _PRT contents
+ */
+static struct acpi_rsdump_info acpi_rs_dump_prt[5] = {
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_prt), NULL, NULL},
+ {ACPI_RSD_UINT64, ACPI_PRT_OFFSET(address), "Address", NULL},
+ {ACPI_RSD_UINT32, ACPI_PRT_OFFSET(pin), "Pin", NULL},
+ {ACPI_RSD_STRING, ACPI_PRT_OFFSET(source[0]), "Source", NULL},
+ {ACPI_RSD_UINT32, ACPI_PRT_OFFSET(source_index), "Source Index", NULL}
+};
/*******************************************************************************
*
- * FUNCTION: acpi_rs_dump*List
+ * FUNCTION: acpi_rs_dump_descriptor
*
- * PARAMETERS: Length - Number of elements in the list
- * Data - Start of the list
+ * PARAMETERS: Resource
*
* RETURN: None
*
- * DESCRIPTION: Miscellaneous functions to dump lists of raw data
+ * DESCRIPTION:
*
******************************************************************************/
-static void acpi_rs_dump_byte_list(u32 length, u8 * data)
+static void
+acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
{
- u32 i;
+ void *target = NULL;
+ void *previous_target;
+ char *name;
+ u8 count;
+
+ /* First table entry must contain the table length (# of table entries) */
+
+ count = table->offset;
+
+ while (count) {
+ previous_target = target;
+ target = ((u8 *) resource) + table->offset;
+ name = table->name;
+
+ switch (table->opcode) {
+ case ACPI_RSD_TITLE:
+ /*
+ * Optional resource title
+ */
+ if (table->name) {
+ acpi_os_printf("%s Resource\n", name);
+ }
+ break;
- for (i = 0; i < length; i++) {
- acpi_os_printf("%25s%2.2X : %2.2X\n", "Byte", i, data[i]);
- }
-}
+ /* Strings */
-static void acpi_rs_dump_dword_list(u32 length, u32 * data)
-{
- u32 i;
+ case ACPI_RSD_LITERAL:
+ acpi_rs_out_string(name, (char *)table->pointer);
+ break;
- for (i = 0; i < length; i++) {
- acpi_os_printf("%25s%2.2X : %8.8X\n", "Dword", i, data[i]);
- }
-}
+ case ACPI_RSD_STRING:
+ acpi_rs_out_string(name, (char *)target);
+ break;
-static void acpi_rs_dump_short_byte_list(u32 length, u32 * data)
-{
- u32 i;
+ /* Data items, 8/16/32/64 bit */
- for (i = 0; i < length; i++) {
- acpi_os_printf("%X ", data[i]);
- }
- acpi_os_printf("\n");
-}
+ case ACPI_RSD_UINT8:
+ acpi_rs_out_integer8(name, *(u8 *) target);
+ break;
-static void acpi_rs_dump_memory_attribute(u32 read_write_attribute)
-{
+ case ACPI_RSD_UINT16:
+ acpi_rs_out_integer16(name, *(u16 *) target);
+ break;
+
+ case ACPI_RSD_UINT32:
+ acpi_rs_out_integer32(name, *(u32 *) target);
+ break;
- acpi_rs_out_string("Read/Write Attribute",
- ACPI_READ_WRITE_MEMORY == read_write_attribute ?
- "Read/Write" : "Read-Only");
+ case ACPI_RSD_UINT64:
+ acpi_rs_out_integer64(name, *(u64 *) target);
+ break;
+
+ /* Flags: 1-bit and 2-bit flags supported */
+
+ case ACPI_RSD_1BITFLAG:
+ acpi_rs_out_string(name, (char *)
+ ((const char **)table->
+ pointer)[(*(u8 *) target) & 0x01]);
+ break;
+
+ case ACPI_RSD_2BITFLAG:
+ acpi_rs_out_string(name, (char *)
+ ((const char **)table->
+ pointer)[(*(u8 *) target) & 0x03]);
+ break;
+
+ case ACPI_RSD_SHORTLIST:
+ /*
+ * Short byte list (single line output) for DMA and IRQ resources
+ * Note: The list length is obtained from the previous table entry
+ */
+ if (previous_target) {
+ acpi_rs_out_title(name);
+ acpi_rs_dump_short_byte_list(*
+ ((u8 *)
+ previous_target),
+ (u8 *) target);
+ }
+ break;
+
+ case ACPI_RSD_LONGLIST:
+ /*
+ * Long byte list for Vendor resource data
+ * Note: The list length is obtained from the previous table entry
+ */
+ if (previous_target) {
+ acpi_rs_dump_byte_list(*
+ ((u16 *)
+ previous_target),
+ (u8 *) target);
+ }
+ break;
+
+ case ACPI_RSD_DWORDLIST:
+ /*
+ * Dword list for Extended Interrupt resources
+ * Note: The list length is obtained from the previous table entry
+ */
+ if (previous_target) {
+ acpi_rs_dump_dword_list(*
+ ((u8 *)
+ previous_target),
+ (u32 *) target);
+ }
+ break;
+
+ case ACPI_RSD_ADDRESS:
+ /*
+ * Common flags for all Address resources
+ */
+ acpi_rs_dump_address_common((union acpi_resource_data *)
+ target);
+ break;
+
+ case ACPI_RSD_SOURCE:
+ /*
+ * Optional resource_source for Address resources
+ */
+ acpi_rs_dump_resource_source((struct
+ acpi_resource_source *)
+ target);
+ break;
+
+ default:
+ acpi_os_printf("**** Invalid table opcode [%X] ****\n",
+ table->opcode);
+ return;
+ }
+
+ table++;
+ count--;
+ }
}
/*******************************************************************************
@@ -187,8 +528,7 @@ acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source)
return;
}
- acpi_rs_out_integer8("Resource Source Index",
- (u8) resource_source->index);
+ acpi_rs_out_integer8("Resource Source Index", resource_source->index);
acpi_rs_out_string("Resource Source",
resource_source->string_ptr ?
@@ -217,65 +557,12 @@ static void acpi_rs_dump_address_common(union acpi_resource_data *resource)
switch (resource->address.resource_type) {
case ACPI_MEMORY_RANGE:
- 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;
-
- case ACPI_CACHABLE_MEMORY:
- acpi_os_printf("Cacheable memory\n");
- break;
-
- case ACPI_WRITE_COMBINING_MEMORY:
- acpi_os_printf("Write-combining memory\n");
- break;
-
- case ACPI_PREFETCHABLE_MEMORY:
- acpi_os_printf("Prefetchable memory\n");
- break;
-
- default:
- acpi_os_printf("Invalid cache attribute\n");
- break;
- }
-
- acpi_rs_dump_memory_attribute(resource->address.attribute.
- memory.read_write_attribute);
+ acpi_rs_dump_descriptor(resource, acpi_rs_dump_memory_flags);
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;
-
- 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");
+ acpi_rs_dump_descriptor(resource, acpi_rs_dump_io_flags);
break;
case ACPI_BUS_NUMBER_RANGE:
@@ -292,24 +579,7 @@ static void acpi_rs_dump_address_common(union acpi_resource_data *resource)
/* 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");
+ acpi_rs_dump_descriptor(resource, acpi_rs_dump_general_flags);
}
/*******************************************************************************
@@ -327,6 +597,7 @@ static void acpi_rs_dump_address_common(union acpi_resource_data *resource)
void acpi_rs_dump_resource_list(struct acpi_resource *resource_list)
{
u32 count = 0;
+ u32 type;
ACPI_FUNCTION_ENTRY();
@@ -335,14 +606,16 @@ void acpi_rs_dump_resource_list(struct acpi_resource *resource_list)
return;
}
- /* Dump all resource descriptors in the list */
+ /* Walk list and dump all resource descriptors (END_TAG terminates) */
- while (resource_list) {
+ do {
acpi_os_printf("\n[%02X] ", count);
+ count++;
/* Validate Type before dispatch */
- if (resource_list->type > ACPI_RESOURCE_TYPE_MAX) {
+ type = resource_list->type;
+ if (type > ACPI_RESOURCE_TYPE_MAX) {
acpi_os_printf
("Invalid descriptor type (%X) in resource list\n",
resource_list->type);
@@ -351,665 +624,141 @@ void acpi_rs_dump_resource_list(struct acpi_resource *resource_list)
/* Dump the resource descriptor */
- acpi_gbl_dump_resource_dispatch[resource_list->
- type] (&resource_list->data);
-
- /* Exit on end tag */
-
- if (resource_list->type == ACPI_RESOURCE_TYPE_END_TAG) {
- return;
- }
+ acpi_rs_dump_descriptor(&resource_list->data,
+ acpi_gbl_dump_resource_dispatch[type]);
- /* Get the next resource structure */
+ /* Point to 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
- *
- ******************************************************************************/
+ /* Exit when END_TAG descriptor is reached */
-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.triggering ? "Level" : "Edge");
-
- acpi_rs_out_string("Active",
- ACPI_ACTIVE_LOW ==
- resource->irq.polarity ? "Low" : "High");
-
- acpi_rs_out_string("Sharing",
- ACPI_SHARED ==
- resource->irq.sharable ? "Shared" : "Exclusive");
-
- acpi_rs_out_integer8("Interrupt Count",
- (u8) resource->irq.interrupt_count);
-
- acpi_rs_out_title("Interrupt List");
- acpi_rs_dump_short_byte_list(resource->irq.interrupt_count,
- resource->irq.interrupts);
+ } while (type != ACPI_RESOURCE_TYPE_END_TAG);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_dump_dma
+ * FUNCTION: acpi_rs_dump_irq_list
*
- * PARAMETERS: Resource - Pointer to an internal resource descriptor
+ * PARAMETERS: route_table - Pointer to the routing table to dump.
*
* RETURN: None
*
- * DESCRIPTION: Dump the field names and values of the resource descriptor
+ * DESCRIPTION: Print IRQ routing table
*
******************************************************************************/
-void acpi_rs_dump_dma(union acpi_resource_data *resource)
+void acpi_rs_dump_irq_list(u8 * route_table)
{
- ACPI_FUNCTION_ENTRY();
-
- acpi_os_printf("DMA Resource\n");
-
- acpi_rs_out_title("DMA Type");
- switch (resource->dma.type) {
- case ACPI_COMPATIBILITY:
- acpi_os_printf("Compatibility mode\n");
- break;
-
- case ACPI_TYPE_A:
- acpi_os_printf("Type A\n");
- break;
-
- case ACPI_TYPE_B:
- acpi_os_printf("Type B\n");
- break;
-
- case ACPI_TYPE_F:
- acpi_os_printf("Type F\n");
- break;
-
- default:
- acpi_os_printf("**** Invalid DMA type\n");
- break;
- }
-
- acpi_rs_out_string("Bus Master",
- ACPI_BUS_MASTER ==
- resource->dma.bus_master ? "Yes" : "No");
-
- acpi_rs_out_title("Transfer Type");
- switch (resource->dma.transfer) {
- case ACPI_TRANSFER_8:
- acpi_os_printf("8-bit transfers only\n");
- break;
-
- case ACPI_TRANSFER_8_16:
- acpi_os_printf("8-bit and 16-bit transfers\n");
- break;
-
- case ACPI_TRANSFER_16:
- acpi_os_printf("16-bit transfers only\n");
- break;
-
- default:
- acpi_os_printf("**** Invalid transfer preference\n");
- break;
- }
-
- acpi_rs_out_integer8("DMA Channel Count",
- (u8) resource->dma.channel_count);
-
- acpi_rs_out_title("Channel List");
- acpi_rs_dump_short_byte_list(resource->dma.channel_count,
- resource->dma.channels);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_rs_dump_start_dpf
- *
- * PARAMETERS: Resource - Pointer to an internal resource descriptor
- *
- * RETURN: None
- *
- * DESCRIPTION: Dump the field names and values of the resource descriptor
- *
- ******************************************************************************/
+ struct acpi_pci_routing_table *prt_element;
+ u8 count;
-void acpi_rs_dump_start_dpf(union acpi_resource_data *resource)
-{
ACPI_FUNCTION_ENTRY();
- acpi_os_printf("Start Dependent Functions Resource\n");
-
- acpi_rs_out_title("Compatibility Priority");
- switch (resource->start_dpf.compatibility_priority) {
- case ACPI_GOOD_CONFIGURATION:
- acpi_os_printf("Good configuration\n");
- break;
-
- case ACPI_ACCEPTABLE_CONFIGURATION:
- acpi_os_printf("Acceptable configuration\n");
- break;
-
- case ACPI_SUB_OPTIMAL_CONFIGURATION:
- acpi_os_printf("Sub-optimal configuration\n");
- break;
-
- default:
- acpi_os_printf("**** Invalid compatibility priority\n");
- break;
+ if (!(acpi_dbg_level & ACPI_LV_RESOURCES)
+ || !(_COMPONENT & acpi_dbg_layer)) {
+ return;
}
- acpi_rs_out_title("Performance/Robustness");
- switch (resource->start_dpf.performance_robustness) {
- case ACPI_GOOD_CONFIGURATION:
- acpi_os_printf("Good configuration\n");
- break;
+ prt_element = ACPI_CAST_PTR(struct acpi_pci_routing_table, route_table);
- case ACPI_ACCEPTABLE_CONFIGURATION:
- acpi_os_printf("Acceptable configuration\n");
- break;
+ /* Dump all table elements, Exit on zero length element */
- case ACPI_SUB_OPTIMAL_CONFIGURATION:
- acpi_os_printf("Sub-optimal configuration\n");
- break;
+ for (count = 0; prt_element->length; count++) {
+ acpi_os_printf("\n[%02X] PCI IRQ Routing Table Package\n",
+ count);
+ acpi_rs_dump_descriptor(prt_element, acpi_rs_dump_prt);
- default:
- acpi_os_printf
- ("**** Invalid performance robustness preference\n");
- break;
+ prt_element = ACPI_CAST_PTR(struct acpi_pci_routing_table,
+ ((u8 *) prt_element) +
+ prt_element->length);
}
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_dump_io
- *
- * PARAMETERS: Resource - Pointer to an internal resource descriptor
- *
- * RETURN: None
- *
- * DESCRIPTION: Dump the field names and values of the resource descriptor
- *
- ******************************************************************************/
-
-void acpi_rs_dump_io(union acpi_resource_data *resource)
-{
- ACPI_FUNCTION_ENTRY();
-
- acpi_os_printf("I/O Resource\n");
-
- acpi_rs_out_string("Decode",
- ACPI_DECODE_16 ==
- resource->io.io_decode ? "16-bit" : "10-bit");
-
- acpi_rs_out_integer32("Address Minimum", resource->io.minimum);
-
- acpi_rs_out_integer32("Address Maximum", resource->io.maximum);
-
- acpi_rs_out_integer32("Alignment", resource->io.alignment);
-
- acpi_rs_out_integer32("Address Length", resource->io.address_length);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_rs_dump_fixed_io
- *
- * PARAMETERS: Resource - Pointer to an internal resource descriptor
- *
- * RETURN: None
- *
- * DESCRIPTION: Dump the field names and values of the resource descriptor
- *
- ******************************************************************************/
-
-void acpi_rs_dump_fixed_io(union acpi_resource_data *resource)
-{
- ACPI_FUNCTION_ENTRY();
-
- acpi_os_printf("Fixed I/O Resource\n");
-
- acpi_rs_out_integer32("Address", resource->fixed_io.address);
-
- acpi_rs_out_integer32("Address Length",
- resource->fixed_io.address_length);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_rs_dump_vendor
- *
- * PARAMETERS: Resource - Pointer to an internal resource descriptor
- *
- * RETURN: None
- *
- * DESCRIPTION: Dump the field names and values of the resource descriptor
- *
- ******************************************************************************/
-
-void acpi_rs_dump_vendor(union acpi_resource_data *resource)
-{
- ACPI_FUNCTION_ENTRY();
-
- acpi_os_printf("Vendor Specific Resource\n");
-
- acpi_rs_out_integer16("Length", (u16) resource->vendor.byte_length);
-
- acpi_rs_dump_byte_list(resource->vendor.byte_length,
- resource->vendor.byte_data);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_rs_dump_memory24
- *
- * PARAMETERS: Resource - Pointer to an internal resource descriptor
- *
- * RETURN: None
- *
- * DESCRIPTION: Dump the field names and values of the resource descriptor
- *
- ******************************************************************************/
-
-void acpi_rs_dump_memory24(union acpi_resource_data *resource)
-{
- ACPI_FUNCTION_ENTRY();
-
- acpi_os_printf("24-Bit Memory Range Resource\n");
-
- acpi_rs_dump_memory_attribute(resource->memory24.read_write_attribute);
-
- acpi_rs_out_integer16("Address Minimum",
- (u16) resource->memory24.minimum);
-
- acpi_rs_out_integer16("Address Maximum",
- (u16) resource->memory24.maximum);
-
- acpi_rs_out_integer16("Alignment", (u16) resource->memory24.alignment);
-
- acpi_rs_out_integer16("Address Length",
- (u16) resource->memory24.address_length);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_rs_dump_memory32
- *
- * PARAMETERS: Resource - Pointer to an internal resource descriptor
- *
- * RETURN: None
- *
- * DESCRIPTION: Dump the field names and values of the resource descriptor
- *
- ******************************************************************************/
-
-void acpi_rs_dump_memory32(union acpi_resource_data *resource)
-{
- ACPI_FUNCTION_ENTRY();
-
- acpi_os_printf("32-Bit Memory Range Resource\n");
-
- acpi_rs_dump_memory_attribute(resource->memory32.read_write_attribute);
-
- acpi_rs_out_integer32("Address Minimum", resource->memory32.minimum);
-
- acpi_rs_out_integer32("Address Maximum", resource->memory32.maximum);
-
- acpi_rs_out_integer32("Alignment", resource->memory32.alignment);
-
- acpi_rs_out_integer32("Address Length",
- resource->memory32.address_length);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_rs_dump_fixed_memory32
- *
- * PARAMETERS: Resource - Pointer to an internal resource descriptor
- *
- * RETURN:
- *
- * DESCRIPTION: Dump the field names and values of the resource descriptor
- *
- ******************************************************************************/
-
-void acpi_rs_dump_fixed_memory32(union acpi_resource_data *resource)
-{
- ACPI_FUNCTION_ENTRY();
-
- acpi_os_printf("32-Bit Fixed Location Memory Range Resource\n");
-
- acpi_rs_dump_memory_attribute(resource->fixed_memory32.
- read_write_attribute);
-
- acpi_rs_out_integer32("Address", resource->fixed_memory32.address);
-
- acpi_rs_out_integer32("Address Length",
- resource->fixed_memory32.address_length);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_rs_dump_address16
+ * FUNCTION: acpi_rs_out*
*
- * PARAMETERS: Resource - Pointer to an internal resource descriptor
+ * PARAMETERS: Title - Name of the resource field
+ * Value - Value of the resource field
*
* RETURN: None
*
- * DESCRIPTION: Dump the field names and values of the resource descriptor
+ * DESCRIPTION: Miscellaneous helper functions to consistently format the
+ * output of the resource dump routines
*
******************************************************************************/
-void acpi_rs_dump_address16(union acpi_resource_data *resource)
+static void acpi_rs_out_string(char *title, char *value)
{
- ACPI_FUNCTION_ENTRY();
-
- acpi_os_printf("16-Bit WORD Address Space Resource\n");
-
- acpi_rs_dump_address_common(resource);
-
- acpi_rs_out_integer16("Granularity",
- (u16) resource->address16.granularity);
-
- acpi_rs_out_integer16("Address Minimum",
- (u16) resource->address16.minimum);
-
- acpi_rs_out_integer16("Address Maximum",
- (u16) resource->address16.maximum);
-
- acpi_rs_out_integer16("Translation Offset",
- (u16) resource->address16.translation_offset);
-
- acpi_rs_out_integer16("Address Length",
- (u16) resource->address16.address_length);
-
- acpi_rs_dump_resource_source(&resource->address16.resource_source);
+ acpi_os_printf("%27s : %s\n", title, value);
}
-/*******************************************************************************
- *
- * FUNCTION: acpi_rs_dump_address32
- *
- * PARAMETERS: Resource - Pointer to an internal resource descriptor
- *
- * RETURN: None
- *
- * DESCRIPTION: Dump the field names and values of the resource descriptor
- *
- ******************************************************************************/
-
-void acpi_rs_dump_address32(union acpi_resource_data *resource)
+static void acpi_rs_out_integer8(char *title, u8 value)
{
- ACPI_FUNCTION_ENTRY();
-
- acpi_os_printf("32-Bit DWORD Address Space Resource\n");
-
- acpi_rs_dump_address_common(resource);
-
- acpi_rs_out_integer32("Granularity", resource->address32.granularity);
-
- acpi_rs_out_integer32("Address Minimum", resource->address32.minimum);
-
- acpi_rs_out_integer32("Address Maximum", resource->address32.maximum);
-
- acpi_rs_out_integer32("Translation Offset",
- resource->address32.translation_offset);
-
- acpi_rs_out_integer32("Address Length",
- resource->address32.address_length);
-
- acpi_rs_dump_resource_source(&resource->address32.resource_source);
+ acpi_os_printf("%27s : %2.2X\n", title, value);
}
-/*******************************************************************************
- *
- * FUNCTION: acpi_rs_dump_address64
- *
- * PARAMETERS: Resource - Pointer to an internal resource descriptor
- *
- * RETURN: None
- *
- * DESCRIPTION: Dump the field names and values of the resource descriptor
- *
- ******************************************************************************/
-
-void acpi_rs_dump_address64(union acpi_resource_data *resource)
+static void acpi_rs_out_integer16(char *title, u16 value)
{
- ACPI_FUNCTION_ENTRY();
-
- acpi_os_printf("64-Bit QWORD Address Space Resource\n");
-
- acpi_rs_dump_address_common(resource);
-
- acpi_rs_out_integer64("Granularity", resource->address64.granularity);
-
- acpi_rs_out_integer64("Address Minimum", resource->address64.minimum);
-
- acpi_rs_out_integer64("Address Maximum", resource->address64.maximum);
-
- acpi_rs_out_integer64("Translation Offset",
- resource->address64.translation_offset);
-
- acpi_rs_out_integer64("Address Length",
- resource->address64.address_length);
-
- acpi_rs_dump_resource_source(&resource->address64.resource_source);
+ acpi_os_printf("%27s : %4.4X\n", title, value);
}
-/*******************************************************************************
- *
- * FUNCTION: acpi_rs_dump_ext_address64
- *
- * PARAMETERS: Resource - Pointer to an internal resource descriptor
- *
- * RETURN: None
- *
- * DESCRIPTION: Dump the field names and values of the resource descriptor
- *
- ******************************************************************************/
-
-void acpi_rs_dump_ext_address64(union acpi_resource_data *resource)
+static void acpi_rs_out_integer32(char *title, u32 value)
{
- ACPI_FUNCTION_ENTRY();
-
- acpi_os_printf("64-Bit Extended Address Space Resource\n");
-
- acpi_rs_dump_address_common(resource);
-
- acpi_rs_out_integer64("Granularity",
- resource->ext_address64.granularity);
-
- acpi_rs_out_integer64("Address Minimum",
- resource->ext_address64.minimum);
-
- acpi_rs_out_integer64("Address Maximum",
- resource->ext_address64.maximum);
-
- acpi_rs_out_integer64("Translation Offset",
- resource->ext_address64.translation_offset);
-
- acpi_rs_out_integer64("Address Length",
- resource->ext_address64.address_length);
-
- acpi_rs_out_integer64("Type-Specific Attribute",
- resource->ext_address64.type_specific_attributes);
+ acpi_os_printf("%27s : %8.8X\n", title, value);
}
-/*******************************************************************************
- *
- * FUNCTION: acpi_rs_dump_ext_irq
- *
- * PARAMETERS: Resource - Pointer to an internal resource descriptor
- *
- * RETURN: None
- *
- * DESCRIPTION: Dump the field names and values of the resource descriptor
- *
- ******************************************************************************/
-
-void acpi_rs_dump_ext_irq(union acpi_resource_data *resource)
+static void acpi_rs_out_integer64(char *title, u64 value)
{
- ACPI_FUNCTION_ENTRY();
-
- acpi_os_printf("Extended IRQ Resource\n");
-
- acpi_rs_out_string("Resource",
- ACPI_CONSUMER ==
- resource->extended_irq.
- producer_consumer ? "Consumer" : "Producer");
-
- acpi_rs_out_string("Triggering",
- ACPI_LEVEL_SENSITIVE ==
- resource->extended_irq.
- triggering ? "Level" : "Edge");
-
- acpi_rs_out_string("Active",
- ACPI_ACTIVE_LOW == resource->extended_irq.polarity ?
- "Low" : "High");
-
- acpi_rs_out_string("Sharing",
- ACPI_SHARED == resource->extended_irq.sharable ?
- "Shared" : "Exclusive");
-
- acpi_rs_dump_resource_source(&resource->extended_irq.resource_source);
-
- acpi_rs_out_integer8("Interrupts",
- (u8) resource->extended_irq.interrupt_count);
-
- acpi_rs_dump_dword_list(resource->extended_irq.interrupt_count,
- resource->extended_irq.interrupts);
+ acpi_os_printf("%27s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value));
}
-/*******************************************************************************
- *
- * FUNCTION: acpi_rs_dump_generic_reg
- *
- * PARAMETERS: Resource - Pointer to an internal resource descriptor
- *
- * RETURN: None
- *
- * DESCRIPTION: Dump the field names and values of the resource descriptor
- *
- ******************************************************************************/
-
-void acpi_rs_dump_generic_reg(union acpi_resource_data *resource)
+static void acpi_rs_out_title(char *title)
{
- ACPI_FUNCTION_ENTRY();
-
- acpi_os_printf("Generic Register Resource\n");
-
- acpi_rs_out_integer8("Space ID", (u8) resource->generic_reg.space_id);
-
- acpi_rs_out_integer8("Bit Width", (u8) resource->generic_reg.bit_width);
-
- acpi_rs_out_integer8("Bit Offset",
- (u8) resource->generic_reg.bit_offset);
-
- acpi_rs_out_integer8("Access Size",
- (u8) resource->generic_reg.access_size);
-
- acpi_rs_out_integer64("Address", resource->generic_reg.address);
+ acpi_os_printf("%27s : ", title);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_dump_end_dpf
+ * FUNCTION: acpi_rs_dump*List
*
- * PARAMETERS: Resource - Pointer to an internal resource descriptor
+ * PARAMETERS: Length - Number of elements in the list
+ * Data - Start of the list
*
* RETURN: None
*
- * DESCRIPTION: Print type, no data.
+ * DESCRIPTION: Miscellaneous functions to dump lists of raw data
*
******************************************************************************/
-void acpi_rs_dump_end_dpf(union acpi_resource_data *resource)
+static void acpi_rs_dump_byte_list(u16 length, u8 * data)
{
- ACPI_FUNCTION_ENTRY();
+ u8 i;
- acpi_os_printf("end_dependent_functions Resource\n");
+ for (i = 0; i < length; i++) {
+ acpi_os_printf("%25s%2.2X : %2.2X\n", "Byte", i, data[i]);
+ }
}
-/*******************************************************************************
- *
- * FUNCTION: acpi_rs_dump_end_tag
- *
- * PARAMETERS: Resource - Pointer to an internal resource descriptor
- *
- * RETURN: None
- *
- * DESCRIPTION: Print type, no data.
- *
- ******************************************************************************/
-
-void acpi_rs_dump_end_tag(union acpi_resource_data *resource)
+static void acpi_rs_dump_short_byte_list(u8 length, u8 * data)
{
- ACPI_FUNCTION_ENTRY();
+ u8 i;
- acpi_os_printf("end_tag Resource\n");
+ for (i = 0; i < length; i++) {
+ acpi_os_printf("%X ", data[i]);
+ }
+ acpi_os_printf("\n");
}
-/*******************************************************************************
- *
- * FUNCTION: acpi_rs_dump_irq_list
- *
- * PARAMETERS: route_table - Pointer to the routing table to dump.
- *
- * RETURN: None
- *
- * DESCRIPTION: Print IRQ routing table
- *
- ******************************************************************************/
-
-void acpi_rs_dump_irq_list(u8 * route_table)
+static void acpi_rs_dump_dword_list(u8 length, u32 * data)
{
- u8 *buffer = route_table;
- u8 count = 0;
- struct acpi_pci_routing_table *prt_element;
-
- ACPI_FUNCTION_ENTRY();
+ u8 i;
- if (!(acpi_dbg_level & ACPI_LV_RESOURCES)
- || !(_COMPONENT & acpi_dbg_layer)) {
- return;
- }
-
- prt_element = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer);
-
- /* Dump all table elements, Exit on null length element */
-
- while (prt_element->length) {
- acpi_os_printf("\n[%02X] PCI IRQ Routing Table Package\n",
- count);
-
- acpi_rs_out_integer64("Address", prt_element->address);
-
- 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);
- count++;
+ for (i = 0; i < length; i++) {
+ acpi_os_printf("%25s%2.2X : %8.8X\n", "Dword", i, data[i]);
}
}
diff --git a/drivers/acpi/resources/rsinfo.c b/drivers/acpi/resources/rsinfo.c
index b31cb33ec56..973fc2834cb 100644
--- a/drivers/acpi/resources/rsinfo.c
+++ b/drivers/acpi/resources/rsinfo.c
@@ -58,60 +58,60 @@ ACPI_MODULE_NAME("rsinfo")
* descriptors are indexed by the acpi_resource_type field.
*/
/* Dispatch table for resource-to-AML (Set Resource) conversion functions */
-ACPI_SET_RESOURCE_HANDLER acpi_gbl_set_resource_dispatch[] = {
+struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[] = {
acpi_rs_set_irq, /* 0x00, ACPI_RESOURCE_TYPE_IRQ */
- acpi_rs_set_dma, /* 0x01, ACPI_RESOURCE_TYPE_DMA */
+ acpi_rs_convert_dma, /* 0x01, ACPI_RESOURCE_TYPE_DMA */
acpi_rs_set_start_dpf, /* 0x02, ACPI_RESOURCE_TYPE_START_DEPENDENT */
- acpi_rs_set_end_dpf, /* 0x03, ACPI_RESOURCE_TYPE_END_DEPENDENT */
- acpi_rs_set_io, /* 0x04, ACPI_RESOURCE_TYPE_IO */
- acpi_rs_set_fixed_io, /* 0x05, ACPI_RESOURCE_TYPE_FIXED_IO */
+ acpi_rs_convert_end_dpf, /* 0x03, ACPI_RESOURCE_TYPE_END_DEPENDENT */
+ acpi_rs_convert_io, /* 0x04, ACPI_RESOURCE_TYPE_IO */
+ acpi_rs_convert_fixed_io, /* 0x05, ACPI_RESOURCE_TYPE_FIXED_IO */
acpi_rs_set_vendor, /* 0x06, ACPI_RESOURCE_TYPE_VENDOR */
- acpi_rs_set_end_tag, /* 0x07, ACPI_RESOURCE_TYPE_END_TAG */
- acpi_rs_set_memory24, /* 0x08, ACPI_RESOURCE_TYPE_MEMORY24 */
- acpi_rs_set_memory32, /* 0x09, ACPI_RESOURCE_TYPE_MEMORY32 */
- acpi_rs_set_fixed_memory32, /* 0x0A, ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */
- acpi_rs_set_address16, /* 0x0B, ACPI_RESOURCE_TYPE_ADDRESS16 */
- acpi_rs_set_address32, /* 0x0C, ACPI_RESOURCE_TYPE_ADDRESS32 */
- acpi_rs_set_address64, /* 0x0D, ACPI_RESOURCE_TYPE_ADDRESS64 */
- acpi_rs_set_ext_address64, /* 0x0E, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */
- acpi_rs_set_ext_irq, /* 0x0F, ACPI_RESOURCE_TYPE_EXTENDED_IRQ */
- acpi_rs_set_generic_reg /* 0x10, ACPI_RESOURCE_TYPE_GENERIC_REGISTER */
+ acpi_rs_convert_end_tag, /* 0x07, ACPI_RESOURCE_TYPE_END_TAG */
+ acpi_rs_convert_memory24, /* 0x08, ACPI_RESOURCE_TYPE_MEMORY24 */
+ acpi_rs_convert_memory32, /* 0x09, ACPI_RESOURCE_TYPE_MEMORY32 */
+ acpi_rs_convert_fixed_memory32, /* 0x0A, ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */
+ acpi_rs_convert_address16, /* 0x0B, ACPI_RESOURCE_TYPE_ADDRESS16 */
+ acpi_rs_convert_address32, /* 0x0C, ACPI_RESOURCE_TYPE_ADDRESS32 */
+ acpi_rs_convert_address64, /* 0x0D, ACPI_RESOURCE_TYPE_ADDRESS64 */
+ acpi_rs_convert_ext_address64, /* 0x0E, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */
+ acpi_rs_convert_ext_irq, /* 0x0F, ACPI_RESOURCE_TYPE_EXTENDED_IRQ */
+ acpi_rs_convert_generic_reg /* 0x10, ACPI_RESOURCE_TYPE_GENERIC_REGISTER */
};
/* Dispatch tables for AML-to-resource (Get Resource) conversion functions */
-ACPI_GET_RESOURCE_HANDLER acpi_gbl_sm_get_resource_dispatch[] = {
+struct acpi_rsconvert_info *acpi_gbl_sm_get_resource_dispatch[] = {
NULL, /* 0x00, Reserved */
NULL, /* 0x01, Reserved */
NULL, /* 0x02, Reserved */
NULL, /* 0x03, Reserved */
acpi_rs_get_irq, /* 0x04, ACPI_RESOURCE_NAME_IRQ */
- acpi_rs_get_dma, /* 0x05, ACPI_RESOURCE_NAME_DMA */
+ acpi_rs_convert_dma, /* 0x05, ACPI_RESOURCE_NAME_DMA */
acpi_rs_get_start_dpf, /* 0x06, ACPI_RESOURCE_NAME_START_DEPENDENT */
- acpi_rs_get_end_dpf, /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */
- acpi_rs_get_io, /* 0x08, ACPI_RESOURCE_NAME_IO */
- acpi_rs_get_fixed_io, /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO */
+ acpi_rs_convert_end_dpf, /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */
+ acpi_rs_convert_io, /* 0x08, ACPI_RESOURCE_NAME_IO */
+ acpi_rs_convert_fixed_io, /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO */
NULL, /* 0x0A, Reserved */
NULL, /* 0x0B, Reserved */
NULL, /* 0x0C, Reserved */
NULL, /* 0x0D, Reserved */
- acpi_rs_get_vendor, /* 0x0E, ACPI_RESOURCE_NAME_VENDOR_SMALL */
- acpi_rs_get_end_tag /* 0x0F, ACPI_RESOURCE_NAME_END_TAG */
+ acpi_rs_get_vendor_small, /* 0x0E, ACPI_RESOURCE_NAME_VENDOR_SMALL */
+ acpi_rs_convert_end_tag /* 0x0F, ACPI_RESOURCE_NAME_END_TAG */
};
-ACPI_GET_RESOURCE_HANDLER acpi_gbl_lg_get_resource_dispatch[] = {
+struct acpi_rsconvert_info *acpi_gbl_lg_get_resource_dispatch[] = {
NULL, /* 0x00, Reserved */
- acpi_rs_get_memory24, /* 0x01, ACPI_RESOURCE_NAME_MEMORY24 */
- acpi_rs_get_generic_reg, /* 0x02, ACPI_RESOURCE_NAME_GENERIC_REGISTER */
+ acpi_rs_convert_memory24, /* 0x01, ACPI_RESOURCE_NAME_MEMORY24 */
+ acpi_rs_convert_generic_reg, /* 0x02, ACPI_RESOURCE_NAME_GENERIC_REGISTER */
NULL, /* 0x03, Reserved */
- acpi_rs_get_vendor, /* 0x04, ACPI_RESOURCE_NAME_VENDOR_LARGE */
- acpi_rs_get_memory32, /* 0x05, ACPI_RESOURCE_NAME_MEMORY32 */
- acpi_rs_get_fixed_memory32, /* 0x06, ACPI_RESOURCE_NAME_FIXED_MEMORY32 */
- acpi_rs_get_address32, /* 0x07, ACPI_RESOURCE_NAME_ADDRESS32 */
- acpi_rs_get_address16, /* 0x08, ACPI_RESOURCE_NAME_ADDRESS16 */
- acpi_rs_get_ext_irq, /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_IRQ */
- acpi_rs_get_address64, /* 0x0A, ACPI_RESOURCE_NAME_ADDRESS64 */
- acpi_rs_get_ext_address64 /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 */
+ acpi_rs_get_vendor_large, /* 0x04, ACPI_RESOURCE_NAME_VENDOR_LARGE */
+ acpi_rs_convert_memory32, /* 0x05, ACPI_RESOURCE_NAME_MEMORY32 */
+ acpi_rs_convert_fixed_memory32, /* 0x06, ACPI_RESOURCE_NAME_FIXED_MEMORY32 */
+ acpi_rs_convert_address32, /* 0x07, ACPI_RESOURCE_NAME_ADDRESS32 */
+ acpi_rs_convert_address16, /* 0x08, ACPI_RESOURCE_NAME_ADDRESS16 */
+ acpi_rs_convert_ext_irq, /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_IRQ */
+ acpi_rs_convert_address64, /* 0x0A, ACPI_RESOURCE_NAME_ADDRESS64 */
+ acpi_rs_convert_ext_address64 /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 */
};
#ifdef ACPI_FUTURE_USAGE
@@ -119,7 +119,7 @@ ACPI_GET_RESOURCE_HANDLER acpi_gbl_lg_get_resource_dispatch[] = {
/* Dispatch table for resource dump functions */
-ACPI_DUMP_RESOURCE_HANDLER acpi_gbl_dump_resource_dispatch[] = {
+struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[] = {
acpi_rs_dump_irq, /* ACPI_RESOURCE_TYPE_IRQ */
acpi_rs_dump_dma, /* ACPI_RESOURCE_TYPE_DMA */
acpi_rs_dump_start_dpf, /* ACPI_RESOURCE_TYPE_START_DEPENDENT */
@@ -136,17 +136,17 @@ ACPI_DUMP_RESOURCE_HANDLER acpi_gbl_dump_resource_dispatch[] = {
acpi_rs_dump_address64, /* ACPI_RESOURCE_TYPE_ADDRESS64 */
acpi_rs_dump_ext_address64, /* ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */
acpi_rs_dump_ext_irq, /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */
- acpi_rs_dump_generic_reg /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */
+ acpi_rs_dump_generic_reg, /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */
};
+
#endif
#endif /* ACPI_FUTURE_USAGE */
-
/*
* Base sizes for external AML resource descriptors, indexed by internal type.
* Includes size of the descriptor header (1 byte for small descriptors,
* 3 bytes for large descriptors)
*/
-u8 acpi_gbl_aml_resource_sizes[] = {
+const u8 acpi_gbl_aml_resource_sizes[] = {
sizeof(struct aml_resource_irq), /* ACPI_RESOURCE_TYPE_IRQ (optional Byte 3 always created) */
sizeof(struct aml_resource_dma), /* ACPI_RESOURCE_TYPE_DMA */
sizeof(struct aml_resource_start_dependent), /* ACPI_RESOURCE_TYPE_START_DEPENDENT (optional Byte 1 always created) */
@@ -168,8 +168,8 @@ u8 acpi_gbl_aml_resource_sizes[] = {
/* Macros used in the tables below */
-#define ACPI_RLARGE(r) sizeof (r) - sizeof (struct aml_resource_large_header)
-#define ACPI_RSMALL(r) sizeof (r) - sizeof (struct aml_resource_small_header)
+#define ACPI_RLARGE(r) (sizeof (r) - sizeof (struct aml_resource_large_header))
+#define ACPI_RSMALL(r) (sizeof (r) - sizeof (struct aml_resource_small_header))
/*
* Base sizes of resource descriptors, both the AML stream resource length
@@ -182,47 +182,46 @@ struct acpi_resource_info acpi_gbl_sm_resource_info[] = {
{0, 0, 0},
{0, 0, 0},
{2, ACPI_RSMALL(struct aml_resource_irq),
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_irq)},
+ ACPI_RS_SIZE(struct acpi_resource_irq)},
{0, ACPI_RSMALL(struct aml_resource_dma),
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma)},
+ ACPI_RS_SIZE(struct acpi_resource_dma)},
{2, ACPI_RSMALL(struct aml_resource_start_dependent),
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_start_dependent)},
- {0, ACPI_RSMALL(struct aml_resource_end_dependent),
- ACPI_RESOURCE_LENGTH},
+ ACPI_RS_SIZE(struct acpi_resource_start_dependent)},
+ {0, ACPI_RSMALL(struct aml_resource_end_dependent), ACPI_RS_SIZE_MIN},
{0, ACPI_RSMALL(struct aml_resource_io),
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_io)},
+ ACPI_RS_SIZE(struct acpi_resource_io)},
{0, ACPI_RSMALL(struct aml_resource_fixed_io),
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io)},
+ ACPI_RS_SIZE(struct acpi_resource_fixed_io)},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{1, ACPI_RSMALL(struct aml_resource_vendor_small),
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor)},
- {0, ACPI_RSMALL(struct aml_resource_end_tag), ACPI_RESOURCE_LENGTH}
+ ACPI_RS_SIZE(struct acpi_resource_vendor)},
+ {0, ACPI_RSMALL(struct aml_resource_end_tag), ACPI_RS_SIZE_MIN}
};
struct acpi_resource_info acpi_gbl_lg_resource_info[] = {
{0, 0, 0},
{0, ACPI_RLARGE(struct aml_resource_memory24),
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_memory24)},
+ ACPI_RS_SIZE(struct acpi_resource_memory24)},
{0, ACPI_RLARGE(struct aml_resource_generic_register),
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_register)},
+ ACPI_RS_SIZE(struct acpi_resource_generic_register)},
{0, 0, 0},
{1, ACPI_RLARGE(struct aml_resource_vendor_large),
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor)},
+ ACPI_RS_SIZE(struct acpi_resource_vendor)},
{0, ACPI_RLARGE(struct aml_resource_memory32),
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_memory32)},
+ ACPI_RS_SIZE(struct acpi_resource_memory32)},
{0, ACPI_RLARGE(struct aml_resource_fixed_memory32),
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_memory32)},
+ ACPI_RS_SIZE(struct acpi_resource_fixed_memory32)},
{1, ACPI_RLARGE(struct aml_resource_address32),
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32)},
+ ACPI_RS_SIZE(struct acpi_resource_address32)},
{1, ACPI_RLARGE(struct aml_resource_address16),
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16)},
+ ACPI_RS_SIZE(struct acpi_resource_address16)},
{1, ACPI_RLARGE(struct aml_resource_extended_irq),
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_extended_irq)},
+ ACPI_RS_SIZE(struct acpi_resource_extended_irq)},
{1, ACPI_RLARGE(struct aml_resource_address64),
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64)},
+ ACPI_RS_SIZE(struct acpi_resource_address64)},
{0, ACPI_RLARGE(struct aml_resource_extended_address64),
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_extended_address64)}
+ ACPI_RS_SIZE(struct acpi_resource_extended_address64)}
};
diff --git a/drivers/acpi/resources/rsio.c b/drivers/acpi/resources/rsio.c
index 0dab8cdfa80..ef24ba110c6 100644
--- a/drivers/acpi/resources/rsio.c
+++ b/drivers/acpi/resources/rsio.c
@@ -49,269 +49,206 @@ ACPI_MODULE_NAME("rsio")
/*******************************************************************************
*
- * FUNCTION: acpi_rs_get_io
- *
- * PARAMETERS: Aml - Pointer to the AML resource descriptor
- * aml_resource_length - Length of the resource from the AML header
- * Resource - Where the internal resource is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
- * internal resource descriptor, simplifying bitflags and handling
- * alignment and endian issues if necessary.
+ * acpi_rs_convert_io
*
******************************************************************************/
-acpi_status
-acpi_rs_get_io(union aml_resource *aml,
- u16 aml_resource_length, struct acpi_resource *resource)
-{
- ACPI_FUNCTION_TRACE("rs_get_io");
+struct acpi_rsconvert_info acpi_rs_convert_io[5] = {
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_IO,
+ ACPI_RS_SIZE(struct acpi_resource_io),
+ ACPI_RSC_TABLE_SIZE(acpi_rs_convert_io)},
- /* Get the Decode flag */
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_IO,
+ sizeof(struct aml_resource_io),
+ 0},
- resource->data.io.io_decode = aml->io.information & 0x01;
+ /* Decode flag */
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.io.io_decode),
+ AML_OFFSET(io.flags),
+ 0},
/*
- * Get the following contiguous fields from the AML descriptor:
- * Minimum Base Address
- * Maximum Base Address
+ * These fields are contiguous in both the source and destination:
* Address Alignment
* Length
+ * Minimum Base Address
+ * Maximum Base Address
*/
- ACPI_MOVE_16_TO_32(&resource->data.io.minimum, &aml->io.minimum);
- ACPI_MOVE_16_TO_32(&resource->data.io.maximum, &aml->io.maximum);
- resource->data.io.alignment = aml->io.alignment;
- resource->data.io.address_length = aml->io.address_length;
-
- /* Complete the resource header */
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.io.alignment),
+ AML_OFFSET(io.alignment),
+ 2},
- resource->type = ACPI_RESOURCE_TYPE_IO;
- resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_io);
- return_ACPI_STATUS(AE_OK);
-}
+ {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.io.minimum),
+ AML_OFFSET(io.minimum),
+ 2}
+};
/*******************************************************************************
*
- * FUNCTION: acpi_rs_set_io
- *
- * PARAMETERS: Resource - Pointer to the resource descriptor
- * Aml - Where the AML descriptor is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert an internal resource descriptor to the corresponding
- * external AML resource descriptor.
+ * acpi_rs_convert_fixed_io
*
******************************************************************************/
-acpi_status
-acpi_rs_set_io(struct acpi_resource *resource, union aml_resource *aml)
-{
- ACPI_FUNCTION_TRACE("rs_set_io");
-
- /* I/O Information Byte */
-
- aml->io.information = (u8) (resource->data.io.io_decode & 0x01);
+struct acpi_rsconvert_info acpi_rs_convert_fixed_io[4] = {
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_FIXED_IO,
+ ACPI_RS_SIZE(struct acpi_resource_fixed_io),
+ ACPI_RSC_TABLE_SIZE(acpi_rs_convert_fixed_io)},
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_FIXED_IO,
+ sizeof(struct aml_resource_fixed_io),
+ 0},
/*
- * Set the following contiguous fields in the AML descriptor:
- * Minimum Base Address
- * Maximum Base Address
- * Address Alignment
+ * These fields are contiguous in both the source and destination:
+ * Base Address
* Length
*/
- ACPI_MOVE_32_TO_16(&aml->io.minimum, &resource->data.io.minimum);
- ACPI_MOVE_32_TO_16(&aml->io.maximum, &resource->data.io.maximum);
- aml->io.alignment = (u8) resource->data.io.alignment;
- aml->io.address_length = (u8) resource->data.io.address_length;
-
- /* Complete the AML descriptor header */
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.fixed_io.address_length),
+ AML_OFFSET(fixed_io.address_length),
+ 1},
- acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_IO,
- sizeof(struct aml_resource_io), aml);
- return_ACPI_STATUS(AE_OK);
-}
+ {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.fixed_io.address),
+ AML_OFFSET(fixed_io.address),
+ 1}
+};
/*******************************************************************************
*
- * FUNCTION: acpi_rs_get_fixed_io
- *
- * PARAMETERS: Aml - Pointer to the AML resource descriptor
- * aml_resource_length - Length of the resource from the AML header
- * Resource - Where the internal resource is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
- * internal resource descriptor, simplifying bitflags and handling
- * alignment and endian issues if necessary.
+ * acpi_rs_convert_generic_reg
*
******************************************************************************/
-acpi_status
-acpi_rs_get_fixed_io(union aml_resource *aml,
- u16 aml_resource_length, struct acpi_resource *resource)
-{
- ACPI_FUNCTION_TRACE("rs_get_fixed_io");
+struct acpi_rsconvert_info acpi_rs_convert_generic_reg[4] = {
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_GENERIC_REGISTER,
+ ACPI_RS_SIZE(struct acpi_resource_generic_register),
+ ACPI_RSC_TABLE_SIZE(acpi_rs_convert_generic_reg)},
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_GENERIC_REGISTER,
+ sizeof(struct aml_resource_generic_register),
+ 0},
/*
- * Get the following contiguous fields from the AML descriptor:
- * Base Address
- * Length
+ * These fields are contiguous in both the source and destination:
+ * Address Space ID
+ * Register Bit Width
+ * Register Bit Offset
+ * Access Size
*/
- ACPI_MOVE_16_TO_32(&resource->data.fixed_io.address,
- &aml->fixed_io.address);
- resource->data.fixed_io.address_length = aml->fixed_io.address_length;
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.generic_reg.space_id),
+ AML_OFFSET(generic_reg.address_space_id),
+ 4},
- /* Complete the resource header */
+ /* Get the Register Address */
- resource->type = ACPI_RESOURCE_TYPE_FIXED_IO;
- resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io);
- return_ACPI_STATUS(AE_OK);
-}
+ {ACPI_RSC_MOVE64, ACPI_RS_OFFSET(data.generic_reg.address),
+ AML_OFFSET(generic_reg.address),
+ 1}
+};
/*******************************************************************************
*
- * FUNCTION: acpi_rs_set_fixed_io
- *
- * PARAMETERS: Resource - Pointer to the resource descriptor
- * Aml - Where the AML descriptor is returned
+ * acpi_rs_convert_end_dpf
*
- * RETURN: Status
+ ******************************************************************************/
+
+struct acpi_rsconvert_info acpi_rs_convert_end_dpf[2] = {
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_END_DEPENDENT,
+ ACPI_RS_SIZE_MIN,
+ ACPI_RSC_TABLE_SIZE(acpi_rs_convert_end_dpf)},
+
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_END_DEPENDENT,
+ sizeof(struct aml_resource_end_dependent),
+ 0}
+};
+
+/*******************************************************************************
*
- * DESCRIPTION: Convert an internal resource descriptor to the corresponding
- * external AML resource descriptor.
+ * acpi_rs_convert_end_tag
*
******************************************************************************/
-acpi_status
-acpi_rs_set_fixed_io(struct acpi_resource *resource, union aml_resource *aml)
-{
- ACPI_FUNCTION_TRACE("rs_set_fixed_io");
+struct acpi_rsconvert_info acpi_rs_convert_end_tag[2] = {
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_END_TAG,
+ ACPI_RS_SIZE_MIN,
+ ACPI_RSC_TABLE_SIZE(acpi_rs_convert_end_tag)},
/*
- * Set the following contiguous fields in the AML descriptor:
- * Base Address
- * Length
+ * Note: The checksum field is set to zero, meaning that the resource
+ * data is treated as if the checksum operation succeeded.
+ * (ACPI Spec 1.0b Section 6.4.2.8)
*/
- ACPI_MOVE_32_TO_16(&aml->fixed_io.address,
- &resource->data.fixed_io.address);
- aml->fixed_io.address_length =
- (u8) resource->data.fixed_io.address_length;
-
- /* Complete the AML descriptor header */
-
- acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_FIXED_IO,
- sizeof(struct aml_resource_fixed_io), aml);
- return_ACPI_STATUS(AE_OK);
-}
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_END_TAG,
+ sizeof(struct aml_resource_end_tag),
+ 0}
+};
/*******************************************************************************
*
- * FUNCTION: acpi_rs_get_dma
- *
- * PARAMETERS: Aml - Pointer to the AML resource descriptor
- * aml_resource_length - Length of the resource from the AML header
- * Resource - Where the internal resource is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
- * internal resource descriptor, simplifying bitflags and handling
- * alignment and endian issues if necessary.
+ * acpi_rs_get_start_dpf
*
******************************************************************************/
-acpi_status
-acpi_rs_get_dma(union aml_resource *aml,
- u16 aml_resource_length, struct acpi_resource *resource)
-{
- u32 channel_count = 0;
- u32 i;
- u8 temp8;
+struct acpi_rsconvert_info acpi_rs_get_start_dpf[5] = {
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_START_DEPENDENT,
+ ACPI_RS_SIZE(struct acpi_resource_start_dependent),
+ ACPI_RSC_TABLE_SIZE(acpi_rs_get_start_dpf)},
- ACPI_FUNCTION_TRACE("rs_get_dma");
+ /* Defaults for Compatibility and Performance priorities */
- /* Decode the DMA channel bits */
+ {ACPI_RSC_SET8, ACPI_RS_OFFSET(data.start_dpf.compatibility_priority),
+ ACPI_ACCEPTABLE_CONFIGURATION,
+ 2},
- for (i = 0; i < 8; i++) {
- if ((aml->dma.dma_channel_mask >> i) & 0x01) {
- resource->data.dma.channels[channel_count] = i;
- channel_count++;
- }
- }
+ /* All done if there is no flag byte present in the descriptor */
- resource->length = 0;
- resource->data.dma.channel_count = channel_count;
+ {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 1},
- /*
- * Calculate the structure size based upon the number of channels
- * Note: Zero DMA channels is valid
- */
- if (channel_count > 0) {
- resource->length = (u32) (channel_count - 1) * 4;
- }
-
- /* Get the flags: transfer preference, bus mastering, channel speed */
+ /* Flag byte is present, get the flags */
- temp8 = aml->dma.flags;
- resource->data.dma.transfer = temp8 & 0x03;
- resource->data.dma.bus_master = (temp8 >> 2) & 0x01;
- resource->data.dma.type = (temp8 >> 5) & 0x03;
+ {ACPI_RSC_2BITFLAG,
+ ACPI_RS_OFFSET(data.start_dpf.compatibility_priority),
+ AML_OFFSET(start_dpf.flags),
+ 0},
- if (resource->data.dma.transfer == 0x03) {
- ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
- "Invalid DMA.Transfer preference (3)\n"));
- return_ACPI_STATUS(AE_BAD_DATA);
- }
-
- /* Complete the resource header */
-
- resource->type = ACPI_RESOURCE_TYPE_DMA;
- resource->length += ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma);
- return_ACPI_STATUS(AE_OK);
-}
+ {ACPI_RSC_2BITFLAG,
+ ACPI_RS_OFFSET(data.start_dpf.performance_robustness),
+ AML_OFFSET(start_dpf.flags),
+ 2}
+};
/*******************************************************************************
*
- * FUNCTION: acpi_rs_set_dma
- *
- * PARAMETERS: Resource - Pointer to the resource descriptor
- * Aml - Where the AML descriptor is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert an internal resource descriptor to the corresponding
- * external AML resource descriptor.
+ * acpi_rs_set_start_dpf
*
******************************************************************************/
-acpi_status
-acpi_rs_set_dma(struct acpi_resource *resource, union aml_resource *aml)
-{
- u8 i;
-
- ACPI_FUNCTION_TRACE("rs_set_dma");
+struct acpi_rsconvert_info acpi_rs_set_start_dpf[6] = {
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_START_DEPENDENT,
+ sizeof(struct aml_resource_start_dependent),
+ ACPI_RSC_TABLE_SIZE(acpi_rs_set_start_dpf)},
- /* Convert channel list to 8-bit DMA channel bitmask */
+ /* Set the default flag values */
- aml->dma.dma_channel_mask = 0;
- for (i = 0; i < resource->data.dma.channel_count; i++) {
- aml->dma.dma_channel_mask |=
- (1 << resource->data.dma.channels[i]);
- }
+ {ACPI_RSC_2BITFLAG,
+ ACPI_RS_OFFSET(data.start_dpf.compatibility_priority),
+ AML_OFFSET(start_dpf.flags),
+ 0},
- /* Set the DMA Flag bits */
+ {ACPI_RSC_2BITFLAG,
+ ACPI_RS_OFFSET(data.start_dpf.performance_robustness),
+ AML_OFFSET(start_dpf.flags),
+ 2},
+ /*
+ * All done if flags byte is necessary -- if either priority value
+ * is not ACPI_ACCEPTABLE_CONFIGURATION
+ */
+ {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE,
+ ACPI_RS_OFFSET(data.start_dpf.compatibility_priority),
+ ACPI_ACCEPTABLE_CONFIGURATION},
- aml->dma.flags = (u8)
- (((resource->data.dma.type & 0x03) << 5) |
- ((resource->data.dma.bus_master & 0x01) << 2) |
- (resource->data.dma.transfer & 0x03));
+ {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE,
+ ACPI_RS_OFFSET(data.start_dpf.performance_robustness),
+ ACPI_ACCEPTABLE_CONFIGURATION},
- /* Complete the AML descriptor header */
+ /* Flag byte is not necessary */
- acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_DMA,
- sizeof(struct aml_resource_dma), aml);
- return_ACPI_STATUS(AE_OK);
-}
+ {ACPI_RSC_LENGTH, 0, 0,
+ sizeof(struct aml_resource_start_dependent_noprio)}
+};
diff --git a/drivers/acpi/resources/rsirq.c b/drivers/acpi/resources/rsirq.c
index 4e854ba7081..79e71257b69 100644
--- a/drivers/acpi/resources/rsirq.c
+++ b/drivers/acpi/resources/rsirq.c
@@ -49,325 +49,182 @@ ACPI_MODULE_NAME("rsirq")
/*******************************************************************************
*
- * FUNCTION: acpi_rs_get_irq
- *
- * PARAMETERS: Aml - Pointer to the AML resource descriptor
- * aml_resource_length - Length of the resource from the AML header
- * Resource - Where the internal resource is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
- * internal resource descriptor, simplifying bitflags and handling
- * alignment and endian issues if necessary.
+ * acpi_rs_get_irq
*
******************************************************************************/
-acpi_status
-acpi_rs_get_irq(union aml_resource *aml,
- u16 aml_resource_length, struct acpi_resource *resource)
-{
- u16 temp16 = 0;
- u32 interrupt_count = 0;
- u32 i;
- u32 resource_length;
-
- ACPI_FUNCTION_TRACE("rs_get_irq");
+struct acpi_rsconvert_info acpi_rs_get_irq[7] = {
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_IRQ,
+ ACPI_RS_SIZE(struct acpi_resource_irq),
+ ACPI_RSC_TABLE_SIZE(acpi_rs_get_irq)},
/* Get the IRQ mask (bytes 1:2) */
- ACPI_MOVE_16_TO_16(&temp16, &aml->irq.irq_mask);
-
- /* Decode the IRQ bits (up to 16 possible) */
-
- for (i = 0; i < 16; i++) {
- if ((temp16 >> i) & 0x01) {
- resource->data.irq.interrupts[interrupt_count] = i;
- interrupt_count++;
- }
- }
-
- /* Zero interrupts is valid */
-
- resource_length = 0;
- resource->data.irq.interrupt_count = interrupt_count;
- if (interrupt_count > 0) {
- /* Calculate the structure size based upon the number of interrupts */
-
- resource_length = (u32) (interrupt_count - 1) * 4;
- }
-
- /* Get Flags (Byte 3) if it is used */
-
- if (aml_resource_length == 3) {
- /* Check for HE, LL interrupts */
-
- switch (aml->irq.flags & 0x09) {
- case 0x01: /* HE */
- resource->data.irq.triggering = ACPI_EDGE_SENSITIVE;
- resource->data.irq.polarity = ACPI_ACTIVE_HIGH;
- break;
-
- case 0x08: /* LL */
- resource->data.irq.triggering = ACPI_LEVEL_SENSITIVE;
- resource->data.irq.polarity = ACPI_ACTIVE_LOW;
- break;
-
- default:
- /*
- * Only _LL and _HE polarity/trigger interrupts
- * are allowed (ACPI spec, section "IRQ Format")
- * so 0x00 and 0x09 are illegal.
- */
- ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
- "Invalid interrupt polarity/trigger in resource list, %X\n",
- aml->irq.flags));
- return_ACPI_STATUS(AE_BAD_DATA);
- }
-
- /* Get Sharing flag */
-
- resource->data.irq.sharable = (aml->irq.flags >> 3) & 0x01;
- } else {
- /*
- * Default configuration: assume Edge Sensitive, Active High,
- * Non-Sharable as per the ACPI Specification
- */
- resource->data.irq.triggering = ACPI_EDGE_SENSITIVE;
- resource->data.irq.polarity = ACPI_ACTIVE_HIGH;
- resource->data.irq.sharable = ACPI_EXCLUSIVE;
- }
-
- /* Complete the resource header */
-
- resource->type = ACPI_RESOURCE_TYPE_IRQ;
- resource->length =
- resource_length + ACPI_SIZEOF_RESOURCE(struct acpi_resource_irq);
- return_ACPI_STATUS(AE_OK);
-}
+ {ACPI_RSC_BITMASK16, ACPI_RS_OFFSET(data.irq.interrupts[0]),
+ AML_OFFSET(irq.irq_mask),
+ ACPI_RS_OFFSET(data.irq.interrupt_count)},
+
+ /* Set default flags (others are zero) */
+
+ {ACPI_RSC_SET8, ACPI_RS_OFFSET(data.irq.triggering),
+ ACPI_EDGE_SENSITIVE,
+ 1},
+
+ /* All done if no flag byte present in descriptor */
+
+ {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 3},
+
+ /* Get flags: Triggering[0], Polarity[3], Sharing[4] */
+
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.triggering),
+ AML_OFFSET(irq.flags),
+ 0},
+
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.polarity),
+ AML_OFFSET(irq.flags),
+ 3},
+
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.sharable),
+ AML_OFFSET(irq.flags),
+ 4}
+};
/*******************************************************************************
*
- * FUNCTION: acpi_rs_set_irq
- *
- * PARAMETERS: Resource - Pointer to the resource descriptor
- * Aml - Where the AML descriptor is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert an internal resource descriptor to the corresponding
- * external AML resource descriptor.
+ * acpi_rs_set_irq
*
******************************************************************************/
-acpi_status
-acpi_rs_set_irq(struct acpi_resource *resource, union aml_resource *aml)
-{
- acpi_size descriptor_length;
- u16 irq_mask;
- u8 i;
-
- ACPI_FUNCTION_TRACE("rs_set_irq");
+struct acpi_rsconvert_info acpi_rs_set_irq[9] = {
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_IRQ,
+ sizeof(struct aml_resource_irq),
+ ACPI_RSC_TABLE_SIZE(acpi_rs_set_irq)},
/* Convert interrupt list to 16-bit IRQ bitmask */
- irq_mask = 0;
- for (i = 0; i < resource->data.irq.interrupt_count; i++) {
- irq_mask |= (1 << resource->data.irq.interrupts[i]);
- }
+ {ACPI_RSC_BITMASK16, ACPI_RS_OFFSET(data.irq.interrupts[0]),
+ AML_OFFSET(irq.irq_mask),
+ ACPI_RS_OFFSET(data.irq.interrupt_count)},
+
+ /* Set the flags byte by default */
- /* Set the interrupt mask */
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.triggering),
+ AML_OFFSET(irq.flags),
+ 0},
- ACPI_MOVE_16_TO_16(&aml->irq.irq_mask, &irq_mask);
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.polarity),
+ AML_OFFSET(irq.flags),
+ 3},
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.sharable),
+ AML_OFFSET(irq.flags),
+ 4},
/*
- * The descriptor field is set based upon whether a third byte is
- * needed to contain the IRQ Information.
+ * Check if the flags byte is necessary. Not needed if the flags are:
+ * ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_HIGH, ACPI_EXCLUSIVE
*/
- if ((resource->data.irq.triggering == ACPI_EDGE_SENSITIVE) &&
- (resource->data.irq.polarity == ACPI_ACTIVE_HIGH) &&
- (resource->data.irq.sharable == ACPI_EXCLUSIVE)) {
- /* irq_no_flags() descriptor can be used */
-
- descriptor_length = sizeof(struct aml_resource_irq_noflags);
- } else {
- /* Irq() descriptor must be used */
-
- descriptor_length = sizeof(struct aml_resource_irq);
-
- /* Set the IRQ Info byte */
+ {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE,
+ ACPI_RS_OFFSET(data.irq.triggering),
+ ACPI_EDGE_SENSITIVE},
- aml->irq.flags = (u8)
- ((resource->data.irq.sharable & 0x01) << 4);
+ {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE,
+ ACPI_RS_OFFSET(data.irq.polarity),
+ ACPI_ACTIVE_HIGH},
- if (ACPI_LEVEL_SENSITIVE == resource->data.irq.triggering &&
- ACPI_ACTIVE_LOW == resource->data.irq.polarity) {
- aml->irq.flags |= 0x08;
- } else {
- aml->irq.flags |= 0x01;
- }
- }
+ {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE,
+ ACPI_RS_OFFSET(data.irq.sharable),
+ ACPI_EXCLUSIVE},
- /* Complete the AML descriptor header */
+ /* irq_no_flags() descriptor can be used */
- acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_IRQ, descriptor_length,
- aml);
- return_ACPI_STATUS(AE_OK);
-}
+ {ACPI_RSC_LENGTH, 0, 0, sizeof(struct aml_resource_irq_noflags)}
+};
/*******************************************************************************
*
- * FUNCTION: acpi_rs_get_ext_irq
- *
- * PARAMETERS: Aml - Pointer to the AML resource descriptor
- * aml_resource_length - Length of the resource from the AML header
- * Resource - Where the internal resource is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
- * internal resource descriptor, simplifying bitflags and handling
- * alignment and endian issues if necessary.
+ * acpi_rs_convert_ext_irq
*
******************************************************************************/
-acpi_status
-acpi_rs_get_ext_irq(union aml_resource *aml,
- u16 aml_resource_length, struct acpi_resource *resource)
-{
- char *out_resource_string;
- u8 temp8;
-
- ACPI_FUNCTION_TRACE("rs_get_ext_irq");
-
- /* Get the flag bits */
+struct acpi_rsconvert_info acpi_rs_convert_ext_irq[9] = {
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_EXTENDED_IRQ,
+ ACPI_RS_SIZE(struct acpi_resource_extended_irq),
+ ACPI_RSC_TABLE_SIZE(acpi_rs_convert_ext_irq)},
- temp8 = aml->extended_irq.flags;
- resource->data.extended_irq.producer_consumer = temp8 & 0x01;
- resource->data.extended_irq.polarity = (temp8 >> 2) & 0x01;
- resource->data.extended_irq.sharable = (temp8 >> 3) & 0x01;
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_EXTENDED_IRQ,
+ sizeof(struct aml_resource_extended_irq),
+ 0},
- /*
- * Check for Interrupt Mode
- *
- * The definition of an Extended IRQ changed between ACPI spec v1.0b
- * and ACPI spec 2.0 (section 6.4.3.6 in both).
- *
- * - Edge/Level are defined opposite in the table vs the headers
- */
- resource->data.extended_irq.triggering =
- (temp8 & 0x2) ? ACPI_EDGE_SENSITIVE : ACPI_LEVEL_SENSITIVE;
+ /* Flag bits */
- /* Get the IRQ Table length (Byte4) */
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.producer_consumer),
+ AML_OFFSET(extended_irq.flags),
+ 0},
- temp8 = aml->extended_irq.table_length;
- resource->data.extended_irq.interrupt_count = temp8;
- if (temp8 < 1) {
- /* Must have at least one IRQ */
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.triggering),
+ AML_OFFSET(extended_irq.flags),
+ 1},
- return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH);
- }
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.polarity),
+ AML_OFFSET(extended_irq.flags),
+ 2},
- /*
- * Add any additional structure size to properly calculate
- * the next pointer at the end of this function
- */
- resource->length = (temp8 - 1) * 4;
- out_resource_string = ACPI_CAST_PTR(char,
- (&resource->data.extended_irq.
- interrupts[0] + temp8));
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.sharable),
+ AML_OFFSET(extended_irq.flags),
+ 3},
- /* Get every IRQ in the table, each is 32 bits */
+ /* IRQ Table length (Byte4) */
- acpi_rs_move_data(resource->data.extended_irq.interrupts,
- aml->extended_irq.interrupt_number,
- (u16) temp8, ACPI_MOVE_TYPE_32_TO_32);
+ {ACPI_RSC_COUNT, ACPI_RS_OFFSET(data.extended_irq.interrupt_count),
+ AML_OFFSET(extended_irq.interrupt_count),
+ sizeof(u32)}
+ ,
- /* Get the optional resource_source (index and string) */
+ /* Copy every IRQ in the table, each is 32 bits */
- resource->length +=
- acpi_rs_get_resource_source(aml_resource_length,
- (acpi_size) resource->length +
- sizeof(struct
- aml_resource_extended_irq),
- &resource->data.extended_irq.
- resource_source, aml,
- out_resource_string);
+ {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.extended_irq.interrupts[0]),
+ AML_OFFSET(extended_irq.interrupts[0]),
+ 0}
+ ,
- /* Complete the resource header */
+ /* Optional resource_source (Index and String) */
- resource->type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ;
- resource->length +=
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_extended_irq);
- return_ACPI_STATUS(AE_OK);
-}
+ {ACPI_RSC_SOURCEX, ACPI_RS_OFFSET(data.extended_irq.resource_source),
+ ACPI_RS_OFFSET(data.extended_irq.interrupts[0]),
+ sizeof(struct aml_resource_extended_irq)}
+};
/*******************************************************************************
*
- * FUNCTION: acpi_rs_set_ext_irq
- *
- * PARAMETERS: Resource - Pointer to the resource descriptor
- * Aml - Where the AML descriptor is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert an internal resource descriptor to the corresponding
- * external AML resource descriptor.
+ * acpi_rs_convert_dma
*
******************************************************************************/
-acpi_status
-acpi_rs_set_ext_irq(struct acpi_resource *resource, union aml_resource *aml)
-{
- acpi_size descriptor_length;
-
- ACPI_FUNCTION_TRACE("rs_set_ext_irq");
-
- /* Set the Interrupt vector flags */
-
- aml->extended_irq.flags = (u8)
- ((resource->data.extended_irq.producer_consumer & 0x01) |
- ((resource->data.extended_irq.sharable & 0x01) << 3) |
- ((resource->data.extended_irq.polarity & 0x1) << 2));
-
- /*
- * Set the Interrupt Mode
- *
- * The definition of an Extended IRQ changed between ACPI spec v1.0b
- * and ACPI spec 2.0 (section 6.4.3.6 in both). This code does not
- * implement the more restrictive definition of 1.0b
- *
- * - Edge/Level are defined opposite in the table vs the headers
- */
- if (resource->data.extended_irq.triggering == ACPI_EDGE_SENSITIVE) {
- aml->extended_irq.flags |= 0x02;
- }
-
- /* Set the Interrupt table length */
-
- aml->extended_irq.table_length = (u8)
- resource->data.extended_irq.interrupt_count;
+struct acpi_rsconvert_info acpi_rs_convert_dma[6] = {
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_DMA,
+ ACPI_RS_SIZE(struct acpi_resource_dma),
+ ACPI_RSC_TABLE_SIZE(acpi_rs_convert_dma)},
- descriptor_length = (sizeof(struct aml_resource_extended_irq) - 4) +
- ((acpi_size) resource->data.extended_irq.interrupt_count *
- sizeof(u32));
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_DMA,
+ sizeof(struct aml_resource_dma),
+ 0},
- /* Set each interrupt value */
+ /* Flags: transfer preference, bus mastering, channel speed */
- acpi_rs_move_data(aml->extended_irq.interrupt_number,
- resource->data.extended_irq.interrupts,
- (u16) resource->data.extended_irq.interrupt_count,
- ACPI_MOVE_TYPE_32_TO_32);
+ {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.dma.transfer),
+ AML_OFFSET(dma.flags),
+ 0},
- /* Resource Source Index and Resource Source are optional */
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.dma.bus_master),
+ AML_OFFSET(dma.flags),
+ 2},
- descriptor_length = acpi_rs_set_resource_source(aml, descriptor_length,
- &resource->data.
- extended_irq.
- resource_source);
+ {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.dma.type),
+ AML_OFFSET(dma.flags),
+ 5},
- /* Complete the AML descriptor header */
+ /* DMA channel mask bits */
- acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_EXTENDED_IRQ,
- descriptor_length, aml);
- return_ACPI_STATUS(AE_OK);
-}
+ {ACPI_RSC_BITMASK, ACPI_RS_OFFSET(data.dma.channels[0]),
+ AML_OFFSET(dma.dma_channel_mask),
+ ACPI_RS_OFFSET(data.dma.channel_count)}
+};
diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c
index f72d42e0927..ee17ef3315f 100644
--- a/drivers/acpi/resources/rslist.c
+++ b/drivers/acpi/resources/rslist.c
@@ -48,7 +48,8 @@
ACPI_MODULE_NAME("rslist")
/* Local prototypes */
-static ACPI_GET_RESOURCE_HANDLER acpi_rs_get_resource_handler(u8 resource_type);
+static struct acpi_rsconvert_info *acpi_rs_get_conversion_info(u8
+ resource_type);
static acpi_status acpi_rs_validate_resource_length(union aml_resource *aml);
@@ -83,7 +84,7 @@ static acpi_status acpi_rs_validate_resource_length(union aml_resource *aml)
return (AE_AML_INVALID_RESOURCE_TYPE);
}
- resource_length = acpi_rs_get_resource_length(aml);
+ resource_length = acpi_ut_get_resource_length(aml);
minimum_aml_resource_length =
resource_info->minimum_aml_resource_length;
@@ -115,18 +116,17 @@ static acpi_status acpi_rs_validate_resource_length(union aml_resource *aml)
/*******************************************************************************
*
- * FUNCTION: acpi_rs_get_resource_handler
+ * FUNCTION: acpi_rs_get_conversion_info
*
* PARAMETERS: resource_type - Byte 0 of a resource descriptor
*
- * RETURN: Pointer to the resource conversion handler
+ * RETURN: Pointer to the resource conversion info table
*
- * DESCRIPTION: Extract the Resource Type/Name from the first byte of
- * a resource descriptor.
+ * DESCRIPTION: Get the conversion table associated with this resource type
*
******************************************************************************/
-static ACPI_GET_RESOURCE_HANDLER acpi_rs_get_resource_handler(u8 resource_type)
+static struct acpi_rsconvert_info *acpi_rs_get_conversion_info(u8 resource_type)
{
ACPI_FUNCTION_ENTRY();
@@ -174,33 +174,24 @@ acpi_rs_convert_aml_to_resources(u8 * aml_buffer,
acpi_status status;
acpi_size bytes_parsed = 0;
struct acpi_resource *resource;
- u16 resource_length;
- u32 descriptor_length;
- ACPI_GET_RESOURCE_HANDLER handler;
+ acpi_rsdesc_size descriptor_length;
+ struct acpi_rsconvert_info *info;
ACPI_FUNCTION_TRACE("rs_convert_aml_to_resources");
/* Loop until end-of-buffer or an end_tag is found */
while (bytes_parsed < aml_buffer_length) {
- /* Get the handler associated with this Descriptor Type */
+ /* Get the conversion table associated with this Descriptor Type */
- handler = acpi_rs_get_resource_handler(*aml_buffer);
- if (!handler) {
- /* No handler indicates invalid resource type */
+ info = acpi_rs_get_conversion_info(*aml_buffer);
+ if (!info) {
+ /* No table indicates an invalid resource type */
return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
}
- resource_length =
- acpi_rs_get_resource_length(ACPI_CAST_PTR
- (union aml_resource,
- aml_buffer));
-
- descriptor_length =
- acpi_rs_get_descriptor_length(ACPI_CAST_PTR
- (union aml_resource,
- aml_buffer));
+ descriptor_length = acpi_ut_get_descriptor_length(aml_buffer);
/*
* Perform limited validation of the resource length, based upon
@@ -214,11 +205,16 @@ acpi_rs_convert_aml_to_resources(u8 * aml_buffer,
return_ACPI_STATUS(status);
}
- /* Convert a byte stream resource to local resource struct */
+ /* Convert the AML byte stream resource to a local resource struct */
- status = handler(ACPI_CAST_PTR(union aml_resource, aml_buffer),
- resource_length,
- ACPI_CAST_PTR(struct acpi_resource, buffer));
+ status =
+ acpi_rs_convert_aml_to_resource(ACPI_CAST_PTR
+ (struct acpi_resource,
+ buffer),
+ ACPI_CAST_PTR(union
+ aml_resource,
+ aml_buffer),
+ info);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("Could not convert AML resource (type %X) to resource, %s\n", *aml_buffer, acpi_format_exception(status)));
return_ACPI_STATUS(status);
@@ -232,7 +228,7 @@ acpi_rs_convert_aml_to_resources(u8 * aml_buffer,
/* Normal exit on completion of an end_tag resource descriptor */
- if (acpi_rs_get_resource_type(*aml_buffer) ==
+ if (acpi_ut_get_resource_type(aml_buffer) ==
ACPI_RESOURCE_NAME_END_TAG) {
return_ACPI_STATUS(AE_OK);
}
@@ -276,14 +272,15 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
acpi_size aml_size_needed, u8 * output_buffer)
{
u8 *aml_buffer = output_buffer;
+ u8 *end_aml_buffer = output_buffer + aml_size_needed;
acpi_status status;
ACPI_FUNCTION_TRACE("rs_convert_resources_to_aml");
- /* Convert each resource descriptor in the list */
+ /* Walk the resource descriptor list, convert each descriptor */
- while (1) {
- /* Validate Resource Descriptor Type before dispatch */
+ while (aml_buffer < end_aml_buffer) {
+ /* Validate the Resource Type */
if (resource->type > ACPI_RESOURCE_TYPE_MAX) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
@@ -292,14 +289,14 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
return_ACPI_STATUS(AE_BAD_DATA);
}
- /* Perform the conversion per resource type */
+ /* Perform the conversion */
- status =
- acpi_gbl_set_resource_dispatch[resource->type] (resource,
- ACPI_CAST_PTR
- (union
- aml_resource,
- aml_buffer));
+ status = acpi_rs_convert_resource_to_aml(resource,
+ ACPI_CAST_PTR(union
+ aml_resource,
+ aml_buffer),
+ acpi_gbl_set_resource_dispatch
+ [resource->type]);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("Could not convert resource (type %X) to AML, %s\n", resource->type, acpi_format_exception(status)));
return_ACPI_STATUS(status);
@@ -323,18 +320,23 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
return_ACPI_STATUS(AE_OK);
}
- /* Extract the total length of the new descriptor */
- /* Set the aml_buffer to point to the next (output) resource descriptor */
-
- aml_buffer +=
- acpi_rs_get_descriptor_length(ACPI_CAST_PTR
- (union aml_resource,
- aml_buffer));
+ /*
+ * Extract the total length of the new descriptor and set the
+ * aml_buffer to point to the next (output) resource descriptor
+ */
+ aml_buffer += acpi_ut_get_descriptor_length(aml_buffer);
/* Point to the next input resource descriptor */
resource =
ACPI_PTR_ADD(struct acpi_resource, resource,
resource->length);
+
+ /* Check for end-of-list, normal exit */
+
}
+
+ /* Completed buffer, but did not find an end_tag resource descriptor */
+
+ return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
}
diff --git a/drivers/acpi/resources/rsmemory.c b/drivers/acpi/resources/rsmemory.c
index 47e979e7ba3..418a3fb6407 100644
--- a/drivers/acpi/resources/rsmemory.c
+++ b/drivers/acpi/resources/rsmemory.c
@@ -49,260 +49,187 @@ ACPI_MODULE_NAME("rsmemory")
/*******************************************************************************
*
- * FUNCTION: acpi_rs_get_memory24
- *
- * PARAMETERS: Aml - Pointer to the AML resource descriptor
- * aml_resource_length - Length of the resource from the AML header
- * Resource - Where the internal resource is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
- * internal resource descriptor, simplifying bitflags and handling
- * alignment and endian issues if necessary.
+ * acpi_rs_convert_memory24
*
******************************************************************************/
-acpi_status
-acpi_rs_get_memory24(union aml_resource * aml,
- u16 aml_resource_length, struct acpi_resource * resource)
-{
- ACPI_FUNCTION_TRACE("rs_get_memory24");
+struct acpi_rsconvert_info acpi_rs_convert_memory24[4] = {
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_MEMORY24,
+ ACPI_RS_SIZE(struct acpi_resource_memory24),
+ ACPI_RSC_TABLE_SIZE(acpi_rs_convert_memory24)},
- /* Get the Read/Write bit */
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_MEMORY24,
+ sizeof(struct aml_resource_memory24),
+ 0},
- resource->data.memory24.read_write_attribute =
- (aml->memory24.information & 0x01);
+ /* Read/Write bit */
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.memory24.write_protect),
+ AML_OFFSET(memory24.flags),
+ 0},
/*
- * Get the following contiguous fields from the AML descriptor:
+ * These fields are contiguous in both the source and destination:
* Minimum Base Address
* Maximum Base Address
* Address Base Alignment
* Range Length
*/
- acpi_rs_move_data(&resource->data.memory24.minimum,
- &aml->memory24.minimum, 4, ACPI_MOVE_TYPE_16_TO_32);
-
- /* Complete the resource header */
-
- resource->type = ACPI_RESOURCE_TYPE_MEMORY24;
- resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_memory24);
- return_ACPI_STATUS(AE_OK);
-}
+ {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.memory24.minimum),
+ AML_OFFSET(memory24.minimum),
+ 4}
+};
/*******************************************************************************
*
- * FUNCTION: acpi_rs_set_memory24
- *
- * PARAMETERS: Resource - Pointer to the resource descriptor
- * Aml - Where the AML descriptor is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert an internal resource descriptor to the corresponding
- * external AML resource descriptor.
+ * acpi_rs_convert_memory32
*
******************************************************************************/
-acpi_status
-acpi_rs_set_memory24(struct acpi_resource *resource, union aml_resource *aml)
-{
- ACPI_FUNCTION_TRACE("rs_set_memory24");
+struct acpi_rsconvert_info acpi_rs_convert_memory32[4] = {
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_MEMORY32,
+ ACPI_RS_SIZE(struct acpi_resource_memory32),
+ ACPI_RSC_TABLE_SIZE(acpi_rs_convert_memory32)},
- /* Set the Information Byte */
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_MEMORY32,
+ sizeof(struct aml_resource_memory32),
+ 0},
- aml->memory24.information = (u8)
- (resource->data.memory24.read_write_attribute & 0x01);
+ /* Read/Write bit */
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.memory32.write_protect),
+ AML_OFFSET(memory32.flags),
+ 0},
/*
- * Set the following contiguous fields in the AML descriptor:
+ * These fields are contiguous in both the source and destination:
* Minimum Base Address
* Maximum Base Address
* Address Base Alignment
* Range Length
*/
- acpi_rs_move_data(&aml->memory24.minimum,
- &resource->data.memory24.minimum, 4,
- ACPI_MOVE_TYPE_32_TO_16);
-
- /* Complete the AML descriptor header */
-
- acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_MEMORY24,
- sizeof(struct aml_resource_memory24), aml);
- return_ACPI_STATUS(AE_OK);
-}
+ {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.memory32.minimum),
+ AML_OFFSET(memory32.minimum),
+ 4}
+};
/*******************************************************************************
*
- * FUNCTION: acpi_rs_get_memory32
- *
- * PARAMETERS: Aml - Pointer to the AML resource descriptor
- * aml_resource_length - Length of the resource from the AML header
- * Resource - Where the internal resource is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
- * internal resource descriptor, simplifying bitflags and handling
- * alignment and endian issues if necessary.
+ * acpi_rs_convert_fixed_memory32
*
******************************************************************************/
-acpi_status
-acpi_rs_get_memory32(union aml_resource *aml,
- u16 aml_resource_length, struct acpi_resource *resource)
-{
- ACPI_FUNCTION_TRACE("rs_get_memory32");
+struct acpi_rsconvert_info acpi_rs_convert_fixed_memory32[4] = {
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_FIXED_MEMORY32,
+ ACPI_RS_SIZE(struct acpi_resource_fixed_memory32),
+ ACPI_RSC_TABLE_SIZE(acpi_rs_convert_fixed_memory32)},
- /* Get the Read/Write bit */
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_FIXED_MEMORY32,
+ sizeof(struct aml_resource_fixed_memory32),
+ 0},
- resource->data.memory32.read_write_attribute =
- (aml->memory32.information & 0x01);
+ /* Read/Write bit */
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.fixed_memory32.write_protect),
+ AML_OFFSET(fixed_memory32.flags),
+ 0},
/*
- * Get the following contiguous fields from the AML descriptor:
- * Minimum Base Address
- * Maximum Base Address
- * Address Base Alignment
+ * These fields are contiguous in both the source and destination:
+ * Base Address
* Range Length
*/
- acpi_rs_move_data(&resource->data.memory32.minimum,
- &aml->memory32.minimum, 4, ACPI_MOVE_TYPE_32_TO_32);
-
- /* Complete the resource header */
-
- resource->type = ACPI_RESOURCE_TYPE_MEMORY32;
- resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_memory32);
- return_ACPI_STATUS(AE_OK);
-}
+ {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.fixed_memory32.address),
+ AML_OFFSET(fixed_memory32.address),
+ 2}
+};
/*******************************************************************************
*
- * FUNCTION: acpi_rs_set_memory32
- *
- * PARAMETERS: Resource - Pointer to the resource descriptor
- * Aml - Where the AML descriptor is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert an internal resource descriptor to the corresponding
- * external AML resource descriptor.
+ * acpi_rs_get_vendor_small
*
******************************************************************************/
-acpi_status
-acpi_rs_set_memory32(struct acpi_resource *resource, union aml_resource *aml)
-{
- ACPI_FUNCTION_TRACE("rs_set_memory32");
-
- /* Set the Information Byte */
+struct acpi_rsconvert_info acpi_rs_get_vendor_small[3] = {
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_VENDOR,
+ ACPI_RS_SIZE(struct acpi_resource_vendor),
+ ACPI_RSC_TABLE_SIZE(acpi_rs_get_vendor_small)},
- aml->memory32.information = (u8)
- (resource->data.memory32.read_write_attribute & 0x01);
+ /* Length of the vendor data (byte count) */
- /*
- * Set the following contiguous fields in the AML descriptor:
- * Minimum Base Address
- * Maximum Base Address
- * Address Base Alignment
- * Range Length
- */
- acpi_rs_move_data(&aml->memory32.minimum,
- &resource->data.memory32.minimum, 4,
- ACPI_MOVE_TYPE_32_TO_32);
+ {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length),
+ 0,
+ sizeof(u8)}
+ ,
- /* Complete the AML descriptor header */
+ /* Vendor data */
- acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_MEMORY32,
- sizeof(struct aml_resource_memory32), aml);
- return_ACPI_STATUS(AE_OK);
-}
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]),
+ sizeof(struct aml_resource_small_header),
+ 0}
+};
/*******************************************************************************
*
- * FUNCTION: acpi_rs_get_fixed_memory32
- *
- * PARAMETERS: Aml - Pointer to the AML resource descriptor
- * aml_resource_length - Length of the resource from the AML header
- * Resource - Where the internal resource is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
- * internal resource descriptor, simplifying bitflags and handling
- * alignment and endian issues if necessary.
+ * acpi_rs_get_vendor_large
*
******************************************************************************/
-acpi_status
-acpi_rs_get_fixed_memory32(union aml_resource *aml,
- u16 aml_resource_length,
- struct acpi_resource *resource)
-{
- ACPI_FUNCTION_TRACE("rs_get_fixed_memory32");
-
- /* Get the Read/Write bit */
+struct acpi_rsconvert_info acpi_rs_get_vendor_large[3] = {
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_VENDOR,
+ ACPI_RS_SIZE(struct acpi_resource_vendor),
+ ACPI_RSC_TABLE_SIZE(acpi_rs_get_vendor_large)},
- resource->data.fixed_memory32.read_write_attribute =
- (aml->fixed_memory32.information & 0x01);
+ /* Length of the vendor data (byte count) */
- /*
- * Get the following contiguous fields from the AML descriptor:
- * Base Address
- * Range Length
- */
- ACPI_MOVE_32_TO_32(&resource->data.fixed_memory32.address,
- &aml->fixed_memory32.address);
- ACPI_MOVE_32_TO_32(&resource->data.fixed_memory32.address_length,
- &aml->fixed_memory32.address_length);
+ {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length),
+ 0,
+ sizeof(u8)}
+ ,
- /* Complete the resource header */
+ /* Vendor data */
- resource->type = ACPI_RESOURCE_TYPE_FIXED_MEMORY32;
- resource->length =
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_memory32);
- return_ACPI_STATUS(AE_OK);
-}
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]),
+ sizeof(struct aml_resource_large_header),
+ 0}
+};
/*******************************************************************************
*
- * FUNCTION: acpi_rs_set_fixed_memory32
- *
- * PARAMETERS: Resource - Pointer to the resource descriptor
- * Aml - Where the AML descriptor is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert an internal resource descriptor to the corresponding
- * external AML resource descriptor.
+ * acpi_rs_set_vendor
*
******************************************************************************/
-acpi_status
-acpi_rs_set_fixed_memory32(struct acpi_resource *resource,
- union aml_resource *aml)
-{
- ACPI_FUNCTION_TRACE("rs_set_fixed_memory32");
+struct acpi_rsconvert_info acpi_rs_set_vendor[7] = {
+ /* Default is a small vendor descriptor */
+
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_VENDOR_SMALL,
+ sizeof(struct aml_resource_small_header),
+ ACPI_RSC_TABLE_SIZE(acpi_rs_set_vendor)},
+
+ /* Get the length and copy the data */
- /* Set the Information Byte */
+ {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length),
+ 0,
+ 0},
- aml->fixed_memory32.information = (u8)
- (resource->data.fixed_memory32.read_write_attribute & 0x01);
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]),
+ sizeof(struct aml_resource_small_header),
+ 0},
/*
- * Set the following contiguous fields in the AML descriptor:
- * Base Address
- * Range Length
+ * All done if the Vendor byte length is 7 or less, meaning that it will
+ * fit within a small descriptor
*/
- ACPI_MOVE_32_TO_32(&aml->fixed_memory32.address,
- &resource->data.fixed_memory32.address);
- ACPI_MOVE_32_TO_32(&aml->fixed_memory32.address_length,
- &resource->data.fixed_memory32.address_length);
-
- /* Complete the AML descriptor header */
-
- acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_FIXED_MEMORY32,
- sizeof(struct aml_resource_fixed_memory32),
- aml);
- return_ACPI_STATUS(AE_OK);
-}
+ {ACPI_RSC_EXIT_LE, 0, 0, 7},
+
+ /* Must create a large vendor descriptor */
+
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_VENDOR_LARGE,
+ sizeof(struct aml_resource_large_header),
+ 0},
+
+ {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length),
+ 0,
+ 0},
+
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]),
+ sizeof(struct aml_resource_large_header),
+ 0}
+};
diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c
index 337a0f01cb2..16ad3bfbee2 100644
--- a/drivers/acpi/resources/rsmisc.c
+++ b/drivers/acpi/resources/rsmisc.c
@@ -47,156 +47,267 @@
#define _COMPONENT ACPI_RESOURCES
ACPI_MODULE_NAME("rsmisc")
+#define INIT_RESOURCE_TYPE(i) i->resource_offset
+#define INIT_RESOURCE_LENGTH(i) i->aml_offset
+#define INIT_TABLE_LENGTH(i) i->value
+#define COMPARE_OPCODE(i) i->resource_offset
+#define COMPARE_TARGET(i) i->aml_offset
+#define COMPARE_VALUE(i) i->value
/*******************************************************************************
*
- * FUNCTION: acpi_rs_get_generic_reg
- *
- * PARAMETERS: Aml - Pointer to the AML resource descriptor
- * aml_resource_length - Length of the resource from the AML header
- * Resource - Where the internal resource is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
- * internal resource descriptor, simplifying bitflags and handling
- * alignment and endian issues if necessary.
- *
- ******************************************************************************/
-acpi_status
-acpi_rs_get_generic_reg(union aml_resource *aml,
- u16 aml_resource_length, struct acpi_resource *resource)
-{
- ACPI_FUNCTION_TRACE("rs_get_generic_reg");
-
- /*
- * Get the following fields from the AML descriptor:
- * Address Space ID
- * Register Bit Width
- * Register Bit Offset
- * Access Size
- * Register Address
- */
- resource->data.generic_reg.space_id = aml->generic_reg.address_space_id;
- resource->data.generic_reg.bit_width = aml->generic_reg.bit_width;
- resource->data.generic_reg.bit_offset = aml->generic_reg.bit_offset;
- resource->data.generic_reg.access_size = aml->generic_reg.access_size;
- ACPI_MOVE_64_TO_64(&resource->data.generic_reg.address,
- &aml->generic_reg.address);
-
- /* Complete the resource header */
-
- resource->type = ACPI_RESOURCE_TYPE_GENERIC_REGISTER;
- resource->length =
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_register);
- return_ACPI_STATUS(AE_OK);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_rs_set_generic_reg
+ * FUNCTION: acpi_rs_convert_aml_to_resource
*
* PARAMETERS: Resource - Pointer to the resource descriptor
* Aml - Where the AML descriptor is returned
+ * Info - Pointer to appropriate conversion table
*
* RETURN: Status
*
- * DESCRIPTION: Convert an internal resource descriptor to the corresponding
- * external AML resource descriptor.
- *
- ******************************************************************************/
-
-acpi_status
-acpi_rs_set_generic_reg(struct acpi_resource *resource, union aml_resource *aml)
-{
- ACPI_FUNCTION_TRACE("rs_set_generic_reg");
-
- /*
- * Set the following fields in the AML descriptor:
- * Address Space ID
- * Register Bit Width
- * Register Bit Offset
- * Access Size
- * Register Address
- */
- aml->generic_reg.address_space_id =
- (u8) resource->data.generic_reg.space_id;
- aml->generic_reg.bit_width = (u8) resource->data.generic_reg.bit_width;
- aml->generic_reg.bit_offset =
- (u8) resource->data.generic_reg.bit_offset;
- aml->generic_reg.access_size =
- (u8) resource->data.generic_reg.access_size;
- ACPI_MOVE_64_TO_64(&aml->generic_reg.address,
- &resource->data.generic_reg.address);
-
- /* Complete the AML descriptor header */
-
- acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_GENERIC_REGISTER,
- sizeof(struct
- aml_resource_generic_register), aml);
- return_ACPI_STATUS(AE_OK);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_rs_get_vendor
- *
- * PARAMETERS: Aml - Pointer to the AML resource descriptor
- * aml_resource_length - Length of the resource from the AML header
- * Resource - Where the internal resource is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
- * internal resource descriptor, simplifying bitflags and handling
- * alignment and endian issues if necessary.
+ * DESCRIPTION: Convert an external AML resource descriptor to the corresponding
+ * internal resource descriptor
*
******************************************************************************/
-
acpi_status
-acpi_rs_get_vendor(union aml_resource *aml,
- u16 aml_resource_length, struct acpi_resource *resource)
+acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
+ union aml_resource *aml,
+ struct acpi_rsconvert_info *info)
{
- u8 *aml_byte_data;
-
- ACPI_FUNCTION_TRACE("rs_get_vendor");
+ acpi_rs_length aml_resource_length;
+ void *source;
+ void *destination;
+ char *target;
+ u8 count;
+ u8 flags_mode = FALSE;
+ u16 item_count = 0;
+ u16 temp16 = 0;
+
+ ACPI_FUNCTION_TRACE("rs_get_resource");
+
+ if (((acpi_native_uint) resource) & 0x3) {
+ acpi_os_printf
+ ("**** GET: Misaligned resource pointer: %p Type %2.2X Len %X\n",
+ resource, resource->type, resource->length);
+ }
- /* Determine if this is a large or small vendor specific item */
+ /* Extract the resource Length field (does not include header length) */
- if (aml->large_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) {
- /* Large item, Point to the first vendor byte */
+ aml_resource_length = acpi_ut_get_resource_length(aml);
- aml_byte_data =
- ((u8 *) aml) + sizeof(struct aml_resource_large_header);
- } else {
- /* Small item, Point to the first vendor byte */
+ /*
+ * First table entry must be ACPI_RSC_INITxxx and must contain the
+ * table length (# of table entries)
+ */
+ count = INIT_TABLE_LENGTH(info);
+
+ while (count) {
+ /*
+ * Source is the external AML byte stream buffer,
+ * destination is the internal resource descriptor
+ */
+ source = ((u8 *) aml) + info->aml_offset;
+ destination = ((u8 *) resource) + info->resource_offset;
+
+ switch (info->opcode) {
+ case ACPI_RSC_INITGET:
+ /*
+ * Get the resource type and the initial (minimum) length
+ */
+ ACPI_MEMSET(resource, 0, INIT_RESOURCE_LENGTH(info));
+ resource->type = INIT_RESOURCE_TYPE(info);
+ resource->length = INIT_RESOURCE_LENGTH(info);
+ break;
+
+ case ACPI_RSC_INITSET:
+ break;
+
+ case ACPI_RSC_FLAGINIT:
+
+ flags_mode = TRUE;
+ break;
+
+ case ACPI_RSC_1BITFLAG:
+ /*
+ * Mask and shift the flag bit
+ */
+ *((u8 *) destination) = (u8)
+ ((*((u8 *) source) >> info->value) & 0x01);
+ break;
+
+ case ACPI_RSC_2BITFLAG:
+ /*
+ * Mask and shift the flag bits
+ */
+ *((u8 *) destination) = (u8)
+ ((*((u8 *) source) >> info->value) & 0x03);
+ break;
+
+ case ACPI_RSC_COUNT:
+
+ item_count = *((u8 *) source);
+ *((u8 *) destination) = (u8) item_count;
+
+ resource->length = resource->length +
+ (info->value * (item_count - 1));
+ break;
+
+ case ACPI_RSC_COUNT16:
+
+ item_count = aml_resource_length;
+ *((u16 *) destination) = item_count;
+
+ resource->length = resource->length +
+ (info->value * (item_count - 1));
+ break;
+
+ case ACPI_RSC_LENGTH:
+
+ resource->length = resource->length + info->value;
+ break;
+
+ case ACPI_RSC_MOVE8:
+ case ACPI_RSC_MOVE16:
+ case ACPI_RSC_MOVE32:
+ case ACPI_RSC_MOVE64:
+ /*
+ * Raw data move. Use the Info value field unless item_count has
+ * been previously initialized via a COUNT opcode
+ */
+ if (info->value) {
+ item_count = info->value;
+ }
+ acpi_rs_move_data(destination, source, item_count,
+ info->opcode);
+ break;
+
+ case ACPI_RSC_SET8:
+
+ ACPI_MEMSET(destination, info->aml_offset, info->value);
+ break;
+
+ case ACPI_RSC_DATA8:
+
+ target = ((char *)resource) + info->value;
+ ACPI_MEMCPY(destination, source,
+ *(ACPI_CAST_PTR(u16, target)));
+ break;
+
+ case ACPI_RSC_ADDRESS:
+ /*
+ * Common handler for address descriptor flags
+ */
+ if (!acpi_rs_get_address_common(resource, aml)) {
+ return_ACPI_STATUS
+ (AE_AML_INVALID_RESOURCE_TYPE);
+ }
+ break;
+
+ case ACPI_RSC_SOURCE:
+ /*
+ * Optional resource_source (Index and String)
+ */
+ resource->length +=
+ acpi_rs_get_resource_source(aml_resource_length,
+ info->value,
+ destination, aml, NULL);
+ break;
+
+ case ACPI_RSC_SOURCEX:
+ /*
+ * Optional resource_source (Index and String). This is the more
+ * complicated case used by the Interrupt() macro
+ */
+ target =
+ ((char *)resource) + info->aml_offset +
+ (item_count * 4);
+
+ resource->length +=
+ acpi_rs_get_resource_source(aml_resource_length,
+ (acpi_rs_length) (((item_count - 1) * sizeof(u32)) + info->value), destination, aml, target);
+ break;
+
+ case ACPI_RSC_BITMASK:
+ /*
+ * 8-bit encoded bitmask (DMA macro)
+ */
+ item_count =
+ acpi_rs_decode_bitmask(*((u8 *) source),
+ destination);
+ if (item_count) {
+ resource->length +=
+ resource->length + (item_count - 1);
+ }
+
+ target = ((char *)resource) + info->value;
+ *((u8 *) target) = (u8) item_count;
+ break;
+
+ case ACPI_RSC_BITMASK16:
+ /*
+ * 16-bit encoded bitmask (IRQ macro)
+ */
+ ACPI_MOVE_16_TO_16(&temp16, source);
+
+ item_count =
+ acpi_rs_decode_bitmask(temp16, destination);
+ if (item_count) {
+ resource->length =
+ resource->length + (item_count - 1);
+ }
+
+ target = ((char *)resource) + info->value;
+ *((u8 *) target) = (u8) item_count;
+ break;
+
+ case ACPI_RSC_EXIT_NE:
+ /*
+ * Control - Exit conversion if not equal
+ */
+ switch (info->resource_offset) {
+ case ACPI_RSC_COMPARE_AML_LENGTH:
+ if (aml_resource_length != info->value) {
+ goto exit;
+ }
+ break;
+
+ case ACPI_RSC_COMPARE_VALUE:
+ if (*((u8 *) source) != info->value) {
+ goto exit;
+ }
+ break;
+
+ default:
+ acpi_os_printf
+ ("*** Invalid conversion sub-opcode\n");
+ return_ACPI_STATUS(AE_BAD_PARAMETER);
+ }
+ break;
+
+ default:
+
+ acpi_os_printf("*** Invalid conversion opcode\n");
+ return_ACPI_STATUS(AE_BAD_PARAMETER);
+ }
- aml_byte_data =
- ((u8 *) aml) + sizeof(struct aml_resource_small_header);
+ count--;
+ info++;
}
- /* Copy the vendor-specific bytes */
-
- ACPI_MEMCPY(resource->data.vendor.byte_data,
- aml_byte_data, aml_resource_length);
- resource->data.vendor.byte_length = aml_resource_length;
+ exit:
+ if (!flags_mode) {
+ /* Round the resource struct length up to the next 32-bit boundary */
- /*
- * In order for the struct_size to fall on a 32-bit boundary,
- * calculate the length of the vendor string and expand the
- * struct_size to the next 32-bit boundary.
- */
- resource->type = ACPI_RESOURCE_TYPE_VENDOR;
- resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor) +
- ACPI_ROUND_UP_to_32_bITS(aml_resource_length);
+ resource->length = ACPI_ROUND_UP_to_32_bITS(resource->length);
+ }
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_set_vendor
+ * FUNCTION: acpi_rs_convert_resource_to_aml
*
* PARAMETERS: Resource - Pointer to the resource descriptor
* Aml - Where the AML descriptor is returned
+ * Info - Pointer to appropriate conversion table
*
* RETURN: Status
*
@@ -206,275 +317,236 @@ acpi_rs_get_vendor(union aml_resource *aml,
******************************************************************************/
acpi_status
-acpi_rs_set_vendor(struct acpi_resource *resource, union aml_resource *aml)
+acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
+ union aml_resource *aml,
+ struct acpi_rsconvert_info *info)
{
- u32 resource_length;
- u8 *source;
- u8 *destination;
-
- ACPI_FUNCTION_TRACE("rs_set_vendor");
-
- resource_length = resource->data.vendor.byte_length;
- source = ACPI_CAST_PTR(u8, resource->data.vendor.byte_data);
-
- /* Length determines if this is a large or small resource */
+ void *source = NULL;
+ void *destination;
+ acpi_rsdesc_size aml_length = 0;
+ u8 count;
+ u16 temp16 = 0;
+ u16 item_count = 0;
- if (resource_length > 7) {
- /* Large item, get pointer to the data part of the descriptor */
+ ACPI_FUNCTION_TRACE("rs_convert_resource_to_aml");
- destination =
- ((u8 *) aml) + sizeof(struct aml_resource_large_header);
+ /* Validate the Resource pointer, must be 32-bit aligned */
- /* Complete the AML descriptor header */
-
- acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_VENDOR_LARGE,
- (u32) (resource_length +
- sizeof(struct
- aml_resource_large_header)),
- aml);
- } else {
- /* Small item, get pointer to the data part of the descriptor */
-
- destination =
- ((u8 *) aml) + sizeof(struct aml_resource_small_header);
-
- /* Complete the AML descriptor header */
-
- acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_VENDOR_SMALL,
- (u32) (resource_length +
- sizeof(struct
- aml_resource_small_header)),
- aml);
+ if (((acpi_native_uint) resource) & 0x3) {
+ acpi_os_printf
+ ("**** SET: Misaligned resource pointer: %p Type %2.2X Len %X\n",
+ resource, resource->type, resource->length);
}
- /* Copy the vendor-specific bytes */
-
- ACPI_MEMCPY(destination, source, resource_length);
- return_ACPI_STATUS(AE_OK);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_rs_get_start_dpf
- *
- * PARAMETERS: Aml - Pointer to the AML resource descriptor
- * aml_resource_length - Length of the resource from the AML header
- * Resource - Where the internal resource is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
- * internal resource descriptor, simplifying bitflags and handling
- * alignment and endian issues if necessary.
- *
- ******************************************************************************/
-
-acpi_status
-acpi_rs_get_start_dpf(union aml_resource *aml,
- u16 aml_resource_length, struct acpi_resource *resource)
-{
- ACPI_FUNCTION_TRACE("rs_get_start_dpf");
-
- /* Get the flags byte if present */
-
- if (aml_resource_length == 1) {
- /* Get the Compatibility priority */
-
- resource->data.start_dpf.compatibility_priority =
- (aml->start_dpf.flags & 0x03);
-
- if (resource->data.start_dpf.compatibility_priority >= 3) {
- return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE);
- }
-
- /* Get the Performance/Robustness preference */
-
- resource->data.start_dpf.performance_robustness =
- ((aml->start_dpf.flags >> 2) & 0x03);
-
- if (resource->data.start_dpf.performance_robustness >= 3) {
- return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE);
+ /*
+ * First table entry must be ACPI_RSC_INITxxx and must contain the
+ * table length (# of table entries)
+ */
+ count = INIT_TABLE_LENGTH(info);
+
+ while (count) {
+ /*
+ * Source is the internal resource descriptor,
+ * destination is the external AML byte stream buffer
+ */
+ source = ((u8 *) resource) + info->resource_offset;
+ destination = ((u8 *) aml) + info->aml_offset;
+
+ switch (info->opcode) {
+ case ACPI_RSC_INITSET:
+
+ ACPI_MEMSET(aml, 0, INIT_RESOURCE_LENGTH(info));
+ aml_length = INIT_RESOURCE_LENGTH(info);
+ acpi_rs_set_resource_header(INIT_RESOURCE_TYPE(info),
+ aml_length, aml);
+ break;
+
+ case ACPI_RSC_INITGET:
+ break;
+
+ case ACPI_RSC_FLAGINIT:
+ /*
+ * Clear the flag byte
+ */
+ *((u8 *) destination) = 0;
+ break;
+
+ case ACPI_RSC_1BITFLAG:
+ /*
+ * Mask and shift the flag bit
+ */
+ *((u8 *) destination) |= (u8)
+ ((*((u8 *) source) & 0x01) << info->value);
+ break;
+
+ case ACPI_RSC_2BITFLAG:
+ /*
+ * Mask and shift the flag bits
+ */
+ *((u8 *) destination) |= (u8)
+ ((*((u8 *) source) & 0x03) << info->value);
+ break;
+
+ case ACPI_RSC_COUNT:
+
+ item_count = *((u8 *) source);
+ *((u8 *) destination) = (u8) item_count;
+
+ aml_length = (u16) (aml_length +
+ (info->value * (item_count - 1)));
+ break;
+
+ case ACPI_RSC_COUNT16:
+
+ item_count = *((u16 *) source);
+ aml_length = (u16) (aml_length + item_count);
+ acpi_rs_set_resource_length(aml_length, aml);
+ break;
+
+ case ACPI_RSC_LENGTH:
+
+ acpi_rs_set_resource_length(info->value, aml);
+ break;
+
+ case ACPI_RSC_MOVE8:
+ case ACPI_RSC_MOVE16:
+ case ACPI_RSC_MOVE32:
+ case ACPI_RSC_MOVE64:
+
+ if (info->value) {
+ item_count = info->value;
+ }
+ acpi_rs_move_data(destination, source, item_count,
+ info->opcode);
+ break;
+
+ case ACPI_RSC_ADDRESS:
+
+ /* Set the Resource Type, General Flags, and Type-Specific Flags */
+
+ acpi_rs_set_address_common(aml, resource);
+ break;
+
+ case ACPI_RSC_SOURCEX:
+ /*
+ * Optional resource_source (Index and String)
+ */
+ aml_length =
+ acpi_rs_set_resource_source(aml,
+ (acpi_rs_length)
+ aml_length, source);
+ acpi_rs_set_resource_length(aml_length, aml);
+ break;
+
+ case ACPI_RSC_SOURCE:
+ /*
+ * Optional resource_source (Index and String). This is the more
+ * complicated case used by the Interrupt() macro
+ */
+ aml_length =
+ acpi_rs_set_resource_source(aml, info->value,
+ source);
+ acpi_rs_set_resource_length(aml_length, aml);
+ break;
+
+ case ACPI_RSC_BITMASK:
+ /*
+ * 8-bit encoded bitmask (DMA macro)
+ */
+ *((u8 *) destination) = (u8)
+ acpi_rs_encode_bitmask(source,
+ *(((u8 *) resource) +
+ info->value));
+ break;
+
+ case ACPI_RSC_BITMASK16:
+ /*
+ * 16-bit encoded bitmask (IRQ macro)
+ */
+ temp16 =
+ acpi_rs_encode_bitmask(source,
+ *(((u8 *) resource) +
+ info->value));
+ ACPI_MOVE_16_TO_16(destination, &temp16);
+ break;
+
+ case ACPI_RSC_EXIT_LE:
+ /*
+ * Control - Exit conversion if less than or equal
+ */
+ if (item_count <= info->value) {
+ goto exit;
+ }
+ break;
+
+ case ACPI_RSC_EXIT_NE:
+ /*
+ * Control - Exit conversion if not equal
+ */
+ switch (COMPARE_OPCODE(info)) {
+ case ACPI_RSC_COMPARE_VALUE:
+ if (*
+ ((u8 *) (((u8 *) resource) +
+ COMPARE_TARGET(info))) !=
+ COMPARE_VALUE(info)) {
+ goto exit;
+ }
+ break;
+
+ default:
+ acpi_os_printf
+ ("*** Invalid conversion sub-opcode\n");
+ return_ACPI_STATUS(AE_BAD_PARAMETER);
+ }
+ break;
+
+ default:
+
+ acpi_os_printf("*** Invalid conversion opcode\n");
+ return_ACPI_STATUS(AE_BAD_PARAMETER);
}
- } else {
- /* start_dependent_no_pri(), no flags byte, set defaults */
-
- resource->data.start_dpf.compatibility_priority =
- ACPI_ACCEPTABLE_CONFIGURATION;
- resource->data.start_dpf.performance_robustness =
- ACPI_ACCEPTABLE_CONFIGURATION;
+ count--;
+ info++;
}
- /* Complete the resource header */
-
- resource->type = ACPI_RESOURCE_TYPE_START_DEPENDENT;
- resource->length =
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_start_dependent);
+ exit:
return_ACPI_STATUS(AE_OK);
}
-/*******************************************************************************
- *
- * FUNCTION: acpi_rs_set_start_dpf
- *
- * PARAMETERS: Resource - Pointer to the resource descriptor
- * Aml - Where the AML descriptor is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert an internal resource descriptor to the corresponding
- * external AML resource descriptor.
- *
- ******************************************************************************/
-
-acpi_status
-acpi_rs_set_start_dpf(struct acpi_resource *resource, union aml_resource *aml)
-{
- ACPI_FUNCTION_TRACE("rs_set_start_dpf");
+#if 0
+/* Previous resource validations */
- /*
- * The descriptor type field is set based upon whether a byte is needed
- * to contain Priority data.
- */
- if (ACPI_ACCEPTABLE_CONFIGURATION ==
- resource->data.start_dpf.compatibility_priority &&
- ACPI_ACCEPTABLE_CONFIGURATION ==
- resource->data.start_dpf.performance_robustness) {
- acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_START_DEPENDENT,
- sizeof(struct
- aml_resource_start_dependent_noprio),
- aml);
- } else {
- acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_START_DEPENDENT,
- sizeof(struct
- aml_resource_start_dependent),
- aml);
-
- /* Set the Flags byte */
-
- aml->start_dpf.flags = (u8)
- (((resource->data.start_dpf.
- performance_robustness & 0x03) << 2) | (resource->data.
- start_dpf.
- compatibility_priority
- & 0x03));
- }
- return_ACPI_STATUS(AE_OK);
+if (aml->ext_address64.revision_iD != AML_RESOURCE_EXTENDED_ADDRESS_REVISION) {
+ return_ACPI_STATUS(AE_SUPPORT);
}
-/*******************************************************************************
- *
- * FUNCTION: acpi_rs_get_end_dpf
- *
- * PARAMETERS: Aml - Pointer to the AML resource descriptor
- * aml_resource_length - Length of the resource from the AML header
- * Resource - Where the internal resource is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
- * internal resource descriptor, simplifying bitflags and handling
- * alignment and endian issues if necessary.
- *
- ******************************************************************************/
-
-acpi_status
-acpi_rs_get_end_dpf(union aml_resource *aml,
- u16 aml_resource_length, struct acpi_resource *resource)
-{
- ACPI_FUNCTION_TRACE("rs_get_end_dpf");
-
- /* Complete the resource header */
-
- resource->type = ACPI_RESOURCE_TYPE_END_DEPENDENT;
- resource->length = (u32) ACPI_RESOURCE_LENGTH;
- return_ACPI_STATUS(AE_OK);
+if (resource->data.start_dpf.performance_robustness >= 3) {
+ return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE);
}
-/*******************************************************************************
- *
- * FUNCTION: acpi_rs_set_end_dpf
- *
- * PARAMETERS: Resource - Pointer to the resource descriptor
- * Aml - Where the AML descriptor is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert an internal resource descriptor to the corresponding
- * external AML resource descriptor.
- *
- ******************************************************************************/
-
-acpi_status
-acpi_rs_set_end_dpf(struct acpi_resource *resource, union aml_resource *aml)
-{
- ACPI_FUNCTION_TRACE("rs_set_end_dpf");
-
- /* Complete the AML descriptor header */
-
- acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_END_DEPENDENT,
- sizeof(struct aml_resource_end_dependent),
- aml);
- return_ACPI_STATUS(AE_OK);
+if (((aml->irq.flags & 0x09) == 0x00) || ((aml->irq.flags & 0x09) == 0x09)) {
+ /*
+ * Only [active_high, edge_sensitive] or [active_low, level_sensitive]
+ * polarity/trigger interrupts are allowed (ACPI spec, section
+ * "IRQ Format"), so 0x00 and 0x09 are illegal.
+ */
+ ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+ "Invalid interrupt polarity/trigger in resource list, %X\n",
+ aml->irq.flags));
+ return_ACPI_STATUS(AE_BAD_DATA);
}
-/*******************************************************************************
- *
- * FUNCTION: acpi_rs_get_end_tag
- *
- * PARAMETERS: Aml - Pointer to the AML resource descriptor
- * aml_resource_length - Length of the resource from the AML header
- * Resource - Where the internal resource is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
- * internal resource descriptor, simplifying bitflags and handling
- * alignment and endian issues if necessary.
- *
- ******************************************************************************/
-
-acpi_status
-acpi_rs_get_end_tag(union aml_resource *aml,
- u16 aml_resource_length, struct acpi_resource *resource)
-{
- ACPI_FUNCTION_TRACE("rs_get_end_tag");
-
- /* Complete the resource header */
+resource->data.extended_irq.interrupt_count = temp8;
+if (temp8 < 1) {
+ /* Must have at least one IRQ */
- resource->type = ACPI_RESOURCE_TYPE_END_TAG;
- resource->length = ACPI_RESOURCE_LENGTH;
- return_ACPI_STATUS(AE_OK);
+ return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH);
}
-/*******************************************************************************
- *
- * FUNCTION: acpi_rs_set_end_tag
- *
- * PARAMETERS: Resource - Pointer to the resource descriptor
- * Aml - Where the AML descriptor is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert an internal resource descriptor to the corresponding
- * external AML resource descriptor.
- *
- ******************************************************************************/
-
-acpi_status
-acpi_rs_set_end_tag(struct acpi_resource *resource, union aml_resource *aml)
-{
- ACPI_FUNCTION_TRACE("rs_set_end_tag");
-
- /*
- * Set the Checksum - zero means that the resource data is treated as if
- * the checksum operation succeeded (ACPI Spec 1.0b Section 6.4.2.8)
- */
- aml->end_tag.checksum = 0;
-
- /* Complete the AML descriptor header */
-
- acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_END_TAG,
- sizeof(struct aml_resource_end_tag), aml);
- return_ACPI_STATUS(AE_OK);
+if (resource->data.dma.transfer == 0x03) {
+ ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+ "Invalid DMA.Transfer preference (3)\n"));
+ return_ACPI_STATUS(AE_BAD_DATA);
}
+#endif
diff --git a/drivers/acpi/resources/rsutils.c b/drivers/acpi/resources/rsutils.c
index 9d503de1a34..7613033f5dc 100644
--- a/drivers/acpi/resources/rsutils.c
+++ b/drivers/acpi/resources/rsutils.c
@@ -50,6 +50,64 @@ ACPI_MODULE_NAME("rsutils")
/*******************************************************************************
*
+ * FUNCTION: acpi_rs_decode_bitmask
+ *
+ * PARAMETERS: Mask - Bitmask to decode
+ * List - Where the converted list is returned
+ *
+ * RETURN: Count of bits set (length of list)
+ *
+ * DESCRIPTION: Convert a bit mask into a list of values
+ *
+ ******************************************************************************/
+u8 acpi_rs_decode_bitmask(u16 mask, u8 * list)
+{
+ acpi_native_uint i;
+ u8 bit_count;
+
+ /* Decode the mask bits */
+
+ for (i = 0, bit_count = 0; mask; i++) {
+ if (mask & 0x0001) {
+ list[bit_count] = (u8) i;
+ bit_count++;
+ }
+
+ mask >>= 1;
+ }
+
+ return (bit_count);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_rs_encode_bitmask
+ *
+ * PARAMETERS: List - List of values to encode
+ * Count - Length of list
+ *
+ * RETURN: Encoded bitmask
+ *
+ * DESCRIPTION: Convert a list of values to an encoded bitmask
+ *
+ ******************************************************************************/
+
+u16 acpi_rs_encode_bitmask(u8 * list, u8 count)
+{
+ acpi_native_uint i;
+ u16 mask;
+
+ /* Encode the list into a single bitmask */
+
+ for (i = 0, mask = 0; i < count; i++) {
+ mask |= (0x0001 << list[i]);
+ }
+
+ return (mask);
+}
+
+/*******************************************************************************
+ *
* FUNCTION: acpi_rs_move_data
*
* PARAMETERS: Destination - Pointer to the destination descriptor
@@ -64,6 +122,7 @@ ACPI_MODULE_NAME("rsutils")
* via the ACPI_MOVE_* macros. (This is why a memcpy is not used)
*
******************************************************************************/
+
void
acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type)
{
@@ -73,22 +132,30 @@ acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type)
for (i = 0; i < item_count; i++) {
switch (move_type) {
- case ACPI_MOVE_TYPE_16_TO_32:
- ACPI_MOVE_16_TO_32(&((u32 *) destination)[i],
- &((u16 *) source)[i]);
- break;
+ /*
+ * For the 8-bit case, we can perform the move all at once
+ * since there are no alignment or endian issues
+ */
+ case ACPI_RSC_MOVE8:
+ ACPI_MEMCPY(destination, source, item_count);
+ return;
- case ACPI_MOVE_TYPE_32_TO_16:
- ACPI_MOVE_32_TO_16(&((u16 *) destination)[i],
- &((u32 *) source)[i]);
+ /*
+ * 16-, 32-, and 64-bit cases must use the move macros that perform
+ * endian conversion and/or accomodate hardware that cannot perform
+ * misaligned memory transfers
+ */
+ case ACPI_RSC_MOVE16:
+ ACPI_MOVE_16_TO_16(&((u16 *) destination)[i],
+ &((u16 *) source)[i]);
break;
- case ACPI_MOVE_TYPE_32_TO_32:
+ case ACPI_RSC_MOVE32:
ACPI_MOVE_32_TO_32(&((u32 *) destination)[i],
&((u32 *) source)[i]);
break;
- case ACPI_MOVE_TYPE_64_TO_64:
+ case ACPI_RSC_MOVE64:
ACPI_MOVE_64_TO_64(&((u64 *) destination)[i],
&((u64 *) source)[i]);
break;
@@ -148,80 +215,57 @@ struct acpi_resource_info *acpi_rs_get_resource_info(u8 resource_type)
/*******************************************************************************
*
- * FUNCTION: acpi_rs_get_resource_length
+ * FUNCTION: acpi_rs_set_resource_length
*
- * PARAMETERS: Aml - Pointer to the raw AML resource descriptor
+ * PARAMETERS: total_length - Length of the AML descriptor, including
+ * the header and length fields.
+ * Aml - Pointer to the raw AML descriptor
*
- * RETURN: Byte Length
+ * RETURN: None
*
- * DESCRIPTION: Get the "Resource Length" of a raw AML descriptor. By
- * definition, this does not include the size of the descriptor
- * header or the length field itself.
+ * DESCRIPTION: Set the resource_length field of an AML
+ * resource descriptor, both Large and Small descriptors are
+ * supported automatically. Note: Descriptor Type field must
+ * be valid.
*
******************************************************************************/
-u16 acpi_rs_get_resource_length(union aml_resource * aml)
+void
+acpi_rs_set_resource_length(acpi_rsdesc_size total_length,
+ union aml_resource *aml)
{
- u16 resource_length;
+ acpi_rs_length resource_length;
ACPI_FUNCTION_ENTRY();
/* Determine if this is a small or large resource */
- if (aml->large_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) {
+ if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) {
/* Large Resource type -- bytes 1-2 contain the 16-bit length */
- ACPI_MOVE_16_TO_16(&resource_length,
- &aml->large_header.resource_length);
+ resource_length = (acpi_rs_length)
+ (total_length - sizeof(struct aml_resource_large_header));
+
+ /* Insert length into the Large descriptor length field */
+ ACPI_MOVE_16_TO_16(&aml->large_header.resource_length,
+ &resource_length);
} else {
/* Small Resource type -- bits 2:0 of byte 0 contain the length */
- resource_length = (u16) (aml->small_header.descriptor_type &
- ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK);
- }
-
- return (resource_length);
-}
+ resource_length = (acpi_rs_length)
+ (total_length - sizeof(struct aml_resource_small_header));
-/*******************************************************************************
- *
- * FUNCTION: acpi_rs_get_descriptor_length
- *
- * PARAMETERS: Aml - Pointer to the raw AML resource descriptor
- *
- * RETURN: Byte length
- *
- * DESCRIPTION: Get the total byte length of a raw AML descriptor, including the
- * length of the descriptor header and the length field itself.
- * Used to walk descriptor lists.
- *
- ******************************************************************************/
-
-u32 acpi_rs_get_descriptor_length(union aml_resource * aml)
-{
- u32 descriptor_length;
-
- ACPI_FUNCTION_ENTRY();
-
- /* Determine if this is a small or large resource */
-
- if (aml->large_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) {
- /* Large Resource type -- bytes 1-2 contain the 16-bit length */
+ /* Insert length into the descriptor type byte */
- ACPI_MOVE_16_TO_32(&descriptor_length,
- &aml->large_header.resource_length);
- descriptor_length += sizeof(struct aml_resource_large_header);
+ aml->small_header.descriptor_type = (u8)
- } else {
- /* Small Resource type -- bits 2:0 of byte 0 contain the length */
+ /* Clear any existing length, preserving descriptor type bits */
+ ((aml->small_header.
+ descriptor_type & ~ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK)
- descriptor_length = (u32) (aml->small_header.descriptor_type &
- ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK);
- descriptor_length += sizeof(struct aml_resource_small_header);
+ | resource_length);
}
-
- return (descriptor_length);
}
/*******************************************************************************
@@ -243,71 +287,18 @@ u32 acpi_rs_get_descriptor_length(union aml_resource * aml)
void
acpi_rs_set_resource_header(u8 descriptor_type,
- acpi_size total_length, union aml_resource *aml)
+ acpi_rsdesc_size total_length,
+ union aml_resource *aml)
{
- u16 resource_length;
-
ACPI_FUNCTION_ENTRY();
- /* Set the descriptor type */
+ /* Set the Descriptor Type */
aml->small_header.descriptor_type = descriptor_type;
- /* Determine if this is a small or large resource */
-
- if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) {
- /* Large Resource type -- bytes 1-2 contain the 16-bit length */
-
- resource_length =
- (u16) (total_length -
- sizeof(struct aml_resource_large_header));
-
- /* Insert length into the Large descriptor length field */
-
- ACPI_MOVE_16_TO_16(&aml->large_header.resource_length,
- &resource_length);
- } else {
- /* Small Resource type -- bits 2:0 of byte 0 contain the length */
-
- resource_length =
- (u16) (total_length -
- sizeof(struct aml_resource_small_header));
-
- /* Insert length into the descriptor type byte */
-
- aml->small_header.descriptor_type |= (u8) resource_length;
- }
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_rs_get_resource_type
- *
- * PARAMETERS: resource_type - Byte 0 of a resource descriptor
- *
- * RETURN: The Resource Type with no extraneous bits (except the
- * Large/Small descriptor bit -- this is left alone)
- *
- * DESCRIPTION: Extract the Resource Type/Name from the first byte of
- * a resource descriptor.
- *
- ******************************************************************************/
-
-u8 acpi_rs_get_resource_type(u8 resource_type)
-{
- ACPI_FUNCTION_ENTRY();
+ /* Set the Resource Length */
- /* Determine if this is a small or large resource */
-
- if (resource_type & ACPI_RESOURCE_NAME_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_RESOURCE_NAME_SMALL_MASK));
- }
+ acpi_rs_set_resource_length(total_length, aml);
}
/*******************************************************************************
@@ -360,13 +351,13 @@ static u16 acpi_rs_strcpy(char *destination, char *source)
*
******************************************************************************/
-u16
-acpi_rs_get_resource_source(u16 resource_length,
- acpi_size minimum_length,
+acpi_rs_length
+acpi_rs_get_resource_source(acpi_rs_length resource_length,
+ acpi_rs_length minimum_length,
struct acpi_resource_source * resource_source,
union aml_resource * aml, char *string_ptr)
{
- acpi_size total_length;
+ acpi_rsdesc_size total_length;
u8 *aml_resource_source;
ACPI_FUNCTION_ENTRY();
@@ -382,7 +373,7 @@ acpi_rs_get_resource_source(u16 resource_length,
* Note: Some resource descriptors will have an additional null, so
* we add 1 to the minimum length.
*/
- if (total_length > (minimum_length + 1)) {
+ if (total_length > (acpi_rsdesc_size) (minimum_length + 1)) {
/* Get the resource_source_index */
resource_source->index = aml_resource_source[0];
@@ -398,20 +389,26 @@ acpi_rs_get_resource_source(u16 resource_length,
sizeof(struct acpi_resource_source);
}
+ /*
+ * In order for the struct_size to fall on a 32-bit boundary, calculate
+ * the length of the string (+1 for the NULL terminator) and expand the
+ * struct_size to the next 32-bit boundary.
+ *
+ * Zero the entire area of the buffer.
+ */
+ total_length =
+ ACPI_ROUND_UP_to_32_bITS(ACPI_STRLEN
+ ((char *)&aml_resource_source[1]) +
+ 1);
+ ACPI_MEMSET(resource_source->string_ptr, 0, total_length);
+
/* Copy the resource_source string to the destination */
resource_source->string_length =
acpi_rs_strcpy(resource_source->string_ptr,
(char *)&aml_resource_source[1]);
- /*
- * In order for the struct_size to fall on a 32-bit boundary,
- * calculate the length of the string and expand the
- * struct_size to the next 32-bit boundary.
- */
- return ((u16)
- ACPI_ROUND_UP_to_32_bITS(resource_source->
- string_length));
+ return ((acpi_rs_length) total_length);
} else {
/* resource_source is not present */
@@ -434,18 +431,18 @@ acpi_rs_get_resource_source(u16 resource_length,
*
* RETURN: Total length of the AML descriptor
*
- * DESCRIPTION: Convert an optoinal resource_source from internal format to a
+ * DESCRIPTION: Convert an optional resource_source from internal format to a
* raw AML resource descriptor
*
******************************************************************************/
-acpi_size
+acpi_rsdesc_size
acpi_rs_set_resource_source(union aml_resource * aml,
- acpi_size minimum_length,
+ acpi_rs_length minimum_length,
struct acpi_resource_source * resource_source)
{
u8 *aml_resource_source;
- acpi_size descriptor_length;
+ acpi_rsdesc_size descriptor_length;
ACPI_FUNCTION_ENTRY();
@@ -472,7 +469,7 @@ acpi_rs_set_resource_source(union aml_resource * aml,
* final descriptor length
*/
descriptor_length +=
- ((acpi_size) resource_source->string_length + 1);
+ ((acpi_rsdesc_size) resource_source->string_length + 1);
}
/* Return the new total length of the AML descriptor */
diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c
index 9d179beb17a..09d250ab987 100644
--- a/drivers/acpi/resources/rsxface.c
+++ b/drivers/acpi/resources/rsxface.c
@@ -57,7 +57,7 @@ ACPI_MODULE_NAME("rsxface")
ACPI_COPY_FIELD(out, in, decode); \
ACPI_COPY_FIELD(out, in, min_address_fixed); \
ACPI_COPY_FIELD(out, in, max_address_fixed); \
- ACPI_COPY_FIELD(out, in, attribute); \
+ ACPI_COPY_FIELD(out, in, info); \
ACPI_COPY_FIELD(out, in, granularity); \
ACPI_COPY_FIELD(out, in, minimum); \
ACPI_COPY_FIELD(out, in, maximum); \
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c
index 4b2fbb592f4..e6dfe688b76 100644
--- a/drivers/acpi/tables/tbutils.c
+++ b/drivers/acpi/tables/tbutils.c
@@ -94,9 +94,8 @@ acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc)
new_table_desc->pointer->length)
&&
(!ACPI_MEMCMP
- ((const char *)table_desc->pointer,
- (const char *)new_table_desc->pointer,
- (acpi_size) new_table_desc->pointer->length))) {
+ (table_desc->pointer, new_table_desc->pointer,
+ new_table_desc->pointer->length))) {
/* Match: this table is already installed */
ACPI_DEBUG_PRINT((ACPI_DB_TABLES,
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c
index dc7f24b3a1c..e04b6119a4d 100644
--- a/drivers/acpi/utilities/utalloc.c
+++ b/drivers/acpi/utilities/utalloc.c
@@ -866,7 +866,7 @@ void acpi_ut_dump_allocations(u32 component, char *module)
if (!num_outstanding) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
- "No outstanding allocations.\n"));
+ "No outstanding allocations\n"));
} else {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"%d(%X) Outstanding allocations\n",
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c
index 7f72839841c..413e1dd8ae3 100644
--- a/drivers/acpi/utilities/utglobal.c
+++ b/drivers/acpi/utilities/utglobal.c
@@ -217,23 +217,23 @@ const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS] = {
* 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to
* perform a Notify() operation on it.
*/
-const struct acpi_predefined_names acpi_gbl_pre_defined_names[] =
- { {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL},
-{"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL},
-{"_SB_", ACPI_TYPE_DEVICE, NULL},
-{"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL},
-{"_TZ_", ACPI_TYPE_THERMAL, NULL},
-{"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL},
-{"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME},
-{"_GL_", ACPI_TYPE_MUTEX, (char *)1},
+const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = {
+ {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL},
+ {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL},
+ {"_SB_", ACPI_TYPE_DEVICE, NULL},
+ {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL},
+ {"_TZ_", ACPI_TYPE_THERMAL, NULL},
+ {"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL},
+ {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME},
+ {"_GL_", ACPI_TYPE_MUTEX, (char *)1},
#if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
-{"_OSI", ACPI_TYPE_METHOD, (char *)1},
+ {"_OSI", ACPI_TYPE_METHOD, (char *)1},
#endif
/* Table terminator */
-{NULL, ACPI_TYPE_ANY, NULL}
+ {NULL, ACPI_TYPE_ANY, NULL}
};
/*
@@ -503,11 +503,13 @@ char *acpi_ut_get_region_name(u8 space_id)
/* Event type decoding */
static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = {
+/*! [Begin] no source code translation (keep these strings as-is) */
"PM_Timer",
- "global_lock",
- "power_button",
- "sleep_button",
- "real_time_clock",
+ "GlobalLock",
+ "PowerButton",
+ "SleepButton",
+ "RealTimeClock",
+/*! [End] no source code translation !*/
};
char *acpi_ut_get_event_name(u32 event_id)
@@ -545,12 +547,13 @@ static const char acpi_gbl_bad_type[] = "UNDEFINED";
/* Printable names of the ACPI object types */
static const char *acpi_gbl_ns_type_names[] = {
+/*! [Begin] no source code translation (keep these strings as-is) */
/* 00 */ "Untyped",
/* 01 */ "Integer",
/* 02 */ "String",
/* 03 */ "Buffer",
/* 04 */ "Package",
- /* 05 */ "field_unit",
+ /* 05 */ "FieldUnit",
/* 06 */ "Device",
/* 07 */ "Event",
/* 08 */ "Method",
@@ -559,23 +562,24 @@ static const char *acpi_gbl_ns_type_names[] = {
/* 11 */ "Power",
/* 12 */ "Processor",
/* 13 */ "Thermal",
- /* 14 */ "buffer_field",
- /* 15 */ "ddb_handle",
- /* 16 */ "debug_object",
- /* 17 */ "region_field",
- /* 18 */ "bank_field",
- /* 19 */ "index_field",
+ /* 14 */ "BufferField",
+ /* 15 */ "DdbHandle",
+ /* 16 */ "DebugObject",
+ /* 17 */ "RegionField",
+ /* 18 */ "BankField",
+ /* 19 */ "IndexField",
/* 20 */ "Reference",
/* 21 */ "Alias",
- /* 22 */ "method_alias",
+ /* 22 */ "MethodAlias",
/* 23 */ "Notify",
- /* 24 */ "addr_handler",
- /* 25 */ "resource_desc",
- /* 26 */ "resource_fld",
+ /* 24 */ "AddrHandler",
+ /* 25 */ "ResourceDesc",
+ /* 26 */ "ResourceFld",
/* 27 */ "Scope",
/* 28 */ "Extra",
/* 29 */ "Data",
/* 30 */ "Invalid"
+/*! [End] no source code translation !*/
};
char *acpi_ut_get_type_name(acpi_object_type type)
@@ -658,15 +662,16 @@ char *acpi_ut_get_node_name(void *object)
/* Printable names of object descriptor types */
static const char *acpi_gbl_desc_type_names[] = {
+/*! [Begin] no source code translation (keep these ASL Keywords as-is) */
/* 00 */ "Invalid",
/* 01 */ "Cached",
/* 02 */ "State-Generic",
/* 03 */ "State-Update",
/* 04 */ "State-Package",
/* 05 */ "State-Control",
- /* 06 */ "State-root_parse_scope",
- /* 07 */ "State-parse_scope",
- /* 08 */ "State-walk_scope",
+ /* 06 */ "State-RootParseScope",
+ /* 07 */ "State-ParseScope",
+ /* 08 */ "State-WalkScope",
/* 09 */ "State-Result",
/* 10 */ "State-Notify",
/* 11 */ "State-Thread",
@@ -674,6 +679,7 @@ static const char *acpi_gbl_desc_type_names[] = {
/* 13 */ "Parser",
/* 14 */ "Operand",
/* 15 */ "Node"
+/*! [End] no source code translation !*/
};
char *acpi_ut_get_descriptor_name(void *object)
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c
index b57afa7421e..e9058d4da12 100644
--- a/drivers/acpi/utilities/utmisc.c
+++ b/drivers/acpi/utilities/utmisc.c
@@ -43,6 +43,7 @@
#include <acpi/acpi.h>
#include <acpi/acnamesp.h>
+#include <acpi/amlresrc.h>
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME("utmisc")
@@ -790,48 +791,147 @@ u8 acpi_ut_generate_checksum(u8 * buffer, u32 length)
/*******************************************************************************
*
+ * FUNCTION: acpi_ut_get_resource_type
+ *
+ * PARAMETERS: Aml - Pointer to the raw AML resource descriptor
+ *
+ * RETURN: The Resource Type with no extraneous bits (except the
+ * Large/Small descriptor bit -- this is left alone)
+ *
+ * DESCRIPTION: Extract the Resource Type/Name from the first byte of
+ * a resource descriptor.
+ *
+ ******************************************************************************/
+
+u8 acpi_ut_get_resource_type(void *aml)
+{
+ ACPI_FUNCTION_ENTRY();
+
+ /*
+ * Byte 0 contains the descriptor name (Resource Type)
+ * Determine if this is a small or large resource
+ */
+ if (*((u8 *) aml) & ACPI_RESOURCE_NAME_LARGE) {
+ /* Large Resource Type -- bits 6:0 contain the name */
+
+ return (*((u8 *) aml));
+ } else {
+ /* Small Resource Type -- bits 6:3 contain the name */
+
+ return ((u8) (*((u8 *) aml) & ACPI_RESOURCE_NAME_SMALL_MASK));
+ }
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_ut_get_resource_length
+ *
+ * PARAMETERS: Aml - Pointer to the raw AML resource descriptor
+ *
+ * RETURN: Byte Length
+ *
+ * DESCRIPTION: Get the "Resource Length" of a raw AML descriptor. By
+ * definition, this does not include the size of the descriptor
+ * header or the length field itself.
+ *
+ ******************************************************************************/
+
+u16 acpi_ut_get_resource_length(void *aml)
+{
+ u16 resource_length;
+
+ ACPI_FUNCTION_ENTRY();
+
+ /*
+ * Byte 0 contains the descriptor name (Resource Type)
+ * Determine if this is a small or large resource
+ */
+ if (*((u8 *) aml) & ACPI_RESOURCE_NAME_LARGE) {
+ /* Large Resource type -- bytes 1-2 contain the 16-bit length */
+
+ ACPI_MOVE_16_TO_16(&resource_length, &((u8 *) aml)[1]);
+
+ } else {
+ /* Small Resource type -- bits 2:0 of byte 0 contain the length */
+
+ resource_length = (u16) (*((u8 *) aml) &
+ ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK);
+ }
+
+ return (resource_length);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_ut_get_descriptor_length
+ *
+ * PARAMETERS: Aml - Pointer to the raw AML resource descriptor
+ *
+ * RETURN: Byte length
+ *
+ * DESCRIPTION: Get the total byte length of a raw AML descriptor, including the
+ * length of the descriptor header and the length field itself.
+ * Used to walk descriptor lists.
+ *
+ ******************************************************************************/
+
+u32 acpi_ut_get_descriptor_length(void *aml)
+{
+ u32 descriptor_length;
+
+ ACPI_FUNCTION_ENTRY();
+
+ /* First get the Resource Length (Does not include header length) */
+
+ descriptor_length = acpi_ut_get_resource_length(aml);
+
+ /* Determine if this is a small or large resource */
+
+ if (*((u8 *) aml) & ACPI_RESOURCE_NAME_LARGE) {
+ descriptor_length += sizeof(struct aml_resource_large_header);
+ } else {
+ descriptor_length += sizeof(struct aml_resource_small_header);
+ }
+
+ return (descriptor_length);
+}
+
+/*******************************************************************************
+ *
* FUNCTION: acpi_ut_get_resource_end_tag
*
* PARAMETERS: obj_desc - The resource template buffer object
*
* RETURN: Pointer to the end tag
*
- * DESCRIPTION: Find the END_TAG resource descriptor in a resource template
+ * DESCRIPTION: Find the END_TAG resource descriptor in an AML resource template
*
******************************************************************************/
u8 *acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc)
{
- u8 buffer_byte;
- u8 *buffer;
- u8 *end_buffer;
-
- buffer = obj_desc->buffer.pointer;
- end_buffer = buffer + obj_desc->buffer.length;
+ u8 *aml;
+ u8 *end_aml;
- while (buffer < end_buffer) {
- buffer_byte = *buffer;
- if (buffer_byte & ACPI_RESOURCE_NAME_LARGE) {
- /* Large Descriptor - Length is next 2 bytes */
+ aml = obj_desc->buffer.pointer;
+ end_aml = aml + obj_desc->buffer.length;
- buffer += ((*(buffer + 1) | (*(buffer + 2) << 8)) + 3);
- } else {
- /* Small Descriptor. End Tag will be found here */
+ /* Walk the resource template, one descriptor per loop */
- if ((buffer_byte & ACPI_RESOURCE_NAME_SMALL_MASK) ==
- ACPI_RESOURCE_NAME_END_TAG) {
- /* Found the end tag descriptor, all done. */
+ while (aml < end_aml) {
+ if (acpi_ut_get_resource_type(aml) ==
+ ACPI_RESOURCE_NAME_END_TAG) {
+ /* Found the end_tag descriptor, all done */
- return (buffer);
- }
+ return (aml);
+ }
- /* Length is in the header */
+ /* Point to the next resource descriptor */
- buffer += ((buffer_byte & 0x07) + 1);
- }
+ aml += acpi_ut_get_resource_length(aml);
}
- /* End tag not found */
+ /* End tag was not found */
return (NULL);
}
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index f4adebde615..b8b46ab54f4 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -401,7 +401,7 @@ pnpacpi_parse_mem24_option(struct pnp_option *option,
mem->align = p->alignment;
mem->size = p->address_length;
- mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ?
+ mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ?
IORESOURCE_MEM_WRITEABLE : 0;
pnp_register_mem_resource(option,mem);
@@ -424,7 +424,7 @@ pnpacpi_parse_mem32_option(struct pnp_option *option,
mem->align = p->alignment;
mem->size = p->address_length;
- mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ?
+ mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ?
IORESOURCE_MEM_WRITEABLE : 0;
pnp_register_mem_resource(option,mem);
@@ -446,7 +446,7 @@ pnpacpi_parse_fixed_mem32_option(struct pnp_option *option,
mem->size = p->address_length;
mem->align = 0;
- mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ?
+ mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ?
IORESOURCE_MEM_WRITEABLE : 0;
pnp_register_mem_resource(option,mem);
@@ -734,7 +734,7 @@ static void pnpacpi_encode_mem24(struct acpi_resource *resource,
resource->type = ACPI_RESOURCE_TYPE_MEMORY24;
resource->length = sizeof(struct acpi_resource);
/* Note: pnp_assign_mem will copy pnp_mem->flags into p->flags */
- resource->data.memory24.read_write_attribute =
+ resource->data.memory24.write_protect =
(p->flags & IORESOURCE_MEM_WRITEABLE) ?
ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY;
resource->data.memory24.minimum = p->start;
@@ -748,7 +748,7 @@ static void pnpacpi_encode_mem32(struct acpi_resource *resource,
{
resource->type = ACPI_RESOURCE_TYPE_MEMORY32;
resource->length = sizeof(struct acpi_resource);
- resource->data.memory32.read_write_attribute =
+ resource->data.memory32.write_protect =
(p->flags & IORESOURCE_MEM_WRITEABLE) ?
ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY;
resource->data.memory32.minimum = p->start;
@@ -762,7 +762,7 @@ static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource,
{
resource->type = ACPI_RESOURCE_TYPE_FIXED_MEMORY32;
resource->length = sizeof(struct acpi_resource);
- resource->data.fixed_memory32.read_write_attribute =
+ resource->data.fixed_memory32.write_protect =
(p->flags & IORESOURCE_MEM_WRITEABLE) ?
ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY;
resource->data.fixed_memory32.address = p->start;
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h
index cb59b018c84..7676afec09a 100644
--- a/include/acpi/acconfig.h
+++ b/include/acpi/acconfig.h
@@ -63,7 +63,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
-#define ACPI_CA_VERSION 0x20050930
+#define ACPI_CA_VERSION 0x20051021
/*
* 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 b2921b869bb..99250ee1b9d 100644
--- a/include/acpi/acdisasm.h
+++ b/include/acpi/acdisasm.h
@@ -60,6 +60,7 @@ extern struct acpi_external_list *acpi_gbl_external_list;
extern const char *acpi_gbl_io_decode[2];
extern const char *acpi_gbl_word_decode[4];
extern const char *acpi_gbl_consume_decode[2];
+extern const char *acpi_gbl_config_decode[4];
extern const char *acpi_gbl_min_decode[2];
extern const char *acpi_gbl_max_decode[2];
extern const char *acpi_gbl_DECdecode[2];
@@ -171,11 +172,19 @@ u8 acpi_dm_is_string_buffer(union acpi_parse_object *op);
/*
* dmresrc
*/
+void acpi_dm_dump_integer8(u8 value, char *name);
+
+void acpi_dm_dump_integer16(u16 value, char *name);
+
+void acpi_dm_dump_integer32(u32 value, char *name);
+
+void acpi_dm_dump_integer64(u64 value, char *name);
+
void
-acpi_dm_resource_descriptor(struct acpi_op_walk_info *info,
- u8 * byte_data, u32 byte_count);
+acpi_dm_resource_template(struct acpi_op_walk_info *info,
+ u8 * byte_data, u32 byte_count);
-u8 acpi_dm_is_resource_descriptor(union acpi_parse_object *op);
+u8 acpi_dm_is_resource_template(union acpi_parse_object *op);
void acpi_dm_indent(u32 level);
@@ -223,6 +232,8 @@ void
acpi_dm_vendor_large_descriptor(union aml_resource *resource,
u32 length, u32 level);
+void acpi_dm_vendor_common(char *name, u8 * byte_data, u32 length, u32 level);
+
/*
* dmresrcs
*/
diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h
index 258cfe5e2aa..e42222c3d34 100644
--- a/include/acpi/acmacros.h
+++ b/include/acpi/acmacros.h
@@ -202,7 +202,7 @@
#define ACPI_BUFFER_INDEX(buf_len,buf_offset,byte_gran) (buf_offset)
-#ifdef ACPI_MISALIGNED_TRANSFERS
+#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
/* The hardware supports unaligned transfers, just do the little-endian move */
@@ -563,11 +563,11 @@
return (_s); })
#define return_UINT8(s) ACPI_DO_WHILE0 ({ \
register u8 _s = (u8) (s); \
- acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \
+ acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) _s); \
return (_s); })
#define return_UINT32(s) ACPI_DO_WHILE0 ({ \
register u32 _s = (u32) (s); \
- acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \
+ acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) _s); \
return (_s); })
#else /* Use original less-safe macros */
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 98e0b8cd14e..58473f60755 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -108,9 +108,9 @@ acpi_status acpi_os_create_lock(acpi_handle * out_handle);
void acpi_os_delete_lock(acpi_handle handle);
-unsigned long acpi_os_acquire_lock(acpi_handle handle);
+acpi_native_uint acpi_os_acquire_lock(acpi_handle handle);
-void acpi_os_release_lock(acpi_handle handle, unsigned long flags);
+void acpi_os_release_lock(acpi_handle handle, acpi_native_uint flags);
/*
* Memory allocation and mapping
diff --git a/include/acpi/acresrc.h b/include/acpi/acresrc.h
index b66994e9e4e..25cff0d5ba5 100644
--- a/include/acpi/acresrc.h
+++ b/include/acpi/acresrc.h
@@ -49,48 +49,132 @@
#include "amlresrc.h"
/*
+ * If possible, pack the following structures to byte alignment, since we
+ * don't care about performance for debug output
+ */
+#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
+#pragma pack(1)
+#endif
+
+/*
+ * Individual entry for the resource conversion tables
+ */
+typedef const struct acpi_rsconvert_info {
+ u8 opcode;
+ u8 resource_offset;
+ u8 aml_offset;
+ u8 value;
+
+} acpi_rsconvert_info;
+
+/* Resource conversion opcodes */
+
+#define ACPI_RSC_INITGET 0
+#define ACPI_RSC_INITSET 1
+#define ACPI_RSC_FLAGINIT 2
+#define ACPI_RSC_1BITFLAG 3
+#define ACPI_RSC_2BITFLAG 4
+#define ACPI_RSC_COUNT 5
+#define ACPI_RSC_COUNT16 6
+#define ACPI_RSC_LENGTH 7
+#define ACPI_RSC_MOVE8 8
+#define ACPI_RSC_MOVE16 9
+#define ACPI_RSC_MOVE32 10
+#define ACPI_RSC_MOVE64 11
+#define ACPI_RSC_SET8 12
+#define ACPI_RSC_DATA8 13
+#define ACPI_RSC_ADDRESS 14
+#define ACPI_RSC_SOURCE 15
+#define ACPI_RSC_SOURCEX 16
+#define ACPI_RSC_BITMASK 17
+#define ACPI_RSC_BITMASK16 18
+#define ACPI_RSC_EXIT_NE 19
+#define ACPI_RSC_EXIT_LE 20
+
+/* Resource Conversion sub-opcodes */
+
+#define ACPI_RSC_COMPARE_AML_LENGTH 0
+#define ACPI_RSC_COMPARE_VALUE 1
+
+#define ACPI_RSC_TABLE_SIZE(d) (sizeof (d) / sizeof (struct acpi_rsconvert_info))
+
+#define ACPI_RS_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_resource,f)
+#define AML_OFFSET(f) (u8) ACPI_OFFSET (union aml_resource,f)
+
+/*
* Resource dispatch and info tables
*/
-struct acpi_resource_info {
+typedef const struct acpi_resource_info {
u8 length_type;
u8 minimum_aml_resource_length;
u8 minimum_internal_struct_length;
-};
+
+} acpi_resource_info;
/* Types for length_type above */
-#define ACPI_FIXED_LENGTH 0
-#define ACPI_VARIABLE_LENGTH 1
-#define ACPI_SMALL_VARIABLE_LENGTH 2
+#define ACPI_FIXED_LENGTH 0
+#define ACPI_VARIABLE_LENGTH 1
+#define ACPI_SMALL_VARIABLE_LENGTH 2
+
+typedef const struct acpi_rsdump_info {
+ u8 opcode;
+ u8 offset;
+ char *name;
+ const void *pointer;
-/* Handlers */
+} acpi_rsdump_info;
-typedef acpi_status(*ACPI_SET_RESOURCE_HANDLER) (struct acpi_resource *
- resource,
- union aml_resource * aml);
+/* Values for the Opcode field above */
-typedef acpi_status(*ACPI_GET_RESOURCE_HANDLER) (union aml_resource * aml,
- u16 aml_resource_length,
- struct acpi_resource *
- resource);
+#define ACPI_RSD_TITLE 0
+#define ACPI_RSD_LITERAL 1
+#define ACPI_RSD_STRING 2
+#define ACPI_RSD_UINT8 3
+#define ACPI_RSD_UINT16 4
+#define ACPI_RSD_UINT32 5
+#define ACPI_RSD_UINT64 6
+#define ACPI_RSD_1BITFLAG 7
+#define ACPI_RSD_2BITFLAG 8
+#define ACPI_RSD_SHORTLIST 9
+#define ACPI_RSD_LONGLIST 10
+#define ACPI_RSD_DWORDLIST 11
+#define ACPI_RSD_ADDRESS 12
+#define ACPI_RSD_SOURCE 13
-typedef void (*ACPI_DUMP_RESOURCE_HANDLER) (union acpi_resource_data * data);
+/* restore default alignment */
-/* Tables indexed by internal resource type */
+#pragma pack()
-extern u8 acpi_gbl_aml_resource_sizes[];
-extern ACPI_SET_RESOURCE_HANDLER acpi_gbl_set_resource_dispatch[];
-extern ACPI_DUMP_RESOURCE_HANDLER acpi_gbl_dump_resource_dispatch[];
+/* Resource tables indexed by internal resource type */
-/* Tables indexed by raw AML resource descriptor type */
+extern const u8 acpi_gbl_aml_resource_sizes[];
+extern struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[];
+
+/* Resource tables indexed by raw AML resource descriptor type */
extern struct acpi_resource_info acpi_gbl_sm_resource_info[];
extern struct acpi_resource_info acpi_gbl_lg_resource_info[];
-extern ACPI_GET_RESOURCE_HANDLER acpi_gbl_sm_get_resource_dispatch[];
-extern ACPI_GET_RESOURCE_HANDLER acpi_gbl_lg_get_resource_dispatch[];
+extern struct acpi_rsconvert_info *acpi_gbl_sm_get_resource_dispatch[];
+extern struct acpi_rsconvert_info *acpi_gbl_lg_get_resource_dispatch[];
+
+/*
+ * rscreate
+ */
+acpi_status
+acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer,
+ struct acpi_buffer *output_buffer);
+
+acpi_status
+acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer,
+ struct acpi_buffer *output_buffer);
+
+acpi_status
+acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
+ struct acpi_buffer *output_buffer);
/*
- * Function prototypes called from Acpi* APIs
+ * rsutils
*/
acpi_status
acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer);
@@ -110,27 +194,6 @@ acpi_rs_get_method_data(acpi_handle handle,
acpi_status
acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer);
-acpi_status
-acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer,
- struct acpi_buffer *output_buffer);
-
-acpi_status
-acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer,
- struct acpi_buffer *output_buffer);
-
-acpi_status
-acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
- struct acpi_buffer *output_buffer);
-
-/*
- * rsdump
- */
-#ifdef ACPI_FUTURE_USAGE
-void acpi_rs_dump_resource_list(struct acpi_resource *resource);
-
-void acpi_rs_dump_irq_list(u8 * route_table);
-#endif /* ACPI_FUTURE_USAGE */
-
/*
* rscalc
*/
@@ -155,144 +218,28 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
acpi_size aml_size_needed, u8 * output_buffer);
/*
- * rsio
- */
-acpi_status
-acpi_rs_get_io(union aml_resource *aml,
- u16 aml_resource_length, struct acpi_resource *resource);
-
-acpi_status
-acpi_rs_set_io(struct acpi_resource *resource, union aml_resource *aml);
-
-acpi_status
-acpi_rs_get_fixed_io(union aml_resource *aml,
- u16 aml_resource_length, struct acpi_resource *resource);
-
-acpi_status
-acpi_rs_set_fixed_io(struct acpi_resource *resource, union aml_resource *aml);
-
-acpi_status
-acpi_rs_get_dma(union aml_resource *aml,
- u16 aml_resource_length, struct acpi_resource *resource);
-
-acpi_status
-acpi_rs_set_dma(struct acpi_resource *resource, union aml_resource *aml);
-
-/*
- * rsirq
- */
-acpi_status
-acpi_rs_get_irq(union aml_resource *aml,
- u16 aml_resource_length, struct acpi_resource *resource);
-
-acpi_status
-acpi_rs_set_irq(struct acpi_resource *resource, union aml_resource *aml);
-
-acpi_status
-acpi_rs_get_ext_irq(union aml_resource *aml,
- u16 aml_resource_length, struct acpi_resource *resource);
-
-acpi_status
-acpi_rs_set_ext_irq(struct acpi_resource *resource, union aml_resource *aml);
-
-/*
* rsaddr
*/
-acpi_status
-acpi_rs_get_address16(union aml_resource *aml,
- u16 aml_resource_length, struct acpi_resource *resource);
-
-acpi_status
-acpi_rs_set_address16(struct acpi_resource *resource, union aml_resource *aml);
-
-acpi_status
-acpi_rs_get_address32(union aml_resource *aml,
- u16 aml_resource_length, struct acpi_resource *resource);
-
-acpi_status
-acpi_rs_set_address32(struct acpi_resource *resource, union aml_resource *aml);
-
-acpi_status
-acpi_rs_get_address64(union aml_resource *aml,
- u16 aml_resource_length, struct acpi_resource *resource);
-
-acpi_status
-acpi_rs_set_address64(struct acpi_resource *resource, union aml_resource *aml);
-
-acpi_status
-acpi_rs_get_ext_address64(union aml_resource *aml,
- u16 aml_resource_length,
- struct acpi_resource *resource);
-
-acpi_status
-acpi_rs_set_ext_address64(struct acpi_resource *resource,
- union aml_resource *aml);
-
-/*
- * rsmemory
- */
-acpi_status
-acpi_rs_get_memory24(union aml_resource *aml,
- u16 aml_resource_length, struct acpi_resource *resource);
-
-acpi_status
-acpi_rs_set_memory24(struct acpi_resource *resource, union aml_resource *aml);
-
-acpi_status
-acpi_rs_get_memory32(union aml_resource *aml,
- u16 aml_resource_length, struct acpi_resource *resource);
-
-acpi_status
-acpi_rs_set_memory32(struct acpi_resource *resource, union aml_resource *aml);
-
-acpi_status
-acpi_rs_get_fixed_memory32(union aml_resource *aml,
- u16 aml_resource_length,
+void
+acpi_rs_set_address_common(union aml_resource *aml,
struct acpi_resource *resource);
-acpi_status
-acpi_rs_set_fixed_memory32(struct acpi_resource *resource,
+u8
+acpi_rs_get_address_common(struct acpi_resource *resource,
union aml_resource *aml);
/*
* rsmisc
*/
acpi_status
-acpi_rs_get_generic_reg(union aml_resource *aml,
- u16 aml_resource_length,
- struct acpi_resource *resource);
-
-acpi_status
-acpi_rs_set_generic_reg(struct acpi_resource *resource,
- union aml_resource *aml);
-
-acpi_status
-acpi_rs_get_vendor(union aml_resource *aml,
- u16 aml_resource_length, struct acpi_resource *resource);
-
-acpi_status
-acpi_rs_set_vendor(struct acpi_resource *resource, union aml_resource *aml);
-
-acpi_status
-acpi_rs_get_start_dpf(union aml_resource *aml,
- u16 aml_resource_length, struct acpi_resource *resource);
-
-acpi_status
-acpi_rs_set_start_dpf(struct acpi_resource *resource, union aml_resource *aml);
-
-acpi_status
-acpi_rs_get_end_dpf(union aml_resource *aml,
- u16 aml_resource_length, struct acpi_resource *resource);
-
-acpi_status
-acpi_rs_set_end_dpf(struct acpi_resource *resource, union aml_resource *aml);
+acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
+ union aml_resource *aml,
+ struct acpi_rsconvert_info *info);
acpi_status
-acpi_rs_get_end_tag(union aml_resource *aml,
- u16 aml_resource_length, struct acpi_resource *resource);
-
-acpi_status
-acpi_rs_set_end_tag(struct acpi_resource *resource, union aml_resource *aml);
+acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
+ union aml_resource *aml,
+ struct acpi_rsconvert_info *info);
/*
* rsutils
@@ -301,74 +248,94 @@ void
acpi_rs_move_data(void *destination,
void *source, u16 item_count, u8 move_type);
-/* Types used in move_type above */
+u8 acpi_rs_decode_bitmask(u16 mask, u8 * list);
-#define ACPI_MOVE_TYPE_16_TO_32 0
-#define ACPI_MOVE_TYPE_32_TO_16 1
-#define ACPI_MOVE_TYPE_32_TO_32 2
-#define ACPI_MOVE_TYPE_64_TO_64 3
+u16 acpi_rs_encode_bitmask(u8 * list, u8 count);
-u16
-acpi_rs_get_resource_source(u16 resource_length,
- acpi_size minimum_length,
+acpi_rs_length
+acpi_rs_get_resource_source(acpi_rs_length resource_length,
+ acpi_rs_length minimum_length,
struct acpi_resource_source *resource_source,
union aml_resource *aml, char *string_ptr);
-acpi_size
+acpi_rsdesc_size
acpi_rs_set_resource_source(union aml_resource *aml,
- acpi_size minimum_length,
+ acpi_rs_length minimum_length,
struct acpi_resource_source *resource_source);
-u8 acpi_rs_get_resource_type(u8 resource_start_byte);
-
-u32 acpi_rs_get_descriptor_length(union aml_resource *aml);
-
-u16 acpi_rs_get_resource_length(union aml_resource *aml);
-
void
acpi_rs_set_resource_header(u8 descriptor_type,
- acpi_size total_length, union aml_resource *aml);
+ acpi_rsdesc_size total_length,
+ union aml_resource *aml);
+
+void
+acpi_rs_set_resource_length(acpi_rsdesc_size total_length,
+ union aml_resource *aml);
struct acpi_resource_info *acpi_rs_get_resource_info(u8 resource_type);
-#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
/*
* rsdump
*/
-void acpi_rs_dump_irq(union acpi_resource_data *resource);
-
-void acpi_rs_dump_address16(union acpi_resource_data *resource);
-
-void acpi_rs_dump_address32(union acpi_resource_data *resource);
-
-void acpi_rs_dump_address64(union acpi_resource_data *resource);
-
-void acpi_rs_dump_ext_address64(union acpi_resource_data *resource);
-
-void acpi_rs_dump_dma(union acpi_resource_data *resource);
-
-void acpi_rs_dump_io(union acpi_resource_data *resource);
-
-void acpi_rs_dump_ext_irq(union acpi_resource_data *resource);
-
-void acpi_rs_dump_fixed_io(union acpi_resource_data *resource);
-
-void acpi_rs_dump_fixed_memory32(union acpi_resource_data *resource);
-
-void acpi_rs_dump_memory24(union acpi_resource_data *resource);
-
-void acpi_rs_dump_memory32(union acpi_resource_data *resource);
-
-void acpi_rs_dump_start_dpf(union acpi_resource_data *resource);
-
-void acpi_rs_dump_vendor(union acpi_resource_data *resource);
+void acpi_rs_dump_resource_list(struct acpi_resource *resource);
-void acpi_rs_dump_generic_reg(union acpi_resource_data *resource);
+void acpi_rs_dump_irq_list(u8 * route_table);
-void acpi_rs_dump_end_dpf(union acpi_resource_data *resource);
+/*
+ * Resource conversion tables
+ */
+extern struct acpi_rsconvert_info acpi_rs_convert_dma[];
+extern struct acpi_rsconvert_info acpi_rs_convert_end_dpf[];
+extern struct acpi_rsconvert_info acpi_rs_convert_io[];
+extern struct acpi_rsconvert_info acpi_rs_convert_fixed_io[];
+extern struct acpi_rsconvert_info acpi_rs_convert_end_tag[];
+extern struct acpi_rsconvert_info acpi_rs_convert_memory24[];
+extern struct acpi_rsconvert_info acpi_rs_convert_generic_reg[];
+extern struct acpi_rsconvert_info acpi_rs_convert_memory32[];
+extern struct acpi_rsconvert_info acpi_rs_convert_fixed_memory32[];
+extern struct acpi_rsconvert_info acpi_rs_convert_address32[];
+extern struct acpi_rsconvert_info acpi_rs_convert_address16[];
+extern struct acpi_rsconvert_info acpi_rs_convert_ext_irq[];
+extern struct acpi_rsconvert_info acpi_rs_convert_address64[];
+extern struct acpi_rsconvert_info acpi_rs_convert_ext_address64[];
+
+/* These resources require separate get/set tables */
+
+extern struct acpi_rsconvert_info acpi_rs_get_irq[];
+extern struct acpi_rsconvert_info acpi_rs_get_start_dpf[];
+extern struct acpi_rsconvert_info acpi_rs_get_vendor_small[];
+extern struct acpi_rsconvert_info acpi_rs_get_vendor_large[];
+
+extern struct acpi_rsconvert_info acpi_rs_set_irq[];
+extern struct acpi_rsconvert_info acpi_rs_set_start_dpf[];
+extern struct acpi_rsconvert_info acpi_rs_set_vendor[];
-void acpi_rs_dump_end_tag(union acpi_resource_data *resource);
+#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
+/*
+ * rsinfo
+ */
+extern struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[];
+/*
+ * rsdump
+ */
+extern struct acpi_rsdump_info acpi_rs_dump_irq[];
+extern struct acpi_rsdump_info acpi_rs_dump_dma[];
+extern struct acpi_rsdump_info acpi_rs_dump_start_dpf[];
+extern struct acpi_rsdump_info acpi_rs_dump_end_dpf[];
+extern struct acpi_rsdump_info acpi_rs_dump_io[];
+extern struct acpi_rsdump_info acpi_rs_dump_fixed_io[];
+extern struct acpi_rsdump_info acpi_rs_dump_vendor[];
+extern struct acpi_rsdump_info acpi_rs_dump_end_tag[];
+extern struct acpi_rsdump_info acpi_rs_dump_memory24[];
+extern struct acpi_rsdump_info acpi_rs_dump_memory32[];
+extern struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[];
+extern struct acpi_rsdump_info acpi_rs_dump_address16[];
+extern struct acpi_rsdump_info acpi_rs_dump_address32[];
+extern struct acpi_rsdump_info acpi_rs_dump_address64[];
+extern struct acpi_rsdump_info acpi_rs_dump_ext_address64[];
+extern struct acpi_rsdump_info acpi_rs_dump_ext_irq[];
+extern struct acpi_rsdump_info acpi_rs_dump_generic_reg[];
#endif
#endif /* __ACRESRC_H__ */
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 43f7c509317..29b887017b1 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -83,10 +83,11 @@ typedef COMPILER_DEPENDENT_UINT64 u64;
* UINT32 32-bit (4 byte) unsigned value
* INT64 64-bit (8 byte) signed value
* UINT64 64-bit (8 byte) unsigned value
- * ACPI_NATIVE_INT 32-bit on IA-32, 64-bit on IA-64 signed value
- * ACPI_NATIVE_UINT 32-bit on IA-32, 64-bit on IA-64 unsigned value
+ * ACPI_NATIVE_UINT 32-bit on IA-32, 64-bit on x86_64/IA-64 unsigned value
*/
+typedef unsigned long acpi_native_uint;
+
#ifndef ACPI_MACHINE_WIDTH
#error ACPI_MACHINE_WIDTH not defined
#endif
@@ -108,9 +109,6 @@ typedef COMPILER_DEPENDENT_UINT64 UINT64;
/*! [End] no source code translation !*/
-typedef s64 acpi_native_int;
-typedef u64 acpi_native_uint;
-
typedef u64 acpi_table_ptr;
typedef u64 acpi_io_address;
typedef u64 acpi_physical_address;
@@ -121,9 +119,22 @@ typedef u64 acpi_size;
#define ACPI_MAX_PTR ACPI_UINT64_MAX
#define ACPI_SIZE_MAX ACPI_UINT64_MAX
+/*
+ * In the case of the Itanium Processor Family (IPF), the hardware does not
+ * support misaligned memory transfers. Set the MISALIGNMENT_NOT_SUPPORTED flag
+ * to indicate that special precautions must be taken to avoid alignment faults.
+ * (IA64 or ia64 is currently used by existing compilers to indicate IPF.)
+ *
+ * Note: Em64_t and other X86-64 processors do support misaligned transfers,
+ * so there is no need to define this flag.
+ */
+#if defined (__IA64__) || defined (__ia64__)
+#define ACPI_MISALIGNMENT_NOT_SUPPORTED
+#endif
+
#elif ACPI_MACHINE_WIDTH == 16
-/*! [Begin] no source code translation (keep the typedefs) */
+/*! [Begin] no source code translation (keep the typedefs as-is) */
/*
* 16-bit type definitions
@@ -142,16 +153,12 @@ struct {
/*! [End] no source code translation !*/
-typedef u16 acpi_native_uint;
-typedef s16 acpi_native_int;
-
typedef u32 acpi_table_ptr;
typedef u32 acpi_io_address;
typedef char *acpi_physical_address;
typedef u16 acpi_size;
#define ALIGNED_ADDRESS_BOUNDARY 0x00000002
-#define ACPI_MISALIGNED_TRANSFERS
#define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */
#define ACPI_MAX_PTR ACPI_UINT16_MAX
#define ACPI_SIZE_MAX ACPI_UINT16_MAX
@@ -179,16 +186,12 @@ typedef COMPILER_DEPENDENT_UINT64 UINT64;
/*! [End] no source code translation !*/
-typedef s32 acpi_native_int;
-typedef u32 acpi_native_uint;
-
typedef u64 acpi_table_ptr;
typedef u32 acpi_io_address;
typedef u64 acpi_physical_address;
typedef u32 acpi_size;
#define ALIGNED_ADDRESS_BOUNDARY 0x00000004
-#define ACPI_MISALIGNED_TRANSFERS
#define ACPI_MAX_PTR ACPI_UINT32_MAX
#define ACPI_SIZE_MAX ACPI_UINT32_MAX
@@ -895,6 +898,8 @@ struct acpi_mem_space_context {
/*
* Definitions for Resource Attributes
*/
+typedef u16 acpi_rs_length; /* Resource Length field is fixed at 16 bits */
+typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (length+3) = (64_k-1)+3 */
/*
* Memory Attributes
@@ -927,8 +932,8 @@ struct acpi_mem_space_context {
/*
* IRQ Attributes
*/
-#define ACPI_EDGE_SENSITIVE (u8) 0x00
-#define ACPI_LEVEL_SENSITIVE (u8) 0x01
+#define ACPI_LEVEL_SENSITIVE (u8) 0x00
+#define ACPI_EDGE_SENSITIVE (u8) 0x01
#define ACPI_ACTIVE_HIGH (u8) 0x00
#define ACPI_ACTIVE_LOW (u8) 0x01
@@ -975,27 +980,34 @@ struct acpi_mem_space_context {
#define ACPI_CONSUMER (u8) 0x01
/*
+ * If possible, pack the following structures to byte alignment
+ */
+#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
+#pragma pack(1)
+#endif
+
+/*
* Structures used to describe device resources
*/
struct acpi_resource_irq {
- u32 triggering;
- u32 polarity;
- u32 sharable;
- u32 interrupt_count;
- u32 interrupts[1];
+ u8 triggering;
+ u8 polarity;
+ u8 sharable;
+ u8 interrupt_count;
+ u8 interrupts[1];
};
struct acpi_resource_dma {
- u32 type;
- u32 bus_master;
- u32 transfer;
- u32 channel_count;
- u32 channels[1];
+ u8 type;
+ u8 bus_master;
+ u8 transfer;
+ u8 channel_count;
+ u8 channels[1];
};
struct acpi_resource_start_dependent {
- u32 compatibility_priority;
- u32 performance_robustness;
+ u8 compatibility_priority;
+ u8 performance_robustness;
};
/*
@@ -1004,20 +1016,20 @@ struct acpi_resource_start_dependent {
*/
struct acpi_resource_io {
- u32 io_decode;
- u32 minimum;
- u32 maximum;
- u32 alignment;
- u32 address_length;
+ u8 io_decode;
+ u8 alignment;
+ u8 address_length;
+ u16 minimum;
+ u16 maximum;
};
struct acpi_resource_fixed_io {
- u32 address;
- u32 address_length;
+ u16 address;
+ u8 address_length;
};
struct acpi_resource_vendor {
- u32 byte_length;
+ u16 byte_length;
u8 byte_data[1];
};
@@ -1026,15 +1038,15 @@ struct acpi_resource_end_tag {
};
struct acpi_resource_memory24 {
- u32 read_write_attribute;
- u32 minimum;
- u32 maximum;
- u32 alignment;
- u32 address_length;
+ u8 write_protect;
+ u16 minimum;
+ u16 maximum;
+ u16 alignment;
+ u16 address_length;
};
struct acpi_resource_memory32 {
- u32 read_write_attribute;
+ u8 write_protect;
u32 minimum;
u32 maximum;
u32 alignment;
@@ -1042,57 +1054,59 @@ struct acpi_resource_memory32 {
};
struct acpi_resource_fixed_memory32 {
- u32 read_write_attribute;
+ u8 write_protect;
u32 address;
u32 address_length;
};
struct acpi_memory_attribute {
- u16 cache_attribute;
- u16 read_write_attribute;
+ u8 write_protect;
+ u8 caching;
+ u8 range_type;
+ u8 translation;
};
struct acpi_io_attribute {
- u16 range_attribute;
- u16 translation_attribute;
-};
-
-struct acpi_bus_attribute {
- u16 reserved1;
- u16 reserved2;
+ u8 range_type;
+ u8 translation;
+ u8 translation_type;
+ u8 reserved1;
};
union acpi_resource_attribute {
- struct acpi_memory_attribute memory;
+ struct acpi_memory_attribute mem;
struct acpi_io_attribute io;
- struct acpi_bus_attribute bus;
+
+ /* Used for the *word_space macros */
+
+ u8 type_specific;
};
struct acpi_resource_source {
- u32 index;
- u32 string_length;
+ u8 index;
+ u16 string_length;
char *string_ptr;
};
/* Fields common to all address descriptors, 16/32/64 bit */
#define ACPI_RESOURCE_ADDRESS_COMMON \
- u32 resource_type; \
- u32 producer_consumer; \
- u32 decode; \
- u32 min_address_fixed; \
- u32 max_address_fixed; \
- union acpi_resource_attribute attribute;
+ u8 resource_type; \
+ u8 producer_consumer; \
+ u8 decode; \
+ u8 min_address_fixed; \
+ u8 max_address_fixed; \
+ union acpi_resource_attribute info;
struct acpi_resource_address {
ACPI_RESOURCE_ADDRESS_COMMON};
struct acpi_resource_address16 {
- ACPI_RESOURCE_ADDRESS_COMMON u32 granularity;
- u32 minimum;
- u32 maximum;
- u32 translation_offset;
- u32 address_length;
+ ACPI_RESOURCE_ADDRESS_COMMON u16 granularity;
+ u16 minimum;
+ u16 maximum;
+ u16 translation_offset;
+ u16 address_length;
struct acpi_resource_source resource_source;
};
@@ -1115,30 +1129,30 @@ struct acpi_resource_address64 {
};
struct acpi_resource_extended_address64 {
- ACPI_RESOURCE_ADDRESS_COMMON u64 granularity;
+ ACPI_RESOURCE_ADDRESS_COMMON u8 revision_iD;
+ u64 granularity;
u64 minimum;
u64 maximum;
u64 translation_offset;
u64 address_length;
- u64 type_specific_attributes;
- u8 revision_iD;
+ u64 type_specific;
};
struct acpi_resource_extended_irq {
- u32 producer_consumer;
- u32 triggering;
- u32 polarity;
- u32 sharable;
- u32 interrupt_count;
+ u8 producer_consumer;
+ u8 triggering;
+ u8 polarity;
+ u8 sharable;
+ u8 interrupt_count;
struct acpi_resource_source resource_source;
u32 interrupts[1];
};
struct acpi_resource_generic_register {
- u32 space_id;
- u32 bit_width;
- u32 bit_offset;
- u32 access_size;
+ u8 space_id;
+ u8 bit_width;
+ u8 bit_offset;
+ u8 access_size;
u64 address;
};
@@ -1192,14 +1206,17 @@ struct acpi_resource {
union acpi_resource_data data;
};
-#define ACPI_RESOURCE_LENGTH 12
-#define ACPI_RESOURCE_LENGTH_NO_DATA 8 /* Id + Length fields */
+/* restore default alignment */
+
+#pragma pack()
-#define ACPI_SIZEOF_RESOURCE(type) (u32) (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (type))
+#define ACPI_RS_SIZE_MIN 12
+#define ACPI_RS_SIZE_NO_DATA 8 /* Id + Length fields */
+#define ACPI_RS_SIZE(type) (u32) (ACPI_RS_SIZE_NO_DATA + sizeof (type))
#define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length)
-#ifdef ACPI_MISALIGNED_TRANSFERS
+#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
#define ACPI_ALIGN_RESOURCE_SIZE(length) (length)
#else
#define ACPI_ALIGN_RESOURCE_SIZE(length) ACPI_ROUND_UP_TO_NATIVE_WORD(length)
diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h
index c1086452696..7386eb81bd2 100644
--- a/include/acpi/acutils.h
+++ b/include/acpi/acutils.h
@@ -159,7 +159,6 @@ extern const u8 _acpi_ctype[];
#define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
#define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU))
#define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
-#define ACPI_IS_ASCII(c) ((c) < 0x80)
#endif /* ACPI_USE_SYSTEM_CLIBRARY */
@@ -419,6 +418,12 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer);
#define ACPI_ANY_BASE 0
+u32 acpi_ut_get_descriptor_length(void *aml);
+
+u16 acpi_ut_get_resource_length(void *aml);
+
+u8 acpi_ut_get_resource_type(void *aml);
+
u8 *acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc);
u8 acpi_ut_generate_checksum(u8 * buffer, u32 length);
diff --git a/include/acpi/amlresrc.h b/include/acpi/amlresrc.h
index 103aff07db1..3112be52773 100644
--- a/include/acpi/amlresrc.h
+++ b/include/acpi/amlresrc.h
@@ -134,7 +134,7 @@ struct aml_resource_end_dependent {
AML_RESOURCE_SMALL_HEADER_COMMON};
struct aml_resource_io {
- AML_RESOURCE_SMALL_HEADER_COMMON u8 information;
+ AML_RESOURCE_SMALL_HEADER_COMMON u8 flags;
u16 minimum;
u16 maximum;
u8 alignment;
@@ -164,7 +164,7 @@ struct aml_resource_large_header {
AML_RESOURCE_LARGE_HEADER_COMMON};
struct aml_resource_memory24 {
- AML_RESOURCE_LARGE_HEADER_COMMON u8 information;
+ AML_RESOURCE_LARGE_HEADER_COMMON u8 flags;
u16 minimum;
u16 maximum;
u16 alignment;
@@ -175,7 +175,7 @@ struct aml_resource_vendor_large {
AML_RESOURCE_LARGE_HEADER_COMMON};
struct aml_resource_memory32 {
- AML_RESOURCE_LARGE_HEADER_COMMON u8 information;
+ AML_RESOURCE_LARGE_HEADER_COMMON u8 flags;
u32 minimum;
u32 maximum;
u32 alignment;
@@ -183,7 +183,7 @@ struct aml_resource_memory32 {
};
struct aml_resource_fixed_memory32 {
- AML_RESOURCE_LARGE_HEADER_COMMON u8 information;
+ AML_RESOURCE_LARGE_HEADER_COMMON u8 flags;
u32 address;
u32 address_length;
};
@@ -205,7 +205,7 @@ struct aml_resource_extended_address64 {
u64 maximum;
u64 translation_offset;
u64 address_length;
- u64 type_specific_attributes;
+ u64 type_specific;
};
#define AML_RESOURCE_EXTENDED_ADDRESS_REVISION 1 /* ACPI 3.0 */
@@ -239,8 +239,8 @@ struct aml_resource_address16 {
struct aml_resource_extended_irq {
AML_RESOURCE_LARGE_HEADER_COMMON u8 flags;
- u8 table_length;
- u32 interrupt_number[1];
+ u8 interrupt_count;
+ u32 interrupts[1];
/* res_source_index, res_source optional fields follow */
};
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index 08539125696..53aa997f05f 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -206,6 +206,8 @@
*
*****************************************************************************/
+#define ACPI_IS_ASCII(c) ((c) < 0x80)
+
#ifdef ACPI_USE_SYSTEM_CLIBRARY
/*
* Use the standard C library headers.
@@ -235,7 +237,7 @@
#define ACPI_STRCAT(d,s) (void) strcat((d), (s))
#define ACPI_STRNCAT(d,s,n) strncat((d), (s), (acpi_size)(n))
#define ACPI_STRTOUL(d,s,n) strtoul((d), (s), (acpi_size)(n))
-#define ACPI_MEMCMP(s1,s2,n) memcmp((s1), (s2), (acpi_size)(n))
+#define ACPI_MEMCMP(s1,s2,n) memcmp((const char *)(s1), (const char *)(s2), (acpi_size)(n))
#define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (acpi_size)(n))
#define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (acpi_size)(n))
@@ -247,7 +249,6 @@
#define ACPI_IS_UPPER(i) isupper((int) (i))
#define ACPI_IS_PRINT(i) isprint((int) (i))
#define ACPI_IS_ALPHA(i) isalpha((int) (i))
-#define ACPI_IS_ASCII(i) isascii((int) (i))
#else
@@ -274,8 +275,8 @@ typedef char *va_list;
/*
* Storage alignment properties
*/
-#define _AUPBND (sizeof (acpi_native_int) - 1)
-#define _ADNBND (sizeof (acpi_native_int) - 1)
+#define _AUPBND (sizeof (acpi_native_uint) - 1)
+#define _ADNBND (sizeof (acpi_native_uint) - 1)
/*
* Variable argument list macro definitions
@@ -297,7 +298,7 @@ typedef char *va_list;
#define ACPI_STRCAT(d,s) (void) acpi_ut_strcat ((d), (s))
#define ACPI_STRNCAT(d,s,n) acpi_ut_strncat ((d), (s), (acpi_size)(n))
#define ACPI_STRTOUL(d,s,n) acpi_ut_strtoul ((d), (s), (acpi_size)(n))
-#define ACPI_MEMCMP(s1,s2,n) acpi_ut_memcmp((s1), (s2), (acpi_size)(n))
+#define ACPI_MEMCMP(s1,s2,n) acpi_ut_memcmp((const char *)(s1), (const char *)(s2), (acpi_size)(n))
#define ACPI_MEMCPY(d,s,n) (void) acpi_ut_memcpy ((d), (s), (acpi_size)(n))
#define ACPI_MEMSET(d,v,n) (void) acpi_ut_memset ((d), (v), (acpi_size)(n))
#define ACPI_TOUPPER acpi_ut_to_upper