Commit 96db255c authored by Bob Moore's avatar Bob Moore Committed by Len Brown

[ACPI] ACPICA 20051102

Modified the subsystem initialization sequence to improve
GPE support. The GPE initialization has been split into
two parts in order to defer execution of the _PRW methods
(Power Resources for Wake) until after the hardware is
fully initialized and the SCI handler is installed. This
allows the _PRW methods to access fields protected by the
Global Lock. This will fix systems where a NO_GLOBAL_LOCK
exception has been seen during initialization.

Fixed a regression with the ConcatenateResTemplate()
ASL operator introduced in the 20051021 release.

Implemented support for "local" internal ACPI object
types within the debugger "Object" command and the
acpi_walk_namespace() external interfaces. These local
types include RegionFields, BankFields, IndexFields, Alias,
and reference objects.

Moved common AML resource handling code into a new file,
"utresrc.c". This code is shared by both the Resource
Manager and the AML Debugger.
Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 0897831b
...@@ -98,6 +98,48 @@ acpi_status acpi_ev_initialize_events(void) ...@@ -98,6 +98,48 @@ acpi_status acpi_ev_initialize_events(void)
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
/*******************************************************************************
*
* FUNCTION: acpi_ev_install_fadt_gpes
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Completes initialization of the FADT-defined GPE blocks
* (0 and 1). This causes the _PRW methods to be run, so the HW
* must be fully initialized at this point, including global lock
* support.
*
******************************************************************************/
acpi_status acpi_ev_install_fadt_gpes(void)
{
acpi_status status;
ACPI_FUNCTION_TRACE("ev_install_fadt_gpes");
/* Namespace must be locked */
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(status)) {
return (status);
}
/* FADT GPE Block 0 */
(void)acpi_ev_initialize_gpe_block(acpi_gbl_fadt_gpe_device,
acpi_gbl_gpe_fadt_blocks[0]);
/* FADT GPE Block 1 */
(void)acpi_ev_initialize_gpe_block(acpi_gbl_fadt_gpe_device,
acpi_gbl_gpe_fadt_blocks[1]);
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
return_ACPI_STATUS(AE_OK);
}
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ev_install_xrupt_handlers * FUNCTION: acpi_ev_install_xrupt_handlers
......
...@@ -319,8 +319,8 @@ acpi_ev_save_method_info(acpi_handle obj_handle, ...@@ -319,8 +319,8 @@ acpi_ev_save_method_info(acpi_handle obj_handle,
gpe_event_info = gpe_event_info =
&gpe_block->event_info[gpe_number - gpe_block->block_base_number]; &gpe_block->event_info[gpe_number - gpe_block->block_base_number];
gpe_event_info->flags = (u8) (type | ACPI_GPE_DISPATCH_METHOD | gpe_event_info->flags = (u8)
ACPI_GPE_TYPE_RUNTIME); (type | ACPI_GPE_DISPATCH_METHOD | ACPI_GPE_TYPE_RUNTIME);
gpe_event_info->dispatch.method_node = gpe_event_info->dispatch.method_node =
(struct acpi_namespace_node *)obj_handle; (struct acpi_namespace_node *)obj_handle;
...@@ -443,6 +443,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, ...@@ -443,6 +443,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
gpe_event_info->flags &= gpe_event_info->flags &=
~(ACPI_GPE_WAKE_ENABLED | ACPI_GPE_RUN_ENABLED); ~(ACPI_GPE_WAKE_ENABLED | ACPI_GPE_RUN_ENABLED);
status = status =
acpi_ev_set_gpe_type(gpe_event_info, ACPI_GPE_TYPE_WAKE); acpi_ev_set_gpe_type(gpe_event_info, ACPI_GPE_TYPE_WAKE);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
...@@ -566,7 +567,8 @@ acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt) ...@@ -566,7 +567,8 @@ acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt)
/* Disable this interrupt */ /* Disable this interrupt */
status = acpi_os_remove_interrupt_handler(gpe_xrupt->interrupt_number, status =
acpi_os_remove_interrupt_handler(gpe_xrupt->interrupt_number,
acpi_ev_gpe_xrupt_handler); acpi_ev_gpe_xrupt_handler);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
...@@ -771,7 +773,7 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) ...@@ -771,7 +773,7 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
/* /*
* Initialize the GPE Register and Event structures. A goal of these * Initialize the GPE Register and Event structures. A goal of these
* tables is to hide the fact that there are two separate GPE register sets * tables is to hide the fact that there are two separate GPE register sets
* in a given gpe hardware block, the status registers occupy the first half, * in a given GPE hardware block, the status registers occupy the first half,
* and the enable registers occupy the second half. * and the enable registers occupy the second half.
*/ */
this_register = gpe_register_info; this_register = gpe_register_info;
...@@ -812,11 +814,8 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) ...@@ -812,11 +814,8 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
this_event++; this_event++;
} }
/* /* Disable all GPEs within this register */
* Clear the status/enable registers. Note that status registers
* are cleared by writing a '1', while enable registers are cleared
* by writing a '0'.
*/
status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0x00, status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0x00,
&this_register-> &this_register->
enable_address); enable_address);
...@@ -824,6 +823,8 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) ...@@ -824,6 +823,8 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
goto error_exit; goto error_exit;
} }
/* Clear any pending GPE events within this register */
status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0xFF, status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0xFF,
&this_register-> &this_register->
status_address); status_address);
...@@ -860,7 +861,9 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) ...@@ -860,7 +861,9 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Create and Install a block of GPE registers * DESCRIPTION: Create and Install a block of GPE registers. All GPEs within
* the block are disabled at exit.
* Note: Assumes namespace is locked.
* *
******************************************************************************/ ******************************************************************************/
...@@ -872,14 +875,8 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, ...@@ -872,14 +875,8 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
u32 interrupt_number, u32 interrupt_number,
struct acpi_gpe_block_info **return_gpe_block) struct acpi_gpe_block_info **return_gpe_block)
{ {
struct acpi_gpe_block_info *gpe_block;
struct acpi_gpe_event_info *gpe_event_info;
acpi_native_uint i;
acpi_native_uint j;
u32 wake_gpe_count;
u32 gpe_enabled_count;
acpi_status status; acpi_status status;
struct acpi_gpe_walk_info gpe_info; struct acpi_gpe_block_info *gpe_block;
ACPI_FUNCTION_TRACE("ev_create_gpe_block"); ACPI_FUNCTION_TRACE("ev_create_gpe_block");
...@@ -896,22 +893,24 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, ...@@ -896,22 +893,24 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
/* Initialize the new GPE block */ /* Initialize the new GPE block */
gpe_block->node = gpe_device;
gpe_block->register_count = register_count; gpe_block->register_count = register_count;
gpe_block->block_base_number = gpe_block_base_number; gpe_block->block_base_number = gpe_block_base_number;
gpe_block->node = gpe_device;
ACPI_MEMCPY(&gpe_block->block_address, gpe_block_address, ACPI_MEMCPY(&gpe_block->block_address, gpe_block_address,
sizeof(struct acpi_generic_address)); sizeof(struct acpi_generic_address));
/* Create the register_info and event_info sub-structures */ /*
* Create the register_info and event_info sub-structures
* Note: disables and clears all GPEs in the block
*/
status = acpi_ev_create_gpe_info_blocks(gpe_block); status = acpi_ev_create_gpe_info_blocks(gpe_block);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_MEM_FREE(gpe_block); ACPI_MEM_FREE(gpe_block);
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
/* Install the new block in the global list(s) */ /* Install the new block in the global lists */
status = acpi_ev_install_gpe_block(gpe_block, interrupt_number); status = acpi_ev_install_gpe_block(gpe_block, interrupt_number);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
...@@ -926,16 +925,70 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, ...@@ -926,16 +925,70 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
acpi_ev_save_method_info, gpe_block, acpi_ev_save_method_info, gpe_block,
NULL); NULL);
/* Return the new block */
if (return_gpe_block) {
(*return_gpe_block) = gpe_block;
}
ACPI_DEBUG_PRINT((ACPI_DB_INIT,
"GPE %02X to %02X [%4.4s] %u regs on int 0x%X\n",
(u32) gpe_block->block_base_number,
(u32) (gpe_block->block_base_number +
((gpe_block->register_count *
ACPI_GPE_REGISTER_WIDTH) - 1)),
gpe_device->name.ascii, gpe_block->register_count,
interrupt_number));
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_initialize_gpe_block
*
* PARAMETERS: gpe_device - Handle to the parent GPE block
* gpe_block - Gpe Block info
*
* RETURN: Status
*
* DESCRIPTION: Initialize and enable a GPE block. First find and run any
* _PRT methods associated with the block, then enable the
* appropriate GPEs.
* Note: Assumes namespace is locked.
*
******************************************************************************/
acpi_status
acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
struct acpi_gpe_block_info *gpe_block)
{
acpi_status status;
struct acpi_gpe_event_info *gpe_event_info;
struct acpi_gpe_walk_info gpe_info;
u32 wake_gpe_count;
u32 gpe_enabled_count;
acpi_native_uint i;
acpi_native_uint j;
ACPI_FUNCTION_TRACE("ev_initialize_gpe_block");
/* Ignore a null GPE block (e.g., if no GPE block 1 exists) */
if (!gpe_block) {
return_ACPI_STATUS(AE_OK);
}
/* /*
* Runtime option: Should Wake GPEs be enabled at runtime? The default * Runtime option: Should wake GPEs be enabled at runtime? The default
* is No, they should only be enabled just as the machine goes to sleep. * is no, they should only be enabled just as the machine goes to sleep.
*/ */
if (acpi_gbl_leave_wake_gpes_disabled) { if (acpi_gbl_leave_wake_gpes_disabled) {
/* /*
* Differentiate RUNTIME vs WAKE GPEs, via the _PRW control methods. * Differentiate runtime vs wake GPEs, via the _PRW control methods.
* (Each GPE that has one or more _PRWs that reference it is by * Each GPE that has one or more _PRWs that reference it is by
* definition a WAKE GPE and will not be enabled while the machine * definition a wake GPE and will not be enabled while the machine
* is running.) * is running.
*/ */
gpe_info.gpe_block = gpe_block; gpe_info.gpe_block = gpe_block;
gpe_info.gpe_device = gpe_device; gpe_info.gpe_device = gpe_device;
...@@ -948,9 +1001,12 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, ...@@ -948,9 +1001,12 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
} }
/* /*
* Enable all GPEs in this block that are 1) "runtime" or "run/wake" GPEs, * Enable all GPEs in this block that have these attributes:
* and 2) have a corresponding _Lxx or _Exx method. All other GPEs must * 1) are "runtime" or "run/wake" GPEs, and
* be enabled via the acpi_enable_gpe() external interface. * 2) have a corresponding _Lxx or _Exx method
*
* Any other GPEs within this block must be enabled via the acpi_enable_gpe()
* external interface.
*/ */
wake_gpe_count = 0; wake_gpe_count = 0;
gpe_enabled_count = 0; gpe_enabled_count = 0;
...@@ -976,32 +1032,19 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, ...@@ -976,32 +1032,19 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
} }
} }
/* Dump info about this GPE block */
ACPI_DEBUG_PRINT((ACPI_DB_INIT,
"GPE %02X to %02X [%4.4s] %u regs on int 0x%X\n",
(u32) gpe_block->block_base_number,
(u32) (gpe_block->block_base_number +
((gpe_block->register_count *
ACPI_GPE_REGISTER_WIDTH) - 1)),
gpe_device->name.ascii, gpe_block->register_count,
interrupt_number));
/* Enable all valid GPEs found above */
status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block);
ACPI_DEBUG_PRINT((ACPI_DB_INIT, ACPI_DEBUG_PRINT((ACPI_DB_INIT,
"Found %u Wake, Enabled %u Runtime GPEs in this block\n", "Found %u Wake, Enabled %u Runtime GPEs in this block\n",
wake_gpe_count, gpe_enabled_count)); wake_gpe_count, gpe_enabled_count));
/* Return the new block */ /* Enable all valid runtime GPEs found above */
if (return_gpe_block) { status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block);
(*return_gpe_block) = gpe_block; if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("Could not enable GPEs in gpe_block %p\n",
gpe_block));
} }
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(status);
} }
/******************************************************************************* /*******************************************************************************
......
...@@ -626,6 +626,13 @@ acpi_install_gpe_block(acpi_handle gpe_device, ...@@ -626,6 +626,13 @@ acpi_install_gpe_block(acpi_handle gpe_device,
goto unlock_and_exit; goto unlock_and_exit;
} }
/* Run the _PRW methods and enable the GPEs */
status = acpi_ev_initialize_gpe_block(node, gpe_block);
if (ACPI_FAILURE(status)) {
goto unlock_and_exit;
}
/* Get the device_object attached to the node */ /* Get the device_object attached to the node */
obj_desc = acpi_ns_get_attached_object(node); obj_desc = acpi_ns_get_attached_object(node);
......
This diff is collapsed.
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include <acpi/acpi.h> #include <acpi/acpi.h>
#include <acpi/acinterp.h> #include <acpi/acinterp.h>
#include <acpi/amlcode.h> #include <acpi/amlcode.h>
#include <acpi/amlresrc.h>
#define _COMPONENT ACPI_EXECUTER #define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME("exmisc") ACPI_MODULE_NAME("exmisc")
...@@ -157,40 +158,52 @@ acpi_ex_concat_template(union acpi_operand_object *operand0, ...@@ -157,40 +158,52 @@ acpi_ex_concat_template(union acpi_operand_object *operand0,
union acpi_operand_object **actual_return_desc, union acpi_operand_object **actual_return_desc,
struct acpi_walk_state *walk_state) struct acpi_walk_state *walk_state)
{ {
acpi_status status;
union acpi_operand_object *return_desc; union acpi_operand_object *return_desc;
u8 *new_buf; u8 *new_buf;
u8 *end_tag1; u8 *end_tag;
u8 *end_tag2; acpi_size length0;
acpi_size length1; acpi_size length1;
acpi_size length2;
ACPI_FUNCTION_TRACE("ex_concat_template"); ACPI_FUNCTION_TRACE("ex_concat_template");
/* Find the end_tags in each resource template */ /*
* Find the end_tag descriptor in each resource template.
* Note: returned pointers point TO the end_tag, not past it.
*
* Compute the length of each resource template
*/
status = acpi_ut_get_resource_end_tag(operand0, &end_tag);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
length0 = ACPI_PTR_DIFF(end_tag, operand0->buffer.pointer);
end_tag1 = acpi_ut_get_resource_end_tag(operand0); status = acpi_ut_get_resource_end_tag(operand1, &end_tag);
end_tag2 = acpi_ut_get_resource_end_tag(operand1); if (ACPI_FAILURE(status)) {
if (!end_tag1 || !end_tag2) { return_ACPI_STATUS(status);
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
} }
/* Compute the length of each part */ /* Include the end_tag in the second template length */
length1 = ACPI_PTR_DIFF(end_tag1, operand0->buffer.pointer); length1 = ACPI_PTR_DIFF(end_tag, operand1->buffer.pointer) +
length2 = ACPI_PTR_DIFF(end_tag2, operand1->buffer.pointer) + 2; /* Size of END_TAG */ sizeof(struct aml_resource_end_tag);
/* Create a new buffer object for the result */ /* Create a new buffer object for the result */
return_desc = acpi_ut_create_buffer_object(length1 + length2); return_desc = acpi_ut_create_buffer_object(length0 + length1);
if (!return_desc) { if (!return_desc) {
return_ACPI_STATUS(AE_NO_MEMORY); return_ACPI_STATUS(AE_NO_MEMORY);
} }
/* Copy the templates to the new descriptor */ /*
* Copy the templates to the new buffer, 0 first, then 1 follows. One
* end_tag descriptor is copied from Operand1.
*/
new_buf = return_desc->buffer.pointer; new_buf = return_desc->buffer.pointer;
ACPI_MEMCPY(new_buf, operand0->buffer.pointer, length1); ACPI_MEMCPY(new_buf, operand0->buffer.pointer, length0);
ACPI_MEMCPY(new_buf + length1, operand1->buffer.pointer, length2); ACPI_MEMCPY(new_buf + length0, operand1->buffer.pointer, length1);
/* Compute the new checksum */ /* Compute the new checksum */
...@@ -198,7 +211,7 @@ acpi_ex_concat_template(union acpi_operand_object *operand0, ...@@ -198,7 +211,7 @@ acpi_ex_concat_template(union acpi_operand_object *operand0,
acpi_ut_generate_checksum(return_desc->buffer.pointer, acpi_ut_generate_checksum(return_desc->buffer.pointer,
(return_desc->buffer.length - 1)); (return_desc->buffer.length - 1));
/* Return the completed template descriptor */ /* Return the completed resource template */
*actual_return_desc = return_desc; *actual_return_desc = return_desc;
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
......
...@@ -399,7 +399,7 @@ acpi_walk_namespace(acpi_object_type type, ...@@ -399,7 +399,7 @@ acpi_walk_namespace(acpi_object_type type,
/* Parameter validation */ /* Parameter validation */
if ((type > ACPI_TYPE_EXTERNAL_MAX) || (!max_depth) || (!user_function)) { if ((type > ACPI_TYPE_LOCAL_MAX) || (!max_depth) || (!user_function)) {
return_ACPI_STATUS(AE_BAD_PARAMETER); return_ACPI_STATUS(AE_BAD_PARAMETER);
} }
......
...@@ -299,13 +299,14 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) ...@@ -299,13 +299,14 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed)
/* Point to the next object */ /* Point to the next object */
resource = ACPI_PTR_ADD(struct acpi_resource, resource =
resource, resource->length); ACPI_PTR_ADD(struct acpi_resource, resource,
resource->length);
} }
/* Did not find an END_TAG descriptor */ /* Did not find an end_tag resource descriptor */
return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
} }
/******************************************************************************* /*******************************************************************************
...@@ -328,105 +329,89 @@ acpi_status ...@@ -328,105 +329,89 @@ acpi_status
acpi_rs_get_list_length(u8 * aml_buffer, acpi_rs_get_list_length(u8 * aml_buffer,
u32 aml_buffer_length, acpi_size * size_needed) u32 aml_buffer_length, acpi_size * size_needed)
{ {
acpi_status status;
u8 *end_aml;
u8 *buffer; u8 *buffer;
struct acpi_resource_info *resource_info;
u32 buffer_size = 0; u32 buffer_size = 0;
u32 bytes_parsed = 0;
u8 resource_type;
u16 temp16; u16 temp16;
u16 resource_length; u16 resource_length;
u16 header_length;
u32 extra_struct_bytes; u32 extra_struct_bytes;
u8 resource_index;
u8 minimum_aml_resource_length;
ACPI_FUNCTION_TRACE("rs_get_list_length"); ACPI_FUNCTION_TRACE("rs_get_list_length");
while (bytes_parsed < aml_buffer_length) { end_aml = aml_buffer + aml_buffer_length;
/* The next byte in the stream is the resource descriptor type */
resource_type = acpi_ut_get_resource_type(aml_buffer); /* Walk the list of AML resource descriptors */
/* Get the base stream size and structure sizes for the descriptor */ while (aml_buffer < end_aml) {
/* Validate the Resource Type and Resource Length */
resource_info = acpi_rs_get_resource_info(resource_type); status = acpi_ut_validate_resource(aml_buffer, &resource_index);
if (!resource_info) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); return_ACPI_STATUS(status);
} }
/* Get the Length field from the input resource descriptor */ /* Get the resource length and base (minimum) AML size */
resource_length = acpi_ut_get_resource_length(aml_buffer); resource_length = acpi_ut_get_resource_length(aml_buffer);
minimum_aml_resource_length =
acpi_gbl_resource_aml_sizes[resource_index];
/* Augment the size for descriptors with optional fields */
extra_struct_bytes = 0;
if (!(resource_type & ACPI_RESOURCE_NAME_LARGE)) {
/* /*
* Small resource descriptors * Augment the size for descriptors with optional
* and/or variable length fields
*/ */
header_length = extra_struct_bytes = 0;
sizeof(struct aml_resource_small_header); buffer =
buffer = aml_buffer + header_length; aml_buffer + acpi_ut_get_resource_header_length(aml_buffer);
switch (resource_type) { switch (acpi_ut_get_resource_type(aml_buffer)) {
case ACPI_RESOURCE_NAME_IRQ: case ACPI_RESOURCE_NAME_IRQ:
/* /*
* IRQ Resource: * IRQ Resource:
* Get the number of bits set in the IRQ word * Get the number of bits set in the 16-bit IRQ mask
*/ */
ACPI_MOVE_16_TO_16(&temp16, buffer); ACPI_MOVE_16_TO_16(&temp16, buffer);
extra_struct_bytes = extra_struct_bytes =
(acpi_rs_count_set_bits(temp16) * acpi_rs_count_set_bits(temp16) * sizeof(u32);
sizeof(u32));
break; break;
case ACPI_RESOURCE_NAME_DMA: case ACPI_RESOURCE_NAME_DMA:
/* /*
* DMA Resource: * DMA Resource:
* Get the number of bits set in the DMA channels byte * Get the number of bits set in the 8-bit DMA mask
*/ */
ACPI_MOVE_16_TO_16(&temp16, buffer);
extra_struct_bytes = extra_struct_bytes =
(acpi_rs_count_set_bits(temp16) * acpi_rs_count_set_bits(*buffer) * sizeof(u32);
sizeof(u32));
break; break;
case ACPI_RESOURCE_NAME_VENDOR_SMALL: case ACPI_RESOURCE_NAME_VENDOR_SMALL:
/* /*
* Vendor Specific Resource: * Vendor Resource:
* Ensure a 32-bit boundary for the structure * Ensure a 32-bit boundary for the structure
*/ */
extra_struct_bytes = extra_struct_bytes =
ACPI_ROUND_UP_to_32_bITS(resource_length); ACPI_ROUND_UP_to_32_bITS(resource_length) -
resource_length;
break; break;
case ACPI_RESOURCE_NAME_END_TAG: case ACPI_RESOURCE_NAME_END_TAG:
/* /*
* End Tag: * End Tag: This is the normal exit
* Terminate the loop now
*/ */
aml_buffer_length = bytes_parsed; *size_needed = buffer_size;
break; return_ACPI_STATUS(AE_OK);
default:
break;
}
} else {
/*
* Large resource descriptors
*/
header_length =
sizeof(struct aml_resource_large_header);
buffer = aml_buffer + header_length;
switch (resource_type) {
case ACPI_RESOURCE_NAME_VENDOR_LARGE: case ACPI_RESOURCE_NAME_VENDOR_LARGE:
/* /*
* Vendor Defined Resource: * Vendor Resource:
* Add vendor data and ensure a 32-bit boundary for the structure * Add vendor data and ensure a 32-bit boundary for the structure
*/ */
extra_struct_bytes = extra_struct_bytes =
ACPI_ROUND_UP_to_32_bITS(resource_length); ACPI_ROUND_UP_to_32_bITS(resource_length) -
resource_length;
break; break;
case ACPI_RESOURCE_NAME_ADDRESS32: case ACPI_RESOURCE_NAME_ADDRESS32:
...@@ -436,9 +421,7 @@ acpi_rs_get_list_length(u8 * aml_buffer, ...@@ -436,9 +421,7 @@ acpi_rs_get_list_length(u8 * aml_buffer,
* Add the size of any optional data (resource_source) * Add the size of any optional data (resource_source)
*/ */
extra_struct_bytes = extra_struct_bytes =
acpi_rs_stream_option_length acpi_rs_stream_option_length(resource_length,
(resource_length,
resource_info->
minimum_aml_resource_length); minimum_aml_resource_length);
break; break;
...@@ -450,21 +433,16 @@ acpi_rs_get_list_length(u8 * aml_buffer, ...@@ -450,21 +433,16 @@ acpi_rs_get_list_length(u8 * aml_buffer,
*/ */
buffer++; buffer++;
extra_struct_bytes =
/* /*
* Add 4 bytes for each additional interrupt. Note: at least one * Add 4 bytes for each additional interrupt. Note: at
* interrupt is required and is included in the minimum * least one interrupt is required and is included in
* descriptor size * the minimum descriptor size
*/ */
extra_struct_bytes = ((*buffer - 1) * sizeof(u32)) +
((*buffer - 1) * sizeof(u32));
/* Add the size of any optional data (resource_source) */ /* Add the size of any optional data (resource_source) */
acpi_rs_stream_option_length(resource_length -
extra_struct_bytes +=
acpi_rs_stream_option_length(resource_length
-
extra_struct_bytes, extra_struct_bytes,
resource_info->
minimum_aml_resource_length); minimum_aml_resource_length);
break; break;
...@@ -477,36 +455,29 @@ acpi_rs_get_list_length(u8 * aml_buffer, ...@@ -477,36 +455,29 @@ acpi_rs_get_list_length(u8 * aml_buffer,
extra_struct_bytes = extra_struct_bytes =
ACPI_ROUND_UP_to_64_bITS ACPI_ROUND_UP_to_64_bITS
(acpi_rs_stream_option_length (acpi_rs_stream_option_length
(resource_length, (resource_length, minimum_aml_resource_length));
resource_info->
minimum_aml_resource_length));
break; break;
default: default:
break; break;
} }
}
/* Update the required buffer size for the internal descriptor structs */ /* Update the required buffer size for the internal descriptor structs */
temp16 = temp16 = (u16) (acpi_gbl_resource_struct_sizes[resource_index] +
(u16) (resource_info->minimum_internal_struct_length +
extra_struct_bytes); extra_struct_bytes);
buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE(temp16); buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE(temp16);
/* /*
* Update byte count and point to the next resource within the stream * Point to the next resource within the stream
* using the size of the header plus the length contained in the header * using the size of the header plus the length contained in the header
*/ */
temp16 = (u16) (header_length + resource_length); aml_buffer += acpi_ut_get_descriptor_length(aml_buffer);
bytes_parsed += temp16;
aml_buffer += temp16;
} }
/* This is the data the caller needs */ /* Did not find an end_tag resource descriptor */
*size_needed = buffer_size; return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
return_ACPI_STATUS(AE_OK);
} }
/******************************************************************************* /*******************************************************************************
......
...@@ -324,7 +324,7 @@ static struct acpi_rsdump_info acpi_rs_dump_general_flags[5] = { ...@@ -324,7 +324,7 @@ static struct acpi_rsdump_info acpi_rs_dump_general_flags[5] = {
static struct acpi_rsdump_info acpi_rs_dump_memory_flags[5] = { static struct acpi_rsdump_info acpi_rs_dump_memory_flags[5] = {
{ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory_flags), {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory_flags),
"Resource Type", "Memory Range"}, "Resource Type", (void *)"Memory Range"},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.write_protect), {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.write_protect),
"Write Protect", acpi_gbl_RWdecode}, "Write Protect", acpi_gbl_RWdecode},
{ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.caching), {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.caching),
...@@ -337,7 +337,7 @@ static struct acpi_rsdump_info acpi_rs_dump_memory_flags[5] = { ...@@ -337,7 +337,7 @@ static struct acpi_rsdump_info acpi_rs_dump_memory_flags[5] = {
static struct acpi_rsdump_info acpi_rs_dump_io_flags[4] = { static struct acpi_rsdump_info acpi_rs_dump_io_flags[4] = {
{ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io_flags), {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io_flags),
"Resource Type", "I/O Range"}, "Resource Type", (void *)"I/O Range"},
{ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.io.range_type), {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.io.range_type),
"Range Type", acpi_gbl_RNGdecode}, "Range Type", acpi_gbl_RNGdecode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation), {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation),
...@@ -372,8 +372,8 @@ static struct acpi_rsdump_info acpi_rs_dump_prt[5] = { ...@@ -372,8 +372,8 @@ static struct acpi_rsdump_info acpi_rs_dump_prt[5] = {
static void static void
acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table) acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
{ {
void *target = NULL; u8 *target = NULL;
void *previous_target; u8 *previous_target;
char *name; char *name;
u8 count; u8 count;
...@@ -399,43 +399,49 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table) ...@@ -399,43 +399,49 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
/* Strings */ /* Strings */
case ACPI_RSD_LITERAL: case ACPI_RSD_LITERAL:
acpi_rs_out_string(name, (char *)table->pointer); acpi_rs_out_string(name,
ACPI_CAST_PTR(char, table->pointer));
break; break;
case ACPI_RSD_STRING: case ACPI_RSD_STRING:
acpi_rs_out_string(name, (char *)target); acpi_rs_out_string(name, ACPI_CAST_PTR(char, target));
break; break;
/* Data items, 8/16/32/64 bit */ /* Data items, 8/16/32/64 bit */
case ACPI_RSD_UINT8: case ACPI_RSD_UINT8:
acpi_rs_out_integer8(name, *(u8 *) target); acpi_rs_out_integer8(name, *ACPI_CAST_PTR(u8, target));
break; break;
case ACPI_RSD_UINT16: case ACPI_RSD_UINT16:
acpi_rs_out_integer16(name, *(u16 *) target); acpi_rs_out_integer16(name,
*ACPI_CAST_PTR(u16, target));
break; break;
case ACPI_RSD_UINT32: case ACPI_RSD_UINT32:
acpi_rs_out_integer32(name, *(u32 *) target); acpi_rs_out_integer32(name,
*ACPI_CAST_PTR(u32, target));
break; break;
case ACPI_RSD_UINT64: case ACPI_RSD_UINT64:
acpi_rs_out_integer64(name, *(u64 *) target); acpi_rs_out_integer64(name,
*ACPI_CAST_PTR(u64, target));
break; break;
/* Flags: 1-bit and 2-bit flags supported */ /* Flags: 1-bit and 2-bit flags supported */
case ACPI_RSD_1BITFLAG: case ACPI_RSD_1BITFLAG:
acpi_rs_out_string(name, (char *) acpi_rs_out_string(name, ACPI_CAST_PTR(char,
((const char **)table-> table->
pointer)[(*(u8 *) target) & 0x01]); pointer[*target &
0x01]));
break; break;
case ACPI_RSD_2BITFLAG: case ACPI_RSD_2BITFLAG:
acpi_rs_out_string(name, (char *) acpi_rs_out_string(name, ACPI_CAST_PTR(char,
((const char **)table-> table->
pointer)[(*(u8 *) target) & 0x03]); pointer[*target &
0x03]));
break; break;
case ACPI_RSD_SHORTLIST: case ACPI_RSD_SHORTLIST:
...@@ -445,10 +451,8 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table) ...@@ -445,10 +451,8 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
*/ */
if (previous_target) { if (previous_target) {
acpi_rs_out_title(name); acpi_rs_out_title(name);
acpi_rs_dump_short_byte_list(* acpi_rs_dump_short_byte_list(*previous_target,
((u8 *) target);
previous_target),
(u8 *) target);
} }
break; break;
...@@ -458,10 +462,9 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table) ...@@ -458,10 +462,9 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
* Note: The list length is obtained from the previous table entry * Note: The list length is obtained from the previous table entry
*/ */
if (previous_target) { if (previous_target) {
acpi_rs_dump_byte_list(* acpi_rs_dump_byte_list(*ACPI_CAST_PTR
((u16 *) (u16, previous_target),
previous_target), target);
(u8 *) target);
} }
break; break;
...@@ -471,10 +474,9 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table) ...@@ -471,10 +474,9 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
* Note: The list length is obtained from the previous table entry * Note: The list length is obtained from the previous table entry
*/ */
if (previous_target) { if (previous_target) {
acpi_rs_dump_dword_list(* acpi_rs_dump_dword_list(*previous_target,
((u8 *) ACPI_CAST_PTR(u32,
previous_target), target));
(u32 *) target);
} }
break; break;
...@@ -482,17 +484,19 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table) ...@@ -482,17 +484,19 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
/* /*
* Common flags for all Address resources * Common flags for all Address resources
*/ */
acpi_rs_dump_address_common((union acpi_resource_data *) acpi_rs_dump_address_common(ACPI_CAST_PTR
target); (union acpi_resource_data,
target));
break; break;
case ACPI_RSD_SOURCE: case ACPI_RSD_SOURCE:
/* /*
* Optional resource_source for Address resources * Optional resource_source for Address resources
*/ */
acpi_rs_dump_resource_source((struct acpi_rs_dump_resource_source(ACPI_CAST_PTR
acpi_resource_source *) (struct
target); acpi_resource_source,
target));
break; break;
default: default:
......
...@@ -80,7 +80,9 @@ struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[] = { ...@@ -80,7 +80,9 @@ struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[] = {
/* Dispatch tables for AML-to-resource (Get Resource) conversion functions */ /* Dispatch tables for AML-to-resource (Get Resource) conversion functions */
struct acpi_rsconvert_info *acpi_gbl_sm_get_resource_dispatch[] = { struct acpi_rsconvert_info *acpi_gbl_get_resource_dispatch[] = {
/* Small descriptors */
NULL, /* 0x00, Reserved */ NULL, /* 0x00, Reserved */
NULL, /* 0x01, Reserved */ NULL, /* 0x01, Reserved */
NULL, /* 0x02, Reserved */ NULL, /* 0x02, Reserved */
...@@ -96,10 +98,10 @@ struct acpi_rsconvert_info *acpi_gbl_sm_get_resource_dispatch[] = { ...@@ -96,10 +98,10 @@ struct acpi_rsconvert_info *acpi_gbl_sm_get_resource_dispatch[] = {
NULL, /* 0x0C, Reserved */ NULL, /* 0x0C, Reserved */
NULL, /* 0x0D, Reserved */ NULL, /* 0x0D, Reserved */
acpi_rs_get_vendor_small, /* 0x0E, ACPI_RESOURCE_NAME_VENDOR_SMALL */ acpi_rs_get_vendor_small, /* 0x0E, ACPI_RESOURCE_NAME_VENDOR_SMALL */
acpi_rs_convert_end_tag /* 0x0F, ACPI_RESOURCE_NAME_END_TAG */ acpi_rs_convert_end_tag, /* 0x0F, ACPI_RESOURCE_NAME_END_TAG */
};
/* Large descriptors */
struct acpi_rsconvert_info *acpi_gbl_lg_get_resource_dispatch[] = {
NULL, /* 0x00, Reserved */ NULL, /* 0x00, Reserved */
acpi_rs_convert_memory24, /* 0x01, ACPI_RESOURCE_NAME_MEMORY24 */ acpi_rs_convert_memory24, /* 0x01, ACPI_RESOURCE_NAME_MEMORY24 */
acpi_rs_convert_generic_reg, /* 0x02, ACPI_RESOURCE_NAME_GENERIC_REGISTER */ acpi_rs_convert_generic_reg, /* 0x02, ACPI_RESOURCE_NAME_GENERIC_REGISTER */
...@@ -138,7 +140,6 @@ struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[] = { ...@@ -138,7 +140,6 @@ struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[] = {
acpi_rs_dump_ext_irq, /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ 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
#endif /* ACPI_FUTURE_USAGE */ #endif /* ACPI_FUTURE_USAGE */
/* /*
...@@ -166,62 +167,38 @@ const u8 acpi_gbl_aml_resource_sizes[] = { ...@@ -166,62 +167,38 @@ const u8 acpi_gbl_aml_resource_sizes[] = {
sizeof(struct aml_resource_generic_register) /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ sizeof(struct aml_resource_generic_register) /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */
}; };
/* Macros used in the tables below */ const u8 acpi_gbl_resource_struct_sizes[] = {
/* Small descriptors */
#define ACPI_RLARGE(r) (sizeof (r) - sizeof (struct aml_resource_large_header)) 0,
#define ACPI_RSMALL(r) (sizeof (r) - sizeof (struct aml_resource_small_header)) 0,
0,
0,
ACPI_RS_SIZE(struct acpi_resource_irq),
ACPI_RS_SIZE(struct acpi_resource_dma),
ACPI_RS_SIZE(struct acpi_resource_start_dependent),
ACPI_RS_SIZE_MIN,
ACPI_RS_SIZE(struct acpi_resource_io),
ACPI_RS_SIZE(struct acpi_resource_fixed_io),
0,
0,
0,
0,
ACPI_RS_SIZE(struct acpi_resource_vendor),
ACPI_RS_SIZE_MIN,
/* /* Large descriptors */
* Base sizes of resource descriptors, both the AML stream resource length
* (minus size of header and length fields),and the size of the internal
* struct representation.
*/
struct acpi_resource_info acpi_gbl_sm_resource_info[] = {
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{2, ACPI_RSMALL(struct aml_resource_irq),
ACPI_RS_SIZE(struct acpi_resource_irq)},
{0, ACPI_RSMALL(struct aml_resource_dma),
ACPI_RS_SIZE(struct acpi_resource_dma)},
{2, ACPI_RSMALL(struct aml_resource_start_dependent),
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_RS_SIZE(struct acpi_resource_io)},
{0, ACPI_RSMALL(struct aml_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_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_RS_SIZE(struct acpi_resource_memory24),
{0, ACPI_RLARGE(struct aml_resource_memory24), ACPI_RS_SIZE(struct acpi_resource_generic_register),
ACPI_RS_SIZE(struct acpi_resource_memory24)}, 0,
{0, ACPI_RLARGE(struct aml_resource_generic_register), ACPI_RS_SIZE(struct acpi_resource_vendor),
ACPI_RS_SIZE(struct acpi_resource_generic_register)}, ACPI_RS_SIZE(struct acpi_resource_memory32),
{0, 0, 0}, ACPI_RS_SIZE(struct acpi_resource_fixed_memory32),
{1, ACPI_RLARGE(struct aml_resource_vendor_large), ACPI_RS_SIZE(struct acpi_resource_address32),
ACPI_RS_SIZE(struct acpi_resource_vendor)}, ACPI_RS_SIZE(struct acpi_resource_address16),
{0, ACPI_RLARGE(struct aml_resource_memory32), ACPI_RS_SIZE(struct acpi_resource_extended_irq),
ACPI_RS_SIZE(struct acpi_resource_memory32)}, ACPI_RS_SIZE(struct acpi_resource_address64),
{0, ACPI_RLARGE(struct aml_resource_fixed_memory32), ACPI_RS_SIZE(struct acpi_resource_extended_address64)
ACPI_RS_SIZE(struct acpi_resource_fixed_memory32)},
{1, ACPI_RLARGE(struct aml_resource_address32),
ACPI_RS_SIZE(struct acpi_resource_address32)},
{1, ACPI_RLARGE(struct aml_resource_address16),
ACPI_RS_SIZE(struct acpi_resource_address16)},
{1, ACPI_RLARGE(struct aml_resource_extended_irq),
ACPI_RS_SIZE(struct acpi_resource_extended_irq)},
{1, ACPI_RLARGE(struct aml_resource_address64),
ACPI_RS_SIZE(struct acpi_resource_address64)},
{0, ACPI_RLARGE(struct aml_resource_extended_address64),
ACPI_RS_SIZE(struct acpi_resource_extended_address64)}
}; };
...@@ -47,115 +47,12 @@ ...@@ -47,115 +47,12 @@
#define _COMPONENT ACPI_RESOURCES #define _COMPONENT ACPI_RESOURCES
ACPI_MODULE_NAME("rslist") ACPI_MODULE_NAME("rslist")
/* Local prototypes */
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);
/*******************************************************************************
*
* FUNCTION: acpi_rs_validate_resource_length
*
* PARAMETERS: Aml - Pointer to the AML resource descriptor
*
* RETURN: Status - AE_OK if the resource length appears valid
*
* DESCRIPTION: Validate the resource_length. Fixed-length descriptors must
* have the exact length; variable-length descriptors must be
* at least as long as the minimum. Certain Small descriptors
* can vary in size by at most one byte.
*
******************************************************************************/
static acpi_status acpi_rs_validate_resource_length(union aml_resource *aml)
{
struct acpi_resource_info *resource_info;
u16 minimum_aml_resource_length;
u16 resource_length;
ACPI_FUNCTION_ENTRY();
/* Get the size and type info about this resource descriptor */
resource_info =
acpi_rs_get_resource_info(aml->small_header.descriptor_type);
if (!resource_info) {
return (AE_AML_INVALID_RESOURCE_TYPE);
}
resource_length = acpi_ut_get_resource_length(aml);
minimum_aml_resource_length =
resource_info->minimum_aml_resource_length;
/* Validate based upon the type of resource, fixed length or variable */
if (resource_info->length_type == ACPI_FIXED_LENGTH) {
/* Fixed length resource, length must match exactly */
if (resource_length != minimum_aml_resource_length) {
return (AE_AML_BAD_RESOURCE_LENGTH);
}
} else if (resource_info->length_type == ACPI_VARIABLE_LENGTH) {
/* Variable length resource, must be at least the minimum */
if (resource_length < minimum_aml_resource_length) {
return (AE_AML_BAD_RESOURCE_LENGTH);
}
} else {
/* Small variable length resource, allowed to be (Min) or (Min-1) */
if ((resource_length > minimum_aml_resource_length) ||
(resource_length < (minimum_aml_resource_length - 1))) {
return (AE_AML_BAD_RESOURCE_LENGTH);
}
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_rs_get_conversion_info
*
* PARAMETERS: resource_type - Byte 0 of a resource descriptor
*
* RETURN: Pointer to the resource conversion info table
*
* DESCRIPTION: Get the conversion table associated with this resource type
*
******************************************************************************/
static struct acpi_rsconvert_info *acpi_rs_get_conversion_info(u8 resource_type)
{
ACPI_FUNCTION_ENTRY();
/* 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 */
if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) {
return (NULL);
}
return (acpi_gbl_lg_get_resource_dispatch[(resource_type &
ACPI_RESOURCE_NAME_LARGE_MASK)]);
} else {
/* Small Resource Type -- bits 6:3 contain the name */
return (acpi_gbl_sm_get_resource_dispatch[((resource_type &
ACPI_RESOURCE_NAME_SMALL_MASK)
>> 3)]);
}
}
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_rs_convert_aml_to_resources * FUNCTION: acpi_rs_convert_aml_to_resources
* *
* PARAMETERS: aml_buffer - Pointer to the resource byte stream * PARAMETERS: Aml - Pointer to the resource byte stream
* aml_buffer_length - Length of aml_buffer * aml_length - Length of Aml
* output_buffer - Pointer to the buffer that will * output_buffer - Pointer to the buffer that will
* contain the output structures * contain the output structures
* *
...@@ -165,42 +62,24 @@ static struct acpi_rsconvert_info *acpi_rs_get_conversion_info(u8 resource_type) ...@@ -165,42 +62,24 @@ static struct acpi_rsconvert_info *acpi_rs_get_conversion_info(u8 resource_type)
* linked list of resources in the caller's output buffer * linked list of resources in the caller's output buffer
* *
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_rs_convert_aml_to_resources(u8 * aml_buffer, acpi_rs_convert_aml_to_resources(u8 * aml, u32 aml_length, u8 * output_buffer)
u32 aml_buffer_length, u8 * output_buffer)
{ {
u8 *buffer = output_buffer; struct acpi_resource *resource = (void *)output_buffer;
acpi_status status; acpi_status status;
acpi_size bytes_parsed = 0; u8 resource_index;
struct acpi_resource *resource; u8 *end_aml;
acpi_rsdesc_size descriptor_length;
struct acpi_rsconvert_info *info;
ACPI_FUNCTION_TRACE("rs_convert_aml_to_resources"); ACPI_FUNCTION_TRACE("rs_convert_aml_to_resources");
/* Loop until end-of-buffer or an end_tag is found */ end_aml = aml + aml_length;
while (bytes_parsed < aml_buffer_length) {
/* Get the conversion table associated with this Descriptor 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); /* Loop until end-of-buffer or an end_tag is found */
}
descriptor_length = acpi_ut_get_descriptor_length(aml_buffer); while (aml < end_aml) {
/* Validate the Resource Type and Resource Length */
/* status = acpi_ut_validate_resource(aml, &resource_index);
* Perform limited validation of the resource length, based upon
* what we know about the resource type
*/
status =
acpi_rs_validate_resource_length(ACPI_CAST_PTR
(union aml_resource,
aml_buffer));
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
...@@ -208,42 +87,36 @@ acpi_rs_convert_aml_to_resources(u8 * aml_buffer, ...@@ -208,42 +87,36 @@ acpi_rs_convert_aml_to_resources(u8 * aml_buffer,
/* Convert the AML byte stream resource to a local resource struct */ /* Convert the AML byte stream resource to a local resource struct */
status = status =
acpi_rs_convert_aml_to_resource(ACPI_CAST_PTR acpi_rs_convert_aml_to_resource(resource,
(struct acpi_resource,
buffer),
ACPI_CAST_PTR(union ACPI_CAST_PTR(union
aml_resource, aml_resource,
aml_buffer), aml),
info); acpi_gbl_get_resource_dispatch
[resource_index]);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("Could not convert AML resource (type %X) to resource, %s\n", *aml_buffer, acpi_format_exception(status))); ACPI_REPORT_ERROR(("Could not convert AML resource (Type %X) to resource, %s\n", *aml, acpi_format_exception(status)));
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
/* Set the aligned length of the new resource descriptor */
resource = ACPI_CAST_PTR(struct acpi_resource, buffer);
resource->length =
(u32) ACPI_ALIGN_RESOURCE_SIZE(resource->length);
/* Normal exit on completion of an end_tag resource descriptor */ /* Normal exit on completion of an end_tag resource descriptor */
if (acpi_ut_get_resource_type(aml_buffer) == if (acpi_ut_get_resource_type(aml) ==
ACPI_RESOURCE_NAME_END_TAG) { ACPI_RESOURCE_NAME_END_TAG) {
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
} }
/* Update counter and point to the next input resource */ /* Point to the next input AML resource */
bytes_parsed += descriptor_length; aml += acpi_ut_get_descriptor_length(aml);
aml_buffer += descriptor_length;
/* Point to the next structure in the output buffer */ /* Point to the next structure in the output buffer */
buffer += resource->length; resource =
ACPI_PTR_ADD(struct acpi_resource, resource,
resource->length);
} }
/* Completed buffer, but did not find an end_tag resource descriptor */ /* Did not find an end_tag resource descriptor */
return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
} }
...@@ -271,16 +144,16 @@ acpi_status ...@@ -271,16 +144,16 @@ acpi_status
acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
acpi_size aml_size_needed, u8 * output_buffer) acpi_size aml_size_needed, u8 * output_buffer)
{ {
u8 *aml_buffer = output_buffer; u8 *aml = output_buffer;
u8 *end_aml_buffer = output_buffer + aml_size_needed; u8 *end_aml = output_buffer + aml_size_needed;
acpi_status status; acpi_status status;
ACPI_FUNCTION_TRACE("rs_convert_resources_to_aml"); ACPI_FUNCTION_TRACE("rs_convert_resources_to_aml");
/* Walk the resource descriptor list, convert each descriptor */ /* Walk the resource descriptor list, convert each descriptor */
while (aml_buffer < end_aml_buffer) { while (aml < end_aml) {
/* Validate the Resource Type */ /* Validate the (internal) Resource Type */
if (resource->type > ACPI_RESOURCE_TYPE_MAX) { if (resource->type > ACPI_RESOURCE_TYPE_MAX) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
...@@ -294,7 +167,7 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, ...@@ -294,7 +167,7 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
status = acpi_rs_convert_resource_to_aml(resource, status = acpi_rs_convert_resource_to_aml(resource,
ACPI_CAST_PTR(union ACPI_CAST_PTR(union
aml_resource, aml_resource,
aml_buffer), aml),
acpi_gbl_set_resource_dispatch acpi_gbl_set_resource_dispatch
[resource->type]); [resource->type]);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
...@@ -305,9 +178,8 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, ...@@ -305,9 +178,8 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
/* Perform final sanity check on the new AML resource descriptor */ /* Perform final sanity check on the new AML resource descriptor */
status = status =
acpi_rs_validate_resource_length(ACPI_CAST_PTR acpi_ut_validate_resource(ACPI_CAST_PTR
(union aml_resource, (union aml_resource, aml), NULL);
aml_buffer));
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
...@@ -322,18 +194,15 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, ...@@ -322,18 +194,15 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
/* /*
* Extract the total length of the new descriptor and set the * Extract the total length of the new descriptor and set the
* aml_buffer to point to the next (output) resource descriptor * Aml to point to the next (output) resource descriptor
*/ */
aml_buffer += acpi_ut_get_descriptor_length(aml_buffer); aml += acpi_ut_get_descriptor_length(aml);
/* Point to the next input resource descriptor */ /* Point to the next input resource descriptor */
resource = resource =
ACPI_PTR_ADD(struct acpi_resource, resource, ACPI_PTR_ADD(struct acpi_resource, resource,
resource->length); resource->length);
/* Check for end-of-list, normal exit */
} }
/* Completed buffer, but did not find an end_tag resource descriptor */ /* Completed buffer, but did not find an end_tag resource descriptor */
......
...@@ -65,6 +65,8 @@ u8 acpi_rs_decode_bitmask(u16 mask, u8 * list) ...@@ -65,6 +65,8 @@ u8 acpi_rs_decode_bitmask(u16 mask, u8 * list)
acpi_native_uint i; acpi_native_uint i;
u8 bit_count; u8 bit_count;
ACPI_FUNCTION_ENTRY();
/* Decode the mask bits */ /* Decode the mask bits */
for (i = 0, bit_count = 0; mask; i++) { for (i = 0, bit_count = 0; mask; i++) {
...@@ -97,6 +99,8 @@ u16 acpi_rs_encode_bitmask(u8 * list, u8 count) ...@@ -97,6 +99,8 @@ u16 acpi_rs_encode_bitmask(u8 * list, u8 count)
acpi_native_uint i; acpi_native_uint i;
u16 mask; u16 mask;
ACPI_FUNCTION_ENTRY();
/* Encode the list into a single bitmask */ /* Encode the list into a single bitmask */
for (i = 0, mask = 0; i < count; i++) { for (i = 0, mask = 0; i < count; i++) {
...@@ -128,6 +132,8 @@ acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type) ...@@ -128,6 +132,8 @@ acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type)
{ {
acpi_native_uint i; acpi_native_uint i;
ACPI_FUNCTION_ENTRY();
/* One move per item */ /* One move per item */
for (i = 0; i < item_count; i++) { for (i = 0; i < item_count; i++) {
...@@ -166,53 +172,6 @@ acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type) ...@@ -166,53 +172,6 @@ acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type)
} }
} }
/*******************************************************************************
*
* FUNCTION: acpi_rs_get_resource_info
*
* PARAMETERS: resource_type - Byte 0 of a resource descriptor
*
* RETURN: Pointer to the resource conversion handler
*
* DESCRIPTION: Extract the Resource Type/Name from the first byte of
* a resource descriptor.
*
******************************************************************************/
struct acpi_resource_info *acpi_rs_get_resource_info(u8 resource_type)
{
struct acpi_resource_info *size_info;
ACPI_FUNCTION_ENTRY();
/* 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 */
if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) {
return (NULL);
}
size_info = &acpi_gbl_lg_resource_info[(resource_type &
ACPI_RESOURCE_NAME_LARGE_MASK)];
} else {
/* Small Resource Type -- bits 6:3 contain the name */
size_info = &acpi_gbl_sm_resource_info[((resource_type &
ACPI_RESOURCE_NAME_SMALL_MASK)
>> 3)];
}
/* Zero entry indicates an invalid resource type */
if (!size_info->minimum_internal_struct_length) {
return (NULL);
}
return (size_info);
}
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_rs_set_resource_length * FUNCTION: acpi_rs_set_resource_length
...@@ -238,25 +197,20 @@ acpi_rs_set_resource_length(acpi_rsdesc_size total_length, ...@@ -238,25 +197,20 @@ acpi_rs_set_resource_length(acpi_rsdesc_size total_length,
ACPI_FUNCTION_ENTRY(); ACPI_FUNCTION_ENTRY();
/* Determine if this is a small or large resource */ /* Length is the total descriptor length minus the header length */
if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) {
/* Large Resource type -- bytes 1-2 contain the 16-bit length */
resource_length = (acpi_rs_length) resource_length = (acpi_rs_length)
(total_length - sizeof(struct aml_resource_large_header)); (total_length - acpi_ut_get_resource_header_length(aml));
/* Length is stored differently for large and small descriptors */
/* Insert length into the Large descriptor length field */ if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) {
/* Large descriptor -- bytes 1-2 contain the 16-bit length */
ACPI_MOVE_16_TO_16(&aml->large_header.resource_length, ACPI_MOVE_16_TO_16(&aml->large_header.resource_length,
&resource_length); &resource_length);
} else { } else {
/* Small Resource type -- bits 2:0 of byte 0 contain the length */ /* Small descriptor -- bits 2:0 of byte 0 contain the length */
resource_length = (acpi_rs_length)
(total_length - sizeof(struct aml_resource_small_header));
/* Insert length into the descriptor type byte */
aml->small_header.descriptor_type = (u8) aml->small_header.descriptor_type = (u8)
...@@ -292,7 +246,7 @@ acpi_rs_set_resource_header(u8 descriptor_type, ...@@ -292,7 +246,7 @@ acpi_rs_set_resource_header(u8 descriptor_type,
{ {
ACPI_FUNCTION_ENTRY(); ACPI_FUNCTION_ENTRY();
/* Set the Descriptor Type */ /* Set the Resource Type */
aml->small_header.descriptor_type = descriptor_type; aml->small_header.descriptor_type = descriptor_type;
...@@ -409,14 +363,14 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length, ...@@ -409,14 +363,14 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length,
(char *)&aml_resource_source[1]); (char *)&aml_resource_source[1]);
return ((acpi_rs_length) total_length); return ((acpi_rs_length) total_length);
} else { }
/* resource_source is not present */ /* resource_source is not present */
resource_source->index = 0; resource_source->index = 0;
resource_source->string_length = 0; resource_source->string_length = 0;
resource_source->string_ptr = NULL; resource_source->string_ptr = NULL;
return (0); return (0);
}
} }
/******************************************************************************* /*******************************************************************************
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
# #
obj-y := utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \ obj-y := utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \
utcopy.o utdelete.o utglobal.o utmath.o utobject.o utstate.o utmutex.o utobject.o utcache.o utcopy.o utdelete.o utglobal.o utmath.o utobject.o \
utstate.o utmutex.o utobject.o utcache.o utresrc.o
EXTRA_CFLAGS += $(ACPI_CFLAGS) EXTRA_CFLAGS += $(ACPI_CFLAGS)
...@@ -43,7 +43,6 @@ ...@@ -43,7 +43,6 @@
#include <acpi/acpi.h> #include <acpi/acpi.h>
#include <acpi/acnamesp.h> #include <acpi/acnamesp.h>
#include <acpi/amlresrc.h>
#define _COMPONENT ACPI_UTILITIES #define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME("utmisc") ACPI_MODULE_NAME("utmisc")
...@@ -789,153 +788,6 @@ u8 acpi_ut_generate_checksum(u8 * buffer, u32 length) ...@@ -789,153 +788,6 @@ u8 acpi_ut_generate_checksum(u8 * buffer, u32 length)
return ((u8) (0 - sum)); return ((u8) (0 - sum));
} }
/*******************************************************************************
*
* 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 an AML resource template
*
******************************************************************************/
u8 *acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc)
{
u8 *aml;
u8 *end_aml;
aml = obj_desc->buffer.pointer;
end_aml = aml + obj_desc->buffer.length;
/* Walk the resource template, one descriptor per loop */
while (aml < end_aml) {
if (acpi_ut_get_resource_type(aml) ==
ACPI_RESOURCE_NAME_END_TAG) {
/* Found the end_tag descriptor, all done */
return (aml);
}
/* Point to the next resource descriptor */
aml += acpi_ut_get_resource_length(aml);
}
/* End tag was not found */
return (NULL);
}
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ut_report_error * FUNCTION: acpi_ut_report_error
......
This diff is collapsed.
...@@ -63,7 +63,7 @@ acpi_status ...@@ -63,7 +63,7 @@ acpi_status
acpi_ut_create_pkg_state_and_push(void *internal_object, acpi_ut_create_pkg_state_and_push(void *internal_object,
void *external_object, void *external_object,
u16 index, u16 index,
union acpi_generic_state ** state_list) union acpi_generic_state **state_list)
{ {
union acpi_generic_state *state; union acpi_generic_state *state;
......
...@@ -178,10 +178,14 @@ acpi_status acpi_enable_subsystem(u32 flags) ...@@ -178,10 +178,14 @@ acpi_status acpi_enable_subsystem(u32 flags)
/* /*
* Initialize ACPI Event handling (Fixed and General Purpose) * Initialize ACPI Event handling (Fixed and General Purpose)
* *
* NOTE: We must have the hardware AND events initialized before we can * Note1: We must have the hardware and events initialized before we can
* execute ANY control methods SAFELY. Any control method can require * execute any control methods safely. Any control method can require
* ACPI hardware support, so the hardware MUST be initialized before * ACPI hardware support, so the hardware must be fully initialized before
* execution! * any method execution!
*
* Note2: Fixed events are initialized and enabled here. GPEs are
* initialized, but cannot be enabled until after the hardware is
* completely initialized (SCI and global_lock activated)
*/ */
if (!(flags & ACPI_NO_EVENT_INIT)) { if (!(flags & ACPI_NO_EVENT_INIT)) {
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
...@@ -193,8 +197,10 @@ acpi_status acpi_enable_subsystem(u32 flags) ...@@ -193,8 +197,10 @@ acpi_status acpi_enable_subsystem(u32 flags)
} }
} }
/* Install the SCI handler and Global Lock handler */ /*
* Install the SCI handler and Global Lock handler. This completes the
* hardware initialization.
*/
if (!(flags & ACPI_NO_HANDLER_INIT)) { if (!(flags & ACPI_NO_HANDLER_INIT)) {
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"[Init] Installing SCI/GL handlers\n")); "[Init] Installing SCI/GL handlers\n"));
...@@ -205,6 +211,24 @@ acpi_status acpi_enable_subsystem(u32 flags) ...@@ -205,6 +211,24 @@ acpi_status acpi_enable_subsystem(u32 flags)
} }
} }
/*
* Complete the GPE initialization for the GPE blocks defined in the FADT
* (GPE block 0 and 1).
*
* Note1: This is where the _PRW methods are executed for the GPEs. These
* methods can only be executed after the SCI and Global Lock handlers are
* installed and initialized.
*
* Note2: Currently, there seems to be no need to run the _REG methods
* before execution of the _PRW methods and enabling of the GPEs.
*/
if (!(flags & ACPI_NO_EVENT_INIT)) {
status = acpi_ev_install_fadt_gpes();
if (ACPI_FAILURE(status)) {
return (status);
}
}
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
...@@ -230,9 +254,9 @@ acpi_status acpi_initialize_objects(u32 flags) ...@@ -230,9 +254,9 @@ acpi_status acpi_initialize_objects(u32 flags)
/* /*
* Run all _REG methods * Run all _REG methods
* *
* NOTE: Any objects accessed * Note: Any objects accessed by the _REG methods will be automatically
* by the _REG methods will be automatically initialized, even if they * initialized, even if they contain executable AML (see the call to
* contain executable AML (see call to acpi_ns_initialize_objects below). * acpi_ns_initialize_objects below).
*/ */
if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) {
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
...@@ -245,9 +269,9 @@ acpi_status acpi_initialize_objects(u32 flags) ...@@ -245,9 +269,9 @@ acpi_status acpi_initialize_objects(u32 flags)
} }
/* /*
* Initialize the objects that remain uninitialized. This * Initialize the objects that remain uninitialized. This runs the
* runs the executable AML that may be part of the declaration of these * executable AML that may be part of the declaration of these objects:
* objects: operation_regions, buffer_fields, Buffers, and Packages. * operation_regions, buffer_fields, Buffers, and Packages.
*/ */
if (!(flags & ACPI_NO_OBJECT_INIT)) { if (!(flags & ACPI_NO_OBJECT_INIT)) {
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
...@@ -260,8 +284,8 @@ acpi_status acpi_initialize_objects(u32 flags) ...@@ -260,8 +284,8 @@ acpi_status acpi_initialize_objects(u32 flags)
} }
/* /*
* Initialize all device objects in the namespace * Initialize all device objects in the namespace. This runs the device
* This runs the _STA and _INI methods. * _STA and _INI methods.
*/ */
if (!(flags & ACPI_NO_DEVICE_INIT)) { if (!(flags & ACPI_NO_DEVICE_INIT)) {
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
......
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */ /* Current ACPICA subsystem version in YYYYMMDD format */
#define ACPI_CA_VERSION 0x20051021 #define ACPI_CA_VERSION 0x20051102
/* /*
* OS name, used for the _OS object. The _OS object is essentially obsolete, * OS name, used for the _OS object. The _OS object is essentially obsolete,
......
...@@ -51,6 +51,8 @@ acpi_status acpi_ev_initialize_events(void); ...@@ -51,6 +51,8 @@ acpi_status acpi_ev_initialize_events(void);
acpi_status acpi_ev_install_xrupt_handlers(void); acpi_status acpi_ev_install_xrupt_handlers(void);
acpi_status acpi_ev_install_fadt_gpes(void);
u32 acpi_ev_fixed_event_detect(void); u32 acpi_ev_fixed_event_detect(void);
/* /*
...@@ -105,6 +107,10 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, ...@@ -105,6 +107,10 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
u32 interrupt_number, u32 interrupt_number,
struct acpi_gpe_block_info **return_gpe_block); struct acpi_gpe_block_info **return_gpe_block);
acpi_status
acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
struct acpi_gpe_block_info *gpe_block);
acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block); acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block);
u32 u32
......
...@@ -46,6 +46,48 @@ ...@@ -46,6 +46,48 @@
#define ACPI_WALK_OPERANDS (&(walk_state->operands [walk_state->num_operands -1])) #define ACPI_WALK_OPERANDS (&(walk_state->operands [walk_state->num_operands -1]))
/* Macros for tables used for debug output */
#define ACPI_EXD_OFFSET(f) (u8) ACPI_OFFSET (union acpi_operand_object,f)
#define ACPI_EXD_NSOFFSET(f) (u8) ACPI_OFFSET (struct acpi_namespace_node,f)
#define ACPI_EXD_TABLE_SIZE(name) (sizeof(name) / sizeof (struct acpi_exdump_info))
/*
* If possible, pack the following structure to byte alignment, since we
* don't care about performance for debug output
*/
#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
#pragma pack(1)
#endif
typedef const struct acpi_exdump_info {
u8 opcode;
u8 offset;
char *name;
} acpi_exdump_info;
/* Values for the Opcode field above */
#define ACPI_EXD_INIT 0
#define ACPI_EXD_TYPE 1
#define ACPI_EXD_UINT8 2
#define ACPI_EXD_UINT16 3
#define ACPI_EXD_UINT32 4
#define ACPI_EXD_UINT64 5
#define ACPI_EXD_LITERAL 6
#define ACPI_EXD_POINTER 7
#define ACPI_EXD_ADDRESS 8
#define ACPI_EXD_STRING 9
#define ACPI_EXD_BUFFER 10
#define ACPI_EXD_PACKAGE 11
#define ACPI_EXD_FIELD 12
#define ACPI_EXD_REFERENCE 13
/* restore default alignment */
#pragma pack()
/* /*
* exconvrt - object conversion * exconvrt - object conversion
*/ */
...@@ -327,7 +369,7 @@ acpi_ex_dump_operands(union acpi_operand_object **operands, ...@@ -327,7 +369,7 @@ acpi_ex_dump_operands(union acpi_operand_object **operands,
void void
acpi_ex_dump_object_descriptor(union acpi_operand_object *object, u32 flags); acpi_ex_dump_object_descriptor(union acpi_operand_object *object, u32 flags);
void acpi_ex_dump_node(struct acpi_namespace_node *node, u32 flags); void acpi_ex_dump_namespace_node(struct acpi_namespace_node *node, u32 flags);
#endif /* ACPI_FUTURE_USAGE */ #endif /* ACPI_FUTURE_USAGE */
/* /*
......
...@@ -101,27 +101,11 @@ typedef const struct acpi_rsconvert_info { ...@@ -101,27 +101,11 @@ typedef const struct acpi_rsconvert_info {
#define ACPI_RS_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_resource,f) #define ACPI_RS_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_resource,f)
#define AML_OFFSET(f) (u8) ACPI_OFFSET (union aml_resource,f) #define AML_OFFSET(f) (u8) ACPI_OFFSET (union aml_resource,f)
/*
* Resource dispatch and info tables
*/
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
typedef const struct acpi_rsdump_info { typedef const struct acpi_rsdump_info {
u8 opcode; u8 opcode;
u8 offset; u8 offset;
char *name; char *name;
const void *pointer; const char **pointer;
} acpi_rsdump_info; } acpi_rsdump_info;
...@@ -153,10 +137,9 @@ extern struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[]; ...@@ -153,10 +137,9 @@ extern struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[];
/* Resource tables indexed by raw AML resource descriptor type */ /* Resource tables indexed by raw AML resource descriptor type */
extern struct acpi_resource_info acpi_gbl_sm_resource_info[]; extern struct acpi_rsconvert_info *acpi_gbl_get_resource_dispatch[];
extern struct acpi_resource_info acpi_gbl_lg_resource_info[];
extern struct acpi_rsconvert_info *acpi_gbl_sm_get_resource_dispatch[]; extern const u8 acpi_gbl_resource_struct_sizes[];
extern struct acpi_rsconvert_info *acpi_gbl_lg_get_resource_dispatch[];
/* /*
* rscreate * rscreate
...@@ -272,8 +255,6 @@ void ...@@ -272,8 +255,6 @@ void
acpi_rs_set_resource_length(acpi_rsdesc_size total_length, acpi_rs_set_resource_length(acpi_rsdesc_size total_length,
union aml_resource *aml); union aml_resource *aml);
struct acpi_resource_info *acpi_rs_get_resource_info(u8 resource_type);
/* /*
* rsdump * rsdump
*/ */
......
...@@ -44,6 +44,15 @@ ...@@ -44,6 +44,15 @@
#ifndef _ACUTILS_H #ifndef _ACUTILS_H
#define _ACUTILS_H #define _ACUTILS_H
extern const u8 acpi_gbl_resource_aml_sizes[];
/* Types for Resource descriptor entries */
#define ACPI_INVALID_RESOURCE 0
#define ACPI_FIXED_LENGTH 1
#define ACPI_VARIABLE_LENGTH 2
#define ACPI_SMALL_VARIABLE_LENGTH 3
typedef typedef
acpi_status(*acpi_pkg_callback) (u8 object_type, acpi_status(*acpi_pkg_callback) (u8 object_type,
union acpi_operand_object * source_object, union acpi_operand_object * source_object,
...@@ -418,13 +427,19 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer); ...@@ -418,13 +427,19 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer);
#define ACPI_ANY_BASE 0 #define ACPI_ANY_BASE 0
acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index);
u32 acpi_ut_get_descriptor_length(void *aml); u32 acpi_ut_get_descriptor_length(void *aml);
u16 acpi_ut_get_resource_length(void *aml); u16 acpi_ut_get_resource_length(void *aml);
u8 acpi_ut_get_resource_header_length(void *aml);
u8 acpi_ut_get_resource_type(void *aml); u8 acpi_ut_get_resource_type(void *aml);
u8 *acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc); acpi_status
acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc,
u8 ** end_tag);
u8 acpi_ut_generate_checksum(u8 * buffer, u32 length); u8 acpi_ut_generate_checksum(u8 * buffer, u32 length);
......
...@@ -92,6 +92,11 @@ struct asl_resource_node { ...@@ -92,6 +92,11 @@ struct asl_resource_node {
struct asl_resource_node *next; struct asl_resource_node *next;
}; };
/* Macros used to generate AML resource length fields */
#define ACPI_AML_SIZE_LARGE(r) (sizeof (r) - sizeof (struct aml_resource_large_header))
#define ACPI_AML_SIZE_SMALL(r) (sizeof (r) - sizeof (struct aml_resource_small_header))
/* /*
* Resource descriptors defined in the ACPI specification. * Resource descriptors defined in the ACPI specification.
* *
......
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