This is the update to the core interpreter code.
#
# Makefile for all Linux ACPI interpreter subdirectories
-# EXCEPT for the ospm directory
#
O_TARGET := $(notdir $(CURDIR)).o
-obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c))
+obj-$(CONFIG_ACPI_INTERPRETER) := $(patsubst %.c,%.o,$(wildcard *.c))
EXTRA_CFLAGS += $(ACPI_CFLAGS)
/*******************************************************************************
*
* Module Name: dbcmds - debug commands and output routines
- * $Revision: 66 $
+ * $Revision: 79 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#ifdef ENABLE_DEBUGGER
#define _COMPONENT ACPI_DEBUGGER
- MODULE_NAME ("dbcmds")
+ ACPI_MODULE_NAME ("dbcmds")
/*
* DESCRIPTION: Check if this namespace object refers to the target object
* that is passed in as the context value.
*
+ * Note: Currently doesn't check subobjects within the Node's object
+ *
******************************************************************************/
acpi_status
/* Check for match against the object attached to the node */
- if (node->object == obj_desc) {
+ if (acpi_ns_get_attached_object (node) == obj_desc) {
acpi_os_printf ("Reference at Node->Object %p [%4.4s]\n", node, &node->name);
}
- /* Check first child for a match */
- /* TBD: [Investigate] probably now obsolete with new datastructure */
-
- if (node->child == (void *) obj_desc) {
- acpi_os_printf ("Reference at Node->Child %p [%4.4s]\n", node, &node->name);
- }
-
return (AE_OK);
}
/* Convert string to object pointer */
- obj_desc = (acpi_operand_object *) STRTOUL (object_arg, NULL, 16);
+ obj_desc = ACPI_TO_POINTER (ACPI_STRTOUL (object_arg, NULL, 16));
/* Search all nodes in namespace */
/* Search all tables for the target type */
for (i = 0; i < NUM_ACPI_TABLES; i++) {
- if (!STRNCMP (table_arg, acpi_gbl_acpi_table_data[i].signature,
+ if (!ACPI_STRNCMP (table_arg, acpi_gbl_acpi_table_data[i].signature,
acpi_gbl_acpi_table_data[i].sig_length)) {
/* Found the table, unload it */
/* Get and verify the breakpoint address */
- address = STRTOUL (location, NULL, 16);
+ address = ACPI_STRTOUL (location, NULL, 16);
if (address <= op->aml_offset) {
acpi_os_printf ("Breakpoint %X is beyond current address %X\n", address, op->aml_offset);
}
/* Save breakpoint in current walk */
- walk_state->method_breakpoint = address;
+ walk_state->user_breakpoint = address;
acpi_os_printf ("Breakpoint set at AML offset %X\n", address);
}
}
if (statements) {
- num_statements = STRTOUL (statements, NULL, 0);
+ num_statements = ACPI_STRTOUL (statements, NULL, 0);
}
-
acpi_db_display_op (NULL, op, num_statements);
}
/* Check if numeric argument, must be a Node */
if ((start_arg[0] >= 0x30) && (start_arg[0] <= 0x39)) {
- subtree_entry = (acpi_handle) STRTOUL (start_arg, NULL, 16);
+ subtree_entry = ACPI_TO_POINTER (ACPI_STRTOUL (start_arg, NULL, 16));
if (!acpi_os_readable (subtree_entry, sizeof (acpi_namespace_node))) {
acpi_os_printf ("Address %p is invalid in this address space\n", subtree_entry);
return;
}
- if (!VALID_DESCRIPTOR_TYPE ((subtree_entry), ACPI_DESC_TYPE_NAMED)) {
+ if (ACPI_GET_DESCRIPTOR_TYPE (subtree_entry) != ACPI_DESC_TYPE_NAMED) {
acpi_os_printf ("Address %p is not a valid Named object\n", subtree_entry);
return;
}
/* Now we can check for the depth argument */
if (depth_arg) {
- max_depth = STRTOUL (depth_arg, NULL, 0);
+ max_depth = ACPI_STRTOUL (depth_arg, NULL, 0);
}
}
-
- acpi_db_set_output_destination (DB_DUPLICATE_OUTPUT);
+ acpi_db_set_output_destination (ACPI_DB_DUPLICATE_OUTPUT);
acpi_os_printf ("ACPI Namespace (from %p subtree):\n", subtree_entry);
/* Display the subtree */
- acpi_db_set_output_destination (DB_REDIRECTABLE_OUTPUT);
+ acpi_db_set_output_destination (ACPI_DB_REDIRECTABLE_OUTPUT);
acpi_ns_dump_objects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, max_depth, ACPI_UINT32_MAX, subtree_entry);
- acpi_db_set_output_destination (DB_CONSOLE_OUTPUT);
+ acpi_db_set_output_destination (ACPI_DB_CONSOLE_OUTPUT);
}
u16 owner_id;
- owner_id = (u16) STRTOUL (owner_arg, NULL, 0);
-
+ owner_id = (u16) ACPI_STRTOUL (owner_arg, NULL, 0);
/* Now we can check for the depth argument */
if (depth_arg) {
- max_depth = STRTOUL (depth_arg, NULL, 0);
+ max_depth = ACPI_STRTOUL (depth_arg, NULL, 0);
}
-
- acpi_db_set_output_destination (DB_DUPLICATE_OUTPUT);
+ acpi_db_set_output_destination (ACPI_DB_DUPLICATE_OUTPUT);
acpi_os_printf ("ACPI Namespace by owner %X:\n", owner_id);
/* Display the subtree */
- acpi_db_set_output_destination (DB_REDIRECTABLE_OUTPUT);
+ acpi_db_set_output_destination (ACPI_DB_REDIRECTABLE_OUTPUT);
acpi_ns_dump_objects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, max_depth, owner_id, subtree_entry);
- acpi_db_set_output_destination (DB_CONSOLE_OUTPUT);
+ acpi_db_set_output_destination (ACPI_DB_CONSOLE_OUTPUT);
}
/* Validate Type_arg */
- STRUPR (type_arg);
+ ACPI_STRUPR (type_arg);
type = type_arg[0];
if ((type != 'L') &&
(type != 'A')) {
/* Get the index and value */
- index = STRTOUL (index_arg, NULL, 16);
- value = STRTOUL (value_arg, NULL, 16);
+ index = ACPI_STRTOUL (index_arg, NULL, 16);
+ value = ACPI_STRTOUL (value_arg, NULL, 16);
walk_state = acpi_ds_get_current_walk_state (acpi_gbl_current_walk_list);
if (!walk_state) {
{
acpi_operand_object *obj_desc;
acpi_status status;
- u32 buf_size;
- NATIVE_CHAR buffer[64];
+ acpi_buffer buffer;
- obj_desc = ((acpi_namespace_node *)obj_handle)->object;
- buf_size = sizeof (buffer) / sizeof (*buffer);
+ obj_desc = acpi_ns_get_attached_object ((acpi_namespace_node *) obj_handle);
/* Get and display the full pathname to this object */
- status = acpi_ns_handle_to_pathname (obj_handle, &buf_size, buffer);
-
+ buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
+ status = acpi_ns_handle_to_pathname (obj_handle, &buffer);
if (ACPI_FAILURE (status)) {
acpi_os_printf ("Could Not get pathname for object %p\n", obj_handle);
return (AE_OK);
}
- acpi_os_printf ("%32s", buffer);
+ acpi_os_printf ("%32s", buffer.pointer);
+ ACPI_MEM_FREE (buffer.pointer);
/* Display short information about the object */
NATIVE_CHAR *obj_type_arg,
NATIVE_CHAR *display_count_arg)
{
- acpi_object_type8 type;
+ acpi_object_type type;
/* Get the object type */
return (AE_OK);
}
- acpi_db_set_output_destination (DB_DUPLICATE_OUTPUT);
+ acpi_db_set_output_destination (ACPI_DB_DUPLICATE_OUTPUT);
acpi_os_printf ("Objects of type [%s] defined in the current ACPI Namespace: \n", acpi_ut_get_type_name (type));
- acpi_db_set_output_destination (DB_REDIRECTABLE_OUTPUT);
+ acpi_db_set_output_destination (ACPI_DB_REDIRECTABLE_OUTPUT);
/* Walk the namespace from the root */
acpi_walk_namespace (type, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
acpi_db_walk_for_specific_objects, (void *) &type, NULL);
- acpi_db_set_output_destination (DB_CONSOLE_OUTPUT);
+ acpi_db_set_output_destination (ACPI_DB_CONSOLE_OUTPUT);
return (AE_OK);
}
acpi_status status;
NATIVE_CHAR *requested_name = (NATIVE_CHAR *) context;
u32 i;
- u32 buf_size;
- NATIVE_CHAR buffer[96];
+ acpi_buffer buffer;
/* Check for a name match */
/* Get the full pathname to this object */
- buf_size = sizeof (buffer) / sizeof (*buffer);
-
- status = acpi_ns_handle_to_pathname (obj_handle, &buf_size, buffer);
+ buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
+ status = acpi_ns_handle_to_pathname (obj_handle, &buffer);
if (ACPI_FAILURE (status)) {
acpi_os_printf ("Could Not get pathname for object %p\n", obj_handle);
}
-
else {
- acpi_os_printf ("%32s (%p) - %s\n", buffer, obj_handle,
+ acpi_os_printf ("%32s (%p) - %s\n", buffer.pointer, obj_handle,
acpi_ut_get_type_name (((acpi_namespace_node *) obj_handle)->type));
+ ACPI_MEM_FREE (buffer.pointer);
}
return (AE_OK);
NATIVE_CHAR *name_arg)
{
- if (STRLEN (name_arg) > 4) {
+ if (ACPI_STRLEN (name_arg) > 4) {
acpi_os_printf ("Name must be no longer than 4 characters\n");
return (AE_OK);
}
acpi_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
acpi_db_walk_and_match_name, name_arg, NULL);
- acpi_db_set_output_destination (DB_CONSOLE_OUTPUT);
+ acpi_db_set_output_destination (ACPI_DB_CONSOLE_OUTPUT);
return (AE_OK);
}
acpi_db_set_scope (
NATIVE_CHAR *name)
{
+ acpi_status status;
+ acpi_namespace_node *node;
+
if (!name || name[0] == 0) {
acpi_os_printf ("Current scope: %s\n", acpi_gbl_db_scope_buf);
acpi_db_prep_namestring (name);
- /* TBD: [Future] Validate scope here */
if (name[0] == '\\') {
- STRCPY (acpi_gbl_db_scope_buf, name);
- STRCAT (acpi_gbl_db_scope_buf, "\\");
- }
+ /* Validate new scope from the root */
+ status = acpi_ns_get_node_by_path (name, acpi_gbl_root_node, ACPI_NS_NO_UPSEARCH, &node);
+ if (ACPI_FAILURE (status)) {
+ goto error_exit;
+ }
+
+ ACPI_STRCPY (acpi_gbl_db_scope_buf, name);
+ ACPI_STRCAT (acpi_gbl_db_scope_buf, "\\");
+ }
else {
- STRCAT (acpi_gbl_db_scope_buf, name);
- STRCAT (acpi_gbl_db_scope_buf, "\\");
+ /* Validate new scope relative to old scope */
+
+ status = acpi_ns_get_node_by_path (name, acpi_gbl_db_scope_node, ACPI_NS_NO_UPSEARCH, &node);
+ if (ACPI_FAILURE (status)) {
+ goto error_exit;
+ }
+
+ ACPI_STRCAT (acpi_gbl_db_scope_buf, name);
+ ACPI_STRCAT (acpi_gbl_db_scope_buf, "\\");
}
+ acpi_gbl_db_scope_node = node;
acpi_os_printf ("New scope: %s\n", acpi_gbl_db_scope_buf);
+ return;
+
+
+error_exit:
+
+ acpi_os_printf ("Could not attach scope: %s, %s\n", name, acpi_format_exception (status));
}
acpi_buffer return_obj;
- acpi_db_set_output_destination (DB_REDIRECTABLE_OUTPUT);
+ acpi_db_set_output_destination (ACPI_DB_REDIRECTABLE_OUTPUT);
+ acpi_dbg_level |= ACPI_LV_RESOURCES;
/* Convert string to object pointer */
- obj_desc = (acpi_operand_object *) STRTOUL (object_arg, NULL, 16);
+ obj_desc = ACPI_TO_POINTER (ACPI_STRTOUL (object_arg, NULL, 16));
/* Prepare for a return object of arbitrary size */
return_obj.pointer = acpi_gbl_db_buffer;
return_obj.length = ACPI_DEBUG_BUFFER_SIZE;
-
/* _PRT */
acpi_os_printf ("Evaluating _PRT\n");
status = acpi_get_current_resources (obj_desc, &return_obj);
if (ACPI_FAILURE (status)) {
acpi_os_printf ("Acpi_get_current_resources failed: %s\n", acpi_format_exception (status));
+ goto get_prs;
}
else {
acpi_rs_dump_resource_list ((acpi_resource *) acpi_gbl_db_buffer);
}
+ status = acpi_set_current_resources (obj_desc, &return_obj);
+ if (ACPI_FAILURE (status)) {
+ acpi_os_printf ("Acpi_set_current_resources failed: %s\n", acpi_format_exception (status));
+ goto get_prs;
+ }
+
/* _PRS */
cleanup:
- acpi_db_set_output_destination (DB_CONSOLE_OUTPUT);
+ acpi_db_set_output_destination (ACPI_DB_CONSOLE_OUTPUT);
return;
#endif
/*******************************************************************************
*
* Module Name: dbdisasm - parser op tree display routines
- * $Revision: 50 $
+ * $Revision: 61 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#ifdef ENABLE_DEBUGGER
#define _COMPONENT ACPI_DEBUGGER
- MODULE_NAME ("dbdisasm")
+ ACPI_MODULE_NAME ("dbdisasm")
-#define MAX_SHOW_ENTRY 128
#define BLOCK_PAREN 1
#define BLOCK_BRACE 2
#define DB_NO_OP_INFO " [%2.2d] "
switch (op->opcode) {
case AML_METHOD_OP:
return (BLOCK_BRACE);
- break;
default:
break;
}
return (BLOCK_PAREN);
-
}
acpi_parse_object *op)
{
acpi_parse_object *target_op;
+ char *name;
+ if (op->flags & ACPI_PARSEOP_GENERIC) {
+ name = op->value.name;
+ if (name[0] == '\\') {
+ acpi_os_printf (" (Fully Qualified Pathname)");
+ return (AE_OK);
+ }
+ }
+ else {
+ name = (char *) &((acpi_parse2_object *) op)->name;
+ }
+
/* Search parent tree up to the root if necessary */
- target_op = acpi_ps_find (op, op->value.name, 0, 0);
+ target_op = acpi_ps_find (op, name, 0, 0);
if (!target_op) {
/*
* Didn't find the name in the parse tree. This may be
*/
acpi_os_printf (" **** Path not found in parse tree");
}
-
else {
/* The target was found, print the name and complete path */
{
acpi_status status;
acpi_namespace_node *node;
- NATIVE_CHAR buffer[MAX_SHOW_ENTRY];
- u32 buffer_size = MAX_SHOW_ENTRY;
+ acpi_buffer buffer;
u32 debug_level;
/* Node not defined in this scope, look it up */
status = acpi_ns_lookup (walk_state->scope_info, op->value.string, ACPI_TYPE_ANY,
- IMODE_EXECUTE, NS_SEARCH_PARENT, walk_state, &(node));
+ ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node));
if (ACPI_FAILURE (status)) {
/*
/* Convert Named_desc/handle to a full pathname */
- status = acpi_ns_handle_to_pathname (node, &buffer_size, buffer);
+ buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
+ status = acpi_ns_handle_to_pathname (node, &buffer);
if (ACPI_FAILURE (status)) {
acpi_os_printf ("****Could not get pathname****)");
goto exit;
}
- acpi_os_printf (" (Path %s)", buffer);
+ acpi_os_printf (" (Path %s)", buffer.pointer);
+ ACPI_MEM_FREE (buffer.pointer);
exit:
u32 j;
- if (op) {
- while (op) {
- /* indentation */
+ if (!op) {
+ acpi_db_display_opcode (walk_state, op);
+ return;
+ }
+
+
+ while (op) {
+ /* Indentation */
+
+ depth_count = 0;
+ if (!acpi_gbl_db_opt_verbose) {
+ depth_count++;
+ }
- depth_count = 0;
- if (!acpi_gbl_db_opt_verbose) {
- depth_count++;
+ /* Determine the nesting depth of this argument */
+
+ for (depth = op->parent; depth; depth = depth->parent) {
+ arg = acpi_ps_get_arg (depth, 0);
+ while (arg && arg != origin) {
+ arg = arg->next;
}
- /* Determine the nesting depth of this argument */
+ if (arg) {
+ break;
+ }
- for (depth = op->parent; depth; depth = depth->parent) {
- arg = acpi_ps_get_arg (depth, 0);
- while (arg && arg != origin) {
- arg = arg->next;
- }
+ depth_count++;
+ }
- if (arg) {
- break;
- }
+ /* Open a new block if we are nested further than last time */
- depth_count++;
+ if (depth_count > last_depth) {
+ VERBOSE_PRINT ((DB_NO_OP_INFO, last_depth));
+ for (i = 0; i < last_depth; i++) {
+ acpi_os_printf ("%s", acpi_gbl_db_disasm_indent);
}
+ if (acpi_db_block_type (op) == BLOCK_PAREN) {
+ acpi_os_printf ("(\n");
+ }
+ else {
+ acpi_os_printf ("{\n");
+ }
+ }
- /* Open a new block if we are nested further than last time */
+ /* Close a block if we are nested less than last time */
- if (depth_count > last_depth) {
- VERBOSE_PRINT ((DB_NO_OP_INFO, last_depth));
- for (i = 0; i < last_depth; i++) {
+ else if (depth_count < last_depth) {
+ for (j = 0; j < (last_depth - depth_count); j++) {
+ VERBOSE_PRINT ((DB_NO_OP_INFO, last_depth - j));
+ for (i = 0; i < (last_depth - j - 1); i++) {
acpi_os_printf ("%s", acpi_gbl_db_disasm_indent);
}
if (acpi_db_block_type (op) == BLOCK_PAREN) {
- acpi_os_printf ("(\n");
+ acpi_os_printf (")\n");
}
else {
- acpi_os_printf ("{\n");
- }
- }
-
- /* Close a block if we are nested less than last time */
-
- else if (depth_count < last_depth) {
- for (j = 0; j < (last_depth - depth_count); j++) {
- VERBOSE_PRINT ((DB_NO_OP_INFO, last_depth - j));
- for (i = 0; i < (last_depth - j - 1); i++) {
- acpi_os_printf ("%s", acpi_gbl_db_disasm_indent);
- }
-
- if (acpi_db_block_type (op) == BLOCK_PAREN) {
- acpi_os_printf (")\n");
- }
- else {
- acpi_os_printf ("}\n");
- }
+ acpi_os_printf ("}\n");
}
}
+ }
- /* In verbose mode, print the AML offset, opcode and depth count */
-
- VERBOSE_PRINT ((DB_FULL_OP_INFO, (unsigned) op->aml_offset, op->opcode, depth_count));
+ /* In verbose mode, print the AML offset, opcode and depth count */
+ VERBOSE_PRINT ((DB_FULL_OP_INFO, (unsigned) op->aml_offset, op->opcode, depth_count));
- /* Indent the output according to the depth count */
- for (i = 0; i < depth_count; i++) {
- acpi_os_printf ("%s", acpi_gbl_db_disasm_indent);
- }
+ /* Indent the output according to the depth count */
+ for (i = 0; i < depth_count; i++) {
+ acpi_os_printf ("%s", acpi_gbl_db_disasm_indent);
+ }
- /* Now print the opcode */
+ /* Now print the opcode */
- acpi_db_display_opcode (walk_state, op);
+ acpi_db_display_opcode (walk_state, op);
- /* Resolve a name reference */
+ /* Resolve a name reference */
- if ((op->opcode == AML_INT_NAMEPATH_OP && op->value.name) &&
- (op->parent) &&
- (acpi_gbl_db_opt_verbose)) {
- acpi_ps_display_object_pathname (walk_state, op);
- }
+ if ((op->opcode == AML_INT_NAMEPATH_OP && op->value.name) &&
+ (op->parent) &&
+ (acpi_gbl_db_opt_verbose)) {
+ acpi_ps_display_object_pathname (walk_state, op);
+ }
- acpi_os_printf ("\n");
+ acpi_os_printf ("\n");
- /* Get the next node in the tree */
+ /* Get the next node in the tree */
- op = acpi_ps_get_depth_next (origin, op);
- last_depth = depth_count;
+ op = acpi_ps_get_depth_next (origin, op);
+ last_depth = depth_count;
- num_opcodes--;
- if (!num_opcodes) {
- op = NULL;
- }
+ num_opcodes--;
+ if (!num_opcodes) {
+ op = NULL;
}
+ }
- /* Close the last block(s) */
+ /* Close the last block(s) */
- depth_count = last_depth -1;
- for (i = 0; i < last_depth; i++) {
- VERBOSE_PRINT ((DB_NO_OP_INFO, last_depth - i));
- for (j = 0; j < depth_count; j++) {
- acpi_os_printf ("%s", acpi_gbl_db_disasm_indent);
- }
- acpi_os_printf ("}\n");
- depth_count--;
+ depth_count = last_depth -1;
+ for (i = 0; i < last_depth; i++) {
+ VERBOSE_PRINT ((DB_NO_OP_INFO, last_depth - i));
+ for (j = 0; j < depth_count; j++) {
+ acpi_os_printf ("%s", acpi_gbl_db_disasm_indent);
}
-
- }
-
- else {
- acpi_db_display_opcode (walk_state, op);
+ acpi_os_printf ("}\n");
+ depth_count--;
}
}
NATIVE_CHAR *name)
{
u32 seg_count;
- u8 do_dot = FALSE;
if (!name) {
return;
}
- if (acpi_ps_is_prefix_char (GET8 (name))) {
- /* append prefix character */
+ /* Handle all Scope Prefix operators */
+
+ while (acpi_ps_is_prefix_char (ACPI_GET8 (name))) {
+ /* Append prefix character */
- acpi_os_printf ("%1c", GET8 (name));
+ acpi_os_printf ("%1c", ACPI_GET8 (name));
name++;
}
- switch (GET8 (name)) {
+ switch (ACPI_GET8 (name)) {
+ case 0:
+ seg_count = 0;
+ break;
+
case AML_DUAL_NAME_PREFIX:
seg_count = 2;
name++;
break;
case AML_MULTI_NAME_PREFIX_OP:
- seg_count = (u32) GET8 (name + 1);
+ seg_count = (u32) ACPI_GET8 (name + 1);
name += 2;
break;
break;
}
- while (seg_count--) {
- /* append Name segment */
+ while (seg_count) {
+ /* Append Name segment */
+
+ acpi_os_printf ("%4.4s", name);
- if (do_dot) {
- /* append dot */
+ seg_count--;
+ if (seg_count) {
+ /* Not last name, append dot separator */
acpi_os_printf (".");
}
-
- acpi_os_printf ("%4.4s", name);
- do_dot = TRUE;
-
- name += 4;
+ name += ACPI_NAME_SIZE;
}
}
return;
}
-
if (op_info->flags & AML_CREATE) {
/* Field creation - check for a fully qualified namepath */
acpi_os_printf ("%4.4s", name_path->value.string);
}
}
-
else {
name = acpi_ps_get_name (search);
acpi_os_printf ("%4.4s", &name);
acpi_os_printf ("<NULL OP PTR>");
}
-
/* op and arguments */
switch (op->opcode) {
-
case AML_BYTE_OP:
if (acpi_gbl_db_opt_verbose) {
acpi_os_printf ("(u8) 0x%2.2X", op->value.integer8);
}
-
else {
acpi_os_printf ("0x%2.2X", op->value.integer8);
}
-
break;
if (acpi_gbl_db_opt_verbose) {
acpi_os_printf ("(u16) 0x%4.4X", op->value.integer16);
}
-
else {
acpi_os_printf ("0x%4.4X", op->value.integer16);
}
-
break;
if (acpi_gbl_db_opt_verbose) {
acpi_os_printf ("(u32) 0x%8.8X", op->value.integer32);
}
-
else {
acpi_os_printf ("0x%8.8X", op->value.integer32);
}
-
break;
acpi_os_printf ("(u64) 0x%8.8X%8.8X", op->value.integer64.hi,
op->value.integer64.lo);
}
-
else {
acpi_os_printf ("0x%8.8X%8.8X", op->value.integer64.hi,
op->value.integer64.lo);
}
-
break;
if (op->value.string) {
acpi_os_printf ("\"%s\"", op->value.string);
}
-
else {
acpi_os_printf ("<\"NULL STRING PTR\">");
}
-
break;
if (op->value.string) {
acpi_os_printf ("\"%s\"", op->value.string);
}
-
else {
acpi_os_printf ("\"<NULL STATIC STRING PTR>\"");
}
-
break;
if (acpi_gbl_db_opt_verbose) {
acpi_os_printf ("Byte_list (Length 0x%8.8X) ", op->value.integer32);
}
-
else {
acpi_os_printf ("0x%2.2X", op->value.integer32);
acpi_os_printf (", 0x%2.2X", byte_data[i]);
}
}
-
break;
acpi_db_decode_internal_object (walk_state->results->results.obj_desc [walk_state->results->results.num_results-1]);
}
#endif
-
break;
}
name = acpi_ps_get_name (op);
acpi_os_printf (" %4.4s", &name);
- if (acpi_gbl_db_opt_verbose) {
- acpi_os_printf (" (Path \\");
- acpi_db_display_path (op);
- acpi_os_printf (")");
+ if ((acpi_gbl_db_opt_verbose) && (op->opcode != AML_INT_NAMEDFIELD_OP)) {
+ acpi_ps_display_object_pathname (walk_state, op);
}
}
}
-
#endif /* ENABLE_DEBUGGER */
/*******************************************************************************
*
* Module Name: dbdisply - debug display commands
- * $Revision: 57 $
+ * $Revision: 66 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_DEBUGGER
- MODULE_NAME ("dbdisply")
+ ACPI_MODULE_NAME ("dbdisply")
/******************************************************************************
/* Simple flat pointer */
- obj_ptr = (void *) STRTOUL (target, NULL, 16);
-
+ obj_ptr = ACPI_TO_POINTER (ACPI_STRTOUL (target, NULL, 16));
#endif
return (obj_ptr);
acpi_os_printf ("Parser Op Descriptor:\n");
acpi_os_printf ("%20.20s : %4.4X\n", "Opcode", op->opcode);
- DEBUG_ONLY_MEMBERS (acpi_os_printf ("%20.20s : %s\n", "Opcode Name", info->name));
+ ACPI_DEBUG_ONLY_MEMBERS (acpi_os_printf ("%20.20s : %s\n", "Opcode Name", info->name));
acpi_os_printf ("%20.20s : %p\n", "Value/Arg_list", op->value);
acpi_os_printf ("%20.20s : %p\n", "Parent", op->parent);
{
void *obj_ptr;
acpi_namespace_node *node;
+ acpi_operand_object *obj_desc;
u32 display = DB_BYTE_DISPLAY;
NATIVE_CHAR buffer[80];
acpi_buffer ret_buf;
/* Decode the output type */
if (output_type) {
- STRUPR (output_type);
+ ACPI_STRUPR (output_type);
if (output_type[0] == 'W') {
display = DB_WORD_DISPLAY;
}
}
}
-
ret_buf.length = sizeof (buffer);
ret_buf.pointer = buffer;
/* Decode the object type */
- if (VALID_DESCRIPTOR_TYPE ((obj_ptr), ACPI_DESC_TYPE_NAMED)) {
- /* This is a Node */
+ switch (ACPI_GET_DESCRIPTOR_TYPE (obj_ptr)) {
+ case ACPI_DESC_TYPE_NAMED:
+
+ /* This is a namespace Node */
if (!acpi_os_readable (obj_ptr, sizeof (acpi_namespace_node))) {
acpi_os_printf ("Cannot read entire Named object at address %p\n", obj_ptr);
node = obj_ptr;
goto dump_nte;
- }
- else if (VALID_DESCRIPTOR_TYPE ((obj_ptr), ACPI_DESC_TYPE_INTERNAL)) {
- /* This is an ACPI OBJECT */
+
+ case ACPI_DESC_TYPE_INTERNAL:
+
+ /* This is a ACPI OPERAND OBJECT */
if (!acpi_os_readable (obj_ptr, sizeof (acpi_operand_object))) {
acpi_os_printf ("Cannot read entire ACPI object at address %p\n", obj_ptr);
acpi_ut_dump_buffer (obj_ptr, sizeof (acpi_operand_object), display, ACPI_UINT32_MAX);
acpi_ex_dump_object_descriptor (obj_ptr, 1);
- }
+ break;
- else if (VALID_DESCRIPTOR_TYPE ((obj_ptr), ACPI_DESC_TYPE_PARSER)) {
- /* This is an Parser Op object */
+
+ case ACPI_DESC_TYPE_PARSER:
+
+ /* This is a Parser Op object */
if (!acpi_os_readable (obj_ptr, sizeof (acpi_parse_object))) {
acpi_os_printf ("Cannot read entire Parser object at address %p\n", obj_ptr);
return;
}
-
acpi_ut_dump_buffer (obj_ptr, sizeof (acpi_parse_object), display, ACPI_UINT32_MAX);
acpi_db_dump_parser_descriptor ((acpi_parse_object *) obj_ptr);
- }
+ break;
+
+
+ default:
+
+ /* Is not a recognizeable object */
- else {
size = 16;
if (acpi_os_readable (obj_ptr, 64)) {
size = 64;
/* Just dump some memory */
acpi_ut_dump_buffer (obj_ptr, size, display, ACPI_UINT32_MAX);
+ break;
}
return;
}
-
/* The parameter is a name string that must be resolved to a Named obj */
node = acpi_db_local_ns_lookup (target);
acpi_ut_dump_buffer ((void *) node, sizeof (acpi_namespace_node), display, ACPI_UINT32_MAX);
acpi_ex_dump_node (node, 1);
- if (node->object) {
- acpi_os_printf ("\n_attached Object (%p):\n", node->object);
- if (!acpi_os_readable (node->object, sizeof (acpi_operand_object))) {
- acpi_os_printf ("Invalid internal ACPI Object at address %p\n", node->object);
+ obj_desc = acpi_ns_get_attached_object (node);
+ if (obj_desc) {
+ acpi_os_printf ("\n_attached Object (%p):\n", obj_desc);
+ if (!acpi_os_readable (obj_desc, sizeof (acpi_operand_object))) {
+ acpi_os_printf ("Invalid internal ACPI Object at address %p\n", obj_desc);
return;
}
- acpi_ut_dump_buffer ((void *) node->object, sizeof (acpi_operand_object), display, ACPI_UINT32_MAX);
- acpi_ex_dump_object_descriptor (node->object, 1);
+ acpi_ut_dump_buffer ((void *) obj_desc, sizeof (acpi_operand_object), display, ACPI_UINT32_MAX);
+ acpi_ex_dump_object_descriptor (obj_desc, 1);
}
}
switch (obj_desc->common.type) {
case ACPI_TYPE_INTEGER:
- acpi_os_printf (" %.8X%.8X", HIDWORD (obj_desc->integer.value),
- LODWORD (obj_desc->integer.value));
+ acpi_os_printf (" %.8X%.8X", ACPI_HIDWORD (obj_desc->integer.value),
+ ACPI_LODWORD (obj_desc->integer.value));
break;
return;
}
-
/* Decode the object type */
- else if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_PARSER)) {
+ switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) {
+ case ACPI_DESC_TYPE_PARSER:
+
acpi_os_printf ("<Parser> ");
- }
+ break;
+
+
+ case ACPI_DESC_TYPE_NAMED:
- else if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) {
acpi_os_printf ("<Node> Name %4.4s Type-%s",
&((acpi_namespace_node *)obj_desc)->name,
acpi_ut_get_type_name (((acpi_namespace_node *) obj_desc)->type));
+
if (((acpi_namespace_node *) obj_desc)->flags & ANOBJ_METHOD_ARG) {
acpi_os_printf (" [Method Arg]");
}
if (((acpi_namespace_node *) obj_desc)->flags & ANOBJ_METHOD_LOCAL) {
acpi_os_printf (" [Method Local]");
}
- }
+ break;
+
+
+ case ACPI_DESC_TYPE_INTERNAL:
- else if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_INTERNAL)) {
type = obj_desc->common.type;
if (type > INTERNAL_TYPE_MAX) {
acpi_os_printf (" Type %x [Invalid Type]", type);
break;
case AML_INDEX_OP:
- acpi_os_printf ("[Index] ");
+ acpi_os_printf ("[Index] ");
acpi_db_decode_internal_object (obj_desc->reference.object);
break;
acpi_db_decode_internal_object (obj_desc);
break;
}
- }
+ break;
+
+
+ default:
- else {
acpi_os_printf ("<Not a valid ACPI Object Descriptor> ");
+ break;
}
+
acpi_os_printf ("\n");
}
}
obj_desc = walk_state->method_desc;
- node = walk_state->method_node;
+ node = walk_state->method_node;
- num_args = obj_desc->method.param_count;
+ num_args = obj_desc->method.param_count;
concurrency = obj_desc->method.concurrency;
acpi_os_printf ("Currently executing control method is [%4.4s]\n", &node->name);
break;
}
-
op = acpi_ps_get_depth_next (start_op, op);
}
obj_desc = walk_state->method_desc;
node = walk_state->method_node;
-
-
acpi_os_printf ("Local Variables for method [%4.4s]:\n", &node->name);
for (i = 0; i < MTH_NUM_LOCALS; i++) {
}
obj_desc = walk_state->method_desc;
- node = walk_state->method_node;
+ node = walk_state->method_node;
- num_args = obj_desc->method.param_count;
+ num_args = obj_desc->method.param_count;
concurrency = obj_desc->method.concurrency;
- acpi_os_printf ("Method [%4.4s] has %X arguments, max concurrency = %X\n", &node->name, num_args, concurrency);
+ acpi_os_printf ("Method [%4.4s] has %X arguments, max concurrency = %X\n",
+ &node->name, num_args, concurrency);
for (i = 0; i < num_args; i++) {
obj_desc = walk_state->arguments[i].object;
num_results = walk_state->results->results.num_results;
}
- acpi_os_printf ("Method [%4.4s] has %X stacked result objects\n", &node->name, num_results);
+ acpi_os_printf ("Method [%4.4s] has %X stacked result objects\n",
+ &node->name, num_results);
for (i = 0; i < num_results; i++) {
obj_desc = walk_state->results->results.obj_desc[i];
}
node = walk_state->method_node;
-
acpi_os_printf ("Current Control Method Call Tree\n");
for (i = 0; walk_state; i++) {
*
* DESCRIPTION: Display the result of an AML opcode
*
+ * Note: Curently only displays the result object if we are single stepping.
+ * However, this output may be useful in other contexts and could be enabled
+ * to do so if needed.
+ *
******************************************************************************/
void
acpi_walk_state *walk_state)
{
- /* TBD: [Future] We don't always want to display the result.
- * For now, only display if single stepping
- * however, this output is very useful in other contexts also
- */
+ /* Only display if single stepping */
+
if (!acpi_gbl_cm_single_step) {
return;
}
acpi_walk_state *walk_state)
{
-
if (!acpi_gbl_cm_single_step) {
return;
}
/*******************************************************************************
*
* Module Name: dbexec - debugger control method execution
- * $Revision: 34 $
+ * $Revision: 39 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#ifdef ENABLE_DEBUGGER
#define _COMPONENT ACPI_DEBUGGER
- MODULE_NAME ("dbexec")
+ ACPI_MODULE_NAME ("dbexec")
-db_method_info acpi_gbl_db_method_info;
+acpi_db_method_info acpi_gbl_db_method_info;
/*******************************************************************************
acpi_status
acpi_db_execute_method (
- db_method_info *info,
+ acpi_db_method_info *info,
acpi_buffer *return_obj)
{
acpi_status status;
if (info->args && info->args[0]) {
for (i = 0; info->args[i] && i < MTH_NUM_ARGS; i++) {
params[i].type = ACPI_TYPE_INTEGER;
- params[i].integer.value = STRTOUL (info->args[i], NULL, 16);
+ params[i].integer.value = ACPI_STRTOUL (info->args[i], NULL, 16);
}
param_objects.pointer = params;
param_objects.count = i;
}
-
else {
/* Setup default parameters */
return_obj->pointer = acpi_gbl_db_buffer;
return_obj->length = ACPI_DEBUG_BUFFER_SIZE;
-
/* Do the actual method execution */
status = acpi_evaluate_object (NULL, info->pathname, ¶m_objects, return_obj);
void
acpi_db_execute_setup (
- db_method_info *info)
+ acpi_db_method_info *info)
{
/* Catenate the current scope to the supplied name */
info->pathname[0] = 0;
if ((info->name[0] != '\\') &&
(info->name[0] != '/')) {
- STRCAT (info->pathname, acpi_gbl_db_scope_buf);
+ ACPI_STRCAT (info->pathname, acpi_gbl_db_scope_buf);
}
- STRCAT (info->pathname, info->name);
+ ACPI_STRCAT (info->pathname, info->name);
acpi_db_prep_namestring (info->pathname);
- acpi_db_set_output_destination (DB_DUPLICATE_OUTPUT);
+ acpi_db_set_output_destination (ACPI_DB_DUPLICATE_OUTPUT);
acpi_os_printf ("Executing %s\n", info->pathname);
if (info->flags & EX_SINGLE_STEP) {
acpi_gbl_cm_single_step = TRUE;
- acpi_db_set_output_destination (DB_CONSOLE_OUTPUT);
+ acpi_db_set_output_destination (ACPI_DB_CONSOLE_OUTPUT);
}
else {
/* No single step, allow redirection to a file */
- acpi_db_set_output_destination (DB_REDIRECTABLE_OUTPUT);
+ acpi_db_set_output_destination (ACPI_DB_REDIRECTABLE_OUTPUT);
}
}
u32
acpi_db_get_outstanding_allocations (void)
{
- u32 i;
u32 outstanding = 0;
-
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+ u32 i;
+
for (i = ACPI_MEM_LIST_FIRST_CACHE_LIST; i < ACPI_NUM_MEM_LISTS; i++) {
outstanding += (acpi_gbl_memory_lists[i].total_allocated -
allocations = acpi_db_get_outstanding_allocations () - previous_allocations;
- acpi_db_set_output_destination (DB_DUPLICATE_OUTPUT);
+ acpi_db_set_output_destination (ACPI_DB_DUPLICATE_OUTPUT);
if (allocations > 0) {
acpi_os_printf ("Outstanding: %ld allocations after execution\n",
}
}
- acpi_db_set_output_destination (DB_CONSOLE_OUTPUT);
+ acpi_db_set_output_destination (ACPI_DB_CONSOLE_OUTPUT);
}
*
******************************************************************************/
-void
+void ACPI_SYSTEM_XFACE
acpi_db_method_thread (
void *context)
{
acpi_status status;
- db_method_info *info = context;
+ acpi_db_method_info *info = context;
u32 i;
acpi_buffer return_obj;
/* Get the arguments */
- num_threads = STRTOUL (num_threads_arg, NULL, 0);
- num_loops = STRTOUL (num_loops_arg, NULL, 0);
+ num_threads = ACPI_STRTOUL (num_threads_arg, NULL, 0);
+ num_loops = ACPI_STRTOUL (num_loops_arg, NULL, 0);
if (!num_threads || !num_loops) {
acpi_os_printf ("Bad argument: Threads %X, Loops %X\n", num_threads, num_loops);
return;
}
-
/* Create the synchronization semaphore */
status = acpi_os_create_semaphore (1, 0, &thread_gate);
acpi_db_execute_setup (&acpi_gbl_db_method_info);
-
/* Create the threads */
acpi_os_printf ("Creating %X threads to execute %X times each\n", num_threads, num_loops);
acpi_os_queue_for_execution (OSD_PRIORITY_MED, acpi_db_method_thread, &acpi_gbl_db_method_info);
}
-
/* Wait for all threads to complete */
i = num_threads;
acpi_os_delete_semaphore (thread_gate);
- acpi_db_set_output_destination (DB_DUPLICATE_OUTPUT);
+ acpi_db_set_output_destination (ACPI_DB_DUPLICATE_OUTPUT);
acpi_os_printf ("All threads (%X) have completed\n", num_threads);
- acpi_db_set_output_destination (DB_CONSOLE_OUTPUT);
+ acpi_db_set_output_destination (ACPI_DB_CONSOLE_OUTPUT);
}
*
* Module Name: dbfileio - Debugger file I/O commands. These can't usually
* be used when running the debugger in Ring 0 (Kernel mode)
- * $Revision: 53 $
+ * $Revision: 59 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#ifdef ENABLE_DEBUGGER
#define _COMPONENT ACPI_DEBUGGER
- MODULE_NAME ("dbfileio")
+ ACPI_MODULE_NAME ("dbfileio")
/*
*
******************************************************************************/
-acpi_object_type8
+acpi_object_type
acpi_db_match_argument (
NATIVE_CHAR *user_argument,
ARGUMENT_INFO *arguments)
}
for (i = 0; arguments[i].name; i++) {
- if (STRSTR (arguments[i].name, user_argument) == arguments[i].name) {
- return ((acpi_object_type8) i);
+ if (ACPI_STRSTR (arguments[i].name, user_argument) == arguments[i].name) {
+ return (i);
}
}
acpi_gbl_debug_file = fopen (name, "w+");
if (acpi_gbl_debug_file) {
acpi_os_printf ("Debug output file %s opened\n", name);
- STRCPY (acpi_gbl_db_debug_filename, name);
+ ACPI_STRCPY (acpi_gbl_db_debug_filename, name);
acpi_gbl_db_output_to_file = TRUE;
}
else {
/* We only support a limited number of table types */
- if (STRNCMP ((char *) table_header.signature, DSDT_SIG, 4) &&
- STRNCMP ((char *) table_header.signature, PSDT_SIG, 4) &&
- STRNCMP ((char *) table_header.signature, SSDT_SIG, 4)) {
+ if (ACPI_STRNCMP ((char *) table_header.signature, DSDT_SIG, 4) &&
+ ACPI_STRNCMP ((char *) table_header.signature, PSDT_SIG, 4) &&
+ ACPI_STRNCMP ((char *) table_header.signature, SSDT_SIG, 4)) {
acpi_os_printf ("Table signature is invalid\n");
- DUMP_BUFFER (&table_header, sizeof (acpi_table_header));
+ ACPI_DUMP_BUFFER (&table_header, sizeof (acpi_table_header));
return (AE_ERROR);
}
/* Copy the header to the buffer */
- MEMCPY (*table_ptr, &table_header, sizeof (table_header));
+ ACPI_MEMCPY (*table_ptr, &table_header, sizeof (table_header));
/* Get the rest of the table */
acpi_table_desc table_info;
- FUNCTION_TRACE ("Ae_local_load_table");
+ ACPI_FUNCTION_TRACE ("Ae_local_load_table");
if (!table_ptr) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
status = ae_local_load_table (acpi_gbl_db_table_ptr);
if (ACPI_FAILURE (status)) {
- if (status == AE_EXIST) {
+ if (status == AE_ALREADY_EXISTS) {
acpi_os_printf ("Table %4.4s is already installed\n",
&acpi_gbl_db_table_ptr->signature);
}
acpi_format_exception (status));
}
- acpi_os_free (acpi_gbl_db_table_ptr);
return (status);
}
/******************************************************************************
*
* Module Name: dbhistry - debugger HISTORY command
- * $Revision: 19 $
+ * $Revision: 22 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#ifdef ENABLE_DEBUGGER
#define _COMPONENT ACPI_DEBUGGER
- MODULE_NAME ("dbhistry")
+ ACPI_MODULE_NAME ("dbhistry")
#define HI_NO_HISTORY 0
NATIVE_CHAR *command_line)
{
-
/* Put command into the next available slot */
- STRCPY (acpi_gbl_history_buffer[acpi_gbl_next_history_index].command, command_line);
+ ACPI_STRCPY (acpi_gbl_history_buffer[acpi_gbl_next_history_index].command, command_line);
acpi_gbl_history_buffer[acpi_gbl_next_history_index].cmd_num = acpi_gbl_next_cmd_num;
acpi_gbl_next_history_index = 0;
}
-
acpi_gbl_next_cmd_num++;
if (acpi_gbl_num_history < HISTORY_SIZE) {
acpi_gbl_num_history++;
}
-
}
}
else {
- cmd_num = STRTOUL (command_num_arg, NULL, 0);
+ cmd_num = ACPI_STRTOUL (command_num_arg, NULL, 0);
}
-
/* Search history buffer */
history_index = acpi_gbl_lo_history;
/*******************************************************************************
*
* Module Name: dbinput - user front-end to the AML debugger
- * $Revision: 72 $
+ * $Revision: 81 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#ifdef ENABLE_DEBUGGER
#define _COMPONENT ACPI_DEBUGGER
- MODULE_NAME ("dbinput")
+ ACPI_MODULE_NAME ("dbinput")
-/*
- * Globals that are specific to the debugger
- */
-
-NATIVE_CHAR acpi_gbl_db_line_buf[80];
-NATIVE_CHAR acpi_gbl_db_parsed_buf[80];
-NATIVE_CHAR acpi_gbl_db_scope_buf[40];
-NATIVE_CHAR acpi_gbl_db_debug_filename[40];
-NATIVE_CHAR *acpi_gbl_db_args[DB_MAX_ARGS];
-NATIVE_CHAR *acpi_gbl_db_buffer = NULL;
-NATIVE_CHAR *acpi_gbl_db_filename = NULL;
-u8 acpi_gbl_db_output_to_file = FALSE;
-
-u32 acpi_gbl_db_debug_level = ACPI_LV_VERBOSITY2;
-u32 acpi_gbl_db_console_debug_level = NORMAL_DEFAULT | ACPI_LV_TABLES;
-u8 acpi_gbl_db_output_flags = DB_CONSOLE_OUTPUT;
-
-
-u8 acpi_gbl_db_opt_tables = FALSE;
-u8 acpi_gbl_db_opt_disasm = FALSE;
-u8 acpi_gbl_db_opt_stats = FALSE;
-u8 acpi_gbl_db_opt_parse_jit = FALSE;
-u8 acpi_gbl_db_opt_verbose = TRUE;
-u8 acpi_gbl_db_opt_ini_methods = TRUE;
-
-/*
- * Statistic globals
- */
-u16 acpi_gbl_obj_type_count[INTERNAL_TYPE_NODE_MAX+1];
-u16 acpi_gbl_node_type_count[INTERNAL_TYPE_NODE_MAX+1];
-u16 acpi_gbl_obj_type_count_misc;
-u16 acpi_gbl_node_type_count_misc;
-u32 acpi_gbl_num_nodes;
-u32 acpi_gbl_num_objects;
-
-
-u32 acpi_gbl_size_of_parse_tree;
-u32 acpi_gbl_size_of_method_trees;
-u32 acpi_gbl_size_of_node_entries;
-u32 acpi_gbl_size_of_acpi_objects;
-
/*
* Top-level debugger commands.
*
* This list of commands must match the string table below it
*/
-
enum acpi_ex_debugger_commands
{
CMD_NOT_FOUND = 0,
}
-
/*
* Parameter is the command class
*
* The idea here is to keep each class of commands smaller than a screenful
*/
-
switch (help_type[0])
{
case 'G':
{
NATIVE_CHAR *start;
+
/* At end of buffer? */
if (!string || !(*string))
return (NULL);
}
-
/* Get rid of any spaces at the beginning */
if (*string == ' ')
string++;
}
-
if (!(*string))
{
*next = NULL;
}
-
else
{
*string = 0;
NATIVE_CHAR *this;
- STRCPY (acpi_gbl_db_parsed_buf, input_buffer);
- STRUPR (acpi_gbl_db_parsed_buf);
+ ACPI_STRCPY (acpi_gbl_db_parsed_buf, input_buffer);
+ ACPI_STRUPR (acpi_gbl_db_parsed_buf);
this = acpi_gbl_db_parsed_buf;
- for (i = 0; i < DB_MAX_ARGS; i++)
+ for (i = 0; i < ACPI_DEBUGGER_MAX_ARGS; i++)
{
acpi_gbl_db_args[i] = acpi_db_get_next_token (this, &next);
if (!acpi_gbl_db_args[i])
this = next;
}
-
/* Uppercase the actual command */
if (acpi_gbl_db_args[0])
{
- STRUPR (acpi_gbl_db_args[0]);
+ ACPI_STRUPR (acpi_gbl_db_args[0]);
}
count = i;
for (i = CMD_FIRST_VALID; acpi_gbl_db_commands[i].name; i++)
{
- if (STRSTR (acpi_gbl_db_commands[i].name, user_command) == acpi_gbl_db_commands[i].name)
+ if (ACPI_STRSTR (acpi_gbl_db_commands[i].name, user_command) ==
+ acpi_gbl_db_commands[i].name)
{
return (i);
}
status = AE_CTRL_TRUE;
}
return (status);
- break;
case CMD_HISTORY_LAST:
command_line = acpi_db_get_from_history (NULL);
if (op)
{
acpi_gbl_cm_single_step = TRUE;
-
-/* TBD: Must get current walk state */
- /* Acpi_gbl_Method_breakpoint = 0; */
return (AE_OK);
}
break;
else if (param_count == 2)
{
temp = acpi_gbl_db_console_debug_level;
- acpi_gbl_db_console_debug_level = STRTOUL (acpi_gbl_db_args[1], NULL, 16);
+ acpi_gbl_db_console_debug_level = ACPI_STRTOUL (acpi_gbl_db_args[1], NULL, 16);
acpi_os_printf ("Debug Level for console output was %8.8lX, now %8.8lX\n", temp, acpi_gbl_db_console_debug_level);
}
else
{
temp = acpi_gbl_db_debug_level;
- acpi_gbl_db_debug_level = STRTOUL (acpi_gbl_db_args[1], NULL, 16);
+ acpi_gbl_db_debug_level = ACPI_STRTOUL (acpi_gbl_db_args[1], NULL, 16);
acpi_os_printf ("Debug Level for file output was %8.8lX, now %8.8lX\n", temp, acpi_gbl_db_debug_level);
}
break;
break;
case CMD_NOTIFY:
- temp = STRTOUL (acpi_gbl_db_args[2], NULL, 0);
+ temp = ACPI_STRTOUL (acpi_gbl_db_args[2], NULL, 0);
acpi_db_send_notify (acpi_gbl_db_args[1], temp);
break;
case CMD_OBJECT:
- acpi_db_display_objects (STRUPR (acpi_gbl_db_args[1]), acpi_gbl_db_args[2]);
+ acpi_db_display_objects (ACPI_STRUPR (acpi_gbl_db_args[1]), acpi_gbl_db_args[2]);
break;
case CMD_OPEN:
case CMD_STOP:
return (AE_AML_ERROR);
- break;
case CMD_TABLES:
acpi_db_display_table_info (acpi_gbl_db_args[1]);
break;
case CMD_TERMINATE:
- acpi_db_set_output_destination (DB_REDIRECTABLE_OUTPUT);
+ acpi_db_set_output_destination (ACPI_DB_REDIRECTABLE_OUTPUT);
acpi_ut_subsystem_shutdown ();
/* TBD: [Restructure] Need some way to re-initialize without re-creating the semaphores! */
*
******************************************************************************/
-void
+void ACPI_SYSTEM_XFACE
acpi_db_execute_thread (
void *context)
{
acpi_status status = AE_OK;
+ acpi_status Mstatus;
while (status != AE_CTRL_TERMINATE)
acpi_gbl_method_executing = FALSE;
acpi_gbl_step_to_next_call = FALSE;
- acpi_ut_acquire_mutex (ACPI_MTX_DEBUG_CMD_READY);
+ Mstatus = acpi_ut_acquire_mutex (ACPI_MTX_DEBUG_CMD_READY);
+ if (ACPI_FAILURE (Mstatus))
+ {
+ return;
+ }
+
status = acpi_db_command_dispatch (acpi_gbl_db_line_buf, NULL, NULL);
- acpi_ut_release_mutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
+
+ Mstatus = acpi_ut_release_mutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
+ if (ACPI_FAILURE (Mstatus))
+ {
+ return;
+ }
}
}
acpi_db_single_thread (
void)
{
- acpi_status status = AE_OK;
+ acpi_status status;
acpi_gbl_method_executing = FALSE;
{
/* Force output to console until a command is entered */
- acpi_db_set_output_destination (DB_CONSOLE_OUTPUT);
+ acpi_db_set_output_destination (ACPI_DB_CONSOLE_OUTPUT);
/* Different prompt if method is executing */
if (!acpi_gbl_method_executing)
{
- acpi_os_printf ("%1c ", DB_COMMAND_PROMPT);
+ acpi_os_printf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT);
}
else
{
- acpi_os_printf ("%1c ", DB_EXECUTE_PROMPT);
+ acpi_os_printf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT);
}
/* Get the user input line */
* Signal the debug thread that we have a command to execute,
* and wait for the command to complete.
*/
- acpi_ut_release_mutex (ACPI_MTX_DEBUG_CMD_READY);
- acpi_ut_acquire_mutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
+ status = acpi_ut_release_mutex (ACPI_MTX_DEBUG_CMD_READY);
+ if (ACPI_FAILURE (status))
+ {
+ return (status);
+ }
+
+ status = acpi_ut_acquire_mutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
+ if (ACPI_FAILURE (status))
+ {
+ return (status);
+ }
}
-
else
{
/* Just call to the command line interpreter */
}
}
-
/*
* Only this thread (the original thread) should actually terminate the subsystem,
* because all the semaphores are deleted during termination
/*******************************************************************************
*
* Module Name: dbstats - Generation and display of ACPI table statistics
- * $Revision: 47 $
+ * $Revision: 55 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#ifdef ENABLE_DEBUGGER
#define _COMPONENT ACPI_DEBUGGER
- MODULE_NAME ("dbstats")
+ ACPI_MODULE_NAME ("dbstats")
/*
* Statistics subcommands
* RETURN: None
*
* DESCRIPTION: Add this object to the global counts, by object type.
- * Recursively handles subobjects and packages.
- *
- * [TBD] Restructure - remove recursion.
+ * Limited recursion handles subobjects and packages, and this
+ * is probably acceptable within the AML debugger only.
*
******************************************************************************/
acpi_db_enumerate_object (
acpi_operand_object *obj_desc)
{
- u32 type;
u32 i;
acpi_gbl_num_objects++;
- type = obj_desc->common.type;
- if (type > INTERNAL_TYPE_NODE_MAX)
+ if (obj_desc->common.type > INTERNAL_TYPE_NODE_MAX)
{
acpi_gbl_obj_type_count_misc++;
}
else
{
- acpi_gbl_obj_type_count [type]++;
+ acpi_gbl_obj_type_count [obj_desc->common.type]++;
}
/* Count the sub-objects */
- switch (type)
+ switch (obj_desc->common.type)
{
case ACPI_TYPE_PACKAGE:
- for (i = 0; i< obj_desc->package.count; i++)
+ for (i = 0; i < obj_desc->package.count; i++)
{
acpi_db_enumerate_object (obj_desc->package.elements[i]);
}
acpi_db_enumerate_object (obj_desc->device.addr_handler);
break;
+ case ACPI_TYPE_BUFFER_FIELD:
+ if (acpi_ns_get_secondary_object (obj_desc))
+ {
+ acpi_gbl_obj_type_count [ACPI_TYPE_BUFFER_FIELD]++;
+ }
+ break;
+
case ACPI_TYPE_REGION:
+ acpi_gbl_obj_type_count [INTERNAL_TYPE_REGION_FIELD ]++;
acpi_db_enumerate_object (obj_desc->region.addr_handler);
break;
acpi_gbl_num_nodes++;
node = (acpi_namespace_node *) obj_handle;
- obj_desc = ((acpi_namespace_node *) obj_handle)->object;
+ obj_desc = acpi_ns_get_attached_object (node);
acpi_db_enumerate_object (obj_desc);
{
u32 i;
u32 type;
- u32 outstanding;
u32 size;
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+ u32 outstanding;
+#endif
if (!acpi_gbl_DSDT)
return (AE_OK);
}
- STRUPR (type_arg);
+ ACPI_STRUPR (type_arg);
type = acpi_db_match_argument (type_arg, acpi_db_stat_types);
if (type == (u32) -1)
{
if (acpi_gbl_memory_lists[i].object_size)
{
- size = ROUND_UP_TO_1K (outstanding * acpi_gbl_memory_lists[i].object_size);
+ size = ACPI_ROUND_UP_TO_1K (outstanding * acpi_gbl_memory_lists[i].object_size);
}
else
{
- size = ROUND_UP_TO_1K (acpi_gbl_memory_lists[i].current_total_size);
+ size = ACPI_ROUND_UP_TO_1K (acpi_gbl_memory_lists[i].current_total_size);
}
acpi_os_printf (" Mem: [Alloc Free Outstanding Size] % 7d % 7d % 7d % 7d Kb\n",
acpi_os_printf ("Notify_handler %3d\n", sizeof (ACPI_OBJECT_NOTIFY_HANDLER));
acpi_os_printf ("Addr_handler %3d\n", sizeof (ACPI_OBJECT_ADDR_HANDLER));
acpi_os_printf ("Extra %3d\n", sizeof (ACPI_OBJECT_EXTRA));
+ acpi_os_printf ("Data %3d\n", sizeof (ACPI_OBJECT_DATA));
acpi_os_printf ("\n");
/*******************************************************************************
*
* Module Name: dbutils - AML debugger utilities
- * $Revision: 45 $
+ * $Revision: 51 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#ifdef ENABLE_DEBUGGER
#define _COMPONENT ACPI_DEBUGGER
- MODULE_NAME ("dbutils")
+ ACPI_MODULE_NAME ("dbutils")
/*******************************************************************************
acpi_gbl_db_output_flags = (u8) output_flags;
- if (output_flags & DB_REDIRECTABLE_OUTPUT) {
- if (acpi_gbl_db_output_to_file) {
- acpi_dbg_level = acpi_gbl_db_debug_level;
- }
+ if ((output_flags & ACPI_DB_REDIRECTABLE_OUTPUT) && acpi_gbl_db_output_to_file) {
+ acpi_dbg_level = acpi_gbl_db_debug_level;
}
else {
acpi_dbg_level = acpi_gbl_db_console_debug_level;
acpi_os_printf ("\n_location %X:\n", address);
acpi_dbg_level |= ACPI_LV_TABLES;
- acpi_ut_dump_buffer ((u8 *) address, 64, DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
+ acpi_ut_dump_buffer (ACPI_TO_POINTER (address), 64, DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
}
case ACPI_TYPE_INTEGER:
- acpi_os_printf ("[Integer] = %8.8X%8.8X\n", HIDWORD (obj_desc->integer.value),
- LODWORD (obj_desc->integer.value));
+ acpi_os_printf ("[Integer] = %8.8X%8.8X\n",
+ ACPI_HIDWORD (obj_desc->integer.value),
+ ACPI_LODWORD (obj_desc->integer.value));
break;
return;
}
- STRUPR (name);
+ ACPI_STRUPR (name);
/* Convert a leading forward slash to a backslash */
acpi_walk_state *walk_state;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
acpi_os_printf ("Pass two parse ....\n");
*
* DESCRIPTION: Lookup a name in the ACPI namespace
*
+ * Note: Currently begins search from the root. Could be enhanced to use
+ * the current prefix (scope) node as the search beginning point.
+ *
******************************************************************************/
acpi_namespace_node *
return (NULL);
}
- /* Lookup the name */
-
- /* TBD: [Investigate] what scope do we use? */
- /* Use the root scope for the start of the search */
-
- status = acpi_ns_lookup (NULL, internal_path, ACPI_TYPE_ANY, IMODE_EXECUTE,
- NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, NULL, &node);
-
+ /*
+ * Lookup the name.
+ * (Uses root node as the search starting point)
+ */
+ status = acpi_ns_lookup (NULL, internal_path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+ ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE, NULL, &node);
if (ACPI_FAILURE (status)) {
acpi_os_printf ("Could not locate name: %s %s\n", name, acpi_format_exception (status));
}
-
ACPI_MEM_FREE (internal_path);
-
return (node);
}
/*******************************************************************************
*
* Module Name: dbxface - AML Debugger external interfaces
- * $Revision: 45 $
+ * $Revision: 55 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#ifdef ENABLE_DEBUGGER
#define _COMPONENT ACPI_DEBUGGER
- MODULE_NAME ("dbxface")
+ ACPI_MODULE_NAME ("dbxface")
/*******************************************************************************
acpi_status status = AE_OK;
u32 original_debug_level;
acpi_parse_object *display_op;
+ acpi_parse_object *parent_op;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
- /* Is there a breakpoint set? */
+ /* Check for single-step breakpoint */
- if (walk_state->method_breakpoint) {
+ if (walk_state->method_breakpoint && (walk_state->method_breakpoint <= op->aml_offset)) {
/* Check if the breakpoint has been reached or passed */
+ /* Hit the breakpoint, resume single step, reset breakpoint */
- if (walk_state->method_breakpoint <= op->aml_offset) {
- /* Hit the breakpoint, resume single step, reset breakpoint */
+ acpi_os_printf ("***Break*** at AML offset %X\n", op->aml_offset);
+ acpi_gbl_cm_single_step = TRUE;
+ acpi_gbl_step_to_next_call = FALSE;
+ walk_state->method_breakpoint = 0;
+ }
- acpi_os_printf ("***Break*** at AML offset %X\n", op->aml_offset);
- acpi_gbl_cm_single_step = TRUE;
- acpi_gbl_step_to_next_call = FALSE;
- walk_state->method_breakpoint = 0;
- }
+ /* Check for user breakpoint (Must be on exact Aml offset) */
+
+ else if (walk_state->user_breakpoint && (walk_state->user_breakpoint == op->aml_offset)) {
+ acpi_os_printf ("***User_breakpoint*** at AML offset %X\n", op->aml_offset);
+ acpi_gbl_cm_single_step = TRUE;
+ acpi_gbl_step_to_next_call = FALSE;
+ walk_state->method_breakpoint = 0;
}
+
/*
* Check if this is an opcode that we are interested in --
* namely, opcodes that have arguments
case AML_CLASS_UNKNOWN:
case AML_CLASS_ARGUMENT: /* constants, literals, etc. do nothing */
return (AE_OK);
- break;
}
/*
display_op = op;
- if (op->parent) {
- if ((op->parent->opcode == AML_IF_OP) ||
- (op->parent->opcode == AML_WHILE_OP)) {
- display_op = op->parent;
+ parent_op = op->parent;
+ if (parent_op) {
+ if ((walk_state->control_state) &&
+ (walk_state->control_state->common.state == ACPI_CONTROL_PREDICATE_EXECUTING)) {
+ /*
+ * We are executing the predicate of an IF or WHILE statement
+ * Search upwards for the containing IF or WHILE so that the
+ * entire predicate can be displayed.
+ */
+ while (parent_op) {
+ if ((parent_op->opcode == AML_IF_OP) ||
+ (parent_op->opcode == AML_WHILE_OP)) {
+ display_op = parent_op;
+ break;
+ }
+ parent_op = parent_op->parent;
+ }
+ }
+ else {
+ while (parent_op) {
+ if ((parent_op->opcode == AML_IF_OP) ||
+ (parent_op->opcode == AML_ELSE_OP) ||
+ (parent_op->opcode == AML_SCOPE_OP) ||
+ (parent_op->opcode == AML_METHOD_OP) ||
+ (parent_op->opcode == AML_WHILE_OP)) {
+ break;
+ }
+ display_op = parent_op;
+ parent_op = parent_op->parent;
+ }
}
}
if ((op->opcode == AML_IF_OP) ||
(op->opcode == AML_WHILE_OP)) {
if (walk_state->control_state->common.value) {
- acpi_os_printf ("Predicate was TRUE, executed block\n");
+ acpi_os_printf ("Predicate = [True], IF block was executed\n");
}
else {
- acpi_os_printf ("Predicate is FALSE, skipping block\n");
+ acpi_os_printf ("Predicate = [False], Skipping IF block\n");
}
}
else if (op->opcode == AML_ELSE_OP) {
- /* TBD */
+ acpi_os_printf ("Predicate = [False], ELSE block was executed\n");
}
/* Restore everything */
return (AE_OK);
}
-
/*
* If we are executing a step-to-call command,
* Check if this is a method call.
acpi_gbl_step_to_next_call = FALSE;
}
-
/*
* If the next opcode is a method call, we will "step over" it
* by default.
if (op->opcode == AML_INT_METHODCALL_OP) {
acpi_gbl_cm_single_step = FALSE; /* No more single step while executing called method */
- /* Set the breakpoint on the call, it will stop execution as soon as we return */
+ /* Set the breakpoint on/before the call, it will stop execution as soon as we return */
- /* TBD: [Future] don't kill the user breakpoint! */
-
- walk_state->method_breakpoint = /* Op->Aml_offset + */ 1; /* Must be non-zero! */
+ walk_state->method_breakpoint = 1; /* Must be non-zero! */
}
if (acpi_gbl_debugger_configuration == DEBUGGER_MULTI_THREADED) {
/* Handshake with the front-end that gets user command lines */
- acpi_ut_release_mutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
- acpi_ut_acquire_mutex (ACPI_MTX_DEBUG_CMD_READY);
+ status = acpi_ut_release_mutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
+ status = acpi_ut_acquire_mutex (ACPI_MTX_DEBUG_CMD_READY);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
}
else {
/* Force output to console until a command is entered */
- acpi_db_set_output_destination (DB_CONSOLE_OUTPUT);
+ acpi_db_set_output_destination (ACPI_DB_CONSOLE_OUTPUT);
/* Different prompt if method is executing */
if (!acpi_gbl_method_executing) {
- acpi_os_printf ("%1c ", DB_COMMAND_PROMPT);
+ acpi_os_printf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT);
}
else {
- acpi_os_printf ("%1c ", DB_EXECUTE_PROMPT);
+ acpi_os_printf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT);
}
/* Get the user input line */
acpi_db_initialize (void)
{
-
/* Init globals */
- acpi_gbl_db_buffer = acpi_os_callocate (ACPI_DEBUG_BUFFER_SIZE);
+ acpi_gbl_db_buffer = NULL;
+ acpi_gbl_db_filename = NULL;
+ acpi_gbl_db_output_to_file = FALSE;
+
+ acpi_gbl_db_debug_level = ACPI_LV_VERBOSITY2;
+ acpi_gbl_db_console_debug_level = NORMAL_DEFAULT | ACPI_LV_TABLES;
+ acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT;
+
+ acpi_gbl_db_opt_tables = FALSE;
+ acpi_gbl_db_opt_disasm = FALSE;
+ acpi_gbl_db_opt_stats = FALSE;
+ acpi_gbl_db_opt_verbose = TRUE;
+ acpi_gbl_db_opt_ini_methods = TRUE;
+
+ acpi_gbl_db_buffer = acpi_os_allocate (ACPI_DEBUG_BUFFER_SIZE);
+ if (!acpi_gbl_db_buffer) {
+ return 0;
+ }
+ ACPI_MEMSET (acpi_gbl_db_buffer, 0, ACPI_DEBUG_BUFFER_SIZE);
/* Initial scope is the root */
acpi_gbl_db_scope_buf [0] = '\\';
acpi_gbl_db_scope_buf [1] = 0;
-
+ acpi_gbl_db_scope_node = acpi_gbl_root_node;
/*
* If configured for multi-thread support, the debug executor runs in
#
# Makefile for all Linux ACPI interpreter subdirectories
-# EXCEPT for the ospm directory
#
O_TARGET := $(notdir $(CURDIR)).o
-obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c))
+obj-$(CONFIG_ACPI_INTERPRETER) := $(patsubst %.c,%.o,$(wildcard *.c))
EXTRA_CFLAGS += $(ACPI_CFLAGS)
/******************************************************************************
*
* Module Name: dsfield - Dispatcher field routines
- * $Revision: 46 $
+ * $Revision: 62 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_DISPATCHER
- MODULE_NAME ("dsfield")
+ ACPI_MODULE_NAME ("dsfield")
/*******************************************************************************
acpi_namespace_node *node;
acpi_status status;
acpi_operand_object *obj_desc;
+ acpi_operand_object *second_desc = NULL;
+ u32 flags;
- FUNCTION_TRACE ("Ds_create_buffer_field");
+ ACPI_FUNCTION_TRACE ("Ds_create_buffer_field");
/* Get the Name_string argument */
return_ACPI_STATUS (AE_AML_NO_OPERAND);
}
+ /*
+ * During the load phase, we want to enter the name of the field into
+ * the namespace. During the execute phase (when we evaluate the size
+ * operand), we want to lookup the name
+ */
+ if (walk_state->parse_flags & ACPI_PARSE_EXECUTE) {
+ flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE;
+ }
+ else {
+ flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND;
+ }
+
/*
* Enter the Name_string into the namespace
*/
status = acpi_ns_lookup (walk_state->scope_info, arg->value.string,
- INTERNAL_TYPE_DEF_ANY, IMODE_LOAD_PASS1,
- NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
- walk_state, &(node));
+ INTERNAL_TYPE_DEF_ANY, ACPI_IMODE_LOAD_PASS1,
+ flags, walk_state, &(node));
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
* we need to create the field object. Otherwise, this was a lookup of an
* existing node and we don't want to create the field object again.
*/
- if (node->object) {
+ obj_desc = acpi_ns_get_attached_object (node);
+ if (obj_desc) {
return_ACPI_STATUS (AE_OK);
}
goto cleanup;
}
- /*
- * Allocate a method object for this field unit
- */
- obj_desc->buffer_field.extra = acpi_ut_create_internal_object (
- INTERNAL_TYPE_EXTRA);
- if (!obj_desc->buffer_field.extra) {
- status = AE_NO_MEMORY;
- goto cleanup;
- }
-
/*
* Remember location in AML stream of the field unit
* opcode and operands -- since the buffer and index
* operands must be evaluated.
*/
- obj_desc->buffer_field.extra->extra.aml_start = ((acpi_parse2_object *) op)->data;
- obj_desc->buffer_field.extra->extra.aml_length = ((acpi_parse2_object *) op)->length;
+ second_desc = obj_desc->common.next_object;
+ second_desc->extra.aml_start = ((acpi_parse2_object *) op)->data;
+ second_desc->extra.aml_length = ((acpi_parse2_object *) op)->length;
obj_desc->buffer_field.node = node;
- /* Attach constructed field descriptor to parent node */
+ /* Attach constructed field descriptors to parent node */
status = acpi_ns_attach_object (node, obj_desc, ACPI_TYPE_BUFFER_FIELD);
+ if (ACPI_FAILURE (status)) {
+ goto cleanup;
+ }
cleanup:
acpi_status status;
- FUNCTION_TRACE_U32 ("Ds_get_field_names", info);
+ ACPI_FUNCTION_TRACE_PTR ("Ds_get_field_names", info);
/* First field starts at bit zero */
switch (arg->opcode) {
case AML_INT_RESERVEDFIELD_OP:
+ if (((acpi_integer) info->field_bit_position + arg->value.size) >
+ ACPI_UINT32_MAX) {
+ ACPI_REPORT_ERROR (("Bit offset within field too large (> 0xFFFFFFFF)\n"));
+ return_ACPI_STATUS (AE_SUPPORT);
+ }
+
info->field_bit_position += arg->value.size;
break;
case AML_INT_ACCESSFIELD_OP:
/*
- * Get a new Access_type and Access_attribute for all
- * entries (until end or another Access_as keyword)
+ * Get a new Access_type and Access_attribute -- to be used for all
+ * field units that follow, until field end or another Access_as keyword.
+ *
+ * In Field_flags, preserve the flag bits other than the ACCESS_TYPE bits
*/
- info->field_flags = (u8) ((info->field_flags & FIELD_ACCESS_TYPE_MASK) ||
- ((u8) (arg->value.integer >> 8)));
+ info->field_flags = (u8) ((info->field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) |
+ ((u8) (arg->value.integer32 >> 8)));
+
+ info->attribute = (u8) (arg->value.integer32);
break;
case AML_INT_NAMEDFIELD_OP:
- /* Enter a new field name into the namespace */
+ /* Lookup the name */
status = acpi_ns_lookup (walk_state->scope_info,
(NATIVE_CHAR *) &((acpi_parse2_object *)arg)->name,
- info->field_type, IMODE_LOAD_PASS1,
- NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
- NULL, &info->field_node);
+ info->field_type, ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE,
+ walk_state, &info->field_node);
if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
+ if (status != AE_ALREADY_EXISTS) {
+ return_ACPI_STATUS (status);
+ }
- /* Create and initialize an object for the new Field Node */
+ ACPI_REPORT_ERROR (("Field name [%4.4s] already exists in current scope\n",
+ &((acpi_parse2_object *)arg)->name));
+ }
+ else {
+ arg->node = info->field_node;
+ info->field_bit_length = arg->value.size;
- info->field_bit_length = arg->value.size;
+ /* Create and initialize an object for the new Field Node */
- status = acpi_ex_prep_field_value (info);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ status = acpi_ex_prep_field_value (info);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
}
/* Keep track of bit position for the next field */
+ if (((acpi_integer) info->field_bit_position + arg->value.size) >
+ ACPI_UINT32_MAX) {
+ ACPI_REPORT_ERROR (("Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n",
+ &info->field_node->name));
+ return_ACPI_STATUS (AE_SUPPORT);
+ }
+
info->field_bit_position += info->field_bit_length;
break;
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid opcode in field list: %X\n",
arg->opcode));
return_ACPI_STATUS (AE_AML_ERROR);
- break;
}
arg = arg->next;
ACPI_CREATE_FIELD_INFO info;
- FUNCTION_TRACE_PTR ("Ds_create_field", op);
+ ACPI_FUNCTION_TRACE_PTR ("Ds_create_field", op);
/* First arg is the name of the parent Op_region (must already exist) */
arg = op->value.arg;
if (!region_node) {
status = acpi_ns_lookup (walk_state->scope_info, arg->value.name,
- ACPI_TYPE_REGION, IMODE_EXECUTE,
- NS_SEARCH_PARENT, walk_state, ®ion_node);
+ ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE,
+ ACPI_NS_SEARCH_PARENT, walk_state, ®ion_node);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
arg = arg->next;
info.field_flags = arg->value.integer8;
+ info.attribute = 0;
/* Each remaining arg is a Named Field */
}
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ds_init_field_objects
+ *
+ * PARAMETERS: Op - Op containing the Field definition and args
+ * ` Walk_state - Current method state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: For each "Field Unit" name in the argument list that is
+ * part of the field declaration, enter the name into the
+ * namespace.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ds_init_field_objects (
+ acpi_parse_object *op,
+ acpi_walk_state *walk_state)
+{
+ acpi_status status = AE_AML_ERROR;
+ acpi_parse_object *arg = NULL;
+ acpi_namespace_node *node;
+ u8 type = 0;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("Ds_init_field_objects", op);
+
+
+ switch (walk_state->opcode) {
+ case AML_FIELD_OP:
+ arg = acpi_ps_get_arg (op, 2);
+ type = INTERNAL_TYPE_REGION_FIELD;
+ break;
+
+ case AML_BANK_FIELD_OP:
+ arg = acpi_ps_get_arg (op, 4);
+ type = INTERNAL_TYPE_BANK_FIELD;
+ break;
+
+ case AML_INDEX_FIELD_OP:
+ arg = acpi_ps_get_arg (op, 3);
+ type = INTERNAL_TYPE_INDEX_FIELD;
+ break;
+ }
+
+ /*
+ * Walk the list of entries in the Field_list
+ */
+ while (arg) {
+ /* Ignore OFFSET and ACCESSAS terms here */
+
+ if (arg->opcode == AML_INT_NAMEDFIELD_OP) {
+ status = acpi_ns_lookup (walk_state->scope_info,
+ (NATIVE_CHAR *) &((acpi_parse2_object *)arg)->name,
+ type, ACPI_IMODE_LOAD_PASS1,
+ ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND,
+ walk_state, &node);
+ if (ACPI_FAILURE (status)) {
+ if (status != AE_ALREADY_EXISTS) {
+ return_ACPI_STATUS (status);
+ }
+
+ ACPI_REPORT_ERROR (("Field name [%4.4s] already exists in current scope\n",
+ &((acpi_parse2_object *)arg)->name));
+ }
+
+ arg->node = node;
+ }
+
+ /* Move to next field in the list */
+
+ arg = arg->next;
+ }
+
+ return_ACPI_STATUS (status);
+}
+
+
/*******************************************************************************
*
* FUNCTION: Acpi_ds_create_bank_field
ACPI_CREATE_FIELD_INFO info;
- FUNCTION_TRACE_PTR ("Ds_create_bank_field", op);
+ ACPI_FUNCTION_TRACE_PTR ("Ds_create_bank_field", op);
/* First arg is the name of the parent Op_region (must already exist) */
arg = op->value.arg;
if (!region_node) {
status = acpi_ns_lookup (walk_state->scope_info, arg->value.name,
- ACPI_TYPE_REGION, IMODE_EXECUTE,
- NS_SEARCH_PARENT, walk_state, ®ion_node);
+ ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE,
+ ACPI_NS_SEARCH_PARENT, walk_state, ®ion_node);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
arg = arg->next;
status = acpi_ns_lookup (walk_state->scope_info, arg->value.string,
- INTERNAL_TYPE_BANK_FIELD_DEFN, IMODE_EXECUTE,
- NS_SEARCH_PARENT, walk_state, &info.register_node);
+ INTERNAL_TYPE_BANK_FIELD_DEFN, ACPI_IMODE_EXECUTE,
+ ACPI_NS_SEARCH_PARENT, walk_state, &info.register_node);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
ACPI_CREATE_FIELD_INFO info;
- FUNCTION_TRACE_PTR ("Ds_create_index_field", op);
+ ACPI_FUNCTION_TRACE_PTR ("Ds_create_index_field", op);
/* First arg is the name of the Index register (must already exist) */
arg = op->value.arg;
status = acpi_ns_lookup (walk_state->scope_info, arg->value.string,
- ACPI_TYPE_ANY, IMODE_EXECUTE,
- NS_SEARCH_PARENT, walk_state, &info.register_node);
+ ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+ ACPI_NS_SEARCH_PARENT, walk_state, &info.register_node);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
arg = arg->next;
status = acpi_ns_lookup (walk_state->scope_info, arg->value.string,
- INTERNAL_TYPE_INDEX_FIELD_DEFN, IMODE_EXECUTE,
- NS_SEARCH_PARENT, walk_state, &info.data_register_node);
+ INTERNAL_TYPE_INDEX_FIELD_DEFN, ACPI_IMODE_EXECUTE,
+ ACPI_NS_SEARCH_PARENT, walk_state, &info.data_register_node);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/******************************************************************************
*
* Module Name: dsmethod - Parser/Interpreter interface - control method parsing
- * $Revision: 69 $
+ * $Revision: 79 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_DISPATCHER
- MODULE_NAME ("dsmethod")
+ ACPI_MODULE_NAME ("dsmethod")
/*******************************************************************************
acpi_walk_state *walk_state;
- FUNCTION_TRACE_PTR ("Ds_parse_method", obj_handle);
+ ACPI_FUNCTION_TRACE_PTR ("Ds_parse_method", obj_handle);
/* Parameter Validation */
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Parsing [%4.4s] **** Named_obj=%p\n",
- (char*)&((acpi_namespace_node *)obj_handle)->name, obj_handle));
-
+ (char *) &((acpi_namespace_node *) obj_handle)->name, obj_handle));
/* Extract the method object from the method Node */
node = (acpi_namespace_node *) obj_handle;
- obj_desc = node->object;
+ obj_desc = acpi_ns_get_attached_object (node);
if (!obj_desc) {
return_ACPI_STATUS (AE_NULL_OBJECT);
}
acpi_ps_set_name (op, node->name);
op->node = node;
+ /*
+ * Get a new Owner_id for objects created by this method. Namespace
+ * objects (such as Operation Regions) can be created during the
+ * first pass parse.
+ */
+ owner_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_METHOD);
+ obj_desc->method.owning_id = owner_id;
+
/* Create and initialize a new walk state */
- walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT,
+ walk_state = acpi_ds_create_walk_state (owner_id,
NULL, NULL, NULL);
if (!walk_state) {
return_ACPI_STATUS (AE_NO_MEMORY);
status = acpi_ds_init_aml_walk (walk_state, op, node, obj_desc->method.aml_start,
obj_desc->method.aml_length, NULL, NULL, 1);
if (ACPI_FAILURE (status)) {
- /* TBD: delete walk state */
+ acpi_ds_delete_walk_state (walk_state);
return_ACPI_STATUS (status);
}
return_ACPI_STATUS (status);
}
- /* Get a new Owner_id for objects created by this method */
-
- owner_id = acpi_ut_allocate_owner_id (OWNER_TYPE_METHOD);
- obj_desc->method.owning_id = owner_id;
-
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** [%4.4s] Parsed **** Named_obj=%p Op=%p\n",
- (char*)&((acpi_namespace_node *)obj_handle)->name, obj_handle, op));
+ (char *) &((acpi_namespace_node *) obj_handle)->name, obj_handle, op));
acpi_ps_delete_parse_tree (op);
-
return_ACPI_STATUS (status);
}
acpi_status status = AE_OK;
- FUNCTION_TRACE_PTR ("Ds_begin_method_execution", method_node);
+ ACPI_FUNCTION_TRACE_PTR ("Ds_begin_method_execution", method_node);
if (!method_node) {
return_ACPI_STATUS (AE_NULL_ENTRY);
}
-
/*
* If there is a concurrency limit on this method, we need to
* obtain a unit from the method semaphore.
WAIT_FOREVER);
}
-
/*
* Increment the method parse tree thread count since it has been
* reentered one more time (even if it is the same thread)
*/
obj_desc->method.thread_count++;
-
return_ACPI_STATUS (status);
}
acpi_status
acpi_ds_call_control_method (
- acpi_walk_list *walk_list,
+ ACPI_THREAD_STATE *thread,
acpi_walk_state *this_walk_state,
- acpi_parse_object *op) /* TBD: This operand is obsolete */
+ acpi_parse_object *op)
{
acpi_status status;
acpi_namespace_node *method_node;
u32 i;
- FUNCTION_TRACE_PTR ("Ds_call_control_method", this_walk_state);
+ ACPI_FUNCTION_TRACE_PTR ("Ds_call_control_method", this_walk_state);
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Execute method %p, currentstate=%p\n",
this_walk_state->prev_op, this_walk_state));
return_ACPI_STATUS (status);
}
-
/* 1) Parse: Create a new walk state for the preempting walk */
next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id,
op, obj_desc, NULL);
if (!next_walk_state) {
return_ACPI_STATUS (AE_NO_MEMORY);
- goto cleanup;
}
/* Create and init a Root Node */
obj_desc->method.aml_start, obj_desc->method.aml_length,
NULL, NULL, 1);
if (ACPI_FAILURE (status)) {
- /* TBD: delete walk state */
+ acpi_ds_delete_walk_state (next_walk_state);
goto cleanup;
}
status = acpi_ps_parse_aml (next_walk_state);
acpi_ps_delete_parse_tree (op);
-
/* 2) Execute: Create a new state for the preempting walk */
next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id,
- NULL, obj_desc, walk_list);
+ NULL, obj_desc, thread);
if (!next_walk_state) {
status = AE_NO_MEMORY;
goto cleanup;
acpi_status status;
- FUNCTION_TRACE_PTR ("Ds_restart_control_method", walk_state);
+ ACPI_FUNCTION_TRACE_PTR ("Ds_restart_control_method", walk_state);
if (return_desc) {
return_ACPI_STATUS (status);
}
}
-
else {
/*
* Delete the return value if it will not be used by the
*/
acpi_ut_remove_reference (return_desc);
}
-
}
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
{
acpi_operand_object *obj_desc;
acpi_namespace_node *method_node;
+ acpi_status status;
- FUNCTION_TRACE_PTR ("Ds_terminate_control_method", walk_state);
+ ACPI_FUNCTION_TRACE_PTR ("Ds_terminate_control_method", walk_state);
- /* The method object should be stored in the walk state */
+ /* The current method object was saved in the walk state */
obj_desc = walk_state->method_desc;
if (!obj_desc) {
* If this is the last thread executing the method,
* we have additional cleanup to perform
*/
- acpi_ut_acquire_mutex (ACPI_MTX_PARSER);
-
+ status = acpi_ut_acquire_mutex (ACPI_MTX_PARSER);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
/* Signal completion of the execution of this method if necessary */
* Delete any namespace entries created immediately underneath
* the method
*/
- acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+
if (method_node->child) {
acpi_ns_delete_namespace_subtree (method_node);
}
* the namespace
*/
acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owning_id);
- acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
}
- acpi_ut_release_mutex (ACPI_MTX_PARSER);
- return_ACPI_STATUS (AE_OK);
+ status = acpi_ut_release_mutex (ACPI_MTX_PARSER);
+ return_ACPI_STATUS (status);
}
/*******************************************************************************
*
* Module Name: dsmthdat - control method arguments and local variables
- * $Revision: 49 $
+ * $Revision: 58 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_DISPATCHER
- MODULE_NAME ("dsmthdat")
+ ACPI_MODULE_NAME ("dsmthdat")
/*******************************************************************************
* This allows Ref_of and De_ref_of to work properly for these
* special data types.
*
+ * NOTES: Walk_state fields are initialized to zero by the
+ * ACPI_MEM_CALLOCATE().
+ *
+ * A pseudo-Namespace Node is assigned to each argument and local
+ * so that Ref_of() can return a pointer to the Node.
+ *
******************************************************************************/
acpi_status
u32 i;
- FUNCTION_TRACE ("Ds_method_data_init");
+ ACPI_FUNCTION_TRACE ("Ds_method_data_init");
- /*
- * Walk_state fields are initialized to zero by the
- * ACPI_MEM_CALLOCATE().
- *
- * An Node is assigned to each argument and local so
- * that Ref_of() can return a pointer to the Node.
- */
/* Init the method arguments */
for (i = 0; i < MTH_NUM_ARGS; i++) {
- MOVE_UNALIGNED32_TO_32 (&walk_state->arguments[i].name,
+ ACPI_MOVE_UNALIGNED32_TO_32 (&walk_state->arguments[i].name,
NAMEOF_ARG_NTE);
- walk_state->arguments[i].name |= (i << 24);
- walk_state->arguments[i].data_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].name |= (i << 24);
+ walk_state->arguments[i].descriptor = 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;
}
/* Init the method locals */
for (i = 0; i < MTH_NUM_LOCALS; i++) {
- MOVE_UNALIGNED32_TO_32 (&walk_state->local_variables[i].name,
+ ACPI_MOVE_UNALIGNED32_TO_32 (&walk_state->local_variables[i].name,
NAMEOF_LOCAL_NTE);
- walk_state->local_variables[i].name |= (i << 24);
- walk_state->local_variables[i].data_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].name |= (i << 24);
+ walk_state->local_variables[i].descriptor = 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;
}
return_ACPI_STATUS (AE_OK);
acpi_walk_state *walk_state)
{
u32 index;
- acpi_operand_object *object;
-
- FUNCTION_TRACE ("Ds_method_data_delete_all");
+ ACPI_FUNCTION_TRACE ("Ds_method_data_delete_all");
- /* Delete the locals */
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Deleting local variables in %p\n", walk_state));
+ /* Detach the locals */
for (index = 0; index < MTH_NUM_LOCALS; index++) {
- object = walk_state->local_variables[index].object;
- if (object) {
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Local%d=%p\n", index, object));
-
- /* Remove first */
-
- walk_state->local_variables[index].object = NULL;
+ if (walk_state->local_variables[index].object) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Local%d=%p\n",
+ index, walk_state->local_variables[index].object));
- /* Was given a ref when stored */
+ /* Detach object (if present) and remove a reference */
- acpi_ut_remove_reference (object);
+ acpi_ns_detach_object (&walk_state->local_variables[index]);
}
}
-
- /* Delete the arguments */
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Deleting arguments in %p\n", walk_state));
+ /* Detach the arguments */
for (index = 0; index < MTH_NUM_ARGS; index++) {
- object = walk_state->arguments[index].object;
- if (object) {
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Arg%d=%p\n", index, object));
-
- /* Remove first */
-
- walk_state->arguments[index].object = NULL;
+ if (walk_state->arguments[index].object) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Arg%d=%p\n",
+ index, walk_state->arguments[index].object));
- /* Was given a ref when stored */
+ /* Detach object (if present) and remove a reference */
- acpi_ut_remove_reference (object);
+ acpi_ns_detach_object (&walk_state->arguments[index]);
}
}
*
* RETURN: Status
*
- * DESCRIPTION: Initialize arguments for a method
+ * DESCRIPTION: Initialize arguments for a method. The parameter list is a list
+ * of ACPI operand objects, either null terminated or whose length
+ * is defined by Max_param_count.
*
******************************************************************************/
acpi_walk_state *walk_state)
{
acpi_status status;
- u32 mindex;
- u32 pindex;
+ u32 index = 0;
- FUNCTION_TRACE_PTR ("Ds_method_data_init_args", params);
+ ACPI_FUNCTION_TRACE_PTR ("Ds_method_data_init_args", params);
if (!params) {
/* Copy passed parameters into the new method stack frame */
- for (pindex = mindex = 0;
- (mindex < MTH_NUM_ARGS) && (pindex < max_param_count);
- mindex++) {
- if (params[pindex]) {
- /*
- * A valid parameter.
- * Set the current method argument to the
- * Params[Pindex++] argument object descriptor
- */
- status = acpi_ds_store_object_to_local (AML_ARG_OP, mindex,
- params[pindex], walk_state);
- if (ACPI_FAILURE (status)) {
- break;
- }
-
- pindex++;
+ while ((index < MTH_NUM_ARGS) && (index < max_param_count) && params[index]) {
+ /*
+ * A valid parameter.
+ * Store the argument in the method/walk descriptor
+ */
+ status = acpi_ds_store_object_to_local (AML_ARG_OP, index, params[index],
+ walk_state);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
}
- else {
- break;
- }
+ index++;
}
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%d args passed to method\n", pindex));
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%d args passed to method\n", index));
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: Acpi_ds_method_data_get_entry
+ * FUNCTION: Acpi_ds_method_data_get_node
*
* PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
- * Index - Which local_var or argument to get
- * Entry - Pointer to where a pointer to the stack
- * entry is returned.
+ * Index - Which local_var or argument whose type
+ * to get
* Walk_state - Current walk state object
*
- * RETURN: Status
- *
- * DESCRIPTION: Get the address of the object entry given by Opcode:Index
+ * RETURN: Get the Node associated with a local or arg.
*
******************************************************************************/
acpi_status
-acpi_ds_method_data_get_entry (
+acpi_ds_method_data_get_node (
u16 opcode,
u32 index,
acpi_walk_state *walk_state,
- acpi_operand_object ***entry)
+ acpi_namespace_node **node)
{
-
- FUNCTION_TRACE_U32 ("Ds_method_data_get_entry", index);
+ ACPI_FUNCTION_TRACE ("Ds_method_data_get_node");
/*
- * Get the requested object.
- * The stack "Opcode" is either a Local_variable or an Argument
+ * Method Locals and Arguments are supported
*/
switch (opcode) {
-
case AML_LOCAL_OP:
if (index > MTH_MAX_LOCAL) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Local_var index %d is invalid (max %d)\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Local index %d is invalid (max %d)\n",
index, MTH_MAX_LOCAL));
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ return_ACPI_STATUS (AE_AML_INVALID_INDEX);
}
- *entry = (acpi_operand_object **)
- &walk_state->local_variables[index].object;
- break;
+ /* Return a pointer to the pseudo-node */
+ *node = &walk_state->local_variables[index];
+ break;
case AML_ARG_OP:
if (index > MTH_MAX_ARG) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Arg index %d is invalid (max %d)\n",
index, MTH_MAX_ARG));
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ return_ACPI_STATUS (AE_AML_INVALID_INDEX);
}
- *entry = (acpi_operand_object **)
- &walk_state->arguments[index].object;
- break;
+ /* Return a pointer to the pseudo-node */
+ *node = &walk_state->arguments[index];
+ break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Opcode %d is invalid\n", opcode));
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ return_ACPI_STATUS (AE_AML_BAD_OPCODE);
}
-
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: Acpi_ds_method_data_set_entry
+ * FUNCTION: Acpi_ds_method_data_set_value
*
* PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
* Index - Which local_var or argument to get
******************************************************************************/
acpi_status
-acpi_ds_method_data_set_entry (
+acpi_ds_method_data_set_value (
u16 opcode,
u32 index,
acpi_operand_object *object,
acpi_walk_state *walk_state)
{
acpi_status status;
- acpi_operand_object **entry;
+ acpi_namespace_node *node;
- FUNCTION_TRACE ("Ds_method_data_set_entry");
+ ACPI_FUNCTION_TRACE ("Ds_method_data_set_value");
- /* Get a pointer to the stack entry to set */
+ /* Get the namespace node for the arg/local */
- status = acpi_ds_method_data_get_entry (opcode, index, walk_state, &entry);
+ status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/* Install the object into the stack entry */
- *entry = object;
-
+ node->object = object;
return_ACPI_STATUS (AE_OK);
}
* to get
* Walk_state - Current walk state object
*
- * RETURN: Data type of selected Arg or Local
- * Used only in Exec_monadic2()/Type_op.
+ * RETURN: Data type of current value of the selected Arg or Local
*
******************************************************************************/
-acpi_object_type8
+acpi_object_type
acpi_ds_method_data_get_type (
u16 opcode,
u32 index,
acpi_walk_state *walk_state)
{
acpi_status status;
- acpi_operand_object **entry;
+ acpi_namespace_node *node;
acpi_operand_object *object;
- FUNCTION_TRACE ("Ds_method_data_get_type");
+ ACPI_FUNCTION_TRACE ("Ds_method_data_get_type");
- /* Get a pointer to the requested stack entry */
+ /* Get the namespace node for the arg/local */
- status = acpi_ds_method_data_get_entry (opcode, index, walk_state, &entry);
+ status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
if (ACPI_FAILURE (status)) {
return_VALUE ((ACPI_TYPE_NOT_FOUND));
}
- /* Get the object from the method stack */
-
- object = *entry;
-
- /* Get the object type */
+ /* Get the object */
+ object = acpi_ns_get_attached_object (node);
if (!object) {
- /* Any == 0 => "uninitialized" -- see spec 15.2.3.5.2.28 */
- return_VALUE (ACPI_TYPE_ANY);
- }
-
- return_VALUE (object->common.type);
-}
+ /* Uninitialized local/arg, return TYPE_ANY */
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ds_method_data_get_node
- *
- * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
- * Index - Which local_var or argument whose type
- * to get
- * Walk_state - Current walk state object
- *
- * RETURN: Get the Node associated with a local or arg.
- *
- ******************************************************************************/
-
-acpi_namespace_node *
-acpi_ds_method_data_get_node (
- u16 opcode,
- u32 index,
- acpi_walk_state *walk_state)
-{
- acpi_namespace_node *node = NULL;
-
-
- FUNCTION_TRACE ("Ds_method_data_get_node");
-
-
- switch (opcode) {
-
- case AML_LOCAL_OP:
-
- if (index > MTH_MAX_LOCAL) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Local index %d is invalid (max %d)\n",
- index, MTH_MAX_LOCAL));
- return_PTR (node);
- }
-
- node = &walk_state->local_variables[index];
- break;
-
-
- case AML_ARG_OP:
-
- if (index > MTH_MAX_ARG) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Arg index %d is invalid (max %d)\n",
- index, MTH_MAX_ARG));
- return_PTR (node);
- }
-
- node = &walk_state->arguments[index];
- break;
-
-
- default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Opcode %d is invalid\n", opcode));
- break;
+ return_VALUE (ACPI_TYPE_ANY);
}
+ /* Get the object type */
- return_PTR (node);
+ return_VALUE (object->common.type);
}
acpi_operand_object **dest_desc)
{
acpi_status status;
- acpi_operand_object **entry;
+ acpi_namespace_node *node;
acpi_operand_object *object;
- FUNCTION_TRACE ("Ds_method_data_get_value");
+ ACPI_FUNCTION_TRACE ("Ds_method_data_get_value");
/* Validate the object descriptor */
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
+ /* Get the namespace node for the arg/local */
- /* Get a pointer to the requested method stack entry */
-
- status = acpi_ds_method_data_get_entry (opcode, index, walk_state, &entry);
+ status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
- /* Get the object from the method stack */
-
- object = *entry;
+ /* Get the object from the node */
+ object = node->object;
/* Examine the returned object, it must be valid. */
if (!object) {
/*
- * Index points to uninitialized object stack value.
+ * Index points to uninitialized object.
* This means that either 1) The expected argument was
* not passed to the method, or 2) A local variable
* was referenced by the method (via the ASL)
switch (opcode) {
case AML_ARG_OP:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Arg[%d] at entry %p\n",
- index, entry));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Arg[%d] at node %p\n",
+ index, node));
return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG);
- break;
case AML_LOCAL_OP:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Local[%d] at entry %p\n",
- index, entry));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Local[%d] at node %p\n",
+ index, node));
return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL);
- break;
}
}
-
/*
- * Index points to initialized and valid object stack value.
+ * The Index points to an initialized and valid object.
* Return an additional reference to the object
*/
*dest_desc = object;
acpi_walk_state *walk_state)
{
acpi_status status;
- acpi_operand_object **entry;
+ acpi_namespace_node *node;
acpi_operand_object *object;
- FUNCTION_TRACE ("Ds_method_data_delete_value");
+ ACPI_FUNCTION_TRACE ("Ds_method_data_delete_value");
- /* Get a pointer to the requested entry */
+ /* Get the namespace node for the arg/local */
- status = acpi_ds_method_data_get_entry (opcode, index, walk_state, &entry);
+ status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
- /* Get the current entry in this slot k */
+ /* Get the associated object */
- object = *entry;
+ object = acpi_ns_get_attached_object (node);
/*
* Undefine the Arg or Local by setting its descriptor
* pointer to NULL. Locals/Args can contain both
* ACPI_OPERAND_OBJECTS and ACPI_NAMESPACE_NODEs
*/
- *entry = NULL;
+ node->object = NULL;
if ((object) &&
- (VALID_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_INTERNAL))) {
+ (ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_INTERNAL)) {
/*
- * There is a valid object in this slot
+ * There is a valid object.
* Decrement the reference count by one to balance the
- * increment when the object was stored in the slot.
+ * increment when the object was stored.
*/
acpi_ut_remove_reference (object);
}
*
* PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
* Index - Which local_var or argument to set
- * Src_desc - Value to be stored
+ * Obj_desc - Value to be stored
* Walk_state - Current walk state
*
* RETURN: Status
*
- * DESCRIPTION: Store a value in an Arg or Local. The Src_desc is installed
+ * DESCRIPTION: Store a value in an Arg or Local. The Obj_desc is installed
* as the new value for the Arg or Local and the reference count
- * for Src_desc is incremented.
+ * for Obj_desc is incremented.
*
******************************************************************************/
acpi_ds_store_object_to_local (
u16 opcode,
u32 index,
- acpi_operand_object *src_desc,
+ acpi_operand_object *obj_desc,
acpi_walk_state *walk_state)
{
acpi_status status;
- acpi_operand_object **entry;
+ acpi_namespace_node *node;
+ acpi_operand_object *current_obj_desc;
- FUNCTION_TRACE ("Ds_method_data_set_value");
+ ACPI_FUNCTION_TRACE ("Ds_store_object_to_local");
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode=%d Idx=%d Obj=%p\n",
- opcode, index, src_desc));
+ opcode, index, obj_desc));
/* Parameter validation */
- if (!src_desc) {
+ if (!obj_desc) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
+ /* Get the namespace node for the arg/local */
- /* Get a pointer to the requested method stack entry */
-
- status = acpi_ds_method_data_get_entry (opcode, index, walk_state, &entry);
+ status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
if (ACPI_FAILURE (status)) {
- goto cleanup;
+ return_ACPI_STATUS (status);
}
- if (*entry == src_desc) {
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p already installed!\n", src_desc));
- goto cleanup;
+ current_obj_desc = acpi_ns_get_attached_object (node);
+ if (current_obj_desc == obj_desc) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p already installed!\n", obj_desc));
+ return_ACPI_STATUS (status);
}
-
/*
* If there is an object already in this slot, we either
* have to delete it, or if this is an argument and there
* is an object reference stored there, we have to do
* an indirect store!
*/
- if (*entry) {
+ if (current_obj_desc) {
/*
* Check for an indirect store if an argument
* contains an object reference (stored as an Node).
* Weird, but true.
*/
if ((opcode == AML_ARG_OP) &&
- (VALID_DESCRIPTOR_TYPE (*entry, ACPI_DESC_TYPE_NAMED))) {
+ (ACPI_GET_DESCRIPTOR_TYPE (current_obj_desc) == ACPI_DESC_TYPE_NAMED)) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
- "Arg (%p) is an Obj_ref(Node), storing in %p\n",
- src_desc, *entry));
+ "Arg (%p) is an Obj_ref(Node), storing in node %p\n",
+ obj_desc, current_obj_desc));
/* Detach an existing object from the Node */
- acpi_ns_detach_object ((acpi_namespace_node *) *entry);
+ acpi_ns_detach_object ((acpi_namespace_node *) current_obj_desc);
/*
* Store this object into the Node
- * (do the indirect store)
+ * (perform the indirect store)
*/
- status = acpi_ns_attach_object ((acpi_namespace_node *) *entry, src_desc,
- src_desc->common.type);
+ status = acpi_ns_attach_object ((acpi_namespace_node *) current_obj_desc,
+ obj_desc, obj_desc->common.type);
return_ACPI_STATUS (status);
}
-
-#ifdef ACPI_ENABLE_IMPLICIT_CONVERSION
- /*
- * Perform "Implicit conversion" of the new object to the type of the
- * existing object
- */
- status = acpi_ex_convert_to_target_type ((*entry)->common.type, &src_desc, walk_state);
- if (ACPI_FAILURE (status)) {
- goto cleanup;
- }
-#endif
-
/*
* Delete the existing object
* before storing the new one
acpi_ds_method_data_delete_value (opcode, index, walk_state);
}
-
/*
- * Install the Obj_stack descriptor (*Src_desc) into
+ * Install the Obj_stack descriptor (*Obj_desc) into
* the descriptor for the Arg or Local.
* Install the new object in the stack entry
* (increments the object reference count by one)
*/
- status = acpi_ds_method_data_set_entry (opcode, index, src_desc, walk_state);
- if (ACPI_FAILURE (status)) {
- goto cleanup;
- }
-
- /* Normal exit */
-
- return_ACPI_STATUS (AE_OK);
-
-
- /* Error exit */
-
-cleanup:
-
+ status = acpi_ds_method_data_set_value (opcode, index, obj_desc, walk_state);
return_ACPI_STATUS (status);
}
+
/******************************************************************************
*
* Module Name: dsobject - Dispatcher object management routines
- * $Revision: 81 $
+ * $Revision: 90 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acnamesp.h"
#define _COMPONENT ACPI_DISPATCHER
- MODULE_NAME ("dsobject")
+ ACPI_MODULE_NAME ("dsobject")
/*******************************************************************************
void *context,
void **return_value)
{
- acpi_object_type8 type;
+ acpi_object_type type;
acpi_status status;
acpi_init_walk_info *info = (acpi_init_walk_info *) context;
u8 table_revision;
- PROC_NAME ("Ds_init_one_object");
+ ACPI_FUNCTION_NAME ("Ds_init_one_object");
info->object_count++;
type = acpi_ns_get_type (obj_handle);
switch (type) {
-
case ACPI_TYPE_REGION:
acpi_ds_initialize_region (obj_handle);
status = acpi_ds_parse_method (obj_handle);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Method %p [%4.4s] - parse failure, %s\n",
- obj_handle, (char*)&((acpi_namespace_node *)obj_handle)->name,
+ obj_handle, (char *) &((acpi_namespace_node *) obj_handle)->name,
acpi_format_exception (status)));
/* This parse failed, but we will continue parsing more methods */
* for every execution since there isn't much overhead
*/
acpi_ns_delete_namespace_subtree (obj_handle);
+ acpi_ns_delete_namespace_by_owner (((acpi_namespace_node *) obj_handle)->object->method.owning_id);
break;
default:
acpi_init_walk_info info;
- FUNCTION_TRACE ("Ds_initialize_objects");
+ ACPI_FUNCTION_TRACE ("Ds_initialize_objects");
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
acpi_operand_object *obj_desc;
- PROC_NAME ("Ds_init_object_from_op");
+ ACPI_FUNCTION_NAME ("Ds_init_object_from_op");
obj_desc = *ret_obj_desc;
switch (obj_desc->common.type) {
case ACPI_TYPE_BUFFER:
+ obj_desc->buffer.node = (acpi_namespace_node *) walk_state->operands[0];
+
/* First arg is a number */
acpi_ds_create_operand (walk_state, op->value.arg, 0);
if (obj_desc->buffer.length == 0) {
obj_desc->buffer.pointer = NULL;
- REPORT_WARNING (("Buffer created with zero length in AML\n"));
+ ACPI_REPORT_WARNING (("Buffer created with zero length in AML\n"));
break;
}
return (AE_TYPE);
}
- MEMCPY (obj_desc->buffer.pointer, byte_list->data,
- obj_desc->buffer.length);
+ ACPI_MEMCPY (obj_desc->buffer.pointer, byte_list->data,
+ obj_desc->buffer.length);
}
break;
case ACPI_TYPE_STRING:
obj_desc->string.pointer = op->value.string;
- obj_desc->string.length = STRLEN (op->value.string);
+ obj_desc->string.length = ACPI_STRLEN (op->value.string);
/*
* The string is contained in the ACPI table, don't ever try
acpi_operand_object **obj_desc_ptr)
{
acpi_operand_object *obj_desc;
- acpi_object_type8 type;
acpi_status status;
- u32 length;
char *name;
- FUNCTION_TRACE ("Ds_build_internal_simple_obj");
+ ACPI_FUNCTION_TRACE ("Ds_build_internal_simple_obj");
if (op->opcode == AML_INT_NAMEPATH_OP) {
/*
- * This is an object reference. If The name was
- * previously looked up in the NS, it is stored in this op.
+ * This is an object reference. If this name was
+ * previously looked up in the namespace, it was stored in this op.
* Otherwise, go ahead and look it up now
*/
if (!op->node) {
- status = acpi_ns_lookup (walk_state->scope_info,
- op->value.string, ACPI_TYPE_ANY,
- IMODE_EXECUTE,
- NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE,
- NULL,
- (acpi_namespace_node **)&(op->node));
+ status = acpi_ns_lookup (walk_state->scope_info, op->value.string,
+ ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+ ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL,
+ (acpi_namespace_node **) &(op->node));
if (ACPI_FAILURE (status)) {
if (status == AE_NOT_FOUND) {
name = NULL;
- acpi_ns_externalize_name (ACPI_UINT32_MAX, op->value.string, &length, &name);
+ acpi_ns_externalize_name (ACPI_UINT32_MAX, op->value.string, NULL, &name);
if (name) {
- REPORT_WARNING (("Reference %s at AML %X not found\n",
+ ACPI_REPORT_WARNING (("Reference %s at AML %X not found\n",
name, op->aml_offset));
ACPI_MEM_FREE (name);
}
else {
- REPORT_WARNING (("Reference %s at AML %X not found\n",
+ ACPI_REPORT_WARNING (("Reference %s at AML %X not found\n",
op->value.string, op->aml_offset));
}
}
}
}
-
- /*
- * The reference will be a Reference
- * TBD: [Restructure] unless we really need a separate
- * type of INTERNAL_TYPE_REFERENCE change
- * Acpi_ds_map_opcode_to_data_type to handle this case
- */
- type = INTERNAL_TYPE_REFERENCE;
- }
- else {
- type = acpi_ds_map_opcode_to_data_type (op->opcode, NULL);
}
-
/* Create and init the internal ACPI object */
- obj_desc = acpi_ut_create_internal_object (type);
+ obj_desc = acpi_ut_create_internal_object ((acpi_ps_get_opcode_info (op->opcode))->object_type);
if (!obj_desc) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
acpi_status status = AE_OK;
- FUNCTION_TRACE ("Ds_build_internal_package_obj");
+ ACPI_FUNCTION_TRACE ("Ds_build_internal_package_obj");
obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_PACKAGE);
acpi_operand_object *obj_desc;
- FUNCTION_TRACE_PTR ("Ds_create_node", op);
+ ACPI_FUNCTION_TRACE_PTR ("Ds_create_node", op);
/*
* parts of the table, we can arrive here twice. Only init
* the named object node the first time through
*/
- if (node->object) {
+ if (acpi_ns_get_attached_object (node)) {
return_ACPI_STATUS (AE_OK);
}
/* Init obj */
- status = acpi_ns_attach_object (node, obj_desc, (u8) node->type);
+ status = acpi_ns_attach_object (node, obj_desc, node->type);
/* Remove local reference to the object */
*
* Module Name: dsopcode - Dispatcher Op Region support and handling of
* "control" opcodes
- * $Revision: 56 $
+ * $Revision: 73 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "actables.h"
#define _COMPONENT ACPI_DISPATCHER
- MODULE_NAME ("dsopcode")
+ ACPI_MODULE_NAME ("dsopcode")
/*****************************************************************************
*
- * FUNCTION: Acpi_ds_get_buffer_field_arguments
+ * FUNCTION: Acpi_ds_execute_arguments
*
- * PARAMETERS: Obj_desc - A valid Buffer_field object
+ * PARAMETERS: Node - Parent NS node
+ * Extra_desc - Has AML pointer and length
*
* RETURN: Status.
*
- * DESCRIPTION: Get Buffer_field Buffer and Index. This implements the late
- * evaluation of these field attributes.
+ * DESCRIPTION: Late execution of region or field arguments
*
****************************************************************************/
acpi_status
-acpi_ds_get_buffer_field_arguments (
- acpi_operand_object *obj_desc)
+acpi_ds_execute_arguments (
+ acpi_namespace_node *node,
+ acpi_operand_object *extra_desc)
{
- acpi_operand_object *extra_desc;
- acpi_namespace_node *node;
- acpi_parse_object *op;
- acpi_parse_object *field_op;
acpi_status status;
- acpi_table_desc *table_desc;
+ acpi_parse_object *op;
acpi_walk_state *walk_state;
+ acpi_parse_object *arg;
- FUNCTION_TRACE_PTR ("Ds_get_buffer_field_arguments", obj_desc);
-
-
- if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
- return_ACPI_STATUS (AE_OK);
- }
-
-
- /* Get the AML pointer (method object) and Buffer_field node */
-
- extra_desc = obj_desc->buffer_field.extra;
- node = obj_desc->buffer_field.node;
-
- DEBUG_EXEC(acpi_ut_display_init_pathname (node, " [Field]"));
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] Buffer_field JIT Init\n",
- (char*)&node->name));
+ ACPI_FUNCTION_TRACE ("Acpi_ds_execute_arguments");
/*
* Allocate a new parser op to be the root of the parsed
- * Op_region tree
+ * Buffer_field tree
*/
op = acpi_ps_alloc_op (AML_SCOPE_OP);
if (!op) {
- return (AE_NO_MEMORY);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Save the Node for use in Acpi_ps_parse_aml */
- op->node = acpi_ns_get_parent_object (node);
-
- /* Get a handle to the parent ACPI table */
-
- status = acpi_tb_handle_to_object (node->owner_id, &table_desc);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
+ op->node = acpi_ns_get_parent_node (node);
/* Create and initialize a new parser state */
- walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT,
- NULL, NULL, NULL);
+ walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT, NULL, NULL, NULL);
if (!walk_state) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
status = acpi_ds_init_aml_walk (walk_state, op, NULL, extra_desc->extra.aml_start,
extra_desc->extra.aml_length, NULL, NULL, 1);
if (ACPI_FAILURE (status)) {
- /* TBD: delete walk state */
+ acpi_ds_delete_walk_state (walk_state);
return_ACPI_STATUS (status);
}
- /* TBD: No Walk flags?? */
-
walk_state->parse_flags = 0;
/* Pass1: Parse the entire Buffer_field declaration */
/* Get and init the actual Field_unit Op created above */
- field_op = op->value.arg;
+ arg = op->value.arg;
op->node = node;
-
-
- field_op = op->value.arg;
- field_op->node = node;
+ arg->node = node;
acpi_ps_delete_parse_tree (op);
- /* Evaluate the address and length arguments for the Op_region */
+ /* Evaluate the address and length arguments for the Buffer Field */
op = acpi_ps_alloc_op (AML_SCOPE_OP);
if (!op) {
- return (AE_NO_MEMORY);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
- op->node = acpi_ns_get_parent_object (node);
+ op->node = acpi_ns_get_parent_node (node);
/* Create and initialize a new parser state */
- walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT,
- NULL, NULL, NULL);
+ walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT, NULL, NULL, NULL);
if (!walk_state) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
status = acpi_ds_init_aml_walk (walk_state, op, NULL, extra_desc->extra.aml_start,
extra_desc->extra.aml_length, NULL, NULL, 3);
if (ACPI_FAILURE (status)) {
- /* TBD: delete walk state */
+ acpi_ds_delete_walk_state (walk_state);
return_ACPI_STATUS (status);
}
status = acpi_ps_parse_aml (walk_state);
acpi_ps_delete_parse_tree (op);
-
- /*
- * The pseudo-method object is no longer needed since the region is
- * now initialized
- */
- acpi_ut_remove_reference (obj_desc->buffer_field.extra);
- obj_desc->buffer_field.extra = NULL;
-
return_ACPI_STATUS (status);
}
/*****************************************************************************
*
- * FUNCTION: Acpi_ds_get_region_arguments
+ * FUNCTION: Acpi_ds_get_buffer_field_arguments
*
- * PARAMETERS: Obj_desc - A valid region object
+ * PARAMETERS: Obj_desc - A valid Buffer_field object
*
* RETURN: Status.
*
- * DESCRIPTION: Get region address and length. This implements the late
- * evaluation of these region attributes.
+ * DESCRIPTION: Get Buffer_field Buffer and Index. This implements the late
+ * evaluation of these field attributes.
*
****************************************************************************/
acpi_status
-acpi_ds_get_region_arguments (
+acpi_ds_get_buffer_field_arguments (
acpi_operand_object *obj_desc)
{
- acpi_operand_object *extra_desc = NULL;
+ acpi_operand_object *extra_desc;
acpi_namespace_node *node;
- acpi_parse_object *op;
- acpi_parse_object *region_op;
acpi_status status;
- acpi_table_desc *table_desc;
- acpi_walk_state *walk_state;
- FUNCTION_TRACE_PTR ("Ds_get_region_arguments", obj_desc);
+ ACPI_FUNCTION_TRACE_PTR ("Ds_get_buffer_field_arguments", obj_desc);
- if (obj_desc->region.flags & AOPOBJ_DATA_VALID) {
+ if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
return_ACPI_STATUS (AE_OK);
}
+ /* Get the AML pointer (method object) and Buffer_field node */
- /* Get the AML pointer (method object) and region node */
-
- extra_desc = obj_desc->region.extra;
- node = obj_desc->region.node;
-
- DEBUG_EXEC(acpi_ut_display_init_pathname (node, " [Operation Region]"));
-
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] Op_region Init at AML %p\n",
- (char*)&node->name, extra_desc->extra.aml_start));
-
- /*
- * Allocate a new parser op to be the root of the parsed
- * Op_region tree
- */
- op = acpi_ps_alloc_op (AML_SCOPE_OP);
- if (!op) {
- return (AE_NO_MEMORY);
- }
-
- /* Save the Node for use in Acpi_ps_parse_aml */
+ extra_desc = acpi_ns_get_secondary_object (obj_desc);
+ node = obj_desc->buffer_field.node;
- op->node = acpi_ns_get_parent_object (node);
+ ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname (node, " [Field]"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] Buffer_field JIT Init\n",
+ (char *) &node->name));
- /* Get a handle to the parent ACPI table */
+ /* Execute the AML code for the Term_arg arguments */
- status = acpi_tb_handle_to_object (node->owner_id, &table_desc);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
+ status = acpi_ds_execute_arguments (node, extra_desc);
+ return_ACPI_STATUS (status);
+}
- /* Create and initialize a new parser state */
- walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT,
- op, NULL, NULL);
- if (!walk_state) {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
+/*****************************************************************************
+ *
+ * FUNCTION: Acpi_ds_get_region_arguments
+ *
+ * PARAMETERS: Obj_desc - A valid region object
+ *
+ * RETURN: Status.
+ *
+ * DESCRIPTION: Get region address and length. This implements the late
+ * evaluation of these region attributes.
+ *
+ ****************************************************************************/
- status = acpi_ds_init_aml_walk (walk_state, op, NULL, extra_desc->extra.aml_start,
- extra_desc->extra.aml_length, NULL, NULL, 1);
- if (ACPI_FAILURE (status)) {
- /* TBD: delete walk state */
- return_ACPI_STATUS (status);
- }
+acpi_status
+acpi_ds_get_region_arguments (
+ acpi_operand_object *obj_desc)
+{
+ acpi_namespace_node *node;
+ acpi_status status;
+ acpi_operand_object *region_obj2;
- /* TBD: No Walk flags?? */
- walk_state->parse_flags = 0;
+ ACPI_FUNCTION_TRACE_PTR ("Ds_get_region_arguments", obj_desc);
- /* Parse the entire Op_region declaration, creating a parse tree */
- status = acpi_ps_parse_aml (walk_state);
- if (ACPI_FAILURE (status)) {
- acpi_ps_delete_parse_tree (op);
- return_ACPI_STATUS (status);
+ if (obj_desc->region.flags & AOPOBJ_DATA_VALID) {
+ return_ACPI_STATUS (AE_OK);
}
- /* Get and init the actual Region_op created above */
-
- region_op = op->value.arg;
- op->node = node;
-
-
- region_op = op->value.arg;
- region_op->node = node;
- acpi_ps_delete_parse_tree (op);
-
- /* Evaluate the address and length arguments for the Op_region */
-
- op = acpi_ps_alloc_op (AML_SCOPE_OP);
- if (!op) {
- return (AE_NO_MEMORY);
+ region_obj2 = acpi_ns_get_secondary_object (obj_desc);
+ if (!region_obj2) {
+ return_ACPI_STATUS (AE_NOT_EXIST);
}
- op->node = acpi_ns_get_parent_object (node);
+ /* Get the AML pointer (method object) and region node */
- /* Create and initialize a new parser state */
+ node = obj_desc->region.node;
- walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT,
- op, NULL, NULL);
- if (!walk_state) {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
+ ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname (node, " [Operation Region]"));
- status = acpi_ds_init_aml_walk (walk_state, op, NULL, extra_desc->extra.aml_start,
- extra_desc->extra.aml_length, NULL, NULL, 3);
- if (ACPI_FAILURE (status)) {
- /* TBD: delete walk state */
- return_ACPI_STATUS (status);
- }
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] Op_region Init at AML %p\n",
+ (char *) &node->name, region_obj2->extra.aml_start));
- status = acpi_ps_parse_aml (walk_state);
- acpi_ps_delete_parse_tree (op);
+ status = acpi_ds_execute_arguments (node, region_obj2);
return_ACPI_STATUS (status);
}
/* Namespace is NOT locked */
status = acpi_ev_initialize_region (obj_desc, FALSE);
-
return (status);
}
* DESCRIPTION: Get Buffer_field Buffer and Index
* Called from Acpi_ds_exec_end_op during Buffer_field parse tree walk
*
- * ACPI SPECIFICATION REFERENCES:
- * Each of the Buffer Field opcodes is defined as specified in in-line
- * comments below. For each one, use the following definitions.
- *
- * Def_bit_field := Bit_field_op Src_buf Bit_idx Destination
- * Def_byte_field := Byte_field_op Src_buf Byte_idx Destination
- * Def_create_field := Create_field_op Src_buf Bit_idx Num_bits Name_string
- * Def_dWord_field := DWord_field_op Src_buf Byte_idx Destination
- * Def_word_field := Word_field_op Src_buf Byte_idx Destination
- * Bit_index := Term_arg=>Integer
- * Byte_index := Term_arg=>Integer
- * Destination := Name_string
- * Num_bits := Term_arg=>Integer
- * Source_buf := Term_arg=>Buffer
- *
****************************************************************************/
acpi_status
acpi_operand_object *src_desc = NULL;
- FUNCTION_TRACE_PTR ("Ds_eval_buffer_field_operands", op);
+ ACPI_FUNCTION_TRACE_PTR ("Ds_eval_buffer_field_operands", op);
/*
return_ACPI_STATUS (AE_NOT_EXIST);
}
-
/* Resolve the operands */
- status = acpi_ex_resolve_operands (op->opcode, WALK_OPERANDS, walk_state);
- DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, acpi_ps_get_opcode_name (op->opcode),
+ status = acpi_ex_resolve_operands (op->opcode, ACPI_WALK_OPERANDS, walk_state);
+ ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, acpi_ps_get_opcode_name (op->opcode),
walk_state->num_operands, "after Acpi_ex_resolve_operands");
if (ACPI_FAILURE (status)) {
off_desc = walk_state->operands[1];
src_desc = walk_state->operands[0];
-
-
- offset = (u32) off_desc->integer.value;
+ offset = (u32) off_desc->integer.value;
/*
* If Res_desc is a Name, it will be a direct name pointer after
* Acpi_ex_resolve_operands()
*/
- if (!VALID_DESCRIPTOR_TYPE (res_desc, ACPI_DESC_TYPE_NAMED)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) destination must be a Node\n",
+ if (ACPI_GET_DESCRIPTOR_TYPE (res_desc) != ACPI_DESC_TYPE_NAMED) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) destination must be a NS Node\n",
acpi_ps_get_opcode_name (op->opcode)));
status = AE_AML_OPERAND_TYPE;
* Setup the Bit offsets and counts, according to the opcode
*/
switch (op->opcode) {
-
- /* Def_create_field */
-
case AML_CREATE_FIELD_OP:
/* Offset is in bits, count is in bits */
bit_offset = offset;
bit_count = (u32) cnt_desc->integer.value;
- field_flags = ACCESS_BYTE_ACC;
+ field_flags = AML_FIELD_ACCESS_BYTE;
break;
-
- /* Def_create_bit_field */
-
case AML_CREATE_BIT_FIELD_OP:
/* Offset is in bits, Field is one bit */
bit_offset = offset;
bit_count = 1;
- field_flags = ACCESS_BYTE_ACC;
+ field_flags = AML_FIELD_ACCESS_BYTE;
break;
-
- /* Def_create_byte_field */
-
case AML_CREATE_BYTE_FIELD_OP:
/* Offset is in bytes, field is one byte */
bit_offset = 8 * offset;
bit_count = 8;
- field_flags = ACCESS_BYTE_ACC;
+ field_flags = AML_FIELD_ACCESS_BYTE;
break;
-
- /* Def_create_word_field */
-
case AML_CREATE_WORD_FIELD_OP:
/* Offset is in bytes, field is one word */
bit_offset = 8 * offset;
bit_count = 16;
- field_flags = ACCESS_WORD_ACC;
+ field_flags = AML_FIELD_ACCESS_WORD;
break;
-
- /* Def_create_dWord_field */
-
case AML_CREATE_DWORD_FIELD_OP:
/* Offset is in bytes, field is one dword */
bit_offset = 8 * offset;
bit_count = 32;
- field_flags = ACCESS_DWORD_ACC;
+ field_flags = AML_FIELD_ACCESS_DWORD;
break;
-
- /* Def_create_qWord_field */
-
case AML_CREATE_QWORD_FIELD_OP:
/* Offset is in bytes, field is one qword */
bit_offset = 8 * offset;
bit_count = 64;
- field_flags = ACCESS_QWORD_ACC;
+ field_flags = AML_FIELD_ACCESS_QWORD;
break;
-
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
goto cleanup;
}
-
/*
* Setup field according to the object type
*/
goto cleanup;
}
-
/*
* Initialize areas of the field object that are common to all fields
* For Field_flags, use LOCK_RULE = 0 (NO_LOCK), UPDATE_RULE = 0 (UPDATE_PRESERVE)
*/
- status = acpi_ex_prep_common_field_object (obj_desc, field_flags,
+ status = acpi_ex_prep_common_field_object (obj_desc, field_flags, 0,
bit_offset, bit_count);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
src_desc->common.reference_count = (u16) (src_desc->common.reference_count +
obj_desc->common.reference_count);
-
break;
default:
- if ((src_desc->common.type > (u8) INTERNAL_TYPE_REFERENCE) || !acpi_ut_valid_object_type (src_desc->common.type)) /* TBD: This line MUST be a single line until Acpi_src can handle it (block deletion) */ {
+ if ((src_desc->common.type > (u8) INTERNAL_TYPE_REFERENCE) || !acpi_ut_valid_object_type (src_desc->common.type)) /* This line MUST be a single line until Acpi_src can handle it (block deletion) */ {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Tried to create field in invalid object type %X\n",
src_desc->common.type));
}
-
else {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Tried to create field in improper object type - %s\n",
if (ACPI_FAILURE (status)) {
acpi_ut_remove_reference (res_desc); /* Result descriptor */
}
-
else {
/* Now the address and length are valid for this Buffer_field */
acpi_parse_object *next_op;
- FUNCTION_TRACE_PTR ("Ds_eval_region_operands", op);
+ ACPI_FUNCTION_TRACE_PTR ("Ds_eval_region_operands", op);
/*
/* Resolve the length and address operands to numbers */
- status = acpi_ex_resolve_operands (op->opcode, WALK_OPERANDS, walk_state);
+ status = acpi_ex_resolve_operands (op->opcode, ACPI_WALK_OPERANDS, walk_state);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
- DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE,
+ ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
acpi_ps_get_opcode_name (op->opcode),
1, "after Acpi_ex_resolve_operands");
-
obj_desc = acpi_ns_get_attached_object (node);
if (!obj_desc) {
return_ACPI_STATUS (AE_NOT_EXIST);
obj_desc->region.address = (ACPI_PHYSICAL_ADDRESS) operand_desc->integer.value;
acpi_ut_remove_reference (operand_desc);
-
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Rgn_obj %p Addr %8.8X%8.8X Len %X\n",
- obj_desc, HIDWORD(obj_desc->region.address), LODWORD(obj_desc->region.address),
+ obj_desc,
+ ACPI_HIDWORD (obj_desc->region.address), ACPI_LODWORD (obj_desc->region.address),
obj_desc->region.length));
/* Now the address and length are valid for this opregion */
acpi_generic_state *control_state;
- PROC_NAME ("Ds_exec_begin_control_op");
+ ACPI_FUNCTION_NAME ("Ds_exec_begin_control_op");
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", op,
status = AE_NO_MEMORY;
break;
}
-
- acpi_ut_push_generic_state (&walk_state->control_state, control_state);
-
/*
* Save a pointer to the predicate for multiple executions
* of a loop
*/
- walk_state->control_state->control.aml_predicate_start =
- walk_state->parser_state.aml - 1;
- /* TBD: can this be removed? */
- /*Acpi_ps_pkg_length_encoding_size (GET8 (Walk_state->Parser_state->Aml));*/
- break;
+ control_state->control.aml_predicate_start = walk_state->parser_state.aml - 1;
+ control_state->control.package_end = walk_state->parser_state.pkg_end;
+ control_state->control.opcode = op->opcode;
+ /* Push the control state on this walk's control stack */
+
+ acpi_ut_push_generic_state (&walk_state->control_state, control_state);
+ break;
+
case AML_ELSE_OP:
/* Predicate is in the state object */
break;
-
case AML_RETURN_OP:
break;
-
default:
break;
}
* DESCRIPTION: Handles all control ops encountered during control method
* execution.
*
- *
******************************************************************************/
acpi_status
acpi_generic_state *control_state;
- PROC_NAME ("Ds_exec_end_control_op");
+ ACPI_FUNCTION_NAME ("Ds_exec_end_control_op");
switch (op->opcode) {
*/
walk_state->return_desc = walk_state->operands[0];
}
-
else if ((walk_state->results) &&
(walk_state->results->results.num_results > 0)) {
/*
*
* Allow references created by the Index operator to return unchanged.
*/
- if (VALID_DESCRIPTOR_TYPE (walk_state->results->results.obj_desc [0], ACPI_DESC_TYPE_INTERNAL) &&
+ if ((ACPI_GET_DESCRIPTOR_TYPE (walk_state->results->results.obj_desc[0]) == ACPI_DESC_TYPE_INTERNAL) &&
((walk_state->results->results.obj_desc [0])->common.type == INTERNAL_TYPE_REFERENCE) &&
((walk_state->results->results.obj_desc [0])->reference.opcode != AML_INDEX_OP)) {
- status = acpi_ex_resolve_to_value (&walk_state->results->results.obj_desc [0], walk_state);
- if (ACPI_FAILURE (status)) {
- return (status);
- }
+ status = acpi_ex_resolve_to_value (&walk_state->results->results.obj_desc [0], walk_state);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
}
walk_state->return_desc = walk_state->results->results.obj_desc [0];
}
-
else {
/* No return operand */
case AML_BREAK_OP:
+ case AML_CONTINUE_OP: /* ACPI 2.0 */
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Break to end of current package, Op=%p\n", op));
- /* TBD: update behavior for ACPI 2.0 */
+ /* Pop and delete control states until we find a while */
- /*
- * As per the ACPI specification:
- * "The break operation causes the current package
- * execution to complete"
- * "Break -- Stop executing the current code package
- * at this point"
- *
- * Returning AE_FALSE here will cause termination of
- * the current package, and execution will continue one
- * level up, starting with the completion of the parent Op.
- */
- status = AE_CTRL_FALSE;
- break;
+ while (walk_state->control_state &&
+ (walk_state->control_state->control.opcode != AML_WHILE_OP)) {
+ control_state = acpi_ut_pop_generic_state (&walk_state->control_state);
+ acpi_ut_delete_generic_state (control_state);
+ }
+ /* No while found? */
- case AML_CONTINUE_OP: /* ACPI 2.0 */
+ if (!walk_state->control_state) {
+ return (AE_AML_NO_WHILE);
+ }
+
+ /* Was: Walk_state->Aml_last_while = Walk_state->Control_state->Control.Aml_predicate_start; */
+
+ walk_state->aml_last_while = walk_state->control_state->control.package_end;
- status = AE_NOT_IMPLEMENTED;
+ /* Return status depending on opcode */
+
+ if (op->opcode == AML_BREAK_OP) {
+ status = AE_CTRL_BREAK;
+ }
+ else {
+ status = AE_CTRL_CONTINUE;
+ }
break;
break;
}
-
return (status);
}
/*******************************************************************************
*
* Module Name: dsutils - Dispatcher utilities
- * $Revision: 80 $
+ * $Revision: 88 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acdebug.h"
#define _COMPONENT ACPI_DISPATCHER
- MODULE_NAME ("dsutils")
+ ACPI_MODULE_NAME ("dsutils")
/*******************************************************************************
const acpi_opcode_info *parent_info;
- FUNCTION_TRACE_PTR ("Ds_is_result_used", op);
+ ACPI_FUNCTION_TRACE_PTR ("Ds_is_result_used", op);
/* Must have both an Op and a Result Object */
return_VALUE (TRUE);
}
-
/*
* If there is no parent, the result can't possibly be used!
* (An executing method typically has no parent, since each
return_VALUE (FALSE);
}
-
/*
* Get info on the parent. The root Op is AML_SCOPE
*/
-
parent_info = acpi_ps_get_opcode_info (op->parent->opcode);
if (parent_info->class == AML_CLASS_UNKNOWN) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown parent opcode. Op=%p\n", op));
return_VALUE (FALSE);
}
-
/*
* Decide what to do with the result based on the parent. If
* the parent opcode will not use the result, delete the object.
* as an operand later.
*/
switch (parent_info->class) {
- /*
- * In these cases, the parent will never use the return object
- */
- case AML_CLASS_CONTROL: /* IF, ELSE, WHILE only */
+ case AML_CLASS_CONTROL:
switch (op->parent->opcode) {
case AML_RETURN_OP:
/* Never delete the return value associated with a return opcode */
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "Result used, [RETURN] opcode=%X Op=%p\n", op->opcode, op));
- return_VALUE (TRUE);
- break;
+ goto result_used;
case AML_IF_OP:
case AML_WHILE_OP:
/*
* If we are executing the predicate AND this is the predicate op,
- * we will use the return value!
+ * we will use the return value
*/
- if ((walk_state->control_state->common.state == CONTROL_PREDICATE_EXECUTING) &&
+ if ((walk_state->control_state->common.state == ACPI_CONTROL_PREDICATE_EXECUTING) &&
(walk_state->control_state->control.predicate_op == op)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "Result used as a predicate, [IF/WHILE] opcode=%X Op=%p\n",
- op->opcode, op));
- return_VALUE (TRUE);
+ goto result_used;
}
-
- break;
}
+ /* The general control opcode returns no result */
- /* Fall through to not used case below */
+ goto result_not_used;
- case AML_CLASS_NAMED_OBJECT: /* Scope, method, etc. */
case AML_CLASS_CREATE:
/*
* These opcodes allow Term_arg(s) as operands and therefore
- * method calls. The result is used.
+ * the operands can be method calls. The result is used.
*/
- if ((op->parent->opcode == AML_REGION_OP) ||
- (op->parent->opcode == AML_CREATE_FIELD_OP) ||
- (op->parent->opcode == AML_CREATE_BIT_FIELD_OP) ||
- (op->parent->opcode == AML_CREATE_BYTE_FIELD_OP) ||
- (op->parent->opcode == AML_CREATE_WORD_FIELD_OP) ||
- (op->parent->opcode == AML_CREATE_DWORD_FIELD_OP) ||
- (op->parent->opcode == AML_CREATE_QWORD_FIELD_OP)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "Result used, [Region or Create_field] opcode=%X Op=%p\n",
- op->opcode, op));
- return_VALUE (TRUE);
+ goto result_used;
+
+
+ case AML_CLASS_NAMED_OBJECT:
+
+ if ((op->parent->opcode == AML_REGION_OP) ||
+ (op->parent->opcode == AML_DATA_REGION_OP)) {
+ /*
+ * These opcodes allow Term_arg(s) as operands and therefore
+ * the operands can be method calls. The result is used.
+ */
+ goto result_used;
}
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "Result not used, Parent opcode=%X Op=%p\n", op->opcode, op));
+ goto result_not_used;
- return_VALUE (FALSE);
- break;
/*
* In all other cases. the parent will actually use the return
* object, so keep it.
*/
default:
- break;
+ goto result_used;
}
+
+result_used:
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] used by Parent [%s] Op=%p\n",
+ acpi_ps_get_opcode_name (op->opcode),
+ acpi_ps_get_opcode_name (op->parent->opcode), op));
+
return_VALUE (TRUE);
+
+
+result_not_used:
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] not used by Parent [%s] Op=%p\n",
+ acpi_ps_get_opcode_name (op->opcode),
+ acpi_ps_get_opcode_name (op->parent->opcode), op));
+
+ return_VALUE (FALSE);
+
}
acpi_status status;
- FUNCTION_TRACE_PTR ("Ds_delete_result_if_not_used", result_obj);
+ ACPI_FUNCTION_TRACE_PTR ("Ds_delete_result_if_not_used", result_obj);
if (!op) {
acpi_status status = AE_OK;
NATIVE_CHAR *name_string;
u32 name_length;
- acpi_object_type8 data_type;
acpi_operand_object *obj_desc;
acpi_parse_object *parent_op;
u16 opcode;
- u32 flags;
- operating_mode interpreter_mode;
+ acpi_interpreter_mode interpreter_mode;
const acpi_opcode_info *op_info;
+ char *name;
- FUNCTION_TRACE_PTR ("Ds_create_operand", arg);
+ ACPI_FUNCTION_TRACE_PTR ("Ds_create_operand", arg);
/* A valid name must be looked up in the namespace */
(parent_op->opcode != AML_INT_NAMEPATH_OP)) {
/* Enter name into namespace if not found */
- interpreter_mode = IMODE_LOAD_PASS2;
+ interpreter_mode = ACPI_IMODE_LOAD_PASS2;
}
else {
/* Return a failure if name not found */
- interpreter_mode = IMODE_EXECUTE;
+ interpreter_mode = ACPI_IMODE_EXECUTE;
}
status = acpi_ns_lookup (walk_state->scope_info, name_string,
ACPI_TYPE_ANY, interpreter_mode,
- NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE,
+ ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
walk_state,
(acpi_namespace_node **) &obj_desc);
-
- /* Free the namestring created above */
-
- ACPI_MEM_FREE (name_string);
-
/*
* The only case where we pass through (ignore) a NOT_FOUND
* error is for the Cond_ref_of opcode.
*/
status = AE_AML_NAME_NOT_FOUND;
- /* TBD: Externalize Name_string and print */
-
+ name = NULL;
+ acpi_ns_externalize_name (ACPI_UINT32_MAX, name_string, NULL, &name);
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Object name was not found in namespace\n"));
+ "Object name [%s] was not found in namespace\n", name));
+ ACPI_MEM_FREE (name);
}
}
+ /* Free the namestring created above */
+
+ ACPI_MEM_FREE (name_string);
+
/* Check status from the lookup */
if (ACPI_FAILURE (status)) {
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
- DEBUGGER_EXEC (acpi_db_display_argument_object (obj_desc, walk_state));
+ ACPI_DEBUGGER_EXEC (acpi_db_display_argument_object (obj_desc, walk_state));
}
opcode = AML_ZERO_OP; /* Has no arguments! */
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Null namepath: Arg=%p\n", arg));
-
- /*
- * TBD: [Investigate] anything else needed for the
- * zero op lvalue?
- */
}
else {
opcode = arg->opcode;
}
+ /* Get the object type of the argument */
- /* Get the data type of the argument */
-
- data_type = acpi_ds_map_opcode_to_data_type (opcode, &flags);
- if (data_type == INTERNAL_TYPE_INVALID) {
+ op_info = acpi_ps_get_opcode_info (opcode);
+ if (op_info->object_type == INTERNAL_TYPE_INVALID) {
return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
}
- if (flags & OP_HAS_RETURN_VALUE) {
+ if (op_info->flags & AML_HAS_RETVAL) {
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Argument previously created, already stacked \n"));
- DEBUGGER_EXEC (acpi_db_display_argument_object (walk_state->operands [walk_state->num_operands - 1], walk_state));
+ ACPI_DEBUGGER_EXEC (acpi_db_display_argument_object (
+ walk_state->operands [walk_state->num_operands - 1], walk_state));
/*
* Use value that was already previously returned
acpi_format_exception (status)));
return_ACPI_STATUS (status);
}
-
}
else {
/* Create an ACPI_INTERNAL_OBJECT for the argument */
- obj_desc = acpi_ut_create_internal_object (data_type);
+ obj_desc = acpi_ut_create_internal_object (op_info->object_type);
if (!obj_desc) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
return_ACPI_STATUS (status);
}
- DEBUGGER_EXEC (acpi_db_display_argument_object (obj_desc, walk_state));
+ ACPI_DEBUGGER_EXEC (acpi_db_display_argument_object (obj_desc, walk_state));
}
return_ACPI_STATUS (AE_OK);
u32 arg_count = 0;
- FUNCTION_TRACE_PTR ("Ds_create_operands", first_arg);
+ ACPI_FUNCTION_TRACE_PTR ("Ds_create_operands", first_arg);
/* For all arguments in the list... */
acpi_status status = AE_OK;
- FUNCTION_TRACE_PTR ("Ds_resolve_operands", walk_state);
+ ACPI_FUNCTION_TRACE_PTR ("Ds_resolve_operands", walk_state);
/*
* Attempt to resolve each of the valid operands
* Method arguments are passed by value, not by reference
*/
-
- /*
- * TBD: [Investigate] Note from previous parser:
- * Ref_of problem with Acpi_ex_resolve_to_value() conversion.
- */
for (i = 0; i < walk_state->num_operands; i++) {
status = acpi_ex_resolve_to_value (&walk_state->operands[i], walk_state);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ds_map_opcode_to_data_type
- *
- * PARAMETERS: Opcode - AML opcode to map
- * Out_flags - Additional info about the opcode
- *
- * RETURN: The ACPI type associated with the opcode
- *
- * DESCRIPTION: Convert a raw AML opcode to the associated ACPI data type,
- * if any. If the opcode returns a value as part of the
- * intepreter execution, a flag is returned in Out_flags.
- *
- ******************************************************************************/
-
-acpi_object_type8
-acpi_ds_map_opcode_to_data_type (
- u16 opcode,
- u32 *out_flags)
-{
- acpi_object_type8 data_type = INTERNAL_TYPE_INVALID;
- const acpi_opcode_info *op_info;
- u32 flags = 0;
-
-
- PROC_NAME ("Ds_map_opcode_to_data_type");
-
-
- op_info = acpi_ps_get_opcode_info (opcode);
- if (op_info->class == AML_CLASS_UNKNOWN) {
- /* Unknown opcode */
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown AML opcode: %x\n", opcode));
- return (data_type);
- }
-
-
-/*
- * TBD: Use op class
- */
-
- switch (op_info->type) {
-
- case AML_TYPE_LITERAL:
-
- switch (opcode) {
- case AML_BYTE_OP:
- case AML_WORD_OP:
- case AML_DWORD_OP:
- case AML_QWORD_OP:
-
- data_type = ACPI_TYPE_INTEGER;
- break;
-
-
- case AML_STRING_OP:
-
- data_type = ACPI_TYPE_STRING;
- break;
-
- case AML_INT_NAMEPATH_OP:
- data_type = INTERNAL_TYPE_REFERENCE;
- break;
-
- default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unknown (type LITERAL) AML opcode: %x\n", opcode));
- break;
- }
- break;
-
-
- case AML_TYPE_DATA_TERM:
-
- switch (opcode) {
- case AML_BUFFER_OP:
-
- data_type = ACPI_TYPE_BUFFER;
- break;
-
- case AML_PACKAGE_OP:
- case AML_VAR_PACKAGE_OP:
-
- data_type = ACPI_TYPE_PACKAGE;
- break;
-
- default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unknown (type DATA_TERM) AML opcode: %x\n", opcode));
- break;
- }
- break;
-
-
- case AML_TYPE_CONSTANT:
- case AML_TYPE_METHOD_ARGUMENT:
- case AML_TYPE_LOCAL_VARIABLE:
-
- data_type = INTERNAL_TYPE_REFERENCE;
- break;
-
-
- case AML_TYPE_EXEC_1A_0T_1R:
- case AML_TYPE_EXEC_1A_1T_1R:
- case AML_TYPE_EXEC_2A_0T_1R:
- case AML_TYPE_EXEC_2A_1T_1R:
- case AML_TYPE_EXEC_2A_2T_1R:
- case AML_TYPE_EXEC_3A_1T_1R:
- case AML_TYPE_EXEC_6A_0T_1R:
- case AML_TYPE_RETURN:
-
- flags = OP_HAS_RETURN_VALUE;
- data_type = ACPI_TYPE_ANY;
- break;
-
-
- case AML_TYPE_METHOD_CALL:
-
- flags = OP_HAS_RETURN_VALUE;
- data_type = ACPI_TYPE_METHOD;
- break;
-
-
- case AML_TYPE_NAMED_FIELD:
- case AML_TYPE_NAMED_SIMPLE:
- case AML_TYPE_NAMED_COMPLEX:
- case AML_TYPE_NAMED_NO_OBJ:
-
- data_type = acpi_ds_map_named_opcode_to_data_type (opcode);
- break;
-
-
- case AML_TYPE_EXEC_1A_0T_0R:
- case AML_TYPE_EXEC_2A_0T_0R:
- case AML_TYPE_EXEC_3A_0T_0R:
- case AML_TYPE_EXEC_1A_1T_0R:
- case AML_TYPE_CONTROL:
-
- /* No mapping needed at this time */
-
- break;
-
-
- default:
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unimplemented data type opcode: %x\n", opcode));
- break;
- }
-
- /* Return flags to caller if requested */
-
- if (out_flags) {
- *out_flags = flags;
- }
-
- return (data_type);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ds_map_named_opcode_to_data_type
- *
- * PARAMETERS: Opcode - The Named AML opcode to map
- *
- * RETURN: The ACPI type associated with the named opcode
- *
- * DESCRIPTION: Convert a raw Named AML opcode to the associated data type.
- * Named opcodes are a subsystem of the AML opcodes.
- *
- ******************************************************************************/
-
-acpi_object_type8
-acpi_ds_map_named_opcode_to_data_type (
- u16 opcode)
-{
- acpi_object_type8 data_type;
-
-
- FUNCTION_ENTRY ();
-
-
- /* Decode Opcode */
-
- switch (opcode) {
- case AML_SCOPE_OP:
- data_type = INTERNAL_TYPE_SCOPE;
- break;
-
- case AML_DEVICE_OP:
- data_type = ACPI_TYPE_DEVICE;
- break;
-
- case AML_THERMAL_ZONE_OP:
- data_type = ACPI_TYPE_THERMAL;
- break;
-
- case AML_METHOD_OP:
- data_type = ACPI_TYPE_METHOD;
- break;
-
- case AML_POWER_RES_OP:
- data_type = ACPI_TYPE_POWER;
- break;
-
- case AML_PROCESSOR_OP:
- data_type = ACPI_TYPE_PROCESSOR;
- break;
-
- case AML_FIELD_OP: /* Field_op */
- data_type = INTERNAL_TYPE_FIELD_DEFN;
- break;
-
- case AML_INDEX_FIELD_OP: /* Index_field_op */
- data_type = INTERNAL_TYPE_INDEX_FIELD_DEFN;
- break;
-
- case AML_BANK_FIELD_OP: /* Bank_field_op */
- data_type = INTERNAL_TYPE_BANK_FIELD_DEFN;
- break;
-
- case AML_INT_NAMEDFIELD_OP: /* NO CASE IN ORIGINAL */
- data_type = ACPI_TYPE_ANY;
- break;
-
- case AML_NAME_OP: /* Name_op - special code in original */
- case AML_INT_NAMEPATH_OP:
- data_type = ACPI_TYPE_ANY;
- break;
-
- case AML_ALIAS_OP:
- data_type = INTERNAL_TYPE_ALIAS;
- break;
-
- case AML_MUTEX_OP:
- data_type = ACPI_TYPE_MUTEX;
- break;
-
- case AML_EVENT_OP:
- data_type = ACPI_TYPE_EVENT;
- break;
-
- case AML_DATA_REGION_OP:
- case AML_REGION_OP:
- data_type = ACPI_TYPE_REGION;
- break;
-
-
- default:
- data_type = ACPI_TYPE_ANY;
- break;
-
- }
-
- return (data_type);
-}
-
-
*
* Module Name: dswexec - Dispatcher method execution callbacks;
* dispatch to interpreter.
- * $Revision: 79 $
+ * $Revision: 89 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_DISPATCHER
- MODULE_NAME ("dswexec")
+ ACPI_MODULE_NAME ("dswexec")
/*
- * Dispatch tables for opcode classes
+ * Dispatch table for opcode classes
*/
ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch [] = {
acpi_ex_opcode_1A_0T_0R,
acpi_status
acpi_ds_get_predicate_value (
acpi_walk_state *walk_state,
- u32 has_result_obj) {
+ acpi_operand_object *result_obj) {
acpi_status status = AE_OK;
acpi_operand_object *obj_desc;
- FUNCTION_TRACE_PTR ("Ds_get_predicate_value", walk_state);
+ ACPI_FUNCTION_TRACE_PTR ("Ds_get_predicate_value", walk_state);
walk_state->control_state->common.state = 0;
- if (has_result_obj) {
+ if (result_obj) {
status = acpi_ds_result_pop (&obj_desc, walk_state);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
return_ACPI_STATUS (status);
}
}
-
else {
status = acpi_ds_create_operand (walk_state, walk_state->op, 0);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (AE_AML_NO_OPERAND);
}
-
/*
* Result of predicate evaluation currently must
* be a number
goto cleanup;
}
-
/* Truncate the predicate to 32-bits if necessary */
acpi_ex_truncate_for32bit_table (obj_desc, walk_state);
if (obj_desc->integer.value) {
walk_state->control_state->common.value = TRUE;
}
-
else {
/*
* Predicate is FALSE, we will just toss the
cleanup:
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%pn",
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%p\n",
walk_state->control_state->common.value, walk_state->op));
/* Break to debugger to display result */
- DEBUGGER_EXEC (acpi_db_display_result_object (obj_desc, walk_state));
+ ACPI_DEBUGGER_EXEC (acpi_db_display_result_object (obj_desc, walk_state));
/*
* Delete the predicate result object (we know that
*/
acpi_ut_remove_reference (obj_desc);
- walk_state->control_state->common.state = CONTROL_NORMAL;
+ walk_state->control_state->common.state = ACPI_CONTROL_NORMAL;
return_ACPI_STATUS (status);
}
u32 opcode_class;
- FUNCTION_TRACE_PTR ("Ds_exec_begin_op", walk_state);
+ ACPI_FUNCTION_TRACE_PTR ("Ds_exec_begin_op", walk_state);
op = walk_state->op;
walk_state->op = op;
walk_state->op_info = acpi_ps_get_opcode_info (op->opcode);
walk_state->opcode = op->opcode;
+
+ if (acpi_ns_opens_scope (walk_state->op_info->object_type)) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n",
+ acpi_ut_get_type_name (walk_state->op_info->object_type), op));
+ acpi_ds_scope_stack_pop (walk_state);
+ }
}
if (op == walk_state->origin) {
*/
if ((walk_state->control_state) &&
(walk_state->control_state->common.state ==
- CONTROL_CONDITIONAL_EXECUTING)) {
+ ACPI_CONTROL_CONDITIONAL_EXECUTING)) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Exec predicate Op=%p State=%p\n",
op, walk_state));
- walk_state->control_state->common.state = CONTROL_PREDICATE_EXECUTING;
+ walk_state->control_state->common.state = ACPI_CONTROL_PREDICATE_EXECUTING;
/* Save start of predicate */
case AML_CLASS_NAMED_OBJECT:
- if (walk_state->walk_type == WALK_METHOD) {
+ if (walk_state->walk_type == ACPI_WALK_METHOD) {
/*
* Found a named object declaration during method
* execution; we must enter this object into the
status = acpi_ds_load2_begin_op (walk_state, NULL);
}
-
if (op->opcode == AML_REGION_OP) {
status = acpi_ds_result_stack_push (walk_state);
}
-
break;
- /* most operators with arguments */
-
case AML_CLASS_EXECUTE:
case AML_CLASS_CREATE:
+ /* most operators with arguments */
/* Start a new result/operand state */
status = acpi_ds_result_stack_push (walk_state);
u32 i;
- FUNCTION_TRACE_PTR ("Ds_exec_end_op", walk_state);
+ ACPI_FUNCTION_TRACE_PTR ("Ds_exec_end_op", walk_state);
op = walk_state->op;
walk_state->return_desc = NULL;
walk_state->result_obj = NULL;
-
/* Call debugger for single step support (DEBUG build only) */
- DEBUGGER_EXEC (status = acpi_db_single_step (walk_state, op, op_class));
- DEBUGGER_EXEC (if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status);});
-
+ ACPI_DEBUGGER_EXEC (status = acpi_db_single_step (walk_state, op, op_class));
+ ACPI_DEBUGGER_EXEC (if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status);});
- switch (op_class) {
/* Decode the Opcode Class */
- case AML_CLASS_ARGUMENT: /* constants, literals, etc. do nothing */
+ switch (op_class) {
+ case AML_CLASS_ARGUMENT: /* constants, literals, etc. -- do nothing */
break;
- /* most operators with arguments */
- case AML_CLASS_EXECUTE:
+ case AML_CLASS_EXECUTE: /* most operators with arguments */
/* Build resolved operand stack */
status = acpi_ex_resolve_operands (walk_state->opcode,
&(walk_state->operands [walk_state->num_operands -1]),
walk_state);
- if (ACPI_FAILURE (status)) {
- /* TBD: must pop and delete operands */
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "[%s]: Could not resolve operands, %s\n",
- acpi_ps_get_opcode_name (walk_state->opcode), acpi_format_exception (status)));
+ if (ACPI_SUCCESS (status)) {
+ ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
+ acpi_ps_get_opcode_name (walk_state->opcode),
+ walk_state->num_operands, "after Ex_resolve_operands");
/*
- * On error, we must delete all the operands and clear the
- * operand stack
+ * Dispatch the request to the appropriate interpreter handler
+ * routine. There is one routine per opcode "type" based upon the
+ * number of opcode arguments and return type.
*/
- for (i = 0; i < walk_state->num_operands; i++) {
- acpi_ut_remove_reference (walk_state->operands[i]);
- walk_state->operands[i] = NULL;
- }
-
- walk_state->num_operands = 0;
- goto cleanup;
+ status = acpi_gbl_op_type_dispatch [op_type] (walk_state);
+ }
+ else {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "[%s]: Could not resolve operands, %s\n",
+ acpi_ps_get_opcode_name (walk_state->opcode),
+ acpi_format_exception (status)));
}
- DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, acpi_ps_get_opcode_name (walk_state->opcode),
- walk_state->num_operands, "after Ex_resolve_operands");
-
- /*
- * Dispatch the request to the appropriate interpreter handler
- * routine. There is one routine per opcode "type" based upon the
- * number of opcode arguments and return type.
- */
- status = acpi_gbl_op_type_dispatch [op_type] (walk_state);
-
-
- /* Delete argument objects and clear the operand stack */
+ /* Always delete the argument objects and clear the operand stack */
for (i = 0; i < walk_state->num_operands; i++) {
/*
acpi_ut_remove_reference (walk_state->operands[i]);
walk_state->operands[i] = NULL;
}
-
walk_state->num_operands = 0;
/*
}
/*
- * Since the operands will be passed to another
- * control method, we must resolve all local
- * references here (Local variables, arguments
- * to *this* method, etc.)
+ * Since the operands will be passed to another control method,
+ * we must resolve all local references here (Local variables,
+ * arguments to *this* method, etc.)
*/
status = acpi_ds_resolve_operands (walk_state);
if (ACPI_FAILURE (status)) {
* especially the operand count!
*/
return_ACPI_STATUS (status);
- break;
case AML_TYPE_CREATE_FIELD:
case AML_TYPE_NAMED_FIELD:
case AML_TYPE_NAMED_COMPLEX:
case AML_TYPE_NAMED_SIMPLE:
+ case AML_TYPE_NAMED_NO_OBJ:
status = acpi_ds_load2_end_op (walk_state);
if (ACPI_FAILURE (status)) {
break;
+
case AML_TYPE_UNDEFINED:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Undefined opcode type Op=%p\n", op));
return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
- break;
case AML_TYPE_BOGUS:
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Internal opcode=%X type Op=%p\n",
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "Internal opcode=%X type Op=%p\n",
walk_state->opcode, op));
break;
+
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
}
/*
- * ACPI 2.0 support for 64-bit integers:
- * Truncate numeric result value if we are executing from a 32-bit ACPI table
+ * ACPI 2.0 support for 64-bit integers: Truncate numeric
+ * result value if we are executing from a 32-bit ACPI table
*/
acpi_ex_truncate_for32bit_table (walk_state->result_obj, walk_state);
if ((walk_state->control_state) &&
(walk_state->control_state->common.state ==
- CONTROL_PREDICATE_EXECUTING) &&
+ ACPI_CONTROL_PREDICATE_EXECUTING) &&
(walk_state->control_state->control.predicate_op == op)) {
- status = acpi_ds_get_predicate_value (walk_state, (u32) walk_state->result_obj);
+ status = acpi_ds_get_predicate_value (walk_state, walk_state->result_obj);
walk_state->result_obj = NULL;
}
if (walk_state->result_obj) {
/* Break to debugger to display result */
- DEBUGGER_EXEC (acpi_db_display_result_object (walk_state->result_obj, walk_state));
+ ACPI_DEBUGGER_EXEC (acpi_db_display_result_object (walk_state->result_obj, walk_state));
/*
* Delete the result op if and only if:
/* Always clear the object stack */
- /* TBD: [Investigate] Clear stack of return value,
- but don't delete it */
walk_state->num_operands = 0;
-
return_ACPI_STATUS (status);
}
/******************************************************************************
*
* Module Name: dswload - Dispatcher namespace load callbacks
- * $Revision: 50 $
+ * $Revision: 61 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_DISPATCHER
- MODULE_NAME ("dswload")
+ ACPI_MODULE_NAME ("dswload")
/*******************************************************************************
default:
return (AE_BAD_PARAMETER);
- break;
}
return (AE_OK);
acpi_parse_object *op;
acpi_namespace_node *node;
acpi_status status;
- acpi_object_type8 data_type;
+ acpi_object_type object_type;
NATIVE_CHAR *path;
- PROC_NAME ("Ds_load1_begin_op");
+ ACPI_FUNCTION_NAME ("Ds_load1_begin_op");
op = walk_state->op;
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state));
+ if (op && (op->opcode == AML_INT_NAMEDFIELD_OP)) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state));
+ }
+
/* We are only interested in opcodes that have an associated name */
if (walk_state->op) {
/* Map the raw opcode into an internal object type */
- data_type = acpi_ds_map_named_opcode_to_data_type (walk_state->opcode);
-
+ object_type = walk_state->op_info->object_type;
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "State=%p Op=%p Type=%x\n", walk_state, op, data_type));
-
-
- if (walk_state->opcode == AML_SCOPE_OP) {
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "State=%p Op=%p Type=%x\n", walk_state, op, data_type));
- }
+ "State=%p Op=%p Type=%x\n", walk_state, op, object_type));
/*
* Enter the named type into the internal namespace. We enter the name
* as we go downward in the parse tree. Any necessary subobjects that involve
* arguments to the opcode must be created as we go back up the parse tree later.
*/
- status = acpi_ns_lookup (walk_state->scope_info, path, data_type,
- IMODE_LOAD_PASS1, NS_NO_UPSEARCH, walk_state, &(node));
+ status = acpi_ns_lookup (walk_state->scope_info, path, object_type,
+ ACPI_IMODE_LOAD_PASS1, ACPI_NS_NO_UPSEARCH, walk_state, &(node));
if (ACPI_FAILURE (status)) {
return (status);
acpi_walk_state *walk_state)
{
acpi_parse_object *op;
- acpi_object_type8 data_type;
+ acpi_object_type object_type;
- PROC_NAME ("Ds_load1_end_op");
+ ACPI_FUNCTION_NAME ("Ds_load1_end_op");
op = walk_state->op;
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state));
/* We are only interested in opcodes that have an associated name */
- if (!(walk_state->op_info->flags & AML_NAMED)) {
+ if (!(walk_state->op_info->flags & (AML_NAMED | AML_FIELD))) {
+ return (AE_OK);
+ }
+
+ /* Get the object type to determine if we should pop the scope */
+
+ object_type = walk_state->op_info->object_type;
+
+ if (walk_state->op_info->flags & AML_FIELD) {
+ if (walk_state->opcode == AML_FIELD_OP ||
+ walk_state->opcode == AML_BANK_FIELD_OP ||
+ walk_state->opcode == AML_INDEX_FIELD_OP) {
+ acpi_ds_init_field_objects (op, walk_state);
+ }
return (AE_OK);
}
- /* Get the type to determine if we should pop the scope */
- data_type = acpi_ds_map_named_opcode_to_data_type (op->opcode);
+ if (op->opcode == AML_REGION_OP) {
+ /*Status = */acpi_ex_create_region (((acpi_parse2_object *) op)->data,
+ ((acpi_parse2_object *) op)->length,
+ (ACPI_ADR_SPACE_TYPE) ((op->value.arg)->value.integer), walk_state);
+ }
if (op->opcode == AML_NAME_OP) {
- /* For Name opcode, check the argument */
+ /* For Name opcode, get the object type from the argument */
if (op->value.arg) {
- data_type = acpi_ds_map_opcode_to_data_type (
- (op->value.arg)->opcode, NULL);
- ((acpi_namespace_node *)op->node)->type =
- (u8) data_type;
+ object_type = (acpi_ps_get_opcode_info ((op->value.arg)->opcode))->object_type;
+ op->node->type = (u8) object_type;
}
}
/* Pop the scope stack */
- if (acpi_ns_opens_scope (data_type)) {
+ if (acpi_ns_opens_scope (object_type)) {
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s): Popping scope for Op %p\n",
- acpi_ut_get_type_name (data_type), op));
+ acpi_ut_get_type_name (object_type), op));
acpi_ds_scope_stack_pop (walk_state);
}
acpi_parse_object *op;
acpi_namespace_node *node;
acpi_status status;
- acpi_object_type8 data_type;
+ acpi_object_type object_type;
NATIVE_CHAR *buffer_ptr;
void *original = NULL;
- PROC_NAME ("Ds_load2_begin_op");
+ ACPI_FUNCTION_NAME ("Ds_load2_begin_op");
+
op = walk_state->op;
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state));
-
if (op) {
/* We only care about Namespace opcodes here */
- if (!(walk_state->op_info->flags & AML_NSOPCODE) &&
- walk_state->opcode != AML_INT_NAMEPATH_OP) {
- return (AE_OK);
- }
-
- /* TBD: [Restructure] Temp! same code as in psparse */
-
- if (!(walk_state->op_info->flags & AML_NAMED)) {
+ if ((!(walk_state->op_info->flags & AML_NSOPCODE) && (walk_state->opcode != AML_INT_NAMEPATH_OP)) ||
+ (!(walk_state->op_info->flags & AML_NAMED))) {
return (AE_OK);
}
}
}
else {
+ /* Get the namestring from the raw AML */
+
buffer_ptr = acpi_ps_get_next_namestring (&walk_state->parser_state);
}
+ /* Map the opcode into an internal object type */
- /* Map the raw opcode into an internal object type */
-
- data_type = acpi_ds_map_named_opcode_to_data_type (walk_state->opcode);
+ object_type = walk_state->op_info->object_type;
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "State=%p Op=%p Type=%x\n", walk_state, op, data_type));
+ "State=%p Op=%p Type=%x\n", walk_state, op, object_type));
if (walk_state->opcode == AML_FIELD_OP ||
node = NULL;
status = AE_OK;
}
-
else if (walk_state->opcode == AML_INT_NAMEPATH_OP) {
/*
* The Name_path is an object reference to an existing object. Don't enter the
* name into the namespace, but look it up for use later
*/
- status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, data_type,
- IMODE_EXECUTE, NS_SEARCH_PARENT, walk_state, &(node));
+ status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type,
+ ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node));
}
-
else {
if (op && op->node) {
original = op->node;
node = op->node;
- if (acpi_ns_opens_scope (data_type)) {
- status = acpi_ds_scope_stack_push (node, data_type, walk_state);
+ if (acpi_ns_opens_scope (object_type)) {
+ status = acpi_ds_scope_stack_push (node, object_type, walk_state);
if (ACPI_FAILURE (status)) {
return (status);
}
* as we go downward in the parse tree. Any necessary subobjects that involve
* arguments to the opcode must be created as we go back up the parse tree later.
*/
- status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, data_type,
- IMODE_EXECUTE, NS_NO_UPSEARCH, walk_state, &(node));
+ status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type,
+ ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, walk_state, &(node));
}
if (ACPI_SUCCESS (status)) {
return (AE_NO_MEMORY);
}
- /* Initialize */
+ /* Initialize the new op */
((acpi_parse2_object *)op)->name = node->name;
*out_op = op;
{
acpi_parse_object *op;
acpi_status status = AE_OK;
- acpi_object_type8 data_type;
+ acpi_object_type object_type;
acpi_namespace_node *node;
acpi_parse_object *arg;
acpi_namespace_node *new_node;
u32 i;
- PROC_NAME ("Ds_load2_end_op");
+ ACPI_FUNCTION_NAME ("Ds_load2_end_op");
op = walk_state->op;
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state));
-
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n",
+ walk_state->op_info->name, op, walk_state));
/* Only interested in opcodes that have namespace objects */
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Ending scope Op=%p State=%p\n", op, walk_state));
- if (((acpi_parse2_object *)op)->name == -1) {
+ if (((acpi_parse2_object *)op)->name == ACPI_UINT16_MAX) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unnamed scope! Op=%p State=%p\n",
op, walk_state));
return (AE_OK);
}
- data_type = acpi_ds_map_named_opcode_to_data_type (op->opcode);
+ object_type = walk_state->op_info->object_type;
/*
* Get the Node/name from the earlier lookup
/* Pop the scope stack */
- if (acpi_ns_opens_scope (data_type)) {
-
+ if (acpi_ns_opens_scope (object_type)) {
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n",
- acpi_ut_get_type_name (data_type), op));
+ acpi_ut_get_type_name (object_type), op));
acpi_ds_scope_stack_pop (walk_state);
}
case AML_TYPE_NAMED_FIELD:
- arg = op->value.arg;
switch (op->opcode) {
case AML_INDEX_FIELD_OP:
walk_state);
break;
-
case AML_BANK_FIELD_OP:
status = acpi_ds_create_bank_field (op, arg->node, walk_state);
break;
-
case AML_FIELD_OP:
status = acpi_ds_create_field (op, arg->node, walk_state);
status = acpi_ex_create_processor (walk_state);
break;
-
case AML_POWER_RES_OP:
status = acpi_ex_create_power_resource (walk_state);
break;
-
case AML_MUTEX_OP:
status = acpi_ex_create_mutex (walk_state);
break;
-
case AML_EVENT_OP:
status = acpi_ex_create_event (walk_state);
break;
-
case AML_DATA_REGION_OP:
status = acpi_ex_create_table_region (walk_state);
status = AE_OK;
goto cleanup;
- break;
}
/* Delete operands */
switch (op->opcode) {
case AML_METHOD_OP:
/*
- * Method_op Pkg_length Names_string Method_flags Term_list
+ * Method_op Pkg_length Name_string Method_flags Term_list
*/
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"LOADING-Method: State=%p Op=%p Named_obj=%p\n",
walk_state, op, node));
- if (!node->object) {
+ if (!acpi_ns_get_attached_object (node)) {
status = acpi_ds_create_operands (walk_state, arg);
if (ACPI_FAILURE (status)) {
goto cleanup;
* The Op_region is not fully parsed at this time. Only valid argument is the Space_id.
* (We must save the address of the AML of the address and length operands)
*/
- status = acpi_ex_create_region (((acpi_parse2_object *) op)->data,
- ((acpi_parse2_object *) op)->length,
- (ACPI_ADR_SPACE_TYPE) arg->value.integer, walk_state);
+ /*
+ * If we have a valid region, initialize it
+ * Namespace is NOT locked at this point.
+ */
+ status = acpi_ev_initialize_region (acpi_ns_get_attached_object (node), FALSE);
+ if (ACPI_FAILURE (status)) {
+ /*
+ * If AE_NOT_EXIST is returned, it is not fatal
+ * because many regions get created before a handler
+ * is installed for said region.
+ */
+ if (AE_NOT_EXIST == status) {
+ status = AE_OK;
+ }
+ }
break;
* Lookup the method name and save the Node
*/
status = acpi_ns_lookup (walk_state->scope_info, arg->value.string,
- ACPI_TYPE_ANY, IMODE_LOAD_PASS2,
- NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE,
+ ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2,
+ ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
walk_state, &(new_node));
if (ACPI_SUCCESS (status)) {
- /* TBD: has name already been resolved by here ??*/
-
- /* TBD: [Restructure] Make sure that what we found is indeed a method! */
- /* We didn't search for a method on purpose, to see if the name would resolve! */
+ /*
+ * Make sure that what we found is indeed a method
+ * We didn't search for a method on purpose, to see if the name would resolve
+ */
+ if (new_node->type != ACPI_TYPE_METHOD) {
+ status = AE_AML_OPERAND_TYPE;
+ }
/* We could put the returned object (Node) on the object stack for later, but
* for now, we will put it in the "op" object that the parser uses, so we
/******************************************************************************
*
* Module Name: dswscope - Scope stack manipulation
- * $Revision: 49 $
+ * $Revision: 52 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_DISPATCHER
- MODULE_NAME ("dswscope")
+ ACPI_MODULE_NAME ("dswscope")
#define STACK_POP(head) head
{
acpi_generic_state *scope_info;
- PROC_NAME ("Ds_scope_stack_clear");
+ ACPI_FUNCTION_NAME ("Ds_scope_stack_clear");
while (walk_state->scope_info) {
acpi_status
acpi_ds_scope_stack_push (
acpi_namespace_node *node,
- acpi_object_type8 type,
+ acpi_object_type type,
acpi_walk_state *walk_state)
{
acpi_generic_state *scope_info;
- FUNCTION_TRACE ("Ds_scope_stack_push");
+ ACPI_FUNCTION_TRACE ("Ds_scope_stack_push");
if (!node) {
/* Invalid scope */
- REPORT_ERROR (("Ds_scope_stack_push: null scope passed\n"));
+ ACPI_REPORT_ERROR (("Ds_scope_stack_push: null scope passed\n"));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Make sure object type is valid */
if (!acpi_ex_validate_object_type (type)) {
- REPORT_WARNING (("Ds_scope_stack_push: type code out of range\n"));
+ ACPI_REPORT_WARNING (("Ds_scope_stack_push: type code out of range\n"));
}
acpi_generic_state *scope_info;
- FUNCTION_TRACE ("Ds_scope_stack_pop");
+ ACPI_FUNCTION_TRACE ("Ds_scope_stack_pop");
/*
/******************************************************************************
*
* Module Name: dswstate - Dispatcher parse tree walk management routines
- * $Revision: 54 $
+ * $Revision: 59 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acinterp.h"
#define _COMPONENT ACPI_DISPATCHER
- MODULE_NAME ("dswstate")
+ ACPI_MODULE_NAME ("dswstate")
/*******************************************************************************
acpi_generic_state *state;
- PROC_NAME ("Ds_result_insert");
+ ACPI_FUNCTION_NAME ("Ds_result_insert");
state = walk_state->results;
acpi_generic_state *state;
- PROC_NAME ("Ds_result_remove");
+ ACPI_FUNCTION_NAME ("Ds_result_remove");
state = walk_state->results;
acpi_generic_state *state;
- PROC_NAME ("Ds_result_pop");
+ ACPI_FUNCTION_NAME ("Ds_result_pop");
state = walk_state->results;
acpi_generic_state *state;
- PROC_NAME ("Ds_result_pop_from_bottom");
+ ACPI_FUNCTION_NAME ("Ds_result_pop_from_bottom");
state = walk_state->results;
acpi_generic_state *state;
- PROC_NAME ("Ds_result_push");
+ ACPI_FUNCTION_NAME ("Ds_result_push");
state = walk_state->results;
{
acpi_generic_state *state;
- PROC_NAME ("Ds_result_stack_push");
+ ACPI_FUNCTION_NAME ("Ds_result_stack_push");
state = acpi_ut_create_generic_state ();
{
acpi_generic_state *state;
- PROC_NAME ("Ds_result_stack_pop");
+ ACPI_FUNCTION_NAME ("Ds_result_stack_pop");
/* Check for stack underflow */
u32 i;
- FUNCTION_TRACE_PTR ("Ds_obj_stack_delete_all", walk_state);
+ ACPI_FUNCTION_TRACE_PTR ("Ds_obj_stack_delete_all", walk_state);
/* The stack size is configurable, but fixed */
void *object,
acpi_walk_state *walk_state)
{
- PROC_NAME ("Ds_obj_stack_push");
+ ACPI_FUNCTION_NAME ("Ds_obj_stack_push");
/* Check for stack overflow */
acpi_operand_object **object,
acpi_walk_state *walk_state)
{
- PROC_NAME ("Ds_obj_stack_pop_object");
+ ACPI_FUNCTION_NAME ("Ds_obj_stack_pop_object");
/* Check for stack underflow */
{
u32 i;
- PROC_NAME ("Ds_obj_stack_pop");
+ ACPI_FUNCTION_NAME ("Ds_obj_stack_pop");
for (i = 0; i < pop_count; i++) {
u32 i;
acpi_operand_object *obj_desc;
- PROC_NAME ("Ds_obj_stack_pop_and_delete");
+ ACPI_FUNCTION_NAME ("Ds_obj_stack_pop_and_delete");
for (i = 0; i < pop_count; i++) {
acpi_walk_state *walk_state)
{
- FUNCTION_TRACE_PTR ("Ds_obj_stack_get_value", walk_state);
+ ACPI_FUNCTION_TRACE_PTR ("Ds_obj_stack_get_value", walk_state);
/* Can't do it if the stack is empty */
*
* FUNCTION: Acpi_ds_get_current_walk_state
*
- * PARAMETERS: Walk_list - Get current active state for this walk list
+ * PARAMETERS: Thread - Get current active state for this Thread
*
* RETURN: Pointer to the current walk state
*
* DESCRIPTION: Get the walk state that is at the head of the list (the "current"
- * walk state.
+ * walk state.)
*
******************************************************************************/
acpi_walk_state *
acpi_ds_get_current_walk_state (
- acpi_walk_list *walk_list)
+ ACPI_THREAD_STATE *thread)
{
- PROC_NAME ("Ds_get_current_walk_state");
+ ACPI_FUNCTION_NAME ("Ds_get_current_walk_state");
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Ds_get_current_walk_state, =%p\n",
- walk_list->walk_state));
-
- if (!walk_list) {
+ if (!thread) {
return (NULL);
}
- return (walk_list->walk_state);
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Ds_get_current_walk_state, =%p\n",
+ thread->walk_state_list));
+
+
+ return (thread->walk_state_list);
}
void
acpi_ds_push_walk_state (
acpi_walk_state *walk_state,
- acpi_walk_list *walk_list)
+ ACPI_THREAD_STATE *thread)
{
- FUNCTION_TRACE ("Ds_push_walk_state");
+ ACPI_FUNCTION_TRACE ("Ds_push_walk_state");
- walk_state->next = walk_list->walk_state;
- walk_list->walk_state = walk_state;
+ walk_state->next = thread->walk_state_list;
+ thread->walk_state_list = walk_state;
return_VOID;
}
acpi_walk_state *
acpi_ds_pop_walk_state (
- acpi_walk_list *walk_list)
+ ACPI_THREAD_STATE *thread)
{
acpi_walk_state *walk_state;
- FUNCTION_TRACE ("Ds_pop_walk_state");
+ ACPI_FUNCTION_TRACE ("Ds_pop_walk_state");
- walk_state = walk_list->walk_state;
+ walk_state = thread->walk_state_list;
if (walk_state) {
/* Next walk state becomes the current walk state */
- walk_list->walk_state = walk_state->next;
+ thread->walk_state_list = walk_state->next;
/*
* Don't clear the NEXT field, this serves as an indicator
* that there is a parent WALK STATE
- * Walk_state->Next = NULL;
+ * NO: Walk_state->Next = NULL;
*/
}
* FUNCTION: Acpi_ds_create_walk_state
*
* PARAMETERS: Origin - Starting point for this walk
- * Walk_list - Owning walk list
+ * Thread - Current thread state
*
* RETURN: Pointer to the new walk state.
*
- * DESCRIPTION: Allocate and initialize a new walk state. The current walk state
- * is set to this new state.
+ * DESCRIPTION: Allocate and initialize a new walk state. The current walk
+ * state is set to this new state.
*
******************************************************************************/
acpi_owner_id owner_id,
acpi_parse_object *origin,
acpi_operand_object *mth_desc,
- acpi_walk_list *walk_list)
+ ACPI_THREAD_STATE *thread)
{
acpi_walk_state *walk_state;
acpi_status status;
- FUNCTION_TRACE ("Ds_create_walk_state");
+ ACPI_FUNCTION_TRACE ("Ds_create_walk_state");
walk_state = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_WALK);
walk_state->owner_id = owner_id;
walk_state->origin = origin;
walk_state->method_desc = mth_desc;
- walk_state->walk_list = walk_list;
+ walk_state->thread = thread;
/* Init the method args/local */
/* Put the new state at the head of the walk list */
- if (walk_list) {
- acpi_ds_push_walk_state (walk_state, walk_list);
+ if (thread) {
+ acpi_ds_push_walk_state (walk_state, thread);
}
return_PTR (walk_state);
acpi_parse_state *parser_state = &walk_state->parser_state;
- FUNCTION_TRACE ("Ds_init_aml_walk");
+ ACPI_FUNCTION_TRACE ("Ds_init_aml_walk");
walk_state->parser_state.aml =
walk_state->parser_state.pkg_end = aml_start + aml_length;
/* The Next_op of the Next_walk will be the beginning of the method */
- /* TBD: [Restructure] -- obsolete? */
walk_state->next_op = NULL;
walk_state->params = params;
if (method_node) {
walk_state->parser_state.start_node = method_node;
- walk_state->walk_type = WALK_METHOD;
+ walk_state->walk_type = ACPI_WALK_METHOD;
walk_state->method_node = method_node;
walk_state->method_desc = acpi_ns_get_attached_object (method_node);
acpi_generic_state *state;
- FUNCTION_TRACE_PTR ("Ds_delete_walk_state", walk_state);
+ ACPI_FUNCTION_TRACE_PTR ("Ds_delete_walk_state", walk_state);
if (!walk_state) {
acpi_ds_delete_walk_state_cache (
void)
{
- FUNCTION_TRACE ("Ds_delete_walk_state_cache");
+ ACPI_FUNCTION_TRACE ("Ds_delete_walk_state_cache");
acpi_ut_delete_generic_cache (ACPI_MEM_LIST_WALK);
+++ /dev/null
-/*
- * driver.c - ACPI driver
- *
- * Copyright (C) 2000 Andrew Henroid
- * Copyright (C) 2001 Andrew Grover
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-/*
- * Changes
- * David Woodhouse <dwmw2@redhat.com> 2000-12-6
- * - Fix interruptible_sleep_on() races
- * Andrew Grover <andrew.grover@intel.com> 2001-2-28
- * - Major revamping
- * Peter Breuer <ptb@it.uc3m.es> 2001-5-20
- * - parse boot time params.
- */
-
-#include <linux/config.h>
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/slab.h>
-#include <linux/proc_fs.h>
-#include <linux/sysctl.h>
-#include <linux/pm.h>
-#include <linux/acpi.h>
-#include <asm/uaccess.h>
-#include "acpi.h"
-
-
-#define _COMPONENT OS_DEPENDENT
- MODULE_NAME ("driver")
-
-FADT_DESCRIPTOR acpi_fadt;
-
-static int acpi_disabled = 0;
-
-enum acpi_blacklist_predicates
-{
- all_versions,
- less_than_or_equal,
- equal,
- greater_than_or_equal,
-};
-
-struct acpi_blacklist_item
-{
- char oem_id[7];
- char oem_table_id[9];
- u32 oem_revision;
- enum acpi_blacklist_predicates oem_revision_predicate;
-};
-
-/*
- * Currently, this blacklists based on items in the FADT. We may want to
- * expand this to using other ACPI tables in the future, too.
- */
-static struct acpi_blacklist_item acpi_blacklist[] __initdata =
-{
- {"TOSHIB", "750 ", 0x970814, less_than_or_equal}, /* Portege 7020, BIOS 8.10 */
- {""}
-};
-
-int
-acpi_blacklisted(FADT_DESCRIPTOR *fadt)
-{
- int i = 0;
-
- while (acpi_blacklist[i].oem_id[0] != '\0')
- {
- if (strncmp(acpi_blacklist[i].oem_id, fadt->header.oem_id, 6)) {
- i++;
- continue;
- }
-
- if (strncmp(acpi_blacklist[i].oem_table_id, fadt->header.oem_table_id, 8)) {
- i++;
- continue;
- }
-
- if (acpi_blacklist[i].oem_revision_predicate == all_versions)
- return TRUE;
-
- if (acpi_blacklist[i].oem_revision_predicate == less_than_or_equal
- && fadt->header.oem_revision <= acpi_blacklist[i].oem_revision)
- return TRUE;
-
- if (acpi_blacklist[i].oem_revision_predicate == greater_than_or_equal
- && fadt->header.oem_revision >= acpi_blacklist[i].oem_revision)
- return TRUE;
-
- if (acpi_blacklist[i].oem_revision_predicate == equal
- && fadt->header.oem_revision == acpi_blacklist[i].oem_revision)
- return TRUE;
-
- i++;
- }
-
- return FALSE;
-}
-
-/*
- * Start the interpreter
- */
-int
-acpi_init(void)
-{
- acpi_buffer buffer;
- acpi_system_info sys_info;
-
- if (PM_IS_ACTIVE()) {
- printk(KERN_NOTICE "ACPI: APM is already active, exiting\n");
- return -ENODEV;
- }
-
- if (acpi_disabled) {
- printk(KERN_NOTICE "ACPI: disabled by cmdline, exiting\n");
- return -ENODEV;
- }
-
- if (!ACPI_SUCCESS(acpi_initialize_subsystem())) {
- printk(KERN_ERR "ACPI: Driver initialization failed\n");
- return -ENODEV;
- }
-
- /* from this point on, on error we must call acpi_terminate() */
- if (!ACPI_SUCCESS(acpi_load_tables())) {
- printk(KERN_ERR "ACPI: System description table load failed\n");
- acpi_terminate();
- return -ENODEV;
- }
-
- /* get a separate copy of the FADT for use by other drivers */
- memset(&acpi_fadt, 0, sizeof(acpi_fadt));
- buffer.pointer = &acpi_fadt;
- buffer.length = sizeof(acpi_fadt);
-
- if (!ACPI_SUCCESS(acpi_get_table(ACPI_TABLE_FADT, 1, &buffer))) {
- printk(KERN_ERR "ACPI: Could not get FADT\n");
- acpi_terminate();
- return -ENODEV;
- }
-
- if (acpi_blacklisted(&acpi_fadt)) {
- printk(KERN_ERR "ACPI: On blacklist -- BIOS not fully ACPI compliant\n");
- acpi_terminate();
- return -ENODEV;
- }
-
- buffer.length = sizeof(sys_info);
- buffer.pointer = &sys_info;
-
- if (!ACPI_SUCCESS (acpi_get_system_info(&buffer))) {
- printk(KERN_ERR "ACPI: Could not get system info\n");
- acpi_terminate();
- return -ENODEV;
- }
-
- printk(KERN_INFO "ACPI: Core Subsystem version [%x]\n", sys_info.acpi_ca_version);
-
- if (!ACPI_SUCCESS(acpi_enable_subsystem(ACPI_FULL_INITIALIZATION))) {
- printk(KERN_ERR "ACPI: Subsystem enable failed\n");
- acpi_terminate();
- return -ENODEV;
- }
-
- printk(KERN_INFO "ACPI: Subsystem enabled\n");
-
- pm_active = 1;
-
- return 0;
-}
-
-/*
- * Terminate the interpreter
- */
-void
-acpi_exit(void)
-{
- acpi_terminate();
-
- pm_active = 0;
-
- printk(KERN_ERR "ACPI: Subsystem disabled\n");
-}
-
-module_init(acpi_init);
-module_exit(acpi_exit);
-
-#ifndef MODULE
-static int __init acpi_setup(char *str) {
- while (str && *str) {
- if (strncmp(str, "off", 3) == 0)
- acpi_disabled = 1;
- str = strchr(str, ',');
- if (str)
- str += strspn(str, ", \t");
- }
- return 1;
-}
-
-__setup("acpi=", acpi_setup);
-#endif
#
# Makefile for all Linux ACPI interpreter subdirectories
-# EXCEPT for the ospm directory
#
O_TARGET := $(notdir $(CURDIR)).o
-obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c))
+obj-$(CONFIG_ACPI_INTERPRETER) := $(patsubst %.c,%.o,$(wildcard *.c))
EXTRA_CFLAGS += $(ACPI_CFLAGS)
/******************************************************************************
*
- * Module Name: evevent - Fixed and General Purpose Acpi_event
- * handling and dispatch
- * $Revision: 51 $
+ * Module Name: evevent - Fixed and General Purpose Even handling and dispatch
+ * $Revision: 71 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acnamesp.h"
#define _COMPONENT ACPI_EVENTS
- MODULE_NAME ("evevent")
+ ACPI_MODULE_NAME ("evevent")
/*******************************************************************************
*
* RETURN: Status
*
- * DESCRIPTION: Ensures that the system control interrupt (SCI) is properly
- * configured, disables SCI event sources, installs the SCI
- * handler
+ * DESCRIPTION: Initialize global data structures for events.
*
******************************************************************************/
acpi_status status;
- FUNCTION_TRACE ("Ev_initialize");
+ ACPI_FUNCTION_TRACE ("Ev_initialize");
/* Make sure we have ACPI tables */
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
}
-
- /* Make sure the BIOS supports ACPI mode */
-
- if (SYS_MODE_LEGACY == acpi_hw_get_mode_capabilities()) {
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "ACPI Mode is not supported!\n"));
- return_ACPI_STATUS (AE_ERROR);
- }
-
-
- acpi_gbl_original_mode = acpi_hw_get_mode();
-
/*
* Initialize the Fixed and General Purpose Acpi_events prior. This is
* done prior to enabling SCIs to prevent interrupts from occuring
*/
status = acpi_ev_fixed_event_initialize ();
if (ACPI_FAILURE (status)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, "Unable to initialize fixed events.\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_FATAL,
+ "Unable to initialize fixed events, %s\n",
+ acpi_format_exception (status)));
return_ACPI_STATUS (status);
}
status = acpi_ev_gpe_initialize ();
if (ACPI_FAILURE (status)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, "Unable to initialize general purpose events.\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_FATAL,
+ "Unable to initialize general purpose events, %s\n",
+ acpi_format_exception (status)));
return_ACPI_STATUS (status);
}
+ return_ACPI_STATUS (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ev_handler_initialize
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Install handlers for the SCI, Global Lock, and GPEs.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ev_handler_initialize (
+ void)
+{
+ acpi_status status;
+
+
+ ACPI_FUNCTION_TRACE ("Ev_initialize");
+
+
/* Install the SCI handler */
status = acpi_ev_install_sci_handler ();
if (ACPI_FAILURE (status)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, "Unable to install System Control Interrupt Handler\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_FATAL,
+ "Unable to install System Control Interrupt Handler, %s\n",
+ acpi_format_exception (status)));
return_ACPI_STATUS (status);
}
-
/* Install handlers for control method GPE handlers (_Lxx, _Exx) */
status = acpi_ev_init_gpe_control_methods ();
if (ACPI_FAILURE (status)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, "Unable to initialize Gpe control methods\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_FATAL,
+ "Unable to initialize GPE control methods, %s\n",
+ acpi_format_exception (status)));
return_ACPI_STATUS (status);
}
status = acpi_ev_init_global_lock_handler ();
if (ACPI_FAILURE (status)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, "Unable to initialize Global Lock handler\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_FATAL,
+ "Unable to initialize Global Lock handler, %s\n",
+ acpi_format_exception (status)));
return_ACPI_STATUS (status);
}
-
return_ACPI_STATUS (status);
}
*
* RETURN: Status
*
- * DESCRIPTION: Initialize the Fixed Acpi_event data structures
+ * DESCRIPTION: Install the fixed event handlers and enable the fixed events.
*
******************************************************************************/
acpi_status
-acpi_ev_fixed_event_initialize(void)
+acpi_ev_fixed_event_initialize (
+ void)
{
- int i = 0;
+ NATIVE_UINT i;
- /* Initialize the structure that keeps track of fixed event handlers */
+ /*
+ * Initialize the structure that keeps track of fixed event handlers
+ * and enable the fixed events.
+ */
for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
acpi_gbl_fixed_event_handlers[i].handler = NULL;
acpi_gbl_fixed_event_handlers[i].context = NULL;
- }
- acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, TMR_EN, 0);
- acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, GBL_EN, 0);
- acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, PWRBTN_EN, 0);
- acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, SLPBTN_EN, 0);
- acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, RTC_EN, 0);
+ /* Enable the fixed event */
+
+ if (acpi_gbl_fixed_event_info[i].enable_register_id != 0xFF) {
+ acpi_hw_bit_register_write (acpi_gbl_fixed_event_info[i].enable_register_id,
+ 0, ACPI_MTX_LOCK);
+ }
+ }
return (AE_OK);
}
******************************************************************************/
u32
-acpi_ev_fixed_event_detect (void)
+acpi_ev_fixed_event_detect (
+ void)
{
- u32 int_status = INTERRUPT_NOT_HANDLED;
- u32 status_register;
- u32 enable_register;
+ u32 int_status = ACPI_INTERRUPT_NOT_HANDLED;
+ u32 gpe_status;
+ u32 gpe_enable;
+ NATIVE_UINT i;
- PROC_NAME ("Ev_fixed_event_detect");
+ ACPI_FUNCTION_NAME ("Ev_fixed_event_detect");
/*
* Read the fixed feature status and enable registers, as all the cases
* depend on their values.
*/
- status_register = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, PM1_STS);
- enable_register = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, PM1_EN);
+ gpe_status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS);
+ gpe_enable = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE);
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
"Fixed Acpi_event Block: Enable %08X Status %08X\n",
- enable_register, status_register));
-
-
- /* power management timer roll over */
-
- if ((status_register & ACPI_STATUS_PMTIMER) &&
- (enable_register & ACPI_ENABLE_PMTIMER)) {
- int_status |= acpi_ev_fixed_event_dispatch (ACPI_EVENT_PMTIMER);
- }
-
- /* global event (BIOS wants the global lock) */
-
- if ((status_register & ACPI_STATUS_GLOBAL) &&
- (enable_register & ACPI_ENABLE_GLOBAL)) {
- int_status |= acpi_ev_fixed_event_dispatch (ACPI_EVENT_GLOBAL);
- }
-
- /* power button event */
+ gpe_enable, gpe_status));
- if ((status_register & ACPI_STATUS_POWER_BUTTON) &&
- (enable_register & ACPI_ENABLE_POWER_BUTTON)) {
- int_status |= acpi_ev_fixed_event_dispatch (ACPI_EVENT_POWER_BUTTON);
- }
+ /*
+ * Check for all possible Fixed Events and dispatch those that are active
+ */
+ for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
+ /* Both the status and enable bits must be on for this event */
- /* sleep button event */
+ if ((gpe_status & acpi_gbl_fixed_event_info[i].status_bit_mask) &&
+ (gpe_enable & acpi_gbl_fixed_event_info[i].enable_bit_mask)) {
+ /* Found an active (signalled) event */
- if ((status_register & ACPI_STATUS_SLEEP_BUTTON) &&
- (enable_register & ACPI_ENABLE_SLEEP_BUTTON)) {
- int_status |= acpi_ev_fixed_event_dispatch (ACPI_EVENT_SLEEP_BUTTON);
+ int_status |= acpi_ev_fixed_event_dispatch (i);
+ }
}
return (int_status);
acpi_ev_fixed_event_dispatch (
u32 event)
{
- u32 register_id;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/* Clear the status bit */
- switch (event) {
- case ACPI_EVENT_PMTIMER:
- register_id = TMR_STS;
- break;
-
- case ACPI_EVENT_GLOBAL:
- register_id = GBL_STS;
- break;
-
- case ACPI_EVENT_POWER_BUTTON:
- register_id = PWRBTN_STS;
- break;
-
- case ACPI_EVENT_SLEEP_BUTTON:
- register_id = SLPBTN_STS;
- break;
-
- case ACPI_EVENT_RTC:
- register_id = RTC_STS;
- break;
-
- default:
- return 0;
- break;
- }
-
- acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_DO_NOT_LOCK, register_id, 1);
+ acpi_hw_bit_register_write (acpi_gbl_fixed_event_info[event].status_register_id,
+ 1, ACPI_MTX_DO_NOT_LOCK);
/*
* Make sure we've got a handler. If not, report an error.
* The event is disabled to prevent further interrupts.
*/
if (NULL == acpi_gbl_fixed_event_handlers[event].handler) {
- register_id = (PM1_EN | REGISTER_BIT_ID(register_id));
+ acpi_hw_bit_register_write (acpi_gbl_fixed_event_info[event].enable_register_id,
+ 0, ACPI_MTX_DO_NOT_LOCK);
- acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_DO_NOT_LOCK,
- register_id, 0);
-
- REPORT_ERROR (
+ ACPI_REPORT_ERROR (
("Ev_gpe_dispatch: No installed handler for fixed event [%08X]\n",
event));
- return (INTERRUPT_NOT_HANDLED);
+ return (ACPI_INTERRUPT_NOT_HANDLED);
}
- /* Invoke the handler */
+ /* Invoke the Fixed Event handler */
return ((acpi_gbl_fixed_event_handlers[event].handler)(
acpi_gbl_fixed_event_handlers[event].context));
acpi_status
acpi_ev_gpe_initialize (void)
{
- u32 i;
- u32 j;
- u32 register_index;
+ NATIVE_UINT i;
+ NATIVE_UINT j;
+ NATIVE_UINT gpe_block;
+ u32 gpe_register;
+ u32 gpe_number_index;
u32 gpe_number;
- u16 gpe0register_count;
- u16 gpe1_register_count;
+ ACPI_GPE_REGISTER_INFO *gpe_register_info;
+
+ ACPI_FUNCTION_TRACE ("Ev_gpe_initialize");
- FUNCTION_TRACE ("Ev_gpe_initialize");
/*
- * Set up various GPE counts
+ * Initialize the GPE Block globals
*
- * You may ask,why are the GPE register block lengths divided by 2?
- * From the ACPI 2.0 Spec, section, 4.7.1.6 General-Purpose Event
- * Registers, we have,
+ * Why the GPE register block lengths divided by 2: From the ACPI Spec,
+ * section "General-Purpose Event Registers", we have:
*
* "Each register block contains two registers of equal length
- * GPEx_STS and GPEx_EN (where x is 0 or 1). The length of the
- * GPE0_STS and GPE0_EN registers is equal to half the GPE0_LEN
- * The length of the GPE1_STS and GPE1_EN registers is equal to
- * half the GPE1_LEN. If a generic register block is not supported
- * then its respective block pointer and block length values in the
- * FADT table contain zeros. The GPE0_LEN and GPE1_LEN do not need
- * to be the same size."
+ * GPEx_STS and GPEx_EN (where x is 0 or 1). The length of the
+ * GPE0_STS and GPE0_EN registers is equal to half the GPE0_LEN
+ * The length of the GPE1_STS and GPE1_EN registers is equal to
+ * half the GPE1_LEN. If a generic register block is not supported
+ * then its respective block pointer and block length values in the
+ * FADT table contain zeros. The GPE0_LEN and GPE1_LEN do not need
+ * to be the same size."
*/
- gpe0register_count = (u16) DIV_2 (acpi_gbl_FADT->gpe0blk_len);
- gpe1_register_count = (u16) DIV_2 (acpi_gbl_FADT->gpe1_blk_len);
- acpi_gbl_gpe_register_count = gpe0register_count + gpe1_register_count;
+ acpi_gbl_gpe_block_info[0].register_count = (u16) ACPI_DIV_2 (acpi_gbl_FADT->gpe0_blk_len);
+ acpi_gbl_gpe_block_info[1].register_count = (u16) ACPI_DIV_2 (acpi_gbl_FADT->gpe1_blk_len);
+
+ acpi_gbl_gpe_block_info[0].block_address = (u16) ACPI_GET_ADDRESS (acpi_gbl_FADT->Xgpe0_blk.address);
+ acpi_gbl_gpe_block_info[1].block_address = (u16) ACPI_GET_ADDRESS (acpi_gbl_FADT->Xgpe1_blk.address);
+ acpi_gbl_gpe_block_info[0].block_base_number = 0;
+ acpi_gbl_gpe_block_info[1].block_base_number = acpi_gbl_FADT->gpe1_base;
+
+ acpi_gbl_gpe_register_count = acpi_gbl_gpe_block_info[0].register_count +
+ acpi_gbl_gpe_block_info[1].register_count;
if (!acpi_gbl_gpe_register_count) {
- REPORT_WARNING (("Zero GPEs are defined in the FADT\n"));
+ ACPI_REPORT_WARNING (("Zero GPEs are defined in the FADT\n"));
return_ACPI_STATUS (AE_OK);
}
+ /* Determine the maximum GPE number for this machine */
+
+ acpi_gbl_gpe_number_max = ACPI_MUL_8 (acpi_gbl_gpe_block_info[0].register_count) - 1;
+
+ if (acpi_gbl_gpe_block_info[1].register_count) {
+ /* Check for GPE0/GPE1 overlap */
+
+ if (acpi_gbl_gpe_number_max >= acpi_gbl_FADT->gpe1_base) {
+ ACPI_REPORT_ERROR (("GPE0 block overlaps the GPE1 block\n"));
+ return_ACPI_STATUS (AE_BAD_VALUE);
+ }
+
+ /* GPE0 and GPE1 do not have to be contiguous in the GPE number space */
+
+ acpi_gbl_gpe_number_max = acpi_gbl_FADT->gpe1_base + (ACPI_MUL_8 (acpi_gbl_gpe_block_info[1].register_count) - 1);
+ }
+
+ /* Check for Max GPE number out-of-range */
+
+ if (acpi_gbl_gpe_number_max > ACPI_GPE_MAX) {
+ ACPI_REPORT_ERROR (("Maximum GPE number from FADT is too large: 0x%X\n", acpi_gbl_gpe_number_max));
+ return_ACPI_STATUS (AE_BAD_VALUE);
+ }
+
/*
- * Allocate the Gpe information block
+ * Allocate the GPE number-to-index translation table
*/
- acpi_gbl_gpe_registers = ACPI_MEM_CALLOCATE (acpi_gbl_gpe_register_count *
- sizeof (acpi_gpe_registers));
- if (!acpi_gbl_gpe_registers) {
+ acpi_gbl_gpe_number_to_index = ACPI_MEM_CALLOCATE (sizeof (ACPI_GPE_INDEX_INFO) *
+ (acpi_gbl_gpe_number_max + 1));
+ if (!acpi_gbl_gpe_number_to_index) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not allocate the Gpe_registers block\n"));
+ "Could not allocate the Gpe_number_to_index table\n"));
return_ACPI_STATUS (AE_NO_MEMORY);
}
+ /* Set the Gpe index table to GPE_INVALID */
+
+ ACPI_MEMSET (acpi_gbl_gpe_number_to_index, (int) ACPI_GPE_INVALID,
+ sizeof (ACPI_GPE_INDEX_INFO) * (acpi_gbl_gpe_number_max + 1));
+
/*
- * Allocate the Gpe dispatch handler block
- * There are eight distinct GP events per register.
- * Initialization to zeros is sufficient
+ * Allocate the GPE register information block
*/
- acpi_gbl_gpe_info = ACPI_MEM_CALLOCATE (MUL_8 (acpi_gbl_gpe_register_count) *
- sizeof (acpi_gpe_level_info));
- if (!acpi_gbl_gpe_info) {
- ACPI_MEM_FREE (acpi_gbl_gpe_registers);
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not allocate the Gpe_info block\n"));
- return_ACPI_STATUS (AE_NO_MEMORY);
+ acpi_gbl_gpe_register_info = ACPI_MEM_CALLOCATE (acpi_gbl_gpe_register_count *
+ sizeof (ACPI_GPE_REGISTER_INFO));
+ if (!acpi_gbl_gpe_register_info) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Could not allocate the Gpe_register_info table\n"));
+ goto error_exit1;
}
- /* Set the Gpe validation table to GPE_INVALID */
-
- MEMSET (acpi_gbl_gpe_valid, (int) ACPI_GPE_INVALID, ACPI_NUM_GPE);
+ /*
+ * Allocate the GPE dispatch handler block. There are eight distinct GPEs
+ * per register. Initialization to zeros is sufficient.
+ */
+ acpi_gbl_gpe_number_info = ACPI_MEM_CALLOCATE (ACPI_MUL_8 (acpi_gbl_gpe_register_count) *
+ sizeof (ACPI_GPE_NUMBER_INFO));
+ if (!acpi_gbl_gpe_number_info) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not allocate the Gpe_number_info table\n"));
+ goto error_exit2;
+ }
/*
- * Initialize the Gpe information and validation blocks. A goal of these
- * blocks is to hide the fact that there are two separate GPE register sets
- * In a given block, the status registers occupy the first half, and
- * the enable registers occupy the second half.
+ * Initialize the GPE information and validation tables. A goal of these
+ * 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,
+ * and the enable registers occupy the second half. Another goal is to hide
+ * the fact that there may be multiple GPE hardware blocks.
*/
+ gpe_register = 0;
+ gpe_number_index = 0;
- /* GPE Block 0 */
+ for (gpe_block = 0; gpe_block < ACPI_MAX_GPE_BLOCKS; gpe_block++) {
+ for (i = 0; i < acpi_gbl_gpe_block_info[gpe_block].register_count; i++) {
+ gpe_register_info = &acpi_gbl_gpe_register_info[gpe_register];
- register_index = 0;
+ /* Init the Register info for this entire GPE register (8 GPEs) */
- for (i = 0; i < gpe0register_count; i++) {
- acpi_gbl_gpe_registers[register_index].status_addr =
- (u16) (ACPI_GET_ADDRESS (acpi_gbl_FADT->Xgpe0blk.address) + i);
+ gpe_register_info->base_gpe_number = (u8) (acpi_gbl_gpe_block_info[gpe_block].block_base_number + (ACPI_MUL_8 (i)));
+ gpe_register_info->status_addr = (u16) (acpi_gbl_gpe_block_info[gpe_block].block_address + i);
+ gpe_register_info->enable_addr = (u16) (acpi_gbl_gpe_block_info[gpe_block].block_address + i +
+ acpi_gbl_gpe_block_info[gpe_block].register_count);
- acpi_gbl_gpe_registers[register_index].enable_addr =
- (u16) (ACPI_GET_ADDRESS (acpi_gbl_FADT->Xgpe0blk.address) + i + gpe0register_count);
+ /* Init the Index mapping info for each GPE number within this register */
- acpi_gbl_gpe_registers[register_index].gpe_base = (u8) MUL_8 (i);
+ for (j = 0; j < 8; j++) {
+ gpe_number = gpe_register_info->base_gpe_number + j;
+ acpi_gbl_gpe_number_to_index[gpe_number].number_index = (u8) gpe_number_index;
- for (j = 0; j < 8; j++) {
- gpe_number = acpi_gbl_gpe_registers[register_index].gpe_base + j;
- acpi_gbl_gpe_valid[gpe_number] = (u8) register_index;
- }
+ acpi_gbl_gpe_number_info[gpe_number_index].bit_mask = acpi_gbl_decode_to8bit[j];
+ gpe_number_index++;
+ }
- /*
- * Clear the status/enable registers. Note that status registers
- * are cleared by writing a '1', while enable registers are cleared
- * by writing a '0'.
- */
- acpi_os_write_port (acpi_gbl_gpe_registers[register_index].enable_addr, 0x00, 8);
- acpi_os_write_port (acpi_gbl_gpe_registers[register_index].status_addr, 0xFF, 8);
+ /*
+ * Clear the status/enable registers. Note that status registers
+ * are cleared by writing a '1', while enable registers are cleared
+ * by writing a '0'.
+ */
+ acpi_os_write_port (gpe_register_info->enable_addr, 0x00, 8);
+ acpi_os_write_port (gpe_register_info->status_addr, 0xFF, 8);
- register_index++;
+ gpe_register++;
+ }
}
- /* GPE Block 1 */
-
- for (i = 0; i < gpe1_register_count; i++) {
- acpi_gbl_gpe_registers[register_index].status_addr =
- (u16) (ACPI_GET_ADDRESS (acpi_gbl_FADT->Xgpe1_blk.address) + i);
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "GPE registers: %X@%8.8X%8.8X (Blk0) %X@%8.8X%8.8X (Blk1)\n",
+ acpi_gbl_gpe_block_info[0].register_count,
+ ACPI_HIDWORD (acpi_gbl_FADT->Xgpe0_blk.address), ACPI_LODWORD (acpi_gbl_FADT->Xgpe0_blk.address),
+ acpi_gbl_gpe_block_info[1].register_count,
+ ACPI_HIDWORD (acpi_gbl_FADT->Xgpe1_blk.address), ACPI_LODWORD (acpi_gbl_FADT->Xgpe1_blk.address)));
- acpi_gbl_gpe_registers[register_index].enable_addr =
- (u16) (ACPI_GET_ADDRESS (acpi_gbl_FADT->Xgpe1_blk.address) + i + gpe1_register_count);
+ return_ACPI_STATUS (AE_OK);
- acpi_gbl_gpe_registers[register_index].gpe_base =
- (u8) (acpi_gbl_FADT->gpe1_base + MUL_8 (i));
- for (j = 0; j < 8; j++) {
- gpe_number = acpi_gbl_gpe_registers[register_index].gpe_base + j;
- acpi_gbl_gpe_valid[gpe_number] = (u8) register_index;
- }
+ /* Error cleanup */
- /*
- * Clear the status/enable registers. Note that status registers
- * are cleared by writing a '1', while enable registers are cleared
- * by writing a '0'.
- */
- acpi_os_write_port (acpi_gbl_gpe_registers[register_index].enable_addr, 0x00, 8);
- acpi_os_write_port (acpi_gbl_gpe_registers[register_index].status_addr, 0xFF, 8);
+error_exit2:
+ ACPI_MEM_FREE (acpi_gbl_gpe_register_info);
- register_index++;
- }
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "GPE registers: %X@%8.8X%8.8X (Blk0) %X@%8.8X%8.8X (Blk1)\n",
- gpe0register_count, HIDWORD(acpi_gbl_FADT->Xgpe0blk.address), LODWORD(acpi_gbl_FADT->Xgpe0blk.address),
- gpe1_register_count, HIDWORD(acpi_gbl_FADT->Xgpe1_blk.address), LODWORD(acpi_gbl_FADT->Xgpe1_blk.address)));
-
- return_ACPI_STATUS (AE_OK);
+error_exit1:
+ ACPI_MEM_FREE (acpi_gbl_gpe_number_to_index);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
* Where:
* L - means that the GPE is level triggered
* E - means that the GPE is edge triggered
- * nn - is the GPE number
+ * nn - is the GPE number [in HEX]
*
******************************************************************************/
void **return_value)
{
u32 gpe_number;
+ u32 gpe_number_index;
NATIVE_CHAR name[ACPI_NAME_SIZE + 1];
u8 type;
- PROC_NAME ("Ev_save_method_info");
+ ACPI_FUNCTION_NAME ("Ev_save_method_info");
/* Extract the name from the object and convert to a string */
- MOVE_UNALIGNED32_TO_32 (name, &((acpi_namespace_node *) obj_handle)->name);
+ ACPI_MOVE_UNALIGNED32_TO_32 (name,
+ &((acpi_namespace_node *) obj_handle)->name);
name[ACPI_NAME_SIZE] = 0;
/*
- * Edge/Level determination is based on the 2nd s8 of the method name
+ * Edge/Level determination is based on the 2nd character of the method name
*/
- if (name[1] == 'L') {
+ switch (name[1]) {
+ case 'L':
type = ACPI_EVENT_LEVEL_TRIGGERED;
- }
- else if (name[1] == 'E') {
+ break;
+
+ case 'E':
type = ACPI_EVENT_EDGE_TRIGGERED;
- }
- else {
+ break;
+
+ default:
/* Unknown method type, just ignore it! */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
return (AE_OK);
}
- /* Convert the last two characters of the name to the Gpe Number */
+ /* Convert the last two characters of the name to the GPE Number */
- gpe_number = STRTOUL (&name[2], NULL, 16);
+ gpe_number = ACPI_STRTOUL (&name[2], NULL, 16);
if (gpe_number == ACPI_UINT32_MAX) {
/* Conversion failed; invalid method, just ignore it */
return (AE_OK);
}
- /* Ensure that we have a valid GPE number */
+ /* Get GPE index and ensure that we have a valid GPE number */
- if (acpi_gbl_gpe_valid[gpe_number] == ACPI_GPE_INVALID) {
+ gpe_number_index = acpi_ev_get_gpe_number_index (gpe_number);
+ if (gpe_number_index == ACPI_GPE_INVALID) {
/* Not valid, all we can do here is ignore it */
return (AE_OK);
* Now we can add this information to the Gpe_info block
* for use during dispatch of this GPE.
*/
- acpi_gbl_gpe_info [gpe_number].type = type;
- acpi_gbl_gpe_info [gpe_number].method_handle = obj_handle;
-
+ acpi_gbl_gpe_number_info [gpe_number_index].type = type;
+ acpi_gbl_gpe_number_info [gpe_number_index].method_handle = obj_handle;
/*
* Enable the GPE (SCIs should be disabled at this point)
*
* PARAMETERS: None
*
- * RETURN: None
+ * RETURN: Status
*
* DESCRIPTION: Obtain the control methods associated with the GPEs.
- *
* NOTE: Must be called AFTER namespace initialization!
*
******************************************************************************/
acpi_status status;
- FUNCTION_TRACE ("Ev_init_gpe_control_methods");
+ ACPI_FUNCTION_TRACE ("Ev_init_gpe_control_methods");
/* Get a permanent handle to the _GPE object */
*
* RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
*
- * DESCRIPTION: Detect if any GP events have occurred
+ * DESCRIPTION: Detect if any GP events have occurred. This function is
+ * executed at interrupt level.
*
******************************************************************************/
u32
acpi_ev_gpe_detect (void)
{
- u32 int_status = INTERRUPT_NOT_HANDLED;
+ u32 int_status = ACPI_INTERRUPT_NOT_HANDLED;
u32 i;
u32 j;
u8 enabled_status_byte;
u8 bit_mask;
+ ACPI_GPE_REGISTER_INFO *gpe_register_info;
- PROC_NAME ("Ev_gpe_detect");
+ ACPI_FUNCTION_NAME ("Ev_gpe_detect");
/*
* Find all currently active GP events.
*/
for (i = 0; i < acpi_gbl_gpe_register_count; i++) {
- acpi_os_read_port (acpi_gbl_gpe_registers[i].status_addr,
- &acpi_gbl_gpe_registers[i].status, 8);
+ gpe_register_info = &acpi_gbl_gpe_register_info[i];
+
+ acpi_os_read_port (gpe_register_info->status_addr,
+ &gpe_register_info->status, 8);
- acpi_os_read_port (acpi_gbl_gpe_registers[i].enable_addr,
- &acpi_gbl_gpe_registers[i].enable, 8);
+ acpi_os_read_port (gpe_register_info->enable_addr,
+ &gpe_register_info->enable, 8);
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
"GPE block at %X - Enable %08X Status %08X\n",
- acpi_gbl_gpe_registers[i].enable_addr,
- acpi_gbl_gpe_registers[i].status,
- acpi_gbl_gpe_registers[i].enable));
+ gpe_register_info->enable_addr,
+ gpe_register_info->status,
+ gpe_register_info->enable));
/* First check if there is anything active at all in this register */
- enabled_status_byte = (u8) (acpi_gbl_gpe_registers[i].status &
- acpi_gbl_gpe_registers[i].enable);
-
+ enabled_status_byte = (u8) (gpe_register_info->status &
+ gpe_register_info->enable);
if (!enabled_status_byte) {
/* No active GPEs in this register, move on */
* or method.
*/
int_status |= acpi_ev_gpe_dispatch (
- acpi_gbl_gpe_registers[i].gpe_base + j);
+ gpe_register_info->base_gpe_number + j);
}
}
}
*
* FUNCTION: Acpi_ev_asynch_execute_gpe_method
*
- * PARAMETERS: Gpe_number - The 0-based Gpe number
+ * PARAMETERS: Gpe_number - The 0-based GPE number
*
* RETURN: None
*
*
******************************************************************************/
-static void
+static void ACPI_SYSTEM_XFACE
acpi_ev_asynch_execute_gpe_method (
void *context)
{
- u32 gpe_number = (u32) context;
- acpi_gpe_level_info gpe_info;
+ u32 gpe_number = (u32) ACPI_TO_INTEGER (context);
+ u32 gpe_number_index;
+ ACPI_GPE_NUMBER_INFO gpe_info;
- FUNCTION_TRACE ("Ev_asynch_execute_gpe_method");
+ ACPI_FUNCTION_TRACE ("Ev_asynch_execute_gpe_method");
- /*
- * Take a snapshot of the GPE info for this level
- */
- acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
- gpe_info = acpi_gbl_gpe_info [gpe_number];
- acpi_ut_release_mutex (ACPI_MTX_EVENTS);
+
+ gpe_number_index = acpi_ev_get_gpe_number_index (gpe_number);
+ if (gpe_number_index == ACPI_GPE_INVALID) {
+ return_VOID;
+ }
/*
- * Method Handler (_Lxx, _Exx):
- * ----------------------------
- * Evaluate the _Lxx/_Exx control method that corresponds to this GPE.
+ * Take a snapshot of the GPE info for this level - we copy the
+ * info to prevent a race condition with Remove_handler.
*/
+ if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_EVENTS))) {
+ return_VOID;
+ }
+
+ gpe_info = acpi_gbl_gpe_number_info [gpe_number_index];
+ if (ACPI_FAILURE (acpi_ut_release_mutex (ACPI_MTX_EVENTS))) {
+ return_VOID;
+ }
+
if (gpe_info.method_handle) {
+ /*
+ * Invoke the GPE Method (_Lxx, _Exx):
+ * (Evaluate the _Lxx/_Exx control method that corresponds to this GPE.)
+ */
acpi_ns_evaluate_by_handle (gpe_info.method_handle, NULL, NULL);
}
- /*
- * Level-Triggered?
- * ----------------
- * If level-triggered we clear the GPE status bit after handling the event.
- */
if (gpe_info.type & ACPI_EVENT_LEVEL_TRIGGERED) {
+ /*
+ * GPE is level-triggered, we clear the GPE status bit after handling
+ * the event.
+ */
acpi_hw_clear_gpe (gpe_number);
}
* Enable the GPE.
*/
acpi_hw_enable_gpe (gpe_number);
-
return_VOID;
}
*
* FUNCTION: Acpi_ev_gpe_dispatch
*
- * PARAMETERS: Gpe_number - The 0-based Gpe number
+ * PARAMETERS: Gpe_number - The 0-based GPE number
*
* RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
*
- * DESCRIPTION: Handle and dispatch a General Purpose Acpi_event.
- * Clears the status bit for the requested event.
- *
- * TBD: [Investigate] is this still valid or necessary:
- * The Gpe handler differs from the fixed events in that it clears the enable
- * bit rather than the status bit to clear the interrupt. This allows
- * software outside of interrupt context to determine what caused the SCI and
- * dispatch the correct AML.
+ * DESCRIPTION: Dispatch a General Purpose Event to either a function (e.g. EC)
+ * or method (e.g. _Lxx/_Exx) handler. This function executes
+ * at interrupt level.
*
******************************************************************************/
acpi_ev_gpe_dispatch (
u32 gpe_number)
{
- acpi_gpe_level_info gpe_info;
+ u32 gpe_number_index;
+ ACPI_GPE_NUMBER_INFO *gpe_info;
- FUNCTION_TRACE ("Ev_gpe_dispatch");
+ ACPI_FUNCTION_TRACE ("Ev_gpe_dispatch");
- /*
- * Valid GPE number?
- */
- if (acpi_gbl_gpe_valid[gpe_number] == ACPI_GPE_INVALID) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid GPE bit [%X].\n", gpe_number));
- return_VALUE (INTERRUPT_NOT_HANDLED);
+ gpe_number_index = acpi_ev_get_gpe_number_index (gpe_number);
+ if (gpe_number_index == ACPI_GPE_INVALID) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid event, GPE[%X].\n", gpe_number));
+ return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
}
/*
- * Disable the GPE.
+ * We don't have to worry about mutex on Gpe_info because we are
+ * executing at interrupt level.
*/
- acpi_hw_disable_gpe (gpe_number);
-
- gpe_info = acpi_gbl_gpe_info [gpe_number];
+ gpe_info = &acpi_gbl_gpe_number_info [gpe_number_index];
/*
- * Edge-Triggered?
- * ---------------
* If edge-triggered, clear the GPE status bit now. Note that
* level-triggered events are cleared after the GPE is serviced.
*/
- if (gpe_info.type & ACPI_EVENT_EDGE_TRIGGERED) {
+ if (gpe_info->type & ACPI_EVENT_EDGE_TRIGGERED) {
acpi_hw_clear_gpe (gpe_number);
}
- /*
- * Function Handler (e.g. EC)?
- */
- if (gpe_info.handler) {
- /* Invoke function handler (at interrupt level). */
-
- gpe_info.handler (gpe_info.context);
- /* Level-Triggered? */
-
- if (gpe_info.type & ACPI_EVENT_LEVEL_TRIGGERED) {
- acpi_hw_clear_gpe (gpe_number);
- }
-
- /* Enable GPE */
+ /*
+ * Dispatch the GPE to either an installed handler, or the control
+ * method associated with this GPE (_Lxx or _Exx).
+ * If a handler exists, we invoke it and do not attempt to run the method.
+ * If there is neither a handler nor a method, we disable the level to
+ * prevent further events from coming in here.
+ */
+ if (gpe_info->handler) {
+ /* Invoke the installed handler (at interrupt level) */
- acpi_hw_enable_gpe (gpe_number);
+ gpe_info->handler (gpe_info->context);
}
+ else if (gpe_info->method_handle) {
+ /*
+ * Execute the method associated with the GPE.
+ */
+ if (ACPI_FAILURE (acpi_os_queue_for_execution (OSD_PRIORITY_GPE,
+ acpi_ev_asynch_execute_gpe_method,
+ ACPI_TO_POINTER (gpe_number)))) {
+ ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to queue handler for GPE[%X], disabling event\n", gpe_number));
- /*
- * Method Handler (e.g. _Exx/_Lxx)?
- */
- else if (gpe_info.method_handle) {
- if (ACPI_FAILURE(acpi_os_queue_for_execution (OSD_PRIORITY_GPE,
- acpi_ev_asynch_execute_gpe_method, (void*) gpe_number))) {
/*
- * Shoudn't occur, but if it does report an error. Note that
- * the GPE will remain disabled until the ACPI Core Subsystem
- * is restarted, or the handler is removed/reinstalled.
+ * Disable the GPE on error. The GPE will remain disabled until the ACPI
+ * Core Subsystem is restarted, or the handler is reinstalled.
*/
- REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to queue handler for GPE bit [%X]\n", gpe_number));
+ acpi_hw_disable_gpe (gpe_number);
}
}
-
- /*
- * No Handler? Report an error and leave the GPE disabled.
- */
else {
- REPORT_ERROR (("Acpi_ev_gpe_dispatch: No installed handler for GPE [%X]\n", gpe_number));
+ /* No handler or method to run! */
- /* Level-Triggered? */
+ ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: No handler or method for GPE[%X], disabling event\n", gpe_number));
- if (gpe_info.type & ACPI_EVENT_LEVEL_TRIGGERED) {
- acpi_hw_clear_gpe (gpe_number);
- }
+ /*
+ * Disable the GPE. The GPE will remain disabled until the ACPI
+ * Core Subsystem is restarted, or the handler is reinstalled.
+ */
+ acpi_hw_disable_gpe (gpe_number);
+ }
+
+ /*
+ * It is now safe to clear level-triggered evnets.
+ */
+ if (gpe_info->type & ACPI_EVENT_LEVEL_TRIGGERED) {
+ acpi_hw_clear_gpe (gpe_number);
}
- return_VALUE (INTERRUPT_HANDLED);
+ return_VALUE (ACPI_INTERRUPT_HANDLED);
}
*
* Module Name: evmisc - ACPI device notification handler dispatch
* and ACPI Global Lock support
- * $Revision: 35 $
+ * $Revision: 47 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "achware.h"
#define _COMPONENT ACPI_EVENTS
- MODULE_NAME ("evmisc")
+ ACPI_MODULE_NAME ("evmisc")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ev_get_gpe_register_index
+ *
+ * PARAMETERS: Gpe_number - Raw GPE number
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Returns the register index (index into the GPE register info
+ * table) associated with this GPE.
+ *
+ ******************************************************************************/
+
+u32
+acpi_ev_get_gpe_register_index (
+ u32 gpe_number)
+{
+
+ if (gpe_number > acpi_gbl_gpe_number_max) {
+ return (ACPI_GPE_INVALID);
+ }
+
+ return (ACPI_DIV_8 (acpi_gbl_gpe_number_to_index[gpe_number].number_index));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ev_get_gpe_number_index
+ *
+ * PARAMETERS: Gpe_number - Raw GPE number
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Returns the number index (index into the GPE number info table)
+ * associated with this GPE.
+ *
+ ******************************************************************************/
+
+u32
+acpi_ev_get_gpe_number_index (
+ u32 gpe_number)
+{
+
+ if (gpe_number > acpi_gbl_gpe_number_max) {
+ return (ACPI_GPE_INVALID);
+ }
+
+ return (acpi_gbl_gpe_number_to_index[gpe_number].number_index);
+}
/*******************************************************************************
acpi_status status = AE_OK;
- PROC_NAME ("Ev_queue_notify_request");
+ ACPI_FUNCTION_NAME ("Ev_queue_notify_request");
/*
break;
}
-
/*
* Get the notify object attached to the device Node
*/
obj_desc = acpi_ns_get_attached_object (node);
if (obj_desc) {
-
/* We have the notify object, Get the right handler */
switch (node->type) {
case ACPI_TYPE_DEVICE:
- if (notify_value <= MAX_SYS_NOTIFY) {
+
+ if (notify_value <= ACPI_MAX_SYS_NOTIFY) {
handler_obj = obj_desc->device.sys_handler;
}
else {
}
break;
+
case ACPI_TYPE_THERMAL:
- if (notify_value <= MAX_SYS_NOTIFY) {
+
+ if (notify_value <= ACPI_MAX_SYS_NOTIFY) {
handler_obj = obj_desc->thermal_zone.sys_handler;
}
else {
}
}
-
/* If there is any handler to run, schedule the dispatcher */
- if ((acpi_gbl_sys_notify.handler && (notify_value <= MAX_SYS_NOTIFY)) ||
- (acpi_gbl_drv_notify.handler && (notify_value > MAX_SYS_NOTIFY)) ||
+ if ((acpi_gbl_sys_notify.handler && (notify_value <= ACPI_MAX_SYS_NOTIFY)) ||
+ (acpi_gbl_drv_notify.handler && (notify_value > ACPI_MAX_SYS_NOTIFY)) ||
handler_obj) {
-
notify_info = acpi_ut_create_generic_state ();
if (!notify_info) {
return (AE_NO_MEMORY);
*
******************************************************************************/
-void
+void ACPI_SYSTEM_XFACE
acpi_ev_notify_dispatch (
void *context)
{
acpi_operand_object *handler_obj;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/*
* We will invoke a global notify handler if installed.
* This is done _before_ we invoke the per-device handler attached to the device.
*/
- if (notify_info->notify.value <= MAX_SYS_NOTIFY) {
+ if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) {
/* Global system notification handler */
if (acpi_gbl_sys_notify.handler) {
global_context = acpi_gbl_sys_notify.context;
}
}
-
else {
/* Global driver notification handler */
}
}
-
/* Invoke the system handler first, if present */
if (global_handler) {
*
******************************************************************************/
-static void
+static void ACPI_SYSTEM_XFACE
acpi_ev_global_lock_thread (
void *context)
{
void *context)
{
u8 acquired = FALSE;
- void *global_lock;
/*
* If we don't get it now, it will be marked pending and we will
* take another interrupt when it becomes free.
*/
- global_lock = acpi_gbl_FACS->global_lock;
- ACPI_ACQUIRE_GLOBAL_LOCK (global_lock, acquired);
+ ACPI_ACQUIRE_GLOBAL_LOCK (acpi_gbl_common_fACS.global_lock, acquired);
if (acquired) {
/* Got the lock, now wake all threads waiting for it */
context);
}
- return (INTERRUPT_HANDLED);
+ return (ACPI_INTERRUPT_HANDLED);
}
acpi_status status;
- FUNCTION_TRACE ("Ev_init_global_lock_handler");
+ ACPI_FUNCTION_TRACE ("Ev_init_global_lock_handler");
acpi_gbl_global_lock_present = TRUE;
/*
* If the global lock does not exist on this platform, the attempt
- * to enable GBL_STS will fail (the GBL_EN bit will not stick)
+ * to enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick)
* Map to AE_OK, but mark global lock as not present.
* Any attempt to actually use the global lock will be flagged
* with an error.
*****************************************************************************/
acpi_status
-acpi_ev_acquire_global_lock(void)
+acpi_ev_acquire_global_lock (
+ u32 timeout)
{
acpi_status status = AE_OK;
u8 acquired = FALSE;
- void *global_lock;
- FUNCTION_TRACE ("Ev_acquire_global_lock");
+ ACPI_FUNCTION_TRACE ("Ev_acquire_global_lock");
+
/* Make sure that we actually have a global lock */
acpi_gbl_global_lock_thread_count++;
-
- /* If we (OS side) have the hardware lock already, we are done */
+ /* If we (OS side vs. BIOS side) have the hardware lock already, we are done */
if (acpi_gbl_global_lock_acquired) {
return_ACPI_STATUS (AE_OK);
}
- /* Only if the FACS is valid */
-
- if (!acpi_gbl_FACS) {
- return_ACPI_STATUS (AE_OK);
- }
-
-
/* We must acquire the actual hardware lock */
- global_lock = acpi_gbl_FACS->global_lock;
- ACPI_ACQUIRE_GLOBAL_LOCK (global_lock, acquired);
+ ACPI_ACQUIRE_GLOBAL_LOCK (acpi_gbl_common_fACS.global_lock, acquired);
if (acquired) {
/* We got the lock */
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Acquired the Global Lock\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Acquired the HW Global Lock\n"));
acpi_gbl_global_lock_acquired = TRUE;
return_ACPI_STATUS (AE_OK);
}
-
/*
* Did not get the lock. The pending bit was set above, and we must now
* wait until we get the global lock released interrupt.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Waiting for the HW Global Lock\n"));
- /*
- * Acquire the global lock semaphore first.
- * Since this wait will block, we must release the interpreter
- */
+ /*
+ * Acquire the global lock semaphore first.
+ * Since this wait will block, we must release the interpreter
+ */
status = acpi_ex_system_wait_semaphore (acpi_gbl_global_lock_semaphore,
- ACPI_UINT32_MAX);
+ timeout);
return_ACPI_STATUS (status);
}
acpi_ev_release_global_lock (void)
{
u8 pending = FALSE;
- void *global_lock;
- FUNCTION_TRACE ("Ev_release_global_lock");
+ ACPI_FUNCTION_TRACE ("Ev_release_global_lock");
if (!acpi_gbl_global_lock_thread_count) {
- REPORT_WARNING(("Global Lock has not be acquired, cannot release\n"));
+ ACPI_REPORT_WARNING(("Cannot release HW Global Lock, it has not been acquired\n"));
return_VOID;
}
- /* One fewer thread has the global lock */
+ /* One fewer thread has the global lock */
acpi_gbl_global_lock_thread_count--;
+ if (acpi_gbl_global_lock_thread_count) {
+ /* There are still some threads holding the lock, cannot release */
+
+ return_VOID;
+ }
- /* Have all threads released the lock? */
+ /*
+ * No more threads holding lock, we can do the actual hardware
+ * release
+ */
+ ACPI_RELEASE_GLOBAL_LOCK (acpi_gbl_common_fACS.global_lock, pending);
+ acpi_gbl_global_lock_acquired = FALSE;
- if (!acpi_gbl_global_lock_thread_count) {
- /*
- * No more threads holding lock, we can do the actual hardware
- * release
- */
- global_lock = acpi_gbl_FACS->global_lock;
- ACPI_RELEASE_GLOBAL_LOCK (global_lock, pending);
- acpi_gbl_global_lock_acquired = FALSE;
-
- /*
- * If the pending bit was set, we must write GBL_RLS to the control
- * register
- */
- if (pending) {
- acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK,
- GBL_RLS, 1);
- }
+ /*
+ * If the pending bit was set, we must write GBL_RLS to the control
+ * register
+ */
+ if (pending) {
+ acpi_hw_bit_register_write (ACPI_BITREG_GLOBAL_LOCK_RELEASE, 1, ACPI_MTX_LOCK);
+ }
+
+ return_VOID;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: Acpi_ev_terminate
+ *
+ * PARAMETERS: none
+ *
+ * RETURN: none
+ *
+ * DESCRIPTION: free memory allocated for table storage.
+ *
+ ******************************************************************************/
+
+void
+acpi_ev_terminate (void)
+{
+
+ ACPI_FUNCTION_TRACE ("Ev_terminate");
+
+
+ /*
+ * Free global tables, etc.
+ */
+ if (acpi_gbl_gpe_register_info) {
+ ACPI_MEM_FREE (acpi_gbl_gpe_register_info);
+ acpi_gbl_gpe_register_info = NULL;
+ }
+
+ if (acpi_gbl_gpe_number_info) {
+ ACPI_MEM_FREE (acpi_gbl_gpe_number_info);
+ acpi_gbl_gpe_number_info = NULL;
+ }
+
+ if (acpi_gbl_gpe_number_to_index) {
+ ACPI_MEM_FREE (acpi_gbl_gpe_number_to_index);
+ acpi_gbl_gpe_number_to_index = NULL;
}
return_VOID;
}
+
/******************************************************************************
*
* Module Name: evregion - ACPI Address_space (Op_region) handler dispatch
- * $Revision: 113 $
+ * $Revision: 128 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "amlcode.h"
#define _COMPONENT ACPI_EVENTS
- MODULE_NAME ("evregion")
+ ACPI_MODULE_NAME ("evregion")
/*******************************************************************************
acpi_status status;
- FUNCTION_TRACE ("Ev_install_default_address_space_handlers");
+ ACPI_FUNCTION_TRACE ("Ev_install_default_address_space_handlers");
/*
* space must be always available -- even though we are nowhere
* near ready to find the PCI root buses at this point.
*
- * NOTE: We ignore AE_EXIST because this means that a handler has
- * already been installed (via Acpi_install_address_space_handler)
+ * NOTE: We ignore AE_ALREADY_EXISTS because this means that a handler
+ * has already been installed (via Acpi_install_address_space_handler)
*/
- status = acpi_install_address_space_handler (acpi_gbl_root_node,
+
+ status = acpi_install_address_space_handler ((acpi_handle) acpi_gbl_root_node,
ACPI_ADR_SPACE_SYSTEM_MEMORY,
ACPI_DEFAULT_HANDLER, NULL, NULL);
if ((ACPI_FAILURE (status)) &&
- (status != AE_EXIST)) {
+ (status != AE_ALREADY_EXISTS)) {
return_ACPI_STATUS (status);
}
- status = acpi_install_address_space_handler (acpi_gbl_root_node,
+ status = acpi_install_address_space_handler ((acpi_handle) acpi_gbl_root_node,
ACPI_ADR_SPACE_SYSTEM_IO,
ACPI_DEFAULT_HANDLER, NULL, NULL);
if ((ACPI_FAILURE (status)) &&
- (status != AE_EXIST)) {
+ (status != AE_ALREADY_EXISTS)) {
return_ACPI_STATUS (status);
}
- status = acpi_install_address_space_handler (acpi_gbl_root_node,
+ status = acpi_install_address_space_handler ((acpi_handle) acpi_gbl_root_node,
ACPI_ADR_SPACE_PCI_CONFIG,
ACPI_DEFAULT_HANDLER, NULL, NULL);
if ((ACPI_FAILURE (status)) &&
- (status != AE_EXIST)) {
+ (status != AE_ALREADY_EXISTS)) {
return_ACPI_STATUS (status);
}
+ status = acpi_install_address_space_handler ((acpi_handle) acpi_gbl_root_node,
+ ACPI_ADR_SPACE_DATA_TABLE,
+ ACPI_DEFAULT_HANDLER, NULL, NULL);
+ if ((ACPI_FAILURE (status)) &&
+ (status != AE_ALREADY_EXISTS)) {
+ return_ACPI_STATUS (status);
+ }
return_ACPI_STATUS (AE_OK);
}
-/* TBD: [Restructure] Move elsewhere */
-
/*******************************************************************************
*
* FUNCTION: Acpi_ev_execute_reg_method
u32 function)
{
acpi_operand_object *params[3];
+ acpi_operand_object *region_obj2;
acpi_status status;
- FUNCTION_TRACE ("Ev_execute_reg_method");
+ ACPI_FUNCTION_TRACE ("Ev_execute_reg_method");
- if (region_obj->region.extra->extra.method_REG == NULL) {
+ region_obj2 = acpi_ns_get_secondary_object (region_obj);
+ if (!region_obj2) {
+ return_ACPI_STATUS (AE_NOT_EXIST);
+ }
+
+ if (region_obj2->extra.method_REG == NULL) {
return_ACPI_STATUS (AE_OK);
}
/*
* Execute the method, no return value
*/
- DEBUG_EXEC(acpi_ut_display_init_pathname (region_obj->region.extra->extra.method_REG, " [Method]"));
- status = acpi_ns_evaluate_by_handle (region_obj->region.extra->extra.method_REG, params, NULL);
+ ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname (region_obj2->extra.method_REG, " [Method]"));
+ status = acpi_ns_evaluate_by_handle (region_obj2->extra.method_REG, params, NULL);
acpi_ut_remove_reference (params[1]);
* Space_id - ID of the address space (0-255)
* Function - Read or Write operation
* Address - Where in the space to read or write
- * Bit_width - Field width in bits (8, 16, or 32)
+ * Bit_width - Field width in bits (8, 16, 32, or 64)
* Value - Pointer to in or out value
*
* RETURN: Status
u32 function,
ACPI_PHYSICAL_ADDRESS address,
u32 bit_width,
- u32 *value)
+ acpi_integer *value)
{
acpi_status status;
acpi_adr_space_handler handler;
acpi_adr_space_setup region_setup;
acpi_operand_object *handler_desc;
+ acpi_operand_object *region_obj2;
void *region_context = NULL;
- FUNCTION_TRACE ("Ev_address_space_dispatch");
+ ACPI_FUNCTION_TRACE ("Ev_address_space_dispatch");
+ region_obj2 = acpi_ns_get_secondary_object (region_obj);
+ if (!region_obj2) {
+ return_ACPI_STATUS (AE_NOT_EXIST);
+ }
+
/*
* Ensure that there is a handler associated with this region
*/
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "no handler for region(%p) [%s]\n",
region_obj, acpi_ut_get_region_name (region_obj->region.space_id)));
- return_ACPI_STATUS(AE_NOT_EXIST);
+ return_ACPI_STATUS (AE_NOT_EXIST);
}
/*
* It may be the case that the region has never been initialized
* Some types of regions require special init code
*/
- if (!(region_obj->region.flags & AOPOBJ_INITIALIZED)) {
+ if (!(region_obj->region.flags & AOPOBJ_SETUP_COMPLETE)) {
/*
* This region has not been initialized yet, do it
*/
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Region Init: %s [%s]\n",
acpi_format_exception (status),
acpi_ut_get_region_name (region_obj->region.space_id)));
- return_ACPI_STATUS(status);
+ return_ACPI_STATUS (status);
}
- region_obj->region.flags |= AOPOBJ_INITIALIZED;
+ region_obj->region.flags |= AOPOBJ_SETUP_COMPLETE;
/*
* Save the returned context for use in all accesses to
* this particular region.
*/
- region_obj->region.extra->extra.region_context = region_context;
+ region_obj2->extra.region_context = region_context;
}
/*
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
"Addrhandler %p (%p), Address %8.8X%8.8X\n",
- ®ion_obj->region.addr_handler->addr_handler, handler, HIDWORD(address),
- LODWORD(address)));
+ ®ion_obj->region.addr_handler->addr_handler, handler,
+ ACPI_HIDWORD (address), ACPI_LODWORD (address)));
- if (!(handler_desc->addr_handler.flags & ADDR_HANDLER_DEFAULT_INSTALLED)) {
+ if (!(handler_desc->addr_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
*/
status = handler (function, address, bit_width, value,
handler_desc->addr_handler.context,
- region_obj->region.extra->extra.region_context);
+ region_obj2->extra.region_context);
if (ACPI_FAILURE (status)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Region handler: %s [%s]\n",
- acpi_format_exception (status),
- acpi_ut_get_region_name (region_obj->region.space_id)));
+ ACPI_REPORT_ERROR (("Handler for [%s] returned %s\n",
+ acpi_ut_get_region_name (region_obj->region.space_id),
+ acpi_format_exception (status)));
}
- if (!(handler_desc->addr_handler.flags & ADDR_HANDLER_DEFAULT_INSTALLED)) {
+ if (!(handler_desc->addr_handler.flags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) {
/*
* We just returned from a non-default handler, we must re-enter the
* interpreter
acpi_operand_object **last_obj_ptr;
acpi_adr_space_setup region_setup;
void *region_context;
+ acpi_operand_object *region_obj2;
acpi_status status;
- FUNCTION_TRACE ("Ev_disassociate_region_from_handler");
+ ACPI_FUNCTION_TRACE ("Ev_disassociate_region_from_handler");
- region_context = region_obj->region.extra->extra.region_context;
+ region_obj2 = acpi_ns_get_secondary_object (region_obj);
+ if (!region_obj2) {
+ return;
+ }
+ region_context = region_obj2->extra.region_context;
/*
* Get the address handler from the region object
obj_desc->region.next = NULL; /* Must clear field */
if (acpi_ns_is_locked) {
- acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return_VOID;
+ }
}
/*
acpi_ev_execute_reg_method (region_obj, 0);
if (acpi_ns_is_locked) {
- acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return_VOID;
+ }
}
/*
acpi_ut_get_region_name (region_obj->region.space_id)));
}
- region_obj->region.flags &= ~(AOPOBJ_INITIALIZED);
+ region_obj->region.flags &= ~(AOPOBJ_SETUP_COMPLETE);
/*
* Remove handler reference in the region
acpi_status status;
- FUNCTION_TRACE ("Ev_associate_region_and_handler");
+ ACPI_FUNCTION_TRACE ("Ev_associate_region_and_handler");
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
/*
- * Link this region to the front of the handler's list
+ * Link this region to the front of the handler's list
*/
region_obj->region.next = handler_obj->addr_handler.region_list;
handler_obj->addr_handler.region_list = region_obj;
/*
- * set the region's handler
+ * Set the region's handler
*/
region_obj->region.addr_handler = handler_obj;
/*
- * Last thing, tell all users that this region is usable
+ * Tell all users that this region is usable by running the _REG
+ * method
*/
if (acpi_ns_is_locked) {
acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
status = acpi_ev_execute_reg_method (region_obj, 1);
if (acpi_ns_is_locked) {
- acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ (void) acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
}
return_ACPI_STATUS (status);
* Level - Nesting level of the handle
* Context - Passed into Acpi_ns_walk_namespace
*
- * DESCRIPTION: This routine checks to see if the object is a Region if it
- * is then the address handler is installed in it.
+ * DESCRIPTION: This routine installs an address handler into objects that are
+ * of type Region.
*
* If the Object is a Device, and the device has a handler of
* the same type then the search is terminated in that branch.
acpi_status status;
- PROC_NAME ("Ev_addr_handler_helper");
+ ACPI_FUNCTION_NAME ("Ev_addr_handler_helper");
handler_obj = (acpi_operand_object *) context;
/*
* Devices are handled different than regions
*/
- if (IS_THIS_OBJECT_TYPE (obj_desc, ACPI_TYPE_DEVICE)) {
+ if (obj_desc->common.type == ACPI_TYPE_DEVICE) {
/*
* See if this guy has any handlers
*/
/******************************************************************************
*
* Module Name: evrgnini- ACPI Address_space (Op_region) init
- * $Revision: 48 $
+ * $Revision: 57 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "amlcode.h"
#define _COMPONENT ACPI_EVENTS
- MODULE_NAME ("evrgnini")
+ ACPI_MODULE_NAME ("evrgnini")
/*******************************************************************************
void *handler_context,
void **region_context)
{
- FUNCTION_TRACE ("Ev_system_memory_region_setup");
+ acpi_operand_object *region_desc = (acpi_operand_object *) handle;
+ acpi_mem_space_context *local_region_context;
+
+ ACPI_FUNCTION_TRACE ("Ev_system_memory_region_setup");
if (function == ACPI_REGION_DEACTIVATE) {
/* Activate. Create a new context */
- *region_context = ACPI_MEM_CALLOCATE (sizeof (acpi_mem_space_context));
- if (!(*region_context)) {
+ local_region_context = ACPI_MEM_CALLOCATE (sizeof (acpi_mem_space_context));
+ if (!(local_region_context)) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
+ /* Save the region length and address for use in the handler */
+
+ local_region_context->length = region_desc->region.length;
+ local_region_context->address = region_desc->region.address;
+
+ *region_context = local_region_context;
return_ACPI_STATUS (AE_OK);
}
void *handler_context,
void **region_context)
{
- FUNCTION_TRACE ("Ev_io_space_region_setup");
+ ACPI_FUNCTION_TRACE ("Ev_io_space_region_setup");
if (function == ACPI_REGION_DEACTIVATE) {
acpi_device_id object_hID;
- FUNCTION_TRACE ("Ev_pci_config_region_setup");
+ ACPI_FUNCTION_TRACE ("Ev_pci_config_region_setup");
handler_obj = region_obj->region.addr_handler;
* First get device and function numbers from the _ADR object
* in the parent's scope.
*/
- node = acpi_ns_get_parent_object (region_obj->region.node);
+ node = acpi_ns_get_parent_node (region_obj->region.node);
/* Acpi_evaluate the _ADR object */
* do nothing on failures.
*/
if (ACPI_SUCCESS (status)) {
- pci_id->device = HIWORD (temp);
- pci_id->function = LOWORD (temp);
+ pci_id->device = ACPI_HIWORD (temp);
+ pci_id->function = ACPI_LOWORD (temp);
}
/*
while (node != acpi_gbl_root_node) {
status = acpi_ut_execute_HID (node, &object_hID);
if (ACPI_SUCCESS (status)) {
- if (!(STRNCMP (object_hID.buffer, PCI_ROOT_HID_STRING,
+ if (!(ACPI_STRNCMP (object_hID.buffer, PCI_ROOT_HID_STRING,
sizeof (PCI_ROOT_HID_STRING)))) {
- acpi_install_address_space_handler (node,
+ acpi_install_address_space_handler ((acpi_handle) node,
ACPI_ADR_SPACE_PCI_CONFIG,
ACPI_DEFAULT_HANDLER, NULL, NULL);
break;
}
}
- node = acpi_ns_get_parent_object (node);
+ node = acpi_ns_get_parent_node (node);
}
}
else {
*/
status = acpi_ut_evaluate_numeric_object (METHOD_NAME__SEG, node, &temp);
if (ACPI_SUCCESS (status)) {
- pci_id->segment = LOWORD (temp);
+ pci_id->segment = ACPI_LOWORD (temp);
}
/*
*/
status = acpi_ut_evaluate_numeric_object (METHOD_NAME__BBN, node, &temp);
if (ACPI_SUCCESS (status)) {
- pci_id->bus = LOWORD (temp);
+ pci_id->bus = ACPI_LOWORD (temp);
}
*region_context = pci_id;
void **region_context)
{
- FUNCTION_TRACE ("Ev_pci_bar_region_setup");
+ ACPI_FUNCTION_TRACE ("Ev_pci_bar_region_setup");
return_ACPI_STATUS (AE_OK);
void **region_context)
{
- FUNCTION_TRACE ("Ev_cmos_region_setup");
+ ACPI_FUNCTION_TRACE ("Ev_cmos_region_setup");
return_ACPI_STATUS (AE_OK);
void *handler_context,
void **region_context)
{
- FUNCTION_TRACE ("Ev_default_region_setup");
+ ACPI_FUNCTION_TRACE ("Ev_default_region_setup");
if (function == ACPI_REGION_DEACTIVATE) {
acpi_status status;
acpi_namespace_node *method_node;
acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG;
+ acpi_operand_object *region_obj2;
- FUNCTION_TRACE_U32 ("Ev_initialize_region", acpi_ns_locked);
+ ACPI_FUNCTION_TRACE_U32 ("Ev_initialize_region", acpi_ns_locked);
if (!region_obj) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- node = acpi_ns_get_parent_object (region_obj->region.node);
+ if (region_obj->common.flags & AOPOBJ_OBJECT_INITIALIZED) {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ region_obj2 = acpi_ns_get_secondary_object (region_obj);
+ if (!region_obj2) {
+ return_ACPI_STATUS (AE_NOT_EXIST);
+ }
+ node = acpi_ns_get_parent_node (region_obj->region.node);
+
+
space_id = region_obj->region.space_id;
region_obj->region.addr_handler = NULL;
- region_obj->region.extra->extra.method_REG = NULL;
- region_obj->region.flags &= ~(AOPOBJ_INITIALIZED);
+ region_obj2->extra.method_REG = NULL;
+ region_obj->common.flags &= ~(AOPOBJ_SETUP_COMPLETE);
+ region_obj->common.flags |= AOPOBJ_OBJECT_INITIALIZED;
/*
* Find any "_REG" associated with this region definition
* definition. This will be executed when the handler is attached
* or removed
*/
- region_obj->region.extra->extra.method_REG = method_node;
+ region_obj2->extra.method_REG = method_node;
}
/*
*/
acpi_ev_associate_region_and_handler (handler_obj, region_obj,
acpi_ns_locked);
+
return_ACPI_STATUS (AE_OK);
}
* This one does not have the handler we need
* Pop up one level
*/
- node = acpi_ns_get_parent_object (node);
+ node = acpi_ns_get_parent_node (node);
} /* while Node != ROOT */
*
* Module Name: evsci - System Control Interrupt configuration and
* legacy to ACPI mode state transition functions
- * $Revision: 74 $
+ * $Revision: 83 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_EVENTS
- MODULE_NAME ("evsci")
-
-
-/*
- * Elements correspond to counts for TMR, NOT_USED, GBL, PWR_BTN, SLP_BTN, RTC,
- * and GENERAL respectively. These counts are modified by the ACPI interrupt
- * handler.
- *
- * TBD: [Investigate] Note that GENERAL should probably be split out into
- * one element for each bit in the GPE registers
- */
+ ACPI_MODULE_NAME ("evsci")
/*******************************************************************************
*
******************************************************************************/
-static u32
-acpi_ev_sci_handler (void *context)
+static u32 ACPI_SYSTEM_XFACE
+acpi_ev_sci_handler (
+ void *context)
{
- u32 interrupt_handled = INTERRUPT_NOT_HANDLED;
+ u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED;
- FUNCTION_TRACE("Ev_sci_handler");
+ ACPI_FUNCTION_TRACE("Ev_sci_handler");
/*
* Make sure that ACPI is enabled by checking SCI_EN. Note that we are
* required to treat the SCI interrupt as sharable, level, active low.
*/
- if (!acpi_hw_register_bit_access (ACPI_READ, ACPI_MTX_DO_NOT_LOCK, SCI_EN)) {
+ if (!acpi_hw_bit_register_read (ACPI_BITREG_SCI_ENABLE, ACPI_MTX_DO_NOT_LOCK)) {
/* ACPI is not enabled; this interrupt cannot be for us */
- return_VALUE (INTERRUPT_NOT_HANDLED);
+ return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
}
/*
u32 status = AE_OK;
- FUNCTION_TRACE ("Ev_install_sci_handler");
+ ACPI_FUNCTION_TRACE ("Ev_install_sci_handler");
status = acpi_os_install_interrupt_handler ((u32) acpi_gbl_FADT->sci_int,
/******************************************************************************
-
*
* FUNCTION: Acpi_ev_remove_sci_handler
*
* RETURN: E_OK if handler uninstalled OK, E_ERROR if handler was not
* installed to begin with
*
- * DESCRIPTION: Restores original status of all fixed event enable bits and
- * removes SCI handler.
+ * DESCRIPTION: Remove the SCI interrupt handler. No further SCIs will be
+ * taken.
+ *
+ * Note: It doesn't seem important to disable all events or set the event
+ * enable registers to their original values. The OS should disable
+ * the SCI interrupt level when the handler is removed, so no more
+ * events will come in.
*
******************************************************************************/
acpi_status
acpi_ev_remove_sci_handler (void)
{
- FUNCTION_TRACE ("Ev_remove_sci_handler");
-
-
-#if 0
- /* TBD:[Investigate] Figure this out!! Disable all events first ??? */
-
- if (original_fixed_enable_bit_status ^ 1 << acpi_event_index (TMR_FIXED_EVENT)) {
- acpi_event_disable_event (TMR_FIXED_EVENT);
- }
-
- if (original_fixed_enable_bit_status ^ 1 << acpi_event_index (GBL_FIXED_EVENT)) {
- acpi_event_disable_event (GBL_FIXED_EVENT);
- }
-
- if (original_fixed_enable_bit_status ^ 1 << acpi_event_index (PWR_BTN_FIXED_EVENT)) {
- acpi_event_disable_event (PWR_BTN_FIXED_EVENT);
- }
-
- if (original_fixed_enable_bit_status ^ 1 << acpi_event_index (SLP_BTN_FIXED_EVENT)) {
- acpi_event_disable_event (SLP_BTN_FIXED_EVENT);
- }
-
- if (original_fixed_enable_bit_status ^ 1 << acpi_event_index (RTC_FIXED_EVENT)) {
- acpi_event_disable_event (RTC_FIXED_EVENT);
- }
+ ACPI_FUNCTION_TRACE ("Ev_remove_sci_handler");
- original_fixed_enable_bit_status = 0;
-#endif
+ /* Just let the OS remove the handler and disable the level */
acpi_os_remove_interrupt_handler ((u32) acpi_gbl_FADT->sci_int,
acpi_ev_sci_handler);
}
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ev_restore_acpi_state
- *
- * PARAMETERS: none
- *
- * RETURN: none
- *
- * DESCRIPTION: Restore the original ACPI state of the machine
- *
- ******************************************************************************/
-
-void
-acpi_ev_restore_acpi_state (void)
-{
- u32 index;
-
-
- FUNCTION_TRACE ("Ev_restore_acpi_state");
-
-
- /* Restore the state of the chipset enable bits. */
-
- if (acpi_gbl_restore_acpi_chipset == TRUE) {
- /* Restore the fixed events */
-
- if (acpi_hw_register_read (ACPI_MTX_LOCK, PM1_EN) !=
- acpi_gbl_pm1_enable_register_save) {
- acpi_hw_register_write (ACPI_MTX_LOCK, PM1_EN,
- acpi_gbl_pm1_enable_register_save);
- }
-
-
- /* Ensure that all status bits are clear */
-
- acpi_hw_clear_acpi_status ();
-
-
- /* Now restore the GPEs */
-
- for (index = 0; index < DIV_2 (acpi_gbl_FADT->gpe0blk_len); index++) {
- if (acpi_hw_register_read (ACPI_MTX_LOCK, GPE0_EN_BLOCK | index) !=
- acpi_gbl_gpe0enable_register_save[index]) {
- acpi_hw_register_write (ACPI_MTX_LOCK, GPE0_EN_BLOCK | index,
- acpi_gbl_gpe0enable_register_save[index]);
- }
- }
-
- /* GPE 1 present? */
-
- if (acpi_gbl_FADT->gpe1_blk_len) {
- for (index = 0; index < DIV_2 (acpi_gbl_FADT->gpe1_blk_len); index++) {
- if (acpi_hw_register_read (ACPI_MTX_LOCK, GPE1_EN_BLOCK | index) !=
- acpi_gbl_gpe1_enable_register_save[index]) {
- acpi_hw_register_write (ACPI_MTX_LOCK, GPE1_EN_BLOCK | index,
- acpi_gbl_gpe1_enable_register_save[index]);
- }
- }
- }
-
- if (acpi_hw_get_mode() != acpi_gbl_original_mode) {
- acpi_hw_set_mode (acpi_gbl_original_mode);
- }
- }
-
- return_VOID;
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: Acpi_ev_terminate
- *
- * PARAMETERS: none
- *
- * RETURN: none
- *
- * DESCRIPTION: free memory allocated for table storage.
- *
- ******************************************************************************/
-
-void
-acpi_ev_terminate (void)
-{
-
- FUNCTION_TRACE ("Ev_terminate");
-
-
- /*
- * Free global tables, etc.
- */
- if (acpi_gbl_gpe_registers) {
- ACPI_MEM_FREE (acpi_gbl_gpe_registers);
- }
-
- if (acpi_gbl_gpe_info) {
- ACPI_MEM_FREE (acpi_gbl_gpe_info);
- }
-
- return_VOID;
-}
-
-
/******************************************************************************
*
* Module Name: evxface - External interfaces for ACPI events
- * $Revision: 116 $
+ * $Revision: 125 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acinterp.h"
#define _COMPONENT ACPI_EVENTS
- MODULE_NAME ("evxface")
+ ACPI_MODULE_NAME ("evxface")
/*******************************************************************************
acpi_status status;
- FUNCTION_TRACE ("Acpi_install_fixed_event_handler");
+ ACPI_FUNCTION_TRACE ("Acpi_install_fixed_event_handler");
/* Parameter validation */
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
+ status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
/* Don't allow two handlers. */
if (NULL != acpi_gbl_fixed_event_handlers[event].handler) {
- status = AE_EXIST;
+ status = AE_ALREADY_EXISTS;
goto cleanup;
}
acpi_gbl_fixed_event_handlers[event].context = context;
status = acpi_enable_event (event, ACPI_EVENT_FIXED, 0);
- if (!ACPI_SUCCESS (status)) {
+ if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Could not enable fixed event.\n"));
/* Remove the handler */
acpi_gbl_fixed_event_handlers[event].handler = NULL;
acpi_gbl_fixed_event_handlers[event].context = NULL;
}
-
else {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Enabled fixed event %X, Handler=%p\n", event, handler));
cleanup:
- acpi_ut_release_mutex (ACPI_MTX_EVENTS);
+ (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
return_ACPI_STATUS (status);
}
acpi_status status = AE_OK;
- FUNCTION_TRACE ("Acpi_remove_fixed_event_handler");
+ ACPI_FUNCTION_TRACE ("Acpi_remove_fixed_event_handler");
/* Parameter validation */
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
+ status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
/* Disable the event before removing the handler */
acpi_gbl_fixed_event_handlers[event].handler = NULL;
acpi_gbl_fixed_event_handlers[event].context = NULL;
- if (!ACPI_SUCCESS (status)) {
+ if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_WARN,
"Could not write to fixed event enable register.\n"));
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Disabled fixed event %X.\n", event));
}
- acpi_ut_release_mutex (ACPI_MTX_EVENTS);
+ (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
return_ACPI_STATUS (status);
}
acpi_operand_object *obj_desc;
acpi_operand_object *notify_obj;
acpi_namespace_node *device_node;
- acpi_status status = AE_OK;
+ acpi_status status;
- FUNCTION_TRACE ("Acpi_install_notify_handler");
+ ACPI_FUNCTION_TRACE ("Acpi_install_notify_handler");
/* Parameter validation */
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
/* Convert and validate the device handle */
acpi_gbl_sys_notify.handler) ||
((handler_type == ACPI_DEVICE_NOTIFY) &&
acpi_gbl_drv_notify.handler)) {
- status = AE_EXIST;
+ status = AE_ALREADY_EXISTS;
goto unlock_and_exit;
}
obj_desc->device.sys_handler) ||
((handler_type == ACPI_DEVICE_NOTIFY) &&
obj_desc->device.drv_handler)) {
- status = AE_EXIST;
+ status = AE_ALREADY_EXISTS;
goto unlock_and_exit;
}
}
-
else {
/* Create a new object */
/* Attach new object to the Node */
- status = acpi_ns_attach_object (device, obj_desc, (u8) device_node->type);
+ status = acpi_ns_attach_object (device, obj_desc, device_node->type);
if (ACPI_FAILURE (status)) {
goto unlock_and_exit;
}
if (handler_type == ACPI_SYSTEM_NOTIFY) {
obj_desc->device.sys_handler = notify_obj;
}
-
else /* ACPI_DEVICE_NOTIFY */ {
obj_desc->device.drv_handler = notify_obj;
}
unlock_and_exit:
- acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (status);
}
acpi_operand_object *notify_obj;
acpi_operand_object *obj_desc;
acpi_namespace_node *device_node;
- acpi_status status = AE_OK;
+ acpi_status status;
- FUNCTION_TRACE ("Acpi_remove_notify_handler");
+ ACPI_FUNCTION_TRACE ("Acpi_remove_notify_handler");
/* Parameter validation */
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
/* Convert and validate the device handle */
unlock_and_exit:
- acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (status);
}
acpi_gpe_handler handler,
void *context)
{
- acpi_status status = AE_OK;
+ acpi_status status;
+ u32 gpe_number_index;
- FUNCTION_TRACE ("Acpi_install_gpe_handler");
+ ACPI_FUNCTION_TRACE ("Acpi_install_gpe_handler");
/* Parameter validation */
- if (!handler || (gpe_number > ACPI_GPE_MAX)) {
+ if (!handler) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Ensure that we have a valid GPE number */
- if (acpi_gbl_gpe_valid[gpe_number] == ACPI_GPE_INVALID) {
+ gpe_number_index = acpi_ev_get_gpe_number_index (gpe_number);
+ if (gpe_number_index == ACPI_GPE_INVALID) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
+ status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
/* Make sure that there isn't a handler there already */
- if (acpi_gbl_gpe_info[gpe_number].handler) {
- status = AE_EXIST;
+ if (acpi_gbl_gpe_number_info[gpe_number_index].handler) {
+ status = AE_ALREADY_EXISTS;
goto cleanup;
}
/* Install the handler */
- acpi_gbl_gpe_info[gpe_number].handler = handler;
- acpi_gbl_gpe_info[gpe_number].context = context;
- acpi_gbl_gpe_info[gpe_number].type = (u8) type;
+ acpi_gbl_gpe_number_info[gpe_number_index].handler = handler;
+ acpi_gbl_gpe_number_info[gpe_number_index].context = context;
+ acpi_gbl_gpe_number_info[gpe_number_index].type = (u8) type;
/* Clear the GPE (of stale events), the enable it */
cleanup:
- acpi_ut_release_mutex (ACPI_MTX_EVENTS);
+ (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
return_ACPI_STATUS (status);
}
u32 gpe_number,
acpi_gpe_handler handler)
{
- acpi_status status = AE_OK;
+ acpi_status status;
+ u32 gpe_number_index;
- FUNCTION_TRACE ("Acpi_remove_gpe_handler");
+ ACPI_FUNCTION_TRACE ("Acpi_remove_gpe_handler");
/* Parameter validation */
- if (!handler || (gpe_number > ACPI_GPE_MAX)) {
+ if (!handler) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Ensure that we have a valid GPE number */
- if (acpi_gbl_gpe_valid[gpe_number] == ACPI_GPE_INVALID) {
+ gpe_number_index = acpi_ev_get_gpe_number_index (gpe_number);
+ if (gpe_number_index == ACPI_GPE_INVALID) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
acpi_hw_disable_gpe (gpe_number);
- acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
+ status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
/* Make sure that the installed handler is the same */
- if (acpi_gbl_gpe_info[gpe_number].handler != handler) {
+ if (acpi_gbl_gpe_number_info[gpe_number_index].handler != handler) {
acpi_hw_enable_gpe (gpe_number);
status = AE_BAD_PARAMETER;
goto cleanup;
/* Remove the handler */
- acpi_gbl_gpe_info[gpe_number].handler = NULL;
- acpi_gbl_gpe_info[gpe_number].context = NULL;
+ acpi_gbl_gpe_number_info[gpe_number_index].handler = NULL;
+ acpi_gbl_gpe_number_info[gpe_number_index].context = NULL;
cleanup:
- acpi_ut_release_mutex (ACPI_MTX_EVENTS);
+ (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
return_ACPI_STATUS (status);
}
acpi_status
acpi_acquire_global_lock (
- void)
+ u32 timeout,
+ u32 *handle)
{
acpi_status status;
+ if (!handle) {
+ return (AE_BAD_PARAMETER);
+ }
+
status = acpi_ex_enter_interpreter ();
if (ACPI_FAILURE (status)) {
return (status);
}
- /*
- * TBD: [Restructure] add timeout param to internal interface, and
- * perhaps INTERPRETER_LOCKED
- */
- status = acpi_ev_acquire_global_lock ();
+ status = acpi_ev_acquire_global_lock (timeout);
acpi_ex_exit_interpreter ();
+ if (ACPI_SUCCESS (status)) {
+ acpi_gbl_global_lock_handle++;
+ *handle = acpi_gbl_global_lock_handle;
+ }
+
return (status);
}
acpi_status
acpi_release_global_lock (
- void)
+ u32 handle)
{
+ if (handle != acpi_gbl_global_lock_handle) {
+ return (AE_NOT_ACQUIRED);
+ }
+
acpi_ev_release_global_lock ();
return (AE_OK);
}
/******************************************************************************
*
* Module Name: evxfevnt - External Interfaces, ACPI event disable/enable
- * $Revision: 38 $
+ * $Revision: 51 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acinterp.h"
#define _COMPONENT ACPI_EVENTS
- MODULE_NAME ("evxfevnt")
+ ACPI_MODULE_NAME ("evxfevnt")
/*******************************************************************************
acpi_status
acpi_enable (void)
{
- acpi_status status;
+ acpi_status status = AE_OK;
- FUNCTION_TRACE ("Acpi_enable");
+ ACPI_FUNCTION_TRACE ("Acpi_enable");
- /* Make sure we've got ACPI tables */
+ /* Make sure we have ACPI tables */
if (!acpi_gbl_DSDT) {
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No ACPI tables present!\n"));
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
}
- /* Make sure the BIOS supports ACPI mode */
+ acpi_gbl_original_mode = acpi_hw_get_mode ();
- if (SYS_MODE_LEGACY == acpi_hw_get_mode_capabilities()) {
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Only legacy mode supported!\n"));
- return_ACPI_STATUS (AE_ERROR);
+ if (acpi_gbl_original_mode == ACPI_SYS_MODE_ACPI) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_OK, "Already in ACPI mode.\n"));
}
+ else {
+ /* Transition to ACPI mode */
- /* Transition to ACPI mode */
+ status = acpi_hw_set_mode (ACPI_SYS_MODE_ACPI);
+ if (ACPI_FAILURE (status)) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, "Could not transition to ACPI mode.\n"));
+ return_ACPI_STATUS (status);
+ }
- status = acpi_hw_set_mode (SYS_MODE_ACPI);
- if (ACPI_FAILURE (status)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, "Could not transition to ACPI mode.\n"));
- return_ACPI_STATUS (status);
+ ACPI_DEBUG_PRINT ((ACPI_DB_OK, "Transition to ACPI mode successful\n"));
}
- ACPI_DEBUG_PRINT ((ACPI_DB_OK, "Transition to ACPI mode successful\n"));
-
return_ACPI_STATUS (status);
}
acpi_status
acpi_disable (void)
{
- acpi_status status;
+ acpi_status status = AE_OK;
- FUNCTION_TRACE ("Acpi_disable");
+ ACPI_FUNCTION_TRACE ("Acpi_disable");
- /* Restore original mode */
+ if (acpi_hw_get_mode () != acpi_gbl_original_mode) {
+ /* Restore original mode */
- status = acpi_hw_set_mode (acpi_gbl_original_mode);
- if (ACPI_FAILURE (status)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unable to transition to original mode"));
- return_ACPI_STATUS (status);
+ status = acpi_hw_set_mode (acpi_gbl_original_mode);
+ if (ACPI_FAILURE (status)) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unable to transition to original mode"));
+ return_ACPI_STATUS (status);
+ }
}
/* Unload the SCI interrupt handler */
acpi_ev_remove_sci_handler ();
- acpi_ev_restore_acpi_state ();
-
return_ACPI_STATUS (status);
}
u32 flags)
{
acpi_status status = AE_OK;
- u32 register_id;
- FUNCTION_TRACE ("Acpi_enable_event");
+ ACPI_FUNCTION_TRACE ("Acpi_enable_event");
- /* The Type must be either Fixed Acpi_event or GPE */
+ /* The Type must be either Fixed Event or GPE */
switch (type) {
-
case ACPI_EVENT_FIXED:
- /* Decode the Fixed Acpi_event */
-
- switch (event) {
- case ACPI_EVENT_PMTIMER:
- register_id = TMR_EN;
- break;
-
- case ACPI_EVENT_GLOBAL:
- register_id = GBL_EN;
- break;
-
- case ACPI_EVENT_POWER_BUTTON:
- register_id = PWRBTN_EN;
- break;
-
- case ACPI_EVENT_SLEEP_BUTTON:
- register_id = SLPBTN_EN;
- break;
-
- case ACPI_EVENT_RTC:
- register_id = RTC_EN;
- break;
+ /* Decode the Fixed Event */
- default:
+ if (event > ACPI_NUM_FIXED_EVENTS) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
- break;
}
/*
* Enable the requested fixed event (by writing a one to the
* enable register bit)
*/
- acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, register_id, 1);
+ acpi_hw_bit_register_write (acpi_gbl_fixed_event_info[event].enable_register_id,
+ 1, ACPI_MTX_LOCK);
- if (1 != acpi_hw_register_bit_access(ACPI_READ, ACPI_MTX_LOCK, register_id)) {
+ /* Make sure that the hardware responded */
+
+ if (1 != acpi_hw_bit_register_read (acpi_gbl_fixed_event_info[event].enable_register_id,
+ ACPI_MTX_LOCK)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Fixed event bit clear when it should be set\n"));
+ "Could not enable %s event\n", acpi_ut_get_event_name (event)));
return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
}
-
break;
/* Ensure that we have a valid GPE number */
- if ((event > ACPI_GPE_MAX) ||
- (acpi_gbl_gpe_valid[event] == ACPI_GPE_INVALID)) {
+ if (acpi_ev_get_gpe_number_index (event) == ACPI_GPE_INVALID) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
-
/* Enable the requested GPE number */
- if (flags & ACPI_EVENT_ENABLE) {
- acpi_hw_enable_gpe (event);
- }
+ acpi_hw_enable_gpe (event);
+
if (flags & ACPI_EVENT_WAKE_ENABLE) {
acpi_hw_enable_gpe_for_wakeup (event);
}
-
break;
status = AE_BAD_PARAMETER;
}
-
return_ACPI_STATUS (status);
}
u32 flags)
{
acpi_status status = AE_OK;
- u32 register_id;
- FUNCTION_TRACE ("Acpi_disable_event");
+ ACPI_FUNCTION_TRACE ("Acpi_disable_event");
- /* The Type must be either Fixed Acpi_event or GPE */
+ /* The Type must be either Fixed Event or GPE */
switch (type) {
-
case ACPI_EVENT_FIXED:
- /* Decode the Fixed Acpi_event */
-
- switch (event) {
- case ACPI_EVENT_PMTIMER:
- register_id = TMR_EN;
- break;
-
- case ACPI_EVENT_GLOBAL:
- register_id = GBL_EN;
- break;
-
- case ACPI_EVENT_POWER_BUTTON:
- register_id = PWRBTN_EN;
- break;
-
- case ACPI_EVENT_SLEEP_BUTTON:
- register_id = SLPBTN_EN;
- break;
+ /* Decode the Fixed Event */
- case ACPI_EVENT_RTC:
- register_id = RTC_EN;
- break;
-
- default:
+ if (event > ACPI_NUM_FIXED_EVENTS) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
- break;
}
/*
* Disable the requested fixed event (by writing a zero to the
* enable register bit)
*/
- acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, register_id, 0);
+ acpi_hw_bit_register_write (acpi_gbl_fixed_event_info[event].enable_register_id,
+ 0, ACPI_MTX_LOCK);
- if (0 != acpi_hw_register_bit_access(ACPI_READ, ACPI_MTX_LOCK, register_id)) {
+ if (0 != acpi_hw_bit_register_read (acpi_gbl_fixed_event_info[event].enable_register_id,
+ ACPI_MTX_LOCK)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Fixed event bit set when it should be clear,\n"));
+ "Could not disable %s events\n", acpi_ut_get_event_name (event)));
return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
}
-
break;
/* Ensure that we have a valid GPE number */
- if ((event > ACPI_GPE_MAX) ||
- (acpi_gbl_gpe_valid[event] == ACPI_GPE_INVALID)) {
+ if (acpi_ev_get_gpe_number_index (event) == ACPI_GPE_INVALID) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- /* Disable the requested GPE number */
+ /*
+ * Only disable the requested GPE number for wake if specified.
+ * Otherwise, turn it totally off
+ */
- if (flags & ACPI_EVENT_DISABLE) {
- acpi_hw_disable_gpe (event);
- }
if (flags & ACPI_EVENT_WAKE_DISABLE) {
acpi_hw_disable_gpe_for_wakeup (event);
}
-
+ else {
+ acpi_hw_disable_gpe (event);
+ }
break;
u32 type)
{
acpi_status status = AE_OK;
- u32 register_id;
- FUNCTION_TRACE ("Acpi_clear_event");
+ ACPI_FUNCTION_TRACE ("Acpi_clear_event");
- /* The Type must be either Fixed Acpi_event or GPE */
+ /* The Type must be either Fixed Event or GPE */
switch (type) {
-
case ACPI_EVENT_FIXED:
- /* Decode the Fixed Acpi_event */
-
- switch (event) {
- case ACPI_EVENT_PMTIMER:
- register_id = TMR_STS;
- break;
-
- case ACPI_EVENT_GLOBAL:
- register_id = GBL_STS;
- break;
+ /* Decode the Fixed Event */
- case ACPI_EVENT_POWER_BUTTON:
- register_id = PWRBTN_STS;
- break;
-
- case ACPI_EVENT_SLEEP_BUTTON:
- register_id = SLPBTN_STS;
- break;
-
- case ACPI_EVENT_RTC:
- register_id = RTC_STS;
- break;
-
- default:
+ if (event > ACPI_NUM_FIXED_EVENTS) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
- break;
}
/*
* Clear the requested fixed event (By writing a one to the
* status register bit)
*/
- acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, register_id, 1);
+ acpi_hw_bit_register_write (acpi_gbl_fixed_event_info[event].status_register_id,
+ 1, ACPI_MTX_LOCK);
break;
/* Ensure that we have a valid GPE number */
- if ((event > ACPI_GPE_MAX) ||
- (acpi_gbl_gpe_valid[event] == ACPI_GPE_INVALID)) {
+ if (acpi_ev_get_gpe_number_index (event) == ACPI_GPE_INVALID) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
-
acpi_hw_clear_gpe (event);
break;
acpi_event_status *event_status)
{
acpi_status status = AE_OK;
- u32 register_id;
- FUNCTION_TRACE ("Acpi_get_event_status");
+ ACPI_FUNCTION_TRACE ("Acpi_get_event_status");
if (!event_status) {
}
- /* The Type must be either Fixed Acpi_event or GPE */
+ /* The Type must be either Fixed Event or GPE */
switch (type) {
-
case ACPI_EVENT_FIXED:
- /* Decode the Fixed Acpi_event */
-
- switch (event) {
- case ACPI_EVENT_PMTIMER:
- register_id = TMR_STS;
- break;
+ /* Decode the Fixed Event */
- case ACPI_EVENT_GLOBAL:
- register_id = GBL_STS;
- break;
-
- case ACPI_EVENT_POWER_BUTTON:
- register_id = PWRBTN_STS;
- break;
-
- case ACPI_EVENT_SLEEP_BUTTON:
- register_id = SLPBTN_STS;
- break;
-
- case ACPI_EVENT_RTC:
- register_id = RTC_STS;
- break;
-
- default:
+ if (event > ACPI_NUM_FIXED_EVENTS) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
- break;
}
/* Get the status of the requested fixed event */
- *event_status = acpi_hw_register_bit_access (ACPI_READ, ACPI_MTX_LOCK, register_id);
+ *event_status = acpi_hw_bit_register_read (acpi_gbl_fixed_event_info[event].status_register_id,
+ ACPI_MTX_LOCK);
break;
/* Ensure that we have a valid GPE number */
- if ((event > ACPI_GPE_MAX) ||
- (acpi_gbl_gpe_valid[event] == ACPI_GPE_INVALID)) {
+ if (acpi_ev_get_gpe_number_index (event) == ACPI_GPE_INVALID) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
-
/* Obtain status on the requested GPE number */
acpi_hw_get_gpe_status (event, event_status);
*
* Module Name: evxfregn - External Interfaces, ACPI Operation Regions and
* Address Spaces.
- * $Revision: 40 $
+ * $Revision: 48 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acinterp.h"
#define _COMPONENT ACPI_EVENTS
- MODULE_NAME ("evxfregn")
+ ACPI_MODULE_NAME ("evxfregn")
/*******************************************************************************
acpi_operand_object *obj_desc;
acpi_operand_object *handler_obj;
acpi_namespace_node *node;
- acpi_status status = AE_OK;
- acpi_object_type8 type;
+ acpi_status status;
+ acpi_object_type type;
u16 flags = 0;
- FUNCTION_TRACE ("Acpi_install_address_space_handler");
+ ACPI_FUNCTION_TRACE ("Acpi_install_address_space_handler");
/* Parameter validation */
- if ((!device) ||
- ((!handler) && (handler != ACPI_DEFAULT_HANDLER)) ||
- (space_id > ACPI_MAX_ADDRESS_SPACE)) {
+ if (!device) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
/* Convert and validate the device handle */
}
if (handler == ACPI_DEFAULT_HANDLER) {
- flags = ADDR_HANDLER_DEFAULT_INSTALLED;
+ flags = ACPI_ADDR_HANDLER_DEFAULT_INSTALLED;
switch (space_id) {
case ACPI_ADR_SPACE_SYSTEM_MEMORY:
setup = acpi_ev_pci_bar_region_setup;
break;
+ case ACPI_ADR_SPACE_DATA_TABLE:
+ handler = acpi_ex_data_table_space_handler;
+ setup = NULL;
+ break;
+
default:
status = AE_NOT_EXIST;
goto unlock_and_exit;
- break;
}
}
* address space.
*/
if(handler_obj->addr_handler.space_id == space_id) {
- status = AE_EXIST;
+ status = AE_ALREADY_EXISTS;
goto unlock_and_exit;
}
handler_obj = handler_obj->addr_handler.next;
}
}
-
else {
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
"Creating object on Device %p while installing handler\n", node));
/* Attach the new object to the Node */
- status = acpi_ns_attach_object (node, obj_desc, (u8) type);
+ status = acpi_ns_attach_object (node, obj_desc, type);
if (ACPI_FAILURE (status)) {
acpi_ut_remove_reference (obj_desc);
goto unlock_and_exit;
* of the branch
*/
status = acpi_ns_walk_namespace (ACPI_TYPE_ANY, device,
- ACPI_UINT32_MAX, NS_WALK_UNLOCK,
+ ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK,
acpi_ev_addr_handler_helper,
handler_obj, NULL);
unlock_and_exit:
- acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (status);
}
acpi_operand_object *region_obj;
acpi_operand_object **last_obj_ptr;
acpi_namespace_node *node;
- acpi_status status = AE_OK;
+ acpi_status status;
- FUNCTION_TRACE ("Acpi_remove_address_space_handler");
+ ACPI_FUNCTION_TRACE ("Acpi_remove_address_space_handler");
/* Parameter validation */
- if ((!device) ||
- ((!handler) && (handler != ACPI_DEFAULT_HANDLER)) ||
- (space_id > ACPI_MAX_ADDRESS_SPACE)) {
+ if (!device) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
/* Convert and validate the device handle */
goto unlock_and_exit;
}
-
/* Make sure the internal object exists */
obj_desc = acpi_ns_get_attached_object (node);
unlock_and_exit:
- acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (status);
}
#
# Makefile for all Linux ACPI interpreter subdirectories
-# EXCEPT for the ospm directory
#
O_TARGET := $(notdir $(CURDIR)).o
-obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c))
+obj-$(CONFIG_ACPI_INTERPRETER) := $(patsubst %.c,%.o,$(wildcard *.c))
EXTRA_CFLAGS += $(ACPI_CFLAGS)
/******************************************************************************
*
* Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes)
- * $Revision: 44 $
+ * $Revision: 59 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exconfig")
+ ACPI_MODULE_NAME ("exconfig")
-/*****************************************************************************
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ex_add_table
+ *
+ * PARAMETERS: Table - Pointer to raw table
+ * Parent_node - Where to load the table (scope)
+ * Ddb_handle - Where to return the table handle.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Common function to Install and Load an ACPI table with a
+ * returned table handle.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ex_add_table (
+ acpi_table_header *table,
+ acpi_namespace_node *parent_node,
+ acpi_operand_object **ddb_handle)
+{
+ acpi_status status;
+ acpi_table_desc table_info;
+ acpi_operand_object *obj_desc;
+
+
+ ACPI_FUNCTION_TRACE ("Ex_add_table");
+
+
+ /* Create an object to be the table handle */
+
+ obj_desc = acpi_ut_create_internal_object (INTERNAL_TYPE_REFERENCE);
+ if (!obj_desc) {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Install the new table into the local data structures */
+
+ table_info.pointer = table;
+ table_info.length = table->length;
+ table_info.allocation = ACPI_MEM_ALLOCATED;
+ table_info.base_pointer = table;
+
+ status = acpi_tb_install_table (NULL, &table_info);
+ if (ACPI_FAILURE (status)) {
+ goto cleanup;
+ }
+
+ /* Add the table to the namespace */
+
+ status = acpi_ns_load_table (table_info.installed_desc, parent_node);
+ if (ACPI_FAILURE (status)) {
+ /* Uninstall table on error */
+
+ acpi_tb_uninstall_table (table_info.installed_desc);
+ goto cleanup;
+ }
+
+ /* Init the table handle */
+
+ obj_desc->reference.opcode = AML_LOAD_OP;
+ obj_desc->reference.object = table_info.installed_desc;
+ *ddb_handle = obj_desc;
+ return_ACPI_STATUS (AE_OK);
+
+
+cleanup:
+ acpi_ut_remove_reference (obj_desc);
+ return_ACPI_STATUS (status);
+}
+
+
+/*******************************************************************************
*
* FUNCTION: Acpi_ex_load_table_op
*
- * PARAMETERS: Rgn_desc - Op region where the table will be obtained
- * Ddb_handle - Where a handle to the table will be returned
+ * PARAMETERS: Walk_state - Current state with operands
+ * Return_desc - Where to store the return object
*
* RETURN: Status
*
* DESCRIPTION: Load an ACPI table
*
- ****************************************************************************/
+ ******************************************************************************/
acpi_status
-acpi_ex_load_op (
- acpi_operand_object *rgn_desc,
- acpi_operand_object *ddb_handle)
+acpi_ex_load_table_op (
+ acpi_walk_state *walk_state,
+ acpi_operand_object **return_desc)
{
acpi_status status;
- acpi_operand_object *table_desc = NULL;
- u8 *table_ptr;
- u8 *table_data_ptr;
- acpi_table_header table_header;
- acpi_table_desc table_info;
- u32 i;
+ acpi_operand_object **operand = &walk_state->operands[0];
+ acpi_table_header *table;
+ acpi_namespace_node *parent_node;
+ acpi_namespace_node *start_node;
+ acpi_namespace_node *parameter_node = NULL;
+ acpi_operand_object *ddb_handle;
+
+
+ ACPI_FUNCTION_TRACE ("Ex_load_table_op");
+
+
+ /*
+ * Make sure that the signature does not match one of the tables that
+ * is already loaded.
+ */
+ status = acpi_tb_match_signature (operand[0]->string.pointer, NULL);
+ if (status == AE_OK) {
+ /* Signature matched -- don't allow override */
+
+ return_ACPI_STATUS (AE_ALREADY_EXISTS);
+ }
+
+ /* Find the ACPI table */
+
+ status = acpi_tb_find_table (operand[0]->string.pointer,
+ operand[1]->string.pointer,
+ operand[2]->string.pointer, &table);
+ if (ACPI_FAILURE (status)) {
+ if (status != AE_NOT_FOUND) {
+ return_ACPI_STATUS (status);
+ }
+ /* Not found, return an Integer=0 and AE_OK */
- FUNCTION_TRACE ("Ex_load_op");
+ ddb_handle = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+ if (!ddb_handle) {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ ddb_handle->integer.value = 0;
+ *return_desc = ddb_handle;
- /* TBD: [Unhandled] Object can be either a field or an opregion */
+ return_ACPI_STATUS (AE_OK);
+ }
+ /* Default nodes */
- /* Get the table header */
+ start_node = walk_state->scope_info->scope.node;
+ parent_node = acpi_gbl_root_node;
- table_header.length = 0;
- for (i = 0; i < sizeof (acpi_table_header); i++) {
- status = acpi_ev_address_space_dispatch (rgn_desc, ACPI_READ_ADR_SPACE,
- (ACPI_PHYSICAL_ADDRESS) i, 8,
- (u32 *) ((u8 *) &table_header + i));
+ /* Root_path (optional parameter) */
+
+ if (operand[3]->string.length > 0) {
+ /*
+ * Find the node referenced by the Root_path_string. This is the
+ * location within the namespace where the table will be loaded.
+ */
+ status = acpi_ns_get_node_by_path (operand[3]->string.pointer, start_node,
+ ACPI_NS_SEARCH_PARENT, &parent_node);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
}
- /* Allocate a buffer for the entire table */
+ /* Parameter_path (optional parameter) */
- table_ptr = ACPI_MEM_ALLOCATE (table_header.length);
- if (!table_ptr) {
- return_ACPI_STATUS (AE_NO_MEMORY);
+ if (operand[4]->string.length > 0) {
+ if ((operand[4]->string.pointer[0] != '\\') &&
+ (operand[4]->string.pointer[0] != '^')) {
+ /*
+ * Path is not absolute, so it will be relative to the node
+ * referenced by the Root_path_string (or the NS root if omitted)
+ */
+ start_node = parent_node;
+ }
+
+ /*
+ * Find the node referenced by the Parameter_path_string
+ */
+ status = acpi_ns_get_node_by_path (operand[4]->string.pointer, start_node,
+ ACPI_NS_SEARCH_PARENT, ¶meter_node);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
}
- /* Copy the header to the buffer */
+ /* Load the table into the namespace */
- MEMCPY (table_ptr, &table_header, sizeof (acpi_table_header));
- table_data_ptr = table_ptr + sizeof (acpi_table_header);
+ status = acpi_ex_add_table (table, parent_node, &ddb_handle);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+ /* Parameter Data (optional) */
- /* Get the table from the op region */
+ if (parameter_node) {
+ /* Store the parameter data into the optional parameter object */
- for (i = 0; i < table_header.length; i++) {
- status = acpi_ev_address_space_dispatch (rgn_desc, ACPI_READ_ADR_SPACE,
- (ACPI_PHYSICAL_ADDRESS) i, 8,
- (u32 *) (table_data_ptr + i));
+ status = acpi_ex_store (operand[5], (acpi_operand_object *) parameter_node,
+ walk_state);
if (ACPI_FAILURE (status)) {
- goto cleanup;
+ acpi_ex_unload_table (ddb_handle);
}
}
+ return_ACPI_STATUS (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ex_load_op
+ *
+ * PARAMETERS: Obj_desc - Region or Field where the table will be
+ * obtained
+ * Target - Where a handle to the table will be stored
+ * Walk_state - Current state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Load an ACPI table from a field or operation region
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ex_load_op (
+ acpi_operand_object *obj_desc,
+ acpi_operand_object *target,
+ acpi_walk_state *walk_state)
+{
+ acpi_status status;
+ acpi_operand_object *ddb_handle;
+ acpi_operand_object *buffer_desc = NULL;
+ acpi_table_header *table_ptr = NULL;
+ u8 *table_data_ptr;
+ acpi_table_header table_header;
+ u32 i;
+
+
+ ACPI_FUNCTION_TRACE ("Ex_load_op");
+
+
+ /* Object can be either an Op_region or a Field */
+
+ switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+ case ACPI_TYPE_REGION:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Region %p %s\n",
+ obj_desc, acpi_ut_get_type_name (obj_desc->common.type)));
+
+ /* Get the table header */
+
+ table_header.length = 0;
+ for (i = 0; i < sizeof (acpi_table_header); i++) {
+ status = acpi_ev_address_space_dispatch (obj_desc, ACPI_READ,
+ (ACPI_PHYSICAL_ADDRESS) i, 8,
+ (acpi_integer *) ((u8 *) &table_header + i));
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+ }
+
+ /* Allocate a buffer for the entire table */
+
+ table_ptr = ACPI_MEM_ALLOCATE (table_header.length);
+ if (!table_ptr) {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Copy the header to the buffer */
+
+ ACPI_MEMCPY (table_ptr, &table_header, sizeof (acpi_table_header));
+ table_data_ptr = ACPI_PTR_ADD (u8, table_ptr, sizeof (acpi_table_header));
- /* Table must be either an SSDT or a PSDT */
+ /* Get the table from the op region */
- if ((!STRNCMP (table_header.signature,
+ for (i = 0; i < table_header.length; i++) {
+ status = acpi_ev_address_space_dispatch (obj_desc, ACPI_READ,
+ (ACPI_PHYSICAL_ADDRESS) i, 8,
+ (acpi_integer *) (table_data_ptr + i));
+ if (ACPI_FAILURE (status)) {
+ goto cleanup;
+ }
+ }
+ break;
+
+
+ case ACPI_TYPE_BUFFER_FIELD:
+ case INTERNAL_TYPE_REGION_FIELD:
+ case INTERNAL_TYPE_BANK_FIELD:
+ case INTERNAL_TYPE_INDEX_FIELD:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Field %p %s\n",
+ obj_desc, acpi_ut_get_type_name (obj_desc->common.type)));
+
+ /*
+ * The length of the field must be at least as large as the table.
+ * Read the entire field and thus the entire table. Buffer is
+ * allocated during the read.
+ */
+ status = acpi_ex_read_data_from_field (obj_desc, &buffer_desc);
+ if (ACPI_FAILURE (status)) {
+ goto cleanup;
+ }
+
+ table_ptr = (acpi_table_header *) buffer_desc->buffer.pointer;
+ break;
+
+
+ default:
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+
+ /* The table must be either an SSDT or a PSDT */
+
+ if ((!ACPI_STRNCMP (table_ptr->signature,
acpi_gbl_acpi_table_data[ACPI_TABLE_PSDT].signature,
acpi_gbl_acpi_table_data[ACPI_TABLE_PSDT].sig_length)) &&
- (!STRNCMP (table_header.signature,
+ (!ACPI_STRNCMP (table_ptr->signature,
acpi_gbl_acpi_table_data[ACPI_TABLE_SSDT].signature,
acpi_gbl_acpi_table_data[ACPI_TABLE_SSDT].sig_length))) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Table has invalid signature [%4.4s], must be SSDT or PSDT\n",
- (char*)table_header.signature));
+ (char *) &table_ptr->signature));
status = AE_BAD_SIGNATURE;
goto cleanup;
}
- /* Create an object to be the table handle */
-
- table_desc = acpi_ut_create_internal_object (INTERNAL_TYPE_REFERENCE);
- if (!table_desc) {
- status = AE_NO_MEMORY;
- goto cleanup;
- }
-
-
/* Install the new table into the local data structures */
- table_info.pointer = (acpi_table_header *) table_ptr;
- table_info.length = table_header.length;
- table_info.allocation = ACPI_MEM_ALLOCATED;
- table_info.base_pointer = table_ptr;
-
- status = acpi_tb_install_table (NULL, &table_info);
+ status = acpi_ex_add_table (table_ptr, acpi_gbl_root_node, &ddb_handle);
if (ACPI_FAILURE (status)) {
goto cleanup;
}
- /* Add the table to the namespace */
+ /* Store the Ddb_handle into the Target operand */
- /* TBD: [Restructure] - change to whatever new interface is appropriate */
-/*
- Status = Acpi_load_namespace ();
- if (ACPI_FAILURE (Status))
- {
-*/
- /* TBD: [Errors] Unload the table on failure ? */
-/*
- goto Cleanup;
+ status = acpi_ex_store (ddb_handle, target, walk_state);
+ if (ACPI_FAILURE (status)) {
+ acpi_ex_unload_table (ddb_handle);
}
-*/
-
-
- /* TBD: [Investigate] we need a pointer to the table desc */
-
- /* Init the table handle */
-
- table_desc->reference.opcode = AML_LOAD_OP;
- table_desc->reference.object = table_info.installed_desc;
-
- /* TBD: store the tabledesc into the Ddb_handle target */
- /* Ddb_handle = Table_desc; */
return_ACPI_STATUS (status);
cleanup:
- ACPI_MEM_FREE (table_desc);
- ACPI_MEM_FREE (table_ptr);
+ if (buffer_desc) {
+ acpi_ut_remove_reference (buffer_desc);
+ }
+ else {
+ ACPI_MEM_FREE (table_ptr);
+ }
return_ACPI_STATUS (status);
}
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: Acpi_ex_unload_table
*
*
* DESCRIPTION: Unload an ACPI table
*
- ****************************************************************************/
+ ******************************************************************************/
acpi_status
acpi_ex_unload_table (
acpi_table_desc *table_info;
- FUNCTION_TRACE ("Ex_unload_table");
+ ACPI_FUNCTION_TRACE ("Ex_unload_table");
/*
* validated here.
*/
if ((!ddb_handle) ||
- (!VALID_DESCRIPTOR_TYPE (ddb_handle, ACPI_DESC_TYPE_INTERNAL)) ||
+ (ACPI_GET_DESCRIPTOR_TYPE (ddb_handle) != ACPI_DESC_TYPE_INTERNAL) ||
(((acpi_operand_object *)ddb_handle)->common.type !=
INTERNAL_TYPE_REFERENCE)) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
/* Delete the table descriptor (Ddb_handle) */
acpi_ut_remove_reference (table_desc);
-
return_ACPI_STATUS (status);
}
/******************************************************************************
*
* Module Name: exconvrt - Object conversion routines
- * $Revision: 24 $
+ * $Revision: 30 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exconvrt")
+ ACPI_MODULE_NAME ("exconvrt")
/*******************************************************************************
u32 integer_size = sizeof (acpi_integer);
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_TRACE_PTR ("Ex_convert_to_integer", obj_desc);
switch (obj_desc->common.type) {
case ACPI_TYPE_INTEGER:
*result_desc = obj_desc;
- return (AE_OK);
+ return_ACPI_STATUS (AE_OK);
case ACPI_TYPE_STRING:
pointer = obj_desc->string.pointer;
break;
default:
- return (AE_TYPE);
+ return_ACPI_STATUS (AE_TYPE);
}
/*
*/
ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
if (!ret_desc) {
- return (AE_NO_MEMORY);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
-
/* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
if (walk_state->method_node->flags & ANOBJ_DATA_WIDTH_32) {
integer_size = sizeof (u32);
}
-
/*
* Convert the buffer/string to an integer. Note that both buffers and
* strings are treated as raw data - we don't convert ascii to hex for
switch (obj_desc->common.type) {
case ACPI_TYPE_STRING:
- /* TBD: Need to use 64-bit STRTOUL */
+ /* TBD: Need to use 64-bit ACPI_STRTOUL */
/*
* Convert string to an integer
* String must be hexadecimal as per the ACPI specification
*/
- result = STRTOUL (pointer, NULL, 16);
+ result = ACPI_STRTOUL (pointer, NULL, 16);
break;
*/
result |= (((acpi_integer) pointer[i]) << (i * 8));
}
-
break;
}
}
*result_desc = ret_desc;
- return (AE_OK);
+ return_ACPI_STATUS (AE_OK);
}
u8 *new_buf;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_TRACE_PTR ("Ex_convert_to_buffer", obj_desc);
switch (obj_desc->common.type) {
*/
ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
if (!ret_desc) {
- return (AE_NO_MEMORY);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
integer_size = sizeof (u32);
}
- /* Need enough space for one integers */
+ /* Need enough space for one integer */
ret_desc->buffer.length = integer_size;
new_buf = ACPI_MEM_CALLOCATE (integer_size);
if (!new_buf) {
- REPORT_ERROR
+ ACPI_REPORT_ERROR
(("Ex_convert_to_buffer: Buffer allocation failure\n"));
acpi_ut_remove_reference (ret_desc);
- return (AE_NO_MEMORY);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Copy the integer to the buffer */
/* Return the new buffer descriptor */
- if (*result_desc == obj_desc) {
- if (walk_state->opcode != AML_STORE_OP) {
- acpi_ut_remove_reference (obj_desc);
- }
- }
-
*result_desc = ret_desc;
break;
default:
- return (AE_TYPE);
- break;
- }
+ return_ACPI_STATUS (AE_TYPE);
+ }
- return (AE_OK);
+ return_ACPI_STATUS (AE_OK);
}
u8 leading_zero = TRUE;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
switch (base) {
}
if (!leading_zero) {
- string[k] = (u8) (ASCII_ZERO + remainder);
+ string[k] = (u8) (ACPI_ASCII_ZERO + remainder);
k++;
}
}
for (i = 0, j = ((length * 2) -1); i < (length * 2); i++, j--) {
hex_digit = acpi_ut_hex_to_ascii_char (integer, (j * 4));
- if (hex_digit != ASCII_ZERO) {
+ if (hex_digit != ACPI_ASCII_ZERO) {
leading_zero = FALSE;
}
* Finally, null terminate the string and return the length
*/
if (!k) {
- string [0] = ASCII_ZERO;
+ string [0] = ACPI_ASCII_ZERO;
k = 1;
}
string [k] = 0;
u8 *pointer;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_TRACE_PTR ("Ex_convert_to_string", obj_desc);
switch (obj_desc->common.type) {
*/
ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_STRING);
if (!ret_desc) {
- return (AE_NO_MEMORY);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Need enough space for one ASCII integer plus null terminator */
new_buf = ACPI_MEM_CALLOCATE (string_length + 1);
if (!new_buf) {
- REPORT_ERROR
+ ACPI_REPORT_ERROR
(("Ex_convert_to_string: Buffer allocation failure\n"));
acpi_ut_remove_reference (ret_desc);
- return (AE_NO_MEMORY);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
if (max_length > ACPI_MAX_STRING_CONVERSION) {
if (string_length > ACPI_MAX_STRING_CONVERSION) {
- return (AE_AML_STRING_LIMIT);
+ return_ACPI_STATUS (AE_AML_STRING_LIMIT);
}
}
*/
ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_STRING);
if (!ret_desc) {
- return (AE_NO_MEMORY);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
/* String length is the lesser of the Max or the actual length */
new_buf = ACPI_MEM_CALLOCATE (string_length + 1);
if (!new_buf) {
- REPORT_ERROR
+ ACPI_REPORT_ERROR
(("Ex_convert_to_string: Buffer allocation failure\n"));
acpi_ut_remove_reference (ret_desc);
- return (AE_NO_MEMORY);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
/*
new_buf [index-1] = 0;
ret_desc->buffer.pointer = new_buf;
- ret_desc->string.length = STRLEN ((char *) new_buf);
+ ret_desc->string.length = ACPI_STRLEN ((char *) new_buf);
/* Return the new buffer descriptor */
else {
/* Must copy the string first and then truncate it */
- return (AE_NOT_IMPLEMENTED);
+ return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
}
break;
default:
- return (AE_TYPE);
- break;
- }
+ return_ACPI_STATUS (AE_TYPE);
+ }
- return (AE_OK);
+ return_ACPI_STATUS (AE_OK);
}
*
* FUNCTION: Acpi_ex_convert_to_target_type
*
- * PARAMETERS: *Obj_desc - Object to be converted.
- * Walk_state - Current method state
+ * PARAMETERS: Destination_type - Current type of the destination
+ * Source_desc - Source object to be converted.
+ * Walk_state - Current method state
*
* RETURN: Status
*
- * DESCRIPTION:
+ * DESCRIPTION: Implements "implicit conversion" rules for storing an object.
*
******************************************************************************/
acpi_status
acpi_ex_convert_to_target_type (
- acpi_object_type8 destination_type,
- acpi_operand_object **obj_desc,
+ acpi_object_type destination_type,
+ acpi_operand_object *source_desc,
+ acpi_operand_object **result_desc,
acpi_walk_state *walk_state)
{
acpi_status status = AE_OK;
- FUNCTION_TRACE ("Ex_convert_to_target_type");
+ ACPI_FUNCTION_TRACE ("Ex_convert_to_target_type");
+ /* Default behavior */
+
+ *result_desc = source_desc;
+
/*
* If required by the target,
* perform implicit conversion on the source before we store it.
default:
/* No conversion allowed for these types */
- if (destination_type != (*obj_desc)->common.type) {
+ if (destination_type != source_desc->common.type) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Target does not allow conversion of type %s to %s\n",
- acpi_ut_get_type_name ((*obj_desc)->common.type),
+ acpi_ut_get_type_name ((source_desc)->common.type),
acpi_ut_get_type_name (destination_type)));
status = AE_TYPE;
}
* These types require an Integer operand. We can convert
* a Buffer or a String to an Integer if necessary.
*/
- status = acpi_ex_convert_to_integer (*obj_desc, obj_desc, walk_state);
+ status = acpi_ex_convert_to_integer (source_desc, result_desc, walk_state);
break;
* The operand must be a String. We can convert an
* Integer or Buffer if necessary
*/
- status = acpi_ex_convert_to_string (*obj_desc, obj_desc, 16, ACPI_UINT32_MAX, walk_state);
+ status = acpi_ex_convert_to_string (source_desc, result_desc, 16, ACPI_UINT32_MAX, walk_state);
break;
case ACPI_TYPE_BUFFER:
/*
- * The operand must be a String. We can convert an
- * Integer or Buffer if necessary
+ * The operand must be a Buffer. We can convert an
+ * Integer or String if necessary
*/
- status = acpi_ex_convert_to_buffer (*obj_desc, obj_desc, walk_state);
+ status = acpi_ex_convert_to_buffer (source_desc, result_desc, walk_state);
break;
}
break;
/******************************************************************************
*
* Module Name: excreate - Named object creation
- * $Revision: 71 $
+ * $Revision: 89 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acnamesp.h"
#include "acevents.h"
#include "acdispat.h"
+#include "actables.h"
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("excreate")
+ ACPI_MODULE_NAME ("excreate")
/*****************************************************************************
acpi_status status;
- FUNCTION_TRACE ("Ex_create_alias");
+ ACPI_FUNCTION_TRACE ("Ex_create_alias");
/* Get the source/alias operands (both namespace nodes) */
/* Attach the original source object to the new Alias Node */
status = acpi_ns_attach_object ((acpi_namespace_node *) walk_state->operands[0],
- source_node->object,
+ acpi_ns_get_attached_object (source_node),
source_node->type);
/*
acpi_operand_object *obj_desc;
- FUNCTION_TRACE ("Ex_create_event");
+ ACPI_FUNCTION_TRACE ("Ex_create_event");
obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_EVENT);
goto cleanup;
}
- /* Create the actual OS semaphore */
-
- /* TBD: [Investigate] should be created with 0 or 1 units? */
-
- status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, 1,
+ /*
+ * Create the actual OS semaphore, with zero initial units -- meaning
+ * that the event is created in an unsignalled state
+ */
+ status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, 0,
&obj_desc->event.semaphore);
if (ACPI_FAILURE (status)) {
goto cleanup;
/* Attach object to the Node */
status = acpi_ns_attach_object ((acpi_namespace_node *) walk_state->operands[0],
- obj_desc, (u8) ACPI_TYPE_EVENT);
+ obj_desc, ACPI_TYPE_EVENT);
cleanup:
/*
acpi_operand_object *obj_desc;
- FUNCTION_TRACE_PTR ("Ex_create_mutex", WALK_OPERANDS);
+ ACPI_FUNCTION_TRACE_PTR ("Ex_create_mutex", ACPI_WALK_OPERANDS);
/* Create the new mutex object */
goto cleanup;
}
- /* Create the actual OS semaphore */
-
+ /*
+ * Create the actual OS semaphore.
+ * One unit max to make it a mutex, with one initial unit to allow
+ * the mutex to be acquired.
+ */
status = acpi_os_create_semaphore (1, 1, &obj_desc->mutex.semaphore);
if (ACPI_FAILURE (status)) {
goto cleanup;
obj_desc->mutex.sync_level = (u8) walk_state->operands[1]->integer.value;
status = acpi_ns_attach_object ((acpi_namespace_node *) walk_state->operands[0],
- obj_desc, (u8) ACPI_TYPE_MUTEX);
+ obj_desc, ACPI_TYPE_MUTEX);
cleanup:
acpi_status status;
acpi_operand_object *obj_desc;
acpi_namespace_node *node;
+ acpi_operand_object *region_obj2;
- FUNCTION_TRACE ("Ex_create_region");
+ ACPI_FUNCTION_TRACE ("Ex_create_region");
/* Get the Node from the object stack */
- node = (acpi_namespace_node *) walk_state->operands[0];
+ node = walk_state->op->node;
/*
* If the region object is already attached to this node,
* just return
*/
- if (node->object) {
+ if (acpi_ns_get_attached_object (node)) {
return_ACPI_STATUS (AE_OK);
}
* Space ID must be one of the predefined IDs, or in the user-defined
* range
*/
- if ((region_space >= NUM_REGION_TYPES) &&
- (region_space < USER_REGION_BEGIN)) {
- REPORT_ERROR (("Invalid Address_space type %X\n", region_space));
+ if ((region_space >= ACPI_NUM_PREDEFINED_REGIONS) &&
+ (region_space < ACPI_USER_REGION_BEGIN)) {
+ ACPI_REPORT_ERROR (("Invalid Address_space type %X\n", region_space));
return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID);
}
goto cleanup;
}
- /* Allocate a method object for this region */
-
- obj_desc->region.extra = acpi_ut_create_internal_object (
- INTERNAL_TYPE_EXTRA);
- if (!obj_desc->region.extra) {
- status = AE_NO_MEMORY;
- goto cleanup;
- }
-
/*
* Remember location in AML stream of address & length
* operands since they need to be evaluated at run time.
*/
- obj_desc->region.extra->extra.aml_start = aml_start;
- obj_desc->region.extra->extra.aml_length = aml_length;
+ region_obj2 = obj_desc->common.next_object;
+ region_obj2->extra.aml_start = aml_start;
+ region_obj2->extra.aml_length = aml_length;
/* Init the region from the operands */
/* Install the new region object in the parent Node */
- status = acpi_ns_attach_object (node, obj_desc,
- (u8) ACPI_TYPE_REGION);
- if (ACPI_FAILURE (status)) {
- goto cleanup;
- }
+ status = acpi_ns_attach_object (node, obj_desc, ACPI_TYPE_REGION);
- /*
- * If we have a valid region, initialize it
- * Namespace is NOT locked at this point.
- */
- status = acpi_ev_initialize_region (obj_desc, FALSE);
- if (ACPI_FAILURE (status)) {
- /*
- * If AE_NOT_EXIST is returned, it is not fatal
- * because many regions get created before a handler
- * is installed for said region.
- */
- if (AE_NOT_EXIST == status) {
- status = AE_OK;
- }
- }
cleanup:
/* Remove local reference to the object */
acpi_ut_remove_reference (obj_desc);
-
return_ACPI_STATUS (status);
}
acpi_ex_create_table_region (
acpi_walk_state *walk_state)
{
- acpi_status status = AE_OK;
+ acpi_status status;
+ acpi_operand_object **operand = &walk_state->operands[0];
+ acpi_operand_object *obj_desc;
+ acpi_namespace_node *node;
+ acpi_table_header *table;
+ acpi_operand_object *region_obj2;
- FUNCTION_TRACE ("Ex_create_table_region");
+ ACPI_FUNCTION_TRACE ("Ex_create_table_region");
-/*
- acpi_operand_object *Obj_desc;
- Obj_desc = Acpi_ut_create_internal_object (ACPI_TYPE_REGION);
- if (!Obj_desc)
- {
- Status = AE_NO_MEMORY;
- goto Cleanup;
+ /* Get the Node from the object stack */
+
+ node = walk_state->op->node;
+
+ /*
+ * If the region object is already attached to this node,
+ * just return
+ */
+ if (acpi_ns_get_attached_object (node)) {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Find the ACPI table */
+
+ status = acpi_tb_find_table (operand[1]->string.pointer,
+ operand[2]->string.pointer,
+ operand[3]->string.pointer, &table);
+
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
}
+ /* Create the region descriptor */
-Cleanup:
-*/
+ obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_REGION);
+ if (!obj_desc) {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ region_obj2 = obj_desc->common.next_object;
+ region_obj2->extra.region_context = NULL;
+
+ /* Init the region from the operands */
+
+ obj_desc->region.space_id = REGION_DATA_TABLE;
+ obj_desc->region.address = (ACPI_PHYSICAL_ADDRESS) ACPI_TO_INTEGER (table);
+ obj_desc->region.length = table->length;
+ obj_desc->region.node = node;
+ obj_desc->region.flags = AOPOBJ_DATA_VALID;
+
+ /* Install the new region object in the parent Node */
+ status = acpi_ns_attach_object (node, obj_desc, ACPI_TYPE_REGION);
+ if (ACPI_FAILURE (status)) {
+ goto cleanup;
+ }
+
+ status = acpi_ev_initialize_region (obj_desc, FALSE);
+ if (ACPI_FAILURE (status)) {
+ if (status == AE_NOT_EXIST) {
+ status = AE_OK;
+ }
+ else {
+ goto cleanup;
+ }
+ }
+
+ obj_desc->region.flags |= AOPOBJ_SETUP_COMPLETE;
+
+
+cleanup:
+
+ /* Remove local reference to the object */
+
+ acpi_ut_remove_reference (obj_desc);
return_ACPI_STATUS (status);
}
acpi_status status;
- FUNCTION_TRACE_PTR ("Ex_create_processor", walk_state);
+ ACPI_FUNCTION_TRACE_PTR ("Ex_create_processor", walk_state);
/* Create the processor object */
/* Install the processor object in the parent Node */
status = acpi_ns_attach_object ((acpi_namespace_node *) operand[0],
- obj_desc, (u8) ACPI_TYPE_PROCESSOR);
+ obj_desc, ACPI_TYPE_PROCESSOR);
/* Remove local reference to the object */
acpi_operand_object *obj_desc;
- FUNCTION_TRACE_PTR ("Ex_create_power_resource", walk_state);
+ ACPI_FUNCTION_TRACE_PTR ("Ex_create_power_resource", walk_state);
/* Create the power resource object */
/* Install the power resource object in the parent Node */
status = acpi_ns_attach_object ((acpi_namespace_node *) operand[0],
- obj_desc, (u8) ACPI_TYPE_POWER);
+ obj_desc, ACPI_TYPE_POWER);
/* Remove local reference to the object */
u8 method_flags;
- FUNCTION_TRACE_PTR ("Ex_create_method", walk_state);
+ ACPI_FUNCTION_TRACE_PTR ("Ex_create_method", walk_state);
/* Create a new method object */
/* Attach the new object to the method Node */
status = acpi_ns_attach_object ((acpi_namespace_node *) operand[0],
- obj_desc, (u8) ACPI_TYPE_METHOD);
+ obj_desc, ACPI_TYPE_METHOD);
/* Remove local reference to the object */
/******************************************************************************
*
* Module Name: exdump - Interpreter debug output routines
- * $Revision: 126 $
+ * $Revision: 145 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acparser.h"
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exdump")
+ ACPI_MODULE_NAME ("exdump")
/*
u8 *current_aml_ptr = NULL; /* Pointer to current byte of AML value */
- FUNCTION_TRACE ("Ex_show_hex_value");
+ ACPI_FUNCTION_TRACE ("Ex_show_hex_value");
+ if (!((ACPI_LV_LOAD & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) {
+ return;
+ }
+
if (!aml_start) {
- REPORT_ERROR (("Ex_show_hex_value: null pointer\n"));
+ ACPI_REPORT_ERROR (("Ex_show_hex_value: null pointer\n"));
+ return;
}
/*
}
for (length = lead_space; length; --length ) {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_LOAD, " "));
+ acpi_os_printf (" ");
}
while (byte_count--) {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_LOAD, "%02x", *aml_start++));
-
+ acpi_os_printf ("%02x", *aml_start++);
if (byte_count) {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_LOAD, " "));
+ acpi_os_printf (" ");
}
}
if (show_decimal_value) {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_LOAD, " [%d]", value));
+ acpi_os_printf (" [%d]", value);
}
if (0 == lead_space) {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_LOAD, " "));
+ acpi_os_printf (" ");
}
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_LOAD, "\n"));
+ acpi_os_printf ("\n");
return_VOID;
}
*
* FUNCTION: Acpi_ex_dump_operand
*
- * PARAMETERS: *Entry_desc - Pointer to entry to be dumped
+ * PARAMETERS: *Obj_desc - Pointer to entry to be dumped
*
* RETURN: Status
*
- * DESCRIPTION: Dump a stack entry
+ * DESCRIPTION: Dump an operand object
*
****************************************************************************/
acpi_status
acpi_ex_dump_operand (
- acpi_operand_object *entry_desc)
+ acpi_operand_object *obj_desc)
{
u8 *buf = NULL;
u32 length;
u32 i;
- PROC_NAME ("Ex_dump_operand")
+ ACPI_FUNCTION_NAME ("Ex_dump_operand")
+
+ if (!((ACPI_LV_INFO & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) {
+ return (AE_OK);
+ }
- if (!entry_desc) {
+ if (!obj_desc) {
/*
* This usually indicates that something serious is wrong --
* since most (if not all)
return (AE_OK);
}
- if (VALID_DESCRIPTOR_TYPE (entry_desc, ACPI_DESC_TYPE_NAMED)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%p NS Node: ", entry_desc));
- DUMP_ENTRY (entry_desc, ACPI_LV_INFO);
+ if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%p NS Node: ", obj_desc));
+ ACPI_DUMP_ENTRY (obj_desc, ACPI_LV_INFO);
return (AE_OK);
}
- if (!VALID_DESCRIPTOR_TYPE (entry_desc, ACPI_DESC_TYPE_INTERNAL)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%p Is not a local object \n", entry_desc));
- DUMP_BUFFER (entry_desc, sizeof (acpi_operand_object));
+ if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_INTERNAL) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%p is not a local object\n", obj_desc));
+ ACPI_DUMP_BUFFER (obj_desc, sizeof (acpi_operand_object));
return (AE_OK);
}
- /* Entry_desc is a valid object */
+ /* Obj_desc is a valid object */
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%p ", entry_desc));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%p ", obj_desc));
- switch (entry_desc->common.type) {
+ switch (obj_desc->common.type) {
case INTERNAL_TYPE_REFERENCE:
- switch (entry_desc->reference.opcode) {
+ switch (obj_desc->reference.opcode) {
case AML_ZERO_OP:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: Zero\n"));
+ acpi_os_printf ("Reference: Zero\n");
break;
case AML_ONE_OP:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: One\n"));
+ acpi_os_printf ("Reference: One\n");
break;
case AML_ONES_OP:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: Ones\n"));
+ acpi_os_printf ("Reference: Ones\n");
break;
case AML_REVISION_OP:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: Revision\n"));
+ acpi_os_printf ("Reference: Revision\n");
break;
case AML_DEBUG_OP:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: Debug\n"));
+ acpi_os_printf ("Reference: Debug\n");
break;
case AML_NAME_OP:
- DUMP_PATHNAME (entry_desc->reference.object, "Reference: Name: ",
+ ACPI_DUMP_PATHNAME (obj_desc->reference.object, "Reference: Name: ",
ACPI_LV_INFO, _COMPONENT);
- DUMP_ENTRY (entry_desc->reference.object, ACPI_LV_INFO);
+ ACPI_DUMP_ENTRY (obj_desc->reference.object, ACPI_LV_INFO);
break;
case AML_INDEX_OP:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: Index %p\n",
- entry_desc->reference.object));
+ acpi_os_printf ("Reference: Index %p\n",
+ obj_desc->reference.object);
break;
case AML_ARG_OP:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: Arg%d",
- entry_desc->reference.offset));
+ acpi_os_printf ("Reference: Arg%d",
+ obj_desc->reference.offset);
- if (ACPI_TYPE_INTEGER == entry_desc->common.type) {
+ if (ACPI_TYPE_INTEGER == obj_desc->common.type) {
/* Value is a Number */
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, " value is [%8.8X%8.8x]",
- HIDWORD(entry_desc->integer.value),
- LODWORD(entry_desc->integer.value)));
+ acpi_os_printf (" value is [%8.8X%8.8x]",
+ ACPI_HIDWORD(obj_desc->integer.value),
+ ACPI_LODWORD(obj_desc->integer.value));
}
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\n"));
+ acpi_os_printf ("\n");
break;
case AML_LOCAL_OP:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: Local%d",
- entry_desc->reference.offset));
+ acpi_os_printf ("Reference: Local%d",
+ obj_desc->reference.offset);
- if (ACPI_TYPE_INTEGER == entry_desc->common.type) {
+ if (ACPI_TYPE_INTEGER == obj_desc->common.type) {
/* Value is a Number */
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, " value is [%8.8X%8.8x]",
- HIDWORD(entry_desc->integer.value),
- LODWORD(entry_desc->integer.value)));
+ acpi_os_printf (" value is [%8.8X%8.8x]",
+ ACPI_HIDWORD(obj_desc->integer.value),
+ ACPI_LODWORD(obj_desc->integer.value));
}
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\n"));
+ acpi_os_printf ("\n");
break;
case AML_INT_NAMEPATH_OP:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference.Node->Name %X\n",
- entry_desc->reference.node->name));
+ acpi_os_printf ("Reference.Node->Name %X\n",
+ obj_desc->reference.node->name);
break;
default:
/* unknown opcode */
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Unknown opcode=%X\n",
- entry_desc->reference.opcode));
+ acpi_os_printf ("Unknown opcode=%X\n",
+ obj_desc->reference.opcode);
break;
}
case ACPI_TYPE_BUFFER:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Buffer len %X @ %p \n",
- entry_desc->buffer.length,
- entry_desc->buffer.pointer));
+ acpi_os_printf ("Buffer len %X @ %p \n",
+ obj_desc->buffer.length,
+ obj_desc->buffer.pointer);
- length = entry_desc->buffer.length;
+ length = obj_desc->buffer.length;
if (length > 64) {
length = 64;
/* Debug only -- dump the buffer contents */
- if (entry_desc->buffer.pointer) {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Buffer Contents: "));
+ if (obj_desc->buffer.pointer) {
+ acpi_os_printf ("Buffer Contents: ");
- for (buf = entry_desc->buffer.pointer; length--; ++buf) {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, " %02x", *buf));
+ for (buf = obj_desc->buffer.pointer; length--; ++buf) {
+ acpi_os_printf (" %02x", *buf);
}
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO,"\n"));
+ acpi_os_printf ("\n");
}
break;
case ACPI_TYPE_INTEGER:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Integer %8.8X%8.8X\n",
- HIDWORD (entry_desc->integer.value),
- LODWORD (entry_desc->integer.value)));
+ acpi_os_printf ("Integer %8.8X%8.8X\n",
+ ACPI_HIDWORD (obj_desc->integer.value),
+ ACPI_LODWORD (obj_desc->integer.value));
break;
case INTERNAL_TYPE_IF:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "If [Integer] %8.8X%8.8X\n",
- HIDWORD (entry_desc->integer.value),
- LODWORD (entry_desc->integer.value)));
+ acpi_os_printf ("If [Integer] %8.8X%8.8X\n",
+ ACPI_HIDWORD (obj_desc->integer.value),
+ ACPI_LODWORD (obj_desc->integer.value));
break;
case INTERNAL_TYPE_WHILE:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "While [Integer] %8.8X%8.8X\n",
- HIDWORD (entry_desc->integer.value),
- LODWORD (entry_desc->integer.value)));
+ acpi_os_printf ("While [Integer] %8.8X%8.8X\n",
+ ACPI_HIDWORD (obj_desc->integer.value),
+ ACPI_LODWORD (obj_desc->integer.value));
break;
case ACPI_TYPE_PACKAGE:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Package count %X @ %p\n",
- entry_desc->package.count, entry_desc->package.elements));
+ acpi_os_printf ("Package count %X @ %p\n",
+ obj_desc->package.count, obj_desc->package.elements);
/*
* If elements exist, package vector pointer is valid,
* and debug_level exceeds 1, dump package's elements.
*/
- if (entry_desc->package.count &&
- entry_desc->package.elements &&
+ if (obj_desc->package.count &&
+ obj_desc->package.elements &&
acpi_dbg_level > 1) {
acpi_operand_object**element;
u16 element_index;
- for (element_index = 0, element = entry_desc->package.elements;
- element_index < entry_desc->package.count;
+ for (element_index = 0, element = obj_desc->package.elements;
+ element_index < obj_desc->package.count;
++element_index, ++element) {
acpi_ex_dump_operand (*element);
}
}
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\n"));
+ acpi_os_printf ("\n");
break;
case ACPI_TYPE_REGION:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Region %s (%X)",
- acpi_ut_get_region_name (entry_desc->region.space_id),
- entry_desc->region.space_id));
+ acpi_os_printf ("Region %s (%X)",
+ acpi_ut_get_region_name (obj_desc->region.space_id),
+ obj_desc->region.space_id);
/*
* If the address and length have not been evaluated,
* don't print them.
*/
- if (!(entry_desc->region.flags & AOPOBJ_DATA_VALID)) {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\n"));
+ if (!(obj_desc->region.flags & AOPOBJ_DATA_VALID)) {
+ acpi_os_printf ("\n");
}
else {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, " base %8.8X%8.8X Length %X\n",
- HIDWORD(entry_desc->region.address),
- LODWORD(entry_desc->region.address),
- entry_desc->region.length));
+ acpi_os_printf (" base %8.8X%8.8X Length %X\n",
+ ACPI_HIDWORD (obj_desc->region.address),
+ ACPI_LODWORD (obj_desc->region.address),
+ obj_desc->region.length);
}
break;
case ACPI_TYPE_STRING:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "String length %X @ %p \"",
- entry_desc->string.length, entry_desc->string.pointer));
+ acpi_os_printf ("String length %X @ %p \"",
+ obj_desc->string.length, obj_desc->string.pointer);
- for (i = 0; i < entry_desc->string.length; i++) {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "%c",
- entry_desc->string.pointer[i]));
+ for (i = 0; i < obj_desc->string.length; i++) {
+ acpi_os_printf ("%c",
+ obj_desc->string.pointer[i]);
}
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\"\n"));
+ acpi_os_printf ("\"\n");
break;
case INTERNAL_TYPE_BANK_FIELD:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Bank_field\n"));
+ acpi_os_printf ("Bank_field\n");
break;
case INTERNAL_TYPE_REGION_FIELD:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO,
- "Region_field: bits=%X bitaccwidth=%X lock=%X update=%X at byte=%X bit=%X of below:\n",
- entry_desc->field.bit_length, entry_desc->field.access_bit_width,
- entry_desc->field.lock_rule, entry_desc->field.update_rule,
- entry_desc->field.base_byte_offset, entry_desc->field.start_field_bit_offset));
- DUMP_STACK_ENTRY (entry_desc->field.region_obj);
+ acpi_os_printf (
+ "Region_field: Bits=%X Acc_width=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n",
+ obj_desc->field.bit_length, obj_desc->field.access_byte_width,
+ obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK,
+ obj_desc->field.field_flags & AML_FIELD_UPDATE_RULE_MASK,
+ obj_desc->field.base_byte_offset, obj_desc->field.start_field_bit_offset);
+ ACPI_DUMP_STACK_ENTRY (obj_desc->field.region_obj);
break;
case INTERNAL_TYPE_INDEX_FIELD:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Index_field\n"));
+ acpi_os_printf ("Index_field\n");
break;
case ACPI_TYPE_BUFFER_FIELD:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO,
+ acpi_os_printf (
"Buffer_field: %X bits at byte %X bit %X of \n",
- entry_desc->buffer_field.bit_length, entry_desc->buffer_field.base_byte_offset,
- entry_desc->buffer_field.start_field_bit_offset));
+ obj_desc->buffer_field.bit_length, obj_desc->buffer_field.base_byte_offset,
+ obj_desc->buffer_field.start_field_bit_offset);
- if (!entry_desc->buffer_field.buffer_obj)
+ if (!obj_desc->buffer_field.buffer_obj)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "*NULL* \n"));
}
else if (ACPI_TYPE_BUFFER !=
- entry_desc->buffer_field.buffer_obj->common.type)
+ obj_desc->buffer_field.buffer_obj->common.type)
{
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "*not a Buffer* \n"));
+ acpi_os_printf ("*not a Buffer* \n");
}
else
{
- DUMP_STACK_ENTRY (entry_desc->buffer_field.buffer_obj);
+ ACPI_DUMP_STACK_ENTRY (obj_desc->buffer_field.buffer_obj);
}
break;
case ACPI_TYPE_EVENT:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Event\n"));
+ acpi_os_printf ("Event\n");
break;
case ACPI_TYPE_METHOD:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO,
+ acpi_os_printf (
"Method(%X) @ %p:%X\n",
- entry_desc->method.param_count,
- entry_desc->method.aml_start, entry_desc->method.aml_length));
+ obj_desc->method.param_count,
+ obj_desc->method.aml_start, obj_desc->method.aml_length);
break;
case ACPI_TYPE_MUTEX:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Mutex\n"));
+ acpi_os_printf ("Mutex\n");
break;
case ACPI_TYPE_DEVICE:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Device\n"));
+ acpi_os_printf ("Device\n");
break;
case ACPI_TYPE_POWER:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Power\n"));
+ acpi_os_printf ("Power\n");
break;
case ACPI_TYPE_PROCESSOR:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Processor\n"));
+ acpi_os_printf ("Processor\n");
break;
case ACPI_TYPE_THERMAL:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Thermal\n"));
+ acpi_os_printf ("Thermal\n");
break;
default:
- /* unknown Entry_desc->Common.Type value */
+ /* unknown Obj_desc->Common.Type value */
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Unknown Type %X\n",
- entry_desc->common.type));
-
- /* Back up to previous entry */
-
- entry_desc--;
-
-
- /* TBD: [Restructure] Change to use dump object routine !! */
- /* What is all of this?? */
-
- DUMP_BUFFER (entry_desc, sizeof (acpi_operand_object));
- DUMP_BUFFER (++entry_desc, sizeof (acpi_operand_object));
- DUMP_BUFFER (++entry_desc, sizeof (acpi_operand_object));
+ acpi_os_printf ("Unknown Type %X\n", obj_desc->common.type);
break;
-
}
return (AE_OK);
void
acpi_ex_dump_operands (
acpi_operand_object **operands,
- operating_mode interpreter_mode,
+ acpi_interpreter_mode interpreter_mode,
NATIVE_CHAR *ident,
u32 num_levels,
NATIVE_CHAR *note,
u32 line_number)
{
NATIVE_UINT i;
- acpi_operand_object **entry_desc;
+ acpi_operand_object **obj_desc;
- PROC_NAME ("Ex_dump_operands");
+ ACPI_FUNCTION_NAME ("Ex_dump_operands");
if (!ident)
for (i = 0; num_levels > 0; i--, num_levels--)
{
- entry_desc = &operands[i];
+ obj_desc = &operands[i];
- if (ACPI_FAILURE (acpi_ex_dump_operand (*entry_desc)))
+ if (ACPI_FAILURE (acpi_ex_dump_operand (*obj_desc)))
{
break;
}
}
+/*****************************************************************************
+ *
+ * FUNCTION: Acpi_ex_out*
+ *
+ * PARAMETERS: Title - Descriptive text
+ * Value - Value to be displayed
+ *
+ * DESCRIPTION: Object dump output formatting functions. These functions
+ * reduce the number of format strings required and keeps them
+ * all in one place for easy modification.
+ *
+ ****************************************************************************/
+
+void
+acpi_ex_out_string (
+ char *title,
+ char *value)
+{
+ acpi_os_printf ("%20s : %s\n", title, value);
+}
+
+void
+acpi_ex_out_pointer (
+ char *title,
+ void *value)
+{
+ acpi_os_printf ("%20s : %p\n", title, value);
+}
+
+void
+acpi_ex_out_integer (
+ char *title,
+ u32 value)
+{
+ acpi_os_printf ("%20s : %X\n", title, value);
+}
+
+void
+acpi_ex_out_address (
+ char *title,
+ ACPI_PHYSICAL_ADDRESS value)
+{
+#ifdef _IA16
+ acpi_os_printf ("%20s : %p\n", title, value);
+#else
+ acpi_os_printf ("%20s : %8.8X%8.8X\n", title,
+ ACPI_HIDWORD (value), ACPI_LODWORD (value));
+#endif
+}
+
+
/*****************************************************************************
*
* FUNCTION: Acpi_ex_dump_node
u32 flags)
{
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
if (!flags)
}
- acpi_os_printf ("%20s : %4.4s\n", "Name", (char*)&node->name);
- acpi_os_printf ("%20s : %s\n", "Type", acpi_ut_get_type_name (node->type));
- acpi_os_printf ("%20s : %X\n", "Flags", node->flags);
- acpi_os_printf ("%20s : %X\n", "Owner Id", node->owner_id);
- acpi_os_printf ("%20s : %X\n", "Reference Count", node->reference_count);
- acpi_os_printf ("%20s : %p\n", "Attached Object", node->object);
- acpi_os_printf ("%20s : %p\n", "Child_list", node->child);
- acpi_os_printf ("%20s : %p\n", "Next_peer", node->peer);
- acpi_os_printf ("%20s : %p\n", "Parent", acpi_ns_get_parent_object (node));
+ acpi_os_printf ("%20s : %4.4s\n", "Name", (char *) &node->name);
+ acpi_ex_out_string ("Type", acpi_ut_get_type_name (node->type));
+ acpi_ex_out_integer ("Flags", node->flags);
+ acpi_ex_out_integer ("Owner Id", node->owner_id);
+ acpi_ex_out_integer ("Reference Count", node->reference_count);
+ acpi_ex_out_pointer ("Attached Object", acpi_ns_get_attached_object (node));
+ acpi_ex_out_pointer ("Child_list", node->child);
+ acpi_ex_out_pointer ("Next_peer", node->peer);
+ acpi_ex_out_pointer ("Parent", acpi_ns_get_parent_node (node));
}
acpi_operand_object *obj_desc,
u32 flags)
{
- const acpi_opcode_info *op_info;
+ u32 i;
- FUNCTION_TRACE ("Ex_dump_object_descriptor");
+ ACPI_FUNCTION_TRACE ("Ex_dump_object_descriptor");
if (!flags)
}
}
- if (!(VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_INTERNAL)))
+ if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_INTERNAL)
{
- acpi_os_printf ("%p is not a valid ACPI object\n", obj_desc);
+ acpi_os_printf ("Ex_dump_object_descriptor: %p is not a valid ACPI object\n", obj_desc);
return;
}
/* Common Fields */
- acpi_os_printf ("%20s : %X\n", "Reference Count", obj_desc->common.reference_count);
- acpi_os_printf ("%20s : %X\n", "Flags", obj_desc->common.flags);
+ acpi_ex_out_string ("Type", acpi_ut_get_type_name (obj_desc->common.type));
+ acpi_ex_out_integer ("Reference Count", obj_desc->common.reference_count);
+ acpi_ex_out_integer ("Flags", obj_desc->common.flags);
/* Object-specific Fields */
{
case ACPI_TYPE_INTEGER:
- acpi_os_printf ("%20s : %s\n", "Type", "Integer");
- acpi_os_printf ("%20s : %X%8.8X\n", "Value", HIDWORD (obj_desc->integer.value),
- LODWORD (obj_desc->integer.value));
+ acpi_os_printf ("%20s : %X%8.8X\n", "Value",
+ ACPI_HIDWORD (obj_desc->integer.value),
+ ACPI_LODWORD (obj_desc->integer.value));
break;
case ACPI_TYPE_STRING:
- acpi_os_printf ("%20s : %s\n", "Type", "String");
- acpi_os_printf ("%20s : %X\n", "Length", obj_desc->string.length);
- acpi_os_printf ("%20s : %p\n", "Pointer", obj_desc->string.pointer);
+ acpi_ex_out_integer ("Length", obj_desc->string.length);
+ acpi_ex_out_pointer ("Pointer", obj_desc->string.pointer);
break;
case ACPI_TYPE_BUFFER:
- acpi_os_printf ("%20s : %s\n", "Type", "Buffer");
- acpi_os_printf ("%20s : %X\n", "Length", obj_desc->buffer.length);
- acpi_os_printf ("%20s : %p\n", "Pointer", obj_desc->buffer.pointer);
+ acpi_ex_out_integer ("Length", obj_desc->buffer.length);
+ acpi_ex_out_pointer ("Pointer", obj_desc->buffer.pointer);
break;
case ACPI_TYPE_PACKAGE:
- acpi_os_printf ("%20s : %s\n", "Type", "Package");
- acpi_os_printf ("%20s : %X\n", "Flags", obj_desc->package.flags);
- acpi_os_printf ("%20s : %X\n", "Count", obj_desc->package.count);
- acpi_os_printf ("%20s : %p\n", "Elements", obj_desc->package.elements);
- acpi_os_printf ("%20s : %p\n", "Next_element", obj_desc->package.next_element);
- break;
-
+ acpi_ex_out_integer ("Flags", obj_desc->package.flags);
+ acpi_ex_out_integer ("Count", obj_desc->package.count);
+ acpi_ex_out_pointer ("Elements", obj_desc->package.elements);
+ acpi_ex_out_pointer ("Next_element", obj_desc->package.next_element);
- case ACPI_TYPE_BUFFER_FIELD:
+ /* Dump the package contents */
- acpi_os_printf ("%20s : %s\n", "Type", "Buffer_field");
- acpi_os_printf ("%20s : %X\n", "Bit_length", obj_desc->buffer_field.bit_length);
- acpi_os_printf ("%20s : %X\n", "Bit_offset", obj_desc->buffer_field.start_field_bit_offset);
- acpi_os_printf ("%20s : %X\n", "Base_byte_offset",obj_desc->buffer_field.base_byte_offset);
- acpi_os_printf ("%20s : %p\n", "Buffer_obj", obj_desc->buffer_field.buffer_obj);
+ if (obj_desc->package.count > 0)
+ {
+ acpi_os_printf ("\n_package Contents:\n");
+ for (i = 0; i < obj_desc->package.count; i++)
+ {
+ acpi_os_printf ("[%.3d] %p", i, obj_desc->package.elements[i]);
+ if (obj_desc->package.elements[i])
+ {
+ acpi_os_printf (" %s", acpi_ut_get_type_name ((obj_desc->package.elements[i])->common.type));
+ }
+ acpi_os_printf ("\n");
+ }
+ }
break;
case ACPI_TYPE_DEVICE:
- acpi_os_printf ("%20s : %s\n", "Type", "Device");
- acpi_os_printf ("%20s : %p\n", "Addr_handler", obj_desc->device.addr_handler);
- acpi_os_printf ("%20s : %p\n", "Sys_handler", obj_desc->device.sys_handler);
- acpi_os_printf ("%20s : %p\n", "Drv_handler", obj_desc->device.drv_handler);
+ acpi_ex_out_pointer ("Addr_handler", obj_desc->device.addr_handler);
+ acpi_ex_out_pointer ("Sys_handler", obj_desc->device.sys_handler);
+ acpi_ex_out_pointer ("Drv_handler", obj_desc->device.drv_handler);
break;
+
case ACPI_TYPE_EVENT:
- acpi_os_printf ("%20s : %s\n", "Type", "Event");
- acpi_os_printf ("%20s : %X\n", "Semaphore", obj_desc->event.semaphore);
+ acpi_ex_out_pointer ("Semaphore", obj_desc->event.semaphore);
break;
case ACPI_TYPE_METHOD:
- acpi_os_printf ("%20s : %s\n", "Type", "Method");
- acpi_os_printf ("%20s : %X\n", "Param_count", obj_desc->method.param_count);
- acpi_os_printf ("%20s : %X\n", "Concurrency", obj_desc->method.concurrency);
- acpi_os_printf ("%20s : %p\n", "Semaphore", obj_desc->method.semaphore);
- acpi_os_printf ("%20s : %X\n", "Aml_length", obj_desc->method.aml_length);
- acpi_os_printf ("%20s : %X\n", "Aml_start", obj_desc->method.aml_start);
+ acpi_ex_out_integer ("Param_count", obj_desc->method.param_count);
+ acpi_ex_out_integer ("Concurrency", obj_desc->method.concurrency);
+ acpi_ex_out_pointer ("Semaphore", obj_desc->method.semaphore);
+ acpi_ex_out_integer ("Owning_id", obj_desc->method.owning_id);
+ acpi_ex_out_integer ("Aml_length", obj_desc->method.aml_length);
+ acpi_ex_out_pointer ("Aml_start", obj_desc->method.aml_start);
break;
case ACPI_TYPE_MUTEX:
- acpi_os_printf ("%20s : %s\n", "Type", "Mutex");
- acpi_os_printf ("%20s : %X\n", "Sync_level", obj_desc->mutex.sync_level);
- acpi_os_printf ("%20s : %p\n", "Owner", obj_desc->mutex.owner);
- acpi_os_printf ("%20s : %X\n", "Acquisition_depth", obj_desc->mutex.acquisition_depth);
- acpi_os_printf ("%20s : %p\n", "Semaphore", obj_desc->mutex.semaphore);
+ acpi_ex_out_integer ("Sync_level", obj_desc->mutex.sync_level);
+ acpi_ex_out_pointer ("Owner_thread", obj_desc->mutex.owner_thread);
+ acpi_ex_out_integer ("Acquisition_depth",obj_desc->mutex.acquisition_depth);
+ acpi_ex_out_pointer ("Semaphore", obj_desc->mutex.semaphore);
break;
case ACPI_TYPE_REGION:
- acpi_os_printf ("%20s : %s\n", "Type", "Region");
- acpi_os_printf ("%20s : %X\n", "Space_id", obj_desc->region.space_id);
- acpi_os_printf ("%20s : %X\n", "Flags", obj_desc->region.flags);
- acpi_os_printf ("%20s : %X\n", "Address", obj_desc->region.address);
- acpi_os_printf ("%20s : %X\n", "Length", obj_desc->region.length);
- acpi_os_printf ("%20s : %p\n", "Addr_handler", obj_desc->region.addr_handler);
- acpi_os_printf ("%20s : %p\n", "Next", obj_desc->region.next);
+ acpi_ex_out_integer ("Space_id", obj_desc->region.space_id);
+ acpi_ex_out_integer ("Flags", obj_desc->region.flags);
+ acpi_ex_out_address ("Address", obj_desc->region.address);
+ acpi_ex_out_integer ("Length", obj_desc->region.length);
+ acpi_ex_out_pointer ("Addr_handler", obj_desc->region.addr_handler);
+ acpi_ex_out_pointer ("Next", obj_desc->region.next);
break;
case ACPI_TYPE_POWER:
- acpi_os_printf ("%20s : %s\n", "Type", "Power_resource");
- acpi_os_printf ("%20s : %X\n", "System_level", obj_desc->power_resource.system_level);
- acpi_os_printf ("%20s : %X\n", "Resource_order", obj_desc->power_resource.resource_order);
- acpi_os_printf ("%20s : %p\n", "Sys_handler", obj_desc->power_resource.sys_handler);
- acpi_os_printf ("%20s : %p\n", "Drv_handler", obj_desc->power_resource.drv_handler);
+ acpi_ex_out_integer ("System_level", obj_desc->power_resource.system_level);
+ acpi_ex_out_integer ("Resource_order", obj_desc->power_resource.resource_order);
+ acpi_ex_out_pointer ("Sys_handler", obj_desc->power_resource.sys_handler);
+ acpi_ex_out_pointer ("Drv_handler", obj_desc->power_resource.drv_handler);
break;
case ACPI_TYPE_PROCESSOR:
- acpi_os_printf ("%20s : %s\n", "Type", "Processor");
- acpi_os_printf ("%20s : %X\n", "Processor ID", obj_desc->processor.proc_id);
- acpi_os_printf ("%20s : %X\n", "Length", obj_desc->processor.length);
- acpi_os_printf ("%20s : %X\n", "Address", obj_desc->processor.address);
- acpi_os_printf ("%20s : %p\n", "Sys_handler", obj_desc->processor.sys_handler);
- acpi_os_printf ("%20s : %p\n", "Drv_handler", obj_desc->processor.drv_handler);
- acpi_os_printf ("%20s : %p\n", "Addr_handler", obj_desc->processor.addr_handler);
+ acpi_ex_out_integer ("Processor ID", obj_desc->processor.proc_id);
+ acpi_ex_out_integer ("Length", obj_desc->processor.length);
+ acpi_ex_out_integer ("Address", obj_desc->processor.address);
+ acpi_ex_out_pointer ("Sys_handler", obj_desc->processor.sys_handler);
+ acpi_ex_out_pointer ("Drv_handler", obj_desc->processor.drv_handler);
+ acpi_ex_out_pointer ("Addr_handler", obj_desc->processor.addr_handler);
break;
case ACPI_TYPE_THERMAL:
- acpi_os_printf ("%20s : %s\n", "Type", "Thermal_zone");
- acpi_os_printf ("%20s : %p\n", "Sys_handler", obj_desc->thermal_zone.sys_handler);
- acpi_os_printf ("%20s : %p\n", "Drv_handler", obj_desc->thermal_zone.drv_handler);
- acpi_os_printf ("%20s : %p\n", "Addr_handler", obj_desc->thermal_zone.addr_handler);
+ acpi_ex_out_pointer ("Sys_handler", obj_desc->thermal_zone.sys_handler);
+ acpi_ex_out_pointer ("Drv_handler", obj_desc->thermal_zone.drv_handler);
+ acpi_ex_out_pointer ("Addr_handler", obj_desc->thermal_zone.addr_handler);
break;
+ case ACPI_TYPE_BUFFER_FIELD:
case INTERNAL_TYPE_REGION_FIELD:
-
- acpi_os_printf ("%20s : %p\n", "Access_bit_width", obj_desc->field.access_bit_width);
- acpi_os_printf ("%20s : %p\n", "Bit_length", obj_desc->field.bit_length);
- acpi_os_printf ("%20s : %p\n", "Base_byte_offset",obj_desc->field.base_byte_offset);
- acpi_os_printf ("%20s : %p\n", "Bit_offset", obj_desc->field.start_field_bit_offset);
- acpi_os_printf ("%20s : %p\n", "Region_obj", obj_desc->field.region_obj);
- break;
-
-
case INTERNAL_TYPE_BANK_FIELD:
+ case INTERNAL_TYPE_INDEX_FIELD:
- acpi_os_printf ("%20s : %s\n", "Type", "Bank_field");
- acpi_os_printf ("%20s : %X\n", "Access_bit_width", obj_desc->bank_field.access_bit_width);
- acpi_os_printf ("%20s : %X\n", "Lock_rule", obj_desc->bank_field.lock_rule);
- acpi_os_printf ("%20s : %X\n", "Update_rule", obj_desc->bank_field.update_rule);
- acpi_os_printf ("%20s : %X\n", "Bit_length", obj_desc->bank_field.bit_length);
- acpi_os_printf ("%20s : %X\n", "Bit_offset", obj_desc->bank_field.start_field_bit_offset);
- acpi_os_printf ("%20s : %X\n", "Base_byte_offset", obj_desc->bank_field.base_byte_offset);
- acpi_os_printf ("%20s : %X\n", "Value", obj_desc->bank_field.value);
- acpi_os_printf ("%20s : %p\n", "Region_obj", obj_desc->bank_field.region_obj);
- acpi_os_printf ("%20s : %X\n", "Bank_register_obj", obj_desc->bank_field.bank_register_obj);
- break;
+ acpi_ex_out_integer ("Field_flags", obj_desc->common_field.field_flags);
+ acpi_ex_out_integer ("Access_byte_width", obj_desc->common_field.access_byte_width);
+ acpi_ex_out_integer ("Bit_length", obj_desc->common_field.bit_length);
+ acpi_ex_out_integer ("Fld_bit_offset", obj_desc->common_field.start_field_bit_offset);
+ acpi_ex_out_integer ("Base_byte_offset", obj_desc->common_field.base_byte_offset);
+ acpi_ex_out_integer ("Datum_valid_bits", obj_desc->common_field.datum_valid_bits);
+ acpi_ex_out_integer ("End_fld_valid_bits", obj_desc->common_field.end_field_valid_bits);
+ acpi_ex_out_integer ("End_buf_valid_bits", obj_desc->common_field.end_buffer_valid_bits);
+ acpi_ex_out_pointer ("Parent_node", obj_desc->common_field.node);
+
+ switch (obj_desc->common.type)
+ {
+ case ACPI_TYPE_BUFFER_FIELD:
+ acpi_ex_out_pointer ("Buffer_obj", obj_desc->buffer_field.buffer_obj);
+ break;
+ case INTERNAL_TYPE_REGION_FIELD:
+ acpi_ex_out_pointer ("Region_obj", obj_desc->field.region_obj);
+ break;
- case INTERNAL_TYPE_INDEX_FIELD:
+ case INTERNAL_TYPE_BANK_FIELD:
+ acpi_ex_out_integer ("Value", obj_desc->bank_field.value);
+ acpi_ex_out_pointer ("Region_obj", obj_desc->bank_field.region_obj);
+ acpi_ex_out_pointer ("Bank_obj", obj_desc->bank_field.bank_obj);
+ break;
- acpi_os_printf ("%20s : %s\n", "Type", "Index_field");
- acpi_os_printf ("%20s : %X\n", "Access_bit_width", obj_desc->index_field.access_bit_width);
- acpi_os_printf ("%20s : %X\n", "Lock_rule", obj_desc->index_field.lock_rule);
- acpi_os_printf ("%20s : %X\n", "Update_rule", obj_desc->index_field.update_rule);
- acpi_os_printf ("%20s : %X\n", "Bit_length", obj_desc->index_field.bit_length);
- acpi_os_printf ("%20s : %X\n", "Bit_offset", obj_desc->index_field.start_field_bit_offset);
- acpi_os_printf ("%20s : %X\n", "Value", obj_desc->index_field.value);
- acpi_os_printf ("%20s : %X\n", "Index", obj_desc->index_field.index_obj);
- acpi_os_printf ("%20s : %X\n", "Data", obj_desc->index_field.data_obj);
+ case INTERNAL_TYPE_INDEX_FIELD:
+ acpi_ex_out_integer ("Value", obj_desc->index_field.value);
+ acpi_ex_out_pointer ("Index", obj_desc->index_field.index_obj);
+ acpi_ex_out_pointer ("Data", obj_desc->index_field.data_obj);
+ break;
+ }
break;
case INTERNAL_TYPE_REFERENCE:
- op_info = acpi_ps_get_opcode_info (obj_desc->reference.opcode);
-
- acpi_os_printf ("%20s : %s\n", "Type", "Reference");
- acpi_os_printf ("%20s : %X\n", "Target_type", obj_desc->reference.target_type);
- acpi_os_printf ("%20s : %s\n", "Opcode", op_info->name);
- acpi_os_printf ("%20s : %X\n", "Offset", obj_desc->reference.offset);
- acpi_os_printf ("%20s : %p\n", "Obj_desc", obj_desc->reference.object);
- acpi_os_printf ("%20s : %p\n", "Node", obj_desc->reference.node);
- acpi_os_printf ("%20s : %p\n", "Where", obj_desc->reference.where);
+ acpi_ex_out_integer ("Target_type", obj_desc->reference.target_type);
+ acpi_ex_out_string ("Opcode", (acpi_ps_get_opcode_info (obj_desc->reference.opcode))->name);
+ acpi_ex_out_integer ("Offset", obj_desc->reference.offset);
+ acpi_ex_out_pointer ("Obj_desc", obj_desc->reference.object);
+ acpi_ex_out_pointer ("Node", obj_desc->reference.node);
+ acpi_ex_out_pointer ("Where", obj_desc->reference.where);
break;
case INTERNAL_TYPE_ADDRESS_HANDLER:
- acpi_os_printf ("%20s : %s\n", "Type", "Address Handler");
- acpi_os_printf ("%20s : %X\n", "Space_id", obj_desc->addr_handler.space_id);
- acpi_os_printf ("%20s : %p\n", "Next", obj_desc->addr_handler.next);
- acpi_os_printf ("%20s : %p\n", "Region_list", obj_desc->addr_handler.region_list);
- acpi_os_printf ("%20s : %p\n", "Node", obj_desc->addr_handler.node);
- acpi_os_printf ("%20s : %p\n", "Handler", obj_desc->addr_handler.handler);
- acpi_os_printf ("%20s : %p\n", "Context", obj_desc->addr_handler.context);
+ acpi_ex_out_integer ("Space_id", obj_desc->addr_handler.space_id);
+ acpi_ex_out_pointer ("Next", obj_desc->addr_handler.next);
+ acpi_ex_out_pointer ("Region_list", obj_desc->addr_handler.region_list);
+ acpi_ex_out_pointer ("Node", obj_desc->addr_handler.node);
+ acpi_ex_out_pointer ("Context", obj_desc->addr_handler.context);
break;
case INTERNAL_TYPE_NOTIFY:
- acpi_os_printf ("%20s : %s\n", "Type", "Notify Handler");
- acpi_os_printf ("%20s : %p\n", "Node", obj_desc->notify_handler.node);
- acpi_os_printf ("%20s : %p\n", "Handler", obj_desc->notify_handler.handler);
- acpi_os_printf ("%20s : %p\n", "Context", obj_desc->notify_handler.context);
+ acpi_ex_out_pointer ("Node", obj_desc->notify_handler.node);
+ acpi_ex_out_pointer ("Context", obj_desc->notify_handler.context);
break;
case INTERNAL_TYPE_WHILE:
case INTERNAL_TYPE_SCOPE:
case INTERNAL_TYPE_DEF_ANY:
+ case INTERNAL_TYPE_EXTRA:
+ case INTERNAL_TYPE_DATA:
- acpi_os_printf ("*** Structure display not implemented for type %X! ***\n",
+ acpi_os_printf ("Ex_dump_object_descriptor: Display not implemented for object type %X\n",
obj_desc->common.type);
break;
default:
- acpi_os_printf ("*** Cannot display unknown type %X! ***\n", obj_desc->common.type);
+ acpi_os_printf ("Ex_dump_object_descriptor: Unknown object type %X\n", obj_desc->common.type);
break;
}
/******************************************************************************
*
* Module Name: exfield - ACPI AML (p-code) execution - field manipulation
- * $Revision: 95 $
+ * $Revision: 105 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exfield")
+ ACPI_MODULE_NAME ("exfield")
/*******************************************************************************
*
* FUNCTION: Acpi_ex_read_data_from_field
*
- * PARAMETERS: Mode - ACPI_READ or ACPI_WRITE
- * *Field_node - Parent node for field to be accessed
- * *Buffer - Value(s) to be read or written
- * Buffer_length - Number of bytes to transfer
+ * PARAMETERS: Obj_desc - The named field
+ * Ret_buffer_desc - Where the return data object is stored
*
- * RETURN: Status3
+ * RETURN: Status
*
- * DESCRIPTION: Read or write a named field
+ * DESCRIPTION: Read from a named field. Returns either an Integer or a
+ * Buffer, depending on the size of the field.
*
******************************************************************************/
acpi_operand_object *buffer_desc;
u32 length;
void *buffer;
+ u8 locked;
- FUNCTION_TRACE_PTR ("Ex_read_data_from_field", obj_desc);
+ ACPI_FUNCTION_TRACE_PTR ("Ex_read_data_from_field", obj_desc);
/* Parameter validation */
return_ACPI_STATUS (AE_AML_NO_OPERAND);
}
+ if (obj_desc->common.type == ACPI_TYPE_BUFFER_FIELD) {
+ /*
+ * If the Buffer_field arguments have not been previously evaluated,
+ * evaluate them now and save the results.
+ */
+ if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) {
+ status = acpi_ds_get_buffer_field_arguments (obj_desc);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+ }
+ }
+
/*
* Allocate a buffer for the contents of the field.
*
*
* Note: Field.length is in bits.
*/
- length = ROUND_BITS_UP_TO_BYTES (obj_desc->field.bit_length);
+ length = ACPI_ROUND_BITS_UP_TO_BYTES (obj_desc->field.bit_length);
if (length > sizeof (acpi_integer)) {
/* Field is too large for an Integer, create a Buffer instead */
buffer_desc->buffer.length = length;
buffer = buffer_desc->buffer.pointer;
}
-
else {
/* Field will fit within an Integer (normal case) */
buffer = &buffer_desc->integer.value;
}
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Obj=%p Type=%X Buf=%p Len=%X\n",
+ obj_desc, obj_desc->common.type, buffer, length));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Field_write: Bit_len=%X Bit_off=%X Byte_off=%X\n",
+ obj_desc->common_field.bit_length,
+ obj_desc->common_field.start_field_bit_offset,
+ obj_desc->common_field.base_byte_offset));
- /* Read from the appropriate field */
-
- switch (obj_desc->common.type) {
- case ACPI_TYPE_BUFFER_FIELD:
- status = acpi_ex_access_buffer_field (ACPI_READ, obj_desc, buffer, length);
- break;
-
- case INTERNAL_TYPE_REGION_FIELD:
- status = acpi_ex_access_region_field (ACPI_READ, obj_desc, buffer, length);
- break;
-
- case INTERNAL_TYPE_BANK_FIELD:
- status = acpi_ex_access_bank_field (ACPI_READ, obj_desc, buffer, length);
- break;
+ locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags);
- case INTERNAL_TYPE_INDEX_FIELD:
- status = acpi_ex_access_index_field (ACPI_READ, obj_desc, buffer, length);
- break;
+ /* Read from the field */
- default:
- status = AE_AML_INTERNAL;
- }
+ status = acpi_ex_extract_from_field (obj_desc, buffer, length);
+ /*
+ * Release global lock if we acquired it earlier
+ */
+ acpi_ex_release_global_lock (locked);
if (ACPI_FAILURE (status)) {
acpi_ut_remove_reference (buffer_desc);
}
-
else if (ret_buffer_desc) {
*ret_buffer_desc = buffer_desc;
}
*
* FUNCTION: Acpi_ex_write_data_to_field
*
- * PARAMETERS: Mode - ACPI_READ or ACPI_WRITE
- * *Field_node - Parent node for field to be accessed
- * *Buffer - Value(s) to be read or written
- * Buffer_length - Number of bytes to transfer
+ * PARAMETERS: Source_desc - Contains data to write
+ * Obj_desc - The named field
*
* RETURN: Status
*
- * DESCRIPTION: Read or write a named field
+ * DESCRIPTION: Write to a named field
*
******************************************************************************/
-
acpi_status
acpi_ex_write_data_to_field (
acpi_operand_object *source_desc,
{
acpi_status status;
u32 length;
+ u32 required_length;
void *buffer;
+ void *new_buffer;
+ u8 locked;
- FUNCTION_TRACE_PTR ("Ex_write_data_to_field", obj_desc);
+ ACPI_FUNCTION_TRACE_PTR ("Ex_write_data_to_field", obj_desc);
/* Parameter validation */
return_ACPI_STATUS (AE_AML_NO_OPERAND);
}
+ if (obj_desc->common.type == ACPI_TYPE_BUFFER_FIELD) {
+ /*
+ * If the Buffer_field arguments have not been previously evaluated,
+ * evaluate them now and save the results.
+ */
+ if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) {
+ status = acpi_ds_get_buffer_field_arguments (obj_desc);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+ }
+ }
/*
* Get a pointer to the data to be written
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
-
/*
- * Decode the type of field to be written
+ * We must have a buffer that is at least as long as the field
+ * we are writing to. This is because individual fields are
+ * indivisible and partial writes are not supported -- as per
+ * the ACPI specification.
*/
- switch (obj_desc->common.type) {
- case ACPI_TYPE_BUFFER_FIELD:
- status = acpi_ex_access_buffer_field (ACPI_WRITE, obj_desc, buffer, length);
- break;
-
- case INTERNAL_TYPE_REGION_FIELD:
- status = acpi_ex_access_region_field (ACPI_WRITE, obj_desc, buffer, length);
- break;
+ new_buffer = NULL;
+ required_length = ACPI_ROUND_BITS_UP_TO_BYTES (obj_desc->common_field.bit_length);
- case INTERNAL_TYPE_BANK_FIELD:
- status = acpi_ex_access_bank_field (ACPI_WRITE, obj_desc, buffer, length);
- break;
-
- case INTERNAL_TYPE_INDEX_FIELD:
- status = acpi_ex_access_index_field (ACPI_WRITE, obj_desc, buffer, length);
- break;
+ if (length < required_length) {
+ /* We need to create a new buffer */
- default:
- return_ACPI_STATUS (AE_AML_INTERNAL);
- }
-
-
- return_ACPI_STATUS (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ex_access_buffer_field
- *
- * PARAMETERS: Mode - ACPI_READ or ACPI_WRITE
- * *Field_node - Parent node for field to be accessed
- * *Buffer - Value(s) to be read or written
- * Buffer_length - Number of bytes to transfer
- *
- * RETURN: Status
- *
- * DESCRIPTION: Read or write a named field
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ex_access_buffer_field (
- u32 mode,
- acpi_operand_object *obj_desc,
- void *buffer,
- u32 buffer_length)
-{
- acpi_status status;
-
-
- FUNCTION_TRACE_PTR ("Ex_access_buffer_field", obj_desc);
-
-
- /*
- * If the Buffer_field arguments have not been previously evaluated,
- * evaluate them now and save the results.
- */
- if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) {
- status = acpi_ds_get_buffer_field_arguments (obj_desc);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ new_buffer = ACPI_MEM_CALLOCATE (required_length);
+ if (!new_buffer) {
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
- }
-
-
- status = acpi_ex_common_access_field (mode, obj_desc, buffer, buffer_length);
-
- return_ACPI_STATUS (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ex_access_region_field
- *
- * PARAMETERS: Mode - ACPI_READ or ACPI_WRITE
- * *Field_node - Parent node for field to be accessed
- * *Buffer - Value(s) to be read or written
- * Buffer_length - Number of bytes to transfer
- *
- * RETURN: Status
- *
- * DESCRIPTION: Read or write a named field
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ex_access_region_field (
- u32 mode,
- acpi_operand_object *obj_desc,
- void *buffer,
- u32 buffer_length)
-{
- acpi_status status;
- u8 locked;
-
-
- FUNCTION_TRACE_PTR ("Ex_access_region_field", obj_desc);
-
-
- /*
- * Get the global lock if needed
- */
- locked = acpi_ex_acquire_global_lock (obj_desc->field.lock_rule);
-
- status = acpi_ex_common_access_field (mode, obj_desc, buffer, buffer_length);
-
-
- /*
- * Release global lock if we acquired it earlier
- */
- acpi_ex_release_global_lock (locked);
-
- return_ACPI_STATUS (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ex_access_bank_field
- *
- * PARAMETERS: Mode - ACPI_READ or ACPI_WRITE
- * *Field_node - Parent node for field to be accessed
- * *Buffer - Value(s) to be read or written
- * Buffer_length - Number of bytes to transfer
- *
- * RETURN: Status
- *
- * DESCRIPTION: Read or write a Bank Field
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ex_access_bank_field (
- u32 mode,
- acpi_operand_object *obj_desc,
- void *buffer,
- u32 buffer_length)
-{
- acpi_status status;
- u8 locked;
-
-
- FUNCTION_TRACE_PTR ("Ex_access_bank_field", obj_desc);
-
-
- /*
- * Get the global lock if needed
- */
- locked = acpi_ex_acquire_global_lock (obj_desc->bank_field.lock_rule);
-
- /*
- * Write the Bank_value to the Bank_register to select the bank.
- * The Bank_value for this Bank_field is specified in the
- * Bank_field ASL declaration. The Bank_register is always a Field in
- * an operation region.
- */
- status = acpi_ex_common_access_field (ACPI_WRITE,
- obj_desc->bank_field.bank_register_obj,
- &obj_desc->bank_field.value,
- sizeof (obj_desc->bank_field.value));
- if (ACPI_FAILURE (status)) {
- goto cleanup;
+ /*
+ * Copy the original data to the new buffer, starting
+ * at Byte zero. All unused (upper) bytes of the
+ * buffer will be 0.
+ */
+ ACPI_MEMCPY ((char *) new_buffer, (char *) buffer, length);
+ buffer = new_buffer;
+ length = required_length;
}
- /*
- * The bank was successfully selected, now read or write the actual
- * data.
- */
- status = acpi_ex_common_access_field (mode, obj_desc, buffer, buffer_length);
-
-
-cleanup:
- /*
- * Release global lock if we acquired it earlier
- */
- acpi_ex_release_global_lock (locked);
-
- return_ACPI_STATUS (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ex_access_index_field
- *
- * PARAMETERS: Mode - ACPI_READ or ACPI_WRITE
- * *Field_node - Parent node for field to be accessed
- * *Buffer - Value(s) to be read or written
- * Buffer_length - Number of bytes to transfer
- *
- * RETURN: Status
- *
- * DESCRIPTION: Read or write a Index Field
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ex_access_index_field (
- u32 mode,
- acpi_operand_object *obj_desc,
- void *buffer,
- u32 buffer_length)
-{
- acpi_status status;
- u8 locked;
-
-
- FUNCTION_TRACE_PTR ("Ex_access_index_field", obj_desc);
-
-
- /*
- * Get the global lock if needed
- */
- locked = acpi_ex_acquire_global_lock (obj_desc->index_field.lock_rule);
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Obj=%p Type=%X Buf=%p Len=%X\n",
+ obj_desc, obj_desc->common.type, buffer, length));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Field_read: Bit_len=%X Bit_off=%X Byte_off=%X\n",
+ obj_desc->common_field.bit_length,
+ obj_desc->common_field.start_field_bit_offset,
+ obj_desc->common_field.base_byte_offset));
+ locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags);
/*
- * Set Index value to select proper Data register
+ * Write to the field
*/
- status = acpi_ex_common_access_field (ACPI_WRITE,
- obj_desc->index_field.index_obj,
- &obj_desc->index_field.value,
- sizeof (obj_desc->index_field.value));
- if (ACPI_FAILURE (status)) {
- goto cleanup;
- }
+ status = acpi_ex_insert_into_field (obj_desc, buffer, length);
- /* Now read/write the data register */
-
- status = acpi_ex_common_access_field (mode, obj_desc->index_field.data_obj,
- buffer, buffer_length);
-
-cleanup:
/*
* Release global lock if we acquired it earlier
*/
acpi_ex_release_global_lock (locked);
- return_ACPI_STATUS (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ex_common_access_field
- *
- * PARAMETERS: Mode - ACPI_READ or ACPI_WRITE
- * *Field_node - Parent node for field to be accessed
- * *Buffer - Value(s) to be read or written
- * Buffer_length - Size of buffer, in bytes. Must be large
- * enough for all bits of the field.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Read or write a named field
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ex_common_access_field (
- u32 mode,
- acpi_operand_object *obj_desc,
- void *buffer,
- u32 buffer_length)
-{
- acpi_status status;
-
-
- FUNCTION_TRACE_PTR ("Ex_common_access_field", obj_desc);
-
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Obj=%p Type=%X Buf=%p Len=%X\n",
- obj_desc, obj_desc->common.type, buffer, buffer_length));
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode=%d Bit_len=%X Bit_off=%X Byte_off=%X\n",
- mode, obj_desc->common_field.bit_length,
- obj_desc->common_field.start_field_bit_offset,
- obj_desc->common_field.base_byte_offset));
-
-
- /* Perform the actual read or write of the field */
-
- switch (mode) {
- case ACPI_READ:
+ /* Free temporary buffer if we used one */
- status = acpi_ex_extract_from_field (obj_desc, buffer, buffer_length);
- break;
-
-
- case ACPI_WRITE:
-
- status = acpi_ex_insert_into_field (obj_desc, buffer, buffer_length);
- break;
-
-
- default:
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown I/O Mode: %X\n", mode));
- status = AE_BAD_PARAMETER;
- break;
+ if (new_buffer) {
+ ACPI_MEM_FREE (new_buffer);
}
-
return_ACPI_STATUS (status);
}
+
/******************************************************************************
*
* Module Name: exfldio - Aml Field I/O
- * $Revision: 66 $
+ * $Revision: 82 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exfldio")
+ ACPI_MODULE_NAME ("exfldio")
/*******************************************************************************
*
- * FUNCTION: Acpi_ex_setup_field
+ * FUNCTION: Acpi_ex_setup_region
*
- * PARAMETERS: *Obj_desc - Field to be read or written
- * Field_datum_byte_offset - Current offset into the field
+ * PARAMETERS: *Obj_desc - Field to be read or written
+ * Field_datum_byte_offset - Byte offset of this datum within the
+ * parent field
*
* RETURN: Status
*
* DESCRIPTION: Common processing for Acpi_ex_extract_from_field and
- * Acpi_ex_insert_into_field
+ * Acpi_ex_insert_into_field. Initialize the
*
******************************************************************************/
acpi_status
-acpi_ex_setup_field (
+acpi_ex_setup_region (
acpi_operand_object *obj_desc,
u32 field_datum_byte_offset)
{
acpi_operand_object *rgn_desc;
- FUNCTION_TRACE_U32 ("Ex_setup_field", field_datum_byte_offset);
+ ACPI_FUNCTION_TRACE_U32 ("Ex_setup_region", field_datum_byte_offset);
rgn_desc = obj_desc->common_field.region_obj;
* evaluate them now and save the results.
*/
if (!(rgn_desc->region.flags & AOPOBJ_DATA_VALID)) {
-
status = acpi_ds_get_region_arguments (rgn_desc);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
* length of one field datum (access width) must fit within the region.
* (Region length is specified in bytes)
*/
- if (rgn_desc->region.length < (obj_desc->common_field.base_byte_offset +
- field_datum_byte_offset +
- obj_desc->common_field.access_byte_width)) {
+ if (rgn_desc->region.length < (obj_desc->common_field.base_byte_offset
+ + field_datum_byte_offset
+ + obj_desc->common_field.access_byte_width)) {
if (rgn_desc->region.length < obj_desc->common_field.access_byte_width) {
/*
* This is the case where the Access_type (Acc_word, etc.) is wider
* byte, and a field with Dword access specified.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Field access width (%d bytes) too large for region size (%X)\n",
- obj_desc->common_field.access_byte_width, rgn_desc->region.length));
+ "Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n",
+ (char *) &obj_desc->common_field.node->name, obj_desc->common_field.access_byte_width,
+ (char *) &rgn_desc->region.node->name, rgn_desc->region.length));
}
/*
* exceeds region length, indicate an error
*/
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Field base+offset+width %X+%X+%X exceeds region size (%X bytes) field=%p region=%p\n",
- obj_desc->common_field.base_byte_offset, field_datum_byte_offset,
- obj_desc->common_field.access_byte_width,
- rgn_desc->region.length, obj_desc, rgn_desc));
+ "Field [%4.4s] Base+Offset+Width %X+%X+%X is beyond end of region [%4.4s] (length %X)\n",
+ (char *) &obj_desc->common_field.node->name, obj_desc->common_field.base_byte_offset,
+ field_datum_byte_offset, obj_desc->common_field.access_byte_width,
+ (char *) &rgn_desc->region.node->name, rgn_desc->region.length));
return_ACPI_STATUS (AE_AML_REGION_LIMIT);
}
/*******************************************************************************
*
- * FUNCTION: Acpi_ex_read_field_datum
+ * FUNCTION: Acpi_ex_access_region
*
- * PARAMETERS: *Obj_desc - Field to be read
- * *Value - Where to store value (must be 32 bits)
+ * PARAMETERS: *Obj_desc - Field to be read
+ * Field_datum_byte_offset - Byte offset of this datum within the
+ * parent field
+ * *Value - Where to store value (must be 32 bits)
+ * Read_write - Read or Write flag
*
* RETURN: Status
*
- * DESCRIPTION: Retrieve the value of the given field
+ * DESCRIPTION: Read or Write a single field datum to an Operation Region.
*
******************************************************************************/
acpi_status
-acpi_ex_read_field_datum (
+acpi_ex_access_region (
acpi_operand_object *obj_desc,
u32 field_datum_byte_offset,
- u32 *value)
+ acpi_integer *value,
+ u32 read_write)
{
acpi_status status;
acpi_operand_object *rgn_desc;
ACPI_PHYSICAL_ADDRESS address;
- u32 local_value;
- FUNCTION_TRACE_U32 ("Ex_read_field_datum", field_datum_byte_offset);
+ ACPI_FUNCTION_TRACE ("Acpi_ex_access_region");
+
+
+ /*
+ * The physical address of this field datum is:
+ *
+ * 1) The base of the region, plus
+ * 2) The base offset of the field, plus
+ * 3) The current offset into the field
+ */
+ rgn_desc = obj_desc->common_field.region_obj;
+ address = rgn_desc->region.address
+ + obj_desc->common_field.base_byte_offset
+ + field_datum_byte_offset;
+
+ if (read_write == ACPI_READ) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "[READ]"));
+ }
+ else {
+ ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "[WRITE]"));
+ }
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_BFIELD,
+ " Region[%s-%X] Access %X Base:Off %X:%X at %8.8X%8.8X\n",
+ acpi_ut_get_region_name (rgn_desc->region.space_id),
+ rgn_desc->region.space_id,
+ obj_desc->common_field.access_byte_width,
+ obj_desc->common_field.base_byte_offset,
+ field_datum_byte_offset,
+ ACPI_HIDWORD (address), ACPI_LODWORD (address)));
- if (!value) {
- local_value = 0;
- value = &local_value; /* support reads without saving value */
+ /* Invoke the appropriate Address_space/Op_region handler */
+
+ status = acpi_ev_address_space_dispatch (rgn_desc, read_write,
+ address, ACPI_MUL_8 (obj_desc->common_field.access_byte_width), value);
+
+ if (ACPI_FAILURE (status)) {
+ if (status == AE_NOT_IMPLEMENTED) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Region %s(%X) not implemented\n",
+ acpi_ut_get_region_name (rgn_desc->region.space_id),
+ rgn_desc->region.space_id));
+ }
+
+ else if (status == AE_NOT_EXIST) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Region %s(%X) has no handler\n",
+ acpi_ut_get_region_name (rgn_desc->region.space_id),
+ rgn_desc->region.space_id));
+ }
}
- /* Clear the entire return buffer first, [Very Important!] */
+ return_ACPI_STATUS (status);
+}
- *value = 0;
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ex_register_overflow
+ *
+ * PARAMETERS: *Obj_desc - Register(Field) to be written
+ * Value - Value to be stored
+ *
+ * RETURN: TRUE if value overflows the field, FALSE otherwise
+ *
+ * DESCRIPTION: Check if a value is out of range of the field being written.
+ * Used to check if the values written to Index and Bank registers
+ * are out of range. Normally, the value is simply truncated
+ * to fit the field, but this case is most likely a serious
+ * coding error in the ASL.
+ *
+ ******************************************************************************/
+
+u8
+acpi_ex_register_overflow (
+ acpi_operand_object *obj_desc,
+ acpi_integer value)
+{
+
+ if (obj_desc->common_field.bit_length >= ACPI_INTEGER_BIT_SIZE) {
+ /*
+ * The field is large enough to hold the maximum integer, so we can
+ * never overflow it.
+ */
+ return (FALSE);
+ }
+
+ if (value >= (acpi_integer) (1 << obj_desc->common_field.bit_length)) {
+ /*
+ * The Value is larger than the maximum value that can fit into
+ * the register.
+ */
+ return (TRUE);
+ }
+
+ /* The Value will fit into the field with no truncation */
+
+ return (FALSE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ex_field_datum_io
+ *
+ * PARAMETERS: *Obj_desc - Field to be read
+ * Field_datum_byte_offset - Byte offset of this datum within the
+ * parent field
+ * *Value - Where to store value (must be 64 bits)
+ * Read_write - Read or Write flag
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Read or Write a single datum of a field. The Field_type is
+ * demultiplexed here to handle the different types of fields
+ * (Buffer_field, Region_field, Index_field, Bank_field)
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ex_field_datum_io (
+ acpi_operand_object *obj_desc,
+ u32 field_datum_byte_offset,
+ acpi_integer *value,
+ u32 read_write)
+{
+ acpi_status status;
+ acpi_integer local_value;
+
+
+ ACPI_FUNCTION_TRACE_U32 ("Ex_field_datum_io", field_datum_byte_offset);
+
+
+ if (read_write == ACPI_READ) {
+ if (!value) {
+ local_value = 0;
+ value = &local_value; /* To support reads without saving return value */
+ }
+
+ /* Clear the entire return buffer first, [Very Important!] */
+
+ *value = 0;
+ }
/*
- * Buffer_fields - Read from a Buffer
- * Other Fields - Read from a Operation Region.
+ * The four types of fields are:
+ *
+ * Buffer_fields - Read/write from/to a Buffer
+ * Region_fields - Read/write from/to a Operation Region.
+ * Bank_fields - Write to a Bank Register, then read/write from/to an Op_region
+ * Index_fields - Write to an Index Register, then read/write from/to a Data Register
*/
switch (obj_desc->common.type) {
case ACPI_TYPE_BUFFER_FIELD:
-
/*
- * For Buffer_fields, we only need to copy the data from the
- * source buffer. Length is the field width in bytes.
+ * If the Buffer_field arguments have not been previously evaluated,
+ * evaluate them now and save the results.
*/
- MEMCPY (value, (obj_desc->buffer_field.buffer_obj)->buffer.pointer
- + obj_desc->buffer_field.base_byte_offset + field_datum_byte_offset,
- obj_desc->common_field.access_byte_width);
+ if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) {
+ status = acpi_ds_get_buffer_field_arguments (obj_desc);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+ }
+
+ if (read_write == ACPI_READ) {
+ /*
+ * Copy the data from the source buffer.
+ * Length is the field width in bytes.
+ */
+ ACPI_MEMCPY (value, (obj_desc->buffer_field.buffer_obj)->buffer.pointer
+ + obj_desc->buffer_field.base_byte_offset
+ + field_datum_byte_offset,
+ obj_desc->common_field.access_byte_width);
+ }
+ else {
+ /*
+ * Copy the data to the target buffer.
+ * Length is the field width in bytes.
+ */
+ ACPI_MEMCPY ((obj_desc->buffer_field.buffer_obj)->buffer.pointer
+ + obj_desc->buffer_field.base_byte_offset
+ + field_datum_byte_offset,
+ value, obj_desc->common_field.access_byte_width);
+ }
+
status = AE_OK;
break;
- case INTERNAL_TYPE_REGION_FIELD:
case INTERNAL_TYPE_BANK_FIELD:
+ /* Ensure that the Bank_value is not beyond the capacity of the register */
+
+ if (acpi_ex_register_overflow (obj_desc->bank_field.bank_obj,
+ obj_desc->bank_field.value)) {
+ return_ACPI_STATUS (AE_AML_REGISTER_LIMIT);
+ }
+
/*
- * For other fields, we need to go through an Operation Region
- * (Only types that will get here are Region_fields and Bank_fields)
+ * For Bank_fields, we must write the Bank_value to the Bank_register
+ * (itself a Region_field) before we can access the data.
*/
- status = acpi_ex_setup_field (obj_desc, field_datum_byte_offset);
+ status = acpi_ex_insert_into_field (obj_desc->bank_field.bank_obj,
+ &obj_desc->bank_field.value,
+ sizeof (obj_desc->bank_field.value));
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/*
- * The physical address of this field datum is:
- *
- * 1) The base of the region, plus
- * 2) The base offset of the field, plus
- * 3) The current offset into the field
+ * Now that the Bank has been selected, fall through to the
+ * Region_field case and write the datum to the Operation Region
*/
- rgn_desc = obj_desc->common_field.region_obj;
- address = rgn_desc->region.address + obj_desc->common_field.base_byte_offset +
- field_datum_byte_offset;
- ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Region %s(%X) width %X base:off %X:%X at %8.8X%8.8X\n",
- acpi_ut_get_region_name (rgn_desc->region.space_id),
- rgn_desc->region.space_id, obj_desc->common_field.access_bit_width,
- obj_desc->common_field.base_byte_offset, field_datum_byte_offset,
- HIDWORD(address), LODWORD(address)));
+ /* No break; ! */
- /* Invoke the appropriate Address_space/Op_region handler */
- status = acpi_ev_address_space_dispatch (rgn_desc, ACPI_READ_ADR_SPACE,
- address, obj_desc->common_field.access_bit_width, value);
- if (status == AE_NOT_IMPLEMENTED) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Region %s(%X) not implemented\n",
- acpi_ut_get_region_name (rgn_desc->region.space_id),
- rgn_desc->region.space_id));
+ case INTERNAL_TYPE_REGION_FIELD:
+ /*
+ * For simple Region_fields, we just directly access the owning
+ * Operation Region.
+ */
+ status = acpi_ex_setup_region (obj_desc, field_datum_byte_offset);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
}
- else if (status == AE_NOT_EXIST) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Region %s(%X) has no handler\n",
- acpi_ut_get_region_name (rgn_desc->region.space_id),
- rgn_desc->region.space_id));
+ status = acpi_ex_access_region (obj_desc, field_datum_byte_offset, value,
+ read_write);
+ break;
+
+
+ case INTERNAL_TYPE_INDEX_FIELD:
+
+
+ /* Ensure that the Index_value is not beyond the capacity of the register */
+
+ if (acpi_ex_register_overflow (obj_desc->index_field.index_obj,
+ obj_desc->index_field.value)) {
+ return_ACPI_STATUS (AE_AML_REGISTER_LIMIT);
+ }
+
+ /* Write the index value to the Index_register (itself a Region_field) */
+
+ status = acpi_ex_insert_into_field (obj_desc->index_field.index_obj,
+ &obj_desc->index_field.value,
+ sizeof (obj_desc->index_field.value));
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+
+ if (read_write == ACPI_READ) {
+ /* Read the datum from the Data_register */
+
+ status = acpi_ex_extract_from_field (obj_desc->index_field.data_obj,
+ value, obj_desc->common_field.access_byte_width);
+ }
+ else {
+ /* Write the datum to the Data register */
+
+ status = acpi_ex_insert_into_field (obj_desc->index_field.data_obj,
+ value, obj_desc->common_field.access_byte_width);
}
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p, wrong source type - %s\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p, Wrong object type - %s\n",
obj_desc, acpi_ut_get_type_name (obj_desc->common.type)));
status = AE_AML_INTERNAL;
break;
}
+ if (ACPI_SUCCESS (status)) {
+ if (read_write == ACPI_READ) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Read=%8.8X%8.8X\n",
+ ACPI_HIDWORD (*value), ACPI_LODWORD (*value)));
+ }
+ else {
+ ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Written=%8.8X%8.8X\n",
+ ACPI_HIDWORD (*value), ACPI_LODWORD (*value)));
+ }
+ }
+
+ return_ACPI_STATUS (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ex_write_with_update_rule
+ *
+ * PARAMETERS: *Obj_desc - Field to be set
+ * Value - Value to store
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Apply the field update rule to a field write
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ex_write_with_update_rule (
+ acpi_operand_object *obj_desc,
+ acpi_integer mask,
+ acpi_integer field_value,
+ u32 field_datum_byte_offset)
+{
+ acpi_status status = AE_OK;
+ acpi_integer merged_value;
+ acpi_integer current_value;
+
+
+ ACPI_FUNCTION_TRACE_U32 ("Ex_write_with_update_rule", mask);
+
+
+ /* Start with the new bits */
+
+ merged_value = field_value;
+
+ /* If the mask is all ones, we don't need to worry about the update rule */
+
+ if (mask != ACPI_UINT32_MAX) {
+ /* Decode the update rule */
+
+ switch (obj_desc->common_field.field_flags & AML_FIELD_UPDATE_RULE_MASK) {
+ case AML_FIELD_UPDATE_PRESERVE:
+ /*
+ * Check if update rule needs to be applied (not if mask is all
+ * ones) The left shift drops the bits we want to ignore.
+ */
+ if ((~mask << (ACPI_MUL_8 (sizeof (mask)) -
+ ACPI_MUL_8 (obj_desc->common_field.access_byte_width))) != 0) {
+ /*
+ * Read the current contents of the byte/word/dword containing
+ * the field, and merge with the new field value.
+ */
+ status = acpi_ex_field_datum_io (obj_desc, field_datum_byte_offset,
+ ¤t_value, ACPI_READ);
+ merged_value |= (current_value & ~mask);
+ }
+ break;
+
+ case AML_FIELD_UPDATE_WRITE_AS_ONES:
+
+ /* Set positions outside the field to all ones */
+
+ merged_value |= ~mask;
+ break;
+
+ case AML_FIELD_UPDATE_WRITE_AS_ZEROS:
+
+ /* Set positions outside the field to all zeros */
+
+ merged_value &= mask;
+ break;
+
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Write_with_update_rule: Unknown Update_rule setting: %x\n",
+ (obj_desc->common_field.field_flags & AML_FIELD_UPDATE_RULE_MASK)));
+ return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
+ }
+ }
+
+ /* Write the merged value */
+
+ status = acpi_ex_field_datum_io (obj_desc, field_datum_byte_offset,
+ &merged_value, ACPI_WRITE);
- ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Returned value=%08X \n", *value));
+ ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
+ "Mask %8.8X%8.8X Datum_offset %X Value %8.8X%8.8X, Merged_value %8.8X%8.8X\n",
+ ACPI_HIDWORD (mask), ACPI_LODWORD (mask),
+ field_datum_byte_offset,
+ ACPI_HIDWORD (field_value), ACPI_LODWORD (field_value),
+ ACPI_HIDWORD (merged_value),ACPI_LODWORD (merged_value)));
return_ACPI_STATUS (status);
}
*
* FUNCTION: Acpi_ex_get_buffer_datum
*
- * PARAMETERS: Merged_datum - Value to store
- * Buffer - Receiving buffer
- * Byte_granularity - 1/2/4 Granularity of the field
+ * PARAMETERS: Datum - Where the Datum is returned
+ * Buffer - Raw field buffer
+ * Byte_granularity - 1/2/4/8 Granularity of the field
* (aka Datum Size)
* Offset - Datum offset into the buffer
*
* RETURN: none
*
- * DESCRIPTION: Store the merged datum to the buffer according to the
+ * DESCRIPTION: Get a datum from the buffer according to the buffer field
* byte granularity
*
******************************************************************************/
-static void
+void
acpi_ex_get_buffer_datum(
- u32 *datum,
+ acpi_integer *datum,
void *buffer,
u32 byte_granularity,
u32 offset)
{
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
switch (byte_granularity) {
case ACPI_FIELD_BYTE_GRANULARITY:
+
*datum = ((u8 *) buffer) [offset];
break;
case ACPI_FIELD_WORD_GRANULARITY:
- MOVE_UNALIGNED16_TO_32 (datum, &(((u16 *) buffer) [offset]));
+
+ ACPI_MOVE_UNALIGNED16_TO_32 (datum, &(((u16 *) buffer) [offset]));
break;
case ACPI_FIELD_DWORD_GRANULARITY:
- MOVE_UNALIGNED32_TO_32 (datum, &(((u32 *) buffer) [offset]));
+
+ ACPI_MOVE_UNALIGNED32_TO_32 (datum, &(((u32 *) buffer) [offset]));
+ break;
+
+ case ACPI_FIELD_QWORD_GRANULARITY:
+
+ ACPI_MOVE_UNALIGNED64_TO_64 (datum, &(((u64 *) buffer) [offset]));
break;
}
}
*
* PARAMETERS: Merged_datum - Value to store
* Buffer - Receiving buffer
- * Byte_granularity - 1/2/4 Granularity of the field
+ * Byte_granularity - 1/2/4/8 Granularity of the field
* (aka Datum Size)
* Offset - Datum offset into the buffer
*
*
******************************************************************************/
-static void
+void
acpi_ex_set_buffer_datum (
- u32 merged_datum,
+ acpi_integer merged_datum,
void *buffer,
u32 byte_granularity,
u32 offset)
{
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
switch (byte_granularity) {
case ACPI_FIELD_BYTE_GRANULARITY:
+
((u8 *) buffer) [offset] = (u8) merged_datum;
break;
case ACPI_FIELD_WORD_GRANULARITY:
- MOVE_UNALIGNED16_TO_16 (&(((u16 *) buffer)[offset]), &merged_datum);
+
+ ACPI_MOVE_UNALIGNED16_TO_16 (&(((u16 *) buffer)[offset]), &merged_datum);
break;
case ACPI_FIELD_DWORD_GRANULARITY:
- MOVE_UNALIGNED32_TO_32 (&(((u32 *) buffer)[offset]), &merged_datum);
+
+ ACPI_MOVE_UNALIGNED32_TO_32 (&(((u32 *) buffer)[offset]), &merged_datum);
+ break;
+
+ case ACPI_FIELD_QWORD_GRANULARITY:
+
+ ACPI_MOVE_UNALIGNED64_TO_64 (&(((u64 *) buffer)[offset]), &merged_datum);
break;
}
}
acpi_status status;
u32 field_datum_byte_offset;
u32 datum_offset;
- u32 previous_raw_datum;
- u32 this_raw_datum = 0;
- u32 merged_datum = 0;
+ acpi_integer previous_raw_datum;
+ acpi_integer this_raw_datum = 0;
+ acpi_integer merged_datum = 0;
u32 byte_field_length;
u32 datum_count;
- FUNCTION_TRACE ("Ex_extract_from_field");
+ ACPI_FUNCTION_TRACE ("Ex_extract_from_field");
/*
* The field must fit within the caller's buffer
*/
- byte_field_length = ROUND_BITS_UP_TO_BYTES (obj_desc->common_field.bit_length);
+ byte_field_length = ACPI_ROUND_BITS_UP_TO_BYTES (obj_desc->common_field.bit_length);
if (byte_field_length > buffer_length) {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Field size %X (bytes) too large for buffer (%X)\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Field size %X (bytes) too large for buffer (%X)\n",
byte_field_length, buffer_length));
return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
/* Convert field byte count to datum count, round up if necessary */
- datum_count = ROUND_UP_TO (byte_field_length, obj_desc->common_field.access_byte_width);
+ datum_count = ACPI_ROUND_UP_TO (byte_field_length,
+ obj_desc->common_field.access_byte_width);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Byte_len=%x, Datum_len=%x, Bit_gran=%x, Byte_gran=%x\n",
- byte_field_length, datum_count, obj_desc->common_field.access_bit_width,
- obj_desc->common_field.access_byte_width));
+ "Byte_len=%x, Datum_len=%x, Byte_gran=%x\n",
+ byte_field_length, datum_count,obj_desc->common_field.access_byte_width));
/*
* Clear the caller's buffer (the whole buffer length as given)
* This is very important, especially in the cases where a byte is read,
* but the buffer is really a u32 (4 bytes).
*/
- MEMSET (buffer, 0, buffer_length);
+ ACPI_MEMSET (buffer, 0, buffer_length);
/* Read the first raw datum to prime the loop */
field_datum_byte_offset = 0;
datum_offset= 0;
- status = acpi_ex_read_field_datum (obj_desc, field_datum_byte_offset, &previous_raw_datum);
+ status = acpi_ex_field_datum_io (obj_desc, field_datum_byte_offset,
+ &previous_raw_datum, ACPI_READ);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/* We might actually be done if the request fits in one datum */
if ((datum_count == 1) &&
- (obj_desc->common_field.access_flags & AFIELD_SINGLE_DATUM)) {
+ (obj_desc->common_field.flags & AOPOBJ_SINGLE_DATUM)) {
/* 1) Shift the valid data bits down to start at bit 0 */
merged_datum = (previous_raw_datum >> obj_desc->common_field.start_field_bit_offset);
/* 2) Mask off any upper unused bits (bits not part of the field) */
if (obj_desc->common_field.end_buffer_valid_bits) {
- merged_datum &= MASK_BITS_ABOVE (obj_desc->common_field.end_buffer_valid_bits);
+ merged_datum &= ACPI_MASK_BITS_ABOVE (obj_desc->common_field.end_buffer_valid_bits);
}
/* Store the datum to the caller buffer */
* to perform a final read, since this would potentially read
* past the end of the region.
*
- * TBD: [Investigate] It may make more sense to just split the aligned
- * and non-aligned cases since the aligned case is so very simple,
+ * We could just split the aligned and non-aligned cases since the
+ * aligned case is so very simple, but this would require more code.
*/
- if ((obj_desc->common_field.start_field_bit_offset != 0) ||
+ if ((obj_desc->common_field.start_field_bit_offset != 0) ||
((obj_desc->common_field.start_field_bit_offset == 0) &&
(datum_offset < (datum_count -1)))) {
/*
* Get the next raw datum, it contains some or all bits
* of the current field datum
*/
- status = acpi_ex_read_field_datum (obj_desc, field_datum_byte_offset, &this_raw_datum);
+ status = acpi_ex_field_datum_io (obj_desc, field_datum_byte_offset,
+ &this_raw_datum, ACPI_READ);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
merged_datum = previous_raw_datum;
}
-
else {
/*
* Put together the appropriate bits of the two raw data to make a
*/
if (obj_desc->common_field.end_buffer_valid_bits) {
merged_datum &=
- MASK_BITS_ABOVE (obj_desc->common_field.end_buffer_valid_bits);
+ ACPI_MASK_BITS_ABOVE (obj_desc->common_field.end_buffer_valid_bits);
}
}
}
* Store the merged field datum in the caller's buffer, according to
* the granularity of the field (size of each datum).
*/
- acpi_ex_set_buffer_datum (merged_datum, buffer, obj_desc->common_field.access_byte_width,
- datum_offset);
+ acpi_ex_set_buffer_datum (merged_datum, buffer,
+ obj_desc->common_field.access_byte_width, datum_offset);
/*
* Save the raw datum that was just acquired since it may contain bits
}
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ex_write_field_datum
- *
- * PARAMETERS: *Obj_desc - Field to be set
- * Value - Value to store
- *
- * RETURN: Status
- *
- * DESCRIPTION: Store the value into the given field
- *
- ******************************************************************************/
-
-static acpi_status
-acpi_ex_write_field_datum (
- acpi_operand_object *obj_desc,
- u32 field_datum_byte_offset,
- u32 value)
-{
- acpi_status status = AE_OK;
- acpi_operand_object *rgn_desc = NULL;
- ACPI_PHYSICAL_ADDRESS address;
-
-
- FUNCTION_TRACE_U32 ("Ex_write_field_datum", field_datum_byte_offset);
-
-
- /*
- * Buffer_fields - Read from a Buffer
- * Other Fields - Read from a Operation Region.
- */
- switch (obj_desc->common.type) {
- case ACPI_TYPE_BUFFER_FIELD:
-
- /*
- * For Buffer_fields, we only need to copy the data to the
- * target buffer. Length is the field width in bytes.
- */
- MEMCPY ((obj_desc->buffer_field.buffer_obj)->buffer.pointer
- + obj_desc->buffer_field.base_byte_offset + field_datum_byte_offset,
- &value, obj_desc->common_field.access_byte_width);
- status = AE_OK;
- break;
-
-
- case INTERNAL_TYPE_REGION_FIELD:
- case INTERNAL_TYPE_BANK_FIELD:
-
- /*
- * For other fields, we need to go through an Operation Region
- * (Only types that will get here are Region_fields and Bank_fields)
- */
- status = acpi_ex_setup_field (obj_desc, field_datum_byte_offset);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
- /*
- * The physical address of this field datum is:
- *
- * 1) The base of the region, plus
- * 2) The base offset of the field, plus
- * 3) The current offset into the field
- */
- rgn_desc = obj_desc->common_field.region_obj;
- address = rgn_desc->region.address +
- obj_desc->common_field.base_byte_offset +
- field_datum_byte_offset;
-
- ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
- "Store %X in Region %s(%X) at %8.8X%8.8X width %X\n",
- value, acpi_ut_get_region_name (rgn_desc->region.space_id),
- rgn_desc->region.space_id, HIDWORD(address), LODWORD(address),
- obj_desc->common_field.access_bit_width));
-
- /* Invoke the appropriate Address_space/Op_region handler */
-
- status = acpi_ev_address_space_dispatch (rgn_desc, ACPI_WRITE_ADR_SPACE,
- address, obj_desc->common_field.access_bit_width, &value);
-
- if (status == AE_NOT_IMPLEMENTED) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "**** Region type %s(%X) not implemented\n",
- acpi_ut_get_region_name (rgn_desc->region.space_id),
- rgn_desc->region.space_id));
- }
-
- else if (status == AE_NOT_EXIST) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "**** Region type %s(%X) does not have a handler\n",
- acpi_ut_get_region_name (rgn_desc->region.space_id),
- rgn_desc->region.space_id));
- }
-
- break;
-
-
- default:
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p, wrong source type - %s\n",
- obj_desc, acpi_ut_get_type_name (obj_desc->common.type)));
- status = AE_AML_INTERNAL;
- break;
- }
-
-
- ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value written=%08X \n", value));
- return_ACPI_STATUS (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ex_write_field_datum_with_update_rule
- *
- * PARAMETERS: *Obj_desc - Field to be set
- * Value - Value to store
- *
- * RETURN: Status
- *
- * DESCRIPTION: Apply the field update rule to a field write
- *
- ******************************************************************************/
-
-static acpi_status
-acpi_ex_write_field_datum_with_update_rule (
- acpi_operand_object *obj_desc,
- u32 mask,
- u32 field_value,
- u32 field_datum_byte_offset)
-{
- acpi_status status = AE_OK;
- u32 merged_value;
- u32 current_value;
-
-
- FUNCTION_TRACE ("Ex_write_field_datum_with_update_rule");
-
-
- /* Start with the new bits */
-
- merged_value = field_value;
-
- /* If the mask is all ones, we don't need to worry about the update rule */
-
- if (mask != ACPI_UINT32_MAX) {
- /* Decode the update rule */
-
- switch (obj_desc->common_field.update_rule) {
- case UPDATE_PRESERVE:
- /*
- * Check if update rule needs to be applied (not if mask is all
- * ones) The left shift drops the bits we want to ignore.
- */
- if ((~mask << (sizeof (mask) * 8 -
- obj_desc->common_field.access_bit_width)) != 0) {
- /*
- * Read the current contents of the byte/word/dword containing
- * the field, and merge with the new field value.
- */
- status = acpi_ex_read_field_datum (obj_desc, field_datum_byte_offset,
- ¤t_value);
- merged_value |= (current_value & ~mask);
- }
- break;
-
-
- case UPDATE_WRITE_AS_ONES:
-
- /* Set positions outside the field to all ones */
-
- merged_value |= ~mask;
- break;
-
-
- case UPDATE_WRITE_AS_ZEROS:
-
- /* Set positions outside the field to all zeros */
-
- merged_value &= mask;
- break;
-
-
- default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Write_with_update_rule: Unknown Update_rule setting: %x\n",
- obj_desc->common_field.update_rule));
- return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
- break;
- }
- }
-
-
- /* Write the merged value */
-
- status = acpi_ex_write_field_datum (obj_desc, field_datum_byte_offset,
- merged_value);
-
- ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Mask %X Datum_offset %X Value %X, Merged_value %X\n",
- mask, field_datum_byte_offset, field_value, merged_value));
-
- return_ACPI_STATUS (status);
-}
-
-
/*******************************************************************************
*
* FUNCTION: Acpi_ex_insert_into_field
acpi_status status;
u32 field_datum_byte_offset;
u32 datum_offset;
- u32 mask;
- u32 merged_datum;
- u32 previous_raw_datum;
- u32 this_raw_datum;
+ acpi_integer mask;
+ acpi_integer merged_datum;
+ acpi_integer previous_raw_datum;
+ acpi_integer this_raw_datum;
u32 byte_field_length;
u32 datum_count;
- FUNCTION_TRACE ("Ex_insert_into_field");
+ ACPI_FUNCTION_TRACE ("Ex_insert_into_field");
/*
* larger than the field, this typically happens when an integer is
* written to a field that is actually smaller than an integer.
*/
- byte_field_length = ROUND_BITS_UP_TO_BYTES (obj_desc->common_field.bit_length);
+ byte_field_length = ACPI_ROUND_BITS_UP_TO_BYTES (obj_desc->common_field.bit_length);
if (buffer_length < byte_field_length) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Buffer length %X too small for field %X\n",
buffer_length, byte_field_length));
- /* TBD: Need a better error code */
-
return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
}
/* Convert byte count to datum count, round up if necessary */
- datum_count = ROUND_UP_TO (byte_field_length, obj_desc->common_field.access_byte_width);
+ datum_count = ACPI_ROUND_UP_TO (byte_field_length, obj_desc->common_field.access_byte_width);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Byte_len=%x, Datum_len=%x, Bit_gran=%x, Byte_gran=%x\n",
- byte_field_length, datum_count, obj_desc->common_field.access_bit_width,
- obj_desc->common_field.access_byte_width));
+ "Byte_len=%x, Datum_len=%x, Byte_gran=%x\n",
+ byte_field_length, datum_count, obj_desc->common_field.access_byte_width));
/*
* Break the request into up to three parts (similar to an I/O request):
*
* Mask off bits that are "below" the field (if any)
*/
- mask = MASK_BITS_BELOW (obj_desc->common_field.start_field_bit_offset);
+ mask = ACPI_MASK_BITS_BELOW (obj_desc->common_field.start_field_bit_offset);
/* If the field fits in one datum, may need to mask upper bits */
- if ((obj_desc->common_field.access_flags & AFIELD_SINGLE_DATUM) &&
+ if ((obj_desc->common_field.flags & AOPOBJ_SINGLE_DATUM) &&
obj_desc->common_field.end_field_valid_bits) {
/* There are bits above the field, mask them off also */
- mask &= MASK_BITS_ABOVE (obj_desc->common_field.end_field_valid_bits);
+ mask &= ACPI_MASK_BITS_ABOVE (obj_desc->common_field.end_field_valid_bits);
}
/* Shift and mask the value into the field position */
/* Apply the update rule (if necessary) and write the datum to the field */
- status = acpi_ex_write_field_datum_with_update_rule (obj_desc, mask, merged_datum,
+ status = acpi_ex_write_with_update_rule (obj_desc, mask, merged_datum,
field_datum_byte_offset);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
/* If the entire field fits within one datum, we are done. */
if ((datum_count == 1) &&
- (obj_desc->common_field.access_flags & AFIELD_SINGLE_DATUM)) {
+ (obj_desc->common_field.flags & AOPOBJ_SINGLE_DATUM)) {
return_ACPI_STATUS (AE_OK);
}
(previous_raw_datum >> obj_desc->common_field.datum_valid_bits) |
(this_raw_datum << obj_desc->common_field.start_field_bit_offset);
}
-
else {
/* Field began aligned on datum boundary */
*
* Mask off the unused bits above (after) the end-of-field
*/
- mask = MASK_BITS_ABOVE (obj_desc->common_field.end_field_valid_bits);
+ mask = ACPI_MASK_BITS_ABOVE (obj_desc->common_field.end_field_valid_bits);
merged_datum &= mask;
/* Write the last datum with the update rule */
- status = acpi_ex_write_field_datum_with_update_rule (obj_desc, mask,
- merged_datum, field_datum_byte_offset);
+ status = acpi_ex_write_with_update_rule (obj_desc, mask, merged_datum,
+ field_datum_byte_offset);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
}
}
-
else {
/* Normal case -- write the completed datum */
- status = acpi_ex_write_field_datum (obj_desc,
- field_datum_byte_offset, merged_datum);
+ status = acpi_ex_field_datum_io (obj_desc, field_datum_byte_offset,
+ &merged_datum, ACPI_WRITE);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/******************************************************************************
*
* Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes
- * $Revision: 92 $
+ * $Revision: 100 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exmisc")
+ ACPI_MODULE_NAME ("exmisc")
/*******************************************************************************
acpi_status status = AE_OK;
- FUNCTION_TRACE_PTR ("Ex_get_object_reference", obj_desc);
+ ACPI_FUNCTION_TRACE_PTR ("Ex_get_object_reference", obj_desc);
- if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_INTERNAL)) {
+ switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) {
+ case ACPI_DESC_TYPE_INTERNAL:
+
if (obj_desc->common.type != INTERNAL_TYPE_REFERENCE) {
*return_desc = NULL;
status = AE_TYPE;
case AML_LOCAL_OP:
case AML_ARG_OP:
- *return_desc = (void *) acpi_ds_method_data_get_node (obj_desc->reference.opcode,
- obj_desc->reference.offset, walk_state);
+ status = acpi_ds_method_data_get_node (obj_desc->reference.opcode,
+ obj_desc->reference.offset, walk_state,
+ (acpi_namespace_node **) return_desc);
break;
default:
status = AE_AML_INTERNAL;
goto cleanup;
}
+ break;
- }
- else if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) {
+ case ACPI_DESC_TYPE_NAMED:
+
/* Must be a named object; Just return the Node */
*return_desc = obj_desc;
- }
+ break;
+
+
+ default:
- else {
*return_desc = NULL;
status = AE_TYPE;
+ break;
}
/*******************************************************************************
*
- * FUNCTION: Acpi_ex_do_concatenate
+ * FUNCTION: Acpi_ex_concat_template
*
* PARAMETERS: *Obj_desc - Object to be converted. Must be an
* Integer, Buffer, or String
*
* RETURN: Status
*
+ * DESCRIPTION: Concatenate two resource templates
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ex_concat_template (
+ acpi_operand_object *obj_desc1,
+ acpi_operand_object *obj_desc2,
+ acpi_operand_object **actual_return_desc,
+ acpi_walk_state *walk_state)
+{
+ acpi_status status;
+ acpi_operand_object *return_desc;
+ NATIVE_CHAR *new_buf;
+ u8 *end_tag1;
+ u8 *end_tag2;
+ ACPI_SIZE length1;
+ ACPI_SIZE length2;
+
+
+ ACPI_FUNCTION_TRACE ("Ex_concat_template");
+
+
+ /* Find the End_tags in each resource template */
+
+ end_tag1 = acpi_ut_get_resource_end_tag (obj_desc1);
+ end_tag2 = acpi_ut_get_resource_end_tag (obj_desc2);
+ if (!end_tag1 || !end_tag2) {
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+
+ /* Create a new buffer object for the result */
+
+ return_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
+ if (!return_desc) {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Allocate a new buffer for the result */
+
+ length1 = ACPI_PTR_DIFF (end_tag1, obj_desc1->buffer.pointer);
+ length2 = ACPI_PTR_DIFF (end_tag2, obj_desc2->buffer.pointer) +
+ 2; /* Size of END_TAG */
+
+ new_buf = ACPI_MEM_ALLOCATE (length1 + length2);
+ if (!new_buf) {
+ ACPI_REPORT_ERROR
+ (("Ex_concat_template: Buffer allocation failure\n"));
+ status = AE_NO_MEMORY;
+ goto cleanup;
+ }
+
+ /* Copy the templates to the new descriptor */
+
+ ACPI_MEMCPY (new_buf, obj_desc1->buffer.pointer, length1);
+ ACPI_MEMCPY (new_buf + length1, obj_desc2->buffer.pointer, length2);
+
+ /*
+ * Point the return object to the new buffer
+ */
+ return_desc->buffer.pointer = (u8 *) new_buf;
+ return_desc->buffer.length = length1 + length2;
+
+ /* Compute the new checksum */
+
+ new_buf[return_desc->buffer.length - 1] =
+ acpi_ut_generate_checksum (return_desc->buffer.pointer,
+ (return_desc->buffer.length - 1));
+
+ /* Return the completed template descriptor */
+
+ *actual_return_desc = return_desc;
+ return_ACPI_STATUS (AE_OK);
+
+
+cleanup:
+
+ acpi_ut_remove_reference (return_desc);
+ return_ACPI_STATUS (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ex_do_concatenate
+ *
+ * PARAMETERS: Obj_desc1 - First source object
+ * Obj_desc2 - Second source object
+ * Actual_return_desc - Where to place the return object
+ * Walk_state - Current walk state
+ *
+ * RETURN: Status
+ *
* DESCRIPTION: Concatenate two objects OF THE SAME TYPE.
*
******************************************************************************/
acpi_status
acpi_ex_do_concatenate (
- acpi_operand_object *obj_desc,
+ acpi_operand_object *obj_desc1,
acpi_operand_object *obj_desc2,
acpi_operand_object **actual_return_desc,
acpi_walk_state *walk_state)
u32 integer_size = sizeof (acpi_integer);
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/*
* 2) Two Strings concatenated to produce a string
* 3) Two Buffers concatenated to produce a buffer
*/
- switch (obj_desc->common.type) {
+ switch (obj_desc1->common.type) {
case ACPI_TYPE_INTEGER:
/* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
return_desc->buffer.length = integer_size * 2;
new_buf = ACPI_MEM_CALLOCATE (return_desc->buffer.length);
if (!new_buf) {
- REPORT_ERROR
+ ACPI_REPORT_ERROR
(("Ex_do_concatenate: Buffer allocation failure\n"));
status = AE_NO_MEMORY;
goto cleanup;
/* Convert the first integer */
- this_integer = obj_desc->integer.value;
+ this_integer = obj_desc1->integer.value;
for (i = 0; i < integer_size; i++) {
new_buf[i] = (u8) this_integer;
this_integer >>= 8;
/* Operand0 is string */
- new_buf = ACPI_MEM_ALLOCATE (obj_desc->string.length +
+ new_buf = ACPI_MEM_ALLOCATE (obj_desc1->string.length +
obj_desc2->string.length + 1);
if (!new_buf) {
- REPORT_ERROR
+ ACPI_REPORT_ERROR
(("Ex_do_concatenate: String allocation failure\n"));
status = AE_NO_MEMORY;
goto cleanup;
}
- STRCPY (new_buf, obj_desc->string.pointer);
- STRCPY (new_buf + obj_desc->string.length,
+ ACPI_STRCPY (new_buf, obj_desc1->string.pointer);
+ ACPI_STRCPY (new_buf + obj_desc1->string.length,
obj_desc2->string.pointer);
/* Point the return object to the new string */
return_desc->string.pointer = new_buf;
- return_desc->string.length = obj_desc->string.length +=
- obj_desc2->string.length;
+ return_desc->string.length = obj_desc1->string.length +
+ obj_desc2->string.length;
break;
return (AE_NO_MEMORY);
}
- new_buf = ACPI_MEM_ALLOCATE (obj_desc->buffer.length +
+ new_buf = ACPI_MEM_ALLOCATE (obj_desc1->buffer.length +
obj_desc2->buffer.length);
if (!new_buf) {
- REPORT_ERROR
+ ACPI_REPORT_ERROR
(("Ex_do_concatenate: Buffer allocation failure\n"));
status = AE_NO_MEMORY;
goto cleanup;
}
- MEMCPY (new_buf, obj_desc->buffer.pointer,
- obj_desc->buffer.length);
- MEMCPY (new_buf + obj_desc->buffer.length, obj_desc2->buffer.pointer,
+ ACPI_MEMCPY (new_buf, obj_desc1->buffer.pointer,
+ obj_desc1->buffer.length);
+ ACPI_MEMCPY (new_buf + obj_desc1->buffer.length, obj_desc2->buffer.pointer,
obj_desc2->buffer.length);
/*
* Point the return object to the new buffer
*/
- return_desc->buffer.pointer = (u8 *) new_buf;
- return_desc->buffer.length = obj_desc->buffer.length +
- obj_desc2->buffer.length;
+ return_desc->buffer.pointer = (u8 *) new_buf;
+ return_desc->buffer.length = obj_desc1->buffer.length +
+ obj_desc2->buffer.length;
break;
return_desc = NULL;
}
-
*actual_return_desc = return_desc;
return (AE_OK);
*
* PARAMETERS: Opcode - AML opcode
* Operand0 - Integer operand #0
- * Operand0 - Integer operand #1
+ * Operand1 - Integer operand #1
*
* RETURN: Integer result of the operation
*
*
* PARAMETERS: Opcode - AML opcode
* Operand0 - Integer operand #0
- * Operand0 - Integer operand #1
+ * Operand1 - Integer operand #1
*
* RETURN: TRUE/FALSE result of the operation
*
/******************************************************************************
*
* Module Name: exmutex - ASL Mutex Acquire/Release functions
- * $Revision: 7 $
+ * $Revision: 10 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acevents.h"
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exmutex")
+ ACPI_MODULE_NAME ("exmutex")
/*******************************************************************************
acpi_ex_unlink_mutex (
acpi_operand_object *obj_desc)
{
+ ACPI_THREAD_STATE *thread = obj_desc->mutex.owner_thread;
+
+
+ if (!thread) {
+ return;
+ }
if (obj_desc->mutex.next) {
(obj_desc->mutex.next)->mutex.prev = obj_desc->mutex.prev;
}
+
if (obj_desc->mutex.prev) {
(obj_desc->mutex.prev)->mutex.next = obj_desc->mutex.next;
}
+ else {
+ thread->acquired_mutex_list = obj_desc->mutex.next;
+ }
}
void
acpi_ex_link_mutex (
acpi_operand_object *obj_desc,
- acpi_operand_object *list_head)
+ ACPI_THREAD_STATE *thread)
{
+ acpi_operand_object *list_head;
+
+
+ list_head = thread->acquired_mutex_list;
/* This object will be the first object in the list */
- obj_desc->mutex.prev = list_head;
- obj_desc->mutex.next = list_head->mutex.next;
+ obj_desc->mutex.prev = NULL;
+ obj_desc->mutex.next = list_head;
/* Update old first object to point back to this object */
- if (list_head->mutex.next) {
- (list_head->mutex.next)->mutex.prev = obj_desc;
+ if (list_head) {
+ list_head->mutex.prev = obj_desc;
}
/* Update list head */
- list_head->mutex.next = obj_desc;
+ thread->acquired_mutex_list = obj_desc;
}
acpi_status status;
- FUNCTION_TRACE_PTR ("Ex_acquire_mutex", obj_desc);
+ ACPI_FUNCTION_TRACE_PTR ("Ex_acquire_mutex", obj_desc);
if (!obj_desc) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
* Current Sync must be less than or equal to the sync level of the
* mutex. This mechanism provides some deadlock prevention
*/
- if (walk_state->current_sync_level > obj_desc->mutex.sync_level) {
+ if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) {
return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
}
/*
- * If the mutex is already owned by this thread,
- * just increment the acquisition depth
+ * Support for multiple acquires by the owning thread
*/
- if (obj_desc->mutex.owner == walk_state) {
+ if (obj_desc->mutex.owner_thread == walk_state->thread) {
+ /*
+ * The mutex is already owned by this thread,
+ * just increment the acquisition depth
+ */
obj_desc->mutex.acquisition_depth++;
return_ACPI_STATUS (AE_OK);
}
/* Have the mutex, update mutex and walk info */
- obj_desc->mutex.owner = walk_state;
+ obj_desc->mutex.owner_thread = walk_state->thread;
obj_desc->mutex.acquisition_depth = 1;
- walk_state->current_sync_level = obj_desc->mutex.sync_level;
- /* Link the mutex to the walk state for force-unlock at method exit */
+ walk_state->thread->current_sync_level = obj_desc->mutex.sync_level;
- acpi_ex_link_mutex (obj_desc, (acpi_operand_object *)
- &(walk_state->walk_list->acquired_mutex_list));
+ /* Link the mutex to the current thread for force-unlock at method exit */
+
+ acpi_ex_link_mutex (obj_desc, walk_state->thread);
return_ACPI_STATUS (AE_OK);
}
acpi_status status;
- FUNCTION_TRACE ("Ex_release_mutex");
+ ACPI_FUNCTION_TRACE ("Ex_release_mutex");
if (!obj_desc) {
/* The mutex must have been previously acquired in order to release it */
- if (!obj_desc->mutex.owner) {
+ if (!obj_desc->mutex.owner_thread) {
return_ACPI_STATUS (AE_AML_MUTEX_NOT_ACQUIRED);
}
/* The Mutex is owned, but this thread must be the owner */
- if (obj_desc->mutex.owner != walk_state) {
+ if (obj_desc->mutex.owner_thread != walk_state->thread) {
return_ACPI_STATUS (AE_AML_NOT_OWNER);
}
* The sync level of the mutex must be less than or
* equal to the current sync level
*/
- if (obj_desc->mutex.sync_level > walk_state->current_sync_level) {
+ if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) {
return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
}
return_ACPI_STATUS (AE_OK);
}
+ /* Unlink the mutex from the owner's list */
+
+ acpi_ex_unlink_mutex (obj_desc);
/* Release the mutex */
/* Update the mutex and walk state */
- obj_desc->mutex.owner = NULL;
- walk_state->current_sync_level = obj_desc->mutex.sync_level;
-
- /* Unlink the mutex from the owner's list */
-
- acpi_ex_unlink_mutex (obj_desc);
+ obj_desc->mutex.owner_thread = NULL;
+ walk_state->thread->current_sync_level = obj_desc->mutex.sync_level;
return_ACPI_STATUS (status);
}
acpi_status
acpi_ex_release_all_mutexes (
- acpi_operand_object *list_head)
+ ACPI_THREAD_STATE *thread)
{
- acpi_operand_object *next = list_head->mutex.next;
+ acpi_operand_object *next = thread->acquired_mutex_list;
acpi_operand_object *this;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/*
this = next;
next = this->mutex.next;
- /* Mark mutex un-owned */
-
- this->mutex.owner = NULL;
- this->mutex.prev = NULL;
- this->mutex.next = NULL;
- this->mutex.acquisition_depth = 0;
+ this->mutex.acquisition_depth = 1;
+ this->mutex.prev = NULL;
+ this->mutex.next = NULL;
/* Release the mutex */
acpi_ex_system_release_mutex (this);
+
+ /* Mark mutex unowned */
+
+ this->mutex.owner_thread = NULL;
}
return (AE_OK);
/******************************************************************************
*
* Module Name: exnames - interpreter/scanner name load/execute
- * $Revision: 83 $
+ * $Revision: 90 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acnamesp.h"
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exnames")
+ ACPI_MODULE_NAME ("exnames")
/* AML Package Length encodings */
NATIVE_CHAR *name_string;
u32 size_needed;
- FUNCTION_TRACE ("Ex_allocate_name_string");
+ ACPI_FUNCTION_TRACE ("Ex_allocate_name_string");
/*
* Also, one byte for the null terminator.
* This may actually be somewhat longer than needed.
*/
- if (prefix_count == (u32) -1) {
+ if (prefix_count == ACPI_UINT32_MAX) {
/* Special case for root */
size_needed = 1 + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1;
*/
name_string = ACPI_MEM_ALLOCATE (size_needed);
if (!name_string) {
- REPORT_ERROR (("Ex_allocate_name_string: Could not allocate size %d\n", size_needed));
+ ACPI_REPORT_ERROR (("Ex_allocate_name_string: Could not allocate size %d\n", size_needed));
return_PTR (NULL);
}
/* Set up Root or Parent prefixes if needed */
- if (prefix_count == (u32) -1) {
+ if (prefix_count == ACPI_UINT32_MAX) {
*temp_ptr++ = AML_ROOT_PREFIX;
}
-
else {
while (prefix_count--) {
*temp_ptr++ = AML_PARENT_PREFIX;
*temp_ptr++ = AML_MULTI_NAME_PREFIX_OP;
*temp_ptr++ = (char) num_name_segs;
}
-
else if (2 == num_name_segs) {
/* Set up dual prefixes */
NATIVE_CHAR char_buf[5];
- FUNCTION_TRACE ("Ex_name_segment");
+ ACPI_FUNCTION_TRACE ("Ex_name_segment");
/*
for (index = 4;
(index > 0) && (acpi_ut_valid_acpi_character (*aml_address));
- --index) {
+ index--) {
char_buf[4 - index] = *aml_address++;
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "%c\n", char_buf[4 - index]));
}
char_buf[4] = '\0';
if (name_string) {
- STRCAT (name_string, char_buf);
+ ACPI_STRCAT (name_string, char_buf);
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Appended to - %s \n", name_string));
}
-
else {
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"No Name string - %s \n", char_buf));
}
}
-
else if (4 == index) {
/*
* First character was not a valid name character,
char_buf[0]));
status = AE_CTRL_PENDING;
}
-
else {
/* Segment started with one or more valid characters, but fewer than 4 */
*
******************************************************************************/
-
acpi_status
acpi_ex_get_name_string (
- acpi_object_type8 data_type,
+ acpi_object_type data_type,
u8 *in_aml_address,
NATIVE_CHAR **out_name_string,
u32 *out_name_length)
NATIVE_CHAR *name_string = NULL;
u32 num_segments;
u32 prefix_count = 0;
- u8 prefix = 0;
u8 has_prefix = FALSE;
- FUNCTION_TRACE_PTR ("Ex_get_name_string", aml_address);
+ ACPI_FUNCTION_TRACE_PTR ("Ex_get_name_string", aml_address);
if (INTERNAL_TYPE_REGION_FIELD == data_type ||
status = acpi_ex_name_segment (&aml_address, name_string);
}
}
-
else {
/*
* Data_type is not a field name.
* Examine first character of name for root or parent prefix operators
*/
switch (*aml_address) {
-
case AML_ROOT_PREFIX:
- prefix = *aml_address++;
- ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Root_prefix: %x\n", prefix));
+ ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Root_prefix(\\) at %p\n", aml_address));
/*
* Remember that we have a Root_prefix --
* see comment in Acpi_ex_allocate_name_string()
*/
- prefix_count = (u32) -1;
+ aml_address++;
+ prefix_count = ACPI_UINT32_MAX;
has_prefix = TRUE;
break;
/* Increment past possibly multiple parent prefixes */
do {
- prefix = *aml_address++;
- ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Parent_prefix: %x\n", prefix));
+ ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Parent_prefix (^) at %p\n", aml_address));
- ++prefix_count;
+ aml_address++;
+ prefix_count++;
} while (*aml_address == AML_PARENT_PREFIX);
+
has_prefix = TRUE;
break;
default:
+ /* Not a prefix character */
+
break;
}
/* Examine first character of name for name segment prefix operator */
switch (*aml_address) {
-
case AML_DUAL_NAME_PREFIX:
- prefix = *aml_address++;
- ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Dual_name_prefix: %x\n", prefix));
+ ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Dual_name_prefix at %p\n", aml_address));
+ aml_address++;
name_string = acpi_ex_allocate_name_string (prefix_count, 2);
if (!name_string) {
status = AE_NO_MEMORY;
case AML_MULTI_NAME_PREFIX_OP:
- prefix = *aml_address++;
- ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Multi_name_prefix: %x\n", prefix));
+ ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Multi_name_prefix at %p\n", aml_address));
/* Fetch count of segments remaining in name path */
- num_segments = *aml_address++;
+ aml_address++;
+ num_segments = *aml_address;
name_string = acpi_ex_allocate_name_string (prefix_count, num_segments);
if (!name_string) {
/* Indicate that we processed a prefix */
+ aml_address++;
has_prefix = TRUE;
while (num_segments &&
(status = acpi_ex_name_segment (&aml_address, name_string)) == AE_OK) {
- --num_segments;
+ num_segments--;
}
break;
/* Null_name valid as of 8-12-98 ASL/AML Grammar Update */
- if (-1 == prefix_count) {
+ if (prefix_count == ACPI_UINT32_MAX) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Name_seg is \"\\\" followed by NULL\n"));
}
status = acpi_ex_name_segment (&aml_address, name_string);
break;
-
- } /* Switch (Peek_op ()) */
+ }
}
-
if (AE_CTRL_PENDING == status && has_prefix) {
/* Ran out of segments after processing a prefix */
- REPORT_ERROR (
+ ACPI_REPORT_ERROR (
("Ex_do_name: Malformed Name at %p\n", name_string));
status = AE_AML_BAD_NAME;
}
-
*out_name_string = name_string;
*out_name_length = (u32) (aml_address - in_aml_address);
/******************************************************************************
*
* Module Name: exoparg1 - AML execution - opcodes with 1 argument
- * $Revision: 120 $
+ * $Revision: 134 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exoparg1")
+ ACPI_MODULE_NAME ("exoparg1")
/*!
acpi_status status = AE_OK;
- FUNCTION_TRACE_STR ("Ex_opcode_1A_0T_0R", acpi_ps_get_opcode_name (walk_state->opcode));
+ ACPI_FUNCTION_TRACE_STR ("Ex_opcode_1A_0T_0R", acpi_ps_get_opcode_name (walk_state->opcode));
- /* Examine the opcode */
+ /* Examine the AML opcode */
switch (walk_state->opcode) {
case AML_RELEASE_OP: /* Release (Mutex_object) */
case AML_SLEEP_OP: /* Sleep (Msec_time) */
- acpi_ex_system_do_suspend ((u32) operand[0]->integer.value);
+ status = acpi_ex_system_do_suspend ((u32) operand[0]->integer.value);
break;
case AML_STALL_OP: /* Stall (Usec_time) */
- acpi_ex_system_do_stall ((u32) operand[0]->integer.value);
+ status = acpi_ex_system_do_stall ((u32) operand[0]->integer.value);
break;
default: /* Unknown opcode */
- REPORT_ERROR (("Acpi_ex_opcode_1A_0T_0R: Unknown opcode %X\n",
+ ACPI_REPORT_ERROR (("Acpi_ex_opcode_1A_0T_0R: Unknown opcode %X\n",
walk_state->opcode));
status = AE_AML_BAD_OPCODE;
break;
acpi_operand_object **operand = &walk_state->operands[0];
- FUNCTION_TRACE_STR ("Ex_opcode_1A_1T_0R", acpi_ps_get_opcode_name (walk_state->opcode));
+ ACPI_FUNCTION_TRACE_STR ("Ex_opcode_1A_1T_0R", acpi_ps_get_opcode_name (walk_state->opcode));
- switch (walk_state->opcode) {
+ /* Examine the AML opcode */
+ switch (walk_state->opcode) {
case AML_LOAD_OP:
- status = acpi_ex_load_op (operand[0], operand[1]);
+ status = acpi_ex_load_op (operand[0], operand[1], walk_state);
break;
default: /* Unknown opcode */
- REPORT_ERROR (("Acpi_ex_opcode_1A_1T_0R: Unknown opcode %X\n",
+ ACPI_REPORT_ERROR (("Acpi_ex_opcode_1A_1T_0R: Unknown opcode %X\n",
walk_state->opcode));
status = AE_AML_BAD_OPCODE;
goto cleanup;
acpi_integer digit;
- FUNCTION_TRACE_STR ("Ex_opcode_1A_1T_1R", acpi_ps_get_opcode_name (walk_state->opcode));
+ ACPI_FUNCTION_TRACE_STR ("Ex_opcode_1A_1T_1R", acpi_ps_get_opcode_name (walk_state->opcode));
/* Create a return object of type Integer for most opcodes */
break;
}
+ /* Examine the AML opcode */
switch (walk_state->opcode) {
case AML_FIND_SET_LEFT_BIT_OP: /* Find_set_left_bit (Operand, Result) */
-
return_desc->integer.value = operand[0]->integer.value;
/*
case AML_FIND_SET_RIGHT_BIT_OP: /* Find_set_right_bit (Operand, Result) */
-
return_desc->integer.value = operand[0]->integer.value;
/*
if (operand[0]->integer.value > ACPI_MAX_BCD_VALUE) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "BCD overflow: %8.8X%8.8X\n",
- HIDWORD(operand[0]->integer.value), LODWORD(operand[0]->integer.value)));
+ ACPI_HIDWORD(operand[0]->integer.value),
+ ACPI_LODWORD(operand[0]->integer.value)));
status = AE_AML_NUMERIC_OVERFLOW;
goto cleanup;
}
/* Create the BCD digit from the remainder above */
if (digit > 0) {
- return_desc->integer.value += (temp32 << (i * 4));
+ return_desc->integer.value += ((acpi_integer) temp32 << (i * 4));
}
}
break;
return_desc->integer.value = ACPI_INTEGER_MAX;
goto cleanup;
- break;
case AML_STORE_OP: /* Store (Source, Target) */
walk_state->result_obj = operand[0];
walk_state->operands[0] = NULL; /* Prevent deletion */
return_ACPI_STATUS (status);
- break;
/*
*/
case AML_COPY_OP: /* Copy (Source, Target) */
- status = AE_NOT_IMPLEMENTED;
- goto cleanup;
+ status = acpi_ut_copy_iobject_to_iobject (operand[0], &return_desc, walk_state);
break;
break;
- /*
- * These are two obsolete opcodes
- */
case AML_SHIFT_LEFT_BIT_OP: /* Shift_left_bit (Source, Bit_num) */
case AML_SHIFT_RIGHT_BIT_OP: /* Shift_right_bit (Source, Bit_num) */
-
+ /*
+ * These are two obsolete opcodes
+ */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s is obsolete and not implemented\n",
acpi_ps_get_opcode_name (walk_state->opcode)));
status = AE_SUPPORT;
goto cleanup;
- break;
default: /* Unknown opcode */
- REPORT_ERROR (("Acpi_ex_opcode_1A_1T_1R: Unknown opcode %X\n",
+ ACPI_REPORT_ERROR (("Acpi_ex_opcode_1A_1T_1R: Unknown opcode %X\n",
walk_state->opcode));
status = AE_AML_BAD_OPCODE;
goto cleanup;
}
-
/*
* Store the return value computed above into the target object
*/
acpi_integer value;
- FUNCTION_TRACE_STR ("Ex_opcode_1A_0T_0R", acpi_ps_get_opcode_name (walk_state->opcode));
+ ACPI_FUNCTION_TRACE_STR ("Ex_opcode_1A_0T_0R", acpi_ps_get_opcode_name (walk_state->opcode));
- /* Get the operand and decode the opcode */
+ /* Examine the AML opcode */
switch (walk_state->opcode) {
-
case AML_LNOT_OP: /* LNot (Operand) */
return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
/*
* Since we are expecting a Reference operand, it
- * can be either a Node or an internal object.
+ * can be either a NS Node or an internal object.
*/
return_desc = operand[0];
- if (VALID_DESCRIPTOR_TYPE (operand[0], ACPI_DESC_TYPE_INTERNAL)) {
+ if (ACPI_GET_DESCRIPTOR_TYPE (operand[0]) == ACPI_DESC_TYPE_INTERNAL) {
/* Internal reference object - prevent deletion */
acpi_ut_add_reference (return_desc);
case AML_DEBUG_OP:
- /* Per 1.0b spec, Debug object is of type "Debug_object" */
+ /* The Debug Object is of type "Debug_object" */
type = ACPI_TYPE_DEBUG_OBJECT;
break;
*/
type = (*(operand[0]->reference.where))->common.type;
}
-
break;
default:
- REPORT_ERROR (("Acpi_ex_opcode_1A_0T_1R/Type_op: Internal error - Unknown Reference subtype %X\n",
+ ACPI_REPORT_ERROR (("Acpi_ex_opcode_1A_0T_1R/Type_op: Internal error - Unknown Reference subtype %X\n",
operand[0]->reference.opcode));
status = AE_AML_INTERNAL;
goto cleanup;
}
}
-
else {
/*
* It's not a Reference, so it must be a direct name pointer.
case AML_SIZE_OF_OP: /* Size_of (Source_object) */
temp_desc = operand[0];
- if (VALID_DESCRIPTOR_TYPE (operand[0], ACPI_DESC_TYPE_NAMED)) {
+ if (ACPI_GET_DESCRIPTOR_TYPE (operand[0]) == ACPI_DESC_TYPE_NAMED) {
temp_desc = acpi_ns_get_attached_object ((acpi_namespace_node *) operand[0]);
}
if (!temp_desc) {
value = 0;
}
-
else {
+ /*
+ * Type is guaranteed to be a buffer, string, or package at this
+ * point (even if the original operand was an object reference, it
+ * will be resolved and typechecked during operand resolution.)
+ */
switch (temp_desc->common.type) {
case ACPI_TYPE_BUFFER:
value = temp_desc->buffer.length;
value = temp_desc->package.count;
break;
- case INTERNAL_TYPE_REFERENCE:
-
- /* TBD: this must be a reference to a buf/str/pkg?? */
-
- value = 4;
- break;
-
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Not Buf/Str/Pkg - found type %X\n",
- temp_desc->common.type));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Size_of, Not Buf/Str/Pkg - found type %s\n",
+ acpi_ut_get_type_name (temp_desc->common.type)));
status = AE_AML_OPERAND_TYPE;
goto cleanup;
}
break;
- case AML_DEREF_OF_OP: /* Deref_of (Obj_reference) */
+ case AML_DEREF_OF_OP: /* Deref_of (Obj_reference | String) */
- /* Check for a method local or argument */
+ /* Check for a method local or argument, or standalone String */
- if (!VALID_DESCRIPTOR_TYPE (operand[0], ACPI_DESC_TYPE_NAMED)) {
- /*
- * Must resolve/dereference the local/arg reference first
- */
- switch (operand[0]->reference.opcode) {
- /* Set Operand[0] to the value of the local/arg */
+ if (ACPI_GET_DESCRIPTOR_TYPE (operand[0]) != ACPI_DESC_TYPE_NAMED) {
+ switch (ACPI_GET_OBJECT_TYPE (operand[0])) {
+ case INTERNAL_TYPE_REFERENCE:
+ /*
+ * This is a Deref_of (Local_x | Arg_x)
+ *
+ * Must resolve/dereference the local/arg reference first
+ */
+ switch (operand[0]->reference.opcode) {
+ case AML_LOCAL_OP:
+ case AML_ARG_OP:
- case AML_LOCAL_OP:
- case AML_ARG_OP:
+ /* Set Operand[0] to the value of the local/arg */
- acpi_ds_method_data_get_value (operand[0]->reference.opcode,
- operand[0]->reference.offset, walk_state, &temp_desc);
+ acpi_ds_method_data_get_value (operand[0]->reference.opcode,
+ operand[0]->reference.offset, walk_state, &temp_desc);
- /*
- * Delete our reference to the input object and
- * point to the object just retrieved
- */
- acpi_ut_remove_reference (operand[0]);
- operand[0] = temp_desc;
- break;
+ /*
+ * Delete our reference to the input object and
+ * point to the object just retrieved
+ */
+ acpi_ut_remove_reference (operand[0]);
+ operand[0] = temp_desc;
+ break;
- default:
+ default:
- /* Index op - handled below */
+ /* Must be an Index op - handled below */
+ break;
+ }
break;
- }
- }
- /* Operand[0] may have changed from the code above */
-
- if (VALID_DESCRIPTOR_TYPE (operand[0], ACPI_DESC_TYPE_NAMED)) {
- /* Get the actual object from the Node (This is the dereference) */
+ case ACPI_TYPE_STRING:
- return_desc = ((acpi_namespace_node *) operand[0])->object;
+ /*
+ * This is a Deref_of (String). The string is a reference to a named ACPI object.
+ *
+ * 1) Find the owning Node
+ * 2) Dereference the node to an actual object. Could be a Field, so we nee
+ * to resolve the node to a value.
+ */
+ status = acpi_ns_get_node_by_path (operand[0]->string.pointer, walk_state->scope_info->scope.node,
+ ACPI_NS_SEARCH_PARENT, (acpi_namespace_node **) &return_desc);
+ if (ACPI_FAILURE (status)) {
+ goto cleanup;
+ }
- /* Returning a pointer to the object, add another reference! */
+ status = acpi_ex_resolve_node_to_value ((acpi_namespace_node **) &return_desc, walk_state);
+ goto cleanup;
- acpi_ut_add_reference (return_desc);
- }
- else {
- /*
- * This must be a reference object produced by the Index
- * ASL operation -- check internal opcode
- */
- if ((operand[0]->reference.opcode != AML_INDEX_OP) &&
- (operand[0]->reference.opcode != AML_REF_OF_OP)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode in ref(%p) - %X\n",
- operand[0], operand[0]->reference.opcode));
+ default:
- status = AE_TYPE;
+ status = AE_AML_OPERAND_TYPE;
goto cleanup;
}
+ }
+ /* Operand[0] may have changed from the code above */
+ if (ACPI_GET_DESCRIPTOR_TYPE (operand[0]) == ACPI_DESC_TYPE_NAMED) {
+ /*
+ * This is a Deref_of (Object_reference)
+ * Get the actual object from the Node (This is the dereference).
+ * -- This case may only happen when a Local_x or Arg_x is dereferenced above.
+ */
+ return_desc = acpi_ns_get_attached_object ((acpi_namespace_node *) operand[0]);
+ }
+ else {
+ /*
+ * This must be a reference object produced by either the Index() or
+ * Ref_of() operator
+ */
switch (operand[0]->reference.opcode) {
case AML_INDEX_OP:
/*
- * Supported target types for the Index operator are
- * 1) A Buffer
- * 2) A Package
+ * The target type for the Index operator must be
+ * either a Buffer or a Package
*/
- if (operand[0]->reference.target_type == ACPI_TYPE_BUFFER_FIELD) {
+ switch (operand[0]->reference.target_type) {
+ case ACPI_TYPE_BUFFER_FIELD:
/*
* The target is a buffer, we must create a new object that
* contains one element of the buffer, the element pointed
goto cleanup;
}
+ /*
+ * Since we are returning the value of the buffer at the
+ * indexed location, we don't need to add an additional
+ * reference to the buffer itself.
+ */
temp_desc = operand[0]->reference.object;
return_desc->integer.value =
temp_desc->buffer.pointer[operand[0]->reference.offset];
+ break;
- /* TBD: [Investigate] (see below) Don't add an additional
- * ref!
- */
- }
- else if (operand[0]->reference.target_type == ACPI_TYPE_PACKAGE) {
+ case ACPI_TYPE_PACKAGE:
+
/*
* The target is a package, we want to return the referenced
* element of the package. We must add another reference to
* an uninitialized package element and is thus a
* severe error.
*/
-
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "NULL package element obj %p\n",
operand[0]));
status = AE_AML_UNINITIALIZED_ELEMENT;
}
acpi_ut_add_reference (return_desc);
- }
+ break;
+
+
+ default:
- else {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Target_type %X in obj %p\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Index Target_type %X in obj %p\n",
operand[0]->reference.target_type, operand[0]));
status = AE_AML_OPERAND_TYPE;
goto cleanup;
}
-
break;
acpi_ut_add_reference (return_desc);
break;
+
+
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode in ref(%p) - %X\n",
+ operand[0], operand[0]->reference.opcode));
+
+ status = AE_TYPE;
+ goto cleanup;
}
}
-
break;
default:
- REPORT_ERROR (("Acpi_ex_opcode_1A_0T_1R: Unknown opcode %X\n",
+ ACPI_REPORT_ERROR (("Acpi_ex_opcode_1A_0T_1R: Unknown opcode %X\n",
walk_state->opcode));
status = AE_AML_BAD_OPCODE;
goto cleanup;
/******************************************************************************
*
* Module Name: exoparg2 - AML execution - opcodes with 2 arguments
- * $Revision: 97 $
+ * $Revision: 104 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exoparg2")
+ ACPI_MODULE_NAME ("exoparg2")
/*!
acpi_status status = AE_OK;
- FUNCTION_TRACE_STR ("Ex_opcode_2A_0T_0R", acpi_ps_get_opcode_name (walk_state->opcode));
+ ACPI_FUNCTION_TRACE_STR ("Ex_opcode_2A_0T_0R", acpi_ps_get_opcode_name (walk_state->opcode));
/* Examine the opcode */
node = (acpi_namespace_node *) operand[0];
- /* The node must refer to a device or thermal zone */
+ /* The node must refer to a device or thermal zone or processor */
- if (node && operand[1]) /* TBD: is this check necessary? */ {
- switch (node->type) {
- case ACPI_TYPE_DEVICE:
- case ACPI_TYPE_THERMAL:
+ switch (node->type) {
+ case ACPI_TYPE_DEVICE:
+ case ACPI_TYPE_THERMAL:
+ case ACPI_TYPE_PROCESSOR:
- /*
- * Dispatch the notify to the appropriate handler
- * NOTE: the request is queued for execution after this method
- * completes. The notify handlers are NOT invoked synchronously
- * from this thread -- because handlers may in turn run other
- * control methods.
- */
- status = acpi_ev_queue_notify_request (node,
- (u32) operand[1]->integer.value);
- break;
+ /*
+ * Dispatch the notify to the appropriate handler
+ * NOTE: the request is queued for execution after this method
+ * completes. The notify handlers are NOT invoked synchronously
+ * from this thread -- because handlers may in turn run other
+ * control methods.
+ */
+ status = acpi_ev_queue_notify_request (node,
+ (u32) operand[1]->integer.value);
+ break;
- default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unexpected notify object type %X\n",
- node->type));
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unexpected notify object type %X\n",
+ node->type));
- status = AE_AML_OPERAND_TYPE;
- break;
- }
+ status = AE_AML_OPERAND_TYPE;
+ break;
}
break;
default:
- REPORT_ERROR (("Acpi_ex_opcode_2A_0T_0R: Unknown opcode %X\n", walk_state->opcode));
+ ACPI_REPORT_ERROR (("Acpi_ex_opcode_2A_0T_0R: Unknown opcode %X\n", walk_state->opcode));
status = AE_AML_BAD_OPCODE;
}
acpi_status status;
- FUNCTION_TRACE_STR ("Ex_opcode_2A_2T_1R", acpi_ps_get_opcode_name (walk_state->opcode));
+ ACPI_FUNCTION_TRACE_STR ("Ex_opcode_2A_2T_1R", acpi_ps_get_opcode_name (walk_state->opcode));
/*
default:
- REPORT_ERROR (("Acpi_ex_opcode_2A_2T_1R: Unknown opcode %X\n",
+ ACPI_REPORT_ERROR (("Acpi_ex_opcode_2A_2T_1R: Unknown opcode %X\n",
walk_state->opcode));
status = AE_AML_BAD_OPCODE;
goto cleanup;
- break;
}
acpi_status status = AE_OK;
- FUNCTION_TRACE_STR ("Ex_opcode_2A_1T_1R", acpi_ps_get_opcode_name (walk_state->opcode));
+ ACPI_FUNCTION_TRACE_STR ("Ex_opcode_2A_1T_1R", acpi_ps_get_opcode_name (walk_state->opcode));
/*
case AML_CONCAT_RES_OP: /* Concatenate_res_template (Buffer, Buffer, Result) (ACPI 2.0) */
- status = AE_NOT_IMPLEMENTED;
+ status = acpi_ex_concat_template (operand[0], operand[1], &return_desc, walk_state);
break;
walk_state->result_obj = return_desc;
goto cleanup;
- break;
default:
- REPORT_ERROR (("Acpi_ex_opcode_2A_1T_1R: Unknown opcode %X\n",
+ ACPI_REPORT_ERROR (("Acpi_ex_opcode_2A_1T_1R: Unknown opcode %X\n",
walk_state->opcode));
status = AE_AML_BAD_OPCODE;
break;
u8 logical_result = FALSE;
- FUNCTION_TRACE_STR ("Ex_opcode_2A_0T_1R", acpi_ps_get_opcode_name (walk_state->opcode));
+ ACPI_FUNCTION_TRACE_STR ("Ex_opcode_2A_0T_1R", acpi_ps_get_opcode_name (walk_state->opcode));
/* Create the internal return object */
default:
- REPORT_ERROR (("Acpi_ex_opcode_2A_0T_1R: Unknown opcode %X\n", walk_state->opcode));
+ ACPI_REPORT_ERROR (("Acpi_ex_opcode_2A_0T_1R: Unknown opcode %X\n", walk_state->opcode));
status = AE_AML_BAD_OPCODE;
goto cleanup;
- break;
}
/******************************************************************************
*
* Module Name: exoparg3 - AML execution - opcodes with 3 arguments
- * $Revision: 3 $
+ * $Revision: 9 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exoparg3")
+ ACPI_MODULE_NAME ("exoparg3")
/*!
acpi_status status = AE_OK;
- FUNCTION_TRACE_STR ("Ex_opcode_3A_0T_0R", acpi_ps_get_opcode_name (walk_state->opcode));
+ ACPI_FUNCTION_TRACE_STR ("Ex_opcode_3A_0T_0R", acpi_ps_get_opcode_name (walk_state->opcode));
switch (walk_state->opcode) {
default:
- REPORT_ERROR (("Acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n",
+ ACPI_REPORT_ERROR (("Acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n",
walk_state->opcode));
status = AE_AML_BAD_OPCODE;
goto cleanup;
- break;
}
u32 length;
- FUNCTION_TRACE_STR ("Ex_opcode_3A_1T_1R", acpi_ps_get_opcode_name (walk_state->opcode));
+ ACPI_FUNCTION_TRACE_STR ("Ex_opcode_3A_1T_1R", acpi_ps_get_opcode_name (walk_state->opcode));
switch (walk_state->opcode) {
buffer = ACPI_MEM_CALLOCATE (length + 1);
if (!buffer) {
- return (AE_NO_MEMORY);
+ status = AE_NO_MEMORY;
+ goto cleanup;
}
/* Copy the portion requested */
- MEMCPY (buffer, operand[0]->string.pointer + index,
- length);
+ ACPI_MEMCPY (buffer, operand[0]->string.pointer + index,
+ length);
/* Set the length of the new String/Buffer */
return_desc->string.pointer = buffer;
return_desc->string.length = length;
}
-
break;
default:
- REPORT_ERROR (("Acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n",
+ ACPI_REPORT_ERROR (("Acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n",
walk_state->opcode));
status = AE_AML_BAD_OPCODE;
goto cleanup;
- break;
}
/* Store the result in the target */
/******************************************************************************
*
* Module Name: exoparg6 - AML execution - opcodes with 6 arguments
- * $Revision: 4 $
+ * $Revision: 10 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exoparg6")
+ ACPI_MODULE_NAME ("exoparg6")
/*!
acpi_operand_object *this_element;
- FUNCTION_TRACE_STR ("Ex_opcode_6A_0T_1R", acpi_ps_get_opcode_name (walk_state->opcode));
+ ACPI_FUNCTION_TRACE_STR ("Ex_opcode_6A_0T_1R", acpi_ps_get_opcode_name (walk_state->opcode));
switch (walk_state->opcode) {
* Examine each element until a match is found. Within the loop,
* "continue" signifies that the current element does not match
* and the next should be examined.
+ *
* Upon finding a match, the loop will terminate via "break" at
* the bottom. If it terminates "normally", Match_value will be -1
* (its initial value) indicating that no match was found. When
/*
* Treat any NULL or non-numeric elements as non-matching.
- * TBD [Unhandled] - if an element is a Name,
- * should we examine its value?
*/
if (!this_element ||
this_element->common.type != ACPI_TYPE_INTEGER) {
continue;
}
-
/*
- * Within these switch statements:
- * "break" (exit from the switch) signifies a match;
- * "continue" (proceed to next iteration of enclosing
- * "for" loop) signifies a non-match.
+ * "continue" (proceed to next iteration of enclosing
+ * "for" loop) signifies a non-match.
*/
if (!acpi_ex_do_match ((u32) operand[1]->integer.value,
this_element->integer.value, operand[2]->integer.value)) {
continue;
}
-
if (!acpi_ex_do_match ((u32) operand[3]->integer.value,
this_element->integer.value, operand[4]->integer.value)) {
continue;
case AML_LOAD_TABLE_OP:
- status = AE_NOT_IMPLEMENTED;
- goto cleanup;
+ status = acpi_ex_load_table_op (walk_state, &return_desc);
break;
default:
- REPORT_ERROR (("Acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n",
+ ACPI_REPORT_ERROR (("Acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n",
walk_state->opcode));
status = AE_AML_BAD_OPCODE;
goto cleanup;
- break;
}
/******************************************************************************
*
* Module Name: exprep - ACPI AML (p-code) execution - field prep utilities
- * $Revision: 99 $
+ * $Revision: 114 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exprep")
+ ACPI_MODULE_NAME ("exprep")
/*******************************************************************************
*
- * FUNCTION: Acpi_ex_decode_field_access_type
+ * FUNCTION: Acpi_ex_decode_field_access
*
* PARAMETERS: Access - Encoded field access bits
* Length - Field length.
*
- * RETURN: Field granularity (8, 16, 32 or 64)
+ * RETURN: Field granularity (8, 16, 32 or 64) and
+ * Byte_alignment (1, 2, 3, or 4)
*
* DESCRIPTION: Decode the Access_type bits of a field definition.
*
******************************************************************************/
static u32
-acpi_ex_decode_field_access_type (
- u32 access,
- u16 length,
- u32 *alignment)
+acpi_ex_decode_field_access (
+ acpi_operand_object *obj_desc,
+ u8 field_flags,
+ u32 *return_byte_alignment)
{
- PROC_NAME ("Ex_decode_field_access_type");
+ u32 access;
+ u32 length;
+ u8 byte_alignment;
+ u8 bit_length;
+
+
+ ACPI_FUNCTION_NAME ("Ex_decode_field_access");
+
+ access = (field_flags & AML_FIELD_ACCESS_TYPE_MASK);
+ length = obj_desc->common_field.bit_length;
switch (access) {
- case ACCESS_ANY_ACC:
+ case AML_FIELD_ACCESS_ANY:
- *alignment = 8;
+ byte_alignment = 1;
+ bit_length = 8;
+
+#if 0
+ /*
+ * TBD: optimize
+ *
+ * Any attempt to optimize the access size to the size of the field
+ * must take into consideration the length of the region and take
+ * care that an access to the field will not attempt to access
+ * beyond the end of the region.
+ */
/* Use the length to set the access type */
if (length <= 8) {
- return (8);
+ bit_length = 8;
}
else if (length <= 16) {
- return (16);
+ bit_length = 16;
}
else if (length <= 32) {
- return (32);
+ bit_length = 32;
}
else if (length <= 64) {
- return (64);
+ bit_length = 64;
}
+ else {
+ /* Larger than Qword - just use byte-size chunks */
- /* Default is 8 (byte) */
+ bit_length = 8;
+ }
+#endif
+ break;
- return (8);
+ case AML_FIELD_ACCESS_BYTE:
+ byte_alignment = 1;
+ bit_length = 8;
break;
- case ACCESS_BYTE_ACC:
- *alignment = 8;
- return (8);
+ case AML_FIELD_ACCESS_WORD:
+ byte_alignment = 2;
+ bit_length = 16;
break;
- case ACCESS_WORD_ACC:
- *alignment = 16;
- return (16);
+ case AML_FIELD_ACCESS_DWORD:
+ byte_alignment = 4;
+ bit_length = 32;
break;
- case ACCESS_DWORD_ACC:
- *alignment = 32;
- return (32);
+ case AML_FIELD_ACCESS_QWORD: /* ACPI 2.0 */
+ byte_alignment = 8;
+ bit_length = 64;
break;
- case ACCESS_QWORD_ACC: /* ACPI 2.0 */
- *alignment = 64;
- return (64);
+ case AML_FIELD_ACCESS_BUFFER: /* ACPI 2.0 */
+ byte_alignment = 8;
+ bit_length = 8;
break;
default:
access));
return (0);
}
+
+ if (obj_desc->common.type == ACPI_TYPE_BUFFER_FIELD) {
+ /*
+ * Buffer_field access can be on any byte boundary, so the
+ * Byte_alignment is always 1 byte -- regardless of any Byte_alignment
+ * implied by the field access type.
+ */
+ byte_alignment = 1;
+ }
+
+ *return_byte_alignment = byte_alignment;
+ return (bit_length);
}
* RETURN: Status
*
* DESCRIPTION: Initialize the areas of the field object that are common
- * to the various types of fields.
+ * to the various types of fields. Note: This is very "sensitive"
+ * code because we are solving the general case for field
+ * alignment.
*
******************************************************************************/
acpi_ex_prep_common_field_object (
acpi_operand_object *obj_desc,
u8 field_flags,
+ u8 field_attribute,
u32 field_bit_position,
u32 field_bit_length)
{
u32 access_bit_width;
- u32 alignment;
+ u32 byte_alignment;
u32 nearest_byte_address;
- FUNCTION_TRACE ("Ex_prep_common_field_object");
+ ACPI_FUNCTION_TRACE ("Ex_prep_common_field_object");
/*
* Note: the structure being initialized is the
- * ACPI_COMMON_FIELD_INFO; No structure fields outside of the common area
- * are initialized by this procedure.
+ * ACPI_COMMON_FIELD_INFO; No structure fields outside of the common
+ * area are initialized by this procedure.
*/
-
- /* Demultiplex the Field_flags byte */
-
- obj_desc->common_field.lock_rule = (u8) ((field_flags & LOCK_RULE_MASK)
- >> LOCK_RULE_SHIFT);
- obj_desc->common_field.update_rule = (u8) ((field_flags & UPDATE_RULE_MASK)
- >> UPDATE_RULE_SHIFT);
- /* Other misc fields */
-
- obj_desc->common_field.bit_length = (u16) field_bit_length;
+ obj_desc->common_field.field_flags = field_flags;
+ obj_desc->common_field.attribute = field_attribute;
+ obj_desc->common_field.bit_length = field_bit_length;
/*
* Decode the access type so we can compute offsets. The access type gives
* two pieces of information - the width of each field access and the
- * necessary alignment of the access. For Any_acc, the width used is the
- * largest necessary/possible in an attempt to access the whole field in one
- * I/O operation. However, for Any_acc, the alignment is 8. For all other
- * access types (Byte, Word, Dword, Qword), the width is the same as the
- * alignment.
+ * necessary Byte_alignment (address granularity) of the access.
+ *
+ * For Any_acc, the Access_bit_width is the largest width that is both necessary
+ * and possible in an attempt to access the whole field in one
+ * I/O operation. However, for Any_acc, the Byte_alignment is always one byte.
+ *
+ * For all Buffer Fields, the Byte_alignment is always one byte.
+ *
+ * For all other access types (Byte, Word, Dword, Qword), the Bitwidth is the
+ * same (equivalent) as the Byte_alignment.
*/
- access_bit_width = acpi_ex_decode_field_access_type (
- ((field_flags & ACCESS_TYPE_MASK) >> ACCESS_TYPE_SHIFT),
- obj_desc->field.bit_length, &alignment);
+ access_bit_width = acpi_ex_decode_field_access (obj_desc, field_flags, &byte_alignment);
if (!access_bit_width) {
return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
}
/* Setup width (access granularity) fields */
- obj_desc->common_field.access_bit_width = (u8) access_bit_width; /* 8, 16, 32, 64 */
- obj_desc->common_field.access_byte_width = (u8) DIV_8 (access_bit_width); /* 1, 2, 4, 8 */
-
- if (obj_desc->common.type == ACPI_TYPE_BUFFER_FIELD) {
- /*
- * Buffer_field access can be on any byte boundary, so the
- * alignment is always 8 (regardless of any alignment implied by the
- * field access type.)
- */
- alignment = 8;
- }
-
+ obj_desc->common_field.access_byte_width = (u8) ACPI_DIV_8 (access_bit_width); /* 1, 2, 4, 8 */
/*
* Base_byte_offset is the address of the start of the field within the region. It is
* the byte address of the first *datum* (field-width data unit) of the field.
* (i.e., the first datum that contains at least the first *bit* of the field.)
+ * Note: Byte_alignment is always either equal to the Access_bit_width or 8 (Byte access),
+ * and it defines the addressing granularity of the parent region or buffer.
*/
- nearest_byte_address = ROUND_BITS_DOWN_TO_BYTES (field_bit_position);
- obj_desc->common_field.base_byte_offset = ROUND_DOWN (nearest_byte_address,
- DIV_8 (alignment));
+ nearest_byte_address = ACPI_ROUND_BITS_DOWN_TO_BYTES (field_bit_position);
+ obj_desc->common_field.base_byte_offset = ACPI_ROUND_DOWN (nearest_byte_address, byte_alignment);
/*
* Start_field_bit_offset is the offset of the first bit of the field within a field datum.
- * This is calculated as the number of bits from the Base_byte_offset. In other words,
- * the start of the field is relative to a byte address, regardless of the access type
- * of the field.
*/
- obj_desc->common_field.start_field_bit_offset = (u8) (MOD_8 (field_bit_position));
-
- /*
- * Datum_valid_bits is the number of valid field bits in the first field datum.
- */
- obj_desc->common_field.datum_valid_bits = (u8) (access_bit_width -
- obj_desc->common_field.start_field_bit_offset);
+ obj_desc->common_field.start_field_bit_offset = (u8) (field_bit_position -
+ ACPI_MUL_8 (obj_desc->common_field.base_byte_offset));
/*
* Valid bits -- the number of bits that compose a partial datum,
* 1) At the end of the field within the region (arbitrary starting bit offset)
* 2) At the end of a buffer used to contain the field (starting offset always zero)
*/
- obj_desc->common_field.end_field_valid_bits = (u8) ((obj_desc->common_field.start_field_bit_offset +
- field_bit_length) % access_bit_width);
+ obj_desc->common_field.end_field_valid_bits = (u8) ((obj_desc->common_field.start_field_bit_offset + field_bit_length) %
+ access_bit_width);
obj_desc->common_field.end_buffer_valid_bits = (u8) (field_bit_length % access_bit_width); /* Start_buffer_bit_offset always = 0 */
+ /*
+ * Datum_valid_bits is the number of valid field bits in the first field datum.
+ */
+ obj_desc->common_field.datum_valid_bits = (u8) (access_bit_width -
+ obj_desc->common_field.start_field_bit_offset);
/*
- * Does the entire field fit within a single field access element
- * (datum)? (without crossing a datum boundary)
+ * Does the entire field fit within a single field access element? (datum)
+ * (i.e., without crossing a datum boundary)
*/
- if ((obj_desc->common_field.start_field_bit_offset + obj_desc->common_field.bit_length) <=
- (u16) obj_desc->common_field.access_bit_width) {
- obj_desc->common_field.access_flags |= AFIELD_SINGLE_DATUM;
+ if ((obj_desc->common_field.start_field_bit_offset + field_bit_length) <=
+ (u16) access_bit_width) {
+ obj_desc->common.flags |= AOPOBJ_SINGLE_DATUM;
}
-
return_ACPI_STATUS (AE_OK);
}
acpi_status status;
- FUNCTION_TRACE ("Ex_prep_field_value");
+ ACPI_FUNCTION_TRACE ("Ex_prep_field_value");
/* Parameter validation */
type = acpi_ns_get_type (info->region_node);
if (type != ACPI_TYPE_REGION) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Needed Region, found type %X %s\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Needed Region, found type %X %s\n",
type, acpi_ut_get_type_name (type)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
}
- /* Allocate a new region object */
+ /* Allocate a new field object */
obj_desc = acpi_ut_create_internal_object (info->field_type);
if (!obj_desc) {
/* Initialize areas of the object that are common to all fields */
+ obj_desc->common_field.node = info->field_node;
status = acpi_ex_prep_common_field_object (obj_desc, info->field_flags,
- info->field_bit_position, info->field_bit_length);
+ info->attribute, info->field_bit_position, info->field_bit_length);
if (ACPI_FAILURE (status)) {
acpi_ut_delete_object_desc (obj_desc);
return_ACPI_STATUS (status);
switch (info->field_type) {
case INTERNAL_TYPE_REGION_FIELD:
- obj_desc->field.region_obj = acpi_ns_get_attached_object (info->region_node);
+ obj_desc->field.region_obj = acpi_ns_get_attached_object (info->region_node);
/* An additional reference for the container */
acpi_ut_add_reference (obj_desc->field.region_obj);
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Region_field: Bitoff=%X Off=%X Gran=%X Region %p\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Region_field: Bitoff=%X Off=%X Gran=%X Region %p\n",
obj_desc->field.start_field_bit_offset, obj_desc->field.base_byte_offset,
- obj_desc->field.access_bit_width, obj_desc->field.region_obj));
+ obj_desc->field.access_byte_width, obj_desc->field.region_obj));
break;
case INTERNAL_TYPE_BANK_FIELD:
- obj_desc->bank_field.value = info->bank_value;
- obj_desc->bank_field.region_obj = acpi_ns_get_attached_object (info->region_node);
- obj_desc->bank_field.bank_register_obj = acpi_ns_get_attached_object (info->register_node);
+ obj_desc->bank_field.value = info->bank_value;
+ obj_desc->bank_field.region_obj = acpi_ns_get_attached_object (info->region_node);
+ obj_desc->bank_field.bank_obj = acpi_ns_get_attached_object (info->register_node);
/* An additional reference for the attached objects */
acpi_ut_add_reference (obj_desc->bank_field.region_obj);
- acpi_ut_add_reference (obj_desc->bank_field.bank_register_obj);
+ acpi_ut_add_reference (obj_desc->bank_field.bank_obj);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Bank Field: Bit_off=%X Off=%X Gran=%X Region %p Bank_reg %p\n",
obj_desc->bank_field.start_field_bit_offset, obj_desc->bank_field.base_byte_offset,
- obj_desc->field.access_bit_width, obj_desc->bank_field.region_obj,
- obj_desc->bank_field.bank_register_obj));
+ obj_desc->field.access_byte_width, obj_desc->bank_field.region_obj,
+ obj_desc->bank_field.bank_obj));
break;
obj_desc->index_field.index_obj = acpi_ns_get_attached_object (info->register_node);
obj_desc->index_field.data_obj = acpi_ns_get_attached_object (info->data_register_node);
obj_desc->index_field.value = (u32) (info->field_bit_position /
- obj_desc->field.access_bit_width);
+ ACPI_MUL_8 (obj_desc->field.access_byte_width));
if (!obj_desc->index_field.data_obj || !obj_desc->index_field.index_obj) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Index Object\n"));
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Index_field: bitoff=%X off=%X gran=%X Index %p Data %p\n",
obj_desc->index_field.start_field_bit_offset, obj_desc->index_field.base_byte_offset,
- obj_desc->field.access_bit_width, obj_desc->index_field.index_obj,
+ obj_desc->field.access_byte_width, obj_desc->index_field.index_obj,
obj_desc->index_field.data_obj));
break;
}
* preserving the current type of that Named_obj.
*/
status = acpi_ns_attach_object (info->field_node, obj_desc,
- (u8) acpi_ns_get_type (info->field_node));
+ acpi_ns_get_type (info->field_node));
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "set Named_obj %p (%4.4s) val = %p\n",
- info->field_node, (char*)&(info->field_node->name), obj_desc));
+ info->field_node, (char *) &(info->field_node->name), obj_desc));
/* Remove local reference to the object */
/******************************************************************************
*
* Module Name: exregion - ACPI default Op_region (address space) handlers
- * $Revision: 61 $
+ * $Revision: 72 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exregion")
+ ACPI_MODULE_NAME ("exregion")
/*******************************************************************************
u32 function,
ACPI_PHYSICAL_ADDRESS address,
u32 bit_width,
- u32 *value,
+ acpi_integer *value,
void *handler_context,
void *region_context)
{
void *logical_addr_ptr = NULL;
acpi_mem_space_context *mem_info = region_context;
u32 length;
+ u32 window_size;
+ u32 remaining;
- FUNCTION_TRACE ("Ex_system_memory_space_handler");
+ ACPI_FUNCTION_TRACE ("Ex_system_memory_space_handler");
/* Validate and translate the bit width */
length = 4;
break;
+ case 64:
+ length = 8;
+ break;
+
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid System_memory width %d\n",
bit_width));
return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
- break;
}
-
/*
* Does the request fit into the cached memory mapping?
* Is 1) Address below the current mapping? OR
mem_info->mapped_length);
}
- mem_info->mapped_length = 0; /* In case of failure below */
+ /*
+ * Don't attempt to map memory beyond the end of the region, and
+ * constrain the maximum mapping size to something reasonable.
+ */
+ remaining = (u32) ((mem_info->address + (ACPI_PHYSICAL_ADDRESS) mem_info->length) - address);
+ if (remaining > SYSMEM_REGION_WINDOW_SIZE) {
+ window_size = SYSMEM_REGION_WINDOW_SIZE;
+ }
+ else {
+ window_size = remaining;
+ }
/* Create a new mapping starting at the address given */
- status = acpi_os_map_memory (address, SYSMEM_REGION_WINDOW_SIZE,
+ status = acpi_os_map_memory (address, window_size,
(void **) &mem_info->mapped_logical_address);
if (ACPI_FAILURE (status)) {
+ mem_info->mapped_length = 0;
return_ACPI_STATUS (status);
}
/* Save the physical address and mapping size */
mem_info->mapped_physical_address = address;
- mem_info->mapped_length = SYSMEM_REGION_WINDOW_SIZE;
+ mem_info->mapped_length = window_size;
}
-
/*
* Generate a logical pointer corresponding to the address we want to
* access
*/
-
- /* TBD: should these pointers go to 64-bit in all cases ? */
-
logical_addr_ptr = mem_info->mapped_logical_address +
((acpi_integer) address - (acpi_integer) mem_info->mapped_physical_address);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"System_memory %d (%d width) Address=%8.8X%8.8X\n", function, bit_width,
- HIDWORD (address), LODWORD (address)));
+ ACPI_HIDWORD (address), ACPI_LODWORD (address)));
/* Perform the memory read or write */
switch (function) {
+ case ACPI_READ:
- case ACPI_READ_ADR_SPACE:
-
+ *value = 0;
switch (bit_width) {
case 8:
*value = (u32)* (u8 *) logical_addr_ptr;
break;
case 16:
- MOVE_UNALIGNED16_TO_32 (value, logical_addr_ptr);
+ ACPI_MOVE_UNALIGNED16_TO_16 (value, logical_addr_ptr);
break;
case 32:
- MOVE_UNALIGNED32_TO_32 (value, logical_addr_ptr);
+ ACPI_MOVE_UNALIGNED32_TO_32 (value, logical_addr_ptr);
break;
- }
+ case 64:
+ ACPI_MOVE_UNALIGNED64_TO_64 (value, logical_addr_ptr);
+ break;
+ }
break;
-
- case ACPI_WRITE_ADR_SPACE:
+ case ACPI_WRITE:
switch (bit_width) {
case 8:
break;
case 16:
- MOVE_UNALIGNED16_TO_16 (logical_addr_ptr, value);
+ ACPI_MOVE_UNALIGNED16_TO_16 (logical_addr_ptr, value);
break;
case 32:
- MOVE_UNALIGNED32_TO_32 (logical_addr_ptr, value);
+ ACPI_MOVE_UNALIGNED32_TO_32 (logical_addr_ptr, value);
break;
- }
+ case 64:
+ ACPI_MOVE_UNALIGNED64_TO_64 (logical_addr_ptr, value);
+ break;
+ }
break;
-
default:
status = AE_BAD_PARAMETER;
break;
u32 function,
ACPI_PHYSICAL_ADDRESS address,
u32 bit_width,
- u32 *value,
+ acpi_integer *value,
void *handler_context,
void *region_context)
{
acpi_status status = AE_OK;
- FUNCTION_TRACE ("Ex_system_io_space_handler");
+ ACPI_FUNCTION_TRACE ("Ex_system_io_space_handler");
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"System_iO %d (%d width) Address=%8.8X%8.8X\n", function, bit_width,
- HIDWORD (address), LODWORD (address)));
+ ACPI_HIDWORD (address), ACPI_LODWORD (address)));
/* Decode the function parameter */
switch (function) {
-
- case ACPI_READ_ADR_SPACE:
+ case ACPI_READ:
*value = 0;
status = acpi_os_read_port ((ACPI_IO_ADDRESS) address, value, bit_width);
break;
-
- case ACPI_WRITE_ADR_SPACE:
+ case ACPI_WRITE:
status = acpi_os_write_port ((ACPI_IO_ADDRESS) address, *value, bit_width);
break;
-
default:
status = AE_BAD_PARAMETER;
break;
u32 function,
ACPI_PHYSICAL_ADDRESS address,
u32 bit_width,
- u32 *value,
+ acpi_integer *value,
void *handler_context,
void *region_context)
{
u16 pci_register;
- FUNCTION_TRACE ("Ex_pci_config_space_handler");
+ ACPI_FUNCTION_TRACE ("Ex_pci_config_space_handler");
/*
- * The arguments to Acpi_os(Read|Write)Pci_cfg(Byte|Word|Dword) are:
+ * The arguments to Acpi_os(Read|Write)Pci_configuration are:
*
* Pci_segment is the PCI bus segment range 0-31
* Pci_bus is the PCI bus number range 0-255
*
*/
pci_id = (acpi_pci_id *) region_context;
- pci_register = (u16) address;
+ pci_register = (u16) (ACPI_SIZE) address;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Pci_config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n",
pci_id->function, pci_register));
switch (function) {
-
- case ACPI_READ_ADR_SPACE:
+ case ACPI_READ:
*value = 0;
status = acpi_os_read_pci_configuration (pci_id, pci_register, value, bit_width);
break;
-
- case ACPI_WRITE_ADR_SPACE:
+ case ACPI_WRITE:
status = acpi_os_write_pci_configuration (pci_id, pci_register, *value, bit_width);
break;
-
default:
status = AE_BAD_PARAMETER;
u32 function,
ACPI_PHYSICAL_ADDRESS address,
u32 bit_width,
- u32 *value,
+ acpi_integer *value,
void *handler_context,
void *region_context)
{
acpi_status status = AE_OK;
- FUNCTION_TRACE ("Ex_cmos_space_handler");
+ ACPI_FUNCTION_TRACE ("Ex_cmos_space_handler");
return_ACPI_STATUS (status);
u32 function,
ACPI_PHYSICAL_ADDRESS address,
u32 bit_width,
- u32 *value,
+ acpi_integer *value,
+ void *handler_context,
+ void *region_context)
+{
+ acpi_status status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE ("Ex_pci_bar_space_handler");
+
+
+ return_ACPI_STATUS (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ex_data_table_space_handler
+ *
+ * PARAMETERS: Function - Read or Write operation
+ * Address - Where in the space to read or write
+ * Bit_width - Field width in bits (8, 16, or 32)
+ * Value - Pointer to in or out value
+ * Handler_context - Pointer to Handler's context
+ * Region_context - Pointer to context specific to the
+ * accessed region
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Handler for the Data Table address space (Op Region)
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ex_data_table_space_handler (
+ u32 function,
+ ACPI_PHYSICAL_ADDRESS address,
+ u32 bit_width,
+ acpi_integer *value,
void *handler_context,
void *region_context)
{
acpi_status status = AE_OK;
+ u32 byte_width = ACPI_DIV_8 (bit_width);
+ u32 i;
+ char *logical_addr_ptr;
+
+
+ ACPI_FUNCTION_TRACE ("Ex_data_table_space_handler");
+
+
+ logical_addr_ptr = ACPI_PHYSADDR_TO_PTR (address);
- FUNCTION_TRACE ("Ex_pci_bar_space_handler");
+ /* Perform the memory read or write */
+
+ switch (function) {
+ case ACPI_READ:
+ for (i = 0; i < byte_width; i++) {
+ ((char *) value) [i] = logical_addr_ptr[i];
+ }
+ break;
+
+ case ACPI_WRITE:
+
+ return_ACPI_STATUS (AE_SUPPORT);
+ }
return_ACPI_STATUS (status);
}
+
/******************************************************************************
*
* Module Name: exresnte - AML Interpreter object resolution
- * $Revision: 43 $
+ * $Revision: 50 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exresnte")
+ ACPI_MODULE_NAME ("exresnte")
/*******************************************************************************
acpi_operand_object *source_desc;
acpi_operand_object *obj_desc = NULL;
acpi_namespace_node *node;
- acpi_object_type8 entry_type;
+ acpi_object_type entry_type;
acpi_integer temp_val;
- FUNCTION_TRACE ("Ex_resolve_node_to_value");
+ ACPI_FUNCTION_TRACE ("Ex_resolve_node_to_value");
/*
* The stack pointer points to a acpi_namespace_node (Node). Get the
* object that is attached to the Node.
*/
- node = *object_ptr;
- source_desc = acpi_ns_get_attached_object (node);
+ node = *object_ptr;
+ source_desc = acpi_ns_get_attached_object (node);
entry_type = acpi_ns_get_type ((acpi_handle) node);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Entry=%p Source_desc=%p Type=%X\n",
node, source_desc, entry_type));
-
/*
* Several object types require no further processing:
* 1) Devices rarely have an attached object, return the Node
* of the attached object or pointer
*/
switch (entry_type) {
-
case ACPI_TYPE_PACKAGE:
if (ACPI_TYPE_PACKAGE != source_desc->common.type) {
status = acpi_ex_read_data_from_field (source_desc, &obj_desc);
break;
-
/*
* For these objects, just return the object attached to the Node
*/
node));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */
- break;
/*
/******************************************************************************
*
* Module Name: exresolv - AML Interpreter object resolution
- * $Revision: 101 $
+ * $Revision: 106 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exresolv")
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ex_get_buffer_field_value
- *
- * PARAMETERS: *Obj_desc - Pointer to a Buffer_field
- * *Result_desc - Pointer to an empty descriptor which will
- * become an Integer with the field's value
- *
- * RETURN: Status
- *
- * DESCRIPTION: Retrieve the value from a Buffer_field
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ex_get_buffer_field_value (
- acpi_operand_object *obj_desc,
- acpi_operand_object *result_desc)
-{
- acpi_status status;
- u32 mask;
- u8 *location;
-
-
- FUNCTION_TRACE ("Ex_get_buffer_field_value");
-
-
- /*
- * Parameter validation
- */
- if (!obj_desc) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null field pointer\n"));
- return_ACPI_STATUS (AE_AML_NO_OPERAND);
- }
-
- if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) {
- status = acpi_ds_get_buffer_field_arguments (obj_desc);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
- }
-
- if (!obj_desc->buffer_field.buffer_obj) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null container pointer\n"));
- return_ACPI_STATUS (AE_AML_INTERNAL);
- }
-
- if (ACPI_TYPE_BUFFER != obj_desc->buffer_field.buffer_obj->common.type) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - container is not a Buffer\n"));
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- }
-
- if (!result_desc) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null result pointer\n"));
- return_ACPI_STATUS (AE_AML_INTERNAL);
- }
-
-
- /* Field location is (base of buffer) + (byte offset) */
-
- location = obj_desc->buffer_field.buffer_obj->buffer.pointer
- + obj_desc->buffer_field.base_byte_offset;
-
- /*
- * Construct Mask with as many 1 bits as the field width
- *
- * NOTE: Only the bottom 5 bits are valid for a shift operation, so
- * special care must be taken for any shift greater than 31 bits.
- *
- * TBD: [Unhandled] Fields greater than 32 bits will not work.
- */
- if (obj_desc->buffer_field.bit_length < 32) {
- mask = ((u32) 1 << obj_desc->buffer_field.bit_length) - (u32) 1;
- }
- else {
- mask = ACPI_UINT32_MAX;
- }
-
- result_desc->integer.type = (u8) ACPI_TYPE_INTEGER;
-
- /* Get the 32 bit value at the location */
-
- MOVE_UNALIGNED32_TO_32 (&result_desc->integer.value, location);
-
- /*
- * Shift the 32-bit word containing the field, and mask off the
- * resulting value
- */
- result_desc->integer.value =
- (result_desc->integer.value >> obj_desc->buffer_field.start_field_bit_offset) & mask;
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "** Read from buffer %p byte %d bit %d width %d addr %p mask %08X val %8.8X%8.8X\n",
- obj_desc->buffer_field.buffer_obj->buffer.pointer,
- obj_desc->buffer_field.base_byte_offset,
- obj_desc->buffer_field.start_field_bit_offset,
- obj_desc->buffer_field.bit_length,
- location, mask,
- HIDWORD(result_desc->integer.value),
- LODWORD(result_desc->integer.value)));
-
- return_ACPI_STATUS (AE_OK);
-}
+ ACPI_MODULE_NAME ("exresolv")
/*******************************************************************************
acpi_status status;
- FUNCTION_TRACE_PTR ("Ex_resolve_to_value", stack_ptr);
+ ACPI_FUNCTION_TRACE_PTR ("Ex_resolve_to_value", stack_ptr);
if (!stack_ptr || !*stack_ptr) {
return_ACPI_STATUS (AE_AML_NO_OPERAND);
}
-
/*
* The entity pointed to by the Stack_ptr can be either
* 1) A valid acpi_operand_object, or
* 2) A acpi_namespace_node (Named_obj)
*/
- if (VALID_DESCRIPTOR_TYPE (*stack_ptr, ACPI_DESC_TYPE_INTERNAL)) {
+ if (ACPI_GET_DESCRIPTOR_TYPE (*stack_ptr) == ACPI_DESC_TYPE_INTERNAL) {
status = acpi_ex_resolve_object_to_value (stack_ptr, walk_state);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
* Object on the stack may have changed if Acpi_ex_resolve_object_to_value()
* was called (i.e., we can't use an _else_ here.)
*/
- if (VALID_DESCRIPTOR_TYPE (*stack_ptr, ACPI_DESC_TYPE_NAMED)) {
+ if (ACPI_GET_DESCRIPTOR_TYPE (*stack_ptr) == ACPI_DESC_TYPE_NAMED) {
status = acpi_ex_resolve_node_to_value ((acpi_namespace_node **) stack_ptr,
walk_state);
if (ACPI_FAILURE (status)) {
}
}
-
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Resolved object %p\n", *stack_ptr));
return_ACPI_STATUS (AE_OK);
}
u16 opcode;
- FUNCTION_TRACE ("Ex_resolve_object_to_value");
+ ACPI_FUNCTION_TRACE ("Ex_resolve_object_to_value");
stack_desc = *stack_ptr;
/* This is an acpi_operand_object */
switch (stack_desc->common.type) {
-
case INTERNAL_TYPE_REFERENCE:
opcode = stack_desc->reference.opcode;
switch (opcode) {
-
case AML_NAME_OP:
/*
stack_desc->reference.offset, obj_desc));
break;
-
/*
* For constants, we must change the reference/constant object
* to a real integer object
acpi_ut_add_reference (obj_desc);
*stack_ptr = obj_desc;
}
-
else {
/*
* A NULL object descriptor means an unitialized element of
status = AE_AML_INTERNAL;
break;
}
-
break;
break; /* case INTERNAL_TYPE_REFERENCE */
-
+ /*
+ * These cases may never happen here, but just in case..
+ */
case ACPI_TYPE_BUFFER_FIELD:
-
- obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_ANY);
- if (!obj_desc) {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- status = acpi_ex_get_buffer_field_value (stack_desc, obj_desc);
- if (ACPI_FAILURE (status)) {
- acpi_ut_remove_reference (obj_desc);
- obj_desc = NULL;
- }
-
- *stack_ptr = (void *) obj_desc;
- break;
-
-
+ case INTERNAL_TYPE_REGION_FIELD:
case INTERNAL_TYPE_BANK_FIELD:
+ case INTERNAL_TYPE_INDEX_FIELD:
- obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_ANY);
- if (!obj_desc) {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /* TBD: WRONG! */
-
- status = acpi_ex_get_buffer_field_value (stack_desc, obj_desc);
- if (ACPI_FAILURE (status)) {
- acpi_ut_remove_reference (obj_desc);
- obj_desc = NULL;
- }
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Field_read Source_desc=%p Type=%X\n",
+ stack_desc, stack_desc->common.type));
+ status = acpi_ex_read_data_from_field (stack_desc, &obj_desc);
*stack_ptr = (void *) obj_desc;
break;
-
- /* TBD: [Future] - may need to handle Index_field, and Def_field someday */
-
default:
-
break;
-
- } /* switch (Stack_desc->Common.Type) */
-
+ }
return_ACPI_STATUS (status);
}
/******************************************************************************
*
* Module Name: exresop - AML Interpreter operand/object resolution
- * $Revision: 41 $
+ * $Revision: 47 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exresop")
+ ACPI_MODULE_NAME ("exresop")
/*******************************************************************************
acpi_object_type this_type,
void *object)
{
- PROC_NAME ("Ex_check_object_type");
+ ACPI_FUNCTION_NAME ("Ex_check_object_type");
if (type_needed == ACPI_TYPE_ANY) {
*
* FUNCTION: Acpi_ex_resolve_operands
*
- * PARAMETERS: Opcode Opcode being interpreted
- * Stack_ptr Top of operand stack
+ * PARAMETERS: Opcode - Opcode being interpreted
+ * Stack_ptr - Pointer to the operand stack to be
+ * resolved
+ * Walk_state - Current stateu
*
* RETURN: Status
*
- * DESCRIPTION: Convert stack entries to required types
+ * DESCRIPTION: Convert multiple input operands to the types required by the
+ * target operator.
*
- * Each nibble in Arg_types represents one required operand
- * and indicates the required Type:
+ * Each nibble (actually 5 bits) in Arg_types represents one required
+ * operand and indicates the required Type:
*
- * The corresponding stack entry will be converted to the
- * required type if possible, else return an exception
+ * The corresponding operand will be converted to the required type if
+ * possible, otherwise we abort with an exception.
*
******************************************************************************/
acpi_object_type type_needed;
- FUNCTION_TRACE_U32 ("Ex_resolve_operands", opcode);
+ ACPI_FUNCTION_TRACE_U32 ("Ex_resolve_operands", opcode);
op_info = acpi_ps_get_opcode_info (opcode);
return_ACPI_STATUS (AE_AML_BAD_OPCODE);
}
-
arg_types = op_info->runtime_args;
if (arg_types == ARGI_INVALID_OPCODE) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - %X is not a valid AML opcode\n",
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode %X Operand_types=%X \n",
opcode, arg_types));
-
/*
* Normal exit is with (Arg_types == 0) at end of argument list.
* Function will return an exception from within the loop upon
/* Decode the descriptor type */
- if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) {
+ switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) {
+ case ACPI_DESC_TYPE_NAMED:
+
/* Node */
object_type = ((acpi_namespace_node *) obj_desc)->type;
- }
+ break;
+
+
+ case ACPI_DESC_TYPE_INTERNAL:
- else if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_INTERNAL)) {
/* ACPI internal object */
object_type = obj_desc->common.type;
return_ACPI_STATUS (AE_AML_BAD_OPCODE);
}
-
switch (obj_desc->reference.opcode) {
case AML_ZERO_OP:
case AML_ONE_OP:
case AML_LOCAL_OP:
case AML_REVISION_OP:
- DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Reference Opcode: %s\n", op_info->name)));
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Reference Opcode: Unknown [%02x]\n",
obj_desc->reference.opcode));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- break;
}
}
- }
+ break;
+
+
+ default:
- else {
/* Invalid descriptor */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Bad descriptor type %X in Obj %p\n",
- obj_desc->common.data_type, obj_desc));
+ ACPI_GET_DESCRIPTOR_TYPE (obj_desc), obj_desc));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
this_arg_type = GET_CURRENT_ARG_TYPE (arg_types);
INCREMENT_ARG_LIST (arg_types);
-
/*
* Handle cases where the object does not need to be
* resolved to a value
*/
switch (this_arg_type) {
+ case ARGI_REF_OR_STRING: /* Can be a String or Reference */
+
+ if ((ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_INTERNAL) &&
+ (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_STRING)) {
+ /*
+ * String found - the string references a named object and must be
+ * resolved to a node
+ */
+ goto next_operand;
+ }
- case ARGI_REFERENCE: /* References */
+ /* Else not a string - fall through to the normal Reference case below */
+
+ case ARGI_REFERENCE: /* References: */
case ARGI_INTEGER_REF:
case ARGI_OBJECT_REF:
case ARGI_DEVICE_REF:
- case ARGI_TARGETREF: /* TBD: must implement implicit conversion rules before store */
+ case ARGI_TARGETREF: /* Allows implicit conversion rules before store */
case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */
- case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */
+ case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */
/* Need an operand of type INTERNAL_TYPE_REFERENCE */
- if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) /* direct name ptr OK as-is */ {
+ if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) /* Node (name) ptr OK as-is */ {
goto next_operand;
}
return_ACPI_STATUS (status);
}
-
if (AML_NAME_OP == obj_desc->reference.opcode) {
/*
* Convert an indirect name ptr to direct name ptr and put
acpi_ut_remove_reference (obj_desc);
(*stack_ptr) = temp_node;
}
-
goto next_operand;
- break;
case ARGI_ANYTYPE:
return_ACPI_STATUS (status);
}
-
/*
* Check the resulting object (value) type
*/
status = acpi_ex_convert_to_integer (*stack_ptr, stack_ptr, walk_state);
if (ACPI_FAILURE (status)) {
if (status == AE_TYPE) {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Needed [Integer/String/Buffer], found [%s] %p\n",
acpi_ut_get_type_name ((*stack_ptr)->common.type), *stack_ptr));
return_ACPI_STATUS (status);
}
-
goto next_operand;
- break;
case ARGI_BUFFER:
status = acpi_ex_convert_to_buffer (*stack_ptr, stack_ptr, walk_state);
if (ACPI_FAILURE (status)) {
if (status == AE_TYPE) {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Needed [Integer/String/Buffer], found [%s] %p\n",
acpi_ut_get_type_name ((*stack_ptr)->common.type), *stack_ptr));
return_ACPI_STATUS (status);
}
-
goto next_operand;
- break;
case ARGI_STRING:
status = acpi_ex_convert_to_string (*stack_ptr, stack_ptr, 16, ACPI_UINT32_MAX, walk_state);
if (ACPI_FAILURE (status)) {
if (status == AE_TYPE) {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Needed [Integer/String/Buffer], found [%s] %p\n",
acpi_ut_get_type_name ((*stack_ptr)->common.type), *stack_ptr));
return_ACPI_STATUS (status);
}
-
goto next_operand;
- break;
case ARGI_COMPUTEDATA:
/* Need an operand of type INTEGER, STRING or BUFFER */
- if ((ACPI_TYPE_INTEGER != (*stack_ptr)->common.type) &&
- (ACPI_TYPE_STRING != (*stack_ptr)->common.type) &&
- (ACPI_TYPE_BUFFER != (*stack_ptr)->common.type)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ switch ((*stack_ptr)->common.type) {
+ case ACPI_TYPE_INTEGER:
+ case ACPI_TYPE_STRING:
+ case ACPI_TYPE_BUFFER:
+
+ /* Valid operand */
+ break;
+
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Needed [Integer/String/Buffer], found [%s] %p\n",
acpi_ut_get_type_name ((*stack_ptr)->common.type), *stack_ptr));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
goto next_operand;
- break;
case ARGI_DATAOBJECT:
/*
* ARGI_DATAOBJECT is only used by the Size_of operator.
+ * Need a buffer, string, package, or Node reference.
*
- * The ACPI specification allows Size_of to return the size of
- * a Buffer, String or Package. However, the MS ACPI.SYS AML
- * Interpreter also allows an Node reference to return without
- * error with a size of 4.
- */
-
- /* Need a buffer, string, package or Node reference */
-
- if (((*stack_ptr)->common.type != ACPI_TYPE_BUFFER) &&
- ((*stack_ptr)->common.type != ACPI_TYPE_STRING) &&
- ((*stack_ptr)->common.type != ACPI_TYPE_PACKAGE) &&
- ((*stack_ptr)->common.type != INTERNAL_TYPE_REFERENCE)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Needed [Buf/Str/Pkg/Ref], found [%s] %p\n",
- acpi_ut_get_type_name ((*stack_ptr)->common.type), *stack_ptr));
-
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- }
-
- /*
- * If this is a reference, only allow a reference to an Node.
+ * The only reference allowed here is a direct reference to
+ * a namespace node.
*/
if ((*stack_ptr)->common.type == INTERNAL_TYPE_REFERENCE) {
if (!(*stack_ptr)->reference.node) {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Needed [Node Reference], found [%p]\n",
*stack_ptr));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
+
+ /* Get the object attached to the node */
+
+ temp_node = acpi_ns_get_attached_object ((*stack_ptr)->reference.node);
+ if (!temp_node) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Node [%p] has no attached object\n",
+ (*stack_ptr)->reference.node));
+
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+
+ /*
+ * Swap the reference object with the node's object. Must add
+ * a reference to the node object, and remove a reference from
+ * the original reference object.
+ */
+ acpi_ut_add_reference (temp_node);
+ acpi_ut_remove_reference (*stack_ptr);
+ (*stack_ptr) = temp_node;
+ }
+
+ /* Need a buffer, string, package */
+
+ switch ((*stack_ptr)->common.type) {
+ case ACPI_TYPE_PACKAGE:
+ case ACPI_TYPE_STRING:
+ case ACPI_TYPE_BUFFER:
+
+ /* Valid operand */
+ break;
+
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Needed [Buf/Str/Pkg], found [%s] %p\n",
+ acpi_ut_get_type_name ((*stack_ptr)->common.type), *stack_ptr));
+
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
goto next_operand;
- break;
case ARGI_COMPLEXOBJ:
/* Need a buffer or package or (ACPI 2.0) String */
- if (((*stack_ptr)->common.type != ACPI_TYPE_BUFFER) &&
- ((*stack_ptr)->common.type != ACPI_TYPE_STRING) &&
- ((*stack_ptr)->common.type != ACPI_TYPE_PACKAGE)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Needed [Buf/Pkg], found [%s] %p\n",
+ switch ((*stack_ptr)->common.type) {
+ case ACPI_TYPE_PACKAGE:
+ case ACPI_TYPE_STRING:
+ case ACPI_TYPE_BUFFER:
+
+ /* Valid operand */
+ break;
+
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Needed [Buf/Str/Pkg], found [%s] %p\n",
acpi_ut_get_type_name ((*stack_ptr)->common.type), *stack_ptr));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
goto next_operand;
- break;
default:
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
-
/*
* Make sure that the original object was resolved to the
* required object type (Simple cases only).
return_ACPI_STATUS (status);
}
-
next_operand:
/*
* If more operands needed, decrement Stack_ptr to point
} /* while (*Types) */
-
return_ACPI_STATUS (status);
}
/******************************************************************************
*
* Module Name: exstore - AML Interpreter object store support
- * $Revision: 150 $
+ * $Revision: 162 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exstore")
+ ACPI_MODULE_NAME ("exstore")
/*******************************************************************************
* *Dest_desc - Where to store it. Must be an NS node
* or an acpi_operand_object of type
* Reference;
+ * Walk_state - Current walk state
*
* RETURN: Status
*
* DESCRIPTION: Store the value described by Source_desc into the location
* described by Dest_desc. Called by various interpreter
* functions to store the result of an operation into
- * the destination operand.
+ * the destination operand -- not just simply the actual "Store"
+ * ASL operator.
*
******************************************************************************/
acpi_operand_object *ref_desc = dest_desc;
- FUNCTION_TRACE_PTR ("Ex_store", dest_desc);
+ ACPI_FUNCTION_TRACE_PTR ("Ex_store", dest_desc);
/* Validate parameters */
if (!source_desc || !dest_desc) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null pointer\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null parameter\n"));
return_ACPI_STATUS (AE_AML_NO_OPERAND);
}
/* Dest_desc can be either a namespace node or an ACPI object */
- if (VALID_DESCRIPTOR_TYPE (dest_desc, ACPI_DESC_TYPE_NAMED)) {
+ if (ACPI_GET_DESCRIPTOR_TYPE (dest_desc) == ACPI_DESC_TYPE_NAMED) {
/*
* Dest is a namespace node,
* Storing an object into a Name "container"
status = acpi_ex_store_object_to_node (source_desc,
(acpi_namespace_node *) dest_desc, walk_state);
- /* All done, that's it */
-
return_ACPI_STATUS (status);
}
-
/* Destination object must be an object of type Reference */
if (dest_desc->common.type != INTERNAL_TYPE_REFERENCE) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Destination is not a Reference_obj [%p]\n", dest_desc));
- DUMP_STACK_ENTRY (source_desc);
- DUMP_STACK_ENTRY (dest_desc);
- DUMP_OPERANDS (&dest_desc, IMODE_EXECUTE, "Ex_store",
+ ACPI_DUMP_STACK_ENTRY (source_desc);
+ ACPI_DUMP_STACK_ENTRY (dest_desc);
+ ACPI_DUMP_OPERANDS (&dest_desc, ACPI_IMODE_EXECUTE, "Ex_store",
2, "Target is not a Reference_obj");
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
-
/*
* Examine the Reference opcode. These cases are handled:
*
* 5) Store to a constant -- a noop
*/
switch (ref_desc->reference.opcode) {
-
case AML_NAME_OP:
/* Storing an object into a Name "container" */
switch (source_desc->common.type) {
case ACPI_TYPE_INTEGER:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%X (%d)\n",
- (u32) source_desc->integer.value, (u32) source_desc->integer.value));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%8.8X%8.8X\n",
+ ACPI_HIWORD (source_desc->integer.value),
+ ACPI_LOWORD (source_desc->integer.value)));
break;
case ACPI_TYPE_BUFFER:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Length 0x%X\n",
- (u32) source_desc->buffer.length));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Length %.2X\n",
+ (u32) source_desc->buffer.length));
break;
case ACPI_TYPE_PACKAGE:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Elements - 0x%X\n",
- (u32) source_desc->package.elements));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Elements Ptr - %p\n",
+ source_desc->package.elements));
break;
default:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "@0x%p\n", source_desc));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Type %s %p\n",
+ acpi_ut_get_type_name (source_desc->common.type), source_desc));
break;
}
case AML_REVISION_OP:
/*
- * Storing to a constant is a no-op -- see ACPI Specification
- * Delete the reference descriptor, however
+ * Storing to a constant is a no-op according to the ACPI
+ * Specification. (Delete the reference descriptor, however.)
*/
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - Unknown Reference subtype %02x\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Reference subtype %02x\n",
ref_desc->reference.opcode));
-
- /* TBD: [Restructure] use object dump routine !! */
-
- DUMP_BUFFER (ref_desc, sizeof (acpi_operand_object));
+ ACPI_DUMP_ENTRY (ref_desc, ACPI_LV_ERROR);
status = AE_AML_INTERNAL;
break;
} /* switch (Ref_desc->Reference.Opcode) */
-
return_ACPI_STATUS (status);
}
*
* FUNCTION: Acpi_ex_store_object_to_index
*
- * PARAMETERS: *Source_desc - Value to be stored
- * *Node - Named object to receive the value
+ * PARAMETERS: *Source_desc - Value to be stored
+ * *Dest_desc - Named object to receive the value
+ * Walk_state - Current walk state
*
* RETURN: Status
*
- * DESCRIPTION: Store the object to the named object.
+ * DESCRIPTION: Store the object to indexed Buffer or Package element
*
******************************************************************************/
acpi_status
acpi_ex_store_object_to_index (
acpi_operand_object *source_desc,
- acpi_operand_object *dest_desc,
+ acpi_operand_object *index_desc,
acpi_walk_state *walk_state)
{
acpi_status status = AE_OK;
acpi_operand_object *obj_desc;
- u32 length;
- u32 i;
+ acpi_operand_object *new_desc;
u8 value = 0;
- FUNCTION_TRACE ("Ex_store_object_to_index");
+ ACPI_FUNCTION_TRACE ("Ex_store_object_to_index");
/*
* Destination must be a reference pointer, and
* must point to either a buffer or a package
*/
- switch (dest_desc->reference.target_type) {
+ switch (index_desc->reference.target_type) {
case ACPI_TYPE_PACKAGE:
/*
* Storing to a package element is not simple. The source must be
* source is copied into the destination - we can't just point to the
* source object.
*/
- if (dest_desc->reference.target_type == ACPI_TYPE_PACKAGE) {
- /*
- * The object at *(Dest_desc->Reference.Where) is the
- * element within the package that is to be modified.
- */
- obj_desc = *(dest_desc->reference.where);
- if (obj_desc) {
- /*
- * If the Destination element is a package, we will delete
- * that object and construct a new one.
- *
- * TBD: [Investigate] Should both the src and dest be required
- * to be packages?
- * && (Source_desc->Common.Type == ACPI_TYPE_PACKAGE)
- */
- if (obj_desc->common.type == ACPI_TYPE_PACKAGE) {
- /* Take away the reference for being part of a package */
-
- acpi_ut_remove_reference (obj_desc);
- obj_desc = NULL;
- }
- }
-
- if (!obj_desc) {
- /*
- * If the Obj_desc is NULL, it means that an uninitialized package
- * element has been used as a destination (this is OK), therefore,
- * we must create the destination element to match the type of the
- * source element NOTE: Source_desccan be of any type.
- */
- obj_desc = acpi_ut_create_internal_object (source_desc->common.type);
- if (!obj_desc) {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /*
- * If the source is a package, copy the source to the new dest
- */
- if (ACPI_TYPE_PACKAGE == obj_desc->common.type) {
- status = acpi_ut_copy_ipackage_to_ipackage (source_desc, obj_desc, walk_state);
- if (ACPI_FAILURE (status)) {
- acpi_ut_remove_reference (obj_desc);
- return_ACPI_STATUS (status);
- }
- }
-
- /* Install the new descriptor into the package */
-
- *(dest_desc->reference.where) = obj_desc;
- }
-
- if (ACPI_TYPE_PACKAGE != obj_desc->common.type) {
- /*
- * The destination element is not a package, so we need to
- * convert the contents of the source (Source_desc) and copy into
- * the destination (Obj_desc)
- */
- status = acpi_ex_store_object_to_object (source_desc, obj_desc,
- walk_state);
- if (ACPI_FAILURE (status)) {
- /*
- * An error occurrered when copying the internal object
- * so delete the reference.
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unable to copy the internal object\n"));
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- }
- }
+ /*
+ * The object at *(Index_desc->Reference.Where) is the
+ * element within the package that is to be modified.
+ */
+ obj_desc = *(index_desc->reference.where);
+
+ /* Do the conversion/store */
+
+ status = acpi_ex_store_object_to_object (source_desc, obj_desc, &new_desc,
+ walk_state);
+ if (ACPI_FAILURE (status)) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Could not store object to indexed package element\n"));
+ return_ACPI_STATUS (status);
+ }
+
+ /*
+ * If a new object was created, we must install it as the new
+ * package element
+ */
+ if (new_desc != obj_desc) {
+ acpi_ut_remove_reference (obj_desc);
+ *(index_desc->reference.where) = new_desc;
}
break;
case ACPI_TYPE_BUFFER_FIELD:
-
- /* TBD: can probably call the generic Buffer/Field routines */
-
/*
- * Storing into a buffer at a location defined by an Index.
+ * Store into a Buffer (not actually a real Buffer_field) at a
+ * location defined by an Index.
*
- * Each 8-bit element of the source object is written to the
- * 8-bit Buffer Field of the Index destination object.
+ * The first 8-bit element of the source object is written to the
+ * 8-bit Buffer location defined by the Index destination object,
+ * according to the ACPI 2.0 specification.
*/
/*
- * Set the Obj_desc to the destination object and type check.
+ * Make sure the target is a Buffer
*/
- obj_desc = dest_desc->reference.object;
+ obj_desc = index_desc->reference.object;
if (obj_desc->common.type != ACPI_TYPE_BUFFER) {
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
*/
switch (source_desc->common.type) {
case ACPI_TYPE_INTEGER:
- /*
- * Type is Integer, assign bytewise
- * This loop to assign each of the elements is somewhat
- * backward because of the Big Endian-ness of IA-64
- */
- length = sizeof (acpi_integer);
- for (i = length; i != 0; i--) {
- value = (u8)(source_desc->integer.value >> (MUL_8 (i - 1)));
- obj_desc->buffer.pointer[dest_desc->reference.offset] = value;
- }
- break;
+ /* Use the least-significant byte of the integer */
- case ACPI_TYPE_BUFFER:
- /*
- * Type is Buffer, the Length is in the structure.
- * Just loop through the elements and assign each one in turn.
- */
- length = source_desc->buffer.length;
- for (i = 0; i < length; i++) {
- value = source_desc->buffer.pointer[i];
- obj_desc->buffer.pointer[dest_desc->reference.offset] = value;
- }
+ value = (u8) (source_desc->integer.value);
break;
+ case ACPI_TYPE_BUFFER:
- case ACPI_TYPE_STRING:
- /*
- * Type is String, the Length is in the structure.
- * Just loop through the elements and assign each one in turn.
- */
- length = source_desc->string.length;
- for (i = 0; i < length; i++) {
- value = source_desc->string.pointer[i];
- obj_desc->buffer.pointer[dest_desc->reference.offset] = value;
- }
+ value = source_desc->buffer.pointer[0];
break;
+ case ACPI_TYPE_STRING:
+
+ value = source_desc->string.pointer[0];
+ break;
default:
- /* Other types are invalid */
+ /* All other types are invalid */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Source must be Number/Buffer/String type, not %X\n",
- source_desc->common.type));
- status = AE_AML_OPERAND_TYPE;
- break;
+ "Source must be Integer/Buffer/String type, not %s\n",
+ acpi_ut_get_type_name (source_desc->common.type)));
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
+
+ /* Store the source value into the target buffer byte */
+
+ obj_desc->buffer.pointer[index_desc->reference.offset] = value;
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Target is not a Package or Buffer_field\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Target is not a Package or Buffer_field\n"));
status = AE_AML_OPERAND_TYPE;
break;
}
-
return_ACPI_STATUS (status);
}
*
* FUNCTION: Acpi_ex_store_object_to_node
*
- * PARAMETERS: *Source_desc - Value to be stored
- * *Node - Named object to receive the value
+ * PARAMETERS: Source_desc - Value to be stored
+ * Node - Named object to receive the value
+ * Walk_state - Current walk state
*
* RETURN: Status
*
* DESCRIPTION: Store the object to the named object.
*
* The Assignment of an object to a named object is handled here
- * The val passed in will replace the current value (if any)
+ * The value passed in will replace the current value (if any)
* with the input value.
*
* When storing into an object the data is converted to the
* that the target object type (for an initialized target) will
* not be changed by a store operation.
*
- * NOTE: the global lock is acquired early. This will result
- * in the global lock being held a bit longer. Also, if the
- * function fails during set up we may get the lock when we
- * don't really need it. I don't think we care.
+ * Assumes parameters are already validated.
*
******************************************************************************/
{
acpi_status status = AE_OK;
acpi_operand_object *target_desc;
- acpi_object_type8 target_type = ACPI_TYPE_ANY;
+ acpi_operand_object *new_desc;
+ acpi_object_type target_type;
- FUNCTION_TRACE ("Ex_store_object_to_node");
+ ACPI_FUNCTION_TRACE_PTR ("Ex_store_object_to_node", source_desc);
- /*
- * Assuming the parameters were already validated
- */
-
/*
* Get current type of the node, and object attached to Node
*/
target_desc = acpi_ns_get_attached_object (node);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Storing %p(%s) into node %p(%s)\n",
- node, acpi_ut_get_type_name (source_desc->common.type),
- source_desc, acpi_ut_get_type_name (target_type)));
-
+ source_desc, acpi_ut_get_type_name (source_desc->common.type),
+ node, acpi_ut_get_type_name (target_type)));
/*
* Resolve the source object to an actual value
return_ACPI_STATUS (status);
}
-
/*
* Do the actual store operation
*/
*
* Copy and/or convert the source object to a new target object
*/
- status = acpi_ex_store_object (source_desc, target_type, &target_desc, walk_state);
+ status = acpi_ex_store_object_to_object (source_desc, target_desc, &new_desc, walk_state);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
- /*
- * Store the new Target_desc as the new value of the Name, and set
- * the Name's type to that of the value being stored in it.
- * Source_desc reference count is incremented by Attach_object.
- */
- status = acpi_ns_attach_object (node, target_desc, target_type);
+ if (new_desc != target_desc) {
+ /*
+ * Store the new New_desc as the new value of the Name, and set
+ * the Name's type to that of the value being stored in it.
+ * Source_desc reference count is incremented by Attach_object.
+ */
+ status = acpi_ns_attach_object (node, new_desc, target_type);
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Store %s into %s via Convert/Attach\n",
- acpi_ut_get_type_name (target_desc->common.type),
- acpi_ut_get_type_name (target_type)));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Store %s into %s via Convert/Attach\n",
+ acpi_ut_get_type_name (source_desc->common.type),
+ acpi_ut_get_type_name (new_desc->common.type)));
+ }
break;
break;
}
-
return_ACPI_STATUS (status);
}
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ex_store_object_to_object
- *
- * PARAMETERS: *Source_desc - Value to be stored
- * *Dest_desc - Object to receive the value
- *
- * RETURN: Status
- *
- * DESCRIPTION: Store an object to another object.
- *
- * The Assignment of an object to another (not named) object
- * is handled here.
- * The val passed in will replace the current value (if any)
- * with the input value.
- *
- * When storing into an object the data is converted to the
- * target object type then stored in the object. This means
- * that the target object type (for an initialized target) will
- * not be changed by a store operation.
- *
- * This module allows destination types of Number, String,
- * and Buffer.
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ex_store_object_to_object (
- acpi_operand_object *source_desc,
- acpi_operand_object *dest_desc,
- acpi_walk_state *walk_state)
-{
- acpi_status status = AE_OK;
- acpi_object_type8 destination_type = dest_desc->common.type;
-
-
- FUNCTION_TRACE ("Ex_store_object_to_object");
-
-
- /*
- * Assuming the parameters are valid!
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Storing %p(%s) to %p(%s)\n",
- source_desc, acpi_ut_get_type_name (source_desc->common.type),
- dest_desc, acpi_ut_get_type_name (dest_desc->common.type)));
-
-
- /*
- * From this interface, we only support Integers/Strings/Buffers
- */
- switch (destination_type) {
- case ACPI_TYPE_INTEGER:
- case ACPI_TYPE_STRING:
- case ACPI_TYPE_BUFFER:
- break;
-
- default:
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Store into %s not implemented\n",
- acpi_ut_get_type_name (dest_desc->common.type)));
-
- return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
- }
-
-
- /*
- * Resolve the source object to an actual value
- * (If it is a reference object)
- */
- status = acpi_ex_resolve_object (&source_desc, destination_type, walk_state);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
-
- /*
- * Copy and/or convert the source object to the destination object
- */
- status = acpi_ex_store_object (source_desc, destination_type, &dest_desc, walk_state);
-
-
- return_ACPI_STATUS (status);
-}
-
*
* Module Name: exstoren - AML Interpreter object store support,
* Store to Node (namespace object)
- * $Revision: 40 $
+ * $Revision: 46 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exstoren")
+ ACPI_MODULE_NAME ("exstoren")
/*******************************************************************************
acpi_status
acpi_ex_resolve_object (
acpi_operand_object **source_desc_ptr,
- acpi_object_type8 target_type,
+ acpi_object_type target_type,
acpi_walk_state *walk_state)
{
acpi_operand_object *source_desc = *source_desc_ptr;
acpi_status status = AE_OK;
- FUNCTION_TRACE ("Ex_resolve_object");
+ ACPI_FUNCTION_TRACE ("Ex_resolve_object");
/*
- * Ensure we have a Source that can be stored in the target
+ * Ensure we have a Target that can be stored to
*/
switch (target_type) {
-
- /* This case handles the "interchangeable" types Integer, String, and Buffer. */
-
- /*
- * These cases all require only Integers or values that
- * can be converted to Integers (Strings or Buffers)
- */
case ACPI_TYPE_BUFFER_FIELD:
case INTERNAL_TYPE_REGION_FIELD:
case INTERNAL_TYPE_BANK_FIELD:
case INTERNAL_TYPE_INDEX_FIELD:
+ /*
+ * These cases all require only Integers or values that
+ * can be converted to Integers (Strings or Buffers)
+ */
- /*
- * Stores into a Field/Region or into a Buffer/String
- * are all essentially the same.
- */
case ACPI_TYPE_INTEGER:
case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER:
+ /*
+ * Stores into a Field/Region or into a Integer/Buffer/String
+ * are all essentially the same. This case handles the
+ * "interchangeable" types Integer, String, and Buffer.
+ */
+ if (source_desc->common.type == INTERNAL_TYPE_REFERENCE) {
+ /* Resolve a reference object first */
- /* TBD: FIX - check for source==REF, resolve, then check type */
+ status = acpi_ex_resolve_to_value (source_desc_ptr, walk_state);
+ if (ACPI_FAILURE (status)) {
+ break;
+ }
+ }
/*
- * If Source_desc is not a valid type, try to resolve it to one.
+ * Must have a Integer, Buffer, or String
*/
if ((source_desc->common.type != ACPI_TYPE_INTEGER) &&
(source_desc->common.type != ACPI_TYPE_BUFFER) &&
(source_desc->common.type != ACPI_TYPE_STRING)) {
/*
- * Initially not a valid type, convert
+ * Conversion successful but still not a valid type
*/
- status = acpi_ex_resolve_to_value (source_desc_ptr, walk_state);
- if (ACPI_SUCCESS (status) &&
- (source_desc->common.type != ACPI_TYPE_INTEGER) &&
- (source_desc->common.type != ACPI_TYPE_BUFFER) &&
- (source_desc->common.type != ACPI_TYPE_STRING)) {
- /*
- * Conversion successful but still not a valid type
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Cannot assign type %s to %s (must be type Int/Str/Buf)\n",
- acpi_ut_get_type_name ((*source_desc_ptr)->common.type),
- acpi_ut_get_type_name (target_type)));
- status = AE_AML_OPERAND_TYPE;
- }
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Cannot assign type %s to %s (must be type Int/Str/Buf)\n",
+ acpi_ut_get_type_name (source_desc->common.type),
+ acpi_ut_get_type_name (target_type)));
+ status = AE_AML_OPERAND_TYPE;
}
break;
/*******************************************************************************
*
- * FUNCTION: Acpi_ex_store_object
+ * FUNCTION: Acpi_ex_store_object_to_object
*
* PARAMETERS: Source_desc - Object to store
- * Target_type - Current type of the target
- * Target_desc_ptr - Pointer to the target
+ * Dest_desc - Object to recieve a copy of the source
+ * New_desc - New object if Dest_desc is obsoleted
* Walk_state - Current walk state
*
* RETURN: Status
* conversion), and a copy of the value of the source to
* the target.
*
+ * The Assignment of an object to another (not named) object
+ * is handled here.
+ * The Source passed in will replace the current value (if any)
+ * with the input value.
+ *
+ * When storing into an object the data is converted to the
+ * target object type then stored in the object. This means
+ * that the target object type (for an initialized target) will
+ * not be changed by a store operation.
+ *
+ * This module allows destination types of Number, String,
+ * Buffer, and Package.
+ *
+ * Assumes parameters are already validated. NOTE: Source_desc
+ * resolution (from a reference object) must be performed by
+ * the caller if necessary.
+ *
******************************************************************************/
acpi_status
-acpi_ex_store_object (
+acpi_ex_store_object_to_object (
acpi_operand_object *source_desc,
- acpi_object_type8 target_type,
- acpi_operand_object **target_desc_ptr,
+ acpi_operand_object *dest_desc,
+ acpi_operand_object **new_desc,
acpi_walk_state *walk_state)
{
- acpi_operand_object *target_desc = *target_desc_ptr;
+ acpi_operand_object *actual_src_desc;
acpi_status status = AE_OK;
- FUNCTION_TRACE ("Ex_store_object");
+ ACPI_FUNCTION_TRACE_PTR ("Acpi_ex_store_object_to_object", source_desc);
- /*
- * Perform the "implicit conversion" of the source to the current type
- * of the target - As per the ACPI specification.
- *
- * If no conversion performed, Source_desc is left alone, otherwise it
- * is updated with a new object.
- */
- status = acpi_ex_convert_to_target_type (target_type, &source_desc, walk_state);
- if (ACPI_FAILURE (status)) {
+ actual_src_desc = source_desc;
+ if (!dest_desc) {
+ /*
+ * There is no destination object (An uninitialized node or
+ * package element), so we can simply copy the source object
+ * creating a new destination object
+ */
+ status = acpi_ut_copy_iobject_to_iobject (actual_src_desc, new_desc, walk_state);
return_ACPI_STATUS (status);
}
+ if (source_desc->common.type != dest_desc->common.type) {
+ /*
+ * The source type does not match the type of the destination.
+ * Perform the "implicit conversion" of the source to the current type
+ * of the target as per the ACPI specification.
+ *
+ * If no conversion performed, Actual_src_desc = Source_desc.
+ * Otherwise, Actual_src_desc is a temporary object to hold the
+ * converted object.
+ */
+ status = acpi_ex_convert_to_target_type (dest_desc->common.type, source_desc,
+ &actual_src_desc, walk_state);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+ }
+
/*
* We now have two objects of identical types, and we can perform a
* copy of the *value* of the source object.
*/
- switch (target_type) {
- case ACPI_TYPE_ANY:
- case INTERNAL_TYPE_DEF_ANY:
-
- /*
- * The target namespace node is uninitialized (has no target object),
- * and will take on the type of the source object
- */
- *target_desc_ptr = source_desc;
- break;
-
-
+ switch (dest_desc->common.type) {
case ACPI_TYPE_INTEGER:
- target_desc->integer.value = source_desc->integer.value;
+ dest_desc->integer.value = actual_src_desc->integer.value;
/* Truncate value if we are executing from a 32-bit ACPI table */
- acpi_ex_truncate_for32bit_table (target_desc, walk_state);
+ acpi_ex_truncate_for32bit_table (dest_desc, walk_state);
break;
case ACPI_TYPE_STRING:
- status = acpi_ex_copy_string_to_string (source_desc, target_desc);
+ status = acpi_ex_store_string_to_string (actual_src_desc, dest_desc);
break;
-
case ACPI_TYPE_BUFFER:
- status = acpi_ex_copy_buffer_to_buffer (source_desc, target_desc);
+ status = acpi_ex_store_buffer_to_buffer (actual_src_desc, dest_desc);
break;
-
case ACPI_TYPE_PACKAGE:
- /*
- * TBD: [Unhandled] Not real sure what to do here
- */
- status = AE_NOT_IMPLEMENTED;
+ status = acpi_ut_copy_iobject_to_iobject (actual_src_desc, &dest_desc, walk_state);
break;
-
default:
-
/*
* All other types come here.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Store into type %s not implemented\n",
- acpi_ut_get_type_name (target_type)));
+ acpi_ut_get_type_name (dest_desc->common.type)));
status = AE_NOT_IMPLEMENTED;
break;
}
+ if (actual_src_desc != source_desc) {
+ /* Delete the intermediate (temporary) source object */
+
+ acpi_ut_remove_reference (actual_src_desc);
+ }
+ *new_desc = dest_desc;
return_ACPI_STATUS (status);
}
/******************************************************************************
*
* Module Name: exstorob - AML Interpreter object store support, store to object
- * $Revision: 37 $
+ * $Revision: 41 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exstorob")
+ ACPI_MODULE_NAME ("exstorob")
/*******************************************************************************
*
- * FUNCTION: Acpi_ex_copy_buffer_to_buffer
+ * FUNCTION: Acpi_ex_store_buffer_to_buffer
*
* PARAMETERS: Source_desc - Source object to copy
* Target_desc - Destination object of the copy
******************************************************************************/
acpi_status
-acpi_ex_copy_buffer_to_buffer (
+acpi_ex_store_buffer_to_buffer (
acpi_operand_object *source_desc,
acpi_operand_object *target_desc)
{
u8 *buffer;
- PROC_NAME ("Ex_copy_buffer_to_buffer");
+ ACPI_FUNCTION_NAME ("Ex_store_buffer_to_buffer");
/*
if (length <= target_desc->buffer.length) {
/* Clear existing buffer and copy in the new one */
- MEMSET (target_desc->buffer.pointer, 0, target_desc->buffer.length);
- MEMCPY (target_desc->buffer.pointer, buffer, length);
+ ACPI_MEMSET (target_desc->buffer.pointer, 0, target_desc->buffer.length);
+ ACPI_MEMCPY (target_desc->buffer.pointer, buffer, length);
}
else {
/*
* Truncate the source, copy only what will fit
*/
- MEMCPY (target_desc->buffer.pointer, buffer, target_desc->buffer.length);
+ ACPI_MEMCPY (target_desc->buffer.pointer, buffer, target_desc->buffer.length);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Truncating src buffer from %X to %X\n",
/*******************************************************************************
*
- * FUNCTION: Acpi_ex_copy_string_to_string
+ * FUNCTION: Acpi_ex_store_string_to_string
*
* PARAMETERS: Source_desc - Source object to copy
* Target_desc - Destination object of the copy
******************************************************************************/
acpi_status
-acpi_ex_copy_string_to_string (
+acpi_ex_store_string_to_string (
acpi_operand_object *source_desc,
acpi_operand_object *target_desc)
{
u8 *buffer;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/*
if (length < target_desc->string.length) {
/* Clear old string and copy in the new one */
- MEMSET (target_desc->string.pointer, 0, target_desc->string.length);
- MEMCPY (target_desc->string.pointer, buffer, length);
+ ACPI_MEMSET (target_desc->string.pointer, 0, target_desc->string.length);
+ ACPI_MEMCPY (target_desc->string.pointer, buffer, length);
}
else {
}
target_desc->string.length = length;
- MEMCPY (target_desc->string.pointer, buffer, length);
+ ACPI_MEMCPY (target_desc->string.pointer, buffer, length);
}
return (AE_OK);
/******************************************************************************
*
* Module Name: exsystem - Interface to OS services
- * $Revision: 67 $
+ * $Revision: 71 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acevents.h"
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exsystem")
+ ACPI_MODULE_NAME ("exsystem")
/*******************************************************************************
u32 timeout)
{
acpi_status status;
+ acpi_status status2;
- FUNCTION_TRACE ("Ex_system_wait_semaphore");
+ ACPI_FUNCTION_TRACE ("Ex_system_wait_semaphore");
status = acpi_os_wait_semaphore (semaphore, 1, 0);
/* Reacquire the interpreter */
- status = acpi_ex_enter_interpreter ();
- if (ACPI_SUCCESS (status)) {
- /* Restore the timeout exception */
+ status2 = acpi_ex_enter_interpreter ();
+ if (ACPI_FAILURE (status2)) {
+ /* Report fatal error, could not acquire interpreter */
- status = AE_TIME;
+ return_ACPI_STATUS (status2);
}
}
*
* PARAMETERS: How_long - The amount of time to stall
*
- * RETURN: None
+ * RETURN: Status
*
* DESCRIPTION: Suspend running thread for specified amount of time.
*
******************************************************************************/
-void
+acpi_status
acpi_ex_system_do_stall (
u32 how_long)
{
- FUNCTION_ENTRY ();
+ acpi_status status = AE_OK;
+
+
+ ACPI_FUNCTION_ENTRY ();
if (how_long > 1000) /* 1 millisecond */ {
/* And now we must get the interpreter again */
- acpi_ex_enter_interpreter ();
+ status = acpi_ex_enter_interpreter ();
}
else {
acpi_os_sleep (0, (how_long / 1000) + 1);
}
+
+ return (status);
}
*
******************************************************************************/
-void
+acpi_status
acpi_ex_system_do_suspend (
u32 how_long)
{
+ acpi_status status;
- FUNCTION_ENTRY ();
+
+ ACPI_FUNCTION_ENTRY ();
/* Since this thread will sleep, we must release the interpreter */
/* And now we must get the interpreter again */
- acpi_ex_enter_interpreter ();
+ status = acpi_ex_enter_interpreter ();
+ return (status);
}
acpi_status status = AE_OK;
- FUNCTION_TRACE_PTR ("Ex_system_acquire_mutex", obj_desc);
+ ACPI_FUNCTION_TRACE_PTR ("Ex_system_acquire_mutex", obj_desc);
if (!obj_desc) {
* Support for the _GL_ Mutex object -- go get the global lock
*/
if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) {
- status = acpi_ev_acquire_global_lock ();
+ status = acpi_ev_acquire_global_lock ((u32) time_desc->integer.value);
return_ACPI_STATUS (status);
}
acpi_status status = AE_OK;
- FUNCTION_TRACE ("Ex_system_release_mutex");
+ ACPI_FUNCTION_TRACE ("Ex_system_release_mutex");
if (!obj_desc) {
acpi_status status = AE_OK;
- FUNCTION_TRACE ("Ex_system_signal_event");
+ ACPI_FUNCTION_TRACE ("Ex_system_signal_event");
if (obj_desc) {
acpi_status status = AE_OK;
- FUNCTION_TRACE ("Ex_system_wait_event");
+ ACPI_FUNCTION_TRACE ("Ex_system_wait_event");
if (obj_desc) {
(u32) time_desc->integer.value);
}
-
return_ACPI_STATUS (status);
}
void *temp_semaphore;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/*
/******************************************************************************
*
* Module Name: exutils - interpreter/scanner utilities
- * $Revision: 85 $
+ * $Revision: 93 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acparser.h"
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exutils")
+ ACPI_MODULE_NAME ("exutils")
/*******************************************************************************
*
* PARAMETERS: None
*
- * DESCRIPTION: Enter the interpreter execution region
- * TBD: should be a macro
+ * DESCRIPTION: Enter the interpreter execution region. Failure to enter
+ * the interpreter region is a fatal system error
*
******************************************************************************/
{
acpi_status status;
- FUNCTION_TRACE ("Ex_enter_interpreter");
+ ACPI_FUNCTION_TRACE ("Ex_enter_interpreter");
status = acpi_ut_acquire_mutex (ACPI_MTX_EXECUTE);
+ if (ACPI_FAILURE (status)) {
+ ACPI_REPORT_ERROR (("Fatal - Could not acquire interpreter lock\n"));
+ }
+
return_ACPI_STATUS (status);
}
* already executing
* 7) About to invoke a user-installed opregion handler
*
- * TBD: should be a macro
- *
******************************************************************************/
void
acpi_ex_exit_interpreter (void)
{
- FUNCTION_TRACE ("Ex_exit_interpreter");
+ acpi_status status;
+
+ ACPI_FUNCTION_TRACE ("Ex_exit_interpreter");
- acpi_ut_release_mutex (ACPI_MTX_EXECUTE);
+
+ status = acpi_ut_release_mutex (ACPI_MTX_EXECUTE);
return_VOID;
}
acpi_object_type type)
{
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
if ((type > ACPI_TYPE_MAX && type < INTERNAL_TYPE_BEGIN) ||
acpi_walk_state *walk_state)
{
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/*
*
* FUNCTION: Acpi_ex_acquire_global_lock
*
- * PARAMETERS: Rule - Lock rule: Always_lock, Never_lock
+ * PARAMETERS: Field_flags - Flags with Lock rule:
+ * Always_lock or Never_lock
*
* RETURN: TRUE/FALSE indicating whether the lock was actually acquired
*
u8
acpi_ex_acquire_global_lock (
- u32 rule)
+ u32 field_flags)
{
u8 locked = FALSE;
acpi_status status;
- FUNCTION_TRACE ("Ex_acquire_global_lock");
+ ACPI_FUNCTION_TRACE ("Ex_acquire_global_lock");
- /* Only attempt lock if the Rule says so */
+ /* Only attempt lock if the Always_lock bit is set */
- if (rule == (u32) GLOCK_ALWAYS_LOCK) {
- /* We should attempt to get the lock */
+ if (field_flags & AML_FIELD_LOCK_RULE_MASK) {
+ /* We should attempt to get the lock, wait forever */
- status = acpi_ev_acquire_global_lock ();
+ status = acpi_ev_acquire_global_lock (ACPI_UINT32_MAX);
if (ACPI_SUCCESS (status)) {
locked = TRUE;
}
-
else {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not acquire Global Lock, %s\n",
acpi_format_exception (status)));
u8 locked_by_me)
{
- FUNCTION_TRACE ("Ex_release_global_lock");
+ ACPI_FUNCTION_TRACE ("Ex_release_global_lock");
/* Only attempt unlock if the caller locked it */
acpi_ev_release_global_lock ();
}
-
return_ACPI_STATUS (AE_OK);
}
u32 num_digits = 0;
- FUNCTION_TRACE ("Ex_digits_needed");
+ ACPI_FUNCTION_TRACE ("Ex_digits_needed");
if (base < 1) {
- REPORT_ERROR (("Ex_digits_needed: Internal error - Invalid base\n"));
+ ACPI_REPORT_ERROR (("Ex_digits_needed: Internal error - Invalid base\n"));
}
-
else {
/*
* acpi_integer is unsigned, which is why we don't worry about a '-'
} in;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
in.value = value;
u32 id;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/* swap to big-endian to get contiguous bits */
u32 remainder;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
digits_needed = acpi_ex_digits_needed (value, 10);
#
# Makefile for all Linux ACPI interpreter subdirectories
-# EXCEPT for the ospm directory
#
O_TARGET := $(notdir $(CURDIR)).o
-obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c))
+obj-$(CONFIG_ACPI_INTERPRETER) := $(patsubst %.c,%.o,$(wildcard *.c))
EXTRA_CFLAGS += $(ACPI_CFLAGS)
/******************************************************************************
*
* Module Name: hwacpi - ACPI Hardware Initialization/Mode Interface
- * $Revision: 46 $
+ * $Revision: 53 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_HARDWARE
- MODULE_NAME ("hwacpi")
+ ACPI_MODULE_NAME ("hwacpi")
/******************************************************************************
acpi_hw_initialize (
void)
{
- acpi_status status = AE_OK;
- u32 index;
+ acpi_status status;
- FUNCTION_TRACE ("Hw_initialize");
+ ACPI_FUNCTION_TRACE ("Hw_initialize");
/* We must have the ACPI tables by the time we get here */
if (!acpi_gbl_FADT) {
- acpi_gbl_restore_acpi_chipset = FALSE;
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No FADT!\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "A FADT is not loaded\n"));
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
}
- /* Identify current ACPI/legacy mode */
-
- switch (acpi_gbl_system_flags & SYS_MODES_MASK) {
- case (SYS_MODE_ACPI):
-
- acpi_gbl_original_mode = SYS_MODE_ACPI;
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "System supports ACPI mode only.\n"));
- break;
-
-
- case (SYS_MODE_LEGACY):
-
- acpi_gbl_original_mode = SYS_MODE_LEGACY;
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Tables loaded from buffer, hardware assumed to support LEGACY mode only.\n"));
- break;
-
-
- case (SYS_MODE_ACPI | SYS_MODE_LEGACY):
-
- if (acpi_hw_get_mode () == SYS_MODE_ACPI) {
- acpi_gbl_original_mode = SYS_MODE_ACPI;
- }
- else {
- acpi_gbl_original_mode = SYS_MODE_LEGACY;
- }
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "System supports both ACPI and LEGACY modes.\n"));
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "System is currently in %s mode.\n",
- (acpi_gbl_original_mode == SYS_MODE_ACPI) ? "ACPI" : "LEGACY"));
- break;
- }
-
-
- if (acpi_gbl_system_flags & SYS_MODE_ACPI) {
- /* Target system supports ACPI mode */
+ /* Sanity check the FADT for valid values */
- /*
- * The purpose of this code is to save the initial state
- * of the ACPI event enable registers. An exit function will be
- * registered which will restore this state when the application
- * exits. The exit function will also clear all of the ACPI event
- * status bits prior to restoring the original mode.
- *
- * The location of the PM1a_evt_blk enable registers is defined as the
- * base of PM1a_evt_blk + DIV_2(PM1a_evt_blk_length). Since the spec further
- * fully defines the PM1a_evt_blk to be a total of 4 bytes, the offset
- * for the enable registers is always 2 from the base. It is hard
- * coded here. If this changes in the spec, this code will need to
- * be modified. The PM1b_evt_blk behaves as expected.
- */
- acpi_gbl_pm1_enable_register_save = (u16) acpi_hw_register_read (
- ACPI_MTX_LOCK, PM1_EN);
-
-
- /*
- * The GPEs behave similarly, except that the length of the register
- * block is not fixed, so the buffer must be allocated with malloc
- */
- if (ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xgpe0blk.address) &&
- acpi_gbl_FADT->gpe0blk_len) {
- /* GPE0 specified in FADT */
-
- acpi_gbl_gpe0enable_register_save = ACPI_MEM_ALLOCATE (
- DIV_2 (acpi_gbl_FADT->gpe0blk_len));
- if (!acpi_gbl_gpe0enable_register_save) {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /* Save state of GPE0 enable bits */
-
- for (index = 0; index < DIV_2 (acpi_gbl_FADT->gpe0blk_len); index++) {
- acpi_gbl_gpe0enable_register_save[index] =
- (u8) acpi_hw_register_read (ACPI_MTX_LOCK, GPE0_EN_BLOCK | index);
- }
- }
-
- else {
- acpi_gbl_gpe0enable_register_save = NULL;
- }
-
- if (ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xgpe1_blk.address) &&
- acpi_gbl_FADT->gpe1_blk_len) {
- /* GPE1 defined */
-
- acpi_gbl_gpe1_enable_register_save = ACPI_MEM_ALLOCATE (
- DIV_2 (acpi_gbl_FADT->gpe1_blk_len));
- if (!acpi_gbl_gpe1_enable_register_save) {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /* save state of GPE1 enable bits */
-
- for (index = 0; index < DIV_2 (acpi_gbl_FADT->gpe1_blk_len); index++) {
- acpi_gbl_gpe1_enable_register_save[index] =
- (u8) acpi_hw_register_read (ACPI_MTX_LOCK, GPE1_EN_BLOCK | index);
- }
- }
-
- else {
- acpi_gbl_gpe1_enable_register_save = NULL;
- }
+ status = acpi_ut_validate_fadt ();
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
}
- return_ACPI_STATUS (status);
+ return_ACPI_STATUS (AE_OK);
}
*
* RETURN: Status
*
- * DESCRIPTION: Transitions the system into the requested mode or does nothing
- * if the system is already in that mode.
+ * DESCRIPTION: Transitions the system into the requested mode.
*
******************************************************************************/
acpi_status status = AE_NO_HARDWARE_RESPONSE;
- FUNCTION_TRACE ("Hw_set_mode");
+ ACPI_FUNCTION_TRACE ("Hw_set_mode");
- if (mode == SYS_MODE_ACPI) {
+ if (mode == ACPI_SYS_MODE_ACPI) {
/* BIOS should have disabled ALL fixed and GP events */
acpi_os_write_port (acpi_gbl_FADT->smi_cmd, acpi_gbl_FADT->acpi_enable, 8);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Attempting to enable ACPI mode\n"));
}
-
- else if (mode == SYS_MODE_LEGACY) {
+ else if (mode == ACPI_SYS_MODE_LEGACY) {
/*
* BIOS should clear all fixed status bits and restore fixed event
* enable bits to default
acpi_hw_get_mode (void)
{
- FUNCTION_TRACE ("Hw_get_mode");
+ ACPI_FUNCTION_TRACE ("Hw_get_mode");
- if (acpi_hw_register_bit_access (ACPI_READ, ACPI_MTX_LOCK, SCI_EN)) {
- return_VALUE (SYS_MODE_ACPI);
+ if (acpi_hw_bit_register_read (ACPI_BITREG_SCI_ENABLE, ACPI_MTX_LOCK)) {
+ return_VALUE (ACPI_SYS_MODE_ACPI);
}
else {
- return_VALUE (SYS_MODE_LEGACY);
- }
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: Acpi_hw_get_mode_capabilities
- *
- * PARAMETERS: none
- *
- * RETURN: logical OR of SYS_MODE_ACPI and SYS_MODE_LEGACY determined at initial
- * system state.
- *
- * DESCRIPTION: Returns capablities of system
- *
- ******************************************************************************/
-
-u32
-acpi_hw_get_mode_capabilities (void)
-{
-
- FUNCTION_TRACE ("Hw_get_mode_capabilities");
-
-
- if (!(acpi_gbl_system_flags & SYS_MODES_MASK)) {
- if (acpi_hw_get_mode () == SYS_MODE_LEGACY) {
- /*
- * Assume that if this call is being made, Acpi_init has been called
- * and ACPI support has been established by the presence of the
- * tables. Therefore since we're in SYS_MODE_LEGACY, the system
- * must support both modes
- */
- acpi_gbl_system_flags |= (SYS_MODE_ACPI | SYS_MODE_LEGACY);
- }
-
- else {
- /* TBD: [Investigate] !!! this may be unsafe... */
- /*
- * system is is ACPI mode, so try to switch back to LEGACY to see if
- * it is supported
- */
- acpi_hw_set_mode (SYS_MODE_LEGACY);
-
- if (acpi_hw_get_mode () == SYS_MODE_LEGACY) {
- /* Now in SYS_MODE_LEGACY, so both are supported */
-
- acpi_gbl_system_flags |= (SYS_MODE_ACPI | SYS_MODE_LEGACY);
- acpi_hw_set_mode (SYS_MODE_ACPI);
- }
-
- else {
- /* Still in SYS_MODE_ACPI so this must be an ACPI only system */
-
- acpi_gbl_system_flags |= SYS_MODE_ACPI;
- }
- }
+ return_VALUE (ACPI_SYS_MODE_LEGACY);
}
-
- return_VALUE (acpi_gbl_system_flags & SYS_MODES_MASK);
}
-
-
/******************************************************************************
*
* Module Name: hwgpe - Low level GPE enable/disable/clear functions
- * $Revision: 35 $
+ * $Revision: 39 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acevents.h"
#define _COMPONENT ACPI_HARDWARE
- MODULE_NAME ("hwgpe")
+ ACPI_MODULE_NAME ("hwgpe")
+
+
+/******************************************************************************
+ *
+ * FUNCTION: Acpi_hw_get_gpe_bit_mask
+ *
+ * PARAMETERS: Gpe_number - The GPE
+ *
+ * RETURN: Gpe register bitmask for this gpe level
+ *
+ * DESCRIPTION: Get the bitmask for this GPE
+ *
+ ******************************************************************************/
+
+u32
+acpi_hw_get_gpe_bit_mask (
+ u32 gpe_number)
+{
+ return (acpi_gbl_gpe_number_info [acpi_ev_get_gpe_number_index (gpe_number)].bit_mask);
+}
/******************************************************************************
u32 bit_mask;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
- /*
- * Translate GPE number to index into global registers array.
- */
- register_index = acpi_gbl_gpe_valid[gpe_number];
+ /* Translate GPE number to index into global registers array. */
- /*
- * Figure out the bit offset for this GPE within the target register.
- */
- bit_mask = acpi_gbl_decode_to8bit [MOD_8 (gpe_number)];
+ register_index = acpi_ev_get_gpe_register_index (gpe_number);
+
+ /* Get the register bitmask for this GPE */
+
+ bit_mask = acpi_hw_get_gpe_bit_mask (gpe_number);
/*
* Read the current value of the register, set the appropriate bit
* to enable the GPE, and write out the new register.
*/
in_byte = 0;
- acpi_os_read_port (acpi_gbl_gpe_registers[register_index].enable_addr, &in_byte, 8);
- acpi_os_write_port (acpi_gbl_gpe_registers[register_index].enable_addr,
- (in_byte | bit_mask), 8);
+ acpi_os_read_port (acpi_gbl_gpe_register_info[register_index].enable_addr, &in_byte, 8);
+ acpi_os_write_port (acpi_gbl_gpe_register_info[register_index].enable_addr,
+ (in_byte | bit_mask), 8);
}
+
/******************************************************************************
*
* FUNCTION: Acpi_hw_enable_gpe_for_wakeup
u32 bit_mask;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
- /*
- * Translate GPE number to index into global registers array.
- */
- register_index = acpi_gbl_gpe_valid[gpe_number];
+ /* Translate GPE number to index into global registers array. */
- /*
- * Figure out the bit offset for this GPE within the target register.
- */
- bit_mask = acpi_gbl_decode_to8bit [MOD_8 (gpe_number)];
+ register_index = acpi_ev_get_gpe_register_index (gpe_number);
+
+ /* Get the register bitmask for this GPE */
+
+ bit_mask = acpi_hw_get_gpe_bit_mask (gpe_number);
/*
* Set the bit so we will not disable this when sleeping
*/
- acpi_gbl_gpe_registers[register_index].wake_enable |= bit_mask;
+ acpi_gbl_gpe_register_info[register_index].wake_enable |= bit_mask;
}
+
/******************************************************************************
*
* FUNCTION: Acpi_hw_disable_gpe
u32 bit_mask;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
- /*
- * Translate GPE number to index into global registers array.
- */
- register_index = acpi_gbl_gpe_valid[gpe_number];
+ /* Translate GPE number to index into global registers array. */
- /*
- * Figure out the bit offset for this GPE within the target register.
- */
- bit_mask = acpi_gbl_decode_to8bit [MOD_8 (gpe_number)];
+ register_index = acpi_ev_get_gpe_register_index (gpe_number);
+
+ /* Get the register bitmask for this GPE */
+
+ bit_mask = acpi_hw_get_gpe_bit_mask (gpe_number);
/*
* Read the current value of the register, clear the appropriate bit,
* and write out the new register value to disable the GPE.
*/
in_byte = 0;
- acpi_os_read_port (acpi_gbl_gpe_registers[register_index].enable_addr, &in_byte, 8);
- acpi_os_write_port (acpi_gbl_gpe_registers[register_index].enable_addr,
+ acpi_os_read_port (acpi_gbl_gpe_register_info[register_index].enable_addr, &in_byte, 8);
+ acpi_os_write_port (acpi_gbl_gpe_register_info[register_index].enable_addr,
(in_byte & ~bit_mask), 8);
acpi_hw_disable_gpe_for_wakeup(gpe_number);
}
+
/******************************************************************************
*
* FUNCTION: Acpi_hw_disable_gpe_for_wakeup
u32 bit_mask;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
- /*
- * Translate GPE number to index into global registers array.
- */
- register_index = acpi_gbl_gpe_valid[gpe_number];
+ /* Translate GPE number to index into global registers array. */
- /*
- * Figure out the bit offset for this GPE within the target register.
- */
- bit_mask = acpi_gbl_decode_to8bit [MOD_8 (gpe_number)];
+ register_index = acpi_ev_get_gpe_register_index (gpe_number);
+
+ /* Get the register bitmask for this GPE */
+
+ bit_mask = acpi_hw_get_gpe_bit_mask (gpe_number);
/*
* Clear the bit so we will disable this when sleeping
*/
- acpi_gbl_gpe_registers[register_index].wake_enable &= ~bit_mask;
+ acpi_gbl_gpe_register_info[register_index].wake_enable &= ~bit_mask;
}
+
/******************************************************************************
*
* FUNCTION: Acpi_hw_clear_gpe
u32 bit_mask;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
- /*
- * Translate GPE number to index into global registers array.
- */
- register_index = acpi_gbl_gpe_valid[gpe_number];
+ /* Translate GPE number to index into global registers array. */
- /*
- * Figure out the bit offset for this GPE within the target register.
- */
- bit_mask = acpi_gbl_decode_to8bit [MOD_8 (gpe_number)];
+ register_index = acpi_ev_get_gpe_register_index (gpe_number);
+
+ /* Get the register bitmask for this GPE */
+
+ bit_mask = acpi_hw_get_gpe_bit_mask (gpe_number);
/*
* Write a one to the appropriate bit in the status register to
* clear this GPE.
*/
- acpi_os_write_port (acpi_gbl_gpe_registers[register_index].status_addr, bit_mask, 8);
+ acpi_os_write_port (acpi_gbl_gpe_register_info[register_index].status_addr, bit_mask, 8);
}
u32 in_byte = 0;
u32 register_index = 0;
u32 bit_mask = 0;
+ ACPI_GPE_REGISTER_INFO *gpe_register_info;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
if (!event_status) {
(*event_status) = 0;
- /*
- * Translate GPE number to index into global registers array.
- */
- register_index = acpi_gbl_gpe_valid[gpe_number];
+ /* Translate GPE number to index into global registers array. */
- /*
- * Figure out the bit offset for this GPE within the target register.
- */
- bit_mask = acpi_gbl_decode_to8bit [MOD_8 (gpe_number)];
+ register_index = acpi_ev_get_gpe_register_index (gpe_number);
+ gpe_register_info = &acpi_gbl_gpe_register_info[register_index];
+
+ /* Get the register bitmask for this GPE */
+
+ bit_mask = acpi_hw_get_gpe_bit_mask (gpe_number);
+
+ /* GPE Enabled? */
- /*
- * Enabled?:
- */
in_byte = 0;
- acpi_os_read_port (acpi_gbl_gpe_registers[register_index].enable_addr, &in_byte, 8);
+ acpi_os_read_port (gpe_register_info->enable_addr, &in_byte, 8);
if (bit_mask & in_byte) {
(*event_status) |= ACPI_EVENT_FLAG_ENABLED;
}
- /*
- * Enabled for wake?:
- */
- if (bit_mask & acpi_gbl_gpe_registers[register_index].wake_enable) {
+ /* GPE Enabled for wake? */
+
+ if (bit_mask & gpe_register_info->wake_enable) {
(*event_status) |= ACPI_EVENT_FLAG_WAKE_ENABLED;
}
- /*
- * Set?
- */
+ /* GPE active (set)? */
+
in_byte = 0;
- acpi_os_read_port (acpi_gbl_gpe_registers[register_index].status_addr, &in_byte, 8);
+ acpi_os_read_port (gpe_register_info->status_addr, &in_byte, 8);
if (bit_mask & in_byte) {
(*event_status) |= ACPI_EVENT_FLAG_SET;
}
}
+
/******************************************************************************
*
* FUNCTION: Acpi_hw_disable_non_wakeup_gpes
*
* DESCRIPTION: Disable all non-wakeup GPEs
* Call with interrupts disabled. The interrupt handler also
- * modifies Acpi_gbl_Gpe_registers[i].Enable, so it should not be
+ * modifies Acpi_gbl_Gpe_register_info[i].Enable, so it should not be
* given the chance to run until after non-wake GPEs are
* re-enabled.
*
void)
{
u32 i;
+ ACPI_GPE_REGISTER_INFO *gpe_register_info;
+
+
+ ACPI_FUNCTION_ENTRY ();
- FUNCTION_ENTRY ();
for (i = 0; i < acpi_gbl_gpe_register_count; i++) {
+ gpe_register_info = &acpi_gbl_gpe_register_info[i];
+
/*
* Read the enabled status of all GPEs. We
* will be using it to restore all the GPEs later.
*/
- acpi_os_read_port (acpi_gbl_gpe_registers[i].enable_addr,
- &acpi_gbl_gpe_registers[i].enable, 8);
+ acpi_os_read_port (gpe_register_info->enable_addr,
+ &gpe_register_info->enable, 8);
/*
- * Disable all GPEs but wakeup GPEs.
+ * Disable all GPEs except wakeup GPEs.
*/
- acpi_os_write_port(acpi_gbl_gpe_registers[i].enable_addr,
- acpi_gbl_gpe_registers[i].wake_enable, 8);
+ acpi_os_write_port(gpe_register_info->enable_addr,
+ gpe_register_info->wake_enable, 8);
}
}
+
/******************************************************************************
*
* FUNCTION: Acpi_hw_enable_non_wakeup_gpes
void)
{
u32 i;
+ ACPI_GPE_REGISTER_INFO *gpe_register_info;
+
+
+ ACPI_FUNCTION_ENTRY ();
- FUNCTION_ENTRY ();
for (i = 0; i < acpi_gbl_gpe_register_count; i++) {
+ gpe_register_info = &acpi_gbl_gpe_register_info[i];
+
/*
* We previously stored the enabled status of all GPEs.
* Blast them back in.
*/
- acpi_os_write_port(acpi_gbl_gpe_registers[i].enable_addr,
- acpi_gbl_gpe_registers[i].enable, 8);
+ acpi_os_write_port(gpe_register_info->enable_addr,
+ gpe_register_info->enable, 8);
}
}
*
* Module Name: hwregs - Read/write access functions for the various ACPI
* control and status registers.
- * $Revision: 110 $
+ * $Revision: 120 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acnamesp.h"
#define _COMPONENT ACPI_HARDWARE
- MODULE_NAME ("hwregs")
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_hw_get_bit_shift
- *
- * PARAMETERS: Mask - Input mask to determine bit shift from.
- * Must have at least 1 bit set.
- *
- * RETURN: Bit location of the lsb of the mask
- *
- * DESCRIPTION: Returns the bit number for the low order bit that's set.
- *
- ******************************************************************************/
-
-u32
-acpi_hw_get_bit_shift (
- u32 mask)
-{
- u32 shift;
-
-
- FUNCTION_TRACE ("Hw_get_bit_shift");
-
-
- for (shift = 0; ((mask >> shift) & 1) == 0; shift++) { ; }
-
- return_VALUE (shift);
-}
+ ACPI_MODULE_NAME ("hwregs")
/*******************************************************************************
void
acpi_hw_clear_acpi_status (void)
{
- u16 gpe_length;
- u16 index;
+ NATIVE_UINT i;
+ NATIVE_UINT gpe_block;
+ acpi_status status;
- FUNCTION_TRACE ("Hw_clear_acpi_status");
+ ACPI_FUNCTION_TRACE ("Hw_clear_acpi_status");
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %04X to %04X\n",
- ALL_FIXED_STS_BITS,
+ ACPI_BITMASK_ALL_FIXED_STATUS,
(u16) ACPI_GET_ADDRESS (acpi_gbl_FADT->Xpm1a_evt_blk.address)));
- acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE);
+ status = acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE);
+ if (ACPI_FAILURE (status)) {
+ return_VOID;
+ }
- acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, PM1_STS, ALL_FIXED_STS_BITS);
+ acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS,
+ ACPI_BITMASK_ALL_FIXED_STATUS);
+ /* Clear the fixed events */
if (ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xpm1b_evt_blk.address)) {
acpi_os_write_port ((ACPI_IO_ADDRESS)
ACPI_GET_ADDRESS (acpi_gbl_FADT->Xpm1b_evt_blk.address),
- ALL_FIXED_STS_BITS, 16);
+ ACPI_BITMASK_ALL_FIXED_STATUS, 16);
}
- /* now clear the GPE Bits */
+ /* Clear the GPE Bits */
- if (acpi_gbl_FADT->gpe0blk_len) {
- gpe_length = (u16) DIV_2 (acpi_gbl_FADT->gpe0blk_len);
-
- for (index = 0; index < gpe_length; index++) {
- acpi_os_write_port ((ACPI_IO_ADDRESS) (
- ACPI_GET_ADDRESS (acpi_gbl_FADT->Xgpe0blk.address) + index),
- 0xFF, 8);
- }
- }
-
- if (acpi_gbl_FADT->gpe1_blk_len) {
- gpe_length = (u16) DIV_2 (acpi_gbl_FADT->gpe1_blk_len);
-
- for (index = 0; index < gpe_length; index++) {
- acpi_os_write_port ((ACPI_IO_ADDRESS) (
- ACPI_GET_ADDRESS (acpi_gbl_FADT->Xgpe1_blk.address) + index),
+ for (gpe_block = 0; gpe_block < ACPI_MAX_GPE_BLOCKS; gpe_block++) {
+ for (i = 0; i < acpi_gbl_gpe_block_info[gpe_block].register_count; i++) {
+ acpi_os_write_port ((ACPI_IO_ADDRESS)
+ (acpi_gbl_gpe_block_info[gpe_block].block_address + i),
0xFF, 8);
}
}
- acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
+ (void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
return_VOID;
}
/*******************************************************************************
*
- * FUNCTION: Acpi_hw_obtain_sleep_type_register_data
+ * FUNCTION: Acpi_hw_get_sleep_type_data
*
- * PARAMETERS: Sleep_state - Numeric state requested
- * *Slp_Typ_a - Pointer to byte to receive SLP_TYPa value
- * *Slp_Typ_b - Pointer to byte to receive SLP_TYPb value
+ * PARAMETERS: Sleep_state - Numeric sleep state
+ * *Sleep_type_a - Where SLP_TYPa is returned
+ * *Sleep_type_b - Where SLP_TYPb is returned
*
* RETURN: Status - ACPI status
*
- * DESCRIPTION: Acpi_hw_obtain_sleep_type_register_data() obtains the SLP_TYP and
- * SLP_TYPb values for the sleep state requested.
+ * DESCRIPTION: Obtain the SLP_TYPa and SLP_TYPb values for the requested sleep
+ * state.
*
******************************************************************************/
acpi_status
-acpi_hw_obtain_sleep_type_register_data (
+acpi_hw_get_sleep_type_data (
u8 sleep_state,
- u8 *slp_typ_a,
- u8 *slp_typ_b)
+ u8 *sleep_type_a,
+ u8 *sleep_type_b)
{
acpi_status status = AE_OK;
acpi_operand_object *obj_desc;
- FUNCTION_TRACE ("Hw_obtain_sleep_type_register_data");
+ ACPI_FUNCTION_TRACE ("Hw_get_sleep_type_data");
/*
* Validate parameters
*/
if ((sleep_state > ACPI_S_STATES_MAX) ||
- !slp_typ_a || !slp_typ_b) {
+ !sleep_type_a || !sleep_type_b) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
}
if (!obj_desc) {
- REPORT_ERROR (("Missing Sleep State object\n"));
+ ACPI_REPORT_ERROR (("Missing Sleep State object\n"));
return_ACPI_STATUS (AE_NOT_EXIST);
}
*/
/* Even though Acpi_evaluate_object resolves package references,
- * Ns_evaluate dpesn't. So, we do it here.
+ * Ns_evaluate doesn't. So, we do it here.
*/
status = acpi_ut_resolve_package_references(obj_desc);
if (obj_desc->package.count < 2) {
/* Must have at least two elements */
- REPORT_ERROR (("Sleep State package does not have at least two elements\n"));
- status = AE_ERROR;
+ ACPI_REPORT_ERROR (("Sleep State package does not have at least two elements\n"));
+ status = AE_AML_NO_OPERAND;
}
-
- else if (((obj_desc->package.elements[0])->common.type !=
- ACPI_TYPE_INTEGER) ||
- ((obj_desc->package.elements[1])->common.type !=
- ACPI_TYPE_INTEGER)) {
+ else if (((obj_desc->package.elements[0])->common.type != ACPI_TYPE_INTEGER) ||
+ ((obj_desc->package.elements[1])->common.type != ACPI_TYPE_INTEGER)) {
/* Must have two */
- REPORT_ERROR (("Sleep State package elements are not both of type Number\n"));
- status = AE_ERROR;
+ ACPI_REPORT_ERROR (("Sleep State package elements are not both of type Number\n"));
+ status = AE_AML_OPERAND_TYPE;
}
-
else {
/*
* Valid _Sx_ package size, type, and value
*/
- *slp_typ_a = (u8) (obj_desc->package.elements[0])->integer.value;
-
- *slp_typ_b = (u8) (obj_desc->package.elements[1])->integer.value;
+ *sleep_type_a = (u8) (obj_desc->package.elements[0])->integer.value;
+ *sleep_type_b = (u8) (obj_desc->package.elements[1])->integer.value;
}
-
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad Sleep object %p type %X\n",
obj_desc, obj_desc->common.type));
}
acpi_ut_remove_reference (obj_desc);
-
return_ACPI_STATUS (status);
}
/*******************************************************************************
*
- * FUNCTION: Acpi_hw_register_bit_access
+ * FUNCTION: Acpi_hw_get_register_bit_mask
*
- * PARAMETERS: Read_write - Either ACPI_READ or ACPI_WRITE.
- * Use_lock - Lock the hardware
- * Register_id - index of ACPI Register to access
- * Value - (only used on write) value to write to the
- * Register. Shifted all the way right.
+ * PARAMETERS: Register_id - index of ACPI Register to access
*
- * RETURN: Value written to or read from specified Register. This value
- * is shifted all the way right.
+ * RETURN: The bit mask to be used when accessing the register
*
- * DESCRIPTION: Generic ACPI Register read/write function.
+ * DESCRIPTION: Map Register_id into a register bit mask.
*
******************************************************************************/
-u32
-acpi_hw_register_bit_access (
- NATIVE_UINT read_write,
- u8 use_lock,
- u32 register_id,
- ...) /* Value (only used on write) */
+ACPI_BIT_REGISTER_INFO *
+acpi_hw_get_bit_register_info (
+ u32 register_id)
{
- u32 register_value = 0;
- u32 mask = 0;
- u32 value = 0;
- va_list marker;
+ ACPI_FUNCTION_NAME ("Hw_get_bit_register_info");
- FUNCTION_TRACE ("Hw_register_bit_access");
+ if (register_id > ACPI_BITREG_MAX) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid Bit_register ID: %X\n", register_id));
+ return (NULL);
+ }
+ return (&acpi_gbl_bit_register_info[register_id]);
+}
- if (read_write == ACPI_WRITE) {
- va_start (marker, register_id);
- value = va_arg (marker, u32);
- va_end (marker);
- }
- if (ACPI_MTX_LOCK == use_lock) {
- acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE);
- }
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_hw_bit_register_read
+ *
+ * PARAMETERS: Register_id - index of ACPI Register to access
+ * Use_lock - Lock the hardware
+ *
+ * RETURN: Value is read from specified Register. Value returned is
+ * normalized to bit0 (is shifted all the way right)
+ *
+ * DESCRIPTION: ACPI Bit_register read function.
+ *
+ ******************************************************************************/
- /*
- * Decode the Register ID
- * Register id = Register block id | bit id
- *
- * Check bit id to fine locate Register offset.
- * Check Mask to determine Register offset, and then read-write.
- */
- switch (REGISTER_BLOCK_ID (register_id)) {
- case PM1_STS:
+u32
+acpi_hw_bit_register_read (
+ u32 register_id,
+ u32 flags)
+{
+ u32 register_value = 0;
+ ACPI_BIT_REGISTER_INFO *bit_reg_info;
- switch (register_id) {
- case TMR_STS:
- mask = TMR_STS_MASK;
- break;
- case BM_STS:
- mask = BM_STS_MASK;
- break;
+ ACPI_FUNCTION_TRACE ("Hw_bit_register_read");
- case GBL_STS:
- mask = GBL_STS_MASK;
- break;
- case PWRBTN_STS:
- mask = PWRBTN_STS_MASK;
- break;
+ if (flags & ACPI_MTX_LOCK) {
+ if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE))) {
+ return_VALUE (0);
+ }
+ }
- case SLPBTN_STS:
- mask = SLPBTN_STS_MASK;
- break;
+ /* Get the info structure corresponding to the requested ACPI Register */
- case RTC_STS:
- mask = RTC_STS_MASK;
- break;
+ bit_reg_info = acpi_hw_get_bit_register_info (register_id);
+ if (!bit_reg_info) {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
- case WAK_STS:
- mask = WAK_STS_MASK;
- break;
+ register_value = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, bit_reg_info->parent_register);
- default:
- mask = 0;
- break;
- }
+ if (flags & ACPI_MTX_LOCK) {
+ (void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
+ }
- register_value = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, PM1_STS);
-
- if (read_write == ACPI_WRITE) {
- /*
- * Status Registers are different from the rest. Clear by
- * writing 1, writing 0 has no effect. So, the only relevent
- * information is the single bit we're interested in, all
- * others should be written as 0 so they will be left
- * unchanged
- */
- value <<= acpi_hw_get_bit_shift (mask);
- value &= mask;
-
- if (value) {
- acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, PM1_STS,
- (u16) value);
- register_value = 0;
- }
- }
+ /* Normalize the value that was read */
- break;
+ register_value = ((register_value & bit_reg_info->access_bit_mask) >> bit_reg_info->bit_position);
+ ACPI_DEBUG_PRINT ((ACPI_DB_IO, "ACPI Register_read: got %X\n", register_value));
+ return_VALUE (register_value);
+}
- case PM1_EN:
- switch (register_id) {
- case TMR_EN:
- mask = TMR_EN_MASK;
- break;
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_hw_bit_register_write
+ *
+ * PARAMETERS: Register_id - ID of ACPI Bit_register to access
+ * Value - (only used on write) value to write to the
+ * Register, NOT pre-normalized to the bit pos.
+ * Flags - Lock the hardware or not
+ *
+ * RETURN: Value written to from specified Register. This value
+ * is shifted all the way right.
+ *
+ * DESCRIPTION: ACPI Bit Register write function.
+ *
+ ******************************************************************************/
- case GBL_EN:
- mask = GBL_EN_MASK;
- break;
+u32
+acpi_hw_bit_register_write (
+ u32 register_id,
+ u32 value,
+ u32 flags)
+{
+ u32 register_value = 0;
+ ACPI_BIT_REGISTER_INFO *bit_reg_info;
- case PWRBTN_EN:
- mask = PWRBTN_EN_MASK;
- break;
- case SLPBTN_EN:
- mask = SLPBTN_EN_MASK;
- break;
+ ACPI_FUNCTION_TRACE_U32 ("Hw_bit_register_write", register_id);
- case RTC_EN:
- mask = RTC_EN_MASK;
- break;
- default:
- mask = 0;
- break;
+ if (flags & ACPI_MTX_LOCK) {
+ if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE))) {
+ return_VALUE (0);
}
+ }
- register_value = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, PM1_EN);
-
- if (read_write == ACPI_WRITE) {
- register_value &= ~mask;
- value <<= acpi_hw_get_bit_shift (mask);
- value &= mask;
- register_value |= value;
+ /* Get the info structure corresponding to the requested ACPI Register */
- acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, PM1_EN, (u16) register_value);
- }
+ bit_reg_info = acpi_hw_get_bit_register_info (register_id);
+ if (!bit_reg_info) {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
- break;
+ /* Always do a register read first so we can insert the new bits */
+ register_value = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, bit_reg_info->parent_register);
- case PM1_CONTROL:
+ /*
+ * Decode the Register ID
+ * Register id = Register block id | bit id
+ *
+ * Check bit id to fine locate Register offset.
+ * Check Mask to determine Register offset, and then read-write.
+ */
+ switch (bit_reg_info->parent_register) {
+ case ACPI_REGISTER_PM1_STATUS:
- switch (register_id) {
- case SCI_EN:
- mask = SCI_EN_MASK;
- break;
+ /*
+ * Status Registers are different from the rest. Clear by
+ * writing 1, writing 0 has no effect. So, the only relevent
+ * information is the single bit we're interested in, all others should
+ * be written as 0 so they will be left unchanged
+ */
+ value = ACPI_REGISTER_PREPARE_BITS (value, bit_reg_info->bit_position, bit_reg_info->access_bit_mask);
+ if (value) {
+ acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS,
+ (u16) value);
+ register_value = 0;
+ }
+ break;
- case BM_RLD:
- mask = BM_RLD_MASK;
- break;
- case GBL_RLS:
- mask = GBL_RLS_MASK;
- break;
+ case ACPI_REGISTER_PM1_ENABLE:
- case SLP_TYPE_A:
- case SLP_TYPE_B:
- mask = SLP_TYPE_X_MASK;
- break;
+ ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position, bit_reg_info->access_bit_mask, value);
- case SLP_EN:
- mask = SLP_EN_MASK;
- break;
+ acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE, (u16) register_value);
+ break;
- default:
- mask = 0;
- break;
- }
+ case ACPI_REGISTER_PM1_CONTROL:
/*
* Read the PM1 Control register.
* Note that at this level, the fact that there are actually TWO
- * registers (A and B) and that B may not exist, are abstracted.
+ * registers (A and B - and that B may not exist) is abstracted.
*/
- register_value = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, PM1_CONTROL);
-
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM1 control: Read %X\n", register_value));
- if (read_write == ACPI_WRITE) {
- register_value &= ~mask;
- value <<= acpi_hw_get_bit_shift (mask);
- value &= mask;
- register_value |= value;
-
- /*
- * SLP_TYPE_x Registers are written differently
- * than any other control Registers with
- * respect to A and B Registers. The value
- * for A may be different than the value for B
- *
- * Therefore, pass the Register_id, not just generic PM1_CONTROL,
- * because we need to do different things. Yuck.
- */
- acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, register_id,
- (u16) register_value);
- }
- break;
-
+ ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position, bit_reg_info->access_bit_mask, value);
- case PM2_CONTROL:
+ acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, register_id,
+ (u16) register_value);
+ break;
- switch (register_id) {
- case ARB_DIS:
- mask = ARB_DIS_MASK;
- break;
- default:
- mask = 0;
- break;
- }
+ case ACPI_REGISTER_PM2_CONTROL:
- register_value = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, PM2_CONTROL);
+ register_value = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM2_CONTROL);
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM2 control: Read %X from %8.8X%8.8X\n",
- register_value, HIDWORD(acpi_gbl_FADT->Xpm2_cnt_blk.address),
- LODWORD(acpi_gbl_FADT->Xpm2_cnt_blk.address)));
-
- if (read_write == ACPI_WRITE) {
- register_value &= ~mask;
- value <<= acpi_hw_get_bit_shift (mask);
- value &= mask;
- register_value |= value;
-
- ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %04X to %8.8X%8.8X\n",
- register_value,
- HIDWORD(acpi_gbl_FADT->Xpm2_cnt_blk.address),
- LODWORD(acpi_gbl_FADT->Xpm2_cnt_blk.address)));
-
- acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
- PM2_CONTROL, (u8) (register_value));
- }
- break;
-
+ register_value, ACPI_HIDWORD (acpi_gbl_FADT->Xpm2_cnt_blk.address),
+ ACPI_LODWORD (acpi_gbl_FADT->Xpm2_cnt_blk.address)));
- case PM_TIMER:
+ ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position, bit_reg_info->access_bit_mask, value);
- mask = TMR_VAL_MASK;
- register_value = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK,
- PM_TIMER);
- ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM_TIMER: Read %X from %8.8X%8.8X\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %04X to %8.8X%8.8X\n",
register_value,
- HIDWORD(acpi_gbl_FADT->Xpm_tmr_blk.address),
- LODWORD(acpi_gbl_FADT->Xpm_tmr_blk.address)));
+ ACPI_HIDWORD (acpi_gbl_FADT->Xpm2_cnt_blk.address),
+ ACPI_LODWORD (acpi_gbl_FADT->Xpm2_cnt_blk.address)));
+ acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
+ ACPI_REGISTER_PM2_CONTROL, (u8) (register_value));
break;
- case GPE1_EN_BLOCK:
- case GPE1_STS_BLOCK:
- case GPE0_EN_BLOCK:
- case GPE0_STS_BLOCK:
-
- /* Determine the bit to be accessed
- *
- * (u32) Register_id:
- * 31 24 16 8 0
- * +--------+--------+--------+--------+
- * | gpe_block_id | gpe_bit_number |
- * +--------+--------+--------+--------+
- *
- * gpe_block_id is one of GPE[01]_EN_BLOCK and GPE[01]_STS_BLOCK
- * gpe_bit_number is relative from the gpe_block (0x00~0xFF)
- */
- mask = REGISTER_BIT_ID(register_id); /* gpe_bit_number */
- register_id = REGISTER_BLOCK_ID(register_id) | (mask >> 3);
- mask = acpi_gbl_decode_to8bit [mask % 8];
-
- /*
- * The base address of the GPE 0 Register Block
- * Plus 1/2 the length of the GPE 0 Register Block
- * The enable Register is the Register following the Status Register
- * and each Register is defined as 1/2 of the total Register Block
- */
-
- /*
- * This sets the bit within Enable_bit that needs to be written to
- * the Register indicated in Mask to a 1, all others are 0
- */
-
- /* Now get the current Enable Bits in the selected Reg */
-
- register_value = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, register_id);
- ACPI_DEBUG_PRINT ((ACPI_DB_IO, "GPE Enable bits: Read %X from %X\n",
- register_value, register_id));
-
- if (read_write == ACPI_WRITE) {
- register_value &= ~mask;
- value <<= acpi_hw_get_bit_shift (mask);
- value &= mask;
- register_value |= value;
-
- /*
- * This write will put the Action state into the General Purpose
- * Enable Register indexed by the value in Mask
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %04X to %04X\n",
- register_value, register_id));
- acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, register_id,
- (u8) register_value);
- register_value = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK,
- register_id);
- }
- break;
-
-
- case SMI_CMD_BLOCK:
- case PROCESSOR_BLOCK:
-
- /* Not used by any callers at this time - therefore, not implemented */
-
default:
-
- mask = 0;
break;
}
- if (ACPI_MTX_LOCK == use_lock) {
- acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
+ if (flags & ACPI_MTX_LOCK) {
+ (void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
}
+ /* Normalize the value that was read */
- register_value &= mask;
- register_value >>= acpi_hw_get_bit_shift (mask);
+ register_value = ((register_value & bit_reg_info->access_bit_mask) >> bit_reg_info->bit_position);
- ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Register I/O: returning %X\n", register_value));
+ ACPI_DEBUG_PRINT ((ACPI_DB_IO, "ACPI Register_write actual %X\n", register_value));
return_VALUE (register_value);
}
u32 bank_offset;
- FUNCTION_TRACE ("Hw_register_read");
+ ACPI_FUNCTION_TRACE ("Hw_register_read");
if (ACPI_MTX_LOCK == use_lock) {
- acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE);
+ if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE))) {
+ return_VALUE (0);
+ }
}
-
- switch (REGISTER_BLOCK_ID(register_id)) {
- case PM1_STS: /* 16-bit access */
+ switch (register_id) {
+ case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */
value = acpi_hw_low_level_read (16, &acpi_gbl_FADT->Xpm1a_evt_blk, 0);
value |= acpi_hw_low_level_read (16, &acpi_gbl_FADT->Xpm1b_evt_blk, 0);
break;
- case PM1_EN: /* 16-bit access*/
+ case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access*/
- bank_offset = DIV_2 (acpi_gbl_FADT->pm1_evt_len);
+ bank_offset = ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len);
value = acpi_hw_low_level_read (16, &acpi_gbl_FADT->Xpm1a_evt_blk, bank_offset);
value |= acpi_hw_low_level_read (16, &acpi_gbl_FADT->Xpm1b_evt_blk, bank_offset);
break;
- case PM1_CONTROL: /* 16-bit access */
+ case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */
value = acpi_hw_low_level_read (16, &acpi_gbl_FADT->Xpm1a_cnt_blk, 0);
value |= acpi_hw_low_level_read (16, &acpi_gbl_FADT->Xpm1b_cnt_blk, 0);
break;
- case PM2_CONTROL: /* 8-bit access */
+ case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
value = acpi_hw_low_level_read (8, &acpi_gbl_FADT->Xpm2_cnt_blk, 0);
break;
- case PM_TIMER: /* 32-bit access */
+ case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
value = acpi_hw_low_level_read (32, &acpi_gbl_FADT->Xpm_tmr_blk, 0);
break;
-
- /*
- * For the GPE? Blocks, the lower word of Register_id contains the
- * byte offset for which to read, as each part of each block may be
- * several bytes long.
- */
- case GPE0_STS_BLOCK: /* 8-bit access */
-
- bank_offset = REGISTER_BIT_ID(register_id);
- value = acpi_hw_low_level_read (8, &acpi_gbl_FADT->Xgpe0blk, bank_offset);
- break;
-
- case GPE0_EN_BLOCK: /* 8-bit access */
-
- bank_offset = DIV_2 (acpi_gbl_FADT->gpe0blk_len) + REGISTER_BIT_ID(register_id);
- value = acpi_hw_low_level_read (8, &acpi_gbl_FADT->Xgpe0blk, bank_offset);
- break;
-
- case GPE1_STS_BLOCK: /* 8-bit access */
-
- bank_offset = REGISTER_BIT_ID(register_id);
- value = acpi_hw_low_level_read (8, &acpi_gbl_FADT->Xgpe1_blk, bank_offset);
- break;
-
- case GPE1_EN_BLOCK: /* 8-bit access */
-
- bank_offset = DIV_2 (acpi_gbl_FADT->gpe1_blk_len) + REGISTER_BIT_ID(register_id);
- value = acpi_hw_low_level_read (8, &acpi_gbl_FADT->Xgpe1_blk, bank_offset);
- break;
-
- case SMI_CMD_BLOCK: /* 8bit */
+ case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */
acpi_os_read_port (acpi_gbl_FADT->smi_cmd, &value, 8);
break;
break;
}
-
if (ACPI_MTX_LOCK == use_lock) {
- acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
+ (void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
}
return_VALUE (value);
u32 bank_offset;
- FUNCTION_TRACE ("Hw_register_write");
+ ACPI_FUNCTION_TRACE ("Hw_register_write");
if (ACPI_MTX_LOCK == use_lock) {
- acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE);
+ if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE))) {
+ return_VOID;
+ }
}
-
- switch (REGISTER_BLOCK_ID (register_id)) {
- case PM1_STS: /* 16-bit access */
+ switch (register_id) {
+ case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */
acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1a_evt_blk, 0);
acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1b_evt_blk, 0);
break;
- case PM1_EN: /* 16-bit access*/
+ case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access*/
- bank_offset = DIV_2 (acpi_gbl_FADT->pm1_evt_len);
+ bank_offset = ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len);
acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1a_evt_blk, bank_offset);
acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1b_evt_blk, bank_offset);
break;
- case PM1_CONTROL: /* 16-bit access */
+ case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */
acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1a_cnt_blk, 0);
acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1b_cnt_blk, 0);
break;
- case PM1A_CONTROL: /* 16-bit access */
+ case ACPI_REGISTER_PM1A_CONTROL: /* 16-bit access */
acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1a_cnt_blk, 0);
break;
- case PM1B_CONTROL: /* 16-bit access */
+ case ACPI_REGISTER_PM1B_CONTROL: /* 16-bit access */
acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1b_cnt_blk, 0);
break;
- case PM2_CONTROL: /* 8-bit access */
+ case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
acpi_hw_low_level_write (8, value, &acpi_gbl_FADT->Xpm2_cnt_blk, 0);
break;
- case PM_TIMER: /* 32-bit access */
+ case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
acpi_hw_low_level_write (32, value, &acpi_gbl_FADT->Xpm_tmr_blk, 0);
break;
- case GPE0_STS_BLOCK: /* 8-bit access */
-
- bank_offset = REGISTER_BIT_ID(register_id);
- acpi_hw_low_level_write (8, value, &acpi_gbl_FADT->Xgpe0blk, bank_offset);
- break;
-
-
- case GPE0_EN_BLOCK: /* 8-bit access */
+ case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */
- bank_offset = DIV_2 (acpi_gbl_FADT->gpe0blk_len) + REGISTER_BIT_ID(register_id);
- acpi_hw_low_level_write (8, value, &acpi_gbl_FADT->Xgpe0blk, bank_offset);
- break;
-
-
- case GPE1_STS_BLOCK: /* 8-bit access */
-
- bank_offset = REGISTER_BIT_ID(register_id);
- acpi_hw_low_level_write (8, value, &acpi_gbl_FADT->Xgpe1_blk, bank_offset);
- break;
-
-
- case GPE1_EN_BLOCK: /* 8-bit access */
-
- bank_offset = DIV_2 (acpi_gbl_FADT->gpe1_blk_len) + REGISTER_BIT_ID(register_id);
- acpi_hw_low_level_write (8, value, &acpi_gbl_FADT->Xgpe1_blk, bank_offset);
- break;
-
-
- case SMI_CMD_BLOCK: /* 8bit */
-
- /* For 2.0, SMI_CMD is always in IO space */
- /* TBD: what about 1.0? 0.71? */
+ /* SMI_CMD is currently always in IO space */
acpi_os_write_port (acpi_gbl_FADT->smi_cmd, value, 8);
break;
break;
}
-
if (ACPI_MTX_LOCK == use_lock) {
- acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
+ (void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
}
return_VOID;
u16 pci_register;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/*
return 0;
}
-
/*
* Three address spaces supported:
* Memory, Io, or PCI config.
u16 pci_register;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/*
return;
}
-
/*
* Three address spaces supported:
* Memory, Io, or PCI config.
/******************************************************************************
*
* Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface
- * $Revision: 22 $
+ * $Revision: 35 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "achware.h"
#define _COMPONENT ACPI_HARDWARE
- MODULE_NAME ("hwsleep")
+ ACPI_MODULE_NAME ("hwsleep")
/******************************************************************************
* PARAMETERS: Physical_address - Physical address of ACPI real mode
* entry point.
*
- * RETURN: AE_OK or AE_ERROR
+ * RETURN: Status
*
* DESCRIPTION: Access function for d_firmware_waking_vector field in FACS
*
ACPI_PHYSICAL_ADDRESS physical_address)
{
- FUNCTION_TRACE ("Acpi_set_firmware_waking_vector");
-
+ ACPI_FUNCTION_TRACE ("Acpi_set_firmware_waking_vector");
- /* Make sure that we have an FACS */
-
- if (!acpi_gbl_FACS) {
- return_ACPI_STATUS (AE_NO_ACPI_TABLES);
- }
/* Set the vector */
- if (acpi_gbl_FACS->vector_width == 32) {
- * (u32 *) acpi_gbl_FACS->firmware_waking_vector = (u32) physical_address;
+ if (acpi_gbl_common_fACS.vector_width == 32) {
+ *(u32 *) acpi_gbl_common_fACS.firmware_waking_vector = (u32) physical_address;
}
else {
- *acpi_gbl_FACS->firmware_waking_vector = physical_address;
+ *acpi_gbl_common_fACS.firmware_waking_vector = physical_address;
}
return_ACPI_STATUS (AE_OK);
*
* RETURN: Status
*
- * DESCRIPTION: Access function for d_firmware_waking_vector field in FACS
+ * DESCRIPTION: Access function for Firmware_waking_vector field in FACS
*
******************************************************************************/
ACPI_PHYSICAL_ADDRESS *physical_address)
{
- FUNCTION_TRACE ("Acpi_get_firmware_waking_vector");
+ ACPI_FUNCTION_TRACE ("Acpi_get_firmware_waking_vector");
if (!physical_address) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- /* Make sure that we have an FACS */
-
- if (!acpi_gbl_FACS) {
- return_ACPI_STATUS (AE_NO_ACPI_TABLES);
- }
-
/* Get the vector */
- if (acpi_gbl_FACS->vector_width == 32) {
- *physical_address = * (u32 *) acpi_gbl_FACS->firmware_waking_vector;
+ if (acpi_gbl_common_fACS.vector_width == 32) {
+ *physical_address = *(u32 *) acpi_gbl_common_fACS.firmware_waking_vector;
}
else {
- *physical_address = *acpi_gbl_FACS->firmware_waking_vector;
+ *physical_address = *acpi_gbl_common_fACS.firmware_waking_vector;
}
return_ACPI_STATUS (AE_OK);
}
+
/******************************************************************************
*
- * FUNCTION: Acpi_enter_sleep_state
+ * FUNCTION: Acpi_enter_sleep_state_prep
*
* PARAMETERS: Sleep_state - Which sleep state to enter
*
* RETURN: Status
*
- * DESCRIPTION: Enter a system sleep state (see ACPI 2.0 spec p 231)
+ * DESCRIPTION: Prepare to enter a system sleep state (see ACPI 2.0 spec p 231)
+ * This function must execute with interrupts enabled.
+ * We break sleeping into 2 stages so that OSPM can handle
+ * various OS-specific tasks between the two steps.
*
******************************************************************************/
acpi_status
-acpi_enter_sleep_state (
+acpi_enter_sleep_state_prep (
u8 sleep_state)
{
acpi_status status;
acpi_object_list arg_list;
acpi_object arg;
- u8 type_a;
- u8 type_b;
- u16 PM1Acontrol;
- u16 PM1Bcontrol;
- FUNCTION_TRACE ("Acpi_enter_sleep_state");
+ ACPI_FUNCTION_TRACE ("Acpi_enter_sleep_state_prep");
/*
* _PSW methods could be run here to enable wake-on keyboard, LAN, etc.
*/
- status = acpi_hw_obtain_sleep_type_register_data (sleep_state, &type_a, &type_b);
- if (!ACPI_SUCCESS (status)) {
- return status;
+ status = acpi_hw_get_sleep_type_data (sleep_state,
+ &acpi_gbl_sleep_type_a, &acpi_gbl_sleep_type_b);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
}
- /* run the _PTS and _GTS methods */
+ /* Setup parameter object */
- MEMSET(&arg_list, 0, sizeof(arg_list));
arg_list.count = 1;
arg_list.pointer = &arg;
- MEMSET(&arg, 0, sizeof(arg));
arg.type = ACPI_TYPE_INTEGER;
arg.integer.value = sleep_state;
- acpi_evaluate_object (NULL, "\\_PTS", &arg_list, NULL);
- acpi_evaluate_object (NULL, "\\_GTS", &arg_list, NULL);
+ /* Run the _PTS and _GTS methods */
+
+ status = acpi_evaluate_object (NULL, "\\_PTS", &arg_list, NULL);
+ if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
+ return_ACPI_STATUS (status);
+ }
+
+ status = acpi_evaluate_object (NULL, "\\_GTS", &arg_list, NULL);
+ if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
+ return_ACPI_STATUS (status);
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: Acpi_enter_sleep_state
+ *
+ * PARAMETERS: Sleep_state - Which sleep state to enter
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Enter a system sleep state (see ACPI 2.0 spec p 231)
+ * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_enter_sleep_state (
+ u8 sleep_state)
+{
+ u16 PM1Acontrol;
+ u16 PM1Bcontrol;
+ ACPI_BIT_REGISTER_INFO *sleep_type_reg_info;
+ ACPI_BIT_REGISTER_INFO *sleep_enable_reg_info;
+
+
+ ACPI_FUNCTION_TRACE ("Acpi_enter_sleep_state");
+
+
+ if ((acpi_gbl_sleep_type_a > ACPI_SLEEP_TYPE_MAX) ||
+ (acpi_gbl_sleep_type_b > ACPI_SLEEP_TYPE_MAX)) {
+ ACPI_REPORT_ERROR (("Sleep values out of range: A=%x B=%x\n",
+ acpi_gbl_sleep_type_a, acpi_gbl_sleep_type_b));
+ return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
+ }
+
- /* clear wake status */
+ sleep_type_reg_info = acpi_hw_get_bit_register_info (ACPI_BITREG_SLEEP_TYPE_A);
+ sleep_enable_reg_info = acpi_hw_get_bit_register_info (ACPI_BITREG_SLEEP_ENABLE);
- acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, WAK_STS, 1);
+ /* Clear wake status */
- disable ();
+ acpi_hw_bit_register_write (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_LOCK);
+ acpi_hw_clear_acpi_status();
+
+ /* TBD: Disable arbitration here? */
acpi_hw_disable_non_wakeup_gpes();
- PM1Acontrol = (u16) acpi_hw_register_read (ACPI_MTX_LOCK, PM1_CONTROL);
+ /* Get current value of PM1A control */
+ PM1Acontrol = (u16) acpi_hw_register_read (ACPI_MTX_LOCK, ACPI_REGISTER_PM1_CONTROL);
ACPI_DEBUG_PRINT ((ACPI_DB_OK, "Entering S%d\n", sleep_state));
- /* mask off SLP_EN and SLP_TYP fields */
+ /* Clear SLP_EN and SLP_TYP fields */
- PM1Acontrol &= ~(SLP_TYPE_X_MASK | SLP_EN_MASK);
+ PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask | sleep_enable_reg_info->access_bit_mask);
PM1Bcontrol = PM1Acontrol;
- /* mask in SLP_TYP */
-
- PM1Acontrol |= (type_a << acpi_hw_get_bit_shift (SLP_TYPE_X_MASK));
- PM1Bcontrol |= (type_b << acpi_hw_get_bit_shift (SLP_TYPE_X_MASK));
+ /* Insert SLP_TYP bits */
- /* write #1: fill in SLP_TYP data */
+ PM1Acontrol |= (acpi_gbl_sleep_type_a << sleep_type_reg_info->bit_position);
+ PM1Bcontrol |= (acpi_gbl_sleep_type_b << sleep_type_reg_info->bit_position);
- acpi_hw_register_write (ACPI_MTX_LOCK, PM1A_CONTROL, PM1Acontrol);
- acpi_hw_register_write (ACPI_MTX_LOCK, PM1B_CONTROL, PM1Bcontrol);
+ /* Write #1: fill in SLP_TYP data */
- /* mask in SLP_EN */
+ acpi_hw_register_write (ACPI_MTX_LOCK, ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol);
+ acpi_hw_register_write (ACPI_MTX_LOCK, ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol);
- PM1Acontrol |= (1 << acpi_hw_get_bit_shift (SLP_EN_MASK));
- PM1Bcontrol |= (1 << acpi_hw_get_bit_shift (SLP_EN_MASK));
+ /* Insert SLP_ENABLE bit */
- /* flush caches */
+ PM1Acontrol |= sleep_enable_reg_info->access_bit_mask;
+ PM1Bcontrol |= sleep_enable_reg_info->access_bit_mask;
- wbinvd();
+ /* Write #2: SLP_TYP + SLP_EN */
- /* write #2: SLP_TYP + SLP_EN */
-
- acpi_hw_register_write (ACPI_MTX_LOCK, PM1A_CONTROL, PM1Acontrol);
- acpi_hw_register_write (ACPI_MTX_LOCK, PM1B_CONTROL, PM1Bcontrol);
+ acpi_hw_register_write (ACPI_MTX_LOCK, ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol);
+ acpi_hw_register_write (ACPI_MTX_LOCK, ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol);
/*
* Wait a second, then try again. This is to get S4/5 to work on all machines.
*/
if (sleep_state > ACPI_STATE_S3) {
- acpi_os_stall(1000000);
+ acpi_os_stall (1000000);
- acpi_hw_register_write (ACPI_MTX_LOCK, PM1_CONTROL,
- (1 << acpi_hw_get_bit_shift (SLP_EN_MASK)));
+ acpi_hw_register_write (ACPI_MTX_LOCK, ACPI_REGISTER_PM1_CONTROL,
+ sleep_enable_reg_info->access_bit_mask);
}
- /* wait until we enter sleep state */
+ /* Wait until we enter sleep state */
- do {
- acpi_os_stall(10000);
+ while (!acpi_hw_bit_register_read (ACPI_BITREG_WAKE_STATUS, ACPI_MTX_LOCK)) {
+ /* Spin until we wake */
}
- while (!acpi_hw_register_bit_access (ACPI_READ, ACPI_MTX_LOCK, WAK_STS));
-
- acpi_hw_enable_non_wakeup_gpes();
-
- enable ();
return_ACPI_STATUS (AE_OK);
}
{
acpi_object_list arg_list;
acpi_object arg;
+ acpi_status status;
- FUNCTION_TRACE ("Acpi_leave_sleep_state");
+ ACPI_FUNCTION_TRACE ("Acpi_leave_sleep_state");
- MEMSET (&arg_list, 0, sizeof(arg_list));
+ /* Ensure Enter_sleep_state_prep -> Enter_sleep_state ordering */
+
+ acpi_gbl_sleep_type_a = ACPI_SLEEP_TYPE_INVALID;
+
+ /* Setup parameter object */
+
arg_list.count = 1;
arg_list.pointer = &arg;
- MEMSET (&arg, 0, sizeof(arg));
arg.type = ACPI_TYPE_INTEGER;
arg.integer.value = sleep_state;
- acpi_evaluate_object (NULL, "\\_BFS", &arg_list, NULL);
- acpi_evaluate_object (NULL, "\\_WAK", &arg_list, NULL);
+ /* Ignore any errors from these methods */
+
+ status = acpi_evaluate_object (NULL, "\\_BFS", &arg_list, NULL);
+ if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
+ ACPI_REPORT_ERROR (("Method _BFS failed, %s\n", acpi_format_exception (status)));
+ }
+
+ status = acpi_evaluate_object (NULL, "\\_WAK", &arg_list, NULL);
+ if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
+ ACPI_REPORT_ERROR (("Method _WAK failed, %s\n", acpi_format_exception (status)));
+ }
/* _WAK returns stuff - do we want to look at it? */
/******************************************************************************
*
* Name: hwtimer.c - ACPI Power Management Timer Interface
- * $Revision: 14 $
+ * $Revision: 19 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "achware.h"
#define _COMPONENT ACPI_HARDWARE
- MODULE_NAME ("hwtimer")
+ ACPI_MODULE_NAME ("hwtimer")
/******************************************************************************
acpi_get_timer_resolution (
u32 *resolution)
{
- FUNCTION_TRACE ("Acpi_get_timer_resolution");
+ ACPI_FUNCTION_TRACE ("Acpi_get_timer_resolution");
if (!resolution) {
if (0 == acpi_gbl_FADT->tmr_val_ext) {
*resolution = 24;
}
-
else {
*resolution = 32;
}
acpi_get_timer (
u32 *ticks)
{
- FUNCTION_TRACE ("Acpi_get_timer");
+ ACPI_FUNCTION_TRACE ("Acpi_get_timer");
if (!ticks) {
u32 *time_elapsed)
{
u32 delta_ticks = 0;
- u32 seconds = 0;
- u32 milliseconds = 0;
- u32 microseconds = 0;
- u32 remainder = 0;
+ uint64_overlay normalized_ticks;
+ acpi_status status;
+ acpi_integer out_quotient;
- FUNCTION_TRACE ("Acpi_get_timer_duration");
+ ACPI_FUNCTION_TRACE ("Acpi_get_timer_duration");
if (!time_elapsed) {
if (start_ticks < end_ticks) {
delta_ticks = end_ticks - start_ticks;
}
-
else if (start_ticks > end_ticks) {
- /* 24-bit Timer */
-
if (0 == acpi_gbl_FADT->tmr_val_ext) {
+ /* 24-bit Timer */
+
delta_ticks = (((0x00FFFFFF - start_ticks) + end_ticks) & 0x00FFFFFF);
}
-
- /* 32-bit Timer */
-
else {
+ /* 32-bit Timer */
+
delta_ticks = (0xFFFFFFFF - start_ticks) + end_ticks;
}
}
-
else {
*time_elapsed = 0;
return_ACPI_STATUS (AE_OK);
/*
* Compute Duration:
* -----------------
- * Since certain compilers (gcc/Linux, argh!) don't support 64-bit
- * divides in kernel-space we have to do some trickery to preserve
- * accuracy while using 32-bit math.
- *
- * TBD: Change to use 64-bit math when supported.
*
- * The process is as follows:
- * 1. Compute the number of seconds by dividing Delta Ticks by
- * the timer frequency.
- * 2. Compute the number of milliseconds in the remainder from step #1
- * by multiplying by 1000 and then dividing by the timer frequency.
- * 3. Compute the number of microseconds in the remainder from step #2
- * by multiplying by 1000 and then dividing by the timer frequency.
- * 4. Add the results from steps 1, 2, and 3 to get the total duration.
+ * Requires a 64-bit divide:
*
- * Example: The time elapsed for Delta_ticks = 0xFFFFFFFF should be
- * 1199864031 microseconds. This is computed as follows:
- * Step #1: Seconds = 1199; Remainder = 3092840
- * Step #2: Milliseconds = 864; Remainder = 113120
- * Step #3: Microseconds = 31; Remainder = <don't care!>
+ * Time_elapsed = (Delta_ticks * 1000000) / PM_TIMER_FREQUENCY;
*/
+ normalized_ticks.full = ((u64) delta_ticks) * 1000000;
- /* Step #1 */
+ status = acpi_ut_short_divide (&normalized_ticks.full, PM_TIMER_FREQUENCY,
+ &out_quotient, NULL);
- seconds = delta_ticks / PM_TIMER_FREQUENCY;
- remainder = delta_ticks % PM_TIMER_FREQUENCY;
-
- /* Step #2 */
-
- milliseconds = (remainder * 1000) / PM_TIMER_FREQUENCY;
- remainder = (remainder * 1000) % PM_TIMER_FREQUENCY;
-
- /* Step #3 */
-
- microseconds = (remainder * 1000) / PM_TIMER_FREQUENCY;
-
- /* Step #4 */
-
- *time_elapsed = seconds * 1000000;
- *time_elapsed += milliseconds * 1000;
- *time_elapsed += microseconds;
-
- return_ACPI_STATUS (AE_OK);
+ *time_elapsed = (u32) out_quotient;
+ return_ACPI_STATUS (status);
}
/******************************************************************************
*
* Name: acconfig.h - Global configuration constants
- * $Revision: 74 $
+ * $Revision: 94 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*****************************************************************************/
/*
- * ACPI_DEBUG - This switch enables all the debug facilities of the ACPI
- * subsystem. This includes the DEBUG_PRINT output statements
- * When disabled, all DEBUG_PRINT statements are compiled out.
+ * ACPI_DEBUG - This switch enables all the debug facilities of the
+ * ACPI subsystem. This includes the DEBUG_PRINT output
+ * statements. When disabled, all DEBUG_PRINT
+ * statements are compiled out.
*
* ACPI_APPLICATION - Use this switch if the subsystem is going to be run
- * at the application level.
+ * at the application level.
*
*/
/* Version string */
-#define ACPI_CA_VERSION 0x20011018
+#define ACPI_CA_VERSION 0x20020308
/* Version of ACPI supported */
#define ACPI_CA_SUPPORT_LEVEL 2
-
/* Maximum objects in the various object caches */
-#define MAX_STATE_CACHE_DEPTH 64 /* State objects for stacks */
+#define MAX_STATE_CACHE_DEPTH 64 /* State objects for stacks */
#define MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */
#define MAX_EXTPARSE_CACHE_DEPTH 64 /* Parse tree objects */
#define MAX_OBJECT_CACHE_DEPTH 64 /* Interpreter operand objects */
-#define MAX_WALK_CACHE_DEPTH 4 /* Objects for parse tree walks (method execution) */
-
+#define MAX_WALK_CACHE_DEPTH 4 /* Objects for parse tree walks */
/* String size constants */
#define MAX_STRING_LENGTH 512
-#define PATHNAME_MAX 256 /* A full namespace pathname */
-
+#define PATHNAME_MAX 256 /* A full namespace pathname */
/* Maximum count for a semaphore object */
#define MAX_SEMAPHORE_COUNT 256
-
/* Max reference count (for debug only) */
#define MAX_REFERENCE_COUNT 0x400
-
/* Size of cached memory mapping for system memory operation region */
#define SYSMEM_REGION_WINDOW_SIZE 4096
+/******************************************************************************
+ *
+ * Configuration of subsystem behavior
+ *
+ *****************************************************************************/
+
/*
* Debugger threading model
* Use single threaded if the entire subsystem is contained in an application
* By default the model is single threaded if ACPI_APPLICATION is set,
* multi-threaded if ACPI_APPLICATION is not set.
*/
-
#define DEBUGGER_SINGLE_THREADED 0
#define DEBUGGER_MULTI_THREADED 1
#define DEBUGGER_THREADING DEBUGGER_MULTI_THREADED
#endif
+/*
+ * Should the subystem abort the loading of an ACPI table if the
+ * table checksum is incorrect?
+ */
+#define ACPI_CHECKSUM_ABORT FALSE
+
/******************************************************************************
*
*
*****************************************************************************/
+/* Number of distinct GPE register blocks */
+
+#define ACPI_MAX_GPE_BLOCKS 2
+
/*
* Method info (in WALK_STATE), containing local variables and argumetns
*/
-
#define MTH_NUM_LOCALS 8
#define MTH_MAX_LOCAL 7
/*
* Operand Stack (in WALK_STATE), Must be large enough to contain MTH_MAX_ARG
*/
-
#define OBJ_NUM_OPERANDS 8
#define OBJ_MAX_OPERAND 7
/* Names within the namespace are 4 bytes long */
#define ACPI_NAME_SIZE 4
-#define PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 s8 for separator */
+#define PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */
#define PATH_SEPARATOR '.'
-
/* Constants used in searching for the RSDP in low memory */
#define LO_RSDP_WINDOW_BASE 0 /* Physical Address */
#define HI_RSDP_WINDOW_SIZE 0x20000
#define RSDP_SCAN_STEP 16
+/* Operation regions */
+
+#define ACPI_NUM_PREDEFINED_REGIONS 8
+#define ACPI_USER_REGION_BEGIN 0x80
+
/* Maximum Space_ids for Operation Regions */
#define ACPI_MAX_ADDRESS_SPACE 255
-#define ACPI_NUM_ADDRESS_SPACES 256
+
+/* RSDP checksums */
+
+#define ACPI_RSDP_CHECKSUM_LENGTH 20
+#define ACPI_RSDP_XCHECKSUM_LENGTH 36
+
+
+/******************************************************************************
+ *
+ * ACPI AML Debugger
+ *
+ *****************************************************************************/
+
+
+#define ACPI_DEBUGGER_MAX_ARGS 8 /* Must be max method args + 1 */
+
+#define ACPI_DEBUGGER_COMMAND_PROMPT '-'
+#define ACPI_DEBUGGER_EXECUTE_PROMPT '%'
#endif /* _ACCONFIG_H */
/******************************************************************************
*
* Name: acdebug.h - ACPI/AML debugger
- * $Revision: 50 $
+ * $Revision: 57 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define __ACDEBUG_H__
-#define DB_MAX_ARGS 8 /* Must be max method args + 1 */
-
-#define DB_COMMAND_PROMPT '-'
-#define DB_EXECUTE_PROMPT '%'
-
-
-extern int optind;
-extern NATIVE_CHAR *optarg;
-extern u8 *aml_start;
-extern u32 aml_length;
-
-extern u8 acpi_gbl_db_opt_tables;
-extern u8 acpi_gbl_db_opt_disasm;
-extern u8 acpi_gbl_db_opt_stats;
-extern u8 acpi_gbl_db_opt_parse_jit;
-extern u8 acpi_gbl_db_opt_verbose;
-extern u8 acpi_gbl_db_opt_ini_methods;
-
-
-extern NATIVE_CHAR *acpi_gbl_db_args[DB_MAX_ARGS];
-extern NATIVE_CHAR acpi_gbl_db_line_buf[80];
-extern NATIVE_CHAR acpi_gbl_db_scope_buf[40];
-extern NATIVE_CHAR acpi_gbl_db_debug_filename[40];
-extern u8 acpi_gbl_db_output_to_file;
-extern NATIVE_CHAR *acpi_gbl_db_buffer;
-extern NATIVE_CHAR *acpi_gbl_db_filename;
-extern NATIVE_CHAR *acpi_gbl_db_disasm_indent;
-extern u8 acpi_gbl_db_output_flags;
-extern u32 acpi_gbl_db_debug_level;
-extern u32 acpi_gbl_db_console_debug_level;
-extern acpi_table_header *acpi_gbl_db_table_ptr;
-
-/*
- * Statistic globals
- */
-extern u16 acpi_gbl_obj_type_count[INTERNAL_TYPE_NODE_MAX+1];
-extern u16 acpi_gbl_node_type_count[INTERNAL_TYPE_NODE_MAX+1];
-extern u16 acpi_gbl_obj_type_count_misc;
-extern u16 acpi_gbl_node_type_count_misc;
-extern u32 acpi_gbl_num_nodes;
-extern u32 acpi_gbl_num_objects;
-
-
-extern u32 acpi_gbl_size_of_parse_tree;
-extern u32 acpi_gbl_size_of_method_trees;
-extern u32 acpi_gbl_size_of_node_entries;
-extern u32 acpi_gbl_size_of_acpi_objects;
-
-
#define ACPI_DEBUG_BUFFER_SIZE 4196
-#define DB_REDIRECTABLE_OUTPUT 0x01
-#define DB_CONSOLE_OUTPUT 0x02
-#define DB_DUPLICATE_OUTPUT 0x03
-
typedef struct command_info
{
* dbfileio - Debugger file I/O commands
*/
-acpi_object_type8
+acpi_object_type
acpi_db_match_argument (
NATIVE_CHAR *user_argument,
ARGUMENT_INFO *arguments);
acpi_walk_state *walk_state,
acpi_parse_object *op);
-void
+void ACPI_SYSTEM_XFACE
acpi_db_execute_thread (
void *context);
/******************************************************************************
*
* Name: acdispat.h - dispatcher (parser to interpreter interface)
- * $Revision: 45 $
+ * $Revision: 51 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
acpi_status
acpi_ds_get_predicate_value (
acpi_walk_state *walk_state,
- u32 has_result_obj);
+ acpi_operand_object *result_obj);
acpi_status
acpi_ds_exec_begin_op (
acpi_parse_object *op,
acpi_walk_state *walk_state);
+acpi_status
+acpi_ds_init_field_objects (
+ acpi_parse_object *op,
+ acpi_walk_state *walk_state);
+
/* dsload - Parser/Interpreter interface, namespace load callbacks */
acpi_ds_is_method_value (
acpi_operand_object *obj_desc);
-acpi_object_type8
+acpi_object_type
acpi_ds_method_data_get_type (
u16 opcode,
u32 index,
u32 max_param_count,
acpi_walk_state *walk_state);
-acpi_namespace_node *
+acpi_status
acpi_ds_method_data_get_node (
u16 opcode,
u32 index,
- acpi_walk_state *walk_state);
+ acpi_walk_state *walk_state,
+ acpi_namespace_node **node);
acpi_status
acpi_ds_method_data_init (
acpi_walk_state *walk_state);
acpi_status
-acpi_ds_method_data_set_entry (
+acpi_ds_method_data_set_value (
u16 opcode,
u32 index,
acpi_operand_object *object,
acpi_status
acpi_ds_call_control_method (
- acpi_walk_list *walk_list,
+ ACPI_THREAD_STATE *thread,
acpi_walk_state *walk_state,
acpi_parse_object *op);
acpi_ds_resolve_operands (
acpi_walk_state *walk_state);
-acpi_object_type8
-acpi_ds_map_opcode_to_data_type (
- u16 opcode,
- u32 *out_flags);
-
-acpi_object_type8
-acpi_ds_map_named_opcode_to_data_type (
- u16 opcode);
-
/*
* dswscope - Scope Stack manipulation
acpi_status
acpi_ds_scope_stack_push (
acpi_namespace_node *node,
- acpi_object_type8 type,
+ acpi_object_type type,
acpi_walk_state *walk_state);
acpi_owner_id owner_id,
acpi_parse_object *origin,
acpi_operand_object *mth_desc,
- acpi_walk_list *walk_list);
+ ACPI_THREAD_STATE *thread);
acpi_status
acpi_ds_init_aml_walk (
acpi_walk_state *
acpi_ds_pop_walk_state (
- acpi_walk_list *walk_list);
+ ACPI_THREAD_STATE *thread);
void
acpi_ds_push_walk_state (
acpi_walk_state *walk_state,
- acpi_walk_list *walk_list);
+ ACPI_THREAD_STATE *thread);
acpi_status
acpi_ds_result_stack_pop (
acpi_walk_state *
acpi_ds_get_current_walk_state (
- acpi_walk_list *walk_list);
+ ACPI_THREAD_STATE *thread);
void
acpi_ds_delete_walk_state_cache (
/******************************************************************************
*
* Name: acevents.h - Event subcomponent prototypes and defines
- * $Revision: 66 $
+ * $Revision: 75 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
acpi_ev_initialize (
void);
+acpi_status
+acpi_ev_handler_initialize (
+ void);
+
/*
- * Acpi_evfixed - Fixed event handling
+ * Evfixed - Fixed event handling
*/
acpi_status
u32
acpi_ev_fixed_event_dispatch (
- u32 acpi_event);
+ u32 event);
/*
- * Acpi_evglock - Global Lock support
+ * Evmisc
*/
acpi_status
acpi_ev_acquire_global_lock(
- void);
+ u32 timeout);
void
acpi_ev_release_global_lock(
acpi_ev_init_global_lock_handler (
void);
+u32
+acpi_ev_get_gpe_register_index (
+ u32 gpe_number);
+
+u32
+acpi_ev_get_gpe_number_index (
+ u32 gpe_number);
+
+acpi_status
+acpi_ev_queue_notify_request (
+ acpi_namespace_node *node,
+ u32 notify_value);
+
+void ACPI_SYSTEM_XFACE
+acpi_ev_notify_dispatch (
+ void *context);
+
/*
- * Acpi_evgpe - GPE handling and dispatch
+ * Evgpe - GPE handling and dispatch
*/
acpi_status
acpi_ev_gpe_detect (
void);
-
-/*
- * Acpi_evnotify - Device Notify handling and dispatch
- */
-
-acpi_status
-acpi_ev_queue_notify_request (
- acpi_namespace_node *node,
- u32 notify_value);
-
-void
-acpi_ev_notify_dispatch (
- void *context);
-
/*
- * Acpi_evregion - Address Space handling
+ * Evregion - Address Space handling
*/
acpi_status
u32 function,
ACPI_PHYSICAL_ADDRESS address,
u32 bit_width,
- u32 *value);
-
+ acpi_integer *value);
acpi_status
acpi_ev_addr_handler_helper (
acpi_operand_object *region_obj,
u8 acpi_ns_is_locked);
-
acpi_status
acpi_ev_associate_region_and_handler (
acpi_operand_object *handler_obj,
/*
- * Acpi_evregini - Region initialization and setup
+ * Evregini - Region initialization and setup
*/
acpi_status
acpi_ev_initialize_sCI (
u32 program_sCI);
-void
-acpi_ev_restore_acpi_state (
- void);
-
void
acpi_ev_terminate (
void);
/******************************************************************************
*
* Name: acexcep.h - Exception codes returned by the ACPI subsystem
- * $Revision: 50 $
+ * $Revision: 57 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define AE_NO_MEMORY (acpi_status) (0x0004 | AE_CODE_ENVIRONMENTAL)
#define AE_NOT_FOUND (acpi_status) (0x0005 | AE_CODE_ENVIRONMENTAL)
#define AE_NOT_EXIST (acpi_status) (0x0006 | AE_CODE_ENVIRONMENTAL)
-#define AE_EXIST (acpi_status) (0x0007 | AE_CODE_ENVIRONMENTAL)
+#define AE_ALREADY_EXISTS (acpi_status) (0x0007 | AE_CODE_ENVIRONMENTAL)
#define AE_TYPE (acpi_status) (0x0008 | AE_CODE_ENVIRONMENTAL)
#define AE_NULL_OBJECT (acpi_status) (0x0009 | AE_CODE_ENVIRONMENTAL)
#define AE_NULL_ENTRY (acpi_status) (0x000A | AE_CODE_ENVIRONMENTAL)
#define AE_BAD_PATHNAME (acpi_status) (0x0003 | AE_CODE_PROGRAMMER)
#define AE_BAD_DATA (acpi_status) (0x0004 | AE_CODE_PROGRAMMER)
#define AE_BAD_ADDRESS (acpi_status) (0x0005 | AE_CODE_PROGRAMMER)
+#define AE_ALIGNMENT (acpi_status) (0x0006 | AE_CODE_PROGRAMMER)
-#define AE_CODE_PGM_MAX 0x0005
+#define AE_CODE_PGM_MAX 0x0006
/*
#define AE_BAD_HEADER (acpi_status) (0x0002 | AE_CODE_ACPI_TABLES)
#define AE_BAD_CHECKSUM (acpi_status) (0x0003 | AE_CODE_ACPI_TABLES)
#define AE_BAD_VALUE (acpi_status) (0x0004 | AE_CODE_ACPI_TABLES)
+#define AE_TABLE_NOT_SUPPORTED (acpi_status) (0x0005 | AE_CODE_ACPI_TABLES)
-#define AE_CODE_TBL_MAX 0x0003
+#define AE_CODE_TBL_MAX 0x0005
/*
#define AE_AML_MUTEX_ORDER (acpi_status) (0x0017 | AE_CODE_AML)
#define AE_AML_MUTEX_NOT_ACQUIRED (acpi_status) (0x0018 | AE_CODE_AML)
#define AE_AML_INVALID_RESOURCE_TYPE (acpi_status) (0x0019 | AE_CODE_AML)
+#define AE_AML_INVALID_INDEX (acpi_status) (0x001A | AE_CODE_AML)
+#define AE_AML_REGISTER_LIMIT (acpi_status) (0x001B | AE_CODE_AML)
+#define AE_AML_NO_WHILE (acpi_status) (0x001C | AE_CODE_AML)
-#define AE_CODE_AML_MAX 0x0019
+#define AE_CODE_AML_MAX 0x001C
/*
* Internal exceptions used for control
#define AE_CTRL_DEPTH (acpi_status) (0x0006 | AE_CODE_CONTROL)
#define AE_CTRL_END (acpi_status) (0x0007 | AE_CODE_CONTROL)
#define AE_CTRL_TRANSFER (acpi_status) (0x0008 | AE_CODE_CONTROL)
+#define AE_CTRL_BREAK (acpi_status) (0x0009 | AE_CODE_CONTROL)
+#define AE_CTRL_CONTINUE (acpi_status) (0x000A | AE_CODE_CONTROL)
-#define AE_CODE_CTRL_MAX 0x0008
+#define AE_CODE_CTRL_MAX 0x000A
#ifdef DEFINE_ACPI_GLOBALS
"AE_NO_MEMORY",
"AE_NOT_FOUND",
"AE_NOT_EXIST",
- "AE_EXIST",
+ "AE_ALREADY_EXISTS",
"AE_TYPE",
"AE_NULL_OBJECT",
"AE_NULL_ENTRY",
"AE_NOT_ACQUIRED",
"AE_ALREADY_ACQUIRED",
"AE_NO_HARDWARE_RESPONSE",
- "AE_NO_GLOBAL_LOCK",
+ "AE_NO_GLOBAL_LOCK"
};
NATIVE_CHAR const *acpi_gbl_exception_names_pgm[] =
"AE_BAD_PATHNAME",
"AE_BAD_DATA",
"AE_BAD_ADDRESS",
+ "AE_ALIGNMENT"
};
NATIVE_CHAR const *acpi_gbl_exception_names_tbl[] =
"AE_BAD_HEADER",
"AE_BAD_CHECKSUM",
"AE_BAD_VALUE",
+ "AE_TABLE_NOT_SUPPORTED"
};
NATIVE_CHAR const *acpi_gbl_exception_names_aml[] =
"AE_AML_MUTEX_ORDER",
"AE_AML_MUTEX_NOT_ACQUIRED",
"AE_AML_INVALID_RESOURCE_TYPE",
+ "AE_AML_INVALID_INDEX",
+ "AE_AML_REGISTER_LIMIT",
+ "AE_AML_NO_WHILE"
};
NATIVE_CHAR const *acpi_gbl_exception_names_ctrl[] =
"AE_CTRL_DEPTH",
"AE_CTRL_END",
"AE_CTRL_TRANSFER",
+ "AE_CTRL_BREAK",
+ "AE_CTRL_CONTINUE"
};
#endif /* ACPI GLOBALS */
/******************************************************************************
*
* Name: acglobal.h - Declarations for global variables
- * $Revision: 106 $
+ * $Revision: 120 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* of each in the system. Each global points to the actual table.
*
*/
-ACPI_EXTERN RSDP_DESCRIPTOR *acpi_gbl_RSDP;
-ACPI_EXTERN xsdt_descriptor *acpi_gbl_XSDT;
-ACPI_EXTERN FADT_DESCRIPTOR *acpi_gbl_FADT;
-ACPI_EXTERN acpi_table_header *acpi_gbl_DSDT;
-ACPI_EXTERN acpi_common_facs *acpi_gbl_FACS;
+ACPI_EXTERN RSDP_DESCRIPTOR *acpi_gbl_RSDP;
+ACPI_EXTERN xsdt_descriptor *acpi_gbl_XSDT;
+ACPI_EXTERN FADT_DESCRIPTOR *acpi_gbl_FADT;
+ACPI_EXTERN acpi_table_header *acpi_gbl_DSDT;
+ACPI_EXTERN FACS_DESCRIPTOR *acpi_gbl_FACS;
+ACPI_EXTERN acpi_common_facs acpi_gbl_common_fACS;
/*
* Since there may be multiple SSDTs and PSDTS, a single pointer is not
ACPI_EXTERN ACPI_MEMORY_LIST acpi_gbl_memory_lists[ACPI_NUM_MEM_LISTS];
ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER acpi_gbl_drv_notify;
ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER acpi_gbl_sys_notify;
-ACPI_EXTERN u8 *acpi_gbl_gpe0enable_register_save;
-ACPI_EXTERN u8 *acpi_gbl_gpe1_enable_register_save;
ACPI_EXTERN acpi_walk_state *acpi_gbl_breakpoint_walk;
ACPI_EXTERN acpi_handle acpi_gbl_global_lock_semaphore;
ACPI_EXTERN u32 acpi_gbl_global_lock_thread_count;
-ACPI_EXTERN u32 acpi_gbl_restore_acpi_chipset;
ACPI_EXTERN u32 acpi_gbl_original_mode;
-ACPI_EXTERN u32 acpi_gbl_edge_level_save;
-ACPI_EXTERN u32 acpi_gbl_irq_enable_save;
ACPI_EXTERN u32 acpi_gbl_rsdp_original_location;
ACPI_EXTERN u32 acpi_gbl_ns_lookup_count;
ACPI_EXTERN u32 acpi_gbl_ps_find_count;
ACPI_EXTERN u16 acpi_gbl_pm1_enable_register_save;
ACPI_EXTERN u16 acpi_gbl_next_table_owner_id;
ACPI_EXTERN u16 acpi_gbl_next_method_owner_id;
+ACPI_EXTERN u16 acpi_gbl_global_lock_handle;
ACPI_EXTERN u8 acpi_gbl_debugger_configuration;
ACPI_EXTERN u8 acpi_gbl_global_lock_acquired;
ACPI_EXTERN u8 acpi_gbl_step_to_next_call;
ACPI_EXTERN u8 acpi_gbl_global_lock_present;
extern u8 acpi_gbl_shutdown;
-extern u32 acpi_gbl_system_flags;
extern u32 acpi_gbl_startup_flags;
extern const u8 acpi_gbl_decode_to8bit[8];
extern const NATIVE_CHAR *acpi_gbl_db_sleep_states[ACPI_NUM_SLEEP_STATES];
ACPI_EXTERN acpi_namespace_node *acpi_gbl_root_node;
extern const u8 acpi_gbl_ns_properties[NUM_NS_TYPES];
-extern const predefined_names acpi_gbl_pre_defined_names [NUM_PREDEFINED_NAMES];
+extern const acpi_predefined_names acpi_gbl_pre_defined_names [NUM_PREDEFINED_NAMES];
#ifdef ACPI_DEBUG
ACPI_EXTERN u32 acpi_gbl_current_node_count;
ACPI_EXTERN u32 acpi_gbl_current_node_size;
ACPI_EXTERN u32 acpi_gbl_max_concurrent_node_count;
-ACPI_EXTERN u32 acpi_gbl_entry_stack_pointer;
-ACPI_EXTERN u32 acpi_gbl_lowest_stack_pointer;
+ACPI_EXTERN ACPI_SIZE acpi_gbl_entry_stack_pointer;
+ACPI_EXTERN ACPI_SIZE acpi_gbl_lowest_stack_pointer;
ACPI_EXTERN u32 acpi_gbl_deepest_nesting;
#endif
****************************************************************************/
-ACPI_EXTERN acpi_walk_list *acpi_gbl_current_walk_list;
-
-/* Address Space handlers */
-
-ACPI_EXTERN acpi_adr_space_info acpi_gbl_address_spaces[ACPI_NUM_ADDRESS_SPACES];
+ACPI_EXTERN ACPI_THREAD_STATE *acpi_gbl_current_walk_list;
/* Control method single step flag */
ACPI_EXTERN acpi_parse_object *acpi_gbl_parsed_namespace_root;
+/*****************************************************************************
+ *
+ * Hardware globals
+ *
+ ****************************************************************************/
+
+ACPI_EXTERN ACPI_BIT_REGISTER_INFO acpi_gbl_bit_register_info[ACPI_NUM_BITREG];
+ACPI_EXTERN u8 acpi_gbl_sleep_type_a;
+ACPI_EXTERN u8 acpi_gbl_sleep_type_b;
+
/*****************************************************************************
*
- * Event globals
+ * Event and GPE globals
*
****************************************************************************/
-ACPI_EXTERN acpi_fixed_event_info acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS];
+extern acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS];
+ACPI_EXTERN ACPI_FIXED_EVENT_HANDLER acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS];
+
ACPI_EXTERN acpi_handle acpi_gbl_gpe_obj_handle;
ACPI_EXTERN u32 acpi_gbl_gpe_register_count;
-ACPI_EXTERN acpi_gpe_registers *acpi_gbl_gpe_registers;
-ACPI_EXTERN acpi_gpe_level_info *acpi_gbl_gpe_info;
+ACPI_EXTERN u32 acpi_gbl_gpe_number_max;
+ACPI_EXTERN ACPI_GPE_REGISTER_INFO *acpi_gbl_gpe_register_info;
+ACPI_EXTERN ACPI_GPE_NUMBER_INFO *acpi_gbl_gpe_number_info;
+ACPI_EXTERN ACPI_GPE_BLOCK_INFO acpi_gbl_gpe_block_info[ACPI_MAX_GPE_BLOCKS];
/*
- * Gpe validation and translation table
- * Indexed by the GPE number, returns GPE_INVALID if the GPE is not supported.
- * Otherwise, returns a valid index into the global GPE table.
+ * GPE translation table
+ * Indexed by the GPE number, returns a valid index into the global GPE tables.
*
* This table is needed because the GPE numbers supported by block 1 do not
* have to be contiguous with the GPE numbers supported by block 0.
*/
-ACPI_EXTERN u8 acpi_gbl_gpe_valid [ACPI_NUM_GPE];
-
-/* Acpi_event counter for debug only */
-
-#ifdef ACPI_DEBUG
-ACPI_EXTERN u32 acpi_gbl_event_count[ACPI_NUM_FIXED_EVENTS];
-#endif
+ACPI_EXTERN ACPI_GPE_INDEX_INFO *acpi_gbl_gpe_number_to_index;
/*****************************************************************************
*
****************************************************************************/
+
+ACPI_EXTERN u8 acpi_gbl_db_output_flags;
+
+
#ifdef ENABLE_DEBUGGER
+
ACPI_EXTERN u8 acpi_gbl_method_executing;
ACPI_EXTERN u8 acpi_gbl_db_terminate_threads;
-#endif
+
+ACPI_EXTERN int optind;
+ACPI_EXTERN NATIVE_CHAR *optarg;
+ACPI_EXTERN u8 *aml_start;
+ACPI_EXTERN u32 aml_length;
+
+ACPI_EXTERN u8 acpi_gbl_db_opt_tables;
+ACPI_EXTERN u8 acpi_gbl_db_opt_disasm;
+ACPI_EXTERN u8 acpi_gbl_db_opt_stats;
+ACPI_EXTERN u8 acpi_gbl_db_opt_verbose;
+ACPI_EXTERN u8 acpi_gbl_db_opt_ini_methods;
+
+
+ACPI_EXTERN NATIVE_CHAR *acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS];
+ACPI_EXTERN NATIVE_CHAR acpi_gbl_db_line_buf[80];
+ACPI_EXTERN NATIVE_CHAR acpi_gbl_db_parsed_buf[80];
+ACPI_EXTERN NATIVE_CHAR acpi_gbl_db_scope_buf[40];
+ACPI_EXTERN NATIVE_CHAR acpi_gbl_db_debug_filename[40];
+ACPI_EXTERN u8 acpi_gbl_db_output_to_file;
+ACPI_EXTERN NATIVE_CHAR *acpi_gbl_db_buffer;
+ACPI_EXTERN NATIVE_CHAR *acpi_gbl_db_filename;
+ACPI_EXTERN NATIVE_CHAR *acpi_gbl_db_disasm_indent;
+ACPI_EXTERN u32 acpi_gbl_db_debug_level;
+ACPI_EXTERN u32 acpi_gbl_db_console_debug_level;
+ACPI_EXTERN acpi_table_header *acpi_gbl_db_table_ptr;
+ACPI_EXTERN acpi_namespace_node *acpi_gbl_db_scope_node;
+
+/*
+ * Statistic globals
+ */
+ACPI_EXTERN u16 acpi_gbl_obj_type_count[INTERNAL_TYPE_NODE_MAX+1];
+ACPI_EXTERN u16 acpi_gbl_node_type_count[INTERNAL_TYPE_NODE_MAX+1];
+ACPI_EXTERN u16 acpi_gbl_obj_type_count_misc;
+ACPI_EXTERN u16 acpi_gbl_node_type_count_misc;
+ACPI_EXTERN u32 acpi_gbl_num_nodes;
+ACPI_EXTERN u32 acpi_gbl_num_objects;
+
+
+ACPI_EXTERN u32 acpi_gbl_size_of_parse_tree;
+ACPI_EXTERN u32 acpi_gbl_size_of_method_trees;
+ACPI_EXTERN u32 acpi_gbl_size_of_node_entries;
+ACPI_EXTERN u32 acpi_gbl_size_of_acpi_objects;
+
+#endif /* ENABLE_DEBUGGER */
#endif /* __ACGLOBAL_H__ */
/******************************************************************************
*
* Name: achware.h -- hardware specific interfaces
- * $Revision: 56 $
+ * $Revision: 58 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/* Register I/O Prototypes */
+ACPI_BIT_REGISTER_INFO *
+acpi_hw_get_bit_register_info (
+ u32 register_id);
u32
-acpi_hw_register_bit_access (
- NATIVE_UINT read_write,
- u8 use_lock,
+acpi_hw_bit_register_read (
+ u32 register_id,
+ u32 flags);
+
+u32
+acpi_hw_bit_register_write (
u32 register_id,
- ... /* DWORD Write Value */);
+ u32 value,
+ u32 flags);
u32
acpi_hw_register_read (
acpi_hw_clear_acpi_status (
void);
-u32
-acpi_hw_get_bit_shift (
- u32 mask);
-
/* GPE support */
/* Sleep Prototypes */
acpi_status
-acpi_hw_obtain_sleep_type_register_data (
+acpi_hw_get_sleep_type_data (
u8 sleep_state,
u8 *slp_typ_a,
u8 *slp_typ_b);
/******************************************************************************
*
* Name: acinterp.h - Interpreter subcomponent prototypes and defines
- * $Revision: 116 $
+ * $Revision: 132 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define __ACINTERP_H__
-#define WALK_OPERANDS &(walk_state->operands [walk_state->num_operands -1])
-
-
-/* Interpreter constants */
-
-#define AML_END_OF_BLOCK -1
-#define PUSH_PKG_LENGTH 1
-#define DO_NOT_PUSH_PKG_LENGTH 0
-
-
-#define STACK_TOP 0
-#define STACK_BOTTOM (u32) -1
-
-/* Constants for global "When_to_parse_methods" */
-
-#define METHOD_PARSE_AT_INIT 0x0
-#define METHOD_PARSE_JUST_IN_TIME 0x1
-#define METHOD_DELETE_AT_COMPLETION 0x2
+#define ACPI_WALK_OPERANDS (&(walk_state->operands [walk_state->num_operands -1]))
acpi_status
/*
- * amxface - External interpreter interfaces
+ * exxface - External interpreter interfaces
*/
acpi_status
/*
- * amconvrt - object conversion
+ * exconvrt - object conversion
*/
acpi_status
acpi_status
acpi_ex_convert_to_target_type (
- acpi_object_type8 destination_type,
- acpi_operand_object **obj_desc,
+ acpi_object_type destination_type,
+ acpi_operand_object *source_desc,
+ acpi_operand_object **result_desc,
acpi_walk_state *walk_state);
/*
- * amfield - ACPI AML (p-code) execution - field manipulation
+ * exfield - ACPI AML (p-code) execution - field manipulation
*/
acpi_status
u32 buffer_length);
acpi_status
-acpi_ex_setup_field (
+acpi_ex_setup_region (
acpi_operand_object *obj_desc,
- u32 field_byte_offset);
+ u32 field_datum_byte_offset);
acpi_status
-acpi_ex_read_field_datum (
+acpi_ex_access_region (
acpi_operand_object *obj_desc,
- u32 field_byte_offset,
- u32 *value);
+ u32 field_datum_byte_offset,
+ acpi_integer *value,
+ u32 read_write);
-acpi_status
-acpi_ex_common_access_field (
- u32 mode,
+u8
+acpi_ex_register_overflow (
acpi_operand_object *obj_desc,
- void *buffer,
- u32 buffer_length);
-
+ acpi_integer value);
acpi_status
-acpi_ex_access_index_field (
- u32 mode,
+acpi_ex_field_datum_io (
acpi_operand_object *obj_desc,
- void *buffer,
- u32 buffer_length);
+ u32 field_datum_byte_offset,
+ acpi_integer *value,
+ u32 read_write);
acpi_status
-acpi_ex_access_bank_field (
- u32 mode,
+acpi_ex_write_with_update_rule (
acpi_operand_object *obj_desc,
- void *buffer,
- u32 buffer_length);
+ acpi_integer mask,
+ acpi_integer field_value,
+ u32 field_datum_byte_offset);
-acpi_status
-acpi_ex_access_region_field (
- u32 mode,
- acpi_operand_object *obj_desc,
+void
+acpi_ex_get_buffer_datum(
+ acpi_integer *datum,
void *buffer,
- u32 buffer_length);
-
+ u32 byte_granularity,
+ u32 offset);
-acpi_status
-acpi_ex_access_buffer_field (
- u32 mode,
- acpi_operand_object *obj_desc,
+void
+acpi_ex_set_buffer_datum (
+ acpi_integer merged_datum,
void *buffer,
- u32 buffer_length);
+ u32 byte_granularity,
+ u32 offset);
acpi_status
acpi_ex_read_data_from_field (
acpi_operand_object *obj_desc);
/*
- * ammisc - ACPI AML (p-code) execution - specific opcodes
+ * exmisc - ACPI AML (p-code) execution - specific opcodes
*/
acpi_status
acpi_operand_object **return_desc,
acpi_walk_state *walk_state);
+acpi_status
+acpi_ex_concat_template (
+ acpi_operand_object *obj_desc,
+ acpi_operand_object *obj_desc2,
+ acpi_operand_object **actual_return_desc,
+ acpi_walk_state *walk_state);
+
acpi_status
acpi_ex_do_concatenate (
acpi_operand_object *obj_desc,
acpi_integer operand0,
acpi_integer operand1);
-acpi_status
-acpi_ex_load_op (
- acpi_operand_object *rgn_desc,
- acpi_operand_object *ddb_handle);
-
-acpi_status
-acpi_ex_unload_table (
- acpi_operand_object *ddb_handle);
-
acpi_status
acpi_ex_create_mutex (
acpi_walk_state *walk_state);
/*
- * ammutex - mutex support
+ * exconfig - dynamic table load/unload
+ */
+
+acpi_status
+acpi_ex_add_table (
+ acpi_table_header *table,
+ acpi_namespace_node *parent_node,
+ acpi_operand_object **ddb_handle);
+
+acpi_status
+acpi_ex_load_op (
+ acpi_operand_object *obj_desc,
+ acpi_operand_object *target,
+ acpi_walk_state *walk_state);
+
+acpi_status
+acpi_ex_load_table_op (
+ acpi_walk_state *walk_state,
+ acpi_operand_object **return_desc);
+
+acpi_status
+acpi_ex_unload_table (
+ acpi_operand_object *ddb_handle);
+
+
+/*
+ * exmutex - mutex support
*/
acpi_status
acpi_status
acpi_ex_release_all_mutexes (
- acpi_operand_object *mutex_list);
+ ACPI_THREAD_STATE *thread);
void
acpi_ex_unlink_mutex (
acpi_operand_object *obj_desc);
+void
+acpi_ex_link_mutex (
+ acpi_operand_object *obj_desc,
+ ACPI_THREAD_STATE *thread);
/*
- * amprep - ACPI AML (p-code) execution - prep utilities
+ * exprep - ACPI AML (p-code) execution - prep utilities
*/
acpi_status
acpi_ex_prep_common_field_object (
acpi_operand_object *obj_desc,
u8 field_flags,
- u32 field_position,
- u32 field_length);
-
-acpi_status
-acpi_ex_prep_region_field_value (
- acpi_namespace_node *node,
- acpi_handle region,
- u8 field_flags,
- u32 field_position,
- u32 field_length);
-
-acpi_status
-acpi_ex_prep_bank_field_value (
- acpi_namespace_node *node,
- acpi_namespace_node *region_node,
- acpi_namespace_node *bank_register_node,
- u32 bank_val,
- u8 field_flags,
- u32 field_position,
- u32 field_length);
-
-acpi_status
-acpi_ex_prep_index_field_value (
- acpi_namespace_node *node,
- acpi_namespace_node *index_reg,
- acpi_namespace_node *data_reg,
- u8 field_flags,
- u32 field_position,
- u32 field_length);
+ u8 field_attribute,
+ u32 field_bit_position,
+ u32 field_bit_length);
acpi_status
acpi_ex_prep_field_value (
ACPI_CREATE_FIELD_INFO *info);
/*
- * amsystem - Interface to OS services
+ * exsystem - Interface to OS services
*/
acpi_status
acpi_operand_object *value,
acpi_operand_object *obj_desc);
-void
+acpi_status
acpi_ex_system_do_suspend(
u32 time);
-void
+acpi_status
acpi_ex_system_do_stall (
u32 time);
/*
- * ammonadic - ACPI AML (p-code) execution, monadic operators
+ * exmonadic - ACPI AML (p-code) execution, monadic operators
*/
acpi_status
acpi_walk_state *walk_state);
/*
- * amdyadic - ACPI AML (p-code) execution, dyadic operators
+ * exdyadic - ACPI AML (p-code) execution, dyadic operators
*/
acpi_status
/*
- * amresolv - Object resolution and get value functions
+ * exresolv - Object resolution and get value functions
*/
acpi_status
acpi_operand_object **stack_ptr,
acpi_walk_state *walk_state);
-acpi_status
-acpi_ex_get_buffer_field_value (
- acpi_operand_object *field_desc,
- acpi_operand_object *result_desc);
-
/*
- * amdump - Scanner debug output routines
+ * exdump - Scanner debug output routines
*/
void
void
acpi_ex_dump_operands (
acpi_operand_object **operands,
- operating_mode interpreter_mode,
+ acpi_interpreter_mode interpreter_mode,
NATIVE_CHAR *ident,
u32 num_levels,
NATIVE_CHAR *note,
/*
- * amnames - interpreter/scanner name load/execute
+ * exnames - interpreter/scanner name load/execute
*/
NATIVE_CHAR *
acpi_status
acpi_ex_get_name_string (
- acpi_object_type8 data_type,
+ acpi_object_type data_type,
u8 *in_aml_address,
NATIVE_CHAR **out_name_string,
u32 *out_name_length);
acpi_status
acpi_ex_do_name (
acpi_object_type data_type,
- operating_mode load_exec_mode);
+ acpi_interpreter_mode load_exec_mode);
/*
- * amstore - Object store support
+ * exstore - Object store support
*/
acpi_status
acpi_namespace_node *node,
acpi_walk_state *walk_state);
-acpi_status
-acpi_ex_store_object_to_object (
- acpi_operand_object *source_desc,
- acpi_operand_object *dest_desc,
- acpi_walk_state *walk_state);
-
/*
- *
+ * exstoren
*/
acpi_status
acpi_ex_resolve_object (
acpi_operand_object **source_desc_ptr,
- acpi_object_type8 target_type,
+ acpi_object_type target_type,
acpi_walk_state *walk_state);
acpi_status
-acpi_ex_store_object (
+acpi_ex_store_object_to_object (
acpi_operand_object *source_desc,
- acpi_object_type8 target_type,
- acpi_operand_object **target_desc_ptr,
+ acpi_operand_object *dest_desc,
+ acpi_operand_object **new_desc,
acpi_walk_state *walk_state);
/*
- * amcopy - object copy
+ * excopy - object copy
*/
acpi_status
-acpi_ex_copy_buffer_to_buffer (
+acpi_ex_store_buffer_to_buffer (
acpi_operand_object *source_desc,
acpi_operand_object *target_desc);
acpi_status
-acpi_ex_copy_string_to_string (
+acpi_ex_store_string_to_string (
acpi_operand_object *source_desc,
acpi_operand_object *target_desc);
acpi_operand_object *target_desc);
/*
- * amutils - interpreter/scanner utilities
+ * exutils - interpreter/scanner utilities
*/
acpi_status
/*
- * amregion - default Op_region handlers
+ * exregion - default Op_region handlers
*/
acpi_status
u32 function,
ACPI_PHYSICAL_ADDRESS address,
u32 bit_width,
- u32 *value,
+ acpi_integer *value,
void *handler_context,
void *region_context);
u32 function,
ACPI_PHYSICAL_ADDRESS address,
u32 bit_width,
- u32 *value,
+ acpi_integer *value,
void *handler_context,
void *region_context);
u32 function,
ACPI_PHYSICAL_ADDRESS address,
u32 bit_width,
- u32 *value,
+ acpi_integer *value,
void *handler_context,
void *region_context);
u32 function,
ACPI_PHYSICAL_ADDRESS address,
u32 bit_width,
- u32 *value,
+ acpi_integer *value,
void *handler_context,
void *region_context);
u32 function,
ACPI_PHYSICAL_ADDRESS address,
u32 bit_width,
- u32 *value,
+ acpi_integer *value,
void *handler_context,
void *region_context);
u32 function,
ACPI_PHYSICAL_ADDRESS address,
u32 bit_width,
- u32 *value,
+ acpi_integer *value,
void *handler_context,
void *region_context);
u32 function,
ACPI_PHYSICAL_ADDRESS address,
u32 bit_width,
- u32 *value,
+ acpi_integer *value,
void *handler_context,
void *region_context);
+acpi_status
+acpi_ex_data_table_space_handler (
+ u32 function,
+ ACPI_PHYSICAL_ADDRESS address,
+ u32 bit_width,
+ acpi_integer *value,
+ void *handler_context,
+ void *region_context);
+
#endif /* __INTERP_H__ */
/******************************************************************************
*
* Name: aclocal.h - Internal data types used across the ACPI subsystem
- * $Revision: 138 $
+ * $Revision: 159 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define ACPI_DESC_TYPE_STATE_WSCOPE 0x26
#define ACPI_DESC_TYPE_STATE_RESULT 0x27
#define ACPI_DESC_TYPE_STATE_NOTIFY 0x28
+#define ACPI_DESC_TYPE_STATE_THREAD 0x29
#define ACPI_DESC_TYPE_WALK 0x44
#define ACPI_DESC_TYPE_PARSER 0x66
#define ACPI_DESC_TYPE_INTERNAL 0x88
typedef u16 acpi_owner_id;
-#define OWNER_TYPE_TABLE 0x0
-#define OWNER_TYPE_METHOD 0x1
-#define FIRST_METHOD_ID 0x0000
-#define FIRST_TABLE_ID 0x8000
+#define ACPI_OWNER_TYPE_TABLE 0x0
+#define ACPI_OWNER_TYPE_METHOD 0x1
+#define ACPI_FIRST_METHOD_ID 0x0000
+#define ACPI_FIRST_TABLE_ID 0x8000
/* TBD: [Restructure] get rid of the need for this! */
typedef enum
{
- IMODE_LOAD_PASS1 = 0x01,
- IMODE_LOAD_PASS2 = 0x02,
- IMODE_EXECUTE = 0x0E
+ ACPI_IMODE_LOAD_PASS1 = 0x01,
+ ACPI_IMODE_LOAD_PASS2 = 0x02,
+ ACPI_IMODE_EXECUTE = 0x0E
-} operating_mode;
+} acpi_interpreter_mode;
/*
typedef struct acpi_node
{
- u8 data_type;
+ u8 descriptor; /* Used to differentiate object descriptor types */
u8 type; /* Type associated with this name */
u16 owner_id;
u32 name; /* ACPI Name, always 4 chars per ACPI spec */
} acpi_namespace_node;
-#define ENTRY_NOT_FOUND NULL
+#define ACPI_ENTRY_NOT_FOUND NULL
/* Node flags */
-#define ANOBJ_AML_ATTACHMENT 0x01
+#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
acpi_handle *list;
u32 *count;
-} find_context;
+} acpi_find_context;
typedef struct
{
acpi_namespace_node *node;
-} ns_search_data;
+} acpi_ns_search_data;
/*
typedef struct
{
NATIVE_CHAR *name;
- acpi_object_type8 type;
+ u8 type;
NATIVE_CHAR *val;
-} predefined_names;
+} acpi_predefined_names;
/* Object types used during package copies */
u32 field_bit_position;
u32 field_bit_length;
u8 field_flags;
+ u8 attribute;
u8 field_type;
} ACPI_CREATE_FIELD_INFO;
-/*
- * Field flags: Bits 00 - 03 : Access_type (Any_acc, Byte_acc, etc.)
- * 04 : Lock_rule (1 == Lock)
- * 05 - 06 : Update_rule
- */
-
-#define FIELD_ACCESS_TYPE_MASK 0x0F
-#define FIELD_LOCK_RULE_MASK 0x10
-#define FIELD_UPDATE_RULE_MASK 0x60
-
/*****************************************************************************
*
*
****************************************************************************/
-
-/* Status bits. */
-
-#define ACPI_STATUS_PMTIMER 0x0001
-#define ACPI_STATUS_BUSMASTER 0x0010
-#define ACPI_STATUS_GLOBAL 0x0020
-#define ACPI_STATUS_POWER_BUTTON 0x0100
-#define ACPI_STATUS_SLEEP_BUTTON 0x0200
-#define ACPI_STATUS_RTC_ALARM 0x0400
-
-/* Enable bits. */
-
-#define ACPI_ENABLE_PMTIMER 0x0001
-#define ACPI_ENABLE_GLOBAL 0x0020
-#define ACPI_ENABLE_POWER_BUTTON 0x0100
-#define ACPI_ENABLE_SLEEP_BUTTON 0x0200
-#define ACPI_ENABLE_RTC_ALARM 0x0400
-
-
-/*
- * Entry in the Address_space (AKA Operation Region) table
- */
+/* Information about each GPE register block */
typedef struct
{
- acpi_adr_space_handler handler;
- void *context;
+ u16 register_count;
+ u16 block_address;
+ u8 block_base_number;
-} acpi_adr_space_info;
+} ACPI_GPE_BLOCK_INFO;
-
-/* Values and addresses of the GPE registers (both banks) */
+/* Information about a particular GPE register pair */
typedef struct
{
u8 status; /* Current value of status reg */
u8 enable; /* Current value of enable reg */
u8 wake_enable; /* Mask of bits to keep enabled when sleeping */
- u8 gpe_base; /* Base GPE number */
+ u8 base_gpe_number; /* Base GPE number for this register */
-} acpi_gpe_registers;
+} ACPI_GPE_REGISTER_INFO;
#define ACPI_GPE_LEVEL_TRIGGERED 1
typedef struct
{
- u8 type; /* Level or Edge */
-
acpi_handle method_handle; /* Method handle for direct (fast) execution */
acpi_gpe_handler handler; /* Address of handler, if any */
void *context; /* Context to be passed to handler */
+ u8 type; /* Level or Edge */
+ u8 bit_mask;
+
+
+} ACPI_GPE_NUMBER_INFO;
+
-} acpi_gpe_level_info;
+typedef struct
+{
+ u8 number_index;
+} ACPI_GPE_INDEX_INFO;
/* Information about each particular fixed event */
acpi_event_handler handler; /* Address of handler. */
void *context; /* Context to be passed to handler */
-} acpi_fixed_event_info;
+} ACPI_FIXED_EVENT_HANDLER;
+
+
+typedef struct
+{
+ u8 status_register_id;
+ u8 enable_register_id;
+ u16 status_bit_mask;
+ u16 enable_bit_mask;
+} acpi_fixed_event_info;
/* Information used during field processing */
****************************************************************************/
-#define CONTROL_NORMAL 0xC0
-#define CONTROL_CONDITIONAL_EXECUTING 0xC1
-#define CONTROL_PREDICATE_EXECUTING 0xC2
-#define CONTROL_PREDICATE_FALSE 0xC3
-#define CONTROL_PREDICATE_TRUE 0xC4
+#define ACPI_CONTROL_NORMAL 0xC0
+#define ACPI_CONTROL_CONDITIONAL_EXECUTING 0xC1
+#define ACPI_CONTROL_PREDICATE_EXECUTING 0xC2
+#define ACPI_CONTROL_PREDICATE_FALSE 0xC3
+#define ACPI_CONTROL_PREDICATE_TRUE 0xC4
/* Forward declarations */
struct acpi_walk_state;
-struct acpi_walk_list;
struct acpi_parse_obj;
struct acpi_obj_mutex;
{
ACPI_STATE_COMMON
struct acpi_parse_obj *predicate_op;
- u8 *aml_predicate_start; /* Start of if/while predicate */
+ u8 *aml_predicate_start; /* Start of if/while predicate */
+ u8 *package_end; /* End of if/while block */
+ u16 opcode;
} acpi_control_state;
typedef struct acpi_pscope_state
{
ACPI_STATE_COMMON
- struct acpi_parse_obj *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 */
+ struct acpi_parse_obj *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 */
} acpi_pscope_state;
+/*
+ * Thread state - one per thread across multiple walk states. Multiple walk
+ * states are created when there are nested control methods executing.
+ */
+typedef struct acpi_thread_state
+{
+ ACPI_STATE_COMMON
+ struct acpi_walk_state *walk_state_list; /* Head of list of Walk_states for this thread */
+ union acpi_operand_obj *acquired_mutex_list; /* List of all currently acquired mutexes */
+ u32 thread_id; /* Running thread ID */
+ u16 current_sync_level; /* Mutex Sync (nested acquire) level */
+
+} ACPI_THREAD_STATE;
+
+
/*
* Result values - used to accumulate the results of nested
* AML arguments
acpi_scope_state scope;
acpi_pscope_state parse_scope;
acpi_pkg_state pkg;
+ ACPI_THREAD_STATE thread;
acpi_result_values results;
acpi_notify_info notify;
*/
typedef struct acpi_opcode_info
{
+#ifdef _OPCODE_NAMES
+ NATIVE_CHAR *name; /* Opcode name (debug only) */
+#endif
u32 parse_args; /* Grammar/Parse time arguments */
u32 runtime_args; /* Interpret time arguments */
- u16 flags; /* Misc flags */
+ u32 flags; /* Misc flags */
+ u8 object_type; /* Corresponding internal object type */
u8 class; /* Opcode class */
u8 type; /* Opcode type */
-#ifdef _OPCODE_NAMES
- NATIVE_CHAR *name; /* op name (debug only) */
-#endif
-
} acpi_opcode_info;
u32 aml_offset; /* offset of declaration in AML */\
struct acpi_parse_obj *parent; /* parent op */\
struct acpi_parse_obj *next; /* next op */\
- DEBUG_ONLY_MEMBERS (\
+ ACPI_DEBUG_ONLY_MEMBERS (\
NATIVE_CHAR op_name[16]) /* op name (debug only) */\
/* NON-DEBUG members below: */\
acpi_namespace_node *node; /* for use by interpreter */\
u8 *aml_end; /* (last + 1) AML byte */
u8 *pkg_start; /* current package begin */
u8 *pkg_end; /* current package end */
-
struct acpi_parse_obj *start_op; /* root of parse tree */
struct acpi_node *start_node;
union acpi_gen_state *scope; /* current scope */
+ struct acpi_parse_obj *start_scope;
+} acpi_parse_state;
- struct acpi_parse_obj *start_scope;
+/* Parse object flags */
-} acpi_parse_state;
+#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
/*****************************************************************************
*
- * Hardware and PNP
+ * Hardware (ACPI registers) and PNP
*
****************************************************************************/
+#define PCI_ROOT_HID_STRING "PNP0A03"
-/* PCI */
-#define PCI_ROOT_HID_STRING "PNP0A03"
-
-/*
- * The #define's and enum below establish an abstract way of identifying what
- * register block and register is to be accessed. Do not change any of the
- * values as they are used in switch statements and offset calculations.
- */
-
-#define REGISTER_BLOCK_MASK 0xFF00 /* Register Block Id */
-#define BIT_IN_REGISTER_MASK 0x00FF /* Bit Id in the Register Block Id */
-#define BYTE_IN_REGISTER_MASK 0x00FF /* Register Offset in the Register Block */
-
-#define REGISTER_BLOCK_ID(reg_id) (reg_id & REGISTER_BLOCK_MASK)
-#define REGISTER_BIT_ID(reg_id) (reg_id & BIT_IN_REGISTER_MASK)
-#define REGISTER_OFFSET(reg_id) (reg_id & BYTE_IN_REGISTER_MASK)
-
-/*
- * Access Rule
- * To access a Register Bit:
- * -> Use Bit Name (= Register Block Id | Bit Id) defined in the enum.
- *
- * To access a Register:
- * -> Use Register Id (= Register Block Id | Register Offset)
- */
+typedef struct
+{
+ u8 parent_register;
+ u8 bit_position;
+ u16 access_bit_mask;
+} ACPI_BIT_REGISTER_INFO;
-/*
- * Register Block Id
- */
-#define PM1_STS 0x0100
-#define PM1_EN 0x0200
-#define PM1_CONTROL 0x0300
-#define PM1A_CONTROL 0x0400
-#define PM1B_CONTROL 0x0500
-#define PM2_CONTROL 0x0600
-#define PM_TIMER 0x0700
-#define PROCESSOR_BLOCK 0x0800
-#define GPE0_STS_BLOCK 0x0900
-#define GPE0_EN_BLOCK 0x0A00
-#define GPE1_STS_BLOCK 0x0B00
-#define GPE1_EN_BLOCK 0x0C00
-#define SMI_CMD_BLOCK 0x0D00
/*
- * Address space bitmasks for mmio or io spaces
+ * Register IDs
+ * These are the full ACPI registers
*/
+#define ACPI_REGISTER_PM1_STATUS 0x01
+#define ACPI_REGISTER_PM1_ENABLE 0x02
+#define ACPI_REGISTER_PM1_CONTROL 0x03
+#define ACPI_REGISTER_PM1A_CONTROL 0x04
+#define ACPI_REGISTER_PM1B_CONTROL 0x05
+#define ACPI_REGISTER_PM2_CONTROL 0x06
+#define ACPI_REGISTER_PM_TIMER 0x07
+#define ACPI_REGISTER_PROCESSOR_BLOCK 0x08
+#define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x09
-#define SMI_CMD_ADDRESS_SPACE 0x01
-#define PM1_BLK_ADDRESS_SPACE 0x02
-#define PM2_CNT_BLK_ADDRESS_SPACE 0x04
-#define PM_TMR_BLK_ADDRESS_SPACE 0x08
-#define GPE0_BLK_ADDRESS_SPACE 0x10
-#define GPE1_BLK_ADDRESS_SPACE 0x20
/*
- * Control bit definitions
+ * Bit_register IDs
+ * These are bitfields defined within the full ACPI registers
*/
-#define TMR_STS (PM1_STS | 0x01)
-#define BM_STS (PM1_STS | 0x02)
-#define GBL_STS (PM1_STS | 0x03)
-#define PWRBTN_STS (PM1_STS | 0x04)
-#define SLPBTN_STS (PM1_STS | 0x05)
-#define RTC_STS (PM1_STS | 0x06)
-#define WAK_STS (PM1_STS | 0x07)
-
-#define TMR_EN (PM1_EN | 0x01)
- /* no BM_EN */
-#define GBL_EN (PM1_EN | 0x03)
-#define PWRBTN_EN (PM1_EN | 0x04)
-#define SLPBTN_EN (PM1_EN | 0x05)
-#define RTC_EN (PM1_EN | 0x06)
-#define WAK_EN (PM1_EN | 0x07)
-
-#define SCI_EN (PM1_CONTROL | 0x01)
-#define BM_RLD (PM1_CONTROL | 0x02)
-#define GBL_RLS (PM1_CONTROL | 0x03)
-#define SLP_TYPE_A (PM1_CONTROL | 0x04)
-#define SLP_TYPE_B (PM1_CONTROL | 0x05)
-#define SLP_EN (PM1_CONTROL | 0x06)
-
-#define ARB_DIS (PM2_CONTROL | 0x01)
-
-#define TMR_VAL (PM_TIMER | 0x01)
-
-#define GPE0_STS (GPE0_STS_BLOCK | 0x01)
-#define GPE0_EN (GPE0_EN_BLOCK | 0x01)
-
-#define GPE1_STS (GPE1_STS_BLOCK | 0x01)
-#define GPE1_EN (GPE1_EN_BLOCK | 0x01)
-
-
-#define TMR_STS_MASK 0x0001
-#define BM_STS_MASK 0x0010
-#define GBL_STS_MASK 0x0020
-#define PWRBTN_STS_MASK 0x0100
-#define SLPBTN_STS_MASK 0x0200
-#define RTC_STS_MASK 0x0400
-#define WAK_STS_MASK 0x8000
-
-#define ALL_FIXED_STS_BITS (TMR_STS_MASK | BM_STS_MASK | GBL_STS_MASK \
- | PWRBTN_STS_MASK | SLPBTN_STS_MASK \
- | RTC_STS_MASK | WAK_STS_MASK)
-
-#define TMR_EN_MASK 0x0001
-#define GBL_EN_MASK 0x0020
-#define PWRBTN_EN_MASK 0x0100
-#define SLPBTN_EN_MASK 0x0200
-#define RTC_EN_MASK 0x0400
-
-#define SCI_EN_MASK 0x0001
-#define BM_RLD_MASK 0x0002
-#define GBL_RLS_MASK 0x0004
-#define SLP_TYPE_X_MASK 0x1C00
-#define SLP_EN_MASK 0x2000
-
-#define ARB_DIS_MASK 0x0001
-#define TMR_VAL_MASK 0xFFFFFFFF
-
-#define GPE0_STS_MASK
-#define GPE0_EN_MASK
-
-#define GPE1_STS_MASK
-#define GPE1_EN_MASK
-
-
-#define ACPI_READ 1
-#define ACPI_WRITE 2
+#define ACPI_BITREG_TIMER_STATUS 0x00
+#define ACPI_BITREG_BUS_MASTER_STATUS 0x01
+#define ACPI_BITREG_GLOBAL_LOCK_STATUS 0x02
+#define ACPI_BITREG_POWER_BUTTON_STATUS 0x03
+#define ACPI_BITREG_SLEEP_BUTTON_STATUS 0x04
+#define ACPI_BITREG_RT_CLOCK_STATUS 0x05
+#define ACPI_BITREG_WAKE_STATUS 0x06
+
+#define ACPI_BITREG_TIMER_ENABLE 0x07
+#define ACPI_BITREG_GLOBAL_LOCK_ENABLE 0x08
+#define ACPI_BITREG_POWER_BUTTON_ENABLE 0x09
+#define ACPI_BITREG_SLEEP_BUTTON_ENABLE 0x0A
+#define ACPI_BITREG_RT_CLOCK_ENABLE 0x0B
+#define ACPI_BITREG_WAKE_ENABLE 0x0C
+
+#define ACPI_BITREG_SCI_ENABLE 0x0D
+#define ACPI_BITREG_BUS_MASTER_RLD 0x0E
+#define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x0F
+#define ACPI_BITREG_SLEEP_TYPE_A 0x10
+#define ACPI_BITREG_SLEEP_TYPE_B 0x11
+#define ACPI_BITREG_SLEEP_ENABLE 0x12
+
+#define ACPI_BITREG_ARB_DISABLE 0x13
+
+#define ACPI_BITREG_MAX 0x13
+#define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1
+
+
+/* Masks used to access the Bit_registers */
+
+#define ACPI_BITMASK_TIMER_STATUS 0x0001
+#define ACPI_BITMASK_BUS_MASTER_STATUS 0x0010
+#define ACPI_BITMASK_GLOBAL_LOCK_STATUS 0x0020
+#define ACPI_BITMASK_POWER_BUTTON_STATUS 0x0100
+#define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x0200
+#define ACPI_BITMASK_RT_CLOCK_STATUS 0x0400
+#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_TIMER_ENABLE 0x0001
+#define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020
+#define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x0100
+#define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x0200
+#define ACPI_BITMASK_RT_CLOCK_ENABLE 0x0400
+
+#define ACPI_BITMASK_SCI_ENABLE 0x0001
+#define ACPI_BITMASK_BUS_MASTER_RLD 0x0002
+#define ACPI_BITMASK_GLOBAL_LOCK_RELEASE 0x0004
+#define ACPI_BITMASK_SLEEP_TYPE_X 0x1C00
+#define ACPI_BITMASK_SLEEP_ENABLE 0x2000
+
+#define ACPI_BITMASK_ARB_DISABLE 0x0001
+
+
+/* Raw bit position of each Bit_register */
+
+#define ACPI_BITPOSITION_TIMER_STATUS 0x00
+#define ACPI_BITPOSITION_BUS_MASTER_STATUS 0x04
+#define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS 0x05
+#define ACPI_BITPOSITION_POWER_BUTTON_STATUS 0x08
+#define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS 0x09
+#define ACPI_BITPOSITION_RT_CLOCK_STATUS 0x0A
+#define ACPI_BITPOSITION_WAKE_STATUS 0x0F
+
+#define ACPI_BITPOSITION_TIMER_ENABLE 0x00
+#define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE 0x05
+#define ACPI_BITPOSITION_POWER_BUTTON_ENABLE 0x08
+#define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE 0x09
+#define ACPI_BITPOSITION_RT_CLOCK_ENABLE 0x0A
+
+#define ACPI_BITPOSITION_SCI_ENABLE 0x00
+#define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01
+#define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE 0x02
+#define ACPI_BITPOSITION_SLEEP_TYPE_X 0x0A
+#define ACPI_BITPOSITION_SLEEP_ENABLE 0x0D
+
+#define ACPI_BITPOSITION_ARB_DISABLE 0x00
/*****************************************************************************
/* Resource_type values */
-#define RESOURCE_TYPE_MEMORY_RANGE 0
-#define RESOURCE_TYPE_IO_RANGE 1
-#define RESOURCE_TYPE_BUS_NUMBER_RANGE 2
+#define ACPI_RESOURCE_TYPE_MEMORY_RANGE 0
+#define ACPI_RESOURCE_TYPE_IO_RANGE 1
+#define ACPI_RESOURCE_TYPE_BUS_NUMBER_RANGE 2
/* Resource descriptor types and masks */
-#define RESOURCE_DESC_TYPE_LARGE 0x80
-#define RESOURCE_DESC_TYPE_SMALL 0x00
+#define ACPI_RDESC_TYPE_LARGE 0x80
+#define ACPI_RDESC_TYPE_SMALL 0x00
-#define RESOURCE_DESC_TYPE_MASK 0x80
-#define RESOURCE_DESC_SMALL_MASK 0x78 /* Only bits 6:3 contain the type */
+#define ACPI_RDESC_TYPE_MASK 0x80
+#define ACPI_RDESC_SMALL_MASK 0x78 /* Only bits 6:3 contain the type */
/*
* Small resource descriptor types
* Note: The 3 length bits (2:0) must be zero
*/
-#define RESOURCE_DESC_IRQ_FORMAT 0x20
-#define RESOURCE_DESC_DMA_FORMAT 0x28
-#define RESOURCE_DESC_START_DEPENDENT 0x30
-#define RESOURCE_DESC_END_DEPENDENT 0x38
-#define RESOURCE_DESC_IO_PORT 0x40
-#define RESOURCE_DESC_FIXED_IO_PORT 0x48
-#define RESOURCE_DESC_SMALL_VENDOR 0x70
-#define RESOURCE_DESC_END_TAG 0x78
+#define ACPI_RDESC_TYPE_IRQ_FORMAT 0x20
+#define ACPI_RDESC_TYPE_DMA_FORMAT 0x28
+#define ACPI_RDESC_TYPE_START_DEPENDENT 0x30
+#define ACPI_RDESC_TYPE_END_DEPENDENT 0x38
+#define ACPI_RDESC_TYPE_IO_PORT 0x40
+#define ACPI_RDESC_TYPE_FIXED_IO_PORT 0x48
+#define ACPI_RDESC_TYPE_SMALL_VENDOR 0x70
+#define ACPI_RDESC_TYPE_END_TAG 0x78
/*
* Large resource descriptor types
*/
-#define RESOURCE_DESC_MEMORY_24 0x81
-#define RESOURCE_DESC_GENERAL_REGISTER 0x82
-#define RESOURCE_DESC_LARGE_VENDOR 0x84
-#define RESOURCE_DESC_MEMORY_32 0x85
-#define RESOURCE_DESC_FIXED_MEMORY_32 0x86
-#define RESOURCE_DESC_DWORD_ADDRESS_SPACE 0x87
-#define RESOURCE_DESC_WORD_ADDRESS_SPACE 0x88
-#define RESOURCE_DESC_EXTENDED_XRUPT 0x89
-#define RESOURCE_DESC_QWORD_ADDRESS_SPACE 0x8A
+#define ACPI_RDESC_TYPE_MEMORY_24 0x81
+#define ACPI_RDESC_TYPE_GENERAL_REGISTER 0x82
+#define ACPI_RDESC_TYPE_LARGE_VENDOR 0x84
+#define ACPI_RDESC_TYPE_MEMORY_32 0x85
+#define ACPI_RDESC_TYPE_FIXED_MEMORY_32 0x86
+#define ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE 0x87
+#define ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE 0x88
+#define ACPI_RDESC_TYPE_EXTENDED_XRUPT 0x89
+#define ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE 0x8A
/* String version of device HIDs and UIDs */
*
****************************************************************************/
-#define ASCII_ZERO 0x30
+#define ACPI_ASCII_ZERO 0x30
/*****************************************************************************
*
u32 num_loops;
NATIVE_CHAR pathname[128];
-} db_method_info;
+} acpi_db_method_info;
+
+
+#define ACPI_DB_REDIRECTABLE_OUTPUT 0x01
+#define ACPI_DB_CONSOLE_OUTPUT 0x02
+#define ACPI_DB_DUPLICATE_OUTPUT 0x03
/*****************************************************************************
/* Entry for a memory allocation (debug only) */
-
-#define MEM_MALLOC 0
-#define MEM_CALLOC 1
-#define 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; \
u32 size; \
u32 component; \
u32 line; \
- NATIVE_CHAR module[MAX_MODULE_NAME]; \
+ NATIVE_CHAR module[ACPI_MAX_MODULE_NAME]; \
u8 alloc_type;
-
typedef struct
{
ACPI_COMMON_DEBUG_MEM_HEADER
/******************************************************************************
*
* Name: acmacros.h - C macros for the entire subsystem.
- * $Revision: 97 $
+ * $Revision: 115 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* Data manipulation macros
*/
-#ifndef LOWORD
-#define LOWORD(l) ((u16)(NATIVE_UINT)(l))
-#endif
-
-#ifndef HIWORD
-#define HIWORD(l) ((u16)((((NATIVE_UINT)(l)) >> 16) & 0xFFFF))
-#endif
-
-#ifndef LOBYTE
-#define LOBYTE(l) ((u8)(u16)(l))
-#endif
-
-#ifndef HIBYTE
-#define HIBYTE(l) ((u8)((((u16)(l)) >> 8) & 0xFF))
-#endif
-
-#define BIT0(x) ((((x) & 0x01) > 0) ? 1 : 0)
-#define BIT1(x) ((((x) & 0x02) > 0) ? 1 : 0)
-#define BIT2(x) ((((x) & 0x04) > 0) ? 1 : 0)
-
-#define BIT3(x) ((((x) & 0x08) > 0) ? 1 : 0)
-#define BIT4(x) ((((x) & 0x10) > 0) ? 1 : 0)
-#define BIT5(x) ((((x) & 0x20) > 0) ? 1 : 0)
-#define BIT6(x) ((((x) & 0x40) > 0) ? 1 : 0)
-#define BIT7(x) ((((x) & 0x80) > 0) ? 1 : 0)
-
-#define LOW_BASE(w) ((u16) ((w) & 0x0000FFFF))
-#define MID_BASE(b) ((u8) (((b) & 0x00FF0000) >> 16))
-#define HI_BASE(b) ((u8) (((b) & 0xFF000000) >> 24))
-#define LOW_LIMIT(w) ((u16) ((w) & 0x0000FFFF))
-#define HI_LIMIT(b) ((u8) (((b) & 0x00FF0000) >> 16))
+#define ACPI_LOWORD(l) ((u16)(NATIVE_UINT)(l))
+#define ACPI_HIWORD(l) ((u16)((((NATIVE_UINT)(l)) >> 16) & 0xFFFF))
+#define ACPI_LOBYTE(l) ((u8)(u16)(l))
+#define ACPI_HIBYTE(l) ((u8)((((u16)(l)) >> 8) & 0xFF))
#ifdef _IA16
* For 16-bit addresses, we have to assume that the upper 32 bits
* are zero.
*/
-#ifndef LODWORD
-#define LODWORD(l) (l)
-#endif
-
-#ifndef HIDWORD
-#define HIDWORD(l) (0)
-#endif
+#define ACPI_LODWORD(l) (l)
+#define ACPI_HIDWORD(l) (0)
#define ACPI_GET_ADDRESS(a) ((a).lo)
#define ACPI_STORE_ADDRESS(a,b) {(a).hi=0;(a).lo=(b);}
/*
* acpi_integer is 32-bits, no 64-bit support on this platform
*/
-#ifndef LODWORD
-#define LODWORD(l) ((u32)(l))
-#endif
-
-#ifndef HIDWORD
-#define HIDWORD(l) (0)
-#endif
+#define ACPI_LODWORD(l) ((u32)(l))
+#define ACPI_HIDWORD(l) (0)
#define ACPI_GET_ADDRESS(a) (a)
#define ACPI_STORE_ADDRESS(a,b) ((a)=(b))
/*
* Full 64-bit address/integer on both 32-bit and 64-bit platforms
*/
-#ifndef LODWORD
-#define LODWORD(l) ((u32)(u64)(l))
-#endif
-
-#ifndef HIDWORD
-#define HIDWORD(l) ((u32)(((*(uint64_struct *)(&l))).hi))
-#endif
+#define ACPI_LODWORD(l) ((u32)(u64)(l))
+#define ACPI_HIDWORD(l) ((u32)(((*(uint64_struct *)(&l))).hi))
#define ACPI_GET_ADDRESS(a) (a)
#define ACPI_STORE_ADDRESS(a,b) ((a)=(b))
* Extract a byte of data using a pointer. Any more than a byte and we
* get into potential aligment issues -- see the STORE macros below
*/
-#define GET8(addr) (*(u8*)(addr))
+#define ACPI_GET8(addr) (*(u8*)(addr))
/* Pointer arithmetic */
+#define ACPI_PTR_ADD(t,a,b) (t *) ((char *)(a) + (b))
+#define ACPI_PTR_DIFF(a,b) (NATIVE_UINT) ((char *)(a) - (char *)(b))
+
+/* Pointer/Integer type conversions */
-#define POINTER_ADD(t,a,b) (t *) ((NATIVE_UINT)(a) + (NATIVE_UINT)(b))
-#define POINTER_DIFF(a,b) ((u32) ((NATIVE_UINT)(a) - (NATIVE_UINT)(b)))
+#define ACPI_TO_POINTER(i) ACPI_PTR_ADD (void,NULL,(NATIVE_UINT)i)
+#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,NULL)
+#define ACPI_OFFSET(d,o) ((ACPI_SIZE) ACPI_TO_INTEGER (&(((d *)0)->o)))
+#define ACPI_FADT_OFFSET(o) ACPI_OFFSET (FADT_DESCRIPTOR, o)
+
+
+#ifdef _IA16
+#define ACPI_PHYSADDR_TO_PTR(i) (void *)(i)
+#define ACPI_PTR_TO_PHYSADDR(i) (char *)(i)
+#else
+#define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i)
+#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i)
+#endif
/*
* Macros for moving data around to/from buffers that are possibly unaligned.
/* The hardware supports unaligned transfers, just do the move */
-#define MOVE_UNALIGNED16_TO_16(d,s) *(u16*)(d) = *(u16*)(s)
-#define MOVE_UNALIGNED32_TO_32(d,s) *(u32*)(d) = *(u32*)(s)
-#define MOVE_UNALIGNED16_TO_32(d,s) *(u32*)(d) = *(u16*)(s)
-#define MOVE_UNALIGNED64_TO_64(d,s) *(u64*)(d) = *(u64*)(s)
+#define ACPI_MOVE_UNALIGNED16_TO_16(d,s) *(u16 *)(d) = *(u16 *)(s)
+#define ACPI_MOVE_UNALIGNED32_TO_32(d,s) *(u32 *)(d) = *(u32 *)(s)
+#define ACPI_MOVE_UNALIGNED16_TO_32(d,s) *(u32 *)(d) = *(u16 *)(s)
+#define ACPI_MOVE_UNALIGNED64_TO_64(d,s) *(u64 *)(d) = *(u64 *)(s)
#else
/*
* the destination (or both) is/are unaligned.
*/
-#define MOVE_UNALIGNED16_TO_16(d,s) {((u8 *)(d))[0] = ((u8 *)(s))[0];\
- ((u8 *)(d))[1] = ((u8 *)(s))[1];}
+#define ACPI_MOVE_UNALIGNED16_TO_16(d,s) {((u8 *)(d))[0] = ((u8 *)(s))[0];\
+ ((u8 *)(d))[1] = ((u8 *)(s))[1];}
-#define MOVE_UNALIGNED32_TO_32(d,s) {((u8 *)(d))[0] = ((u8 *)(s))[0];\
- ((u8 *)(d))[1] = ((u8 *)(s))[1];\
- ((u8 *)(d))[2] = ((u8 *)(s))[2];\
- ((u8 *)(d))[3] = ((u8 *)(s))[3];}
+#define ACPI_MOVE_UNALIGNED32_TO_32(d,s) {((u8 *)(d))[0] = ((u8 *)(s))[0];\
+ ((u8 *)(d))[1] = ((u8 *)(s))[1];\
+ ((u8 *)(d))[2] = ((u8 *)(s))[2];\
+ ((u8 *)(d))[3] = ((u8 *)(s))[3];}
-#define MOVE_UNALIGNED16_TO_32(d,s) {(*(u32*)(d)) = 0; MOVE_UNALIGNED16_TO_16(d,s);}
+#define ACPI_MOVE_UNALIGNED16_TO_32(d,s) {(*(u32*)(d)) = 0; ACPI_MOVE_UNALIGNED16_TO_16(d,s);}
-#define MOVE_UNALIGNED64_TO_64(d,s) {((u8 *)(d))[0] = ((u8 *)(s))[0];\
- ((u8 *)(d))[1] = ((u8 *)(s))[1];\
- ((u8 *)(d))[2] = ((u8 *)(s))[2];\
- ((u8 *)(d))[3] = ((u8 *)(s))[3];\
- ((u8 *)(d))[4] = ((u8 *)(s))[4];\
- ((u8 *)(d))[5] = ((u8 *)(s))[5];\
- ((u8 *)(d))[6] = ((u8 *)(s))[6];\
- ((u8 *)(d))[7] = ((u8 *)(s))[7];}
+#define ACPI_MOVE_UNALIGNED64_TO_64(d,s) {((u8 *)(d))[0] = ((u8 *)(s))[0];\
+ ((u8 *)(d))[1] = ((u8 *)(s))[1];\
+ ((u8 *)(d))[2] = ((u8 *)(s))[2];\
+ ((u8 *)(d))[3] = ((u8 *)(s))[3];\
+ ((u8 *)(d))[4] = ((u8 *)(s))[4];\
+ ((u8 *)(d))[5] = ((u8 *)(s))[5];\
+ ((u8 *)(d))[6] = ((u8 *)(s))[6];\
+ ((u8 *)(d))[7] = ((u8 *)(s))[7];}
#endif
* Fast power-of-two math macros for non-optimized compilers
*/
-#define _DIV(value,power_of2) ((u32) ((value) >> (power_of2)))
-#define _MUL(value,power_of2) ((u32) ((value) << (power_of2)))
-#define _MOD(value,divisor) ((u32) ((value) & ((divisor) -1)))
+#define _ACPI_DIV(value,power_of2) ((u32) ((value) >> (power_of2)))
+#define _ACPI_MUL(value,power_of2) ((u32) ((value) << (power_of2)))
+#define _ACPI_MOD(value,divisor) ((u32) ((value) & ((divisor) -1)))
-#define DIV_2(a) _DIV(a,1)
-#define MUL_2(a) _MUL(a,1)
-#define MOD_2(a) _MOD(a,2)
+#define ACPI_DIV_2(a) _ACPI_DIV(a,1)
+#define ACPI_MUL_2(a) _ACPI_MUL(a,1)
+#define ACPI_MOD_2(a) _ACPI_MOD(a,2)
-#define DIV_4(a) _DIV(a,2)
-#define MUL_4(a) _MUL(a,2)
-#define MOD_4(a) _MOD(a,4)
+#define ACPI_DIV_4(a) _ACPI_DIV(a,2)
+#define ACPI_MUL_4(a) _ACPI_MUL(a,2)
+#define ACPI_MOD_4(a) _ACPI_MOD(a,4)
-#define DIV_8(a) _DIV(a,3)
-#define MUL_8(a) _MUL(a,3)
-#define MOD_8(a) _MOD(a,8)
+#define ACPI_DIV_8(a) _ACPI_DIV(a,3)
+#define ACPI_MUL_8(a) _ACPI_MUL(a,3)
+#define ACPI_MOD_8(a) _ACPI_MOD(a,8)
-#define DIV_16(a) _DIV(a,4)
-#define MUL_16(a) _MUL(a,4)
-#define MOD_16(a) _MOD(a,16)
+#define ACPI_DIV_16(a) _ACPI_DIV(a,4)
+#define ACPI_MUL_16(a) _ACPI_MUL(a,4)
+#define ACPI_MOD_16(a) _ACPI_MOD(a,16)
/*
* Rounding macros (Power of two boundaries only)
*/
-#define ROUND_DOWN(value,boundary) ((value) & (~((boundary)-1)))
-#define ROUND_UP(value,boundary) (((value) + ((boundary)-1)) & (~((boundary)-1)))
+#define ACPI_ROUND_DOWN(value,boundary) (((NATIVE_UINT)(value)) & (~((boundary)-1)))
+#define ACPI_ROUND_UP(value,boundary) ((((NATIVE_UINT)(value)) + ((boundary)-1)) & (~((boundary)-1)))
-#define ROUND_DOWN_TO_32_BITS(a) ROUND_DOWN(a,4)
-#define ROUND_DOWN_TO_64_BITS(a) ROUND_DOWN(a,8)
-#define ROUND_DOWN_TO_NATIVE_WORD(a) ROUND_DOWN(a,ALIGNED_ADDRESS_BOUNDARY)
+#define ACPI_ROUND_DOWN_TO_32_BITS(a) ACPI_ROUND_DOWN(a,4)
+#define ACPI_ROUND_DOWN_TO_64_BITS(a) ACPI_ROUND_DOWN(a,8)
+#define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a,ALIGNED_ADDRESS_BOUNDARY)
-#define ROUND_UP_TO_32_bITS(a) ROUND_UP(a,4)
-#define ROUND_UP_TO_64_bITS(a) ROUND_UP(a,8)
-#define ROUND_UP_TO_NATIVE_WORD(a) ROUND_UP(a,ALIGNED_ADDRESS_BOUNDARY)
+#define ACPI_ROUND_UP_TO_32_bITS(a) ACPI_ROUND_UP(a,4)
+#define ACPI_ROUND_UP_TO_64_bITS(a) ACPI_ROUND_UP(a,8)
+#define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a,ALIGNED_ADDRESS_BOUNDARY)
-#define ROUND_PTR_UP_TO_4(a,b) ((b *)(((NATIVE_UINT)(a) + 3) & ~3))
-#define ROUND_PTR_UP_TO_8(a,b) ((b *)(((NATIVE_UINT)(a) + 7) & ~7))
-#define ROUND_BITS_UP_TO_BYTES(a) DIV_8((a) + 7)
-#define ROUND_BITS_DOWN_TO_BYTES(a) DIV_8((a))
+#define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7)
+#define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a))
-#define ROUND_UP_TO_1K(a) (((a) + 1023) >> 10)
+#define ACPI_ROUND_UP_TO_1K(a) (((a) + 1023) >> 10)
/* Generic (non-power-of-two) rounding */
-#define ROUND_UP_TO(value,boundary) (((value) + ((boundary)-1)) / (boundary))
+#define ACPI_ROUND_UP_TO(value,boundary) (((value) + ((boundary)-1)) / (boundary))
/*
* Bitmask creation
* MASK_BITS_ABOVE creates a mask starting AT the position and above
* MASK_BITS_BELOW creates a mask starting one bit BELOW the position
*/
-#define MASK_BITS_ABOVE(position) (~(((u32)(-1)) << ((u32) (position))))
-#define MASK_BITS_BELOW(position) (((u32)(-1)) << ((u32) (position)))
+#define ACPI_MASK_BITS_ABOVE(position) (~(((acpi_integer)(-1)) << ((u32) (position))))
+#define ACPI_MASK_BITS_BELOW(position) (((acpi_integer)(-1)) << ((u32) (position)))
+#define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7'))
/* Macros for GAS addressing */
#endif
+
+/* Bitfields within ACPI registers */
+
+#define ACPI_REGISTER_PREPARE_BITS(val, pos, mask) ((val << pos) & mask)
+#define ACPI_REGISTER_INSERT_VALUE(reg, pos, mask, val) reg = (reg & (~(mask))) | ACPI_REGISTER_PREPARE_BITS(val, pos, mask)
+
/*
- * An acpi_handle (which is actually an acpi_namespace_node *) can appear in some contexts,
- * such as on ap_obj_stack, where a pointer to an acpi_operand_object can also
+ * An acpi_namespace_node * can appear in some contexts,
+ * where a pointer to an acpi_operand_object can also
* appear. This macro is used to distinguish them.
*
- * The Data_type field is the first field in both structures.
+ * The "Descriptor" field is the first field in both structures.
*/
-#define VALID_DESCRIPTOR_TYPE(d,t) (((acpi_namespace_node *)d)->data_type == t)
+#define ACPI_GET_DESCRIPTOR_TYPE(d) (((acpi_namespace_node *)d)->descriptor)
+#define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((acpi_namespace_node *)d)->descriptor = t)
/* Macro to test the object type */
-#define IS_THIS_OBJECT_TYPE(d,t) (((acpi_operand_object *)d)->common.type == (u8)t)
+#define ACPI_GET_OBJECT_TYPE(d) (((acpi_operand_object *)d)->common.type)
/* Macro to check the table flags for SINGLE or MULTIPLE tables are allowed */
-#define IS_SINGLE_TABLE(x) (((x) & 0x01) == ACPI_TABLE_SINGLE ? 1 : 0)
+#define ACPI_IS_SINGLE_TABLE(x) (((x) & 0x01) == ACPI_TABLE_SINGLE ? 1 : 0)
/*
* Macro to check if a pointer is within an ACPI table.
* and ((u8 *)b+b->Length) points one byte past the end of the table.
*/
#ifndef _IA16
-#define IS_IN_ACPI_TABLE(a,b) (((u8 *)(a) >= (u8 *)(b + 1)) &&\
- ((u8 *)(a) < ((u8 *)b + b->length)))
+#define ACPI_IS_IN_ACPI_TABLE(a,b) (((u8 *)(a) >= (u8 *)(b + 1)) &&\
+ ((u8 *)(a) < ((u8 *)b + b->length)))
#else
-#define IS_IN_ACPI_TABLE(a,b) (_segment)(a) == (_segment)(b) &&\
+#define ACPI_IS_IN_ACPI_TABLE(a,b) (_segment)(a) == (_segment)(b) &&\
(((u8 *)(a) >= (u8 *)(b + 1)) &&\
((u8 *)(a) < ((u8 *)b + b->length)))
#endif
* Macros for the master AML opcode table
*/
#ifdef ACPI_DEBUG
-#define ACPI_OP(name,Pargs,Iargs,class,type,flags) {Pargs,Iargs,flags,class,type,name}
+#define ACPI_OP(name,Pargs,Iargs,obj_type,class,type,flags) {name,Pargs,Iargs,flags,obj_type,class,type}
#else
-#define ACPI_OP(name,Pargs,Iargs,class,type,flags) {Pargs,Iargs,flags,class,type}
+#define ACPI_OP(name,Pargs,Iargs,obj_type,class,type,flags) {Pargs,Iargs,flags,obj_type,class,type}
#endif
#define ARG_TYPE_WIDTH 5
* 5) Expand address to 64 bits
*/
#define ASL_BUILD_GAS_FROM_ENTRY(a,b,c,d) {a.address_space_id = (u8) d;\
- a.register_bit_width = (u8) MUL_8 (b);\
+ a.register_bit_width = (u8) ACPI_MUL_8 (b);\
a.register_bit_offset = 0;\
a.reserved = 0;\
ACPI_STORE_ADDRESS (a.address,c);}
* Reporting macros that are never compiled out
*/
-#define PARAM_LIST(pl) pl
+#define ACPI_PARAM_LIST(pl) pl
/*
* Error reporting. These versions add callers module and line#. Since
#ifdef ACPI_DEBUG
-#define REPORT_INFO(fp) {acpi_ut_report_info(_THIS_MODULE,__LINE__,_COMPONENT); \
- acpi_os_printf PARAM_LIST(fp);}
-#define REPORT_ERROR(fp) {acpi_ut_report_error(_THIS_MODULE,__LINE__,_COMPONENT); \
- acpi_os_printf PARAM_LIST(fp);}
-#define REPORT_WARNING(fp) {acpi_ut_report_warning(_THIS_MODULE,__LINE__,_COMPONENT); \
- acpi_os_printf PARAM_LIST(fp);}
+#define ACPI_REPORT_INFO(fp) {acpi_ut_report_info(_THIS_MODULE,__LINE__,_COMPONENT); \
+ acpi_os_printf ACPI_PARAM_LIST(fp);}
+#define ACPI_REPORT_ERROR(fp) {acpi_ut_report_error(_THIS_MODULE,__LINE__,_COMPONENT); \
+ acpi_os_printf ACPI_PARAM_LIST(fp);}
+#define ACPI_REPORT_WARNING(fp) {acpi_ut_report_warning(_THIS_MODULE,__LINE__,_COMPONENT); \
+ acpi_os_printf ACPI_PARAM_LIST(fp);}
#else
-#define REPORT_INFO(fp) {acpi_ut_report_info("ACPI",__LINE__,_COMPONENT); \
- acpi_os_printf PARAM_LIST(fp);}
-#define REPORT_ERROR(fp) {acpi_ut_report_error("ACPI",__LINE__,_COMPONENT); \
- acpi_os_printf PARAM_LIST(fp);}
-#define REPORT_WARNING(fp) {acpi_ut_report_warning("ACPI",__LINE__,_COMPONENT); \
- acpi_os_printf PARAM_LIST(fp);}
+#define ACPI_REPORT_INFO(fp) {acpi_ut_report_info("ACPI",__LINE__,_COMPONENT); \
+ acpi_os_printf ACPI_PARAM_LIST(fp);}
+#define ACPI_REPORT_ERROR(fp) {acpi_ut_report_error("ACPI",__LINE__,_COMPONENT); \
+ acpi_os_printf ACPI_PARAM_LIST(fp);}
+#define ACPI_REPORT_WARNING(fp) {acpi_ut_report_warning("ACPI",__LINE__,_COMPONENT); \
+ acpi_os_printf ACPI_PARAM_LIST(fp);}
#endif
/* Error reporting. These versions pass thru the module and line# */
-#define _REPORT_INFO(a,b,c,fp) {acpi_ut_report_info(a,b,c); \
- acpi_os_printf PARAM_LIST(fp);}
-#define _REPORT_ERROR(a,b,c,fp) {acpi_ut_report_error(a,b,c); \
- acpi_os_printf PARAM_LIST(fp);}
-#define _REPORT_WARNING(a,b,c,fp) {acpi_ut_report_warning(a,b,c); \
- acpi_os_printf PARAM_LIST(fp);}
+#define _ACPI_REPORT_INFO(a,b,c,fp) {acpi_ut_report_info(a,b,c); \
+ acpi_os_printf ACPI_PARAM_LIST(fp);}
+#define _ACPI_REPORT_ERROR(a,b,c,fp) {acpi_ut_report_error(a,b,c); \
+ acpi_os_printf ACPI_PARAM_LIST(fp);}
+#define _ACPI_REPORT_WARNING(a,b,c,fp) {acpi_ut_report_warning(a,b,c); \
+ acpi_os_printf ACPI_PARAM_LIST(fp);}
/*
* Debug macros that are conditionally compiled
#ifdef ACPI_DEBUG
-#define MODULE_NAME(name) static char *_THIS_MODULE = name;
+#define ACPI_MODULE_NAME(name) static char *_THIS_MODULE = name;
/*
* Function entry tracing.
* as a local string ("_Proc_name) so that it can be also used by the function exit macros below.
*/
-#define PROC_NAME(a) acpi_debug_print_info _dbg; \
+#define ACPI_FUNCTION_NAME(a) acpi_debug_print_info _dbg; \
_dbg.component_id = _COMPONENT; \
_dbg.proc_name = a; \
_dbg.module_name = _THIS_MODULE;
-#define FUNCTION_TRACE(a) PROC_NAME(a)\
- acpi_ut_trace(__LINE__,&_dbg)
-#define FUNCTION_TRACE_PTR(a,b) PROC_NAME(a)\
- acpi_ut_trace_ptr(__LINE__,&_dbg,(void *)b)
-#define FUNCTION_TRACE_U32(a,b) PROC_NAME(a)\
- acpi_ut_trace_u32(__LINE__,&_dbg,(u32)b)
-#define FUNCTION_TRACE_STR(a,b) PROC_NAME(a)\
- acpi_ut_trace_str(__LINE__,&_dbg,(NATIVE_CHAR *)b)
+#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a)\
+ acpi_ut_trace(__LINE__,&_dbg)
+#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a)\
+ acpi_ut_trace_ptr(__LINE__,&_dbg,(void *)b)
+#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a)\
+ acpi_ut_trace_u32(__LINE__,&_dbg,(u32)b)
+#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a)\
+ acpi_ut_trace_str(__LINE__,&_dbg,(NATIVE_CHAR *)b)
-#define FUNCTION_ENTRY() acpi_ut_track_stack_ptr()
+#define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr()
/*
* Function exit tracing.
/* Conditional execution */
-#define DEBUG_EXEC(a) a
-#define NORMAL_EXEC(a)
+#define ACPI_DEBUG_EXEC(a) a
+#define ACPI_NORMAL_EXEC(a)
-#define DEBUG_DEFINE(a) a;
-#define DEBUG_ONLY_MEMBERS(a) a;
+#define ACPI_DEBUG_DEFINE(a) a;
+#define ACPI_DEBUG_ONLY_MEMBERS(a) a;
#define _OPCODE_NAMES
#define _VERBOSE_STRUCTURES
/* Stack and buffer dumping */
-#define DUMP_STACK_ENTRY(a) acpi_ex_dump_operand(a)
-#define DUMP_OPERANDS(a,b,c,d,e) acpi_ex_dump_operands(a,b,c,d,e,_THIS_MODULE,__LINE__)
+#define ACPI_DUMP_STACK_ENTRY(a) acpi_ex_dump_operand(a)
+#define ACPI_DUMP_OPERANDS(a,b,c,d,e) acpi_ex_dump_operands(a,b,c,d,e,_THIS_MODULE,__LINE__)
-#define DUMP_ENTRY(a,b) acpi_ns_dump_entry (a,b)
-#define DUMP_TABLES(a,b) acpi_ns_dump_tables(a,b)
-#define DUMP_PATHNAME(a,b,c,d) acpi_ns_dump_pathname(a,b,c,d)
-#define DUMP_RESOURCE_LIST(a) acpi_rs_dump_resource_list(a)
-#define DUMP_BUFFER(a,b) acpi_ut_dump_buffer((u8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT)
-#define BREAK_MSG(a) acpi_os_signal (ACPI_SIGNAL_BREAKPOINT,(a))
+#define ACPI_DUMP_ENTRY(a,b) acpi_ns_dump_entry (a,b)
+#define ACPI_DUMP_TABLES(a,b) acpi_ns_dump_tables(a,b)
+#define ACPI_DUMP_PATHNAME(a,b,c,d) acpi_ns_dump_pathname(a,b,c,d)
+#define ACPI_DUMP_RESOURCE_LIST(a) acpi_rs_dump_resource_list(a)
+#define ACPI_DUMP_BUFFER(a,b) acpi_ut_dump_buffer((u8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT)
+#define ACPI_BREAK_MSG(a) acpi_os_signal (ACPI_SIGNAL_BREAKPOINT,(a))
/*
* Generate INT3 on ACPI_ERROR (Debug only!)
*/
-#define ERROR_BREAK
-#ifdef ERROR_BREAK
-#define BREAK_ON_ERROR(lvl) if ((lvl)&ACPI_ERROR) acpi_os_signal(ACPI_SIGNAL_BREAKPOINT,"Fatal error encountered\n")
+#define ACPI_ERROR_BREAK
+#ifdef ACPI_ERROR_BREAK
+#define ACPI_BREAK_ON_ERROR(lvl) if ((lvl)&ACPI_ERROR) \
+ acpi_os_signal(ACPI_SIGNAL_BREAKPOINT,"Fatal error encountered\n")
#else
-#define BREAK_ON_ERROR(lvl)
+#define ACPI_BREAK_ON_ERROR(lvl)
#endif
/*
* 2) Debug error level or trace level for the print statement is enabled
*/
-#define ACPI_DEBUG_PRINT(pl) acpi_ut_debug_print PARAM_LIST(pl)
-#define ACPI_DEBUG_PRINT_RAW(pl) acpi_ut_debug_print_raw PARAM_LIST(pl)
+#define ACPI_DEBUG_PRINT(pl) acpi_ut_debug_print ACPI_PARAM_LIST(pl)
+#define ACPI_DEBUG_PRINT_RAW(pl) acpi_ut_debug_print_raw ACPI_PARAM_LIST(pl)
#else
* leaving no executable debug code!
*/
-#define MODULE_NAME(name)
+#define ACPI_MODULE_NAME(name)
#define _THIS_MODULE ""
-#define DEBUG_EXEC(a)
-#define NORMAL_EXEC(a) a;
-
-#define DEBUG_DEFINE(a)
-#define DEBUG_ONLY_MEMBERS(a)
-#define PROC_NAME(a)
-#define FUNCTION_TRACE(a)
-#define FUNCTION_TRACE_PTR(a,b)
-#define FUNCTION_TRACE_U32(a,b)
-#define FUNCTION_TRACE_STR(a,b)
-#define FUNCTION_EXIT
-#define FUNCTION_STATUS_EXIT(s)
-#define FUNCTION_VALUE_EXIT(s)
-#define FUNCTION_ENTRY()
-#define DUMP_STACK_ENTRY(a)
-#define DUMP_OPERANDS(a,b,c,d,e)
-#define DUMP_ENTRY(a,b)
-#define DUMP_TABLES(a,b)
-#define DUMP_PATHNAME(a,b,c,d)
-#define DUMP_RESOURCE_LIST(a)
-#define DUMP_BUFFER(a,b)
+#define ACPI_DEBUG_EXEC(a)
+#define ACPI_NORMAL_EXEC(a) a;
+
+#define ACPI_DEBUG_DEFINE(a)
+#define ACPI_DEBUG_ONLY_MEMBERS(a)
+#define ACPI_FUNCTION_NAME(a)
+#define ACPI_FUNCTION_TRACE(a)
+#define ACPI_FUNCTION_TRACE_PTR(a,b)
+#define ACPI_FUNCTION_TRACE_U32(a,b)
+#define ACPI_FUNCTION_TRACE_STR(a,b)
+#define ACPI_FUNCTION_EXIT
+#define ACPI_FUNCTION_STATUS_EXIT(s)
+#define ACPI_FUNCTION_VALUE_EXIT(s)
+#define ACPI_FUNCTION_ENTRY()
+#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)
#define ACPI_DEBUG_PRINT(pl)
#define ACPI_DEBUG_PRINT_RAW(pl)
-#define BREAK_MSG(a)
+#define ACPI_BREAK_MSG(a)
#define return_VOID return
#define return_ACPI_STATUS(s) return(s)
* DEBUG_PRINT stuff (set by ACPI_DEBUG) is on, or not.
*/
#ifdef ENABLE_DEBUGGER
-#define DEBUGGER_EXEC(a) a
+#define ACPI_DEBUGGER_EXEC(a) a
#else
-#define DEBUGGER_EXEC(a)
+#define ACPI_DEBUGGER_EXEC(a)
#endif
* we are using ACPI_DEBUG to get the debug output
*/
#ifdef _IA16
-#undef DEBUG_ONLY_MEMBERS
+#undef ACPI_DEBUG_ONLY_MEMBERS
#undef _VERBOSE_STRUCTURES
-#define DEBUG_ONLY_MEMBERS(a)
+#define ACPI_DEBUG_ONLY_MEMBERS(a)
#endif
* 1) Set name to blanks
* 2) Copy the object name
*/
-#define ADD_OBJECT_NAME(a,b) MEMSET (a->common.name, ' ', sizeof (a->common.name));\
- STRNCPY (a->common.name, acpi_gbl_ns_type_names[b], sizeof (a->common.name))
+#define ACPI_ADD_OBJECT_NAME(a,b) ACPI_MEMSET (a->common.name, ' ', sizeof (a->common.name));\
+ ACPI_STRNCPY (a->common.name, acpi_gbl_ns_type_names[b], sizeof (a->common.name))
#else
-#define ADD_OBJECT_NAME(a,b)
+#define ACPI_ADD_OBJECT_NAME(a,b)
#endif
/* Memory allocation */
-#define ACPI_MEM_ALLOCATE(a) acpi_os_allocate(a)
-#define ACPI_MEM_CALLOCATE(a) acpi_os_callocate(a)
+#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate(a,_COMPONENT,_THIS_MODULE,__LINE__)
+#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate(a, _COMPONENT,_THIS_MODULE,__LINE__)
#define ACPI_MEM_FREE(a) acpi_os_free(a)
#define ACPI_MEM_TRACKING(a)
/* Memory allocation */
-#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate(a,_COMPONENT,_THIS_MODULE,__LINE__)
-#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate(a, _COMPONENT,_THIS_MODULE,__LINE__)
-#define ACPI_MEM_FREE(a) acpi_ut_free(a,_COMPONENT,_THIS_MODULE,__LINE__)
+#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate_and_track(a,_COMPONENT,_THIS_MODULE,__LINE__)
+#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate_and_track(a, _COMPONENT,_THIS_MODULE,__LINE__)
+#define ACPI_MEM_FREE(a) acpi_ut_free_and_track(a,_COMPONENT,_THIS_MODULE,__LINE__)
#define ACPI_MEM_TRACKING(a) a
#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
/******************************************************************************
*
* Name: acnamesp.h - Namespace subcomponent prototypes and defines
- * $Revision: 110 $
+ * $Revision: 123 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/* To search the entire name space, pass this as Search_base */
-#define NS_ALL ((acpi_handle)0)
+#define ACPI_NS_ALL ((acpi_handle)0)
/*
* Elements of Acpi_ns_properties are bit significant
* and should be one-to-one with values of acpi_object_type
*/
-#define NSP_NORMAL 0
-#define NSP_NEWSCOPE 1 /* a definition of this type opens a name scope */
-#define NSP_LOCAL 2 /* suppress search of enclosing scopes */
+#define ACPI_NS_NORMAL 0
+#define ACPI_NS_NEWSCOPE 1 /* a definition of this type opens a name scope */
+#define ACPI_NS_LOCAL 2 /* suppress search of enclosing scopes */
/* Definitions of the predefined namespace names */
-#define ACPI_UNKNOWN_NAME (u32) 0x3F3F3F3F /* Unknown name is "????" */
-#define ACPI_ROOT_NAME (u32) 0x2F202020 /* Root name is "/ " */
-#define ACPI_SYS_BUS_NAME (u32) 0x5F53425F /* Sys bus name is "_SB_" */
+#define ACPI_UNKNOWN_NAME (u32) 0x3F3F3F3F /* Unknown name is "????" */
+#define ACPI_ROOT_NAME (u32) 0x2F202020 /* Root name is "/ " */
+#define ACPI_SYS_BUS_NAME (u32) 0x5F53425F /* Sys bus name is "_SB_" */
-#define NS_ROOT_PATH "/"
-#define NS_SYSTEM_BUS "_SB_"
+#define ACPI_NS_ROOT_PATH "\\"
+#define ACPI_NS_SYSTEM_BUS "_SB_"
/* Flags for Acpi_ns_lookup, Acpi_ns_search_and_enter */
-#define NS_NO_UPSEARCH 0
-#define NS_SEARCH_PARENT 0x01
-#define NS_DONT_OPEN_SCOPE 0x02
-#define NS_NO_PEER_SEARCH 0x04
-#define NS_ERROR_IF_FOUND 0x08
+#define ACPI_NS_NO_UPSEARCH 0
+#define ACPI_NS_SEARCH_PARENT 0x01
+#define ACPI_NS_DONT_OPEN_SCOPE 0x02
+#define ACPI_NS_NO_PEER_SEARCH 0x04
+#define ACPI_NS_ERROR_IF_FOUND 0x08
-#define NS_WALK_UNLOCK TRUE
-#define NS_WALK_NO_UNLOCK FALSE
+#define ACPI_NS_WALK_UNLOCK TRUE
+#define ACPI_NS_WALK_NO_UNLOCK FALSE
acpi_status
acpi_status
acpi_ns_walk_namespace (
- acpi_object_type8 type,
+ acpi_object_type type,
acpi_handle start_object,
u32 max_depth,
u8 unlock_before_callback,
acpi_namespace_node *
acpi_ns_get_next_node (
- acpi_object_type8 type,
+ acpi_object_type type,
acpi_namespace_node *parent,
acpi_namespace_node *child);
acpi_ns_lookup (
acpi_generic_state *scope_info,
NATIVE_CHAR *name,
- acpi_object_type8 type,
- operating_mode interpreter_mode,
+ acpi_object_type type,
+ acpi_interpreter_mode interpreter_mode,
u32 flags,
acpi_walk_state *walk_state,
acpi_namespace_node **ret_node);
u32 level,
u32 component);
+void
+acpi_ns_print_pathname (
+ u32 num_segments,
+ char *pathname);
+
void
acpi_ns_dump_root_devices (
void);
void
acpi_ns_dump_objects (
- acpi_object_type8 type,
+ acpi_object_type type,
u8 display_type,
u32 max_depth,
u32 ownder_id,
/*
- * Scope manipulation - nsscope
+ * Name and Scope manipulation - nsnames
*/
u32
acpi_ns_opens_scope (
- acpi_object_type8 type);
+ acpi_object_type type);
NATIVE_CHAR *
-acpi_ns_get_table_pathname (
+acpi_ns_get_external_pathname (
acpi_namespace_node *node);
NATIVE_CHAR *
acpi_status
acpi_ns_handle_to_pathname (
- acpi_handle obj_handle,
- u32 *buf_size,
- NATIVE_CHAR *user_buffer);
+ acpi_handle target_handle,
+ acpi_buffer *buffer);
u8
acpi_ns_pattern_match (
NATIVE_CHAR *search_for);
acpi_status
-acpi_ns_get_node (
- NATIVE_CHAR *pathname,
+acpi_ns_get_node_by_path (
+ NATIVE_CHAR *external_pathname,
acpi_namespace_node *in_prefix_node,
+ u32 flags,
acpi_namespace_node **out_node);
-u32
+ACPI_SIZE
acpi_ns_get_pathname_length (
acpi_namespace_node *node);
/*
- * Object management for NTEs - nsobject
+ * Object management for namespace nodes - nsobject
*/
acpi_status
acpi_ns_attach_object (
acpi_namespace_node *node,
acpi_operand_object *object,
- acpi_object_type8 type);
+ acpi_object_type type);
+
+acpi_operand_object *
+acpi_ns_get_attached_object (
+ acpi_namespace_node *node);
+
+acpi_operand_object *
+acpi_ns_get_secondary_object (
+ acpi_operand_object *obj_desc);
+
+acpi_status
+acpi_ns_attach_data (
+ acpi_namespace_node *node,
+ ACPI_OBJECT_HANDLER handler,
+ void *data);
+
+acpi_status
+acpi_ns_detach_data (
+ acpi_namespace_node *node,
+ ACPI_OBJECT_HANDLER handler);
+
+acpi_status
+acpi_ns_get_attached_data (
+ acpi_namespace_node *node,
+ ACPI_OBJECT_HANDLER handler,
+ void **data);
/*
u32 entry_name,
acpi_walk_state *walk_state,
acpi_namespace_node *node,
- operating_mode interpreter_mode,
- acpi_object_type8 type,
+ acpi_interpreter_mode interpreter_mode,
+ acpi_object_type type,
u32 flags,
acpi_namespace_node **ret_node);
acpi_ns_search_node (
u32 entry_name,
acpi_namespace_node *node,
- acpi_object_type8 type,
+ acpi_object_type type,
acpi_namespace_node **ret_node);
void
acpi_walk_state *walk_state,
acpi_namespace_node *parent_node, /* Parent */
acpi_namespace_node *node, /* New Child*/
- acpi_object_type8 type);
+ acpi_object_type type);
/*
acpi_ns_valid_path_separator (
NATIVE_CHAR sep);
-acpi_object_type8
+acpi_object_type
acpi_ns_get_type (
acpi_namespace_node *node);
-void *
-acpi_ns_get_attached_object (
- acpi_namespace_node *node);
-
u32
acpi_ns_local (
- acpi_object_type8 type);
+ acpi_object_type type);
acpi_status
acpi_ns_build_internal_name (
void);
acpi_namespace_node *
-acpi_ns_get_parent_object (
+acpi_ns_get_parent_node (
acpi_namespace_node *node);
/******************************************************************************
*
* Name: acobject.h - Definition of acpi_operand_object (Internal object only)
- * $Revision: 93 $
+ * $Revision: 106 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*/
-#define ACPI_OBJECT_COMMON_HEADER /* SIZE/ALIGNMENT: 32-bits plus trailing 8-bit flag */\
- u8 data_type; /* To differentiate various internal objs */\
+#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_obj *next_object; /* Objects linked to parent NS node */\
u8 flags; \
/* Defines for flag byte above */
-#define AOPOBJ_STATIC_ALLOCATION 0x1
-#define AOPOBJ_STATIC_POINTER 0x2
-#define AOPOBJ_DATA_VALID 0x4
-#define AOPOBJ_ZERO_CONST 0x4
-#define AOPOBJ_INITIALIZED 0x8
+#define AOPOBJ_RESERVED 0x01
+#define AOPOBJ_STATIC_POINTER 0x02
+#define AOPOBJ_DATA_VALID 0x04
+#define AOPOBJ_OBJECT_INITIALIZED 0x08
+#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
+ * "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 access_flags;\
- u16 bit_length; /* Length of field in bits */\
- u32 base_byte_offset; /* Byte offset within containing object */\
- u8 access_bit_width; /* Read/Write size in bits (from ASL Access_type)*/\
+ u8 field_flags; /* Access, update, and lock bits */\
+ u8 attribute; /* From Access_as keyword */\
u8 access_byte_width; /* Read/Write size in bytes */\
- u8 update_rule; /* How neighboring field bits are handled */\
- u8 lock_rule; /* Global Lock: 1 = "Must Lock" */\
+ 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 datum_valid_bits; /* Valid bit in first "Field datum" */\
u8 end_field_valid_bits; /* Valid bits in the last "field datum" */\
u8 end_buffer_valid_bits; /* Valid bits in the last "buffer datum" */\
- u32 value; /* Value to store into the Bank or Index register */
-
-
-/* Access flag bits */
-
-#define AFIELD_SINGLE_DATUM 0x1
+ u32 value; /* Value to store into the Bank or Index register */\
+ acpi_namespace_node *node; /* Link back to parent node */
/*
ACPI_OBJECT_COMMON_HEADER
ACPI_COMMON_BUFFER_INFO
u8 *pointer; /* Buffer value in AML stream or in allocated space */
+ acpi_namespace_node *node; /* Link back to parent node */
} ACPI_OBJECT_BUFFER;
u16 sync_level;
u16 acquisition_depth;
+ struct acpi_thread_state *owner_thread;
void *semaphore;
- void *owner;
union acpi_operand_obj *prev; /* Link for list of acquired mutexes */
union acpi_operand_obj *next; /* Link for list of acquired mutexes */
u8 space_id;
u32 length;
ACPI_PHYSICAL_ADDRESS address;
- union acpi_operand_obj *extra; /* Pointer to executable AML (in region definition) */
union acpi_operand_obj *addr_handler; /* Handler for system notifies */
acpi_namespace_node *node; /* containing object */
ACPI_COMMON_FIELD_INFO
union acpi_operand_obj *region_obj; /* Containing Op_region object */
- union acpi_operand_obj *bank_register_obj; /* Bank_select Register object */
+ union acpi_operand_obj *bank_obj; /* Bank_select Register object */
} ACPI_OBJECT_BANK_FIELD;
ACPI_OBJECT_COMMON_HEADER
ACPI_COMMON_FIELD_INFO
- union acpi_operand_obj *extra; /* Pointer to executable AML (in field definition) */
- acpi_namespace_node *node; /* Parent (containing) object node */
union acpi_operand_obj *buffer_obj; /* Containing Buffer object */
} ACPI_OBJECT_BUFFER_FIELD;
/* Flags for address handler */
-#define ADDR_HANDLER_DEFAULT_INSTALLED 0x1
+#define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x1
typedef struct /* ADDRESS HANDLER */
} ACPI_OBJECT_EXTRA;
+typedef struct /* DATA */
+{
+ ACPI_OBJECT_COMMON_HEADER
+ ACPI_OBJECT_HANDLER handler;
+ void *pointer;
+
+} ACPI_OBJECT_DATA;
+
+
/******************************************************************************
*
* acpi_operand_object Descriptor - a giant union of all of the above
ACPI_OBJECT_NOTIFY_HANDLER notify_handler;
ACPI_OBJECT_ADDR_HANDLER addr_handler;
ACPI_OBJECT_EXTRA extra;
+ ACPI_OBJECT_DATA data;
} acpi_operand_object;
/******************************************************************************
*
* Name: acoutput.h -- debug output
- * $Revision: 84 $
+ * $Revision: 86 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define ACPI_DEBUGGER 0x00000200
#define ACPI_OS_SERVICES 0x00000400
-#define ACPI_BUS 0x00010000
-#define ACPI_SYSTEM 0x00020000
-#define ACPI_POWER 0x00040000
-#define ACPI_EC 0x00080000
-#define ACPI_AC_ADAPTER 0x00100000
-#define ACPI_BATTERY 0x00200000
-#define ACPI_BUTTON 0x00400000
-#define ACPI_PROCESSOR 0x00800000
-#define ACPI_THERMAL 0x01000000
-#define ACPI_FAN 0x02000000
-
-#define ACPI_ALL_COMPONENTS 0x0FFFFFFF
+#define ACPI_ALL_COMPONENTS 0x00000FFF
#define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS)
+/* Component IDs for ACPI tools and utilities */
+
+#define ACPI_COMPILER 0x00001000
+#define ACPI_TOOLS 0x00002000
-#define ACPI_COMPILER 0x10000000
-#define ACPI_TOOLS 0x20000000
+/* Component IDs reserved for ACPI drivers */
+#define ACPI_ALL_DRIVERS 0xFFFF0000
/*
* Raw debug output levels, do not use these in the DEBUG_PRINT macros
/******************************************************************************
*
* Module Name: acparser.h - AML Parser subcomponent prototypes and defines
- * $Revision: 54 $
+ * $Revision: 58 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define __ACPARSER_H__
-#define OP_HAS_RETURN_VALUE 1
+#define OP_HAS_RETURN_VALUE 1
/* variable # arguments */
-#define ACPI_VAR_ARGS ACPI_UINT32_MAX
-
-/* maximum virtual address */
-
-#define ACPI_MAX_AML ((u8 *)(~0UL))
+#define ACPI_VAR_ARGS ACPI_UINT32_MAX
#define ACPI_PARSE_DELETE_TREE 0x0001
#define ACPI_PARSE_EXECUTE 0x0030
#define ACPI_PARSE_MODE_MASK 0x0030
-/* psapi - Parser external interfaces */
+
+/* Parser external interfaces */
acpi_status
acpi_psx_load_table (
acpi_operand_object **params,
acpi_operand_object **return_obj_desc);
+
/******************************************************************************
*
* Parser interfaces
void
acpi_ps_get_next_simple_arg (
acpi_parse_state *parser_state,
- u32 arg_type, /* type of argument */
- acpi_parse_object *arg); /* (OUT) argument data */
+ u32 arg_type,
+ acpi_parse_object *arg);
void
acpi_ps_get_next_namepath (
u32 *arg_count);
+/* psfind */
+
+acpi_parse_object *
+acpi_ps_find_name (
+ acpi_parse_object *scope,
+ u32 name,
+ u32 opcode);
+
+acpi_parse_object*
+acpi_ps_get_parent (
+ acpi_parse_object *op);
+
+
/* psopcode - AML Opcode information */
const acpi_opcode_info *
/* psparse - top level parsing routines */
+u32
+acpi_ps_get_opcode_size (
+ u32 opcode);
+
+u8
+acpi_ps_complete_this_op (
+ acpi_walk_state *walk_state,
+ acpi_parse_object *op);
+
+acpi_status
+acpi_ps_next_parse_state (
+ acpi_walk_state *walk_state,
+ acpi_parse_object *op,
+ acpi_status callback_status);
+
acpi_status
acpi_ps_find_object (
acpi_walk_state *walk_state,
acpi_parse_object *op,
acpi_parse_upwards ascending_callback);
+acpi_status
+acpi_ps_delete_completed_op (
+ acpi_walk_state *walk_state);
+
/* psutils - parser utilities */
/******************************************************************************
*
* Name: acpi.h - Master include file, Publics and external data.
- * $Revision: 54 $
+ * $Revision: 55 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* Types specific to the OS service interfaces
*/
-typedef
-u32 (*OSD_HANDLER) (
+typedef u32
+(ACPI_SYSTEM_XFACE *OSD_HANDLER) (
void *context);
-typedef
-void (*OSD_EXECUTION_CALLBACK) (
+typedef void
+(ACPI_SYSTEM_XFACE *OSD_EXECUTION_CALLBACK) (
void *context);
void *
acpi_os_allocate (
- u32 size);
-
-void *
-acpi_os_callocate (
- u32 size);
+ ACPI_SIZE size);
void
acpi_os_free (
acpi_status
acpi_os_map_memory (
ACPI_PHYSICAL_ADDRESS physical_address,
- u32 length,
+ ACPI_SIZE size,
void **logical_address);
void
acpi_os_unmap_memory (
void *logical_address,
- u32 length);
+ ACPI_SIZE size);
acpi_status
acpi_os_get_physical_address (
acpi_status
acpi_os_write_port (
ACPI_IO_ADDRESS address,
- NATIVE_UINT value,
+ acpi_integer value,
u32 width);
acpi_status
acpi_os_write_memory (
ACPI_PHYSICAL_ADDRESS address,
- NATIVE_UINT value,
+ acpi_integer value,
u32 width);
acpi_os_write_pci_configuration (
acpi_pci_id *pci_id,
u32 register,
- NATIVE_UINT value,
+ acpi_integer value,
u32 width);
* Debug print routines
*/
-s32
+void ACPI_INTERNAL_VAR_XFACE
acpi_os_printf (
const NATIVE_CHAR *format,
...);
-s32
+void
acpi_os_vprintf (
const NATIVE_CHAR *format,
va_list args);
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
acpi_format_exception (
acpi_status exception);
+acpi_status
+acpi_purge_cached_objects (
+ void);
+
/*
* ACPI Memory manager
acpi_string pathname,
acpi_handle *ret_handle);
+acpi_status
+acpi_attach_data (
+ acpi_handle obj_handle,
+ ACPI_OBJECT_HANDLER handler,
+ void *data);
+
+acpi_status
+acpi_detach_data (
+ acpi_handle obj_handle,
+ ACPI_OBJECT_HANDLER handler);
+
+acpi_status
+acpi_get_data (
+ acpi_handle obj_handle,
+ ACPI_OBJECT_HANDLER handler,
+ void **data);
+
/*
* Object manipulation and enumeration
acpi_status
acpi_acquire_global_lock (
- void);
+ u32 timeout,
+ u32 *handle);
acpi_status
acpi_release_global_lock (
- void);
+ u32 handle);
acpi_status
acpi_remove_gpe_handler (
acpi_get_firmware_waking_vector (
ACPI_PHYSICAL_ADDRESS *physical_address);
+
+acpi_status
+acpi_enter_sleep_state_prep (
+ u8 sleep_state);
+
acpi_status
acpi_enter_sleep_state (
u8 sleep_state);
/******************************************************************************
*
* Name: acresrc.h - Resource Manager function prototypes
- * $Revision: 25 $
+ * $Revision: 30 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
acpi_status
acpi_rs_create_resource_list (
acpi_operand_object *byte_stream_buffer,
- u8 *output_buffer,
- u32 *output_buffer_length);
+ acpi_buffer *output_buffer);
acpi_status
acpi_rs_create_byte_stream (
acpi_resource *linked_list_buffer,
- u8 *output_buffer,
- u32 *output_buffer_length);
+ acpi_buffer *output_buffer);
acpi_status
acpi_rs_create_pci_routing_table (
- acpi_operand_object *method_return_object,
- u8 *output_buffer,
- u32 *output_buffer_length);
+ acpi_operand_object *package_object,
+ acpi_buffer *output_buffer);
/*
- *Function prototypes called from Acpi_rs_create*APIs
+ *Function prototypes called from Acpi_rs_create*
*/
void
acpi_rs_calculate_list_length (
u8 *byte_stream_buffer,
u32 byte_stream_buffer_length,
- u32 *size_needed);
+ ACPI_SIZE *size_needed);
acpi_status
acpi_rs_calculate_byte_stream_length (
acpi_resource *linked_list_buffer,
- u32 *size_needed);
+ ACPI_SIZE *size_needed);
acpi_status
acpi_rs_calculate_pci_routing_table_length (
acpi_operand_object *package_object,
- u32 *buffer_size_needed);
+ ACPI_SIZE *buffer_size_needed);
acpi_status
acpi_rs_byte_stream_to_list (
u8 *byte_stream_buffer,
u32 byte_stream_buffer_length,
- u8 **output_buffer);
+ u8 *output_buffer);
acpi_status
acpi_rs_list_to_byte_stream (
acpi_resource *linked_list,
u32 byte_stream_size_needed,
- u8 **output_buffer);
+ u8 *output_buffer);
acpi_status
acpi_rs_io_resource (
u8 *byte_stream_buffer,
- u32 *bytes_consumed,
+ ACPI_SIZE *bytes_consumed,
u8 **output_buffer,
- u32 *structure_size);
+ ACPI_SIZE *structure_size);
acpi_status
acpi_rs_fixed_io_resource (
u8 *byte_stream_buffer,
- u32 *bytes_consumed,
+ ACPI_SIZE *bytes_consumed,
u8 **output_buffer,
- u32 *structure_size);
+ ACPI_SIZE *structure_size);
acpi_status
acpi_rs_io_stream (
acpi_resource *linked_list,
u8 **output_buffer,
- u32 *bytes_consumed);
+ ACPI_SIZE *bytes_consumed);
acpi_status
acpi_rs_fixed_io_stream (
acpi_resource *linked_list,
u8 **output_buffer,
- u32 *bytes_consumed);
+ ACPI_SIZE *bytes_consumed);
acpi_status
acpi_rs_irq_resource (
u8 *byte_stream_buffer,
- u32 *bytes_consumed,
+ ACPI_SIZE *bytes_consumed,
u8 **output_buffer,
- u32 *structure_size);
+ ACPI_SIZE *structure_size);
acpi_status
acpi_rs_irq_stream (
acpi_resource *linked_list,
u8 **output_buffer,
- u32 *bytes_consumed);
+ ACPI_SIZE *bytes_consumed);
acpi_status
acpi_rs_dma_resource (
u8 *byte_stream_buffer,
- u32 *bytes_consumed,
+ ACPI_SIZE *bytes_consumed,
u8 **output_buffer,
- u32 *structure_size);
+ ACPI_SIZE *structure_size);
acpi_status
acpi_rs_dma_stream (
acpi_resource *linked_list,
u8 **output_buffer,
- u32 *bytes_consumed);
+ ACPI_SIZE *bytes_consumed);
acpi_status
acpi_rs_address16_resource (
u8 *byte_stream_buffer,
- u32 *bytes_consumed,
+ ACPI_SIZE *bytes_consumed,
u8 **output_buffer,
- u32 *structure_size);
+ ACPI_SIZE *structure_size);
acpi_status
acpi_rs_address16_stream (
acpi_resource *linked_list,
u8 **output_buffer,
- u32 *bytes_consumed);
+ ACPI_SIZE *bytes_consumed);
acpi_status
acpi_rs_address32_resource (
u8 *byte_stream_buffer,
- u32 *bytes_consumed,
+ ACPI_SIZE *bytes_consumed,
u8 **output_buffer,
- u32 *structure_size);
+ ACPI_SIZE *structure_size);
acpi_status
acpi_rs_address32_stream (
acpi_resource *linked_list,
u8 **output_buffer,
- u32 *bytes_consumed);
+ ACPI_SIZE *bytes_consumed);
acpi_status
acpi_rs_address64_resource (
u8 *byte_stream_buffer,
- u32 *bytes_consumed,
+ ACPI_SIZE *bytes_consumed,
u8 **output_buffer,
- u32 *structure_size);
+ ACPI_SIZE *structure_size);
acpi_status
acpi_rs_address64_stream (
acpi_resource *linked_list,
u8 **output_buffer,
- u32 *bytes_consumed);
+ ACPI_SIZE *bytes_consumed);
acpi_status
-acpi_rs_start_dependent_functions_resource (
+acpi_rs_start_depend_fns_resource (
u8 *byte_stream_buffer,
- u32 *bytes_consumed,
+ ACPI_SIZE *bytes_consumed,
u8 **output_buffer,
- u32 *structure_size);
+ ACPI_SIZE *structure_size);
acpi_status
-acpi_rs_end_dependent_functions_resource (
+acpi_rs_end_depend_fns_resource (
u8 *byte_stream_buffer,
- u32 *bytes_consumed,
+ ACPI_SIZE *bytes_consumed,
u8 **output_buffer,
- u32 *structure_size);
+ ACPI_SIZE *structure_size);
acpi_status
-acpi_rs_start_dependent_functions_stream (
+acpi_rs_start_depend_fns_stream (
acpi_resource *linked_list,
u8 **output_buffer,
- u32 *bytes_consumed);
+ ACPI_SIZE *bytes_consumed);
acpi_status
-acpi_rs_end_dependent_functions_stream (
+acpi_rs_end_depend_fns_stream (
acpi_resource *linked_list,
u8 **output_buffer,
- u32 *bytes_consumed);
+ ACPI_SIZE *bytes_consumed);
acpi_status
acpi_rs_memory24_resource (
u8 *byte_stream_buffer,
- u32 *bytes_consumed,
+ ACPI_SIZE *bytes_consumed,
u8 **output_buffer,
- u32 *structure_size);
+ ACPI_SIZE *structure_size);
acpi_status
acpi_rs_memory24_stream (
acpi_resource *linked_list,
u8 **output_buffer,
- u32 *bytes_consumed);
+ ACPI_SIZE *bytes_consumed);
acpi_status
acpi_rs_memory32_range_resource (
u8 *byte_stream_buffer,
- u32 *bytes_consumed,
+ ACPI_SIZE *bytes_consumed,
u8 **output_buffer,
- u32 *structure_size
-);
+ ACPI_SIZE *structure_size);
acpi_status
acpi_rs_fixed_memory32_resource (
u8 *byte_stream_buffer,
- u32 *bytes_consumed,
+ ACPI_SIZE *bytes_consumed,
u8 **output_buffer,
- u32 *structure_size);
+ ACPI_SIZE *structure_size);
acpi_status
acpi_rs_memory32_range_stream (
acpi_resource *linked_list,
u8 **output_buffer,
- u32 *bytes_consumed);
+ ACPI_SIZE *bytes_consumed);
acpi_status
acpi_rs_fixed_memory32_stream (
acpi_resource *linked_list,
u8 **output_buffer,
- u32 *bytes_consumed);
+ ACPI_SIZE *bytes_consumed);
acpi_status
acpi_rs_extended_irq_resource (
u8 *byte_stream_buffer,
- u32 *bytes_consumed,
+ ACPI_SIZE *bytes_consumed,
u8 **output_buffer,
- u32 *structure_size);
+ ACPI_SIZE *structure_size);
acpi_status
acpi_rs_extended_irq_stream (
acpi_resource *linked_list,
u8 **output_buffer,
- u32 *bytes_consumed);
+ ACPI_SIZE *bytes_consumed);
acpi_status
acpi_rs_end_tag_resource (
u8 *byte_stream_buffer,
- u32 *bytes_consumed,
+ ACPI_SIZE *bytes_consumed,
u8 **output_buffer,
- u32 *structure_size);
+ ACPI_SIZE *structure_size);
acpi_status
acpi_rs_end_tag_stream (
acpi_resource *linked_list,
u8 **output_buffer,
- u32 *bytes_consumed);
+ ACPI_SIZE *bytes_consumed);
acpi_status
acpi_rs_vendor_resource (
u8 *byte_stream_buffer,
- u32 *bytes_consumed,
+ ACPI_SIZE *bytes_consumed,
u8 **output_buffer,
- u32 *structure_size);
+ ACPI_SIZE *structure_size);
acpi_status
acpi_rs_vendor_stream (
acpi_resource *linked_list,
u8 **output_buffer,
- u32 *bytes_consumed);
+ ACPI_SIZE *bytes_consumed);
u8
acpi_rs_get_resource_type (
/******************************************************************************
*
* Name: acstruct.h - Internal structs
- * $Revision: 10 $
+ * $Revision: 16 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the tree (for whatever reason), and for control method execution.
*/
-#define NEXT_OP_DOWNWARD 1
-#define NEXT_OP_UPWARD 2
+#define ACPI_NEXT_OP_DOWNWARD 1
+#define ACPI_NEXT_OP_UPWARD 2
-#define WALK_NON_METHOD 0
-#define WALK_METHOD 1
-#define WALK_METHOD_RESTART 2
+#define ACPI_WALK_NON_METHOD 0
+#define ACPI_WALK_METHOD 1
+#define ACPI_WALK_METHOD_RESTART 2
typedef struct acpi_walk_state
{
u8 num_operands; /* Stack pointer for Operands[] array */
u8 return_used;
u8 walk_type;
- u16 current_sync_level; /* Mutex Sync (nested acquire) level */
u16 opcode; /* Current AML opcode */
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;
u32 prev_arg_types;
union acpi_operand_obj *return_desc; /* Return object, if any */
acpi_generic_state *scope_info; /* Stack of nested scopes */
-/* TBD: Obsolete with removal of WALK procedure ? */
acpi_parse_object *prev_op; /* Last op that was processed */
acpi_parse_object *next_op; /* next op to be processed */
-
-
acpi_parse_downwards descending_callback;
acpi_parse_upwards ascending_callback;
- struct acpi_walk_list *walk_list;
+ ACPI_THREAD_STATE *thread;
struct acpi_walk_state *next; /* Next Walk_state in list */
} acpi_walk_state;
-/*
- * Walk list - head of a tree of walk states. Multiple walk states are created when there
- * are nested control methods executing.
- */
-typedef struct acpi_walk_list
-{
-
- acpi_walk_state *walk_state;
- ACPI_OBJECT_MUTEX acquired_mutex_list; /* List of all currently acquired mutexes */
-
-} acpi_walk_list;
-
-
/* Info used by Acpi_ps_init_objects */
typedef struct acpi_init_walk_info
} acpi_init_walk_info;
-/* Info used by TBD */
+/* Info used by Acpi_ns_initialize_devices */
typedef struct acpi_device_walk_info
{
/******************************************************************************
*
* Name: actables.h - ACPI table management
- * $Revision: 32 $
+ * $Revision: 35 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
acpi_table_header *table_ptr,
acpi_table_desc *table_info);
+acpi_status
+acpi_tb_match_signature (
+ NATIVE_CHAR *signature,
+ acpi_table_desc *table_info);
+
acpi_status
acpi_tb_recognize_table (
acpi_table_header *table_ptr,
* tbutils - common table utilities
*/
+acpi_status
+acpi_tb_find_table (
+ NATIVE_CHAR *signature,
+ NATIVE_CHAR *oem_id,
+ NATIVE_CHAR *oem_table_id,
+ acpi_table_header **table_ptr);
+
acpi_status
acpi_tb_map_acpi_table (
ACPI_PHYSICAL_ADDRESS physical_address,
/******************************************************************************
*
* Name: actbl.h - Table data structures defined in ACPI specification
- * $Revision: 46 $
+ * $Revision: 52 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
* Values for description table header signatures
*/
-
#define RSDP_NAME "RSDP"
#define RSDP_SIG "RSD PTR " /* RSDT Pointer signature */
#define APIC_SIG "APIC" /* Multiple APIC Description Table */
#define XSDT_SIG "XSDT" /* Extended System Description Table */
#define SSDT_SIG "SSDT" /* Secondary System Description Table */
#define SBST_SIG "SBST" /* Smart Battery Specification Table */
-#define SPIC_SIG "SPIC" /* iosapic table */
+#define SPIC_SIG "SPIC" /* IOSAPIC table */
#define BOOT_SIG "BOOT" /* Boot table */
* Architecture-independent tables
* The architecture dependent tables are in separate files
*/
-
typedef struct /* Root System Descriptor Pointer */
{
- NATIVE_CHAR signature [8]; /* contains "RSD PTR " */
- u8 checksum; /* to make sum of struct == 0 */
+ NATIVE_CHAR signature [8]; /* ACPI signature, contains "RSD PTR " */
+ u8 checksum; /* To make sum of struct == 0 */
NATIVE_CHAR oem_id [6]; /* OEM identification */
u8 revision; /* Must be 0 for 1.0, 2 for 2.0 */
u32 rsdt_physical_address; /* 32-bit physical address of RSDT */
u32 length; /* XSDT Length in bytes including hdr */
u64 xsdt_physical_address; /* 64-bit physical address of XSDT */
u8 extended_checksum; /* Checksum of entire table */
- NATIVE_CHAR reserved [3]; /* reserved field must be 0 */
+ NATIVE_CHAR reserved [3]; /* Reserved field must be 0 */
} RSDP_DESCRIPTOR;
typedef struct /* ACPI common table header */
{
- NATIVE_CHAR signature [4]; /* identifies type of table */
- u32 length; /* length of table, in bytes,
- * including header */
- u8 revision; /* specification minor version # */
- u8 checksum; /* to make sum of entire table == 0 */
+ NATIVE_CHAR signature [4]; /* ACPI signature (4 ASCII characters) */
+ u32 length; /* Length of table, in bytes, including header */
+ u8 revision; /* ACPI Specification minor version # */
+ u8 checksum; /* To make sum of entire table == 0 */
NATIVE_CHAR oem_id [6]; /* OEM identification */
NATIVE_CHAR oem_table_id [8]; /* OEM table identification */
u32 oem_revision; /* OEM revision number */
typedef struct /* APIC Table */
{
- acpi_table_header header; /* table header */
+ acpi_table_header header; /* ACPI table header */
u32 local_apic_address; /* Physical address for accessing local APICs */
u32 PCATcompat : 1; /* a one indicates system also has dual 8259s */
u32 reserved1 : 31;
{
APIC_HEADER header;
u8 processor_apic_id; /* ACPI processor id */
- u8 local_apic_id; /* processor's local APIC id */
+ u8 local_apic_id; /* Processor's local APIC id */
u32 processor_enabled: 1; /* Processor is usable if set */
u32 reserved1 : 31;
{
APIC_HEADER header;
u8 io_apic_id; /* I/O APIC ID */
- u8 reserved; /* reserved - must be zero */
+ u8 reserved; /* Reserved - must be zero */
u32 io_apic_address; /* APIC's physical address */
- u32 vector; /* interrupt vector index where INTI
+ u32 vector; /* Interrupt vector index where INTI
* lines start */
} IO_APIC;
/*
-** IA64 TODO: Add SAPIC Tables
-*/
+ * IA64 TBD: Add SAPIC Tables
+ */
/*
-** IA64 TODO: Modify Smart Battery Description to comply with ACPI IA64
-** extensions.
-*/
+ * IA64 TBD: Modify Smart Battery Description to comply with ACPI IA64
+ * extensions.
+ */
typedef struct /* Smart Battery Description Table */
{
acpi_table_header header;
* and type of memory allocation (mapped or allocated) for each
* table for 1) when we exit, and 2) if a new table is installed
*/
-
#define ACPI_MEM_NOT_ALLOCATED 0
#define ACPI_MEM_ALLOCATED 1
#define ACPI_MEM_MAPPED 2
#define ACPI_TABLE_SINGLE 0
#define ACPI_TABLE_MULTIPLE 1
-
+#define ACPI_TABLE_EXECUTABLE 2
/* Data about each known table type */
{
NATIVE_CHAR *name;
NATIVE_CHAR *signature;
+ void **global_ptr;
u8 sig_length;
u8 flags;
- u16 status;
- void **global_ptr;
} ACPI_TABLE_SUPPORT;
+
/*
* Get the architecture-specific tables
*/
-
-#include "actbl1.h" /* Acpi 1.0 table defintions */
-#include "actbl71.h" /* Acpi 0.71 IA-64 Extension table defintions */
+#include "actbl1.h" /* Acpi 1.0 table definitions */
#include "actbl2.h" /* Acpi 2.0 table definitions */
#endif /* __ACTBL_H__ */
/******************************************************************************
*
* Name: actbl1.h - ACPI 1.0 tables
- * $Revision: 17 $
+ * $Revision: 21 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#pragma pack(1)
-/*************************************/
-/* ACPI Specification Rev 1.0 for */
-/* the Root System Description Table */
-/*************************************/
+/*
+ * ACPI 1.0 Root System Description Table (RSDT)
+ */
typedef struct
{
- acpi_table_header header; /* Table header */
+ acpi_table_header header; /* ACPI Table header */
u32 table_offset_entry [1]; /* Array of pointers to other */
/* ACPI tables */
} RSDT_DESCRIPTOR_REV1;
-/***************************************/
-/* ACPI Specification Rev 1.0 for */
-/* the Firmware ACPI Control Structure */
-/***************************************/
+/*
+ * ACPI 1.0 Firmware ACPI Control Structure (FACS)
+ */
typedef struct
{
- NATIVE_CHAR signature[4]; /* signature "FACS" */
- u32 length; /* length of structure, in bytes */
- u32 hardware_signature; /* hardware configuration signature */
+ NATIVE_CHAR signature[4]; /* ACPI Signature */
+ u32 length; /* Length of structure, in bytes */
+ u32 hardware_signature; /* Hardware configuration signature */
u32 firmware_waking_vector; /* ACPI OS waking vector */
u32 global_lock; /* Global Lock */
u32 S4bios_f : 1; /* Indicates if S4BIOS support is present */
- u32 reserved1 : 31; /* must be 0 */
- u8 resverved3 [40]; /* reserved - must be zero */
+ u32 reserved1 : 31; /* Must be 0 */
+ u8 resverved3 [40]; /* Reserved - must be zero */
} facs_descriptor_rev1;
-/************************************/
-/* ACPI Specification Rev 1.0 for */
-/* the Fixed ACPI Description Table */
-/************************************/
+/*
+ * ACPI 1.0 Fixed ACPI Description Table (FADT)
+ */
typedef struct
{
- acpi_table_header header; /* table header */
+ acpi_table_header header; /* ACPI Table header */
u32 firmware_ctrl; /* Physical address of FACS */
u32 dsdt; /* Physical address of DSDT */
u8 model; /* System Interrupt Model */
- u8 reserved1; /* reserved */
+ u8 reserved1; /* Reserved */
u16 sci_int; /* System vector of SCI interrupt */
u32 smi_cmd; /* Port address of SMI command port */
- u8 acpi_enable; /* value to write to smi_cmd to enable ACPI */
- u8 acpi_disable; /* value to write to smi_cmd to disable ACPI */
+ u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */
+ u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */
u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */
- u8 reserved2; /* reserved - must be zero */
+ u8 reserved2; /* Reserved - must be zero */
u32 pm1a_evt_blk; /* Port address of Power Mgt 1a Acpi_event Reg Blk */
u32 pm1b_evt_blk; /* Port address of Power Mgt 1b Acpi_event Reg Blk */
u32 pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */
u32 pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */
u32 pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */
u32 pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */
- u32 gpe0blk; /* Port addr of General Purpose Acpi_event 0 Reg Blk */
+ u32 gpe0_blk; /* Port addr of General Purpose Acpi_event 0 Reg Blk */
u32 gpe1_blk; /* Port addr of General Purpose Acpi_event 1 Reg Blk */
u8 pm1_evt_len; /* Byte Length of ports at pm1_x_evt_blk */
u8 pm1_cnt_len; /* Byte Length of ports at pm1_x_cnt_blk */
u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */
u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */
- u8 gpe0blk_len; /* Byte Length of ports at gpe0_blk */
+ u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */
u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */
- u8 gpe1_base; /* offset in gpe model where gpe1 events start */
- u8 reserved3; /* reserved */
- u16 plvl2_lat; /* worst case HW latency to enter/exit C2 state */
- u16 plvl3_lat; /* worst case HW latency to enter/exit C3 state */
+ u8 gpe1_base; /* Offset in gpe model where gpe1 events start */
+ u8 reserved3; /* Reserved */
+ u16 plvl2_lat; /* Worst case HW latency to enter/exit C2 state */
+ u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */
u16 flush_size; /* Size of area read to flush caches */
u16 flush_stride; /* Stride used in flushing caches */
- u8 duty_offset; /* bit location of duty cycle field in p_cnt reg */
- u8 duty_width; /* bit width of duty cycle field in p_cnt reg */
- u8 day_alrm; /* index to day-of-month alarm in RTC CMOS RAM */
- u8 mon_alrm; /* index to month-of-year alarm in RTC CMOS RAM */
- u8 century; /* index to century in RTC CMOS RAM */
- u8 reserved4; /* reserved */
- u8 reserved4a; /* reserved */
- u8 reserved4b; /* reserved */
- u32 wb_invd : 1; /* wbinvd instruction works properly */
- u32 wb_invd_flush : 1; /* wbinvd flushes but does not invalidate */
- u32 proc_c1 : 1; /* all processors support C1 state */
+ u8 duty_offset; /* Bit location of duty cycle field in p_cnt reg */
+ u8 duty_width; /* Bit width of duty cycle field in p_cnt reg */
+ u8 day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */
+ u8 mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */
+ u8 century; /* Index to century in RTC CMOS RAM */
+ u8 reserved4; /* Reserved */
+ u8 reserved4a; /* Reserved */
+ u8 reserved4b; /* Reserved */
+ u32 wb_invd : 1; /* The wbinvd instruction works properly */
+ u32 wb_invd_flush : 1; /* The wbinvd flushes but does not invalidate */
+ u32 proc_c1 : 1; /* All processors support C1 state */
u32 plvl2_up : 1; /* C2 state works on MP system */
u32 pwr_button : 1; /* Power button is handled as a generic feature */
u32 sleep_button : 1; /* Sleep button is handled as a generic feature, or not present */
u32 fixed_rTC : 1; /* RTC wakeup stat not in fixed register space */
u32 rtcs4 : 1; /* RTC wakeup stat not possible from S4 */
- u32 tmr_val_ext : 1; /* tmr_val is 32 bits */
- u32 reserved5 : 23; /* reserved - must be zero */
+ u32 tmr_val_ext : 1; /* The tmr_val width is 32 bits (0 = 24 bits) */
+ u32 reserved5 : 23; /* Reserved - must be zero */
} fadt_descriptor_rev1;
/******************************************************************************
*
* Name: actbl2.h - ACPI Specification Revision 2.0 Tables
- * $Revision: 24 $
+ * $Revision: 27 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#pragma pack(1)
/*
- * ACPI Specification Rev 2.0 for the Root System Description Table
+ * ACPI 2.0 Root System Description Table (RSDT)
*/
typedef struct
{
- acpi_table_header header; /* Table header */
+ acpi_table_header header; /* ACPI table header */
u32 table_offset_entry [1]; /* Array of pointers to */
- /* other tables' headers */
+ /* ACPI table headers */
} RSDT_DESCRIPTOR_REV2;
/*
- * ACPI Specification Rev 2.0 for the Extended System Description Table (XSDT)
+ * ACPI 2.0 Extended System Description Table (XSDT)
*/
typedef struct
{
- acpi_table_header header; /* Table header */
+ acpi_table_header header; /* ACPI table header */
u64 table_offset_entry [1]; /* Array of pointers to */
- /* other tables' headers */
+ /* ACPI table headers */
} XSDT_DESCRIPTOR_REV2;
/*
- * ACPI Specification Rev 2.0 for the Firmware ACPI Control Structure
+ * ACPI 2.0 Firmware ACPI Control Structure (FACS)
*/
typedef struct
{
- NATIVE_CHAR signature[4]; /* signature "FACS" */
- u32 length; /* length of structure, in bytes */
- u32 hardware_signature; /* hardware configuration signature */
+ NATIVE_CHAR signature[4]; /* ACPI signature */
+ u32 length; /* Length of structure, in bytes */
+ u32 hardware_signature; /* Hardware configuration signature */
u32 firmware_waking_vector; /* 32bit physical address of the Firmware Waking Vector. */
u32 global_lock; /* Global Lock used to synchronize access to shared hardware resources */
- u32 S4bios_f : 1; /* Indicates if S4BIOS support is present */
- u32 reserved1 : 31; /* must be 0 */
+ u32 S4bios_f : 1; /* S4Bios_f - Indicates if S4BIOS support is present */
+ u32 reserved1 : 31; /* Must be 0 */
u64 Xfirmware_waking_vector; /* 64bit physical address of the Firmware Waking Vector. */
u8 version; /* Version of this table */
- u8 reserved3 [31]; /* reserved - must be zero */
+ u8 reserved3 [31]; /* Reserved - must be zero */
} facs_descriptor_rev2;
/*
- * ACPI Specification Rev 2.0 for the Generic Address Structure (GAS)
+ * ACPI 2.0 Generic Address Structure (GAS)
*/
typedef struct
{
/*
- * ACPI Specification Rev 2.0 for the Fixed ACPI Description Table
+ * ACPI 2.0 Fixed ACPI Description Table (FADT)
*/
typedef struct
{
- acpi_table_header header; /* table header */
+ acpi_table_header header; /* ACPI table header */
u32 V1_firmware_ctrl; /* 32-bit physical address of FACS */
u32 V1_dsdt; /* 32-bit physical address of DSDT */
u8 reserved1; /* System Interrupt Model isn't used in ACPI 2.0*/
u8 prefer_PM_profile; /* Conveys preferred power management profile to OSPM. */
u16 sci_int; /* System vector of SCI interrupt */
u32 smi_cmd; /* Port address of SMI command port */
- u8 acpi_enable; /* value to write to smi_cmd to enable ACPI */
- u8 acpi_disable; /* value to write to smi_cmd to disable ACPI */
+ u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */
+ u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */
u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */
- u8 pstate_cnt; /* processor performance state control*/
+ u8 pstate_cnt; /* Processor performance state control*/
u32 V1_pm1a_evt_blk; /* Port address of Power Mgt 1a Acpi_event Reg Blk */
u32 V1_pm1b_evt_blk; /* Port address of Power Mgt 1b Acpi_event Reg Blk */
u32 V1_pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */
u32 V1_pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */
u32 V1_pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */
u32 V1_pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */
- u32 V1_gpe0blk; /* Port addr of General Purpose Acpi_event 0 Reg Blk */
+ u32 V1_gpe0_blk; /* Port addr of General Purpose Acpi_event 0 Reg Blk */
u32 V1_gpe1_blk; /* Port addr of General Purpose Acpi_event 1 Reg Blk */
u8 pm1_evt_len; /* Byte Length of ports at pm1_x_evt_blk */
u8 pm1_cnt_len; /* Byte Length of ports at pm1_x_cnt_blk */
u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */
u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */
- u8 gpe0blk_len; /* Byte Length of ports at gpe0_blk */
+ u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */
u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */
- u8 gpe1_base; /* offset in gpe model where gpe1 events start */
+ u8 gpe1_base; /* Offset in gpe model where gpe1 events start */
u8 cst_cnt; /* Support for the _CST object and C States change notification.*/
- u16 plvl2_lat; /* worst case HW latency to enter/exit C2 state */
- u16 plvl3_lat; /* worst case HW latency to enter/exit C3 state */
- u16 flush_size; /* number of flush strides that need to be read */
+ u16 plvl2_lat; /* Worst case HW latency to enter/exit C2 state */
+ u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */
+ u16 flush_size; /* Number of flush strides that need to be read */
u16 flush_stride; /* Processor's memory cache line width, in bytes */
u8 duty_offset; /* Processor_\92s duty cycle index in processor's P_CNT reg*/
u8 duty_width; /* Processor_\92s duty cycle value bit width in P_CNT register.*/
- u8 day_alrm; /* index to day-of-month alarm in RTC CMOS RAM */
- u8 mon_alrm; /* index to month-of-year alarm in RTC CMOS RAM */
- u8 century; /* index to century in RTC CMOS RAM */
+ u8 day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */
+ u8 mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */
+ u8 century; /* Index to century in RTC CMOS RAM */
u16 iapc_boot_arch; /* IA-PC Boot Architecture Flags. See Table 5-10 for description*/
- u8 reserved2; /* reserved */
- u32 wb_invd : 1; /* wbinvd instruction works properly */
- u32 wb_invd_flush : 1; /* wbinvd flushes but does not invalidate */
- u32 proc_c1 : 1; /* all processors support C1 state */
+ u8 reserved2; /* Reserved */
+ u32 wb_invd : 1; /* The wbinvd instruction works properly */
+ u32 wb_invd_flush : 1; /* The wbinvd flushes but does not invalidate */
+ u32 proc_c1 : 1; /* All processors support C1 state */
u32 plvl2_up : 1; /* C2 state works on MP system */
u32 pwr_button : 1; /* Power button is handled as a generic feature */
u32 sleep_button : 1; /* Sleep button is handled as a generic feature, or not present */
u32 fixed_rTC : 1; /* RTC wakeup stat not in fixed register space */
u32 rtcs4 : 1; /* RTC wakeup stat not possible from S4 */
- u32 tmr_val_ext : 1; /* tmr_val is 32 bits */
+ u32 tmr_val_ext : 1; /* Indicates tmr_val is 32 bits 0=24-bits*/
u32 dock_cap : 1; /* Supports Docking */
u32 reset_reg_sup : 1; /* Indicates system supports system reset via the FADT RESET_REG*/
u32 sealed_case : 1; /* Indicates system has no internal expansion capabilities and case is sealed. */
u32 headless : 1; /* Indicates system does not have local video capabilities or local input devices.*/
u32 cpu_sw_sleep : 1; /* Indicates to OSPM that a processor native instruction */
- /* must be executed after writing the SLP_TYPx register. */
- u32 reserved6 : 18; /* reserved - must be zero */
+ /* Must be executed after writing the SLP_TYPx register. */
+ u32 reserved6 : 18; /* Reserved - must be zero */
acpi_generic_address reset_register; /* Reset register address in GAS format */
u8 reset_value; /* Value to write to the Reset_register port to reset the system. */
acpi_generic_address Xpm1b_cnt_blk; /* Extended Power Mgt 1b Control Reg Blk address */
acpi_generic_address Xpm2_cnt_blk; /* Extended Power Mgt 2 Control Reg Blk address */
acpi_generic_address Xpm_tmr_blk; /* Extended Power Mgt Timer Ctrl Reg Blk address */
- acpi_generic_address Xgpe0blk; /* Extended General Purpose Acpi_event 0 Reg Blk address */
+ acpi_generic_address Xgpe0_blk; /* Extended General Purpose Acpi_event 0 Reg Blk address */
acpi_generic_address Xgpe1_blk; /* Extended General Purpose Acpi_event 1 Reg Blk address */
} fadt_descriptor_rev2;
* Name: actbl71.h - IA-64 Extensions to the ACPI Spec Rev. 0.71
* This file includes tables specific to this
* specification revision.
- * $Revision: 11 $
+ * $Revision: 12 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
u64 pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */
u64 pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */
u64 pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */
- u64 gpe0blk; /* Port addr of General Purpose Acpi_event 0 Reg Blk */
+ u64 gpe0_blk; /* Port addr of General Purpose Acpi_event 0 Reg Blk */
u64 gpe1_blk; /* Port addr of General Purpose Acpi_event 1 Reg Blk */
u8 pm1_evt_len; /* Byte Length of ports at pm1_x_evt_blk */
u8 pm1_cnt_len; /* Byte Length of ports at pm1_x_cnt_blk */
u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */
u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */
- u8 gpe0blk_len; /* Byte Length of ports at gpe0_blk */
+ u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */
u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */
u8 gpe1_base; /* offset in gpe model where gpe1 events start */
u8 reserved3; /* reserved */
/******************************************************************************
*
* Name: actypes.h - Common data types for the entire ACPI subsystem
- * $Revision: 193 $
+ * $Revision: 224 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* UINT64 64-bit (8 byte) unsigned value
* NATIVE_INT 32-bit on IA-32, 64-bit on IA-64 signed value
* NATIVE_UINT 32-bit on IA-32, 64-bit on IA-64 unsigned value
- * UCHAR Character. 1 byte unsigned value.
*/
*/
typedef unsigned char UINT8;
typedef unsigned char BOOLEAN;
-typedef unsigned char UCHAR;
typedef unsigned short UINT16;
typedef int INT32;
typedef unsigned int UINT32;
typedef COMPILER_DEPENDENT_UINT64 UINT64;
typedef UINT64 NATIVE_UINT;
-typedef INT64 NATIVE_INT;
+typedef UINT64 NATIVE_INT;
typedef NATIVE_UINT ACPI_TBLPTR;
typedef UINT64 ACPI_IO_ADDRESS;
typedef UINT64 ACPI_PHYSICAL_ADDRESS;
+typedef UINT64 ACPI_SIZE;
#define ALIGNED_ADDRESS_BOUNDARY 0x00000008 /* No hardware alignment support in IA64 */
#define ACPI_USE_NATIVE_DIVIDE /* Native 64-bit integer support */
+#define ACPI_MAX_PTR 0xFFFFFFFFFFFFFFFF
#elif _IA16
*/
typedef unsigned char UINT8;
typedef unsigned char BOOLEAN;
-typedef unsigned char UCHAR;
typedef unsigned int UINT16;
typedef long INT32;
typedef int INT16;
typedef UINT32 ACPI_TBLPTR;
typedef UINT32 ACPI_IO_ADDRESS;
typedef char *ACPI_PHYSICAL_ADDRESS;
+typedef UINT32 ACPI_SIZE;
#define ALIGNED_ADDRESS_BOUNDARY 0x00000002
#define _HW_ALIGNMENT_SUPPORT
#define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */
+#define ACPI_MAX_PTR 0xFFFF
/*
* (16-bit only) internal integers must be 32-bits, so
*/
typedef unsigned char UINT8;
typedef unsigned char BOOLEAN;
-typedef unsigned char UCHAR;
typedef unsigned short UINT16;
typedef int INT32;
typedef unsigned int UINT32;
typedef NATIVE_UINT ACPI_TBLPTR;
typedef UINT32 ACPI_IO_ADDRESS;
typedef UINT64 ACPI_PHYSICAL_ADDRESS;
+typedef UINT32 ACPI_SIZE;
#define ALIGNED_ADDRESS_BOUNDARY 0x00000004
#define _HW_ALIGNMENT_SUPPORT
+#define ACPI_MAX_PTR 0xFFFFFFFF
#endif
#define ACPI_UINT16_MAX (UINT16) 0xFFFF
#define ACPI_UINT32_MAX (UINT32) 0xFFFFFFFF
#define ACPI_UINT64_MAX (UINT64) 0xFFFFFFFFFFFFFFFF
+#define ACPI_ASCII_MAX 0x7F
#ifdef DEFINE_ALTERNATE_TYPES
/*
- * Types used only in translated source
+ * Types used only in translated source, defined here to enable
+ * cross-platform compilation only.
*/
typedef INT32 s32;
typedef UINT8 u8;
* Constants with special meanings
*/
-#define ACPI_ROOT_OBJECT (acpi_handle)(-1)
+#define ACPI_ROOT_OBJECT (acpi_handle) ACPI_PTR_ADD (char, NULL, ACPI_UINT32_MAX)
/*
#define ACPI_NO_ADDRESS_SPACE_INIT 0x01
#define ACPI_NO_HARDWARE_INIT 0x02
#define ACPI_NO_EVENT_INIT 0x04
-#define ACPI_NO_ACPI_ENABLE 0x08
-#define ACPI_NO_DEVICE_INIT 0x10
-#define ACPI_NO_OBJECT_INIT 0x20
+#define ACPI_NO_HANDLER_INIT 0x08
+#define ACPI_NO_ACPI_ENABLE 0x10
+#define ACPI_NO_DEVICE_INIT 0x20
+#define ACPI_NO_OBJECT_INIT 0x40
/*
* Initialization state
#define ACPI_D_STATES_MAX ACPI_STATE_D3
#define ACPI_D_STATE_COUNT 4
+#define ACPI_STATE_C0 (u8) 0
+#define ACPI_STATE_C1 (u8) 1
+#define ACPI_STATE_C2 (u8) 2
+#define ACPI_STATE_C3 (u8) 3
+#define ACPI_C_STATES_MAX ACPI_STATE_C3
+#define ACPI_C_STATE_COUNT 4
+
+/*
+ * Sleep type invalid value
+ */
+#define ACPI_SLEEP_TYPE_MAX 0x7
+#define ACPI_SLEEP_TYPE_INVALID 0xFF
+
/*
* Standard notify values
*/
* Types associated with names. The first group of
* values correspond to the definition of the ACPI
* Object_type operator (See the ACPI Spec). Therefore,
- * only add to the first group if the spec changes!
+ * only add to the first group if the spec changes.
*
* Types must be kept in sync with the Acpi_ns_properties
* and Acpi_ns_type_names arrays
*/
typedef u32 acpi_object_type;
-typedef u8 acpi_object_type8;
-
-
-#define ACPI_TYPE_ANY 0 /* 0x00 */
-#define ACPI_TYPE_INTEGER 1 /* 0x01 Byte/Word/Dword/Zero/One/Ones */
-#define ACPI_TYPE_STRING 2 /* 0x02 */
-#define ACPI_TYPE_BUFFER 3 /* 0x03 */
-#define ACPI_TYPE_PACKAGE 4 /* 0x04 Byte_const, multiple Data_term/Constant/Super_name */
-#define ACPI_TYPE_FIELD_UNIT 5 /* 0x05 */
-#define ACPI_TYPE_DEVICE 6 /* 0x06 Name, multiple Node */
-#define ACPI_TYPE_EVENT 7 /* 0x07 */
-#define ACPI_TYPE_METHOD 8 /* 0x08 Name, Byte_const, multiple Code */
-#define ACPI_TYPE_MUTEX 9 /* 0x09 */
-#define ACPI_TYPE_REGION 10 /* 0x0A */
-#define ACPI_TYPE_POWER 11 /* 0x0B Name,Byte_const,Word_const,multi Node */
-#define ACPI_TYPE_PROCESSOR 12 /* 0x0C Name,Byte_const,DWord_const,Byte_const,multi Nm_o */
-#define ACPI_TYPE_THERMAL 13 /* 0x0D Name, multiple Node */
-#define ACPI_TYPE_BUFFER_FIELD 14 /* 0x0E */
-#define ACPI_TYPE_DDB_HANDLE 15 /* 0x0F */
-#define ACPI_TYPE_DEBUG_OBJECT 16 /* 0x10 */
-
-#define ACPI_TYPE_MAX 16
+
+#define ACPI_TYPE_ANY 0x00
+#define ACPI_TYPE_INTEGER 0x01 /* Byte/Word/Dword/Zero/One/Ones */
+#define ACPI_TYPE_STRING 0x02
+#define ACPI_TYPE_BUFFER 0x03
+#define ACPI_TYPE_PACKAGE 0x04 /* Byte_const, multiple Data_term/Constant/Super_name */
+#define ACPI_TYPE_FIELD_UNIT 0x05
+#define ACPI_TYPE_DEVICE 0x06 /* Name, multiple Node */
+#define ACPI_TYPE_EVENT 0x07
+#define ACPI_TYPE_METHOD 0x08 /* Name, Byte_const, multiple Code */
+#define ACPI_TYPE_MUTEX 0x09
+#define ACPI_TYPE_REGION 0x0A
+#define ACPI_TYPE_POWER 0x0B /* Name,Byte_const,Word_const,multi Node */
+#define ACPI_TYPE_PROCESSOR 0x0C /* Name,Byte_const,DWord_const,Byte_const,multi Nm_o */
+#define ACPI_TYPE_THERMAL 0x0D /* Name, multiple Node */
+#define ACPI_TYPE_BUFFER_FIELD 0x0E
+#define ACPI_TYPE_DDB_HANDLE 0x0F
+#define ACPI_TYPE_DEBUG_OBJECT 0x10
+
+#define ACPI_TYPE_MAX 0x10
/*
* This section contains object types that do not relate to the ACPI Object_type operator.
* Also, values exceeding the largest official ACPI Object_type must not overlap with
* defined AML opcodes.
*/
-#define INTERNAL_TYPE_BEGIN 17
+#define INTERNAL_TYPE_BEGIN 0x11
-#define INTERNAL_TYPE_REGION_FIELD 17 /* 0x11 */
-#define INTERNAL_TYPE_BANK_FIELD 18 /* 0x12 */
-#define INTERNAL_TYPE_INDEX_FIELD 19 /* 0x13 */
-#define INTERNAL_TYPE_REFERENCE 20 /* 0x14 Arg#, Local#, Name, Debug; used only in descriptors */
-#define INTERNAL_TYPE_ALIAS 21 /* 0x15 */
-#define INTERNAL_TYPE_NOTIFY 22 /* 0x16 */
-#define INTERNAL_TYPE_ADDRESS_HANDLER 23 /* 0x17 */
-#define INTERNAL_TYPE_RESOURCE 24 /* 0x18 */
-#define INTERNAL_TYPE_RESOURCE_FIELD 25 /* 0x19 */
+#define INTERNAL_TYPE_REGION_FIELD 0x11
+#define INTERNAL_TYPE_BANK_FIELD 0x12
+#define INTERNAL_TYPE_INDEX_FIELD 0x13
+#define INTERNAL_TYPE_REFERENCE 0x14 /* Arg#, Local#, Name, Debug; used only in descriptors */
+#define INTERNAL_TYPE_ALIAS 0x15
+#define INTERNAL_TYPE_NOTIFY 0x16
+#define INTERNAL_TYPE_ADDRESS_HANDLER 0x17
+#define INTERNAL_TYPE_RESOURCE 0x18
+#define INTERNAL_TYPE_RESOURCE_FIELD 0x19
-#define INTERNAL_TYPE_NODE_MAX 25
+#define INTERNAL_TYPE_NODE_MAX 0x19
/* These are pseudo-types because there are never any namespace nodes with these types */
-#define INTERNAL_TYPE_FIELD_DEFN 26 /* 0x1A Name, Byte_const, multiple Field_element */
-#define INTERNAL_TYPE_BANK_FIELD_DEFN 27 /* 0x1B 2 Name,DWord_const,Byte_const,multi Field_element */
-#define INTERNAL_TYPE_INDEX_FIELD_DEFN 28 /* 0x1C 2 Name, Byte_const, multiple Field_element */
-#define INTERNAL_TYPE_IF 29 /* 0x1D */
-#define INTERNAL_TYPE_ELSE 30 /* 0x1E */
-#define INTERNAL_TYPE_WHILE 31 /* 0x1F */
-#define INTERNAL_TYPE_SCOPE 32 /* 0x20 Name, multiple Node */
-#define INTERNAL_TYPE_DEF_ANY 33 /* 0x21 type is Any, suppress search of enclosing scopes */
-#define INTERNAL_TYPE_EXTRA 34 /* 0x22 */
+#define INTERNAL_TYPE_FIELD_DEFN 0x1A /* Name, Byte_const, multiple Field_element */
+#define INTERNAL_TYPE_BANK_FIELD_DEFN 0x1B /* 2 Name,DWord_const,Byte_const,multi Field_element */
+#define INTERNAL_TYPE_INDEX_FIELD_DEFN 0x1C /* 2 Name, Byte_const, multiple Field_element */
+#define INTERNAL_TYPE_IF 0x1D
+#define INTERNAL_TYPE_ELSE 0x1E
+#define INTERNAL_TYPE_WHILE 0x1F
+#define INTERNAL_TYPE_SCOPE 0x20 /* Name, multiple Node */
+#define INTERNAL_TYPE_DEF_ANY 0x21 /* type is Any, suppress search of enclosing scopes */
+#define INTERNAL_TYPE_EXTRA 0x22
+#define INTERNAL_TYPE_DATA 0x23
-#define INTERNAL_TYPE_MAX 34
+#define INTERNAL_TYPE_MAX 0x23
-#define INTERNAL_TYPE_INVALID 35
+#define INTERNAL_TYPE_INVALID 0x24
#define ACPI_TYPE_NOT_FOUND 0xFF
#define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */
#define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF
+/*
+ * All I/O
+ */
+#define ACPI_READ 0
+#define ACPI_WRITE 1
+
/*
- * Acpi_event Types:
- * ------------
- * Fixed & general purpose...
+ * Acpi_event Types: Fixed & General Purpose
*/
typedef u32 acpi_event_type;
-#define ACPI_EVENT_FIXED (acpi_event_type) 0
-#define ACPI_EVENT_GPE (acpi_event_type) 1
+#define ACPI_EVENT_FIXED 0
+#define ACPI_EVENT_GPE 1
/*
* Fixed events
*/
-#define ACPI_EVENT_PMTIMER (acpi_event_type) 0
- /*
- * There's no bus master event so index 1 is used for IRQ's that are not
- * handled by the SCI handler
- */
-#define ACPI_EVENT_NOT_USED (acpi_event_type) 1
-#define ACPI_EVENT_GLOBAL (acpi_event_type) 2
-#define ACPI_EVENT_POWER_BUTTON (acpi_event_type) 3
-#define ACPI_EVENT_SLEEP_BUTTON (acpi_event_type) 4
-#define ACPI_EVENT_RTC (acpi_event_type) 5
-#define ACPI_EVENT_GENERAL (acpi_event_type) 6
-#define ACPI_EVENT_MAX 6
-#define ACPI_NUM_FIXED_EVENTS (acpi_event_type) 7
+#define ACPI_EVENT_PMTIMER 0
+#define ACPI_EVENT_GLOBAL 1
+#define ACPI_EVENT_POWER_BUTTON 2
+#define ACPI_EVENT_SLEEP_BUTTON 3
+#define ACPI_EVENT_RTC 4
+#define ACPI_EVENT_MAX 4
+#define ACPI_NUM_FIXED_EVENTS ACPI_EVENT_MAX + 1
#define ACPI_GPE_INVALID 0xFF
#define ACPI_GPE_MAX 0xFF
#define ACPI_NUM_GPE 256
-#define ACPI_EVENT_LEVEL_TRIGGERED (acpi_event_type) 1
-#define ACPI_EVENT_EDGE_TRIGGERED (acpi_event_type) 2
+#define ACPI_EVENT_LEVEL_TRIGGERED 1
+#define ACPI_EVENT_EDGE_TRIGGERED 2
/*
* GPEs
*/
-#define ACPI_EVENT_ENABLE 0x1
-#define ACPI_EVENT_WAKE_ENABLE 0x2
-#define ACPI_EVENT_DISABLE 0x1
-#define ACPI_EVENT_WAKE_DISABLE 0x2
+#define ACPI_EVENT_WAKE_ENABLE 0x1
+
+#define ACPI_EVENT_WAKE_DISABLE 0x1
/*
#define ACPI_DEVICE_NOTIFY 1
#define ACPI_MAX_NOTIFY_HANDLER_TYPE 1
-#define MAX_SYS_NOTIFY 0x7f
+#define ACPI_MAX_SYS_NOTIFY 0x7f
/* Address Space (Operation Region) Types */
#define ACPI_ADR_SPACE_SMBUS (ACPI_ADR_SPACE_TYPE) 4
#define ACPI_ADR_SPACE_CMOS (ACPI_ADR_SPACE_TYPE) 5
#define ACPI_ADR_SPACE_PCI_BAR_TARGET (ACPI_ADR_SPACE_TYPE) 6
+#define ACPI_ADR_SPACE_DATA_TABLE (ACPI_ADR_SPACE_TYPE) 7
/*
u32 resource_order;
} power_resource;
-} acpi_object, *PACPI_OBJECT;
+} acpi_object;
/*
u32 count;
acpi_object *pointer;
-} acpi_object_list, *PACPI_OBJECT_LIST;
+} acpi_object_list;
/*
* Miscellaneous common Data Structures used by the interfaces
*/
+#define ACPI_NO_BUFFER 0
+#define ACPI_ALLOCATE_BUFFER (ACPI_SIZE) (-1)
+#define ACPI_ALLOCATE_LOCAL_BUFFER (ACPI_SIZE) (-2)
+
typedef struct
{
- u32 length; /* Length in bytes of the buffer */
+ ACPI_SIZE length; /* Length in bytes of the buffer */
void *pointer; /* pointer to buffer */
} acpi_buffer;
* Structure and flags for Acpi_get_system_info
*/
-#define SYS_MODE_UNKNOWN 0x0000
-#define SYS_MODE_ACPI 0x0001
-#define SYS_MODE_LEGACY 0x0002
-#define SYS_MODES_MASK 0x0003
+#define ACPI_SYS_MODE_UNKNOWN 0x0000
+#define ACPI_SYS_MODE_ACPI 0x0001
+#define ACPI_SYS_MODE_LEGACY 0x0002
+#define ACPI_SYS_MODES_MASK 0x0003
/*
u32 value,
void *context);
+typedef
+void (*ACPI_OBJECT_HANDLER) (
+ acpi_handle object,
+ u32 function,
+ void *data);
-/* Address Spaces (Operation Regions */
-#define ACPI_READ_ADR_SPACE 1
-#define ACPI_WRITE_ADR_SPACE 2
+/* Address Spaces (Operation Regions */
typedef
acpi_status (*acpi_adr_space_handler) (
u32 function,
ACPI_PHYSICAL_ADDRESS address,
u32 bit_width,
- u32 *value,
+ acpi_integer *value,
void *handler_context,
void *region_context);
-#define ACPI_DEFAULT_HANDLER ((acpi_adr_space_handler) NULL)
+#define ACPI_DEFAULT_HANDLER ((acpi_adr_space_handler) NULL)
typedef
/* Interrupt handler return values */
-#define INTERRUPT_NOT_HANDLED 0x00
-#define INTERRUPT_HANDLED 0x01
+#define ACPI_INTERRUPT_NOT_HANDLED 0x00
+#define ACPI_INTERRUPT_HANDLED 0x01
/* Structure and flags for Acpi_get_device_info */
typedef struct
{
+ u32 length;
+ ACPI_PHYSICAL_ADDRESS address;
ACPI_PHYSICAL_ADDRESS mapped_physical_address;
u8 *mapped_logical_address;
u32 mapped_length;
/*
* Memory Attributes
*/
-#define READ_ONLY_MEMORY (u8) 0x00
-#define READ_WRITE_MEMORY (u8) 0x01
+#define ACPI_READ_ONLY_MEMORY (u8) 0x00
+#define ACPI_READ_WRITE_MEMORY (u8) 0x01
-#define NON_CACHEABLE_MEMORY (u8) 0x00
-#define CACHABLE_MEMORY (u8) 0x01
-#define WRITE_COMBINING_MEMORY (u8) 0x02
-#define PREFETCHABLE_MEMORY (u8) 0x03
+#define ACPI_NON_CACHEABLE_MEMORY (u8) 0x00
+#define ACPI_CACHABLE_MEMORY (u8) 0x01
+#define ACPI_WRITE_COMBINING_MEMORY (u8) 0x02
+#define ACPI_PREFETCHABLE_MEMORY (u8) 0x03
/*
* IO Attributes
- * The ISA IO ranges are: n000-n0FFh, n400-n4_fFh, n800-n8_fFh, n_c00-n_cFFh.
+ * The ISA IO ranges are: n000-n0_fFh, n400-n4_fFh, n800-n8_fFh, n_c00-n_cFFh.
* The non-ISA IO ranges are: n100-n3_fFh, n500-n7_fFh, n900-n_bFFh, n_cD0-n_fFFh.
*/
-#define NON_ISA_ONLY_RANGES (u8) 0x01
-#define ISA_ONLY_RANGES (u8) 0x02
-#define ENTIRE_RANGE (NON_ISA_ONLY_RANGES | ISA_ONLY_RANGES)
+#define ACPI_NON_ISA_ONLY_RANGES (u8) 0x01
+#define ACPI_ISA_ONLY_RANGES (u8) 0x02
+#define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES)
/*
* IO Port Descriptor Decode
*/
-#define DECODE_10 (u8) 0x00 /* 10-bit IO address decode */
-#define DECODE_16 (u8) 0x01 /* 16-bit IO address decode */
+#define ACPI_DECODE_10 (u8) 0x00 /* 10-bit IO address decode */
+#define ACPI_DECODE_16 (u8) 0x01 /* 16-bit IO address decode */
/*
* IRQ Attributes
*/
-#define EDGE_SENSITIVE (u8) 0x00
-#define LEVEL_SENSITIVE (u8) 0x01
+#define ACPI_EDGE_SENSITIVE (u8) 0x00
+#define ACPI_LEVEL_SENSITIVE (u8) 0x01
-#define ACTIVE_HIGH (u8) 0x00
-#define ACTIVE_LOW (u8) 0x01
+#define ACPI_ACTIVE_HIGH (u8) 0x00
+#define ACPI_ACTIVE_LOW (u8) 0x01
-#define EXCLUSIVE (u8) 0x00
-#define SHARED (u8) 0x01
+#define ACPI_EXCLUSIVE (u8) 0x00
+#define ACPI_SHARED (u8) 0x01
/*
* DMA Attributes
*/
-#define COMPATIBILITY (u8) 0x00
-#define TYPE_A (u8) 0x01
-#define TYPE_B (u8) 0x02
-#define TYPE_F (u8) 0x03
+#define ACPI_COMPATIBILITY (u8) 0x00
+#define ACPI_TYPE_A (u8) 0x01
+#define ACPI_TYPE_B (u8) 0x02
+#define ACPI_TYPE_F (u8) 0x03
-#define NOT_BUS_MASTER (u8) 0x00
-#define BUS_MASTER (u8) 0x01
+#define ACPI_NOT_BUS_MASTER (u8) 0x00
+#define ACPI_BUS_MASTER (u8) 0x01
-#define TRANSFER_8 (u8) 0x00
-#define TRANSFER_8_16 (u8) 0x01
-#define TRANSFER_16 (u8) 0x02
+#define ACPI_TRANSFER_8 (u8) 0x00
+#define ACPI_TRANSFER_8_16 (u8) 0x01
+#define ACPI_TRANSFER_16 (u8) 0x02
/*
* Start Dependent Functions Priority definitions
*/
-#define GOOD_CONFIGURATION (u8) 0x00
-#define ACCEPTABLE_CONFIGURATION (u8) 0x01
-#define SUB_OPTIMAL_CONFIGURATION (u8) 0x02
+#define ACPI_GOOD_CONFIGURATION (u8) 0x00
+#define ACPI_ACCEPTABLE_CONFIGURATION (u8) 0x01
+#define ACPI_SUB_OPTIMAL_CONFIGURATION (u8) 0x02
/*
* 16, 32 and 64-bit Address Descriptor resource types
*/
-#define MEMORY_RANGE (u8) 0x00
-#define IO_RANGE (u8) 0x01
-#define BUS_NUMBER_RANGE (u8) 0x02
+#define ACPI_MEMORY_RANGE (u8) 0x00
+#define ACPI_IO_RANGE (u8) 0x01
+#define ACPI_BUS_NUMBER_RANGE (u8) 0x02
-#define ADDRESS_NOT_FIXED (u8) 0x00
-#define ADDRESS_FIXED (u8) 0x01
+#define ACPI_ADDRESS_NOT_FIXED (u8) 0x00
+#define ACPI_ADDRESS_FIXED (u8) 0x01
-#define POS_DECODE (u8) 0x00
-#define SUB_DECODE (u8) 0x01
+#define ACPI_POS_DECODE (u8) 0x00
+#define ACPI_SUB_DECODE (u8) 0x01
-#define PRODUCER (u8) 0x00
-#define CONSUMER (u8) 0x01
+#define ACPI_PRODUCER (u8) 0x00
+#define ACPI_CONSUMER (u8) 0x01
/*
} acpi_resource_vendor;
+typedef struct
+{
+ u8 checksum;
+
+} ACPI_RESOURCE_END_TAG;
+
typedef struct
{
u32 read_write_attribute;
#define ACPI_RSTYPE_ADDRESS64 13
#define ACPI_RSTYPE_EXT_IRQ 14
-typedef u32 acpi_resource_type;
+typedef u32 acpi_resource_type;
typedef union
{
acpi_resource_io io;
acpi_resource_fixed_io fixed_io;
acpi_resource_vendor vendor_specific;
+ ACPI_RESOURCE_END_TAG end_tag;
acpi_resource_mem24 memory24;
acpi_resource_mem32 memory32;
acpi_resource_fixed_mem32 fixed_memory32;
} acpi_resource;
-#define ACPI_RESOURCE_LENGTH 12
-#define ACPI_RESOURCE_LENGTH_NO_DATA 8 /* Id + Length fields */
+#define ACPI_RESOURCE_LENGTH 12
+#define ACPI_RESOURCE_LENGTH_NO_DATA 8 /* Id + Length fields */
-#define SIZEOF_RESOURCE(type) (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (type))
+#define ACPI_SIZEOF_RESOURCE(type) (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (type))
-#define NEXT_RESOURCE(res) (acpi_resource *)((u8 *) res + res->length)
+#define ACPI_NEXT_RESOURCE(res) (acpi_resource *)((u8 *) res + res->length)
+#ifdef _HW_ALIGNMENT_SUPPORT
+#define ACPI_ALIGN_RESOURCE_SIZE(length) (length)
+#else
+#define ACPI_ALIGN_RESOURCE_SIZE(length) ACPI_ROUND_UP_TO_NATIVE_WORD(length)
+#endif
/*
- * END: Definitions for Resource Attributes
+ * END: of definitions for Resource Attributes
*/
-typedef struct pci_routing_table
+typedef struct acpi_pci_routing_table
{
u32 length;
u32 pin;
u32 source_index;
NATIVE_CHAR source[4]; /* pad to 64 bits so sizeof() works in all cases */
-} pci_routing_table;
-
+} acpi_pci_routing_table;
/*
- * END: Definitions for PCI Routing tables
+ * END: of definitions for PCI Routing tables
*/
+
#endif /* __ACTYPES_H__ */
/******************************************************************************
*
* Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
- * $Revision: 117 $
+ * $Revision: 130 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
typedef struct acpi_pkg_info
{
u8 *free_space;
- u32 length;
+ ACPI_SIZE length;
u32 object_space;
u32 num_packages;
} acpi_pkg_info;
NATIVE_CHAR *
acpi_ut_get_type_name (
- u32 type);
+ acpi_object_type type);
+
+#endif
+
NATIVE_CHAR *
acpi_ut_get_region_name (
u8 space_id);
-#endif
-
+NATIVE_CHAR *
+acpi_ut_get_event_name (
+ u32 event_id);
u8
acpi_ut_hex_to_ascii_char (
u8
acpi_ut_valid_object_type (
- u32 type);
+ acpi_object_type type);
acpi_owner_id
acpi_ut_allocate_owner_id (
acpi_operand_object *dest_obj,
acpi_walk_state *walk_state);
+acpi_status
+acpi_ut_copy_simple_object (
+ acpi_operand_object *source_desc,
+ acpi_operand_object *dest_desc);
+
+acpi_status
+acpi_ut_copy_iobject_to_iobject (
+ acpi_operand_object *source_desc,
+ acpi_operand_object **dest_desc,
+ acpi_walk_state *walk_state);
+
/*
* Ut_create - Object creation
u32 display,
u32 component_id);
-void
+void ACPI_INTERNAL_VAR_XFACE
acpi_ut_debug_print (
u32 requested_debug_level,
u32 line_number,
char *format,
...) ACPI_PRINTF_LIKE_FUNC;
-void
+void ACPI_INTERNAL_VAR_XFACE
acpi_ut_debug_print_raw (
u32 requested_debug_level,
u32 line_number,
/* Method name strings */
#define METHOD_NAME__HID "_HID"
+#define METHOD_NAME__CID "_CID"
#define METHOD_NAME__UID "_UID"
#define METHOD_NAME__ADR "_ADR"
#define METHOD_NAME__STA "_STA"
acpi_namespace_node *device_node,
acpi_device_id *hid);
+acpi_status
+acpi_ut_execute_CID (
+ acpi_namespace_node *device_node,
+ acpi_device_id *cid);
+
acpi_status
acpi_ut_execute_STA (
acpi_namespace_node *device_node,
NATIVE_CHAR *module_name,
u32 line_number,
u32 component_id,
- acpi_object_type8 type);
+ acpi_object_type type);
void *
acpi_ut_allocate_object_desc_dbg (
acpi_status
acpi_ut_get_simple_object_size (
acpi_operand_object *obj,
- u32 *obj_length);
+ ACPI_SIZE *obj_length);
acpi_status
acpi_ut_get_package_object_size (
acpi_operand_object *obj,
- u32 *obj_length);
+ ACPI_SIZE *obj_length);
acpi_status
acpi_ut_get_object_size(
acpi_operand_object *obj,
- u32 *obj_length);
+ ACPI_SIZE *obj_length);
/*
acpi_ut_create_generic_state (
void);
+ACPI_THREAD_STATE *
+acpi_ut_create_thread_state (
+ void);
+
acpi_generic_state *
acpi_ut_create_update_state (
acpi_operand_object *object,
acpi_ut_resolve_package_references (
acpi_operand_object *obj_desc);
+u8 *
+acpi_ut_get_resource_end_tag (
+ acpi_operand_object *obj_desc);
+
+u8
+acpi_ut_generate_checksum (
+ u8 *buffer,
+ u32 length);
#ifdef ACPI_DEBUG
void
acpi_ut_delete_generic_cache (
u32 list_id);
+acpi_status
+acpi_ut_validate_buffer (
+ acpi_buffer *buffer);
+
+acpi_status
+acpi_ut_initialize_buffer (
+ acpi_buffer *buffer,
+ ACPI_SIZE required_length);
+
-/* Debug Memory allocation functions */
+/* Memory allocation functions */
void *
acpi_ut_allocate (
- u32 size,
+ ACPI_SIZE size,
u32 component,
NATIVE_CHAR *module,
u32 line);
void *
acpi_ut_callocate (
- u32 size,
+ ACPI_SIZE size,
+ u32 component,
+ NATIVE_CHAR *module,
+ u32 line);
+
+
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+
+void *
+acpi_ut_allocate_and_track (
+ ACPI_SIZE size,
+ u32 component,
+ NATIVE_CHAR *module,
+ u32 line);
+
+void *
+acpi_ut_callocate_and_track (
+ ACPI_SIZE size,
u32 component,
NATIVE_CHAR *module,
u32 line);
void
-acpi_ut_free (
+acpi_ut_free_and_track (
void *address,
u32 component,
NATIVE_CHAR *module,
u32 line);
+acpi_status
+acpi_ut_track_allocation (
+ u32 list_id,
+ acpi_debug_mem_block *address,
+ ACPI_SIZE size,
+ u8 alloc_type,
+ u32 component,
+ NATIVE_CHAR *module,
+ u32 line);
+
+acpi_status
+acpi_ut_remove_allocation (
+ u32 list_id,
+ acpi_debug_mem_block *address,
+ u32 component,
+ NATIVE_CHAR *module,
+ u32 line);
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
void
acpi_ut_dump_allocation_info (
void);
* Name: amlcode.h - Definitions for AML, as included in "definition blocks"
* Declarations and definitions contained herein are derived
* directly from the ACPI specification.
- * $Revision: 58 $
+ * $Revision: 66 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* Resolved argument types for the AML Interpreter
* Each field in the Arg_types u32 is 5 bits, allowing for a maximum of 6 arguments.
* There can be up to 31 unique argument types (0 is end-of-arg-list indicator)
+ *
+ * Note: If and when 5 bits becomes insufficient, it would probably be best
+ * to convert to a 6-byte array of argument types, allowing 8 bits per argument.
*/
/* "Standard" ACPI types are 1-15 (0x0F) */
#define ARGI_FIXED_TARGET 0x1B /* Target, no implicit conversion */
#define ARGI_SIMPLE_TARGET 0x1C /* Name, Local, Arg -- no implicit conversion */
#define ARGI_BUFFERSTRING 0x1D
+#define ARGI_REF_OR_STRING 0x1E /* Reference or String (Used by DEREFOF op only) */
#define ARGI_INVALID_OPCODE 0xFFFFFFFF
REGION_SMBUS,
REGION_CMOS,
REGION_PCI_BAR,
- REGION_FIXED_HW = 0x7F,
+ REGION_DATA_TABLE, /* Internal use only */
+ REGION_FIXED_HW = 0x7F
} AML_REGION_TYPES;
#define MAX_MATCH_OPERATOR 5
-/* Field Access Types */
+/*
+ * Field_flags
+ *
+ * This byte is extracted from the AML and includes three separate
+ * pieces of information about the field:
+ * 1) The field access type
+ * 2) The field update rule
+ * 3) The lock rule for the field
+ *
+ * Bits 00 - 03 : Access_type (Any_acc, Byte_acc, etc.)
+ * 04 : Lock_rule (1 == Lock)
+ * 05 - 06 : Update_rule
+ */
+#define AML_FIELD_ACCESS_TYPE_MASK 0x0F
+#define AML_FIELD_LOCK_RULE_MASK 0x10
+#define AML_FIELD_UPDATE_RULE_MASK 0x60
-#define ACCESS_TYPE_MASK 0x0f
-#define ACCESS_TYPE_SHIFT 0
+
+/* 1) Field Access Types */
typedef enum
{
- ACCESS_ANY_ACC = 0,
- ACCESS_BYTE_ACC = 1,
- ACCESS_WORD_ACC = 2,
- ACCESS_DWORD_ACC = 3,
- ACCESS_QWORD_ACC = 4, /* ACPI 2.0 */
- ACCESS_BLOCK_ACC = 4,
- ACCESS_SMBSEND_RECV_ACC = 5,
- ACCESS_SMBQUICK_ACC = 6
+ AML_FIELD_ACCESS_ANY = 0x00,
+ AML_FIELD_ACCESS_BYTE = 0x01,
+ AML_FIELD_ACCESS_WORD = 0x02,
+ AML_FIELD_ACCESS_DWORD = 0x03,
+ AML_FIELD_ACCESS_QWORD = 0x04, /* ACPI 2.0 */
+ AML_FIELD_ACCESS_BUFFER = 0x05 /* ACPI 2.0 */
} AML_ACCESS_TYPE;
-/* Field Lock Rules */
-
-#define LOCK_RULE_MASK 0x10
-#define LOCK_RULE_SHIFT 4
+/* 2) Field Lock Rules */
typedef enum
{
- GLOCK_NEVER_LOCK = 0,
- GLOCK_ALWAYS_LOCK = 1
+ AML_FIELD_LOCK_NEVER = 0x00,
+ AML_FIELD_LOCK_ALWAYS = 0x10
} AML_LOCK_RULE;
-/* Field Update Rules */
-
-#define UPDATE_RULE_MASK 0x060
-#define UPDATE_RULE_SHIFT 5
+/* 3) Field Update Rules */
typedef enum
{
- UPDATE_PRESERVE = 0,
- UPDATE_WRITE_AS_ONES = 1,
- UPDATE_WRITE_AS_ZEROS = 2
+ AML_FIELD_UPDATE_PRESERVE = 0x00,
+ AML_FIELD_UPDATE_WRITE_AS_ONES = 0x20,
+ AML_FIELD_UPDATE_WRITE_AS_ZEROS = 0x40
} AML_UPDATE_RULE;
+/*
+ * Field Access Attributes.
+ * This byte is extracted from the AML via the
+ * Access_as keyword
+ */
+typedef enum
+{
+ AML_FIELD_ATTRIB_SMB_QUICK = 0x02,
+ AML_FIELD_ATTRIB_SMB_SEND_RCV = 0x04,
+ AML_FIELD_ATTRIB_SMB_BYTE = 0x06,
+ AML_FIELD_ATTRIB_SMB_WORD = 0x08,
+ AML_FIELD_ATTRIB_SMB_BLOCK = 0x0A,
+ AML_FIELD_ATTRIB_SMB_CALL = 0x0E
+
+} AML_ACCESS_ATTRIBUTE;
+
+
/* bit fields in Method_flags byte */
#define METHOD_FLAGS_ARG_COUNT 0x07
/* Array sizes. Used for range checking also */
-#define NUM_REGION_TYPES 7
-#define NUM_ACCESS_TYPES 7
+#define NUM_ACCESS_TYPES 6
#define NUM_UPDATE_RULES 3
#define NUM_MATCH_OPS 7
#define NUM_OPCODES 256
#define NUM_FIELD_NAMES 2
-#define USER_REGION_BEGIN 0x80
-
-
#endif /* __AMLCODE_H__ */
/******************************************************************************
*
* Name: acenv.h - Generation environment specific items
- * $Revision: 77 $
+ * $Revision: 85 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*! [Begin] no source code translation */
-#ifdef _LINUX
+#if defined(_LINUX)
#include "aclinux.h"
-#elif _AED_EFI
+#elif defined(_AED_EFI)
#include "acefi.h"
-#elif WIN32
+#elif defined(MSDOS)
+#include "acdos16.h"
+
+#elif defined(WIN32)
#include "acwin.h"
-#elif __FreeBSD__
+#elif defined(WIN64)
+#include "acwin64.h"
+
+#elif defined(__FreeBSD__)
#include "acfreebsd.h"
+#elif defined(MODESTO)
+#include "acmodesto.h"
+
+#elif defined(NETWARE)
+#include "acnetware.h"
+
#else
/* All other environments */
#endif
-
/*! [End] no source code translation !*/
/******************************************************************************
* We will be linking to the standard Clib functions
*/
-#define STRSTR(s1,s2) strstr((s1), (s2))
-#define STRUPR(s) acpi_ut_strupr ((s))
-#define STRLEN(s) (u32) strlen((s))
-#define STRCPY(d,s) strcpy((d), (s))
-#define STRNCPY(d,s,n) strncpy((d), (s), (NATIVE_INT)(n))
-#define STRNCMP(d,s,n) strncmp((d), (s), (NATIVE_INT)(n))
-#define STRCMP(d,s) strcmp((d), (s))
-#define STRCAT(d,s) strcat((d), (s))
-#define STRNCAT(d,s,n) strncat((d), (s), (NATIVE_INT)(n))
-#define STRTOUL(d,s,n) strtoul((d), (s), (NATIVE_INT)(n))
-#define MEMCPY(d,s,n) memcpy((d), (s), (NATIVE_INT)(n))
-#define MEMSET(d,s,n) memset((d), (s), (NATIVE_INT)(n))
-#define TOUPPER toupper
-#define TOLOWER tolower
-#define IS_XDIGIT isxdigit
+#define ACPI_STRSTR(s1,s2) strstr((s1), (s2))
+#define ACPI_STRUPR(s) acpi_ut_strupr ((s))
+#define ACPI_STRLEN(s) (u32) strlen((s))
+#define ACPI_STRCPY(d,s) strcpy((d), (s))
+#define ACPI_STRNCPY(d,s,n) strncpy((d), (s), (NATIVE_INT)(n))
+#define ACPI_STRNCMP(d,s,n) strncmp((d), (s), (NATIVE_INT)(n))
+#define ACPI_STRCMP(d,s) strcmp((d), (s))
+#define ACPI_STRCAT(d,s) strcat((d), (s))
+#define ACPI_STRNCAT(d,s,n) strncat((d), (s), (NATIVE_INT)(n))
+#define ACPI_STRTOUL(d,s,n) strtoul((d), (s), (NATIVE_INT)(n))
+#define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (NATIVE_INT)(n))
+#define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (NATIVE_INT)(n))
+#define ACPI_TOUPPER toupper
+#define ACPI_TOLOWER tolower
+#define ACPI_IS_XDIGIT isxdigit
/******************************************************************************
*
* Storage alignment properties
*/
-#define _AUPBND (sizeof (NATIVE_INT) - 1)
-#define _ADNBND (sizeof (NATIVE_INT) - 1)
+#define _AUPBND (sizeof (NATIVE_INT) - 1)
+#define _ADNBND (sizeof (NATIVE_INT) - 1)
/*
* Variable argument list macro definitions
*/
-#define _bnd(X, bnd) (((sizeof (X)) + (bnd)) & (~(bnd)))
-#define va_arg(ap, T) (*(T *)(((ap) += (_bnd (T, _AUPBND))) - (_bnd (T,_ADNBND))))
-#define va_end(ap) (void) 0
-#define va_start(ap, A) (void) ((ap) = (((char *) &(A)) + (_bnd (A,_AUPBND))))
+#define _bnd(X, bnd) (((sizeof (X)) + (bnd)) & (~(bnd)))
+#define va_arg(ap, T) (*(T *)(((ap) += (_bnd (T, _AUPBND))) - (_bnd (T,_ADNBND))))
+#define va_end(ap) (void) 0
+#define va_start(ap, A) (void) ((ap) = (((char *) &(A)) + (_bnd (A,_AUPBND))))
#endif /* va_arg */
-#define STRSTR(s1,s2) acpi_ut_strstr ((s1), (s2))
-#define STRUPR(s) acpi_ut_strupr ((s))
-#define STRLEN(s) acpi_ut_strlen ((s))
-#define STRCPY(d,s) acpi_ut_strcpy ((d), (s))
-#define STRNCPY(d,s,n) acpi_ut_strncpy ((d), (s), (n))
-#define STRNCMP(d,s,n) acpi_ut_strncmp ((d), (s), (n))
-#define STRCMP(d,s) acpi_ut_strcmp ((d), (s))
-#define STRCAT(d,s) acpi_ut_strcat ((d), (s))
-#define STRNCAT(d,s,n) acpi_ut_strncat ((d), (s), (n))
-#define STRTOUL(d,s,n) acpi_ut_strtoul ((d), (s),(n))
-#define MEMCPY(d,s,n) acpi_ut_memcpy ((d), (s), (n))
-#define MEMSET(d,v,n) acpi_ut_memset ((d), (v), (n))
-#define TOUPPER acpi_ut_to_upper
-#define TOLOWER acpi_ut_to_lower
+#define ACPI_STRSTR(s1,s2) acpi_ut_strstr ((s1), (s2))
+#define ACPI_STRUPR(s) acpi_ut_strupr ((s))
+#define ACPI_STRLEN(s) acpi_ut_strlen ((s))
+#define ACPI_STRCPY(d,s) acpi_ut_strcpy ((d), (s))
+#define ACPI_STRNCPY(d,s,n) acpi_ut_strncpy ((d), (s), (n))
+#define ACPI_STRNCMP(d,s,n) acpi_ut_strncmp ((d), (s), (n))
+#define ACPI_STRCMP(d,s) acpi_ut_strcmp ((d), (s))
+#define ACPI_STRCAT(d,s) acpi_ut_strcat ((d), (s))
+#define ACPI_STRNCAT(d,s,n) acpi_ut_strncat ((d), (s), (n))
+#define ACPI_STRTOUL(d,s,n) acpi_ut_strtoul ((d), (s),(n))
+#define ACPI_MEMCPY(d,s,n) (void) acpi_ut_memcpy ((d), (s), (n))
+#define ACPI_MEMSET(d,v,n) (void) acpi_ut_memset ((d), (v), (n))
+#define ACPI_TOUPPER acpi_ut_to_upper
+#define ACPI_TOLOWER acpi_ut_to_lower
#endif /* ACPI_USE_SYSTEM_CLIBRARY */
*/
/* Unrecognized compiler, use defaults */
+
#ifndef ACPI_ASM_MACROS
+/*
+ * Calling conventions:
+ *
+ * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads)
+ * ACPI_EXTERNAL_XFACE - External ACPI interfaces
+ * ACPI_INTERNAL_XFACE - Internal ACPI interfaces
+ * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces
+ */
+#define ACPI_SYSTEM_XFACE
+#define ACPI_EXTERNAL_XFACE
+#define ACPI_INTERNAL_XFACE
+#define ACPI_INTERNAL_VAR_XFACE
+
#define ACPI_ASM_MACROS
#define causeinterrupt(level)
#define BREAKPOINT3
-#define disable()
-#define enable()
+#define acpi_disable_irqs()
+#define acpi_enable_irqs()
#define halt()
#define ACPI_ACQUIRE_GLOBAL_LOCK(Glptr, acq)
#define ACPI_RELEASE_GLOBAL_LOCK(Glptr, acq)
/******************************************************************************
*
- * Compiler-specific
+ * Compiler-specific information is contained in the compiler-specific
+ * headers.
*
*****************************************************************************/
-
-/* this has been moved to compiler-specific headers, which are included from the
- platform header. */
-
-
#endif /* __ACENV_H__ */
/******************************************************************************
*
* Name: acgcc.h - GCC specific defines, etc.
- * $Revision: 14 $
+ * $Revision: 19 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _IA64
#define COMPILER_DEPENDENT_UINT64 unsigned long
+
+/*
+ * Calling conventions:
+ *
+ * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads)
+ * ACPI_EXTERNAL_XFACE - External ACPI interfaces
+ * ACPI_INTERNAL_XFACE - Internal ACPI interfaces
+ * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces
+ */
+#define ACPI_SYSTEM_XFACE
+#define ACPI_EXTERNAL_XFACE
+#define ACPI_INTERNAL_XFACE
+#define ACPI_INTERNAL_VAR_XFACE
+
/* Single threaded */
+
#define ACPI_APPLICATION
+/* Asm macros */
+
#define ACPI_ASM_MACROS
#define causeinterrupt(level)
#define BREAKPOINT3
-#define disable() __cli()
-#define enable() __sti()
+#define acpi_disable_irqs() __cli()
+#define acpi_enable_irqs() __sti()
/*! [Begin] no source code translation */
#else /* DO IA32 */
#define COMPILER_DEPENDENT_UINT64 unsigned long long
+
+/*
+ * Calling conventions:
+ *
+ * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads)
+ * ACPI_EXTERNAL_XFACE - External ACPI interfaces
+ * ACPI_INTERNAL_XFACE - Internal ACPI interfaces
+ * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces
+ */
+#define ACPI_SYSTEM_XFACE
+#define ACPI_EXTERNAL_XFACE
+#define ACPI_INTERNAL_XFACE
+#define ACPI_INTERNAL_VAR_XFACE
+
+/* Asm macros */
+
#define ACPI_ASM_MACROS
#define causeinterrupt(level)
#define BREAKPOINT3
-#define disable() __cli()
-#define enable() __sti()
+#define acpi_disable_irqs() __cli()
+#define acpi_enable_irqs() __sti()
#define halt() __asm__ __volatile__ ("sti; hlt":::"memory")
/*! [Begin] no source code translation
#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
asm("shrl $1,%2;" \
- "rcrl $1,%3;" \
- :"=r"(n_hi), "=r"(n_lo) \
- :"0"(n_hi), "1"(n_lo))
+ "rcrl $1,%3;" \
+ :"=r"(n_hi), "=r"(n_lo) \
+ :"0"(n_hi), "1"(n_lo))
/*! [End] no source code translation !*/
/******************************************************************************
*
* Name: aclinux.h - OS specific defines, etc.
- * $Revision: 14 $
+ * $Revision: 15 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#
# Makefile for all Linux ACPI interpreter subdirectories
-# EXCEPT for the ospm directory
#
O_TARGET := $(notdir $(CURDIR)).o
-obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c))
+obj-$(CONFIG_ACPI_INTERPRETER) := $(patsubst %.c,%.o,$(wildcard *.c))
EXTRA_CFLAGS += $(ACPI_CFLAGS)
/*******************************************************************************
*
* Module Name: nsaccess - Top-level functions for accessing ACPI namespace
- * $Revision: 135 $
+ * $Revision: 152 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_NAMESPACE
- MODULE_NAME ("nsaccess")
+ ACPI_MODULE_NAME ("nsaccess")
/*******************************************************************************
acpi_status
acpi_ns_root_initialize (void)
{
- acpi_status status = AE_OK;
- const predefined_names *init_val = NULL;
- acpi_namespace_node *new_node;
- acpi_operand_object *obj_desc;
+ acpi_status status;
+ const acpi_predefined_names *init_val = NULL;
+ acpi_namespace_node *new_node;
+ acpi_operand_object *obj_desc;
- FUNCTION_TRACE ("Ns_root_initialize");
+ ACPI_FUNCTION_TRACE ("Ns_root_initialize");
- acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
/*
* The global root ptr is initially NULL, so a non-NULL value indicates
goto unlock_and_exit;
}
-
/*
* Tell the rest of the subsystem that the root is initialized
* (This is OK because the namespace is locked)
*/
acpi_gbl_root_node = &acpi_gbl_root_node_struct;
-
/* Enter the pre-defined names in the name table */
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Entering predefined entries into namespace\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Entering predefined entries into namespace\n"));
for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) {
status = acpi_ns_lookup (NULL, init_val->name, init_val->type,
- IMODE_LOAD_PASS2, NS_NO_UPSEARCH,
- NULL, &new_node);
+ ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH, NULL, &new_node);
if (ACPI_FAILURE (status) || (!new_node)) /* Must be on same line for code converter */ {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
* internal representation. Only types actually
* used for initial values are implemented here.
*/
-
switch (init_val->type) {
-
case ACPI_TYPE_INTEGER:
obj_desc->integer.value =
- (acpi_integer) STRTOUL (init_val->val, NULL, 10);
+ (acpi_integer) ACPI_STRTOUL (init_val->val, NULL, 10);
break;
/*
* Build an object around the static string
*/
- obj_desc->string.length = STRLEN (init_val->val);
+ obj_desc->string.length = ACPI_STRLEN (init_val->val);
obj_desc->string.pointer = init_val->val;
obj_desc->common.flags |= AOPOBJ_STATIC_POINTER;
break;
case ACPI_TYPE_MUTEX:
obj_desc->mutex.sync_level =
- (u16) STRTOUL (init_val->val, NULL, 10);
+ (u16) ACPI_STRTOUL (init_val->val, NULL, 10);
- if (STRCMP (init_val->name, "_GL_") == 0) {
+ if (ACPI_STRCMP (init_val->name, "_GL_") == 0) {
/*
* Create a counting semaphore for the
* global lock
*/
status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT,
1, &obj_desc->mutex.semaphore);
-
if (ACPI_FAILURE (status)) {
goto unlock_and_exit;
}
*/
acpi_gbl_global_lock_semaphore = obj_desc->mutex.semaphore;
}
-
else {
/* Create a mutex */
status = acpi_os_create_semaphore (1, 1,
&obj_desc->mutex.semaphore);
-
if (ACPI_FAILURE (status)) {
goto unlock_and_exit;
}
default:
- REPORT_ERROR (("Unsupported initial type value %X\n",
+ ACPI_REPORT_ERROR (("Unsupported initial type value %X\n",
init_val->type));
acpi_ut_remove_reference (obj_desc);
obj_desc = NULL;
unlock_and_exit:
- acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (status);
}
acpi_ns_lookup (
acpi_generic_state *scope_info,
NATIVE_CHAR *pathname,
- acpi_object_type8 type,
- operating_mode interpreter_mode,
+ acpi_object_type type,
+ acpi_interpreter_mode interpreter_mode,
u32 flags,
acpi_walk_state *walk_state,
acpi_namespace_node **return_node)
acpi_status status;
acpi_namespace_node *prefix_node;
acpi_namespace_node *current_node = NULL;
- acpi_namespace_node *scope_to_push = NULL;
acpi_namespace_node *this_node = NULL;
u32 num_segments;
acpi_name simple_name;
- u8 null_name_path = FALSE;
- acpi_object_type8 type_to_check_for;
- acpi_object_type8 this_search_type;
- u32 local_flags = flags & ~NS_ERROR_IF_FOUND;
+ acpi_object_type type_to_check_for;
+ acpi_object_type this_search_type;
+ u32 local_flags = flags & ~ACPI_NS_ERROR_IF_FOUND;
- DEBUG_EXEC (u32 i;)
-
- FUNCTION_TRACE ("Ns_lookup");
+ ACPI_FUNCTION_TRACE ("Ns_lookup");
if (!return_node) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
-
acpi_gbl_ns_lookup_count++;
-
- *return_node = ENTRY_NOT_FOUND;
-
+ *return_node = ACPI_ENTRY_NOT_FOUND;
if (!acpi_gbl_root_node) {
- return (AE_NO_NAMESPACE);
+ return_ACPI_STATUS (AE_NO_NAMESPACE);
}
/*
*/
if ((!scope_info) ||
(!scope_info->scope.node)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Null scope prefix, using root node (%p)\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+ "Null scope prefix, using root node (%p)\n",
acpi_gbl_root_node));
prefix_node = acpi_gbl_root_node;
prefix_node = scope_info->scope.node;
}
-
/*
* This check is explicitly split to relax the Type_to_check_for
* conditions for Bank_field_defn. Originally, both Bank_field_defn and
type_to_check_for = ACPI_TYPE_REGION;
}
-
else if (INTERNAL_TYPE_BANK_FIELD_DEFN == type) {
/* Bank_field_defn defines data fields in a Field Object */
type_to_check_for = ACPI_TYPE_ANY;
}
-
else {
type_to_check_for = type;
}
-
- /* TBD: [Restructure] - Move the pathname stuff into a new procedure */
-
- /* Examine the name pointer */
-
+ /*
+ * Begin examination of the actual pathname
+ */
if (!pathname) {
- /* 8-12-98 ASL Grammar Update supports null Name_path */
+ /* A Null Name_path is allowed and refers to the root */
- null_name_path = TRUE;
num_segments = 0;
- this_node = acpi_gbl_root_node;
+ this_node = acpi_gbl_root_node;
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
- "Null Pathname (Zero segments), Flags=%x\n", flags));
+ "Null Pathname (Zero segments), Flags=%x\n", flags));
}
-
else {
/*
- * Valid name pointer (Internal name format)
+ * Name pointer is valid (and must be in internal name format)
*
- * Check for prefixes. As represented in the AML stream, a
- * Pathname consists of an optional scope prefix followed by
- * a segment part.
+ * Check for scope prefixes:
*
- * If present, the scope prefix is either a Root_prefix (in
- * which case the name is fully qualified), or zero or more
- * Parent_prefixes (in which case the name's scope is relative
- * to the current scope).
+ * As represented in the AML stream, a namepath consists of an
+ * optional scope prefix followed by a name segment part.
*
- * The segment part consists of either:
- * - A single 4-byte name segment, or
- * - A Dual_name_prefix followed by two 4-byte name segments, or
- * - A Multi_name_prefix_op, followed by a byte indicating the
- * number of segments and the segments themselves.
+ * If present, the scope prefix is either a Root Prefix (in
+ * which case the name is fully qualified), or one or more
+ * Parent Prefixes (in which case the name's scope is relative
+ * to the current scope).
*/
if (*pathname == AML_ROOT_PREFIX) {
- /* Pathname is fully qualified, look in root name table */
+ /* Pathname is fully qualified, start from the root */
- current_node = acpi_gbl_root_node;
+ this_node = acpi_gbl_root_node;
- /* point to segment part */
+ /* Point to name segment part */
pathname++;
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching from root [%p]\n",
- current_node));
-
- /* Direct reference to root, "\" */
-
- if (!(*pathname)) {
- this_node = acpi_gbl_root_node;
- goto check_for_new_scope_and_exit;
- }
+ this_node));
}
-
else {
/* Pathname is relative to current scope, start there */
- current_node = prefix_node;
-
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching relative to pfx scope [%p]\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+ "Searching relative to pfx scope [%p]\n",
prefix_node));
/*
- * Handle up-prefix (carat). More than one prefix
- * is supported
+ * Handle multiple Parent Prefixes (carat) by just getting
+ * the parent node for each prefix instance.
*/
+ this_node = prefix_node;
while (*pathname == AML_PARENT_PREFIX) {
- /* Point to segment part or next Parent_prefix */
-
+ /*
+ * Point past this prefix to the name segment
+ * part or the next Parent Prefix
+ */
pathname++;
- /* Backup to the parent's scope */
+ /* Backup to the parent node */
- this_node = acpi_ns_get_parent_object (current_node);
+ this_node = acpi_ns_get_parent_node (this_node);
if (!this_node) {
/* Current scope has no parent scope */
- REPORT_ERROR (
- ("Too many parent prefixes (^) - reached root\n"));
+ ACPI_REPORT_ERROR (
+ ("ACPI path has too many parent prefixes (^) - reached beyond root node\n"));
return_ACPI_STATUS (AE_NOT_FOUND);
}
-
- current_node = this_node;
}
}
-
/*
- * Examine the name prefix opcode, if any,
- * to determine the number of segments
+ * Determine the number of ACPI name segments in this pathname.
+ *
+ * The segment part consists of either:
+ * - A Null name segment (0)
+ * - A Dual_name_prefix followed by two 4-byte name segments
+ * - A Multi_name_prefix followed by a byte indicating the
+ * number of segments and the segments themselves.
+ * - A single 4-byte name segment
+ *
+ * Examine the name prefix opcode, if any, to determine the number of
+ * segments.
*/
- if (*pathname == AML_DUAL_NAME_PREFIX) {
- num_segments = 2;
+ switch (*pathname) {
+ case 0:
+ /*
+ * Null name after a root or parent prefixes. We already
+ * have the correct target node and there are no name segments.
+ */
+ num_segments = 0;
- /* point to first segment */
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+ "Prefix-only Pathname (Zero name segments), Flags=%x\n", flags));
+ break;
+
+ case AML_DUAL_NAME_PREFIX:
+ /* Two segments, point to first name segment */
+
+ num_segments = 2;
pathname++;
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Dual Pathname (2 segments, Flags=%X)\n", flags));
- }
+ break;
- else if (*pathname == AML_MULTI_NAME_PREFIX_OP) {
- num_segments = (u32)* (u8 *) ++pathname;
+ case AML_MULTI_NAME_PREFIX_OP:
- /* point to first segment */
+ /* Extract segment count, point to first name segment */
+ pathname++;
+ num_segments = (u32) (u8) *pathname;
pathname++;
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Multi Pathname (%d Segments, Flags=%X) \n",
num_segments, flags));
- }
+ break;
- else {
+ default:
/*
- * No Dual or Multi prefix, hence there is only one
- * segment and Pathname is already pointing to it.
+ * Not a Null name, no Dual or Multi prefix, hence there is
+ * only one name segment and Pathname is already pointing to it.
*/
num_segments = 1;
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Simple Pathname (1 segment, Flags=%X)\n", flags));
+ break;
}
-#ifdef ACPI_DEBUG
-
- /* TBD: [Restructure] Make this a procedure */
-
- /* Debug only: print the entire name that we are about to lookup */
-
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "["));
-
- for (i = 0; i < num_segments; i++) {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_NAMES, "%4.4s/", (char*)&pathname[i * 4]));
- }
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_NAMES, "]\n"));
-#endif
+ ACPI_DEBUG_EXEC (acpi_ns_print_pathname (num_segments, pathname));
}
-
/*
- * Search namespace for each segment of the name.
- * Loop through and verify/add each name segment.
+ * Search namespace for each segment of the name. Loop through and
+ * verify/add each name segment.
*/
- while (num_segments-- && current_node) {
+ current_node = this_node;
+ while (num_segments && current_node) {
/*
* Search for the current name segment under the current
- * named object. The Type is significant only at the last (topmost)
- * level. (We don't care about the types along the path, only
+ * named object. The Type is significant only at the last name
+ * segment. (We don't care about the types along the path, only
* the type of the final target object.)
*/
this_search_type = ACPI_TYPE_ANY;
+ num_segments--;
if (!num_segments) {
this_search_type = type;
local_flags = flags;
}
- /* Pluck one ACPI name from the front of the pathname */
+ /* Extract one ACPI name from the front of the pathname */
- MOVE_UNALIGNED32_TO_32 (&simple_name, pathname);
+ ACPI_MOVE_UNALIGNED32_TO_32 (&simple_name, pathname);
/* Try to find the ACPI name */
- status = acpi_ns_search_and_enter (simple_name, walk_state,
- current_node, interpreter_mode,
- this_search_type, local_flags,
- &this_node);
-
+ status = acpi_ns_search_and_enter (simple_name, walk_state, current_node,
+ interpreter_mode, this_search_type, local_flags, &this_node);
if (ACPI_FAILURE (status)) {
if (status == AE_NOT_FOUND) {
- /* Name not found in ACPI namespace */
+ /* Name not found in ACPI namespace */
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
- "Name [%4.4s] not found in scope %p\n",
- (char*)&simple_name, current_node));
+ "Name [%4.4s] not found in scope [%4.4s] %p\n",
+ (char *) &simple_name, (char *) ¤t_node->name, current_node));
}
return_ACPI_STATUS (status);
}
-
/*
+ * Sanity typecheck of the target object:
+ *
* If 1) This is the last segment (Num_segments == 0)
- * 2) and looking for a specific type
+ * 2) And we are looking for a specific type
* (Not checking for TYPE_ANY)
* 3) Which is not an alias
- * 4) which is not a local type (TYPE_DEF_ANY)
- * 5) which is not a local type (TYPE_SCOPE)
- * 6) which is not a local type (TYPE_INDEX_FIELD_DEFN)
- * 7) and type of object is known (not TYPE_ANY)
- * 8) and object does not match request
+ * 4) Which is not a local type (TYPE_DEF_ANY)
+ * 5) Which is not a local type (TYPE_SCOPE)
+ * 6) Which is not a local type (TYPE_INDEX_FIELD_DEFN)
+ * 7) And the type of target object is known (not TYPE_ANY)
+ * 8) And target object does not match what we are looking for
*
* Then we have a type mismatch. Just warn and ignore it.
*/
(this_node->type != type_to_check_for)) {
/* Complain about a type mismatch */
- REPORT_WARNING (
+ ACPI_REPORT_WARNING (
("Ns_lookup: %4.4s, type %X, checking for type %X\n",
- (char*)&simple_name, this_node->type, type_to_check_for));
+ (char *) &simple_name, this_node->type, type_to_check_for));
}
/*
* specific type, but the type of found object is known, use that type
* to see if it opens a scope.
*/
- if ((0 == num_segments) && (ACPI_TYPE_ANY == type)) {
+ if ((num_segments == 0) && (type == ACPI_TYPE_ANY)) {
type = this_node->type;
}
- if ((num_segments || acpi_ns_opens_scope (type)) &&
- (this_node->child == NULL)) {
- /*
- * More segments or the type implies enclosed scope,
- * and the next scope has not been allocated.
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Load mode=%X This_node=%p\n",
- interpreter_mode, this_node));
- }
-
- current_node = this_node;
-
- /* point to next name segment */
+ /* Point to next name segment and make this node current */
pathname += ACPI_NAME_SIZE;
+ current_node = this_node;
}
-
/*
* Always check if we need to open a new scope
*/
-check_for_new_scope_and_exit:
-
- if (!(flags & NS_DONT_OPEN_SCOPE) && (walk_state)) {
+ if (!(flags & ACPI_NS_DONT_OPEN_SCOPE) && (walk_state)) {
/*
- * If entry is a type which opens a scope,
- * push the new scope on the scope stack.
+ * If entry is a type which opens a scope, push the new scope on the
+ * scope stack.
*/
if (acpi_ns_opens_scope (type_to_check_for)) {
- /* 8-12-98 ASL Grammar Update supports null Name_path */
-
- if (null_name_path) {
- /* TBD: [Investigate] - is this the correct thing to do? */
-
- scope_to_push = NULL;
- }
- else {
- scope_to_push = this_node;
- }
-
- status = acpi_ds_scope_stack_push (scope_to_push, type,
- walk_state);
+ status = acpi_ds_scope_stack_push (this_node, type, walk_state);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Set global scope to %p\n", scope_to_push));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Setting global scope to %p\n", this_node));
}
}
/*******************************************************************************
*
* Module Name: nsalloc - Namespace allocation and deletion utilities
- * $Revision: 60 $
+ * $Revision: 70 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_NAMESPACE
- MODULE_NAME ("nsalloc")
+ ACPI_MODULE_NAME ("nsalloc")
/*******************************************************************************
acpi_namespace_node *node;
- FUNCTION_TRACE ("Ns_create_node");
+ ACPI_FUNCTION_TRACE ("Ns_create_node");
node = ACPI_MEM_CALLOCATE (sizeof (acpi_namespace_node));
ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_allocated++);
- node->data_type = ACPI_DESC_TYPE_NAMED;
node->name = name;
node->reference_count = 1;
+ ACPI_SET_DESCRIPTOR_TYPE (node, ACPI_DESC_TYPE_NAMED);
return_PTR (node);
}
acpi_namespace_node *next_node;
- FUNCTION_TRACE_PTR ("Ns_delete_node", node);
+ ACPI_FUNCTION_TRACE_PTR ("Ns_delete_node", node);
- parent_node = acpi_ns_get_parent_object (node);
+ parent_node = acpi_ns_get_parent_node (node);
prev_node = NULL;
next_node = parent_node->child;
ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_freed++);
/*
- * Detach an object if there is one
+ * Detach an object if there is one then delete the node
*/
- if (node->object) {
- acpi_ns_detach_object (node);
- }
-
+ acpi_ns_detach_object (node);
ACPI_MEM_FREE (node);
return_VOID;
}
*
* RETURN: None
*
- * DESCRIPTION: Initialize a new entry within a namespace table.
+ * DESCRIPTION: Initialize a new namespace node and install it amongst
+ * its peers.
+ *
+ * Note: Current namespace lookup is linear search, so the nodes
+ * are not linked in any particular order.
*
******************************************************************************/
acpi_walk_state *walk_state,
acpi_namespace_node *parent_node, /* Parent */
acpi_namespace_node *node, /* New Child*/
- acpi_object_type8 type)
+ acpi_object_type type)
{
u16 owner_id = TABLE_ID_DSDT;
acpi_namespace_node *child_node;
- FUNCTION_TRACE ("Ns_install_node");
+ ACPI_FUNCTION_TRACE ("Ns_install_node");
/*
owner_id = walk_state->owner_id;
}
-
- /* link the new entry into the parent and existing children */
-
- /* TBD: Could be first, last, or alphabetic */
+ /* Link the new entry into the parent and existing children */
child_node = parent_node->child;
if (!child_node) {
parent_node->child = node;
}
-
else {
while (!(child_node->flags & ANOBJ_END_OF_PEER_LIST)) {
child_node = child_node->peer;
* real definition is found later.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "[%4.4s] is a forward reference\n",
- (char*)&node->name));
+ (char *) &node->name));
}
/*
}
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%4.4s added to %p at %p\n",
- (char*)&node->name, parent_node, node));
+ (char *) &node->name, parent_node, node));
/*
* Increment the reference count(s) of all parents up to
* the root!
*/
- while ((node = acpi_ns_get_parent_object (node)) != NULL) {
+ while ((node = acpi_ns_get_parent_node (node)) != NULL) {
node->reference_count++;
}
*
* RETURN: None.
*
- * DESCRIPTION: Delete all children of the parent object. Deletes a
- * "scope".
+ * DESCRIPTION: Delete all children of the parent object. In other words,
+ * deletes a "scope".
*
******************************************************************************/
u8 flags;
- FUNCTION_TRACE_PTR ("Ns_delete_children", parent_node);
+ ACPI_FUNCTION_TRACE_PTR ("Ns_delete_children", parent_node);
if (!parent_node) {
* RETURN: None.
*
* DESCRIPTION: Delete a subtree of the namespace. This includes all objects
- * stored within the subtree. Scope tables are deleted also
+ * stored within the subtree.
*
******************************************************************************/
u32 level = 1;
- FUNCTION_TRACE ("Ns_delete_namespace_subtree");
+ ACPI_FUNCTION_TRACE ("Ns_delete_namespace_subtree");
if (!parent_node) {
child_node = 0;
}
}
-
else {
/*
* No more children of this parent node.
/* Move up the tree to the grandparent */
- parent_node = acpi_ns_get_parent_object (parent_node);
+ parent_node = acpi_ns_get_parent_node (parent_node);
}
}
acpi_ns_remove_reference (
acpi_namespace_node *node)
{
- acpi_namespace_node *next_node;
+ acpi_namespace_node *parent_node;
+ acpi_namespace_node *this_node;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/*
* Decrement the reference count(s) of this node and all
* nodes up to the root, Delete anything with zero remaining references.
*/
- next_node = node;
- while (next_node) {
- /* Decrement the reference count on this node*/
+ this_node = node;
+ while (this_node) {
+ /* Prepare to move up to parent */
- next_node->reference_count--;
+ 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 (!next_node->reference_count) {
+ if (!this_node->reference_count) {
/* Delete all children and delete the node */
- acpi_ns_delete_children (next_node);
- acpi_ns_delete_node (next_node);
+ acpi_ns_delete_children (this_node);
+ acpi_ns_delete_node (this_node);
}
- /* Move up to parent */
-
- next_node = acpi_ns_get_parent_object (next_node);
+ this_node = parent_node;
}
}
u16 owner_id)
{
acpi_namespace_node *child_node;
+ acpi_namespace_node *deletion_node;
u32 level;
acpi_namespace_node *parent_node;
- FUNCTION_TRACE ("Ns_delete_namespace_by_owner");
+ ACPI_FUNCTION_TRACE_U32 ("Ns_delete_namespace_by_owner", owner_id);
- parent_node = acpi_gbl_root_node;
- child_node = 0;
- level = 1;
+ parent_node = acpi_gbl_root_node;
+ child_node = NULL;
+ deletion_node = NULL;
+ level = 1;
/*
* Traverse the tree of nodes until we bubble back up
* to where we started.
*/
while (level > 0) {
- /* Get the next node in this scope (NULL if none) */
+ /*
+ * Get the next child of this parent node. When Child_node is NULL,
+ * the first child of the parent is returned
+ */
+ child_node = acpi_ns_get_next_node (ACPI_TYPE_ANY, parent_node, child_node);
+
+ if (deletion_node) {
+ acpi_ns_remove_reference (deletion_node);
+ deletion_node = NULL;
+ }
- child_node = acpi_ns_get_next_node (ACPI_TYPE_ANY, parent_node,
- child_node);
if (child_node) {
if (child_node->owner_id == owner_id) {
- /* Found a child node - detach any attached object */
+ /* Found a matching child node - detach any attached object */
acpi_ns_detach_object (child_node);
}
/* Check if this node has any children */
- if (acpi_ns_get_next_node (ACPI_TYPE_ANY, child_node, 0)) {
+ if (acpi_ns_get_next_node (ACPI_TYPE_ANY, child_node, NULL)) {
/*
* There is at least one child of this node,
* visit the node
*/
level++;
parent_node = child_node;
- child_node = 0;
+ child_node = NULL;
}
-
else if (child_node->owner_id == owner_id) {
- acpi_ns_remove_reference (child_node);
+ deletion_node = child_node;
}
}
-
else {
/*
* No more children of this parent node.
* Move up to the grandparent.
*/
level--;
-
if (level != 0) {
if (parent_node->owner_id == owner_id) {
- acpi_ns_remove_reference (parent_node);
+ deletion_node = parent_node;
}
}
/* Move up the tree to the grandparent */
- parent_node = acpi_ns_get_parent_object (parent_node);
+ parent_node = acpi_ns_get_parent_node (parent_node);
}
}
/******************************************************************************
*
* Module Name: nsdump - table dumping routines for debug
- * $Revision: 105 $
+ * $Revision: 127 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_NAMESPACE
- MODULE_NAME ("nsdump")
-
+ ACPI_MODULE_NAME ("nsdump")
#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER)
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ns_print_pathname
+ *
+ * PARAMETERS: Num_segment - Number of ACPI name segments
+ * Pathname - The compressed (internal) path
+ *
+ * DESCRIPTION: Print an object's full namespace pathname
+ *
+ ******************************************************************************/
+
+void
+acpi_ns_print_pathname (
+ u32 num_segments,
+ char *pathname)
+{
+ ACPI_FUNCTION_NAME ("Acpi_ns_print_pathname");
+
+
+ if (!(acpi_dbg_level & ACPI_LV_NAMES) || !(acpi_dbg_layer & ACPI_NAMESPACE)) {
+ return;
+ }
+
+ /* Print the entire name */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "["));
+
+ while (num_segments) {
+ acpi_os_printf ("%4.4s", pathname);
+ pathname += ACPI_NAME_SIZE;
+
+ num_segments--;
+ if (num_segments) {
+ acpi_os_printf (".");
+ }
+ }
+
+ acpi_os_printf ("]\n");
+}
+
+
/*******************************************************************************
*
* FUNCTION: Acpi_ns_dump_pathname
u32 level,
u32 component)
{
- NATIVE_CHAR *buffer;
- u32 length;
+ acpi_buffer buffer;
+ acpi_status status;
- FUNCTION_TRACE ("Ns_dump_pathname");
+ ACPI_FUNCTION_TRACE ("Ns_dump_pathname");
/* Do this only if the requested debug level and component are enabled */
return_ACPI_STATUS (AE_OK);
}
- buffer = ACPI_MEM_ALLOCATE (PATHNAME_MAX);
- if (!buffer) {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
/* Convert handle to a full pathname and print it (with supplied message) */
- length = PATHNAME_MAX;
- if (ACPI_SUCCESS (acpi_ns_handle_to_pathname (handle, &length, buffer))) {
- acpi_os_printf ("%s %s (%p)\n", msg, buffer, handle);
- }
+ buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
- ACPI_MEM_FREE (buffer);
+ status = acpi_ns_handle_to_pathname (handle, &buffer);
+ if (ACPI_SUCCESS (status)) {
+ acpi_os_printf ("%s %s (Node %p)\n", msg, buffer.pointer, handle);
+ ACPI_MEM_FREE (buffer.pointer);
+ }
- return_ACPI_STATUS (AE_OK);
+ return_ACPI_STATUS (status);
}
acpi_walk_info *info = (acpi_walk_info *) context;
acpi_namespace_node *this_node;
acpi_operand_object *obj_desc = NULL;
- acpi_object_type8 obj_type;
- acpi_object_type8 type;
+ acpi_object_type obj_type;
+ acpi_object_type type;
u32 bytes_to_dump;
u32 downstream_sibling_mask = 0;
u32 level_tmp;
u32 which_bit;
u32 i;
+ u32 dbg_level;
- PROC_NAME ("Ns_dump_one_object");
+ ACPI_FUNCTION_NAME ("Ns_dump_one_object");
this_node = acpi_ns_map_handle_to_node (obj_handle);
return (AE_OK);
}
-
/* Indent the object according to the level */
while (level_tmp--) {
-
/* Print appropriate characters to form tree structure */
if (level_tmp) {
if (downstream_sibling_mask & which_bit) {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "|"));
+ acpi_os_printf ("|");
}
-
else {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " "));
+ acpi_os_printf (" ");
}
which_bit <<= 1;
}
-
else {
if (acpi_ns_exist_downstream_sibling (this_node + 1)) {
downstream_sibling_mask |= (1 << (level - 1));
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "+"));
+ acpi_os_printf ("+");
}
-
else {
downstream_sibling_mask &= ACPI_UINT32_MAX ^ (1 << (level - 1));
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "+"));
+ acpi_os_printf ("+");
}
if (this_node->child == NULL) {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "-"));
+ acpi_os_printf ("-");
}
-
else if (acpi_ns_exist_downstream_sibling (this_node->child)) {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "+"));
+ acpi_os_printf ("+");
}
-
else {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "-"));
+ acpi_os_printf ("-");
}
}
}
-
/* Check the integrity of our data */
if (type > INTERNAL_TYPE_MAX) {
- type = INTERNAL_TYPE_DEF_ANY; /* prints as *ERROR* */
+ type = INTERNAL_TYPE_DEF_ANY; /* prints as *ERROR* */
}
if (!acpi_ut_valid_acpi_name (this_node->name)) {
- REPORT_WARNING (("Invalid ACPI Name %08X\n", this_node->name));
+ ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n", this_node->name));
}
/*
* Now we can print out the pertinent information
*/
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " %4.4s %-12s %p",
- (char*)&this_node->name, acpi_ut_get_type_name (type), this_node));
+ acpi_os_printf (" %4.4s %-12s %p",
+ (char *) &this_node->name, acpi_ut_get_type_name (type), this_node);
- obj_desc = this_node->object;
+ dbg_level = acpi_dbg_level;
+ acpi_dbg_level = 0;
+ obj_desc = acpi_ns_get_attached_object (this_node);
+ acpi_dbg_level = dbg_level;
switch (info->display_type) {
case ACPI_DISPLAY_SUMMARY:
if (!obj_desc) {
/* No attached object, we are done */
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n"));
+ acpi_os_printf ("\n");
return (AE_OK);
}
-
switch (type) {
case ACPI_TYPE_PROCESSOR:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " ID %d Addr %.4X Len %.4X\n",
+ acpi_os_printf (" ID %d Addr %.4X Len %.4X\n",
obj_desc->processor.proc_id,
obj_desc->processor.address,
- obj_desc->processor.length));
+ obj_desc->processor.length);
break;
case ACPI_TYPE_DEVICE:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Notification object: %p", obj_desc));
+ acpi_os_printf (" Notification object: %p", obj_desc);
break;
case ACPI_TYPE_METHOD:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Args %d Len %.4X Aml %p \n",
+ acpi_os_printf (" Args %d Len %.4X Aml %p \n",
obj_desc->method.param_count,
obj_desc->method.aml_length,
- obj_desc->method.aml_start));
+ obj_desc->method.aml_start);
break;
case ACPI_TYPE_INTEGER:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " = %8.8X%8.8X\n",
- HIDWORD (obj_desc->integer.value),
- LODWORD (obj_desc->integer.value)));
+ acpi_os_printf (" = %8.8X%8.8X\n",
+ ACPI_HIDWORD (obj_desc->integer.value),
+ ACPI_LODWORD (obj_desc->integer.value));
break;
case ACPI_TYPE_PACKAGE:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Elements %.2X\n",
- obj_desc->package.count));
+ acpi_os_printf (" Elements %.2X\n",
+ obj_desc->package.count);
break;
case ACPI_TYPE_BUFFER:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Len %.2X",
- obj_desc->buffer.length));
+ acpi_os_printf (" Len %.2X",
+ obj_desc->buffer.length);
/* Dump some of the buffer */
if (obj_desc->buffer.length > 0) {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " ="));
+ acpi_os_printf (" =");
for (i = 0; (i < obj_desc->buffer.length && i < 12); i++) {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " %.2X",
- obj_desc->buffer.pointer[i]));
+ acpi_os_printf (" %.2X", obj_desc->buffer.pointer[i]);
}
}
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n"));
+ acpi_os_printf ("\n");
break;
case ACPI_TYPE_STRING:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Len %.2X",
- obj_desc->string.length));
+ acpi_os_printf (" Len %.2X", obj_desc->string.length);
if (obj_desc->string.length > 0) {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " = \"%.32s\"...",
- obj_desc->string.pointer));
+ acpi_os_printf (" = \"%.32s\"...", obj_desc->string.pointer);
}
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n"));
+ acpi_os_printf ("\n");
break;
case ACPI_TYPE_REGION:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " [%s]",
- acpi_ut_get_region_name (obj_desc->region.space_id)));
+ acpi_os_printf (" [%s]", acpi_ut_get_region_name (obj_desc->region.space_id));
if (obj_desc->region.flags & AOPOBJ_DATA_VALID) {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Addr %8.8X%8.8X Len %.4X\n",
- HIDWORD(obj_desc->region.address),
- LODWORD(obj_desc->region.address),
- obj_desc->region.length));
+ acpi_os_printf (" Addr %8.8X%8.8X Len %.4X\n",
+ ACPI_HIDWORD (obj_desc->region.address),
+ ACPI_LODWORD (obj_desc->region.address),
+ obj_desc->region.length);
}
else {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " [Address/Length not evaluated]\n"));
+ acpi_os_printf (" [Address/Length not evaluated]\n");
}
break;
case INTERNAL_TYPE_REFERENCE:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " [%s]\n",
- acpi_ps_get_opcode_name (obj_desc->reference.opcode)));
+ acpi_os_printf (" [%s]\n",
+ acpi_ps_get_opcode_name (obj_desc->reference.opcode));
break;
case ACPI_TYPE_BUFFER_FIELD:
-
- /* TBD: print Buffer name when we can easily get it */
+ if (obj_desc->buffer_field.buffer_obj &&
+ obj_desc->buffer_field.buffer_obj->buffer.node) {
+ acpi_os_printf (" Buf [%4.4s]",
+ (char *) &obj_desc->buffer_field.buffer_obj->buffer.node->name);
+ }
break;
case INTERNAL_TYPE_REGION_FIELD:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Rgn [%4.4s]",
- (char *) &obj_desc->common_field.region_obj->region.node->name));
+ acpi_os_printf (" Rgn [%4.4s]",
+ (char *) &obj_desc->common_field.region_obj->region.node->name);
break;
case INTERNAL_TYPE_BANK_FIELD:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Rgn [%4.4s]",
- (char *) &obj_desc->common_field.region_obj->region.node->name));
+ acpi_os_printf (" Rgn [%4.4s] Bnk [%4.4s]",
+ (char *) &obj_desc->common_field.region_obj->region.node->name,
+ (char *) &obj_desc->bank_field.bank_obj->common_field.node->name);
break;
case INTERNAL_TYPE_INDEX_FIELD:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Rgn [%4.4s]",
- (char *) &obj_desc->index_field.index_obj->common_field.region_obj->region.node->name));
+ acpi_os_printf (" Idx [%4.4s] Dat [%4.4s]",
+ (char *) &obj_desc->index_field.index_obj->common_field.node->name,
+ (char *) &obj_desc->index_field.data_obj->common_field.node->name);
break;
default:
-
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Object %p\n", obj_desc));
+ acpi_os_printf (" Object %p\n", obj_desc);
break;
}
case INTERNAL_TYPE_REGION_FIELD:
case INTERNAL_TYPE_BANK_FIELD:
case INTERNAL_TYPE_INDEX_FIELD:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Off %.2X Len %.2X Acc %.2d\n",
- (obj_desc->common_field.base_byte_offset * 8) + obj_desc->common_field.start_field_bit_offset,
- obj_desc->common_field.bit_length,
- obj_desc->common_field.access_bit_width));
+ acpi_os_printf (" Off %.2X Len %.2X Acc %.2d\n",
+ (obj_desc->common_field.base_byte_offset * 8)
+ + obj_desc->common_field.start_field_bit_offset,
+ obj_desc->common_field.bit_length,
+ obj_desc->common_field.access_byte_width);
break;
}
case ACPI_DISPLAY_OBJECTS:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "%p O:%p",
- this_node, obj_desc));
+ acpi_os_printf ("%p O:%p",
+ this_node, obj_desc);
if (!obj_desc) {
/* No attached object, we are done */
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n"));
+ acpi_os_printf ("\n");
return (AE_OK);
}
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(R%d)",
- obj_desc->common.reference_count));
+ acpi_os_printf ("(R%d)",
+ obj_desc->common.reference_count);
switch (type) {
-
case ACPI_TYPE_METHOD:
/* Name is a Method and its AML offset/length are set */
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " M:%p-%X\n",
- obj_desc->method.aml_start,
- obj_desc->method.aml_length));
-
+ acpi_os_printf (" M:%p-%X\n", obj_desc->method.aml_start,
+ obj_desc->method.aml_length);
break;
-
case ACPI_TYPE_INTEGER:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " N:%X%X\n",
- HIDWORD(obj_desc->integer.value),
- LODWORD(obj_desc->integer.value)));
+ acpi_os_printf (" N:%X%X\n", ACPI_HIDWORD(obj_desc->integer.value),
+ ACPI_LODWORD(obj_desc->integer.value));
break;
-
case ACPI_TYPE_STRING:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " S:%p-%X\n",
- obj_desc->string.pointer,
- obj_desc->string.length));
+ acpi_os_printf (" S:%p-%X\n", obj_desc->string.pointer,
+ obj_desc->string.length);
break;
-
case ACPI_TYPE_BUFFER:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " B:%p-%X\n",
- obj_desc->buffer.pointer,
- obj_desc->buffer.length));
+ acpi_os_printf (" B:%p-%X\n", obj_desc->buffer.pointer,
+ obj_desc->buffer.length);
break;
-
default:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n"));
+ acpi_os_printf ("\n");
break;
}
break;
+
+
+ default:
+ acpi_os_printf ("\n");
+ break;
}
/* If debug turned off, done */
/* If there is an attached object, display it */
- obj_desc = this_node->object;
+ dbg_level = acpi_dbg_level;
+ acpi_dbg_level = 0;
+ obj_desc = acpi_ns_get_attached_object (this_node);
+ acpi_dbg_level = dbg_level;
/* Dump attached objects */
while (obj_desc) {
obj_type = INTERNAL_TYPE_INVALID;
+ acpi_os_printf (" Attached Object %p: ", obj_desc);
/* Decode the type of attached object and dump the contents */
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Attached Object %p: ", obj_desc));
+ switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) {
+ case ACPI_DESC_TYPE_NAMED:
- if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(Ptr to Node)\n"));
+ acpi_os_printf ("(Ptr to Node)\n");
bytes_to_dump = sizeof (acpi_namespace_node);
- }
+ break;
+
+ case ACPI_DESC_TYPE_INTERNAL:
- else if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_INTERNAL)) {
obj_type = obj_desc->common.type;
if (obj_type > INTERNAL_TYPE_MAX) {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(Ptr to ACPI Object type %X [UNKNOWN])\n", obj_type));
+ acpi_os_printf ("(Ptr to ACPI Object type %X [UNKNOWN])\n", obj_type);
bytes_to_dump = 32;
}
-
else {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(Ptr to ACPI Object type %2.2X [%s])\n",
- obj_type, acpi_ut_get_type_name (obj_type)));
+ acpi_os_printf ("(Ptr to ACPI Object type %2.2X [%s])\n",
+ obj_type, acpi_ut_get_type_name (obj_type));
bytes_to_dump = sizeof (acpi_operand_object);
}
- }
+ break;
- else {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(String or Buffer - not descriptor)\n"));
+
+ default:
+
+ acpi_os_printf ("(String or Buffer ptr - not an object descriptor)\n");
bytes_to_dump = 16;
+ break;
}
- DUMP_BUFFER (obj_desc, bytes_to_dump);
+ ACPI_DUMP_BUFFER (obj_desc, bytes_to_dump);
/* If value is NOT an internal object, we are done */
- if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) {
+ if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_INTERNAL) {
goto cleanup;
}
goto cleanup;
}
- obj_type = INTERNAL_TYPE_INVALID; /* Terminate loop after next pass */
+ obj_type = INTERNAL_TYPE_INVALID; /* Terminate loop after next pass */
}
cleanup:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n"));
+ acpi_os_printf ("\n");
return (AE_OK);
}
void
acpi_ns_dump_objects (
- acpi_object_type8 type,
+ acpi_object_type type,
u8 display_type,
u32 max_depth,
u32 owner_id,
acpi_walk_info info;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
info.debug_level = ACPI_LV_TABLES;
info.display_type = display_type;
- acpi_ns_walk_namespace (type, start_handle, max_depth, NS_WALK_NO_UNLOCK, acpi_ns_dump_one_object,
+ acpi_ns_walk_namespace (type, start_handle, max_depth, ACPI_NS_WALK_NO_UNLOCK, acpi_ns_dump_one_object,
(void *) &info, NULL);
}
u32 i;
- PROC_NAME ("Ns_dump_one_device");
+ ACPI_FUNCTION_NAME ("Ns_dump_one_device");
status = acpi_ns_dump_one_object (obj_handle, level, context, return_value);
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " HID: %s, ADR: %8.8X%8.8X, Status: %x\n",
- info.hardware_id, HIDWORD(info.address), LODWORD(info.address), info.current_status));
+ info.hardware_id,
+ ACPI_HIDWORD (info.address), ACPI_LODWORD (info.address),
+ info.current_status));
}
return (status);
acpi_handle sys_bus_handle;
- PROC_NAME ("Ns_dump_root_devices");
+ ACPI_FUNCTION_NAME ("Ns_dump_root_devices");
/* Only dump the table if tracing is enabled */
return;
}
- acpi_get_handle (0, NS_SYSTEM_BUS, &sys_bus_handle);
+ acpi_get_handle (0, ACPI_NS_SYSTEM_BUS, &sys_bus_handle);
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Display of all devices in the namespace:\n"));
- acpi_ns_walk_namespace (ACPI_TYPE_DEVICE, sys_bus_handle, ACPI_UINT32_MAX, NS_WALK_NO_UNLOCK,
+ acpi_ns_walk_namespace (ACPI_TYPE_DEVICE, sys_bus_handle, ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
acpi_ns_dump_one_device, NULL, NULL);
}
acpi_handle search_handle = search_base;
- FUNCTION_TRACE ("Ns_dump_tables");
+ ACPI_FUNCTION_TRACE ("Ns_dump_tables");
if (!acpi_gbl_root_node) {
return_VOID;
}
- if (NS_ALL == search_base) {
+ if (ACPI_NS_ALL == search_base) {
/* entire namespace */
search_handle = acpi_gbl_root_node;
acpi_walk_info info;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
info.debug_level = debug_level;
info.owner_id = ACPI_UINT32_MAX;
+ info.display_type = ACPI_DISPLAY_SUMMARY;
acpi_ns_dump_one_object (handle, 1, &info, NULL);
}
*
* Module Name: nseval - Object evaluation interfaces -- includes control
* method lookup and execution.
- * $Revision: 102 $
+ * $Revision: 109 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_NAMESPACE
- MODULE_NAME ("nseval")
+ ACPI_MODULE_NAME ("nseval")
/*******************************************************************************
acpi_generic_state scope_info;
- FUNCTION_TRACE ("Ns_evaluate_relative");
+ ACPI_FUNCTION_TRACE ("Ns_evaluate_relative");
/*
/* Get the prefix handle and Node */
- acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
prefix_node = acpi_ns_map_handle_to_node (handle);
if (!prefix_node) {
- acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
status = AE_BAD_PARAMETER;
goto cleanup;
}
scope_info.scope.node = prefix_node;
status = acpi_ns_lookup (&scope_info, internal_path, ACPI_TYPE_ANY,
- IMODE_EXECUTE, NS_NO_UPSEARCH, NULL,
+ ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL,
&node);
- acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Object [%s] not found [%s]\n",
* to evaluate it.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s [%p] Value %p\n",
- pathname, node, node->object));
+ pathname, node, acpi_ns_get_attached_object (node)));
status = acpi_ns_evaluate_by_handle (node, params, return_object);
NATIVE_CHAR *internal_path = NULL;
- FUNCTION_TRACE ("Ns_evaluate_by_name");
+ ACPI_FUNCTION_TRACE ("Ns_evaluate_by_name");
/* Build an internal name string for the method */
return_ACPI_STATUS (status);
}
- acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
/* Lookup the name in the namespace */
status = acpi_ns_lookup (NULL, internal_path, ACPI_TYPE_ANY,
- IMODE_EXECUTE, NS_NO_UPSEARCH, NULL,
+ ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL,
&node);
- acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Object at [%s] was not found, status=%.4X\n",
* to evaluate it.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s [%p] Value %p\n",
- pathname, node, node->object));
+ pathname, node, acpi_ns_get_attached_object (node)));
status = acpi_ns_evaluate_by_handle (node, params, return_object);
acpi_operand_object *local_return_object;
- FUNCTION_TRACE ("Ns_evaluate_by_handle");
+ ACPI_FUNCTION_TRACE ("Ns_evaluate_by_handle");
/* Check if namespace has been initialized */
/* Get the prefix handle and Node */
- acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
node = acpi_ns_map_handle_to_node (handle);
if (!node) {
- acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
acpi_operand_object *obj_desc;
- FUNCTION_TRACE ("Ns_execute_control_method");
+ ACPI_FUNCTION_TRACE ("Ns_execute_control_method");
/* Verify that there is a method associated with this object */
if (!obj_desc) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No attached method object\n"));
- acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (AE_NULL_OBJECT);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Control method at Offset %p Length %x]\n",
obj_desc->method.aml_start + 1, obj_desc->method.aml_length - 1));
- DUMP_PATHNAME (method_node, "Ns_execute_control_method: Executing",
+ ACPI_DUMP_PATHNAME (method_node, "Ns_execute_control_method: Executing",
ACPI_LV_NAMES, _COMPONENT);
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "At offset %p\n",
* interpreter locks to ensure that no thread is using the portion of the
* namespace that is being deleted.
*/
- acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
/*
* Execute the method via the interpreter. The interpreter is locked
*
* DESCRIPTION: Return the current value of the object
*
- * MUTEX: Assumes namespace is locked
+ * MUTEX: Assumes namespace is locked, leaves namespace unlocked
*
******************************************************************************/
{
acpi_status status = AE_OK;
acpi_operand_object *obj_desc;
- acpi_operand_object *source_desc;
- FUNCTION_TRACE ("Ns_get_object_value");
+ ACPI_FUNCTION_TRACE ("Ns_get_object_value");
/*
- * We take the value from certain objects directly
+ * Objects require additional resolution steps (e.g., the
+ * Node may be a field that must be read, etc.) -- we can't just grab
+ * the object out of the node.
*/
- if ((node->type == ACPI_TYPE_PROCESSOR) ||
- (node->type == ACPI_TYPE_POWER)) {
- /*
- * Create a Reference object to contain the object
- */
- obj_desc = acpi_ut_create_internal_object (node->type);
- if (!obj_desc) {
- status = AE_NO_MEMORY;
- goto unlock_and_exit;
- }
-
- /*
- * Get the attached object
- */
- source_desc = acpi_ns_get_attached_object (node);
- if (!source_desc) {
- status = AE_NULL_OBJECT;
- goto unlock_and_exit;
- }
-
- /*
- * Just copy from the original to the return object
- *
- * TBD: [Future] - need a low-level object copy that handles
- * the reference count automatically. (Don't want to copy it)
- */
- MEMCPY (obj_desc, source_desc, sizeof (acpi_operand_object));
- obj_desc->common.reference_count = 1;
- acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
- }
-
+ obj_desc = (acpi_operand_object *) node;
/*
- * Other objects require a reference object wrapper which we
- * then attempt to resolve.
+ * Use Resolve_node_to_value() to get the associated value. This call
+ * always deletes Obj_desc (allocated above).
+ *
+ * NOTE: we can get away with passing in NULL for a walk state
+ * because Obj_desc is guaranteed to not be a reference to either
+ * a method local or a method argument (because this interface can only be
+ * called from the Acpi_evaluate external interface, never called from
+ * a running control method.)
+ *
+ * Even though we do not directly invoke the interpreter
+ * for this, we must enter it because we could access an opregion.
+ * The opregion access code assumes that the interpreter
+ * is locked.
+ *
+ * We must release the namespace lock before entering the
+ * intepreter.
*/
- else {
- /* Create an Reference object to contain the object */
-
- obj_desc = acpi_ut_create_internal_object (INTERNAL_TYPE_REFERENCE);
- if (!obj_desc) {
- status = AE_NO_MEMORY;
- goto unlock_and_exit;
- }
-
- /* Construct a descriptor pointing to the name */
-
- obj_desc->reference.opcode = (u8) AML_NAME_OP;
- obj_desc->reference.object = (void *) node;
+ status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+ status = acpi_ex_enter_interpreter ();
+ if (ACPI_SUCCESS (status)) {
+ status = acpi_ex_resolve_node_to_value ((acpi_namespace_node **) &obj_desc, NULL);
/*
- * Use Resolve_to_value() to get the associated value. This call
- * always deletes Obj_desc (allocated above).
- *
- * NOTE: we can get away with passing in NULL for a walk state
- * because Obj_desc is guaranteed to not be a reference to either
- * a method local or a method argument
- *
- * Even though we do not directly invoke the interpreter
- * for this, we must enter it because we could access an opregion.
- * The opregion access code assumes that the interpreter
- * is locked.
- *
- * We must release the namespace lock before entering the
- * intepreter.
+ * If Acpi_ex_resolve_node_to_value() succeeded, the return value was
+ * placed in Obj_desc.
*/
- acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
- status = acpi_ex_enter_interpreter ();
- if (ACPI_SUCCESS (status)) {
- status = acpi_ex_resolve_to_value (&obj_desc, NULL);
+ acpi_ex_exit_interpreter ();
- acpi_ex_exit_interpreter ();
+ if (ACPI_SUCCESS (status)) {
+ status = AE_CTRL_RETURN_VALUE;
+ *return_obj_desc = obj_desc;
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Returning obj %p\n", *return_obj_desc));
}
}
- /*
- * If Acpi_ex_resolve_to_value() succeeded, the return value was
- * placed in Obj_desc.
- */
- if (ACPI_SUCCESS (status)) {
- status = AE_CTRL_RETURN_VALUE;
-
- *return_obj_desc = obj_desc;
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Returning obj %p\n", *return_obj_desc));
- }
-
/* Namespace is unlocked */
return_ACPI_STATUS (status);
-
-
-unlock_and_exit:
-
- /* Unlock the namespace */
-
- acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
- return_ACPI_STATUS (status);
}
+
/******************************************************************************
*
* Module Name: nsinit - namespace initialization
- * $Revision: 33 $
+ * $Revision: 41 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acinterp.h"
#define _COMPONENT ACPI_NAMESPACE
- MODULE_NAME ("nsinit")
+ ACPI_MODULE_NAME ("nsinit")
/*******************************************************************************
acpi_init_walk_info info;
- FUNCTION_TRACE ("Ns_initialize_objects");
+ ACPI_FUNCTION_TRACE ("Ns_initialize_objects");
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
acpi_device_walk_info info;
- FUNCTION_TRACE ("Ns_initialize_devices");
+ ACPI_FUNCTION_TRACE ("Ns_initialize_devices");
info.device_count = 0;
void *context,
void **return_value)
{
- acpi_object_type8 type;
+ acpi_object_type type;
acpi_status status;
acpi_init_walk_info *info = (acpi_init_walk_info *) context;
acpi_namespace_node *node = (acpi_namespace_node *) obj_handle;
acpi_operand_object *obj_desc;
- PROC_NAME ("Ns_init_one_object");
+ ACPI_FUNCTION_NAME ("Ns_init_one_object");
info->object_count++;
/* And even then, we are only interested in a few object types */
type = acpi_ns_get_type (obj_handle);
- obj_desc = node->object;
+ obj_desc = acpi_ns_get_attached_object (node);
if (!obj_desc) {
return (AE_OK);
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR, "\n"));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"%s while getting region arguments [%4.4s]\n",
- acpi_format_exception (status), (char*)&node->name));
+ acpi_format_exception (status), (char *) &node->name));
}
if (!(acpi_dbg_level & ACPI_LV_INIT)) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR, "\n"));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"%s while getting buffer field arguments [%4.4s]\n",
- acpi_format_exception (status), (char*)&node->name));
+ acpi_format_exception (status), (char *) &node->name));
}
if (!(acpi_dbg_level & ACPI_LV_INIT)) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "."));
acpi_device_walk_info *info = (acpi_device_walk_info *) context;
- FUNCTION_TRACE ("Ns_init_one_device");
+ ACPI_FUNCTION_TRACE ("Ns_init_one_device");
if (!(acpi_dbg_level & ACPI_LV_INIT)) {
info->device_count++;
- acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
node = acpi_ns_map_handle_to_node (obj_handle);
if (!node) {
- acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
- return (AE_BAD_PARAMETER);
+ (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
/*
* Run _STA to determine if we can run _INI on the device.
*/
- DEBUG_EXEC (acpi_ut_display_init_pathname (node, "_STA [Method]"));
+ ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (node, "_STA [Method]"));
status = acpi_ut_execute_STA (node, &flags);
if (ACPI_FAILURE (status)) {
/* Ignore error and move on to next device */
/*
* The device is present. Run _INI.
*/
- DEBUG_EXEC (acpi_ut_display_init_pathname (obj_handle, "_INI [Method]"));
+ ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (obj_handle, "_INI [Method]"));
status = acpi_ns_evaluate_relative (obj_handle, "_INI", NULL, NULL);
if (AE_NOT_FOUND == status) {
/* No _INI means device requires no initialization */
/* Ignore error and move on to next device */
#ifdef ACPI_DEBUG
- NATIVE_CHAR *scope_name = acpi_ns_get_table_pathname (obj_handle);
+ NATIVE_CHAR *scope_name = acpi_ns_get_external_pathname (obj_handle);
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "%s._INI failed: %s\n",
scope_name, acpi_format_exception (status)));
/******************************************************************************
*
* Module Name: nsload - namespace loading/expanding/contracting procedures
- * $Revision: 47 $
+ * $Revision: 53 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_NAMESPACE
- MODULE_NAME ("nsload")
+ ACPI_MODULE_NAME ("nsload")
/*******************************************************************************
*
* FUNCTION: Acpi_load_namespace
*
- * PARAMETERS: Display_aml_during_load
+ * PARAMETERS: None
*
* RETURN: Status
*
acpi_status status;
- FUNCTION_TRACE ("Acpi_load_name_space");
+ ACPI_FUNCTION_TRACE ("Acpi_load_name_space");
/* There must be at least a DSDT installed */
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
}
-
/*
* Load the namespace. The DSDT is required,
* but the SSDT and PSDT tables are optional.
acpi_ns_load_table_by_type (ACPI_TABLE_SSDT);
acpi_ns_load_table_by_type (ACPI_TABLE_PSDT);
-
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
"ACPI Namespace successfully loaded at root %p\n",
acpi_gbl_root_node));
-
return_ACPI_STATUS (status);
}
*
* FUNCTION: Acpi_ns_one_parse_pass
*
- * PARAMETERS:
+ * PARAMETERS: Pass_number - 1 or 2
+ * Table_desc - The table to be parsed.
*
* RETURN: Status
*
- * DESCRIPTION:
+ * DESCRIPTION: Perform one complete parse of an ACPI/AML table.
*
******************************************************************************/
acpi_walk_state *walk_state;
- FUNCTION_TRACE ("Ns_one_complete_parse");
+ ACPI_FUNCTION_TRACE ("Ns_one_complete_parse");
/* Create and init a Root Node */
((acpi_parse2_object *) parse_root)->name = ACPI_ROOT_NAME;
-
/* Create and initialize a new walk state */
walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT,
acpi_status status;
- FUNCTION_TRACE ("Ns_parse_table");
+ ACPI_FUNCTION_TRACE ("Ns_parse_table");
/*
return_ACPI_STATUS (status);
}
-
/*
* AML Parse, pass 2
*
acpi_status status;
- FUNCTION_TRACE ("Ns_load_table");
+ ACPI_FUNCTION_TRACE ("Ns_load_table");
+
+
+ /* Check if table contains valid AML (must be DSDT, PSDT, SSDT, etc.) */
+ if (!(acpi_gbl_acpi_table_data[table_desc->type].flags & ACPI_TABLE_EXECUTABLE)) {
+ /* Just ignore this table */
+
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Check validity of the AML start and length */
if (!table_desc->aml_start) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null AML pointer\n"));
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AML block at %p\n", table_desc->aml_start));
-
if (!table_desc->aml_length) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Zero-length AML block\n"));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
-
/*
* Parse the table and load the namespace with all named
* objects found within. Control methods are NOT parsed
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Loading table into namespace ****\n"));
- acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+
status = acpi_ns_parse_table (table_desc, node->child);
- acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
acpi_table_type table_type)
{
u32 i;
- acpi_status status = AE_OK;
+ acpi_status status;
acpi_table_desc *table_desc;
- FUNCTION_TRACE ("Ns_load_table_by_type");
-
+ ACPI_FUNCTION_TRACE ("Ns_load_table_by_type");
- acpi_ut_acquire_mutex (ACPI_MTX_TABLES);
+ status = acpi_ut_acquire_mutex (ACPI_MTX_TABLES);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
/*
* Table types supported are:
* DSDT (one), SSDT/PSDT (multiple)
*/
switch (table_type) {
-
case ACPI_TABLE_DSDT:
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading DSDT\n"));
unlock_and_exit:
-
- acpi_ut_release_mutex (ACPI_MTX_TABLES);
-
+ (void) acpi_ut_release_mutex (ACPI_MTX_TABLES);
return_ACPI_STATUS (status);
-
}
* DESCRIPTION: Walks the namespace starting at the given handle and deletes
* all objects, entries, and scopes in the entire subtree.
*
- * TBD: [Investigate] What if any part of this subtree is in use?
- * (i.e. on one of the object stacks?)
+ * Namespace/Interpreter should be locked or the subsystem should
+ * be in shutdown before this routine is called.
*
******************************************************************************/
u32 level;
- FUNCTION_TRACE ("Ns_delete_subtree");
+ ACPI_FUNCTION_TRACE ("Ns_delete_subtree");
parent_handle = start_handle;
child_handle = next_child_handle;
-
/* Did we get a new object? */
if (ACPI_SUCCESS (status)) {
child_handle = 0;
}
}
-
else {
/*
* No more children in this object, go back up to
acpi_status status;
- FUNCTION_TRACE ("Ns_unload_name_space");
+ ACPI_FUNCTION_TRACE ("Ns_unload_name_space");
/* Parameter validation */
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
-
/* This function does the real work */
status = acpi_ns_delete_subtree (handle);
/*******************************************************************************
*
* Module Name: nsnames - Name manipulation and search
- * $Revision: 64 $
+ * $Revision: 74 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_NAMESPACE
- MODULE_NAME ("nsnames")
+ ACPI_MODULE_NAME ("nsnames")
/*******************************************************************************
*
- * FUNCTION: Acpi_ns_get_table_pathname
+ * FUNCTION: Acpi_ns_build_external_path
*
- * PARAMETERS: Node - Scope whose name is needed
+ * PARAMETERS: Node - NS node whose pathname is needed
+ * Size - Size of the pathname
+ * *Name_buffer - Where to return the pathname
*
- * RETURN: Pointer to storage containing the fully qualified name of
- * the scope, in Label format (all segments strung together
- * with no separators)
+ * RETURN: Places the pathname into the Name_buffer, in external format
+ * (name segments separated by path separators)
*
- * DESCRIPTION: Used for debug printing in Acpi_ns_search_table().
+ * DESCRIPTION: Generate a full pathaname
*
******************************************************************************/
-NATIVE_CHAR *
-acpi_ns_get_table_pathname (
- acpi_namespace_node *node)
+void
+acpi_ns_build_external_path (
+ acpi_namespace_node *node,
+ ACPI_SIZE size,
+ NATIVE_CHAR *name_buffer)
{
- NATIVE_CHAR *name_buffer;
- u32 size;
- acpi_name name;
- acpi_namespace_node *child_node;
+ u32 index;
acpi_namespace_node *parent_node;
- FUNCTION_TRACE_PTR ("Ns_get_table_pathname", node);
+ ACPI_FUNCTION_NAME ("Ns_build_external_path");
- if (!acpi_gbl_root_node || !node) {
- /*
- * If the name space has not been initialized,
- * this function should not have been called.
- */
- return_PTR (NULL);
+ /* Special case for root */
+
+ index = size - 1;
+ if (index < ACPI_NAME_SIZE) {
+ name_buffer[0] = AML_ROOT_PREFIX;
+ name_buffer[1] = 0;
+ return;
}
- child_node = node->child;
+ /* Store terminator byte, then build name backwards */
+
+ parent_node = node;
+ name_buffer[index] = 0;
+ while ((index > ACPI_NAME_SIZE) && (parent_node != acpi_gbl_root_node)) {
+ index -= ACPI_NAME_SIZE;
- /* Calculate required buffer size based on depth below root */
+ /* Put the name into the buffer */
+
+ ACPI_MOVE_UNALIGNED32_TO_32 ((name_buffer + index), &parent_node->name);
+ parent_node = acpi_ns_get_parent_node (parent_node);
- size = 1;
- parent_node = child_node;
- while (parent_node) {
- parent_node = acpi_ns_get_parent_object (parent_node);
- if (parent_node) {
- size += ACPI_NAME_SIZE;
- }
+ /* Prefix name with the path separator */
+
+ index--;
+ name_buffer[index] = PATH_SEPARATOR;
}
+ /* Overwrite final separator with the root prefix character */
- /* Allocate a buffer to be returned to caller */
+ name_buffer[index] = AML_ROOT_PREFIX;
- name_buffer = ACPI_MEM_CALLOCATE (size + 1);
- if (!name_buffer) {
- REPORT_ERROR (("Ns_get_table_pathname: allocation failure\n"));
- return_PTR (NULL);
+ if (index != 0) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Could not construct pathname; index=%X, size=%X, Path=%s\n",
+ index, size, &name_buffer[size]));
}
+ return;
+}
- /* Store terminator byte, then build name backwards */
- name_buffer[size] = '\0';
- while ((size > ACPI_NAME_SIZE) &&
- acpi_ns_get_parent_object (child_node)) {
- size -= ACPI_NAME_SIZE;
- name = acpi_ns_find_parent_name (child_node);
+#ifdef ACPI_DEBUG
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ns_get_external_pathname
+ *
+ * PARAMETERS: Node - NS node whose pathname is needed
+ *
+ * RETURN: Pointer to storage containing the fully qualified name of
+ * the node, In external format (name segments separated by path
+ * separators.)
+ *
+ * DESCRIPTION: Used for debug printing in Acpi_ns_search_table().
+ *
+ ******************************************************************************/
- /* Put the name into the buffer */
+NATIVE_CHAR *
+acpi_ns_get_external_pathname (
+ acpi_namespace_node *node)
+{
+ NATIVE_CHAR *name_buffer;
+ ACPI_SIZE size;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("Ns_get_external_pathname", node);
- MOVE_UNALIGNED32_TO_32 ((name_buffer + size), &name);
- child_node = acpi_ns_get_parent_object (child_node);
- }
- name_buffer[--size] = AML_ROOT_PREFIX;
+ /* Calculate required buffer size based on depth below root */
+
+ size = acpi_ns_get_pathname_length (node);
+
+ /* Allocate a buffer to be returned to caller */
- if (size != 0) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad pointer returned; size=%X\n", size));
+ name_buffer = ACPI_MEM_CALLOCATE (size);
+ if (!name_buffer) {
+ ACPI_REPORT_ERROR (("Ns_get_table_pathname: allocation failure\n"));
+ return_PTR (NULL);
}
+ /* Build the path in the allocated buffer */
+
+ acpi_ns_build_external_path (node, size, name_buffer);
return_PTR (name_buffer);
}
+#endif
/*******************************************************************************
*
******************************************************************************/
-u32
+ACPI_SIZE
acpi_ns_get_pathname_length (
acpi_namespace_node *node)
{
- u32 size;
+ ACPI_SIZE size;
acpi_namespace_node *next_node;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/*
* Compute length of pathname as 5 * number of name segments.
* Go back up the parent tree to the root
*/
- for (size = 0, next_node = node;
- acpi_ns_get_parent_object (next_node);
- next_node = acpi_ns_get_parent_object (next_node)) {
- size += PATH_SEGMENT_LENGTH;
- }
-
- /* Special case for size still 0 - no parent for "special" nodes */
+ size = 0;
+ next_node = node;
- if (!size) {
- size = PATH_SEGMENT_LENGTH;
+ while (next_node != acpi_gbl_root_node) {
+ size += PATH_SEGMENT_LENGTH;
+ next_node = acpi_ns_get_parent_node (next_node);
}
return (size + 1);
*
* PARAMETERS: Target_handle - Handle of named object whose name is
* to be found
- * Buf_size - Size of the buffer provided
- * User_buffer - Where the pathname is returned
+ * Buffer - Where the pathname is returned
*
* RETURN: Status, Buffer is filled with pathname if status is AE_OK
*
* DESCRIPTION: Build and return a full namespace pathname
*
- * MUTEX: Locks Namespace
- *
******************************************************************************/
acpi_status
acpi_ns_handle_to_pathname (
acpi_handle target_handle,
- u32 *buf_size,
- NATIVE_CHAR *user_buffer)
+ acpi_buffer *buffer)
{
- acpi_status status = AE_OK;
+ acpi_status status;
acpi_namespace_node *node;
- u32 path_length;
- u32 user_buf_size;
- acpi_name name;
- u32 size;
+ ACPI_SIZE required_size;
- FUNCTION_TRACE_PTR ("Ns_handle_to_pathname", target_handle);
+ ACPI_FUNCTION_TRACE_PTR ("Ns_handle_to_pathname", target_handle);
- if (!acpi_gbl_root_node) {
- /*
- * If the name space has not been initialized,
- * this function should not have been called.
- */
- return_ACPI_STATUS (AE_NO_NAMESPACE);
- }
-
node = acpi_ns_map_handle_to_node (target_handle);
if (!node) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
+ /* Determine size required for the caller buffer */
- /* Set return length to the required path length */
-
- path_length = acpi_ns_get_pathname_length (node);
- size = path_length - 1;
-
- user_buf_size = *buf_size;
- *buf_size = path_length;
+ required_size = acpi_ns_get_pathname_length (node);
- /* Check if the user buffer is sufficiently large */
+ /* Validate/Allocate/Clear caller buffer */
- if (path_length > user_buf_size) {
- status = AE_BUFFER_OVERFLOW;
- goto exit;
+ status = acpi_ut_initialize_buffer (buffer, required_size);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
}
- /* Store null terminator */
-
- user_buffer[size] = 0;
- size -= ACPI_NAME_SIZE;
-
- /* Put the original ACPI name at the end of the path */
-
- MOVE_UNALIGNED32_TO_32 ((user_buffer + size),
- &node->name);
-
- user_buffer[--size] = PATH_SEPARATOR;
-
- /* Build name backwards, putting "." between segments */
-
- while ((size > ACPI_NAME_SIZE) && node) {
- size -= ACPI_NAME_SIZE;
- name = acpi_ns_find_parent_name (node);
- MOVE_UNALIGNED32_TO_32 ((user_buffer + size), &name);
-
- user_buffer[--size] = PATH_SEPARATOR;
- node = acpi_ns_get_parent_object (node);
- }
-
- /*
- * Overlay the "." preceding the first segment with
- * the root name "\"
- */
- user_buffer[size] = '\\';
+ /* Build the path in the caller buffer */
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Len=%X, %s \n", path_length, user_buffer));
+ acpi_ns_build_external_path (node, required_size, buffer->pointer);
-exit:
- return_ACPI_STATUS (status);
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X] \n", (char *) buffer->pointer, required_size));
+ return_ACPI_STATUS (AE_OK);
}
*
* Module Name: nsobject - Utilities for objects attached to namespace
* table entries
- * $Revision: 67 $
+ * $Revision: 78 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_NAMESPACE
- MODULE_NAME ("nsobject")
+ ACPI_MODULE_NAME ("nsobject")
/*******************************************************************************
* DESCRIPTION: Record the given object as the value associated with the
* name whose acpi_handle is passed. If Object is NULL
* and Type is ACPI_TYPE_ANY, set the name as having no value.
+ * Note: Future may require that the Node->Flags field be passed
+ * as a parameter.
*
* MUTEX: Assumes namespace is locked
*
acpi_ns_attach_object (
acpi_namespace_node *node,
acpi_operand_object *object,
- acpi_object_type8 type)
+ acpi_object_type type)
{
acpi_operand_object *obj_desc;
- acpi_operand_object *previous_obj_desc;
- acpi_object_type8 obj_type = ACPI_TYPE_ANY;
- u8 flags;
+ acpi_operand_object *last_obj_desc;
+ acpi_object_type object_type = ACPI_TYPE_ANY;
- FUNCTION_TRACE ("Ns_attach_object");
+ ACPI_FUNCTION_TRACE ("Ns_attach_object");
/*
* Parameter validation
*/
- if (!acpi_gbl_root_node) {
- /* Name space not initialized */
-
- REPORT_ERROR (("Ns_attach_object: Namespace not initialized\n"));
- return_ACPI_STATUS (AE_NO_NAMESPACE);
- }
-
if (!node) {
/* Invalid handle */
- REPORT_ERROR (("Ns_attach_object: Null Named_obj handle\n"));
+ ACPI_REPORT_ERROR (("Ns_attach_object: Null Named_obj handle\n"));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
if (!object && (ACPI_TYPE_ANY != type)) {
/* Null object */
- REPORT_ERROR (("Ns_attach_object: Null object, but type not ACPI_TYPE_ANY\n"));
+ ACPI_REPORT_ERROR (("Ns_attach_object: Null object, but type not ACPI_TYPE_ANY\n"));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- if (!VALID_DESCRIPTOR_TYPE (node, ACPI_DESC_TYPE_NAMED)) {
+ if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) {
/* Not a name handle */
- REPORT_ERROR (("Ns_attach_object: Invalid handle\n"));
+ ACPI_REPORT_ERROR (("Ns_attach_object: Invalid handle\n"));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
return_ACPI_STATUS (AE_OK);
}
-
- /* Get the current flags field of the Node */
-
- flags = node->flags;
- flags &= ~ANOBJ_AML_ATTACHMENT;
-
-
/* If null object, we will just install it */
if (!object) {
- obj_desc = NULL;
- obj_type = ACPI_TYPE_ANY;
+ obj_desc = NULL;
+ object_type = ACPI_TYPE_ANY;
}
/*
* If the source object is a namespace Node with an attached object,
* we will use that (attached) object
*/
- else if (VALID_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_NAMED) &&
+ else if ((ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_NAMED) &&
((acpi_namespace_node *) object)->object) {
/*
* Value passed is a name handle and that name has a
* non-null value. Use that name's value and type.
*/
- obj_desc = ((acpi_namespace_node *) object)->object;
- obj_type = ((acpi_namespace_node *) object)->type;
-
- /*
- * Copy appropriate flags
- */
- if (((acpi_namespace_node *) object)->flags & ANOBJ_AML_ATTACHMENT) {
- flags |= ANOBJ_AML_ATTACHMENT;
- }
+ obj_desc = ((acpi_namespace_node *) object)->object;
+ object_type = ((acpi_namespace_node *) object)->type;
}
-
/*
* Otherwise, we will use the parameter object, but we must type
* it first
/* If a valid type (non-ANY) was given, just use it */
if (ACPI_TYPE_ANY != type) {
- obj_type = type;
+ object_type = type;
}
-
else {
- /*
- * Cannot figure out the type -- set to Def_any which
- * will print as an error in the name table dump
- */
- if (acpi_dbg_level > 0) {
- DUMP_PATHNAME (node,
- "Ns_attach_object confused: setting bogus type for ",
- ACPI_LV_INFO, _COMPONENT);
-
- if (VALID_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_NAMED)) {
- DUMP_PATHNAME (object, "name ", ACPI_LV_INFO, _COMPONENT);
- }
-
- else {
- DUMP_PATHNAME (object, "object ", ACPI_LV_INFO, _COMPONENT);
- DUMP_STACK_ENTRY (object);
- }
- }
-
- obj_type = INTERNAL_TYPE_DEF_ANY;
+ object_type = INTERNAL_TYPE_DEF_ANY;
}
}
-
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Installing %p into Node %p [%4.4s]\n",
- obj_desc, node, (char*)&node->name));
-
+ obj_desc, node, (char *) &node->name));
/*
* Must increment the new value's reference count
*/
acpi_ut_add_reference (obj_desc);
- /* Save the existing object (if any) for deletion later */
+ /* Detach an existing attached object if present */
- previous_obj_desc = node->object;
-
- /* Install the object and set the type, flags */
-
- node->object = obj_desc;
- node->type = (u8) obj_type;
- node->flags |= flags;
+ if (node->object) {
+ acpi_ns_detach_object (node);
+ }
/*
- * Delete an existing attached object.
+ * Handle objects with multiple descriptors - walk
+ * to the end of the descriptor list
*/
- if (previous_obj_desc) {
- /* One for the attach to the Node */
+ last_obj_desc = obj_desc;
+ while (last_obj_desc->common.next_object) {
+ last_obj_desc = last_obj_desc->common.next_object;
+ }
- acpi_ut_remove_reference (previous_obj_desc);
+ /* Install the object at the front of the object list */
- /* Now delete */
+ last_obj_desc->common.next_object = node->object;
- acpi_ut_remove_reference (previous_obj_desc);
- }
+ node->type = (u8) object_type;
+ node->object = obj_desc;
return_ACPI_STATUS (AE_OK);
}
acpi_operand_object *obj_desc;
- FUNCTION_TRACE ("Ns_detach_object");
+ ACPI_FUNCTION_TRACE ("Ns_detach_object");
obj_desc = node->object;
- if (!obj_desc) {
+ if (!obj_desc ||
+ (obj_desc->common.type == INTERNAL_TYPE_DATA)) {
return_VOID;
}
/* Clear the entry in all cases */
node->object = NULL;
+ if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_INTERNAL) {
+ node->object = obj_desc->common.next_object;
+ if (node->object &&
+ (node->object->common.type != INTERNAL_TYPE_DATA)) {
+ node->object = node->object->common.next_object;
+ }
+ }
+
+ /* Reset the node type to untyped */
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Object=%p Value=%p Name %4.4s\n",
- node, obj_desc, (char*)&node->name));
+ node->type = ACPI_TYPE_ANY;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Node %p [%4.4s] Object %p\n",
+ node, (char *) &node->name, obj_desc));
/* Remove one reference on the object (and all subobjects) */
*
******************************************************************************/
-void *
+acpi_operand_object *
acpi_ns_get_attached_object (
acpi_namespace_node *node)
{
- FUNCTION_TRACE_PTR ("Ns_get_attached_object", node);
+ ACPI_FUNCTION_TRACE_PTR ("Ns_get_attached_object", node);
if (!node) {
- /* handle invalid */
-
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Null Node ptr\n"));
return_PTR (NULL);
}
+ if (!node->object ||
+ ((ACPI_GET_DESCRIPTOR_TYPE (node->object) != ACPI_DESC_TYPE_INTERNAL) &&
+ (ACPI_GET_DESCRIPTOR_TYPE (node->object) != ACPI_DESC_TYPE_NAMED)) ||
+ (node->object->common.type == INTERNAL_TYPE_DATA)) {
+ return_PTR (NULL);
+ }
+
return_PTR (node->object);
}
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ns_get_secondary_object
+ *
+ * PARAMETERS: Node - Parent Node to be examined
+ *
+ * RETURN: Current value of the object field from the Node whose
+ * handle is passed
+ *
+ ******************************************************************************/
+
+acpi_operand_object *
+acpi_ns_get_secondary_object (
+ acpi_operand_object *obj_desc)
+{
+ ACPI_FUNCTION_TRACE_PTR ("Acpi_ns_get_secondary_object", obj_desc);
+
+
+ if ((!obj_desc) ||
+ (obj_desc->common.type == INTERNAL_TYPE_DATA) ||
+ (!obj_desc->common.next_object) ||
+ (obj_desc->common.next_object->common.type == INTERNAL_TYPE_DATA)) {
+ return_PTR (NULL);
+ }
+
+ return_PTR (obj_desc->common.next_object);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ns_attach_data
+ *
+ * PARAMETERS:
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION:
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ns_attach_data (
+ acpi_namespace_node *node,
+ ACPI_OBJECT_HANDLER handler,
+ void *data)
+{
+ acpi_operand_object *prev_obj_desc;
+ acpi_operand_object *obj_desc;
+ acpi_operand_object *data_desc;
+
+
+ /* */
+ prev_obj_desc = NULL;
+ obj_desc = node->object;
+ while (obj_desc) {
+ if ((obj_desc->common.type == INTERNAL_TYPE_DATA) &&
+ (obj_desc->data.handler == handler)) {
+ return (AE_ALREADY_EXISTS);
+ }
+
+ prev_obj_desc = obj_desc;
+ obj_desc = obj_desc->common.next_object;
+ }
+
+
+ /* Create an internal object for the data */
+
+ data_desc = acpi_ut_create_internal_object (INTERNAL_TYPE_DATA);
+ if (!data_desc) {
+ return (AE_NO_MEMORY);
+ }
+
+ data_desc->data.handler = handler;
+ data_desc->data.pointer = data;
+
+
+ /* Install the data object */
+
+ if (prev_obj_desc) {
+ prev_obj_desc->common.next_object = data_desc;
+ }
+ else {
+ node->object = data_desc;
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ns_detach_data
+ *
+ * PARAMETERS:
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION:
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ns_detach_data (
+ acpi_namespace_node *node,
+ ACPI_OBJECT_HANDLER handler)
+{
+ acpi_operand_object *obj_desc;
+ acpi_operand_object *prev_obj_desc;
+
+
+ prev_obj_desc = NULL;
+ obj_desc = node->object;
+ while (obj_desc) {
+ if ((obj_desc->common.type == INTERNAL_TYPE_DATA) &&
+ (obj_desc->data.handler == handler)) {
+ if (prev_obj_desc) {
+ prev_obj_desc->common.next_object = obj_desc->common.next_object;
+ }
+ else {
+ node->object = obj_desc->common.next_object;
+ }
+
+ acpi_ut_remove_reference (obj_desc);
+ return (AE_OK);
+ }
+
+ prev_obj_desc = obj_desc;
+ obj_desc = obj_desc->common.next_object;
+ }
+
+ return (AE_NOT_FOUND);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ns_get_attached_data
+ *
+ * PARAMETERS:
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION:
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ns_get_attached_data (
+ acpi_namespace_node *node,
+ ACPI_OBJECT_HANDLER handler,
+ void **data)
+{
+ acpi_operand_object *obj_desc;
+
+
+ obj_desc = node->object;
+ while (obj_desc) {
+ if ((obj_desc->common.type == INTERNAL_TYPE_DATA) &&
+ (obj_desc->data.handler == handler)) {
+ *data = obj_desc->data.pointer;
+ return (AE_OK);
+ }
+
+ obj_desc = obj_desc->common.next_object;
+ }
+
+ return (AE_NOT_FOUND);
+}
+
+
/*******************************************************************************
*
* Module Name: nssearch - Namespace search
- * $Revision: 75 $
+ * $Revision: 83 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_NAMESPACE
- MODULE_NAME ("nssearch")
+ ACPI_MODULE_NAME ("nssearch")
/*******************************************************************************
acpi_ns_search_node (
u32 target_name,
acpi_namespace_node *node,
- acpi_object_type8 type,
+ acpi_object_type type,
acpi_namespace_node **return_node)
{
acpi_namespace_node *next_node;
- FUNCTION_TRACE ("Ns_search_node");
+ ACPI_FUNCTION_TRACE ("Ns_search_node");
#ifdef ACPI_DEBUG
if (ACPI_LV_NAMES & acpi_dbg_level) {
NATIVE_CHAR *scope_name;
- scope_name = acpi_ns_get_table_pathname (node);
+ scope_name = acpi_ns_get_external_pathname (node);
if (scope_name) {
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching %s [%p] For %4.4s (type %X)\n",
- scope_name, node, (char*)&target_name, type));
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching %s [%p] For %4.4s (type %s)\n",
+ scope_name, node, (char *) &target_name, acpi_ut_get_type_name (type)));
ACPI_MEM_FREE (scope_name);
}
}
#endif
-
/*
* Search for name in this table, which is to say that we must search
* for the name among the children of this object
}
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
- "Name %4.4s (actual type %X) found at %p\n",
- (char*)&target_name, next_node->type, next_node));
+ "Name %4.4s Type [%s] found at %p\n",
+ (char *) &target_name, acpi_ut_get_type_name (next_node->type), next_node));
*return_node = next_node;
return_ACPI_STATUS (AE_OK);
}
-
/*
* The last entry in the list points back to the parent,
* so a flag is used to indicate the end-of-list
next_node = next_node->peer;
}
-
/* Searched entire table, not found */
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Name %4.4s (type %X) not found at %p\n",
- (char*)&target_name, type, next_node));
+ (char *) &target_name, type, next_node));
return_ACPI_STATUS (AE_NOT_FOUND);
}
acpi_ns_search_parent_tree (
u32 target_name,
acpi_namespace_node *node,
- acpi_object_type8 type,
+ acpi_object_type type,
acpi_namespace_node **return_node)
{
acpi_status status;
acpi_namespace_node *parent_node;
- FUNCTION_TRACE ("Ns_search_parent_tree");
+ ACPI_FUNCTION_TRACE ("Ns_search_parent_tree");
- parent_node = acpi_ns_get_parent_object (node);
+ parent_node = acpi_ns_get_parent_node (node);
/*
* If there is no parent (at the root) or type is "local", we won't be
(!parent_node)) {
if (!parent_node) {
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] has no parent\n",
- (char*)&target_name));
+ (char *) &target_name));
}
if (acpi_ns_local (type)) {
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] type %X is local(no search)\n",
- (char*)&target_name, type));
+ (char *) &target_name, type));
}
return_ACPI_STATUS (AE_NOT_FOUND);
}
-
/* Search the parent tree */
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching parent for %4.4s\n", (char*)&target_name));
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching parent for %4.4s\n", (char *) &target_name));
/*
* Search parents until found the target or we have backed up to
* the root
*/
while (parent_node) {
- /* Search parent scope */
- /* TBD: [Investigate] Why ACPI_TYPE_ANY? */
-
+ /*
+ * Search parent scope. Use TYPE_ANY because we don't care about the
+ * object type at this point, we only care about the existence of
+ * the actual name we are searching for. Typechecking comes later.
+ */
status = acpi_ns_search_node (target_name, parent_node,
ACPI_TYPE_ANY, return_node);
-
if (ACPI_SUCCESS (status)) {
return_ACPI_STATUS (status);
}
* Not found here, go up another level
* (until we reach the root)
*/
- parent_node = acpi_ns_get_parent_object (parent_node);
+ parent_node = acpi_ns_get_parent_node (parent_node);
}
-
/* Not found in parent tree */
return_ACPI_STATUS (AE_NOT_FOUND);
u32 target_name,
acpi_walk_state *walk_state,
acpi_namespace_node *node,
- operating_mode interpreter_mode,
- acpi_object_type8 type,
+ acpi_interpreter_mode interpreter_mode,
+ acpi_object_type type,
u32 flags,
acpi_namespace_node **return_node)
{
acpi_namespace_node *new_node;
- FUNCTION_TRACE ("Ns_search_and_enter");
+ ACPI_FUNCTION_TRACE ("Ns_search_and_enter");
/* Parameter validation */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null param- Table %p Name %X Return %p\n",
node, target_name, return_node));
- REPORT_ERROR (("Ns_search_and_enter: bad (null) parameter\n"));
+ ACPI_REPORT_ERROR (("Ns_search_and_enter: bad (null) parameter\n"));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
-
/* Name must consist of printable characters */
if (!acpi_ut_valid_acpi_name (target_name)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "*** Bad character in name: %08x *** \n",
target_name));
- REPORT_ERROR (("Ns_search_and_enter: Bad character in ACPI Name\n"));
+ ACPI_REPORT_ERROR (("Ns_search_and_enter: Bad character in ACPI Name\n"));
return_ACPI_STATUS (AE_BAD_CHARACTER);
}
-
/* Try to find the name in the table specified by the caller */
- *return_node = ENTRY_NOT_FOUND;
+ *return_node = ACPI_ENTRY_NOT_FOUND;
status = acpi_ns_search_node (target_name, node, type, return_node);
if (status != AE_NOT_FOUND) {
/*
* return the error
*/
if ((status == AE_OK) &&
- (flags & NS_ERROR_IF_FOUND)) {
- status = AE_EXIST;
+ (flags & ACPI_NS_ERROR_IF_FOUND)) {
+ status = AE_ALREADY_EXISTS;
}
/*
return_ACPI_STATUS (status);
}
-
/*
- * Not found in the table. If we are NOT performing the
+ * The name was not found. If we are NOT performing the
* first pass (name entry) of loading the namespace, search
* the parent tree (all the way to the root if necessary.)
* We don't want to perform the parent search when the
* the search when namespace references are being resolved
* (load pass 2) and during the execution phase.
*/
- if ((interpreter_mode != IMODE_LOAD_PASS1) &&
- (flags & NS_SEARCH_PARENT)) {
+ if ((interpreter_mode != ACPI_IMODE_LOAD_PASS1) &&
+ (flags & ACPI_NS_SEARCH_PARENT)) {
/*
* Not found in table - search parent tree according
* to ACPI specification
}
}
-
/*
* In execute mode, just search, never add names. Exit now.
*/
- if (interpreter_mode == IMODE_EXECUTE) {
+ if (interpreter_mode == ACPI_IMODE_EXECUTE) {
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%4.4s Not found in %p [Not adding]\n",
- (char*)&target_name, node));
+ (char *) &target_name, node));
return_ACPI_STATUS (AE_NOT_FOUND);
}
-
/* Create the new named object */
new_node = acpi_ns_create_node (target_name);
*
* Module Name: nsutils - Utilities for accessing ACPI namespace, accessing
* parents and siblings and Scope manipulation
- * $Revision: 92 $
+ * $Revision: 104 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "actables.h"
#define _COMPONENT ACPI_NAMESPACE
- MODULE_NAME ("nsutils")
+ ACPI_MODULE_NAME ("nsutils")
/*******************************************************************************
*
******************************************************************************/
-acpi_object_type8
+acpi_object_type
acpi_ns_get_type (
acpi_namespace_node *node)
{
- FUNCTION_TRACE ("Ns_get_type");
+ ACPI_FUNCTION_TRACE ("Ns_get_type");
if (!node) {
- REPORT_WARNING (("Ns_get_type: Null Node ptr"));
+ ACPI_REPORT_WARNING (("Ns_get_type: Null Node ptr"));
return_VALUE (ACPI_TYPE_ANY);
}
- return_VALUE (node->type);
+ return_VALUE ((acpi_object_type) node->type);
}
u32
acpi_ns_local (
- acpi_object_type8 type)
+ acpi_object_type type)
{
- FUNCTION_TRACE ("Ns_local");
+ ACPI_FUNCTION_TRACE ("Ns_local");
if (!acpi_ut_valid_object_type (type)) {
/* Type code out of range */
- REPORT_WARNING (("Ns_local: Invalid Object Type\n"));
- return_VALUE (NSP_NORMAL);
+ ACPI_REPORT_WARNING (("Ns_local: Invalid Object Type\n"));
+ return_VALUE (ACPI_NS_NORMAL);
}
- return_VALUE ((u32) acpi_gbl_ns_properties[type] & NSP_LOCAL);
+ return_VALUE ((u32) acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL);
}
u32 i;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
next_external_char = info->external_name;
info->fully_qualified = TRUE;
next_external_char++;
}
-
else {
/*
* Handle Carat prefixes
u32 i;
- FUNCTION_TRACE ("Ns_build_internal_name");
+ ACPI_FUNCTION_TRACE ("Ns_build_internal_name");
/* Setup the correct prefixes, counts, and pointers */
}
}
- if (num_segments == 1) {
+ if (num_segments <= 1) {
result = &internal_name[i];
}
-
else if (num_segments == 2) {
internal_name[i] = AML_DUAL_NAME_PREFIX;
result = &internal_name[i+1];
}
-
else {
internal_name[i] = AML_MULTI_NAME_PREFIX_OP;
internal_name[i+1] = (char) num_segments;
result[i] = '_';
}
-
else {
/* Convert the character to uppercase and save it */
- result[i] = (char) TOUPPER (*external_name);
+ result[i] = (char) ACPI_TOUPPER (*external_name);
external_name++;
}
}
result += ACPI_NAME_SIZE;
}
-
/* Terminate the string */
*result = 0;
acpi_status status;
- FUNCTION_TRACE ("Ns_internalize_name");
+ ACPI_FUNCTION_TRACE ("Ns_internalize_name");
if ((!external_name) ||
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
-
/* Get the length of the new internal name */
info.external_name = external_name;
{
u32 prefix_length = 0;
u32 names_index = 0;
- u32 names_count = 0;
+ u32 num_segments = 0;
u32 i = 0;
u32 j = 0;
+ u32 required_length;
- FUNCTION_TRACE ("Ns_externalize_name");
+ ACPI_FUNCTION_TRACE ("Ns_externalize_name");
if (!internal_name_length ||
!internal_name ||
- !converted_name_length ||
!converted_name) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
-
/*
* Check for a prefix (one '\' | one or more '^').
*/
*/
if (prefix_length < internal_name_length) {
switch (internal_name[prefix_length]) {
+ case AML_MULTI_NAME_PREFIX_OP:
- /* <count> 4-byte names */
+ /* <count> 4-byte names */
- case AML_MULTI_NAME_PREFIX_OP:
names_index = prefix_length + 2;
- names_count = (u32) internal_name[prefix_length + 1];
+ num_segments = (u32) (u8) internal_name[prefix_length + 1];
break;
+ case AML_DUAL_NAME_PREFIX:
- /* two 4-byte names */
+ /* Two 4-byte names */
- case AML_DUAL_NAME_PREFIX:
names_index = prefix_length + 1;
- names_count = 2;
+ num_segments = 2;
break;
+ case 0:
- /* Null_name */
+ /* Null_name */
- case 0:
names_index = 0;
- names_count = 0;
+ num_segments = 0;
break;
+ default:
- /* one 4-byte name */
+ /* one 4-byte name */
- default:
names_index = prefix_length;
- names_count = 1;
+ num_segments = 1;
break;
}
}
* of the prefix, length of all object names, length of any required
* punctuation ('.') between object names, plus the NULL terminator.
*/
- *converted_name_length = prefix_length + (4 * names_count) +
- ((names_count > 0) ? (names_count - 1) : 0) + 1;
+ required_length = prefix_length + (4 * num_segments) +
+ ((num_segments > 0) ? (num_segments - 1) : 0) + 1;
/*
* Check to see if we're still in bounds. If not, there's a problem
* with Internal_name (invalid format).
*/
- if (*converted_name_length > internal_name_length) {
- REPORT_ERROR (("Ns_externalize_name: Invalid internal name\n"));
+ if (required_length > internal_name_length) {
+ ACPI_REPORT_ERROR (("Ns_externalize_name: Invalid internal name\n"));
return_ACPI_STATUS (AE_BAD_PATHNAME);
}
/*
* Build Converted_name...
*/
-
- (*converted_name) = ACPI_MEM_CALLOCATE (*converted_name_length);
+ *converted_name = ACPI_MEM_CALLOCATE (required_length);
if (!(*converted_name)) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
(*converted_name)[j++] = internal_name[i];
}
- if (names_count > 0) {
- for (i = 0; i < names_count; i++) {
+ if (num_segments > 0) {
+ for (i = 0; i < num_segments; i++) {
if (i > 0) {
(*converted_name)[j++] = '.';
}
}
}
+ if (converted_name_length) {
+ *converted_name_length = required_length;
+ }
+
return_ACPI_STATUS (AE_OK);
}
*
* DESCRIPTION: Convert a namespace handle to a real Node
*
+ * Note: Real integer handles allow for more verification
+ * and keep all pointers within this subsystem.
+ *
******************************************************************************/
acpi_namespace_node *
acpi_handle handle)
{
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/*
- * Simple implementation for now;
- * TBD: [Future] Real integer handles allow for more verification
- * and keep all pointers within this subsystem!
+ * Simple implementation.
*/
if (!handle) {
return (NULL);
return (acpi_gbl_root_node);
}
-
/* We can at least attempt to verify the handle */
- if (!VALID_DESCRIPTOR_TYPE (handle, ACPI_DESC_TYPE_NAMED)) {
+ if (ACPI_GET_DESCRIPTOR_TYPE (handle) != ACPI_DESC_TYPE_NAMED) {
return (NULL);
}
/*
* Simple implementation for now;
- * TBD: [Future] Real integer handles allow for more verification
- * and keep all pointers within this subsystem!
*/
return ((acpi_handle) node);
acpi_namespace_node *this_node;
- FUNCTION_TRACE ("Ns_terminate");
+ ACPI_FUNCTION_TRACE ("Ns_terminate");
this_node = acpi_gbl_root_node;
u32
acpi_ns_opens_scope (
- acpi_object_type8 type)
+ acpi_object_type type)
{
- FUNCTION_TRACE_U32 ("Ns_opens_scope", type);
+ ACPI_FUNCTION_TRACE_U32 ("Ns_opens_scope", type);
if (!acpi_ut_valid_object_type (type)) {
/* type code out of range */
- REPORT_WARNING (("Ns_opens_scope: Invalid Object Type\n"));
- return_VALUE (NSP_NORMAL);
+ ACPI_REPORT_WARNING (("Ns_opens_scope: Invalid Object Type %X\n", type));
+ return_VALUE (ACPI_NS_NORMAL);
}
- return_VALUE (((u32) acpi_gbl_ns_properties[type]) & NSP_NEWSCOPE);
+ return_VALUE (((u32) acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE);
}
/*******************************************************************************
*
- * FUNCTION: Acpi_ns_get_node
+ * FUNCTION: Acpi_ns_get_node_by_path
*
* PARAMETERS: *Pathname - Name to be found, in external (ASL) format. The
* \ (backslash) and ^ (carat) prefixes, and the
* root of the name space. If Name is fully
* qualified (first s8 is '\'), the passed value
* of Scope will not be accessed.
+ * Flags - Used to indicate whether to perform upsearch or
+ * not.
* Return_node - Where the Node is returned
*
* DESCRIPTION: Look up a name relative to a given scope and return the
******************************************************************************/
acpi_status
-acpi_ns_get_node (
+acpi_ns_get_node_by_path (
NATIVE_CHAR *pathname,
acpi_namespace_node *start_node,
+ u32 flags,
acpi_namespace_node **return_node)
{
acpi_generic_state scope_info;
NATIVE_CHAR *internal_path = NULL;
- FUNCTION_TRACE_PTR ("Ns_get_node", pathname);
+ ACPI_FUNCTION_TRACE_PTR ("Ns_get_node_by_path", pathname);
- /* Ensure that the namespace has been initialized */
-
- if (!acpi_gbl_root_node) {
- return_ACPI_STATUS (AE_NO_NAMESPACE);
- }
-
if (!pathname) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
-
/* Convert path to internal representation */
status = acpi_ns_internalize_name (pathname, &internal_path);
return_ACPI_STATUS (status);
}
+ /* Must lock namespace during lookup */
- acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
/* Setup lookup scope (search starting point) */
/* Lookup the name in the namespace */
status = acpi_ns_lookup (&scope_info, internal_path,
- ACPI_TYPE_ANY, IMODE_EXECUTE,
- NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
+ ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+ (flags | ACPI_NS_DONT_OPEN_SCOPE),
NULL, return_node);
-
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s, %s\n",
internal_path, acpi_format_exception (status)));
}
-
- acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-
/* Cleanup */
+ (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
ACPI_MEM_FREE (internal_path);
return_ACPI_STATUS (status);
}
acpi_namespace_node *parent_node;
- FUNCTION_TRACE ("Ns_find_parent_name");
+ ACPI_FUNCTION_TRACE ("Ns_find_parent_name");
if (child_node) {
/* Valid entry. Get the parent Node */
- parent_node = acpi_ns_get_parent_object (child_node);
+ parent_node = acpi_ns_get_parent_node (child_node);
if (parent_node) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Parent of %p [%4.4s] is %p [%4.4s]\n",
- child_node, (char*)&child_node->name, parent_node, (char*)&parent_node->name));
+ child_node, (char *) &child_node->name,
+ parent_node, (char *) &parent_node->name));
if (parent_node->name) {
return_VALUE (parent_node->name);
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "unable to find parent of %p (%4.4s)\n",
- child_node, (char*)&child_node->name));
+ child_node, (char *) &child_node->name));
}
return_VALUE (ACPI_UNKNOWN_NAME);
/*******************************************************************************
*
- * FUNCTION: Acpi_ns_get_parent_object
+ * FUNCTION: Acpi_ns_get_parent_node
*
* PARAMETERS: Node - Current table entry
*
acpi_namespace_node *
-acpi_ns_get_parent_object (
+acpi_ns_get_parent_node (
acpi_namespace_node *node)
{
-
-
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
if (!node) {
/******************************************************************************
*
* Module Name: nswalk - Functions for walking the ACPI namespace
- * $Revision: 26 $
+ * $Revision: 32 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_NAMESPACE
- MODULE_NAME ("nswalk")
+ ACPI_MODULE_NAME ("nswalk")
/*******************************************************************************
acpi_namespace_node *
acpi_ns_get_next_node (
- acpi_object_type8 type,
+ acpi_object_type type,
acpi_namespace_node *parent_node,
acpi_namespace_node *child_node)
{
acpi_namespace_node *next_node = NULL;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
if (!child_node) {
acpi_status
acpi_ns_walk_namespace (
- acpi_object_type8 type,
+ acpi_object_type type,
acpi_handle start_node,
u32 max_depth,
u8 unlock_before_callback,
acpi_status status;
acpi_namespace_node *child_node;
acpi_namespace_node *parent_node;
- acpi_object_type8 child_type;
+ acpi_object_type child_type;
u32 level;
- FUNCTION_TRACE ("Ns_walk_namespace");
+ ACPI_FUNCTION_TRACE ("Ns_walk_namespace");
/* Special case for the namespace Root Node */
* callback function
*/
if (unlock_before_callback) {
- acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
}
status = user_function (child_node, level,
context, return_value);
if (unlock_before_callback) {
- acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
}
switch (status) {
/* Exit now, with OK status */
return_ACPI_STATUS (AE_OK);
- break;
default:
/* All others are valid exceptions */
return_ACPI_STATUS (status);
- break;
}
}
}
}
}
-
else {
/*
* No more children of this node (Acpi_ns_get_next_node
*/
level--;
child_node = parent_node;
- parent_node = acpi_ns_get_parent_object (parent_node);
+ parent_node = acpi_ns_get_parent_node (parent_node);
}
}
*
* Module Name: nsxfname - Public interfaces to the ACPI subsystem
* ACPI Namespace oriented interfaces
- * $Revision: 82 $
+ * $Revision: 89 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_NAMESPACE
- MODULE_NAME ("nsxfname")
+ ACPI_MODULE_NAME ("nsxfname")
/****************************************************************************
acpi_namespace_node *prefix_node = NULL;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/* Parameter Validation */
/* Convert a parent handle to a prefix node */
if (parent) {
- acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
prefix_node = acpi_ns_map_handle_to_node (parent);
if (!prefix_node) {
- acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return (AE_BAD_PARAMETER);
}
- acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
}
/* Special case for root, since we can't search for it */
- if (STRCMP (pathname, NS_ROOT_PATH) == 0) {
+ if (ACPI_STRCMP (pathname, ACPI_NS_ROOT_PATH) == 0) {
*ret_handle = acpi_ns_convert_entry_to_handle (acpi_gbl_root_node);
return (AE_OK);
}
/*
* Find the Node and convert to a handle
*/
- status = acpi_ns_get_node (pathname, prefix_node, &node);
+ status = acpi_ns_get_node_by_path (pathname, prefix_node, ACPI_NS_NO_UPSEARCH, &node);
*ret_handle = NULL;
if (ACPI_SUCCESS (status)) {
*
* PARAMETERS: Handle - Handle to be converted to a pathname
* Name_type - Full pathname or single segment
- * Ret_path_ptr - Buffer for returned path
+ * Buffer - Buffer for returned path
*
* RETURN: Pointer to a string containing the fully qualified Name.
*
acpi_get_name (
acpi_handle handle,
u32 name_type,
- acpi_buffer *ret_path_ptr)
+ acpi_buffer *buffer)
{
acpi_status status;
acpi_namespace_node *node;
- /* Buffer pointer must be valid always */
+ /* Parameter validation */
- if (!ret_path_ptr || (name_type > ACPI_NAME_TYPE_MAX)) {
+ if (name_type > ACPI_NAME_TYPE_MAX) {
return (AE_BAD_PARAMETER);
}
- /* Allow length to be zero and ignore the pointer */
-
- if ((ret_path_ptr->length) &&
- (!ret_path_ptr->pointer)) {
- return (AE_BAD_PARAMETER);
+ status = acpi_ut_validate_buffer (buffer);
+ if (ACPI_FAILURE (status)) {
+ return (status);
}
if (name_type == ACPI_FULL_PATHNAME) {
/* Get the full pathname (From the namespace root) */
- status = acpi_ns_handle_to_pathname (handle, &ret_path_ptr->length,
- ret_path_ptr->pointer);
+ status = acpi_ns_handle_to_pathname (handle, buffer);
return (status);
}
/*
* Wants the single segment ACPI name.
- * Validate handle and convert to an Node
+ * Validate handle and convert to a namespace Node
*/
- acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
+
node = acpi_ns_map_handle_to_node (handle);
if (!node) {
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
}
- /* Check if name will fit in buffer */
+ /* Validate/Allocate/Clear caller buffer */
- if (ret_path_ptr->length < PATH_SEGMENT_LENGTH) {
- ret_path_ptr->length = PATH_SEGMENT_LENGTH;
- status = AE_BUFFER_OVERFLOW;
+ status = acpi_ut_initialize_buffer (buffer, PATH_SEGMENT_LENGTH);
+ if (ACPI_FAILURE (status)) {
goto unlock_and_exit;
}
/* Just copy the ACPI name from the Node and zero terminate it */
- STRNCPY (ret_path_ptr->pointer, (NATIVE_CHAR *) &node->name,
+ ACPI_STRNCPY (buffer->pointer, (NATIVE_CHAR *) &node->name,
ACPI_NAME_SIZE);
- ((NATIVE_CHAR *) ret_path_ptr->pointer) [ACPI_NAME_SIZE] = 0;
+ ((NATIVE_CHAR *) buffer->pointer) [ACPI_NAME_SIZE] = 0;
status = AE_OK;
unlock_and_exit:
- acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return (status);
}
return (AE_BAD_PARAMETER);
}
- acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
node = acpi_ns_map_handle_to_node (handle);
if (!node) {
- acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return (AE_BAD_PARAMETER);
}
info->type = node->type;
info->name = node->name;
- acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
/*
* If not a device, we are all done.
status = acpi_ut_execute_HID (node, &hid);
if (ACPI_SUCCESS (status)) {
- STRNCPY (info->hardware_id, hid.buffer, sizeof(info->hardware_id));
-
+ ACPI_STRNCPY (info->hardware_id, hid.buffer, sizeof(info->hardware_id));
info->valid |= ACPI_VALID_HID;
}
status = acpi_ut_execute_UID (node, &uid);
if (ACPI_SUCCESS (status)) {
- STRCPY (info->unique_id, uid.buffer);
-
+ ACPI_STRCPY (info->unique_id, uid.buffer);
info->valid |= ACPI_VALID_UID;
}
*
* Module Name: nsxfobj - Public interfaces to the ACPI subsystem
* ACPI Object oriented interfaces
- * $Revision: 95 $
+ * $Revision: 108 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_NAMESPACE
- MODULE_NAME ("nsxfobj")
+ ACPI_MODULE_NAME ("nsxfobj")
/*******************************************************************************
acpi_status status;
acpi_operand_object **internal_params = NULL;
acpi_operand_object *internal_return_obj = NULL;
- u32 buffer_space_needed;
- u32 user_buffer_length;
+ ACPI_SIZE buffer_space_needed;
u32 i;
- FUNCTION_TRACE ("Acpi_evaluate_object");
+ ACPI_FUNCTION_TRACE ("Acpi_evaluate_object");
/*
* Allocate a new parameter block for the internal objects
* Add 1 to count to allow for null terminated internal list
*/
- internal_params = ACPI_MEM_CALLOCATE ((external_params->count + 1) * sizeof (void *));
+ internal_params = ACPI_MEM_CALLOCATE ((external_params->count + 1) *
+ sizeof (void *));
if (!internal_params) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
-
/*
* Convert each external object in the list to an
* internal object
for (i = 0; i < external_params->count; i++) {
status = acpi_ut_copy_eobject_to_iobject (&external_params->pointer[i],
&internal_params[i]);
-
if (ACPI_FAILURE (status)) {
acpi_ut_delete_internal_object_list (internal_params);
return_ACPI_STATUS (status);
internal_params[external_params->count] = NULL;
}
-
/*
* Three major cases:
* 1) Fully qualified pathname
/*
* The path is fully qualified, just evaluate by name
*/
- status = acpi_ns_evaluate_by_name (pathname, internal_params, &internal_return_obj);
+ status = acpi_ns_evaluate_by_name (pathname, internal_params,
+ &internal_return_obj);
}
-
else if (!handle) {
/*
* A handle is optional iff a fully qualified pathname
* qualified names above, this is an error
*/
if (!pathname) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Both Handle and Pathname are NULL\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Both Handle and Pathname are NULL\n"));
}
-
else {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Handle is NULL and Pathname is relative\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Handle is NULL and Pathname is relative\n"));
}
status = AE_BAD_PARAMETER;
}
-
else {
/*
* We get here if we have a handle -- and if we have a
* The null pathname case means the handle is for
* the actual object to be evaluated
*/
- status = acpi_ns_evaluate_by_handle (handle, internal_params, &internal_return_obj);
+ status = acpi_ns_evaluate_by_handle (handle, internal_params,
+ &internal_return_obj);
}
-
else {
/*
* Both a Handle and a relative Pathname
*/
status = acpi_ns_evaluate_relative (handle, pathname, internal_params,
- &internal_return_obj);
+ &internal_return_obj);
}
}
* If we are expecting a return value, and all went well above,
* copy the return value to an external object.
*/
-
if (return_buffer) {
- user_buffer_length = return_buffer->length;
- return_buffer->length = 0;
-
- if (internal_return_obj) {
- if (VALID_DESCRIPTOR_TYPE (internal_return_obj, ACPI_DESC_TYPE_NAMED)) {
+ if (!internal_return_obj) {
+ return_buffer->length = 0;
+ }
+ else {
+ if (ACPI_GET_DESCRIPTOR_TYPE (internal_return_obj) == ACPI_DESC_TYPE_NAMED) {
/*
- * If we got an Node as a return object,
- * this means the object we are evaluating
- * has nothing interesting to return (such
- * as a mutex, etc.) We return an error
- * because these types are essentially
- * unsupported by this interface. We
- * don't check up front because this makes
- * it easier to add support for various
- * types at a later date if necessary.
+ * If we received a NS Node as a return object, this means that
+ * the object we are evaluating has nothing interesting to
+ * return (such as a mutex, etc.) We return an error because
+ * these types are essentially unsupported by this interface.
+ * We don't check up front because this makes it easier to add
+ * support for various types at a later date if necessary.
*/
status = AE_TYPE;
- internal_return_obj = NULL; /* No need to delete an Node */
+ internal_return_obj = NULL; /* No need to delete a NS Node */
+ return_buffer->length = 0;
}
if (ACPI_SUCCESS (status)) {
status = acpi_ut_get_object_size (internal_return_obj,
&buffer_space_needed);
if (ACPI_SUCCESS (status)) {
- /*
- * Check if there is enough room in the
- * caller's buffer
- */
- if (user_buffer_length < buffer_space_needed) {
+ /* Validate/Allocate/Clear caller buffer */
+
+ status = acpi_ut_initialize_buffer (return_buffer, buffer_space_needed);
+ if (ACPI_FAILURE (status)) {
/*
- * Caller's buffer is too small, can't
- * give him partial results fail the call
- * but return the buffer size needed
+ * Caller's buffer is too small or a new one can't be allocated
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Needed buffer size %X, received %X\n",
- buffer_space_needed, user_buffer_length));
-
- return_buffer->length = buffer_space_needed;
- status = AE_BUFFER_OVERFLOW;
+ "Needed buffer size %X, %s\n",
+ buffer_space_needed, acpi_format_exception (status)));
}
-
else {
/*
* We have enough space for the object, build it
*/
status = acpi_ut_copy_iobject_to_eobject (internal_return_obj,
return_buffer);
- return_buffer->length = buffer_space_needed;
}
}
}
}
}
-
/* Delete the return and parameter objects */
if (internal_return_obj) {
acpi_handle child,
acpi_handle *ret_handle)
{
- acpi_status status = AE_OK;
+ acpi_status status;
acpi_namespace_node *node;
acpi_namespace_node *parent_node = NULL;
acpi_namespace_node *child_node = NULL;
return (AE_BAD_PARAMETER);
}
- acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
/* If null handle, use the parent */
goto unlock_and_exit;
}
}
-
- /* Non-null handle, ignore the parent */
-
else {
+ /* Non-null handle, ignore the parent */
/* Convert and validate the handle */
child_node = acpi_ns_map_handle_to_node (child);
}
}
-
/* Internal function does the real work */
- node = acpi_ns_get_next_node ((acpi_object_type8) type,
- parent_node, child_node);
+ node = acpi_ns_get_next_node (type, parent_node, child_node);
if (!node) {
status = AE_NOT_FOUND;
goto unlock_and_exit;
unlock_and_exit:
- acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return (status);
}
acpi_object_type *ret_type)
{
acpi_namespace_node *node;
+ acpi_status status;
/* Parameter Validation */
return (AE_OK);
}
- acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
/* Convert and validate the handle */
node = acpi_ns_map_handle_to_node (handle);
if (!node) {
- acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return (AE_BAD_PARAMETER);
}
*ret_type = node->type;
- acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
- return (AE_OK);
+ status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ return (status);
}
acpi_handle *ret_handle)
{
acpi_namespace_node *node;
- acpi_status status = AE_OK;
+ acpi_status status;
if (!ret_handle) {
return (AE_NULL_ENTRY);
}
-
- acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
/* Convert and validate the handle */
goto unlock_and_exit;
}
-
/* Get the parent entry */
*ret_handle =
- acpi_ns_convert_entry_to_handle (acpi_ns_get_parent_object (node));
+ acpi_ns_convert_entry_to_handle (acpi_ns_get_parent_node (node));
/* Return exeption if parent is null */
- if (!acpi_ns_get_parent_object (node)) {
+ if (!acpi_ns_get_parent_node (node)) {
status = AE_NULL_ENTRY;
}
unlock_and_exit:
- acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return (status);
}
acpi_status status;
- FUNCTION_TRACE ("Acpi_walk_namespace");
+ ACPI_FUNCTION_TRACE ("Acpi_walk_namespace");
/* Parameter validation */
* to the user function - since this function
* must be allowed to make Acpi calls itself.
*/
- acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- status = acpi_ns_walk_namespace ((acpi_object_type8) type, start_object,
- max_depth, NS_WALK_UNLOCK, user_function, context,
- return_value);
+ status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
- acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ status = acpi_ns_walk_namespace (type, start_object, max_depth, ACPI_NS_WALK_UNLOCK,
+ user_function, context, return_value);
+ (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (status);
}
acpi_status status;
acpi_namespace_node *node;
u32 flags;
- acpi_device_id device_id;
+ acpi_device_id hid;
+ acpi_device_id cid;
acpi_get_devices_info *info;
info = context;
- acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
+
node = acpi_ns_map_handle_to_node (obj_handle);
- acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
if (!node) {
return (AE_BAD_PARAMETER);
}
if (!(flags & 0x01)) {
- /* don't return at the device or children of the device if not there */
+ /* Don't return at the device or children of the device if not there */
return (AE_CTRL_DEPTH);
}
/*
- * Filter based on device HID
+ * Filter based on device HID & CID
*/
if (info->hid != NULL) {
- status = acpi_ut_execute_HID (node, &device_id);
+ status = acpi_ut_execute_HID (node, &hid);
if (status == AE_NOT_FOUND) {
return (AE_OK);
}
-
else if (ACPI_FAILURE (status)) {
return (AE_CTRL_DEPTH);
}
- if (STRNCMP (device_id.buffer, info->hid, sizeof (device_id.buffer)) != 0) {
- return (AE_OK);
+ if (ACPI_STRNCMP (hid.buffer, info->hid, sizeof (hid.buffer)) != 0) {
+ status = acpi_ut_execute_CID (node, &cid);
+ if (status == AE_NOT_FOUND) {
+ return (AE_OK);
+ }
+ else if (ACPI_FAILURE (status)) {
+ return (AE_CTRL_DEPTH);
+ }
+
+ /* TBD: Handle CID packages */
+
+ if (ACPI_STRNCMP (cid.buffer, info->hid, sizeof (cid.buffer)) != 0) {
+ return (AE_OK);
+ }
}
}
acpi_get_devices_info info;
- FUNCTION_TRACE ("Acpi_get_devices");
+ ACPI_FUNCTION_TRACE ("Acpi_get_devices");
/* Parameter validation */
* to the user function - since this function
* must be allowed to make Acpi calls itself.
*/
- acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+
status = acpi_ns_walk_namespace (ACPI_TYPE_DEVICE,
ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
- NS_WALK_UNLOCK,
+ ACPI_NS_WALK_UNLOCK,
acpi_ns_get_device_callback, &info,
return_value);
- acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-
+ (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (status);
}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_attach_data
+ *
+ * PARAMETERS:
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION:
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_attach_data (
+ acpi_handle obj_handle,
+ ACPI_OBJECT_HANDLER handler,
+ void *data)
+{
+ acpi_namespace_node *node;
+ acpi_status status;
+
+
+ /* Parameter validation */
+
+ if (!obj_handle ||
+ !handler ||
+ !data) {
+ return (AE_BAD_PARAMETER);
+ }
+
+ status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
+
+ /* Convert and validate the handle */
+
+ node = acpi_ns_map_handle_to_node (obj_handle);
+ if (!node) {
+ status = AE_BAD_PARAMETER;
+ goto unlock_and_exit;
+ }
+
+ status = acpi_ns_attach_data (node, handler, data);
+
+unlock_and_exit:
+ (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_detach_data
+ *
+ * PARAMETERS:
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION:
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_detach_data (
+ acpi_handle obj_handle,
+ ACPI_OBJECT_HANDLER handler)
+{
+ acpi_namespace_node *node;
+ acpi_status status;
+
+
+ /* Parameter validation */
+
+ if (!obj_handle ||
+ !handler) {
+ return (AE_BAD_PARAMETER);
+ }
+
+ status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
+
+ /* Convert and validate the handle */
+
+ node = acpi_ns_map_handle_to_node (obj_handle);
+ if (!node) {
+ status = AE_BAD_PARAMETER;
+ goto unlock_and_exit;
+ }
+
+ status = acpi_ns_detach_data (node, handler);
+
+unlock_and_exit:
+ (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_get_data
+ *
+ * PARAMETERS:
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION:
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_get_data (
+ acpi_handle obj_handle,
+ ACPI_OBJECT_HANDLER handler,
+ void **data)
+{
+ acpi_namespace_node *node;
+ acpi_status status;
+
+
+ /* Parameter validation */
+
+ if (!obj_handle ||
+ !handler ||
+ !data) {
+ return (AE_BAD_PARAMETER);
+ }
+
+ status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
+
+ /* Convert and validate the handle */
+
+ node = acpi_ns_map_handle_to_node (obj_handle);
+ if (!node) {
+ status = AE_BAD_PARAMETER;
+ goto unlock_and_exit;
+ }
+
+ status = acpi_ns_get_attached_data (node, handler, data);
+
+unlock_and_exit:
+ (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ return (status);
+}
+
+
#
# Makefile for all Linux ACPI interpreter subdirectories
-# EXCEPT for the ospm directory
#
O_TARGET := $(notdir $(CURDIR)).o
-obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c))
+obj-$(CONFIG_ACPI_INTERPRETER) := $(patsubst %.c,%.o,$(wildcard *.c))
EXTRA_CFLAGS += $(ACPI_CFLAGS)
/******************************************************************************
*
* Module Name: psargs - Parse AML opcode arguments
- * $Revision: 52 $
+ * $Revision: 58 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acnamesp.h"
#define _COMPONENT ACPI_PARSER
- MODULE_NAME ("psargs")
+ ACPI_MODULE_NAME ("psargs")
/*******************************************************************************
u32 length = 0;
- FUNCTION_TRACE ("Ps_get_next_package_length");
+ ACPI_FUNCTION_TRACE ("Ps_get_next_package_length");
- encoded_length = (u32) GET8 (parser_state->aml);
+ encoded_length = (u32) ACPI_GET8 (parser_state->aml);
parser_state->aml++;
case 1: /* 2-byte encoding (next byte + bits 0-3) */
- length = ((GET8 (parser_state->aml) << 04) |
+ length = ((ACPI_GET8 (parser_state->aml) << 04) |
(encoded_length & 0x0F));
parser_state->aml++;
break;
case 2: /* 3-byte encoding (next 2 bytes + bits 0-3) */
- length = ((GET8 (parser_state->aml + 1) << 12) |
- (GET8 (parser_state->aml) << 04) |
+ length = ((ACPI_GET8 (parser_state->aml + 1) << 12) |
+ (ACPI_GET8 (parser_state->aml) << 04) |
(encoded_length & 0x0F));
parser_state->aml += 2;
break;
case 3: /* 4-byte encoding (next 3 bytes + bits 0-3) */
- length = ((GET8 (parser_state->aml + 2) << 20) |
- (GET8 (parser_state->aml + 1) << 12) |
- (GET8 (parser_state->aml) << 04) |
+ length = ((ACPI_GET8 (parser_state->aml + 2) << 20) |
+ (ACPI_GET8 (parser_state->aml + 1) << 12) |
+ (ACPI_GET8 (parser_state->aml) << 04) |
(encoded_length & 0x0F));
parser_state->aml += 3;
break;
NATIVE_UINT length;
- FUNCTION_TRACE ("Ps_get_next_package_end");
+ ACPI_FUNCTION_TRACE ("Ps_get_next_package_end");
length = (NATIVE_UINT) acpi_ps_get_next_package_length (parser_state);
u32 length;
- FUNCTION_TRACE ("Ps_get_next_namestring");
+ ACPI_FUNCTION_TRACE ("Ps_get_next_namestring");
/* Handle multiple prefix characters */
- while (acpi_ps_is_prefix_char (GET8 (end))) {
+ while (acpi_ps_is_prefix_char (ACPI_GET8 (end))) {
/* include prefix '\\' or '^' */
end++;
/* Decode the path */
- switch (GET8 (end)) {
+ switch (ACPI_GET8 (end)) {
case 0:
/* Null_name */
/* multiple name segments */
- length = (u32) GET8 (end + 1) * 4;
+ length = (u32) ACPI_GET8 (end + 1) * 4;
end += 2 + length;
break;
acpi_parse_object *count;
- FUNCTION_TRACE ("Ps_get_next_namepath");
+ ACPI_FUNCTION_TRACE ("Ps_get_next_namepath");
path = acpi_ps_get_next_namestring (parser_state);
acpi_generic_state scope_info;
- FUNCTION_TRACE ("Ps_get_next_namepath");
+ ACPI_FUNCTION_TRACE ("Ps_get_next_namepath");
path = acpi_ps_get_next_namestring (parser_state);
* parent tree, but don't open a new scope -- we just want to lookup the
* object (MUST BE mode EXECUTE to perform upsearch)
*/
- status = acpi_ns_lookup (&scope_info, path, ACPI_TYPE_ANY, IMODE_EXECUTE,
- NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE, NULL,
+ status = acpi_ns_lookup (&scope_info, path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+ ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL,
&node);
if (ACPI_SUCCESS (status)) {
if (node->type == ACPI_TYPE_METHOD) {
name_op->node = method_node;
acpi_ps_append_arg (arg, name_op);
- if (!method_node->object) {
+ if (!acpi_ns_get_attached_object (method_node)) {
return_VOID;
}
- *arg_count = (method_node->object)->method.param_count;
+ *arg_count = (acpi_ns_get_attached_object (method_node))->method.param_count;
}
return_VOID;
acpi_parse_object *arg)
{
- FUNCTION_TRACE_U32 ("Ps_get_next_simple_arg", arg_type);
+ ACPI_FUNCTION_TRACE_U32 ("Ps_get_next_simple_arg", arg_type);
switch (arg_type) {
case ARGP_BYTEDATA:
acpi_ps_init_op (arg, AML_BYTE_OP);
- arg->value.integer = (u32) GET8 (parser_state->aml);
+ arg->value.integer = (u32) ACPI_GET8 (parser_state->aml);
parser_state->aml++;
break;
/* Get 2 bytes from the AML stream */
- MOVE_UNALIGNED16_TO_32 (&arg->value.integer, parser_state->aml);
+ ACPI_MOVE_UNALIGNED16_TO_32 (&arg->value.integer, parser_state->aml);
parser_state->aml += 2;
break;
/* Get 4 bytes from the AML stream */
- MOVE_UNALIGNED32_TO_32 (&arg->value.integer, parser_state->aml);
+ ACPI_MOVE_UNALIGNED32_TO_32 (&arg->value.integer, parser_state->aml);
parser_state->aml += 4;
break;
/* Get 8 bytes from the AML stream */
- MOVE_UNALIGNED64_TO_64 (&arg->value.integer, parser_state->aml);
+ ACPI_MOVE_UNALIGNED64_TO_64 (&arg->value.integer, parser_state->aml);
parser_state->aml += 8;
break;
case ARGP_CHARLIST:
acpi_ps_init_op (arg, AML_STRING_OP);
- arg->value.string = (char*) parser_state->aml;
+ arg->value.string = (char *) parser_state->aml;
- while (GET8 (parser_state->aml) != '\0') {
+ while (ACPI_GET8 (parser_state->aml) != '\0') {
parser_state->aml++;
}
parser_state->aml++;
u32 name;
- FUNCTION_TRACE ("Ps_get_next_field");
+ ACPI_FUNCTION_TRACE ("Ps_get_next_field");
/* determine field type */
- switch (GET8 (parser_state->aml)) {
+ switch (ACPI_GET8 (parser_state->aml)) {
default:
/* Get the 4-character name */
- MOVE_UNALIGNED32_TO_32 (&name, parser_state->aml);
+ ACPI_MOVE_UNALIGNED32_TO_32 (&name, parser_state->aml);
acpi_ps_set_name (field, name);
parser_state->aml += 4;
case AML_INT_ACCESSFIELD_OP:
- /* Get Access_type and Access_atrib and merge into the field Op */
-
- field->value.integer = ((GET8 (parser_state->aml) << 8) |
- GET8 (parser_state->aml));
- parser_state->aml += 2;
+ /*
+ * Get Access_type and Access_attrib and merge into the field Op
+ * Access_type is first operand, Access_attribute is second
+ */
+ field->value.integer32 = (ACPI_GET8 (parser_state->aml) << 8);
+ parser_state->aml++;
+ field->value.integer32 |= ACPI_GET8 (parser_state->aml);
+ parser_state->aml++;
break;
}
}
u32 subop;
- FUNCTION_TRACE_PTR ("Ps_get_next_arg", parser_state);
+ ACPI_FUNCTION_TRACE_PTR ("Ps_get_next_arg", parser_state);
switch (arg_type) {
case ARGP_TARGET:
- case ARGP_SUPERNAME: {
+ case ARGP_SUPERNAME:
+ case ARGP_SIMPLENAME: {
subop = acpi_ps_peek_opcode (parser_state);
if (subop == 0 ||
acpi_ps_is_leading_char (subop) ||
/******************************************************************************
*
* Module Name: psopcode - Parser/Interpreter opcode information table
- * $Revision: 49 $
+ * $Revision: 64 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_PARSER
- MODULE_NAME ("psopcode")
+ ACPI_MODULE_NAME ("psopcode")
#define _UNK 0x6B
#define ARGP_TO_STRING_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_TYPE_OP ARGP_LIST1 (ARGP_SUPERNAME)
#define ARGP_UNLOAD_OP ARGP_LIST1 (ARGP_SUPERNAME)
-#define ARGP_VAR_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_BYTEDATA, ARGP_DATAOBJLIST)
+#define ARGP_VAR_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_DATAOBJLIST)
#define ARGP_WAIT_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG)
#define ARGP_WHILE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST)
#define ARGP_WORD_OP ARGP_LIST1 (ARGP_WORDDATA)
#define ARGI_DATA_REGION_OP ARGI_LIST3 (ARGI_STRING, ARGI_STRING, ARGI_STRING)
#define ARGI_DEBUG_OP ARG_NONE
#define ARGI_DECREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF)
-#define ARGI_DEREF_OF_OP ARGI_LIST1 (ARGI_REFERENCE)
+#define ARGI_DEREF_OF_OP ARGI_LIST1 (ARGI_REF_OR_STRING)
#define ARGI_DEVICE_OP ARGI_INVALID_OPCODE
#define ARGI_DIVIDE_OP ARGI_LIST4 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF, ARGI_TARGETREF)
#define ARGI_DWORD_OP ARGI_INVALID_OPCODE
#define ARGI_LNOT_OP ARGI_LIST1 (ARGI_INTEGER)
#define ARGI_LNOTEQUAL_OP ARGI_INVALID_OPCODE
#define ARGI_LOAD_OP ARGI_LIST2 (ARGI_REGION, ARGI_TARGETREF)
-#define ARGI_LOAD_TABLE_OP ARGI_LIST6 (ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_TARGETREF)
+#define ARGI_LOAD_TABLE_OP ARGI_LIST6 (ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_ANYTYPE)
#define ARGI_LOCAL0 ARG_NONE
#define ARGI_LOCAL1 ARG_NONE
#define ARGI_LOCAL2 ARG_NONE
/******************************************************************************
- Opcodes that have associated namespace objects
+ Opcodes that have associated namespace objects (AML_NSOBJECT flag)
AML_SCOPE_OP
AML_DEVICE_OP
AML_INT_METHODCALL_OP
AML_INT_NAMEPATH_OP
- Opcodes that are "namespace" opcodes
+ Opcodes that are "namespace" opcodes (AML_NSOPCODE flag)
AML_SCOPE_OP
AML_DEVICE_OP
AML_REGION_OP
AML_INT_NAMEDFIELD_OP
- Opcodes that have an associated namespace node
+ Opcodes that have an associated namespace node (AML_NSNODE flag)
AML_SCOPE_OP
AML_DEVICE_OP
AML_INT_METHODCALL_OP
AML_INT_NAMEPATH_OP
- Opcodes that define named ACPI objects
+ Opcodes that define named ACPI objects (AML_NAMED flag)
AML_SCOPE_OP
AML_DEVICE_OP
AML_REGION_OP
AML_INT_NAMEDFIELD_OP
- Opcodes that contain executable AML as part of the definition that
- must be deferred until needed
+ Opcodes that contain executable AML as part of the definition that
+ must be deferred until needed
AML_METHOD_OP
AML_VAR_PACKAGE_OP
*/
-static const acpi_opcode_info aml_op_info[] =
+static const acpi_opcode_info acpi_gbl_aml_op_info[] =
{
-/* Index Name Parser Args Interpreter Args Class Type Flags */
-
-/* 00 */ ACPI_OP ("Zero", ARGP_ZERO_OP, ARGI_ZERO_OP, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0),
-/* 01 */ ACPI_OP ("One", ARGP_ONE_OP, ARGI_ONE_OP, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0),
-/* 02 */ ACPI_OP ("Alias", ARGP_ALIAS_OP, ARGI_ALIAS_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
-/* 03 */ ACPI_OP ("Name", ARGP_NAME_OP, ARGI_NAME_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
-/* 04 */ ACPI_OP ("Byte_const", ARGP_BYTE_OP, ARGI_BYTE_OP, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0),
-/* 05 */ ACPI_OP ("Word_const", ARGP_WORD_OP, ARGI_WORD_OP, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0),
-/* 06 */ ACPI_OP ("Dword_const", ARGP_DWORD_OP, ARGI_DWORD_OP, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0),
-/* 07 */ ACPI_OP ("String", ARGP_STRING_OP, ARGI_STRING_OP, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0),
-/* 08 */ ACPI_OP ("Scope", ARGP_SCOPE_OP, ARGI_SCOPE_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
-/* 09 */ ACPI_OP ("Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP, AML_CLASS_ARGUMENT, AML_TYPE_DATA_TERM, AML_HAS_ARGS),
-/* 0A */ ACPI_OP ("Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP, AML_CLASS_ARGUMENT, AML_TYPE_DATA_TERM, AML_HAS_ARGS),
-/* 0B */ ACPI_OP ("Method", ARGP_METHOD_OP, ARGI_METHOD_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER),
-/* 0C */ ACPI_OP ("Local0", ARGP_LOCAL0, ARGI_LOCAL0, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
-/* 0D */ ACPI_OP ("Local1", ARGP_LOCAL1, ARGI_LOCAL1, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
-/* 0E */ ACPI_OP ("Local2", ARGP_LOCAL2, ARGI_LOCAL2, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
-/* 0F */ ACPI_OP ("Local3", ARGP_LOCAL3, ARGI_LOCAL3, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
-/* 10 */ ACPI_OP ("Local4", ARGP_LOCAL4, ARGI_LOCAL4, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
-/* 11 */ ACPI_OP ("Local5", ARGP_LOCAL5, ARGI_LOCAL5, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
-/* 12 */ ACPI_OP ("Local6", ARGP_LOCAL6, ARGI_LOCAL6, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
-/* 13 */ ACPI_OP ("Local7", ARGP_LOCAL7, ARGI_LOCAL7, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
-/* 14 */ ACPI_OP ("Arg0", ARGP_ARG0, ARGI_ARG0, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
-/* 15 */ ACPI_OP ("Arg1", ARGP_ARG1, ARGI_ARG1, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
-/* 16 */ ACPI_OP ("Arg2", ARGP_ARG2, ARGI_ARG2, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
-/* 17 */ ACPI_OP ("Arg3", ARGP_ARG3, ARGI_ARG3, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
-/* 18 */ ACPI_OP ("Arg4", ARGP_ARG4, ARGI_ARG4, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
-/* 19 */ ACPI_OP ("Arg5", ARGP_ARG5, ARGI_ARG5, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
-/* 1_a */ ACPI_OP ("Arg6", ARGP_ARG6, ARGI_ARG6, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
-/* 1_b */ ACPI_OP ("Store", ARGP_STORE_OP, ARGI_STORE_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
-/* 1_c */ ACPI_OP ("Ref_of", ARGP_REF_OF_OP, ARGI_REF_OF_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
-/* 1_d */ ACPI_OP ("Add", ARGP_ADD_OP, ARGI_ADD_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH),
-/* 1_e */ ACPI_OP ("Concatenate", ARGP_CONCAT_OP, ARGI_CONCAT_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R),
-/* 1_f */ ACPI_OP ("Subtract", ARGP_SUBTRACT_OP, ARGI_SUBTRACT_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH),
-/* 20 */ ACPI_OP ("Increment", ARGP_INCREMENT_OP, ARGI_INCREMENT_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
-/* 21 */ ACPI_OP ("Decrement", ARGP_DECREMENT_OP, ARGI_DECREMENT_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
-/* 22 */ ACPI_OP ("Multiply", ARGP_MULTIPLY_OP, ARGI_MULTIPLY_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH),
-/* 23 */ ACPI_OP ("Divide", ARGP_DIVIDE_OP, ARGI_DIVIDE_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_2T_1R, AML_FLAGS_EXEC_2A_2T_1R),
-/* 24 */ ACPI_OP ("Shift_left", ARGP_SHIFT_LEFT_OP, ARGI_SHIFT_LEFT_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH),
-/* 25 */ ACPI_OP ("Shift_right", ARGP_SHIFT_RIGHT_OP, ARGI_SHIFT_RIGHT_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH),
-/* 26 */ ACPI_OP ("And", ARGP_BIT_AND_OP, ARGI_BIT_AND_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH),
-/* 27 */ ACPI_OP ("NAnd", ARGP_BIT_NAND_OP, ARGI_BIT_NAND_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH),
-/* 28 */ ACPI_OP ("Or", ARGP_BIT_OR_OP, ARGI_BIT_OR_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH),
-/* 29 */ ACPI_OP ("NOr", ARGP_BIT_NOR_OP, ARGI_BIT_NOR_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH),
-/* 2_a */ ACPI_OP ("XOr", ARGP_BIT_XOR_OP, ARGI_BIT_XOR_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH),
-/* 2_b */ ACPI_OP ("Not", ARGP_BIT_NOT_OP, ARGI_BIT_NOT_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
-/* 2_c */ ACPI_OP ("Find_set_left_bit", ARGP_FIND_SET_LEFT_BIT_OP, ARGI_FIND_SET_LEFT_BIT_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
-/* 2_d */ ACPI_OP ("Find_set_right_bit", ARGP_FIND_SET_RIGHT_BIT_OP,ARGI_FIND_SET_RIGHT_BIT_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
-/* 2_e */ ACPI_OP ("Deref_of", ARGP_DEREF_OF_OP, ARGI_DEREF_OF_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
-/* 2_f */ ACPI_OP ("Notify", ARGP_NOTIFY_OP, ARGI_NOTIFY_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_0R, AML_FLAGS_EXEC_2A_0T_0R),
-/* 30 */ ACPI_OP ("Size_of", ARGP_SIZE_OF_OP, ARGI_SIZE_OF_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
-/* 31 */ ACPI_OP ("Index", ARGP_INDEX_OP, ARGI_INDEX_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R),
-/* 32 */ ACPI_OP ("Match", ARGP_MATCH_OP, ARGI_MATCH_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R),
-/* 33 */ ACPI_OP ("Create_dWord_field", ARGP_CREATE_DWORD_FIELD_OP,ARGI_CREATE_DWORD_FIELD_OP, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
-/* 34 */ ACPI_OP ("Create_word_field", ARGP_CREATE_WORD_FIELD_OP, ARGI_CREATE_WORD_FIELD_OP, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
-/* 35 */ ACPI_OP ("Create_byte_field", ARGP_CREATE_BYTE_FIELD_OP, ARGI_CREATE_BYTE_FIELD_OP, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
-/* 36 */ ACPI_OP ("Create_bit_field", ARGP_CREATE_BIT_FIELD_OP, ARGI_CREATE_BIT_FIELD_OP, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
-/* 37 */ ACPI_OP ("Object_type", ARGP_TYPE_OP, ARGI_TYPE_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
-/* 38 */ ACPI_OP ("LAnd", ARGP_LAND_OP, ARGI_LAND_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL),
-/* 39 */ ACPI_OP ("LOr", ARGP_LOR_OP, ARGI_LOR_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL),
-/* 3_a */ ACPI_OP ("LNot", ARGP_LNOT_OP, ARGI_LNOT_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
-/* 3_b */ ACPI_OP ("LEqual", ARGP_LEQUAL_OP, ARGI_LEQUAL_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL),
-/* 3_c */ ACPI_OP ("LGreater", ARGP_LGREATER_OP, ARGI_LGREATER_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL),
-/* 3_d */ ACPI_OP ("LLess", ARGP_LLESS_OP, ARGI_LLESS_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL),
-/* 3_e */ ACPI_OP ("If", ARGP_IF_OP, ARGI_IF_OP, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS),
-/* 3_f */ ACPI_OP ("Else", ARGP_ELSE_OP, ARGI_ELSE_OP, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS),
-/* 40 */ ACPI_OP ("While", ARGP_WHILE_OP, ARGI_WHILE_OP, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS),
-/* 41 */ ACPI_OP ("Noop", ARGP_NOOP_OP, ARGI_NOOP_OP, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
-/* 42 */ ACPI_OP ("Return", ARGP_RETURN_OP, ARGI_RETURN_OP, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS),
-/* 43 */ ACPI_OP ("Break", ARGP_BREAK_OP, ARGI_BREAK_OP, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
-/* 44 */ ACPI_OP ("Break_point", ARGP_BREAK_POINT_OP, ARGI_BREAK_POINT_OP, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
-/* 45 */ ACPI_OP ("Ones", ARGP_ONES_OP, ARGI_ONES_OP, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0),
+/*! [Begin] no source code translation */
+/* Index Name Parser Args Interpreter Args ObjectType Class Type Flags */
+
+/* 00 */ ACPI_OP ("Zero", ARGP_ZERO_OP, ARGI_ZERO_OP, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0),
+/* 01 */ ACPI_OP ("One", ARGP_ONE_OP, ARGI_ONE_OP, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0),
+/* 02 */ ACPI_OP ("Alias", ARGP_ALIAS_OP, ARGI_ALIAS_OP, INTERNAL_TYPE_ALIAS, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
+/* 03 */ ACPI_OP ("Name", ARGP_NAME_OP, ARGI_NAME_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
+/* 04 */ ACPI_OP ("ByteConst", ARGP_BYTE_OP, ARGI_BYTE_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0),
+/* 05 */ ACPI_OP ("WordConst", ARGP_WORD_OP, ARGI_WORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0),
+/* 06 */ ACPI_OP ("DwordConst", ARGP_DWORD_OP, ARGI_DWORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0),
+/* 07 */ ACPI_OP ("String", ARGP_STRING_OP, ARGI_STRING_OP, ACPI_TYPE_STRING, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0),
+/* 08 */ ACPI_OP ("Scope", ARGP_SCOPE_OP, ARGI_SCOPE_OP, INTERNAL_TYPE_SCOPE, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
+/* 09 */ ACPI_OP ("Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP, ACPI_TYPE_BUFFER, AML_CLASS_ARGUMENT, AML_TYPE_DATA_TERM, AML_HAS_ARGS),
+/* 0A */ ACPI_OP ("Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_ARGUMENT, AML_TYPE_DATA_TERM, AML_HAS_ARGS),
+/* 0B */ ACPI_OP ("Method", ARGP_METHOD_OP, ARGI_METHOD_OP, ACPI_TYPE_METHOD, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER),
+/* 0C */ ACPI_OP ("Local0", ARGP_LOCAL0, ARGI_LOCAL0, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
+/* 0D */ ACPI_OP ("Local1", ARGP_LOCAL1, ARGI_LOCAL1, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
+/* 0E */ ACPI_OP ("Local2", ARGP_LOCAL2, ARGI_LOCAL2, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
+/* 0F */ ACPI_OP ("Local3", ARGP_LOCAL3, ARGI_LOCAL3, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
+/* 10 */ ACPI_OP ("Local4", ARGP_LOCAL4, ARGI_LOCAL4, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
+/* 11 */ ACPI_OP ("Local5", ARGP_LOCAL5, ARGI_LOCAL5, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
+/* 12 */ ACPI_OP ("Local6", ARGP_LOCAL6, ARGI_LOCAL6, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
+/* 13 */ ACPI_OP ("Local7", ARGP_LOCAL7, ARGI_LOCAL7, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
+/* 14 */ ACPI_OP ("Arg0", ARGP_ARG0, ARGI_ARG0, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
+/* 15 */ ACPI_OP ("Arg1", ARGP_ARG1, ARGI_ARG1, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
+/* 16 */ ACPI_OP ("Arg2", ARGP_ARG2, ARGI_ARG2, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
+/* 17 */ ACPI_OP ("Arg3", ARGP_ARG3, ARGI_ARG3, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
+/* 18 */ ACPI_OP ("Arg4", ARGP_ARG4, ARGI_ARG4, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
+/* 19 */ ACPI_OP ("Arg5", ARGP_ARG5, ARGI_ARG5, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
+/* 1A */ ACPI_OP ("Arg6", ARGP_ARG6, ARGI_ARG6, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
+/* 1B */ ACPI_OP ("Store", ARGP_STORE_OP, ARGI_STORE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
+/* 1C */ ACPI_OP ("RefOf", ARGP_REF_OF_OP, ARGI_REF_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
+/* 1D */ ACPI_OP ("Add", ARGP_ADD_OP, ARGI_ADD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH),
+/* 1E */ ACPI_OP ("Concatenate", ARGP_CONCAT_OP, ARGI_CONCAT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R),
+/* 1F */ ACPI_OP ("Subtract", ARGP_SUBTRACT_OP, ARGI_SUBTRACT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH),
+/* 20 */ ACPI_OP ("Increment", ARGP_INCREMENT_OP, ARGI_INCREMENT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
+/* 21 */ ACPI_OP ("Decrement", ARGP_DECREMENT_OP, ARGI_DECREMENT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
+/* 22 */ ACPI_OP ("Multiply", ARGP_MULTIPLY_OP, ARGI_MULTIPLY_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH),
+/* 23 */ ACPI_OP ("Divide", ARGP_DIVIDE_OP, ARGI_DIVIDE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_2T_1R, AML_FLAGS_EXEC_2A_2T_1R),
+/* 24 */ ACPI_OP ("ShiftLeft", ARGP_SHIFT_LEFT_OP, ARGI_SHIFT_LEFT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH),
+/* 25 */ ACPI_OP ("ShiftRight", ARGP_SHIFT_RIGHT_OP, ARGI_SHIFT_RIGHT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH),
+/* 26 */ ACPI_OP ("And", ARGP_BIT_AND_OP, ARGI_BIT_AND_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH),
+/* 27 */ ACPI_OP ("NAnd", ARGP_BIT_NAND_OP, ARGI_BIT_NAND_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH),
+/* 28 */ ACPI_OP ("Or", ARGP_BIT_OR_OP, ARGI_BIT_OR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH),
+/* 29 */ ACPI_OP ("NOr", ARGP_BIT_NOR_OP, ARGI_BIT_NOR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH),
+/* 2A */ ACPI_OP ("XOr", ARGP_BIT_XOR_OP, ARGI_BIT_XOR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH),
+/* 2B */ ACPI_OP ("Not", ARGP_BIT_NOT_OP, ARGI_BIT_NOT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
+/* 2C */ ACPI_OP ("FindSetLeftBit", ARGP_FIND_SET_LEFT_BIT_OP, ARGI_FIND_SET_LEFT_BIT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
+/* 2D */ ACPI_OP ("FindSetRightBit", ARGP_FIND_SET_RIGHT_BIT_OP,ARGI_FIND_SET_RIGHT_BIT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
+/* 2E */ ACPI_OP ("DerefOf", ARGP_DEREF_OF_OP, ARGI_DEREF_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
+/* 2F */ ACPI_OP ("Notify", ARGP_NOTIFY_OP, ARGI_NOTIFY_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_0R, AML_FLAGS_EXEC_2A_0T_0R),
+/* 30 */ ACPI_OP ("SizeOf", ARGP_SIZE_OF_OP, ARGI_SIZE_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
+/* 31 */ ACPI_OP ("Index", ARGP_INDEX_OP, ARGI_INDEX_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R),
+/* 32 */ ACPI_OP ("Match", ARGP_MATCH_OP, ARGI_MATCH_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R),
+/* 33 */ ACPI_OP ("CreateDWordField", ARGP_CREATE_DWORD_FIELD_OP,ARGI_CREATE_DWORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
+/* 34 */ ACPI_OP ("CreateWordField", ARGP_CREATE_WORD_FIELD_OP, ARGI_CREATE_WORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
+/* 35 */ ACPI_OP ("CreateByteField", ARGP_CREATE_BYTE_FIELD_OP, ARGI_CREATE_BYTE_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
+/* 36 */ ACPI_OP ("CreateBitField", ARGP_CREATE_BIT_FIELD_OP, ARGI_CREATE_BIT_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
+/* 37 */ ACPI_OP ("ObjectType", ARGP_TYPE_OP, ARGI_TYPE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
+/* 38 */ ACPI_OP ("LAnd", ARGP_LAND_OP, ARGI_LAND_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL),
+/* 39 */ ACPI_OP ("LOr", ARGP_LOR_OP, ARGI_LOR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL),
+/* 3A */ ACPI_OP ("LNot", ARGP_LNOT_OP, ARGI_LNOT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
+/* 3B */ ACPI_OP ("LEqual", ARGP_LEQUAL_OP, ARGI_LEQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL),
+/* 3C */ ACPI_OP ("LGreater", ARGP_LGREATER_OP, ARGI_LGREATER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL),
+/* 3D */ ACPI_OP ("LLess", ARGP_LLESS_OP, ARGI_LLESS_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL),
+/* 3E */ ACPI_OP ("If", ARGP_IF_OP, ARGI_IF_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS),
+/* 3F */ ACPI_OP ("Else", ARGP_ELSE_OP, ARGI_ELSE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS),
+/* 40 */ ACPI_OP ("While", ARGP_WHILE_OP, ARGI_WHILE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS),
+/* 41 */ ACPI_OP ("Noop", ARGP_NOOP_OP, ARGI_NOOP_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
+/* 42 */ ACPI_OP ("Return", ARGP_RETURN_OP, ARGI_RETURN_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS),
+/* 43 */ ACPI_OP ("Break", ARGP_BREAK_OP, ARGI_BREAK_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
+/* 44 */ ACPI_OP ("BreakPoint", ARGP_BREAK_POINT_OP, ARGI_BREAK_POINT_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
+/* 45 */ ACPI_OP ("Ones", ARGP_ONES_OP, ARGI_ONES_OP, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0),
/* Prefixed opcodes (Two-byte opcodes with a prefix op) */
-/* 46 */ ACPI_OP ("Mutex", ARGP_MUTEX_OP, ARGI_MUTEX_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
-/* 47 */ ACPI_OP ("Event", ARGP_EVENT_OP, ARGI_EVENT_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED ),
-/* 48 */ ACPI_OP ("Cond_ref_of", ARGP_COND_REF_OF_OP, ARGI_COND_REF_OF_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
-/* 49 */ ACPI_OP ("Create_field", ARGP_CREATE_FIELD_OP, ARGI_CREATE_FIELD_OP, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_FIELD | AML_CREATE),
-/* 4_a */ ACPI_OP ("Load", ARGP_LOAD_OP, ARGI_LOAD_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_0R, AML_FLAGS_EXEC_1A_1T_0R),
-/* 4_b */ ACPI_OP ("Stall", ARGP_STALL_OP, ARGI_STALL_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
-/* 4_c */ ACPI_OP ("Sleep", ARGP_SLEEP_OP, ARGI_SLEEP_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
-/* 4_d */ ACPI_OP ("Acquire", ARGP_ACQUIRE_OP, ARGI_ACQUIRE_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R),
-/* 4_e */ ACPI_OP ("Signal", ARGP_SIGNAL_OP, ARGI_SIGNAL_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
-/* 4_f */ ACPI_OP ("Wait", ARGP_WAIT_OP, ARGI_WAIT_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R),
-/* 50 */ ACPI_OP ("Reset", ARGP_RESET_OP, ARGI_RESET_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
-/* 51 */ ACPI_OP ("Release", ARGP_RELEASE_OP, ARGI_RELEASE_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
-/* 52 */ ACPI_OP ("From_bCD", ARGP_FROM_BCD_OP, ARGI_FROM_BCD_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
-/* 53 */ ACPI_OP ("To_bCD", ARGP_TO_BCD_OP, ARGI_TO_BCD_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
-/* 54 */ ACPI_OP ("Unload", ARGP_UNLOAD_OP, ARGI_UNLOAD_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
-/* 55 */ ACPI_OP ("Revision", ARGP_REVISION_OP, ARGI_REVISION_OP, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0),
-/* 56 */ ACPI_OP ("Debug", ARGP_DEBUG_OP, ARGI_DEBUG_OP, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0),
-/* 57 */ ACPI_OP ("Fatal", ARGP_FATAL_OP, ARGI_FATAL_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_0T_0R, AML_FLAGS_EXEC_3A_0T_0R),
-/* 58 */ ACPI_OP ("Op_region", ARGP_REGION_OP, ARGI_REGION_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER),
-/* 59 */ ACPI_OP ("Field", ARGP_FIELD_OP, ARGI_FIELD_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD),
-/* 5_a */ ACPI_OP ("Device", ARGP_DEVICE_OP, ARGI_DEVICE_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
-/* 5_b */ ACPI_OP ("Processor", ARGP_PROCESSOR_OP, ARGI_PROCESSOR_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
-/* 5_c */ ACPI_OP ("Power_resource", ARGP_POWER_RES_OP, ARGI_POWER_RES_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
-/* 5_d */ ACPI_OP ("Thermal_zone", ARGP_THERMAL_ZONE_OP, ARGI_THERMAL_ZONE_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
-/* 5_e */ ACPI_OP ("Index_field", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD),
-/* 5_f */ ACPI_OP ("Bank_field", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD),
+/* 46 */ ACPI_OP ("Mutex", ARGP_MUTEX_OP, ARGI_MUTEX_OP, ACPI_TYPE_MUTEX, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
+/* 47 */ ACPI_OP ("Event", ARGP_EVENT_OP, ARGI_EVENT_OP, ACPI_TYPE_EVENT, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED ),
+/* 48 */ ACPI_OP ("CondRefOf", ARGP_COND_REF_OF_OP, ARGI_COND_REF_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
+/* 49 */ ACPI_OP ("CreateField", ARGP_CREATE_FIELD_OP, ARGI_CREATE_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_FIELD | AML_CREATE),
+/* 4A */ ACPI_OP ("Load", ARGP_LOAD_OP, ARGI_LOAD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_0R, AML_FLAGS_EXEC_1A_1T_0R),
+/* 4B */ ACPI_OP ("Stall", ARGP_STALL_OP, ARGI_STALL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
+/* 4C */ ACPI_OP ("Sleep", ARGP_SLEEP_OP, ARGI_SLEEP_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
+/* 4D */ ACPI_OP ("Acquire", ARGP_ACQUIRE_OP, ARGI_ACQUIRE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R),
+/* 4E */ ACPI_OP ("Signal", ARGP_SIGNAL_OP, ARGI_SIGNAL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
+/* 4F */ ACPI_OP ("Wait", ARGP_WAIT_OP, ARGI_WAIT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R),
+/* 50 */ ACPI_OP ("Reset", ARGP_RESET_OP, ARGI_RESET_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
+/* 51 */ ACPI_OP ("Release", ARGP_RELEASE_OP, ARGI_RELEASE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
+/* 52 */ ACPI_OP ("FromBCD", ARGP_FROM_BCD_OP, ARGI_FROM_BCD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
+/* 53 */ ACPI_OP ("ToBCD", ARGP_TO_BCD_OP, ARGI_TO_BCD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
+/* 54 */ ACPI_OP ("Unload", ARGP_UNLOAD_OP, ARGI_UNLOAD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
+/* 55 */ ACPI_OP ("Revision", ARGP_REVISION_OP, ARGI_REVISION_OP, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0),
+/* 56 */ ACPI_OP ("Debug", ARGP_DEBUG_OP, ARGI_DEBUG_OP, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0),
+/* 57 */ ACPI_OP ("Fatal", ARGP_FATAL_OP, ARGI_FATAL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_0T_0R, AML_FLAGS_EXEC_3A_0T_0R),
+/* 58 */ ACPI_OP ("OperationRegion", ARGP_REGION_OP, ARGI_REGION_OP, ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER),
+/* 59 */ ACPI_OP ("Field", ARGP_FIELD_OP, ARGI_FIELD_OP, INTERNAL_TYPE_FIELD_DEFN,AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD),
+/* 5A */ ACPI_OP ("Device", ARGP_DEVICE_OP, ARGI_DEVICE_OP, ACPI_TYPE_DEVICE, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
+/* 5B */ ACPI_OP ("Processor", ARGP_PROCESSOR_OP, ARGI_PROCESSOR_OP, ACPI_TYPE_PROCESSOR, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
+/* 5C */ ACPI_OP ("PowerResource", ARGP_POWER_RES_OP, ARGI_POWER_RES_OP, ACPI_TYPE_POWER, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
+/* 5D */ ACPI_OP ("ThermalZone", ARGP_THERMAL_ZONE_OP, ARGI_THERMAL_ZONE_OP, ACPI_TYPE_THERMAL, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
+/* 5E */ ACPI_OP ("IndexField", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP, INTERNAL_TYPE_INDEX_FIELD_DEFN,AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD),
+/* 5F */ ACPI_OP ("BankField", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP, INTERNAL_TYPE_BANK_FIELD_DEFN,AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD),
/* Internal opcodes that map to invalid AML opcodes */
-/* 60 */ ACPI_OP ("LNot_equal", ARGP_LNOTEQUAL_OP, ARGI_LNOTEQUAL_OP, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS),
-/* 61 */ ACPI_OP ("LLess_equal", ARGP_LLESSEQUAL_OP, ARGI_LLESSEQUAL_OP, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS),
-/* 62 */ ACPI_OP ("LGreater_equal", ARGP_LGREATEREQUAL_OP, ARGI_LGREATEREQUAL_OP, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS),
-/* 63 */ ACPI_OP ("[Name_path]", ARGP_NAMEPATH_OP, ARGI_NAMEPATH_OP, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_NSOBJECT | AML_NSNODE ),
-/* 64 */ ACPI_OP ("[Method_call]", ARGP_METHODCALL_OP, ARGI_METHODCALL_OP, AML_CLASS_METHOD_CALL, AML_TYPE_METHOD_CALL, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE),
-/* 65 */ ACPI_OP ("[Byte_list]", ARGP_BYTELIST_OP, ARGI_BYTELIST_OP, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0),
-/* 66 */ ACPI_OP ("[Reserved_field]", ARGP_RESERVEDFIELD_OP, ARGI_RESERVEDFIELD_OP, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0),
-/* 67 */ ACPI_OP ("[Named_field]", ARGP_NAMEDFIELD_OP, ARGI_NAMEDFIELD_OP, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED ),
-/* 68 */ ACPI_OP ("[Access_field]", ARGP_ACCESSFIELD_OP, ARGI_ACCESSFIELD_OP, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0),
-/* 69 */ ACPI_OP ("[Static_string", ARGP_STATICSTRING_OP, ARGI_STATICSTRING_OP, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0),
-/* 6_a */ ACPI_OP ("[Return Value]", ARG_NONE, ARG_NONE, AML_CLASS_RETURN_VALUE, AML_TYPE_RETURN, AML_HAS_ARGS | AML_HAS_RETVAL),
-/* 6_b */ ACPI_OP ("UNKNOWN_OP!", ARG_NONE, ARG_NONE, AML_CLASS_UNKNOWN, AML_TYPE_BOGUS, AML_HAS_ARGS),
-/* 6_c */ ACPI_OP ("ASCII_ONLY!", ARG_NONE, ARG_NONE, AML_CLASS_ASCII, AML_TYPE_BOGUS, AML_HAS_ARGS),
-/* 6_d */ ACPI_OP ("PREFIX_ONLY!", ARG_NONE, ARG_NONE, AML_CLASS_PREFIX, AML_TYPE_BOGUS, AML_HAS_ARGS),
+/* 60 */ ACPI_OP ("LNotEqual", ARGP_LNOTEQUAL_OP, ARGI_LNOTEQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS),
+/* 61 */ ACPI_OP ("LLessEqual", ARGP_LLESSEQUAL_OP, ARGI_LLESSEQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS),
+/* 62 */ ACPI_OP ("LGreaterEqual", ARGP_LGREATEREQUAL_OP, ARGI_LGREATEREQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS),
+/* 63 */ ACPI_OP ("[NamePath]", ARGP_NAMEPATH_OP, ARGI_NAMEPATH_OP, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_NSOBJECT | AML_NSNODE ),
+/* 64 */ ACPI_OP ("[MethodCall]", ARGP_METHODCALL_OP, ARGI_METHODCALL_OP, ACPI_TYPE_METHOD, AML_CLASS_METHOD_CALL, AML_TYPE_METHOD_CALL, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE),
+/* 65 */ ACPI_OP ("[ByteList]", ARGP_BYTELIST_OP, ARGI_BYTELIST_OP, ACPI_TYPE_ANY, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0),
+/* 66 */ ACPI_OP ("[ReservedField]", ARGP_RESERVEDFIELD_OP, ARGI_RESERVEDFIELD_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0),
+/* 67 */ ACPI_OP ("[NamedField]", ARGP_NAMEDFIELD_OP, ARGI_NAMEDFIELD_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED ),
+/* 68 */ ACPI_OP ("[AccessField]", ARGP_ACCESSFIELD_OP, ARGI_ACCESSFIELD_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0),
+/* 69 */ ACPI_OP ("[StaticString", ARGP_STATICSTRING_OP, ARGI_STATICSTRING_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0),
+/* 6A */ ACPI_OP ("[Return Value]", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, AML_CLASS_RETURN_VALUE, AML_TYPE_RETURN, AML_HAS_ARGS | AML_HAS_RETVAL),
+/* 6B */ ACPI_OP ("UNKNOWN_OP!", ARG_NONE, ARG_NONE, INTERNAL_TYPE_INVALID, AML_CLASS_UNKNOWN, AML_TYPE_BOGUS, AML_HAS_ARGS),
+/* 6C */ ACPI_OP ("ASCII_ONLY!", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, AML_CLASS_ASCII, AML_TYPE_BOGUS, AML_HAS_ARGS),
+/* 6D */ ACPI_OP ("PREFIX_ONLY!", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, AML_CLASS_PREFIX, AML_TYPE_BOGUS, AML_HAS_ARGS),
/* ACPI 2.0 opcodes */
-/* 6_e */ ACPI_OP ("Qword_const", ARGP_QWORD_OP, ARGI_QWORD_OP, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0),
-/* 6_f */ ACPI_OP ("Var_package", ARGP_VAR_PACKAGE_OP, ARGI_VAR_PACKAGE_OP, AML_CLASS_ARGUMENT, AML_TYPE_DATA_TERM, AML_HAS_ARGS | AML_DEFER),
-/* 70 */ ACPI_OP ("Concat_res", ARGP_CONCAT_RES_OP, ARGI_CONCAT_RES_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R),
-/* 71 */ ACPI_OP ("Mod", ARGP_MOD_OP, ARGI_MOD_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R),
-/* 72 */ ACPI_OP ("Create_qWord_field", ARGP_CREATE_QWORD_FIELD_OP,ARGI_CREATE_QWORD_FIELD_OP, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
-/* 73 */ ACPI_OP ("To_buffer", ARGP_TO_BUFFER_OP, ARGI_TO_BUFFER_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
-/* 74 */ ACPI_OP ("To_decimal_string", ARGP_TO_DEC_STR_OP, ARGI_TO_DEC_STR_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
-/* 75 */ ACPI_OP ("To_hex_string", ARGP_TO_HEX_STR_OP, ARGI_TO_HEX_STR_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
-/* 76 */ ACPI_OP ("To_integer", ARGP_TO_INTEGER_OP, ARGI_TO_INTEGER_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
-/* 77 */ ACPI_OP ("To_string", ARGP_TO_STRING_OP, ARGI_TO_STRING_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R),
-/* 78 */ ACPI_OP ("Copy_object", ARGP_COPY_OP, ARGI_COPY_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
-/* 79 */ ACPI_OP ("Mid", ARGP_MID_OP, ARGI_MID_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_1T_1R, AML_FLAGS_EXEC_3A_1T_1R),
-/* 7_a */ ACPI_OP ("Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
-/* 7_b */ ACPI_OP ("Load_table", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R),
-/* 7_c */ ACPI_OP ("Data_op_region", ARGP_DATA_REGION_OP, ARGI_DATA_REGION_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
-
+/* 6E */ ACPI_OP ("QwordConst", ARGP_QWORD_OP, ARGI_QWORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0),
+/* 6F */ ACPI_OP ("Package /*Var*/", ARGP_VAR_PACKAGE_OP, ARGI_VAR_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_ARGUMENT, AML_TYPE_DATA_TERM, AML_HAS_ARGS | AML_DEFER),
+/* 70 */ ACPI_OP ("ConcatenateResTemplate", ARGP_CONCAT_RES_OP, ARGI_CONCAT_RES_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R),
+/* 71 */ ACPI_OP ("Mod", ARGP_MOD_OP, ARGI_MOD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R),
+/* 72 */ ACPI_OP ("CreateQWordField", ARGP_CREATE_QWORD_FIELD_OP,ARGI_CREATE_QWORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
+/* 73 */ ACPI_OP ("ToBuffer", ARGP_TO_BUFFER_OP, ARGI_TO_BUFFER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
+/* 74 */ ACPI_OP ("ToDecimalString", ARGP_TO_DEC_STR_OP, ARGI_TO_DEC_STR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
+/* 75 */ ACPI_OP ("ToHexString", ARGP_TO_HEX_STR_OP, ARGI_TO_HEX_STR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
+/* 76 */ ACPI_OP ("ToInteger", ARGP_TO_INTEGER_OP, ARGI_TO_INTEGER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
+/* 77 */ ACPI_OP ("ToString", ARGP_TO_STRING_OP, ARGI_TO_STRING_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R),
+/* 78 */ ACPI_OP ("CopyObject", ARGP_COPY_OP, ARGI_COPY_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
+/* 79 */ ACPI_OP ("Mid", ARGP_MID_OP, ARGI_MID_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_1T_1R, AML_FLAGS_EXEC_3A_1T_1R),
+/* 7A */ ACPI_OP ("Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
+/* 7B */ ACPI_OP ("LoadTable", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R),
+/* 7C */ ACPI_OP ("DataTableRegion", ARGP_DATA_REGION_OP, ARGI_DATA_REGION_OP, ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
+
+/*! [End] no source code translation !*/
};
/*
* index into the table above
*/
-static const u8 aml_short_op_info_index[256] =
+static const u8 acpi_gbl_short_op_index[256] =
{
/* 0 1 2 3 4 5 6 7 */
/* 8 9 A B C D E F */
};
-static const u8 aml_long_op_info_index[NUM_EXTENDED_OPCODE] =
+static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] =
{
/* 0 1 2 3 4 5 6 7 */
/* 8 9 A B C D E F */
acpi_ps_get_opcode_info (
u16 opcode)
{
- const acpi_opcode_info *op_info;
- u8 upper_opcode;
- u8 lower_opcode;
-
-
- PROC_NAME ("Ps_get_opcode_info");
-
-
- /* Split the 16-bit opcode into separate bytes */
-
- upper_opcode = (u8) (opcode >> 8);
- lower_opcode = (u8) opcode;
-
- /* Default is "unknown opcode" */
-
- op_info = &aml_op_info [_UNK];
+ ACPI_FUNCTION_NAME ("Ps_get_opcode_info");
/*
* Detect normal 8-bit opcode or extended 16-bit opcode
*/
-
- switch (upper_opcode) {
+ switch ((u8) (opcode >> 8)) {
case 0:
/* Simple (8-bit) opcode: 0-255, can't index beyond table */
- op_info = &aml_op_info [aml_short_op_info_index [lower_opcode]];
- break;
-
+ return (&acpi_gbl_aml_op_info [acpi_gbl_short_op_index [(u8) opcode]]);
case AML_EXTOP:
/* Extended (16-bit, prefix+opcode) opcode */
- if (lower_opcode <= MAX_EXTENDED_OPCODE) {
- op_info = &aml_op_info [aml_long_op_info_index [lower_opcode]];
+ if (((u8) opcode) <= MAX_EXTENDED_OPCODE) {
+ return (&acpi_gbl_aml_op_info [acpi_gbl_long_op_index [(u8) opcode]]);
}
- break;
+ /* Else fall through to error case below */
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown extended opcode=%X\n", opcode));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown extended opcode [%X]\n", opcode));
break;
}
- /* Get the Op info pointer for this opcode */
+ /* Default is "unknown opcode" */
- return (op_info);
+ return (&acpi_gbl_aml_op_info [_UNK]);
}
acpi_ps_get_opcode_name (
u16 opcode)
{
+#ifdef ACPI_DEBUG
+
const acpi_opcode_info *op;
/* Always guaranteed to return a valid pointer */
-#ifdef ACPI_DEBUG
return (op->name);
+
#else
return ("AE_NOT_CONFIGURED");
+
#endif
}
/******************************************************************************
*
* Module Name: psparse - Parser top level AML parse routines
- * $Revision: 104 $
+ * $Revision: 119 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acinterp.h"
#define _COMPONENT ACPI_PARSER
- MODULE_NAME ("psparse")
+ ACPI_MODULE_NAME ("psparse")
u32 acpi_gbl_depth = 0;
*
******************************************************************************/
-static u32
+u32
acpi_ps_get_opcode_size (
u32 opcode)
{
aml = parser_state->aml;
- opcode = (u16) GET8 (aml);
+ opcode = (u16) ACPI_GET8 (aml);
- aml++;
-
- /*
- * Original code special cased LNOTEQUAL, LLESSEQUAL, LGREATEREQUAL.
- * These opcodes are no longer recognized. Instead, they are broken into
- * two opcodes.
- *
- *
- * if (Opcode == AML_EXTOP
- * || (Opcode == AML_LNOT
- * && (GET8 (Aml) == AML_LEQUAL
- * || GET8 (Aml) == AML_LGREATER
- * || GET8 (Aml) == AML_LLESS)))
- *
- * extended Opcode, !=, <=, or >=
- */
if (opcode == AML_EXTOP) {
/* Extended opcode */
- opcode = (u16) ((opcode << 8) | GET8 (aml));
+ aml++;
+ opcode = (u16) ((opcode << 8) | ACPI_GET8 (aml));
}
-
return (opcode);
}
*
******************************************************************************/
-static u8
+u8
acpi_ps_complete_this_op (
acpi_walk_state *walk_state,
acpi_parse_object *op)
acpi_parse_object *replacement_op = NULL;
- FUNCTION_TRACE_PTR ("Ps_complete_this_op", op);
+ ACPI_FUNCTION_TRACE_PTR ("Ps_complete_this_op", op);
+
+ /* Check for null Op, can happen if AML code is corrupt */
+
+ if (!op) {
+ return_VALUE (TRUE);
+ }
/* Delete this op and the subtree below it if asked to */
parent_info = acpi_ps_get_opcode_info (op->parent->opcode);
switch (parent_info->class) {
- case AML_CLASS_CONTROL: /* IF, ELSE, WHILE only */
+ case AML_CLASS_CONTROL:
break;
- case AML_CLASS_NAMED_OBJECT: /* Scope, method, etc. */
case AML_CLASS_CREATE:
+ /*
+ * These opcodes contain Term_arg operands. The current
+ * op must be replace by a placeholder return op
+ */
+ replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP);
+ if (!replacement_op) {
+ return_VALUE (FALSE);
+ }
+ break;
+
+ case AML_CLASS_NAMED_OBJECT:
+
/*
* These opcodes contain Term_arg operands. The current
* op must be replace by a placeholder return op
*/
if ((op->parent->opcode == AML_REGION_OP) ||
- (op->parent->opcode == AML_CREATE_FIELD_OP) ||
- (op->parent->opcode == AML_CREATE_BIT_FIELD_OP) ||
- (op->parent->opcode == AML_CREATE_BYTE_FIELD_OP) ||
- (op->parent->opcode == AML_CREATE_WORD_FIELD_OP) ||
- (op->parent->opcode == AML_CREATE_DWORD_FIELD_OP) ||
- (op->parent->opcode == AML_CREATE_QWORD_FIELD_OP)) {
+ (op->parent->opcode == AML_DATA_REGION_OP)) {
replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP);
if (!replacement_op) {
return_VALUE (FALSE);
}
}
-
break;
default:
prev = next;
}
-
}
/* Now we can actually delete the subtree rooted at op */
*
******************************************************************************/
-static acpi_status
+acpi_status
acpi_ps_next_parse_state (
acpi_walk_state *walk_state,
acpi_parse_object *op,
{
acpi_parse_state *parser_state = &walk_state->parser_state;
acpi_status status = AE_CTRL_PENDING;
- u8 *start;
- u32 package_length;
- FUNCTION_TRACE_PTR ("Ps_next_parse_state", op);
+ ACPI_FUNCTION_TRACE_PTR ("Ps_next_parse_state", op);
switch (callback_status) {
break;
- case AE_CTRL_PENDING:
+ case AE_CTRL_BREAK:
- /*
- * Predicate of a WHILE was true and the loop just completed an
- * execution. Go back to the start of the loop and reevaluate the
- * predicate.
- */
+ parser_state->aml = walk_state->aml_last_while;
+ walk_state->control_state->common.value = FALSE;
+ status = AE_CTRL_BREAK;
+ break;
+
+ case AE_CTRL_CONTINUE:
- /* TBD: How to handle a break within a while. */
- /* This code attempts it */
+
+ parser_state->aml = walk_state->aml_last_while;
+ status = AE_CTRL_CONTINUE;
+ break;
+
+ case AE_CTRL_PENDING:
parser_state->aml = walk_state->aml_last_while;
break;
case AE_CTRL_TRUE:
+
/*
* Predicate of an IF was true, and we are at the matching ELSE.
* Just close out this package
- *
- * Note: Parser_state->Aml is modified by the package length procedure
- * TBD: [Investigate] perhaps it shouldn't, too much trouble
*/
- start = parser_state->aml;
- package_length = acpi_ps_get_next_package_length (parser_state);
- parser_state->aml = start + package_length;
+ parser_state->aml = acpi_ps_get_next_package_end (parser_state);
break;
u8 *aml_op_start;
- FUNCTION_TRACE_PTR ("Ps_parse_loop", walk_state);
+ ACPI_FUNCTION_TRACE_PTR ("Ps_parse_loop", walk_state);
parser_state = &walk_state->parser_state;
walk_state->arg_types = 0;
#ifndef PARSER_ONLY
- if (walk_state->walk_type & WALK_METHOD_RESTART) {
+ if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) {
/* We are restarting a preempted control method */
if (acpi_ps_has_completed_scope (parser_state)) {
(parser_state->scope->parse_scope.op->opcode == AML_WHILE_OP)) &&
(walk_state->control_state) &&
(walk_state->control_state->common.state ==
- CONTROL_PREDICATE_EXECUTING)) {
+ ACPI_CONTROL_PREDICATE_EXECUTING)) {
/*
* A predicate was just completed, get the value of the
* predicate and branch based on that value
*/
walk_state->op = NULL;
- status = acpi_ds_get_predicate_value (walk_state, TRUE);
+ status = acpi_ds_get_predicate_value (walk_state, ACPI_TO_POINTER (TRUE));
if (ACPI_FAILURE (status) &&
((status & AE_CODE_MASK) != AE_CODE_CONTROL)) {
if (status == AE_AML_NO_RETURN_VALUE) {
"Found unknown opcode %X at AML offset %X, ignoring\n",
walk_state->opcode, walk_state->aml_offset));
- DUMP_BUFFER (parser_state->aml, 128);
+ ACPI_DUMP_BUFFER (parser_state->aml, 128);
/* Assume one-byte bad opcode */
walk_state->op = NULL;
status = walk_state->descending_callback (walk_state, &op);
-
- /* TBD: check status here? */
-
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "During name lookup/catalog, %s\n",
acpi_format_exception (status)));
if (op == NULL) {
continue;
}
+
status = acpi_ps_next_parse_state (walk_state, op, status);
if (status == AE_CTRL_PENDING) {
status = AE_OK;
acpi_ps_append_arg (op, pre_op.value.arg);
acpi_gbl_depth++;
-
if (op->opcode == AML_REGION_OP) {
/*
* Defer final parsing of an Operation_region body,
}
}
-
else {
/* Not a named opcode, just allocate Op and append to parent */
return_ACPI_STATUS (AE_NO_MEMORY);
}
-
if (walk_state->op_info->flags & AML_CREATE) {
/*
* Backup to beginning of Create_xXXfield declaration
* Find the object. This will either insert the object into
* the namespace or simply look it up
*/
- walk_state->op = op;
+ walk_state->op = op;
status = walk_state->descending_callback (walk_state, &op);
status = acpi_ps_next_parse_state (walk_state, op, status);
if (walk_state->op_info) {
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
- "Op=%p Opcode=%4.4X Aml %p Oft=%5.5X\n",
- op, op->opcode, parser_state->aml, op->aml_offset));
+ "Opcode %4.4X [%s] Op %p Aml %p Aml_offset %5.5X\n",
+ op->opcode, walk_state->op_info->name, op, parser_state->aml, op->aml_offset));
}
}
walk_state->arg_count = 0;
-
if (walk_state->arg_types) /* Are there any arguments that must be processed? */ {
/* get arguments */
INCREMENT_ARG_LIST (walk_state->arg_types);
}
-
/* For a method, save the length and address of the body */
if (op->opcode == AML_METHOD_OP) {
* because we don't have enough info in the first pass
* to parse them correctly.
*/
- ((acpi_parse2_object * ) op)->data = parser_state->aml;
- ((acpi_parse2_object * ) op)->length = (u32) (parser_state->pkg_end -
- parser_state->aml);
+ ((acpi_parse2_object * ) op)->data = parser_state->aml;
+ ((acpi_parse2_object * ) op)->length = (u32) (parser_state->pkg_end -
+ parser_state->aml);
/*
* Skip body of method. For Op_regions, we must continue
* package (We don't know where the end is).
*/
parser_state->aml = parser_state->pkg_end;
- walk_state->arg_count = 0;
+ walk_state->arg_count = 0;
+ }
+ else if (op->opcode == AML_WHILE_OP) {
+ if (walk_state->control_state) {
+ walk_state->control_state->control.package_end = parser_state->pkg_end;
+ }
}
-
break;
}
}
- /*
- * Zero Arg_count means that all arguments for this op have been processed
- */
- if (!walk_state->arg_count) {
- /* completed Op, prepare for next */
+ /* Check for arguments that need to be processed */
- walk_state->op_info = acpi_ps_get_opcode_info (op->opcode);
- if (walk_state->op_info->flags & AML_NAMED) {
- if (acpi_gbl_depth) {
- acpi_gbl_depth--;
- }
+ if (walk_state->arg_count) {
+ /* There are arguments (complex ones), push Op and prepare for argument */
- if (op->opcode == AML_REGION_OP) {
- /*
- * Skip parsing of control method or opregion body,
- * because we don't have enough info in the first pass
- * to parse them correctly.
- *
- * Completed parsing an Op_region declaration, we now
- * know the length.
- */
- ((acpi_parse2_object * ) op)->length = (u32) (parser_state->aml -
- ((acpi_parse2_object * ) op)->data);
- }
+ acpi_ps_push_scope (parser_state, op, walk_state->arg_types, walk_state->arg_count);
+ op = NULL;
+ continue;
+ }
+
+
+ /* All arguments have been processed -- Op is complete, prepare for next */
+
+ walk_state->op_info = acpi_ps_get_opcode_info (op->opcode);
+ if (walk_state->op_info->flags & AML_NAMED) {
+ if (acpi_gbl_depth) {
+ acpi_gbl_depth--;
}
- if (walk_state->op_info->flags & AML_CREATE) {
+ if (op->opcode == AML_REGION_OP) {
/*
- * Backup to beginning of Create_xXXfield declaration (1 for
- * Opcode)
+ * Skip parsing of control method or opregion body,
+ * because we don't have enough info in the first pass
+ * to parse them correctly.
*
- * Body_length is unknown until we parse the body
+ * Completed parsing an Op_region declaration, we now
+ * know the length.
*/
((acpi_parse2_object * ) op)->length = (u32) (parser_state->aml -
((acpi_parse2_object * ) op)->data);
}
+ }
- /* This op complete, notify the dispatcher */
+ if (walk_state->op_info->flags & AML_CREATE) {
+ /*
+ * Backup to beginning of Create_xXXfield declaration (1 for
+ * Opcode)
+ *
+ * Body_length is unknown until we parse the body
+ */
+ ((acpi_parse2_object * ) op)->length = (u32) (parser_state->aml -
+ ((acpi_parse2_object * ) op)->data);
+ }
- if (walk_state->ascending_callback != NULL) {
- walk_state->op = op;
- walk_state->opcode = op->opcode;
+ /* This op complete, notify the dispatcher */
- status = walk_state->ascending_callback (walk_state);
- status = acpi_ps_next_parse_state (walk_state, op, status);
- if (status == AE_CTRL_PENDING) {
- status = AE_OK;
- goto close_this_op;
- }
+ if (walk_state->ascending_callback != NULL) {
+ walk_state->op = op;
+ walk_state->opcode = op->opcode;
+
+ status = walk_state->ascending_callback (walk_state);
+ status = acpi_ps_next_parse_state (walk_state, op, status);
+ if (status == AE_CTRL_PENDING) {
+ status = AE_OK;
+ goto close_this_op;
}
+ }
close_this_op:
+ /*
+ * Finished one argument of the containing scope
+ */
+ parser_state->scope->parse_scope.arg_count--;
+
+ /* Close this Op (may result in parse subtree deletion) */
+
+ if (acpi_ps_complete_this_op (walk_state, op)) {
+ op = NULL;
+ }
+
+ switch (status) {
+ case AE_OK:
+ break;
+
+
+ case AE_CTRL_TRANSFER:
/*
- * Finished one argument of the containing scope
+ * We are about to transfer to a called method.
*/
- parser_state->scope->parse_scope.arg_count--;
+ walk_state->prev_op = op;
+ walk_state->prev_arg_types = walk_state->arg_types;
+ return_ACPI_STATUS (status);
- /* Close this Op (may result in parse subtree deletion) */
- if (acpi_ps_complete_this_op (walk_state, op)) {
- op = NULL;
- }
+ case AE_CTRL_END:
+ acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types, &walk_state->arg_count);
- switch (status) {
- case AE_OK:
- break;
+ walk_state->op = op;
+ walk_state->op_info = acpi_ps_get_opcode_info (op->opcode);
+ walk_state->opcode = op->opcode;
+ status = walk_state->ascending_callback (walk_state);
+ status = acpi_ps_next_parse_state (walk_state, op, status);
- case AE_CTRL_TRANSFER:
+ acpi_ps_complete_this_op (walk_state, op);
+ op = NULL;
+ status = AE_OK;
+ break;
- /*
- * We are about to transfer to a called method.
- */
- walk_state->prev_op = op;
- walk_state->prev_arg_types = walk_state->arg_types;
- return_ACPI_STATUS (status);
- break;
+ case AE_CTRL_BREAK:
+ case AE_CTRL_CONTINUE:
- case AE_CTRL_END:
+ /* Pop off scopes until we find the While */
+ while (!op || (op->opcode != AML_WHILE_OP)) {
acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types, &walk_state->arg_count);
+ }
- walk_state->op = op;
- walk_state->op_info = acpi_ps_get_opcode_info (op->opcode);
- walk_state->opcode = op->opcode;
+ /* Close this iteration of the While loop */
- status = walk_state->ascending_callback (walk_state);
- status = acpi_ps_next_parse_state (walk_state, op, status);
+ walk_state->op = op;
+ walk_state->op_info = acpi_ps_get_opcode_info (op->opcode);
+ walk_state->opcode = op->opcode;
- acpi_ps_complete_this_op (walk_state, op);
- op = NULL;
- status = AE_OK;
- break;
+ status = walk_state->ascending_callback (walk_state);
+ status = acpi_ps_next_parse_state (walk_state, op, status);
+ acpi_ps_complete_this_op (walk_state, op);
+ op = NULL;
- case AE_CTRL_TERMINATE:
+ status = AE_OK;
+ break;
- status = AE_OK;
- /* Clean up */
- do {
- if (op) {
- acpi_ps_complete_this_op (walk_state, op);
- }
+ case AE_CTRL_TERMINATE:
- acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types, &walk_state->arg_count);
- } while (op);
+ status = AE_OK;
- return_ACPI_STATUS (status);
- break;
+ /* Clean up */
+ do {
+ if (op) {
+ acpi_ps_complete_this_op (walk_state, op);
+ }
+ acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types, &walk_state->arg_count);
+ } while (op);
- default: /* All other non-AE_OK status */
+ return_ACPI_STATUS (status);
- if (op == NULL) {
- acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types, &walk_state->arg_count);
- }
- walk_state->prev_op = op;
- walk_state->prev_arg_types = walk_state->arg_types;
- /*
- * TEMP:
- */
+ default: /* All other non-AE_OK status */
- return_ACPI_STATUS (status);
- break;
- }
+ do {
+ if (op) {
+ acpi_ps_complete_this_op (walk_state, op);
+ }
+ acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types, &walk_state->arg_count);
- /* This scope complete? */
+ } while (op);
- if (acpi_ps_has_completed_scope (parser_state)) {
- acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types, &walk_state->arg_count);
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", op));
- }
- else {
- op = NULL;
+ /*
+ * TBD: Cleanup parse ops on error
+ */
+#if 0
+ if (op == NULL) {
+ acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types, &walk_state->arg_count);
}
-
+#endif
+ walk_state->prev_op = op;
+ walk_state->prev_arg_types = walk_state->arg_types;
+ return_ACPI_STATUS (status);
}
+ /* This scope complete? */
- /* Arg_count is non-zero */
-
+ if (acpi_ps_has_completed_scope (parser_state)) {
+ acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types, &walk_state->arg_count);
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", op));
+ }
else {
- /* complex argument, push Op and prepare for argument */
-
- acpi_ps_push_scope (parser_state, op, walk_state->arg_types, walk_state->arg_count);
op = NULL;
}
acpi_walk_state *walk_state)
{
acpi_status status;
- acpi_walk_list walk_list;
- acpi_walk_list *prev_walk_list = acpi_gbl_current_walk_list;
+ ACPI_THREAD_STATE *thread;
+ ACPI_THREAD_STATE *prev_walk_list = acpi_gbl_current_walk_list;
acpi_walk_state *previous_walk_state;
- FUNCTION_TRACE ("Ps_parse_aml");
+ ACPI_FUNCTION_TRACE ("Ps_parse_aml");
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Entered with Walk_state=%p Aml=%p size=%X\n",
walk_state, walk_state->parser_state.aml, walk_state->parser_state.aml_size));
- /* Create and initialize a new walk list */
+ /* Create and initialize a new thread state */
- walk_list.walk_state = NULL;
- walk_list.acquired_mutex_list.prev = NULL;
- walk_list.acquired_mutex_list.next = NULL;
-
- walk_state->walk_list = &walk_list;
- acpi_ds_push_walk_state (walk_state, &walk_list);
+ thread = acpi_ut_create_thread_state ();
+ if (!thread) {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+ walk_state->thread = thread;
+ acpi_ds_push_walk_state (walk_state, thread);
- /* TBD: [Restructure] TEMP until we pass Walk_state to the interpreter
+ /*
+ * This global allows the AML debugger to get a handle to the currently
+ * executing control method.
*/
- acpi_gbl_current_walk_list = &walk_list;
+ acpi_gbl_current_walk_list = thread;
/*
* Execute the walk loop as long as there is a valid Walk State. This
* A method call was detected.
* Transfer control to the called control method
*/
- status = acpi_ds_call_control_method (&walk_list, walk_state, NULL);
+ status = acpi_ds_call_control_method (thread, walk_state, NULL);
/*
* If the transfer to the new method method call worked, a new walk
* state was created -- get it
*/
- walk_state = acpi_ds_get_current_walk_state (&walk_list);
+ walk_state = acpi_ds_get_current_walk_state (thread);
continue;
}
/* We are done with this walk, move on to the parent if any */
- walk_state = acpi_ds_pop_walk_state (&walk_list);
+ walk_state = acpi_ds_pop_walk_state (thread);
/* Reset the current scope to the beginning of scope stack */
/* Check if we have restarted a preempted walk */
- walk_state = acpi_ds_get_current_walk_state (&walk_list);
+ walk_state = acpi_ds_get_current_walk_state (thread);
if (walk_state) {
if (ACPI_SUCCESS (status)) {
- /* There is another walk state, restart it */
-
/*
- * If the method returned value is not used by the parent,
+ * There is another walk state, restart it.
+ * If the method return value is not used by the parent,
* The object is deleted
*/
acpi_ds_restart_control_method (walk_state, previous_walk_state->return_desc);
- walk_state->walk_type |= WALK_METHOD_RESTART;
+ walk_state->walk_type |= ACPI_WALK_METHOD_RESTART;
+ }
+ else {
+ /* On error, delete any return object */
+
+ acpi_ut_remove_reference (previous_walk_state->return_desc);
+
+ ACPI_REPORT_ERROR (("Method execution failed, %s\n", acpi_format_exception (status)));
+ ACPI_DUMP_PATHNAME (walk_state->method_node, "Method pathname: ",
+ ACPI_LV_ERROR, _COMPONENT);
}
}
acpi_ds_delete_walk_state (previous_walk_state);
}
-
/* Normal exit */
- acpi_ex_release_all_mutexes ((acpi_operand_object *) &walk_list.acquired_mutex_list);
+ acpi_ex_release_all_mutexes (thread);
+ acpi_ut_delete_generic_state ((acpi_generic_state *) thread);
acpi_gbl_current_walk_list = prev_walk_list;
return_ACPI_STATUS (status);
}
/******************************************************************************
*
* Module Name: psscope - Parser scope stack management routines
- * $Revision: 30 $
+ * $Revision: 35 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acparser.h"
#define _COMPONENT ACPI_PARSER
- MODULE_NAME ("psscope")
+ ACPI_MODULE_NAME ("psscope")
/*******************************************************************************
acpi_generic_state *scope;
- FUNCTION_TRACE_PTR ("Ps_init_scope", root_op);
+ ACPI_FUNCTION_TRACE_PTR ("Ps_init_scope", root_op);
scope = acpi_ut_create_generic_state ();
acpi_generic_state *scope;
- FUNCTION_TRACE_PTR ("Ps_push_scope", op);
+ ACPI_FUNCTION_TRACE_PTR ("Ps_push_scope", op);
scope = acpi_ut_create_generic_state ();
if (!scope) {
- return (AE_NO_MEMORY);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
else {
/* single argument */
- scope->parse_scope.arg_end = ACPI_MAX_AML;
+ scope->parse_scope.arg_end = ACPI_TO_POINTER (ACPI_MAX_PTR);
}
return_ACPI_STATUS (AE_OK);
acpi_generic_state *scope = parser_state->scope;
- FUNCTION_TRACE ("Ps_pop_scope");
+ ACPI_FUNCTION_TRACE ("Ps_pop_scope");
/*
{
acpi_generic_state *scope;
- FUNCTION_TRACE_PTR ("Ps_cleanup_scope", parser_state);
+ ACPI_FUNCTION_TRACE_PTR ("Ps_cleanup_scope", parser_state);
if (!parser_state) {
/******************************************************************************
*
* Module Name: pstree - Parser op tree manipulation/traversal/search
- * $Revision: 35 $
+ * $Revision: 37 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "amlcode.h"
#define _COMPONENT ACPI_PARSER
- MODULE_NAME ("pstree")
+ ACPI_MODULE_NAME ("pstree")
/*******************************************************************************
const acpi_opcode_info *op_info;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/* Get the info structure for this opcode */
const acpi_opcode_info *op_info;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
if (!op) {
if (op_info->class == AML_CLASS_UNKNOWN) {
/* Invalid opcode */
- REPORT_ERROR (("Ps_append_arg: Invalid AML Opcode: 0x%2.2X\n", op->opcode));
+ ACPI_REPORT_ERROR (("Ps_append_arg: Invalid AML Opcode: 0x%2.2X\n", op->opcode));
return;
}
acpi_parse_object *child = NULL;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
switch (op->opcode) {
acpi_parse_object *arg;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
if (!op) {
/******************************************************************************
*
* Module Name: psutils - Parser miscellaneous utilities (Parser only)
- * $Revision: 44 $
+ * $Revision: 49 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "amlcode.h"
#define _COMPONENT ACPI_PARSER
- MODULE_NAME ("psutils")
-
-
-#define PARSEOP_GENERIC 0x01
-#define PARSEOP_NAMED 0x02
-#define PARSEOP_DEFERRED 0x04
-#define PARSEOP_BYTELIST 0x08
-#define PARSEOP_IN_CACHE 0x80
+ ACPI_MODULE_NAME ("psutils")
/*******************************************************************************
acpi_parse_object *op,
u16 opcode)
{
- const acpi_opcode_info *aml_op;
-
-
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
op->data_type = ACPI_DESC_TYPE_PARSER;
op->opcode = opcode;
- aml_op = acpi_ps_get_opcode_info (opcode);
-
- DEBUG_ONLY_MEMBERS (STRNCPY (op->op_name, aml_op->name,
- sizeof (op->op_name)));
+ ACPI_DEBUG_ONLY_MEMBERS (ACPI_STRNCPY (op->op_name,
+ (acpi_ps_get_opcode_info (opcode))->name, sizeof (op->op_name)));
}
const acpi_opcode_info *op_info;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
op_info = acpi_ps_get_opcode_info (opcode);
if (op_info->flags & AML_DEFER) {
size = sizeof (acpi_parse2_object);
- flags = PARSEOP_DEFERRED;
+ flags = ACPI_PARSEOP_DEFERRED;
}
else if (op_info->flags & AML_NAMED) {
size = sizeof (acpi_parse2_object);
- flags = PARSEOP_NAMED;
+ flags = ACPI_PARSEOP_NAMED;
}
else if (opcode == AML_INT_BYTELIST_OP) {
size = sizeof (acpi_parse2_object);
- flags = PARSEOP_BYTELIST;
+ flags = ACPI_PARSEOP_BYTELIST;
}
else {
size = sizeof (acpi_parse_object);
- flags = PARSEOP_GENERIC;
+ flags = ACPI_PARSEOP_GENERIC;
}
acpi_ps_free_op (
acpi_parse_object *op)
{
- PROC_NAME ("Ps_free_op");
+ ACPI_FUNCTION_NAME ("Ps_free_op");
if (op->opcode == AML_INT_RETURN_VALUE_OP) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Free retval op: %p\n", op));
}
- if (op->flags == PARSEOP_GENERIC) {
+ if (op->flags == ACPI_PARSEOP_GENERIC) {
acpi_ut_release_to_cache (ACPI_MEM_LIST_PSNODE, op);
}
acpi_ps_delete_parse_cache (
void)
{
- FUNCTION_TRACE ("Ps_delete_parse_cache");
+ ACPI_FUNCTION_TRACE ("Ps_delete_parse_cache");
acpi_ut_delete_generic_cache (ACPI_MEM_LIST_PSNODE);
/* The "generic" object has no name associated with it */
- if (op->flags & PARSEOP_GENERIC) {
+ if (op->flags & ACPI_PARSEOP_GENERIC) {
return (0);
}
/* The "generic" object has no name associated with it */
- if (op->flags & PARSEOP_GENERIC) {
+ if (op->flags & ACPI_PARSEOP_GENERIC) {
return;
}
/******************************************************************************
*
* Module Name: pswalk - Parser routines to walk parsed op tree(s)
- * $Revision: 58 $
+ * $Revision: 63 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acinterp.h"
#define _COMPONENT ACPI_PARSER
- MODULE_NAME ("pswalk")
+ ACPI_MODULE_NAME ("pswalk")
/*******************************************************************************
acpi_status status;
- FUNCTION_TRACE_PTR ("Ps_get_next_walk_op", op);
+ ACPI_FUNCTION_TRACE_PTR ("Ps_get_next_walk_op", op);
/* Check for a argument only if we are descending in the tree */
- if (walk_state->next_op_info != NEXT_OP_UPWARD) {
+ if (walk_state->next_op_info != ACPI_NEXT_OP_UPWARD) {
/* Look for an argument or child of the current op */
next = acpi_ps_get_arg (op, 0);
walk_state->prev_op = op;
walk_state->next_op = next;
- walk_state->next_op_info = NEXT_OP_DOWNWARD;
+ walk_state->next_op_info = ACPI_NEXT_OP_DOWNWARD;
return_ACPI_STATUS (AE_OK);
}
-
/*
* No more children, this Op is complete. Save Next and Parent
* in case the Op object gets deleted by the callback routine
walk_state->prev_op = op;
walk_state->next_op = next;
- walk_state->next_op_info = NEXT_OP_DOWNWARD;
+ walk_state->next_op_info = ACPI_NEXT_OP_DOWNWARD;
/* Continue downward */
* the tree
*/
}
-
else {
/*
* We are resuming a walk, and we were (are) going upward in the tree.
parent = op;
}
-
/*
* Look for a sibling of the current Op's parent
* Continue moving up the tree until we find a node that has not been
walk_state->prev_op = parent;
walk_state->next_op = next;
- walk_state->next_op_info = NEXT_OP_DOWNWARD;
+ walk_state->next_op_info = ACPI_NEXT_OP_DOWNWARD;
return_ACPI_STATUS (status);
}
}
- /* Got all the way to the top of the tree, we must be done! */
- /* However, the code should have terminated in the loop above */
-
+ /*
+ * Got all the way to the top of the tree, we must be done!
+ * However, the code should have terminated in the loop above
+ */
walk_state->next_op = NULL;
return_ACPI_STATUS (AE_OK);
*
******************************************************************************/
-static acpi_status
+acpi_status
acpi_ps_delete_completed_op (
acpi_walk_state *walk_state)
{
acpi_parse_object *subtree_root)
{
acpi_walk_state *walk_state;
- acpi_walk_list walk_list;
+ ACPI_THREAD_STATE *thread;
- FUNCTION_TRACE_PTR ("Ps_delete_parse_tree", subtree_root);
+ ACPI_FUNCTION_TRACE_PTR ("Ps_delete_parse_tree", subtree_root);
if (!subtree_root) {
/* Create and initialize a new walk list */
- walk_list.walk_state = NULL;
- walk_list.acquired_mutex_list.prev = NULL;
- walk_list.acquired_mutex_list.next = NULL;
+ thread = acpi_ut_create_thread_state ();
+ if (!thread) {
+ return_VOID;
+ }
+
- walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT, NULL, NULL, &walk_list);
+ walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT, NULL, NULL, thread);
if (!walk_state) {
return_VOID;
}
walk_state->descending_callback = NULL;
walk_state->ascending_callback = NULL;
-
walk_state->origin = subtree_root;
walk_state->next_op = subtree_root;
-
/* Head downward in the tree */
- walk_state->next_op_info = NEXT_OP_DOWNWARD;
+ walk_state->next_op_info = ACPI_NEXT_OP_DOWNWARD;
/* Visit all nodes in the subtree */
/* We are done with this walk */
- acpi_ex_release_all_mutexes ((acpi_operand_object *) &walk_list.acquired_mutex_list);
+ acpi_ut_delete_generic_state ((acpi_generic_state *) thread);
acpi_ds_delete_walk_state (walk_state);
return_VOID;
/******************************************************************************
*
* Module Name: psxface - Parser external interfaces
- * $Revision: 52 $
+ * $Revision: 59 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_PARSER
- MODULE_NAME ("psxface")
+ ACPI_MODULE_NAME ("psxface")
/*******************************************************************************
acpi_walk_state *walk_state;
- FUNCTION_TRACE ("Psx_execute");
+ ACPI_FUNCTION_TRACE ("Psx_execute");
/* Validate the Node and get the attached object */
return_ACPI_STATUS (AE_NO_MEMORY);
}
+ /*
+ * Get a new Owner_id for objects created by this method. Namespace
+ * objects (such as Operation Regions) can be created during the
+ * first pass parse.
+ */
+ obj_desc->method.owning_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_METHOD);
+
/* Create and initialize a new walk state */
- walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT,
+ walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id,
NULL, NULL, NULL);
if (!walk_state) {
return_ACPI_STATUS (AE_NO_MEMORY);
status = acpi_ds_init_aml_walk (walk_state, op, method_node, obj_desc->method.aml_start,
obj_desc->method.aml_length, NULL, NULL, 1);
if (ACPI_FAILURE (status)) {
- /* TBD: delete walk state */
+ acpi_ds_delete_walk_state (walk_state);
return_ACPI_STATUS (status);
}
status = acpi_ds_init_aml_walk (walk_state, op, method_node, obj_desc->method.aml_start,
obj_desc->method.aml_length, params, return_obj_desc, 3);
if (ACPI_FAILURE (status)) {
- /* TBD: delete walk state */
+ acpi_ds_delete_walk_state (walk_state);
return_ACPI_STATUS (status);
}
}
}
-
- if (ACPI_FAILURE (status)) {
- DUMP_PATHNAME (method_node, "Ps_execute: method failed -",
- ACPI_LV_ERROR, _COMPONENT);
- }
-
-
/*
* If the method has returned an object, signal this to the caller with
* a control exception code
if (*return_obj_desc) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Method returned Obj_desc=%p\n",
*return_obj_desc));
- DUMP_STACK_ENTRY (*return_obj_desc);
+ ACPI_DUMP_STACK_ENTRY (*return_obj_desc);
status = AE_CTRL_RETURN_VALUE;
}
-
return_ACPI_STATUS (status);
}
#
# Makefile for all Linux ACPI interpreter subdirectories
-# EXCEPT for the ospm directory
#
O_TARGET := $(notdir $(CURDIR)).o
-obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c))
+obj-$(CONFIG_ACPI_INTERPRETER) := $(patsubst %.c,%.o,$(wildcard *.c))
EXTRA_CFLAGS += $(ACPI_CFLAGS)
/*******************************************************************************
*
* Module Name: rsaddr - Address resource descriptors (16/32/64)
- * $Revision: 19 $
+ * $Revision: 24 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acresrc.h"
#define _COMPONENT ACPI_RESOURCES
- MODULE_NAME ("rsaddr")
+ ACPI_MODULE_NAME ("rsaddr")
/*******************************************************************************
*
* PARAMETERS: Byte_stream_buffer - Pointer to the resource input byte
* stream
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes consumed from
- * the Byte_stream_buffer
- * Output_buffer - Pointer to the user's return buffer
- * Structure_size - u32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * Bytes_consumed - Pointer to where the number of bytes
+ * consumed the Byte_stream_buffer is
+ * returned
+ * Output_buffer - Pointer to the return data buffer
+ * Structure_size - Pointer to where the number of bytes
+ * in the return data struct is returned
*
* RETURN: Status
*
acpi_status
acpi_rs_address16_resource (
u8 *byte_stream_buffer,
- u32 *bytes_consumed,
+ ACPI_SIZE *bytes_consumed,
u8 **output_buffer,
- u32 *structure_size)
+ ACPI_SIZE *structure_size)
{
u8 *buffer = byte_stream_buffer;
acpi_resource *output_struct = (acpi_resource *) *output_buffer;
NATIVE_CHAR *temp_ptr;
- u32 struct_size = SIZEOF_RESOURCE (acpi_resource_address16);
+ ACPI_SIZE struct_size = ACPI_SIZEOF_RESOURCE (acpi_resource_address16);
u32 index;
u16 temp16;
u8 temp8;
- FUNCTION_TRACE ("Rs_address16_resource");
+ ACPI_FUNCTION_TRACE ("Rs_address16_resource");
/*
* Point past the Descriptor to get the number of bytes consumed
*/
buffer += 1;
- MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
*bytes_consumed = temp16 + 3;
output_struct->id = ACPI_RSTYPE_ADDRESS16;
temp8 = *buffer;
/* Values 0-2 are valid */
+
if (temp8 > 2) {
return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
}
buffer += 1;
temp8 = *buffer;
- /*
- * Producer / Consumer
- */
+ /* Producer / Consumer */
+
output_struct->data.address16.producer_consumer = temp8 & 0x01;
- /*
- * Decode
- */
+ /* Decode */
+
output_struct->data.address16.decode = (temp8 >> 1) & 0x01;
- /*
- * Min Address Fixed
- */
+ /* Min Address Fixed */
+
output_struct->data.address16.min_address_fixed = (temp8 >> 2) & 0x01;
- /*
- * Max Address Fixed
- */
+ /* Max Address Fixed */
+
output_struct->data.address16.max_address_fixed = (temp8 >> 3) & 0x01;
/*
buffer += 1;
temp8 = *buffer;
- if (MEMORY_RANGE == output_struct->data.address16.resource_type) {
+ if (ACPI_MEMORY_RANGE == output_struct->data.address16.resource_type) {
output_struct->data.address16.attribute.memory.read_write_attribute =
(u16) (temp8 & 0x01);
output_struct->data.address16.attribute.memory.cache_attribute =
(u16) ((temp8 >> 1) & 0x0F);
}
-
else {
- if (IO_RANGE == output_struct->data.address16.resource_type) {
+ if (ACPI_IO_RANGE == output_struct->data.address16.resource_type) {
output_struct->data.address16.attribute.io.range_attribute =
(u16) (temp8 & 0x03);
}
-
else {
/* BUS_NUMBER_RANGE == Address16.Data->Resource_type */
/* Nothing needs to be filled in */
* Get Granularity (Bytes 6-7)
*/
buffer += 1;
- MOVE_UNALIGNED16_TO_16 (&output_struct->data.address16.granularity,
+ ACPI_MOVE_UNALIGNED16_TO_16 (&output_struct->data.address16.granularity,
buffer);
/*
* Get Min_address_range (Bytes 8-9)
*/
buffer += 2;
- MOVE_UNALIGNED16_TO_16 (&output_struct->data.address16.min_address_range,
+ ACPI_MOVE_UNALIGNED16_TO_16 (&output_struct->data.address16.min_address_range,
buffer);
/*
* Get Max_address_range (Bytes 10-11)
*/
buffer += 2;
- MOVE_UNALIGNED16_TO_16 (&output_struct->data.address16.max_address_range,
+ ACPI_MOVE_UNALIGNED16_TO_16 (&output_struct->data.address16.max_address_range,
buffer);
/*
* Get Address_translation_offset (Bytes 12-13)
*/
buffer += 2;
- MOVE_UNALIGNED16_TO_16 (&output_struct->data.address16.address_translation_offset,
+ ACPI_MOVE_UNALIGNED16_TO_16 (&output_struct->data.address16.address_translation_offset,
buffer);
/*
* Get Address_length (Bytes 14-15)
*/
buffer += 2;
- MOVE_UNALIGNED16_TO_16 (&output_struct->data.address16.address_length,
+ ACPI_MOVE_UNALIGNED16_TO_16 (&output_struct->data.address16.address_length,
buffer);
/*
* Struct_size to the next 32-bit boundary.
*/
temp8 = (u8) (index + 1);
- struct_size += ROUND_UP_TO_32_bITS (temp8);
+ struct_size += ACPI_ROUND_UP_TO_32_bITS (temp8);
}
-
else {
output_struct->data.address16.resource_source.index = 0x00;
output_struct->data.address16.resource_source.string_length = 0;
*
* PARAMETERS: Linked_list - Pointer to the resource linked list
* Output_buffer - Pointer to the user's return buffer
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes of the
- * Output_buffer used
+ * Bytes_consumed - Pointer to where the number of bytes
+ * used in the Output_buffer is returned
*
* RETURN: Status
*
acpi_rs_address16_stream (
acpi_resource *linked_list,
u8 **output_buffer,
- u32 *bytes_consumed)
+ ACPI_SIZE *bytes_consumed)
{
u8 *buffer = *output_buffer;
u8 *length_field;
u8 temp8;
NATIVE_CHAR *temp_pointer = NULL;
- u32 actual_bytes;
+ ACPI_SIZE actual_bytes;
- FUNCTION_TRACE ("Rs_address16_stream");
+ ACPI_FUNCTION_TRACE ("Rs_address16_stream");
/*
*/
temp8 = 0;
- if (MEMORY_RANGE == linked_list->data.address16.resource_type) {
+ if (ACPI_MEMORY_RANGE == linked_list->data.address16.resource_type) {
temp8 = (u8)
(linked_list->data.address16.attribute.memory.read_write_attribute &
0x01);
(linked_list->data.address16.attribute.memory.cache_attribute &
0x0F) << 1;
}
-
- else if (IO_RANGE == linked_list->data.address16.resource_type) {
+ else if (ACPI_IO_RANGE == linked_list->data.address16.resource_type) {
temp8 = (u8)
(linked_list->data.address16.attribute.io.range_attribute &
0x03);
/*
* Set the address space granularity
*/
- MOVE_UNALIGNED16_TO_16 (buffer,
+ ACPI_MOVE_UNALIGNED16_TO_16 (buffer,
&linked_list->data.address16.granularity);
buffer += 2;
/*
* Set the address range minimum
*/
- MOVE_UNALIGNED16_TO_16 (buffer,
+ ACPI_MOVE_UNALIGNED16_TO_16 (buffer,
&linked_list->data.address16.min_address_range);
buffer += 2;
/*
* Set the address range maximum
*/
- MOVE_UNALIGNED16_TO_16 (buffer,
+ ACPI_MOVE_UNALIGNED16_TO_16 (buffer,
&linked_list->data.address16.max_address_range);
buffer += 2;
/*
* Set the address translation offset
*/
- MOVE_UNALIGNED16_TO_16 (buffer,
+ ACPI_MOVE_UNALIGNED16_TO_16 (buffer,
&linked_list->data.address16.address_translation_offset);
buffer += 2;
/*
* Set the address length
*/
- MOVE_UNALIGNED16_TO_16 (buffer,
+ ACPI_MOVE_UNALIGNED16_TO_16 (buffer,
&linked_list->data.address16.address_length);
buffer += 2;
/*
* Copy the string
*/
- STRCPY (temp_pointer,
+ ACPI_STRCPY (temp_pointer,
linked_list->data.address16.resource_source.string_ptr);
/*
* Buffer needs to be set to the length of the sting + one for the
* terminating null
*/
- buffer += (STRLEN (linked_list->data.address16.resource_source.string_ptr)
+ buffer += (ACPI_STRLEN (linked_list->data.address16.resource_source.string_ptr)
+ 1);
}
/*
* Return the number of bytes consumed in this operation
*/
- actual_bytes = POINTER_DIFF (buffer, *output_buffer);
+ actual_bytes = ACPI_PTR_DIFF (buffer, *output_buffer);
*bytes_consumed = actual_bytes;
/*
* minus the header size (3 bytes)
*/
actual_bytes -= 3;
- MOVE_UNALIGNED16_TO_16 (length_field, &actual_bytes);
+ ACPI_MOVE_UNALIGNED16_TO_16 (length_field, &actual_bytes);
return_ACPI_STATUS (AE_OK);
}
*
* PARAMETERS: Byte_stream_buffer - Pointer to the resource input byte
* stream
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes consumed from
- * the Byte_stream_buffer
- * Output_buffer - Pointer to the user's return buffer
- * Structure_size - u32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * Bytes_consumed - Pointer to where the number of bytes
+ * consumed the Byte_stream_buffer is
+ * returned
+ * Output_buffer - Pointer to the return data buffer
+ * Structure_size - Pointer to where the number of bytes
+ * in the return data struct is returned
*
* RETURN: Status
*
acpi_status
acpi_rs_address32_resource (
u8 *byte_stream_buffer,
- u32 *bytes_consumed,
+ ACPI_SIZE *bytes_consumed,
u8 **output_buffer,
- u32 *structure_size)
+ ACPI_SIZE *structure_size)
{
u8 *buffer;
acpi_resource *output_struct;
u16 temp16;
u8 temp8;
NATIVE_CHAR *temp_ptr;
- u32 struct_size;
+ ACPI_SIZE struct_size;
u32 index;
- FUNCTION_TRACE ("Rs_address32_resource");
+ ACPI_FUNCTION_TRACE ("Rs_address32_resource");
buffer = byte_stream_buffer;
output_struct = (acpi_resource *) *output_buffer;
- struct_size = SIZEOF_RESOURCE (acpi_resource_address32);
+ struct_size = ACPI_SIZEOF_RESOURCE (acpi_resource_address32);
/*
* Point past the Descriptor to get the number of bytes consumed
*/
buffer += 1;
- MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
-
+ ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
*bytes_consumed = temp16 + 3;
output_struct->id = ACPI_RSTYPE_ADDRESS32;
buffer += 1;
temp8 = *buffer;
- if (MEMORY_RANGE == output_struct->data.address32.resource_type) {
+ if (ACPI_MEMORY_RANGE == output_struct->data.address32.resource_type) {
output_struct->data.address32.attribute.memory.read_write_attribute =
(u16) (temp8 & 0x01);
output_struct->data.address32.attribute.memory.cache_attribute =
(u16) ((temp8 >> 1) & 0x0F);
}
-
else {
- if (IO_RANGE == output_struct->data.address32.resource_type) {
+ if (ACPI_IO_RANGE == output_struct->data.address32.resource_type) {
output_struct->data.address32.attribute.io.range_attribute =
(u16) (temp8 & 0x03);
}
-
else {
/* BUS_NUMBER_RANGE == Output_struct->Data.Address32.Resource_type */
/* Nothing needs to be filled in */
* Get Granularity (Bytes 6-9)
*/
buffer += 1;
- MOVE_UNALIGNED32_TO_32 (&output_struct->data.address32.granularity,
+ ACPI_MOVE_UNALIGNED32_TO_32 (&output_struct->data.address32.granularity,
buffer);
/*
* Get Min_address_range (Bytes 10-13)
*/
buffer += 4;
- MOVE_UNALIGNED32_TO_32 (&output_struct->data.address32.min_address_range,
+ ACPI_MOVE_UNALIGNED32_TO_32 (&output_struct->data.address32.min_address_range,
buffer);
/*
* Get Max_address_range (Bytes 14-17)
*/
buffer += 4;
- MOVE_UNALIGNED32_TO_32 (&output_struct->data.address32.max_address_range,
+ ACPI_MOVE_UNALIGNED32_TO_32 (&output_struct->data.address32.max_address_range,
buffer);
/*
* Get Address_translation_offset (Bytes 18-21)
*/
buffer += 4;
- MOVE_UNALIGNED32_TO_32 (&output_struct->data.address32.address_translation_offset,
+ ACPI_MOVE_UNALIGNED32_TO_32 (&output_struct->data.address32.address_translation_offset,
buffer);
/*
* Get Address_length (Bytes 22-25)
*/
buffer += 4;
- MOVE_UNALIGNED32_TO_32 (&output_struct->data.address32.address_length,
+ ACPI_MOVE_UNALIGNED32_TO_32 (&output_struct->data.address32.address_length,
buffer);
/*
/* Copy the string into the buffer */
index = 0;
-
while (0x00 != *buffer) {
*temp_ptr = *buffer;
* Struct_size to the next 32-bit boundary.
*/
temp8 = (u8) (index + 1);
- struct_size += ROUND_UP_TO_32_bITS (temp8);
+ struct_size += ACPI_ROUND_UP_TO_32_bITS (temp8);
}
-
else {
output_struct->data.address32.resource_source.index = 0x00;
output_struct->data.address32.resource_source.string_length = 0;
*
* PARAMETERS: Linked_list - Pointer to the resource linked list
* Output_buffer - Pointer to the user's return buffer
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes of the
- * Output_buffer used
+ * Bytes_consumed - Pointer to where the number of bytes
+ * used in the Output_buffer is returned
*
* RETURN: Status
*
acpi_rs_address32_stream (
acpi_resource *linked_list,
u8 **output_buffer,
- u32 *bytes_consumed)
+ ACPI_SIZE *bytes_consumed)
{
u8 *buffer;
u16 *length_field;
NATIVE_CHAR *temp_pointer;
- FUNCTION_TRACE ("Rs_address32_stream");
+ ACPI_FUNCTION_TRACE ("Rs_address32_stream");
buffer = *output_buffer;
/*
* Set a pointer to the Length field - to be filled in later
*/
-
length_field = (u16 *) buffer;
buffer += 2;
*/
temp8 = 0;
- if(MEMORY_RANGE == linked_list->data.address32.resource_type) {
+ if (ACPI_MEMORY_RANGE == linked_list->data.address32.resource_type) {
temp8 = (u8)
(linked_list->data.address32.attribute.memory.read_write_attribute &
0x01);
(linked_list->data.address32.attribute.memory.cache_attribute &
0x0F) << 1;
}
-
- else if (IO_RANGE == linked_list->data.address32.resource_type) {
+ else if (ACPI_IO_RANGE == linked_list->data.address32.resource_type) {
temp8 = (u8)
(linked_list->data.address32.attribute.io.range_attribute &
0x03);
/*
* Set the address space granularity
*/
- MOVE_UNALIGNED32_TO_32 (buffer,
+ ACPI_MOVE_UNALIGNED32_TO_32 (buffer,
&linked_list->data.address32.granularity);
buffer += 4;
/*
* Set the address range minimum
*/
- MOVE_UNALIGNED32_TO_32 (buffer,
+ ACPI_MOVE_UNALIGNED32_TO_32 (buffer,
&linked_list->data.address32.min_address_range);
buffer += 4;
/*
* Set the address range maximum
*/
- MOVE_UNALIGNED32_TO_32 (buffer,
+ ACPI_MOVE_UNALIGNED32_TO_32 (buffer,
&linked_list->data.address32.max_address_range);
buffer += 4;
/*
* Set the address translation offset
*/
- MOVE_UNALIGNED32_TO_32 (buffer,
+ ACPI_MOVE_UNALIGNED32_TO_32 (buffer,
&linked_list->data.address32.address_translation_offset);
buffer += 4;
/*
* Set the address length
*/
- MOVE_UNALIGNED32_TO_32 (buffer,
+ ACPI_MOVE_UNALIGNED32_TO_32 (buffer,
&linked_list->data.address32.address_length);
buffer += 4;
/*
* Copy the string
*/
- STRCPY (temp_pointer,
+ ACPI_STRCPY (temp_pointer,
linked_list->data.address32.resource_source.string_ptr);
/*
* Buffer needs to be set to the length of the sting + one for the
* terminating null
*/
- buffer += (STRLEN (linked_list->data.address32.resource_source.string_ptr) + 1);
+ buffer += (ACPI_STRLEN (linked_list->data.address32.resource_source.string_ptr) + 1);
}
/*
* Return the number of bytes consumed in this operation
*/
- *bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
+ *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
/*
* Set the length field to the number of bytes consumed
*
* PARAMETERS: Byte_stream_buffer - Pointer to the resource input byte
* stream
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes consumed from
- * the Byte_stream_buffer
- * Output_buffer - Pointer to the user's return buffer
- * Structure_size - u32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * Bytes_consumed - Pointer to where the number of bytes
+ * consumed the Byte_stream_buffer is
+ * returned
+ * Output_buffer - Pointer to the return data buffer
+ * Structure_size - Pointer to where the number of bytes
+ * in the return data struct is returned
*
* RETURN: Status
*
acpi_status
acpi_rs_address64_resource (
u8 *byte_stream_buffer,
- u32 *bytes_consumed,
+ ACPI_SIZE *bytes_consumed,
u8 **output_buffer,
- u32 *structure_size)
+ ACPI_SIZE *structure_size)
{
u8 *buffer;
acpi_resource *output_struct;
u16 temp16;
u8 temp8;
NATIVE_CHAR *temp_ptr;
- u32 struct_size;
+ ACPI_SIZE struct_size;
u32 index;
- FUNCTION_TRACE ("Rs_address64_resource");
+ ACPI_FUNCTION_TRACE ("Rs_address64_resource");
buffer = byte_stream_buffer;
output_struct = (acpi_resource *) *output_buffer;
- struct_size = SIZEOF_RESOURCE (acpi_resource_address64);
+ struct_size = ACPI_SIZEOF_RESOURCE (acpi_resource_address64);
/*
* Point past the Descriptor to get the number of bytes consumed
*/
buffer += 1;
- MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
*bytes_consumed = temp16 + 3;
output_struct->id = ACPI_RSTYPE_ADDRESS64;
temp8 = *buffer;
/* Values 0-2 are valid */
+
if(temp8 > 2) {
return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
}
buffer += 1;
temp8 = *buffer;
- if (MEMORY_RANGE == output_struct->data.address64.resource_type) {
+ if (ACPI_MEMORY_RANGE == output_struct->data.address64.resource_type) {
output_struct->data.address64.attribute.memory.read_write_attribute =
(u16) (temp8 & 0x01);
output_struct->data.address64.attribute.memory.cache_attribute =
(u16) ((temp8 >> 1) & 0x0F);
}
-
else {
- if (IO_RANGE == output_struct->data.address64.resource_type) {
+ if (ACPI_IO_RANGE == output_struct->data.address64.resource_type) {
output_struct->data.address64.attribute.io.range_attribute =
(u16) (temp8 & 0x03);
}
-
else {
/* BUS_NUMBER_RANGE == Output_struct->Data.Address64.Resource_type */
/* Nothing needs to be filled in */
* Get Granularity (Bytes 6-13)
*/
buffer += 1;
- MOVE_UNALIGNED64_TO_64 (&output_struct->data.address64.granularity,
+ ACPI_MOVE_UNALIGNED64_TO_64 (&output_struct->data.address64.granularity,
buffer);
/*
* Get Min_address_range (Bytes 14-21)
*/
buffer += 8;
- MOVE_UNALIGNED64_TO_64 (&output_struct->data.address64.min_address_range,
+ ACPI_MOVE_UNALIGNED64_TO_64 (&output_struct->data.address64.min_address_range,
buffer);
/*
* Get Max_address_range (Bytes 22-29)
*/
buffer += 8;
- MOVE_UNALIGNED64_TO_64 (&output_struct->data.address64.max_address_range,
+ ACPI_MOVE_UNALIGNED64_TO_64 (&output_struct->data.address64.max_address_range,
buffer);
/*
* Get Address_translation_offset (Bytes 30-37)
*/
buffer += 8;
- MOVE_UNALIGNED64_TO_64 (&output_struct->data.address64.address_translation_offset,
+ ACPI_MOVE_UNALIGNED64_TO_64 (&output_struct->data.address64.address_translation_offset,
buffer);
/*
* Get Address_length (Bytes 38-45)
*/
buffer += 8;
- MOVE_UNALIGNED64_TO_64 (&output_struct->data.address64.address_length,
+ ACPI_MOVE_UNALIGNED64_TO_64 (&output_struct->data.address64.address_length,
buffer);
/*
/* Copy the string into the buffer */
index = 0;
-
while (0x00 != *buffer) {
*temp_ptr = *buffer;
* Struct_size to the next 32-bit boundary.
*/
temp8 = (u8) (index + 1);
- struct_size += ROUND_UP_TO_32_bITS (temp8);
+ struct_size += ACPI_ROUND_UP_TO_32_bITS (temp8);
}
-
else {
output_struct->data.address64.resource_source.index = 0x00;
output_struct->data.address64.resource_source.string_length = 0;
*
* PARAMETERS: Linked_list - Pointer to the resource linked list
* Output_buffer - Pointer to the user's return buffer
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes of the
- * Output_buffer used
+ * Bytes_consumed - Pointer to where the number of bytes
+ * used in the Output_buffer is returned
*
* RETURN: Status
*
acpi_rs_address64_stream (
acpi_resource *linked_list,
u8 **output_buffer,
- u32 *bytes_consumed)
+ ACPI_SIZE *bytes_consumed)
{
u8 *buffer;
u16 *length_field;
NATIVE_CHAR *temp_pointer;
- FUNCTION_TRACE ("Rs_address64_stream");
+ ACPI_FUNCTION_TRACE ("Rs_address64_stream");
buffer = *output_buffer;
*/
temp8 = 0;
- if(MEMORY_RANGE == linked_list->data.address64.resource_type) {
+ if (ACPI_MEMORY_RANGE == linked_list->data.address64.resource_type) {
temp8 = (u8)
(linked_list->data.address64.attribute.memory.read_write_attribute &
0x01);
(linked_list->data.address64.attribute.memory.cache_attribute &
0x0F) << 1;
}
-
- else if (IO_RANGE == linked_list->data.address64.resource_type) {
+ else if (ACPI_IO_RANGE == linked_list->data.address64.resource_type) {
temp8 = (u8)
(linked_list->data.address64.attribute.io.range_attribute &
0x03);
/*
* Set the address space granularity
*/
- MOVE_UNALIGNED64_TO_64 (buffer,
+ ACPI_MOVE_UNALIGNED64_TO_64 (buffer,
&linked_list->data.address64.granularity);
buffer += 8;
/*
* Set the address range minimum
*/
- MOVE_UNALIGNED64_TO_64 (buffer,
+ ACPI_MOVE_UNALIGNED64_TO_64 (buffer,
&linked_list->data.address64.min_address_range);
buffer += 8;
/*
* Set the address range maximum
*/
- MOVE_UNALIGNED64_TO_64 (buffer,
+ ACPI_MOVE_UNALIGNED64_TO_64 (buffer,
&linked_list->data.address64.max_address_range);
buffer += 8;
/*
* Set the address translation offset
*/
- MOVE_UNALIGNED64_TO_64 (buffer,
+ ACPI_MOVE_UNALIGNED64_TO_64 (buffer,
&linked_list->data.address64.address_translation_offset);
buffer += 8;
/*
* Set the address length
*/
- MOVE_UNALIGNED64_TO_64 (buffer,
+ ACPI_MOVE_UNALIGNED64_TO_64 (buffer,
&linked_list->data.address64.address_length);
buffer += 8;
/*
* Copy the string
*/
- STRCPY (temp_pointer, linked_list->data.address64.resource_source.string_ptr);
+ ACPI_STRCPY (temp_pointer, linked_list->data.address64.resource_source.string_ptr);
/*
* Buffer needs to be set to the length of the sting + one for the
* terminating null
*/
- buffer += (STRLEN (linked_list->data.address64.resource_source.string_ptr) + 1);
+ buffer += (ACPI_STRLEN (linked_list->data.address64.resource_source.string_ptr) + 1);
}
/*
* Return the number of bytes consumed in this operation
*/
- *bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
+ *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
/*
* Set the length field to the number of bytes consumed
/*******************************************************************************
*
* Module Name: rscalc - Calculate stream and list lengths
- * $Revision: 32 $
+ * $Revision: 39 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acnamesp.h"
#define _COMPONENT ACPI_RESOURCES
- MODULE_NAME ("rscalc")
+ ACPI_MODULE_NAME ("rscalc")
/*******************************************************************************
acpi_status
acpi_rs_calculate_byte_stream_length (
acpi_resource *linked_list,
- u32 *size_needed)
+ ACPI_SIZE *size_needed)
{
- u32 byte_stream_size_needed = 0;
- u32 segment_size;
+ ACPI_SIZE byte_stream_size_needed = 0;
+ ACPI_SIZE segment_size;
acpi_resource_ext_irq *ex_irq = NULL;
u8 done = FALSE;
- FUNCTION_TRACE ("Rs_calculate_byte_stream_length");
+ ACPI_FUNCTION_TRACE ("Rs_calculate_byte_stream_length");
while (!done) {
* so exit with an error
*/
return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
- break;
} /* switch (Linked_list->Id) */
/*
* Point to the next object
*/
- linked_list = POINTER_ADD (acpi_resource,
+ linked_list = ACPI_PTR_ADD (acpi_resource,
linked_list, linked_list->length);
}
acpi_rs_calculate_list_length (
u8 *byte_stream_buffer,
u32 byte_stream_buffer_length,
- u32 *size_needed)
+ ACPI_SIZE *size_needed)
{
u32 buffer_size = 0;
u32 bytes_parsed = 0;
u8 additional_bytes;
- FUNCTION_TRACE ("Rs_calculate_list_length");
+ ACPI_FUNCTION_TRACE ("Rs_calculate_list_length");
while (bytes_parsed < byte_stream_buffer_length) {
resource_type = acpi_rs_get_resource_type (*byte_stream_buffer);
switch (resource_type) {
- case RESOURCE_DESC_MEMORY_24:
+ case ACPI_RDESC_TYPE_MEMORY_24:
/*
* 24-Bit Memory Resource
*/
bytes_consumed = 12;
- structure_size = SIZEOF_RESOURCE (acpi_resource_mem24);
+ structure_size = ACPI_SIZEOF_RESOURCE (acpi_resource_mem24);
break;
- case RESOURCE_DESC_LARGE_VENDOR:
+ case ACPI_RDESC_TYPE_LARGE_VENDOR:
/*
* Vendor Defined Resource
*/
buffer = byte_stream_buffer;
++buffer;
- MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
bytes_consumed = temp16 + 3;
/*
* Ensure a 32-bit boundary for the structure
*/
- temp16 = (u16) ROUND_UP_TO_32_bITS (temp16);
+ temp16 = (u16) ACPI_ROUND_UP_TO_32_bITS (temp16);
- structure_size = SIZEOF_RESOURCE (acpi_resource_vendor) +
+ structure_size = ACPI_SIZEOF_RESOURCE (acpi_resource_vendor) +
(temp16 * sizeof (u8));
break;
- case RESOURCE_DESC_MEMORY_32:
+ case ACPI_RDESC_TYPE_MEMORY_32:
/*
* 32-Bit Memory Range Resource
*/
bytes_consumed = 20;
- structure_size = SIZEOF_RESOURCE (acpi_resource_mem32);
+ structure_size = ACPI_SIZEOF_RESOURCE (acpi_resource_mem32);
break;
- case RESOURCE_DESC_FIXED_MEMORY_32:
+ case ACPI_RDESC_TYPE_FIXED_MEMORY_32:
/*
* 32-Bit Fixed Memory Resource
*/
bytes_consumed = 12;
- structure_size = SIZEOF_RESOURCE (acpi_resource_fixed_mem32);
+ structure_size = ACPI_SIZEOF_RESOURCE (acpi_resource_fixed_mem32);
break;
- case RESOURCE_DESC_QWORD_ADDRESS_SPACE:
+ case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE:
/*
* 64-Bit Address Resource
*/
buffer = byte_stream_buffer;
++buffer;
- MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
bytes_consumed = temp16 + 3;
/*
* Ensure a 64-bit boundary for the structure
*/
- temp8 = (u8) ROUND_UP_TO_64_bITS (temp8);
+ temp8 = (u8) ACPI_ROUND_UP_TO_64_bITS (temp8);
- structure_size = SIZEOF_RESOURCE (acpi_resource_address64) +
+ structure_size = ACPI_SIZEOF_RESOURCE (acpi_resource_address64) +
(temp8 * sizeof (u8));
break;
- case RESOURCE_DESC_DWORD_ADDRESS_SPACE:
+ case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE:
/*
* 32-Bit Address Resource
*/
buffer = byte_stream_buffer;
++buffer;
- MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
bytes_consumed = temp16 + 3;
/*
* Ensure a 32-bit boundary for the structure
*/
- temp8 = (u8) ROUND_UP_TO_32_bITS (temp8);
+ temp8 = (u8) ACPI_ROUND_UP_TO_32_bITS (temp8);
- structure_size = SIZEOF_RESOURCE (acpi_resource_address32) +
+ structure_size = ACPI_SIZEOF_RESOURCE (acpi_resource_address32) +
(temp8 * sizeof (u8));
break;
- case RESOURCE_DESC_WORD_ADDRESS_SPACE:
+ case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE:
/*
* 16-Bit Address Resource
*/
buffer = byte_stream_buffer;
++buffer;
- MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
bytes_consumed = temp16 + 3;
/*
* Ensure a 32-bit boundary for the structure
*/
- temp8 = (u8) ROUND_UP_TO_32_bITS (temp8);
+ temp8 = (u8) ACPI_ROUND_UP_TO_32_bITS (temp8);
- structure_size = SIZEOF_RESOURCE (acpi_resource_address16) +
+ structure_size = ACPI_SIZEOF_RESOURCE (acpi_resource_address16) +
(temp8 * sizeof (u8));
break;
- case RESOURCE_DESC_EXTENDED_XRUPT:
+ case ACPI_RDESC_TYPE_EXTENDED_XRUPT:
/*
* Extended IRQ
*/
buffer = byte_stream_buffer;
++buffer;
- MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
bytes_consumed = temp16 + 3;
if (9 + additional_bytes < temp16) {
temp8 = (u8) (temp16 - (9 + additional_bytes));
}
-
else {
temp8 = 0;
}
/*
* Ensure a 32-bit boundary for the structure
*/
- temp8 = (u8) ROUND_UP_TO_32_bITS (temp8);
+ temp8 = (u8) ACPI_ROUND_UP_TO_32_bITS (temp8);
- structure_size = SIZEOF_RESOURCE (acpi_resource_ext_irq) +
+ structure_size = ACPI_SIZEOF_RESOURCE (acpi_resource_ext_irq) +
(additional_bytes * sizeof (u8)) +
(temp8 * sizeof (u8));
break;
- case RESOURCE_DESC_IRQ_FORMAT:
+ case ACPI_RDESC_TYPE_IRQ_FORMAT:
/*
* IRQ Resource.
* Determine if it there are two or three trailing bytes
if(temp8 & 0x01) {
bytes_consumed = 4;
}
-
else {
bytes_consumed = 3;
}
/*
* Look at the number of bits set
*/
- MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
for (index = 0; index < 16; index++) {
if (temp16 & 0x1) {
temp16 >>= 1;
}
- structure_size = SIZEOF_RESOURCE (acpi_resource_io) +
+ structure_size = ACPI_SIZEOF_RESOURCE (acpi_resource_io) +
(number_of_interrupts * sizeof (u32));
break;
- case RESOURCE_DESC_DMA_FORMAT:
+ case ACPI_RDESC_TYPE_DMA_FORMAT:
/*
* DMA Resource
*/
temp8 >>= 1;
}
- structure_size = SIZEOF_RESOURCE (acpi_resource_dma) +
+ structure_size = ACPI_SIZEOF_RESOURCE (acpi_resource_dma) +
(number_of_channels * sizeof (u32));
break;
- case RESOURCE_DESC_START_DEPENDENT:
+ case ACPI_RDESC_TYPE_START_DEPENDENT:
/*
* Start Dependent Functions Resource
* Determine if it there are two or three trailing bytes
bytes_consumed = 1;
}
- structure_size = SIZEOF_RESOURCE (acpi_resource_start_dpf);
+ structure_size = ACPI_SIZEOF_RESOURCE (acpi_resource_start_dpf);
break;
- case RESOURCE_DESC_END_DEPENDENT:
+ case ACPI_RDESC_TYPE_END_DEPENDENT:
/*
* End Dependent Functions Resource
*/
break;
- case RESOURCE_DESC_IO_PORT:
+ case ACPI_RDESC_TYPE_IO_PORT:
/*
* IO Port Resource
*/
bytes_consumed = 8;
- structure_size = SIZEOF_RESOURCE (acpi_resource_io);
+ structure_size = ACPI_SIZEOF_RESOURCE (acpi_resource_io);
break;
- case RESOURCE_DESC_FIXED_IO_PORT:
+ case ACPI_RDESC_TYPE_FIXED_IO_PORT:
/*
* Fixed IO Port Resource
*/
bytes_consumed = 4;
- structure_size = SIZEOF_RESOURCE (acpi_resource_fixed_io);
+ structure_size = ACPI_SIZEOF_RESOURCE (acpi_resource_fixed_io);
break;
- case RESOURCE_DESC_SMALL_VENDOR:
+ case ACPI_RDESC_TYPE_SMALL_VENDOR:
/*
* Vendor Specific Resource
*/
/*
* Ensure a 32-bit boundary for the structure
*/
- temp8 = (u8) ROUND_UP_TO_32_bITS (temp8);
- structure_size = SIZEOF_RESOURCE (acpi_resource_vendor) +
+ temp8 = (u8) ACPI_ROUND_UP_TO_32_bITS (temp8);
+ structure_size = ACPI_SIZEOF_RESOURCE (acpi_resource_vendor) +
(temp8 * sizeof (u8));
break;
- case RESOURCE_DESC_END_TAG:
+ case ACPI_RDESC_TYPE_END_TAG:
/*
* End Tag
*/
* so exit with an error
*/
return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
- break;
}
-
/*
* Update the return value and counter
*/
- buffer_size += structure_size;
+ buffer_size += ACPI_ALIGN_RESOURCE_SIZE(structure_size);
bytes_parsed += bytes_consumed;
/*
byte_stream_buffer += bytes_consumed;
}
-
/*
* This is the data the caller needs
*/
acpi_status
acpi_rs_calculate_pci_routing_table_length (
acpi_operand_object *package_object,
- u32 *buffer_size_needed)
+ ACPI_SIZE *buffer_size_needed)
{
u32 number_of_elements;
u32 temp_size_needed = 0;
u32 table_index;
- FUNCTION_TRACE ("Rs_calculate_pci_routing_table_length");
+ ACPI_FUNCTION_TRACE ("Rs_calculate_pci_routing_table_length");
number_of_elements = package_object->package.count;
((*sub_object_list)->reference.opcode == AML_INT_NAMEPATH_OP))) {
name_found = TRUE;
}
-
else {
/*
* Look at the next element
}
}
- temp_size_needed += (sizeof (pci_routing_table) - 4);
+ temp_size_needed += (sizeof (acpi_pci_routing_table) - 4);
/*
* Was a String type found?
*/
temp_size_needed += (*sub_object_list)->string.length;
}
-
else {
temp_size_needed += acpi_ns_get_pathname_length (
(*sub_object_list)->reference.node);
}
}
-
else {
/*
* If no name was found, then this is a NULL, which is
/* Round up the size since each element must be aligned */
- temp_size_needed = ROUND_UP_TO_64_bITS (temp_size_needed);
+ temp_size_needed = ACPI_ROUND_UP_TO_64_bITS (temp_size_needed);
/*
* Point to the next acpi_operand_object
top_object_list++;
}
-
/*
* Adding an extra element to the end of the list, essentially a NULL terminator
*/
- *buffer_size_needed = temp_size_needed + sizeof (pci_routing_table);
+ *buffer_size_needed = temp_size_needed + sizeof (acpi_pci_routing_table);
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
* Module Name: rscreate - Create resource lists/tables
- * $Revision: 36 $
+ * $Revision: 53 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acnamesp.h"
#define _COMPONENT ACPI_RESOURCES
- MODULE_NAME ("rscreate")
+ ACPI_MODULE_NAME ("rscreate")
/*******************************************************************************
acpi_status
acpi_rs_create_resource_list (
acpi_operand_object *byte_stream_buffer,
- u8 *output_buffer,
- u32 *output_buffer_length)
+ acpi_buffer *output_buffer)
{
acpi_status status;
u8 *byte_stream_start;
- u32 list_size_needed = 0;
+ ACPI_SIZE list_size_needed = 0;
u32 byte_stream_buffer_length;
- FUNCTION_TRACE ("Rs_create_resource_list");
+ ACPI_FUNCTION_TRACE ("Rs_create_resource_list");
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Byte_stream_buffer = %p\n", byte_stream_buffer));
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Status=%X List_size_needed=%X\n",
status, list_size_needed));
-
- /*
- * Exit with the error passed back
- */
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
- /*
- * If the linked list will fit into the available buffer
- * call to fill in the list
- */
- if (list_size_needed <= *output_buffer_length) {
- /*
- * Zero out the return buffer before proceeding
- */
- MEMSET (output_buffer, 0x00, *output_buffer_length);
-
- status = acpi_rs_byte_stream_to_list (byte_stream_start, byte_stream_buffer_length,
- &output_buffer);
+ /* Validate/Allocate/Clear caller buffer */
- /*
- * Exit with the error passed back
- */
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Output_buffer = %p\n", output_buffer));
+ status = acpi_ut_initialize_buffer (output_buffer, list_size_needed);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
}
- else {
- *output_buffer_length = list_size_needed;
- return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
+ /* Do the conversion */
+
+ status = acpi_rs_byte_stream_to_list (byte_stream_start, byte_stream_buffer_length,
+ output_buffer->pointer);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
}
- *output_buffer_length = list_size_needed;
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Output_buffer %p Length %X\n",
+ output_buffer->pointer, output_buffer->length));
return_ACPI_STATUS (AE_OK);
}
*
* RETURN: Status AE_OK if okay, else a valid acpi_status code.
* If the Output_buffer is too small, the error will be
- * AE_BUFFER_OVERFLOW and Output_buffer_length will point
+ * AE_BUFFER_OVERFLOW and Output_buffer->Length will point
* to the size buffer needed.
*
* DESCRIPTION: Takes the acpi_operand_object package and creates a
* linked list of PCI interrupt descriptions
*
+ * NOTE: It is the caller's responsibility to ensure that the start of the
+ * output buffer is aligned properly (if necessary).
+ *
******************************************************************************/
acpi_status
acpi_rs_create_pci_routing_table (
acpi_operand_object *package_object,
- u8 *output_buffer,
- u32 *output_buffer_length)
+ acpi_buffer *output_buffer)
{
- u8 *buffer = output_buffer;
+ u8 *buffer;
acpi_operand_object **top_object_list = NULL;
acpi_operand_object **sub_object_list = NULL;
acpi_operand_object *package_element = NULL;
- u32 buffer_size_needed = 0;
+ ACPI_SIZE buffer_size_needed = 0;
u32 number_of_elements = 0;
u32 index = 0;
- pci_routing_table *user_prt = NULL;
+ acpi_pci_routing_table *user_prt = NULL;
acpi_namespace_node *node;
acpi_status status;
+ acpi_buffer path_buffer;
- FUNCTION_TRACE ("Rs_create_pci_routing_table");
+ ACPI_FUNCTION_TRACE ("Rs_create_pci_routing_table");
+ /* Params already validated, so we don't re-validate here */
+
/*
- * Params already validated, so we don't re-validate here
+ * Get the required buffer length
*/
status = acpi_rs_calculate_pci_routing_table_length (package_object,
&buffer_size_needed);
-
- if (!ACPI_SUCCESS(status)) {
+ if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Buffer_size_needed = %X\n", buffer_size_needed));
+ /* Validate/Allocate/Clear caller buffer */
+
+ status = acpi_ut_initialize_buffer (output_buffer, buffer_size_needed);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+
/*
- * If the data will fit into the available buffer
- * call to fill in the list
+ * Loop through the ACPI_INTERNAL_OBJECTS - Each object should contain an
+ * acpi_integer Address, a u8 Pin, a Name and a u8 Source_index.
*/
- if (buffer_size_needed <= *output_buffer_length) {
+ top_object_list = package_object->package.elements;
+ number_of_elements = package_object->package.count;
+ buffer = output_buffer->pointer;
+ user_prt = (acpi_pci_routing_table *) buffer;
+
+ for (index = 0; index < number_of_elements; index++) {
/*
- * Zero out the return buffer before proceeding
+ * Point User_prt past this current structure
+ *
+ * NOTE: On the first iteration, User_prt->Length will
+ * be zero because we cleared the return buffer earlier
*/
- MEMSET (output_buffer, 0x00, *output_buffer_length);
+ buffer += user_prt->length;
+ user_prt = (acpi_pci_routing_table *) buffer;
/*
- * Loop through the ACPI_INTERNAL_OBJECTS - Each object should
- * contain a u32 Address, a u8 Pin, a Name and a u8
- * Source_index.
+ * Fill in the Length field with the information we have at this point.
+ * The minus four is to subtract the size of the u8 Source[4] member
+ * because it is added below.
*/
- top_object_list = package_object->package.elements;
- number_of_elements = package_object->package.count;
- user_prt = (pci_routing_table *) buffer;
-
-
- buffer = ROUND_PTR_UP_TO_8 (buffer, u8);
-
- for (index = 0; index < number_of_elements; index++) {
- /*
- * Point User_prt past this current structure
- *
- * NOTE: On the first iteration, User_prt->Length will
- * be zero because we cleared the return buffer earlier
- */
- buffer += user_prt->length;
- user_prt = (pci_routing_table *) buffer;
+ user_prt->length = (sizeof (acpi_pci_routing_table) -4);
+ /*
+ * Dereference the sub-package
+ */
+ package_element = *top_object_list;
- /*
- * Fill in the Length field with the information we
- * have at this point.
- * The minus four is to subtract the size of the
- * u8 Source[4] member because it is added below.
- */
- user_prt->length = (sizeof (pci_routing_table) -4);
-
- /*
- * Dereference the sub-package
- */
- package_element = *top_object_list;
+ /*
+ * The Sub_object_list will now point to an array of the four IRQ
+ * elements: Address, Pin, Source and Source_index
+ */
+ sub_object_list = package_element->package.elements;
- /*
- * The Sub_object_list will now point to an array of
- * the four IRQ elements: Address, Pin, Source and
- * Source_index
- */
- sub_object_list = package_element->package.elements;
+ /*
+ * 1) First subobject: Dereference the Address
+ */
+ if (ACPI_TYPE_INTEGER == (*sub_object_list)->common.type) {
+ user_prt->address = (*sub_object_list)->integer.value;
+ }
+ else {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n",
+ acpi_ut_get_type_name ((*sub_object_list)->common.type)));
+ return_ACPI_STATUS (AE_BAD_DATA);
+ }
- /*
- * 1) First subobject: Dereference the Address
- */
- if (ACPI_TYPE_INTEGER == (*sub_object_list)->common.type) {
- user_prt->address = (*sub_object_list)->integer.value;
- }
+ /*
+ * 2) Second subobject: Dereference the Pin
+ */
+ sub_object_list++;
- else {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n",
- acpi_ut_get_type_name ((*sub_object_list)->common.type)));
- return_ACPI_STATUS (AE_BAD_DATA);
- }
+ if (ACPI_TYPE_INTEGER == (*sub_object_list)->common.type) {
+ user_prt->pin = (u32) (*sub_object_list)->integer.value;
+ }
+ else {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n",
+ acpi_ut_get_type_name ((*sub_object_list)->common.type)));
+ return_ACPI_STATUS (AE_BAD_DATA);
+ }
- /*
- * 2) Second subobject: Dereference the Pin
- */
- sub_object_list++;
+ /*
+ * 3) Third subobject: Dereference the Source Name
+ */
+ sub_object_list++;
- if (ACPI_TYPE_INTEGER == (*sub_object_list)->common.type) {
- user_prt->pin = (u32) (*sub_object_list)->integer.value;
- }
+ switch ((*sub_object_list)->common.type) {
+ case INTERNAL_TYPE_REFERENCE:
- else {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n",
- acpi_ut_get_type_name ((*sub_object_list)->common.type)));
+ if ((*sub_object_list)->reference.opcode != AML_INT_NAMEPATH_OP) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need name, found reference op %X\n",
+ (*sub_object_list)->reference.opcode));
return_ACPI_STATUS (AE_BAD_DATA);
}
- /*
- * 3) Third subobject: Dereference the Source Name
- */
- sub_object_list++;
-
- switch ((*sub_object_list)->common.type) {
- case INTERNAL_TYPE_REFERENCE:
+ node = (*sub_object_list)->reference.node;
- if ((*sub_object_list)->reference.opcode != AML_INT_NAMEPATH_OP) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need name, found reference op %X\n",
- (*sub_object_list)->reference.opcode));
- return_ACPI_STATUS (AE_BAD_DATA);
- }
+ /* Use *remaining* length of the buffer as max for pathname */
- node = (*sub_object_list)->reference.node;
+ path_buffer.length = output_buffer->length -
+ (u32) ((u8 *) user_prt->source - (u8 *) output_buffer->pointer);
+ path_buffer.pointer = user_prt->source;
- /* TBD: use *remaining* length of the buffer! */
+ status = acpi_ns_handle_to_pathname ((acpi_handle *) node, &path_buffer);
- status = acpi_ns_handle_to_pathname ((acpi_handle *) node,
- output_buffer_length, user_prt->source);
+ user_prt->length += ACPI_STRLEN (user_prt->source) + 1; /* include null terminator */
+ break;
- user_prt->length += STRLEN (user_prt->source) + 1; /* include null terminator */
- break;
+ case ACPI_TYPE_STRING:
- case ACPI_TYPE_STRING:
+ ACPI_STRCPY (user_prt->source,
+ (*sub_object_list)->string.pointer);
- STRCPY (user_prt->source,
- (*sub_object_list)->string.pointer);
+ /* Add to the Length field the length of the string */
- /*
- * Add to the Length field the length of the string
- */
- user_prt->length += (*sub_object_list)->string.length;
- break;
+ user_prt->length += (*sub_object_list)->string.length;
+ break;
- case ACPI_TYPE_INTEGER:
- /*
- * If this is a number, then the Source Name
- * is NULL, since the entire buffer was zeroed
- * out, we can leave this alone.
- */
- /*
- * Add to the Length field the length of
- * the u32 NULL
- */
- user_prt->length += sizeof (u32);
- break;
+ case ACPI_TYPE_INTEGER:
+ /*
+ * If this is a number, then the Source Name is NULL, since the
+ * entire buffer was zeroed out, we can leave this alone.
+ *
+ * Add to the Length field the length of the u32 NULL
+ */
+ user_prt->length += sizeof (u32);
+ break;
- default:
+ default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n",
- acpi_ut_get_type_name ((*sub_object_list)->common.type)));
- return_ACPI_STATUS (AE_BAD_DATA);
- break;
- }
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n",
+ acpi_ut_get_type_name ((*sub_object_list)->common.type)));
+ return_ACPI_STATUS (AE_BAD_DATA);
+ }
- /* Now align the current length */
+ /* Now align the current length */
- user_prt->length = ROUND_UP_TO_64_bITS (user_prt->length);
+ user_prt->length = ACPI_ROUND_UP_TO_64_bITS (user_prt->length);
- /*
- * 4) Fourth subobject: Dereference the Source Index
- */
- sub_object_list++;
-
- if (ACPI_TYPE_INTEGER == (*sub_object_list)->common.type) {
- user_prt->source_index = (u32) (*sub_object_list)->integer.value;
- }
-
- else {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n",
- acpi_ut_get_type_name ((*sub_object_list)->common.type)));
- return_ACPI_STATUS (AE_BAD_DATA);
- }
+ /*
+ * 4) Fourth subobject: Dereference the Source Index
+ */
+ sub_object_list++;
- /*
- * Point to the next acpi_operand_object
- */
- top_object_list++;
+ if (ACPI_TYPE_INTEGER == (*sub_object_list)->common.type) {
+ user_prt->source_index = (u32) (*sub_object_list)->integer.value;
+ }
+ else {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n",
+ acpi_ut_get_type_name ((*sub_object_list)->common.type)));
+ return_ACPI_STATUS (AE_BAD_DATA);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Output_buffer = %p\n", output_buffer));
- }
-
- else {
- *output_buffer_length = buffer_size_needed;
+ /* Point to the next acpi_operand_object */
- return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
+ top_object_list++;
}
- /*
- * Report the amount of buffer used
- */
- *output_buffer_length = buffer_size_needed;
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Output_buffer %p Length %X\n",
+ output_buffer->pointer, output_buffer->length));
return_ACPI_STATUS (AE_OK);
}
*
* PARAMETERS: Linked_list_buffer - Pointer to the resource linked list
* Output_buffer - Pointer to the user's buffer
- * Output_buffer_length - Size of Output_buffer
*
* RETURN: Status AE_OK if okay, else a valid acpi_status code.
* If the Output_buffer is too small, the error will be
- * AE_BUFFER_OVERFLOW and Output_buffer_length will point
+ * AE_BUFFER_OVERFLOW and Output_buffer->Length will point
* to the size buffer needed.
*
* DESCRIPTION: Takes the linked list of device resources and
acpi_status
acpi_rs_create_byte_stream (
acpi_resource *linked_list_buffer,
- u8 *output_buffer,
- u32 *output_buffer_length)
+ acpi_buffer *output_buffer)
{
acpi_status status;
- u32 byte_stream_size_needed = 0;
+ ACPI_SIZE byte_stream_size_needed = 0;
- FUNCTION_TRACE ("Rs_create_byte_stream");
+ ACPI_FUNCTION_TRACE ("Rs_create_byte_stream");
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Linked_list_buffer = %p\n", linked_list_buffer));
/*
* Params already validated, so we don't re-validate here
*
- * Pass the Linked_list_buffer into a module that can calculate
+ * Pass the Linked_list_buffer into a module that calculates
* the buffer size needed for the byte stream.
*/
status = acpi_rs_calculate_byte_stream_length (linked_list_buffer,
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Byte_stream_size_needed=%X, %s\n",
byte_stream_size_needed, acpi_format_exception (status)));
-
- /*
- * Exit with the error passed back
- */
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
- /*
- * If the linked list will fit into the available buffer
- * call to fill in the list
- */
- if (byte_stream_size_needed <= *output_buffer_length) {
- /*
- * Zero out the return buffer before proceeding
- */
- MEMSET (output_buffer, 0x00, *output_buffer_length);
-
- status = acpi_rs_list_to_byte_stream (linked_list_buffer, byte_stream_size_needed,
- &output_buffer);
+ /* Validate/Allocate/Clear caller buffer */
- /*
- * Exit with the error passed back
- */
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Output_buffer = %p\n", output_buffer));
+ status = acpi_ut_initialize_buffer (output_buffer, byte_stream_size_needed);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
}
- else {
- *output_buffer_length = byte_stream_size_needed;
- return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
+ /* Do the conversion */
+
+ status = acpi_rs_list_to_byte_stream (linked_list_buffer, byte_stream_size_needed,
+ output_buffer->pointer);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
}
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Output_buffer %p Length %X\n",
+ output_buffer->pointer, output_buffer->length));
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
* Module Name: rsdump - Functions to display the resource structures.
- * $Revision: 23 $
+ * $Revision: 29 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acresrc.h"
#define _COMPONENT ACPI_RESOURCES
- MODULE_NAME ("rsdump")
+ ACPI_MODULE_NAME ("rsdump")
#ifdef ACPI_DEBUG
u8 index = 0;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
acpi_os_printf ("IRQ Resource\n");
acpi_os_printf (" %s Triggered\n",
- LEVEL_SENSITIVE == irq_data->edge_level ? "Level" : "Edge");
+ ACPI_LEVEL_SENSITIVE == irq_data->edge_level ? "Level" : "Edge");
acpi_os_printf (" Active %s\n",
- ACTIVE_LOW == irq_data->active_high_low ? "Low" : "High");
+ ACPI_ACTIVE_LOW == irq_data->active_high_low ? "Low" : "High");
acpi_os_printf (" %s\n",
- SHARED == irq_data->shared_exclusive ? "Shared" : "Exclusive");
+ ACPI_SHARED == irq_data->shared_exclusive ? "Shared" : "Exclusive");
acpi_os_printf (" %X Interrupts ( ", irq_data->number_of_interrupts);
u8 index = 0;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
acpi_os_printf ("DMA Resource\n");
switch (dma_data->type) {
- case COMPATIBILITY:
+ case ACPI_COMPATIBILITY:
acpi_os_printf (" Compatibility mode\n");
break;
- case TYPE_A:
+ case ACPI_TYPE_A:
acpi_os_printf (" Type A\n");
break;
- case TYPE_B:
+ case ACPI_TYPE_B:
acpi_os_printf (" Type B\n");
break;
- case TYPE_F:
+ case ACPI_TYPE_F:
acpi_os_printf (" Type F\n");
break;
}
acpi_os_printf (" %sBus Master\n",
- BUS_MASTER == dma_data->bus_master ? "" : "Not a ");
+ ACPI_BUS_MASTER == dma_data->bus_master ? "" : "Not a ");
switch (dma_data->transfer) {
- case TRANSFER_8:
+ case ACPI_TRANSFER_8:
acpi_os_printf (" 8-bit only transfer\n");
break;
- case TRANSFER_8_16:
+ case ACPI_TRANSFER_8_16:
acpi_os_printf (" 8 and 16-bit transfer\n");
break;
- case TRANSFER_16:
+ case ACPI_TRANSFER_16:
acpi_os_printf (" 16 bit only transfer\n");
break;
/*******************************************************************************
*
- * FUNCTION: Acpi_rs_dump_start_dependent_functions
+ * FUNCTION: Acpi_rs_dump_start_depend_fns
*
* PARAMETERS: Data - pointer to the resource structure to dump.
*
******************************************************************************/
void
-acpi_rs_dump_start_dependent_functions (
+acpi_rs_dump_start_depend_fns (
acpi_resource_data *data)
{
acpi_resource_start_dpf *sdf_data = (acpi_resource_start_dpf *) data;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
acpi_os_printf ("Start Dependent Functions Resource\n");
switch (sdf_data->compatibility_priority) {
- case GOOD_CONFIGURATION:
+ case ACPI_GOOD_CONFIGURATION:
acpi_os_printf (" Good configuration\n");
break;
- case ACCEPTABLE_CONFIGURATION:
+ case ACPI_ACCEPTABLE_CONFIGURATION:
acpi_os_printf (" Acceptable configuration\n");
break;
- case SUB_OPTIMAL_CONFIGURATION:
+ case ACPI_SUB_OPTIMAL_CONFIGURATION:
acpi_os_printf (" Sub-optimal configuration\n");
break;
}
switch(sdf_data->performance_robustness) {
- case GOOD_CONFIGURATION:
+ case ACPI_GOOD_CONFIGURATION:
acpi_os_printf (" Good configuration\n");
break;
- case ACCEPTABLE_CONFIGURATION:
+ case ACPI_ACCEPTABLE_CONFIGURATION:
acpi_os_printf (" Acceptable configuration\n");
break;
- case SUB_OPTIMAL_CONFIGURATION:
+ case ACPI_SUB_OPTIMAL_CONFIGURATION:
acpi_os_printf (" Sub-optimal configuration\n");
break;
acpi_resource_io *io_data = (acpi_resource_io *) data;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
acpi_os_printf ("Io Resource\n");
acpi_os_printf (" %d bit decode\n",
- DECODE_16 == io_data->io_decode ? 16 : 10);
+ ACPI_DECODE_16 == io_data->io_decode ? 16 : 10);
acpi_os_printf (" Range minimum base: %08X\n",
io_data->min_base_address);
acpi_resource_fixed_io *fixed_io_data = (acpi_resource_fixed_io *) data;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
acpi_os_printf ("Fixed Io Resource\n");
u16 index = 0;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
acpi_os_printf ("Vendor Specific Resource\n");
acpi_resource_mem24 *memory24_data = (acpi_resource_mem24 *) data;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
acpi_os_printf ("24-Bit Memory Range Resource\n");
acpi_os_printf (" Read%s\n",
- READ_WRITE_MEMORY ==
+ ACPI_READ_WRITE_MEMORY ==
memory24_data->read_write_attribute ?
"/Write" : " only");
acpi_resource_mem32 *memory32_data = (acpi_resource_mem32 *) data;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
acpi_os_printf ("32-Bit Memory Range Resource\n");
acpi_os_printf (" Read%s\n",
- READ_WRITE_MEMORY ==
+ ACPI_READ_WRITE_MEMORY ==
memory32_data->read_write_attribute ?
"/Write" : " only");
acpi_resource_fixed_mem32 *fixed_memory32_data = (acpi_resource_fixed_mem32 *) data;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
acpi_os_printf ("32-Bit Fixed Location Memory Range Resource\n");
acpi_os_printf (" Read%s\n",
- READ_WRITE_MEMORY ==
+ ACPI_READ_WRITE_MEMORY ==
fixed_memory32_data->read_write_attribute ?
"/Write" : " Only");
acpi_resource_address16 *address16_data = (acpi_resource_address16 *) data;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
acpi_os_printf ("16-Bit Address Space Resource\n");
acpi_os_printf (" Resource Type: ");
switch (address16_data->resource_type) {
- case MEMORY_RANGE:
+ case ACPI_MEMORY_RANGE:
acpi_os_printf ("Memory Range\n");
switch (address16_data->attribute.memory.cache_attribute) {
- case NON_CACHEABLE_MEMORY:
+ case ACPI_NON_CACHEABLE_MEMORY:
acpi_os_printf (" Type Specific: "
"Noncacheable memory\n");
break;
- case CACHABLE_MEMORY:
+ case ACPI_CACHABLE_MEMORY:
acpi_os_printf (" Type Specific: "
"Cacheable memory\n");
break;
- case WRITE_COMBINING_MEMORY:
+ case ACPI_WRITE_COMBINING_MEMORY:
acpi_os_printf (" Type Specific: "
"Write-combining memory\n");
break;
- case PREFETCHABLE_MEMORY:
+ case ACPI_PREFETCHABLE_MEMORY:
acpi_os_printf (" Type Specific: "
"Prefetchable memory\n");
break;
}
acpi_os_printf (" Type Specific: Read%s\n",
- READ_WRITE_MEMORY ==
+ ACPI_READ_WRITE_MEMORY ==
address16_data->attribute.memory.read_write_attribute ?
"/Write" : " Only");
break;
- case IO_RANGE:
+ case ACPI_IO_RANGE:
acpi_os_printf ("I/O Range\n");
switch (address16_data->attribute.io.range_attribute) {
- case NON_ISA_ONLY_RANGES:
+ case ACPI_NON_ISA_ONLY_RANGES:
acpi_os_printf (" Type Specific: "
"Non-ISA Io Addresses\n");
break;
- case ISA_ONLY_RANGES:
+ case ACPI_ISA_ONLY_RANGES:
acpi_os_printf (" Type Specific: "
"ISA Io Addresses\n");
break;
- case ENTIRE_RANGE:
+ case ACPI_ENTIRE_RANGE:
acpi_os_printf (" Type Specific: "
"ISA and non-ISA Io Addresses\n");
break;
}
break;
- case BUS_NUMBER_RANGE:
+ case ACPI_BUS_NUMBER_RANGE:
acpi_os_printf ("Bus Number Range\n");
break;
}
acpi_os_printf (" Resource %s\n",
- CONSUMER == address16_data->producer_consumer ?
+ ACPI_CONSUMER == address16_data->producer_consumer ?
"Consumer" : "Producer");
acpi_os_printf (" %s decode\n",
- SUB_DECODE == address16_data->decode ?
+ ACPI_SUB_DECODE == address16_data->decode ?
"Subtractive" : "Positive");
acpi_os_printf (" Min address is %s fixed\n",
- ADDRESS_FIXED == address16_data->min_address_fixed ?
+ ACPI_ADDRESS_FIXED == address16_data->min_address_fixed ?
"" : "not");
acpi_os_printf (" Max address is %s fixed\n",
- ADDRESS_FIXED == address16_data->max_address_fixed ?
+ ACPI_ADDRESS_FIXED == address16_data->max_address_fixed ?
"" : "not");
acpi_os_printf (" Granularity: %08X\n",
acpi_resource_address32 *address32_data = (acpi_resource_address32 *) data;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
acpi_os_printf ("32-Bit Address Space Resource\n");
switch (address32_data->resource_type) {
- case MEMORY_RANGE:
+ case ACPI_MEMORY_RANGE:
acpi_os_printf (" Resource Type: Memory Range\n");
switch (address32_data->attribute.memory.cache_attribute) {
- case NON_CACHEABLE_MEMORY:
+ case ACPI_NON_CACHEABLE_MEMORY:
acpi_os_printf (" Type Specific: "
"Noncacheable memory\n");
break;
- case CACHABLE_MEMORY:
+ case ACPI_CACHABLE_MEMORY:
acpi_os_printf (" Type Specific: "
"Cacheable memory\n");
break;
- case WRITE_COMBINING_MEMORY:
+ case ACPI_WRITE_COMBINING_MEMORY:
acpi_os_printf (" Type Specific: "
"Write-combining memory\n");
break;
- case PREFETCHABLE_MEMORY:
+ case ACPI_PREFETCHABLE_MEMORY:
acpi_os_printf (" Type Specific: "
"Prefetchable memory\n");
break;
}
acpi_os_printf (" Type Specific: Read%s\n",
- READ_WRITE_MEMORY ==
+ ACPI_READ_WRITE_MEMORY ==
address32_data->attribute.memory.read_write_attribute ?
"/Write" : " Only");
break;
- case IO_RANGE:
+ case ACPI_IO_RANGE:
acpi_os_printf (" Resource Type: Io Range\n");
switch (address32_data->attribute.io.range_attribute) {
- case NON_ISA_ONLY_RANGES:
+ case ACPI_NON_ISA_ONLY_RANGES:
acpi_os_printf (" Type Specific: "
"Non-ISA Io Addresses\n");
break;
- case ISA_ONLY_RANGES:
+ case ACPI_ISA_ONLY_RANGES:
acpi_os_printf (" Type Specific: "
"ISA Io Addresses\n");
break;
- case ENTIRE_RANGE:
+ case ACPI_ENTIRE_RANGE:
acpi_os_printf (" Type Specific: "
"ISA and non-ISA Io Addresses\n");
break;
}
break;
- case BUS_NUMBER_RANGE:
+ case ACPI_BUS_NUMBER_RANGE:
acpi_os_printf (" Resource Type: Bus Number Range\n");
break;
}
acpi_os_printf (" Resource %s\n",
- CONSUMER == address32_data->producer_consumer ?
+ ACPI_CONSUMER == address32_data->producer_consumer ?
"Consumer" : "Producer");
acpi_os_printf (" %s decode\n",
- SUB_DECODE == address32_data->decode ?
+ ACPI_SUB_DECODE == address32_data->decode ?
"Subtractive" : "Positive");
acpi_os_printf (" Min address is %s fixed\n",
- ADDRESS_FIXED == address32_data->min_address_fixed ?
+ ACPI_ADDRESS_FIXED == address32_data->min_address_fixed ?
"" : "not ");
acpi_os_printf (" Max address is %s fixed\n",
- ADDRESS_FIXED == address32_data->max_address_fixed ?
+ ACPI_ADDRESS_FIXED == address32_data->max_address_fixed ?
"" : "not ");
acpi_os_printf (" Granularity: %08X\n",
acpi_resource_address64 *address64_data = (acpi_resource_address64 *) data;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
acpi_os_printf ("64-Bit Address Space Resource\n");
switch (address64_data->resource_type) {
- case MEMORY_RANGE:
+ case ACPI_MEMORY_RANGE:
acpi_os_printf (" Resource Type: Memory Range\n");
switch (address64_data->attribute.memory.cache_attribute) {
- case NON_CACHEABLE_MEMORY:
+ case ACPI_NON_CACHEABLE_MEMORY:
acpi_os_printf (" Type Specific: "
"Noncacheable memory\n");
break;
- case CACHABLE_MEMORY:
+ case ACPI_CACHABLE_MEMORY:
acpi_os_printf (" Type Specific: "
"Cacheable memory\n");
break;
- case WRITE_COMBINING_MEMORY:
+ case ACPI_WRITE_COMBINING_MEMORY:
acpi_os_printf (" Type Specific: "
"Write-combining memory\n");
break;
- case PREFETCHABLE_MEMORY:
+ case ACPI_PREFETCHABLE_MEMORY:
acpi_os_printf (" Type Specific: "
"Prefetchable memory\n");
break;
}
acpi_os_printf (" Type Specific: Read%s\n",
- READ_WRITE_MEMORY ==
+ ACPI_READ_WRITE_MEMORY ==
address64_data->attribute.memory.read_write_attribute ?
"/Write" : " Only");
break;
- case IO_RANGE:
+ case ACPI_IO_RANGE:
acpi_os_printf (" Resource Type: Io Range\n");
switch (address64_data->attribute.io.range_attribute) {
- case NON_ISA_ONLY_RANGES:
+ case ACPI_NON_ISA_ONLY_RANGES:
acpi_os_printf (" Type Specific: "
"Non-ISA Io Addresses\n");
break;
- case ISA_ONLY_RANGES:
+ case ACPI_ISA_ONLY_RANGES:
acpi_os_printf (" Type Specific: "
"ISA Io Addresses\n");
break;
- case ENTIRE_RANGE:
+ case ACPI_ENTIRE_RANGE:
acpi_os_printf (" Type Specific: "
"ISA and non-ISA Io Addresses\n");
break;
}
break;
- case BUS_NUMBER_RANGE:
+ case ACPI_BUS_NUMBER_RANGE:
acpi_os_printf (" Resource Type: Bus Number Range\n");
break;
}
acpi_os_printf (" Resource %s\n",
- CONSUMER == address64_data->producer_consumer ?
+ ACPI_CONSUMER == address64_data->producer_consumer ?
"Consumer" : "Producer");
acpi_os_printf (" %s decode\n",
- SUB_DECODE == address64_data->decode ?
+ ACPI_SUB_DECODE == address64_data->decode ?
"Subtractive" : "Positive");
acpi_os_printf (" Min address is %s fixed\n",
- ADDRESS_FIXED == address64_data->min_address_fixed ?
+ ACPI_ADDRESS_FIXED == address64_data->min_address_fixed ?
"" : "not ");
acpi_os_printf (" Max address is %s fixed\n",
- ADDRESS_FIXED == address64_data->max_address_fixed ?
+ ACPI_ADDRESS_FIXED == address64_data->max_address_fixed ?
"" : "not ");
acpi_os_printf (" Granularity: %16X\n",
u8 index = 0;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
acpi_os_printf ("Extended IRQ Resource\n");
acpi_os_printf (" Resource %s\n",
- CONSUMER == ext_irq_data->producer_consumer ?
+ ACPI_CONSUMER == ext_irq_data->producer_consumer ?
"Consumer" : "Producer");
acpi_os_printf (" %s\n",
- LEVEL_SENSITIVE == ext_irq_data->edge_level ?
+ ACPI_LEVEL_SENSITIVE == ext_irq_data->edge_level ?
"Level" : "Edge");
acpi_os_printf (" Active %s\n",
- ACTIVE_LOW == ext_irq_data->active_high_low ?
+ ACPI_ACTIVE_LOW == ext_irq_data->active_high_low ?
"low" : "high");
acpi_os_printf (" %s\n",
- SHARED == ext_irq_data->shared_exclusive ?
+ ACPI_SHARED == ext_irq_data->shared_exclusive ?
"Shared" : "Exclusive");
acpi_os_printf (" Interrupts : %X ( ",
u8 done = FALSE;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
if (acpi_dbg_level & ACPI_LV_RESOURCES && _COMPONENT & acpi_dbg_layer) {
break;
case ACPI_RSTYPE_START_DPF:
- acpi_rs_dump_start_dependent_functions (&resource->data);
+ acpi_rs_dump_start_depend_fns (&resource->data);
break;
case ACPI_RSTYPE_END_DPF:
}
- resource = POINTER_ADD (acpi_resource, resource, resource->length);
+ resource = ACPI_PTR_ADD (acpi_resource, resource, resource->length);
}
}
void
acpi_rs_dump_irq_list (
- u8 *route_table)
+ u8 *route_table)
{
- u8 *buffer = route_table;
- u8 count = 0;
- u8 done = FALSE;
- pci_routing_table *prt_element;
+ u8 *buffer = route_table;
+ u8 count = 0;
+ u8 done = FALSE;
+ acpi_pci_routing_table *prt_element;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
if (acpi_dbg_level & ACPI_LV_RESOURCES && _COMPONENT & acpi_dbg_layer) {
- prt_element = (pci_routing_table *) buffer;
+ prt_element = (acpi_pci_routing_table *) buffer;
while (!done) {
acpi_os_printf ("PCI IRQ Routing Table structure %X.\n", count++);
- acpi_os_printf (" Address: %X\n",
- prt_element->address);
+ acpi_os_printf (" Address: %8.8X%8.8X\n",
+ ACPI_HIDWORD (prt_element->address),
+ ACPI_LODWORD (prt_element->address));
acpi_os_printf (" Pin: %X\n", prt_element->pin);
buffer += prt_element->length;
- prt_element = (pci_routing_table *) buffer;
+ prt_element = (acpi_pci_routing_table *) buffer;
if(0 == prt_element->length) {
done = TRUE;
/*******************************************************************************
*
* Module Name: rsio - IO and DMA resource descriptors
- * $Revision: 14 $
+ * $Revision: 17 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acresrc.h"
#define _COMPONENT ACPI_RESOURCES
- MODULE_NAME ("rsio")
+ ACPI_MODULE_NAME ("rsio")
/*******************************************************************************
*
* PARAMETERS: Byte_stream_buffer - Pointer to the resource input byte
* stream
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes consumed from
- * the Byte_stream_buffer
- * Output_buffer - Pointer to the user's return buffer
- * Structure_size - u32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * Bytes_consumed - Pointer to where the number of bytes
+ * consumed the Byte_stream_buffer is
+ * returned
+ * Output_buffer - Pointer to the return data buffer
+ * Structure_size - Pointer to where the number of bytes
+ * in the return data struct is returned
*
* RETURN: Status
*
acpi_status
acpi_rs_io_resource (
u8 *byte_stream_buffer,
- u32 *bytes_consumed,
+ ACPI_SIZE *bytes_consumed,
u8 **output_buffer,
- u32 *structure_size)
+ ACPI_SIZE *structure_size)
{
u8 *buffer = byte_stream_buffer;
acpi_resource *output_struct = (acpi_resource *) *output_buffer;
u16 temp16 = 0;
u8 temp8 = 0;
- u32 struct_size = SIZEOF_RESOURCE (acpi_resource_io);
+ ACPI_SIZE struct_size = ACPI_SIZEOF_RESOURCE (acpi_resource_io);
- FUNCTION_TRACE ("Rs_io_resource");
+ ACPI_FUNCTION_TRACE ("Rs_io_resource");
/*
* Check Min_base Address
*/
buffer += 1;
- MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
output_struct->data.io.min_base_address = temp16;
* Check Max_base Address
*/
buffer += 2;
- MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
output_struct->data.io.max_base_address = temp16;
*
* PARAMETERS: Byte_stream_buffer - Pointer to the resource input byte
* stream
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes consumed from
- * the Byte_stream_buffer
- * Output_buffer - Pointer to the user's return buffer
- * Structure_size - u32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * Bytes_consumed - Pointer to where the number of bytes
+ * consumed the Byte_stream_buffer is
+ * returned
+ * Output_buffer - Pointer to the return data buffer
+ * Structure_size - Pointer to where the number of bytes
+ * in the return data struct is returned
*
* RETURN: Status
*
acpi_status
acpi_rs_fixed_io_resource (
u8 *byte_stream_buffer,
- u32 *bytes_consumed,
+ ACPI_SIZE *bytes_consumed,
u8 **output_buffer,
- u32 *structure_size)
+ ACPI_SIZE *structure_size)
{
u8 *buffer = byte_stream_buffer;
acpi_resource *output_struct = (acpi_resource *) *output_buffer;
u16 temp16 = 0;
u8 temp8 = 0;
- u32 struct_size = SIZEOF_RESOURCE (acpi_resource_fixed_io);
+ ACPI_SIZE struct_size = ACPI_SIZEOF_RESOURCE (acpi_resource_fixed_io);
- FUNCTION_TRACE ("Rs_fixed_io_resource");
+ ACPI_FUNCTION_TRACE ("Rs_fixed_io_resource");
/*
* Check Range Base Address
*/
buffer += 1;
- MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
output_struct->data.fixed_io.base_address = temp16;
*
* PARAMETERS: Linked_list - Pointer to the resource linked list
* Output_buffer - Pointer to the user's return buffer
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes of the
- * Output_buffer used
+ * Bytes_consumed - Pointer to where the number of bytes
+ * used in the Output_buffer is returned
*
* RETURN: Status
*
acpi_rs_io_stream (
acpi_resource *linked_list,
u8 **output_buffer,
- u32 *bytes_consumed)
+ ACPI_SIZE *bytes_consumed)
{
u8 *buffer = *output_buffer;
u16 temp16 = 0;
u8 temp8 = 0;
- FUNCTION_TRACE ("Rs_io_stream");
+ ACPI_FUNCTION_TRACE ("Rs_io_stream");
/*
*/
temp16 = (u16) linked_list->data.io.min_base_address;
- MOVE_UNALIGNED16_TO_16 (buffer, &temp16);
+ ACPI_MOVE_UNALIGNED16_TO_16 (buffer, &temp16);
buffer += 2;
/*
*/
temp16 = (u16) linked_list->data.io.max_base_address;
- MOVE_UNALIGNED16_TO_16 (buffer, &temp16);
+ ACPI_MOVE_UNALIGNED16_TO_16 (buffer, &temp16);
buffer += 2;
/*
/*
* Return the number of bytes consumed in this operation
*/
- *bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
+ *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
return_ACPI_STATUS (AE_OK);
}
*
* PARAMETERS: Linked_list - Pointer to the resource linked list
* Output_buffer - Pointer to the user's return buffer
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes of the
- * Output_buffer used
+ * Bytes_consumed - Pointer to where the number of bytes
+ * used in the Output_buffer is returned
*
* RETURN: Status
*
acpi_rs_fixed_io_stream (
acpi_resource *linked_list,
u8 **output_buffer,
- u32 *bytes_consumed)
+ ACPI_SIZE *bytes_consumed)
{
u8 *buffer = *output_buffer;
u16 temp16 = 0;
u8 temp8 = 0;
- FUNCTION_TRACE ("Rs_fixed_io_stream");
+ ACPI_FUNCTION_TRACE ("Rs_fixed_io_stream");
/*
*/
temp16 = (u16) linked_list->data.fixed_io.base_address;
- MOVE_UNALIGNED16_TO_16 (buffer, &temp16);
+ ACPI_MOVE_UNALIGNED16_TO_16 (buffer, &temp16);
buffer += 2;
/*
/*
* Return the number of bytes consumed in this operation
*/
- *bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
+ *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
return_ACPI_STATUS (AE_OK);
}
*
* PARAMETERS: Byte_stream_buffer - Pointer to the resource input byte
* stream
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes consumed from
- * the Byte_stream_buffer
- * Output_buffer - Pointer to the user's return buffer
- * Structure_size - u32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * Bytes_consumed - Pointer to where the number of bytes
+ * consumed the Byte_stream_buffer is
+ * returned
+ * Output_buffer - Pointer to the return data buffer
+ * Structure_size - Pointer to where the number of bytes
+ * in the return data struct is returned
*
* RETURN: Status
*
acpi_status
acpi_rs_dma_resource (
u8 *byte_stream_buffer,
- u32 *bytes_consumed,
+ ACPI_SIZE *bytes_consumed,
u8 **output_buffer,
- u32 *structure_size)
+ ACPI_SIZE *structure_size)
{
u8 *buffer = byte_stream_buffer;
acpi_resource *output_struct = (acpi_resource *) *output_buffer;
u8 temp8 = 0;
u8 index;
u8 i;
- u32 struct_size = SIZEOF_RESOURCE (acpi_resource_dma);
+ ACPI_SIZE struct_size = ACPI_SIZEOF_RESOURCE (acpi_resource_dma);
- FUNCTION_TRACE ("Rs_dma_resource");
+ ACPI_FUNCTION_TRACE ("Rs_dma_resource");
/*
*
* PARAMETERS: Linked_list - Pointer to the resource linked list
* Output_buffer - Pointer to the user's return buffer
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes of the
- * Output_buffer used
+ * Bytes_consumed - Pointer to where the number of bytes
+ * used in the Output_buffer is returned
*
* RETURN: Status
*
acpi_rs_dma_stream (
acpi_resource *linked_list,
u8 **output_buffer,
- u32 *bytes_consumed)
+ ACPI_SIZE *bytes_consumed)
{
u8 *buffer = *output_buffer;
u16 temp16 = 0;
u8 index;
- FUNCTION_TRACE ("Rs_dma_stream");
+ ACPI_FUNCTION_TRACE ("Rs_dma_stream");
/*
/*
* Return the number of bytes consumed in this operation
*/
- *bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
+ *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
* Module Name: rsirq - IRQ resource descriptors
- * $Revision: 18 $
+ * $Revision: 24 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acresrc.h"
#define _COMPONENT ACPI_RESOURCES
- MODULE_NAME ("rsirq")
+ ACPI_MODULE_NAME ("rsirq")
/*******************************************************************************
*
* PARAMETERS: Byte_stream_buffer - Pointer to the resource input byte
* stream
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes consumed from
- * the Byte_stream_buffer
- * Output_buffer - Pointer to the user's return buffer
- * Structure_size - u32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * Bytes_consumed - Pointer to where the number of bytes
+ * consumed the Byte_stream_buffer is
+ * returned
+ * Output_buffer - Pointer to the return data buffer
+ * Structure_size - Pointer to where the number of bytes
+ * in the return data struct is returned
*
* RETURN: Status
*
acpi_status
acpi_rs_irq_resource (
u8 *byte_stream_buffer,
- u32 *bytes_consumed,
+ ACPI_SIZE *bytes_consumed,
u8 **output_buffer,
- u32 *structure_size)
+ ACPI_SIZE *structure_size)
{
u8 *buffer = byte_stream_buffer;
acpi_resource *output_struct = (acpi_resource *) *output_buffer;
u8 temp8 = 0;
u8 index;
u8 i;
- u32 struct_size = SIZEOF_RESOURCE (acpi_resource_irq);
+ ACPI_SIZE struct_size = ACPI_SIZEOF_RESOURCE (acpi_resource_irq);
- FUNCTION_TRACE ("Rs_irq_resource");
+ ACPI_FUNCTION_TRACE ("Rs_irq_resource");
/*
* Point to the 16-bits of Bytes 1 and 2
*/
buffer += 1;
- MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
output_struct->data.irq.number_of_interrupts = 0;
* Check for HE, LL or HL
*/
if (temp8 & 0x01) {
- output_struct->data.irq.edge_level = EDGE_SENSITIVE;
- output_struct->data.irq.active_high_low = ACTIVE_HIGH;
+ output_struct->data.irq.edge_level = ACPI_EDGE_SENSITIVE;
+ output_struct->data.irq.active_high_low = ACPI_ACTIVE_HIGH;
}
-
else {
if (temp8 & 0x8) {
- output_struct->data.irq.edge_level = LEVEL_SENSITIVE;
- output_struct->data.irq.active_high_low = ACTIVE_LOW;
+ output_struct->data.irq.edge_level = ACPI_LEVEL_SENSITIVE;
+ output_struct->data.irq.active_high_low = ACPI_ACTIVE_LOW;
}
-
else {
/*
* Only _LL and _HE polarity/trigger interrupts
*/
output_struct->data.irq.shared_exclusive = (temp8 >> 3) & 0x01;
}
-
else {
/*
* Assume Edge Sensitive, Active High, Non-Sharable
* per ACPI Specification
*/
- output_struct->data.irq.edge_level = EDGE_SENSITIVE;
- output_struct->data.irq.active_high_low = ACTIVE_HIGH;
- output_struct->data.irq.shared_exclusive = EXCLUSIVE;
+ output_struct->data.irq.edge_level = ACPI_EDGE_SENSITIVE;
+ output_struct->data.irq.active_high_low = ACPI_ACTIVE_HIGH;
+ output_struct->data.irq.shared_exclusive = ACPI_EXCLUSIVE;
}
/*
*
* PARAMETERS: Linked_list - Pointer to the resource linked list
* Output_buffer - Pointer to the user's return buffer
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes of the
- * Output_buffer used
+ * Bytes_consumed - Pointer to where the number of bytes
+ * used in the Output_buffer is returned
*
* RETURN: Status
*
acpi_rs_irq_stream (
acpi_resource *linked_list,
u8 **output_buffer,
- u32 *bytes_consumed)
+ ACPI_SIZE *bytes_consumed)
{
u8 *buffer = *output_buffer;
u16 temp16 = 0;
u8 IRQinfo_byte_needed;
- FUNCTION_TRACE ("Rs_irq_stream");
+ ACPI_FUNCTION_TRACE ("Rs_irq_stream");
/*
* The descriptor field is set based upon whether a third byte is
* needed to contain the IRQ Information.
*/
- if (EDGE_SENSITIVE == linked_list->data.irq.edge_level &&
- ACTIVE_HIGH == linked_list->data.irq.active_high_low &&
- EXCLUSIVE == linked_list->data.irq.shared_exclusive) {
+ if (ACPI_EDGE_SENSITIVE == linked_list->data.irq.edge_level &&
+ ACPI_ACTIVE_HIGH == linked_list->data.irq.active_high_low &&
+ ACPI_EXCLUSIVE == linked_list->data.irq.shared_exclusive) {
*buffer = 0x22;
IRQinfo_byte_needed = FALSE;
}
-
else {
*buffer = 0x23;
IRQinfo_byte_needed = TRUE;
temp16 |= 0x1 << temp8;
}
- MOVE_UNALIGNED16_TO_16 (buffer, &temp16);
+ ACPI_MOVE_UNALIGNED16_TO_16 (buffer, &temp16);
buffer += 2;
/*
temp8 = (u8) ((linked_list->data.irq.shared_exclusive &
0x01) << 4);
- if (LEVEL_SENSITIVE == linked_list->data.irq.edge_level &&
- ACTIVE_LOW == linked_list->data.irq.active_high_low) {
+ if (ACPI_LEVEL_SENSITIVE == linked_list->data.irq.edge_level &&
+ ACPI_ACTIVE_LOW == linked_list->data.irq.active_high_low) {
temp8 |= 0x08;
}
-
else {
temp8 |= 0x01;
}
/*
* Return the number of bytes consumed in this operation
*/
- *bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
+ *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
return_ACPI_STATUS (AE_OK);
}
*
* PARAMETERS: Byte_stream_buffer - Pointer to the resource input byte
* stream
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes consumed from
- * the Byte_stream_buffer
- * Output_buffer - Pointer to the user's return buffer
- * Structure_size - u32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * Bytes_consumed - Pointer to where the number of bytes
+ * consumed the Byte_stream_buffer is
+ * returned
+ * Output_buffer - Pointer to the return data buffer
+ * Structure_size - Pointer to where the number of bytes
+ * in the return data struct is returned
*
* RETURN: Status
*
acpi_status
acpi_rs_extended_irq_resource (
u8 *byte_stream_buffer,
- u32 *bytes_consumed,
+ ACPI_SIZE *bytes_consumed,
u8 **output_buffer,
- u32 *structure_size)
+ ACPI_SIZE *structure_size)
{
u8 *buffer = byte_stream_buffer;
acpi_resource *output_struct = (acpi_resource *) *output_buffer;
u8 temp8 = 0;
NATIVE_CHAR *temp_ptr;
u8 index;
- u32 struct_size = SIZEOF_RESOURCE (acpi_resource_ext_irq);
+ ACPI_SIZE struct_size = ACPI_SIZEOF_RESOURCE (acpi_resource_ext_irq);
- FUNCTION_TRACE ("Rs_extended_irq_resource");
+ ACPI_FUNCTION_TRACE ("Rs_extended_irq_resource");
/*
* Point past the Descriptor to get the number of bytes consumed
*/
buffer += 1;
- MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
*bytes_consumed = temp16 + 3;
output_struct->id = ACPI_RSTYPE_EXT_IRQ;
output_struct->data.extended_irq.producer_consumer = temp8 & 0x01;
/*
- * Check for HE, LL or HL
+ * Check for Interrupt Mode
+ *
+ * The definition of an Extended IRQ changed between ACPI spec v1.0b
+ * and ACPI spec 2.0 (section 6.4.3.6 in both).
+ *
+ * - Edge/Level are defined opposite in the table vs the headers
*/
- if(temp8 & 0x02) {
- output_struct->data.extended_irq.edge_level = EDGE_SENSITIVE;
- output_struct->data.extended_irq.active_high_low = ACTIVE_HIGH;
- }
-
- else {
- if(temp8 & 0x4) {
- output_struct->data.extended_irq.edge_level = LEVEL_SENSITIVE;
- output_struct->data.extended_irq.active_high_low = ACTIVE_LOW;
- }
+ output_struct->data.extended_irq.edge_level =
+ (temp8 & 0x2) ? ACPI_EDGE_SENSITIVE : ACPI_LEVEL_SENSITIVE;
- else {
- /*
- * Only _LL and _HE polarity/trigger interrupts
- * are allowed (ACPI spec v1.0b ection 6.4.2.1),
- * so an error will occur if we reach this point
- */
- return_ACPI_STATUS (AE_BAD_DATA);
- }
- }
+ /*
+ * Check Interrupt Polarity
+ */
+ output_struct->data.extended_irq.active_high_low = (temp8 >> 2) & 0x1;
/*
* Check for sharable
/* Copy the string into the buffer */
index = 0;
-
while (0x00 != *buffer) {
*temp_ptr = *buffer;
* Struct_size to the next 32-bit boundary.
*/
temp8 = (u8) (index + 1);
- struct_size += ROUND_UP_TO_32_bITS (temp8);
+ struct_size += ACPI_ROUND_UP_TO_32_bITS (temp8);
}
-
else {
output_struct->data.extended_irq.resource_source.index = 0x00;
output_struct->data.extended_irq.resource_source.string_length = 0;
*
* PARAMETERS: Linked_list - Pointer to the resource linked list
* Output_buffer - Pointer to the user's return buffer
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes of the
- * Output_buffer used
+ * Bytes_consumed - Pointer to where the number of bytes
+ * used in the Output_buffer is returned
*
* RETURN: Status
*
acpi_rs_extended_irq_stream (
acpi_resource *linked_list,
u8 **output_buffer,
- u32 *bytes_consumed)
+ ACPI_SIZE *bytes_consumed)
{
u8 *buffer = *output_buffer;
u16 *length_field;
NATIVE_CHAR *temp_pointer = NULL;
- FUNCTION_TRACE ("Rs_extended_irq_stream");
+ ACPI_FUNCTION_TRACE ("Rs_extended_irq_stream");
/*
temp8 = (u8)(linked_list->data.extended_irq.producer_consumer & 0x01);
temp8 |= ((linked_list->data.extended_irq.shared_exclusive & 0x01) << 3);
- if (LEVEL_SENSITIVE == linked_list->data.extended_irq.edge_level &&
- ACTIVE_LOW == linked_list->data.extended_irq.active_high_low) {
- temp8 |= 0x04;
- }
- else {
- temp8 |= 0x02;
+ /*
+ * Set the Interrupt Mode
+ *
+ * The definition of an Extended IRQ changed between ACPI spec v1.0b
+ * and ACPI spec 2.0 (section 6.4.3.6 in both). This code does not
+ * implement the more restrictive definition of 1.0b
+ *
+ * - Edge/Level are defined opposite in the table vs the headers
+ */
+ if (ACPI_EDGE_SENSITIVE == linked_list->data.extended_irq.edge_level) {
+ temp8 |= 0x2;
}
+ /*
+ * Set the Interrupt Polarity
+ */
+ temp8 |= ((linked_list->data.extended_irq.active_high_low & 0x1) << 2);
+
*buffer = temp8;
buffer += 1;
for (index = 0; index < linked_list->data.extended_irq.number_of_interrupts;
index++) {
- MOVE_UNALIGNED32_TO_32 (buffer,
+ ACPI_MOVE_UNALIGNED32_TO_32 (buffer,
&linked_list->data.extended_irq.interrupts[index]);
buffer += 4;
}
/*
* Copy the string
*/
- STRCPY (temp_pointer,
+ ACPI_STRCPY (temp_pointer,
linked_list->data.extended_irq.resource_source.string_ptr);
/*
* Buffer needs to be set to the length of the sting + one for the
* terminating null
*/
- buffer += (STRLEN (linked_list->data.extended_irq.resource_source.string_ptr) + 1);
+ buffer += (ACPI_STRLEN (linked_list->data.extended_irq.resource_source.string_ptr) + 1);
}
/*
* Return the number of bytes consumed in this operation
*/
- *bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
+ *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
/*
* Set the length field to the number of bytes consumed
/*******************************************************************************
*
* Module Name: rslist - Linked list utilities
- * $Revision: 19 $
+ * $Revision: 26 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acresrc.h"
#define _COMPONENT ACPI_RESOURCES
- MODULE_NAME ("rslist")
+ ACPI_MODULE_NAME ("rslist")
/*******************************************************************************
u8 resource_start_byte)
{
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/*
* Determine if this is a small or large resource
*/
- switch (resource_start_byte & RESOURCE_DESC_TYPE_MASK) {
- case RESOURCE_DESC_TYPE_SMALL:
+ switch (resource_start_byte & ACPI_RDESC_TYPE_MASK) {
+ case ACPI_RDESC_TYPE_SMALL:
/*
* Small Resource Type -- Only bits 6:3 are valid
*/
- return ((u8) (resource_start_byte & RESOURCE_DESC_SMALL_MASK));
- break;
+ return ((u8) (resource_start_byte & ACPI_RDESC_SMALL_MASK));
- case RESOURCE_DESC_TYPE_LARGE:
+ case ACPI_RDESC_TYPE_LARGE:
/*
* Large Resource Type -- All bits are valid
*/
return (resource_start_byte);
- break;
}
return (0xFF);
acpi_rs_byte_stream_to_list (
u8 *byte_stream_buffer,
u32 byte_stream_buffer_length,
- u8 **output_buffer)
+ u8 *output_buffer)
{
acpi_status status;
u32 bytes_parsed = 0;
u8 resource_type = 0;
- u32 bytes_consumed = 0;
- u8 **buffer = output_buffer;
- u32 structure_size = 0;
+ ACPI_SIZE bytes_consumed = 0;
+ u8 *buffer = output_buffer;
+ ACPI_SIZE structure_size = 0;
u8 end_tag_processed = FALSE;
+ acpi_resource *resource;
-
- FUNCTION_TRACE ("Rs_byte_stream_to_list");
+ ACPI_FUNCTION_TRACE ("Rs_byte_stream_to_list");
while (bytes_parsed < byte_stream_buffer_length &&
resource_type = acpi_rs_get_resource_type (*byte_stream_buffer);
switch (resource_type) {
- case RESOURCE_DESC_MEMORY_24:
+ case ACPI_RDESC_TYPE_MEMORY_24:
/*
* 24-Bit Memory Resource
*/
status = acpi_rs_memory24_resource (byte_stream_buffer,
- &bytes_consumed, buffer, &structure_size);
+ &bytes_consumed, &buffer, &structure_size);
break;
- case RESOURCE_DESC_LARGE_VENDOR:
+ case ACPI_RDESC_TYPE_LARGE_VENDOR:
/*
* Vendor Defined Resource
*/
status = acpi_rs_vendor_resource (byte_stream_buffer,
- &bytes_consumed, buffer, &structure_size);
+ &bytes_consumed, &buffer, &structure_size);
break;
- case RESOURCE_DESC_MEMORY_32:
+ case ACPI_RDESC_TYPE_MEMORY_32:
/*
* 32-Bit Memory Range Resource
*/
status = acpi_rs_memory32_range_resource (byte_stream_buffer,
- &bytes_consumed, buffer, &structure_size);
+ &bytes_consumed, &buffer, &structure_size);
break;
- case RESOURCE_DESC_FIXED_MEMORY_32:
+ case ACPI_RDESC_TYPE_FIXED_MEMORY_32:
/*
* 32-Bit Fixed Memory Resource
*/
status = acpi_rs_fixed_memory32_resource (byte_stream_buffer,
- &bytes_consumed, buffer, &structure_size);
+ &bytes_consumed, &buffer, &structure_size);
break;
- case RESOURCE_DESC_QWORD_ADDRESS_SPACE:
+ case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE:
/*
* 64-Bit Address Resource
*/
status = acpi_rs_address64_resource (byte_stream_buffer,
- &bytes_consumed, buffer, &structure_size);
+ &bytes_consumed, &buffer, &structure_size);
break;
- case RESOURCE_DESC_DWORD_ADDRESS_SPACE:
+ case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE:
/*
* 32-Bit Address Resource
*/
status = acpi_rs_address32_resource (byte_stream_buffer,
- &bytes_consumed, buffer, &structure_size);
+ &bytes_consumed, &buffer, &structure_size);
break;
- case RESOURCE_DESC_WORD_ADDRESS_SPACE:
+ case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE:
/*
* 16-Bit Address Resource
*/
status = acpi_rs_address16_resource (byte_stream_buffer,
- &bytes_consumed, buffer, &structure_size);
+ &bytes_consumed, &buffer, &structure_size);
break;
- case RESOURCE_DESC_EXTENDED_XRUPT:
+ case ACPI_RDESC_TYPE_EXTENDED_XRUPT:
/*
* Extended IRQ
*/
status = acpi_rs_extended_irq_resource (byte_stream_buffer,
- &bytes_consumed, buffer, &structure_size);
+ &bytes_consumed, &buffer, &structure_size);
break;
- case RESOURCE_DESC_IRQ_FORMAT:
+ case ACPI_RDESC_TYPE_IRQ_FORMAT:
/*
* IRQ Resource
*/
status = acpi_rs_irq_resource (byte_stream_buffer,
- &bytes_consumed, buffer, &structure_size);
+ &bytes_consumed, &buffer, &structure_size);
break;
- case RESOURCE_DESC_DMA_FORMAT:
+ case ACPI_RDESC_TYPE_DMA_FORMAT:
/*
* DMA Resource
*/
status = acpi_rs_dma_resource (byte_stream_buffer,
- &bytes_consumed, buffer, &structure_size);
+ &bytes_consumed, &buffer, &structure_size);
break;
- case RESOURCE_DESC_START_DEPENDENT:
+ case ACPI_RDESC_TYPE_START_DEPENDENT:
/*
* Start Dependent Functions Resource
*/
- status = acpi_rs_start_dependent_functions_resource (byte_stream_buffer,
- &bytes_consumed, buffer, &structure_size);
+ status = acpi_rs_start_depend_fns_resource (byte_stream_buffer,
+ &bytes_consumed, &buffer, &structure_size);
break;
- case RESOURCE_DESC_END_DEPENDENT:
+ case ACPI_RDESC_TYPE_END_DEPENDENT:
/*
* End Dependent Functions Resource
*/
- status = acpi_rs_end_dependent_functions_resource (byte_stream_buffer,
- &bytes_consumed, buffer, &structure_size);
+ status = acpi_rs_end_depend_fns_resource (byte_stream_buffer,
+ &bytes_consumed, &buffer, &structure_size);
break;
- case RESOURCE_DESC_IO_PORT:
+ case ACPI_RDESC_TYPE_IO_PORT:
/*
* IO Port Resource
*/
status = acpi_rs_io_resource (byte_stream_buffer,
- &bytes_consumed, buffer, &structure_size);
+ &bytes_consumed, &buffer, &structure_size);
break;
- case RESOURCE_DESC_FIXED_IO_PORT:
+ case ACPI_RDESC_TYPE_FIXED_IO_PORT:
/*
* Fixed IO Port Resource
*/
status = acpi_rs_fixed_io_resource (byte_stream_buffer,
- &bytes_consumed, buffer, &structure_size);
+ &bytes_consumed, &buffer, &structure_size);
break;
- case RESOURCE_DESC_SMALL_VENDOR:
+ case ACPI_RDESC_TYPE_SMALL_VENDOR:
/*
* Vendor Specific Resource
*/
status = acpi_rs_vendor_resource (byte_stream_buffer,
- &bytes_consumed, buffer, &structure_size);
+ &bytes_consumed, &buffer, &structure_size);
break;
- case RESOURCE_DESC_END_TAG:
+ case ACPI_RDESC_TYPE_END_TAG:
/*
* End Tag
*/
end_tag_processed = TRUE;
status = acpi_rs_end_tag_resource (byte_stream_buffer,
- &bytes_consumed, buffer, &structure_size);
+ &bytes_consumed, &buffer, &structure_size);
break;
break;
}
-
- if (!ACPI_SUCCESS(status)) {
+ if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/*
* Set the Buffer to the next structure
*/
- *buffer += structure_size;
+ resource = (acpi_resource *)buffer;
+ resource->length = ACPI_ALIGN_RESOURCE_SIZE(resource->length);
+ buffer += ACPI_ALIGN_RESOURCE_SIZE(structure_size);
} /* end while */
acpi_rs_list_to_byte_stream (
acpi_resource *linked_list,
u32 byte_stream_size_needed,
- u8 **output_buffer)
+ u8 *output_buffer)
{
acpi_status status;
- u8 *buffer = *output_buffer;
- u32 bytes_consumed = 0;
+ u8 *buffer = output_buffer;
+ ACPI_SIZE bytes_consumed = 0;
u8 done = FALSE;
- FUNCTION_TRACE ("Rs_list_to_byte_stream");
+ ACPI_FUNCTION_TRACE ("Rs_list_to_byte_stream");
while (!done) {
/*
* Start Dependent Functions Resource
*/
- status = acpi_rs_start_dependent_functions_stream (linked_list,
+ status = acpi_rs_start_depend_fns_stream (linked_list,
&buffer, &bytes_consumed);
break;
/*
* End Dependent Functions Resource
*/
- status = acpi_rs_end_dependent_functions_stream (linked_list,
+ status = acpi_rs_end_depend_fns_stream (linked_list,
&buffer, &bytes_consumed);
break;
} /* switch (Linked_list->Id) */
-
- if (!ACPI_SUCCESS(status)) {
+ if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/*
* Point to the next object
*/
- linked_list = POINTER_ADD (acpi_resource,
+ linked_list = ACPI_PTR_ADD (acpi_resource,
linked_list, linked_list->length);
}
/*******************************************************************************
*
* Module Name: rsmem24 - Memory resource descriptors
- * $Revision: 14 $
+ * $Revision: 17 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acresrc.h"
#define _COMPONENT ACPI_RESOURCES
- MODULE_NAME ("rsmemory")
+ ACPI_MODULE_NAME ("rsmemory")
/*******************************************************************************
*
* PARAMETERS: Byte_stream_buffer - Pointer to the resource input byte
* stream
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes consumed from
- * the Byte_stream_buffer
- * Output_buffer - Pointer to the user's return buffer
- * Structure_size - u32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * Bytes_consumed - Pointer to where the number of bytes
+ * consumed the Byte_stream_buffer is
+ * returned
+ * Output_buffer - Pointer to the return data buffer
+ * Structure_size - Pointer to where the number of bytes
+ * in the return data struct is returned
*
* RETURN: Status
*
acpi_status
acpi_rs_memory24_resource (
u8 *byte_stream_buffer,
- u32 *bytes_consumed,
+ ACPI_SIZE *bytes_consumed,
u8 **output_buffer,
- u32 *structure_size)
+ ACPI_SIZE *structure_size)
{
u8 *buffer = byte_stream_buffer;
acpi_resource *output_struct = (acpi_resource *) *output_buffer;
u16 temp16 = 0;
u8 temp8 = 0;
- u32 struct_size = SIZEOF_RESOURCE (acpi_resource_mem24);
+ ACPI_SIZE struct_size = ACPI_SIZEOF_RESOURCE (acpi_resource_mem24);
- FUNCTION_TRACE ("Rs_memory24_resource");
+ ACPI_FUNCTION_TRACE ("Rs_memory24_resource");
/*
*/
buffer += 1;
- MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
buffer += 2;
*bytes_consumed = temp16 + 3;
output_struct->id = ACPI_RSTYPE_MEM24;
/*
* Get Min_base_address (Bytes 4-5)
*/
- MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
buffer += 2;
output_struct->data.memory24.min_base_address = temp16;
/*
* Get Max_base_address (Bytes 6-7)
*/
- MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
buffer += 2;
output_struct->data.memory24.max_base_address = temp16;
/*
* Get Alignment (Bytes 8-9)
*/
- MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
buffer += 2;
output_struct->data.memory24.alignment = temp16;
/*
* Get Range_length (Bytes 10-11)
*/
- MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
output_struct->data.memory24.range_length = temp16;
/*
*
* PARAMETERS: Linked_list - Pointer to the resource linked list
* Output_buffer - Pointer to the user's return buffer
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes of the
- * Output_buffer used
+ * Bytes_consumed - Pointer to where the number of bytes
+ * used in the Output_buffer is returned
*
* RETURN: Status
*
acpi_rs_memory24_stream (
acpi_resource *linked_list,
u8 **output_buffer,
- u32 *bytes_consumed)
+ ACPI_SIZE *bytes_consumed)
{
u8 *buffer = *output_buffer;
u16 temp16 = 0;
u8 temp8 = 0;
- FUNCTION_TRACE ("Rs_memory24_stream");
+ ACPI_FUNCTION_TRACE ("Rs_memory24_stream");
/*
* The length field is static
*/
temp16 = 0x09;
- MOVE_UNALIGNED16_TO_16 (buffer, &temp16);
+ ACPI_MOVE_UNALIGNED16_TO_16 (buffer, &temp16);
buffer += 2;
/*
/*
* Set the Range minimum base address
*/
- MOVE_UNALIGNED16_TO_16 (buffer, &linked_list->data.memory24.min_base_address);
+ ACPI_MOVE_UNALIGNED16_TO_16 (buffer, &linked_list->data.memory24.min_base_address);
buffer += 2;
/*
* Set the Range maximum base address
*/
- MOVE_UNALIGNED16_TO_16 (buffer, &linked_list->data.memory24.max_base_address);
+ ACPI_MOVE_UNALIGNED16_TO_16 (buffer, &linked_list->data.memory24.max_base_address);
buffer += 2;
/*
* Set the base alignment
*/
- MOVE_UNALIGNED16_TO_16 (buffer, &linked_list->data.memory24.alignment);
+ ACPI_MOVE_UNALIGNED16_TO_16 (buffer, &linked_list->data.memory24.alignment);
buffer += 2;
/*
* Set the range length
*/
- MOVE_UNALIGNED16_TO_16 (buffer, &linked_list->data.memory24.range_length);
+ ACPI_MOVE_UNALIGNED16_TO_16 (buffer, &linked_list->data.memory24.range_length);
buffer += 2;
/*
* Return the number of bytes consumed in this operation
*/
- *bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
+ *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
return_ACPI_STATUS (AE_OK);
}
*
* PARAMETERS: Byte_stream_buffer - Pointer to the resource input byte
* stream
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes consumed from
- * the Byte_stream_buffer
- * Output_buffer - Pointer to the user's return buffer
- * Structure_size - u32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * Bytes_consumed - Pointer to where the number of bytes
+ * consumed the Byte_stream_buffer is
+ * returned
+ * Output_buffer - Pointer to the return data buffer
+ * Structure_size - Pointer to where the number of bytes
+ * in the return data struct is returned
*
* RETURN: Status
*
acpi_status
acpi_rs_memory32_range_resource (
u8 *byte_stream_buffer,
- u32 *bytes_consumed,
+ ACPI_SIZE *bytes_consumed,
u8 **output_buffer,
- u32 *structure_size)
+ ACPI_SIZE *structure_size)
{
u8 *buffer = byte_stream_buffer;
acpi_resource *output_struct = (acpi_resource *) *output_buffer;
u16 temp16 = 0;
u8 temp8 = 0;
- u32 struct_size = SIZEOF_RESOURCE (acpi_resource_mem32);
+ ACPI_SIZE struct_size = ACPI_SIZEOF_RESOURCE (acpi_resource_mem32);
- FUNCTION_TRACE ("Rs_memory32_range_resource");
+ ACPI_FUNCTION_TRACE ("Rs_memory32_range_resource");
/*
*/
buffer += 1;
- MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
buffer += 2;
*bytes_consumed = temp16 + 3;
/*
* Get Min_base_address (Bytes 4-7)
*/
- MOVE_UNALIGNED32_TO_32 (&output_struct->data.memory32.min_base_address,
+ ACPI_MOVE_UNALIGNED32_TO_32 (&output_struct->data.memory32.min_base_address,
buffer);
buffer += 4;
/*
* Get Max_base_address (Bytes 8-11)
*/
- MOVE_UNALIGNED32_TO_32 (&output_struct->data.memory32.max_base_address,
+ ACPI_MOVE_UNALIGNED32_TO_32 (&output_struct->data.memory32.max_base_address,
buffer);
buffer += 4;
/*
* Get Alignment (Bytes 12-15)
*/
- MOVE_UNALIGNED32_TO_32 (&output_struct->data.memory32.alignment, buffer);
+ ACPI_MOVE_UNALIGNED32_TO_32 (&output_struct->data.memory32.alignment, buffer);
buffer += 4;
/*
* Get Range_length (Bytes 16-19)
*/
- MOVE_UNALIGNED32_TO_32 (&output_struct->data.memory32.range_length, buffer);
+ ACPI_MOVE_UNALIGNED32_TO_32 (&output_struct->data.memory32.range_length, buffer);
/*
* Set the Length parameter
*
* PARAMETERS: Byte_stream_buffer - Pointer to the resource input byte
* stream
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes consumed from
- * the Byte_stream_buffer
- * Output_buffer - Pointer to the user's return buffer
- * Structure_size - u32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * Bytes_consumed - Pointer to where the number of bytes
+ * consumed the Byte_stream_buffer is
+ * returned
+ * Output_buffer - Pointer to the return data buffer
+ * Structure_size - Pointer to where the number of bytes
+ * in the return data struct is returned
*
* RETURN: Status
*
acpi_status
acpi_rs_fixed_memory32_resource (
u8 *byte_stream_buffer,
- u32 *bytes_consumed,
+ ACPI_SIZE *bytes_consumed,
u8 **output_buffer,
- u32 *structure_size)
+ ACPI_SIZE *structure_size)
{
u8 *buffer = byte_stream_buffer;
acpi_resource *output_struct = (acpi_resource *) *output_buffer;
u16 temp16 = 0;
u8 temp8 = 0;
- u32 struct_size = SIZEOF_RESOURCE (acpi_resource_fixed_mem32);
+ ACPI_SIZE struct_size = ACPI_SIZEOF_RESOURCE (acpi_resource_fixed_mem32);
- FUNCTION_TRACE ("Rs_fixed_memory32_resource");
+ ACPI_FUNCTION_TRACE ("Rs_fixed_memory32_resource");
/*
* Point past the Descriptor to get the number of bytes consumed
*/
buffer += 1;
- MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
buffer += 2;
*bytes_consumed = temp16 + 3;
/*
* Get Range_base_address (Bytes 4-7)
*/
- MOVE_UNALIGNED32_TO_32 (&output_struct->data.fixed_memory32.range_base_address,
+ ACPI_MOVE_UNALIGNED32_TO_32 (&output_struct->data.fixed_memory32.range_base_address,
buffer);
buffer += 4;
/*
* Get Range_length (Bytes 8-11)
*/
- MOVE_UNALIGNED32_TO_32 (&output_struct->data.fixed_memory32.range_length,
+ ACPI_MOVE_UNALIGNED32_TO_32 (&output_struct->data.fixed_memory32.range_length,
buffer);
/*
*
* PARAMETERS: Linked_list - Pointer to the resource linked list
* Output_buffer - Pointer to the user's return buffer
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes of the
- * Output_buffer used
+ * Bytes_consumed - Pointer to where the number of bytes
+ * used in the Output_buffer is returned
*
* RETURN: Status
*
acpi_rs_memory32_range_stream (
acpi_resource *linked_list,
u8 **output_buffer,
- u32 *bytes_consumed)
+ ACPI_SIZE *bytes_consumed)
{
u8 *buffer = *output_buffer;
u16 temp16 = 0;
u8 temp8 = 0;
- FUNCTION_TRACE ("Rs_memory32_range_stream");
+ ACPI_FUNCTION_TRACE ("Rs_memory32_range_stream");
/*
*/
temp16 = 0x11;
- MOVE_UNALIGNED16_TO_16 (buffer, &temp16);
+ ACPI_MOVE_UNALIGNED16_TO_16 (buffer, &temp16);
buffer += 2;
/*
/*
* Set the Range minimum base address
*/
- MOVE_UNALIGNED32_TO_32 (buffer, &linked_list->data.memory32.min_base_address);
+ ACPI_MOVE_UNALIGNED32_TO_32 (buffer, &linked_list->data.memory32.min_base_address);
buffer += 4;
/*
* Set the Range maximum base address
*/
- MOVE_UNALIGNED32_TO_32 (buffer, &linked_list->data.memory32.max_base_address);
+ ACPI_MOVE_UNALIGNED32_TO_32 (buffer, &linked_list->data.memory32.max_base_address);
buffer += 4;
/*
* Set the base alignment
*/
- MOVE_UNALIGNED32_TO_32 (buffer, &linked_list->data.memory32.alignment);
+ ACPI_MOVE_UNALIGNED32_TO_32 (buffer, &linked_list->data.memory32.alignment);
buffer += 4;
/*
* Set the range length
*/
- MOVE_UNALIGNED32_TO_32 (buffer, &linked_list->data.memory32.range_length);
+ ACPI_MOVE_UNALIGNED32_TO_32 (buffer, &linked_list->data.memory32.range_length);
buffer += 4;
/*
* Return the number of bytes consumed in this operation
*/
- *bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
+ *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
return_ACPI_STATUS (AE_OK);
}
*
* PARAMETERS: Linked_list - Pointer to the resource linked list
* Output_buffer - Pointer to the user's return buffer
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes of the
- * Output_buffer used
+ * Bytes_consumed - Pointer to where the number of bytes
+ * used in the Output_buffer is returned
*
* RETURN: Status
*
acpi_rs_fixed_memory32_stream (
acpi_resource *linked_list,
u8 **output_buffer,
- u32 *bytes_consumed)
+ ACPI_SIZE *bytes_consumed)
{
u8 *buffer = *output_buffer;
u16 temp16 = 0;
u8 temp8 = 0;
- FUNCTION_TRACE ("Rs_fixed_memory32_stream");
+ ACPI_FUNCTION_TRACE ("Rs_fixed_memory32_stream");
/*
*/
temp16 = 0x09;
- MOVE_UNALIGNED16_TO_16 (buffer, &temp16);
+ ACPI_MOVE_UNALIGNED16_TO_16 (buffer, &temp16);
buffer += 2;
/*
/*
* Set the Range base address
*/
- MOVE_UNALIGNED32_TO_32 (buffer,
+ ACPI_MOVE_UNALIGNED32_TO_32 (buffer,
&linked_list->data.fixed_memory32.range_base_address);
buffer += 4;
/*
* Set the range length
*/
- MOVE_UNALIGNED32_TO_32 (buffer,
+ ACPI_MOVE_UNALIGNED32_TO_32 (buffer,
&linked_list->data.fixed_memory32.range_length);
buffer += 4;
/*
* Return the number of bytes consumed in this operation
*/
- *bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
+ *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
* Module Name: rsmisc - Miscellaneous resource descriptors
- * $Revision: 16 $
+ * $Revision: 20 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acresrc.h"
#define _COMPONENT ACPI_RESOURCES
- MODULE_NAME ("rsmisc")
+ ACPI_MODULE_NAME ("rsmisc")
/*******************************************************************************
*
* PARAMETERS: Byte_stream_buffer - Pointer to the resource input byte
* stream
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes consumed from
- * the Byte_stream_buffer
- * Output_buffer - Pointer to the user's return buffer
- * Structure_size - u32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * Bytes_consumed - Pointer to where the number of bytes
+ * consumed the Byte_stream_buffer is
+ * returned
+ * Output_buffer - Pointer to the return data buffer
+ * Structure_size - Pointer to where the number of bytes
+ * in the return data struct is returned
*
* RETURN: Status
*
acpi_status
acpi_rs_end_tag_resource (
u8 *byte_stream_buffer,
- u32 *bytes_consumed,
+ ACPI_SIZE *bytes_consumed,
u8 **output_buffer,
- u32 *structure_size)
+ ACPI_SIZE *structure_size)
{
acpi_resource *output_struct = (acpi_resource *) *output_buffer;
- u32 struct_size = ACPI_RESOURCE_LENGTH;
+ ACPI_SIZE struct_size = ACPI_RESOURCE_LENGTH;
- FUNCTION_TRACE ("Rs_end_tag_resource");
+ ACPI_FUNCTION_TRACE ("Rs_end_tag_resource");
/*
*
* PARAMETERS: Linked_list - Pointer to the resource linked list
* Output_buffer - Pointer to the user's return buffer
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes of the
- * Output_buffer used
+ * Bytes_consumed - Pointer to where the number of bytes
+ * used in the Output_buffer is returned
*
* RETURN: Status
*
acpi_rs_end_tag_stream (
acpi_resource *linked_list,
u8 **output_buffer,
- u32 *bytes_consumed)
+ ACPI_SIZE *bytes_consumed)
{
u8 *buffer = *output_buffer;
u8 temp8 = 0;
- FUNCTION_TRACE ("Rs_end_tag_stream");
+ ACPI_FUNCTION_TRACE ("Rs_end_tag_stream");
/*
/*
* Return the number of bytes consumed in this operation
*/
- *bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
+ *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
return_ACPI_STATUS (AE_OK);
}
*
* PARAMETERS: Byte_stream_buffer - Pointer to the resource input byte
* stream
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes consumed from
- * the Byte_stream_buffer
- * Output_buffer - Pointer to the user's return buffer
- * Structure_size - u32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * Bytes_consumed - Pointer to where the number of bytes
+ * consumed the Byte_stream_buffer is
+ * returned
+ * Output_buffer - Pointer to the return data buffer
+ * Structure_size - Pointer to where the number of bytes
+ * in the return data struct is returned
*
* RETURN: Status
*
acpi_status
acpi_rs_vendor_resource (
u8 *byte_stream_buffer,
- u32 *bytes_consumed,
+ ACPI_SIZE *bytes_consumed,
u8 **output_buffer,
- u32 *structure_size)
+ ACPI_SIZE *structure_size)
{
u8 *buffer = byte_stream_buffer;
acpi_resource *output_struct = (acpi_resource *) *output_buffer;
u16 temp16 = 0;
u8 temp8 = 0;
u8 index;
- u32 struct_size = SIZEOF_RESOURCE (acpi_resource_vendor);
+ ACPI_SIZE struct_size = ACPI_SIZEOF_RESOURCE (acpi_resource_vendor);
- FUNCTION_TRACE ("Rs_vendor_resource");
+ ACPI_FUNCTION_TRACE ("Rs_vendor_resource");
/*
if (temp8 & 0x80) {
/*
- * Large Item
- * Point to the length field
+ * Large Item, point to the length field
*/
buffer += 1;
/* Dereference */
- MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
/* Calculate bytes consumed */
buffer += 2;
}
-
else {
/*
- * Small Item
- * Dereference the size
+ * Small Item, dereference the size
*/
temp16 = (u8)(*buffer & 0x07);
* calculate the length of the vendor string and expand the
* Struct_size to the next 32-bit boundary.
*/
- struct_size += ROUND_UP_TO_32_bITS (temp16);
+ struct_size += ACPI_ROUND_UP_TO_32_bITS (temp16);
/*
* Set the Length parameter
*
* PARAMETERS: Linked_list - Pointer to the resource linked list
* Output_buffer - Pointer to the user's return buffer
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes of the
- * Output_buffer used
+ * Bytes_consumed - Pointer to where the number of bytes
+ * used in the Output_buffer is returned
*
* RETURN: Status
*
acpi_rs_vendor_stream (
acpi_resource *linked_list,
u8 **output_buffer,
- u32 *bytes_consumed)
+ ACPI_SIZE *bytes_consumed)
{
u8 *buffer = *output_buffer;
u16 temp16 = 0;
u8 index;
- FUNCTION_TRACE ("Rs_vendor_stream");
+ ACPI_FUNCTION_TRACE ("Rs_vendor_stream");
/*
*/
if(linked_list->data.vendor_specific.length > 7) {
/*
- * Large Item
- * Set the descriptor field and length bytes
+ * Large Item, Set the descriptor field and length bytes
*/
*buffer = 0x84;
buffer += 1;
temp16 = (u16) linked_list->data.vendor_specific.length;
- MOVE_UNALIGNED16_TO_16 (buffer, &temp16);
+ ACPI_MOVE_UNALIGNED16_TO_16 (buffer, &temp16);
buffer += 2;
}
-
else {
/*
- * Small Item
- * Set the descriptor field
+ * Small Item, Set the descriptor field
*/
temp8 = 0x70;
temp8 |= linked_list->data.vendor_specific.length;
/*
* Return the number of bytes consumed in this operation
*/
- *bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
+ *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: Acpi_rs_start_dependent_functions_resource
+ * FUNCTION: Acpi_rs_start_depend_fns_resource
*
* PARAMETERS: Byte_stream_buffer - Pointer to the resource input byte
* stream
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes consumed from
- * the Byte_stream_buffer
- * Output_buffer - Pointer to the user's return buffer
- * Structure_size - u32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * Bytes_consumed - Pointer to where the number of bytes
+ * consumed the Byte_stream_buffer is
+ * returned
+ * Output_buffer - Pointer to the return data buffer
+ * Structure_size - Pointer to where the number of bytes
+ * in the return data struct is returned
*
* RETURN: Status
*
******************************************************************************/
acpi_status
-acpi_rs_start_dependent_functions_resource (
+acpi_rs_start_depend_fns_resource (
u8 *byte_stream_buffer,
- u32 *bytes_consumed,
+ ACPI_SIZE *bytes_consumed,
u8 **output_buffer,
- u32 *structure_size)
+ ACPI_SIZE *structure_size)
{
u8 *buffer = byte_stream_buffer;
- acpi_resource *output_struct = (acpi_resource *) *output_buffer;
+ acpi_resource *output_struct = (acpi_resource *) *output_buffer;
u8 temp8 = 0;
- u32 struct_size = SIZEOF_RESOURCE (acpi_resource_start_dpf);
+ ACPI_SIZE struct_size = ACPI_SIZEOF_RESOURCE (acpi_resource_start_dpf);
- FUNCTION_TRACE ("Rs_start_dependent_functions_resource");
+ ACPI_FUNCTION_TRACE ("Rs_start_depend_fns_resource");
/*
return_ACPI_STATUS (AE_AML_ERROR);
}
}
-
else {
output_struct->data.start_dpf.compatibility_priority =
- ACCEPTABLE_CONFIGURATION;
+ ACPI_ACCEPTABLE_CONFIGURATION;
output_struct->data.start_dpf.performance_robustness =
- ACCEPTABLE_CONFIGURATION;
+ ACPI_ACCEPTABLE_CONFIGURATION;
}
/*
/*******************************************************************************
*
- * FUNCTION: Acpi_rs_end_dependent_functions_resource
+ * FUNCTION: Acpi_rs_end_depend_fns_resource
*
* PARAMETERS: Byte_stream_buffer - Pointer to the resource input byte
* stream
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes consumed from
- * the Byte_stream_buffer
- * Output_buffer - Pointer to the user's return buffer
- * Structure_size - u32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * Bytes_consumed - Pointer to where the number of bytes
+ * consumed the Byte_stream_buffer is
+ * returned
+ * Output_buffer - Pointer to the return data buffer
+ * Structure_size - Pointer to where the number of bytes
+ * in the return data struct is returned
*
* RETURN: Status
*
******************************************************************************/
acpi_status
-acpi_rs_end_dependent_functions_resource (
+acpi_rs_end_depend_fns_resource (
u8 *byte_stream_buffer,
- u32 *bytes_consumed,
+ ACPI_SIZE *bytes_consumed,
u8 **output_buffer,
- u32 *structure_size)
+ ACPI_SIZE *structure_size)
{
acpi_resource *output_struct = (acpi_resource *) *output_buffer;
- u32 struct_size = ACPI_RESOURCE_LENGTH;
+ ACPI_SIZE struct_size = ACPI_RESOURCE_LENGTH;
- FUNCTION_TRACE ("Rs_end_dependent_functions_resource");
+ ACPI_FUNCTION_TRACE ("Rs_end_depend_fns_resource");
/*
/*******************************************************************************
*
- * FUNCTION: Acpi_rs_start_dependent_functions_stream
+ * FUNCTION: Acpi_rs_start_depend_fns_stream
*
* PARAMETERS: Linked_list - Pointer to the resource linked list
* Output_buffer - Pointer to the user's return buffer
******************************************************************************/
acpi_status
-acpi_rs_start_dependent_functions_stream (
+acpi_rs_start_depend_fns_stream (
acpi_resource *linked_list,
u8 **output_buffer,
- u32 *bytes_consumed)
+ ACPI_SIZE *bytes_consumed)
{
u8 *buffer = *output_buffer;
u8 temp8 = 0;
- FUNCTION_TRACE ("Rs_start_dependent_functions_stream");
+ ACPI_FUNCTION_TRACE ("Rs_start_depend_fns_stream");
/*
* The descriptor field is set based upon whether a byte is needed
* to contain Priority data.
*/
- if (ACCEPTABLE_CONFIGURATION ==
+ if (ACPI_ACCEPTABLE_CONFIGURATION ==
linked_list->data.start_dpf.compatibility_priority &&
- ACCEPTABLE_CONFIGURATION ==
+ ACPI_ACCEPTABLE_CONFIGURATION ==
linked_list->data.start_dpf.performance_robustness) {
*buffer = 0x30;
}
/*
* Return the number of bytes consumed in this operation
*/
- *bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
+ *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: Acpi_rs_end_dependent_functions_stream
+ * FUNCTION: Acpi_rs_end_depend_fns_stream
*
* PARAMETERS: Linked_list - Pointer to the resource linked list
* Output_buffer - Pointer to the user's return buffer
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes of the
- * Output_buffer used
+ * Bytes_consumed - Pointer to where the number of bytes
+ * used in the Output_buffer is returned
*
* RETURN: Status
*
******************************************************************************/
acpi_status
-acpi_rs_end_dependent_functions_stream (
+acpi_rs_end_depend_fns_stream (
acpi_resource *linked_list,
u8 **output_buffer,
- u32 *bytes_consumed
- )
+ ACPI_SIZE *bytes_consumed)
{
u8 *buffer = *output_buffer;
- FUNCTION_TRACE ("Rs_end_dependent_functions_stream");
+ ACPI_FUNCTION_TRACE ("Rs_end_depend_fns_stream");
/*
/*
* Return the number of bytes consumed in this operation
*/
- *bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
+ *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
* Module Name: rsutils - Utilities for the resource manager
- * $Revision: 23 $
+ * $Revision: 29 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_RESOURCES
- MODULE_NAME ("rsutils")
+ ACPI_MODULE_NAME ("rsutils")
/*******************************************************************************
{
acpi_operand_object *ret_obj;
acpi_status status;
- u32 buffer_space_needed;
- FUNCTION_TRACE ("Rs_get_prt_method_data");
+ ACPI_FUNCTION_TRACE ("Rs_get_prt_method_data");
- /* already validated params, so we won't repeat here */
-
- buffer_space_needed = ret_buffer->length;
+ /* Parameters guaranteed valid by caller */
/*
* Execute the method, no parameters
return_ACPI_STATUS (AE_TYPE);
}
-
/*
- * The return object will be a package, so check the
- * parameters. If the return object is not a package,
- * then the underlying AML code is corrupt or improperly
- * written.
+ * The return object will be a package, so check the parameters. If the
+ * return object is not a package, then the underlying AML code is corrupt
+ * or improperly written.
*/
if (ACPI_TYPE_PACKAGE != ret_obj->common.type) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_PRT did not return a Package, returned %s\n",
+ acpi_ut_get_type_name (ret_obj->common.type)));
status = AE_AML_OPERAND_TYPE;
goto cleanup;
}
/*
- * Make the call to create a resource linked list from the
- * byte stream buffer that comes back from the _CRS method
- * execution.
- */
- status = acpi_rs_create_pci_routing_table (ret_obj, ret_buffer->pointer,
- &buffer_space_needed);
-
- /*
- * Tell the user how much of the buffer we have used or is needed
- * and return the final status.
+ * Create a resource linked list from the byte stream buffer that comes
+ * back from the _CRS method execution.
*/
- ret_buffer->length = buffer_space_needed;
+ status = acpi_rs_create_pci_routing_table (ret_obj, ret_buffer);
-
- /* On exit, we must delete the object returned by evaluate_object */
+ /* On exit, we must delete the object returned by Evaluate_object */
cleanup:
{
acpi_operand_object *ret_obj;
acpi_status status;
- u32 buffer_space_needed = ret_buffer->length;
- FUNCTION_TRACE ("Rs_get_crs_method_data");
+ ACPI_FUNCTION_TRACE ("Rs_get_crs_method_data");
- /* already validated params, so we won't repeat here */
+ /* Parameters guaranteed valid by caller */
/*
- * Execute the method, no parameters
+ * Execute the method, no parameters
*/
status = acpi_ns_evaluate_relative (handle, "_CRS", NULL, &ret_obj);
if (ACPI_FAILURE (status)) {
/*
* The return object will be a buffer, but check the
- * parameters. If the return object is not a buffer,
- * then the underlying AML code is corrupt or improperly
- * written.
+ * parameters. If the return object is not a buffer,
+ * then the underlying AML code is corrupt or improperly
+ * written.
*/
if (ACPI_TYPE_BUFFER != ret_obj->common.type) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_CRS did not return a Buffer, returned %s\n",
+ acpi_ut_get_type_name (ret_obj->common.type)));
status = AE_AML_OPERAND_TYPE;
goto cleanup;
}
/*
* Make the call to create a resource linked list from the
- * byte stream buffer that comes back from the _CRS method
- * execution.
+ * byte stream buffer that comes back from the _CRS method
+ * execution.
*/
- status = acpi_rs_create_resource_list (ret_obj, ret_buffer->pointer,
- &buffer_space_needed);
-
-
- /*
- * Tell the user how much of the buffer we have used or is needed
- * and return the final status.
- */
- ret_buffer->length = buffer_space_needed;
-
+ status = acpi_rs_create_resource_list (ret_obj, ret_buffer);
/* On exit, we must delete the object returned by evaluate_object */
{
acpi_operand_object *ret_obj;
acpi_status status;
- u32 buffer_space_needed = ret_buffer->length;
- FUNCTION_TRACE ("Rs_get_prs_method_data");
+ ACPI_FUNCTION_TRACE ("Rs_get_prs_method_data");
- /* already validated params, so we won't repeat here */
+ /* Parameters guaranteed valid by caller */
/*
- * Execute the method, no parameters
+ * Execute the method, no parameters
*/
status = acpi_ns_evaluate_relative (handle, "_PRS", NULL, &ret_obj);
if (ACPI_FAILURE (status)) {
/*
* The return object will be a buffer, but check the
- * parameters. If the return object is not a buffer,
- * then the underlying AML code is corrupt or improperly
- * written..
+ * parameters. If the return object is not a buffer,
+ * then the underlying AML code is corrupt or improperly
+ * written..
*/
if (ACPI_TYPE_BUFFER != ret_obj->common.type) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_PRS did not return a Buffer, returned %s\n",
+ acpi_ut_get_type_name (ret_obj->common.type)));
status = AE_AML_OPERAND_TYPE;
goto cleanup;
}
/*
* Make the call to create a resource linked list from the
- * byte stream buffer that comes back from the _CRS method
- * execution.
- */
- status = acpi_rs_create_resource_list (ret_obj, ret_buffer->pointer,
- &buffer_space_needed);
-
- /*
- * Tell the user how much of the buffer we have used or is needed
- * and return the final status.
+ * byte stream buffer that comes back from the _CRS method
+ * execution.
*/
- ret_buffer->length = buffer_space_needed;
-
+ status = acpi_rs_create_resource_list (ret_obj, ret_buffer);
/* On exit, we must delete the object returned by evaluate_object */
{
acpi_operand_object *params[2];
acpi_status status;
- u8 *byte_stream = NULL;
- u32 buffer_size_needed = 0;
+ acpi_buffer buffer;
- FUNCTION_TRACE ("Rs_set_srs_method_data");
+ ACPI_FUNCTION_TRACE ("Rs_set_srs_method_data");
- /* already validated params, so we won't repeat here */
+ /* Parameters guaranteed valid by caller */
/*
* The In_buffer parameter will point to a linked list of
* resource parameters. It needs to be formatted into a
- * byte stream to be sent in as an input parameter.
- */
- buffer_size_needed = 0;
-
- /*
- * First call is to get the buffer size needed
- */
- status = acpi_rs_create_byte_stream (in_buffer->pointer, byte_stream,
- &buffer_size_needed);
- /*
- * We expect a return of AE_BUFFER_OVERFLOW
- * if not, exit with the error
+ * byte stream to be sent in as an input parameter to _SRS
+ *
+ * Convert the linked list into a byte stream
*/
- if (AE_BUFFER_OVERFLOW != status) {
- return_ACPI_STATUS (status);
- }
-
- /*
- * Allocate the buffer needed
- */
- byte_stream = ACPI_MEM_CALLOCATE (buffer_size_needed);
- if (NULL == byte_stream) {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /*
- * Now call to convert the linked list into a byte stream
- */
- status = acpi_rs_create_byte_stream (in_buffer->pointer, byte_stream,
- &buffer_size_needed);
+ buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
+ status = acpi_rs_create_byte_stream (in_buffer->pointer, &buffer);
if (ACPI_FAILURE (status)) {
- goto cleanup;
+ return_ACPI_STATUS (status);
}
/*
*/
params[0] = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
if (!params[0]) {
- status = AE_NO_MEMORY;
- goto cleanup;
+ acpi_os_free (buffer.pointer);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
- params [1] = NULL;
/*
- * Set up the parameter object
+ * Set up the parameter object
*/
- params[0]->buffer.length = buffer_size_needed;
- params[0]->buffer.pointer = byte_stream;
+ params[0]->buffer.length = buffer.length;
+ params[0]->buffer.pointer = buffer.pointer;
+ params[1] = NULL;
/*
* Execute the method, no return value
*/
status = acpi_ns_evaluate_relative (handle, "_SRS", params, NULL);
- acpi_ut_remove_reference (params[0]);
/*
* Clean up and return the status from Acpi_ns_evaluate_relative
*/
-cleanup:
-
+ acpi_ut_remove_reference (params[0]);
return_ACPI_STATUS (status);
}
/*******************************************************************************
*
* Module Name: rsxface - Public interfaces to the resource manager
- * $Revision: 15 $
+ * $Revision: 18 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acresrc.h"
#define _COMPONENT ACPI_RESOURCES
- MODULE_NAME ("rsxface")
+ ACPI_MODULE_NAME ("rsxface")
/*******************************************************************************
acpi_status status;
- FUNCTION_TRACE ("Acpi_get_irq_routing_table ");
+ ACPI_FUNCTION_TRACE ("Acpi_get_irq_routing_table ");
/*
* we also need a valid pointer in the buffer. If it's a zero buffer length,
* we'll be returning the needed buffer size, so keep going.
*/
- if ((!device_handle) ||
- (!ret_buffer) ||
- ((!ret_buffer->pointer) && (ret_buffer->length))) {
+ if (!device_handle) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
+ status = acpi_ut_validate_buffer (ret_buffer);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+
status = acpi_rs_get_prt_method_data (device_handle, ret_buffer);
return_ACPI_STATUS (status);
}
acpi_status status;
- FUNCTION_TRACE ("Acpi_get_current_resources");
+ ACPI_FUNCTION_TRACE ("Acpi_get_current_resources");
/*
* we also need a valid pointer in the buffer. If it's a zero buffer length,
* we'll be returning the needed buffer size, so keep going.
*/
- if ((!device_handle) ||
- (!ret_buffer) ||
- ((ret_buffer->length) && (!ret_buffer->pointer))) {
+ if (!device_handle) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
+ status = acpi_ut_validate_buffer (ret_buffer);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+
status = acpi_rs_get_crs_method_data (device_handle, ret_buffer);
return_ACPI_STATUS (status);
}
acpi_status status;
- FUNCTION_TRACE ("Acpi_get_possible_resources");
+ ACPI_FUNCTION_TRACE ("Acpi_get_possible_resources");
/*
* we also need a valid pointer in the buffer. If it's a zero buffer length,
* we'll be returning the needed buffer size, so keep going.
*/
- if ((!device_handle) ||
- (!ret_buffer) ||
- ((ret_buffer->length) && (!ret_buffer->pointer))) {
+ if (!device_handle) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
+ status = acpi_ut_validate_buffer (ret_buffer);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+
status = acpi_rs_get_prs_method_data (device_handle, ret_buffer);
return_ACPI_STATUS (status);
}
acpi_status status;
- FUNCTION_TRACE ("Acpi_set_current_resources");
+ ACPI_FUNCTION_TRACE ("Acpi_set_current_resources");
/*
#
# Makefile for all Linux ACPI interpreter subdirectories
-# EXCEPT for the ospm directory
#
O_TARGET := $(notdir $(CURDIR)).o
-obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c))
+obj-$(CONFIG_ACPI_INTERPRETER) := $(patsubst %.c,%.o,$(wildcard *.c))
EXTRA_CFLAGS += $(ACPI_CFLAGS)
/******************************************************************************
*
* Module Name: tbconvrt - ACPI Table conversion utilities
- * $Revision: 28 $
+ * $Revision: 36 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acpi.h"
-#include "achware.h"
#include "actables.h"
-#include "actbl.h"
#define _COMPONENT ACPI_TABLES
- MODULE_NAME ("tbconvrt")
+ ACPI_MODULE_NAME ("tbconvrt")
/*******************************************************************************
u32 pointer_size;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
#ifndef _IA64
if (RSDP->revision < 2) {
pointer_size = sizeof (u32);
}
-
else
#endif
{
xsdt_descriptor *new_table;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
- *number_of_tables = acpi_tb_get_table_count (acpi_gbl_RSDP, table_info->pointer);
+ /* Get the number of tables defined in the RSDT or XSDT */
+ *number_of_tables = acpi_tb_get_table_count (acpi_gbl_RSDP, table_info->pointer);
/* Compute size of the converted XSDT */
table_size = (*number_of_tables * sizeof (u64)) + sizeof (acpi_table_header);
-
/* Allocate an XSDT */
new_table = ACPI_MEM_CALLOCATE (table_size);
/* Copy the header and set the length */
- MEMCPY (new_table, table_info->pointer, sizeof (acpi_table_header));
+ ACPI_MEMCPY (new_table, table_info->pointer, sizeof (acpi_table_header));
new_table->header.length = table_size;
/* Copy the table pointers */
for (i = 0; i < *number_of_tables; i++) {
if (acpi_gbl_RSDP->revision < 2) {
-#ifdef _IA64
- new_table->table_offset_entry[i] =
- ((RSDT_DESCRIPTOR_REV071 *) table_info->pointer)->table_offset_entry[i];
-#else
ACPI_STORE_ADDRESS (new_table->table_offset_entry[i],
((RSDT_DESCRIPTOR_REV1 *) table_info->pointer)->table_offset_entry[i]);
-#endif
}
else {
new_table->table_offset_entry[i] =
}
}
-
/* Delete the original table (either mapped or in a buffer) */
acpi_tb_delete_single_table (table_info);
-
/* Point the table descriptor to the new table */
table_info->pointer = (acpi_table_header *) new_table;
*
* FUNCTION: Acpi_tb_convert_table_fadt
*
- * PARAMETERS:
+ * PARAMETERS: None
*
- * RETURN:
+ * RETURN: Status
*
* DESCRIPTION:
- * Converts BIOS supplied 1.0 and 0.71 ACPI FADT to an intermediate
+ * Converts a BIOS supplied ACPI 1.0 FADT to an intermediate
* ACPI 2.0 FADT. If the BIOS supplied a 2.0 FADT then it is simply
* copied to the intermediate FADT. The ACPI CA software uses this
* intermediate FADT. Thus a significant amount of special #ifdef
acpi_status
acpi_tb_convert_table_fadt (void)
{
-
-#ifdef _IA64
- fadt_descriptor_rev071 *FADT71;
- u8 pm1_address_space;
- u8 pm2_address_space;
- u8 pm_timer_address_space;
- u8 gpe0address_space;
- u8 gpe1_address_space;
-#else
fadt_descriptor_rev1 *FADT1;
-#endif
-
fadt_descriptor_rev2 *FADT2;
acpi_table_desc *table_desc;
- FUNCTION_TRACE ("Tb_convert_table_fadt");
-
+ ACPI_FUNCTION_TRACE ("Tb_convert_table_fadt");
- /* Acpi_gbl_FADT is valid */
- /* Allocate and zero the 2.0 buffer */
+ /*
+ * Acpi_gbl_FADT is valid
+ * Allocate and zero the 2.0 FADT buffer
+ */
FADT2 = ACPI_MEM_CALLOCATE (sizeof (fadt_descriptor_rev2));
if (FADT2 == NULL) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
-
- /* The ACPI FADT revision number is FADT2_REVISION_ID=3 */
- /* So, if the current table revision is less than 3 it is type 1.0 or 0.71 */
-
+ /*
+ * The ACPI FADT revision number is FADT2_REVISION_ID=3
+ * So, if the current table revision is less than 3 it is type 1.0
+ */
if (acpi_gbl_FADT->header.revision >= FADT2_REVISION_ID) {
/* We have an ACPI 2.0 FADT but we must copy it to our local buffer */
*FADT2 = *((fadt_descriptor_rev2*) acpi_gbl_FADT);
-
}
-
else {
-
-#ifdef _IA64
- /*
- * For the 64-bit case only, a revision ID less than V2.0 means the
- * tables are the 0.71 extensions
- */
-
- /* The BIOS stored FADT should agree with Revision 0.71 */
-
- FADT71 = (fadt_descriptor_rev071 *) acpi_gbl_FADT;
-
- /* Copy the table header*/
-
- FADT2->header = FADT71->header;
-
- /* Copy the common fields */
-
- FADT2->sci_int = FADT71->sci_int;
- FADT2->acpi_enable = FADT71->acpi_enable;
- FADT2->acpi_disable = FADT71->acpi_disable;
- FADT2->S4bios_req = FADT71->S4bios_req;
- FADT2->plvl2_lat = FADT71->plvl2_lat;
- FADT2->plvl3_lat = FADT71->plvl3_lat;
- FADT2->day_alrm = FADT71->day_alrm;
- FADT2->mon_alrm = FADT71->mon_alrm;
- FADT2->century = FADT71->century;
- FADT2->gpe1_base = FADT71->gpe1_base;
-
- /*
- * We still use the block length registers even though
- * the GAS structure should obsolete them. This is because
- * these registers are byte lengths versus the GAS which
- * contains a bit width
- */
- FADT2->pm1_evt_len = FADT71->pm1_evt_len;
- FADT2->pm1_cnt_len = FADT71->pm1_cnt_len;
- FADT2->pm2_cnt_len = FADT71->pm2_cnt_len;
- FADT2->pm_tm_len = FADT71->pm_tm_len;
- FADT2->gpe0blk_len = FADT71->gpe0blk_len;
- FADT2->gpe1_blk_len = FADT71->gpe1_blk_len;
- FADT2->gpe1_base = FADT71->gpe1_base;
-
- /* Copy the existing 0.71 flags to 2.0. The other bits are zero.*/
-
- FADT2->wb_invd = FADT71->flush_cash;
- FADT2->proc_c1 = FADT71->proc_c1;
- FADT2->plvl2_up = FADT71->plvl2_up;
- FADT2->pwr_button = FADT71->pwr_button;
- FADT2->sleep_button = FADT71->sleep_button;
- FADT2->fixed_rTC = FADT71->fixed_rTC;
- FADT2->rtcs4 = FADT71->rtcs4;
- FADT2->tmr_val_ext = FADT71->tmr_val_ext;
- FADT2->dock_cap = FADT71->dock_cap;
-
-
- /* We should not use these next two addresses */
- /* Since our buffer is pre-zeroed nothing to do for */
- /* the next three data items in the structure */
- /* FADT2->Firmware_ctrl = 0; */
- /* FADT2->Dsdt = 0; */
-
- /* System Interrupt Model isn't used in ACPI 2.0*/
- /* FADT2->Reserved1 = 0; */
-
- /* This field is set by the OEM to convey the preferred */
- /* power management profile to OSPM. It doesn't have any*/
- /* 0.71 equivalence. Since we don't know what kind of */
- /* 64-bit system this is, we will pick unspecified. */
-
- FADT2->prefer_PM_profile = PM_UNSPECIFIED;
-
-
- /* Port address of SMI command port */
- /* We shouldn't use this port because IA64 doesn't */
- /* have or use SMI. It has PMI. */
-
- FADT2->smi_cmd = (u32)(FADT71->smi_cmd & 0xFFFFFFFF);
-
-
- /* processor performance state control*/
- /* The value OSPM writes to the SMI_CMD register to assume */
- /* processor performance state control responsibility. */
- /* There isn't any equivalence in 0.71 */
- /* Again this should be meaningless for IA64 */
- /* FADT2->Pstate_cnt = 0; */
-
- /* The 32-bit Power management and GPE registers are */
- /* not valid in IA-64 and we are not going to use them */
- /* so leaving them pre-zeroed. */
-
- /* Support for the _CST object and C States change notification.*/
- /* This data item hasn't any 0.71 equivalence so leaving it zero.*/
- /* FADT2->Cst_cnt = 0; */
-
- /* number of flush strides that need to be read */
- /* No 0.71 equivalence. Leave pre-zeroed. */
- /* FADT2->Flush_size = 0; */
-
- /* Processor's memory cache line width, in bytes */
- /* No 0.71 equivalence. Leave pre-zeroed. */
- /* FADT2->Flush_stride = 0; */
-
- /* Processor's duty cycle index in processor's P_CNT reg*/
- /* No 0.71 equivalence. Leave pre-zeroed. */
- /* FADT2->Duty_offset = 0; */
-
- /* Processor's duty cycle value bit width in P_CNT register.*/
- /* No 0.71 equivalence. Leave pre-zeroed. */
- /* FADT2->Duty_width = 0; */
-
-
- /* Since there isn't any equivalence in 0.71 */
- /* and since Big_sur had to support legacy */
-
- FADT2->iapc_boot_arch = BAF_LEGACY_DEVICES;
-
- /* Copy to ACPI 2.0 64-BIT Extended Addresses */
-
- FADT2->Xfirmware_ctrl = FADT71->firmware_ctrl;
- FADT2->Xdsdt = FADT71->dsdt;
-
-
- /* Extract the address space IDs */
-
- pm1_address_space = (u8)((FADT71->address_space & PM1_BLK_ADDRESS_SPACE) >> 1);
- pm2_address_space = (u8)((FADT71->address_space & PM2_CNT_BLK_ADDRESS_SPACE) >> 2);
- pm_timer_address_space = (u8)((FADT71->address_space & PM_TMR_BLK_ADDRESS_SPACE) >> 3);
- gpe0address_space = (u8)((FADT71->address_space & GPE0_BLK_ADDRESS_SPACE) >> 4);
- gpe1_address_space = (u8)((FADT71->address_space & GPE1_BLK_ADDRESS_SPACE) >> 5);
-
- /*
- * Convert the 0.71 (non-GAS style) Block addresses to V2.0 GAS structures,
- * in this order:
- *
- * PM 1_a Events
- * PM 1_b Events
- * PM 1_a Control
- * PM 1_b Control
- * PM 2 Control
- * PM Timer Control
- * GPE Block 0
- * GPE Block 1
- */
-
- ASL_BUILD_GAS_FROM_ENTRY (FADT2->Xpm1a_evt_blk, FADT71->pm1_evt_len, FADT71->pm1a_evt_blk, pm1_address_space);
- ASL_BUILD_GAS_FROM_ENTRY (FADT2->Xpm1b_evt_blk, FADT71->pm1_evt_len, FADT71->pm1b_evt_blk, pm1_address_space);
- ASL_BUILD_GAS_FROM_ENTRY (FADT2->Xpm1a_cnt_blk, FADT71->pm1_cnt_len, FADT71->pm1a_cnt_blk, pm1_address_space);
- ASL_BUILD_GAS_FROM_ENTRY (FADT2->Xpm1b_cnt_blk, FADT71->pm1_cnt_len, FADT71->pm1b_cnt_blk, pm1_address_space);
- ASL_BUILD_GAS_FROM_ENTRY (FADT2->Xpm2_cnt_blk, FADT71->pm2_cnt_len, FADT71->pm2_cnt_blk, pm2_address_space);
- ASL_BUILD_GAS_FROM_ENTRY (FADT2->Xpm_tmr_blk, FADT71->pm_tm_len, FADT71->pm_tmr_blk, pm_timer_address_space);
- ASL_BUILD_GAS_FROM_ENTRY (FADT2->Xgpe0blk, FADT71->gpe0blk_len, FADT71->gpe0blk, gpe0address_space);
- ASL_BUILD_GAS_FROM_ENTRY (FADT2->Xgpe1_blk, FADT71->gpe1_blk_len, FADT71->gpe1_blk, gpe1_address_space);
-
-#else
-
/* ACPI 1.0 FACS */
-
/* The BIOS stored FADT should agree with Revision 1.0 */
FADT1 = (fadt_descriptor_rev1*) acpi_gbl_FADT;
/*
- * Copy the table header and the common part of the tables
- * The 2.0 table is an extension of the 1.0 table, so the
- * entire 1.0 table can be copied first, then expand some
- * fields to 64 bits.
+ * Copy the table header and the common part of the tables.
+ *
+ * The 2.0 table is an extension of the 1.0 table, so the entire 1.0
+ * table can be copied first, then expand some fields to 64 bits.
*/
- MEMCPY (FADT2, FADT1, sizeof (fadt_descriptor_rev1));
-
+ ACPI_MEMCPY (FADT2, FADT1, sizeof (fadt_descriptor_rev1));
/* Convert table pointers to 64-bit fields */
ACPI_STORE_ADDRESS (FADT2->Xfirmware_ctrl, FADT1->firmware_ctrl);
ACPI_STORE_ADDRESS (FADT2->Xdsdt, FADT1->dsdt);
- /* System Interrupt Model isn't used in ACPI 2.0*/
- /* FADT2->Reserved1 = 0; */
-
- /* This field is set by the OEM to convey the preferred */
- /* power management profile to OSPM. It doesn't have any*/
- /* 1.0 equivalence. Since we don't know what kind of */
- /* 32-bit system this is, we will pick unspecified. */
+ /*
+ * System Interrupt Model isn't used in ACPI 2.0 (FADT2->Reserved1 = 0;)
+ */
+ /*
+ * This field is set by the OEM to convey the preferred power management
+ * profile to OSPM. It doesn't have any 1.0 equivalence. Since we don't
+ * know what kind of 32-bit system this is, we will use "unspecified".
+ */
FADT2->prefer_PM_profile = PM_UNSPECIFIED;
-
- /* Processor Performance State Control. This is the value */
- /* OSPM writes to the SMI_CMD register to assume processor */
- /* performance state control responsibility. There isn't */
- /* any equivalence in 1.0. So leave it zeroed. */
-
+ /*
+ * Processor Performance State Control. This is the value OSPM writes to
+ * the SMI_CMD register to assume processor performance state control
+ * responsibility. There isn't any equivalence in 1.0, leave it zeroed.
+ */
FADT2->pstate_cnt = 0;
-
- /* Support for the _CST object and C States change notification.*/
- /* This data item hasn't any 1.0 equivalence so leaving it zero.*/
-
+ /*
+ * Support for the _CST object and C States change notification.
+ * This data item hasn't any 1.0 equivalence so leave it zero.
+ */
FADT2->cst_cnt = 0;
-
- /* Since there isn't any equivalence in 1.0 and since it */
- /* is highly likely that a 1.0 system has legacy support. */
-
+ /*
+ * Since there isn't any equivalence in 1.0 and since it highly likely
+ * that a 1.0 system has legacy support.
+ */
FADT2->iapc_boot_arch = BAF_LEGACY_DEVICES;
-
/*
- * Convert the V1.0 Block addresses to V2.0 GAS structures
+ * Convert the V1.0 block addresses to V2.0 GAS structures
* in this order:
*
* PM 1_a Events
* GPE Block 0
* GPE Block 1
*/
-
ASL_BUILD_GAS_FROM_V1_ENTRY (FADT2->Xpm1a_evt_blk, FADT1->pm1_evt_len, FADT1->pm1a_evt_blk);
ASL_BUILD_GAS_FROM_V1_ENTRY (FADT2->Xpm1b_evt_blk, FADT1->pm1_evt_len, FADT1->pm1b_evt_blk);
ASL_BUILD_GAS_FROM_V1_ENTRY (FADT2->Xpm1a_cnt_blk, FADT1->pm1_cnt_len, FADT1->pm1a_cnt_blk);
ASL_BUILD_GAS_FROM_V1_ENTRY (FADT2->Xpm1b_cnt_blk, FADT1->pm1_cnt_len, FADT1->pm1b_cnt_blk);
ASL_BUILD_GAS_FROM_V1_ENTRY (FADT2->Xpm2_cnt_blk, FADT1->pm2_cnt_len, FADT1->pm2_cnt_blk);
ASL_BUILD_GAS_FROM_V1_ENTRY (FADT2->Xpm_tmr_blk, FADT1->pm_tm_len, FADT1->pm_tmr_blk);
- ASL_BUILD_GAS_FROM_V1_ENTRY (FADT2->Xgpe0blk, FADT1->gpe0blk_len, FADT1->gpe0blk);
+ ASL_BUILD_GAS_FROM_V1_ENTRY (FADT2->Xgpe0_blk, FADT1->gpe0_blk_len, FADT1->gpe0_blk);
ASL_BUILD_GAS_FROM_V1_ENTRY (FADT2->Xgpe1_blk, FADT1->gpe1_blk_len, FADT1->gpe1_blk);
-#endif
}
-
/*
* Global FADT pointer will point to the common V2.0 FADT
*/
acpi_gbl_FADT = FADT2;
acpi_gbl_FADT->header.length = sizeof (FADT_DESCRIPTOR);
-
/* Free the original table */
table_desc = &acpi_gbl_acpi_tables[ACPI_TABLE_FADT];
acpi_tb_delete_single_table (table_desc);
-
/* Install the new table */
table_desc->pointer = (acpi_table_header *) acpi_gbl_FADT;
table_desc->allocation = ACPI_MEM_ALLOCATED;
table_desc->length = sizeof (fadt_descriptor_rev2);
-
/* Dump the entire FADT */
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
"Hex dump of common internal FADT, size %d (%X)\n",
acpi_gbl_FADT->header.length, acpi_gbl_FADT->header.length));
- DUMP_BUFFER ((u8 *) (acpi_gbl_FADT), acpi_gbl_FADT->header.length);
-
+ ACPI_DUMP_BUFFER ((u8 *) (acpi_gbl_FADT), acpi_gbl_FADT->header.length);
return_ACPI_STATUS (AE_OK);
}
*
* FUNCTION: Acpi_tb_convert_table_facs
*
- * PARAMETERS:
+ * PARAMETERS: Table_info - Info for currently installad FACS
*
- * RETURN:
+ * RETURN: Status
*
- * DESCRIPTION:
+ * DESCRIPTION: Convert ACPI 1.0 and ACPI 2.0 FACS to a common internal
+ * table format.
*
******************************************************************************/
acpi_tb_build_common_facs (
acpi_table_desc *table_info)
{
- acpi_common_facs *common_facs;
-
-#ifdef _IA64
- facs_descriptor_rev071 *FACS71;
-#else
facs_descriptor_rev1 *FACS1;
-#endif
-
facs_descriptor_rev2 *FACS2;
- FUNCTION_TRACE ("Tb_build_common_facs");
-
-
- /* Allocate a common FACS */
-
- common_facs = ACPI_MEM_CALLOCATE (sizeof (acpi_common_facs));
- if (!common_facs) {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
+ ACPI_FUNCTION_TRACE ("Tb_build_common_facs");
/* Copy fields to the new FACS */
if (acpi_gbl_RSDP->revision < 2) {
-#ifdef _IA64
- /* 0.71 FACS */
-
- FACS71 = (facs_descriptor_rev071 *) acpi_gbl_FACS;
-
- common_facs->global_lock = (u32 *) &(FACS71->global_lock);
- common_facs->firmware_waking_vector = &FACS71->firmware_waking_vector;
- common_facs->vector_width = 64;
-#else
/* ACPI 1.0 FACS */
FACS1 = (facs_descriptor_rev1 *) acpi_gbl_FACS;
- common_facs->global_lock = &(FACS1->global_lock);
- common_facs->firmware_waking_vector = (u64 *) &FACS1->firmware_waking_vector;
- common_facs->vector_width = 32;
-
-#endif
+ acpi_gbl_common_fACS.global_lock = &(FACS1->global_lock);
+ acpi_gbl_common_fACS.firmware_waking_vector = (u64 *) &FACS1->firmware_waking_vector;
+ acpi_gbl_common_fACS.vector_width = 32;
}
-
else {
/* ACPI 2.0 FACS */
FACS2 = (facs_descriptor_rev2 *) acpi_gbl_FACS;
- common_facs->global_lock = &(FACS2->global_lock);
- common_facs->firmware_waking_vector = &FACS2->Xfirmware_waking_vector;
- common_facs->vector_width = 64;
+ acpi_gbl_common_fACS.global_lock = &(FACS2->global_lock);
+ acpi_gbl_common_fACS.firmware_waking_vector = &FACS2->Xfirmware_waking_vector;
+ acpi_gbl_common_fACS.vector_width = 64;
}
-
- /* Set the global FACS pointer to point to the common FACS */
-
-
- acpi_gbl_FACS = common_facs;
-
return_ACPI_STATUS (AE_OK);
}
/******************************************************************************
*
* Module Name: tbget - ACPI Table get* routines
- * $Revision: 56 $
+ * $Revision: 63 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acpi.h"
-#include "achware.h"
#include "actables.h"
#define _COMPONENT ACPI_TABLES
- MODULE_NAME ("tbget")
-
-#define RSDP_CHECKSUM_LENGTH 20
+ ACPI_MODULE_NAME ("tbget")
/*******************************************************************************
u32 i;
- FUNCTION_TRACE ("Tb_get_table_ptr");
+ ACPI_FUNCTION_TRACE ("Tb_get_table_ptr");
if (!acpi_gbl_DSDT) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
-
/*
* For all table types (Single/Multiple), the first
* instance is always in the list head.
return_ACPI_STATUS (AE_OK);
}
-
/*
* Check for instance out of range
*/
acpi_status status = AE_OK;
- FUNCTION_TRACE ("Tb_get_table");
+ ACPI_FUNCTION_TRACE ("Tb_get_table");
if (!table_info) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
-
if (buffer_ptr) {
/*
* Getting data from a buffer, not BIOS tables
/* Copy the entire table (including header) to the local buffer */
size = table_header->length;
- MEMCPY (full_table, buffer_ptr, size);
+ ACPI_MEMCPY (full_table, buffer_ptr, size);
/* Save allocation type */
allocation = ACPI_MEM_ALLOCATED;
}
-
/*
* Not reading from a buffer, just map the table's physical memory
* into our address space.
allocation = ACPI_MEM_MAPPED;
}
-
/* Return values */
table_info->pointer = full_table;
acpi_table_desc table_info;
- FUNCTION_TRACE ("Tb_get_all_tables");
+ ACPI_FUNCTION_TRACE ("Tb_get_all_tables");
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Number of tables: %d\n", number_of_tables));
for (index = 0; index < number_of_tables; index++) {
/* Clear the Table_info each time */
- MEMSET (&table_info, 0, sizeof (acpi_table_desc));
+ ACPI_MEMSET (&table_info, 0, sizeof (acpi_table_desc));
/* Get the table via the XSDT */
}
}
-
/*
* Convert the FADT to a common format. This allows earlier revisions of the
* table to coexist with newer versions, using common access code.
return_ACPI_STATUS (status);
}
-
/*
* Get the minimum set of ACPI tables, namely:
*
return_ACPI_STATUS (status);
}
-
/*
* Get the DSDT (We know that the FADT is valid now)
*/
/* Dump the DSDT Header */
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Hex dump of DSDT Header:\n"));
- DUMP_BUFFER ((u8 *) acpi_gbl_DSDT, sizeof (acpi_table_header));
+ ACPI_DUMP_BUFFER ((u8 *) acpi_gbl_DSDT, sizeof (acpi_table_header));
/* Dump the entire DSDT */
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
"Hex dump of DSDT (After header), size %d (%x)\n",
acpi_gbl_DSDT->length, acpi_gbl_DSDT->length));
- DUMP_BUFFER ((u8 *) (acpi_gbl_DSDT + 1), acpi_gbl_DSDT->length);
-
- /*
- * Initialize the capabilities flags.
- * Assumes that platform supports ACPI_MODE since we have tables!
- */
- acpi_gbl_system_flags |= acpi_hw_get_mode_capabilities ();
-
+ ACPI_DUMP_BUFFER ((u8 *) (acpi_gbl_DSDT + 1), acpi_gbl_DSDT->length);
/* Always delete the RSDP mapping, we are done with it */
acpi_tb_delete_acpi_table (ACPI_TABLE_RSDP);
-
return_ACPI_STATUS (status);
}
{
acpi_table_desc table_info;
acpi_status status;
- u8 *table_ptr;
+ RSDP_DESCRIPTOR *rsdp;
- FUNCTION_TRACE ("Tb_verify_rsdp");
+ ACPI_FUNCTION_TRACE ("Tb_verify_rsdp");
/*
* Obtain access to the RSDP structure
*/
status = acpi_os_map_memory (rsdp_physical_address, sizeof (RSDP_DESCRIPTOR),
- (void **) &table_ptr);
+ (void **) &rsdp);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/*
* The signature and checksum must both be correct
*/
- if (STRNCMP ((NATIVE_CHAR *) table_ptr, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) {
+ if (ACPI_STRNCMP ((NATIVE_CHAR *) rsdp, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) {
/* Nope, BAD Signature */
status = AE_BAD_SIGNATURE;
goto cleanup;
}
- if (acpi_tb_checksum (table_ptr, RSDP_CHECKSUM_LENGTH) != 0) {
- /* Nope, BAD Checksum */
+ /* Check the standard checksum */
+ if (acpi_tb_checksum (rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) {
status = AE_BAD_CHECKSUM;
goto cleanup;
}
- /* TBD: Check extended checksum if table version >= 2 */
+ /* Check extended checksum if table version >= 2 */
+
+ if (rsdp->revision >= 2) {
+ if (acpi_tb_checksum (rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0) {
+ status = AE_BAD_CHECKSUM;
+ goto cleanup;
+ }
+ }
+
/* The RSDP supplied is OK */
- table_info.pointer = (acpi_table_header *) table_ptr;
+ table_info.pointer = (acpi_table_header *) rsdp;
table_info.length = sizeof (RSDP_DESCRIPTOR);
table_info.allocation = ACPI_MEM_MAPPED;
- table_info.base_pointer = table_ptr;
+ table_info.base_pointer = rsdp;
/* Save the table pointers and allocation info */
goto cleanup;
}
-
/* Save the RSDP in a global for easy access */
acpi_gbl_RSDP = (RSDP_DESCRIPTOR *) table_info.pointer;
/* Error exit */
cleanup:
- acpi_os_unmap_memory (table_ptr, sizeof (RSDP_DESCRIPTOR));
+ acpi_os_unmap_memory (rsdp, sizeof (RSDP_DESCRIPTOR));
return_ACPI_STATUS (status);
}
ACPI_PHYSICAL_ADDRESS physical_address;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/*
* For RSDP revision 2 (and above), we use the XSDT
*/
if (acpi_gbl_RSDP->revision < 2) {
-#ifdef _IA64
- /* 0.71 RSDP has 64bit Rsdt address field */
- physical_address = ((RSDP_DESCRIPTOR_REV071 *)acpi_gbl_RSDP)->rsdt_physical_address;
-#else
physical_address = (ACPI_PHYSICAL_ADDRESS) acpi_gbl_RSDP->rsdt_physical_address;
-#endif
}
-
else {
physical_address = (ACPI_PHYSICAL_ADDRESS)
ACPI_GET_ADDRESS (acpi_gbl_RSDP->xsdt_physical_address);
u32 no_match;
- PROC_NAME ("Tb_validate_rsdt");
+ ACPI_FUNCTION_NAME ("Tb_validate_rsdt");
/*
* For RSDP revision 0 or 1, we use the RSDT.
- * For RSDP revision 2 (and above), we use the XSDT
+ * For RSDP revision 2 and above, we use the XSDT
*/
if (acpi_gbl_RSDP->revision < 2) {
- no_match = STRNCMP ((char *) table_ptr, RSDT_SIG,
+ no_match = ACPI_STRNCMP ((char *) table_ptr, RSDT_SIG,
sizeof (RSDT_SIG) -1);
}
else {
- no_match = STRNCMP ((char *) table_ptr, XSDT_SIG,
+ no_match = ACPI_STRNCMP ((char *) table_ptr, XSDT_SIG,
sizeof (XSDT_SIG) -1);
}
-
if (no_match) {
/* Invalid RSDT or XSDT signature */
- REPORT_ERROR (("Invalid signature where RSDP indicates RSDT/XSDT should be located\n"));
+ ACPI_REPORT_ERROR (("Invalid signature where RSDP indicates RSDT/XSDT should be located\n"));
- DUMP_BUFFER (acpi_gbl_RSDP, 20);
+ ACPI_DUMP_BUFFER (acpi_gbl_RSDP, 20);
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR,
"RSDT/XSDT signature at %X is invalid\n",
acpi_status status;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) {
*size = SIZE_IN_HEADER;
status = acpi_tb_map_acpi_table (physical_address, size, table_ptr);
}
-
else {
*size = 0;
- *table_ptr = (acpi_table_header *) (ACPI_TBLPTR) physical_address;
-
+ *table_ptr = ACPI_PHYSADDR_TO_PTR (physical_address);
status = AE_OK;
}
ACPI_PHYSICAL_ADDRESS physical_address;
- FUNCTION_TRACE ("Tb_get_table_rsdt");
+ ACPI_FUNCTION_TRACE ("Tb_get_table_rsdt");
/*
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"RSDP located at %p, RSDT physical=%8.8X%8.8X \n",
- acpi_gbl_RSDP, HIDWORD(acpi_gbl_RSDP->rsdt_physical_address),
- LODWORD(acpi_gbl_RSDP->rsdt_physical_address)));
-
+ acpi_gbl_RSDP,
+ ACPI_HIDWORD (acpi_gbl_RSDP->rsdt_physical_address),
+ ACPI_LODWORD (acpi_gbl_RSDP->rsdt_physical_address)));
physical_address = acpi_tb_get_rsdt_address ();
-
/* Get the RSDT/XSDT */
status = acpi_tb_get_table (physical_address, NULL, &table_info);
return_ACPI_STATUS (status);
}
-
/* Check the RSDT or XSDT signature */
status = acpi_tb_validate_rsdt (table_info.pointer);
return_ACPI_STATUS (status);
}
-
/*
* Valid RSDT signature, verify the checksum. If it fails, just
* print a warning and ignore it.
*/
status = acpi_tb_verify_table_checksum (table_info.pointer);
-
/* Convert and/or copy to an XSDT structure */
status = acpi_tb_convert_to_xsdt (&table_info, number_of_tables);
acpi_gbl_XSDT = (xsdt_descriptor *) table_info.pointer;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "XSDT located at %p\n", acpi_gbl_XSDT));
-
return_ACPI_STATUS (status);
}
acpi_status status = AE_OK;
- FUNCTION_TRACE ("Tb_get_table_facs");
+ ACPI_FUNCTION_TRACE ("Tb_get_table_facs");
/* Must have a valid FADT pointer */
return_ACPI_STATUS (AE_NO_MEMORY);
}
- MEMCPY (table_ptr, buffer_ptr, size);
+ ACPI_MEMCPY (table_ptr, buffer_ptr, size);
/* Save allocation type */
allocation = ACPI_MEM_ALLOCATED;
}
-
else {
/* Just map the physical memory to our address space */
allocation = ACPI_MEM_MAPPED;
}
-
/* Return values */
table_info->pointer = table_ptr;
/******************************************************************************
*
* Module Name: tbinstal - ACPI table installation and removal
- * $Revision: 45 $
+ * $Revision: 55 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acpi.h"
-#include "achware.h"
#include "actables.h"
#define _COMPONENT ACPI_TABLES
- MODULE_NAME ("tbinstal")
+ ACPI_MODULE_NAME ("tbinstal")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_tb_match_signature
+ *
+ * PARAMETERS: Signature - Table signature to match
+ * Table_info - Return data
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Compare signature against the list of "ACPI-subsystem-owned"
+ * tables (DSDT/FADT/SSDT, etc.) Returns the Table_type_iD on match.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_tb_match_signature (
+ NATIVE_CHAR *signature,
+ acpi_table_desc *table_info)
+{
+ NATIVE_UINT i;
+
+
+ ACPI_FUNCTION_TRACE ("Tb_match_signature");
+
+
+ /*
+ * Search for a signature match among the known table types
+ */
+ for (i = 0; i < NUM_ACPI_TABLES; i++) {
+ if (!ACPI_STRNCMP (signature, acpi_gbl_acpi_table_data[i].signature,
+ acpi_gbl_acpi_table_data[i].sig_length)) {
+ /* Found a signature match, return index if requested */
+
+ if (table_info) {
+ table_info->type = (u8) i;
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ACPI Signature match %4.4s\n",
+ (char *) acpi_gbl_acpi_table_data[i].signature));
+
+ return_ACPI_STATUS (AE_OK);
+ }
+ }
+
+ return_ACPI_STATUS (AE_TABLE_NOT_SUPPORTED);
+}
/*******************************************************************************
{
acpi_status status;
- FUNCTION_TRACE ("Tb_install_table");
+ ACPI_FUNCTION_TRACE ("Tb_install_table");
/*
/* Lock tables while installing */
- acpi_ut_acquire_mutex (ACPI_MTX_TABLES);
+ status = acpi_ut_acquire_mutex (ACPI_MTX_TABLES);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
/* Install the table into the global data structure */
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s located at %p\n",
acpi_gbl_acpi_table_data[table_info->type].name, table_info->pointer));
- acpi_ut_release_mutex (ACPI_MTX_TABLES);
+ (void) acpi_ut_release_mutex (ACPI_MTX_TABLES);
return_ACPI_STATUS (status);
}
{
acpi_table_header *table_header;
acpi_status status;
- acpi_table_type table_type = 0;
- u32 i;
- FUNCTION_TRACE ("Tb_recognize_table");
+ ACPI_FUNCTION_TRACE ("Tb_recognize_table");
/* Ensure that we have a valid table pointer */
}
/*
- * Search for a signature match among the known table types
- * Start at index one -> Skip the RSDP
+ * We only "recognize" a limited number of ACPI tables -- namely, the
+ * ones that are used by the subsystem (DSDT, FADT, etc.)
+ *
+ * An AE_NOT_FOUND means that the table was not recognized.
+ * This can be any one of many valid ACPI tables, it just isn't one of
+ * the tables that is consumed by the core subsystem
*/
- status = AE_SUPPORT;
- for (i = 1; i < NUM_ACPI_TABLES; i++) {
- if (!STRNCMP (table_header->signature,
- acpi_gbl_acpi_table_data[i].signature,
- acpi_gbl_acpi_table_data[i].sig_length)) {
- /*
- * Found a signature match, get the pertinent info from the
- * Table_data structure
- */
- table_type = i;
- status = acpi_gbl_acpi_table_data[i].status;
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Found %4.4s\n",
- (char*)acpi_gbl_acpi_table_data[i].signature));
- break;
- }
- }
-
- /* Return the table type and length via the info struct */
-
- table_info->type = (u8) table_type;
- table_info->length = table_header->length;
+ status = acpi_tb_match_signature (table_header->signature, table_info);
+ if (ACPI_SUCCESS (status)) {
+ /* Return the table type and length via the info struct */
+ table_info->length = table_header->length;
- /*
- * Validate checksum for _most_ tables,
- * even the ones whose signature we don't recognize
- */
- if (table_type != ACPI_TABLE_FACS) {
- /* But don't abort if the checksum is wrong */
- /* TBD: [Future] make this a configuration option? */
-
- acpi_tb_verify_table_checksum (table_header);
- }
+ /*
+ * Validate checksum for _most_ tables,
+ * even the ones whose signature we don't recognize
+ */
+ if (table_info->type != ACPI_TABLE_FACS) {
+ status = acpi_tb_verify_table_checksum (table_header);
+ if (ACPI_FAILURE (status) &&
+ (!ACPI_CHECKSUM_ABORT)) {
+ /* Ignore the error if configuration says so */
- /*
- * An AE_SUPPORT means that the table was not recognized.
- * We basically ignore this; just print a debug message
- */
- if (status == AE_SUPPORT) {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Unsupported table %s (Type %X) was found and discarded\n",
- acpi_gbl_acpi_table_data[table_type].name, table_type));
+ status = AE_OK;
+ }
+ }
}
return_ACPI_STATUS (status);
acpi_table_desc *table_desc;
- FUNCTION_TRACE_U32 ("Tb_init_table_descriptor", table_type);
+ ACPI_FUNCTION_TRACE_U32 ("Tb_init_table_descriptor", table_type);
/*
* Install the table into the global data structure
list_head = &acpi_gbl_acpi_tables[table_type];
table_desc = list_head;
-
/*
* Two major types of tables: 1) Only one instance is allowed. This
* includes most ACPI tables such as the DSDT. 2) Multiple instances of
* the table are allowed. This includes SSDT and PSDTs.
*/
- if (IS_SINGLE_TABLE (acpi_gbl_acpi_table_data[table_type].flags)) {
+ if (ACPI_IS_SINGLE_TABLE (acpi_gbl_acpi_table_data[table_type].flags)) {
/*
* Only one table allowed, and a table has alread been installed
* at this location, so return an error.
*/
if (list_head->pointer) {
- return_ACPI_STATUS (AE_EXIST);
+ return_ACPI_STATUS (AE_ALREADY_EXISTS);
}
table_desc->count = 1;
+ table_desc->prev = NULL;
+ table_desc->next = NULL;
}
-
-
else {
/*
* Multiple tables allowed for this table type, we must link
list_head->prev = table_desc;
}
-
else {
table_desc->count = 1;
}
}
-
/* Common initialization of the table descriptor */
+ table_desc->type = table_info->type;
table_desc->pointer = table_info->pointer;
table_desc->base_pointer = table_info->base_pointer;
table_desc->length = table_info->length;
table_desc->aml_start = (u8 *) (table_desc->pointer + 1),
table_desc->aml_length = (u32) (table_desc->length -
(u32) sizeof (acpi_table_header));
- table_desc->table_id = acpi_ut_allocate_owner_id (OWNER_TYPE_TABLE);
+ table_desc->table_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_TABLE);
table_desc->loaded_into_namespace = FALSE;
/*
*(acpi_gbl_acpi_table_data[table_type].global_ptr) = table_info->pointer;
}
-
/* Return Data */
table_info->table_id = table_desc->table_id;
for (type = 0; type < NUM_ACPI_TABLES; type++) {
acpi_tb_delete_acpi_table (type);
}
-
}
acpi_tb_delete_acpi_table (
acpi_table_type type)
{
- FUNCTION_TRACE_U32 ("Tb_delete_acpi_table", type);
+
+ ACPI_FUNCTION_TRACE_U32 ("Tb_delete_acpi_table", type);
if (type > ACPI_TABLE_MAX) {
return_VOID;
}
-
- acpi_ut_acquire_mutex (ACPI_MTX_TABLES);
+ if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_TABLES))) {
+ return;
+ }
/* Free the table */
acpi_tb_free_acpi_tables_of_type (&acpi_gbl_acpi_tables[type]);
-
/* Clear the appropriate "typed" global table pointer */
switch (type) {
break;
}
- acpi_ut_release_mutex (ACPI_MTX_TABLES);
-
+ (void) acpi_ut_release_mutex (ACPI_MTX_TABLES);
return_VOID;
}
u32 i;
- FUNCTION_TRACE_PTR ("Tb_free_acpi_tables_of_type", list_head);
+ ACPI_FUNCTION_TRACE_PTR ("Tb_free_acpi_tables_of_type", list_head);
/* Get the head of the list */
/* Valid table, determine type of memory allocation */
switch (table_desc->allocation) {
-
case ACPI_MEM_NOT_ALLOCATED:
break;
-
case ACPI_MEM_ALLOCATED:
ACPI_MEM_FREE (table_desc->base_pointer);
break;
-
case ACPI_MEM_MAPPED:
acpi_os_unmap_memory (table_desc->base_pointer, table_desc->length);
acpi_table_desc *next_desc;
- FUNCTION_TRACE_PTR ("Tb_delete_single_table", table_desc);
+ ACPI_FUNCTION_TRACE_PTR ("Tb_delete_single_table", table_desc);
if (!table_desc) {
return_PTR (NULL);
}
-
/* Unlink the descriptor */
if (table_desc->prev) {
table_desc->next->prev = table_desc->prev;
}
-
/* Free the memory allocated for the table itself */
acpi_tb_delete_single_table (table_desc);
-
/* Free the table descriptor (Don't delete the list head, tho) */
if ((table_desc->prev) == (table_desc->next)) {
-
next_desc = NULL;
/* Clear the list head */
table_desc->pointer = NULL;
table_desc->length = 0;
table_desc->count = 0;
-
}
-
else {
/* Free the table descriptor */
ACPI_MEM_FREE (table_desc);
}
-
return_PTR (next_desc);
}
/******************************************************************************
*
* Module Name: tbutils - Table manipulation utilities
- * $Revision: 42 $
+ * $Revision: 49 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_TABLES
- MODULE_NAME ("tbutils")
+ ACPI_MODULE_NAME ("tbutils")
/*******************************************************************************
acpi_table_desc *list_head;
- PROC_NAME ("Tb_handle_to_object");
+ ACPI_FUNCTION_NAME ("Tb_handle_to_object");
for (i = 0; i < ACPI_TABLE_MAX; i++) {
}
-/*******************************************************************************
- *
- * FUNCTION: Acpi_tb_system_table_pointer
- *
- * PARAMETERS: *Where - Pointer to be examined
- *
- * RETURN: TRUE if Where is within the AML stream (in one of the ACPI
- * system tables such as the DSDT or an SSDT.)
- * FALSE otherwise
- *
- ******************************************************************************/
-
-u8
-acpi_tb_system_table_pointer (
- void *where)
-{
- u32 i;
- acpi_table_desc *table_desc;
- acpi_table_header *table;
-
-
- /* No function trace, called too often! */
-
-
- /* Ignore null pointer */
-
- if (!where) {
- return (FALSE);
- }
-
-
- /* Check for a pointer within the DSDT */
-
- if ((acpi_gbl_DSDT) &&
- (IS_IN_ACPI_TABLE (where, acpi_gbl_DSDT))) {
- return (TRUE);
- }
-
-
- /* Check each of the loaded SSDTs (if any)*/
-
- table_desc = &acpi_gbl_acpi_tables[ACPI_TABLE_SSDT];
-
- for (i = 0; i < acpi_gbl_acpi_tables[ACPI_TABLE_SSDT].count; i++) {
- table = table_desc->pointer;
-
- if (IS_IN_ACPI_TABLE (where, table)) {
- return (TRUE);
- }
-
- table_desc = table_desc->next;
- }
-
-
- /* Check each of the loaded PSDTs (if any)*/
-
- table_desc = &acpi_gbl_acpi_tables[ACPI_TABLE_PSDT];
-
- for (i = 0; i < acpi_gbl_acpi_tables[ACPI_TABLE_PSDT].count; i++) {
- table = table_desc->pointer;
-
- if (IS_IN_ACPI_TABLE (where, table)) {
- return (TRUE);
- }
-
- table_desc = table_desc->next;
- }
-
-
- /* Pointer does not point into any system table */
-
- return (FALSE);
-}
-
-
/*******************************************************************************
*
* FUNCTION: Acpi_tb_validate_table_header
acpi_name signature;
- PROC_NAME ("Tb_validate_table_header");
+ ACPI_FUNCTION_NAME ("Tb_validate_table_header");
/* Verify that this is a valid address */
/* Ensure that the signature is 4 ASCII characters */
- MOVE_UNALIGNED32_TO_32 (&signature, &table_header->signature);
+ ACPI_MOVE_UNALIGNED32_TO_32 (&signature, &table_header->signature);
if (!acpi_ut_valid_acpi_name (signature)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Table signature at %p [%p] has invalid characters\n",
table_header, &signature));
- REPORT_WARNING (("Invalid table signature %4.4s found\n", (char*)&signature));
- DUMP_BUFFER (table_header, sizeof (acpi_table_header));
+ ACPI_REPORT_WARNING (("Invalid table signature %4.4s found\n", (char *) &signature));
+ ACPI_DUMP_BUFFER (table_header, sizeof (acpi_table_header));
return (AE_BAD_SIGNATURE);
}
if (table_header->length < sizeof (acpi_table_header)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Invalid length in table header %p name %4.4s\n",
- table_header, (char*)&signature));
+ table_header, (char *) &signature));
- REPORT_WARNING (("Invalid table header length found\n"));
- DUMP_BUFFER (table_header, sizeof (acpi_table_header));
+ ACPI_REPORT_WARNING (("Invalid table header length (0x%X) found\n", table_header->length));
+ ACPI_DUMP_BUFFER (table_header, sizeof (acpi_table_header));
return (AE_BAD_HEADER);
}
acpi_status status = AE_OK;
- PROC_NAME ("Tb_map_acpi_table");
+ ACPI_FUNCTION_NAME ("Tb_map_acpi_table");
/* If size is zero, look at the table header to get the actual size */
acpi_status status = AE_OK;
- FUNCTION_TRACE ("Tb_verify_table_checksum");
+ ACPI_FUNCTION_TRACE ("Tb_verify_table_checksum");
/* Compute the checksum on the table */
/* Return the appropriate exception */
if (checksum) {
- REPORT_WARNING (("Invalid checksum (%X) in table %4.4s\n",
- checksum, (char*)&table_header->signature));
+ ACPI_REPORT_WARNING (("Invalid checksum (%X) in table %4.4s\n",
+ checksum, (char *) &table_header->signature));
status = AE_BAD_CHECKSUM;
}
void *buffer,
u32 length)
{
- u8 *limit;
- u8 *rover;
+ const u8 *limit;
+ const u8 *rover;
u8 sum = 0;
*
* Module Name: tbxface - Public interfaces to the ACPI subsystem
* ACPI table oriented interfaces
- * $Revision: 45 $
+ * $Revision: 51 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_TABLES
- MODULE_NAME ("tbxface")
+ ACPI_MODULE_NAME ("tbxface")
/*******************************************************************************
u32 number_of_tables = 0;
- FUNCTION_TRACE ("Acpi_load_tables");
+ ACPI_FUNCTION_TRACE ("Acpi_load_tables");
/* Get the RSDP */
status = acpi_os_get_root_pointer (ACPI_LOGICAL_ADDRESSING,
&rsdp_physical_address);
if (ACPI_FAILURE (status)) {
- REPORT_ERROR (("Acpi_load_tables: Could not get RSDP, %s\n",
+ ACPI_REPORT_ERROR (("Acpi_load_tables: Could not get RSDP, %s\n",
acpi_format_exception (status)));
goto error_exit;
}
status = acpi_tb_verify_rsdp (rsdp_physical_address);
if (ACPI_FAILURE (status)) {
- REPORT_ERROR (("Acpi_load_tables: RSDP Failed validation: %s\n",
+ ACPI_REPORT_ERROR (("Acpi_load_tables: RSDP Failed validation: %s\n",
acpi_format_exception (status)));
goto error_exit;
}
status = acpi_tb_get_table_rsdt (&number_of_tables);
if (ACPI_FAILURE (status)) {
- REPORT_ERROR (("Acpi_load_tables: Could not load RSDT: %s\n",
+ ACPI_REPORT_ERROR (("Acpi_load_tables: Could not load RSDT: %s\n",
acpi_format_exception (status)));
goto error_exit;
}
status = acpi_tb_get_all_tables (number_of_tables, NULL);
if (ACPI_FAILURE (status)) {
- REPORT_ERROR (("Acpi_load_tables: Error getting required tables (DSDT/FADT/FACS): %s\n",
+ ACPI_REPORT_ERROR (("Acpi_load_tables: Error getting required tables (DSDT/FADT/FACS): %s\n",
acpi_format_exception (status)));
goto error_exit;
}
status = acpi_ns_load_namespace ();
if (ACPI_FAILURE (status)) {
- REPORT_ERROR (("Acpi_load_tables: Could not load namespace: %s\n",
+ ACPI_REPORT_ERROR (("Acpi_load_tables: Could not load namespace: %s\n",
acpi_format_exception (status)));
goto error_exit;
}
error_exit:
- REPORT_ERROR (("Acpi_load_tables: Could not load tables: %s\n",
+ ACPI_REPORT_ERROR (("Acpi_load_tables: Could not load tables: %s\n",
acpi_format_exception (status)));
return_ACPI_STATUS (status);
acpi_table_desc table_info;
- FUNCTION_TRACE ("Acpi_load_table");
+ ACPI_FUNCTION_TRACE ("Acpi_load_table");
if (!table_ptr) {
return_ACPI_STATUS (status);
}
+ /* Convert the table to common format if necessary */
+
+ switch (table_info.type) {
+ case ACPI_TABLE_FADT:
+
+ status = acpi_tb_convert_table_fadt ();
+ break;
+
+ case ACPI_TABLE_FACS:
+
+ status = acpi_tb_build_common_facs (&table_info);
+ break;
+
+ default:
+ /* Load table into namespace if it contains executable AML */
+
+ status = acpi_ns_load_table (table_info.installed_desc, acpi_gbl_root_node);
+ break;
+ }
- status = acpi_ns_load_table (table_info.installed_desc, acpi_gbl_root_node);
if (ACPI_FAILURE (status)) {
/* Uninstall table and free the buffer */
acpi_tb_uninstall_table (table_info.installed_desc);
- return_ACPI_STATUS (status);
}
-
return_ACPI_STATUS (status);
}
acpi_table_desc *list_head;
- FUNCTION_TRACE ("Acpi_unload_table");
+ ACPI_FUNCTION_TRACE ("Acpi_unload_table");
/* Parameter validation */
acpi_status status;
- FUNCTION_TRACE ("Acpi_get_table_header");
+ ACPI_FUNCTION_TRACE ("Acpi_get_table_header");
if ((instance == 0) ||
/* Check the table type and instance */
if ((table_type > ACPI_TABLE_MAX) ||
- (IS_SINGLE_TABLE (acpi_gbl_acpi_table_data[table_type].flags) &&
+ (ACPI_IS_SINGLE_TABLE (acpi_gbl_acpi_table_data[table_type].flags) &&
instance > 1)) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/*
* Copy the header to the caller's buffer
*/
- MEMCPY ((void *) out_table_header, (void *) tbl_ptr,
+ ACPI_MEMCPY ((void *) out_table_header, (void *) tbl_ptr,
sizeof (acpi_table_header));
return_ACPI_STATUS (status);
{
acpi_table_header *tbl_ptr;
acpi_status status;
- u32 ret_buf_len;
+ u32 table_length;
- FUNCTION_TRACE ("Acpi_get_table");
+ ACPI_FUNCTION_TRACE ("Acpi_get_table");
- /*
- * If we have a buffer, we must have a length too
- */
- if ((instance == 0) ||
- (!ret_buffer) ||
- ((!ret_buffer->pointer) && (ret_buffer->length))) {
+ /* Parameter validation */
+
+ if (instance == 0) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
+ status = acpi_ut_validate_buffer (ret_buffer);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+
/* Check the table type and instance */
if ((table_type > ACPI_TABLE_MAX) ||
- (IS_SINGLE_TABLE (acpi_gbl_acpi_table_data[table_type].flags) &&
+ (ACPI_IS_SINGLE_TABLE (acpi_gbl_acpi_table_data[table_type].flags) &&
instance > 1)) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
return_ACPI_STATUS (AE_NOT_EXIST);
}
- /*
- * Got a table ptr, assume it's ok and copy it to the user's buffer
- */
+ /* Get the table length */
+
if (table_type == ACPI_TABLE_RSDP) {
/*
* RSD PTR is the only "table" without a header
*/
- ret_buf_len = sizeof (RSDP_DESCRIPTOR);
+ table_length = sizeof (RSDP_DESCRIPTOR);
}
else {
- ret_buf_len = tbl_ptr->length;
+ table_length = tbl_ptr->length;
}
- /*
- * Verify we have space in the caller's buffer for the table
- */
- if (ret_buffer->length < ret_buf_len) {
- ret_buffer->length = ret_buf_len;
- return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
- }
+ /* Validate/Allocate/Clear caller buffer */
- ret_buffer->length = ret_buf_len;
+ status = acpi_ut_initialize_buffer (ret_buffer, table_length);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
- MEMCPY ((void *) ret_buffer->pointer, (void *) tbl_ptr, ret_buf_len);
+ /* Copy the table to the buffer */
+ ACPI_MEMCPY ((void *) ret_buffer->pointer, (void *) tbl_ptr, table_length);
return_ACPI_STATUS (AE_OK);
}
/******************************************************************************
*
* Module Name: tbxfroot - Find the root ACPI table (RSDT)
- * $Revision: 52 $
+ * $Revision: 58 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acpi.h"
-#include "achware.h"
#include "actables.h"
#define _COMPONENT ACPI_TABLES
- MODULE_NAME ("tbxfroot")
-
-#define RSDP_CHECKSUM_LENGTH 20
+ ACPI_MODULE_NAME ("tbxfroot")
/*******************************************************************************
*
- * FUNCTION: Acpi_find_root_pointer
+ * FUNCTION: Acpi_tb_find_table
*
- * PARAMETERS: **Rsdp_physical_address - Where to place the RSDP address
- * Flags - Logical/Physical addressing
+ * PARAMETERS: Signature - String with ACPI table signature
+ * Oem_id - String with the table OEM ID
+ * Oem_table_id - String with the OEM Table ID.
*
- * RETURN: Status, Physical address of the RSDP
+ * RETURN: Status
*
- * DESCRIPTION: Find the RSDP
+ * DESCRIPTION: Find an ACPI table (in the RSDT/XSDT) that matches the
+ * Signature, OEM ID and OEM Table ID.
*
******************************************************************************/
acpi_status
-acpi_find_root_pointer (
- u32 flags,
- ACPI_PHYSICAL_ADDRESS *rsdp_physical_address)
+acpi_tb_find_table (
+ NATIVE_CHAR *signature,
+ NATIVE_CHAR *oem_id,
+ NATIVE_CHAR *oem_table_id,
+ acpi_table_header **table_ptr)
{
- acpi_table_desc table_info;
acpi_status status;
+ acpi_table_header *table;
- FUNCTION_TRACE ("Acpi_find_root_pointer");
+ ACPI_FUNCTION_TRACE ("Tb_find_table");
- /* Get the RSDP */
+ /* Validate string lengths */
- status = acpi_tb_find_rsdp (&table_info, flags);
- if (ACPI_FAILURE (status)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "RSDP structure not found\n"));
- return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+ if ((ACPI_STRLEN (signature) > 4) ||
+ (ACPI_STRLEN (oem_id) > 6) ||
+ (ACPI_STRLEN (oem_table_id) > 8)) {
+ return_ACPI_STATUS (AE_AML_STRING_LIMIT);
}
- *rsdp_physical_address = table_info.physical_address;
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_tb_scan_memory_for_rsdp
- *
- * PARAMETERS: Start_address - Starting pointer for search
- * Length - Maximum length to search
- *
- * RETURN: Pointer to the RSDP if found, otherwise NULL.
- *
- * DESCRIPTION: Search a block of memory for the RSDP signature
- *
- ******************************************************************************/
-
-u8 *
-acpi_tb_scan_memory_for_rsdp (
- u8 *start_address,
- u32 length)
-{
- u32 offset;
- u8 *mem_rover;
-
-
- FUNCTION_TRACE ("Tb_scan_memory_for_rsdp");
-
-
- /* Search from given start addr for the requested length */
-
- for (offset = 0, mem_rover = start_address;
- offset < length;
- offset += RSDP_SCAN_STEP, mem_rover += RSDP_SCAN_STEP) {
-
- /* The signature and checksum must both be correct */
-
- if (STRNCMP ((NATIVE_CHAR *) mem_rover,
- RSDP_SIG, sizeof (RSDP_SIG)-1) == 0 &&
- acpi_tb_checksum (mem_rover, RSDP_CHECKSUM_LENGTH) == 0) {
- /* If so, we have found the RSDP */
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "RSDP located at physical address %p\n",mem_rover));
- return_PTR (mem_rover);
- }
- }
-
- /* Searched entire block, no RSDP was found */
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,"Searched entire block, no RSDP was found.\n"));
-
- return_PTR (NULL);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_tb_find_rsdp
- *
- * PARAMETERS: *Table_info - Where the table info is returned
- * Flags - Current memory mode (logical vs.
- * physical addressing)
- *
- * RETURN: Status
- *
- * DESCRIPTION: Search lower 1_mbyte of memory for the root system descriptor
- * pointer structure. If it is found, set *RSDP to point to it.
- *
- * NOTE: The RSDP must be either in the first 1_k of the Extended
- * BIOS Data Area or between E0000 and FFFFF (ACPI 1.0 section
- * 5.2.2; assertion #421).
- *
- ******************************************************************************/
-
-acpi_status
-acpi_tb_find_rsdp (
- acpi_table_desc *table_info,
- u32 flags)
-{
- u8 *table_ptr;
- u8 *mem_rover;
- u64 phys_addr;
- acpi_status status = AE_OK;
-
-
- FUNCTION_TRACE ("Tb_find_rsdp");
-
-
- /*
- * Scan supports either 1) Logical addressing or 2) Physical addressing
- */
- if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) {
- /*
- * 1) Search EBDA (low memory) paragraphs
- */
- status = acpi_os_map_memory (LO_RSDP_WINDOW_BASE, LO_RSDP_WINDOW_SIZE,
- (void **) &table_ptr);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
- mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, LO_RSDP_WINDOW_SIZE);
- acpi_os_unmap_memory (table_ptr, LO_RSDP_WINDOW_SIZE);
-
- if (mem_rover) {
- /* Found it, return the physical address */
-
- phys_addr = LO_RSDP_WINDOW_BASE;
- phys_addr += (mem_rover - table_ptr);
-
- table_info->physical_address = phys_addr;
-
- return_ACPI_STATUS (AE_OK);
- }
-
- /*
- * 2) Search upper memory: 16-byte boundaries in E0000h-F0000h
- */
- status = acpi_os_map_memory (HI_RSDP_WINDOW_BASE, HI_RSDP_WINDOW_SIZE,
- (void **) &table_ptr);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
- mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, HI_RSDP_WINDOW_SIZE);
- acpi_os_unmap_memory (table_ptr, HI_RSDP_WINDOW_SIZE);
-
- if (mem_rover) {
- /* Found it, return the physical address */
+ /* Find the table */
- phys_addr = HI_RSDP_WINDOW_BASE;
- phys_addr += (mem_rover - table_ptr);
-
- table_info->physical_address = phys_addr;
-
- return_ACPI_STATUS (AE_OK);
- }
+ status = acpi_get_firmware_table (signature, 1,
+ ACPI_LOGICAL_ADDRESSING, &table);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
}
+ /* Check Oem_id and Oem_table_id */
- /*
- * Physical addressing
- */
- else {
- /*
- * 1) Search EBDA (low memory) paragraphs
- */
- mem_rover = acpi_tb_scan_memory_for_rsdp ((u8 *) LO_RSDP_WINDOW_BASE,
- LO_RSDP_WINDOW_SIZE);
- if (mem_rover) {
- /* Found it, return the physical address */
-
- table_info->physical_address = (ACPI_TBLPTR) mem_rover;
- return_ACPI_STATUS (AE_OK);
- }
-
- /*
- * 2) Search upper memory: 16-byte boundaries in E0000h-F0000h
- */
- mem_rover = acpi_tb_scan_memory_for_rsdp ((u8 *) HI_RSDP_WINDOW_BASE,
- HI_RSDP_WINDOW_SIZE);
- if (mem_rover) {
- /* Found it, return the physical address */
-
- table_info->physical_address = (ACPI_TBLPTR) mem_rover;
- return_ACPI_STATUS (AE_OK);
- }
+ if ((oem_id[0] && ACPI_STRCMP (oem_id, table->oem_id)) ||
+ (oem_table_id[0] && ACPI_STRCMP (oem_table_id, table->oem_table_id))) {
+ return_ACPI_STATUS (AE_AML_NAME_NOT_FOUND);
}
-
- /* RSDP signature was not found */
-
- return_ACPI_STATUS (AE_NOT_FOUND);
+ *table_ptr = table;
+ return_ACPI_STATUS (AE_OK);
}
u32 j;
- FUNCTION_TRACE ("Acpi_get_firmware_table");
+ ACPI_FUNCTION_TRACE ("Acpi_get_firmware_table");
/*
}
}
else {
- acpi_gbl_RSDP = (void *) (NATIVE_UINT) physical_address;
+ acpi_gbl_RSDP = ACPI_PHYSADDR_TO_PTR (physical_address);
}
/*
* The signature and checksum must both be correct
*/
- if (STRNCMP ((NATIVE_CHAR *) acpi_gbl_RSDP, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) {
+ if (ACPI_STRNCMP ((NATIVE_CHAR *) acpi_gbl_RSDP, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) {
/* Nope, BAD Signature */
status = AE_BAD_SIGNATURE;
goto cleanup;
}
- if (acpi_tb_checksum (acpi_gbl_RSDP, RSDP_CHECKSUM_LENGTH) != 0) {
+ if (acpi_tb_checksum (acpi_gbl_RSDP, ACPI_RSDP_CHECKSUM_LENGTH) != 0) {
/* Nope, BAD Checksum */
status = AE_BAD_CHECKSUM;
}
}
-
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"RSDP located at %p, RSDT physical=%8.8X%8.8X \n",
- acpi_gbl_RSDP, HIDWORD(acpi_gbl_RSDP->rsdt_physical_address),
- LODWORD(acpi_gbl_RSDP->rsdt_physical_address)));
-
+ acpi_gbl_RSDP,
+ ACPI_HIDWORD (acpi_gbl_RSDP->rsdt_physical_address),
+ ACPI_LODWORD (acpi_gbl_RSDP->rsdt_physical_address)));
/* Get the RSDT and validate it */
goto cleanup;
}
-
/* Get the number of table pointers within the RSDT */
table_count = acpi_tb_get_table_count (acpi_gbl_RSDP, rsdt_ptr);
/* Get the next table pointer */
if (acpi_gbl_RSDP->revision < 2) {
- physical_address = ((RSDT_DESCRIPTOR *) rsdt_ptr)->table_offset_entry[i];
+ physical_address = (ACPI_PHYSICAL_ADDRESS)
+ ((RSDT_DESCRIPTOR *) rsdt_ptr)->table_offset_entry[i];
}
else {
physical_address = (ACPI_PHYSICAL_ADDRESS)
/* Compare table signatures and table instance */
- if (!STRNCMP ((char *) table_ptr, signature, STRLEN (signature))) {
+ if (!ACPI_STRNCMP ((char *) table_ptr, signature, ACPI_STRLEN (signature))) {
/* An instance of the table was found */
j++;
}
+/* TBD: Move to a new file */
+
+#ifndef _IA16
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_find_root_pointer
+ *
+ * PARAMETERS: **Rsdp_physical_address - Where to place the RSDP address
+ * Flags - Logical/Physical addressing
+ *
+ * RETURN: Status, Physical address of the RSDP
+ *
+ * DESCRIPTION: Find the RSDP
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_find_root_pointer (
+ u32 flags,
+ ACPI_PHYSICAL_ADDRESS *rsdp_physical_address)
+{
+ acpi_table_desc table_info;
+ acpi_status status;
+
+
+ ACPI_FUNCTION_TRACE ("Acpi_find_root_pointer");
+
+
+ /* Get the RSDP */
+
+ status = acpi_tb_find_rsdp (&table_info, flags);
+ if (ACPI_FAILURE (status)) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "RSDP structure not found\n"));
+ return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+ }
+
+ *rsdp_physical_address = table_info.physical_address;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_tb_scan_memory_for_rsdp
+ *
+ * PARAMETERS: Start_address - Starting pointer for search
+ * Length - Maximum length to search
+ *
+ * RETURN: Pointer to the RSDP if found, otherwise NULL.
+ *
+ * DESCRIPTION: Search a block of memory for the RSDP signature
+ *
+ ******************************************************************************/
+
+u8 *
+acpi_tb_scan_memory_for_rsdp (
+ u8 *start_address,
+ u32 length)
+{
+ u32 offset;
+ u8 *mem_rover;
+
+
+ ACPI_FUNCTION_TRACE ("Tb_scan_memory_for_rsdp");
+
+
+ /* Search from given start addr for the requested length */
+
+ for (offset = 0, mem_rover = start_address;
+ offset < length;
+ offset += RSDP_SCAN_STEP, mem_rover += RSDP_SCAN_STEP) {
+
+ /* The signature and checksum must both be correct */
+
+ if (ACPI_STRNCMP ((NATIVE_CHAR *) mem_rover,
+ RSDP_SIG, sizeof (RSDP_SIG)-1) == 0 &&
+ acpi_tb_checksum (mem_rover, ACPI_RSDP_CHECKSUM_LENGTH) == 0) {
+ /* If so, we have found the RSDP */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "RSDP located at physical address %p\n",mem_rover));
+ return_PTR (mem_rover);
+ }
+ }
+
+ /* Searched entire block, no RSDP was found */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,"Searched entire block, no RSDP was found.\n"));
+ return_PTR (NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_tb_find_rsdp
+ *
+ * PARAMETERS: *Table_info - Where the table info is returned
+ * Flags - Current memory mode (logical vs.
+ * physical addressing)
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Search lower 1_mbyte of memory for the root system descriptor
+ * pointer structure. If it is found, set *RSDP to point to it.
+ *
+ * NOTE: The RSDP must be either in the first 1_k of the Extended
+ * BIOS Data Area or between E0000 and FFFFF (ACPI 1.0 section
+ * 5.2.2; assertion #421).
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_tb_find_rsdp (
+ acpi_table_desc *table_info,
+ u32 flags)
+{
+ u8 *table_ptr;
+ u8 *mem_rover;
+ u64 phys_addr;
+ acpi_status status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE ("Tb_find_rsdp");
+
+
+ /*
+ * Scan supports either 1) Logical addressing or 2) Physical addressing
+ */
+ if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) {
+ /*
+ * 1) Search EBDA (low memory) paragraphs
+ */
+ status = acpi_os_map_memory ((u64) LO_RSDP_WINDOW_BASE, LO_RSDP_WINDOW_SIZE,
+ (void **) &table_ptr);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+
+ mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, LO_RSDP_WINDOW_SIZE);
+ acpi_os_unmap_memory (table_ptr, LO_RSDP_WINDOW_SIZE);
+
+ if (mem_rover) {
+ /* Found it, return the physical address */
+
+ phys_addr = LO_RSDP_WINDOW_BASE;
+ phys_addr += (mem_rover - table_ptr);
+
+ table_info->physical_address = phys_addr;
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /*
+ * 2) Search upper memory: 16-byte boundaries in E0000h-F0000h
+ */
+ status = acpi_os_map_memory ((u64) HI_RSDP_WINDOW_BASE, HI_RSDP_WINDOW_SIZE,
+ (void **) &table_ptr);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+
+ mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, HI_RSDP_WINDOW_SIZE);
+ acpi_os_unmap_memory (table_ptr, HI_RSDP_WINDOW_SIZE);
+
+ if (mem_rover) {
+ /* Found it, return the physical address */
+
+ phys_addr = HI_RSDP_WINDOW_BASE;
+ phys_addr += (mem_rover - table_ptr);
+
+ table_info->physical_address = phys_addr;
+ return_ACPI_STATUS (AE_OK);
+ }
+ }
+
+ /*
+ * Physical addressing
+ */
+ else {
+ /*
+ * 1) Search EBDA (low memory) paragraphs
+ */
+ mem_rover = acpi_tb_scan_memory_for_rsdp (ACPI_PHYSADDR_TO_PTR (LO_RSDP_WINDOW_BASE),
+ LO_RSDP_WINDOW_SIZE);
+ if (mem_rover) {
+ /* Found it, return the physical address */
+
+ table_info->physical_address = ACPI_TO_INTEGER (mem_rover);
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /*
+ * 2) Search upper memory: 16-byte boundaries in E0000h-F0000h
+ */
+ mem_rover = acpi_tb_scan_memory_for_rsdp (ACPI_PHYSADDR_TO_PTR (HI_RSDP_WINDOW_BASE),
+ HI_RSDP_WINDOW_SIZE);
+ if (mem_rover) {
+ /* Found it, return the physical address */
+
+ table_info->physical_address = ACPI_TO_INTEGER (mem_rover);
+ return_ACPI_STATUS (AE_OK);
+ }
+ }
+
+ /* RSDP signature was not found */
+
+ return_ACPI_STATUS (AE_NOT_FOUND);
+}
+
+#endif
+
#
# Makefile for all Linux ACPI interpreter subdirectories
-# EXCEPT for the ospm directory
#
O_TARGET := $(notdir $(CURDIR)).o
-obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c))
+obj-$(CONFIG_ACPI_INTERPRETER) := $(patsubst %.c,%.o,$(wildcard *.c))
EXTRA_CFLAGS += $(ACPI_CFLAGS)
/******************************************************************************
*
* Module Name: utalloc - local cache and memory allocation routines
- * $Revision: 106 $
+ * $Revision: 121 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acglobal.h"
#define _COMPONENT ACPI_UTILITIES
- MODULE_NAME ("utalloc")
+ ACPI_MODULE_NAME ("utalloc")
/******************************************************************************
ACPI_MEMORY_LIST *cache_info;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/* If walk cache is full, just free this wallkstate object */
/* Otherwise put this object back into the cache */
else {
- acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
+ if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_CACHES))) {
+ return;
+ }
/* Mark the object as cached */
- MEMSET (object, 0xCA, cache_info->object_size);
- ((acpi_operand_object *) object)->common.data_type = ACPI_CACHED_OBJECT;
+ ACPI_MEMSET (object, 0xCA, cache_info->object_size);
+ ACPI_SET_DESCRIPTOR_TYPE (object, ACPI_CACHED_OBJECT);
/* Put the object at the head of the cache list */
cache_info->list_head = object;
cache_info->cache_depth++;
- acpi_ut_release_mutex (ACPI_MTX_CACHES);
+ (void) acpi_ut_release_mutex (ACPI_MTX_CACHES);
}
}
void *object;
- PROC_NAME ("Ut_acquire_from_cache");
+ ACPI_FUNCTION_NAME ("Ut_acquire_from_cache");
cache_info = &acpi_gbl_memory_lists[list_id];
- acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
+ if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_CACHES))) {
+ return (NULL);
+ }
+
ACPI_MEM_TRACKING (cache_info->cache_requests++);
/* Check the cache first */
object, acpi_gbl_memory_lists[list_id].list_name));
#endif
- acpi_ut_release_mutex (ACPI_MTX_CACHES);
+ if (ACPI_FAILURE (acpi_ut_release_mutex (ACPI_MTX_CACHES))) {
+ return (NULL);
+ }
/* Clear (zero) the previously used Object */
- MEMSET (object, 0, cache_info->object_size);
+ ACPI_MEMSET (object, 0, cache_info->object_size);
}
else {
/* Avoid deadlock with ACPI_MEM_CALLOCATE */
- acpi_ut_release_mutex (ACPI_MTX_CACHES);
+ if (ACPI_FAILURE (acpi_ut_release_mutex (ACPI_MTX_CACHES))) {
+ return (NULL);
+ }
object = ACPI_MEM_CALLOCATE (cache_info->object_size);
ACPI_MEM_TRACKING (cache_info->total_allocated++);
char *next;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
cache_info = &acpi_gbl_memory_lists[list_id];
}
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ut_validate_buffer
+ *
+ * PARAMETERS: Buffer - Buffer descriptor to be validated
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Perform parameter validation checks on an acpi_buffer
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ut_validate_buffer (
+ acpi_buffer *buffer)
+{
+
+ /* Obviously, the structure pointer must be valid */
+
+ if (!buffer) {
+ return (AE_BAD_PARAMETER);
+ }
+
+ /* Special semantics for the length */
+
+ if ((buffer->length == ACPI_NO_BUFFER) ||
+ (buffer->length == ACPI_ALLOCATE_BUFFER) ||
+ (buffer->length == ACPI_ALLOCATE_LOCAL_BUFFER)) {
+ return (AE_OK);
+ }
+
+ /* Length is valid, the buffer pointer must be also */
+
+ if (!buffer->pointer) {
+ return (AE_BAD_PARAMETER);
+ }
+
+ return (AE_OK);
+}
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ut_initialize_buffer
+ *
+ * PARAMETERS: Required_length - Length needed
+ * Buffer - Buffer to be validated
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Validate that the buffer is of the required length or
+ * allocate a new buffer.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ut_initialize_buffer (
+ acpi_buffer *buffer,
+ ACPI_SIZE required_length)
+{
+ acpi_status status = AE_OK;
+
+
+ switch (buffer->length) {
+ case ACPI_NO_BUFFER:
+
+ /* Set the exception and returned the required length */
+
+ status = AE_BUFFER_OVERFLOW;
+ break;
+
+
+ case ACPI_ALLOCATE_BUFFER:
+
+ /* Allocate a new buffer */
+
+ buffer->pointer = acpi_os_allocate (required_length);
+ if (!buffer->pointer) {
+ return (AE_NO_MEMORY);
+ }
+
+ /* Clear the buffer */
+
+ ACPI_MEMSET (buffer->pointer, 0, required_length);
+ break;
+
+
+ case ACPI_ALLOCATE_LOCAL_BUFFER:
+
+ /* Allocate a new buffer with local interface to allow tracking */
+
+ buffer->pointer = ACPI_MEM_ALLOCATE (required_length);
+ if (!buffer->pointer) {
+ return (AE_NO_MEMORY);
+ }
+
+ /* Clear the buffer */
+
+ ACPI_MEMSET (buffer->pointer, 0, required_length);
+ break;
+
+
+ default:
+
+ /* Validate the size of the buffer */
+
+ if (buffer->length < required_length) {
+ status = AE_BUFFER_OVERFLOW;
+ }
+
+ /* Clear the buffer */
+
+ ACPI_MEMSET (buffer->pointer, 0, required_length);
+ break;
+ }
+
+ buffer->length = required_length;
+ return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ut_allocate
+ *
+ * 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 (
+ ACPI_SIZE size,
+ u32 component,
+ NATIVE_CHAR *module,
+ u32 line)
+{
+ void *allocation;
+
+
+ ACPI_FUNCTION_TRACE_U32 ("Ut_allocate", size);
+
+
+ /* Check for an inadvertent size of zero bytes */
+
+ if (!size) {
+ _ACPI_REPORT_ERROR (module, line, component,
+ ("Ut_allocate: Attempt to allocate zero bytes\n"));
+ size = 1;
+ }
+
+ allocation = acpi_os_allocate (size);
+ if (!allocation) {
+ /* Report allocation error */
+
+ _ACPI_REPORT_ERROR (module, line, component,
+ ("Ut_allocate: Could not allocate size %X\n", size));
+
+ return_PTR (NULL);
+ }
+
+ return_PTR (allocation);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ut_callocate
+ *
+ * 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 (
+ ACPI_SIZE size,
+ u32 component,
+ NATIVE_CHAR *module,
+ u32 line)
+{
+ void *allocation;
+
+
+ ACPI_FUNCTION_TRACE_U32 ("Ut_callocate", size);
+
+
+ /* Check for an inadvertent size of zero bytes */
+
+ if (!size) {
+ _ACPI_REPORT_ERROR (module, line, component,
+ ("Ut_callocate: Attempt to allocate zero bytes\n"));
+ return_PTR (NULL);
+ }
+
+ allocation = acpi_os_allocate (size);
+ if (!allocation) {
+ /* Report allocation error */
+
+ _ACPI_REPORT_ERROR (module, line, component,
+ ("Ut_callocate: Could not allocate size %X\n", 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.
*/
+/*******************************************************************************
+ *
+ * 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,
+ NATIVE_CHAR *module,
+ u32 line)
+{
+ acpi_debug_mem_block *allocation;
+ acpi_status status;
+
+
+ allocation = acpi_ut_allocate (size + sizeof (acpi_debug_mem_block), component,
+ module, line);
+ if (!allocation) {
+ return (NULL);
+ }
+
+ status = acpi_ut_track_allocation (ACPI_MEM_LIST_GLOBAL, allocation, size,
+ ACPI_MEM_MALLOC, component, module, line);
+ if (ACPI_FAILURE (status)) {
+ acpi_os_free (allocation);
+ return (NULL);
+ }
+
+ acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].total_allocated++;
+ acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].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,
+ NATIVE_CHAR *module,
+ u32 line)
+{
+ acpi_debug_mem_block *allocation;
+ acpi_status status;
+
+
+ allocation = acpi_ut_callocate (size + sizeof (acpi_debug_mem_block), component,
+ module, line);
+ if (!allocation) {
+ /* Report allocation error */
+
+ _ACPI_REPORT_ERROR (module, line, component,
+ ("Ut_callocate: Could not allocate size %X\n", size));
+ return (NULL);
+ }
+
+ status = acpi_ut_track_allocation (ACPI_MEM_LIST_GLOBAL, allocation, size,
+ ACPI_MEM_CALLOC, component, module, line);
+ if (ACPI_FAILURE (status)) {
+ acpi_os_free (allocation);
+ return (NULL);
+ }
+
+ acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].total_allocated++;
+ acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].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,
+ NATIVE_CHAR *module,
+ u32 line)
+{
+ acpi_debug_mem_block *debug_block;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("Ut_free", allocation);
+
+
+ if (NULL == allocation) {
+ _ACPI_REPORT_ERROR (module, line, component,
+ ("Acpi_ut_free: Attempt to delete a NULL address\n"));
+
+ return_VOID;
+ }
+
+ debug_block = (acpi_debug_mem_block *)
+ (((char *) allocation) - sizeof (acpi_debug_mem_header));
+
+ acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].total_freed++;
+ acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].current_total_size -= debug_block->size;
+
+ acpi_ut_remove_allocation (ACPI_MEM_LIST_GLOBAL, debug_block,
+ component, module, line);
+ acpi_os_free (debug_block);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p freed\n", allocation));
+
+ return_VOID;
+}
+
+
/*******************************************************************************
*
* FUNCTION: Acpi_ut_find_allocation
*
- * PARAMETERS: Address - Address of allocated memory
+ * PARAMETERS: Allocation - Address of allocated memory
*
* RETURN: A list element if found; NULL otherwise.
*
acpi_debug_mem_block *
acpi_ut_find_allocation (
u32 list_id,
- void *address)
+ void *allocation)
{
acpi_debug_mem_block *element;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
if (list_id > ACPI_MEM_LIST_MAX) {
/* Search for the address. */
while (element) {
- if (element == address) {
+ if (element == allocation) {
return (element);
}
*
* FUNCTION: Acpi_ut_track_allocation
*
- * PARAMETERS: Address - Address of allocated memory
+ * PARAMETERS: Allocation - Address of allocated memory
* Size - Size of the allocation
* Alloc_type - MEM_MALLOC or MEM_CALLOC
* Component - Component type of caller
acpi_status
acpi_ut_track_allocation (
u32 list_id,
- acpi_debug_mem_block *address,
- u32 size,
+ acpi_debug_mem_block *allocation,
+ ACPI_SIZE size,
u8 alloc_type,
u32 component,
NATIVE_CHAR *module,
acpi_status status = AE_OK;
- FUNCTION_TRACE_PTR ("Ut_track_allocation", address);
+ ACPI_FUNCTION_TRACE_PTR ("Ut_track_allocation", allocation);
if (list_id > ACPI_MEM_LIST_MAX) {
}
mem_list = &acpi_gbl_memory_lists[list_id];
- acpi_ut_acquire_mutex (ACPI_MTX_MEMORY);
+ 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 (list_id, address);
+ element = acpi_ut_find_allocation (list_id, allocation);
if (element) {
- REPORT_ERROR (("Ut_track_allocation: Address already present in list! (%p)\n",
- address));
+ ACPI_REPORT_ERROR (("Ut_track_allocation: Allocation already present in list! (%p)\n",
+ allocation));
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Element %p Address %p\n", element, address));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Element %p Address %p\n", element, allocation));
goto unlock_and_exit;
}
/* Fill in the instance data. */
- address->size = size;
- address->alloc_type = alloc_type;
- address->component = component;
- address->line = line;
+ allocation->size = (u32) size;
+ allocation->alloc_type = alloc_type;
+ allocation->component = component;
+ allocation->line = line;
- STRNCPY (address->module, module, MAX_MODULE_NAME);
+ ACPI_STRNCPY (allocation->module, module, ACPI_MAX_MODULE_NAME);
/* Insert at list head */
if (mem_list->list_head) {
- ((acpi_debug_mem_block *)(mem_list->list_head))->previous = address;
+ ((acpi_debug_mem_block *)(mem_list->list_head))->previous = allocation;
}
- address->next = mem_list->list_head;
- address->previous = NULL;
+ allocation->next = mem_list->list_head;
+ allocation->previous = NULL;
- mem_list->list_head = address;
+ mem_list->list_head = allocation;
unlock_and_exit:
- acpi_ut_release_mutex (ACPI_MTX_MEMORY);
+ status = acpi_ut_release_mutex (ACPI_MTX_MEMORY);
return_ACPI_STATUS (status);
}
*
* FUNCTION: Acpi_ut_remove_allocation
*
- * PARAMETERS: Address - Address of allocated memory
+ * PARAMETERS: Allocation - Address of allocated memory
* Component - Component type of caller
* Module - Source file name of caller
* Line - Line number of caller
acpi_status
acpi_ut_remove_allocation (
u32 list_id,
- acpi_debug_mem_block *address,
+ acpi_debug_mem_block *allocation,
u32 component,
NATIVE_CHAR *module,
u32 line)
{
ACPI_MEMORY_LIST *mem_list;
+ acpi_status status;
- FUNCTION_TRACE ("Ut_remove_allocation");
+ ACPI_FUNCTION_TRACE ("Ut_remove_allocation");
if (list_id > ACPI_MEM_LIST_MAX) {
if (NULL == mem_list->list_head) {
/* No allocations! */
- _REPORT_ERROR (module, line, component,
+ _ACPI_REPORT_ERROR (module, line, component,
("Ut_remove_allocation: Empty allocation list, nothing to free!\n"));
return_ACPI_STATUS (AE_OK);
}
-
- acpi_ut_acquire_mutex (ACPI_MTX_MEMORY);
+ status = acpi_ut_acquire_mutex (ACPI_MTX_MEMORY);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
/* Unlink */
- if (address->previous) {
- (address->previous)->next = address->next;
+ if (allocation->previous) {
+ (allocation->previous)->next = allocation->next;
}
else {
- mem_list->list_head = address->next;
+ mem_list->list_head = allocation->next;
}
- if (address->next) {
- (address->next)->previous = address->previous;
+ if (allocation->next) {
+ (allocation->next)->previous = allocation->previous;
}
-
/* Mark the segment as deleted */
- MEMSET (&address->user_space, 0xEA, address->size);
+ ACPI_MEMSET (&allocation->user_space, 0xEA, allocation->size);
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing size %X\n", address->size));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing size %X\n", allocation->size));
- acpi_ut_release_mutex (ACPI_MTX_MEMORY);
- return_ACPI_STATUS (AE_OK);
+ status = acpi_ut_release_mutex (ACPI_MTX_MEMORY);
+ return_ACPI_STATUS (status);
}
ACPI_MEMORY_LIST *Mem_list;
*/
- FUNCTION_TRACE ("Ut_dump_allocation_info");
+ ACPI_FUNCTION_TRACE ("Ut_dump_allocation_info");
/*
ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
NATIVE_CHAR *module)
{
acpi_debug_mem_block *element;
- u32 i;
-
-
- FUNCTION_TRACE ("Ut_dump_allocations");
+ u32 num_outstanding = 0;
- element = acpi_gbl_memory_lists[0].list_head;
- if (element == NULL) {
- ACPI_DEBUG_PRINT ((ACPI_DB_OK,
- "No outstanding allocations.\n"));
- return_VOID;
- }
+ ACPI_FUNCTION_TRACE ("Ut_dump_allocations");
/*
* Walk the allocation list.
*/
- acpi_ut_acquire_mutex (ACPI_MTX_MEMORY);
-
- ACPI_DEBUG_PRINT ((ACPI_DB_OK,
- "Outstanding allocations:\n"));
+ if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_MEMORY))) {
+ return;
+ }
- for (i = 1; ; i++) /* Just a counter */ {
+ element = acpi_gbl_memory_lists[0].list_head;
+ while (element) {
if ((element->component & component) &&
- ((module == NULL) || (0 == STRCMP (module, element->module)))) {
+ ((module == NULL) || (0 == ACPI_STRCMP (module, element->module)))) {
+ /* Ignore allocated objects that are in a cache */
+
if (((acpi_operand_object *)(&element->user_space))->common.type != ACPI_CACHED_OBJECT) {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
- "%p Len %04X %9.9s-%d",
+ acpi_os_printf ("%p Len %04X %9.9s-%d ",
&element->user_space, element->size, element->module,
- element->line));
+ element->line);
/* Most of the elements will be internal objects. */
- switch (((acpi_operand_object *)
- (&element->user_space))->common.data_type) {
+ switch (ACPI_GET_DESCRIPTOR_TYPE (&element->user_space)) {
case ACPI_DESC_TYPE_INTERNAL:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
- " Obj_type %12.12s R%d",
+ acpi_os_printf ("Obj_type %12.12s R%d",
acpi_ut_get_type_name (((acpi_operand_object *)(&element->user_space))->common.type),
- ((acpi_operand_object *)(&element->user_space))->common.reference_count));
+ ((acpi_operand_object *)(&element->user_space))->common.reference_count);
break;
case ACPI_DESC_TYPE_PARSER:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
- " Parse_obj Opcode %04X",
- ((acpi_parse_object *)(&element->user_space))->opcode));
+ acpi_os_printf ("Parse_obj Opcode %04X",
+ ((acpi_parse_object *)(&element->user_space))->opcode);
break;
case ACPI_DESC_TYPE_NAMED:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
- " Node %4.4s",
- (char*)&((acpi_namespace_node *)(&element->user_space))->name));
+ acpi_os_printf ("Node %4.4s",
+ (char *) &((acpi_namespace_node *)(&element->user_space))->name);
break;
case ACPI_DESC_TYPE_STATE:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
- " Untyped State_obj"));
+ acpi_os_printf ("Untyped State_obj");
break;
case ACPI_DESC_TYPE_STATE_UPDATE:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
- " UPDATE State_obj"));
+ acpi_os_printf ("UPDATE State_obj");
break;
case ACPI_DESC_TYPE_STATE_PACKAGE:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
- " PACKAGE State_obj"));
+ acpi_os_printf ("PACKAGE State_obj");
break;
case ACPI_DESC_TYPE_STATE_CONTROL:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
- " CONTROL State_obj"));
+ acpi_os_printf ("CONTROL State_obj");
break;
case ACPI_DESC_TYPE_STATE_RPSCOPE:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
- " ROOT-PARSE-SCOPE State_obj"));
+ acpi_os_printf ("ROOT-PARSE-SCOPE State_obj");
break;
case ACPI_DESC_TYPE_STATE_PSCOPE:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
- " PARSE-SCOPE State_obj"));
+ acpi_os_printf ("PARSE-SCOPE State_obj");
break;
case ACPI_DESC_TYPE_STATE_WSCOPE:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
- " WALK-SCOPE State_obj"));
+ acpi_os_printf ("WALK-SCOPE State_obj");
break;
case ACPI_DESC_TYPE_STATE_RESULT:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
- " RESULT State_obj"));
+ acpi_os_printf ("RESULT State_obj");
break;
case ACPI_DESC_TYPE_STATE_NOTIFY:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
- " NOTIFY State_obj"));
+ acpi_os_printf ("NOTIFY State_obj");
+ break;
+
+ case ACPI_DESC_TYPE_STATE_THREAD:
+ acpi_os_printf ("THREAD State_obj");
break;
}
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "\n"));
+ acpi_os_printf ( "\n");
+ num_outstanding++;
}
}
-
- if (element->next == NULL) {
- break;
- }
-
element = element->next;
}
- acpi_ut_release_mutex (ACPI_MTX_MEMORY);
-
- ACPI_DEBUG_PRINT ((ACPI_DB_OK,
- "Total number of unfreed allocations = %d(%X)\n", i,i));
-
-
- return_VOID;
-
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ut_allocate
- *
- * 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 (
- u32 size,
- u32 component,
- NATIVE_CHAR *module,
- u32 line)
-{
- acpi_debug_mem_block *address;
- acpi_status status;
-
-
- FUNCTION_TRACE_U32 ("Ut_allocate", size);
-
-
- /* Check for an inadvertent size of zero bytes */
-
- if (!size) {
- _REPORT_ERROR (module, line, component,
- ("Ut_allocate: Attempt to allocate zero bytes\n"));
- size = 1;
- }
-
- address = acpi_os_allocate (size + sizeof (acpi_debug_mem_block));
- if (!address) {
- /* Report allocation error */
-
- _REPORT_ERROR (module, line, component,
- ("Ut_allocate: Could not allocate size %X\n", size));
-
- return_PTR (NULL);
- }
-
- status = acpi_ut_track_allocation (ACPI_MEM_LIST_GLOBAL, address, size,
- MEM_MALLOC, component, module, line);
- if (ACPI_FAILURE (status)) {
- acpi_os_free (address);
- return_PTR (NULL);
- }
-
- acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].total_allocated++;
- acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].current_total_size += size;
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p Size %X\n", address, size));
-
- return_PTR ((void *) &address->user_space);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ut_callocate
- *
- * 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 (
- u32 size,
- u32 component,
- NATIVE_CHAR *module,
- u32 line)
-{
- acpi_debug_mem_block *address;
- acpi_status status;
-
-
- FUNCTION_TRACE_U32 ("Ut_callocate", size);
-
-
- /* Check for an inadvertent size of zero bytes */
-
- if (!size) {
- _REPORT_ERROR (module, line, component,
- ("Ut_callocate: Attempt to allocate zero bytes\n"));
- return_PTR (NULL);
- }
-
-
- address = acpi_os_callocate (size + sizeof (acpi_debug_mem_block));
- if (!address) {
- /* Report allocation error */
+ (void) acpi_ut_release_mutex (ACPI_MTX_MEMORY);
- _REPORT_ERROR (module, line, component,
- ("Ut_callocate: Could not allocate size %X\n", size));
- return_PTR (NULL);
- }
+ /* Print summary */
- status = acpi_ut_track_allocation (ACPI_MEM_LIST_GLOBAL, address, size,
- MEM_CALLOC, component, module, line);
- if (ACPI_FAILURE (status)) {
- acpi_os_free (address);
- return_PTR (NULL);
+ if (!num_outstanding) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_OK,
+ "No outstanding allocations.\n"));
}
-
- acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].total_allocated++;
- acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].current_total_size += size;
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p Size %X\n", address, size));
- return_PTR ((void *) &address->user_space);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ut_free
- *
- * PARAMETERS: Address - 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 Address
- *
- ******************************************************************************/
-
-void
-acpi_ut_free (
- void *address,
- u32 component,
- NATIVE_CHAR *module,
- u32 line)
-{
- acpi_debug_mem_block *debug_block;
-
-
- FUNCTION_TRACE_PTR ("Ut_free", address);
-
-
- if (NULL == address) {
- _REPORT_ERROR (module, line, component,
- ("Acpi_ut_free: Trying to delete a NULL address\n"));
-
- return_VOID;
+ else {
+ ACPI_DEBUG_PRINT ((ACPI_DB_OK,
+ "%d(%X) Outstanding allocations\n",
+ num_outstanding, num_outstanding));
}
- debug_block = (acpi_debug_mem_block *)
- (((char *) address) - sizeof (acpi_debug_mem_header));
-
- acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].total_freed++;
- acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].current_total_size -= debug_block->size;
-
- acpi_ut_remove_allocation (ACPI_MEM_LIST_GLOBAL, debug_block,
- component, module, line);
- acpi_os_free (debug_block);
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p freed\n", address));
-
return_VOID;
}
+
#endif /* #ifdef ACPI_DBG_TRACK_ALLOCATIONS */
/******************************************************************************
*
* Module Name: utcopy - Internal to external object translation utilities
- * $Revision: 83 $
+ * $Revision: 94 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_UTILITIES
- MODULE_NAME ("utcopy")
+ ACPI_MODULE_NAME ("utcopy")
/*******************************************************************************
acpi_operand_object *internal_object,
acpi_object *external_object,
u8 *data_space,
- u32 *buffer_space_used)
+ ACPI_SIZE *buffer_space_used)
{
- u32 length = 0;
+ acpi_buffer buffer;
acpi_status status = AE_OK;
- FUNCTION_TRACE ("Ut_copy_isimple_to_esimple");
+ ACPI_FUNCTION_TRACE ("Ut_copy_isimple_to_esimple");
+
+ *buffer_space_used = 0;
/*
* Check for NULL object case (could be an uninitialized
* package element
*/
if (!internal_object) {
- *buffer_space_used = 0;
return_ACPI_STATUS (AE_OK);
}
/* Always clear the external object */
- MEMSET (external_object, 0, sizeof (acpi_object));
+ ACPI_MEMSET (external_object, 0, sizeof (acpi_object));
/*
* In general, the external object will be the same type as
/* However, only a limited number of external types are supported */
switch (internal_object->common.type) {
-
case ACPI_TYPE_STRING:
- length = internal_object->string.length + 1;
- external_object->string.length = internal_object->string.length;
external_object->string.pointer = (NATIVE_CHAR *) data_space;
- MEMCPY ((void *) data_space, (void *) internal_object->string.pointer, length);
+ external_object->string.length = internal_object->string.length;
+ *buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD (internal_object->string.length + 1);
+
+ ACPI_MEMCPY ((void *) data_space, (void *) internal_object->string.pointer,
+ internal_object->string.length + 1);
break;
case ACPI_TYPE_BUFFER:
- length = internal_object->buffer.length;
- external_object->buffer.length = internal_object->buffer.length;
external_object->buffer.pointer = data_space;
- MEMCPY ((void *) data_space, (void *) internal_object->buffer.pointer, length);
+ external_object->buffer.length = internal_object->buffer.length;
+ *buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD (internal_object->string.length);
+
+ ACPI_MEMCPY ((void *) data_space, (void *) internal_object->buffer.pointer,
+ internal_object->buffer.length);
break;
case ACPI_TYPE_INTEGER:
- external_object->integer.value= internal_object->integer.value;
+ external_object->integer.value = internal_object->integer.value;
break;
* This is a named reference, get the string. We already know that
* we have room for it, use max length
*/
- length = MAX_STRING_LENGTH;
external_object->type = ACPI_TYPE_STRING;
external_object->string.pointer = (NATIVE_CHAR *) data_space;
+
+ buffer.length = MAX_STRING_LENGTH;
+ buffer.pointer = data_space;
+
status = acpi_ns_handle_to_pathname ((acpi_handle *) internal_object->reference.node,
- &length, (char *) data_space);
+ &buffer);
/* Converted (external) string length is returned from above */
- external_object->string.length = length;
+ external_object->string.length = buffer.length;
+ *buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD (buffer.length);
break;
default:
* There is no corresponding external object type
*/
return_ACPI_STATUS (AE_SUPPORT);
- break;
}
-
- *buffer_space_used = (u32) ROUND_UP_TO_NATIVE_WORD (length);
-
return_ACPI_STATUS (status);
}
{
acpi_status status = AE_OK;
acpi_pkg_info *info = (acpi_pkg_info *) context;
- u32 object_space;
+ ACPI_SIZE object_space;
u32 this_index;
acpi_object *target_object;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
this_index = state->pkg.index;
case ACPI_COPY_TYPE_SIMPLE:
/*
- * This is a simple or null object -- get the size
+ * This is a simple or null object
*/
status = acpi_ut_copy_isimple_to_esimple (source_object,
target_object, info->free_space, &object_space);
if (ACPI_FAILURE (status)) {
return (status);
}
-
break;
+
case ACPI_COPY_TYPE_PACKAGE:
/*
* Save space for the array of objects (Package elements)
* update the buffer length counter
*/
- object_space = (u32) ROUND_UP_TO_NATIVE_WORD (
+ object_space = ACPI_ROUND_UP_TO_NATIVE_WORD (
target_object->package.count * sizeof (acpi_object));
break;
+
default:
return (AE_BAD_PARAMETER);
}
-
info->free_space += object_space;
info->length += object_space;
-
return (status);
}
acpi_ut_copy_ipackage_to_epackage (
acpi_operand_object *internal_object,
u8 *buffer,
- u32 *space_used)
+ ACPI_SIZE *space_used)
{
acpi_object *external_object;
acpi_status status;
acpi_pkg_info info;
- FUNCTION_TRACE ("Ut_copy_ipackage_to_epackage");
+ ACPI_FUNCTION_TRACE ("Ut_copy_ipackage_to_epackage");
/*
info.length = 0;
info.object_space = 0;
info.num_packages = 1;
- info.free_space = buffer + ROUND_UP_TO_NATIVE_WORD (sizeof (acpi_object));
-
+ info.free_space = buffer + ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (acpi_object));
external_object->type = internal_object->common.type;
external_object->package.count = internal_object->package.count;
external_object->package.elements = (acpi_object *) info.free_space;
-
/*
* Build an array of ACPI_OBJECTS in the buffer
* and move the free space past it
*/
info.free_space += external_object->package.count *
- ROUND_UP_TO_NATIVE_WORD (sizeof (acpi_object));
-
+ ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (acpi_object));
status = acpi_ut_walk_package_tree (internal_object, external_object,
acpi_ut_copy_ielement_to_eelement, &info);
*space_used = info.length;
-
return_ACPI_STATUS (status);
-
}
+
/*******************************************************************************
*
* FUNCTION: Acpi_ut_copy_iobject_to_eobject
acpi_status status;
- FUNCTION_TRACE ("Ut_copy_iobject_to_eobject");
+ ACPI_FUNCTION_TRACE ("Ut_copy_iobject_to_eobject");
- if (IS_THIS_OBJECT_TYPE (internal_object, ACPI_TYPE_PACKAGE)) {
+ if (internal_object->common.type == ACPI_TYPE_PACKAGE) {
/*
* Package object: Copy all subobjects (including
* nested packages)
status = acpi_ut_copy_ipackage_to_epackage (internal_object,
ret_buffer->pointer, &ret_buffer->length);
}
-
else {
/*
* Build a simple object (no nested objects)
status = acpi_ut_copy_isimple_to_esimple (internal_object,
(acpi_object *) ret_buffer->pointer,
((u8 *) ret_buffer->pointer +
- ROUND_UP_TO_NATIVE_WORD (sizeof (acpi_object))),
+ ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (acpi_object))),
&ret_buffer->length);
/*
* build simple does not include the object size in the length
acpi_operand_object *internal_object;
- FUNCTION_TRACE ("Ut_copy_esimple_to_isimple");
+ ACPI_FUNCTION_TRACE ("Ut_copy_esimple_to_isimple");
/*
* Whatever other type -- it is not supported
*/
return_ACPI_STATUS (AE_SUPPORT);
- break;
}
return_ACPI_STATUS (AE_NO_MEMORY);
}
- MEMCPY (internal_object->string.pointer,
- external_object->string.pointer,
- external_object->string.length);
+ ACPI_MEMCPY (internal_object->string.pointer,
+ external_object->string.pointer,
+ external_object->string.length);
internal_object->string.length = external_object->string.length;
break;
return_ACPI_STATUS (AE_NO_MEMORY);
}
- MEMCPY (internal_object->buffer.pointer,
- external_object->buffer.pointer,
- external_object->buffer.length);
+ ACPI_MEMCPY (internal_object->buffer.pointer,
+ external_object->buffer.pointer,
+ external_object->buffer.length);
internal_object->buffer.length = external_object->buffer.length;
break;
break;
}
-
*ret_internal_object = internal_object;
return_ACPI_STATUS (AE_OK);
}
acpi_object *this_external_obj;
- FUNCTION_TRACE ("Ut_copy_epackage_to_ipackage");
+ ACPI_FUNCTION_TRACE ("Ut_copy_epackage_to_ipackage");
/*
acpi_status status;
- FUNCTION_TRACE ("Ut_copy_eobject_to_iobject");
+ ACPI_FUNCTION_TRACE ("Ut_copy_eobject_to_iobject");
if (external_object->type == ACPI_TYPE_PACKAGE) {
/*
- * Package objects contain other objects (which can be objects)
- * buildpackage does it all
- *
- * TBD: Package conversion must be completed and tested
- * NOTE: this code converts packages as input parameters to
- * control methods only. This is a very, very rare case.
+ * Packages as external input to control methods are not supported,
*/
-/*
- Status = Acpi_ut_copy_epackage_to_ipackage(Internal_object,
- Ret_buffer->Pointer,
- &Ret_buffer->Length);
-*/
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Packages as parameters not implemented!\n"));
}
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ut_copy_simple_object
+ *
+ * PARAMETERS: Source_desc - The internal object to be copied
+ * Dest_desc - New target object
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Simple copy of one internal object to another. Reference count
+ * of the destination object is preserved.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ut_copy_simple_object (
+ acpi_operand_object *source_desc,
+ acpi_operand_object *dest_desc)
+{
+ u16 reference_count;
+ acpi_operand_object *next_object;
+
+
+ /* Save fields from destination that we don't want to overwrite */
+
+ reference_count = dest_desc->common.reference_count;
+ next_object = dest_desc->common.next_object;
+
+ /* Copy the entire source object over the destination object*/
+
+ ACPI_MEMCPY ((char *) dest_desc, (char *) source_desc, sizeof (acpi_operand_object));
+
+ /* Restore the saved fields */
+
+ dest_desc->common.reference_count = reference_count;
+ dest_desc->common.next_object = next_object;
+
+ /* Handle the objects with extra data */
+
+ switch (dest_desc->common.type) {
+ case ACPI_TYPE_BUFFER:
+
+ dest_desc->buffer.node = NULL;
+
+ case ACPI_TYPE_STRING:
+
+ /*
+ * Allocate and copy the actual string if and only if:
+ * 1) There is a valid string (length > 0)
+ * 2) The string is not static (not in an ACPI table) (in this case,
+ * the actual pointer was already copied above)
+ */
+ if ((source_desc->string.length) &&
+ (!(source_desc->common.flags & AOPOBJ_STATIC_POINTER))) {
+ dest_desc->string.pointer = ACPI_MEM_ALLOCATE (source_desc->string.length);
+ if (!dest_desc->string.pointer) {
+ return (AE_NO_MEMORY);
+ }
+
+ ACPI_MEMCPY (dest_desc->string.pointer, source_desc->string.pointer,
+ source_desc->string.length);
+ }
+ break;
+ }
+
+ return (AE_OK);
+}
+
+
/*******************************************************************************
*
* FUNCTION: Acpi_ut_copy_ielement_to_ielement
*
* PARAMETERS: ACPI_PKG_CALLBACK
*
- * RETURN: Status - the status of the call
+ * RETURN: Status
*
* DESCRIPTION: Copy one package element to another package element
*
acpi_operand_object *target_object;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
this_index = state->pkg.index;
return (AE_NO_MEMORY);
}
- status = acpi_ex_store_object_to_object (source_object, target_object,
- (acpi_walk_state *) context);
+ status = acpi_ut_copy_simple_object (source_object, target_object);
if (ACPI_FAILURE (status)) {
return (status);
}
case 1:
+
/*
* This object is a package - go down another nesting level
* Create and build the package object
*/
target_object = acpi_ut_create_internal_object (ACPI_TYPE_PACKAGE);
if (!target_object) {
- /* TBD: must delete package created up to this point */
-
return (AE_NO_MEMORY);
}
*this_target_ptr = target_object;
break;
+
default:
return (AE_BAD_PARAMETER);
}
-
return (status);
}
acpi_status status = AE_OK;
- FUNCTION_TRACE ("Ut_copy_ipackage_to_ipackage");
+ ACPI_FUNCTION_TRACE ("Ut_copy_ipackage_to_ipackage");
dest_obj->common.type = source_obj->common.type;
*/
dest_obj->package.elements = ACPI_MEM_CALLOCATE ((source_obj->package.count + 1) *
sizeof (void *));
- dest_obj->package.next_element = dest_obj->package.elements;
-
if (!dest_obj->package.elements) {
- REPORT_ERROR (
+ ACPI_REPORT_ERROR (
("Aml_build_copy_internal_package_object: Package allocation failure\n"));
return_ACPI_STATUS (AE_NO_MEMORY);
}
+ /* Init */
+ dest_obj->package.next_element = dest_obj->package.elements;
+
+ /*
+ * Copy the package element-by-element by walking the package "tree".
+ * This handles nested packages of arbitrary depth.
+ */
status = acpi_ut_walk_package_tree (source_obj, dest_obj,
acpi_ut_copy_ielement_to_ielement, walk_state);
+ if (ACPI_FAILURE (status)) {
+ /* On failure, delete the destination package object */
+
+ acpi_ut_remove_reference (dest_obj);
+ }
+
+ return_ACPI_STATUS (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ut_copy_iobject_to_iobject
+ *
+ * PARAMETERS: Walk_state - Current walk state
+ * Source_desc - The internal object to be copied
+ * Dest_desc - Where the copied object is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Copy an internal object to a new internal object
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ut_copy_iobject_to_iobject (
+ acpi_operand_object *source_desc,
+ acpi_operand_object **dest_desc,
+ acpi_walk_state *walk_state)
+{
+ acpi_status status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE ("Ut_copy_iobject_to_iobject");
+
+
+ /* Create the top level object */
+
+ *dest_desc = acpi_ut_create_internal_object (source_desc->common.type);
+ if (!*dest_desc) {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Copy the object and possible subobjects */
+
+ if (source_desc->common.type == ACPI_TYPE_PACKAGE) {
+ status = acpi_ut_copy_ipackage_to_ipackage (source_desc, *dest_desc,
+ walk_state);
+ }
+ else {
+ status = acpi_ut_copy_simple_object (source_desc, *dest_desc);
+ }
return_ACPI_STATUS (status);
}
+
/******************************************************************************
*
* Module Name: utdebug - Debug print routines
- * $Revision: 90 $
+ * $Revision: 96 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acpi.h"
#define _COMPONENT ACPI_UTILITIES
- MODULE_NAME ("utdebug")
+ ACPI_MODULE_NAME ("utdebug")
u32 acpi_gbl_prev_thread_id = 0xFFFFFFFF;
u32 current_sp;
- acpi_gbl_entry_stack_pointer = (u32) ¤t_sp;
+ acpi_gbl_entry_stack_pointer = ACPI_PTR_DIFF (¤t_sp, NULL);
}
acpi_ut_track_stack_ptr (
void)
{
- u32 current_sp;
+ ACPI_SIZE current_sp;
+
- current_sp = (u32) ¤t_sp;
+ current_sp = ACPI_PTR_DIFF (¤t_sp, NULL);
if (current_sp < acpi_gbl_lowest_stack_pointer) {
acpi_gbl_lowest_stack_pointer = current_sp;
*
****************************************************************************/
-void
+void ACPI_INTERNAL_VAR_XFACE
acpi_ut_debug_print (
u32 requested_debug_level,
u32 line_number,
*
****************************************************************************/
-void
+void ACPI_INTERNAL_VAR_XFACE
acpi_ut_debug_print_raw (
u32 requested_debug_level,
u32 line_number,
{
acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
- "%s %8.8X%8.8X\n", acpi_gbl_fn_exit_str, HIDWORD(value), LODWORD(value));
+ "%s %8.8X%8.8X\n", acpi_gbl_fn_exit_str,
+ ACPI_HIDWORD (value), ACPI_LODWORD (value));
acpi_gbl_nesting_level--;
}
case DB_WORD_DISPLAY:
- MOVE_UNALIGNED16_TO_32 (&temp32,
- &buffer[i + j]);
+ ACPI_MOVE_UNALIGNED16_TO_32 (&temp32,
+ &buffer[i + j]);
acpi_os_printf ("%04X ", temp32);
j += 2;
break;
case DB_DWORD_DISPLAY:
- MOVE_UNALIGNED32_TO_32 (&temp32,
- &buffer[i + j]);
+ ACPI_MOVE_UNALIGNED32_TO_32 (&temp32,
+ &buffer[i + j]);
acpi_os_printf ("%08X ", temp32);
j += 4;
break;
case DB_QWORD_DISPLAY:
- MOVE_UNALIGNED32_TO_32 (&temp32,
- &buffer[i + j]);
+ ACPI_MOVE_UNALIGNED32_TO_32 (&temp32,
+ &buffer[i + j]);
acpi_os_printf ("%08X", temp32);
- MOVE_UNALIGNED32_TO_32 (&temp32,
- &buffer[i + j + 4]);
+ ACPI_MOVE_UNALIGNED32_TO_32 (&temp32,
+ &buffer[i + j + 4]);
acpi_os_printf ("%08X ", temp32);
j += 8;
break;
/*******************************************************************************
*
* Module Name: utdelete - object deletion and reference count utilities
- * $Revision: 81 $
+ * $Revision: 87 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "acparser.h"
#define _COMPONENT ACPI_UTILITIES
- MODULE_NAME ("utdelete")
+ ACPI_MODULE_NAME ("utdelete")
/*******************************************************************************
{
void *obj_pointer = NULL;
acpi_operand_object *handler_desc;
+ acpi_operand_object *second_desc;
- FUNCTION_TRACE_PTR ("Ut_delete_internal_obj", object);
+ ACPI_FUNCTION_TRACE_PTR ("Ut_delete_internal_obj", object);
if (!object) {
acpi_os_delete_semaphore (object->method.semaphore);
object->method.semaphore = NULL;
}
-
break;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "***** Region %p\n", object));
- if (object->region.extra) {
+ second_desc = acpi_ns_get_secondary_object (object);
+ if (second_desc) {
/*
* Free the Region_context if and only if the handler is one of the
* default handlers -- and therefore, we created the context object
*/
handler_desc = object->region.addr_handler;
if ((handler_desc) &&
- (handler_desc->addr_handler.hflags == ADDR_HANDLER_DEFAULT_INSTALLED)) {
- obj_pointer = object->region.extra->extra.region_context;
+ (handler_desc->addr_handler.hflags == ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) {
+ obj_pointer = second_desc->extra.region_context;
}
/* Now we can free the Extra object */
- acpi_ut_delete_object_desc (object->region.extra);
+ acpi_ut_delete_object_desc (second_desc);
}
break;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "***** Buffer Field %p\n", object));
- if (object->buffer_field.extra) {
- acpi_ut_delete_object_desc (object->buffer_field.extra);
+ second_desc = acpi_ns_get_secondary_object (object);
+ if (second_desc) {
+ acpi_ut_delete_object_desc (second_desc);
}
break;
+
default:
break;
}
- /*
- * Delete any allocated memory found above
- */
+ /* Free any allocated memory (pointer within the object) found above */
+
if (obj_pointer) {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Deleting Obj Ptr %p \n", obj_pointer));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Deleting Object Subptr %p\n",
+ obj_pointer));
ACPI_MEM_FREE (obj_pointer);
}
- /* Only delete the object if it was dynamically allocated */
-
- if (object->common.flags & AOPOBJ_STATIC_ALLOCATION) {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Object %p [%s] static allocation, no delete\n",
- object, acpi_ut_get_type_name (object->common.type)));
- }
+ /* Now the object can be safely deleted */
- if (!(object->common.flags & AOPOBJ_STATIC_ALLOCATION)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Deleting object %p [%s]\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Deleting Object %p [%s]\n",
object, acpi_ut_get_type_name (object->common.type)));
- acpi_ut_delete_object_desc (object);
- }
-
+ acpi_ut_delete_object_desc (object);
return_VOID;
}
acpi_operand_object **internal_obj;
- FUNCTION_TRACE ("Ut_delete_internal_object_list");
+ ACPI_FUNCTION_TRACE ("Ut_delete_internal_object_list");
/* Walk the null-terminated internal list */
u16 new_count;
- PROC_NAME ("Ut_update_ref_count");
+ ACPI_FUNCTION_NAME ("Ut_update_ref_count");
if (!object) {
return;
acpi_generic_state *state;
- FUNCTION_TRACE_PTR ("Ut_update_object_reference", object);
+ ACPI_FUNCTION_TRACE_PTR ("Ut_update_object_reference", object);
/* Ignore a null object ptr */
return_ACPI_STATUS (AE_OK);
}
-
/*
- * Make sure that this isn't a namespace handle or an AML pointer
+ * Make sure that this isn't a namespace handle
*/
- if (VALID_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_NAMED)) {
+ if (ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_NAMED) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Object %p is NS handle\n", object));
return_ACPI_STATUS (AE_OK);
}
-
state = acpi_ut_create_update_state (object, action);
while (state) {
* Different object types have different subobjects.
*/
switch (object->common.type) {
-
case ACPI_TYPE_DEVICE:
status = acpi_ut_create_update_state_and_push (object->device.addr_handler,
case INTERNAL_TYPE_BANK_FIELD:
status = acpi_ut_create_update_state_and_push (
- object->bank_field.bank_register_obj, action, &state_list);
+ object->bank_field.bank_obj, action, &state_list);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
break;
}
-
/*
* Now we can update the count in the main object. This can only
* happen after we update the sub-objects in case this causes the
*/
acpi_ut_update_ref_count (object, action);
-
/* Move on to the next object to be updated */
state = acpi_ut_pop_generic_state (&state_list);
}
-
return_ACPI_STATUS (AE_OK);
}
acpi_operand_object *object)
{
- FUNCTION_TRACE_PTR ("Ut_add_reference", object);
+ ACPI_FUNCTION_TRACE_PTR ("Ut_add_reference", object);
/*
acpi_operand_object *object)
{
- FUNCTION_TRACE_PTR ("Ut_remove_reference", object);
+ ACPI_FUNCTION_TRACE_PTR ("Ut_remove_reference", object);
/*
* Allow a NULL pointer to be passed in, just ignore it. This saves
*
*/
if (!object ||
- (VALID_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_NAMED))) {
+ (ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_NAMED)) {
return_VOID;
}
/******************************************************************************
*
* Module Name: uteval - Object evaluation
- * $Revision: 31 $
+ * $Revision: 37 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_UTILITIES
- MODULE_NAME ("uteval")
+ ACPI_MODULE_NAME ("uteval")
/*******************************************************************************
acpi_status status;
- FUNCTION_TRACE ("Ut_evaluate_numeric_object");
+ ACPI_FUNCTION_TRACE ("Ut_evaluate_numeric_object");
/* Execute the method */
if (ACPI_FAILURE (status)) {
if (status == AE_NOT_FOUND) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s on %4.4s was not found\n",
- object_name, (char*)&device_node->name));
+ object_name, (char *) &device_node->name));
}
else {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s on %4.4s failed with status %s\n",
- object_name, (char*)&device_node->name,
+ object_name, (char *) &device_node->name,
acpi_format_exception (status)));
}
acpi_status status;
- FUNCTION_TRACE ("Ut_execute_HID");
+ ACPI_FUNCTION_TRACE ("Ut_execute_HID");
/* Execute the method */
if (ACPI_FAILURE (status)) {
if (status == AE_NOT_FOUND) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "_HID on %4.4s was not found\n",
- (char*)&device_node->name));
+ (char *) &device_node->name));
}
-
else {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_HID on %4.4s failed %s\n",
- (char*)&device_node->name, acpi_format_exception (status)));
+ (char *) &device_node->name, acpi_format_exception (status)));
}
return_ACPI_STATUS (status);
"Type returned from _HID not a number or string: %s(%X) \n",
acpi_ut_get_type_name (obj_desc->common.type), obj_desc->common.type));
}
-
else {
if (obj_desc->common.type == ACPI_TYPE_INTEGER) {
/* Convert the Numeric HID to string */
acpi_ex_eisa_id_to_string ((u32) obj_desc->integer.value, hid->buffer);
}
-
else {
/* Copy the String HID from the returned object */
- STRNCPY(hid->buffer, obj_desc->string.pointer, sizeof(hid->buffer));
+ ACPI_STRNCPY (hid->buffer, obj_desc->string.pointer, sizeof(hid->buffer));
+ }
+ }
+
+ /* On exit, we must delete the return object */
+
+ acpi_ut_remove_reference (obj_desc);
+
+ return_ACPI_STATUS (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ut_execute_CID
+ *
+ * PARAMETERS: Device_node - Node for the device
+ * *Cid - Where the CID is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Executes the _CID control method that returns one or more
+ * compatible hardware IDs for the device.
+ *
+ * NOTE: Internal function, no parameter validation
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ut_execute_CID (
+ acpi_namespace_node *device_node,
+ acpi_device_id *cid)
+{
+ acpi_operand_object *obj_desc;
+ acpi_status status;
+
+
+ ACPI_FUNCTION_TRACE ("Ut_execute_CID");
+
+ /* Execute the method */
+
+ status = acpi_ns_evaluate_relative (device_node,
+ METHOD_NAME__CID, NULL, &obj_desc);
+ if (ACPI_FAILURE (status)) {
+ if (status == AE_NOT_FOUND) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "_CID on %4.4s was not found\n",
+ (char *)&device_node->name));
}
+ else {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_CID on %4.4s failed %s\n",
+ (char *)&device_node->name, acpi_format_exception (status)));
+ }
+
+ return_ACPI_STATUS (status);
}
+ /* Did we get a return object? */
+
+ if (!obj_desc) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _CID\n"));
+ return_ACPI_STATUS (AE_TYPE);
+ }
+
+ /*
+ * A _CID can return either a single compatible ID or a package of compatible
+ * IDs. Each compatible ID can be a Number (32 bit compressed EISA ID) or
+ * string (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss").
+ */
+ switch (obj_desc->common.type) {
+ case ACPI_TYPE_INTEGER:
+
+ /* Convert the Numeric CID to string */
+
+ acpi_ex_eisa_id_to_string ((u32) obj_desc->integer.value, cid->buffer);
+ break;
+
+ case ACPI_TYPE_STRING:
+
+ /* Copy the String CID from the returned object */
+
+ ACPI_STRNCPY (cid->buffer, obj_desc->string.pointer, sizeof(cid->buffer));
+ break;
+
+ case ACPI_TYPE_PACKAGE:
+
+ /* TBD: Parse package elements; need different return struct, etc. */
+ break;
+
+ default:
+
+ status = AE_TYPE;
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Type returned from _CID not a number, string, or package: %s(%X) \n",
+ acpi_ut_get_type_name (obj_desc->common.type), obj_desc->common.type));
+ break;
+ }
/* On exit, we must delete the return object */
acpi_status status;
- PROC_NAME ("Ut_execute_UID");
+ ACPI_FUNCTION_NAME ("Ut_execute_UID");
/* Execute the method */
if (ACPI_FAILURE (status)) {
if (status == AE_NOT_FOUND) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "_UID on %4.4s was not found\n",
- (char*)&device_node->name));
+ (char *) &device_node->name));
}
-
else {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"_UID on %4.4s failed %s\n",
- (char*)&device_node->name, acpi_format_exception (status)));
+ (char *) &device_node->name, acpi_format_exception (status)));
}
return (status);
"Type returned from _UID was not a number or string: %X \n",
obj_desc->common.type));
}
-
else {
if (obj_desc->common.type == ACPI_TYPE_INTEGER) {
/* Convert the Numeric UID to string */
acpi_ex_unsigned_integer_to_string (obj_desc->integer.value, uid->buffer);
}
-
else {
/* Copy the String UID from the returned object */
- STRNCPY(uid->buffer, obj_desc->string.pointer, sizeof(uid->buffer));
+ ACPI_STRNCPY (uid->buffer, obj_desc->string.pointer, sizeof(uid->buffer));
}
}
acpi_status status;
- FUNCTION_TRACE ("Ut_execute_STA");
+ ACPI_FUNCTION_TRACE ("Ut_execute_STA");
/* Execute the method */
if (AE_NOT_FOUND == status) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"_STA on %4.4s was not found, assuming present.\n",
- (char*)&device_node->name));
+ (char *) &device_node->name));
*flags = 0x0F;
status = AE_OK;
else if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_STA on %4.4s failed %s\n",
- (char*)&device_node->name,
+ (char *) &device_node->name,
acpi_format_exception (status)));
}
"Type returned from _STA was not a number: %X \n",
obj_desc->common.type));
}
-
else {
/* Extract the status flags */
/******************************************************************************
*
* Module Name: utglobal - Global variables for the ACPI subsystem
- * $Revision: 133 $
+ * $Revision: 153 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_UTILITIES
- MODULE_NAME ("utglobal")
+ ACPI_MODULE_NAME ("utglobal")
/******************************************************************************
/* System flags */
-u32 acpi_gbl_system_flags = 0;
u32 acpi_gbl_startup_flags = 0;
-/* System starts unitialized! */
+/* System starts uninitialized */
u8 acpi_gbl_shutdown = TRUE;
* during the initialization sequence.
*/
-const predefined_names acpi_gbl_pre_defined_names[] =
+const acpi_predefined_names acpi_gbl_pre_defined_names[] =
{ {"_GPE", INTERNAL_TYPE_DEF_ANY},
{"_PR_", INTERNAL_TYPE_DEF_ANY},
{"_SB_", ACPI_TYPE_DEVICE},
* and the table is indexed by values of acpi_object_type
*/
-const u8 acpi_gbl_ns_properties[] =
+const u8 acpi_gbl_ns_properties[] =
{
- NSP_NORMAL, /* 00 Any */
- NSP_NORMAL, /* 01 Number */
- NSP_NORMAL, /* 02 String */
- NSP_NORMAL, /* 03 Buffer */
- NSP_LOCAL, /* 04 Package */
- NSP_NORMAL, /* 05 Field_unit */
- NSP_NEWSCOPE | NSP_LOCAL, /* 06 Device */
- NSP_LOCAL, /* 07 Acpi_event */
- NSP_NEWSCOPE | NSP_LOCAL, /* 08 Method */
- NSP_LOCAL, /* 09 Mutex */
- NSP_LOCAL, /* 10 Region */
- NSP_NEWSCOPE | NSP_LOCAL, /* 11 Power */
- NSP_NEWSCOPE | NSP_LOCAL, /* 12 Processor */
- NSP_NEWSCOPE | NSP_LOCAL, /* 13 Thermal */
- NSP_NORMAL, /* 14 Buffer_field */
- NSP_NORMAL, /* 15 Ddb_handle */
- NSP_NORMAL, /* 16 Debug Object */
- NSP_NORMAL, /* 17 Def_field */
- NSP_NORMAL, /* 18 Bank_field */
- NSP_NORMAL, /* 19 Index_field */
- NSP_NORMAL, /* 20 Reference */
- NSP_NORMAL, /* 21 Alias */
- NSP_NORMAL, /* 22 Notify */
- NSP_NORMAL, /* 23 Address Handler */
- NSP_NEWSCOPE | NSP_LOCAL, /* 24 Resource Desc */
- NSP_NEWSCOPE | NSP_LOCAL, /* 25 Resource Field */
- NSP_NORMAL, /* 26 Def_field_defn */
- NSP_NORMAL, /* 27 Bank_field_defn */
- NSP_NORMAL, /* 28 Index_field_defn */
- NSP_NORMAL, /* 29 If */
- NSP_NORMAL, /* 30 Else */
- NSP_NORMAL, /* 31 While */
- NSP_NEWSCOPE, /* 32 Scope */
- NSP_LOCAL, /* 33 Def_any */
- NSP_NORMAL, /* 34 Extra */
- NSP_NORMAL /* 35 Invalid */
+ ACPI_NS_NORMAL, /* 00 Any */
+ ACPI_NS_NORMAL, /* 01 Number */
+ ACPI_NS_NORMAL, /* 02 String */
+ ACPI_NS_NORMAL, /* 03 Buffer */
+ ACPI_NS_LOCAL, /* 04 Package */
+ ACPI_NS_NORMAL, /* 05 Field_unit */
+ ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 06 Device */
+ ACPI_NS_LOCAL, /* 07 Acpi_event */
+ ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 08 Method */
+ ACPI_NS_LOCAL, /* 09 Mutex */
+ ACPI_NS_LOCAL, /* 10 Region */
+ ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 11 Power */
+ ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 12 Processor */
+ ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 13 Thermal */
+ ACPI_NS_NORMAL, /* 14 Buffer_field */
+ ACPI_NS_NORMAL, /* 15 Ddb_handle */
+ ACPI_NS_NORMAL, /* 16 Debug Object */
+ ACPI_NS_NORMAL, /* 17 Def_field */
+ ACPI_NS_NORMAL, /* 18 Bank_field */
+ ACPI_NS_NORMAL, /* 19 Index_field */
+ ACPI_NS_NORMAL, /* 20 Reference */
+ ACPI_NS_NORMAL, /* 21 Alias */
+ ACPI_NS_NORMAL, /* 22 Notify */
+ ACPI_NS_NORMAL, /* 23 Address Handler */
+ ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 24 Resource Desc */
+ ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 25 Resource Field */
+ ACPI_NS_NORMAL, /* 26 Def_field_defn */
+ ACPI_NS_NORMAL, /* 27 Bank_field_defn */
+ ACPI_NS_NORMAL, /* 28 Index_field_defn */
+ ACPI_NS_NORMAL, /* 29 If */
+ ACPI_NS_NORMAL, /* 30 Else */
+ ACPI_NS_NORMAL, /* 31 While */
+ ACPI_NS_NEWSCOPE, /* 32 Scope */
+ ACPI_NS_LOCAL, /* 33 Def_any */
+ ACPI_NS_NORMAL, /* 34 Extra */
+ ACPI_NS_NORMAL, /* 35 Data */
+ ACPI_NS_NORMAL /* 36 Invalid */
};
/******************************************************************************
*
- * Table globals
+ * Table name globals
*
* NOTE: This table includes ONLY the ACPI tables that the subsystem consumes.
* it is NOT an exhaustive list of all possible ACPI tables. All ACPI tables
* that are not used by the subsystem are simply ignored.
*
+ * Do NOT add any table to this list that is not consumed directly by this
+ * subsystem.
+ *
******************************************************************************/
ACPI_TABLE_SUPPORT acpi_gbl_acpi_table_data[NUM_ACPI_TABLES] =
{
- /*********** Name, Signature, Signature size, How many allowed?, Supported? Global typed pointer */
-
- /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, sizeof (RSDP_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, NULL},
- /* DSDT 1 */ {DSDT_SIG, DSDT_SIG, sizeof (DSDT_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, (void **) &acpi_gbl_DSDT},
- /* FADT 2 */ {FADT_SIG, FADT_SIG, sizeof (FADT_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, (void **) &acpi_gbl_FADT},
- /* FACS 3 */ {FACS_SIG, FACS_SIG, sizeof (FACS_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, (void **) &acpi_gbl_FACS},
- /* PSDT 4 */ {PSDT_SIG, PSDT_SIG, sizeof (PSDT_SIG)-1, ACPI_TABLE_MULTIPLE, AE_OK, NULL},
- /* SSDT 5 */ {SSDT_SIG, SSDT_SIG, sizeof (SSDT_SIG)-1, ACPI_TABLE_MULTIPLE, AE_OK, NULL},
- /* XSDT 6 */ {XSDT_SIG, XSDT_SIG, sizeof (RSDT_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, NULL},
+ /*********** Name, Signature, Global typed pointer Signature size, How many allowed?, Contains valid AML? */
+
+ /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL, sizeof (RSDP_SIG)-1, ACPI_TABLE_SINGLE},
+ /* DSDT 1 */ {DSDT_SIG, DSDT_SIG, (void **) &acpi_gbl_DSDT, sizeof (DSDT_SIG)-1, ACPI_TABLE_SINGLE | ACPI_TABLE_EXECUTABLE},
+ /* FADT 2 */ {FADT_SIG, FADT_SIG, (void **) &acpi_gbl_FADT, sizeof (FADT_SIG)-1, ACPI_TABLE_SINGLE},
+ /* FACS 3 */ {FACS_SIG, FACS_SIG, (void **) &acpi_gbl_FACS, sizeof (FACS_SIG)-1, ACPI_TABLE_SINGLE},
+ /* PSDT 4 */ {PSDT_SIG, PSDT_SIG, NULL, sizeof (PSDT_SIG)-1, ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE},
+ /* SSDT 5 */ {SSDT_SIG, SSDT_SIG, NULL, sizeof (SSDT_SIG)-1, ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE},
+ /* XSDT 6 */ {XSDT_SIG, XSDT_SIG, NULL, sizeof (RSDT_SIG)-1, ACPI_TABLE_SINGLE},
+};
+
+
+/******************************************************************************
+ *
+ * Event and Hardware globals
+ *
+ ******************************************************************************/
+
+ACPI_BIT_REGISTER_INFO acpi_gbl_bit_register_info[ACPI_NUM_BITREG] =
+{
+ /* Name Parent Register Register Bit Position Register Bit Mask */
+
+ /* ACPI_BITREG_TIMER_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_TIMER_STATUS, ACPI_BITMASK_TIMER_STATUS},
+ /* ACPI_BITREG_BUS_MASTER_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_BUS_MASTER_STATUS, ACPI_BITMASK_BUS_MASTER_STATUS},
+ /* ACPI_BITREG_GLOBAL_LOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_GLOBAL_LOCK_STATUS, ACPI_BITMASK_GLOBAL_LOCK_STATUS},
+ /* ACPI_BITREG_POWER_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_POWER_BUTTON_STATUS, ACPI_BITMASK_POWER_BUTTON_STATUS},
+ /* ACPI_BITREG_SLEEP_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_SLEEP_BUTTON_STATUS, ACPI_BITMASK_SLEEP_BUTTON_STATUS},
+ /* ACPI_BITREG_RT_CLOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_RT_CLOCK_STATUS, ACPI_BITMASK_RT_CLOCK_STATUS},
+ /* ACPI_BITREG_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_WAKE_STATUS, ACPI_BITMASK_WAKE_STATUS},
+
+ /* ACPI_BITREG_TIMER_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_TIMER_ENABLE, ACPI_BITMASK_TIMER_ENABLE},
+ /* ACPI_BITREG_GLOBAL_LOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE, ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
+ /* ACPI_BITREG_POWER_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_POWER_BUTTON_ENABLE, ACPI_BITMASK_POWER_BUTTON_ENABLE},
+ /* ACPI_BITREG_SLEEP_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE, ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
+ /* ACPI_BITREG_RT_CLOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_RT_CLOCK_ENABLE, ACPI_BITMASK_RT_CLOCK_ENABLE},
+ /* ACPI_BITREG_WAKE_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, 0, 0},
+
+ /* ACPI_BITREG_SCI_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SCI_ENABLE, ACPI_BITMASK_SCI_ENABLE},
+ /* ACPI_BITREG_BUS_MASTER_RLD */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_BUS_MASTER_RLD, ACPI_BITMASK_BUS_MASTER_RLD},
+ /* ACPI_BITREG_GLOBAL_LOCK_RELEASE */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE, ACPI_BITMASK_GLOBAL_LOCK_RELEASE},
+ /* ACPI_BITREG_SLEEP_TYPE_A */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SLEEP_TYPE_X, ACPI_BITMASK_SLEEP_TYPE_X},
+ /* ACPI_BITREG_SLEEP_TYPE_B */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SLEEP_TYPE_X, ACPI_BITMASK_SLEEP_TYPE_X},
+ /* ACPI_BITREG_SLEEP_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SLEEP_ENABLE, ACPI_BITMASK_SLEEP_ENABLE},
+
+ /* ACPI_BITREG_ARB_DIS */ {ACPI_REGISTER_PM2_CONTROL, ACPI_BITPOSITION_ARB_DISABLE, ACPI_BITMASK_ARB_DISABLE}
};
+acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] =
+{
+ /* ACPI_EVENT_PMTIMER */ {ACPI_BITREG_TIMER_STATUS, ACPI_BITREG_TIMER_ENABLE, ACPI_BITMASK_TIMER_STATUS, ACPI_BITMASK_TIMER_ENABLE},
+ /* ACPI_EVENT_GLOBAL */ {ACPI_BITREG_GLOBAL_LOCK_STATUS, ACPI_BITREG_GLOBAL_LOCK_ENABLE, ACPI_BITMASK_GLOBAL_LOCK_STATUS, ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
+ /* ACPI_EVENT_POWER_BUTTON */ {ACPI_BITREG_POWER_BUTTON_STATUS, ACPI_BITREG_POWER_BUTTON_ENABLE, ACPI_BITMASK_POWER_BUTTON_STATUS, ACPI_BITMASK_POWER_BUTTON_ENABLE},
+ /* ACPI_EVENT_SLEEP_BUTTON */ {ACPI_BITREG_SLEEP_BUTTON_STATUS, ACPI_BITREG_SLEEP_BUTTON_ENABLE, ACPI_BITMASK_SLEEP_BUTTON_STATUS, ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
+ /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS, ACPI_BITREG_RT_CLOCK_ENABLE, 0, 0},
+};
+
+/*****************************************************************************
+ *
+ * FUNCTION: Acpi_ut_get_region_name
+ *
+ * PARAMETERS: None.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Translate a Space ID into a name string (Debug only)
+ *
+ ****************************************************************************/
+
+/* Region type decoding */
+
+const NATIVE_CHAR *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] =
+{
+ "System_memory",
+ "System_iO",
+ "PCIConfig",
+ "Embedded_control",
+ "SMBus",
+ "CMOS",
+ "PCIBar_target",
+ "Data_table",
+};
+
+
+NATIVE_CHAR *
+acpi_ut_get_region_name (
+ u8 space_id)
+{
+
+ if (space_id >= ACPI_USER_REGION_BEGIN)
+ {
+ return ("User_defined_region");
+ }
+
+ else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS)
+ {
+ return ("Invalid_space_iD");
+ }
+
+ return ((NATIVE_CHAR *) acpi_gbl_region_types[space_id]);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: Acpi_ut_get_event_name
+ *
+ * PARAMETERS: None.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Translate a Event ID into a name string (Debug only)
+ *
+ ****************************************************************************/
+
+/* Event type decoding */
+
+const NATIVE_CHAR *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] =
+{
+ "PM_Timer",
+ "Global_lock",
+ "Power_button",
+ "Sleep_button",
+ "Real_time_clock",
+};
+
+
+NATIVE_CHAR *
+acpi_ut_get_event_name (
+ u32 event_id)
+{
+
+ if (event_id > ACPI_EVENT_MAX)
+ {
+ return ("Invalid_event_iD");
+ }
+
+ return ((NATIVE_CHAR *) acpi_gbl_event_types[event_id]);
+}
+
+
#ifdef ACPI_DEBUG
/*
}
+/*****************************************************************************
+ *
+ * FUNCTION: Acpi_ut_get_type_name
+ *
+ * PARAMETERS: None.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Translate a Type ID into a name string (Debug only)
+ *
+ ****************************************************************************/
+
/*
* Elements of Acpi_gbl_Ns_type_names below must match
* one-to-one with values of acpi_object_type
/* 32 */ "Scope",
/* 33 */ "Def_any",
/* 34 */ "Extra",
- /* 35 */ "Invalid"
+ /* 35 */ "Data",
+ /* 36 */ "Invalid"
};
-/*****************************************************************************
- *
- * FUNCTION: Acpi_ut_get_type_name
- *
- * PARAMETERS: None.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Translate a Type ID into a name string (Debug only)
- *
- ****************************************************************************/
-
NATIVE_CHAR *
acpi_ut_get_type_name (
- u32 type)
+ acpi_object_type type)
{
if (type > INTERNAL_TYPE_INVALID)
}
-/* Region type decoding */
-
-const NATIVE_CHAR *acpi_gbl_region_types[NUM_REGION_TYPES] =
-{
- "System_memory",
- "System_iO",
- "PCIConfig",
- "Embedded_control",
- "SMBus",
- "CMOS",
- "PCIBar_target",
-};
-
-
-/*****************************************************************************
- *
- * FUNCTION: Acpi_ut_get_region_name
- *
- * PARAMETERS: None.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Translate a Space ID into a name string (Debug only)
- *
- ****************************************************************************/
-
-NATIVE_CHAR *
-acpi_ut_get_region_name (
- u8 space_id)
-{
-
- if (space_id >= USER_REGION_BEGIN)
- {
- return ("User_defined_region");
- }
-
- else if (space_id >= NUM_REGION_TYPES)
- {
- return ("Invalid_space_iD");
- }
-
- return ((NATIVE_CHAR *) acpi_gbl_region_types[space_id]);
-}
-
-
/* Data used in keeping track of fields */
const NATIVE_CHAR *acpi_gbl_FEnames[NUM_FIELD_NAMES] =
"Byte_acc",
"Word_acc",
"DWord_acc",
- "Block_acc",
- "SMBSend_recv_acc",
- "SMBQuick_acc"
+ "QWord_acc",
+ "Buffer_acc",
};
u8
acpi_ut_valid_object_type (
- u32 type)
+ acpi_object_type type)
{
if (type > ACPI_TYPE_MAX)
acpi_owner_id owner_id = 0xFFFF;
- FUNCTION_TRACE ("Ut_allocate_owner_id");
+ ACPI_FUNCTION_TRACE ("Ut_allocate_owner_id");
- acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
+ if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_CACHES)))
+ {
+ return (0);
+ }
switch (id_type)
{
- case OWNER_TYPE_TABLE:
+ case ACPI_OWNER_TYPE_TABLE:
owner_id = acpi_gbl_next_table_owner_id;
acpi_gbl_next_table_owner_id++;
- if (acpi_gbl_next_table_owner_id == FIRST_METHOD_ID)
+ if (acpi_gbl_next_table_owner_id == ACPI_FIRST_METHOD_ID)
{
- acpi_gbl_next_table_owner_id = FIRST_TABLE_ID;
+ acpi_gbl_next_table_owner_id = ACPI_FIRST_TABLE_ID;
}
break;
- case OWNER_TYPE_METHOD:
+ case ACPI_OWNER_TYPE_METHOD:
owner_id = acpi_gbl_next_method_owner_id;
acpi_gbl_next_method_owner_id++;
- if (acpi_gbl_next_method_owner_id == FIRST_TABLE_ID)
+ if (acpi_gbl_next_method_owner_id == ACPI_FIRST_TABLE_ID)
{
- acpi_gbl_next_method_owner_id = FIRST_METHOD_ID;
+ acpi_gbl_next_method_owner_id = ACPI_FIRST_METHOD_ID;
}
break;
}
-
- acpi_ut_release_mutex (ACPI_MTX_CACHES);
-
+ (void) acpi_ut_release_mutex (ACPI_MTX_CACHES);
return_VALUE (owner_id);
}
u32 i;
- FUNCTION_TRACE ("Ut_init_globals");
+ ACPI_FUNCTION_TRACE ("Ut_init_globals");
/* Memory allocation and cache lists */
- MEMSET (acpi_gbl_memory_lists, 0, sizeof (ACPI_MEMORY_LIST) * ACPI_NUM_MEM_LISTS);
+ ACPI_MEMSET (acpi_gbl_memory_lists, 0, sizeof (ACPI_MEMORY_LIST) * ACPI_NUM_MEM_LISTS);
- acpi_gbl_memory_lists[ACPI_MEM_LIST_STATE].link_offset = (u16) (NATIVE_UINT) &(((acpi_generic_state *) NULL)->common.next);
- acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE].link_offset = (u16) (NATIVE_UINT) &(((acpi_parse_object *) NULL)->next);
- acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE_EXT].link_offset = (u16) (NATIVE_UINT) &(((acpi_parse2_object *) NULL)->next);
- acpi_gbl_memory_lists[ACPI_MEM_LIST_OPERAND].link_offset = (u16) (NATIVE_UINT) &(((acpi_operand_object *) NULL)->cache.next);
- acpi_gbl_memory_lists[ACPI_MEM_LIST_WALK].link_offset = (u16) (NATIVE_UINT) &(((acpi_walk_state *) NULL)->next);
+ acpi_gbl_memory_lists[ACPI_MEM_LIST_STATE].link_offset = (u16) ACPI_PTR_DIFF (&(((acpi_generic_state *) NULL)->common.next), NULL);
+ acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE].link_offset = (u16) ACPI_PTR_DIFF (&(((acpi_parse_object *) NULL)->next), NULL);
+ acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE_EXT].link_offset = (u16) ACPI_PTR_DIFF (&(((acpi_parse2_object *) NULL)->next), NULL);
+ acpi_gbl_memory_lists[ACPI_MEM_LIST_OPERAND].link_offset = (u16) ACPI_PTR_DIFF (&(((acpi_operand_object *) NULL)->cache.next), NULL);
+ acpi_gbl_memory_lists[ACPI_MEM_LIST_WALK].link_offset = (u16) ACPI_PTR_DIFF (&(((acpi_walk_state *) NULL)->next), NULL);
acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].object_size = sizeof (acpi_namespace_node);
acpi_gbl_memory_lists[ACPI_MEM_LIST_STATE].object_size = sizeof (acpi_generic_state);
acpi_gbl_acpi_tables[i].count = 0;
}
-
- /* Address Space handler array */
-
- for (i = 0; i < ACPI_NUM_ADDRESS_SPACES; i++)
- {
- acpi_gbl_address_spaces[i].handler = NULL;
- acpi_gbl_address_spaces[i].context = NULL;
- }
-
/* Mutex locked flags */
for (i = 0; i < NUM_MTX; i++)
acpi_gbl_global_lock_acquired = FALSE;
acpi_gbl_global_lock_thread_count = 0;
+ acpi_gbl_global_lock_handle = 0;
/* Miscellaneous variables */
- acpi_gbl_system_flags = 0;
- acpi_gbl_startup_flags = 0;
acpi_gbl_rsdp_original_location = 0;
acpi_gbl_cm_single_step = FALSE;
acpi_gbl_db_terminate_threads = FALSE;
acpi_gbl_ns_lookup_count = 0;
acpi_gbl_ps_find_count = 0;
acpi_gbl_acpi_hardware_present = TRUE;
- acpi_gbl_next_table_owner_id = FIRST_TABLE_ID;
- acpi_gbl_next_method_owner_id = FIRST_METHOD_ID;
+ acpi_gbl_next_table_owner_id = ACPI_FIRST_TABLE_ID;
+ acpi_gbl_next_method_owner_id = ACPI_FIRST_METHOD_ID;
acpi_gbl_debugger_configuration = DEBUGGER_THREADING;
+ acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT;
/* Hardware oriented */
- acpi_gbl_gpe0enable_register_save = NULL;
- acpi_gbl_gpe1_enable_register_save = NULL;
- acpi_gbl_original_mode = SYS_MODE_UNKNOWN; /* original ACPI/legacy mode */
- acpi_gbl_gpe_registers = NULL;
- acpi_gbl_gpe_info = NULL;
+ acpi_gbl_gpe_register_info = NULL;
+ acpi_gbl_gpe_number_info = NULL;
/* Namespace */
acpi_gbl_root_node = NULL;
acpi_gbl_root_node_struct.name = ACPI_ROOT_NAME;
- acpi_gbl_root_node_struct.data_type = ACPI_DESC_TYPE_NAMED;
+ acpi_gbl_root_node_struct.descriptor = ACPI_DESC_TYPE_NAMED;
acpi_gbl_root_node_struct.type = ACPI_TYPE_ANY;
acpi_gbl_root_node_struct.child = NULL;
acpi_gbl_root_node_struct.peer = NULL;
/******************************************************************************
*
* Module Name: utinit - Common ACPI subsystem initialization
- * $Revision: 102 $
+ * $Revision: 109 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "achware.h"
#include "acnamesp.h"
#include "acevents.h"
-#include "acparser.h"
-#include "acdispat.h"
#define _COMPONENT ACPI_UTILITIES
- MODULE_NAME ("utinit")
-
-
-#define ACPI_OFFSET(d,o) ((u32) &(((d *)0)->o))
-#define ACPI_FADT_OFFSET(o) ACPI_OFFSET (FADT_DESCRIPTOR, o)
+ ACPI_MODULE_NAME ("utinit")
/*******************************************************************************
*
******************************************************************************/
-static acpi_status
+static void
acpi_ut_fadt_register_error (
NATIVE_CHAR *register_name,
u32 value,
- u32 offset)
+ ACPI_SIZE offset)
{
- REPORT_ERROR (
+ ACPI_REPORT_WARNING (
("Invalid FADT value %s=%lX at offset %lX FADT=%p\n",
register_name, value, offset, acpi_gbl_FADT));
-
-
- return (AE_BAD_VALUE);
}
acpi_ut_validate_fadt (
void)
{
- acpi_status status = AE_OK;
-
/*
* Verify Fixed ACPI Description Table fields,
* but don't abort on any problems, just display error
*/
if (acpi_gbl_FADT->pm1_evt_len < 4) {
- status = acpi_ut_fadt_register_error ("PM1_EVT_LEN",
+ acpi_ut_fadt_register_error ("PM1_EVT_LEN",
(u32) acpi_gbl_FADT->pm1_evt_len,
ACPI_FADT_OFFSET (pm1_evt_len));
}
if (!acpi_gbl_FADT->pm1_cnt_len) {
- status = acpi_ut_fadt_register_error ("PM1_CNT_LEN", 0,
+ acpi_ut_fadt_register_error ("PM1_CNT_LEN", 0,
ACPI_FADT_OFFSET (pm1_cnt_len));
}
if (!ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xpm1a_evt_blk.address)) {
- status = acpi_ut_fadt_register_error ("X_PM1a_EVT_BLK", 0,
+ acpi_ut_fadt_register_error ("X_PM1a_EVT_BLK", 0,
ACPI_FADT_OFFSET (Xpm1a_evt_blk.address));
}
if (!ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xpm1a_cnt_blk.address)) {
- status = acpi_ut_fadt_register_error ("X_PM1a_CNT_BLK", 0,
+ acpi_ut_fadt_register_error ("X_PM1a_CNT_BLK", 0,
ACPI_FADT_OFFSET (Xpm1a_cnt_blk.address));
}
if (!ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xpm_tmr_blk.address)) {
- status = acpi_ut_fadt_register_error ("X_PM_TMR_BLK", 0,
+ acpi_ut_fadt_register_error ("X_PM_TMR_BLK", 0,
ACPI_FADT_OFFSET (Xpm_tmr_blk.address));
}
if ((ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xpm2_cnt_blk.address) &&
!acpi_gbl_FADT->pm2_cnt_len)) {
- status = acpi_ut_fadt_register_error ("PM2_CNT_LEN",
+ acpi_ut_fadt_register_error ("PM2_CNT_LEN",
(u32) acpi_gbl_FADT->pm2_cnt_len,
ACPI_FADT_OFFSET (pm2_cnt_len));
}
if (acpi_gbl_FADT->pm_tm_len < 4) {
- status = acpi_ut_fadt_register_error ("PM_TM_LEN",
+ acpi_ut_fadt_register_error ("PM_TM_LEN",
(u32) acpi_gbl_FADT->pm_tm_len,
ACPI_FADT_OFFSET (pm_tm_len));
}
- /* length of GPE blocks must be a multiple of 2 */
+ /* Length of GPE blocks must be a multiple of 2 */
- if (ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xgpe0blk.address) &&
- (acpi_gbl_FADT->gpe0blk_len & 1)) {
- status = acpi_ut_fadt_register_error ("(x)GPE0_BLK_LEN",
- (u32) acpi_gbl_FADT->gpe0blk_len,
- ACPI_FADT_OFFSET (gpe0blk_len));
+ if (ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xgpe0_blk.address) &&
+ (acpi_gbl_FADT->gpe0_blk_len & 1)) {
+ acpi_ut_fadt_register_error ("(x)GPE0_BLK_LEN",
+ (u32) acpi_gbl_FADT->gpe0_blk_len,
+ ACPI_FADT_OFFSET (gpe0_blk_len));
}
if (ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xgpe1_blk.address) &&
(acpi_gbl_FADT->gpe1_blk_len & 1)) {
- status = acpi_ut_fadt_register_error ("(x)GPE1_BLK_LEN",
+ acpi_ut_fadt_register_error ("(x)GPE1_BLK_LEN",
(u32) acpi_gbl_FADT->gpe1_blk_len,
ACPI_FADT_OFFSET (gpe1_blk_len));
}
- return (status);
+ return (AE_OK);
}
acpi_ut_terminate (void)
{
- FUNCTION_TRACE ("Ut_terminate");
+ ACPI_FUNCTION_TRACE ("Ut_terminate");
/* Free global tables, etc. */
- if (acpi_gbl_gpe0enable_register_save) {
- ACPI_MEM_FREE (acpi_gbl_gpe0enable_register_save);
- }
-
- if (acpi_gbl_gpe1_enable_register_save) {
- ACPI_MEM_FREE (acpi_gbl_gpe1_enable_register_save);
- }
-
+ /* Nothing to do at this time */
return_VOID;
}
acpi_ut_subsystem_shutdown (void)
{
- FUNCTION_TRACE ("Ut_subsystem_shutdown");
+ ACPI_FUNCTION_TRACE ("Ut_subsystem_shutdown");
/* Just exit if subsystem is already shutdown */
acpi_gbl_shutdown = TRUE;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Shutting down ACPI Subsystem...\n"));
-
/* Close the Namespace */
acpi_ns_terminate ();
acpi_ut_terminate ();
- /* Flush the local cache(s) */
-
- acpi_ut_delete_generic_state_cache ();
- acpi_ut_delete_object_cache ();
- acpi_ds_delete_walk_state_cache ();
-
- /* Close the Parser */
-
- /* TBD: [Restructure] Acpi_ps_terminate () */
+ /* Purge the local caches */
- acpi_ps_delete_parse_cache ();
+ acpi_purge_cached_objects ();
/* Debug only - display leftover memory allocation, if any */
/*******************************************************************************
*
* Module Name: utmath - Integer math support routines
- * $Revision: 7 $
+ * $Revision: 10 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_UTILITIES
- MODULE_NAME ("utmath")
+ ACPI_MODULE_NAME ("utmath")
/*
* Support for double-precision integer divide. This code is included here
u32 remainder32;
- FUNCTION_TRACE ("Ut_short_divide");
+ ACPI_FUNCTION_TRACE ("Ut_short_divide");
dividend.full = *in_dividend;
/* Always check for a zero divisor */
if (divisor == 0) {
- REPORT_ERROR (("Acpi_ut_short_divide: Divide by zero\n"));
+ ACPI_REPORT_ERROR (("Acpi_ut_short_divide: Divide by zero\n"));
return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO);
}
uint64_overlay partial3;
- FUNCTION_TRACE ("Ut_divide");
+ ACPI_FUNCTION_TRACE ("Ut_divide");
/* Always check for a zero divisor */
if (*in_divisor == 0) {
- REPORT_ERROR (("Acpi_ut_divide: Divide by zero\n"));
+ ACPI_REPORT_ERROR (("Acpi_ut_divide: Divide by zero\n"));
return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO);
}
u32 *out_remainder)
{
- FUNCTION_TRACE ("Ut_short_divide");
+ ACPI_FUNCTION_TRACE ("Ut_short_divide");
/* Always check for a zero divisor */
if (divisor == 0) {
- REPORT_ERROR (("Acpi_ut_short_divide: Divide by zero\n"));
+ ACPI_REPORT_ERROR (("Acpi_ut_short_divide: Divide by zero\n"));
return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO);
}
acpi_integer *out_quotient,
acpi_integer *out_remainder)
{
- FUNCTION_TRACE ("Ut_divide");
+ ACPI_FUNCTION_TRACE ("Ut_divide");
/* Always check for a zero divisor */
if (*in_divisor == 0) {
- REPORT_ERROR (("Acpi_ut_divide: Divide by zero\n"));
+ ACPI_REPORT_ERROR (("Acpi_ut_divide: Divide by zero\n"));
return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO);
}
/*******************************************************************************
*
* Module Name: utmisc - common utility procedures
- * $Revision: 52 $
+ * $Revision: 67 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_UTILITIES
- MODULE_NAME ("utmisc")
+ ACPI_MODULE_NAME ("utmisc")
+
+
+#ifdef ACPI_DEBUG
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ut_display_init_pathname
+ *
+ * PARAMETERS: Obj_handle - Handle whose pathname will be displayed
+ * Path - Additional path string to be appended
+ *
+ * RETURN: acpi_status
+ *
+ * DESCRIPTION: Display full pathnbame of an object, DEBUG ONLY
+ *
+ ******************************************************************************/
+
+void
+acpi_ut_display_init_pathname (
+ acpi_handle obj_handle,
+ char *path)
+{
+ acpi_status status;
+ acpi_buffer buffer;
+
+
+ ACPI_FUNCTION_NAME ("Ut_display_init_pathname");
+
+
+ buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
+
+ status = acpi_ns_handle_to_pathname (obj_handle, &buffer);
+ if (ACPI_SUCCESS (status)) {
+ if (path) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "%s.%s\n", (char *) buffer.pointer, path));
+ }
+ else {
+ ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "%s\n", (char *) buffer.pointer));
+ }
+
+ ACPI_MEM_FREE (buffer.pointer);
+ }
+}
+#endif
/*******************************************************************************
u32 i;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
for (i = 0; i < ACPI_NAME_SIZE; i++) {
NATIVE_CHAR character)
{
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
return ((u8) ((character == '_') ||
(character >= 'A' && character <= 'Z') ||
NATIVE_CHAR *string;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/* Walk entire string, uppercasing the letters */
for (string = src_string; *string; ) {
- *string = (char) TOUPPER (*string);
+ *string = (char) ACPI_TOUPPER (*string);
string++;
}
acpi_status status;
- FUNCTION_TRACE ("Ut_mutex_initialize");
+ ACPI_FUNCTION_TRACE ("Ut_mutex_initialize");
/*
u32 i;
- FUNCTION_TRACE ("Ut_mutex_terminate");
+ ACPI_FUNCTION_TRACE ("Ut_mutex_terminate");
/*
acpi_status status = AE_OK;
- FUNCTION_TRACE_U32 ("Ut_create_mutex", mutex_id);
+ ACPI_FUNCTION_TRACE_U32 ("Ut_create_mutex", mutex_id);
if (mutex_id > MAX_MTX) {
acpi_status status;
- FUNCTION_TRACE_U32 ("Ut_delete_mutex", mutex_id);
+ ACPI_FUNCTION_TRACE_U32 ("Ut_delete_mutex", mutex_id);
if (mutex_id > MAX_MTX) {
u32 this_thread_id;
- PROC_NAME ("Ut_acquire_mutex");
+ ACPI_FUNCTION_NAME ("Ut_acquire_mutex");
if (mutex_id > MAX_MTX) {
status = acpi_os_wait_semaphore (acpi_gbl_acpi_mutex_info[mutex_id].mutex,
1, WAIT_FOREVER);
-
if (ACPI_SUCCESS (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X acquired Mutex [%s]\n",
this_thread_id, acpi_ut_get_mutex_name (mutex_id)));
u32 this_thread_id;
- PROC_NAME ("Ut_release_mutex");
+ ACPI_FUNCTION_NAME ("Ut_release_mutex");
this_thread_id = acpi_os_get_thread_id ();
acpi_generic_state *state;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/* Ignore null objects; these are expected */
acpi_generic_state *state;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
state = acpi_ut_create_pkg_state (internal_object, external_object, index);
acpi_generic_state **list_head,
acpi_generic_state *state)
{
- FUNCTION_TRACE ("Ut_push_generic_state");
+ ACPI_FUNCTION_TRACE ("Ut_push_generic_state");
/* Push the state object onto the front of the list (stack) */
acpi_generic_state *state;
- FUNCTION_TRACE ("Ut_pop_generic_state");
+ ACPI_FUNCTION_TRACE ("Ut_pop_generic_state");
/* Remove the state object at the head of the list (stack) */
acpi_generic_state *state;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
state = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_STATE);
}
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ut_create_thread_state
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Thread State
+ *
+ * DESCRIPTION: Create a "Thread State" - a flavor of the generic state used
+ * to track per-thread info during method execution
+ *
+ ******************************************************************************/
+
+ACPI_THREAD_STATE *
+acpi_ut_create_thread_state (
+ void)
+{
+ acpi_generic_state *state;
+
+
+ ACPI_FUNCTION_TRACE ("Ut_create_thread_state");
+
+
+ /* Create the generic state object */
+
+ state = acpi_ut_create_generic_state ();
+ if (!state) {
+ return_PTR (NULL);
+ }
+
+ /* Init fields specific to the update struct */
+
+ state->common.data_type = ACPI_DESC_TYPE_STATE_THREAD;
+ state->thread.thread_id = acpi_os_get_thread_id ();
+
+ return_PTR ((ACPI_THREAD_STATE *) state);
+}
+
+
/*******************************************************************************
*
* FUNCTION: Acpi_ut_create_update_state
acpi_generic_state *state;
- FUNCTION_TRACE_PTR ("Ut_create_update_state", object);
+ ACPI_FUNCTION_TRACE_PTR ("Ut_create_update_state", object);
/* Create the generic state object */
state = acpi_ut_create_generic_state ();
if (!state) {
- return (NULL);
+ return_PTR (NULL);
}
/* Init fields specific to the update struct */
acpi_generic_state *state;
- FUNCTION_TRACE_PTR ("Ut_create_pkg_state", internal_object);
+ ACPI_FUNCTION_TRACE_PTR ("Ut_create_pkg_state", internal_object);
/* Create the generic state object */
state = acpi_ut_create_generic_state ();
if (!state) {
- return (NULL);
+ return_PTR (NULL);
}
/* Init fields specific to the update struct */
acpi_generic_state *state;
- FUNCTION_TRACE ("Ut_create_control_state");
+ ACPI_FUNCTION_TRACE ("Ut_create_control_state");
/* Create the generic state object */
state = acpi_ut_create_generic_state ();
if (!state) {
- return (NULL);
+ return_PTR (NULL);
}
/* Init fields specific to the control struct */
state->common.data_type = ACPI_DESC_TYPE_STATE_CONTROL;
- state->common.state = CONTROL_CONDITIONAL_EXECUTING;
+ state->common.state = ACPI_CONTROL_CONDITIONAL_EXECUTING;
return_PTR (state);
}
acpi_ut_delete_generic_state (
acpi_generic_state *state)
{
- FUNCTION_TRACE ("Ut_delete_generic_state");
+ ACPI_FUNCTION_TRACE ("Ut_delete_generic_state");
acpi_ut_release_to_cache (ACPI_MEM_LIST_STATE, state);
acpi_ut_delete_generic_state_cache (
void)
{
- FUNCTION_TRACE ("Ut_delete_generic_state_cache");
+ ACPI_FUNCTION_TRACE ("Ut_delete_generic_state_cache");
acpi_ut_delete_generic_cache (ACPI_MEM_LIST_STATE);
/*******************************************************************************
*
- * FUNCTION: Acpi_ut_resolve_package_references
+ * FUNCTION: Acpi_ut_resolve_reference
*
- * PARAMETERS: Obj_desc - The Package object on which to resolve refs
+ * PARAMETERS: ACPI_PKG_CALLBACK
*
- * RETURN: Status
+ * RETURN: Status - the status of the call
*
- * DESCRIPTION: Walk through a package and turn internal references into values
+ * DESCRIPTION: Resolve a reference object to an actual value
*
******************************************************************************/
acpi_status
-acpi_ut_resolve_package_references (
- acpi_operand_object *obj_desc)
+acpi_ut_resolve_reference (
+ u8 object_type,
+ acpi_operand_object *source_object,
+ acpi_generic_state *state,
+ void *context)
{
- u32 count;
- acpi_operand_object *sub_object;
+ acpi_pkg_info *info = (acpi_pkg_info *) context;
- FUNCTION_TRACE ("Ut_resolve_package_references");
+ switch (object_type) {
+ case ACPI_COPY_TYPE_SIMPLE:
+ /*
+ * Simple object - check for a reference
+ */
+ if (source_object->common.type == INTERNAL_TYPE_REFERENCE) {
+ switch (source_object->reference.opcode) {
+ case AML_ZERO_OP:
- if (obj_desc->common.type != ACPI_TYPE_PACKAGE) {
- /* The object must be a package */
+ source_object->common.type = ACPI_TYPE_INTEGER;
+ source_object->integer.value = 0;
+ break;
- REPORT_ERROR (("Must resolve Package Refs on a Package\n"));
- return_ACPI_STATUS(AE_ERROR);
- }
+ case AML_ONE_OP:
- /*
- * TBD: what about nested packages? */
+ source_object->common.type = ACPI_TYPE_INTEGER;
+ source_object->integer.value = 1;
+ break;
- for (count = 0; count < obj_desc->package.count; count++) {
- sub_object = obj_desc->package.elements[count];
+ case AML_ONES_OP:
- if (sub_object->common.type == INTERNAL_TYPE_REFERENCE) {
- if (sub_object->reference.opcode == AML_ZERO_OP) {
- sub_object->common.type = ACPI_TYPE_INTEGER;
- sub_object->integer.value = 0;
+ source_object->common.type = ACPI_TYPE_INTEGER;
+ source_object->integer.value = ACPI_INTEGER_MAX;
+ break;
}
+ }
+ break;
- else if (sub_object->reference.opcode == AML_ONE_OP) {
- sub_object->common.type = ACPI_TYPE_INTEGER;
- sub_object->integer.value = 1;
- }
- else if (sub_object->reference.opcode == AML_ONES_OP) {
- sub_object->common.type = ACPI_TYPE_INTEGER;
- sub_object->integer.value = ACPI_INTEGER_MAX;
- }
- }
+ case ACPI_COPY_TYPE_PACKAGE:
+
+ /* Package object - nothing much to do here, let the walk handle it */
+
+ info->num_packages++;
+ state->pkg.this_target_obj = NULL;
+ break;
}
- return_ACPI_STATUS(AE_OK);
+ return (AE_OK);
}
-#ifdef ACPI_DEBUG
/*******************************************************************************
*
- * FUNCTION: Acpi_ut_display_init_pathname
+ * FUNCTION: Acpi_ut_resolve_package_references
*
- * PARAMETERS: Obj_handle - Handle whose pathname will be displayed
- * Path - Additional path string to be appended
+ * PARAMETERS: Obj_desc - The Package object on which to resolve refs
*
- * RETURN: acpi_status
+ * RETURN: Status
*
- * DESCRIPTION: Display full pathnbame of an object, DEBUG ONLY
+ * DESCRIPTION: Walk through a package and turn internal references into values
*
******************************************************************************/
-void
-acpi_ut_display_init_pathname (
- acpi_handle obj_handle,
- char *path)
+acpi_status
+acpi_ut_resolve_package_references (
+ acpi_operand_object *obj_desc)
{
+ acpi_pkg_info info;
acpi_status status;
- u32 length = 128;
- char buffer[128];
- PROC_NAME ("Ut_display_init_pathname");
+ ACPI_FUNCTION_TRACE ("Ut_resolve_package_references");
- status = acpi_ns_handle_to_pathname (obj_handle, &length, buffer);
- if (ACPI_SUCCESS (status)) {
- if (path) {
- ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "%s.%s\n", buffer, path));
- }
- else {
- ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "%s\n", buffer));
- }
+ if (obj_desc->common.type != ACPI_TYPE_PACKAGE) {
+ /* The object must be a package */
+
+ ACPI_REPORT_ERROR (("Expecting a Package object\n"));
+ return_ACPI_STATUS (AE_TYPE);
}
+
+ info.length = 0;
+ info.object_space = 0;
+ info.num_packages = 1;
+
+ status = acpi_ut_walk_package_tree (obj_desc, NULL,
+ acpi_ut_resolve_reference, &info);
+
+ return_ACPI_STATUS (status);
}
-#endif
+
/*******************************************************************************
*
acpi_operand_object *this_source_obj;
- FUNCTION_TRACE ("Ut_walk_package_tree");
+ ACPI_FUNCTION_TRACE ("Ut_walk_package_tree");
state = acpi_ut_create_pkg_state (source_object, target_object, 0);
state->pkg.source_object->package.elements[this_index];
/*
- * Check for
+ * Check for:
* 1) An uninitialized package element. It is completely
- * legal to declare a package and leave it uninitialized
+ * legal to declare a package and leave it uninitialized
* 2) Not an internal object - can be a namespace node instead
* 3) Any type other than a package. Packages are handled in else
- * case below.
+ * case below.
*/
if ((!this_source_obj) ||
- (!VALID_DESCRIPTOR_TYPE (
- this_source_obj, ACPI_DESC_TYPE_INTERNAL)) ||
- (!IS_THIS_OBJECT_TYPE (
- this_source_obj, ACPI_TYPE_PACKAGE))) {
-
+ (ACPI_GET_DESCRIPTOR_TYPE (this_source_obj) != ACPI_DESC_TYPE_INTERNAL) ||
+ (this_source_obj->common.type != ACPI_TYPE_PACKAGE)) {
status = walk_callback (ACPI_COPY_TYPE_SIMPLE, this_source_obj,
state, context);
if (ACPI_FAILURE (status)) {
- /* TBD: must delete package created up to this point */
-
return_ACPI_STATUS (status);
}
acpi_ut_delete_generic_state (state);
state = acpi_ut_pop_generic_state (&state_list);
-
/* Finished when there are no more states */
if (!state) {
state->pkg.index++;
}
}
-
else {
- /* This is a sub-object of type package */
+ /* This is a subobject of type package */
status = walk_callback (ACPI_COPY_TYPE_PACKAGE, this_source_obj,
state, context);
if (ACPI_FAILURE (status)) {
- /* TBD: must delete package created up to this point */
-
return_ACPI_STATUS (status);
}
-
- /*
- * The callback above returned a new target package object.
- */
-
/*
* Push the current state and create a new one
+ * The callback above returned a new target package object.
*/
acpi_ut_push_generic_state (&state_list, state);
state = acpi_ut_create_pkg_state (this_source_obj,
state->pkg.this_target_obj, 0);
if (!state) {
- /* TBD: must delete package created up to this point */
-
return_ACPI_STATUS (AE_NO_MEMORY);
}
}
/* We should never get here */
- return (AE_AML_INTERNAL);
+ return_ACPI_STATUS (AE_AML_INTERNAL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ut_generate_checksum
+ *
+ * PARAMETERS: Buffer - Buffer to be scanned
+ * Length - number of bytes to examine
+ *
+ * RETURN: checksum
+ *
+ * DESCRIPTION: Generate a checksum on a raw buffer
+ *
+ ******************************************************************************/
+
+u8
+acpi_ut_generate_checksum (
+ u8 *buffer,
+ u32 length)
+{
+ u32 i;
+ signed char sum = 0;
+
+ for (i = 0; i < length; i++) {
+ sum = (signed char) (sum + buffer[i]);
+ }
+
+ return ((u8) (0 - sum));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ut_get_resource_end_tag
+ *
+ * PARAMETERS: Obj_desc - The resource template buffer object
+ *
+ * RETURN: Pointer to the end tag
+ *
+ * DESCRIPTION: Find the END_TAG resource descriptor in a resource template
+ *
+ ******************************************************************************/
+
+
+u8 *
+acpi_ut_get_resource_end_tag (
+ acpi_operand_object *obj_desc)
+{
+ u8 buffer_byte;
+ u8 *buffer;
+ u8 *end_buffer;
+
+
+ buffer = obj_desc->buffer.pointer;
+ end_buffer = buffer + obj_desc->buffer.length;
+
+ while (buffer < end_buffer) {
+ buffer_byte = *buffer;
+ if (buffer_byte & ACPI_RDESC_TYPE_MASK) {
+ /* Large Descriptor - Length is next 2 bytes */
+
+ buffer += ((*(buffer+1) | (*(buffer+2) << 8)) + 3);
+ }
+ else {
+ /* Small Descriptor. End Tag will be found here */
+
+ if ((buffer_byte & ACPI_RDESC_SMALL_MASK) == ACPI_RDESC_TYPE_END_TAG) {
+ /* Found the end tag descriptor, all done. */
+
+ return (buffer);
+ }
+
+ /* Length is in the header */
+
+ buffer += ((buffer_byte & 0x07) + 1);
+ }
+ }
+
+ /* End tag not found */
+
+ return (NULL);
}
/******************************************************************************
*
* Module Name: utobject - ACPI object create/delete/size/cache routines
- * $Revision: 57 $
+ * $Revision: 68 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define _COMPONENT ACPI_UTILITIES
- MODULE_NAME ("utobject")
+ ACPI_MODULE_NAME ("utobject")
/*******************************************************************************
NATIVE_CHAR *module_name,
u32 line_number,
u32 component_id,
- acpi_object_type8 type)
+ acpi_object_type type)
{
acpi_operand_object *object;
+ acpi_operand_object *second_object;
- FUNCTION_TRACE_STR ("Ut_create_internal_object_dbg", acpi_ut_get_type_name (type));
+ ACPI_FUNCTION_TRACE_STR ("Ut_create_internal_object_dbg", acpi_ut_get_type_name (type));
/* Allocate the raw object descriptor */
object = acpi_ut_allocate_object_desc_dbg (module_name, line_number, component_id);
if (!object) {
- /* Allocation failure */
-
return_PTR (NULL);
}
+ switch (type) {
+ case ACPI_TYPE_REGION:
+ case ACPI_TYPE_BUFFER_FIELD:
+
+ /* These types require a secondary object */
+
+ second_object = acpi_ut_allocate_object_desc_dbg (module_name, line_number, component_id);
+ if (!second_object) {
+ acpi_ut_delete_object_desc (object);
+ return_PTR (NULL);
+ }
+
+ second_object->common.type = INTERNAL_TYPE_EXTRA;
+ second_object->common.reference_count = 1;
+
+ /* Link the second object to the first */
+
+ object->common.next_object = second_object;
+ break;
+ }
+
/* Save the object type in the object descriptor */
- object->common.type = type;
+ object->common.type = (u8) type;
/* Init the reference count */
void *object)
{
- PROC_NAME ("Ut_valid_internal_object");
+ ACPI_FUNCTION_NAME ("Ut_valid_internal_object");
/* Check for a null pointer */
/* Check the descriptor type field */
- if (!VALID_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_INTERNAL)) {
- /* Not an ACPI internal object, do some further checking */
+ switch (ACPI_GET_DESCRIPTOR_TYPE (object)) {
+ case ACPI_DESC_TYPE_INTERNAL:
- if (VALID_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_NAMED)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "**** Obj %p is a named obj, not ACPI obj\n", object));
- }
+ /* The object appears to be a valid acpi_operand_object */
- else if (VALID_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_PARSER)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "**** Obj %p is a parser obj, not ACPI obj\n", object));
- }
+ return (TRUE);
- else {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "**** Obj %p is of unknown type\n", object));
- }
+ case ACPI_DESC_TYPE_NAMED:
- return (FALSE);
- }
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "**** Obj %p is a named obj, not ACPI obj\n", object));
+ break;
+ case ACPI_DESC_TYPE_PARSER:
- /* The object appears to be a valid acpi_operand_object */
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "**** Obj %p is a parser obj, not ACPI obj\n", object));
+ break;
- return (TRUE);
+ default:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "**** Obj %p is of unknown type\n", object));
+ break;
+ }
+
+ return (FALSE);
}
acpi_operand_object *object;
- FUNCTION_TRACE ("Ut_allocate_object_desc_dbg");
+ ACPI_FUNCTION_TRACE ("Ut_allocate_object_desc_dbg");
object = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_OPERAND);
if (!object) {
- _REPORT_ERROR (module_name, line_number, component_id,
+ _ACPI_REPORT_ERROR (module_name, line_number, component_id,
("Could not allocate an object descriptor\n"));
return_PTR (NULL);
/* Mark the descriptor type */
- object->common.data_type = ACPI_DESC_TYPE_INTERNAL;
+ ACPI_SET_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_INTERNAL);
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p Size %X\n",
object, sizeof (acpi_operand_object)));
acpi_ut_delete_object_desc (
acpi_operand_object *object)
{
- FUNCTION_TRACE_PTR ("Ut_delete_object_desc", object);
+ ACPI_FUNCTION_TRACE_PTR ("Ut_delete_object_desc", object);
/* Object must be an acpi_operand_object */
- if (object->common.data_type != ACPI_DESC_TYPE_INTERNAL) {
+ if (ACPI_GET_DESCRIPTOR_TYPE (object) != ACPI_DESC_TYPE_INTERNAL) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Obj %p is not an ACPI object\n", object));
return_VOID;
acpi_ut_delete_object_cache (
void)
{
- FUNCTION_TRACE ("Ut_delete_object_cache");
+ ACPI_FUNCTION_TRACE ("Ut_delete_object_cache");
acpi_ut_delete_generic_cache (ACPI_MEM_LIST_OPERAND);
acpi_status
acpi_ut_get_simple_object_size (
acpi_operand_object *internal_object,
- u32 *obj_length)
+ ACPI_SIZE *obj_length)
{
- u32 length;
+ ACPI_SIZE length;
acpi_status status = AE_OK;
- FUNCTION_TRACE_PTR ("Ut_get_simple_object_size", internal_object);
+ ACPI_FUNCTION_TRACE_PTR ("Ut_get_simple_object_size", internal_object);
/* Handle a null object (Could be a uninitialized package element -- which is legal) */
length = sizeof (acpi_object);
- if (VALID_DESCRIPTOR_TYPE (internal_object, ACPI_DESC_TYPE_NAMED)) {
+ if (ACPI_GET_DESCRIPTOR_TYPE (internal_object) == ACPI_DESC_TYPE_NAMED) {
/* Object is a named object (reference), just return the length */
- *obj_length = (u32) ROUND_UP_TO_NATIVE_WORD (length);
+ *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD (length);
return_ACPI_STATUS (status);
}
case INTERNAL_TYPE_REFERENCE:
- /*
- * The only type that should be here is internal opcode NAMEPATH_OP -- since
- * this means an object reference
- */
- if (internal_object->reference.opcode != AML_INT_NAMEPATH_OP) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unsupported Reference opcode=%X in object %p\n",
- internal_object->reference.opcode, internal_object));
- status = AE_TYPE;
- }
+ switch (internal_object->reference.opcode) {
+ case AML_ZERO_OP:
+ case AML_ONE_OP:
+ case AML_ONES_OP:
+ case AML_REVISION_OP:
+
+ /* These Constant opcodes will be resolved to Integers */
+
+ break;
+
+ case AML_INT_NAMEPATH_OP:
- else {
/*
* Get the actual length of the full pathname to this object.
* The reference will be converted to the pathname to the object
*/
- length += ROUND_UP_TO_NATIVE_WORD (acpi_ns_get_pathname_length (internal_object->reference.node));
+ length += ACPI_ROUND_UP_TO_NATIVE_WORD (acpi_ns_get_pathname_length (internal_object->reference.node));
+ break;
+
+ default:
+
+ /*
+ * No other reference opcodes are supported.
+ * Notably, Locals and Args are not supported, by this may be
+ * required eventually.
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Unsupported Reference opcode=%X in object %p\n",
+ internal_object->reference.opcode, internal_object));
+ status = AE_TYPE;
+ break;
}
break;
* on a machine word boundary. (preventing alignment faults on some
* machines.)
*/
- *obj_length = (u32) ROUND_UP_TO_NATIVE_WORD (length);
-
+ *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD (length);
return_ACPI_STATUS (status);
}
{
acpi_status status = AE_OK;
acpi_pkg_info *info = (acpi_pkg_info *) context;
- u32 object_space;
+ ACPI_SIZE object_space;
switch (object_type) {
- case 0:
+ case ACPI_COPY_TYPE_SIMPLE:
/*
* Simple object - just get the size (Null object/entry is handled
break;
- case 1:
- /* Package - nothing much to do here, let the walk handle it */
+ case ACPI_COPY_TYPE_PACKAGE:
+
+ /* Package object - nothing much to do here, let the walk handle it */
info->num_packages++;
state->pkg.this_target_obj = NULL;
break;
-
- default:
- return (AE_BAD_PARAMETER);
}
-
return (status);
}
acpi_status
acpi_ut_get_package_object_size (
acpi_operand_object *internal_object,
- u32 *obj_length)
+ ACPI_SIZE *obj_length)
{
acpi_status status;
acpi_pkg_info info;
- FUNCTION_TRACE_PTR ("Ut_get_package_object_size", internal_object);
+ ACPI_FUNCTION_TRACE_PTR ("Ut_get_package_object_size", internal_object);
info.length = 0;
status = acpi_ut_walk_package_tree (internal_object, NULL,
acpi_ut_get_element_length, &info);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
/*
* We have handled all of the objects in all levels of the package.
* just add the length of the package objects themselves.
* Round up to the next machine word.
*/
- info.length += ROUND_UP_TO_NATIVE_WORD (sizeof (acpi_object)) *
+ info.length += ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (acpi_object)) *
info.num_packages;
/* Return the total package length */
acpi_status
acpi_ut_get_object_size(
acpi_operand_object *internal_object,
- u32 *obj_length)
+ ACPI_SIZE *obj_length)
{
acpi_status status;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
- if ((VALID_DESCRIPTOR_TYPE (internal_object, ACPI_DESC_TYPE_INTERNAL)) &&
- (IS_THIS_OBJECT_TYPE (internal_object, ACPI_TYPE_PACKAGE))) {
+ if ((ACPI_GET_DESCRIPTOR_TYPE (internal_object) == ACPI_DESC_TYPE_INTERNAL) &&
+ (internal_object->common.type == ACPI_TYPE_PACKAGE)) {
status = acpi_ut_get_package_object_size (internal_object, obj_length);
}
-
else {
status = acpi_ut_get_simple_object_size (internal_object, obj_length);
}
/******************************************************************************
*
* Module Name: utxface - External interfaces for "global" ACPI functions
- * $Revision: 82 $
+ * $Revision: 92 $
*
*****************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "amlcode.h"
#include "acdebug.h"
#include "acexcep.h"
+#include "acparser.h"
+#include "acdispat.h"
#define _COMPONENT ACPI_UTILITIES
- MODULE_NAME ("utxface")
+ ACPI_MODULE_NAME ("utxface")
/*******************************************************************************
{
acpi_status status;
- FUNCTION_TRACE ("Acpi_initialize_subsystem");
+ ACPI_FUNCTION_TRACE ("Acpi_initialize_subsystem");
- DEBUG_EXEC(acpi_ut_init_stack_ptr_trace ());
+ ACPI_DEBUG_EXEC (acpi_ut_init_stack_ptr_trace ());
/* Initialize all globals used by the subsystem */
status = acpi_os_initialize ();
if (ACPI_FAILURE (status)) {
- REPORT_ERROR (("OSD failed to initialize, %s\n",
+ ACPI_REPORT_ERROR (("OSD failed to initialize, %s\n",
acpi_format_exception (status)));
return_ACPI_STATUS (status);
}
status = acpi_ut_mutex_initialize ();
if (ACPI_FAILURE (status)) {
- REPORT_ERROR (("Global mutex creation failure, %s\n",
+ ACPI_REPORT_ERROR (("Global mutex creation failure, %s\n",
acpi_format_exception (status)));
return_ACPI_STATUS (status);
}
status = acpi_ns_root_initialize ();
if (ACPI_FAILURE (status)) {
- REPORT_ERROR (("Namespace initialization failure, %s\n",
+ ACPI_REPORT_ERROR (("Namespace initialization failure, %s\n",
acpi_format_exception (status)));
return_ACPI_STATUS (status);
}
/* If configured, initialize the AML debugger */
- DEBUGGER_EXEC (acpi_db_initialize ());
+ ACPI_DEBUGGER_EXEC (acpi_db_initialize ());
return_ACPI_STATUS (status);
}
acpi_status status = AE_OK;
- FUNCTION_TRACE ("Acpi_enable_subsystem");
+ ACPI_FUNCTION_TRACE ("Acpi_enable_subsystem");
- /* Sanity check the FADT for valid values */
-
- status = acpi_ut_validate_fadt ();
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
/*
- * Install the default Op_region handlers. These are
- * installed unless other handlers have already been
- * installed via the Install_address_space_handler interface
+ * Install the default Op_region handlers. These are installed unless
+ * other handlers have already been installed via the
+ * Install_address_space_handler interface
*/
if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Installing default address space handlers\n"));
/*
* We must initialize the hardware before we can enable ACPI.
+ * FADT values are validated here.
*/
if (!(flags & ACPI_NO_HARDWARE_INIT)) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI hardware\n"));
}
}
+ /* Install SCI handler, Global Lock handler, GPE handlers */
+
+ if (!(flags & ACPI_NO_HANDLER_INIT)) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Installing SCI/GL/GPE handlers\n"));
+
+ status = acpi_ev_handler_initialize ();
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+ }
/*
* Initialize all device objects in the namespace
}
}
-
/*
* Initialize the objects that remain uninitialized. This
* runs the executable AML that is part of the declaration of Op_regions
}
}
- acpi_gbl_startup_flags |= ACPI_INITIALIZED_OK;
+ /*
+ * Empty the caches (delete the cached objects) on the assumption that
+ * the table load filled them up more than they will be at runtime --
+ * thus wasting non-paged memory.
+ */
+ status = acpi_purge_cached_objects ();
+ acpi_gbl_startup_flags |= ACPI_INITIALIZED_OK;
return_ACPI_STATUS (status);
}
acpi_status
acpi_terminate (void)
{
- FUNCTION_TRACE ("Acpi_terminate");
+ ACPI_FUNCTION_TRACE ("Acpi_terminate");
/* Terminate the AML Debugger if present */
- DEBUGGER_EXEC(acpi_gbl_db_terminate_threads = TRUE);
-
- /* TBD: [Investigate] This is no longer needed?*/
-/* Acpi_ut_release_mutex (ACPI_MTX_DEBUG_CMD_READY); */
-
+ ACPI_DEBUGGER_EXEC(acpi_gbl_db_terminate_threads = TRUE);
/* Shutdown and free all resources */
{
acpi_system_info *info_ptr;
u32 i;
+ acpi_status status;
- FUNCTION_TRACE ("Acpi_get_system_info");
+ ACPI_FUNCTION_TRACE ("Acpi_get_system_info");
- /*
- * Must have a valid buffer
- */
- if ((!out_buffer) ||
- (!out_buffer->pointer)) {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ /* Parameter validation */
+
+ status = acpi_ut_validate_buffer (out_buffer);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
}
- if (out_buffer->length < sizeof (acpi_system_info)) {
- /*
- * Caller's buffer is too small
- */
- out_buffer->length = sizeof (acpi_system_info);
+ /* Validate/Allocate/Clear caller buffer */
- return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
+ status = acpi_ut_initialize_buffer (out_buffer, sizeof (acpi_system_info));
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
}
-
/*
- * Set return length and get data
+ * Populate the return buffer
*/
- out_buffer->length = sizeof (acpi_system_info);
info_ptr = (acpi_system_info *) out_buffer->pointer;
info_ptr->acpi_ca_version = ACPI_CA_VERSION;
/* System flags (ACPI capabilities) */
- info_ptr->flags = acpi_gbl_system_flags;
+ info_ptr->flags = ACPI_SYS_MODE_ACPI;
/* Timer resolution - 24 or 32 bits */
+
if (!acpi_gbl_FADT) {
info_ptr->timer_resolution = 0;
}
}
+/*****************************************************************************
+ *
+ * FUNCTION: Acpi_purge_cached_objects
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Empty all caches (delete the cached objects)
+ *
+ ****************************************************************************/
+
+acpi_status
+acpi_purge_cached_objects (void)
+{
+ ACPI_FUNCTION_TRACE ("Acpi_purge_cached_objects");
+
+
+ acpi_ut_delete_generic_state_cache ();
+ acpi_ut_delete_object_cache ();
+ acpi_ds_delete_walk_state_cache ();
+ acpi_ps_delete_parse_cache ();
+
+ return_ACPI_STATUS (AE_OK);
+}