summaryrefslogtreecommitdiffstats
path: root/drivers/acpi
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 /drivers/acpi
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>
Diffstat (limited to 'drivers/acpi')
-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
21 files changed, 1945 insertions, 2653 deletions
diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c
index f51c3b16c608..bdd86537738e 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 b312eb33c43e..7ca10c5f2914 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 43b33d19cdf9..57d73299298e 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 a3f4d72bedc9..1899ab251393 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 9a2f5bea3afe..1897379b5f90 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 e3cd0b16031a..4ece850b2af1 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 6f48ebf3304e..4ac942badbc0 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);
-}