Commit 61686124 authored by Bob Moore's avatar Bob Moore Committed by Len Brown

[ACPI] ACPICA 20060317

Implemented the use of a cache object for all internal
namespace nodes. Since there are about 1000 static nodes
in a typical system, this will decrease memory use for
cache implementations that minimize per-allocation overhead
(such as a slab allocator.)

Removed the reference count mechanism for internal
namespace nodes, since it was deemed unnecessary. This
reduces the size of each namespace node by about 5%-10%
on all platforms. Nodes are now 20 bytes for the 32-bit
case, and 32 bytes for the 64-bit case.

Optimized several internal data structures to reduce
object size on 64-bit platforms by packing data within
the 64-bit alignment. This includes the frequently used
ACPI_OPERAND_OBJECT, of which there can be ~1000 static
instances corresponding to the namespace objects.

Added two new strings for the predefined _OSI method:
"Windows 2001.1 SP1" and "Windows 2006".

Split the allocation tracking mechanism out to a separate
file, from utalloc.c to uttrack.c. This mechanism appears
to be only useful for application-level code. Kernels may
wish to not include uttrack.c in distributions.

Removed all remnants of the obsolete ACPI_REPORT_* macros
and the associated code. (These macros have been replaced
by the ACPI_ERROR and ACPI_WARNING macros.)
Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 144c87b4
......@@ -596,6 +596,8 @@ void __init acpi_early_init(void)
if (acpi_disabled)
return_VOID;
printk(KERN_INFO PREFIX "Core revision %08x\n", ACPI_CA_VERSION);
/* enable workarounds, unless strict ACPI spec. compliance */
if (!acpi_strict)
acpi_gbl_enable_interpreter_slack = TRUE;
......@@ -743,8 +745,6 @@ static int __init acpi_init(void)
ACPI_FUNCTION_TRACE("acpi_init");
printk(KERN_INFO PREFIX "Subsystem revision %08x\n", ACPI_CA_VERSION);
if (acpi_disabled) {
printk(KERN_INFO PREFIX "Interpreter disabled.\n");
return_VALUE(-ENODEV);
......
......@@ -100,10 +100,10 @@ void acpi_ds_method_data_init(struct acpi_walk_state *walk_state)
ACPI_MOVE_32_TO_32(&walk_state->arguments[i].name,
NAMEOF_ARG_NTE);
walk_state->arguments[i].name.integer |= (i << 24);
walk_state->arguments[i].descriptor = ACPI_DESC_TYPE_NAMED;
walk_state->arguments[i].descriptor_type = ACPI_DESC_TYPE_NAMED;
walk_state->arguments[i].type = ACPI_TYPE_ANY;
walk_state->arguments[i].flags = ANOBJ_END_OF_PEER_LIST |
ANOBJ_METHOD_ARG;
walk_state->arguments[i].flags =
ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG;
}
/* Init the method locals */
......@@ -113,11 +113,11 @@ void acpi_ds_method_data_init(struct acpi_walk_state *walk_state)
NAMEOF_LOCAL_NTE);
walk_state->local_variables[i].name.integer |= (i << 24);
walk_state->local_variables[i].descriptor =
walk_state->local_variables[i].descriptor_type =
ACPI_DESC_TYPE_NAMED;
walk_state->local_variables[i].type = ACPI_TYPE_ANY;
walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST |
ANOBJ_METHOD_LOCAL;
walk_state->local_variables[i].flags =
ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL;
}
return_VOID;
......
......@@ -128,7 +128,7 @@ acpi_ds_scope_stack_push(struct acpi_namespace_node *node,
/* Init new scope object */
scope_info->common.data_type = ACPI_DESC_TYPE_STATE_WSCOPE;
scope_info->common.descriptor_type = ACPI_DESC_TYPE_STATE_WSCOPE;
scope_info->scope.node = node;
scope_info->common.value = (u16) type;
......
......@@ -337,7 +337,7 @@ acpi_status acpi_ds_result_stack_push(struct acpi_walk_state * walk_state)
return (AE_NO_MEMORY);
}
state->common.data_type = ACPI_DESC_TYPE_STATE_RESULT;
state->common.descriptor_type = ACPI_DESC_TYPE_STATE_RESULT;
acpi_ut_push_generic_state(&walk_state->results, state);
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Results=%p State=%p\n",
......@@ -620,7 +620,7 @@ struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state *thread)
*
* PARAMETERS: owner_id - ID for object creation
* Origin - Starting point for this walk
* mth_desc - Method object
* method_desc - Method object
* Thread - Current thread state
*
* RETURN: Pointer to the new walk state.
......@@ -634,7 +634,7 @@ struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id,
union acpi_parse_object
*origin,
union acpi_operand_object
*mth_desc,
*method_desc,
struct acpi_thread_state
*thread)
{
......@@ -648,10 +648,10 @@ struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id,
return_PTR(NULL);
}
walk_state->data_type = ACPI_DESC_TYPE_WALK;
walk_state->descriptor_type = ACPI_DESC_TYPE_WALK;
walk_state->method_desc = method_desc;
walk_state->owner_id = owner_id;
walk_state->origin = origin;
walk_state->method_desc = mth_desc;
walk_state->thread = thread;
walk_state->parser_state.start_op = origin;
......@@ -819,7 +819,7 @@ void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state)
return;
}
if (walk_state->data_type != ACPI_DESC_TYPE_WALK) {
if (walk_state->descriptor_type != ACPI_DESC_TYPE_WALK) {
ACPI_ERROR((AE_INFO, "%p is not a valid walk state",
walk_state));
return;
......
......@@ -131,7 +131,7 @@ u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info)
*
******************************************************************************/
acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback)
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;
......
......@@ -185,7 +185,8 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
return (AE_NO_MEMORY);
}
notify_info->common.data_type = ACPI_DESC_TYPE_STATE_NOTIFY;
notify_info->common.descriptor_type =
ACPI_DESC_TYPE_STATE_NOTIFY;
notify_info->notify.node = node;
notify_info->notify.value = (u16) notify_value;
notify_info->notify.handler_obj = handler_obj;
......
......@@ -250,7 +250,6 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
cleanup:
acpi_ut_remove_reference(params[0]);
return_ACPI_STATUS(status);
}
......@@ -389,9 +388,8 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
acpi_ut_get_region_name(region_obj->region.
space_id)));
if (!
(handler_desc->address_space.
hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) {
if (!(handler_desc->address_space.handler_flags &
ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) {
/*
* For handlers other than the default (supplied) handlers, we must
* exit the interpreter because the handler *might* block -- we don't
......@@ -412,9 +410,8 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
space_id)));
}
if (!
(handler_desc->address_space.
hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) {
if (!(handler_desc->address_space.handler_flags &
ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) {
/*
* We just returned from a non-default handler, we must re-enter the
* interpreter
......@@ -772,7 +769,7 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node,
union acpi_operand_object *handler_obj;
acpi_status status;
acpi_object_type type;
u16 flags = 0;
u8 flags = 0;
ACPI_FUNCTION_TRACE("ev_install_space_handler");
......@@ -930,7 +927,7 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node,
/* Init handler obj */
handler_obj->address_space.space_id = (u8) space_id;
handler_obj->address_space.hflags = flags;
handler_obj->address_space.handler_flags = flags;
handler_obj->address_space.region_list = NULL;
handler_obj->address_space.node = node;
handler_obj->address_space.handler = handler;
......
......@@ -243,8 +243,9 @@ acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state)
obj_desc->mutex.node =
(struct acpi_namespace_node *)walk_state->operands[0];
status = acpi_ns_attach_object(obj_desc->mutex.node,
obj_desc, ACPI_TYPE_MUTEX);
status =
acpi_ns_attach_object(obj_desc->mutex.node, obj_desc,
ACPI_TYPE_MUTEX);
cleanup:
/*
......@@ -464,9 +465,9 @@ acpi_status acpi_ex_create_processor(struct acpi_walk_state *walk_state)
/* Initialize the processor object from the operands */
obj_desc->processor.proc_id = (u8) operand[1]->integer.value;
obj_desc->processor.length = (u8) operand[3]->integer.value;
obj_desc->processor.address =
(acpi_io_address) operand[2]->integer.value;
obj_desc->processor.length = (u8) operand[3]->integer.value;
/* Install the processor object in the parent Node */
......
......@@ -267,8 +267,6 @@ static struct acpi_exdump_info acpi_ex_dump_node[6] = {
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_node), NULL},
{ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(flags), "Flags"},
{ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(owner_id), "Owner Id"},
{ACPI_EXD_UINT16, ACPI_EXD_NSOFFSET(reference_count),
"Reference Count"},
{ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(child), "Child List"},
{ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(peer), "Next Peer"}
};
......
......@@ -47,9 +47,6 @@
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME("nsalloc")
/* Local prototypes */
static void acpi_ns_remove_reference(struct acpi_namespace_node *node);
/*******************************************************************************
*
* FUNCTION: acpi_ns_create_node
......@@ -61,14 +58,13 @@ static void acpi_ns_remove_reference(struct acpi_namespace_node *node);
* DESCRIPTION: Create a namespace node
*
******************************************************************************/
struct acpi_namespace_node *acpi_ns_create_node(u32 name)
{
struct acpi_namespace_node *node;
ACPI_FUNCTION_TRACE("ns_create_node");
node = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_namespace_node));
node = acpi_os_acquire_object(acpi_gbl_namespace_cache);
if (!node) {
return_PTR(NULL);
}
......@@ -76,9 +72,7 @@ struct acpi_namespace_node *acpi_ns_create_node(u32 name)
ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_allocated++);
node->name.integer = name;
node->reference_count = 1;
ACPI_SET_DESCRIPTOR_TYPE(node, ACPI_DESC_TYPE_NAMED);
return_PTR(node);
}
......@@ -139,10 +133,10 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node)
ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++);
/*
* Detach an object if there is one then delete the node
* Detach an object if there is one, then delete the node
*/
acpi_ns_detach_object(node);
ACPI_FREE(node);
(void)acpi_os_release_object(acpi_gbl_namespace_cache, node);
return_VOID;
}
......@@ -217,16 +211,6 @@ void acpi_ns_install_node(struct acpi_walk_state *walk_state, struct acpi_namesp
acpi_ut_get_node_name(parent_node),
acpi_ut_get_type_name(parent_node->type),
parent_node));
/*
* Increment the reference count(s) of all parents up to
* the root!
*/
while ((node = acpi_ns_get_parent_node(node)) != NULL) {
node->reference_count++;
}
return_VOID;
}
/*******************************************************************************
......@@ -246,7 +230,6 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node)
{
struct acpi_namespace_node *child_node;
struct acpi_namespace_node *next_node;
struct acpi_namespace_node *node;
u8 flags;
ACPI_FUNCTION_TRACE_PTR("ns_delete_children", parent_node);
......@@ -292,26 +275,10 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node)
*/
acpi_ns_detach_object(child_node);
/*
* Decrement the reference count(s) of all parents up to
* the root! (counts were incremented when the node was created)
*/
node = child_node;
while ((node = acpi_ns_get_parent_node(node)) != NULL) {
node->reference_count--;
}
/* There should be only one reference remaining on this node */
if (child_node->reference_count != 1) {
ACPI_WARNING((AE_INFO,
"Existing references (%d) on node being deleted (%p)",
child_node->reference_count, child_node));
}
/* Now we can delete the node */
ACPI_FREE(child_node);
(void)acpi_os_release_object(acpi_gbl_namespace_cache,
child_node);
/* And move on to the next child in the list */
......@@ -358,8 +325,9 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node)
/* Get the next node in this scope (NULL if none) */
child_node = acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node,
child_node);
child_node =
acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node,
child_node);
if (child_node) {
/* Found a child node - detach any attached object */
......@@ -404,57 +372,6 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node)
return_VOID;
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_remove_reference
*
* PARAMETERS: Node - Named node whose reference count is to be
* decremented
*
* RETURN: None.
*
* DESCRIPTION: Remove a Node reference. Decrements the reference count
* of all parent Nodes up to the root. Any node along
* the way that reaches zero references is freed.
*
******************************************************************************/
static void acpi_ns_remove_reference(struct acpi_namespace_node *node)
{
struct acpi_namespace_node *parent_node;
struct acpi_namespace_node *this_node;
ACPI_FUNCTION_ENTRY();
/*
* Decrement the reference count(s) of this node and all
* nodes up to the root, Delete anything with zero remaining references.
*/
this_node = node;
while (this_node) {
/* Prepare to move up to parent */
parent_node = acpi_ns_get_parent_node(this_node);
/* Decrement the reference count on this node */
this_node->reference_count--;
/* Delete the node if no more references */
if (!this_node->reference_count) {
/* Delete all children and delete the node */
acpi_ns_delete_children(this_node);
acpi_ns_delete_node(this_node);
}
this_node = parent_node;
}
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_delete_namespace_by_owner
......@@ -482,9 +399,9 @@ void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id)
return_VOID;
}
deletion_node = NULL;
parent_node = acpi_gbl_root_node;
child_node = NULL;
deletion_node = NULL;
level = 1;
/*
......@@ -501,7 +418,8 @@ void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id)
child_node);
if (deletion_node) {
acpi_ns_remove_reference(deletion_node);
acpi_ns_delete_children(deletion_node);
acpi_ns_delete_node(deletion_node);
deletion_node = NULL;
}
......
......@@ -81,7 +81,7 @@ acpi_ns_report_error(char *module_name,
u32 bad_name;
char *name = NULL;
acpi_ut_report_error(module_name, line_number);
acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number);
if (lookup_status == AE_BAD_CHARACTER) {
......@@ -139,7 +139,7 @@ acpi_ns_report_method_error(char *module_name,
acpi_status status;
struct acpi_namespace_node *node = prefix_node;
acpi_ut_report_error(module_name, line_number);
acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number);
if (path) {
status = acpi_ns_get_node_by_path(path, prefix_node,
......
......@@ -1126,14 +1126,13 @@ acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object)
*
* RETURN: Status
*
* DESCRIPTION: Get an object from the specified cache. If cache is empty,
* the object is allocated.
* DESCRIPTION: Return a zero-filled object.
*
******************************************************************************/
void *acpi_os_acquire_object(acpi_cache_t * cache)
{
void *object = kmem_cache_alloc(cache, GFP_KERNEL);
void *object = kmem_cache_zalloc(cache, GFP_KERNEL);
WARN_ON(!object);
return object;
}
......
......@@ -113,7 +113,7 @@ acpi_ps_init_scope(struct acpi_parse_state * parser_state,
return_ACPI_STATUS(AE_NO_MEMORY);
}
scope->common.data_type = ACPI_DESC_TYPE_STATE_RPSCOPE;
scope->common.descriptor_type = ACPI_DESC_TYPE_STATE_RPSCOPE;
scope->parse_scope.op = root_op;
scope->parse_scope.arg_count = ACPI_VAR_ARGS;
scope->parse_scope.arg_end = parser_state->aml_end;
......@@ -143,7 +143,7 @@ acpi_ps_init_scope(struct acpi_parse_state * parser_state,
acpi_status
acpi_ps_push_scope(struct acpi_parse_state *parser_state,
union acpi_parse_object *op,
u32 remaining_args, u32 arg_count)
u32 remaining_args, u8 arg_count)
{
union acpi_generic_state *scope;
......@@ -154,7 +154,7 @@ acpi_ps_push_scope(struct acpi_parse_state *parser_state,
return_ACPI_STATUS(AE_NO_MEMORY);
}
scope->common.data_type = ACPI_DESC_TYPE_STATE_PSCOPE;
scope->common.descriptor_type = ACPI_DESC_TYPE_STATE_PSCOPE;
scope->parse_scope.op = op;
scope->parse_scope.arg_list = remaining_args;
scope->parse_scope.arg_count = arg_count;
......@@ -196,7 +196,7 @@ acpi_ps_push_scope(struct acpi_parse_state *parser_state,
void
acpi_ps_pop_scope(struct acpi_parse_state *parser_state,
union acpi_parse_object **op, u32 * arg_list, u32 * arg_count)
union acpi_parse_object **op, u32 * arg_list, u8 * arg_count)
{
union acpi_generic_state *scope = parser_state->scope;
......@@ -207,7 +207,7 @@ acpi_ps_pop_scope(struct acpi_parse_state *parser_state,
if (scope->common.next) {
scope = acpi_ut_pop_generic_state(&parser_state->scope);
/* return to parsing previous op */
/* Return to parsing previous op */
*op = scope->parse_scope.op;
*arg_list = scope->parse_scope.arg_list;
......@@ -218,7 +218,7 @@ acpi_ps_pop_scope(struct acpi_parse_state *parser_state,
acpi_ut_delete_generic_state(scope);
} else {
/* empty parse stack, prepare to fetch next opcode */
/* Empty parse stack, prepare to fetch next opcode */
*op = NULL;
*arg_list = 0;
......
......@@ -89,7 +89,7 @@ void acpi_ps_init_op(union acpi_parse_object *op, u16 opcode)
{
ACPI_FUNCTION_ENTRY();
op->common.data_type = ACPI_DESC_TYPE_PARSER;
op->common.descriptor_type = ACPI_DESC_TYPE_PARSER;
op->common.aml_opcode = opcode;
ACPI_DISASM_ONLY_MEMBERS(ACPI_STRNCPY(op->common.aml_op_name,
......
......@@ -456,7 +456,7 @@ acpi_rs_get_list_length(u8 * aml_buffer,
*size_needed += buffer_size;
ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
"Type %.2X, Aml %.2X internal %.2X\n",
"Type %.2X, aml_length %.2X internal_length %.2X\n",
acpi_ut_get_resource_type(aml_buffer),
acpi_ut_get_descriptor_length(aml_buffer),
buffer_size));
......
......@@ -75,6 +75,7 @@ acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer,
u8 *aml_start;
acpi_size list_size_needed = 0;
u32 aml_buffer_length;
void *resource;
ACPI_FUNCTION_TRACE("rs_create_resource_list");
......@@ -107,8 +108,10 @@ acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer,
/* Do the conversion */
status = acpi_rs_convert_aml_to_resources(aml_start, aml_buffer_length,
output_buffer->pointer);
resource = output_buffer->pointer;
status = acpi_ut_walk_aml_resources(aml_start, aml_buffer_length,
acpi_rs_convert_aml_to_resources,
&resource);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
......
......@@ -51,92 +51,60 @@ ACPI_MODULE_NAME("rslist")
*
* FUNCTION: acpi_rs_convert_aml_to_resources
*
* PARAMETERS: Aml - Pointer to the resource byte stream
* aml_length - Length of Aml
* output_buffer - Pointer to the buffer that will
* contain the output structures
* PARAMETERS: acpi_walk_aml_callback
* resource_ptr - Pointer to the buffer that will
* contain the output structures
*
* RETURN: Status
*
* DESCRIPTION: Takes the resource byte stream and parses it, creating a
* linked list of resources in the caller's output buffer
* DESCRIPTION: Convert an AML resource to an internal representation of the
* resource that is aligned and easier to access.
*
******************************************************************************/
acpi_status
acpi_rs_convert_aml_to_resources(u8 * aml, u32 aml_length, u8 * output_buffer)
acpi_rs_convert_aml_to_resources(u8 * aml,
u32 length,
u32 offset,
u8 resource_index, void **resource_ptr)
{
struct acpi_resource *resource = (void *)output_buffer;
struct acpi_resource *resource = *resource_ptr;
acpi_status status;
u8 resource_index;
u8 *end_aml;
ACPI_FUNCTION_TRACE("rs_convert_aml_to_resources");
end_aml = aml + aml_length;
/* Loop until end-of-buffer or an end_tag is found */
while (aml < end_aml) {
/*
* Check that the input buffer and all subsequent pointers into it
* are aligned on a native word boundary. Most important on IA64
*/
if (ACPI_IS_MISALIGNED(resource)) {
ACPI_WARNING((AE_INFO,
"Misaligned resource pointer %p",
resource));
}
/* Validate the Resource Type and Resource Length */
status = acpi_ut_validate_resource(aml, &resource_index);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
/* Convert the AML byte stream resource to a local resource struct */
status =
acpi_rs_convert_aml_to_resource(resource,
ACPI_CAST_PTR(union
aml_resource,
aml),
acpi_gbl_get_resource_dispatch
[resource_index]);
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status,
"Could not convert AML resource (Type %X)",
*aml));
return_ACPI_STATUS(status);
}
ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
"Type %.2X, Aml %.2X internal %.2X\n",
acpi_ut_get_resource_type(aml),
acpi_ut_get_descriptor_length(aml),
resource->length));
/* Normal exit on completion of an end_tag resource descriptor */
if (acpi_ut_get_resource_type(aml) ==
ACPI_RESOURCE_NAME_END_TAG) {
return_ACPI_STATUS(AE_OK);
}
/* Point to the next input AML resource */
aml += acpi_ut_get_descriptor_length(aml);
/* Point to the next structure in the output buffer */
/*
* Check that the input buffer and all subsequent pointers into it
* are aligned on a native word boundary. Most important on IA64
*/
if (ACPI_IS_MISALIGNED(resource)) {
ACPI_WARNING((AE_INFO,
"Misaligned resource pointer %p", resource));
}
resource =
ACPI_ADD_PTR(struct acpi_resource, resource,
resource->length);
/* Convert the AML byte stream resource to a local resource struct */
status =
acpi_rs_convert_aml_to_resource(resource,
ACPI_CAST_PTR(union aml_resource,
aml),
acpi_gbl_get_resource_dispatch
[resource_index]);
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status,
"Could not convert AML resource (Type %X)",
*aml));
return_ACPI_STATUS(status);
}
/* Did not find an end_tag resource descriptor */
ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
"Type %.2X, aml_length %.2X internal_length %.2X\n",
acpi_ut_get_resource_type(aml), length,
resource->length));
return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
/* Point to the next structure in the output buffer */
*resource_ptr = ACPI_ADD_PTR(void, resource, resource->length);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
......
......@@ -242,7 +242,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_possible_resources)
acpi_status
acpi_walk_resources(acpi_handle device_handle,
char *name,
ACPI_WALK_RESOURCE_CALLBACK user_function, void *context)
acpi_walk_resource_callback user_function, void *context)
{
acpi_status status;
struct acpi_buffer buffer;
......@@ -469,7 +469,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_vendor_resource)
*
* FUNCTION: acpi_rs_match_vendor_resource
*
* PARAMETERS: ACPI_WALK_RESOURCE_CALLBACK
* PARAMETERS: acpi_walk_resource_callback
*
* RETURN: Status
*
......
......@@ -46,24 +46,6 @@
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME("utalloc")
/* Local prototypes */
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation);
static acpi_status
acpi_ut_track_allocation(struct acpi_debug_mem_block *address,
acpi_size size,
u8 alloc_type, u32 component, char *module, u32 line);
static acpi_status
acpi_ut_remove_allocation(struct acpi_debug_mem_block *address,
u32 component, char *module, u32 line);
static acpi_status
acpi_ut_create_list(char *list_name,
u16 object_size, struct acpi_memory_list **return_cache);
#endif
/*******************************************************************************
*
* FUNCTION: acpi_ut_create_caches
......@@ -75,7 +57,6 @@ acpi_ut_create_list(char *list_name,
* DESCRIPTION: Create all local caches
*
******************************************************************************/
acpi_status acpi_ut_create_caches(void)
{
acpi_status status;
......@@ -101,7 +82,16 @@ acpi_status acpi_ut_create_caches(void)
/* Object Caches, for frequently used objects */
status =
acpi_os_create_cache("acpi_state", sizeof(union acpi_generic_state),
acpi_os_create_cache("Acpi-Namespace",
sizeof(struct acpi_namespace_node),
ACPI_MAX_NAMESPACE_CACHE_DEPTH,
&acpi_gbl_namespace_cache);
if (ACPI_FAILURE(status)) {
return (status);
}
status =
acpi_os_create_cache("Acpi-State", sizeof(union acpi_generic_state),
ACPI_MAX_STATE_CACHE_DEPTH,
&acpi_gbl_state_cache);
if (ACPI_FAILURE(status)) {
......@@ -109,7 +99,7 @@ acpi_status acpi_ut_create_caches(void)
}
status =
acpi_os_create_cache("acpi_parse",
acpi_os_create_cache("Acpi-Parse",
sizeof(struct acpi_parse_obj_common),
ACPI_MAX_PARSE_CACHE_DEPTH,
&acpi_gbl_ps_node_cache);
......@@ -118,7 +108,7 @@ acpi_status acpi_ut_create_caches(void)
}
status =
acpi_os_create_cache("acpi_parse_ext",
acpi_os_create_cache("Acpi-parse_ext",
sizeof(struct acpi_parse_obj_named),
ACPI_MAX_EXTPARSE_CACHE_DEPTH,
&acpi_gbl_ps_node_ext_cache);
......@@ -127,7 +117,7 @@ acpi_status acpi_ut_create_caches(void)
}
status =
acpi_os_create_cache("acpi_operand",
acpi_os_create_cache("Acpi-Operand",
sizeof(union acpi_operand_object),
ACPI_MAX_OBJECT_CACHE_DEPTH,
&acpi_gbl_operand_cache);
......@@ -153,6 +143,9 @@ acpi_status acpi_ut_create_caches(void)
acpi_status acpi_ut_delete_caches(void)
{
(void)acpi_os_delete_cache(acpi_gbl_namespace_cache);
acpi_gbl_namespace_cache = NULL;
(void)acpi_os_delete_cache(acpi_gbl_state_cache);
acpi_gbl_state_cache = NULL;
......@@ -288,7 +281,7 @@ acpi_ut_initialize_buffer(struct acpi_buffer * buffer,
*
* RETURN: Address of the allocated memory on success, NULL on failure.
*
* DESCRIPTION: The subsystem's equivalent of malloc.
* DESCRIPTION: Subsystem equivalent of malloc.
*
******************************************************************************/
......@@ -301,8 +294,8 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line)
/* Check for an inadvertent size of zero bytes */
if (!size) {
ACPI_ERROR((module, line,
"ut_allocate: Attempt to allocate zero bytes, allocating 1 byte"));
ACPI_WARNING((module, line,
"Attempt to allocate zero bytes, allocating 1 byte"));
size = 1;
}
......@@ -311,9 +304,8 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line)
/* Report allocation error */
ACPI_ERROR((module, line,
"ut_allocate: Could not allocate size %X",
(u32) size));
ACPI_WARNING((module, line,
"Could not allocate size %X", (u32) size));
return_PTR(NULL);
}
......@@ -323,7 +315,7 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line)
/*******************************************************************************
*
* FUNCTION: acpi_ut_callocate
* FUNCTION: acpi_ut_allocate_zeroed
*
* PARAMETERS: Size - Size of the allocation
* Component - Component type of caller
......@@ -332,546 +324,24 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line)
*
* RETURN: Address of the allocated memory on success, NULL on failure.
*
* DESCRIPTION: Subsystem equivalent of calloc.
* DESCRIPTION: Subsystem equivalent of calloc. Allocate and zero memory.
*
******************************************************************************/
void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line)
void *acpi_ut_allocate_zeroed(acpi_size size,
u32 component, char *module, u32 line)
{
void *allocation;
ACPI_FUNCTION_TRACE_U32("ut_callocate", size);
/* Check for an inadvertent size of zero bytes */
if (!size) {
ACPI_ERROR((module, line,
"Attempt to allocate zero bytes, allocating 1 byte"));
size = 1;
}
allocation = acpi_os_allocate(size);
if (!allocation) {
/* Report allocation error */
ACPI_ERROR((module, line,
"Could not allocate size %X", (u32) size));
return_PTR(NULL);
}
/* Clear the memory block */
ACPI_MEMSET(allocation, 0, size);
return_PTR(allocation);
}
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
/*
* These procedures are used for tracking memory leaks in the subsystem, and
* they get compiled out when the ACPI_DBG_TRACK_ALLOCATIONS is not set.
*
* Each memory allocation is tracked via a doubly linked list. Each
* element contains the caller's component, module name, function name, and
* line number. acpi_ut_allocate and acpi_ut_callocate call
* acpi_ut_track_allocation to add an element to the list; deletion
* occurs in the body of acpi_ut_free.
*/
/*******************************************************************************
*
* FUNCTION: acpi_ut_create_list
*
* PARAMETERS: cache_name - Ascii name for the cache
* object_size - Size of each cached object
* return_cache - Where the new cache object is returned
*
* RETURN: Status
*
* DESCRIPTION: Create a local memory list for tracking purposed
*
******************************************************************************/
static acpi_status
acpi_ut_create_list(char *list_name,
u16 object_size, struct acpi_memory_list **return_cache)
{
struct acpi_memory_list *cache;
cache = acpi_os_allocate(sizeof(struct acpi_memory_list));
if (!cache) {
return (AE_NO_MEMORY);
}
ACPI_MEMSET(cache, 0, sizeof(struct acpi_memory_list));
cache->list_name = list_name;
cache->object_size = object_size;
*return_cache = cache;
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ut_allocate_and_track
*
* PARAMETERS: Size - Size of the allocation
* Component - Component type of caller
* Module - Source file name of caller
* Line - Line number of caller
*
* RETURN: Address of the allocated memory on success, NULL on failure.
*
* DESCRIPTION: The subsystem's equivalent of malloc.
*
******************************************************************************/
void *acpi_ut_allocate_and_track(acpi_size size,
u32 component, char *module, u32 line)
{
struct acpi_debug_mem_block *allocation;
acpi_status status;
allocation =
acpi_ut_allocate(size + sizeof(struct acpi_debug_mem_header),
component, module, line);
if (!allocation) {
return (NULL);
}
status = acpi_ut_track_allocation(allocation, size,
ACPI_MEM_MALLOC, component, module,
line);
if (ACPI_FAILURE(status)) {
acpi_os_free(allocation);
return (NULL);
}
acpi_gbl_global_list->total_allocated++;
acpi_gbl_global_list->current_total_size += (u32) size;
return ((void *)&allocation->user_space);
}
/*******************************************************************************
*
* FUNCTION: acpi_ut_callocate_and_track
*
* PARAMETERS: Size - Size of the allocation
* Component - Component type of caller
* Module - Source file name of caller
* Line - Line number of caller
*
* RETURN: Address of the allocated memory on success, NULL on failure.
*
* DESCRIPTION: Subsystem equivalent of calloc.
*
******************************************************************************/
void *acpi_ut_callocate_and_track(acpi_size size,
u32 component, char *module, u32 line)
{
struct acpi_debug_mem_block *allocation;
acpi_status status;
allocation =
acpi_ut_callocate(size + sizeof(struct acpi_debug_mem_header),
component, module, line);
if (!allocation) {
/* Report allocation error */
ACPI_ERROR((module, line,
"Could not allocate size %X", (u32) size));
return (NULL);
}
status = acpi_ut_track_allocation(allocation, size,
ACPI_MEM_CALLOC, component, module,
line);
if (ACPI_FAILURE(status)) {
acpi_os_free(allocation);
return (NULL);
}
acpi_gbl_global_list->total_allocated++;
acpi_gbl_global_list->current_total_size += (u32) size;
return ((void *)&allocation->user_space);
}
/*******************************************************************************
*
* FUNCTION: acpi_ut_free_and_track
*
* PARAMETERS: Allocation - Address of the memory to deallocate
* Component - Component type of caller
* Module - Source file name of caller
* Line - Line number of caller
*
* RETURN: None
*
* DESCRIPTION: Frees the memory at Allocation
*
******************************************************************************/
void
acpi_ut_free_and_track(void *allocation, u32 component, char *module, u32 line)
{
struct acpi_debug_mem_block *debug_block;
acpi_status status;
ACPI_FUNCTION_TRACE_PTR("ut_free", allocation);
if (NULL == allocation) {
ACPI_ERROR((module, line, "Attempt to delete a NULL address"));
return_VOID;
}
debug_block = ACPI_CAST_PTR(struct acpi_debug_mem_block,
(((char *)allocation) -
sizeof(struct acpi_debug_mem_header)));
acpi_gbl_global_list->total_freed++;
acpi_gbl_global_list->current_total_size -= debug_block->size;
status = acpi_ut_remove_allocation(debug_block,
component, module, line);
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Could not free memory"));
}
acpi_os_free(debug_block);
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p freed\n", allocation));
return_VOID;
}
/*******************************************************************************
*
* FUNCTION: acpi_ut_find_allocation
*
* PARAMETERS: Allocation - Address of allocated memory
*
* RETURN: A list element if found; NULL otherwise.
*
* DESCRIPTION: Searches for an element in the global allocation tracking list.
*
******************************************************************************/
static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation)
{
struct acpi_debug_mem_block *element;
ACPI_FUNCTION_ENTRY();
element = acpi_gbl_global_list->list_head;
/* Search for the address. */
while (element) {
if (element == allocation) {
return (element);
}
element = element->next;
}
return (NULL);
}
/*******************************************************************************
*
* FUNCTION: acpi_ut_track_allocation
*
* PARAMETERS: Allocation - Address of allocated memory
* Size - Size of the allocation
* alloc_type - MEM_MALLOC or MEM_CALLOC
* Component - Component type of caller
* Module - Source file name of caller
* Line - Line number of caller
*
* RETURN: None.
*
* DESCRIPTION: Inserts an element into the global allocation tracking list.
*
******************************************************************************/
static acpi_status
acpi_ut_track_allocation(struct acpi_debug_mem_block *allocation,
acpi_size size,
u8 alloc_type, u32 component, char *module, u32 line)
{
struct acpi_memory_list *mem_list;
struct acpi_debug_mem_block *element;
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE_PTR("ut_track_allocation", allocation);
mem_list = acpi_gbl_global_list;
status = acpi_ut_acquire_mutex(ACPI_MTX_MEMORY);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
/*
* Search list for this address to make sure it is not already on the list.
* This will catch several kinds of problems.
*/
element = acpi_ut_find_allocation(allocation);
if (element) {
ACPI_ERROR((AE_INFO,
"ut_track_allocation: Allocation already present in list! (%p)",
allocation));
allocation = acpi_ut_allocate(size, component, module, line);
if (allocation) {
ACPI_ERROR((AE_INFO, "Element %p Address %p",
element, allocation));
/* Clear the memory block */
goto unlock_and_exit;
ACPI_MEMSET(allocation, 0, size);
}
/* Fill in the instance data. */
allocation->size = (u32) size;
allocation->alloc_type = alloc_type;
allocation->component = component;
allocation->line = line;
ACPI_STRNCPY(allocation->module, module, ACPI_MAX_MODULE_NAME);
allocation->module[ACPI_MAX_MODULE_NAME - 1] = 0;
/* Insert at list head */
if (mem_list->list_head) {
((struct acpi_debug_mem_block *)(mem_list->list_head))->
previous = allocation;
}
allocation->next = mem_list->list_head;
allocation->previous = NULL;
mem_list->list_head = allocation;
unlock_and_exit:
status = acpi_ut_release_mutex(ACPI_MTX_MEMORY);
return_ACPI_STATUS(status);
return (allocation);
}
/*******************************************************************************
*
* FUNCTION: acpi_ut_remove_allocation
*
* PARAMETERS: Allocation - Address of allocated memory
* Component - Component type of caller
* Module - Source file name of caller
* Line - Line number of caller
*
* RETURN:
*
* DESCRIPTION: Deletes an element from the global allocation tracking list.
*
******************************************************************************/
static acpi_status
acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation,
u32 component, char *module, u32 line)
{
struct acpi_memory_list *mem_list;
acpi_status status;
ACPI_FUNCTION_TRACE("ut_remove_allocation");
mem_list = acpi_gbl_global_list;
if (NULL == mem_list->list_head) {
/* No allocations! */
ACPI_ERROR((module, line,
"Empty allocation list, nothing to free!"));
return_ACPI_STATUS(AE_OK);
}
status = acpi_ut_acquire_mutex(ACPI_MTX_MEMORY);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
/* Unlink */
if (allocation->previous) {
(allocation->previous)->next = allocation->next;
} else {
mem_list->list_head = allocation->next;
}
if (allocation->next) {
(allocation->next)->previous = allocation->previous;
}
/* Mark the segment as deleted */
ACPI_MEMSET(&allocation->user_space, 0xEA, allocation->size);
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n",
allocation->size));
status = acpi_ut_release_mutex(ACPI_MTX_MEMORY);
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ut_dump_allocation_info
*
* PARAMETERS:
*
* RETURN: None
*
* DESCRIPTION: Print some info about the outstanding allocations.
*
******************************************************************************/
#ifdef ACPI_FUTURE_USAGE
void acpi_ut_dump_allocation_info(void)
{
/*
struct acpi_memory_list *mem_list;
*/
ACPI_FUNCTION_TRACE("ut_dump_allocation_info");
/*
ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
("%30s: %4d (%3d Kb)\n", "Current allocations",
mem_list->current_count,
ROUND_UP_TO_1K (mem_list->current_size)));
ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
("%30s: %4d (%3d Kb)\n", "Max concurrent allocations",
mem_list->max_concurrent_count,
ROUND_UP_TO_1K (mem_list->max_concurrent_size)));
ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
("%30s: %4d (%3d Kb)\n", "Total (all) internal objects",
running_object_count,
ROUND_UP_TO_1K (running_object_size)));
ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
("%30s: %4d (%3d Kb)\n", "Total (all) allocations",
running_alloc_count,
ROUND_UP_TO_1K (running_alloc_size)));
ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
("%30s: %4d (%3d Kb)\n", "Current Nodes",
acpi_gbl_current_node_count,
ROUND_UP_TO_1K (acpi_gbl_current_node_size)));
ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
("%30s: %4d (%3d Kb)\n", "Max Nodes",
acpi_gbl_max_concurrent_node_count,
ROUND_UP_TO_1K ((acpi_gbl_max_concurrent_node_count *
sizeof (struct acpi_namespace_node)))));
*/
return_VOID;
}
#endif /* ACPI_FUTURE_USAGE */
/*******************************************************************************
*
* FUNCTION: acpi_ut_dump_allocations
*
* PARAMETERS: Component - Component(s) to dump info for.
* Module - Module to dump info for. NULL means all.
*
* RETURN: None
*
* DESCRIPTION: Print a list of all outstanding allocations.
*
******************************************************************************/
void acpi_ut_dump_allocations(u32 component, char *module)
{
struct acpi_debug_mem_block *element;
union acpi_descriptor *descriptor;
u32 num_outstanding = 0;
ACPI_FUNCTION_TRACE("ut_dump_allocations");
/*
* Walk the allocation list.
*/
if (ACPI_FAILURE(acpi_ut_acquire_mutex(ACPI_MTX_MEMORY))) {
return;
}
element = acpi_gbl_global_list->list_head;
while (element) {
if ((element->component & component) &&
((module == NULL)
|| (0 == ACPI_STRCMP(module, element->module)))) {
/* Ignore allocated objects that are in a cache */
descriptor =
ACPI_CAST_PTR(union acpi_descriptor,
&element->user_space);
if (descriptor->descriptor_id != ACPI_DESC_TYPE_CACHED) {
acpi_os_printf("%p Len %04X %9.9s-%d [%s] ",
descriptor, element->size,
element->module, element->line,
acpi_ut_get_descriptor_name
(descriptor));
/* Most of the elements will be Operand objects. */
switch (ACPI_GET_DESCRIPTOR_TYPE(descriptor)) {
case ACPI_DESC_TYPE_OPERAND:
acpi_os_printf("%12.12s R%hd",
acpi_ut_get_type_name
(descriptor->object.
common.type),
descriptor->object.
common.reference_count);
break;
case ACPI_DESC_TYPE_PARSER:
acpi_os_printf("aml_opcode %04hX",
descriptor->op.asl.
aml_opcode);
break;
case ACPI_DESC_TYPE_NAMED:
acpi_os_printf("%4.4s",
acpi_ut_get_node_name
(&descriptor->node));
break;
default:
break;
}
acpi_os_printf("\n");
num_outstanding++;
}
}
element = element->next;
}
(void)acpi_ut_release_mutex(ACPI_MTX_MEMORY);
/* Print summary */
if (!num_outstanding) {
ACPI_INFO((AE_INFO, "No outstanding allocations"));
} else {
ACPI_ERROR((AE_INFO,
"%d(%X) Outstanding allocations",
num_outstanding, num_outstanding));
}
return_VOID;
}
#endif /* #ifdef ACPI_DBG_TRACK_ALLOCATIONS */
......@@ -272,9 +272,9 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache)
cache->current_depth--;
ACPI_MEM_TRACKING(cache->hits++);
ACPI_MEM_TRACKING(ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"Object %p from %s cache\n",
object, cache->list_name)));
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"Object %p from %s cache\n", object,
cache->list_name));
status = acpi_ut_release_mutex(ACPI_MTX_CACHES);
if (ACPI_FAILURE(status)) {
......
......@@ -200,8 +200,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
*/
handler_desc = object->region.handler;
if (handler_desc) {
if (handler_desc->address_space.
hflags &
if (handler_desc->address_space.handler_flags &
ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) {
obj_pointer =
second_desc->extra.region_context;
......
......@@ -191,12 +191,14 @@ const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS] = {
"Linux",
"Windows 2000",
"Windows 2001",
"Windows 2001.1",
"Windows 2001 SP0",
"Windows 2001 SP1",
"Windows 2001 SP2",
"Windows 2001 SP3",
"Windows 2001 SP4",
"Windows 2001.1",
"Windows 2001.1 SP1", /* Added 03/2006 */
"Windows 2006", /* Added 03/2006 */
/* Feature Group Strings */
......@@ -633,7 +635,7 @@ char *acpi_ut_get_node_name(void *object)
/* Descriptor must be a namespace node */
if (node->descriptor != ACPI_DESC_TYPE_NAMED) {
if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) {
return ("####");
}
......@@ -855,7 +857,7 @@ void acpi_ut_init_globals(void)
acpi_gbl_root_node = NULL;
acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME;
acpi_gbl_root_node_struct.descriptor = ACPI_DESC_TYPE_NAMED;
acpi_gbl_root_node_struct.descriptor_type = ACPI_DESC_TYPE_NAMED;
acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE;
acpi_gbl_root_node_struct.child = NULL;
acpi_gbl_root_node_struct.peer = NULL;
......
......@@ -881,36 +881,3 @@ acpi_ut_info(char *module_name, u32 line_number, char *format, ...)
acpi_os_vprintf(format, args);
acpi_os_printf(" [%X]\n", ACPI_CA_VERSION);
}
/*******************************************************************************
*
* FUNCTION: acpi_ut_report_error, Warning, Info
*
* PARAMETERS: module_name - Caller's module name (for error output)
* line_number - Caller's line number (for error output)
*
* RETURN: None
*
* DESCRIPTION: Print error message
*
* Note: Legacy only, should be removed when no longer used by drivers.
*
******************************************************************************/
void acpi_ut_report_error(char *module_name, u32 line_number)
{
acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number);
}
void acpi_ut_report_warning(char *module_name, u32 line_number)
{
acpi_os_printf("ACPI Warning (%s-%04d): ", module_name, line_number);
}
void acpi_ut_report_info(char *module_name, u32 line_number)
{
acpi_os_printf("ACPI (%s-%04d): ", module_name, line_number);
}
......@@ -238,6 +238,104 @@ static const u8 acpi_gbl_resource_types[] = {
ACPI_FIXED_LENGTH
};
/*******************************************************************************
*
* FUNCTION: acpi_ut_walk_aml_resources
*
* PARAMETERS: Aml - Pointer to the raw AML resource template
* aml_length - Length of the entire template
* user_function - Called once for each descriptor found. If
* NULL, a pointer to the end_tag is returned
* Context - Passed to user_function
*
* RETURN: Status
*
* DESCRIPTION: Walk a raw AML resource list(buffer). User function called
* once for each resource found.
*
******************************************************************************/
acpi_status
acpi_ut_walk_aml_resources(u8 * aml,
acpi_size aml_length,
acpi_walk_aml_callback user_function, void *context)
{
acpi_status status;
u8 *end_aml;
u8 resource_index;
u32 length;
u32 offset = 0;
ACPI_FUNCTION_TRACE("ut_walk_aml_resources");
/* The absolute minimum resource template is one end_tag descriptor */
if (aml_length < sizeof(struct aml_resource_end_tag)) {
return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
}
/* Point to the end of the resource template buffer */
end_aml = aml + aml_length;
/* Walk the byte list, abort on any invalid descriptor type or length */
while (aml < end_aml) {
/* Validate the Resource Type and Resource Length */
status = acpi_ut_validate_resource(aml, &resource_index);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
/* Get the length of this descriptor */
length = acpi_ut_get_descriptor_length(aml);
/* Invoke the user function */
if (user_function) {
status =
user_function(aml, length, offset, resource_index,
context);
if (ACPI_FAILURE(status)) {
return (status);
}
}
/* An end_tag descriptor terminates this resource template */
if (acpi_ut_get_resource_type(aml) ==
ACPI_RESOURCE_NAME_END_TAG) {
/*
* There must be at least one more byte in the buffer for
* the 2nd byte of the end_tag
*/
if ((aml + 1) >= end_aml) {
return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
}
/* Return the pointer to the end_tag if requested */
if (!user_function) {
*(void **)context = aml;
}
/* Normal exit */
return_ACPI_STATUS(AE_OK);
}
aml += length;
offset += length;
}
/* Did not find an end_tag descriptor */
return (AE_AML_NO_RESOURCE_END_TAG);
}
/*******************************************************************************
*
* FUNCTION: acpi_ut_validate_resource
......@@ -498,61 +596,21 @@ acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc,
u8 ** end_tag)
{
acpi_status status;
u8 *aml;
u8 *end_aml;
ACPI_FUNCTION_TRACE("ut_get_resource_end_tag");
/* Get start and end pointers */
aml = obj_desc->buffer.pointer;
end_aml = aml + obj_desc->buffer.length;
/* Allow a buffer length of zero */
if (!obj_desc->buffer.length) {
*end_tag = aml;
*end_tag = obj_desc->buffer.pointer;
return_ACPI_STATUS(AE_OK);
}
/* Walk the resource template, one descriptor per iteration */
while (aml < end_aml) {
/* Validate the Resource Type and Resource Length */
status = acpi_ut_validate_resource(aml, NULL);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
/* end_tag resource indicates the end of the resource template */
if (acpi_ut_get_resource_type(aml) ==
ACPI_RESOURCE_NAME_END_TAG) {
/*
* There must be at least one more byte in the buffer for
* the 2nd byte of the end_tag
*/
if ((aml + 1) >= end_aml) {
return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
}
/* Return the pointer to the end_tag */
*end_tag = aml;
return_ACPI_STATUS(AE_OK);
}
/*
* Point to the next resource descriptor in the AML buffer. The
* descriptor length is guaranteed to be non-zero by resource
* validation above.
*/
aml += acpi_ut_get_descriptor_length(aml);
}
/* Validate the template and get a pointer to the end_tag */
/* Did not find an end_tag resource descriptor */
status = acpi_ut_walk_aml_resources(obj_desc->buffer.pointer,
obj_desc->buffer.length, NULL,
end_tag);
return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
return_ACPI_STATUS(status);
}
......@@ -162,7 +162,7 @@ union acpi_generic_state *acpi_ut_create_generic_state(void)
/* Initialize */
memset(state, 0, sizeof(union acpi_generic_state));
state->common.data_type = ACPI_DESC_TYPE_STATE;
state->common.descriptor_type = ACPI_DESC_TYPE_STATE;
}
return (state);
......@@ -196,7 +196,7 @@ struct acpi_thread_state *acpi_ut_create_thread_state(void)
/* Init fields specific to the update struct */
state->common.data_type = ACPI_DESC_TYPE_STATE_THREAD;
state->common.descriptor_type = ACPI_DESC_TYPE_STATE_THREAD;
state->thread.thread_id = acpi_os_get_thread_id();
return_PTR((struct acpi_thread_state *)state);
......@@ -233,7 +233,7 @@ union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object
/* Init fields specific to the update struct */
state->common.data_type = ACPI_DESC_TYPE_STATE_UPDATE;
state->common.descriptor_type = ACPI_DESC_TYPE_STATE_UPDATE;
state->update.object = object;
state->update.value = action;
......@@ -270,7 +270,7 @@ union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object,
/* Init fields specific to the update struct */
state->common.data_type = ACPI_DESC_TYPE_STATE_PACKAGE;
state->common.descriptor_type = ACPI_DESC_TYPE_STATE_PACKAGE;
state->pkg.source_object = (union acpi_operand_object *)internal_object;
state->pkg.dest_object = external_object;
state->pkg.index = index;
......@@ -307,7 +307,7 @@ union acpi_generic_state *acpi_ut_create_control_state(void)
/* Init fields specific to the control struct */
state->common.data_type = ACPI_DESC_TYPE_STATE_CONTROL;
state->common.descriptor_type = ACPI_DESC_TYPE_STATE_CONTROL;
state->common.state = ACPI_CONTROL_CONDITIONAL_EXECUTING;
return_PTR(state);
......
......@@ -63,7 +63,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
#define ACPI_CA_VERSION 0x20060310
#define ACPI_CA_VERSION 0x20060317
/*
* OS name, used for the _OS object. The _OS object is essentially obsolete,
......@@ -81,6 +81,7 @@
#define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */
#define ACPI_MAX_EXTPARSE_CACHE_DEPTH 96 /* Parse tree objects */
#define ACPI_MAX_OBJECT_CACHE_DEPTH 96 /* Interpreter operand objects */
#define ACPI_MAX_NAMESPACE_CACHE_DEPTH 96 /* Namespace objects */
/*
* Should the subsystem abort the loading of an ACPI table if the
......@@ -189,7 +190,7 @@
/* Number of strings associated with the _OSI reserved method */
#define ACPI_NUM_OSI_STRINGS 10
#define ACPI_NUM_OSI_STRINGS 12
/******************************************************************************
*
......
......@@ -93,7 +93,7 @@ struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
*/
u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info);
acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback);
acpi_status acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback);
acpi_status
acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
......
......@@ -203,6 +203,7 @@ ACPI_EXTERN struct acpi_memory_list *acpi_gbl_ns_node_list;
/* Object caches */
ACPI_EXTERN acpi_cache_t *acpi_gbl_namespace_cache;
ACPI_EXTERN acpi_cache_t *acpi_gbl_state_cache;
ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_cache;
ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_ext_cache;
......
......@@ -44,7 +44,10 @@
#ifndef __ACLOCAL_H__
#define __ACLOCAL_H__
/* acpisrc:struct_defs -- for acpisrc conversion */
#define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */
#define ACPI_INFINITE_CONCURRENCY 0xFF
typedef void *acpi_mutex;
typedef u32 acpi_mutex_handle;
......@@ -144,6 +147,8 @@ struct acpi_mutex_info {
#define ACPI_FIELD_DWORD_GRANULARITY 4
#define ACPI_FIELD_QWORD_GRANULARITY 8
#define ACPI_ENTRY_NOT_FOUND NULL
/*****************************************************************************
*
* Namespace typedefs and structs
......@@ -158,49 +163,45 @@ typedef enum {
ACPI_IMODE_EXECUTE = 0x0E
} acpi_interpreter_mode;
/*
* The Node describes a named object that appears in the AML
* An acpi_node is used to store Nodes.
*
* data_type is used to differentiate between internal descriptors, and MUST
* be the first byte in this structure.
*/
union acpi_name_union {
u32 integer;
char ascii[4];
};
/*
* The Namespace Node describes a named object that appears in the AML.
* descriptor_type is used to differentiate between internal descriptors.
*
* The node is optimized for both 32-bit and 64-bit platforms:
* 20 bytes for the 32-bit case, 32 bytes for the 64-bit case.
*/
struct acpi_namespace_node {
u8 descriptor; /* Used to differentiate object descriptor types */
u8 type; /* Type associated with this name */
u16 reference_count; /* Current count of references and children */
union acpi_operand_object *object; /* Interpreter object */
u8 descriptor_type; /* Differentiate object descriptor types */
u8 flags; /* Miscellaneous flags */
acpi_owner_id owner_id; /* Node creator */
u8 type; /* ACPI Type associated with this name */
union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */
union acpi_operand_object *object; /* Pointer to attached ACPI object (optional) */
struct acpi_namespace_node *child; /* First child */
struct acpi_namespace_node *peer; /* Next peer */
u8 owner_id; /* Who created this node */
u8 flags;
struct acpi_namespace_node *peer; /* Peer. Parent if ANOBJ_END_OF_PEER_LIST set */
/* Fields used by the ASL compiler and disassembler only */
/* Fields used by the ASL compiler and disassembler only: */
#ifdef ACPI_LARGE_NAMESPACE_NODE
u32 value;
union acpi_parse_object *op;
u32 value;
#endif
};
#define ACPI_ENTRY_NOT_FOUND NULL
/* Node flags */
/* Namespace Node flags */
#define ANOBJ_RESERVED 0x01
#define ANOBJ_END_OF_PEER_LIST 0x02
#define ANOBJ_DATA_WIDTH_32 0x04 /* Parent table is 64-bits */
#define ANOBJ_METHOD_ARG 0x08
#define ANOBJ_METHOD_LOCAL 0x10
#define ANOBJ_METHOD_NO_RETVAL 0x20
#define ANOBJ_METHOD_SOME_NO_RETVAL 0x40
#define ANOBJ_IS_BIT_OFFSET 0x80
#define ANOBJ_END_OF_PEER_LIST 0x01 /* End-of-list, Peer field points to parent */
#define ANOBJ_DATA_WIDTH_32 0x02 /* Parent table uses 32-bit math */
#define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */
#define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */
#define ANOBJ_METHOD_NO_RETVal 0x10 /* i_aSL only: Method has no return value */
#define ANOBJ_METHOD_SOME_NO_RETVal 0x20 /* i_aSL only: Method has at least one return value */
#define ANOBJ_IS_BIT_OFFSet 0x40 /* i_aSL only: Reference is a bit offset */
/*
* ACPI Table Descriptor. One per ACPI table
......@@ -212,8 +213,8 @@ struct acpi_table_desc {
struct acpi_table_header *pointer;
u8 *aml_start;
u64 physical_address;
u32 aml_length;
acpi_size length;
u32 aml_length;
acpi_owner_id owner_id;
u8 type;
u8 allocation;
......@@ -276,6 +277,9 @@ struct acpi_create_field_info {
u8 field_type;
};
typedef
acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state);
/*
* Bitmapped ACPI types. Used internally only
*/
......@@ -377,7 +381,7 @@ struct acpi_gpe_walk_info {
struct acpi_gpe_block_info *gpe_block;
};
typedef acpi_status(*ACPI_GPE_CALLBACK) (struct acpi_gpe_xrupt_info *
typedef acpi_status(*acpi_gpe_callback) (struct acpi_gpe_xrupt_info *
gpe_xrupt_info,
struct acpi_gpe_block_info *
gpe_block);
......@@ -416,13 +420,14 @@ struct acpi_field_info {
#define ACPI_CONTROL_PREDICATE_FALSE 0xC3
#define ACPI_CONTROL_PREDICATE_TRUE 0xC4
#define ACPI_STATE_COMMON /* Two 32-bit fields and a pointer */\
u8 data_type; /* To differentiate various internal objs */\
u8 flags; \
u16 value; \
u16 state; \
u16 reserved; \
void *next;
#define ACPI_STATE_COMMON \
void *next; \
u8 descriptor_type; /* To differentiate various internal objs */\
u8 flags; \
u16 value; \
u16 state;
/* There are 2 bytes available here until the next natural alignment boundary */
struct acpi_common_state {
ACPI_STATE_COMMON};
......@@ -438,12 +443,12 @@ struct acpi_update_state {
* Pkg state - used to traverse nested package structures
*/
struct acpi_pkg_state {
ACPI_STATE_COMMON union acpi_operand_object *source_object;
ACPI_STATE_COMMON u16 index;
union acpi_operand_object *source_object;
union acpi_operand_object *dest_object;
struct acpi_walk_state *walk_state;
void *this_target_obj;
u32 num_packages;
u16 index;
};
/*
......@@ -451,10 +456,10 @@ struct acpi_pkg_state {
* Allows nesting of these constructs
*/
struct acpi_control_state {
ACPI_STATE_COMMON union acpi_parse_object *predicate_op;
ACPI_STATE_COMMON u16 opcode;
union acpi_parse_object *predicate_op;
u8 *aml_predicate_start; /* Start of if/while predicate */
u8 *package_end; /* End of if/while block */
u16 opcode;
};
/*
......@@ -465,11 +470,11 @@ struct acpi_scope_state {
};
struct acpi_pscope_state {
ACPI_STATE_COMMON union acpi_parse_object *op; /* Current op being parsed */
ACPI_STATE_COMMON u8 arg_count; /* Number of fixed arguments */
union acpi_parse_object *op; /* Current op being parsed */
u8 *arg_end; /* Current argument end */
u8 *pkg_end; /* Current package end */
u32 arg_list; /* Next argument to parse */
u32 arg_count; /* Number of fixed arguments */
};
/*
......@@ -477,10 +482,10 @@ struct acpi_pscope_state {
* states are created when there are nested control methods executing.
*/
struct acpi_thread_state {
ACPI_STATE_COMMON struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */
ACPI_STATE_COMMON u8 current_sync_level; /* Mutex Sync (nested acquire) level */
struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */
union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */
acpi_thread_id thread_id; /* Running thread ID */
u8 current_sync_level; /* Mutex Sync (nested acquire) level */
};
/*
......@@ -488,10 +493,9 @@ struct acpi_thread_state {
* AML arguments
*/
struct acpi_result_values {
ACPI_STATE_COMMON
union acpi_operand_object *obj_desc[ACPI_OBJ_NUM_OPERANDS];
u8 num_results;
ACPI_STATE_COMMON u8 num_results;
u8 last_insert;
union acpi_operand_object *obj_desc[ACPI_OBJ_NUM_OPERANDS];
};
typedef
......@@ -546,7 +550,7 @@ struct acpi_opcode_info {
#endif
u32 parse_args; /* Grammar/Parse time arguments */
u32 runtime_args; /* Interpret time arguments */
u32 flags; /* Misc flags */
u16 flags; /* Misc flags */
u8 object_type; /* Corresponding internal object type */
u8 class; /* Opcode class */
u8 type; /* Opcode type */
......@@ -563,29 +567,28 @@ union acpi_parse_value {
};
#define ACPI_PARSE_COMMON \
u8 data_type; /* To differentiate various internal objs */\
u8 flags; /* Type of Op */\
u16 aml_opcode; /* AML opcode */\
u32 aml_offset; /* Offset of declaration in AML */\
union acpi_parse_object *parent; /* Parent op */\
union acpi_parse_object *next; /* Next op */\
union acpi_parse_object *parent; /* Parent op */\
u8 descriptor_type; /* To differentiate various internal objs */\
u8 flags; /* Type of Op */\
u16 aml_opcode; /* AML opcode */\
u32 aml_offset; /* Offset of declaration in AML */\
union acpi_parse_object *next; /* Next op */\
struct acpi_namespace_node *node; /* For use by interpreter */\
union acpi_parse_value value; /* Value or args associated with the opcode */\
ACPI_DISASM_ONLY_MEMBERS (\
u8 disasm_flags; /* Used during AML disassembly */\
u8 disasm_opcode; /* Subtype used for disassembly */\
char aml_op_name[16]) /* Op name (debug only) */\
/* NON-DEBUG members below: */\
struct acpi_namespace_node *node; /* For use by interpreter */\
union acpi_parse_value value; /* Value or args associated with the opcode */
#define ACPI_DASM_BUFFER 0x00
#define ACPI_DASM_RESOURCE 0x01
#define ACPI_DASM_STRING 0x02
#define ACPI_DASM_UNICODE 0x03
#define ACPI_DASM_EISAID 0x04
#define ACPI_DASM_MATCHOP 0x05
u8 disasm_flags; /* Used during AML disassembly */\
u8 disasm_opcode; /* Subtype used for disassembly */\
char aml_op_name[16]) /* Op name (debug only) */
#define ACPI_DASM_BUFFER 0x00
#define ACPI_DASM_RESOURCE 0x01
#define ACPI_DASM_STRING 0x02
#define ACPI_DASM_UNICODE 0x03
#define ACPI_DASM_EISAID 0x04
#define ACPI_DASM_MATCHOP 0x05
/*
* generic operation (for example: If, While, Store)
* Generic operation (for example: If, While, Store)
*/
struct acpi_parse_obj_common {
ACPI_PARSE_COMMON};
......@@ -601,7 +604,7 @@ struct acpi_parse_obj_named {
u32 name; /* 4-byte name or zero if no name */
};
/* The parse node is the fundamental element of the parse tree */
/* this version is used by the i_aSL compiler only */
#define ACPI_MAX_PARSEOP_NAME 20
......@@ -643,7 +646,6 @@ union acpi_parse_object {
* method.
*/
struct acpi_parse_state {
u32 aml_size;
u8 *aml_start; /* First AML byte */
u8 *aml; /* Next AML byte */
u8 *aml_end; /* (last + 1) AML byte */
......@@ -653,22 +655,23 @@ struct acpi_parse_state {
struct acpi_namespace_node *start_node;
union acpi_generic_state *scope; /* Current scope */
union acpi_parse_object *start_scope;
u32 aml_size;
};
/* Parse object flags */
#define ACPI_PARSEOP_GENERIC 0x01
#define ACPI_PARSEOP_NAMED 0x02
#define ACPI_PARSEOP_DEFERRED 0x04
#define ACPI_PARSEOP_BYTELIST 0x08
#define ACPI_PARSEOP_IN_CACHE 0x80
#define ACPI_PARSEOP_GENERIC 0x01
#define ACPI_PARSEOP_NAMED 0x02
#define ACPI_PARSEOP_DEFERRED 0x04
#define ACPI_PARSEOP_BYTELIST 0x08
#define ACPI_PARSEOP_IN_CACHE 0x80
/* Parse object disasm_flags */
#define ACPI_PARSEOP_IGNORE 0x01
#define ACPI_PARSEOP_PARAMLIST 0x02
#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04
#define ACPI_PARSEOP_SPECIAL 0x10
#define ACPI_PARSEOP_IGNORE 0x01
#define ACPI_PARSEOP_PARAMLIST 0x02
#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04
#define ACPI_PARSEOP_SPECIAL 0x10
/*****************************************************************************
*
......@@ -676,8 +679,8 @@ struct acpi_parse_state {
*
****************************************************************************/
#define PCI_ROOT_HID_STRING "PNP0A03"
#define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08"
#define PCI_ROOT_HID_STRING "PNP0A03"
#define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08"
struct acpi_bit_register_info {
u8 parent_register;
......@@ -710,13 +713,14 @@ struct acpi_bit_register_info {
#define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */
#define ACPI_BITMASK_WAKE_STATUS 0x8000
#define ACPI_BITMASK_ALL_FIXED_STATUS (ACPI_BITMASK_TIMER_STATUS | \
ACPI_BITMASK_BUS_MASTER_STATUS | \
ACPI_BITMASK_GLOBAL_LOCK_STATUS | \
ACPI_BITMASK_POWER_BUTTON_STATUS | \
ACPI_BITMASK_SLEEP_BUTTON_STATUS | \
ACPI_BITMASK_RT_CLOCK_STATUS | \
ACPI_BITMASK_WAKE_STATUS)
#define ACPI_BITMASK_ALL_FIXED_STATUS (\
ACPI_BITMASK_TIMER_STATUS | \
ACPI_BITMASK_BUS_MASTER_STATUS | \
ACPI_BITMASK_GLOBAL_LOCK_STATUS | \
ACPI_BITMASK_POWER_BUTTON_STATUS | \
ACPI_BITMASK_SLEEP_BUTTON_STATUS | \
ACPI_BITMASK_RT_CLOCK_STATUS | \
ACPI_BITMASK_WAKE_STATUS)
#define ACPI_BITMASK_TIMER_ENABLE 0x0001
#define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020
......@@ -820,7 +824,7 @@ struct acpi_bit_register_info {
*
****************************************************************************/
#define ACPI_ASCII_ZERO 0x30
#define ACPI_ASCII_ZERO 0x30
/*****************************************************************************
*
......@@ -842,9 +846,9 @@ struct acpi_integrity_info {
u32 objects;
};
#define ACPI_DB_REDIRECTABLE_OUTPUT 0x01
#define ACPI_DB_CONSOLE_OUTPUT 0x02
#define ACPI_DB_DUPLICATE_OUTPUT 0x03
#define ACPI_DB_REDIRECTABLE_OUTPUT 0x01
#define ACPI_DB_CONSOLE_OUTPUT 0x02
#define ACPI_DB_DUPLICATE_OUTPUT 0x03
/*****************************************************************************
*
......@@ -854,18 +858,18 @@ struct acpi_integrity_info {
/* Entry for a memory allocation (debug only) */
#define ACPI_MEM_MALLOC 0
#define ACPI_MEM_CALLOC 1
#define ACPI_MAX_MODULE_NAME 16
#define ACPI_MEM_MALLOC 0
#define ACPI_MEM_CALLOC 1
#define ACPI_MAX_MODULE_NAME 16
#define ACPI_COMMON_DEBUG_MEM_HEADER \
struct acpi_debug_mem_block *previous; \
struct acpi_debug_mem_block *next; \
u32 size; \
u32 component; \
u32 line; \
char module[ACPI_MAX_MODULE_NAME]; \
u8 alloc_type;
struct acpi_debug_mem_block *previous; \
struct acpi_debug_mem_block *next; \
u32 size; \
u32 component; \
u32 line; \
char module[ACPI_MAX_MODULE_NAME]; \
u8 alloc_type;
struct acpi_debug_mem_header {
ACPI_COMMON_DEBUG_MEM_HEADER};
......
......@@ -400,8 +400,8 @@
*
* The "Descriptor" field is the first field in both structures.
*/
#define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->descriptor_id)
#define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((union acpi_descriptor *)(void *)(d))->descriptor_id = t)
#define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type)
#define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type = t)
/* Macro to test the object type */
......@@ -490,7 +490,6 @@
#define ACPI_ERROR(plist)
#define ACPI_ERROR_NAMESPACE(s,e)
#define ACPI_ERROR_METHOD(s,n,p,e)
#endif
/*
......@@ -532,13 +531,13 @@
#endif
#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \
acpi_ut_trace(ACPI_DEBUG_PARAMETERS)
acpi_ut_trace(ACPI_DEBUG_PARAMETERS)
#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \
acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS,(void *)b)
acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS,(void *)b)
#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \
acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS,(u32)b)
acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS,(u32)b)
#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \
acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS,(char *)b)
acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS,(char *)b)
#define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr()
......@@ -658,6 +657,7 @@
#define ACPI_DUMP_STACK_ENTRY(a)
#define ACPI_DUMP_OPERANDS(a,b,c,d,e)
#define ACPI_DUMP_ENTRY(a,b)
#define ACPI_DUMP_TABLES(a,b)
#define ACPI_DUMP_PATHNAME(a,b,c,d)
#define ACPI_DUMP_RESOURCE_LIST(a)
#define ACPI_DUMP_BUFFER(a,b)
......@@ -714,7 +714,7 @@
/* Memory allocation */
#define ACPI_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__)
#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_callocate((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__)
#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__)
#define ACPI_FREE(a) acpi_os_free(a)
#define ACPI_MEM_TRACKING(a)
......@@ -723,9 +723,9 @@
/* Memory allocation */
#define ACPI_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__)
#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_callocate_and_track((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__)
#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed_and_track((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__)
#define ACPI_FREE(a) acpi_ut_free_and_track(a,_COMPONENT,_acpi_module_name,__LINE__)
#define ACPI_MEM_TRACKING(a) a
#define ACPI_MEM_TRACKING(a) a
#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
......
/******************************************************************************
*
* Name: acobject.h - Definition of union acpi_operand_object (Internal object only)
* Name: acobject.h - Definition of union acpi_operand_object (Internal object only)
*
*****************************************************************************/
......@@ -45,10 +45,12 @@
#ifndef _ACOBJECT_H
#define _ACOBJECT_H
/* acpisrc:struct_defs -- for acpisrc conversion */
/*
* The union acpi_operand_object is used to pass AML operands from the dispatcher
* The union acpi_operand_object is used to pass AML operands from the dispatcher
* to the interpreter, and to keep track of the various handlers such as
* address space handlers and notify handlers. The object is a constant
* address space handlers and notify handlers. The object is a constant
* size in order to allow it to be cached and reused.
*/
......@@ -61,17 +63,21 @@
/*
* Common area for all objects.
*
* data_type is used to differentiate between internal descriptors, and MUST
* be the first byte in this structure.
* descriptor_type is used to differentiate between internal descriptors, and
* must be in the same place across all descriptors
*/
#define ACPI_OBJECT_COMMON_HEADER /* SIZE/ALIGNMENT: 32 bits, one ptr plus trailing 8-bit flag */\
u8 descriptor; /* To differentiate various internal objs */\
u8 type; /* acpi_object_type */\
u16 reference_count; /* For object deletion management */\
union acpi_operand_object *next_object; /* Objects linked to parent NS node */\
u8 flags;
/* Values for flag byte above */
#define ACPI_OBJECT_COMMON_HEADER \
union acpi_operand_object *next_object; /* Objects linked to parent NS node */\
u8 descriptor_type; /* To differentiate various internal objs */\
u8 type; /* acpi_object_type */\
u16 reference_count; /* For object deletion management */\
u8 flags;
/*
* Note: There are 3 bytes available here before the
* next natural alignment boundary (for both 32/64 cases)
*/
/* Values for Flag byte above */
#define AOPOBJ_AML_CONSTANT 0x01
#define AOPOBJ_STATIC_POINTER 0x02
......@@ -80,36 +86,6 @@
#define AOPOBJ_SETUP_COMPLETE 0x10
#define AOPOBJ_SINGLE_DATUM 0x20
/*
* Common bitfield for the field objects
* "Field Datum" -- a datum from the actual field object
* "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field
*/
#define ACPI_COMMON_FIELD_INFO /* SIZE/ALIGNMENT: 24 bits + three 32-bit values */\
u8 field_flags; /* Access, update, and lock bits */\
u8 attribute; /* From access_as keyword */\
u8 access_byte_width; /* Read/Write size in bytes */\
u32 bit_length; /* Length of field in bits */\
u32 base_byte_offset; /* Byte offset within containing object */\
u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\
u8 access_bit_width; /* Read/Write size in bits (8-64) */\
u32 value; /* Value to store into the Bank or Index register */\
struct acpi_namespace_node *node; /* Link back to parent node */
/*
* Fields common to both Strings and Buffers
*/
#define ACPI_COMMON_BUFFER_INFO \
u32 length;
/*
* Common fields for objects that support ASL notifications
*/
#define ACPI_COMMON_NOTIFY_INFO \
union acpi_operand_object *system_notify; /* Handler for system notifies */\
union acpi_operand_object *device_notify; /* Handler for driver notifies */\
union acpi_operand_object *handler; /* Handler for Address space */
/******************************************************************************
*
* Basic data types
......@@ -125,25 +101,31 @@ struct acpi_object_integer {
/*
* Note: The String and Buffer object must be identical through the Pointer
* element. There is code that depends on this.
* and length elements. There is code that depends on this.
*
* Fields common to both Strings and Buffers
*/
#define ACPI_COMMON_BUFFER_INFO(_type) \
_type *pointer; \
u32 length;
struct acpi_object_string { /* Null terminated, ASCII characters only */
ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO char *pointer; /* String in AML stream or allocated string */
ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO(char) /* String in AML stream or allocated string */
};
struct acpi_object_buffer {
ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO u8 * pointer; /* Buffer in AML stream or allocated buffer */
struct acpi_namespace_node *node; /* Link back to parent node */
u8 *aml_start;
ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO(u8) /* Buffer in AML stream or allocated buffer */
u32 aml_length;
u8 *aml_start;
struct acpi_namespace_node *node; /* Link back to parent node */
};
struct acpi_object_package {
ACPI_OBJECT_COMMON_HEADER u32 count; /* # of elements in package */
u32 aml_length;
u8 *aml_start;
struct acpi_namespace_node *node; /* Link back to parent node */
ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *node; /* Link back to parent node */
union acpi_operand_object **elements; /* Array of pointers to acpi_objects */
u8 *aml_start;
u32 aml_length;
u32 count; /* # of elements in package */
};
/******************************************************************************
......@@ -156,23 +138,6 @@ struct acpi_object_event {
ACPI_OBJECT_COMMON_HEADER void *semaphore;
};
#define ACPI_INFINITE_CONCURRENCY 0xFF
typedef
acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state);
struct acpi_object_method {
ACPI_OBJECT_COMMON_HEADER u8 method_flags;
u8 param_count;
u32 aml_length;
void *semaphore;
u8 *aml_start;
ACPI_INTERNAL_METHOD implementation;
u8 concurrency;
u8 thread_count;
acpi_owner_id owner_id;
};
struct acpi_object_mutex {
ACPI_OBJECT_COMMON_HEADER u8 sync_level; /* 0-15, specified in Mutex() call */
u16 acquisition_depth; /* Allow multiple Acquires, same thread */
......@@ -186,11 +151,23 @@ struct acpi_object_mutex {
struct acpi_object_region {
ACPI_OBJECT_COMMON_HEADER u8 space_id;
union acpi_operand_object *handler; /* Handler for region access */
struct acpi_namespace_node *node; /* Containing namespace node */
union acpi_operand_object *handler; /* Handler for region access */
union acpi_operand_object *next;
u32 length;
acpi_physical_address address;
u32 length;
};
struct acpi_object_method {
ACPI_OBJECT_COMMON_HEADER u8 method_flags;
u8 param_count;
u8 concurrency;
void *semaphore;
u8 *aml_start;
ACPI_INTERNAL_METHOD implementation;
u32 aml_length;
u8 thread_count;
acpi_owner_id owner_id;
};
/******************************************************************************
......@@ -199,6 +176,14 @@ struct acpi_object_region {
*
*****************************************************************************/
/*
* Common fields for objects that support ASL notifications
*/
#define ACPI_COMMON_NOTIFY_INFO \
union acpi_operand_object *system_notify; /* Handler for system notifies */\
union acpi_operand_object *device_notify; /* Handler for driver notifies */\
union acpi_operand_object *handler; /* Handler for Address space */
struct acpi_object_notify_common { /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */
ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO};
......@@ -213,9 +198,9 @@ struct acpi_object_power_resource {
};
struct acpi_object_processor {
ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO u32 proc_id;
u32 length;
acpi_io_address address;
ACPI_OBJECT_COMMON_HEADER u8 proc_id;
u8 length;
ACPI_COMMON_NOTIFY_INFO acpi_io_address address;
};
struct acpi_object_thermal_zone {
......@@ -227,9 +212,24 @@ ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO};
*
*****************************************************************************/
/*
* Common bitfield for the field objects
* "Field Datum" -- a datum from the actual field object
* "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field
*/
#define ACPI_COMMON_FIELD_INFO \
u8 field_flags; /* Access, update, and lock bits */\
u8 attribute; /* From access_as keyword */\
u8 access_byte_width; /* Read/Write size in bytes */\
struct acpi_namespace_node *node; /* Link back to parent node */\
u32 bit_length; /* Length of field in bits */\
u32 base_byte_offset; /* Byte offset within containing object */\
u32 value; /* Value to store into the Bank or Index register */\
u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\
u8 access_bit_width; /* Read/Write size in bits (8-64) */
struct acpi_object_field_common { /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */
ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Containing Operation Region object */
/* (REGION/BANK fields only) */
ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Parent Operation Region object (REGION/BANK fields only) */
};
struct acpi_object_region_field {
......@@ -269,13 +269,9 @@ struct acpi_object_notify_handler {
void *context;
};
/* Flags for address handler */
#define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x1
struct acpi_object_addr_handler {
ACPI_OBJECT_COMMON_HEADER u8 space_id;
u16 hflags;
u8 handler_flags;
acpi_adr_space_handler handler;
struct acpi_namespace_node *node; /* Parent device */
void *context;
......@@ -284,6 +280,10 @@ struct acpi_object_addr_handler {
union acpi_operand_object *next;
};
/* Flags for address handler (handler_flags) */
#define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x01
/******************************************************************************
*
* Special internal objects
......@@ -297,10 +297,10 @@ struct acpi_object_addr_handler {
struct acpi_object_reference {
ACPI_OBJECT_COMMON_HEADER u8 target_type; /* Used for index_op */
u16 opcode;
u32 offset; /* Used for arg_op, local_op, and index_op */
void *object; /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */
void *object; /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */
struct acpi_namespace_node *node;
union acpi_operand_object **where;
u32 offset; /* Used for arg_op, local_op, and index_op */
};
/*
......@@ -311,12 +311,10 @@ struct acpi_object_reference {
* Currently: Region and field_unit types
*/
struct acpi_object_extra {
ACPI_OBJECT_COMMON_HEADER u8 byte_fill1;
u16 word_fill1;
u32 aml_length;
u8 *aml_start;
struct acpi_namespace_node *method_REG; /* _REG method for this region (if any) */
ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *method_REG; /* _REG method for this region (if any) */
void *region_context; /* Region-specific data */
u8 *aml_start;
u32 aml_length;
};
/* Additional data that can be attached to namespace nodes */
......@@ -391,8 +389,13 @@ union acpi_operand_object {
#define ACPI_DESC_TYPE_NAMED 0x0F
#define ACPI_DESC_TYPE_MAX 0x0F
struct acpi_common_descriptor {
void *common_pointer;
u8 descriptor_type; /* To differentiate various internal objs */
};
union acpi_descriptor {
u8 descriptor_id; /* To differentiate various internal objs */
struct acpi_common_descriptor common;
union acpi_operand_object object;
struct acpi_namespace_node node;
union acpi_parse_object op;
......
......@@ -144,7 +144,7 @@
/*
* These two levels are essentially obsolete, all instances in the
* ACPICA core code have been replaced by REPORT_ERROR and REPORT_WARNING
* ACPICA core code have been replaced by ACPI_ERROR and ACPI_WARNING
* (Kept here because some drivers may still use them)
*/
#define ACPI_DB_ERROR ACPI_DEBUG_LEVEL (ACPI_LV_ERROR)
......
......@@ -48,7 +48,7 @@
/* variable # arguments */
#define ACPI_VAR_ARGS ACPI_UINT32_MAX
#define ACPI_VAR_ARGS ACPI_UINT8_MAX
#define ACPI_PARSE_DELETE_TREE 0x0001
#define ACPI_PARSE_NO_TREE_DELETE 0x0000
......@@ -146,13 +146,12 @@ u8 acpi_ps_has_completed_scope(struct acpi_parse_state *parser_state);
void
acpi_ps_pop_scope(struct acpi_parse_state *parser_state,
union acpi_parse_object **op,
u32 * arg_list, u32 * arg_count);
union acpi_parse_object **op, u32 * arg_list, u8 * arg_count);
acpi_status
acpi_ps_push_scope(struct acpi_parse_state *parser_state,
union acpi_parse_object *op,
u32 remaining_args, u32 arg_count);
u32 remaining_args, u8 arg_count);
void acpi_ps_cleanup_scope(struct acpi_parse_state *state);
......
......@@ -268,7 +268,7 @@ acpi_status acpi_remove_gpe_block(acpi_handle gpe_device);
* Resource interfaces
*/
typedef
acpi_status(*ACPI_WALK_RESOURCE_CALLBACK) (struct acpi_resource * resource,
acpi_status(*acpi_walk_resource_callback) (struct acpi_resource * resource,
void *context);
acpi_status
......@@ -290,7 +290,7 @@ acpi_get_possible_resources(acpi_handle device_handle,
acpi_status
acpi_walk_resources(acpi_handle device_handle,
char *name,
ACPI_WALK_RESOURCE_CALLBACK user_function, void *context);
acpi_walk_resource_callback user_function, void *context);
acpi_status
acpi_set_current_resources(acpi_handle device_handle,
......
......@@ -198,8 +198,9 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
acpi_size * buffer_size_needed);
acpi_status
acpi_rs_convert_aml_to_resources(u8 * aml_buffer,
u32 aml_buffer_length, u8 * output_buffer);
acpi_rs_convert_aml_to_resources(u8 * aml,
u32 length,
u32 offset, u8 resource_index, void **context);
acpi_status
acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
......
......@@ -44,6 +44,8 @@
#ifndef __ACSTRUCT_H__
#define __ACSTRUCT_H__
/* acpisrc:struct_defs -- for acpisrc conversion */
/*****************************************************************************
*
* Tree walking typedefs and structs
......@@ -64,54 +66,55 @@
#define ACPI_WALK_CONST_OPTIONAL 4
struct acpi_walk_state {
u8 data_type; /* To differentiate various internal objs MUST BE FIRST! */
struct acpi_walk_state *next; /* Next walk_state in list */
u8 descriptor_type; /* To differentiate various internal objs */
u8 walk_type;
acpi_owner_id owner_id; /* Owner of objects created during the walk */
u8 last_predicate; /* Result of last predicate */
u8 current_result; /* */
u16 opcode; /* Current AML opcode */
u8 next_op_info; /* Info about next_op */
u8 num_operands; /* Stack pointer for Operands[] array */
acpi_owner_id owner_id; /* Owner of objects created during the walk */
u8 last_predicate; /* Result of last predicate */
u8 current_result;
u8 return_used;
u16 opcode; /* Current AML opcode */
u8 scope_depth;
u8 pass_number; /* Parse pass during table load */
u32 arg_count; /* push for fixed or var args */
u32 aml_offset;
u32 arg_types;
u32 method_breakpoint; /* For single stepping */
u32 user_breakpoint; /* User AML breakpoint */
u32 parse_flags;
struct acpi_parse_state parser_state; /* Current state of parser */
u32 prev_arg_types;
u8 arg_count; /* push for fixed or var args */
u8 *aml_last_while;
struct acpi_namespace_node arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */
struct acpi_namespace_node local_variables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */
union acpi_operand_object *operands[ACPI_OBJ_NUM_OPERANDS + 1]; /* Operands passed to the interpreter (+1 for NULL terminator) */
union acpi_operand_object **params;
u8 *aml_last_while;
union acpi_operand_object **caller_return_desc;
union acpi_generic_state *control_state; /* List of control states (nested IFs) */
struct acpi_namespace_node *deferred_node; /* Used when executing deferred opcodes */
struct acpi_gpe_event_info *gpe_event_info; /* Info for GPE (_Lxx/_Exx methods only */
union acpi_operand_object *implicit_return_obj;
struct acpi_namespace_node local_variables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */
struct acpi_namespace_node *method_call_node; /* Called method Node */
union acpi_parse_object *method_call_op; /* method_call Op if running a method */
union acpi_operand_object *method_desc; /* Method descriptor if running a method */
struct acpi_namespace_node *method_node; /* Method node if running a method. */
union acpi_parse_object *op; /* Current parser op */
union acpi_operand_object *operands[ACPI_OBJ_NUM_OPERANDS + 1]; /* Operands passed to the interpreter (+1 for NULL terminator) */
const struct acpi_opcode_info *op_info; /* Info on current opcode */
union acpi_parse_object *origin; /* Start of walk [Obsolete] */
union acpi_operand_object **params;
struct acpi_parse_state parser_state; /* Current state of parser */
union acpi_operand_object *result_obj;
union acpi_generic_state *results; /* Stack of accumulated results */
union acpi_operand_object *return_desc; /* Return object, if any */
union acpi_generic_state *scope_info; /* Stack of nested scopes */
union acpi_parse_object *prev_op; /* Last op that was processed */
union acpi_parse_object *next_op; /* next op to be processed */
struct acpi_thread_state *thread;
acpi_parse_downwards descending_callback;
acpi_parse_upwards ascending_callback;
struct acpi_thread_state *thread;
struct acpi_walk_state *next; /* Next walk_state in list */
};
/* Info used by acpi_ps_init_objects */
......@@ -151,11 +154,11 @@ struct acpi_walk_info {
/* Display Types */
#define ACPI_DISPLAY_SUMMARY (u8) 0
#define ACPI_DISPLAY_OBJECTS (u8) 1
#define ACPI_DISPLAY_MASK (u8) 1
#define ACPI_DISPLAY_SUMMARY (u8) 0
#define ACPI_DISPLAY_OBJECTS (u8) 1
#define ACPI_DISPLAY_MASK (u8) 1
#define ACPI_DISPLAY_SHORT (u8) 2
#define ACPI_DISPLAY_SHORT (u8) 2
struct acpi_get_devices_info {
acpi_walk_callback user_function;
......
......@@ -44,6 +44,8 @@
#ifndef __ACTYPES_H__
#define __ACTYPES_H__
/* acpisrc:struct_defs -- for acpisrc conversion */
/*
* ACPI_MACHINE_WIDTH must be specified in an OS- or compiler-dependent header
* and must be either 16, 32, or 64
......@@ -250,7 +252,7 @@ typedef acpi_native_uint acpi_size;
/* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */
#ifndef acpi_uintptr_t
#define acpi_uintptr_t void *
#define acpi_uintptr_t void *
#endif
/*
......@@ -259,7 +261,7 @@ typedef acpi_native_uint acpi_size;
* manager implementation is to be used (ACPI_USE_LOCAL_CACHE)
*/
#ifndef acpi_cache_t
#define acpi_cache_t struct acpi_memory_list
#define acpi_cache_t struct acpi_memory_list
#endif
/*
......@@ -267,7 +269,7 @@ typedef acpi_native_uint acpi_size;
* lock and unlock OSL interfaces.
*/
#ifndef acpi_cpu_flags
#define acpi_cpu_flags acpi_native_uint
#define acpi_cpu_flags acpi_native_uint
#endif
/*
......@@ -300,7 +302,7 @@ typedef acpi_native_uint acpi_size;
* thread_id is returned by acpi_os_get_thread_id.
*/
#ifndef acpi_thread_id
#define acpi_thread_id acpi_native_uint
#define acpi_thread_id acpi_native_uint
#endif
/*******************************************************************************
......@@ -869,7 +871,7 @@ acpi_status(*acpi_adr_space_handler) (u32 function,
void *handler_context,
void *region_context);
#define ACPI_DEFAULT_HANDLER NULL
#define ACPI_DEFAULT_HANDLER NULL
typedef
acpi_status(*acpi_adr_space_setup) (acpi_handle region_handle,
......@@ -926,8 +928,8 @@ struct acpi_compatible_id_list {
#define ACPI_STA_BATTERY_PRESENT 0x10
#define ACPI_COMMON_OBJ_INFO \
acpi_object_type type; /* ACPI object type */ \
acpi_name name /* ACPI object Name */
acpi_object_type type; /* ACPI object type */ \
acpi_name name /* ACPI object Name */
struct acpi_obj_info_header {
ACPI_COMMON_OBJ_INFO;
......@@ -1182,12 +1184,12 @@ struct acpi_resource_source {
/* Fields common to all address descriptors, 16/32/64 bit */
#define ACPI_RESOURCE_ADDRESS_COMMON \
u8 resource_type; \
u8 producer_consumer; \
u8 decode; \
u8 min_address_fixed; \
u8 max_address_fixed; \
union acpi_resource_attribute info;
u8 resource_type; \
u8 producer_consumer; \
u8 decode; \
u8 min_address_fixed; \
u8 max_address_fixed; \
union acpi_resource_attribute info;
struct acpi_resource_address {
ACPI_RESOURCE_ADDRESS_COMMON};
......@@ -1308,10 +1310,6 @@ struct acpi_resource {
#define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length)
/*
* END: of definitions for Resource Attributes
*/
struct acpi_pci_routing_table {
u32 length;
u32 pin;
......@@ -1320,8 +1318,4 @@ struct acpi_pci_routing_table {
char source[4]; /* pad to 64 bits so sizeof() works in all cases */
};
/*
* END: of definitions for PCI Routing tables
*/
#endif /* __ACTYPES_H__ */
......@@ -77,6 +77,12 @@ extern const char *acpi_gbl_TYPdecode[4];
#define ACPI_VARIABLE_LENGTH 2
#define ACPI_SMALL_VARIABLE_LENGTH 3
typedef
acpi_status(*acpi_walk_aml_callback) (u8 * aml,
u32 length,
u32 offset,
u8 resource_index, void *context);
typedef
acpi_status(*acpi_pkg_callback) (u8 object_type,
union acpi_operand_object * source_object,
......@@ -469,6 +475,25 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer);
#define ACPI_ANY_BASE 0
u32 acpi_ut_dword_byte_swap(u32 value);
void acpi_ut_set_integer_width(u8 revision);
#ifdef ACPI_DEBUG_OUTPUT
void
acpi_ut_display_init_pathname(u8 type,
struct acpi_namespace_node *obj_handle,
char *path);
#endif
/*
* utresrc
*/
acpi_status
acpi_ut_walk_aml_resources(u8 * aml,
acpi_size aml_length,
acpi_walk_aml_callback user_function, void *context);
acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index);
u32 acpi_ut_get_descriptor_length(void *aml);
......@@ -483,18 +508,6 @@ acpi_status
acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc,
u8 ** end_tag);
u32 acpi_ut_dword_byte_swap(u32 value);
void acpi_ut_set_integer_width(u8 revision);
#ifdef ACPI_DEBUG_OUTPUT
void
acpi_ut_display_init_pathname(u8 type,
struct acpi_namespace_node *obj_handle,
char *path);
#endif
/*
* utmutex - mutex support
*/
......@@ -521,14 +534,15 @@ acpi_ut_initialize_buffer(struct acpi_buffer *buffer,
void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line);
void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line);
void *acpi_ut_allocate_zeroed(acpi_size size,
u32 component, char *module, u32 line);
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
void *acpi_ut_allocate_and_track(acpi_size size,
u32 component, char *module, u32 line);
void *acpi_ut_callocate_and_track(acpi_size size,
u32 component, char *module, u32 line);
void *acpi_ut_allocate_zeroed_and_track(acpi_size size,
u32 component, char *module, u32 line);
void
acpi_ut_free_and_track(void *address, u32 component, char *module, u32 line);
......@@ -538,6 +552,11 @@ void acpi_ut_dump_allocation_info(void);
#endif /* ACPI_FUTURE_USAGE */
void acpi_ut_dump_allocations(u32 component, char *module);
acpi_status
acpi_ut_create_list(char *list_name,
u16 object_size, struct acpi_memory_list **return_cache);
#endif
#endif /* _ACUTILS_H */
......@@ -42,9 +42,17 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
/* acpisrc:struct_defs -- for acpisrc conversion */
#ifndef __AMLRESRC_H
#define __AMLRESRC_H
/*! [Begin] no source code translation */
/*
* Resource descriptor tags, as defined in the ACPI specification.
* Used to symbolically reference fields within a descriptor.
*/
#define ACPI_RESTAG_ADDRESS "_ADR"
#define ACPI_RESTAG_ALIGNMENT "_ALN"
#define ACPI_RESTAG_ADDRESSSPACE "_ASI"
......@@ -57,12 +65,12 @@
#define ACPI_RESTAG_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */
#define ACPI_RESTAG_GRANULARITY "_GRA"
#define ACPI_RESTAG_INTERRUPT "_INT"
#define ACPI_RESTAG_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */
#define ACPI_RESTAG_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */
#define ACPI_RESTAG_INTERRUPTLEVEL "_LL_" /* ActiveLo(1), ActiveHi(0) */
#define ACPI_RESTAG_INTERRUPTSHARE "_SHR" /* Shareable(1), NoShare(0) */
#define ACPI_RESTAG_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */
#define ACPI_RESTAG_LENGTH "_LEN"
#define ACPI_RESTAG_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */
#define ACPI_RESTAG_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */
#define ACPI_RESTAG_MEMTYPE "_MEM" /* NonCache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */
#define ACPI_RESTAG_MAXADDR "_MAX"
#define ACPI_RESTAG_MINADDR "_MIN"
#define ACPI_RESTAG_MAXTYPE "_MAF"
......@@ -70,11 +78,12 @@
#define ACPI_RESTAG_REGISTERBITOFFSET "_RBO"
#define ACPI_RESTAG_REGISTERBITWIDTH "_RBW"
#define ACPI_RESTAG_RANGETYPE "_RNG"
#define ACPI_RESTAG_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */
#define ACPI_RESTAG_READWRITETYPE "_RW_" /* ReadOnly(0), Writeable (1) */
#define ACPI_RESTAG_TRANSLATION "_TRA"
#define ACPI_RESTAG_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */
#define ACPI_RESTAG_TYPE "_TTP" /* Translation(1), Static (0) */
#define ACPI_RESTAG_XFERTYPE "_SIz" /* 8(0), 8_and16(1), 16(2) */
#define ACPI_RESTAG_XFERTYPE "_SIZ" /* 8(0), 8And16(1), 16(2) */
/*! [End] no source code translation !*/
/* Default sizes for "small" resource descriptors */
......@@ -109,7 +118,7 @@ struct asl_resource_node {
* SMALL descriptors
*/
#define AML_RESOURCE_SMALL_HEADER_COMMON \
u8 descriptor_type;
u8 descriptor_type;
struct aml_resource_small_header {
AML_RESOURCE_SMALL_HEADER_COMMON};
......@@ -162,8 +171,8 @@ struct aml_resource_end_tag {
* LARGE descriptors
*/
#define AML_RESOURCE_LARGE_HEADER_COMMON \
u8 descriptor_type;\
u16 resource_length;
u8 descriptor_type;\
u16 resource_length;
struct aml_resource_large_header {
AML_RESOURCE_LARGE_HEADER_COMMON};
......@@ -194,9 +203,9 @@ struct aml_resource_fixed_memory32 {
};
#define AML_RESOURCE_ADDRESS_COMMON \
u8 resource_type; \
u8 flags; \
u8 specific_flags;
u8 resource_type; \
u8 flags; \
u8 specific_flags;
struct aml_resource_address {
AML_RESOURCE_LARGE_HEADER_COMMON AML_RESOURCE_ADDRESS_COMMON};
......
......@@ -70,6 +70,7 @@
#define ACPI_DEBUGGER
#define ACPI_DISASSEMBLER
#define ACPI_MUTEX_DEBUG
#define ACPI_DBG_TRACK_ALLOCATIONS
#endif
#ifdef ACPI_ASL_COMPILER
......@@ -165,17 +166,6 @@
#endif
/*
* Memory allocation tracking. Used only if
* 1) This is the debug version
* 2) This is NOT a 16-bit version of the code (not enough real-mode memory)
*/
#ifdef ACPI_DEBUG_OUTPUT
#if ACPI_MACHINE_WIDTH != 16
#define ACPI_DBG_TRACK_ALLOCATIONS
#endif
#endif
/*! [End] no source code translation !*/
/*
......
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