Commit 0897831b authored by Bob Moore's avatar Bob Moore Committed by Len Brown

[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: default avatarBob Moore <robert.moore@intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 50eca3eb
......@@ -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);
......
......@@ -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;
......
......@@ -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");
......
......@@ -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");
......
......@@ -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) {
......
......@@ -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.
......
......@@ -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);
}
......
This diff is collapsed.
......@@ -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 +=
total_size = (acpi_rs_length)
(total_size +
acpi_rs_struct_option_length(&resource->data.
address16.
resource_source);
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 +=
total_size = (acpi_rs_length)
(total_size +
acpi_rs_struct_option_length(&resource->data.
address32.
resource_source);
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 +=
total_size = (acpi_rs_length)
(total_size +
acpi_rs_struct_option_length(&resource->data.
address64.
resource_source);
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);
total_size = (acpi_rs_length)
(total_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);
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 */
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -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
status = acpi_rs_convert_resource_to_aml(resource,
ACPI_CAST_PTR(union
aml_resource,
aml_buffer));
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);
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -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); \
......
......@@ -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,
......
......@@ -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",
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -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,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment