/*******************************************************************************
*
* Module Name: dbcmds - debug commands and output routines
- * $Revision: 79 $
+ * $Revision: 83 $
*
******************************************************************************/
#include "acpi.h"
-#include "acparser.h"
#include "acdispat.h"
#include "amlcode.h"
#include "acnamesp.h"
-#include "acparser.h"
#include "acevents.h"
-#include "acinterp.h"
#include "acdebug.h"
-#include "actables.h"
#include "acresrc.h"
#ifdef ENABLE_DEBUGGER
* These object types map directly to the ACPI_TYPES
*/
-ARGUMENT_INFO acpi_db_object_types [] =
+static ARGUMENT_INFO acpi_db_object_types [] =
{ {"ANY"},
{"NUMBERS"},
{"STRINGS"},
/* Check for match against the namespace node itself */
if (node == (void *) obj_desc) {
- acpi_os_printf ("Object is a Node [%4.4s]\n", &node->name);
+ acpi_os_printf ("Object is a Node [%4.4s]\n", node->name.ascii);
}
/* Check for match against the object attached to the node */
if (acpi_ns_get_attached_object (node) == obj_desc) {
- acpi_os_printf ("Reference at Node->Object %p [%4.4s]\n", node, &node->name);
+ acpi_os_printf ("Reference at Node->Object %p [%4.4s]\n", node, node->name.ascii);
}
return (AE_OK);
/* Search all nodes in namespace */
- acpi_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+ (void) acpi_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
acpi_db_walk_for_references, (void *) obj_desc, NULL);
}
/* Get and verify the breakpoint address */
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);
+ if (address <= op->common.aml_offset) {
+ acpi_os_printf ("Breakpoint %X is beyond current address %X\n", address, op->common.aml_offset);
}
/* Save breakpoint in current walk */
u32 value)
{
acpi_namespace_node *node;
+ acpi_status status;
/* Translate name to an Named object */
/* Send the notify */
- acpi_ev_queue_notify_request (node, value);
+ status = acpi_ev_queue_notify_request (node, value);
+ if (ACPI_FAILURE (status)) {
+ acpi_os_printf ("Could not queue notify\n");
+ }
break;
default:
u32 value;
acpi_walk_state *walk_state;
acpi_operand_object *obj_desc;
+ acpi_status status;
/* Validate Type_arg */
/* Set a method argument */
- if (index > MTH_NUM_ARGS) {
+ if (index > MTH_MAX_ARG) {
acpi_os_printf ("Arg%d - Invalid argument name\n", index);
return;
}
- acpi_ds_store_object_to_local (AML_ARG_OP, index, obj_desc, walk_state);
+ status = acpi_ds_store_object_to_local (AML_ARG_OP, index, obj_desc, walk_state);
+ if (ACPI_FAILURE (status)) {
+ return;
+ }
+
obj_desc = walk_state->arguments[index].object;
acpi_os_printf ("Arg%d: ", index);
/* Set a method local */
- if (index > MTH_NUM_LOCALS) {
+ if (index > MTH_MAX_LOCAL) {
acpi_os_printf ("Local%d - Invalid local variable name\n", index);
return;
}
- acpi_ds_store_object_to_local (AML_LOCAL_OP, index, obj_desc, walk_state);
+ status = acpi_ds_store_object_to_local (AML_LOCAL_OP, index, obj_desc, walk_state);
+ if (ACPI_FAILURE (status)) {
+ return;
+ }
+
obj_desc = walk_state->local_variables[index].object;
acpi_os_printf ("Local%d: ", index);
case ACPI_TYPE_BUFFER:
acpi_os_printf (" Length %X", obj_desc->buffer.length);
break;
+
+ default:
+ /* Ignore other object types */
+ break;
}
}
/* Walk the namespace from the root */
- acpi_walk_namespace (type, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+ (void) acpi_walk_namespace (type, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
acpi_db_walk_for_specific_objects, (void *) &type, NULL);
acpi_db_set_output_destination (ACPI_DB_CONSOLE_OUTPUT);
/* Wildcard support */
if ((requested_name[i] != '?') &&
- (requested_name[i] != ((NATIVE_CHAR *) (&((acpi_namespace_node *) obj_handle)->name))[i])) {
+ (requested_name[i] != ((acpi_namespace_node *) obj_handle)->name.ascii[i])) {
/* No match, just exit */
return (AE_OK);
/* Walk the namespace from the root */
- acpi_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+ (void) 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 (ACPI_DB_CONSOLE_OUTPUT);
acpi_db_display_resources (
NATIVE_CHAR *object_arg)
{
-#ifndef _IA16
+#if ACPI_MACHINE_WIDTH != 16
+
acpi_operand_object *obj_desc;
acpi_status status;
acpi_buffer return_obj;
}
else {
- acpi_rs_dump_resource_list ((acpi_resource *) acpi_gbl_db_buffer);
+ acpi_rs_dump_resource_list (ACPI_CAST_PTR (acpi_resource, acpi_gbl_db_buffer));
}
status = acpi_set_current_resources (obj_desc, &return_obj);
}
else {
- acpi_rs_dump_resource_list ((acpi_resource *) acpi_gbl_db_buffer);
+ acpi_rs_dump_resource_list (ACPI_CAST_PTR (acpi_resource, acpi_gbl_db_buffer));
}
}
+typedef struct
+{
+ u32 nodes;
+ u32 objects;
+} ACPI_INTEGRITY_INFO;
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_db_integrity_walk
+ *
+ * PARAMETERS: Callback from Walk_namespace
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Examine one NS node for valid values.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_db_integrity_walk (
+ acpi_handle obj_handle,
+ u32 nesting_level,
+ void *context,
+ void **return_value)
+{
+ ACPI_INTEGRITY_INFO *info = (ACPI_INTEGRITY_INFO *) context;
+ acpi_namespace_node *node = (acpi_namespace_node *) obj_handle;
+ acpi_operand_object *object;
+
+
+ info->nodes++;
+ if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) {
+ acpi_os_printf ("Invalid Descriptor Type for Node %p, Type = %X\n",
+ node, ACPI_GET_DESCRIPTOR_TYPE (node));
+ }
+
+ if (node->type > INTERNAL_TYPE_MAX) {
+ acpi_os_printf ("Invalid Object Type for Node %p, Type = %X\n",
+ node, node->type);
+ }
+
+ if (!acpi_ut_valid_acpi_name (node->name.integer)) {
+ acpi_os_printf ("Invalid Acpi_name for Node %p\n", node);
+ }
+
+ object = acpi_ns_get_attached_object (node);
+ if (object) {
+ info->objects++;
+ if (ACPI_GET_DESCRIPTOR_TYPE (object) != ACPI_DESC_TYPE_OPERAND) {
+ acpi_os_printf ("Invalid Descriptor Type for Object %p, Type = %X\n",
+ object, ACPI_GET_DESCRIPTOR_TYPE (object));
+ }
+ }
+
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_db_check_integrity
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Check entire namespace for data structure integrity
+ *
+ ******************************************************************************/
+
+void
+acpi_db_check_integrity (void)
+{
+ ACPI_INTEGRITY_INFO info = {0,0};
+
+ /* Search all nodes in namespace */
+
+ (void) acpi_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+ acpi_db_integrity_walk, (void *) &info, NULL);
+
+ acpi_os_printf ("Verified %d namespace nodes with %d Objects\n", info.nodes, info.objects);
+
+}
+
#endif /* ENABLE_DEBUGGER */
/*******************************************************************************
*
* Module Name: dbdisasm - parser op tree display routines
- * $Revision: 61 $
+ * $Revision: 66 $
*
******************************************************************************/
#define BLOCK_PAREN 1
#define BLOCK_BRACE 2
#define DB_NO_OP_INFO " [%2.2d] "
-#define DB_FULL_OP_INFO "%5.5X #%4.4X [%2.2d] "
+#define DB_FULL_OP_INFO "%5.5X #%4.4hX [%2.2d] "
NATIVE_CHAR *acpi_gbl_db_disasm_indent = "....";
acpi_parse_object *op)
{
- switch (op->opcode) {
+ switch (op->common.aml_opcode) {
case AML_METHOD_OP:
return (BLOCK_BRACE);
char *name;
- if (op->flags & ACPI_PARSEOP_GENERIC) {
- name = op->value.name;
+ if (op->common.flags & ACPI_PARSEOP_GENERIC) {
+ name = op->common.value.name;
if (name[0] == '\\') {
acpi_os_printf (" (Fully Qualified Pathname)");
return (AE_OK);
}
}
else {
- name = (char *) &((acpi_parse2_object *) op)->name;
+ name = (char *) &op->named.name;
}
/* Search parent tree up to the root if necessary */
/* Just get the Node out of the Op object */
- node = op->node;
+ node = op->common.node;
if (!node) {
/* Node not defined in this scope, look it up */
- status = acpi_ns_lookup (walk_state->scope_info, op->value.string, ACPI_TYPE_ANY,
+ status = acpi_ns_lookup (walk_state->scope_info, op->common.value.string, ACPI_TYPE_ANY,
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node));
if (ACPI_FAILURE (status)) {
/* Save it for next time. */
- op->node = node;
+ op->common.node = node;
}
/* Convert Named_desc/handle to a full pathname */
/* Determine the nesting depth of this argument */
- for (depth = op->parent; depth; depth = depth->parent) {
+ for (depth = op->common.parent; depth; depth = depth->common.parent) {
arg = acpi_ps_get_arg (depth, 0);
while (arg && arg != origin) {
- arg = arg->next;
+ arg = arg->common.next;
}
if (arg) {
/* 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++) {
+ for (j = last_depth; j >= (depth_count + 1); j--) {
+ VERBOSE_PRINT ((DB_NO_OP_INFO, (j - 1)));
+ for (i = 1; i < j; i++) {
acpi_os_printf ("%s", acpi_gbl_db_disasm_indent);
}
/* 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));
+ VERBOSE_PRINT ((DB_FULL_OP_INFO, (u32) op->common.aml_offset,
+ op->common.aml_opcode, depth_count));
/* Indent the output according to the depth count */
/* Resolve a name reference */
- if ((op->opcode == AML_INT_NAMEPATH_OP && op->value.name) &&
- (op->parent) &&
+ if ((op->common.aml_opcode == AML_INT_NAMEPATH_OP && op->common.value.name) &&
+ (op->common.parent) &&
(acpi_gbl_db_opt_verbose)) {
- acpi_ps_display_object_pathname (walk_state, op);
+ (void) acpi_ps_display_object_pathname (walk_state, op);
}
acpi_os_printf ("\n");
/* We are only interested in named objects */
- op_info = acpi_ps_get_opcode_info (op->opcode);
+ op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
if (!(op_info->flags & AML_NSNODE)) {
return;
}
if (op_info->flags & AML_CREATE) {
/* Field creation - check for a fully qualified namepath */
- if (op->opcode == AML_CREATE_FIELD_OP) {
+ if (op->common.aml_opcode == AML_CREATE_FIELD_OP) {
name_path = acpi_ps_get_arg (op, 3);
}
else {
}
if ((name_path) &&
- (name_path->value.string) &&
- (name_path->value.string[0] == '\\')) {
- acpi_db_display_namestring (name_path->value.string);
+ (name_path->common.value.string) &&
+ (name_path->common.value.string[0] == '\\')) {
+ acpi_db_display_namestring (name_path->common.value.string);
return;
}
}
search = op;
for (; ;) {
- if (search->parent == prev) {
+ if (search->common.parent == prev) {
break;
}
/* Go up one level */
- search = search->parent;
+ search = search->common.parent;
}
if (prev) {
- op_info = acpi_ps_get_opcode_info (search->opcode);
+ op_info = acpi_ps_get_opcode_info (search->common.aml_opcode);
if (!(op_info->flags & AML_FIELD)) {
/* below root scope, append scope name */
}
if (op_info->flags & AML_CREATE) {
- if (op->opcode == AML_CREATE_FIELD_OP) {
+ if (op->common.aml_opcode == AML_CREATE_FIELD_OP) {
name_path = acpi_ps_get_arg (op, 3);
}
else {
}
if ((name_path) &&
- (name_path->value.string)) {
- acpi_os_printf ("%4.4s", name_path->value.string);
+ (name_path->common.value.string)) {
+ acpi_os_printf ("%4.4s", name_path->common.value.string);
}
}
else {
if (!op) {
acpi_os_printf ("<NULL OP PTR>");
+ return;
}
/* op and arguments */
- switch (op->opcode) {
+ switch (op->common.aml_opcode) {
case AML_BYTE_OP:
if (acpi_gbl_db_opt_verbose) {
- acpi_os_printf ("(u8) 0x%2.2X", op->value.integer8);
+ acpi_os_printf ("(u8) 0x%2.2hX", op->common.value.integer8);
}
else {
- acpi_os_printf ("0x%2.2X", op->value.integer8);
+ acpi_os_printf ("0x%2.2hX", op->common.value.integer8);
}
break;
case AML_WORD_OP:
if (acpi_gbl_db_opt_verbose) {
- acpi_os_printf ("(u16) 0x%4.4X", op->value.integer16);
+ acpi_os_printf ("(u16) 0x%4.4hX", op->common.value.integer16);
}
else {
- acpi_os_printf ("0x%4.4X", op->value.integer16);
+ acpi_os_printf ("0x%4.4hX", op->common.value.integer16);
}
break;
case AML_DWORD_OP:
if (acpi_gbl_db_opt_verbose) {
- acpi_os_printf ("(u32) 0x%8.8X", op->value.integer32);
+ acpi_os_printf ("(u32) 0x%8.8X", op->common.value.integer32);
}
else {
- acpi_os_printf ("0x%8.8X", op->value.integer32);
+ acpi_os_printf ("0x%8.8X", op->common.value.integer32);
}
break;
case AML_QWORD_OP:
if (acpi_gbl_db_opt_verbose) {
- acpi_os_printf ("(u64) 0x%8.8X%8.8X", op->value.integer64.hi,
- op->value.integer64.lo);
+ acpi_os_printf ("(u64) 0x%8.8X%8.8X", op->common.value.integer64.hi,
+ op->common.value.integer64.lo);
}
else {
- acpi_os_printf ("0x%8.8X%8.8X", op->value.integer64.hi,
- op->value.integer64.lo);
+ acpi_os_printf ("0x%8.8X%8.8X", op->common.value.integer64.hi,
+ op->common.value.integer64.lo);
}
break;
case AML_STRING_OP:
- if (op->value.string) {
- acpi_os_printf ("\"%s\"", op->value.string);
+ if (op->common.value.string) {
+ acpi_os_printf ("\"%s\"", op->common.value.string);
}
else {
acpi_os_printf ("<\"NULL STRING PTR\">");
case AML_INT_STATICSTRING_OP:
- if (op->value.string) {
- acpi_os_printf ("\"%s\"", op->value.string);
+ if (op->common.value.string) {
+ acpi_os_printf ("\"%s\"", op->common.value.string);
}
else {
acpi_os_printf ("\"<NULL STATIC STRING PTR>\"");
case AML_INT_NAMEPATH_OP:
- acpi_db_display_namestring (op->value.name);
+ acpi_db_display_namestring (op->common.value.name);
break;
case AML_INT_NAMEDFIELD_OP:
- acpi_os_printf ("Named_field (Length 0x%8.8X) ", op->value.integer32);
+ acpi_os_printf ("Named_field (Length 0x%8.8X) ", op->common.value.integer32);
break;
case AML_INT_RESERVEDFIELD_OP:
- acpi_os_printf ("Reserved_field (Length 0x%8.8X) ", op->value.integer32);
+ acpi_os_printf ("Reserved_field (Length 0x%8.8X) ", op->common.value.integer32);
break;
case AML_INT_ACCESSFIELD_OP:
- acpi_os_printf ("Access_field (Length 0x%8.8X) ", op->value.integer32);
+ acpi_os_printf ("Access_field (Length 0x%8.8X) ", op->common.value.integer32);
break;
case AML_INT_BYTELIST_OP:
if (acpi_gbl_db_opt_verbose) {
- acpi_os_printf ("Byte_list (Length 0x%8.8X) ", op->value.integer32);
+ acpi_os_printf ("Byte_list (Length 0x%8.8X) ", op->common.value.integer32);
}
else {
- acpi_os_printf ("0x%2.2X", op->value.integer32);
+ acpi_os_printf ("0x%2.2X", op->common.value.integer32);
- byte_count = op->value.integer32;
- byte_data = ((acpi_parse2_object *) op)->data;
+ byte_count = op->common.value.integer32;
+ byte_data = op->named.data;
for (i = 0; i < byte_count; i++) {
acpi_os_printf (", 0x%2.2X", byte_data[i]);
/* Just get the opcode name and print it */
- op_info = acpi_ps_get_opcode_info (op->opcode);
+ op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
acpi_os_printf ("%s", op_info->name);
#ifndef PARSER_ONLY
- if ((op->opcode == AML_INT_RETURN_VALUE_OP) &&
+ if ((op->common.aml_opcode == AML_INT_RETURN_VALUE_OP) &&
+ (walk_state) &&
(walk_state->results) &&
(walk_state->results->results.num_results)) {
acpi_db_decode_internal_object (walk_state->results->results.obj_desc [walk_state->results->results.num_results-1]);
if (!op_info) {
/* If there is another element in the list, add a comma */
- if (op->next) {
+ if (op->common.next) {
acpi_os_printf (",");
}
}
/*
* If this is a named opcode, print the associated name value
*/
- op_info = acpi_ps_get_opcode_info (op->opcode);
+ op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
if (op && (op_info->flags & AML_NAMED)) {
name = acpi_ps_get_name (op);
acpi_os_printf (" %4.4s", &name);
- if ((acpi_gbl_db_opt_verbose) && (op->opcode != AML_INT_NAMEDFIELD_OP)) {
- acpi_ps_display_object_pathname (walk_state, op);
+ if ((acpi_gbl_db_opt_verbose) && (op->common.aml_opcode != AML_INT_NAMEDFIELD_OP)) {
+ (void) acpi_ps_display_object_pathname (walk_state, op);
}
}
}
/*******************************************************************************
*
* Module Name: dbdisply - debug display commands
- * $Revision: 67 $
+ * $Revision: 73 $
*
******************************************************************************/
#include "acpi.h"
-#include "acparser.h"
#include "amlcode.h"
#include "acdispat.h"
#include "acnamesp.h"
#include "acparser.h"
-#include "acevents.h"
#include "acinterp.h"
#include "acdebug.h"
void *obj_ptr;
-#ifdef _IA16
+#if ACPI_MACHINE_WIDTH == 16
#include <stdio.h>
/* Have to handle 16-bit pointers of the form segment:offset */
const acpi_opcode_info *info;
- info = acpi_ps_get_opcode_info (op->opcode);
+ info = acpi_ps_get_opcode_info (op->common.aml_opcode);
acpi_os_printf ("Parser Op Descriptor:\n");
- acpi_os_printf ("%20.20s : %4.4X\n", "Opcode", op->opcode);
+ acpi_os_printf ("%20.20s : %4.4X\n", "Opcode", op->common.aml_opcode);
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);
- acpi_os_printf ("%20.20s : %p\n", "Next_op", op->next);
+ acpi_os_printf ("%20.20s : %p\n", "Value/Arg_list", op->common.value.arg);
+ acpi_os_printf ("%20.20s : %p\n", "Parent", op->common.parent);
+ acpi_os_printf ("%20.20s : %p\n", "Next_op", op->common.next);
}
goto dump_nte;
- case ACPI_DESC_TYPE_INTERNAL:
+ case ACPI_DESC_TYPE_OPERAND:
/* This is a ACPI OPERAND OBJECT */
obj_desc = acpi_ns_get_attached_object (node);
if (obj_desc) {
- acpi_os_printf ("\n_attached Object (%p):\n", obj_desc);
+ acpi_os_printf ("\nAttached 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;
switch (obj_desc->common.type) {
case ACPI_TYPE_INTEGER:
- acpi_os_printf (" %.8X%.8X", ACPI_HIDWORD (obj_desc->integer.value),
- ACPI_LODWORD (obj_desc->integer.value));
+ acpi_os_printf (" %8.8X%8.8X", ACPI_HIDWORD (obj_desc->integer.value),
+ ACPI_LODWORD (obj_desc->integer.value));
break;
acpi_os_printf (" %2.2X", obj_desc->buffer.pointer[i]);
}
break;
+
+
+ default:
+ /* No additional display for other types */
+ break;
}
}
case ACPI_DESC_TYPE_NAMED:
acpi_os_printf ("<Node> Name %4.4s Type-%s",
- &((acpi_namespace_node *)obj_desc)->name,
+ ((acpi_namespace_node *)obj_desc)->name.ascii,
acpi_ut_get_type_name (((acpi_namespace_node *) obj_desc)->type));
if (((acpi_namespace_node *) obj_desc)->flags & ANOBJ_METHOD_ARG) {
break;
- case ACPI_DESC_TYPE_INTERNAL:
+ case ACPI_DESC_TYPE_OPERAND:
type = obj_desc->common.type;
if (type > INTERNAL_TYPE_MAX) {
- acpi_os_printf (" Type %x [Invalid Type]", type);
+ acpi_os_printf (" Type %hX [Invalid Type]", type);
return;
}
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);
+ acpi_os_printf ("Currently executing control method is [%4.4s]\n", node->name.ascii);
acpi_os_printf ("%X arguments, max concurrency = %X\n", num_args, concurrency);
root_op = start_op;
- while (root_op->parent) {
- root_op = root_op->parent;
+ while (root_op->common.parent) {
+ root_op = root_op->common.parent;
}
op = root_op;
/* Decode the opcode */
- op_info = acpi_ps_get_opcode_info (op->opcode);
+ op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
switch (op_info->class) {
case AML_CLASS_ARGUMENT:
if (count_remaining) {
obj_desc = walk_state->method_desc;
node = walk_state->method_node;
- acpi_os_printf ("Local Variables for method [%4.4s]:\n", &node->name);
+ acpi_os_printf ("Local Variables for method [%4.4s]:\n", node->name.ascii);
for (i = 0; i < MTH_NUM_LOCALS; i++) {
obj_desc = walk_state->local_variables[i].object;
concurrency = obj_desc->method.concurrency;
acpi_os_printf ("Method [%4.4s] has %X arguments, max concurrency = %X\n",
- &node->name, num_args, concurrency);
+ node->name.ascii, num_args, concurrency);
for (i = 0; i < num_args; i++) {
obj_desc = walk_state->arguments[i].object;
}
acpi_os_printf ("Method [%4.4s] has %X stacked result objects\n",
- &node->name, num_results);
+ node->name.ascii, num_results);
for (i = 0; i < num_results; i++) {
obj_desc = walk_state->results->results.obj_desc[i];
void
acpi_db_display_calling_tree (void)
{
- u32 i;
acpi_walk_state *walk_state;
acpi_namespace_node *node;
node = walk_state->method_node;
acpi_os_printf ("Current Control Method Call Tree\n");
- for (i = 0; walk_state; i++) {
+ while (walk_state) {
node = walk_state->method_node;
- acpi_os_printf (" [%4.4s]\n", &node->name);
+ acpi_os_printf (" [%4.4s]\n", node->name.ascii);
walk_state = walk_state->next;
}
/*******************************************************************************
*
* Module Name: dbexec - debugger control method execution
- * $Revision: 39 $
+ * $Revision: 41 $
*
******************************************************************************/
#include "acpi.h"
-#include "acparser.h"
-#include "acdispat.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-#include "acparser.h"
-#include "acevents.h"
-#include "acinterp.h"
#include "acdebug.h"
-#include "actables.h"
#ifdef ENABLE_DEBUGGER
ACPI_MODULE_NAME ("dbexec")
-acpi_db_method_info acpi_gbl_db_method_info;
+static acpi_db_method_info acpi_gbl_db_method_info;
/*******************************************************************************
void
acpi_db_execute_setup (
- acpi_db_method_info *info)
+ acpi_db_method_info *info)
{
/* Catenate the current scope to the supplied name */
******************************************************************************/
u32
-acpi_db_get_outstanding_allocations (void)
+acpi_db_get_outstanding_allocations (
+ void)
{
u32 outstanding = 0;
/* Signal our completion */
- acpi_os_signal_semaphore (info->thread_gate, 1);
+ status = acpi_os_signal_semaphore (info->thread_gate, 1);
+ if (ACPI_FAILURE (status)) {
+ acpi_os_printf ("Could not signal debugger semaphore\n");
+ }
}
acpi_os_printf ("Creating %X threads to execute %X times each\n", num_threads, num_loops);
for (i = 0; i < (num_threads); i++) {
- acpi_os_queue_for_execution (OSD_PRIORITY_MED, acpi_db_method_thread, &acpi_gbl_db_method_info);
+ status = acpi_os_queue_for_execution (OSD_PRIORITY_MED, acpi_db_method_thread, &acpi_gbl_db_method_info);
+ if (ACPI_FAILURE (status)) {
+ break;
+ }
}
/* Wait for all threads to complete */
/* Cleanup and exit */
- acpi_os_delete_semaphore (thread_gate);
+ (void) acpi_os_delete_semaphore (thread_gate);
acpi_db_set_output_destination (ACPI_DB_DUPLICATE_OUTPUT);
acpi_os_printf ("All threads (%X) have completed\n", num_threads);
*
* Module Name: dbfileio - Debugger file I/O commands. These can't usually
* be used when running the debugger in Ring 0 (Kernel mode)
- * $Revision: 60 $
+ * $Revision: 63 $
*
******************************************************************************/
#include "acpi.h"
#include "acdebug.h"
#include "acnamesp.h"
-#include "acparser.h"
-#include "acevents.h"
#include "actables.h"
#ifdef ENABLE_DEBUGGER
*
******************************************************************************/
-acpi_status
+static acpi_status
acpi_db_load_table(
FILE *fp,
acpi_table_header **table_ptr,
table_info.pointer = table_ptr;
- status = acpi_tb_install_table (NULL, &table_info);
+ status = acpi_tb_install_table (&table_info);
if (ACPI_FAILURE (status)) {
/* Free table allocated by Acpi_tb_get_table */
if (ACPI_FAILURE (status)) {
if (status == AE_ALREADY_EXISTS) {
acpi_os_printf ("Table %4.4s is already installed\n",
- &acpi_gbl_db_table_ptr->signature);
+ acpi_gbl_db_table_ptr->signature);
}
else {
acpi_os_printf ("Could not install table, %s\n",
}
acpi_os_printf ("%4.4s at %p successfully installed and loaded\n",
- &acpi_gbl_db_table_ptr->signature, acpi_gbl_db_table_ptr);
+ acpi_gbl_db_table_ptr->signature, acpi_gbl_db_table_ptr);
acpi_gbl_acpi_hardware_present = FALSE;
/******************************************************************************
*
* Module Name: dbhistry - debugger HISTORY command
- * $Revision: 22 $
+ * $Revision: 24 $
*
*****************************************************************************/
#include "acpi.h"
-#include "acparser.h"
-#include "acdispat.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-#include "acparser.h"
-#include "acevents.h"
-#include "acinterp.h"
#include "acdebug.h"
-#include "actables.h"
#ifdef ENABLE_DEBUGGER
} HISTORY_INFO;
-HISTORY_INFO acpi_gbl_history_buffer[HISTORY_SIZE];
-u16 acpi_gbl_lo_history = 0;
-u16 acpi_gbl_num_history = 0;
-u16 acpi_gbl_next_history_index = 0;
-u32 acpi_gbl_next_cmd_num = 1;
+static HISTORY_INFO acpi_gbl_history_buffer[HISTORY_SIZE];
+static u16 acpi_gbl_lo_history = 0;
+static u16 acpi_gbl_num_history = 0;
+static u16 acpi_gbl_next_history_index = 0;
+static u32 acpi_gbl_next_cmd_num = 1;
/*******************************************************************************
/*******************************************************************************
*
* Module Name: dbinput - user front-end to the AML debugger
- * $Revision: 81 $
+ * $Revision: 86 $
*
******************************************************************************/
#include "acpi.h"
-#include "acparser.h"
-#include "actables.h"
-#include "acnamesp.h"
-#include "acinterp.h"
#include "acdebug.h"
CMD_HISTORY_EXE,
CMD_HISTORY_LAST,
CMD_INFORMATION,
+ CMD_INTEGRITY,
CMD_INTO,
CMD_LEVEL,
CMD_LIST,
#define CMD_FIRST_VALID 2
-const COMMAND_INFO acpi_gbl_db_commands[] =
+static const COMMAND_INFO acpi_gbl_db_commands[] =
{ {"<NOT FOUND>", 0},
{"<NULL>", 0},
{"ALLOCATIONS", 0},
{"!", 1},
{"!!", 0},
{"INFORMATION", 0},
+ {"INTEGRITY", 0},
{"INTO", 0},
{"LEVEL", 0},
{"LIST", 0},
switch (help_type[0])
{
case 'G':
- acpi_os_printf ("\n_general-Purpose Commands\n\n");
+ acpi_os_printf ("\nGeneral-Purpose Commands\n\n");
acpi_os_printf ("Allocations Display list of current memory allocations\n");
acpi_os_printf ("Dump <Address>|<Namepath>\n");
acpi_os_printf (" [Byte|Word|Dword|Qword] Display ACPI objects or memory\n");
return;
case 'N':
- acpi_os_printf ("\n_namespace Access Commands\n\n");
+ acpi_os_printf ("\nNamespace Access Commands\n\n");
acpi_os_printf ("Debug <Namepath> [Arguments] Single Step a control method\n");
acpi_os_printf ("Event <F|G> <Value> Generate Acpi_event (Fixed/GPE)\n");
acpi_os_printf ("Execute <Namepath> [Arguments] Execute control method\n");
return;
case 'M':
- acpi_os_printf ("\n_control Method Execution Commands\n\n");
+ acpi_os_printf ("\nControl Method Execution Commands\n\n");
acpi_os_printf ("Arguments (or Args) Display method arguments\n");
acpi_os_printf ("Breakpoint <Aml_offset> Set an AML execution breakpoint\n");
acpi_os_printf ("Call Run to next control method invocation\n");
return;
case 'F':
- acpi_os_printf ("\n_file I/O Commands\n\n");
+ acpi_os_printf ("\nFile I/O Commands\n\n");
acpi_os_printf ("Close Close debug output file\n");
acpi_os_printf ("Open <Output Filename> Open a file for debug output\n");
acpi_os_printf ("Load <Input Filename> Load ACPI table from a file\n");
return;
default:
- acpi_os_printf ("Unrecognized Command Class: %x\n", help_type);
+ acpi_os_printf ("Unrecognized Command Class: %X\n", help_type);
return;
}
}
break;
case CMD_FIND:
- acpi_db_find_name_in_namespace (acpi_gbl_db_args[1]);
+ status = acpi_db_find_name_in_namespace (acpi_gbl_db_args[1]);
break;
case CMD_GO:
acpi_db_display_method_info (op);
break;
+ case CMD_INTEGRITY:
+ acpi_db_check_integrity ();
+ break;
+
case CMD_INTO:
if (op)
{
break;
case CMD_METHODS:
- acpi_db_display_objects ("METHOD", acpi_gbl_db_args[1]);
+ status = acpi_db_display_objects ("METHOD", acpi_gbl_db_args[1]);
break;
case CMD_NAMESPACE:
break;
case CMD_OBJECT:
- acpi_db_display_objects (ACPI_STRUPR (acpi_gbl_db_args[1]), acpi_gbl_db_args[2]);
+ ACPI_STRUPR (acpi_gbl_db_args[1]);
+ status = acpi_db_display_objects (acpi_gbl_db_args[1], acpi_gbl_db_args[2]);
break;
case CMD_OPEN:
break;
case CMD_STATS:
- acpi_db_display_statistics (acpi_gbl_db_args[1]);
+ status = acpi_db_display_statistics (acpi_gbl_db_args[1]);
break;
case CMD_STOP:
- return (AE_AML_ERROR);
+ return (AE_NOT_IMPLEMENTED);
case CMD_TABLES:
acpi_db_display_table_info (acpi_gbl_db_args[1]);
return (AE_CTRL_TERMINATE);
case CMD_NOT_FOUND:
+ default:
acpi_os_printf ("Unknown Command\n");
return (AE_CTRL_TRUE);
}
acpi_db_single_thread (
void)
{
- acpi_status status;
-
acpi_gbl_method_executing = FALSE;
acpi_gbl_step_to_next_call = FALSE;
- status = acpi_db_command_dispatch (acpi_gbl_db_line_buf, NULL, NULL);
+ (void) acpi_db_command_dispatch (acpi_gbl_db_line_buf, NULL, NULL);
}
/* Get the user input line */
- acpi_os_get_line (acpi_gbl_db_line_buf);
-
+ (void) acpi_os_get_line (acpi_gbl_db_line_buf);
/* Check for single or multithreaded debug */
* Only this thread (the original thread) should actually terminate the subsystem,
* because all the semaphores are deleted during termination
*/
- acpi_terminate ();
+ status = acpi_terminate ();
return (status);
}
/*******************************************************************************
*
* Module Name: dbstats - Generation and display of ACPI table statistics
- * $Revision: 55 $
+ * $Revision: 59 $
*
******************************************************************************/
#include <acpi.h>
#include <acdebug.h>
-#include <amlcode.h>
-#include <acparser.h>
#include <acnamesp.h>
#ifdef ENABLE_DEBUGGER
/*
* Statistics subcommands
*/
-ARGUMENT_INFO acpi_db_stat_types [] =
+static ARGUMENT_INFO acpi_db_stat_types [] =
{ {"ALLOCATIONS"},
{"OBJECTS"},
{"MEMORY"},
{NULL} /* Must be null terminated */
};
-#define CMD_ALLOCATIONS 0
-#define CMD_OBJECTS 1
-#define CMD_MEMORY 2
-#define CMD_MISC 3
-#define CMD_TABLES 4
-#define CMD_SIZES 5
-#define CMD_STACK 6
+#define CMD_STAT_ALLOCATIONS 0
+#define CMD_STAT_OBJECTS 1
+#define CMD_STAT_MEMORY 2
+#define CMD_STAT_MISC 3
+#define CMD_STAT_TABLES 4
+#define CMD_STAT_SIZES 5
+#define CMD_STAT_STACK 6
/*******************************************************************************
acpi_db_enumerate_object (obj_desc->thermal_zone.drv_handler);
acpi_db_enumerate_object (obj_desc->thermal_zone.addr_handler);
break;
+
+ default:
+ break;
}
}
*
******************************************************************************/
-acpi_status
+void
acpi_db_count_namespace_objects (
void)
{
acpi_gbl_node_type_count [i] = 0;
}
- acpi_ns_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+ (void) acpi_ns_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
FALSE, acpi_db_classify_one_object, NULL, NULL);
-
- return (AE_OK);
}
#endif
switch (type)
{
#ifndef PARSER_ONLY
- case CMD_ALLOCATIONS:
+ case CMD_STAT_ALLOCATIONS:
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
acpi_ut_dump_allocation_info ();
#endif
break;
#endif
- case CMD_TABLES:
+ case CMD_STAT_TABLES:
acpi_os_printf ("ACPI Table Information:\n\n");
if (acpi_gbl_DSDT)
}
break;
- case CMD_OBJECTS:
+ case CMD_STAT_OBJECTS:
#ifndef PARSER_ONLY
acpi_db_count_namespace_objects ();
- acpi_os_printf ("\n_objects defined in the current namespace:\n\n");
+ acpi_os_printf ("\nObjects defined in the current namespace:\n\n");
acpi_os_printf ("%16.16s % 10.10s % 10.10s\n", "ACPI_TYPE", "NODES", "OBJECTS");
#endif
break;
- case CMD_MEMORY:
+ case CMD_STAT_MEMORY:
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
acpi_os_printf ("\n----Object and Cache Statistics---------------------------------------------\n");
break;
- case CMD_MISC:
+ case CMD_STAT_MISC:
- acpi_os_printf ("\n_miscellaneous Statistics:\n\n");
+ acpi_os_printf ("\nMiscellaneous Statistics:\n\n");
acpi_os_printf ("Calls to Acpi_ps_find:.. ........% 7ld\n", acpi_gbl_ps_find_count);
acpi_os_printf ("Calls to Acpi_ns_lookup:..........% 7ld\n", acpi_gbl_ns_lookup_count);
break;
- case CMD_SIZES:
+ case CMD_STAT_SIZES:
- acpi_os_printf ("\n_internal object sizes:\n\n");
+ acpi_os_printf ("\nInternal object sizes:\n\n");
acpi_os_printf ("Common %3d\n", sizeof (ACPI_OBJECT_COMMON));
acpi_os_printf ("Number %3d\n", sizeof (ACPI_OBJECT_INTEGER));
acpi_os_printf ("\n");
- acpi_os_printf ("Parse_object %3d\n", sizeof (acpi_parse_object));
- acpi_os_printf ("Parse2_object %3d\n", sizeof (acpi_parse2_object));
+ acpi_os_printf ("Parse_object %3d\n", sizeof (ACPI_PARSE_OBJ_COMMON));
+ acpi_os_printf ("Parse_object_named %3d\n", sizeof (ACPI_PARSE_OBJ_NAMED));
+ acpi_os_printf ("Parse_object_asl %3d\n", sizeof (ACPI_PARSE_OBJ_ASL));
acpi_os_printf ("Operand_object %3d\n", sizeof (acpi_operand_object));
acpi_os_printf ("Namespace_node %3d\n", sizeof (acpi_namespace_node));
break;
- case CMD_STACK:
+ case CMD_STAT_STACK:
+#if defined(ACPI_DEBUG)
- size = acpi_gbl_entry_stack_pointer - acpi_gbl_lowest_stack_pointer;
+ size = (u32) (acpi_gbl_entry_stack_pointer - acpi_gbl_lowest_stack_pointer);
- acpi_os_printf ("\n_subsystem Stack Usage:\n\n");
+ acpi_os_printf ("\nSubsystem Stack Usage:\n\n");
acpi_os_printf ("Entry Stack Pointer %X\n", acpi_gbl_entry_stack_pointer);
acpi_os_printf ("Lowest Stack Pointer %X\n", acpi_gbl_lowest_stack_pointer);
acpi_os_printf ("Stack Use %X (%d)\n", size, size);
acpi_os_printf ("Deepest Procedure Nesting %d\n", acpi_gbl_deepest_nesting);
+#endif
+ break;
+
+ default:
break;
}
/*******************************************************************************
*
* Module Name: dbutils - AML debugger utilities
- * $Revision: 52 $
+ * $Revision: 55 $
*
******************************************************************************/
#include "acparser.h"
#include "amlcode.h"
#include "acnamesp.h"
-#include "acparser.h"
-#include "acevents.h"
-#include "acinterp.h"
#include "acdebug.h"
#include "acdispat.h"
u32 address)
{
- acpi_os_printf ("\n_location %X:\n", address);
+ acpi_os_printf ("\nLocation %X:\n", address);
acpi_dbg_level |= ACPI_LV_TABLES;
acpi_ut_dump_buffer (ACPI_TO_POINTER (address), 64, DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
acpi_parse_object *root)
{
acpi_parse_object *op = root;
- acpi_parse2_object *method;
+ acpi_parse_object *method;
acpi_parse_object *search_op;
acpi_parse_object *start_op;
acpi_status status = AE_OK;
acpi_os_printf ("Pass two parse ....\n");
-
while (op) {
- if (op->opcode == AML_METHOD_OP) {
- method = (acpi_parse2_object *) op;
+ if (op->common.aml_opcode == AML_METHOD_OP) {
+ method = op;
+
+ /* Create a new walk state for the parse */
walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT,
NULL, NULL, NULL);
return (AE_NO_MEMORY);
}
+ /* Init the Walk State */
walk_state->parser_state.aml =
- walk_state->parser_state.aml_start = method->data;
+ walk_state->parser_state.aml_start = method->named.data;
walk_state->parser_state.aml_end =
- walk_state->parser_state.pkg_end = method->data + method->length;
+ walk_state->parser_state.pkg_end = method->named.data + method->named.length;
walk_state->parser_state.start_scope = op;
walk_state->descending_callback = acpi_ds_load1_begin_op;
walk_state->ascending_callback = acpi_ds_load1_end_op;
+ /* Perform the AML parse */
status = acpi_ps_parse_aml (walk_state);
-
- base_aml_offset = (method->value.arg)->aml_offset + 1;
- start_op = (method->value.arg)->next;
+ base_aml_offset = (method->common.value.arg)->common.aml_offset + 1;
+ start_op = (method->common.value.arg)->common.next;
search_op = start_op;
while (search_op) {
- search_op->aml_offset += base_aml_offset;
+ search_op->common.aml_offset += base_aml_offset;
search_op = acpi_ps_get_depth_next (start_op, search_op);
}
-
}
- if (op->opcode == AML_REGION_OP) {
+ if (op->common.aml_opcode == AML_REGION_OP) {
/* TBD: [Investigate] this isn't quite the right thing to do! */
/*
*
/*******************************************************************************
*
* Module Name: dbxface - AML Debugger external interfaces
- * $Revision: 55 $
+ * $Revision: 59 $
*
******************************************************************************/
#include "acpi.h"
-#include "acparser.h"
#include "amlcode.h"
-#include "acnamesp.h"
-#include "acparser.h"
-#include "acevents.h"
-#include "acinterp.h"
#include "acdebug.h"
/* Check for single-step breakpoint */
- if (walk_state->method_breakpoint && (walk_state->method_breakpoint <= op->aml_offset)) {
+ if (walk_state->method_breakpoint &&
+ (walk_state->method_breakpoint <= op->common.aml_offset)) {
/* Check if the breakpoint has been reached or passed */
/* Hit the breakpoint, resume single step, reset breakpoint */
- acpi_os_printf ("***Break*** at AML offset %X\n", op->aml_offset);
+ acpi_os_printf ("***Break*** at AML offset %X\n", op->common.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);
+ else if (walk_state->user_breakpoint &&
+ (walk_state->user_breakpoint == op->common.aml_offset)) {
+ acpi_os_printf ("***User_breakpoint*** at AML offset %X\n", op->common.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
*/
- if (op->opcode == AML_INT_NAMEDFIELD_OP) {
+ if (op->common.aml_opcode == AML_INT_NAMEDFIELD_OP) {
return (AE_OK);
}
case AML_CLASS_UNKNOWN:
case AML_CLASS_ARGUMENT: /* constants, literals, etc. do nothing */
return (AE_OK);
+
+ default:
+ /* All other opcodes -- continue */
+ break;
}
/*
*/
original_debug_level = acpi_dbg_level;
acpi_dbg_level &= ~(ACPI_LV_PARSE | ACPI_LV_FUNCTIONS);
- next = op->next;
- op->next = NULL;
+ next = op->common.next;
+ op->common.next = NULL;
display_op = op;
- parent_op = op->parent;
+ parent_op = op->common.parent;
if (parent_op) {
if ((walk_state->control_state) &&
(walk_state->control_state->common.state == ACPI_CONTROL_PREDICATE_EXECUTING)) {
* entire predicate can be displayed.
*/
while (parent_op) {
- if ((parent_op->opcode == AML_IF_OP) ||
- (parent_op->opcode == AML_WHILE_OP)) {
+ if ((parent_op->common.aml_opcode == AML_IF_OP) ||
+ (parent_op->common.aml_opcode == AML_WHILE_OP)) {
display_op = parent_op;
break;
}
- parent_op = parent_op->parent;
+ parent_op = parent_op->common.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)) {
+ if ((parent_op->common.aml_opcode == AML_IF_OP) ||
+ (parent_op->common.aml_opcode == AML_ELSE_OP) ||
+ (parent_op->common.aml_opcode == AML_SCOPE_OP) ||
+ (parent_op->common.aml_opcode == AML_METHOD_OP) ||
+ (parent_op->common.aml_opcode == AML_WHILE_OP)) {
break;
}
display_op = parent_op;
- parent_op = parent_op->parent;
+ parent_op = parent_op->common.parent;
}
}
}
acpi_db_display_op (walk_state, display_op, ACPI_UINT32_MAX);
- if ((op->opcode == AML_IF_OP) ||
- (op->opcode == AML_WHILE_OP)) {
+ if ((op->common.aml_opcode == AML_IF_OP) ||
+ (op->common.aml_opcode == AML_WHILE_OP)) {
if (walk_state->control_state->common.value) {
acpi_os_printf ("Predicate = [True], IF block was executed\n");
}
}
}
- else if (op->opcode == AML_ELSE_OP) {
+ else if (op->common.aml_opcode == AML_ELSE_OP) {
acpi_os_printf ("Predicate = [False], ELSE block was executed\n");
}
/* Restore everything */
- op->next = next;
+ op->common.next = next;
acpi_os_printf ("\n");
acpi_dbg_level = original_debug_level;
}
* Check if this is a method call.
*/
if (acpi_gbl_step_to_next_call) {
- if (op->opcode != AML_INT_METHODCALL_OP) {
+ if (op->common.aml_opcode != AML_INT_METHODCALL_OP) {
/* Not a method call, just keep executing */
return (AE_OK);
* If the next opcode is a method call, we will "step over" it
* by default.
*/
- if (op->opcode == AML_INT_METHODCALL_OP) {
+ if (op->common.aml_opcode == AML_INT_METHODCALL_OP) {
acpi_gbl_cm_single_step = FALSE; /* No more single step while executing called method */
/* Set the breakpoint on/before the call, it will stop execution as soon as we return */
/* Get the user input line */
- acpi_os_get_line (acpi_gbl_db_line_buf);
+ (void) acpi_os_get_line (acpi_gbl_db_line_buf);
}
status = acpi_db_command_dispatch (acpi_gbl_db_line_buf, walk_state, op);
*
******************************************************************************/
-int
+acpi_status
acpi_db_initialize (void)
{
+ acpi_status status;
+
/* Init globals */
acpi_gbl_db_buffer = acpi_os_allocate (ACPI_DEBUG_BUFFER_SIZE);
if (!acpi_gbl_db_buffer) {
- return 0;
+ return (AE_NO_MEMORY);
}
ACPI_MEMSET (acpi_gbl_db_buffer, 0, ACPI_DEBUG_BUFFER_SIZE);
if (acpi_gbl_debugger_configuration & DEBUGGER_MULTI_THREADED) {
/* These were created with one unit, grab it */
- acpi_ut_acquire_mutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
- acpi_ut_acquire_mutex (ACPI_MTX_DEBUG_CMD_READY);
+ status = acpi_ut_acquire_mutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
+ if (ACPI_FAILURE (status)) {
+ acpi_os_printf ("Could not get debugger mutex\n");
+ return (status);
+ }
+ status = acpi_ut_acquire_mutex (ACPI_MTX_DEBUG_CMD_READY);
+ if (ACPI_FAILURE (status)) {
+ acpi_os_printf ("Could not get debugger mutex\n");
+ return (status);
+ }
/* Create the debug execution thread to execute commands */
- acpi_os_queue_for_execution (0, acpi_db_execute_thread, NULL);
+ status = acpi_os_queue_for_execution (0, acpi_db_execute_thread, NULL);
+ if (ACPI_FAILURE (status)) {
+ acpi_os_printf ("Could not start debugger thread\n");
+ return (status);
+ }
}
if (!acpi_gbl_db_opt_verbose) {
acpi_gbl_db_opt_stats = FALSE;
}
- return (0);
+ return (AE_OK);
}
/******************************************************************************
*
* Module Name: dsfield - Dispatcher field routines
- * $Revision: 62 $
+ * $Revision: 65 $
*
*****************************************************************************/
/* Get the Name_string argument */
- if (op->opcode == AML_CREATE_FIELD_OP) {
+ if (op->common.aml_opcode == AML_CREATE_FIELD_OP) {
arg = acpi_ps_get_arg (op, 3);
}
else {
/*
* Enter the Name_string into the namespace
*/
- status = acpi_ns_lookup (walk_state->scope_info, arg->value.string,
+ status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string,
INTERNAL_TYPE_DEF_ANY, ACPI_IMODE_LOAD_PASS1,
flags, walk_state, &(node));
if (ACPI_FAILURE (status)) {
* for now, we will put it in the "op" object that the parser uses, so we
* can get it again at the end of this scope
*/
- op->node = node;
+ op->common.node = node;
/*
* If there is no object attached to the node, this node was just created and
* operands must be evaluated.
*/
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;
+ second_desc->extra.aml_start = op->named.data;
+ second_desc->extra.aml_length = op->named.length;
obj_desc->buffer_field.node = node;
/* Attach constructed field descriptors to parent node */
acpi_parse_object *arg)
{
acpi_status status;
+ acpi_integer position;
ACPI_FUNCTION_TRACE_PTR ("Ds_get_field_names", info);
* 2) Access_as - changes the access mode
* 3) Name - Enters a new named field into the namespace
*/
- switch (arg->opcode) {
+ switch (arg->common.aml_opcode) {
case AML_INT_RESERVEDFIELD_OP:
- if (((acpi_integer) info->field_bit_position + arg->value.size) >
- ACPI_UINT32_MAX) {
+ position = (acpi_integer) info->field_bit_position
+ + (acpi_integer) arg->common.value.size;
+
+ if (position > 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;
+ info->field_bit_position = (u32) position;
break;
* In Field_flags, preserve the flag bits other than the ACCESS_TYPE bits
*/
info->field_flags = (u8) ((info->field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) |
- ((u8) (arg->value.integer32 >> 8)));
+ ((u8) (arg->common.value.integer32 >> 8)));
- info->attribute = (u8) (arg->value.integer32);
+ info->attribute = (u8) (arg->common.value.integer32);
break;
/* Lookup the name */
status = acpi_ns_lookup (walk_state->scope_info,
- (NATIVE_CHAR *) &((acpi_parse2_object *)arg)->name,
+ (NATIVE_CHAR *) &arg->named.name,
info->field_type, ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE,
walk_state, &info->field_node);
if (ACPI_FAILURE (status)) {
}
ACPI_REPORT_ERROR (("Field name [%4.4s] already exists in current scope\n",
- &((acpi_parse2_object *)arg)->name));
+ &arg->named.name));
}
else {
- arg->node = info->field_node;
- info->field_bit_length = arg->value.size;
+ arg->common.node = info->field_node;
+ info->field_bit_length = arg->common.value.size;
/* Create and initialize an object for the new Field Node */
/* Keep track of bit position for the next field */
- if (((acpi_integer) info->field_bit_position + arg->value.size) >
- ACPI_UINT32_MAX) {
+ position = (acpi_integer) info->field_bit_position
+ + (acpi_integer) arg->common.value.size;
+
+ if (position > ACPI_UINT32_MAX) {
ACPI_REPORT_ERROR (("Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n",
&info->field_node->name));
return_ACPI_STATUS (AE_SUPPORT);
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid opcode in field list: %X\n",
- arg->opcode));
- return_ACPI_STATUS (AE_AML_ERROR);
+ arg->common.aml_opcode));
+ return_ACPI_STATUS (AE_AML_BAD_OPCODE);
}
- arg = arg->next;
+ arg = arg->common.next;
}
return_ACPI_STATUS (AE_OK);
acpi_namespace_node *region_node,
acpi_walk_state *walk_state)
{
- acpi_status status = AE_AML_ERROR;
+ acpi_status status;
acpi_parse_object *arg;
ACPI_CREATE_FIELD_INFO info;
/* First arg is the name of the parent Op_region (must already exist) */
- arg = op->value.arg;
+ arg = op->common.value.arg;
if (!region_node) {
- status = acpi_ns_lookup (walk_state->scope_info, arg->value.name,
+ status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.name,
ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT, walk_state, ®ion_node);
if (ACPI_FAILURE (status)) {
/* Second arg is the field flags */
- arg = arg->next;
- info.field_flags = arg->value.integer8;
+ arg = arg->common.next;
+ info.field_flags = arg->common.value.integer8;
info.attribute = 0;
/* Each remaining arg is a Named Field */
info.field_type = INTERNAL_TYPE_REGION_FIELD;
info.region_node = region_node;
- status = acpi_ds_get_field_names (&info, walk_state, arg->next);
+ status = acpi_ds_get_field_names (&info, walk_state, arg->common.next);
return_ACPI_STATUS (status);
}
acpi_parse_object *op,
acpi_walk_state *walk_state)
{
- acpi_status status = AE_AML_ERROR;
+ acpi_status status;
acpi_parse_object *arg = NULL;
acpi_namespace_node *node;
u8 type = 0;
arg = acpi_ps_get_arg (op, 3);
type = INTERNAL_TYPE_INDEX_FIELD;
break;
+
+ default:
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/*
while (arg) {
/* Ignore OFFSET and ACCESSAS terms here */
- if (arg->opcode == AML_INT_NAMEDFIELD_OP) {
+ if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) {
status = acpi_ns_lookup (walk_state->scope_info,
- (NATIVE_CHAR *) &((acpi_parse2_object *)arg)->name,
+ (NATIVE_CHAR *) &arg->named.name,
type, ACPI_IMODE_LOAD_PASS1,
ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND,
walk_state, &node);
}
ACPI_REPORT_ERROR (("Field name [%4.4s] already exists in current scope\n",
- &((acpi_parse2_object *)arg)->name));
+ &arg->named.name));
+
+ /* Name already exists, just ignore this error */
+
+ status = AE_OK;
}
- arg->node = node;
+ arg->common.node = node;
}
/* Move to next field in the list */
- arg = arg->next;
+ arg = arg->common.next;
}
- return_ACPI_STATUS (status);
+ return_ACPI_STATUS (AE_OK);
}
acpi_namespace_node *region_node,
acpi_walk_state *walk_state)
{
- acpi_status status = AE_AML_ERROR;
+ acpi_status status;
acpi_parse_object *arg;
ACPI_CREATE_FIELD_INFO info;
/* First arg is the name of the parent Op_region (must already exist) */
- arg = op->value.arg;
+ arg = op->common.value.arg;
if (!region_node) {
- status = acpi_ns_lookup (walk_state->scope_info, arg->value.name,
+ status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.name,
ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT, walk_state, ®ion_node);
if (ACPI_FAILURE (status)) {
/* Second arg is the Bank Register (must already exist) */
- arg = arg->next;
- status = acpi_ns_lookup (walk_state->scope_info, arg->value.string,
+ arg = arg->common.next;
+ status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string,
INTERNAL_TYPE_BANK_FIELD_DEFN, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT, walk_state, &info.register_node);
if (ACPI_FAILURE (status)) {
/* Third arg is the Bank_value */
- arg = arg->next;
- info.bank_value = arg->value.integer32;
+ arg = arg->common.next;
+ info.bank_value = arg->common.value.integer32;
/* Fourth arg is the field flags */
- arg = arg->next;
- info.field_flags = arg->value.integer8;
+ arg = arg->common.next;
+ info.field_flags = arg->common.value.integer8;
/* Each remaining arg is a Named Field */
info.field_type = INTERNAL_TYPE_BANK_FIELD;
info.region_node = region_node;
- status = acpi_ds_get_field_names (&info, walk_state, arg->next);
+ status = acpi_ds_get_field_names (&info, walk_state, arg->common.next);
return_ACPI_STATUS (status);
}
/* 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,
+ arg = op->common.value.arg;
+ status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string,
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT, walk_state, &info.register_node);
if (ACPI_FAILURE (status)) {
/* Second arg is the data register (must already exist) */
- arg = arg->next;
- status = acpi_ns_lookup (walk_state->scope_info, arg->value.string,
+ arg = arg->common.next;
+ status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string,
INTERNAL_TYPE_INDEX_FIELD_DEFN, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT, walk_state, &info.data_register_node);
if (ACPI_FAILURE (status)) {
/* Next arg is the field flags */
- arg = arg->next;
- info.field_flags = arg->value.integer8;
+ arg = arg->common.next;
+ info.field_flags = arg->common.value.integer8;
/* Each remaining arg is a Named Field */
info.field_type = INTERNAL_TYPE_INDEX_FIELD;
info.region_node = region_node;
- status = acpi_ds_get_field_names (&info, walk_state, arg->next);
+ status = acpi_ds_get_field_names (&info, walk_state, arg->common.next);
return_ACPI_STATUS (status);
}
/******************************************************************************
*
* Module Name: dsmethod - Parser/Interpreter interface - control method parsing
- * $Revision: 81 $
+ * $Revision: 86 $
*
*****************************************************************************/
#include "acdispat.h"
#include "acinterp.h"
#include "acnamesp.h"
-#include "actables.h"
-#include "acdebug.h"
#define _COMPONENT ACPI_DISPATCHER
}
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Parsing [%4.4s] **** Named_obj=%p\n",
- (char *) &((acpi_namespace_node *) obj_handle)->name, obj_handle));
+ ((acpi_namespace_node *) obj_handle)->name.ascii, obj_handle));
/* Extract the method object from the method Node */
/* Init new op with the method name and pointer back to the Node */
acpi_ps_set_name (op, node->name.integer);
- op->node = node;
+ op->common.node = node;
/*
* Get a new Owner_id for objects created by this method. Namespace
/* Create and initialize a new walk state */
- walk_state = acpi_ds_create_walk_state (owner_id,
- NULL, NULL, NULL);
+ walk_state = acpi_ds_create_walk_state (owner_id, NULL, NULL, NULL);
if (!walk_state) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
return_ACPI_STATUS (status);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** [%4.4s] Parsed **** Named_obj=%p Op=%p\n",
- (char *) &((acpi_namespace_node *) obj_handle)->name, obj_handle, op));
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "**** [%4.4s] Parsed **** Named_obj=%p Op=%p\n",
+ ((acpi_namespace_node *) obj_handle)->name.ascii, obj_handle, op));
acpi_ps_delete_parse_tree (op);
return_ACPI_STATUS (status);
this_walk_state->num_operands = 0;
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Starting nested execution, newstate=%p\n",
- next_walk_state));
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "Starting nested execution, newstate=%p\n", next_walk_state));
return_ACPI_STATUS (AE_OK);
/* On error, we must delete the new walk state */
cleanup:
- acpi_ds_terminate_control_method (next_walk_state);
+ (void) acpi_ds_terminate_control_method (next_walk_state);
acpi_ds_delete_walk_state (next_walk_state);
return_ACPI_STATUS (status);
ACPI_FUNCTION_TRACE_PTR ("Ds_terminate_control_method", walk_state);
+ if (!walk_state) {
+ return (AE_BAD_PARAMETER);
+ }
+
/* The current method object was saved in the walk state */
obj_desc = walk_state->method_desc;
/* Signal completion of the execution of this method if necessary */
if (walk_state->method_desc->method.semaphore) {
- acpi_os_signal_semaphore (
- walk_state->method_desc->method.semaphore, 1);
+ status = acpi_os_signal_semaphore (
+ walk_state->method_desc->method.semaphore, 1);
+ if (ACPI_FAILURE (status)) {
+ ACPI_REPORT_ERROR (("Could not signal method semaphore\n"));
+ status = AE_OK;
+
+ /* Ignore error and continue cleanup */
+ }
}
/* Decrement the thread count on the method parse tree */
/*******************************************************************************
*
* Module Name: dsmthdat - control method arguments and local variables
- * $Revision: 59 $
+ * $Revision: 61 $
*
******************************************************************************/
#include "acpi.h"
-#include "acparser.h"
#include "acdispat.h"
-#include "acinterp.h"
#include "amlcode.h"
#include "acnamesp.h"
*
******************************************************************************/
-acpi_status
+void
acpi_ds_method_data_init (
acpi_walk_state *walk_state)
{
walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL;
}
- return_ACPI_STATUS (AE_OK);
+ return_VOID;
}
*
* PARAMETERS: Walk_state - Current walk state object
*
- * RETURN: Status
+ * RETURN: None
*
* DESCRIPTION: Delete method locals and arguments. Arguments are only
* deleted if this method was called from another method.
*
******************************************************************************/
-acpi_status
+void
acpi_ds_method_data_delete_all (
acpi_walk_state *walk_state)
{
/* Detach object (if present) and remove a reference */
acpi_ns_detach_object (&walk_state->local_variables[index]);
- }
+ }
}
/* Detach the arguments */
}
}
- return_ACPI_STATUS (AE_OK);
+ return_VOID;
}
index, node));
return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL);
+
+ default:
+ return_ACPI_STATUS (AE_AML_INTERNAL);
}
}
* Index - Which local_var or argument to delete
* Walk_state - Current walk state object
*
- * RETURN: Status
+ * RETURN: None
*
* DESCRIPTION: Delete the entry at Opcode:Index on the method stack. Inserts
* a null into the stack slot after the object is deleted.
*
******************************************************************************/
-acpi_status
+void
acpi_ds_method_data_delete_value (
u16 opcode,
u32 index,
status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ return_VOID;
}
/* Get the associated object */
node->object = NULL;
if ((object) &&
- (ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_INTERNAL)) {
+ (ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_OPERAND)) {
/*
* There is a valid object.
* Decrement the reference count by one to balance the
acpi_ut_remove_reference (object);
}
- return_ACPI_STATUS (AE_OK);
+ return_VOID;
}
/******************************************************************************
*
* Module Name: dsobject - Dispatcher object management routines
- * $Revision: 91 $
+ * $Revision: 99 $
*
*****************************************************************************/
#include "acparser.h"
#include "amlcode.h"
#include "acdispat.h"
-#include "acinterp.h"
#include "acnamesp.h"
#define _COMPONENT ACPI_DISPATCHER
acpi_object_type type;
acpi_status status;
acpi_init_walk_info *info = (acpi_init_walk_info *) context;
- u8 table_revision;
ACPI_FUNCTION_NAME ("Ds_init_one_object");
- info->object_count++;
- table_revision = info->table_desc->pointer->revision;
-
/*
* We are only interested in objects owned by the table that
* was just loaded
return (AE_OK);
}
+ info->object_count++;
+
/* And even then, we are only interested in a few object types */
type = acpi_ns_get_type (obj_handle);
switch (type) {
case ACPI_TYPE_REGION:
- acpi_ds_initialize_region (obj_handle);
+ status = acpi_ds_initialize_region (obj_handle);
+ if (ACPI_FAILURE (status)) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Region %p [%4.4s] - Init failure, %s\n",
+ obj_handle, ((acpi_namespace_node *) obj_handle)->name.ascii,
+ acpi_format_exception (status)));
+ }
info->op_region_count++;
break;
/*
* Set the execution data width (32 or 64) based upon the
* revision number of the parent ACPI table.
+ * TBD: This is really for possible future support of integer width
+ * on a per-table basis. Currently, we just use a global for the width.
*/
- if (table_revision == 1) {
- ((acpi_namespace_node *)obj_handle)->flags |= ANOBJ_DATA_WIDTH_32;
+ if (info->table_desc->pointer->revision == 1) {
+ ((acpi_namespace_node *) obj_handle)->flags |= ANOBJ_DATA_WIDTH_32;
}
/*
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, ((acpi_namespace_node *) obj_handle)->name.ascii,
acpi_format_exception (status)));
/* This parse failed, but we will continue parsing more methods */
acpi_ns_delete_namespace_by_owner (((acpi_namespace_node *) obj_handle)->object->method.owning_id);
break;
+
+ case ACPI_TYPE_DEVICE:
+
+ info->device_count++;
+ break;
+
+
default:
break;
}
"**** Starting initialization of namespace objects ****\n"));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "Parsing Methods:"));
-
info.method_count = 0;
info.op_region_count = 0;
info.object_count = 0;
+ info.device_count = 0;
info.table_desc = table_desc;
/* Walk entire namespace from the supplied root */
status = acpi_walk_namespace (ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX,
acpi_ds_init_one_object, &info, NULL);
if (ACPI_FAILURE (status)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Walk_namespace failed! %x\n", status));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Walk_namespace failed, %s\n",
+ acpi_format_exception (status)));
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
- "\n%d Control Methods found and parsed (%d nodes total)\n",
- info.method_count, info.object_count));
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "%d Control Methods found\n", info.method_count));
+ "\nTable [%4.4s] - %hd Objects with %hd Devices %hd Methods %hd Regions\n",
+ table_desc->pointer->signature, info.object_count,
+ info.device_count, info.method_count, info.op_region_count));
+
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "%d Op Regions found\n", info.op_region_count));
+ "%hd Methods, %hd Regions\n", info.method_count, info.op_region_count));
return_ACPI_STATUS (AE_OK);
}
* Defer evaluation of Buffer Term_arg operand
*/
obj_desc->buffer.node = (acpi_namespace_node *) walk_state->operands[0];
- obj_desc->buffer.aml_start = ((acpi_parse2_object *) op)->data;
- obj_desc->buffer.aml_length = ((acpi_parse2_object *) op)->length;
+ obj_desc->buffer.aml_start = op->named.data;
+ obj_desc->buffer.aml_length = op->named.length;
break;
* Defer evaluation of Package Term_arg operand
*/
obj_desc->package.node = (acpi_namespace_node *) walk_state->operands[0];
- obj_desc->package.aml_start = ((acpi_parse2_object *) op)->data;
- obj_desc->package.aml_length = ((acpi_parse2_object *) op)->length;
+ obj_desc->package.aml_start = op->named.data;
+ obj_desc->package.aml_length = op->named.length;
break;
case ACPI_TYPE_INTEGER:
- obj_desc->integer.value = op->value.integer;
+ obj_desc->integer.value = op->common.value.integer;
break;
case ACPI_TYPE_STRING:
- obj_desc->string.pointer = op->value.string;
- obj_desc->string.length = ACPI_STRLEN (op->value.string);
+ obj_desc->string.pointer = op->common.value.string;
+ obj_desc->string.length = ACPI_STRLEN (op->common.value.string);
/*
* The string is contained in the ACPI table, don't ever try
default: /* Constants, Literals, etc.. */
- if (op->opcode == AML_INT_NAMEPATH_OP) {
+ if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
/* Node was saved in Op */
- obj_desc->reference.node = op->node;
+ obj_desc->reference.node = op->common.node;
}
obj_desc->reference.opcode = opcode;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unimplemented data type: %x\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unimplemented data type: %X\n",
obj_desc->common.type));
break;
ACPI_FUNCTION_TRACE ("Ds_build_internal_object");
- if (op->opcode == AML_INT_NAMEPATH_OP) {
+ if (op->common.aml_opcode == AML_INT_NAMEPATH_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,
+ if (!op->common.node) {
+ status = acpi_ns_lookup (walk_state->scope_info, op->common.value.string,
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL,
- (acpi_namespace_node **) &(op->node));
+ (acpi_namespace_node **) &(op->common.node));
if (ACPI_FAILURE (status)) {
if (status == AE_NOT_FOUND) {
name = NULL;
- acpi_ns_externalize_name (ACPI_UINT32_MAX, op->value.string, NULL, &name);
-
- if (name) {
+ status = acpi_ns_externalize_name (ACPI_UINT32_MAX, op->common.value.string, NULL, &name);
+ if (ACPI_SUCCESS (status)) {
ACPI_REPORT_WARNING (("Reference %s at AML %X not found\n",
- name, op->aml_offset));
+ name, op->common.aml_offset));
ACPI_MEM_FREE (name);
}
else {
ACPI_REPORT_WARNING (("Reference %s at AML %X not found\n",
- op->value.string, op->aml_offset));
+ op->common.value.string, op->common.aml_offset));
}
*obj_desc_ptr = NULL;
/* Create and init the internal ACPI object */
- obj_desc = acpi_ut_create_internal_object ((acpi_ps_get_opcode_info (op->opcode))->object_type);
+ obj_desc = acpi_ut_create_internal_object ((acpi_ps_get_opcode_info (op->common.aml_opcode))->object_type);
if (!obj_desc) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
- status = acpi_ds_init_object_from_op (walk_state, op, op->opcode, &obj_desc);
+ status = acpi_ds_init_object_from_op (walk_state, op, op->common.aml_opcode, &obj_desc);
if (ACPI_FAILURE (status)) {
acpi_ut_remove_reference (obj_desc);
return_ACPI_STATUS (status);
{
acpi_parse_object *arg;
acpi_operand_object *obj_desc;
- acpi_parse2_object *byte_list;
+ acpi_parse_object *byte_list;
u32 byte_list_length = 0;
* individual bytes or a string initializer. In either case, a
* Byte_list appears in the AML.
*/
- arg = op->value.arg; /* skip first arg */
+ arg = op->common.value.arg; /* skip first arg */
- byte_list = (acpi_parse2_object *) arg->next;
+ byte_list = arg->named.next;
if (byte_list) {
- if (byte_list->opcode != AML_INT_BYTELIST_OP) {
+ if (byte_list->common.aml_opcode != AML_INT_BYTELIST_OP) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Expecting bytelist, got AML opcode %X in op %p\n",
- byte_list->opcode, byte_list));
+ byte_list->common.aml_opcode, byte_list));
acpi_ut_remove_reference (obj_desc);
return (AE_TYPE);
}
- byte_list_length = byte_list->value.integer32;
+ byte_list_length = byte_list->common.value.integer32;
}
/*
/* Initialize buffer from the Byte_list (if present) */
if (byte_list) {
- ACPI_MEMCPY (obj_desc->buffer.pointer, byte_list->data,
+ ACPI_MEMCPY (obj_desc->buffer.pointer, byte_list->named.data,
byte_list_length);
}
obj_desc->buffer.flags |= AOPOBJ_DATA_VALID;
- op->node = (acpi_namespace_node *) obj_desc;
+ op->common.node = (acpi_namespace_node *) obj_desc;
return_ACPI_STATUS (AE_OK);
}
/* Find the parent of a possibly nested package */
-
- parent = op->parent;
- while ((parent->opcode == AML_PACKAGE_OP) ||
- (parent->opcode == AML_VAR_PACKAGE_OP)) {
- parent = parent->parent;
+ parent = op->common.parent;
+ while ((parent->common.aml_opcode == AML_PACKAGE_OP) ||
+ (parent->common.aml_opcode == AML_VAR_PACKAGE_OP)) {
+ parent = parent->common.parent;
}
obj_desc = *obj_desc_ptr;
return_ACPI_STATUS (AE_NO_MEMORY);
}
- obj_desc->package.node = parent->node;
+ obj_desc->package.node = parent->common.node;
}
obj_desc->package.count = package_length;
/* Count the number of items in the package list */
package_list_length = 0;
- arg = op->value.arg;
- arg = arg->next;
+ arg = op->common.value.arg;
+ arg = arg->common.next;
while (arg) {
package_list_length++;
- arg = arg->next;
+ arg = arg->common.next;
}
/*
* that the list is always null terminated.
*/
obj_desc->package.elements = ACPI_MEM_CALLOCATE (
- (obj_desc->package.count + 1) * sizeof (void *));
+ ((ACPI_SIZE) obj_desc->package.count + 1) * sizeof (void *));
if (!obj_desc->package.elements) {
acpi_ut_delete_object_desc (obj_desc);
* Now init the elements of the package
*/
i = 0;
- arg = op->value.arg;
- arg = arg->next;
+ arg = op->common.value.arg;
+ arg = arg->common.next;
while (arg) {
- if (arg->opcode == AML_INT_RETURN_VALUE_OP) {
+ if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) {
/* Object (package or buffer) is already built */
- obj_desc->package.elements[i] = (acpi_operand_object *) arg->node;
+ obj_desc->package.elements[i] = ACPI_CAST_PTR (acpi_operand_object, arg->common.node);
}
else {
status = acpi_ds_build_internal_object (walk_state, arg,
}
i++;
- arg = arg->next;
+ arg = arg->common.next;
}
obj_desc->package.flags |= AOPOBJ_DATA_VALID;
- op->node = (acpi_namespace_node *) obj_desc;
+ op->common.node = (acpi_namespace_node *) obj_desc;
return_ACPI_STATUS (status);
}
return_ACPI_STATUS (AE_OK);
}
- if (!op->value.arg) {
+ if (!op->common.value.arg) {
/* No arguments, there is nothing to do */
return_ACPI_STATUS (AE_OK);
/* Build an internal object for the argument(s) */
- status = acpi_ds_build_internal_object (walk_state, op->value.arg, &obj_desc);
+ status = acpi_ds_build_internal_object (walk_state, op->common.value.arg, &obj_desc);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
*
* Module Name: dsopcode - Dispatcher Op Region support and handling of
* "control" opcodes
- * $Revision: 74 $
+ * $Revision: 79 $
*
*****************************************************************************/
#include "acinterp.h"
#include "acnamesp.h"
#include "acevents.h"
-#include "actables.h"
#define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsopcode")
* FUNCTION: Acpi_ds_execute_arguments
*
* PARAMETERS: Node - Parent NS node
- * Extra_desc - Has AML pointer and length
+ * Aml_length - Length of executable AML
+ * Aml_start - Pointer to the AML
*
* RETURN: Status.
*
/* Save the Node for use in Acpi_ps_parse_aml */
- op->node = scope_node;
+ op->common.node = scope_node;
/* Create and initialize a new parser state */
/* Get and init the Op created above */
- arg = op->value.arg;
- op->node = node;
- arg->node = node;
+ arg = op->common.value.arg;
+ op->common.node = node;
+ arg->common.node = node;
acpi_ps_delete_parse_tree (op);
/* Evaluate the address and length arguments for the Buffer Field */
return_ACPI_STATUS (AE_NO_MEMORY);
}
- op->node = scope_node;
+ op->common.node = scope_node;
/* Create and initialize a new parser state */
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));
+ node->name.ascii));
/* Execute the AML code for the Term_arg arguments */
ACPI_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));
+ node->name.ascii, extra_desc->extra.aml_start));
status = acpi_ds_execute_arguments (node, acpi_ns_get_parent_node (node),
*
* RETURN: Status
*
- * DESCRIPTION:
+ * DESCRIPTION: Front end to Ev_initialize_region
*
****************************************************************************/
/*****************************************************************************
*
- * FUNCTION: Acpi_ds_eval_buffer_field_operands
+ * FUNCTION: Acpi_ds_init_buffer_field
*
- * PARAMETERS: Op - A valid Buffer_field Op object
+ * PARAMETERS: Aml_opcode - Create_xxx_field
+ * Obj_desc - Buffer_field object
+ * Buffer_desc - Host Buffer
+ * Offset_desc - Offset into buffer
+ * Length - Length of field (CREATE_FIELD_OP only)
+ * Result - Where to store the result
*
* RETURN: Status
*
- * DESCRIPTION: Get Buffer_field Buffer and Index
- * Called from Acpi_ds_exec_end_op during Buffer_field parse tree walk
+ * DESCRIPTION: Perform actual initialization of a buffer field
*
****************************************************************************/
acpi_status
-acpi_ds_eval_buffer_field_operands (
- acpi_walk_state *walk_state,
- acpi_parse_object *op)
+acpi_ds_init_buffer_field (
+ u16 aml_opcode,
+ acpi_operand_object *obj_desc,
+ acpi_operand_object *buffer_desc,
+ acpi_operand_object *offset_desc,
+ acpi_operand_object *length_desc,
+ acpi_operand_object *result_desc)
{
- acpi_status status;
- acpi_operand_object *obj_desc;
- acpi_namespace_node *node;
- acpi_parse_object *next_op;
u32 offset;
u32 bit_offset;
u32 bit_count;
u8 field_flags;
- acpi_operand_object *res_desc = NULL;
- acpi_operand_object *cnt_desc = NULL;
- acpi_operand_object *off_desc = NULL;
- acpi_operand_object *src_desc = NULL;
-
-
- ACPI_FUNCTION_TRACE_PTR ("Ds_eval_buffer_field_operands", op);
-
-
- /*
- * This is where we evaluate the address and length fields of the
- * Create_xxx_field declaration
- */
- node = op->node;
-
- /* Next_op points to the op that holds the Buffer */
+ acpi_status status;
- next_op = op->value.arg;
- /* Evaluate/create the address and length operands */
+ ACPI_FUNCTION_TRACE_PTR ("Ds_init_buffer_field", obj_desc);
- status = acpi_ds_create_operands (walk_state, next_op);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
- obj_desc = acpi_ns_get_attached_object (node);
- if (!obj_desc) {
- return_ACPI_STATUS (AE_NOT_EXIST);
- }
-
- /* Resolve the operands */
-
- 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");
+ /* Host object must be a Buffer */
- if (ACPI_FAILURE (status)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) bad operand(s) (%X)\n",
- acpi_ps_get_opcode_name (op->opcode), status));
+ if (buffer_desc->common.type != ACPI_TYPE_BUFFER) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Target of Create Field is not a Buffer object - %s\n",
+ acpi_ut_get_type_name (buffer_desc->common.type)));
+ status = AE_AML_OPERAND_TYPE;
goto cleanup;
}
- /* Get the operands */
-
- if (AML_CREATE_FIELD_OP == op->opcode) {
- res_desc = walk_state->operands[3];
- cnt_desc = walk_state->operands[2];
- }
- else {
- res_desc = walk_state->operands[2];
- }
-
- off_desc = walk_state->operands[1];
- src_desc = walk_state->operands[0];
- offset = (u32) off_desc->integer.value;
-
/*
- * If Res_desc is a Name, it will be a direct name pointer after
- * Acpi_ex_resolve_operands()
+ * The last parameter to all of these opcodes (Result_desc) started
+ * out as a Name_string, and should therefore now be a NS node
+ * after resolution in Acpi_ex_resolve_operands().
*/
- if (ACPI_GET_DESCRIPTOR_TYPE (res_desc) != ACPI_DESC_TYPE_NAMED) {
+ if (ACPI_GET_DESCRIPTOR_TYPE (result_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)));
+ acpi_ps_get_opcode_name (aml_opcode)));
status = AE_AML_OPERAND_TYPE;
goto cleanup;
}
+ offset = (u32) offset_desc->integer.value;
+
/*
* Setup the Bit offsets and counts, according to the opcode
*/
- switch (op->opcode) {
+ switch (aml_opcode) {
case AML_CREATE_FIELD_OP:
/* Offset is in bits, count is in bits */
- bit_offset = offset;
- bit_count = (u32) cnt_desc->integer.value;
+ bit_offset = offset;
+ bit_count = (u32) length_desc->integer.value;
field_flags = AML_FIELD_ACCESS_BYTE;
break;
/* Offset is in bits, Field is one bit */
- bit_offset = offset;
- bit_count = 1;
+ bit_offset = offset;
+ bit_count = 1;
field_flags = AML_FIELD_ACCESS_BYTE;
break;
/* Offset is in bytes, field is one byte */
- bit_offset = 8 * offset;
- bit_count = 8;
+ bit_offset = 8 * offset;
+ bit_count = 8;
field_flags = AML_FIELD_ACCESS_BYTE;
break;
/* Offset is in bytes, field is one word */
- bit_offset = 8 * offset;
- bit_count = 16;
+ bit_offset = 8 * offset;
+ bit_count = 16;
field_flags = AML_FIELD_ACCESS_WORD;
break;
/* Offset is in bytes, field is one dword */
- bit_offset = 8 * offset;
- bit_count = 32;
+ bit_offset = 8 * offset;
+ bit_count = 32;
field_flags = AML_FIELD_ACCESS_DWORD;
break;
/* Offset is in bytes, field is one qword */
- bit_offset = 8 * offset;
- bit_count = 64;
+ bit_offset = 8 * offset;
+ bit_count = 64;
field_flags = AML_FIELD_ACCESS_QWORD;
break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Internal error - unknown field creation opcode %02x\n",
- op->opcode));
+ "Unknown field creation opcode %02x\n",
+ aml_opcode));
status = AE_AML_BAD_OPCODE;
goto cleanup;
}
+
+ /* Entire field must fit within the current length of the buffer */
+
+ if ((bit_offset + bit_count) >
+ (8 * (u32) buffer_desc->buffer.length)) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Field size %d exceeds Buffer size %d (bits)\n",
+ bit_offset + bit_count, 8 * (u32) buffer_desc->buffer.length));
+ status = AE_AML_BUFFER_LIMIT;
+ goto cleanup;
+ }
+
/*
- * Setup field according to the object type
+ * 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)
*/
- switch (src_desc->common.type) {
-
- /* Source_buff := Term_arg=>Buffer */
+ status = acpi_ex_prep_common_field_object (obj_desc, field_flags, 0,
+ bit_offset, bit_count);
+ if (ACPI_FAILURE (status)) {
+ goto cleanup;
+ }
- case ACPI_TYPE_BUFFER:
+ obj_desc->buffer_field.buffer_obj = buffer_desc;
- if ((bit_offset + bit_count) >
- (8 * (u32) src_desc->buffer.length)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Field size %d exceeds Buffer size %d (bits)\n",
- bit_offset + bit_count, 8 * (u32) src_desc->buffer.length));
- status = AE_AML_BUFFER_LIMIT;
- goto cleanup;
- }
+ /* Reference count for Buffer_desc inherits Obj_desc count */
- /*
- * 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, 0,
- bit_offset, bit_count);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
+ buffer_desc->common.reference_count = (u16) (buffer_desc->common.reference_count +
+ obj_desc->common.reference_count);
- obj_desc->buffer_field.buffer_obj = src_desc;
- /* Reference count for Src_desc inherits Obj_desc count */
+cleanup:
- src_desc->common.reference_count = (u16) (src_desc->common.reference_count +
- obj_desc->common.reference_count);
- break;
+ /* Always delete the operands */
+ acpi_ut_remove_reference (offset_desc);
+ acpi_ut_remove_reference (buffer_desc);
- /* Improper object type */
+ if (aml_opcode == AML_CREATE_FIELD_OP) {
+ acpi_ut_remove_reference (length_desc);
+ }
- default:
+ /* On failure, delete the result descriptor */
- 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",
- acpi_ut_get_type_name (src_desc->common.type)));
- }
+ if (ACPI_FAILURE (status)) {
+ acpi_ut_remove_reference (result_desc); /* Result descriptor */
+ }
+ else {
+ /* Now the address and length are valid for this Buffer_field */
- status = AE_AML_OPERAND_TYPE;
- goto cleanup;
+ obj_desc->buffer_field.flags |= AOPOBJ_DATA_VALID;
}
+ return_ACPI_STATUS (status);
+}
- if (AML_CREATE_FIELD_OP == op->opcode) {
- /* Delete object descriptor unique to Create_field */
- acpi_ut_remove_reference (cnt_desc);
- cnt_desc = NULL;
- }
+/*****************************************************************************
+ *
+ * FUNCTION: Acpi_ds_eval_buffer_field_operands
+ *
+ * PARAMETERS: Walk_state - Current walk
+ * Op - A valid Buffer_field Op object
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Get Buffer_field Buffer and Index
+ * Called from Acpi_ds_exec_end_op during Buffer_field parse tree walk
+ *
+ ****************************************************************************/
+acpi_status
+acpi_ds_eval_buffer_field_operands (
+ acpi_walk_state *walk_state,
+ acpi_parse_object *op)
+{
+ acpi_status status;
+ acpi_operand_object *obj_desc;
+ acpi_namespace_node *node;
+ acpi_parse_object *next_op;
-cleanup:
- /* Always delete the operands */
+ ACPI_FUNCTION_TRACE_PTR ("Ds_eval_buffer_field_operands", op);
+
+
+ /*
+ * This is where we evaluate the address and length fields of the
+ * Create_xxx_field declaration
+ */
+ node = op->common.node;
+
+ /* Next_op points to the op that holds the Buffer */
- acpi_ut_remove_reference (off_desc);
- acpi_ut_remove_reference (src_desc);
+ next_op = op->common.value.arg;
+
+ /* Evaluate/create the address and length operands */
+
+ status = acpi_ds_create_operands (walk_state, next_op);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
- if (AML_CREATE_FIELD_OP == op->opcode) {
- acpi_ut_remove_reference (cnt_desc);
+ obj_desc = acpi_ns_get_attached_object (node);
+ if (!obj_desc) {
+ return_ACPI_STATUS (AE_NOT_EXIST);
}
- /* On failure, delete the result descriptor */
+ /* Resolve the operands */
+
+ status = acpi_ex_resolve_operands (op->common.aml_opcode,
+ ACPI_WALK_OPERANDS, walk_state);
+
+ ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
+ acpi_ps_get_opcode_name (op->common.aml_opcode),
+ walk_state->num_operands, "after Acpi_ex_resolve_operands");
if (ACPI_FAILURE (status)) {
- acpi_ut_remove_reference (res_desc); /* Result descriptor */
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) bad operand(s) (%X)\n",
+ acpi_ps_get_opcode_name (op->common.aml_opcode), status));
+
+ return_ACPI_STATUS (status);
+ }
+
+ /* Initialize the Buffer Field */
+
+ if (op->common.aml_opcode == AML_CREATE_FIELD_OP) {
+ /* NOTE: Slightly different operands for this opcode */
+
+ status = acpi_ds_init_buffer_field (op->common.aml_opcode, obj_desc,
+ walk_state->operands[0], walk_state->operands[1],
+ walk_state->operands[2], walk_state->operands[3]);
}
else {
- /* Now the address and length are valid for this Buffer_field */
+ /* All other, Create_xxx_field opcodes */
- obj_desc->buffer_field.flags |= AOPOBJ_DATA_VALID;
+ status = acpi_ds_init_buffer_field (op->common.aml_opcode, obj_desc,
+ walk_state->operands[0], walk_state->operands[1],
+ NULL, walk_state->operands[2]);
}
return_ACPI_STATUS (status);
*
* FUNCTION: Acpi_ds_eval_region_operands
*
- * PARAMETERS: Op - A valid region Op object
+ * PARAMETERS: Walk_state - Current walk
+ * Op - A valid region Op object
*
* RETURN: Status
*
/*
* This is where we evaluate the address and length fields of the Op_region declaration
*/
- node = op->node;
+ node = op->common.node;
/* Next_op points to the op that holds the Space_iD */
- next_op = op->value.arg;
+ next_op = op->common.value.arg;
/* Next_op points to address op */
- next_op = next_op->next;
+ next_op = next_op->common.next;
/* Evaluate/create the address and length operands */
/* Resolve the length and address operands to numbers */
- status = acpi_ex_resolve_operands (op->opcode, ACPI_WALK_OPERANDS, walk_state);
+ status = acpi_ex_resolve_operands (op->common.aml_opcode, ACPI_WALK_OPERANDS, walk_state);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
- acpi_ps_get_opcode_name (op->opcode),
+ acpi_ps_get_opcode_name (op->common.aml_opcode),
1, "after Acpi_ex_resolve_operands");
obj_desc = acpi_ns_get_attached_object (node);
*
* FUNCTION: Acpi_ds_eval_data_object_operands
*
- * PARAMETERS: Op - A valid Data_object Op object
+ * PARAMETERS: Walk_state - Current walk
+ * Op - A valid Data_object Op object
+ * Obj_desc - Data_object
*
* RETURN: Status
*
/* The first operand (for all of these data objects) is the length */
- status = acpi_ds_create_operand (walk_state, op->value.arg, 1);
+ status = acpi_ds_create_operand (walk_state, op->common.value.arg, 1);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/* Cleanup for length operand */
- acpi_ds_obj_stack_pop (1, walk_state);
+ status = acpi_ds_obj_stack_pop (1, walk_state);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+
acpi_ut_remove_reference (arg_desc);
/*
* Create the actual data object
*/
- switch (op->opcode) {
+ switch (op->common.aml_opcode) {
case AML_BUFFER_OP:
status = acpi_ds_build_internal_buffer_obj (walk_state, op, length, &obj_desc);
* in this case, the return object will be stored in the parse tree
* for the package.
*/
- if ((!op->parent) ||
- ((op->parent->opcode != AML_PACKAGE_OP) &&
- (op->parent->opcode != AML_VAR_PACKAGE_OP) &&
- (op->parent->opcode != AML_NAME_OP))) {
+ if ((!op->common.parent) ||
+ ((op->common.parent->common.aml_opcode != AML_PACKAGE_OP) &&
+ (op->common.parent->common.aml_opcode != AML_VAR_PACKAGE_OP) &&
+ (op->common.parent->common.aml_opcode != AML_NAME_OP))) {
walk_state->result_obj = obj_desc;
}
}
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", op,
- op->opcode, walk_state));
+ op->common.aml_opcode, walk_state));
- switch (op->opcode) {
+ switch (op->common.aml_opcode) {
case AML_IF_OP:
case AML_WHILE_OP:
*/
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;
+ control_state->control.opcode = op->common.aml_opcode;
/* Push the control state on this walk's control stack */
ACPI_FUNCTION_NAME ("Ds_exec_end_control_op");
- switch (op->opcode) {
+ switch (op->common.aml_opcode) {
case AML_IF_OP:
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[IF_OP] Op=%p\n", op));
case AML_RETURN_OP:
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "[RETURN_OP] Op=%p Arg=%p\n",op, op->value.arg));
+ "[RETURN_OP] Op=%p Arg=%p\n",op, op->common.value.arg));
/*
* One optional operand -- the return value
* It can be either an immediate operand or a result that
* has been bubbled up the tree
*/
- if (op->value.arg) {
+ if (op->common.value.arg) {
/* Return statement has an immediate operand */
- status = acpi_ds_create_operands (walk_state, op->value.arg);
+ status = acpi_ds_create_operands (walk_state, op->common.value.arg);
if (ACPI_FAILURE (status)) {
return (status);
}
*
* Allow references created by the Index operator to return unchanged.
*/
- if ((ACPI_GET_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_OPERAND) &&
((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);
/* Call up to the OS service layer to handle this */
- acpi_os_signal (ACPI_SIGNAL_BREAKPOINT, "Executed AML Breakpoint opcode");
+ status = acpi_os_signal (ACPI_SIGNAL_BREAKPOINT, "Executed AML Breakpoint opcode");
/* If and when it returns, all done. */
/* Return status depending on opcode */
- if (op->opcode == AML_BREAK_OP) {
+ if (op->common.aml_opcode == AML_BREAK_OP) {
status = AE_CTRL_BREAK;
}
else {
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown control opcode=%X Op=%p\n",
- op->opcode, op));
+ op->common.aml_opcode, op));
status = AE_AML_BAD_OPCODE;
break;
/*******************************************************************************
*
* Module Name: dsutils - Dispatcher utilities
- * $Revision: 89 $
+ * $Revision: 92 $
*
******************************************************************************/
* method is parsed separately) However, a method that is
* invoked from another method has a parent.
*/
- if (!op->parent) {
+ if (!op->common.parent) {
return_VALUE (FALSE);
}
/*
* Get info on the parent. The root Op is AML_SCOPE
*/
- parent_info = acpi_ps_get_opcode_info (op->parent->opcode);
+ parent_info = acpi_ps_get_opcode_info (op->common.parent->common.aml_opcode);
if (parent_info->class == AML_CLASS_UNKNOWN) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown parent opcode. Op=%p\n", op));
return_VALUE (FALSE);
switch (parent_info->class) {
case AML_CLASS_CONTROL:
- switch (op->parent->opcode) {
+ switch (op->common.parent->common.aml_opcode) {
case AML_RETURN_OP:
/* Never delete the return value associated with a return opcode */
(walk_state->control_state->control.predicate_op == op)) {
goto result_used;
}
+ break;
+
+ default:
+ /* Ignore other control opcodes */
+ break;
}
/* The general control opcode returns no result */
case AML_CLASS_NAMED_OBJECT:
- if ((op->parent->opcode == AML_REGION_OP) ||
- (op->parent->opcode == AML_DATA_REGION_OP) ||
- (op->parent->opcode == AML_PACKAGE_OP) ||
- (op->parent->opcode == AML_VAR_PACKAGE_OP) ||
- (op->parent->opcode == AML_BUFFER_OP) ||
- (op->parent->opcode == AML_INT_EVAL_SUBTREE_OP)) {
+ if ((op->common.parent->common.aml_opcode == AML_REGION_OP) ||
+ (op->common.parent->common.aml_opcode == AML_DATA_REGION_OP) ||
+ (op->common.parent->common.aml_opcode == AML_PACKAGE_OP) ||
+ (op->common.parent->common.aml_opcode == AML_VAR_PACKAGE_OP) ||
+ (op->common.parent->common.aml_opcode == AML_BUFFER_OP) ||
+ (op->common.parent->common.aml_opcode == AML_INT_EVAL_SUBTREE_OP)) {
/*
* These opcodes allow Term_arg(s) as operands and therefore
* the operands can be method calls. The result is 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));
+ acpi_ps_get_opcode_name (op->common.aml_opcode),
+ acpi_ps_get_opcode_name (op->common.parent->common.aml_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));
+ acpi_ps_get_opcode_name (op->common.aml_opcode),
+ acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op));
return_VALUE (FALSE);
u32 arg_index)
{
acpi_status status = AE_OK;
+ acpi_status status2;
NATIVE_CHAR *name_string;
u32 name_length;
acpi_operand_object *obj_desc;
/* A valid name must be looked up in the namespace */
- if ((arg->opcode == AML_INT_NAMEPATH_OP) &&
- (arg->value.string)) {
+ if ((arg->common.aml_opcode == AML_INT_NAMEPATH_OP) &&
+ (arg->common.value.string)) {
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Getting a name: Arg=%p\n", arg));
/* Get the entire name string from the AML stream */
- status = acpi_ex_get_name_string (ACPI_TYPE_ANY, arg->value.buffer,
+ status = acpi_ex_get_name_string (ACPI_TYPE_ANY, arg->common.value.buffer,
&name_string, &name_length);
if (ACPI_FAILURE (status)) {
* IMODE_EXECUTE) in order to support the creation of
* namespace objects during the execution of control methods.
*/
- parent_op = arg->parent;
- op_info = acpi_ps_get_opcode_info (parent_op->opcode);
+ parent_op = arg->common.parent;
+ op_info = acpi_ps_get_opcode_info (parent_op->common.aml_opcode);
if ((op_info->flags & AML_NSNODE) &&
- (parent_op->opcode != AML_INT_METHODCALL_OP) &&
- (parent_op->opcode != AML_REGION_OP) &&
- (parent_op->opcode != AML_INT_NAMEPATH_OP)) {
+ (parent_op->common.aml_opcode != AML_INT_METHODCALL_OP) &&
+ (parent_op->common.aml_opcode != AML_REGION_OP) &&
+ (parent_op->common.aml_opcode != AML_INT_NAMEPATH_OP)) {
/* Enter name into namespace if not found */
interpreter_mode = ACPI_IMODE_LOAD_PASS2;
ACPI_TYPE_ANY, interpreter_mode,
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
walk_state,
- (acpi_namespace_node **) &obj_desc);
+ ACPI_CAST_INDIRECT_PTR (acpi_namespace_node, &obj_desc));
/*
* The only case where we pass through (ignore) a NOT_FOUND
* error is for the Cond_ref_of opcode.
*/
if (status == AE_NOT_FOUND) {
- if (parent_op->opcode == AML_COND_REF_OF_OP) {
+ if (parent_op->common.aml_opcode == AML_COND_REF_OF_OP) {
/*
* For the Conditional Reference op, it's OK if
* the name is not found; We just need a way to
* indicate this to the interpreter, set the
* object to the root
*/
- obj_desc = (acpi_operand_object *) acpi_gbl_root_node;
+ obj_desc = ACPI_CAST_PTR (acpi_operand_object, acpi_gbl_root_node);
status = AE_OK;
}
status = AE_AML_NAME_NOT_FOUND;
name = NULL;
- acpi_ns_externalize_name (ACPI_UINT32_MAX, name_string, NULL, &name);
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Object name [%s] was not found in namespace\n", name));
- ACPI_MEM_FREE (name);
+ status2 = acpi_ns_externalize_name (ACPI_UINT32_MAX, name_string, NULL, &name);
+ if (ACPI_SUCCESS (status2)) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Object name [%s] was not found in namespace\n", name));
+ ACPI_MEM_FREE (name);
+ }
}
}
else {
/* Check for null name case */
- if (arg->opcode == AML_INT_NAMEPATH_OP) {
+ if (arg->common.aml_opcode == AML_INT_NAMEPATH_OP) {
/*
* If the name is null, this means that this is an
* optional result parameter that was not specified
}
else {
- opcode = arg->opcode;
+ opcode = arg->common.aml_opcode;
}
/* Get the object type of the argument */
return_ACPI_STATUS (status);
}
}
-
else {
/* Create an ACPI_INTERNAL_OBJECT for the argument */
acpi_ut_delete_object_desc (obj_desc);
return_ACPI_STATUS (status);
}
- }
+ }
/* Put the operand object on the object stack */
/* Move on to next argument, if any */
- arg = arg->next;
+ arg = arg->common.next;
arg_count++;
}
* pop everything off of the operand stack and delete those
* objects
*/
- acpi_ds_obj_stack_pop_and_delete (arg_count, walk_state);
+ (void) acpi_ds_obj_stack_pop_and_delete (arg_count, walk_state);
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "While creating Arg %d - %s\n",
(arg_count + 1), acpi_format_exception (status)));
*
* Module Name: dswexec - Dispatcher method execution callbacks;
* dispatch to interpreter.
- * $Revision: 90 $
+ * $Revision: 92 $
*
*****************************************************************************/
/*
* Dispatch table for opcode classes
*/
-ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch [] = {
+static ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch [] = {
acpi_ex_opcode_1A_0T_0R,
acpi_ex_opcode_1A_0T_1R,
acpi_ex_opcode_1A_1T_0R,
op = *out_op;
walk_state->op = op;
- walk_state->op_info = acpi_ps_get_opcode_info (op->opcode);
- walk_state->opcode = op->opcode;
+ walk_state->opcode = op->common.aml_opcode;
+ walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_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);
+
+ status = acpi_ds_scope_stack_pop (walk_state);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
}
}
/* We want to send namepaths to the load code */
- if (op->opcode == AML_INT_NAMEPATH_OP) {
+ if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
opcode_class = AML_CLASS_NAMED_OBJECT;
}
status = acpi_ds_load2_begin_op (walk_state, NULL);
}
- if (op->opcode == AML_REGION_OP) {
+ if (op->common.aml_opcode == AML_REGION_OP) {
status = acpi_ds_result_stack_push (walk_state);
}
break;
op_class = walk_state->op_info->class;
if (op_class == AML_CLASS_UNKNOWN) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode %X\n", op->opcode));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode %X\n", op->common.aml_opcode));
return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
}
- first_arg = op->value.arg;
+ first_arg = op->common.value.arg;
/* Init the walk state */
/* 1 Operand, 0 External_result, 0 Internal_result */
status = acpi_ds_exec_end_control_op (walk_state, op);
+ if (ACPI_FAILURE (status)) {
+ break;
+ }
- acpi_ds_result_stack_pop (walk_state);
+ status = acpi_ds_result_stack_pop (walk_state);
break;
/* Next_op points to first argument op */
- next_op = next_op->next;
+ next_op = next_op->common.next;
/*
* Get the method's arguments and put them on the operand stack
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Executing Create_object (Buffer/Package) Op=%p\n", op));
- switch (op->parent->opcode) {
+ switch (op->common.parent->common.aml_opcode) {
case AML_NAME_OP:
/*
* Put the Node on the object stack (Contains the ACPI Name of
* this object)
*/
- walk_state->operands[0] = (void *) op->parent->node;
+ walk_state->operands[0] = (void *) op->common.parent->common.node;
walk_state->num_operands = 1;
- status = acpi_ds_create_node (walk_state, op->parent->node, op->parent);
+ status = acpi_ds_create_node (walk_state, op->common.parent->common.node, op->common.parent);
if (ACPI_FAILURE (status)) {
break;
}
/* Fall through */
+ /*lint -fallthrough */
case AML_INT_EVAL_SUBTREE_OP:
- status = acpi_ds_eval_data_object_operands (walk_state, op, acpi_ns_get_attached_object (op->parent->node));
+ status = acpi_ds_eval_data_object_operands (walk_state, op,
+ acpi_ns_get_attached_object (op->common.parent->common.node));
break;
default:
break;
}
- if (op->opcode == AML_REGION_OP) {
+ if (op->common.aml_opcode == AML_REGION_OP) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Executing Op_region Address/Length Op=%p\n", op));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p\n",
- op_class, op_type, op->opcode, op));
+ op_class, op_type, op->common.aml_opcode, op));
status = AE_NOT_IMPLEMENTED;
break;
/******************************************************************************
*
* Module Name: dswload - Dispatcher namespace load callbacks
- * $Revision: 62 $
+ * $Revision: 66 $
*
*****************************************************************************/
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state));
- if (op && (op->opcode == AML_INT_NAMEDFIELD_OP)) {
+ if (op && (op->common.aml_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) {
- if (!(walk_state->op_info->flags & AML_NAMED)) {
+ if (op) {
+ if (!(walk_state->op_info->flags & AML_NAMED)) {
*out_op = op;
return (AE_OK);
}
/* Check if this object has already been installed in the namespace */
- if (op->node) {
+ if (op->common.node) {
*out_op = op;
return (AE_OK);
}
object_type = walk_state->op_info->object_type;
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "State=%p Op=%p Type=%x\n", walk_state, op, object_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
/* Initialize */
- ((acpi_parse2_object *)op)->name = node->name.integer;
+ op->named.name = node->name.integer;
/*
* Put the Node in the "op" object that the parser uses, so we
* can get it again quickly when this scope is closed
*/
- op->node = node;
+ op->common.node = node;
acpi_ps_append_arg (acpi_ps_get_parent_scope (&walk_state->parser_state), op);
*out_op = op;
{
acpi_parse_object *op;
acpi_object_type object_type;
+ acpi_status status = AE_OK;
ACPI_FUNCTION_NAME ("Ds_load1_end_op");
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);
+ status = acpi_ds_init_field_objects (op, walk_state);
}
- return (AE_OK);
+ return (status);
}
- 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->common.aml_opcode == AML_REGION_OP) {
+ status = acpi_ex_create_region (op->named.data, op->named.length,
+ (ACPI_ADR_SPACE_TYPE) ((op->common.value.arg)->common.value.integer), walk_state);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
}
- if (op->opcode == AML_NAME_OP) {
+ if (op->common.aml_opcode == AML_NAME_OP) {
/* For Name opcode, get the object type from the argument */
- if (op->value.arg) {
- object_type = (acpi_ps_get_opcode_info ((op->value.arg)->opcode))->object_type;
- op->node->type = (u8) object_type;
+ if (op->common.value.arg) {
+ object_type = (acpi_ps_get_opcode_info ((op->common.value.arg)->common.aml_opcode))->object_type;
+ op->common.node->type = (u8) object_type;
}
}
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s): Popping scope for Op %p\n",
acpi_ut_get_type_name (object_type), op));
- acpi_ds_scope_stack_pop (walk_state);
+ status = acpi_ds_scope_stack_pop (walk_state);
}
- return (AE_OK);
+ return (status);
}
acpi_status status;
acpi_object_type object_type;
NATIVE_CHAR *buffer_ptr;
- void *original = NULL;
ACPI_FUNCTION_NAME ("Ds_load2_begin_op");
if (walk_state->opcode == AML_INT_NAMEPATH_OP) {
/* For Namepath op, get the path string */
- buffer_ptr = op->value.string;
+ buffer_ptr = op->common.value.string;
if (!buffer_ptr) {
/* No name, just exit */
else {
/* Get name from the op */
- buffer_ptr = (NATIVE_CHAR *) &((acpi_parse2_object *)op)->name;
+ buffer_ptr = (NATIVE_CHAR *) &op->named.name;
}
}
else {
object_type = walk_state->op_info->object_type;
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "State=%p Op=%p Type=%x\n", walk_state, op, object_type));
+ "State=%p Op=%p Type=%X\n", walk_state, op, object_type));
if (walk_state->opcode == AML_FIELD_OP ||
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node));
}
else {
- if (op && op->node) {
- original = op->node;
- node = op->node;
+ /* All other opcodes */
+
+ if (op && op->common.node) {
+ /* This op/node was previously entered into the namespace */
+
+ node = op->common.node;
if (acpi_ns_opens_scope (object_type)) {
status = acpi_ds_scope_stack_push (node, object_type, walk_state);
/* Initialize the new op */
- ((acpi_parse2_object *)op)->name = node->name.integer;
- *out_op = op;
+ if (node) {
+ op->named.name = node->name.integer;
+ }
+ if (out_op) {
+ *out_op = op;
+ }
}
/*
* Put the Node in the "op" object that the parser uses, so we
* can get it again quickly when this scope is closed
*/
- op->node = node;
-
- if (original) {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "old %p new %p\n", original, node));
-
- if (original != node) {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Lookup match error: old %p new %p\n", original, node));
- }
- }
+ op->common.node = node;
}
return (status);
return (AE_OK);
}
- if (op->opcode == AML_SCOPE_OP) {
+ if (op->common.aml_opcode == AML_SCOPE_OP) {
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Ending scope Op=%p State=%p\n", op, walk_state));
- if (((acpi_parse2_object *)op)->name == ACPI_UINT16_MAX) {
+ if (op->named.name == ACPI_UINT16_MAX) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unnamed scope! Op=%p State=%p\n",
op, walk_state));
return (AE_OK);
* Get the Node/name from the earlier lookup
* (It was saved in the *op structure)
*/
- node = op->node;
+ node = op->common.node;
/*
* Put the Node on the object stack (Contains the ACPI Name of
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 (object_type), op));
- acpi_ds_scope_stack_pop (walk_state);
+
+ status = acpi_ds_scope_stack_pop (walk_state);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
}
/*
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Create-Load [%s] State=%p Op=%p Named_obj=%p\n",
- acpi_ps_get_opcode_name (op->opcode), walk_state, op, node));
+ acpi_ps_get_opcode_name (op->common.aml_opcode), walk_state, op, node));
/* Decode the opcode */
- arg = op->value.arg;
+ arg = op->common.value.arg;
switch (walk_state->op_info->type) {
case AML_TYPE_CREATE_FIELD:
case AML_TYPE_NAMED_FIELD:
- switch (op->opcode) {
+ switch (op->common.aml_opcode) {
case AML_INDEX_FIELD_OP:
- status = acpi_ds_create_index_field (op, (acpi_handle) arg->node,
+ status = acpi_ds_create_index_field (op, (acpi_handle) arg->common.node,
walk_state);
break;
case AML_BANK_FIELD_OP:
- status = acpi_ds_create_bank_field (op, arg->node, walk_state);
+ status = acpi_ds_create_bank_field (op, arg->common.node, walk_state);
break;
case AML_FIELD_OP:
- status = acpi_ds_create_field (op, arg->node, walk_state);
+ status = acpi_ds_create_field (op, arg->common.node, walk_state);
+ break;
+
+ default:
+ /* All NAMED_FIELD opcodes must be handled above */
break;
}
break;
goto cleanup;
}
- switch (op->opcode) {
+ switch (op->common.aml_opcode) {
case AML_PROCESSOR_OP:
status = acpi_ex_create_processor (walk_state);
case AML_TYPE_NAMED_COMPLEX:
- switch (op->opcode) {
+ switch (op->common.aml_opcode) {
case AML_METHOD_OP:
/*
* Method_op Pkg_length Name_string Method_flags Term_list
goto cleanup;
}
- status = acpi_ex_create_method (((acpi_parse2_object *) op)->data,
- ((acpi_parse2_object *) op)->length,
- walk_state);
+ status = acpi_ex_create_method (op->named.data,
+ op->named.length, walk_state);
}
break;
status = acpi_ds_create_node (walk_state, node, op);
break;
+
+
+ default:
+ /* All NAMED_COMPLEX opcodes must be handled above */
+ break;
}
break;
/*
* Lookup the method name and save the Node
*/
- status = acpi_ns_lookup (walk_state->scope_info, arg->value.string,
+ status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string,
ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2,
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
walk_state, &(new_node));
* for now, we will put it in the "op" object that the parser uses, so we
* can get it again at the end of this scope
*/
- op->node = new_node;
+ op->common.node = new_node;
}
break;
/******************************************************************************
*
* Module Name: dswstate - Dispatcher parse tree walk management routines
- * $Revision: 59 $
+ * $Revision: 64 $
*
*****************************************************************************/
#include "acpi.h"
-#include "amlcode.h"
#include "acparser.h"
#include "acdispat.h"
#include "acnamesp.h"
-#include "acinterp.h"
#define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dswstate")
return (AE_NOT_EXIST);
}
- if (index >= OBJ_NUM_OPERANDS) {
+ if (index >= OBJ_MAX_OPERAND) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Index out of range: %X State=%p Num=%X\n",
index, walk_state, state->results.num_results));
}
-
/* Check for a valid result object */
if (!state->results.obj_desc [index]) {
acpi_operand_object **object,
acpi_walk_state *walk_state)
{
- u32 index;
+ NATIVE_UINT index;
acpi_generic_state *state;
return (AE_NOT_EXIST);
}
-
if (!state->results.num_results) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", walk_state));
return (AE_AML_NO_RETURN_VALUE);
if (!*object) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null operand! State=%p #Ops=%X, Index=%X\n",
- walk_state, state->results.num_results, index));
+ walk_state, state->results.num_results, (u32) index));
return (AE_AML_NO_RETURN_VALUE);
}
return (AE_BAD_PARAMETER);
}
-
state->results.obj_desc [state->results.num_results] = object;
state->results.num_results++;
return_PTR (NULL);
}
-
return_PTR (walk_state->operands[(NATIVE_UINT)(walk_state->num_operands - 1) -
index]);
}
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Ds_get_current_walk_state, =%p\n",
thread->walk_state_list));
-
return (thread->walk_state_list);
}
walk_state->method_node = method_node;
walk_state->method_desc = acpi_ns_get_attached_object (method_node);
-
/* Push start scope on scope stack and make it current */
status = acpi_ds_scope_stack_push (method_node, ACPI_TYPE_METHOD, walk_state);
/* Init the method arguments */
- acpi_ds_method_data_init_args (params, MTH_NUM_ARGS, walk_state);
+ status = acpi_ds_method_data_init_args (params, MTH_NUM_ARGS, walk_state);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
}
-
else {
/* Setup the current scope */
- parser_state->start_node = parser_state->start_op->node;
+ parser_state->start_node = parser_state->start_op->common.node;
if (parser_state->start_node) {
/* Push start scope on scope stack and make it current */
}
}
- acpi_ds_init_callbacks (walk_state, pass_number);
-
- return_ACPI_STATUS (AE_OK);
+ status = acpi_ds_init_callbacks (walk_state, pass_number);
+ return_ACPI_STATUS (status);
}
#endif
return;
}
-
if (walk_state->parser_state.scope) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p walk still has a scope list\n", walk_state));
}
/******************************************************************************
*
* Module Name: evevent - Fixed and General Purpose Even handling and dispatch
- * $Revision: 78 $
+ * $Revision: 88 $
*
*****************************************************************************/
*/
#include "acpi.h"
-#include "achware.h"
#include "acevents.h"
#include "acnamesp.h"
void)
{
NATIVE_UINT i;
+ acpi_status status;
/*
/* 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,
+ status = acpi_set_register (acpi_gbl_fixed_event_info[i].enable_register_id,
0, ACPI_MTX_LOCK);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
}
}
u32 int_status = ACPI_INTERRUPT_NOT_HANDLED;
u32 gpe_status;
u32 gpe_enable;
- NATIVE_UINT i;
+ NATIVE_UINT_MAX32 i;
ACPI_FUNCTION_NAME ("Ev_fixed_event_detect");
/*
* Read the fixed feature status and enable registers, as all the cases
- * depend on their values.
+ * depend on their values. Ignore errors here.
*/
- 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);
+ (void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS, &gpe_status);
+ (void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE, &gpe_enable);
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
"Fixed Acpi_event Block: Enable %08X Status %08X\n",
/* Clear the status bit */
- acpi_hw_bit_register_write (acpi_gbl_fixed_event_info[event].status_register_id,
+ (void) acpi_set_register (acpi_gbl_fixed_event_info[event].status_register_id,
1, ACPI_MTX_DO_NOT_LOCK);
/*
* The event is disabled to prevent further interrupts.
*/
if (NULL == acpi_gbl_fixed_event_handlers[event].handler) {
- acpi_hw_bit_register_write (acpi_gbl_fixed_event_info[event].enable_register_id,
+ (void) acpi_set_register (acpi_gbl_fixed_event_info[event].enable_register_id,
0, ACPI_MTX_DO_NOT_LOCK);
ACPI_REPORT_ERROR (
acpi_status
acpi_ev_gpe_initialize (void)
{
- NATIVE_UINT i;
- NATIVE_UINT j;
- NATIVE_UINT gpe_block;
+ NATIVE_UINT_MAX32 i;
+ NATIVE_UINT_MAX32 j;
+ u32 gpe_block;
u32 gpe_register;
u32 gpe_number_index;
u32 gpe_number;
ACPI_GPE_REGISTER_INFO *gpe_register_info;
+ acpi_status status;
ACPI_FUNCTION_TRACE ("Ev_gpe_initialize");
/*
* Allocate the GPE number-to-index translation table
*/
- acpi_gbl_gpe_number_to_index = ACPI_MEM_CALLOCATE (sizeof (ACPI_GPE_INDEX_INFO) *
- (acpi_gbl_gpe_number_max + 1));
+ acpi_gbl_gpe_number_to_index = ACPI_MEM_CALLOCATE (
+ sizeof (ACPI_GPE_INDEX_INFO) *
+ ((ACPI_SIZE) acpi_gbl_gpe_number_max + 1));
if (!acpi_gbl_gpe_number_to_index) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Could not allocate the Gpe_number_to_index table\n"));
/* 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));
+ sizeof (ACPI_GPE_INDEX_INFO) * ((ACPI_SIZE) acpi_gbl_gpe_number_max + 1));
/*
* Allocate the GPE register information block
*/
- acpi_gbl_gpe_register_info = ACPI_MEM_CALLOCATE (acpi_gbl_gpe_register_count *
+ acpi_gbl_gpe_register_info = ACPI_MEM_CALLOCATE (
+ (ACPI_SIZE) acpi_gbl_gpe_register_count *
sizeof (ACPI_GPE_REGISTER_INFO));
if (!acpi_gbl_gpe_register_info) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
* 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) *
+ acpi_gbl_gpe_number_info = ACPI_MEM_CALLOCATE (
+ (ACPI_SIZE) 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"));
/* Init the Register info for this entire GPE register (8 GPEs) */
- gpe_register_info->base_gpe_number = (u8) (acpi_gbl_gpe_block_info[gpe_block].block_base_number + (ACPI_MUL_8 (i)));
+ gpe_register_info->base_gpe_number = (u8) (acpi_gbl_gpe_block_info[gpe_block].block_base_number
+ + (ACPI_MUL_8 (i)));
ACPI_STORE_ADDRESS (gpe_register_info->status_address.address,
- (ACPI_GET_ADDRESS (acpi_gbl_gpe_block_info[gpe_block].block_address->address) + i));
+ (ACPI_GET_ADDRESS (acpi_gbl_gpe_block_info[gpe_block].block_address->address)
+ + i));
ACPI_STORE_ADDRESS (gpe_register_info->enable_address.address,
- (ACPI_GET_ADDRESS (acpi_gbl_gpe_block_info[gpe_block].block_address->address) + i +
- acpi_gbl_gpe_block_info[gpe_block].register_count));
+ (ACPI_GET_ADDRESS (acpi_gbl_gpe_block_info[gpe_block].block_address->address)
+ + i
+ + acpi_gbl_gpe_block_info[gpe_block].register_count));
gpe_register_info->status_address.address_space_id = acpi_gbl_gpe_block_info[gpe_block].address_space_id;
gpe_register_info->enable_address.address_space_id = acpi_gbl_gpe_block_info[gpe_block].address_space_id;
* by writing a '0'.
*/
- acpi_hw_low_level_write (8, 0x00, &gpe_register_info->enable_address, 0);
- acpi_hw_low_level_write (8, 0xFF, &gpe_register_info->status_address, 0);
+ status = acpi_hw_low_level_write (8, 0x00, &gpe_register_info->enable_address, 0);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+
+ status = acpi_hw_low_level_write (8, 0xFF, &gpe_register_info->status_address, 0);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
gpe_register++;
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "GPE Block%d: %X registers at %8.8X%8.8X\n",
- gpe_block, acpi_gbl_gpe_block_info[0].register_count,
- ACPI_HIDWORD (acpi_gbl_gpe_block_info[gpe_block].block_address->address),
- ACPI_LODWORD (acpi_gbl_gpe_block_info[gpe_block].block_address->address)));
+ (s32) gpe_block, acpi_gbl_gpe_block_info[0].register_count,
+ ACPI_HIDWORD (ACPI_GET_ADDRESS (acpi_gbl_gpe_block_info[gpe_block].block_address->address)),
+ ACPI_LODWORD (ACPI_GET_ADDRESS (acpi_gbl_gpe_block_info[gpe_block].block_address->address))));
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "GPE Block%d Range GPE #%2.2X to GPE #%2.2X\n",
- gpe_block,
+ (s32) gpe_block,
acpi_gbl_gpe_block_info[gpe_block].block_base_number,
acpi_gbl_gpe_block_info[gpe_block].block_base_number +
((acpi_gbl_gpe_block_info[gpe_block].register_count * 8) -1)));
u32 gpe_number_index;
NATIVE_CHAR name[ACPI_NAME_SIZE + 1];
u8 type;
+ acpi_status status;
ACPI_FUNCTION_NAME ("Ev_save_method_info");
/* Extract the name from the object and convert to a string */
ACPI_MOVE_UNALIGNED32_TO_32 (name,
- &((acpi_namespace_node *) obj_handle)->name);
+ &((acpi_namespace_node *) obj_handle)->name.integer);
name[ACPI_NAME_SIZE] = 0;
/*
/*
* Enable the GPE (SCIs should be disabled at this point)
*/
- acpi_hw_enable_gpe (gpe_number);
+ status = acpi_hw_enable_gpe (gpe_number);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Registered GPE method %s as GPE number %X\n",
name, gpe_number));
u8 enabled_status_byte;
u8 bit_mask;
ACPI_GPE_REGISTER_INFO *gpe_register_info;
+ u32 in_value;
+ acpi_status status;
ACPI_FUNCTION_NAME ("Ev_gpe_detect");
for (i = 0; i < acpi_gbl_gpe_register_count; i++) {
gpe_register_info = &acpi_gbl_gpe_register_info[i];
- gpe_register_info->status = (u8) acpi_hw_low_level_read (8,
- &gpe_register_info->status_address, 0);
+ status = acpi_hw_low_level_read (8, &in_value, &gpe_register_info->status_address, 0);
+ gpe_register_info->status = (u8) in_value;
+ if (ACPI_FAILURE (status)) {
+ return (ACPI_INTERRUPT_NOT_HANDLED);
+ }
- gpe_register_info->enable = (u8) acpi_hw_low_level_read (8,
- &gpe_register_info->enable_address, 0);
+ status = acpi_hw_low_level_read (8, &in_value, &gpe_register_info->enable_address, 0);
+ gpe_register_info->enable = (u8) in_value;
+ if (ACPI_FAILURE (status)) {
+ return (ACPI_INTERRUPT_NOT_HANDLED);
+ }
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
- "GPE block at %8.8X%8.8X - Enable %08X Status %08X\n",
- ACPI_HIDWORD (gpe_register_info->enable_address.address),
- ACPI_LODWORD (gpe_register_info->enable_address.address),
+ "GPE block at %8.8X%8.8X - Values: Enable %02X Status %02X\n",
+ ACPI_HIDWORD (ACPI_GET_ADDRESS (gpe_register_info->enable_address.address)),
+ ACPI_LODWORD (ACPI_GET_ADDRESS (gpe_register_info->enable_address.address)),
gpe_register_info->enable,
gpe_register_info->status));
u32 gpe_number = (u32) ACPI_TO_INTEGER (context);
u32 gpe_number_index;
ACPI_GPE_NUMBER_INFO gpe_info;
+ acpi_status status;
ACPI_FUNCTION_TRACE ("Ev_asynch_execute_gpe_method");
* 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))) {
+ status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
+ if (ACPI_FAILURE (status)) {
return_VOID;
}
gpe_info = acpi_gbl_gpe_number_info [gpe_number_index];
- if (ACPI_FAILURE (acpi_ut_release_mutex (ACPI_MTX_EVENTS))) {
+ status = acpi_ut_release_mutex (ACPI_MTX_EVENTS);
+ if (ACPI_FAILURE (status)) {
return_VOID;
}
* 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);
+ status = acpi_ns_evaluate_by_handle (gpe_info.method_handle, NULL, NULL);
+ if (ACPI_FAILURE (status)) {
+ ACPI_REPORT_ERROR (("%s while evaluated GPE%X method\n",
+ acpi_format_exception (status), gpe_number));
+ }
}
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);
+ status = acpi_hw_clear_gpe (gpe_number);
+ if (ACPI_FAILURE (status)) {
+ return_VOID;
+ }
}
/*
* Enable the GPE.
*/
- acpi_hw_enable_gpe (gpe_number);
+ (void) acpi_hw_enable_gpe (gpe_number);
return_VOID;
}
{
u32 gpe_number_index;
ACPI_GPE_NUMBER_INFO *gpe_info;
+ acpi_status status;
ACPI_FUNCTION_TRACE ("Ev_gpe_dispatch");
* level-triggered events are cleared after the GPE is serviced.
*/
if (gpe_info->type & ACPI_EVENT_EDGE_TRIGGERED) {
- acpi_hw_clear_gpe (gpe_number);
+ status = acpi_hw_clear_gpe (gpe_number);
+ if (ACPI_FAILURE (status)) {
+ ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to clear GPE[%X]\n", gpe_number));
+ return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
+ }
}
/*
* Disable GPE, so it doesn't keep firing before the method has a
* chance to run.
*/
- acpi_hw_disable_gpe (gpe_number);
+ status = acpi_hw_disable_gpe (gpe_number);
+ if (ACPI_FAILURE (status)) {
+ ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to disable GPE[%X]\n", gpe_number));
+ return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
+ }
/*
* Execute the method associated with the GPE.
* 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);
+ status = acpi_hw_disable_gpe (gpe_number);
+ if (ACPI_FAILURE (status)) {
+ ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to disable GPE[%X]\n", gpe_number));
+ return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
+ }
}
/*
* It is now safe to clear level-triggered evnets.
*/
if (gpe_info->type & ACPI_EVENT_LEVEL_TRIGGERED) {
- acpi_hw_clear_gpe (gpe_number);
+ status = acpi_hw_clear_gpe (gpe_number);
+ if (ACPI_FAILURE (status)) {
+ ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to clear GPE[%X]\n", gpe_number));
+ return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
+ }
}
return_VALUE (ACPI_INTERRUPT_HANDLED);
/******************************************************************************
*
* Module Name: evmisc - Miscellaneous event manager support functions
- * $Revision: 48 $
+ * $Revision: 53 $
*
*****************************************************************************/
#include "acevents.h"
#include "acnamesp.h"
#include "acinterp.h"
-#include "achware.h"
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evmisc")
}
/*
- * Get the notify object attached to the device Node
+ * Get the notify object attached to the NS Node
*/
obj_desc = acpi_ns_get_attached_object (node);
if (obj_desc) {
switch (node->type) {
case ACPI_TYPE_DEVICE:
-
- if (notify_value <= ACPI_MAX_SYS_NOTIFY) {
- handler_obj = obj_desc->device.sys_handler;
- }
- else {
- handler_obj = obj_desc->device.drv_handler;
- }
- break;
-
-
case ACPI_TYPE_THERMAL:
+ case ACPI_TYPE_PROCESSOR:
+ case ACPI_TYPE_POWER:
if (notify_value <= ACPI_MAX_SYS_NOTIFY) {
- handler_obj = obj_desc->thermal_zone.sys_handler;
+ handler_obj = obj_desc->common_notify.sys_handler;
}
else {
- handler_obj = obj_desc->thermal_zone.drv_handler;
+ handler_obj = obj_desc->common_notify.drv_handler;
}
break;
+
+ default:
+ /* All other types are not supported */
+ return (AE_TYPE);
}
}
acpi_ev_global_lock_thread (
void *context)
{
+ acpi_status status;
+
/* Signal threads that are waiting for the lock */
if (acpi_gbl_global_lock_thread_count) {
/* Send sufficient units to the semaphore */
- acpi_os_signal_semaphore (acpi_gbl_global_lock_semaphore,
+ status = acpi_os_signal_semaphore (acpi_gbl_global_lock_semaphore,
acpi_gbl_global_lock_thread_count);
+ if (ACPI_FAILURE (status)) {
+ ACPI_REPORT_ERROR (("Could not signal Global Lock semaphore\n"));
+ }
}
}
void *context)
{
u8 acquired = FALSE;
+ acpi_status status;
/*
/* Run the Global Lock thread which will signal all waiting threads */
- acpi_os_queue_for_execution (OSD_PRIORITY_HIGH, acpi_ev_global_lock_thread,
- context);
+ status = acpi_os_queue_for_execution (OSD_PRIORITY_HIGH,
+ acpi_ev_global_lock_thread, context);
+ if (ACPI_FAILURE (status)) {
+ ACPI_REPORT_ERROR (("Could not queue Global Lock thread, %s\n",
+ acpi_format_exception (status)));
+
+ return (ACPI_INTERRUPT_NOT_HANDLED);
+ }
}
return (ACPI_INTERRUPT_HANDLED);
*
******************************************************************************/
-void
+acpi_status
acpi_ev_release_global_lock (void)
{
u8 pending = FALSE;
+ acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE ("Ev_release_global_lock");
if (!acpi_gbl_global_lock_thread_count) {
ACPI_REPORT_WARNING(("Cannot release HW Global Lock, it has not been acquired\n"));
- return_VOID;
+ return_ACPI_STATUS (AE_NOT_ACQUIRED);
}
/* One fewer thread has the global lock */
if (acpi_gbl_global_lock_thread_count) {
/* There are still some threads holding the lock, cannot release */
- return_VOID;
+ return_ACPI_STATUS (AE_OK);
}
/*
* register
*/
if (pending) {
- acpi_hw_bit_register_write (ACPI_BITREG_GLOBAL_LOCK_RELEASE, 1, ACPI_MTX_LOCK);
+ status = acpi_set_register (ACPI_BITREG_GLOBAL_LOCK_RELEASE, 1, ACPI_MTX_LOCK);
}
- return_VOID;
+ return_ACPI_STATUS (status);
}
/******************************************************************************
*
* Module Name: evregion - ACPI Address_space (Op_region) handler dispatch
- * $Revision: 128 $
+ * $Revision: 133 $
*
*****************************************************************************/
#include "acevents.h"
#include "acnamesp.h"
#include "acinterp.h"
-#include "amlcode.h"
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evregion")
/*******************************************************************************
*
- * FUNCTION: Acpi_ev_install_default_address_space_handlers
+ * FUNCTION: Acpi_ev_init_address_spaces
*
* PARAMETERS:
*
******************************************************************************/
acpi_status
-acpi_ev_install_default_address_space_handlers (
+acpi_ev_init_address_spaces (
void)
{
acpi_status status;
- ACPI_FUNCTION_TRACE ("Ev_install_default_address_space_handlers");
+ ACPI_FUNCTION_TRACE ("Ev_init_address_spaces");
/*
/*
* Set up the parameter objects
*/
- params[0]->integer.value = region_obj->region.space_id;
+ params[0]->integer.value = region_obj->region.space_id;
params[1]->integer.value = function;
params[2] = NULL;
u32 function,
ACPI_PHYSICAL_ADDRESS address,
u32 bit_width,
- acpi_integer *value)
+ void *value)
{
acpi_status status;
+ acpi_status status2;
acpi_adr_space_handler handler;
acpi_adr_space_setup region_setup;
acpi_operand_object *handler_desc;
/* Re-enter the interpreter */
- acpi_ex_enter_interpreter ();
+ status2 = acpi_ex_enter_interpreter ();
+ if (ACPI_FAILURE (status2)) {
+ return_ACPI_STATUS (status2);
+ }
/*
* Init routine may fail
* We just returned from a non-default handler, we must re-enter the
* interpreter
*/
- acpi_ex_enter_interpreter ();
+ status2 = acpi_ex_enter_interpreter ();
+ if (ACPI_FAILURE (status2)) {
+ return_ACPI_STATUS (status2);
+ }
}
return_ACPI_STATUS (status);
/*******************************************************************************
*
- * FUNCTION: Acpi_ev_disassociate_region_from_handler
+ * FUNCTION: Acpi_ev_detach_region
*
* PARAMETERS: Region_obj - Region Object
* Acpi_ns_is_locked - Namespace Region Already Locked?
******************************************************************************/
void
-acpi_ev_disassociate_region_from_handler(
+acpi_ev_detach_region(
acpi_operand_object *region_obj,
u8 acpi_ns_is_locked)
{
acpi_status status;
- ACPI_FUNCTION_TRACE ("Ev_disassociate_region_from_handler");
+ ACPI_FUNCTION_TRACE ("Ev_detach_region");
region_obj2 = acpi_ns_get_secondary_object (region_obj);
if (!region_obj2) {
- return;
+ return_VOID;
}
region_context = region_obj2->extra.region_context;
/*
* Now stop region accesses by executing the _REG method
*/
- acpi_ev_execute_reg_method (region_obj, 0);
+ status = acpi_ev_execute_reg_method (region_obj, 0);
+ if (ACPI_FAILURE (status)) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s from region _REG, [%s]\n",
+ acpi_format_exception (status),
+ acpi_ut_get_region_name (region_obj->region.space_id)));
+ }
if (acpi_ns_is_locked) {
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
/*******************************************************************************
*
- * FUNCTION: Acpi_ev_associate_region_and_handler
+ * FUNCTION: Acpi_ev_attach_region
*
* PARAMETERS: Handler_obj - Handler Object
* Region_obj - Region Object
******************************************************************************/
acpi_status
-acpi_ev_associate_region_and_handler (
+acpi_ev_attach_region (
acpi_operand_object *handler_obj,
acpi_operand_object *region_obj,
u8 acpi_ns_is_locked)
{
- acpi_status status;
+ acpi_status status;
+ acpi_status status2;
- ACPI_FUNCTION_TRACE ("Ev_associate_region_and_handler");
+ ACPI_FUNCTION_TRACE ("Ev_attach_region");
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
* method
*/
if (acpi_ns_is_locked) {
- acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ status2 = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status2)) {
+ return_ACPI_STATUS (status2);
+ }
}
status = acpi_ev_execute_reg_method (region_obj, 1);
if (acpi_ns_is_locked) {
- (void) acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ status2 = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status2)) {
+ return_ACPI_STATUS (status2);
+ }
}
return_ACPI_STATUS (status);
*
* First disconnect region for any previous handler (if any)
*/
- acpi_ev_disassociate_region_from_handler (obj_desc, FALSE);
+ acpi_ev_detach_region (obj_desc, FALSE);
/*
* Then connect the region to the new handler
*/
- status = acpi_ev_associate_region_and_handler (handler_obj, obj_desc, FALSE);
+ status = acpi_ev_attach_region (handler_obj, obj_desc, FALSE);
return (status);
}
/******************************************************************************
*
* Module Name: evrgnini- ACPI Address_space (Op_region) init
- * $Revision: 57 $
+ * $Revision: 61 $
*
*****************************************************************************/
#include "acpi.h"
#include "acevents.h"
#include "acnamesp.h"
-#include "acinterp.h"
-#include "amlcode.h"
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evrgnini")
status = acpi_ut_evaluate_numeric_object (METHOD_NAME__ADR, node, &temp);
/*
- * The default is zero, since the allocation above zeroed the data, just
- * do nothing on failures.
+ * The default is zero, and since the allocation above zeroed
+ * the data, just do nothing on failure.
*/
if (ACPI_SUCCESS (status)) {
- pci_id->device = ACPI_HIWORD (temp);
- pci_id->function = ACPI_LOWORD (temp);
+ pci_id->device = ACPI_HIWORD (ACPI_LODWORD (temp));
+ pci_id->function = ACPI_LOWORD (ACPI_LODWORD (temp));
}
/*
if (ACPI_SUCCESS (status)) {
if (!(ACPI_STRNCMP (object_hID.buffer, PCI_ROOT_HID_STRING,
sizeof (PCI_ROOT_HID_STRING)))) {
- acpi_install_address_space_handler ((acpi_handle) node,
+ status = acpi_install_address_space_handler ((acpi_handle) node,
ACPI_ADR_SPACE_PCI_CONFIG,
ACPI_DEFAULT_HANDLER, NULL, NULL);
+ if (ACPI_FAILURE (status)) {
+ ACPI_REPORT_ERROR (("Could not install handler for %4.4s, %s\n",
+ node->name.ascii, acpi_format_exception (status)));
+ }
break;
}
}
obj_desc = acpi_ns_get_attached_object (node);
if (obj_desc) {
/*
- * can only be a handler if the object exists
+ * Can only be a handler if the object exists
*/
switch (node->type) {
case ACPI_TYPE_DEVICE:
handler_obj = obj_desc->thermal_zone.addr_handler;
break;
+
+ default:
+ /* Ignore other objects */
+ break;
}
while (handler_obj) {
/*
* Found it! Now update the region and the handler
*/
- acpi_ev_associate_region_and_handler (handler_obj, region_obj,
- acpi_ns_locked);
+ status = acpi_ev_attach_region (handler_obj, region_obj,
+ acpi_ns_locked);
return_ACPI_STATUS (AE_OK);
}
*
* Module Name: evsci - System Control Interrupt configuration and
* legacy to ACPI mode state transition functions
- * $Revision: 83 $
+ * $Revision: 86 $
*
******************************************************************************/
*/
#include "acpi.h"
-#include "acnamesp.h"
-#include "achware.h"
#include "acevents.h"
void *context)
{
u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED;
+ u32 value;
+ acpi_status status;
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_bit_register_read (ACPI_BITREG_SCI_ENABLE, ACPI_MTX_DO_NOT_LOCK)) {
+ status = acpi_get_register (ACPI_BITREG_SCI_ENABLE, &value, ACPI_MTX_DO_NOT_LOCK);
+ if (ACPI_FAILURE (status)) {
+ return (ACPI_INTERRUPT_NOT_HANDLED);
+ }
+
+ if (!value) {
/* ACPI is not enabled; this interrupt cannot be for us */
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
acpi_status
acpi_ev_remove_sci_handler (void)
{
+ acpi_status status;
+
+
ACPI_FUNCTION_TRACE ("Ev_remove_sci_handler");
/* Just let the OS remove the handler and disable the level */
- acpi_os_remove_interrupt_handler ((u32) acpi_gbl_FADT->sci_int,
+ status = acpi_os_remove_interrupt_handler ((u32) acpi_gbl_FADT->sci_int,
acpi_ev_sci_handler);
- return_ACPI_STATUS (AE_OK);
+ return_ACPI_STATUS (status);
}
/******************************************************************************
*
* Module Name: evxface - External interfaces for ACPI events
- * $Revision: 126 $
+ * $Revision: 128 $
*
*****************************************************************************/
#include "acpi.h"
-#include "achware.h"
#include "acnamesp.h"
#include "acevents.h"
-#include "amlcode.h"
#include "acinterp.h"
#define _COMPONENT ACPI_EVENTS
/* Clear the GPE (of stale events), the enable it */
- acpi_hw_clear_gpe (gpe_number);
- acpi_hw_enable_gpe (gpe_number);
+ status = acpi_hw_clear_gpe (gpe_number);
+ if (ACPI_FAILURE (status)) {
+ goto cleanup;
+ }
+
+ status = acpi_hw_enable_gpe (gpe_number);
cleanup:
/* Disable the GPE before removing the handler */
- acpi_hw_disable_gpe (gpe_number);
+ status = acpi_hw_disable_gpe (gpe_number);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (status)) {
/* Make sure that the installed handler is the same */
if (acpi_gbl_gpe_number_info[gpe_number_index].handler != handler) {
- acpi_hw_enable_gpe (gpe_number);
+ (void) acpi_hw_enable_gpe (gpe_number);
status = AE_BAD_PARAMETER;
goto cleanup;
}
acpi_release_global_lock (
u32 handle)
{
+ acpi_status status;
+
if (handle != acpi_gbl_global_lock_handle) {
return (AE_NOT_ACQUIRED);
}
- acpi_ev_release_global_lock ();
- return (AE_OK);
+ status = acpi_ev_release_global_lock ();
+ return (status);
}
/******************************************************************************
*
* Module Name: evxfevnt - External Interfaces, ACPI event disable/enable
- * $Revision: 51 $
+ * $Revision: 55 $
*
*****************************************************************************/
#include "acpi.h"
-#include "achware.h"
-#include "acnamesp.h"
#include "acevents.h"
-#include "amlcode.h"
-#include "acinterp.h"
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evxfevnt")
/* Unload the SCI interrupt handler */
- acpi_ev_remove_sci_handler ();
+ status = acpi_ev_remove_sci_handler ();
return_ACPI_STATUS (status);
}
u32 flags)
{
acpi_status status = AE_OK;
+ u32 value;
ACPI_FUNCTION_TRACE ("Acpi_enable_event");
/* Decode the Fixed Event */
- if (event > ACPI_NUM_FIXED_EVENTS) {
+ if (event > ACPI_EVENT_MAX) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
* Enable the requested fixed event (by writing a one to the
* enable register bit)
*/
- acpi_hw_bit_register_write (acpi_gbl_fixed_event_info[event].enable_register_id,
- 1, ACPI_MTX_LOCK);
+ status = acpi_set_register (acpi_gbl_fixed_event_info[event].enable_register_id,
+ 1, ACPI_MTX_LOCK);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
/* 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)) {
+ status = acpi_get_register (acpi_gbl_fixed_event_info[event].enable_register_id,
+ &value, ACPI_MTX_LOCK);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+
+ if (value != 1) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Could not enable %s event\n", acpi_ut_get_event_name (event)));
return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
/* Enable the requested GPE number */
- acpi_hw_enable_gpe (event);
+ status = acpi_hw_enable_gpe (event);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
if (flags & ACPI_EVENT_WAKE_ENABLE) {
acpi_hw_enable_gpe_for_wakeup (event);
u32 flags)
{
acpi_status status = AE_OK;
+ u32 value;
ACPI_FUNCTION_TRACE ("Acpi_disable_event");
/* Decode the Fixed Event */
- if (event > ACPI_NUM_FIXED_EVENTS) {
+ if (event > ACPI_EVENT_MAX) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
* Disable the requested fixed event (by writing a zero to the
* enable register bit)
*/
- acpi_hw_bit_register_write (acpi_gbl_fixed_event_info[event].enable_register_id,
- 0, ACPI_MTX_LOCK);
+ status = acpi_set_register (acpi_gbl_fixed_event_info[event].enable_register_id,
+ 0, ACPI_MTX_LOCK);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+
+ status = acpi_get_register (acpi_gbl_fixed_event_info[event].enable_register_id,
+ &value, ACPI_MTX_LOCK);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
- if (0 != acpi_hw_bit_register_read (acpi_gbl_fixed_event_info[event].enable_register_id,
- ACPI_MTX_LOCK)) {
+ if (value != 0) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Could not disable %s events\n", acpi_ut_get_event_name (event)));
return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
acpi_hw_disable_gpe_for_wakeup (event);
}
else {
- acpi_hw_disable_gpe (event);
+ status = acpi_hw_disable_gpe (event);
}
break;
/* Decode the Fixed Event */
- if (event > ACPI_NUM_FIXED_EVENTS) {
+ if (event > ACPI_EVENT_MAX) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
* Clear the requested fixed event (By writing a one to the
* status register bit)
*/
- acpi_hw_bit_register_write (acpi_gbl_fixed_event_info[event].status_register_id,
+ status = acpi_set_register (acpi_gbl_fixed_event_info[event].status_register_id,
1, ACPI_MTX_LOCK);
break;
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- acpi_hw_clear_gpe (event);
+ status = acpi_hw_clear_gpe (event);
break;
/* Decode the Fixed Event */
- if (event > ACPI_NUM_FIXED_EVENTS) {
+ if (event > ACPI_EVENT_MAX) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Get the status of the requested fixed event */
- *event_status = acpi_hw_bit_register_read (acpi_gbl_fixed_event_info[event].status_register_id,
- ACPI_MTX_LOCK);
+ status = acpi_get_register (acpi_gbl_fixed_event_info[event].status_register_id,
+ event_status, ACPI_MTX_LOCK);
break;
/* Obtain status on the requested GPE number */
- acpi_hw_get_gpe_status (event, event_status);
+ status = acpi_hw_get_gpe_status (event, event_status);
break;
*
* Module Name: evxfregn - External Interfaces, ACPI Operation Regions and
* Address Spaces.
- * $Revision: 48 $
+ * $Revision: 50 $
*
*****************************************************************************/
#include "acpi.h"
-#include "achware.h"
#include "acnamesp.h"
#include "acevents.h"
-#include "amlcode.h"
#include "acinterp.h"
#define _COMPONENT ACPI_EVENTS
* The region is just inaccessible as indicated to
* the _REG method
*/
- acpi_ev_disassociate_region_from_handler(region_obj, TRUE);
+ acpi_ev_detach_region (region_obj, TRUE);
/*
* Walk the list, since we took the first region and it
/******************************************************************************
*
* Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes)
- * $Revision: 60 $
+ * $Revision: 65 $
*
*****************************************************************************/
#include "acpi.h"
-#include "acparser.h"
#include "acinterp.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "acevents.h"
#include "actables.h"
-#include "acdispat.h"
#define _COMPONENT ACPI_EXECUTER
/* Install the new table into the local data structures */
table_info.pointer = table;
- table_info.length = table->length;
+ table_info.length = (ACPI_SIZE) table->length;
table_info.allocation = ACPI_MEM_ALLOCATED;
table_info.base_pointer = table;
- status = acpi_tb_install_table (NULL, &table_info);
+ status = acpi_tb_install_table (&table_info);
if (ACPI_FAILURE (status)) {
goto cleanup;
}
if (ACPI_FAILURE (status)) {
/* Uninstall table on error */
- acpi_tb_uninstall_table (table_info.installed_desc);
+ (void) acpi_tb_uninstall_table (table_info.installed_desc);
goto cleanup;
}
if (parameter_node) {
/* Store the parameter data into the optional parameter object */
- status = acpi_ex_store (operand[5], (acpi_operand_object *) parameter_node,
+ status = acpi_ex_store (operand[5], ACPI_CAST_PTR (acpi_operand_object, parameter_node),
walk_state);
if (ACPI_FAILURE (status)) {
- acpi_ex_unload_table (ddb_handle);
+ (void) acpi_ex_unload_table (ddb_handle);
}
}
acpi_table_header table_header;
u32 i;
-
ACPI_FUNCTION_TRACE ("Ex_load_op");
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));
+ ((u8 *) &table_header) + i);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
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));
+ ((u8 *) table_data_ptr + i));
if (ACPI_FAILURE (status)) {
goto cleanup;
}
goto cleanup;
}
- table_ptr = (acpi_table_header *) buffer_desc->buffer.pointer;
+ table_ptr = ACPI_CAST_PTR (acpi_table_header, buffer_desc->buffer.pointer);
break;
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_ptr->signature));
+ table_ptr->signature));
status = AE_BAD_SIGNATURE;
goto cleanup;
}
status = acpi_ex_store (ddb_handle, target, walk_state);
if (ACPI_FAILURE (status)) {
- acpi_ex_unload_table (ddb_handle);
+ (void) acpi_ex_unload_table (ddb_handle);
}
return_ACPI_STATUS (status);
* validated here.
*/
if ((!ddb_handle) ||
- (ACPI_GET_DESCRIPTOR_TYPE (ddb_handle) != ACPI_DESC_TYPE_INTERNAL) ||
+ (ACPI_GET_DESCRIPTOR_TYPE (ddb_handle) != ACPI_DESC_TYPE_OPERAND) ||
(((acpi_operand_object *)ddb_handle)->common.type !=
INTERNAL_TYPE_REFERENCE)) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
* Delete the entire namespace under this table Node
* (Offset contains the Table_id)
*/
- status = acpi_ns_delete_namespace_by_owner (table_info->table_id);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
+ acpi_ns_delete_namespace_by_owner (table_info->table_id);
/* Delete the table itself */
- acpi_tb_uninstall_table (table_info->installed_desc);
+ (void) acpi_tb_uninstall_table (table_info->installed_desc);
/* Delete the table descriptor (Ddb_handle) */
/******************************************************************************
*
* Module Name: exconvrt - Object conversion routines
- * $Revision: 32 $
+ * $Revision: 35 $
*
*****************************************************************************/
#include "acpi.h"
-#include "acparser.h"
-#include "acnamesp.h"
#include "acinterp.h"
-#include "acevents.h"
#include "amlcode.h"
-#include "acdispat.h"
#define _COMPONENT ACPI_EXECUTER
u32 i;
acpi_operand_object *ret_desc;
u32 count;
- char *pointer;
+ u8 *pointer;
acpi_integer result;
- u32 integer_size = sizeof (acpi_integer);
+ acpi_status status;
ACPI_FUNCTION_TRACE_PTR ("Ex_convert_to_integer", obj_desc);
return_ACPI_STATUS (AE_OK);
case ACPI_TYPE_STRING:
- pointer = obj_desc->string.pointer;
+ pointer = (u8 *) obj_desc->string.pointer;
count = obj_desc->string.length;
break;
case ACPI_TYPE_BUFFER:
- pointer = (char *) obj_desc->buffer.pointer;
+ pointer = obj_desc->buffer.pointer;
count = obj_desc->buffer.length;
break;
return_ACPI_STATUS (AE_TYPE);
}
- /*
- * Create a new integer
- */
- ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
- if (!ret_desc) {
- 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) {
- /*
- * We are running a method that exists in a 32-bit ACPI table.
- * Truncate the value to 32 bits by zeroing out the upper 32-bit field
- */
- 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
/* Transfer no more than an integer's worth of data */
- if (count > integer_size) {
- count = integer_size;
+ if (count > acpi_gbl_integer_byte_width) {
+ count = acpi_gbl_integer_byte_width;
}
/*
switch (obj_desc->common.type) {
case ACPI_TYPE_STRING:
- /* TBD: Need to use 64-bit ACPI_STRTOUL */
-
/*
* Convert string to an integer
* String must be hexadecimal as per the ACPI specification
*/
- result = ACPI_STRTOUL (pointer, NULL, 16);
+ status = acpi_ut_strtoul64 ((char *) pointer, 16, &result);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
break;
result |= (((acpi_integer) pointer[i]) << (i * 8));
}
break;
+
+
+ default:
+ /* No other types can get here */
+ break;
+ }
+
+ /*
+ * Create a new integer
+ */
+ ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+ if (!ret_desc) {
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Save the Result, delete original descriptor, store new descriptor */
{
acpi_operand_object *ret_desc;
u32 i;
- u32 integer_size = sizeof (acpi_integer);
u8 *new_buf;
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) {
- /*
- * We are running a method that exists in a 32-bit ACPI table.
- * Use only 32 bits of the Integer for conversion.
- */
- integer_size = sizeof (u32);
- }
-
/* Need enough space for one integer */
- ret_desc->buffer.length = integer_size;
- new_buf = ACPI_MEM_CALLOCATE (integer_size);
+ ret_desc->buffer.length = acpi_gbl_integer_byte_width;
+ new_buf = ACPI_MEM_CALLOCATE (acpi_gbl_integer_byte_width);
if (!new_buf) {
ACPI_REPORT_ERROR
(("Ex_convert_to_buffer: Buffer allocation failure\n"));
/* Copy the integer to the buffer */
- for (i = 0; i < integer_size; i++) {
+ for (i = 0; i < acpi_gbl_integer_byte_width; i++) {
new_buf[i] = (u8) (obj_desc->integer.value >> (i * 8));
}
ret_desc->buffer.pointer = new_buf;
u32 i;
u32 j;
u32 k = 0;
- u8 hex_digit;
+ char hex_digit;
acpi_integer digit;
u32 remainder;
u32 length = sizeof (acpi_integer);
digit = integer;
for (j = 1; j < i; j++) {
- acpi_ut_short_divide (&digit, 10, &digit, &remainder);
+ (void) acpi_ut_short_divide (&digit, 10, &digit, &remainder);
}
/* Create the decimal digit */
}
if (!leading_zero) {
- string[k] = hex_digit;
+ string[k] = (u8) hex_digit;
k++;
}
}
u32 i;
u32 index;
u32 string_length;
- u32 integer_size = sizeof (acpi_integer);
u8 *new_buf;
u8 *pointer;
switch (obj_desc->common.type) {
case ACPI_TYPE_INTEGER:
- /* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
-
- if (walk_state->method_node->flags & ANOBJ_DATA_WIDTH_32) {
- /*
- * We are running a method that exists in a 32-bit ACPI table.
- * Use only 32 bits of the Integer
- */
- integer_size = sizeof (u32);
- }
-
- string_length = integer_size * 2;
+ string_length = acpi_gbl_integer_byte_width * 2;
if (base == 10) {
string_length = ACPI_MAX_DECIMAL_DIGITS;
}
/* Need enough space for one ASCII integer plus null terminator */
- new_buf = ACPI_MEM_CALLOCATE (string_length + 1);
+ new_buf = ACPI_MEM_CALLOCATE ((ACPI_SIZE) string_length + 1);
if (!new_buf) {
ACPI_REPORT_ERROR
(("Ex_convert_to_string: Buffer allocation failure\n"));
return_ACPI_STATUS (AE_NO_MEMORY);
}
-
/* Convert */
i = acpi_ex_convert_to_ascii (obj_desc->integer.value, base, new_buf);
string_length = max_length;
}
- new_buf = ACPI_MEM_CALLOCATE (string_length + 1);
+ new_buf = ACPI_MEM_CALLOCATE ((ACPI_SIZE) string_length + 1);
if (!new_buf) {
ACPI_REPORT_ERROR
(("Ex_convert_to_string: Buffer allocation failure\n"));
pointer = obj_desc->buffer.pointer;
index = 0;
for (i = 0, index = 0; i < obj_desc->buffer.length; i++) {
- index = acpi_ex_convert_to_ascii (pointer[i], base, &new_buf[index]);
+ index = acpi_ex_convert_to_ascii ((acpi_integer) pointer[i], base, &new_buf[index]);
new_buf[index] = ' ';
index++;
ret_desc->buffer.pointer = new_buf;
ret_desc->string.length = ACPI_STRLEN ((char *) new_buf);
-
/* Return the new buffer descriptor */
if (*result_desc == obj_desc) {
*/
status = acpi_ex_convert_to_buffer (source_desc, result_desc, walk_state);
break;
+
+
+ default:
+ status = AE_AML_INTERNAL;
+ break;
}
break;
status = AE_AML_INTERNAL;
}
-
/*
* Source-to-Target conversion semantics:
*
/******************************************************************************
*
* Module Name: excreate - Named object creation
- * $Revision: 89 $
+ * $Revision: 91 $
*
*****************************************************************************/
#include "acpi.h"
-#include "acparser.h"
#include "acinterp.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "acevents.h"
-#include "acdispat.h"
#include "actables.h"
/* Get the Node from the object stack */
- node = walk_state->op->node;
+ node = walk_state->op->common.node;
/*
* If the region object is already attached to this node,
/* Get the Node from the object stack */
- node = walk_state->op->node;
+ node = walk_state->op->common.node;
/*
* If the region object is already attached to this node,
/******************************************************************************
*
* Module Name: exdump - Interpreter debug output routines
- * $Revision: 147 $
+ * $Revision: 153 $
*
*****************************************************************************/
#include "acinterp.h"
#include "amlcode.h"
#include "acnamesp.h"
-#include "actables.h"
#include "acparser.h"
#define _COMPONENT ACPI_EXECUTER
#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER)
-/*****************************************************************************
- *
- * FUNCTION: Acpi_ex_show_hex_value
- *
- * PARAMETERS: Byte_count - Number of bytes to print (1, 2, or 4)
- * *Aml_start - Address in AML stream of bytes to print
- * Interpreter_mode - Current running mode (load1/Load2/Exec)
- * Lead_space - # of spaces to print ahead of value
- * 0 => none ahead but one behind
- *
- * DESCRIPTION: Print Byte_count byte(s) starting at Aml_start as a single
- * value, in hex. If Byte_count > 1 or the value printed is > 9, also
- * print in decimal.
- *
- ****************************************************************************/
-
-void
-acpi_ex_show_hex_value (
- u32 byte_count,
- u8 *aml_start,
- u32 lead_space)
-{
- u32 value; /* Value retrieved from AML stream */
- u32 show_decimal_value;
- u32 length; /* Length of printed field */
- u8 *current_aml_ptr = NULL; /* Pointer to current byte of AML value */
-
-
- ACPI_FUNCTION_TRACE ("Ex_show_hex_value");
-
-
- if (!((ACPI_LV_LOAD & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) {
- return;
- }
-
- if (!aml_start) {
- ACPI_REPORT_ERROR (("Ex_show_hex_value: null pointer\n"));
- return;
- }
-
- /*
- * AML numbers are always stored little-endian,
- * even if the processor is big-endian.
- */
- for (current_aml_ptr = aml_start + byte_count,
- value = 0;
- current_aml_ptr > aml_start; ) {
- value = (value << 8) + (u32)* --current_aml_ptr;
- }
-
- length = lead_space * byte_count + 2;
- if (byte_count > 1) {
- length += (byte_count - 1);
- }
-
- show_decimal_value = (byte_count > 1 || value > 9);
- if (show_decimal_value) {
- length += 3 + acpi_ex_digits_needed (value, 10);
- }
-
- for (length = lead_space; length; --length ) {
- acpi_os_printf (" ");
- }
-
- while (byte_count--) {
- acpi_os_printf ("%02x", *aml_start++);
- if (byte_count) {
- acpi_os_printf (" ");
- }
- }
-
- if (show_decimal_value) {
- acpi_os_printf (" [%d]", value);
- }
-
- if (0 == lead_space) {
- acpi_os_printf (" ");
- }
-
- acpi_os_printf ("\n");
- return_VOID;
-}
-
-
/*****************************************************************************
*
* FUNCTION: Acpi_ex_dump_operand
*
****************************************************************************/
-acpi_status
+void
acpi_ex_dump_operand (
acpi_operand_object *obj_desc)
{
u8 *buf = NULL;
u32 length;
u32 i;
+ acpi_operand_object **element;
+ u16 element_index;
ACPI_FUNCTION_NAME ("Ex_dump_operand")
if (!((ACPI_LV_EXEC & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) {
- return (AE_OK);
+ return;
}
if (!obj_desc) {
* code that dumps the stack expects something to be there!
*/
acpi_os_printf ("Null stack entry ptr\n");
- return (AE_OK);
+ return;
}
if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p NS Node: ", obj_desc));
ACPI_DUMP_ENTRY (obj_desc, ACPI_LV_EXEC);
- return (AE_OK);
+ return;
}
- if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_INTERNAL) {
+ if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_OPERAND) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p is not a local object\n", obj_desc));
ACPI_DUMP_BUFFER (obj_desc, sizeof (acpi_operand_object));
- return (AE_OK);
+ return;
}
/* Obj_desc is a valid object */
case AML_INT_NAMEPATH_OP:
acpi_os_printf ("Reference.Node->Name %X\n",
- obj_desc->reference.node->name);
+ obj_desc->reference.node->name.integer);
break;
default:
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 = obj_desc->package.elements;
element_index < obj_desc->package.count;
++element_index, ++element) {
acpi_ex_dump_operand (*element);
}
}
-
acpi_os_printf ("\n");
-
break;
acpi_os_printf ("%c",
obj_desc->string.pointer[i]);
}
-
acpi_os_printf ("\"\n");
break;
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL* \n"));
}
-
else if (ACPI_TYPE_BUFFER !=
obj_desc->buffer_field.buffer_obj->common.type)
{
acpi_os_printf ("*not a Buffer* \n");
}
-
else
{
ACPI_DUMP_STACK_ENTRY (obj_desc->buffer_field.buffer_obj);
default:
- /* unknown Obj_desc->Common.Type value */
+ /* Unknown Obj_desc->Common.Type value */
acpi_os_printf ("Unknown Type %X\n", obj_desc->common.type);
break;
}
- return (AE_OK);
+ return;
}
note = "?";
}
-
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"************* Operand Stack Contents (Opcode [%s], %d Operands)\n",
ident, num_levels));
num_levels = 1;
}
- /* Dump the stack starting at the top, working down */
+ /* Dump the operand stack starting at the top */
for (i = 0; num_levels > 0; i--, num_levels--)
{
obj_desc = &operands[i];
-
- if (ACPI_FAILURE (acpi_ex_dump_operand (*obj_desc)))
- {
- break;
- }
+ acpi_ex_dump_operand (*obj_desc);
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
char *title,
ACPI_PHYSICAL_ADDRESS value)
{
-#ifdef _IA16
+
+#if ACPI_MACHINE_WIDTH == 16
acpi_os_printf ("%20s : %p\n", title, value);
#else
acpi_os_printf ("%20s : %8.8X%8.8X\n", title,
}
}
-
- acpi_os_printf ("%20s : %4.4s\n", "Name", (char *) &node->name);
+ acpi_os_printf ("%20s : %4.4s\n", "Name", node->name.ascii);
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);
}
}
- if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_INTERNAL)
+ if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_OPERAND)
{
acpi_os_printf ("Ex_dump_object_descriptor: %p is not a valid ACPI object\n", obj_desc);
return;
{
case ACPI_TYPE_INTEGER:
- acpi_os_printf ("%20s : %X%8.8X\n", "Value",
+ acpi_os_printf ("%20s : %8.8X%8.8X\n", "Value",
ACPI_HIDWORD (obj_desc->integer.value),
ACPI_LODWORD (obj_desc->integer.value));
break;
if (obj_desc->package.count > 0)
{
- acpi_os_printf ("\n_package Contents:\n");
+ acpi_os_printf ("\nPackage Contents:\n");
for (i = 0; i < obj_desc->package.count; i++)
{
acpi_os_printf ("[%.3d] %p", i, obj_desc->package.elements[i]);
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_address ("Address", (ACPI_PHYSICAL_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);
acpi_ex_out_pointer ("Index", obj_desc->index_field.index_obj);
acpi_ex_out_pointer ("Data", obj_desc->index_field.data_obj);
break;
+
+ default:
+ /* All object types covered above */
+ break;
}
break;
/******************************************************************************
*
* Module Name: exfield - ACPI AML (p-code) execution - field manipulation
- * $Revision: 108 $
+ * $Revision: 110 $
*
*****************************************************************************/
#include "acpi.h"
#include "acdispat.h"
#include "acinterp.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-#include "achware.h"
-#include "acevents.h"
#define _COMPONENT ACPI_EXECUTER
acpi_status status;
acpi_operand_object *buffer_desc;
u32 length;
- u32 integer_size;
void *buffer;
u8 locked;
* Note: Field.length is in bits.
*/
length = ACPI_ROUND_BITS_UP_TO_BYTES (obj_desc->field.bit_length);
-
- /* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
-
- integer_size = sizeof (acpi_integer);
- if (walk_state->method_node->flags & ANOBJ_DATA_WIDTH_32) {
- /*
- * We are running a method that exists in a 32-bit ACPI table.
- * Integer size is 4.
- */
- integer_size = sizeof (u32);
- }
-
- if (length > integer_size) {
+ if (length > acpi_gbl_integer_byte_width) {
/* Field is too large for an Integer, create a Buffer instead */
buffer_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
return_ACPI_STATUS (AE_NO_MEMORY);
}
- length = integer_size;
+ length = acpi_gbl_integer_byte_width;
buffer_desc->integer.value = 0;
buffer = &buffer_desc->integer.value;
}
/******************************************************************************
*
* Module Name: exfldio - Aml Field I/O
- * $Revision: 84 $
+ * $Revision: 86 $
*
*****************************************************************************/
#include "acpi.h"
#include "acinterp.h"
#include "amlcode.h"
-#include "acnamesp.h"
-#include "achware.h"
#include "acevents.h"
#include "acdispat.h"
rgn_desc = obj_desc->common_field.region_obj;
if (ACPI_TYPE_REGION != rgn_desc->common.type) {
- 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",
rgn_desc->common.type, acpi_ut_get_type_name (rgn_desc->common.type)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
*/
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"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));
+ obj_desc->common_field.node->name.ascii, obj_desc->common_field.access_byte_width,
+ rgn_desc->region.node->name.ascii, rgn_desc->region.length));
}
/*
*/
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"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,
+ obj_desc->common_field.node->name.ascii, 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));
+ rgn_desc->region.node->name.ascii, rgn_desc->region.length));
return_ACPI_STATUS (AE_AML_REGION_LIMIT);
}
return (FALSE);
}
- if (value >= (acpi_integer) (1 << obj_desc->common_field.bit_length)) {
+ 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.
/* 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)) {
+ (acpi_integer) obj_desc->bank_field.value)) {
return_ACPI_STATUS (AE_AML_REGISTER_LIMIT);
}
* Region_field case and write the datum to the Operation Region
*/
- /* No break; ! */
+ /*lint -fallthrough */
case INTERNAL_TYPE_REGION_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)) {
+ (acpi_integer) obj_desc->index_field.value)) {
return_ACPI_STATUS (AE_AML_REGISTER_LIMIT);
}
/* If the mask is all ones, we don't need to worry about the update rule */
- if (mask != ACPI_UINT32_MAX) {
+ if (mask != ACPI_INTEGER_MAX) {
/* Decode the update rule */
switch (obj_desc->common_field.field_flags & AML_FIELD_UPDATE_RULE_MASK) {
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Write_with_update_rule: Unknown Update_rule setting: %x\n",
+ "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);
}
ACPI_MOVE_UNALIGNED64_TO_64 (datum, &(((u64 *) buffer) [offset]));
break;
+
+ default:
+ /* Should not get here */
+ break;
}
}
ACPI_MOVE_UNALIGNED64_TO_64 (&(((u64 *) buffer)[offset]), &merged_datum);
break;
+
+ default:
+ /* Should not get here */
+ break;
}
}
obj_desc->common_field.access_byte_width);
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
- "Byte_len=%x, Datum_len=%x, Byte_gran=%x\n",
+ "Byte_len=%X, Datum_len=%X, Byte_gran=%X\n",
byte_field_length, datum_count,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_BFIELD,
- "Byte_len=%x, Datum_len=%x, Byte_gran=%x\n",
+ "Byte_len=%X, Datum_len=%X, Byte_gran=%X\n",
byte_field_length, datum_count, obj_desc->common_field.access_byte_width));
/*
/******************************************************************************
*
* Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes
- * $Revision: 100 $
+ * $Revision: 104 $
*
*****************************************************************************/
#include "acpi.h"
-#include "acparser.h"
#include "acinterp.h"
#include "amlcode.h"
#include "acdispat.h"
switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) {
- case ACPI_DESC_TYPE_INTERNAL:
+ case ACPI_DESC_TYPE_OPERAND:
if (obj_desc->common.type != INTERNAL_TYPE_REFERENCE) {
*return_desc = NULL;
status = acpi_ds_method_data_get_node (obj_desc->reference.opcode,
obj_desc->reference.offset, walk_state,
- (acpi_namespace_node **) return_desc);
+ ACPI_CAST_INDIRECT_PTR (acpi_namespace_node, return_desc));
break;
default:
* Point the return object to the new buffer
*/
return_desc->buffer.pointer = (u8 *) new_buf;
- return_desc->buffer.length = length1 + length2;
+ return_desc->buffer.length = (u32) (length1 + length2);
/* Compute the new checksum */
- new_buf[return_desc->buffer.length - 1] =
+ new_buf[return_desc->buffer.length - 1] = (NATIVE_CHAR)
acpi_ut_generate_checksum (return_desc->buffer.pointer,
(return_desc->buffer.length - 1));
acpi_integer this_integer;
acpi_operand_object *return_desc;
NATIVE_CHAR *new_buf;
- u32 integer_size = sizeof (acpi_integer);
ACPI_FUNCTION_ENTRY ();
switch (obj_desc1->common.type) {
case ACPI_TYPE_INTEGER:
- /* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
-
- if (walk_state->method_node->flags & ANOBJ_DATA_WIDTH_32) {
- /*
- * We are running a method that exists in a 32-bit ACPI table.
- * Truncate the value to 32 bits by zeroing out the upper
- * 32-bit field
- */
- integer_size = sizeof (u32);
- }
-
/* Result of two integers is a buffer */
return_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
/* Need enough space for two integers */
- return_desc->buffer.length = integer_size * 2;
+ return_desc->buffer.length = acpi_gbl_integer_byte_width * 2;
new_buf = ACPI_MEM_CALLOCATE (return_desc->buffer.length);
if (!new_buf) {
ACPI_REPORT_ERROR
/* Convert the first integer */
this_integer = obj_desc1->integer.value;
- for (i = 0; i < integer_size; i++) {
- new_buf[i] = (u8) this_integer;
+ for (i = 0; i < acpi_gbl_integer_byte_width; i++) {
+ new_buf[i] = (NATIVE_CHAR) this_integer;
this_integer >>= 8;
}
/* Convert the second integer */
this_integer = obj_desc2->integer.value;
- for (; i < (integer_size * 2); i++) {
- new_buf[i] = (u8) this_integer;
+ for (; i < (ACPI_MUL_2 (acpi_gbl_integer_byte_width)); i++) {
+ new_buf[i] = (NATIVE_CHAR) this_integer;
this_integer >>= 8;
}
/* Operand0 is string */
- new_buf = ACPI_MEM_ALLOCATE (obj_desc1->string.length +
- obj_desc2->string.length + 1);
+ new_buf = ACPI_MEM_ALLOCATE ((ACPI_SIZE) obj_desc1->string.length +
+ (ACPI_SIZE) obj_desc2->string.length + 1);
if (!new_buf) {
ACPI_REPORT_ERROR
(("Ex_do_concatenate: String allocation failure\n"));
return (AE_NO_MEMORY);
}
- new_buf = ACPI_MEM_ALLOCATE (obj_desc1->buffer.length +
- obj_desc2->buffer.length);
+ new_buf = ACPI_MEM_ALLOCATE ((ACPI_SIZE) obj_desc1->buffer.length +
+ (ACPI_SIZE) obj_desc2->buffer.length);
if (!new_buf) {
ACPI_REPORT_ERROR
(("Ex_do_concatenate: Buffer allocation failure\n"));
return (TRUE);
}
break;
+
+ default:
+ break;
}
return (FALSE);
/******************************************************************************
*
* Module Name: exmutex - ASL Mutex Acquire/Release functions
- * $Revision: 10 $
+ * $Revision: 13 $
*
*****************************************************************************/
#include "acpi.h"
#include "acinterp.h"
-#include "acnamesp.h"
-#include "achware.h"
-#include "acevents.h"
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exmutex")
*
******************************************************************************/
-acpi_status
+void
acpi_ex_release_all_mutexes (
ACPI_THREAD_STATE *thread)
{
acpi_operand_object *next = thread->acquired_mutex_list;
acpi_operand_object *this;
+ acpi_status status;
ACPI_FUNCTION_ENTRY ();
/* Release the mutex */
- acpi_ex_system_release_mutex (this);
+ status = acpi_ex_system_release_mutex (this);
+ if (ACPI_FAILURE (status)) {
+ continue;
+ }
/* Mark mutex unowned */
this->mutex.owner_thread = NULL;
}
-
- return (AE_OK);
}
/******************************************************************************
*
* Module Name: exnames - interpreter/scanner name load/execute
- * $Revision: 90 $
+ * $Revision: 91 $
*
*****************************************************************************/
#include "acpi.h"
#include "acinterp.h"
#include "amlcode.h"
-#include "acnamesp.h"
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exnames")
u8 **in_aml_address,
NATIVE_CHAR *name_string)
{
- u8 *aml_address = *in_aml_address;
+ char *aml_address = (void *) *in_aml_address;
acpi_status status = AE_OK;
u32 index;
- NATIVE_CHAR char_buf[5];
+ char char_buf[5];
ACPI_FUNCTION_TRACE ("Ex_name_segment");
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Bytes from stream:\n"));
- for (index = 4;
- (index > 0) && (acpi_ut_valid_acpi_character (*aml_address));
- index--) {
- char_buf[4 - index] = *aml_address++;
- ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "%c\n", char_buf[4 - index]));
+ for (index = 0;
+ (index < ACPI_NAME_SIZE) && (acpi_ut_valid_acpi_character (*aml_address));
+ index++) {
+ char_buf[index] = *aml_address++;
+ ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "%c\n", char_buf[index]));
}
/* Valid name segment */
- if (0 == index) {
+ if (index == 4) {
/* Found 4 valid characters */
char_buf[4] = '\0';
"No Name string - %s \n", char_buf));
}
}
- else if (4 == index) {
+ else if (index == 0) {
/*
* First character was not a valid name character,
* so we are looking at something other than a name.
*aml_address, aml_address));
}
- *in_aml_address = aml_address;
+ *in_aml_address = (u8 *) aml_address;
return_ACPI_STATUS (status);
}
/******************************************************************************
*
* Module Name: exoparg1 - AML execution - opcodes with 1 argument
- * $Revision: 135 $
+ * $Revision: 137 $
*
*****************************************************************************/
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 */
+ /* Examine the AML opcode */
switch (walk_state->opcode) {
case AML_BIT_NOT_OP:
case AML_TO_BCD_OP:
case AML_COND_REF_OF_OP:
+ /* Create a return object of type Integer for these opcodes */
+
return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
if (!return_desc) {
status = AE_NO_MEMORY;
goto cleanup;
}
- break;
- }
+ switch (walk_state->opcode) {
+ case AML_BIT_NOT_OP: /* Not (Operand, Result) */
- /* Examine the AML opcode */
+ return_desc->integer.value = ~operand[0]->integer.value;
+ break;
- switch (walk_state->opcode) {
- case AML_BIT_NOT_OP: /* Not (Operand, Result) */
+ case AML_FIND_SET_LEFT_BIT_OP: /* Find_set_left_bit (Operand, Result) */
- return_desc->integer.value = ~operand[0]->integer.value;
- break;
+ return_desc->integer.value = operand[0]->integer.value;
+ /*
+ * Acpi specification describes Integer type as a little
+ * endian unsigned value, so this boundary condition is valid.
+ */
+ for (temp32 = 0; return_desc->integer.value && temp32 < ACPI_INTEGER_BIT_SIZE; ++temp32) {
+ return_desc->integer.value >>= 1;
+ }
- case AML_FIND_SET_LEFT_BIT_OP: /* Find_set_left_bit (Operand, Result) */
+ return_desc->integer.value = temp32;
+ break;
- return_desc->integer.value = operand[0]->integer.value;
- /*
- * Acpi specification describes Integer type as a little
- * endian unsigned value, so this boundary condition is valid.
- */
- for (temp32 = 0; return_desc->integer.value && temp32 < ACPI_INTEGER_BIT_SIZE; ++temp32) {
- return_desc->integer.value >>= 1;
- }
+ case AML_FIND_SET_RIGHT_BIT_OP: /* Find_set_right_bit (Operand, Result) */
- return_desc->integer.value = temp32;
- break;
+ return_desc->integer.value = operand[0]->integer.value;
+ /*
+ * The Acpi specification describes Integer type as a little
+ * endian unsigned value, so this boundary condition is valid.
+ */
+ for (temp32 = 0; return_desc->integer.value && temp32 < ACPI_INTEGER_BIT_SIZE; ++temp32) {
+ return_desc->integer.value <<= 1;
+ }
- case AML_FIND_SET_RIGHT_BIT_OP: /* Find_set_right_bit (Operand, Result) */
+ /* Since the bit position is one-based, subtract from 33 (65) */
- return_desc->integer.value = operand[0]->integer.value;
+ return_desc->integer.value = temp32 == 0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - temp32;
+ break;
- /*
- * The Acpi specification describes Integer type as a little
- * endian unsigned value, so this boundary condition is valid.
- */
- for (temp32 = 0; return_desc->integer.value && temp32 < ACPI_INTEGER_BIT_SIZE; ++temp32) {
- return_desc->integer.value <<= 1;
- }
- /* Since the bit position is one-based, subtract from 33 (65) */
+ case AML_FROM_BCD_OP: /* From_bcd (BCDValue, Result) */
- return_desc->integer.value = temp32 == 0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - temp32;
- break;
+ /*
+ * The 64-bit ACPI integer can hold 16 4-bit BCD integers
+ */
+ return_desc->integer.value = 0;
+ for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++) {
+ /* Get one BCD digit */
+ digit = (acpi_integer) ((operand[0]->integer.value >> (i * 4)) & 0xF);
- case AML_FROM_BCD_OP: /* From_bcd (BCDValue, Result) */
+ /* Check the range of the digit */
- /*
- * The 64-bit ACPI integer can hold 16 4-bit BCD integers
- */
- return_desc->integer.value = 0;
- for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++) {
- /* Get one BCD digit */
+ if (digit > 9) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "BCD digit too large: %d\n",
+ (u32) digit));
+ status = AE_AML_NUMERIC_OVERFLOW;
+ goto cleanup;
+ }
- digit = (acpi_integer) ((operand[0]->integer.value >> (i * 4)) & 0xF);
+ if (digit > 0) {
+ /* Sum into the result with the appropriate power of 10 */
- /* Check the range of the digit */
+ for (j = 0; j < i; j++) {
+ digit *= 10;
+ }
- if (digit > 9) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "BCD digit too large: %d\n",
- (u32) digit));
+ return_desc->integer.value += digit;
+ }
+ }
+ break;
+
+
+ case AML_TO_BCD_OP: /* To_bcd (Operand, Result) */
+
+ if (operand[0]->integer.value > ACPI_MAX_BCD_VALUE) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "BCD overflow: %8.8X%8.8X\n",
+ ACPI_HIDWORD(operand[0]->integer.value),
+ ACPI_LODWORD(operand[0]->integer.value)));
status = AE_AML_NUMERIC_OVERFLOW;
goto cleanup;
}
- if (digit > 0) {
- /* Sum into the result with the appropriate power of 10 */
+ return_desc->integer.value = 0;
+ for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++) {
+ /* Divide by nth factor of 10 */
+ temp32 = 0;
+ digit = operand[0]->integer.value;
for (j = 0; j < i; j++) {
- digit *= 10;
+ (void) acpi_ut_short_divide (&digit, 10, &digit, &temp32);
}
- return_desc->integer.value += digit;
- }
- }
- break;
+ /* Create the BCD digit from the remainder above */
+ if (digit > 0) {
+ return_desc->integer.value += ((acpi_integer) temp32 << (i * 4));
+ }
+ }
+ break;
- case AML_TO_BCD_OP: /* To_bcd (Operand, Result) */
- if (operand[0]->integer.value > ACPI_MAX_BCD_VALUE) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "BCD overflow: %8.8X%8.8X\n",
- ACPI_HIDWORD(operand[0]->integer.value),
- ACPI_LODWORD(operand[0]->integer.value)));
- status = AE_AML_NUMERIC_OVERFLOW;
- goto cleanup;
- }
+ case AML_COND_REF_OF_OP: /* Cond_ref_of (Source_object, Result) */
- return_desc->integer.value = 0;
- for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++) {
- /* Divide by nth factor of 10 */
+ /*
+ * This op is a little strange because the internal return value is
+ * different than the return value stored in the result descriptor
+ * (There are really two return values)
+ */
+ if ((acpi_namespace_node *) operand[0] == acpi_gbl_root_node) {
+ /*
+ * This means that the object does not exist in the namespace,
+ * return FALSE
+ */
+ return_desc->integer.value = 0;
- temp32 = 0;
- digit = operand[0]->integer.value;
- for (j = 0; j < i; j++) {
- acpi_ut_short_divide (&digit, 10, &digit, &temp32);
+ /*
+ * Must delete the result descriptor since there is no reference
+ * being returned
+ */
+ acpi_ut_remove_reference (operand[1]);
+ goto cleanup;
}
- /* Create the BCD digit from the remainder above */
+ /* Get the object reference and store it */
- if (digit > 0) {
- return_desc->integer.value += ((acpi_integer) temp32 << (i * 4));
+ status = acpi_ex_get_object_reference (operand[0], &return_desc2, walk_state);
+ if (ACPI_FAILURE (status)) {
+ goto cleanup;
}
- }
- break;
+ status = acpi_ex_store (return_desc2, operand[1], walk_state);
- case AML_COND_REF_OF_OP: /* Cond_ref_of (Source_object, Result) */
+ /* The object exists in the namespace, return TRUE */
- /*
- * This op is a little strange because the internal return value is
- * different than the return value stored in the result descriptor
- * (There are really two return values)
- */
- if ((acpi_namespace_node *) operand[0] == acpi_gbl_root_node) {
- /*
- * This means that the object does not exist in the namespace,
- * return FALSE
- */
- return_desc->integer.value = 0;
-
- /*
- * Must delete the result descriptor since there is no reference
- * being returned
- */
- acpi_ut_remove_reference (operand[1]);
+ return_desc->integer.value = ACPI_INTEGER_MAX;
goto cleanup;
- }
- /* Get the object reference and store it */
- status = acpi_ex_get_object_reference (operand[0], &return_desc2, walk_state);
- if (ACPI_FAILURE (status)) {
- goto cleanup;
+ default:
+ /* No other opcodes get here */
+ break;
}
-
- status = acpi_ex_store (return_desc2, operand[1], walk_state);
-
- /* The object exists in the namespace, return TRUE */
-
- return_desc->integer.value = ACPI_INTEGER_MAX;
- goto cleanup;
+ break;
case AML_STORE_OP: /* Store (Source, Target) */
* can be either a NS Node or an internal object.
*/
return_desc = operand[0];
- if (ACPI_GET_DESCRIPTOR_TYPE (operand[0]) == ACPI_DESC_TYPE_INTERNAL) {
+ if (ACPI_GET_DESCRIPTOR_TYPE (operand[0]) == ACPI_DESC_TYPE_OPERAND) {
/* Internal reference object - prevent deletion */
acpi_ut_add_reference (return_desc);
case INTERNAL_TYPE_INDEX_FIELD:
type = ACPI_TYPE_FIELD_UNIT;
+ break;
+
+ default:
+ /* No change to Type required */
+ break;
}
}
/* 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);
+ status = acpi_ds_method_data_get_value (operand[0]->reference.opcode,
+ operand[0]->reference.offset, walk_state, &temp_desc);
+ if (ACPI_FAILURE (status)) {
+ goto cleanup;
+ }
/*
* Delete our reference to the input object and
* 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);
+ status = acpi_ns_get_node_by_path (operand[0]->string.pointer,
+ walk_state->scope_info->scope.node, ACPI_NS_SEARCH_PARENT,
+ ACPI_CAST_INDIRECT_PTR (acpi_namespace_node, &return_desc));
if (ACPI_FAILURE (status)) {
goto cleanup;
}
- status = acpi_ex_resolve_node_to_value ((acpi_namespace_node **) &return_desc, walk_state);
+ status = acpi_ex_resolve_node_to_value (
+ ACPI_CAST_INDIRECT_PTR (acpi_namespace_node, &return_desc), walk_state);
goto cleanup;
/******************************************************************************
*
* Module Name: exoparg2 - AML execution - opcodes with 2 arguments
- * $Revision: 105 $
+ * $Revision: 106 $
*
*****************************************************************************/
#include "acpi.h"
#include "acparser.h"
-#include "acnamesp.h"
#include "acinterp.h"
#include "acevents.h"
#include "amlcode.h"
-#include "acdispat.h"
#define _COMPONENT ACPI_EXECUTER
/******************************************************************************
*
* Module Name: exoparg3 - AML execution - opcodes with 3 arguments
- * $Revision: 9 $
+ * $Revision: 13 $
*
*****************************************************************************/
case AML_FATAL_OP: /* Fatal (Fatal_type Fatal_code Fatal_arg) */
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Fatal_op: Type %x Code %x Arg %x <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
+ "Fatal_op: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
(u32) operand[0]->integer.value, (u32) operand[1]->integer.value,
(u32) operand[2]->integer.value));
/*
* Always signal the OS!
*/
- acpi_os_signal (ACPI_SIGNAL_FATAL, fatal);
+ status = acpi_os_signal (ACPI_SIGNAL_FATAL, fatal);
/* Might return while OS is shutting down, just continue */
acpi_operand_object *return_desc = NULL;
char *buffer;
acpi_status status = AE_OK;
- u32 index;
- u32 length;
+ NATIVE_UINT index;
+ ACPI_SIZE length;
ACPI_FUNCTION_TRACE_STR ("Ex_opcode_3A_1T_1R", acpi_ps_get_opcode_name (walk_state->opcode));
/* Get the Integer values from the objects */
- index = (u32) operand[1]->integer.value;
- length = (u32) operand[2]->integer.value;
+ index = (NATIVE_UINT) operand[1]->integer.value;
+ length = (ACPI_SIZE) operand[2]->integer.value;
/*
* If the index is beyond the length of the String/Buffer, or if the
if ((index + length) >
operand[0]->string.length) {
- length = operand[0]->string.length - index;
+ length = (ACPI_SIZE) operand[0]->string.length - index;
}
/* Allocate a new buffer for the String/Buffer */
- buffer = ACPI_MEM_CALLOCATE (length + 1);
+ buffer = ACPI_MEM_CALLOCATE ((ACPI_SIZE) length + 1);
if (!buffer) {
status = AE_NO_MEMORY;
goto cleanup;
/* Set the length of the new String/Buffer */
return_desc->string.pointer = buffer;
- return_desc->string.length = length;
+ return_desc->string.length = (u32) length;
}
break;
/******************************************************************************
*
* Module Name: exprep - ACPI AML (p-code) execution - field prep utilities
- * $Revision: 115 $
+ * $Revision: 117 $
*
*****************************************************************************/
#include "acinterp.h"
#include "amlcode.h"
#include "acnamesp.h"
-#include "acparser.h"
#define _COMPONENT ACPI_EXECUTER
u32 *return_byte_alignment)
{
u32 access;
- u32 length;
u8 byte_alignment;
u8 bit_length;
+/* u32 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 AML_FIELD_ACCESS_ANY:
/* Use the length to set the access type */
+ length = obj_desc->common_field.bit_length;
+
if (length <= 8) {
bit_length = 8;
}
/* Invalid field access type */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unknown field access type %x\n",
+ "Unknown field access type %X\n",
access));
return (0);
}
obj_desc->index_field.index_obj,
obj_desc->index_field.data_obj));
break;
+
+ default:
+ /* No other types should get here */
+ break;
}
/*
acpi_ns_get_type (info->field_node));
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "set Named_obj %p (%4.4s) val = %p\n",
- info->field_node, (char *) &(info->field_node->name), obj_desc));
+ info->field_node, info->field_node->name.ascii, obj_desc));
/* Remove local reference to the object */
/******************************************************************************
*
* Module Name: exregion - ACPI default Op_region (address space) handlers
- * $Revision: 74 $
+ * $Revision: 79 $
*
*****************************************************************************/
#include "acpi.h"
#include "acinterp.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-#include "achware.h"
-#include "acevents.h"
#define _COMPONENT ACPI_EXECUTER
void *logical_addr_ptr = NULL;
acpi_mem_space_context *mem_info = region_context;
u32 length;
- u32 window_size;
-
+ ACPI_SIZE window_size;
+#ifndef _HW_ALIGNMENT_SUPPORT
+ u32 remainder;
+#endif
ACPI_FUNCTION_TRACE ("Ex_system_memory_space_handler");
return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
}
+
+#ifndef _HW_ALIGNMENT_SUPPORT
+ /*
+ * Hardware does not support non-aligned data transfers, we must verify
+ * the request.
+ */
+ (void) acpi_ut_short_divide ((acpi_integer *) &address, length, NULL, &remainder);
+ if (remainder != 0) {
+ return_ACPI_STATUS (AE_AML_ALIGNMENT);
+ }
+#endif
+
/*
* Does the request fit into the cached memory mapping?
* Is 1) Address below the current mapping? OR
* Don't attempt to map memory beyond the end of the region, and
* constrain the maximum mapping size to something reasonable.
*/
- window_size = (u32) ((mem_info->address + mem_info->length) - address);
+ window_size = (ACPI_SIZE) ((mem_info->address + mem_info->length) - address);
if (window_size > SYSMEM_REGION_WINDOW_SIZE) {
window_size = SYSMEM_REGION_WINDOW_SIZE;
}
status = acpi_os_map_memory (address, window_size,
(void **) &mem_info->mapped_logical_address);
if (ACPI_FAILURE (status)) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %8.8X%8.8X, size %X\n",
+ ACPI_HIDWORD (address), ACPI_LODWORD (address), (u32) window_size));
mem_info->mapped_length = 0;
return_ACPI_STATUS (status);
}
"System_memory %d (%d width) Address=%8.8X%8.8X\n", function, bit_width,
ACPI_HIDWORD (address), ACPI_LODWORD (address)));
- /* Perform the memory read or write */
-
+ /*
+ * Perform the memory read or write
+ *
+ * Note: For machines that do not support non-aligned transfers, the target
+ * address was checked for alignment above. We do not attempt to break the
+ * transfer up into smaller (byte-size) chunks because the AML specifically
+ * asked for a transfer width that the hardware may require.
+ */
switch (function) {
case ACPI_READ:
*value = 0;
switch (bit_width) {
case 8:
- *value = (u32)* (u8 *) logical_addr_ptr;
+ *value = (acpi_integer) *((u8 *) logical_addr_ptr);
break;
case 16:
- ACPI_MOVE_UNALIGNED16_TO_16 (value, logical_addr_ptr);
+ *value = (acpi_integer) *((u16 *) logical_addr_ptr);
break;
case 32:
- ACPI_MOVE_UNALIGNED32_TO_32 (value, logical_addr_ptr);
+ *value = (acpi_integer) *((u32 *) logical_addr_ptr);
break;
+#if ACPI_MACHINE_WIDTH != 16
case 64:
- ACPI_MOVE_UNALIGNED64_TO_64 (value, logical_addr_ptr);
+ *value = (acpi_integer) *((u64 *) logical_addr_ptr);
+ break;
+#endif
+ default:
+ /* Bit_width was already validated */
break;
}
break;
break;
case 16:
- ACPI_MOVE_UNALIGNED16_TO_16 (logical_addr_ptr, value);
+ *(u16 *) logical_addr_ptr = (u16) *value;
break;
case 32:
- ACPI_MOVE_UNALIGNED32_TO_32 (logical_addr_ptr, value);
+ *(u32 *) logical_addr_ptr = (u32) *value;
break;
+#if ACPI_MACHINE_WIDTH != 16
case 64:
- ACPI_MOVE_UNALIGNED64_TO_64 (logical_addr_ptr, value);
+ *(u64 *) logical_addr_ptr = (u64) *value;
+ break;
+#endif
+
+ default:
+ /* Bit_width was already validated */
break;
}
break;
*
*/
pci_id = (acpi_pci_id *) region_context;
- pci_register = (u16) (ACPI_SIZE) address;
+ pci_register = (u16) (u32) address;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Pci_config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n",
break;
case ACPI_WRITE:
+ default:
return_ACPI_STATUS (AE_SUPPORT);
}
/******************************************************************************
*
* Module Name: exresnte - AML Interpreter object resolution
- * $Revision: 52 $
+ * $Revision: 53 $
*
*****************************************************************************/
#include "acpi.h"
#include "amlcode.h"
-#include "acparser.h"
#include "acdispat.h"
#include "acinterp.h"
#include "acnamesp.h"
-#include "actables.h"
-#include "acevents.h"
#define _COMPONENT ACPI_EXECUTER
/******************************************************************************
*
* Module Name: exresolv - AML Interpreter object resolution
- * $Revision: 109 $
+ * $Revision: 111 $
*
*****************************************************************************/
#include "acpi.h"
#include "amlcode.h"
-#include "acparser.h"
#include "acdispat.h"
#include "acinterp.h"
-#include "acnamesp.h"
-#include "actables.h"
-#include "acevents.h"
#define _COMPONENT ACPI_EXECUTER
* 1) A valid acpi_operand_object, or
* 2) A acpi_namespace_node (Named_obj)
*/
- if (ACPI_GET_DESCRIPTOR_TYPE (*stack_ptr) == ACPI_DESC_TYPE_INTERNAL) {
+ if (ACPI_GET_DESCRIPTOR_TYPE (*stack_ptr) == ACPI_DESC_TYPE_OPERAND) {
status = acpi_ex_resolve_object_to_value (stack_ptr, walk_state);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
* was called (i.e., we can't use an _else_ here.)
*/
if (ACPI_GET_DESCRIPTOR_TYPE (*stack_ptr) == ACPI_DESC_TYPE_NAMED) {
- status = acpi_ex_resolve_node_to_value ((acpi_namespace_node **) stack_ptr,
+ status = acpi_ex_resolve_node_to_value (
+ ACPI_CAST_INDIRECT_PTR (acpi_namespace_node, stack_ptr),
walk_state);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
case AML_REVISION_OP:
obj_desc->integer.value = ACPI_CA_SUPPORT_LEVEL;
break;
+
+ default:
+ /* No other opcodes can get here */
+ break;
}
/*
/******************************************************************************
*
* Module Name: exresop - AML Interpreter operand/object resolution
- * $Revision: 48 $
+ * $Revision: 50 $
*
*****************************************************************************/
#include "acpi.h"
#include "amlcode.h"
#include "acparser.h"
-#include "acdispat.h"
#include "acinterp.h"
#include "acnamesp.h"
-#include "actables.h"
-#include "acevents.h"
#define _COMPONENT ACPI_EXECUTER
break;
- case ACPI_DESC_TYPE_INTERNAL:
+ case ACPI_DESC_TYPE_OPERAND:
/* ACPI internal object */
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) &&
+ if ((ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_OPERAND) &&
(ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_STRING)) {
/*
* String found - the string references a named object and must be
}
/* Else not a string - fall through to the normal Reference case below */
+ /*lint -fallthrough */
case ARGI_REFERENCE: /* References: */
case ARGI_INTEGER_REF:
goto next_operand;
}
break;
+
+ default:
+ /* All cases covered above */
+ break;
}
/******************************************************************************
*
* Module Name: exstore - AML Interpreter object store support
- * $Revision: 163 $
+ * $Revision: 164 $
*
*****************************************************************************/
#include "acpi.h"
-#include "acparser.h"
#include "acdispat.h"
#include "acinterp.h"
#include "amlcode.h"
#include "acnamesp.h"
-#include "actables.h"
#define _COMPONENT ACPI_EXECUTER
case ACPI_TYPE_STRING:
- value = source_desc->string.pointer[0];
+ value = (u8) source_desc->string.pointer[0];
break;
default:
*
* Module Name: exstoren - AML Interpreter object store support,
* Store to Node (namespace object)
- * $Revision: 47 $
+ * $Revision: 48 $
*
*****************************************************************************/
#include "acpi.h"
-#include "acparser.h"
-#include "acdispat.h"
#include "acinterp.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-#include "actables.h"
#define _COMPONENT ACPI_EXECUTER
/******************************************************************************
*
* Module Name: exstorob - AML Interpreter object store support, store to object
- * $Revision: 42 $
+ * $Revision: 44 $
*
*****************************************************************************/
#include "acpi.h"
-#include "acparser.h"
-#include "acdispat.h"
#include "acinterp.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-#include "actables.h"
#define _COMPONENT ACPI_EXECUTER
ACPI_MEM_FREE (target_desc->string.pointer);
}
- target_desc->string.pointer = ACPI_MEM_ALLOCATE (length + 1);
+ target_desc->string.pointer = ACPI_MEM_ALLOCATE ((ACPI_SIZE) length + 1);
if (!target_desc->string.pointer) {
return (AE_NO_MEMORY);
}
/******************************************************************************
*
* Module Name: exsystem - Interface to OS services
- * $Revision: 71 $
+ * $Revision: 73 $
*
*****************************************************************************/
#include "acpi.h"
#include "acinterp.h"
-#include "acnamesp.h"
-#include "achware.h"
#include "acevents.h"
#define _COMPONENT ACPI_EXECUTER
* Support for the _GL_ Mutex object -- release the global lock
*/
if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) {
- acpi_ev_release_global_lock ();
- return_ACPI_STATUS (AE_OK);
+ status = acpi_ev_release_global_lock ();
+ return_ACPI_STATUS (status);
}
status = acpi_os_signal_semaphore (obj_desc->mutex.semaphore, 1);
*/
status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, 0, &temp_semaphore);
if (ACPI_SUCCESS (status)) {
- acpi_os_delete_semaphore (obj_desc->event.semaphore);
+ (void) acpi_os_delete_semaphore (obj_desc->event.semaphore);
obj_desc->event.semaphore = temp_semaphore;
}
/******************************************************************************
*
* Module Name: exutils - interpreter/scanner utilities
- * $Revision: 93 $
+ * $Revision: 98 $
*
*****************************************************************************/
#define DEFINE_AML_GLOBALS
#include "acpi.h"
-#include "acparser.h"
#include "acinterp.h"
#include "amlcode.h"
-#include "acnamesp.h"
#include "acevents.h"
-#include "acparser.h"
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exutils")
status = acpi_ut_acquire_mutex (ACPI_MTX_EXECUTE);
if (ACPI_FAILURE (status)) {
- ACPI_REPORT_ERROR (("Fatal - Could not acquire interpreter lock\n"));
+ ACPI_REPORT_ERROR (("Could not acquire interpreter mutex\n"));
}
return_ACPI_STATUS (status);
status = acpi_ut_release_mutex (ACPI_MTX_EXECUTE);
+ if (ACPI_FAILURE (status)) {
+ ACPI_REPORT_ERROR (("Could not release interpreter mutex\n"));
+ }
return_VOID;
}
return;
}
- if (walk_state->method_node->flags & ANOBJ_DATA_WIDTH_32) {
+ if (acpi_gbl_integer_byte_width == 4) {
/*
* We are running a method that exists in a 32-bit ACPI table.
* Truncate the value to 32 bits by zeroing out the upper 32-bit field
*
******************************************************************************/
-acpi_status
+void
acpi_ex_release_global_lock (
u8 locked_by_me)
{
+ acpi_status status;
+
ACPI_FUNCTION_TRACE ("Ex_release_global_lock");
if (locked_by_me) {
/* OK, now release the lock */
- acpi_ev_release_global_lock ();
- }
+ status = acpi_ev_release_global_lock ();
+ if (ACPI_FAILURE (status)) {
+ /* Report the error, but there isn't much else we can do */
- return_ACPI_STATUS (AE_OK);
+ ACPI_REPORT_ERROR (("Could not release ACPI Global Lock\n"));
+ }
+ }
}
acpi_integer value,
u32 base)
{
- u32 num_digits = 0;
+ u32 num_digits;
+ acpi_integer current_value;
+ acpi_integer quotient;
ACPI_FUNCTION_TRACE ("Ex_digits_needed");
- if (base < 1) {
- 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 '-'
- */
- for (num_digits = 1;
- (acpi_ut_short_divide (&value, base, &value, NULL));
- ++num_digits) { ; }
+ /*
+ * acpi_integer is unsigned, so we don't worry about a '-'
+ */
+ current_value = value;
+ num_digits = 0;
+
+ while (current_value) {
+ (void) acpi_ut_short_divide (¤t_value, base, "ient, NULL);
+ num_digits++;
+ current_value = quotient;
}
return_VALUE (num_digits);
}
-/*******************************************************************************
- *
- * FUNCTION: ntohl
- *
- * PARAMETERS: Value - Value to be converted
- *
- * DESCRIPTION: Convert a 32-bit value to big-endian (swap the bytes)
- *
- ******************************************************************************/
-
-static u32
-_ntohl (
- u32 value)
-{
- union {
- u32 value;
- u8 bytes[4];
- } out;
-
- union {
- u32 value;
- u8 bytes[4];
- } in;
-
-
- ACPI_FUNCTION_ENTRY ();
-
-
- in.value = value;
-
- out.bytes[0] = in.bytes[3];
- out.bytes[1] = in.bytes[2];
- out.bytes[2] = in.bytes[1];
- out.bytes[3] = in.bytes[0];
-
- return (out.value);
-}
-
-
/*******************************************************************************
*
* FUNCTION: Acpi_ex_eisa_id_to_string
*
******************************************************************************/
-acpi_status
+void
acpi_ex_eisa_id_to_string (
u32 numeric_id,
NATIVE_CHAR *out_string)
{
- u32 id;
+ u32 eisa_id;
ACPI_FUNCTION_ENTRY ();
- /* swap to big-endian to get contiguous bits */
+ /* Swap ID to big-endian to get contiguous bits */
- id = _ntohl (numeric_id);
+ eisa_id = acpi_ut_dword_byte_swap (numeric_id);
- out_string[0] = (char) ('@' + ((id >> 26) & 0x1f));
- out_string[1] = (char) ('@' + ((id >> 21) & 0x1f));
- out_string[2] = (char) ('@' + ((id >> 16) & 0x1f));
- out_string[3] = acpi_ut_hex_to_ascii_char (id, 12);
- out_string[4] = acpi_ut_hex_to_ascii_char (id, 8);
- out_string[5] = acpi_ut_hex_to_ascii_char (id, 4);
- out_string[6] = acpi_ut_hex_to_ascii_char (id, 0);
+ out_string[0] = (char) ('@' + ((eisa_id >> 26) & 0x1f));
+ out_string[1] = (char) ('@' + ((eisa_id >> 21) & 0x1f));
+ out_string[2] = (char) ('@' + ((eisa_id >> 16) & 0x1f));
+ out_string[3] = acpi_ut_hex_to_ascii_char ((acpi_integer) eisa_id, 12);
+ out_string[4] = acpi_ut_hex_to_ascii_char ((acpi_integer) eisa_id, 8);
+ out_string[5] = acpi_ut_hex_to_ascii_char ((acpi_integer) eisa_id, 4);
+ out_string[6] = acpi_ut_hex_to_ascii_char ((acpi_integer) eisa_id, 0);
out_string[7] = 0;
-
- return (AE_OK);
}
*
******************************************************************************/
-acpi_status
+void
acpi_ex_unsigned_integer_to_string (
acpi_integer value,
NATIVE_CHAR *out_string)
u32 count;
u32 digits_needed;
u32 remainder;
+ acpi_integer quotient;
ACPI_FUNCTION_ENTRY ();
out_string[digits_needed] = 0;
for (count = digits_needed; count > 0; count--) {
- acpi_ut_short_divide (&value, 10, &value, &remainder);
- out_string[count-1] = (NATIVE_CHAR) ('0' + remainder);
+ (void) acpi_ut_short_divide (&value, 10, "ient, &remainder);
+ out_string[count-1] = (NATIVE_CHAR) ('0' + remainder);\
+ value = quotient;
}
-
- return (AE_OK);
}
/******************************************************************************
*
* Module Name: hwacpi - ACPI Hardware Initialization/Mode Interface
- * $Revision: 53 $
+ * $Revision: 58 $
*
*****************************************************************************/
#include "acpi.h"
-#include "achware.h"
#define _COMPONENT ACPI_HARDWARE
u32 mode)
{
- acpi_status status = AE_NO_HARDWARE_RESPONSE;
+ acpi_status status;
+ u32 retry;
ACPI_FUNCTION_TRACE ("Hw_set_mode");
+ switch (mode) {
+ case ACPI_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);
+ status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd,
+ (acpi_integer) acpi_gbl_FADT->acpi_enable, 8);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Attempting to enable ACPI mode\n"));
- }
- else if (mode == ACPI_SYS_MODE_LEGACY) {
+ break;
+
+ case ACPI_SYS_MODE_LEGACY:
+
/*
* BIOS should clear all fixed status bits and restore fixed event
* enable bits to default
*/
- acpi_os_write_port (acpi_gbl_FADT->smi_cmd, acpi_gbl_FADT->acpi_disable, 8);
+ status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd,
+ (acpi_integer) acpi_gbl_FADT->acpi_disable, 8);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Attempting to enable Legacy (non-ACPI) mode\n"));
- }
+ break;
- /* Give the platform some time to react */
+ default:
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
- acpi_os_stall (20000);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
- if (acpi_hw_get_mode () == mode) {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode %X successfully enabled\n", mode));
- status = AE_OK;
+ /*
+ * Some hardware takes a LONG time to switch modes. Give them 3 sec to
+ * do so, but allow faster systems to proceed more quickly.
+ */
+ retry = 3000;
+ while (retry) {
+ status = AE_NO_HARDWARE_RESPONSE;
+
+ if (acpi_hw_get_mode() == mode) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode %X successfully enabled\n", mode));
+ status = AE_OK;
+ break;
+ }
+ acpi_os_stall(1000);
+ retry--;
}
return_ACPI_STATUS (status);
u32
acpi_hw_get_mode (void)
{
+ acpi_status status;
+ u32 value;
+
ACPI_FUNCTION_TRACE ("Hw_get_mode");
+ status = acpi_get_register (ACPI_BITREG_SCI_ENABLE, &value, ACPI_MTX_LOCK);
+ if (ACPI_FAILURE (status)) {
+ return_VALUE (ACPI_SYS_MODE_LEGACY);
+ }
- if (acpi_hw_bit_register_read (ACPI_BITREG_SCI_ENABLE, ACPI_MTX_LOCK)) {
+ if (value) {
return_VALUE (ACPI_SYS_MODE_ACPI);
}
else {
/******************************************************************************
*
* Module Name: hwgpe - Low level GPE enable/disable/clear functions
- * $Revision: 40 $
+ * $Revision: 41 $
*
*****************************************************************************/
*/
#include "acpi.h"
-#include "achware.h"
-#include "acnamesp.h"
#include "acevents.h"
#define _COMPONENT ACPI_HARDWARE
*
******************************************************************************/
-u32
+u8
acpi_hw_get_gpe_bit_mask (
u32 gpe_number)
{
*
******************************************************************************/
-void
+acpi_status
acpi_hw_enable_gpe (
u32 gpe_number)
{
u32 in_byte;
u32 register_index;
- u32 bit_mask;
+ u8 bit_mask;
+ acpi_status status;
ACPI_FUNCTION_ENTRY ();
* Read the current value of the register, set the appropriate bit
* to enable the GPE, and write out the new register.
*/
- in_byte = acpi_hw_low_level_read (8,
- &acpi_gbl_gpe_register_info[register_index].enable_address, 0);
- acpi_hw_low_level_write (8, (in_byte | bit_mask),
- &acpi_gbl_gpe_register_info[register_index].enable_address, 0);
+ status = acpi_hw_low_level_read (8, &in_byte,
+ &acpi_gbl_gpe_register_info[register_index].enable_address, 0);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
+
+ status = acpi_hw_low_level_write (8, (in_byte | bit_mask),
+ &acpi_gbl_gpe_register_info[register_index].enable_address, 0);
+
+ return (status);
}
u32 gpe_number)
{
u32 register_index;
- u32 bit_mask;
+ u8 bit_mask;
ACPI_FUNCTION_ENTRY ();
*
******************************************************************************/
-void
+acpi_status
acpi_hw_disable_gpe (
u32 gpe_number)
{
u32 in_byte;
u32 register_index;
- u32 bit_mask;
+ u8 bit_mask;
+ acpi_status status;
ACPI_FUNCTION_ENTRY ();
* Read the current value of the register, clear the appropriate bit,
* and write out the new register value to disable the GPE.
*/
- in_byte = acpi_hw_low_level_read (8,
- &acpi_gbl_gpe_register_info[register_index].enable_address, 0);
- acpi_hw_low_level_write (8, (in_byte & ~bit_mask),
- &acpi_gbl_gpe_register_info[register_index].enable_address, 0);
+ status = acpi_hw_low_level_read (8, &in_byte,
+ &acpi_gbl_gpe_register_info[register_index].enable_address, 0);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
+
+ status = acpi_hw_low_level_write (8, (in_byte & ~bit_mask),
+ &acpi_gbl_gpe_register_info[register_index].enable_address, 0);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
acpi_hw_disable_gpe_for_wakeup(gpe_number);
+ return (AE_OK);
}
u32 gpe_number)
{
u32 register_index;
- u32 bit_mask;
+ u8 bit_mask;
ACPI_FUNCTION_ENTRY ();
*
******************************************************************************/
-void
+acpi_status
acpi_hw_clear_gpe (
u32 gpe_number)
{
u32 register_index;
- u32 bit_mask;
+ u8 bit_mask;
+ acpi_status status;
ACPI_FUNCTION_ENTRY ();
* Write a one to the appropriate bit in the status register to
* clear this GPE.
*/
- acpi_hw_low_level_write (8, bit_mask,
- &acpi_gbl_gpe_register_info[register_index].status_address, 0);
+ status = acpi_hw_low_level_write (8, bit_mask,
+ &acpi_gbl_gpe_register_info[register_index].status_address, 0);
+
+ return (status);
}
*
******************************************************************************/
-void
+acpi_status
acpi_hw_get_gpe_status (
u32 gpe_number,
acpi_event_status *event_status)
{
u32 in_byte = 0;
u32 register_index = 0;
- u32 bit_mask = 0;
+ u8 bit_mask = 0;
ACPI_GPE_REGISTER_INFO *gpe_register_info;
+ acpi_status status;
ACPI_FUNCTION_ENTRY ();
if (!event_status) {
- return;
+ return (AE_BAD_PARAMETER);
}
(*event_status) = 0;
/* GPE Enabled? */
- in_byte = acpi_hw_low_level_read (8, &gpe_register_info->enable_address, 0);
+ status = acpi_hw_low_level_read (8, &in_byte, &gpe_register_info->enable_address, 0);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
+
if (bit_mask & in_byte) {
(*event_status) |= ACPI_EVENT_FLAG_ENABLED;
}
/* GPE active (set)? */
- in_byte = acpi_hw_low_level_read (8, &gpe_register_info->status_address, 0);
+ status = acpi_hw_low_level_read (8, &in_byte, &gpe_register_info->status_address, 0);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
+
if (bit_mask & in_byte) {
(*event_status) |= ACPI_EVENT_FLAG_SET;
}
+ return (AE_OK);
}
*
******************************************************************************/
-void
+acpi_status
acpi_hw_disable_non_wakeup_gpes (
void)
{
u32 i;
ACPI_GPE_REGISTER_INFO *gpe_register_info;
+ u32 in_value;
+ acpi_status status;
ACPI_FUNCTION_ENTRY ();
* Read the enabled status of all GPEs. We
* will be using it to restore all the GPEs later.
*/
- gpe_register_info->enable = (u8) acpi_hw_low_level_read (8,
+ status = acpi_hw_low_level_read (8, &in_value,
&gpe_register_info->enable_address, 0);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
+
+ gpe_register_info->enable = (u8) in_value;
/*
* Disable all GPEs except wakeup GPEs.
*/
- acpi_hw_low_level_write (8, gpe_register_info->wake_enable,
+ status = acpi_hw_low_level_write (8, gpe_register_info->wake_enable,
&gpe_register_info->enable_address, 0);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
}
+ return (AE_OK);
}
*
******************************************************************************/
-void
+acpi_status
acpi_hw_enable_non_wakeup_gpes (
void)
{
u32 i;
ACPI_GPE_REGISTER_INFO *gpe_register_info;
+ acpi_status status;
ACPI_FUNCTION_ENTRY ();
* We previously stored the enabled status of all GPEs.
* Blast them back in.
*/
- acpi_hw_low_level_write (8, gpe_register_info->enable, &
- gpe_register_info->enable_address, 0);
+ status = acpi_hw_low_level_write (8, gpe_register_info->enable,
+ &gpe_register_info->enable_address, 0);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
}
+ return (AE_OK);
}
*
* Module Name: hwregs - Read/write access functions for the various ACPI
* control and status registers.
- * $Revision: 121 $
+ * $Revision: 130 $
*
******************************************************************************/
#include "acpi.h"
-#include "achware.h"
#include "acnamesp.h"
#define _COMPONENT ACPI_HARDWARE
*
******************************************************************************/
-void
+acpi_status
acpi_hw_clear_acpi_status (void)
{
- NATIVE_UINT i;
+ NATIVE_UINT_MAX32 i;
NATIVE_UINT gpe_block;
acpi_status status;
status = acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE);
if (ACPI_FAILURE (status)) {
- return_VOID;
+ return_ACPI_STATUS (status);
}
- acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS,
- ACPI_BITMASK_ALL_FIXED_STATUS);
+ status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS,
+ ACPI_BITMASK_ALL_FIXED_STATUS);
+ if (ACPI_FAILURE (status)) {
+ goto unlock_and_exit;
+ }
/* Clear the fixed events */
if (ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xpm1b_evt_blk.address)) {
- acpi_hw_low_level_write (16, ACPI_BITMASK_ALL_FIXED_STATUS,
- &acpi_gbl_FADT->Xpm1b_evt_blk, 0);
+ status = acpi_hw_low_level_write (16, ACPI_BITMASK_ALL_FIXED_STATUS,
+ &acpi_gbl_FADT->Xpm1b_evt_blk, 0);
+ if (ACPI_FAILURE (status)) {
+ goto unlock_and_exit;
+ }
}
/* Clear the GPE Bits */
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_hw_low_level_write (8, 0xFF,
- acpi_gbl_gpe_block_info[gpe_block].block_address, i);
+ status = acpi_hw_low_level_write (8, 0xFF,
+ acpi_gbl_gpe_block_info[gpe_block].block_address, i);
+ if (ACPI_FAILURE (status)) {
+ goto unlock_and_exit;
+ }
}
}
+unlock_and_exit:
(void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
- return_VOID;
+ return_ACPI_STATUS (status);
}
/*******************************************************************************
*
- * FUNCTION: Acpi_hw_get_sleep_type_data
+ * FUNCTION: Acpi_get_sleep_type_data
*
* PARAMETERS: Sleep_state - Numeric sleep state
* *Sleep_type_a - Where SLP_TYPa is returned
******************************************************************************/
acpi_status
-acpi_hw_get_sleep_type_data (
+acpi_get_sleep_type_data (
u8 sleep_state,
u8 *sleep_type_a,
u8 *sleep_type_b)
acpi_operand_object *obj_desc;
- ACPI_FUNCTION_TRACE ("Hw_get_sleep_type_data");
+ ACPI_FUNCTION_TRACE ("Acpi_get_sleep_type_data");
/*
/*******************************************************************************
*
- * FUNCTION: Acpi_hw_bit_register_read
+ * FUNCTION: Acpi_get_register
*
* PARAMETERS: Register_id - index of ACPI Register to access
* Use_lock - Lock the hardware
*
******************************************************************************/
-u32
-acpi_hw_bit_register_read (
+acpi_status
+acpi_get_register (
u32 register_id,
+ u32 *return_value,
u32 flags)
{
u32 register_value = 0;
ACPI_BIT_REGISTER_INFO *bit_reg_info;
+ acpi_status status;
- ACPI_FUNCTION_TRACE ("Hw_bit_register_read");
+ ACPI_FUNCTION_TRACE ("Acpi_get_register");
- if (flags & ACPI_MTX_LOCK) {
- if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE))) {
- return_VALUE (0);
- }
- }
-
/* Get the info structure corresponding to the requested ACPI Register */
bit_reg_info = acpi_hw_get_bit_register_info (register_id);
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- register_value = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, bit_reg_info->parent_register);
+ if (flags & ACPI_MTX_LOCK) {
+ status = acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+ }
+
+ status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK,
+ bit_reg_info->parent_register, ®ister_value);
if (flags & ACPI_MTX_LOCK) {
(void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
}
- /* Normalize the value that was read */
+ if (ACPI_SUCCESS (status)) {
+ /* Normalize the value that was read */
- register_value = ((register_value & bit_reg_info->access_bit_mask) >> bit_reg_info->bit_position);
+ 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);
+ *return_value = register_value;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read value %X\n", register_value));
+ }
+
+ return_ACPI_STATUS (status);
}
/*******************************************************************************
*
- * FUNCTION: Acpi_hw_bit_register_write
+ * FUNCTION: Acpi_set_register
*
* 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.
+ * RETURN: None
*
* DESCRIPTION: ACPI Bit Register write function.
*
******************************************************************************/
-u32
-acpi_hw_bit_register_write (
+acpi_status
+acpi_set_register (
u32 register_id,
u32 value,
u32 flags)
{
u32 register_value = 0;
ACPI_BIT_REGISTER_INFO *bit_reg_info;
+ acpi_status status;
- ACPI_FUNCTION_TRACE_U32 ("Hw_bit_register_write", register_id);
+ ACPI_FUNCTION_TRACE_U32 ("Acpi_set_register", register_id);
- if (flags & ACPI_MTX_LOCK) {
- if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE))) {
- return_VALUE (0);
- }
- }
-
/* Get the info structure corresponding to the requested ACPI Register */
bit_reg_info = acpi_hw_get_bit_register_info (register_id);
if (!bit_reg_info) {
+ ACPI_REPORT_ERROR (("Bad ACPI HW Register_id: %X\n", register_id));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
+ if (flags & ACPI_MTX_LOCK) {
+ status = acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+ }
+
/* 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);
+ status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK,
+ bit_reg_info->parent_register, ®ister_value);
+ if (ACPI_FAILURE (status)) {
+ goto unlock_and_exit;
+ }
/*
* Decode the Register ID
* 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);
+ 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);
+ status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
+ ACPI_REGISTER_PM1_STATUS, (u16) value);
register_value = 0;
}
break;
case ACPI_REGISTER_PM1_ENABLE:
- ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position, bit_reg_info->access_bit_mask, value);
+ ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position,
+ bit_reg_info->access_bit_mask, value);
- acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE, (u16) register_value);
+ status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
+ ACPI_REGISTER_PM1_ENABLE, (u16) register_value);
break;
*/
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM1 control: Read %X\n", register_value));
- ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position, bit_reg_info->access_bit_mask, value);
+ ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position,
+ bit_reg_info->access_bit_mask, value);
- acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, register_id,
+ status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, register_id,
(u16) register_value);
break;
case ACPI_REGISTER_PM2_CONTROL:
- register_value = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM2_CONTROL);
+ status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK,
+ ACPI_REGISTER_PM2_CONTROL, ®ister_value);
+ if (ACPI_FAILURE (status)) {
+ goto unlock_and_exit;
+ }
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM2 control: Read %X from %8.8X%8.8X\n",
- register_value, ACPI_HIDWORD (acpi_gbl_FADT->Xpm2_cnt_blk.address),
- ACPI_LODWORD (acpi_gbl_FADT->Xpm2_cnt_blk.address)));
+ register_value,
+ ACPI_HIDWORD (ACPI_GET_ADDRESS (acpi_gbl_FADT->Xpm2_cnt_blk.address)),
+ ACPI_LODWORD (ACPI_GET_ADDRESS (acpi_gbl_FADT->Xpm2_cnt_blk.address))));
- ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position, bit_reg_info->access_bit_mask, value);
+ ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position,
+ bit_reg_info->access_bit_mask, value);
- ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %04X to %8.8X%8.8X\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %4.4X to %8.8X%8.8X\n",
register_value,
- ACPI_HIDWORD (acpi_gbl_FADT->Xpm2_cnt_blk.address),
- ACPI_LODWORD (acpi_gbl_FADT->Xpm2_cnt_blk.address)));
+ ACPI_HIDWORD (ACPI_GET_ADDRESS (acpi_gbl_FADT->Xpm2_cnt_blk.address)),
+ ACPI_LODWORD (ACPI_GET_ADDRESS (acpi_gbl_FADT->Xpm2_cnt_blk.address))));
- acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
+ status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM2_CONTROL, (u8) (register_value));
break;
break;
}
+
+unlock_and_exit:
+
if (flags & ACPI_MTX_LOCK) {
(void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
}
/* Normalize the value that was read */
- register_value = ((register_value & bit_reg_info->access_bit_mask) >> bit_reg_info->bit_position);
+ ACPI_DEBUG_EXEC (register_value = ((register_value & bit_reg_info->access_bit_mask) >> bit_reg_info->bit_position));
- ACPI_DEBUG_PRINT ((ACPI_DB_IO, "ACPI Register_write actual %X\n", register_value));
- return_VALUE (register_value);
+ ACPI_DEBUG_PRINT ((ACPI_DB_IO, "ACPI Register Write actual %X\n", register_value));
+ return_ACPI_STATUS (status);
}
*
******************************************************************************/
-u32
+acpi_status
acpi_hw_register_read (
u8 use_lock,
- u32 register_id)
+ u32 register_id,
+ u32 *return_value)
{
- u32 value = 0;
+ u32 value1 = 0;
+ u32 value2 = 0;
u32 bank_offset;
+ acpi_status status;
ACPI_FUNCTION_TRACE ("Hw_register_read");
if (ACPI_MTX_LOCK == use_lock) {
- if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE))) {
- return_VALUE (0);
+ status = acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
}
}
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);
+ status = acpi_hw_low_level_read (16, &value1, &acpi_gbl_FADT->Xpm1a_evt_blk, 0);
+ if (ACPI_FAILURE (status)) {
+ goto unlock_and_exit;
+ }
+
+ status = acpi_hw_low_level_read (16, &value2, &acpi_gbl_FADT->Xpm1b_evt_blk, 0);
+ value1 |= value2;
break;
case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access*/
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);
+ status = acpi_hw_low_level_read (16, &value1, &acpi_gbl_FADT->Xpm1a_evt_blk, bank_offset);
+ if (ACPI_FAILURE (status)) {
+ goto unlock_and_exit;
+ }
+
+ status = acpi_hw_low_level_read (16, &value2, &acpi_gbl_FADT->Xpm1b_evt_blk, bank_offset);
+ value1 |= value2;
break;
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);
+ status = acpi_hw_low_level_read (16, &value1, &acpi_gbl_FADT->Xpm1a_cnt_blk, 0);
+ if (ACPI_FAILURE (status)) {
+ goto unlock_and_exit;
+ }
+
+ status = acpi_hw_low_level_read (16, &value2, &acpi_gbl_FADT->Xpm1b_cnt_blk, 0);
+ value1 |= value2;
break;
case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
- value = acpi_hw_low_level_read (8, &acpi_gbl_FADT->Xpm2_cnt_blk, 0);
+ status = acpi_hw_low_level_read (8, &value1, &acpi_gbl_FADT->Xpm2_cnt_blk, 0);
break;
case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
- value = acpi_hw_low_level_read (32, &acpi_gbl_FADT->Xpm_tmr_blk, 0);
+ status = acpi_hw_low_level_read (32, &value1, &acpi_gbl_FADT->Xpm_tmr_blk, 0);
break;
case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */
- acpi_os_read_port (acpi_gbl_FADT->smi_cmd, &value, 8);
+ status = acpi_os_read_port (acpi_gbl_FADT->smi_cmd, &value1, 8);
break;
default:
- /* Value will be returned as 0 */
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Register ID: %X\n", register_id));
+ status = AE_BAD_PARAMETER;
break;
}
+unlock_and_exit:
if (ACPI_MTX_LOCK == use_lock) {
(void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
}
- return_VALUE (value);
+ if (ACPI_SUCCESS (status)) {
+ *return_value = value1;
+ }
+
+ return_ACPI_STATUS (status);
}
*
******************************************************************************/
-void
+acpi_status
acpi_hw_register_write (
u8 use_lock,
u32 register_id,
u32 value)
{
u32 bank_offset;
+ acpi_status status;
ACPI_FUNCTION_TRACE ("Hw_register_write");
if (ACPI_MTX_LOCK == use_lock) {
- if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE))) {
- return_VOID;
+ status = acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
}
}
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);
+ status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1a_evt_blk, 0);
+ if (ACPI_FAILURE (status)) {
+ goto unlock_and_exit;
+ }
+
+ status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1b_evt_blk, 0);
break;
case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access*/
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);
+ status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1a_evt_blk, bank_offset);
+ if (ACPI_FAILURE (status)) {
+ goto unlock_and_exit;
+ }
+
+ status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1b_evt_blk, bank_offset);
break;
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);
+ status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1a_cnt_blk, 0);
+ if (ACPI_FAILURE (status)) {
+ goto unlock_and_exit;
+ }
+
+ status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1b_cnt_blk, 0);
break;
case ACPI_REGISTER_PM1A_CONTROL: /* 16-bit access */
- acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1a_cnt_blk, 0);
+ status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1a_cnt_blk, 0);
break;
case ACPI_REGISTER_PM1B_CONTROL: /* 16-bit access */
- acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1b_cnt_blk, 0);
+ status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1b_cnt_blk, 0);
break;
case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
- acpi_hw_low_level_write (8, value, &acpi_gbl_FADT->Xpm2_cnt_blk, 0);
+ status = acpi_hw_low_level_write (8, value, &acpi_gbl_FADT->Xpm2_cnt_blk, 0);
break;
case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
- acpi_hw_low_level_write (32, value, &acpi_gbl_FADT->Xpm_tmr_blk, 0);
+ status = acpi_hw_low_level_write (32, value, &acpi_gbl_FADT->Xpm_tmr_blk, 0);
break;
/* SMI_CMD is currently always in IO space */
- acpi_os_write_port (acpi_gbl_FADT->smi_cmd, value, 8);
+ status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd, (acpi_integer) value, 8);
break;
default:
- value = 0;
+ status = AE_BAD_PARAMETER;
break;
}
+unlock_and_exit:
if (ACPI_MTX_LOCK == use_lock) {
(void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
}
- return_VOID;
+ return_ACPI_STATUS (status);
}
*
******************************************************************************/
-u32
+acpi_status
acpi_hw_low_level_read (
u32 width,
+ u32 *value,
acpi_generic_address *reg,
u32 offset)
{
- u32 value = 0;
ACPI_PHYSICAL_ADDRESS mem_address;
ACPI_IO_ADDRESS io_address;
acpi_pci_id pci_id;
u16 pci_register;
+ acpi_status status;
- ACPI_FUNCTION_ENTRY ();
+ ACPI_FUNCTION_NAME ("Hw_low_level_read");
/*
* Must have a valid pointer to a GAS structure, and
- * a non-zero address within
+ * a non-zero address within. However, don't return an error
+ * because the PM1A/B code must not fail if B isn't present.
*/
if ((!reg) ||
(!ACPI_VALID_ADDRESS (reg->address))) {
- return 0;
+ return (AE_OK);
}
+ *value = 0;
/*
* Three address spaces supported:
switch (reg->address_space_id) {
case ACPI_ADR_SPACE_SYSTEM_MEMORY:
- mem_address = (ACPI_PHYSICAL_ADDRESS) (ACPI_GET_ADDRESS (reg->address) + offset);
+ mem_address = (ACPI_GET_ADDRESS (reg->address)
+ + (ACPI_PHYSICAL_ADDRESS) offset);
- acpi_os_read_memory (mem_address, &value, width);
+ status = acpi_os_read_memory (mem_address, value, width);
break;
case ACPI_ADR_SPACE_SYSTEM_IO:
- io_address = (ACPI_IO_ADDRESS) (ACPI_GET_ADDRESS (reg->address) + offset);
+ io_address = (ACPI_IO_ADDRESS) (ACPI_GET_ADDRESS (reg->address)
+ + (ACPI_PHYSICAL_ADDRESS) offset);
- acpi_os_read_port (io_address, &value, width);
+ status = acpi_os_read_port (io_address, value, width);
break;
pci_id.bus = 0;
pci_id.device = ACPI_PCI_DEVICE (ACPI_GET_ADDRESS (reg->address));
pci_id.function = ACPI_PCI_FUNCTION (ACPI_GET_ADDRESS (reg->address));
- pci_register = (u16) (ACPI_PCI_REGISTER (ACPI_GET_ADDRESS (reg->address)) + offset);
+ pci_register = (u16) (ACPI_PCI_REGISTER (ACPI_GET_ADDRESS (reg->address))
+ + offset);
+
+ status = acpi_os_read_pci_configuration (&pci_id, pci_register, value, width);
+ break;
+
- acpi_os_read_pci_configuration (&pci_id, pci_register, &value, width);
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported address space: %X\n", reg->address_space_id));
+ status = AE_BAD_PARAMETER;
break;
}
- return value;
+ return (status);
}
*
******************************************************************************/
-void
+acpi_status
acpi_hw_low_level_write (
u32 width,
u32 value,
ACPI_IO_ADDRESS io_address;
acpi_pci_id pci_id;
u16 pci_register;
+ acpi_status status;
- ACPI_FUNCTION_ENTRY ();
+ ACPI_FUNCTION_NAME ("Hw_low_level_write");
/*
* Must have a valid pointer to a GAS structure, and
- * a non-zero address within
+ * a non-zero address within. However, don't return an error
+ * because the PM1A/B code must not fail if B isn't present.
*/
if ((!reg) ||
(!ACPI_VALID_ADDRESS (reg->address))) {
- return;
+ return (AE_OK);
}
-
/*
* Three address spaces supported:
* Memory, Io, or PCI config.
switch (reg->address_space_id) {
case ACPI_ADR_SPACE_SYSTEM_MEMORY:
- mem_address = (ACPI_PHYSICAL_ADDRESS) (ACPI_GET_ADDRESS (reg->address) + offset);
+ mem_address = (ACPI_GET_ADDRESS (reg->address)
+ + (ACPI_PHYSICAL_ADDRESS) offset);
- acpi_os_write_memory (mem_address, value, width);
+ status = acpi_os_write_memory (mem_address, (acpi_integer) value, width);
break;
case ACPI_ADR_SPACE_SYSTEM_IO:
- io_address = (ACPI_IO_ADDRESS) (ACPI_GET_ADDRESS (reg->address) + offset);
+ io_address = (ACPI_IO_ADDRESS) (ACPI_GET_ADDRESS (reg->address)
+ + (ACPI_PHYSICAL_ADDRESS) offset);
- acpi_os_write_port (io_address, value, width);
+ status = acpi_os_write_port (io_address, (acpi_integer) value, width);
break;
pci_id.bus = 0;
pci_id.device = ACPI_PCI_DEVICE (ACPI_GET_ADDRESS (reg->address));
pci_id.function = ACPI_PCI_FUNCTION (ACPI_GET_ADDRESS (reg->address));
- pci_register = (u16) (ACPI_PCI_REGISTER (ACPI_GET_ADDRESS (reg->address)) + offset);
+ pci_register = (u16) (ACPI_PCI_REGISTER (ACPI_GET_ADDRESS (reg->address))
+ + offset);
- acpi_os_write_pci_configuration (&pci_id, pci_register, value, width);
+ status = acpi_os_write_pci_configuration (&pci_id, pci_register, (acpi_integer) value, width);
+ break;
+
+
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported address space: %X\n", reg->address_space_id));
+ status = AE_BAD_PARAMETER;
break;
}
+
+ return (status);
}
/******************************************************************************
*
* Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface
- * $Revision: 37 $
+ * $Revision: 45 $
*
*****************************************************************************/
*/
#include "acpi.h"
-#include "acnamesp.h"
-#include "achware.h"
#define _COMPONENT ACPI_HARDWARE
ACPI_MODULE_NAME ("hwsleep")
/* Set the vector */
if (acpi_gbl_common_fACS.vector_width == 32) {
- *(u32 *) acpi_gbl_common_fACS.firmware_waking_vector = (u32) physical_address;
+ *(ACPI_CAST_PTR (u32, acpi_gbl_common_fACS.firmware_waking_vector))
+ = (u32) physical_address;
}
else {
- *acpi_gbl_common_fACS.firmware_waking_vector = physical_address;
+ *acpi_gbl_common_fACS.firmware_waking_vector
+ = physical_address;
}
return_ACPI_STATUS (AE_OK);
/* Get the vector */
if (acpi_gbl_common_fACS.vector_width == 32) {
- *physical_address = *(u32 *) acpi_gbl_common_fACS.firmware_waking_vector;
+ *physical_address = (ACPI_PHYSICAL_ADDRESS)
+ *(ACPI_CAST_PTR (u32, acpi_gbl_common_fACS.firmware_waking_vector));
}
else {
- *physical_address = *acpi_gbl_common_fACS.firmware_waking_vector;
+ *physical_address =
+ *acpi_gbl_common_fACS.firmware_waking_vector;
}
return_ACPI_STATUS (AE_OK);
/*
* _PSW methods could be run here to enable wake-on keyboard, LAN, etc.
*/
- status = acpi_hw_get_sleep_type_data (sleep_state,
+ status = acpi_get_sleep_type_data (sleep_state,
&acpi_gbl_sleep_type_a, &acpi_gbl_sleep_type_b);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
acpi_enter_sleep_state (
u8 sleep_state)
{
- u16 PM1Acontrol;
- u16 PM1Bcontrol;
+ u32 PM1Acontrol;
+ u32 PM1Bcontrol;
ACPI_BIT_REGISTER_INFO *sleep_type_reg_info;
ACPI_BIT_REGISTER_INFO *sleep_enable_reg_info;
+ u32 in_value;
+ acpi_status status;
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_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 */
- acpi_hw_bit_register_write (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_LOCK);
- acpi_hw_clear_acpi_status();
+ status = acpi_set_register (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_LOCK);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
- /* TBD: Disable arbitration here? */
+ status = acpi_hw_clear_acpi_status();
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
- acpi_hw_disable_non_wakeup_gpes();
+ /* Disable BM arbitration */
+
+ status = acpi_set_register (ACPI_BITREG_ARB_DISABLE, 1, ACPI_MTX_LOCK);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+
+ status = acpi_hw_disable_non_wakeup_gpes();
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
/* Get current value of PM1A control */
- PM1Acontrol = (u16) acpi_hw_register_read (ACPI_MTX_LOCK, ACPI_REGISTER_PM1_CONTROL);
+ status = acpi_hw_register_read (ACPI_MTX_LOCK, ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
ACPI_DEBUG_PRINT ((ACPI_DB_OK, "Entering S%d\n", sleep_state));
/* Clear SLP_EN and SLP_TYP fields */
/* Write #1: fill in SLP_TYP data */
- acpi_hw_register_write (ACPI_MTX_LOCK, ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol);
- acpi_hw_register_write (ACPI_MTX_LOCK, ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol);
+ status = acpi_hw_register_write (ACPI_MTX_LOCK, ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+
+ status = acpi_hw_register_write (ACPI_MTX_LOCK, ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
/* Insert SLP_ENABLE bit */
PM1Bcontrol |= sleep_enable_reg_info->access_bit_mask;
/* Write #2: SLP_TYP + SLP_EN */
- ACPI_FLUSH_CPU_CACHE();
- acpi_hw_register_write (ACPI_MTX_LOCK, ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol);
- acpi_hw_register_write (ACPI_MTX_LOCK, ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol);
+ ACPI_FLUSH_CPU_CACHE ();
+
+ status = acpi_hw_register_write (ACPI_MTX_LOCK, ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+
+ status = acpi_hw_register_write (ACPI_MTX_LOCK, ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
/*
* 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_hw_register_write (ACPI_MTX_LOCK, ACPI_REGISTER_PM1_CONTROL,
- sleep_enable_reg_info->access_bit_mask);
+ /*
+ * We wait so long to allow chipsets that poll this reg very slowly to
+ * still read the right value. Ideally, this entire block would go
+ * away entirely.
+ */
+ acpi_os_stall (10000000);
+
+ status = acpi_hw_register_write (ACPI_MTX_LOCK, ACPI_REGISTER_PM1_CONTROL,
+ sleep_enable_reg_info->access_bit_mask);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
}
/* Wait until we enter sleep state */
- while (!acpi_hw_bit_register_read (ACPI_BITREG_WAKE_STATUS, ACPI_MTX_LOCK)) {
+ do {
+ status = acpi_get_register (ACPI_BITREG_WAKE_STATUS, &in_value, ACPI_MTX_LOCK);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+
/* Spin until we wake */
- }
+
+ } while (!in_value);
return_ACPI_STATUS (AE_OK);
}
/* _WAK returns stuff - do we want to look at it? */
- acpi_hw_enable_non_wakeup_gpes();
+ status = acpi_hw_enable_non_wakeup_gpes();
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
- return_ACPI_STATUS (AE_OK);
+ /* Disable BM arbitration */
+ status = acpi_set_register (ACPI_BITREG_ARB_DISABLE, 0, ACPI_MTX_LOCK);
+
+ return_ACPI_STATUS (status);
}
/******************************************************************************
*
* Name: hwtimer.c - ACPI Power Management Timer Interface
- * $Revision: 20 $
+ * $Revision: 21 $
*
*****************************************************************************/
*/
#include "acpi.h"
-#include "achware.h"
#define _COMPONENT ACPI_HARDWARE
ACPI_MODULE_NAME ("hwtimer")
acpi_get_timer (
u32 *ticks)
{
+ acpi_status status;
+
+
ACPI_FUNCTION_TRACE ("Acpi_get_timer");
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- *ticks = acpi_hw_low_level_read (32, &acpi_gbl_FADT->Xpm_tmr_blk, 0);
+ status = acpi_hw_low_level_read (32, ticks, &acpi_gbl_FADT->Xpm_tmr_blk, 0);
- return_ACPI_STATUS (AE_OK);
+ return_ACPI_STATUS (status);
}
/******************************************************************************
*
* Name: acconfig.h - Global configuration constants
- * $Revision: 96 $
+ * $Revision: 102 $
*
*****************************************************************************/
/* Version string */
-#define ACPI_CA_VERSION 0x20020403
+#define ACPI_CA_VERSION 0x20020517
/* Version of ACPI supported */
/******************************************************************************
*
* Name: acdebug.h - ACPI/AML debugger
- * $Revision: 58 $
+ * $Revision: 61 $
*
*****************************************************************************/
* dbapi - external debugger interfaces
*/
-int
+acpi_status
acpi_db_initialize (
void);
* dbcmds - debug commands and output routines
*/
-
void
acpi_db_display_table_info (
NATIVE_CHAR *table_arg);
acpi_db_display_resources (
NATIVE_CHAR *object_arg);
+void
+acpi_db_check_integrity (
+ void);
+
+acpi_status
+acpi_db_integrity_walk (
+ acpi_handle obj_handle,
+ u32 nesting_level,
+ void *context,
+ void **return_value);
+
+acpi_status
+acpi_db_walk_and_match_name (
+ acpi_handle obj_handle,
+ u32 nesting_level,
+ void *context,
+ void **return_value);
+
+acpi_status
+acpi_db_walk_for_references (
+ acpi_handle obj_handle,
+ u32 nesting_level,
+ void *context,
+ void **return_value);
+
+acpi_status
+acpi_db_walk_for_specific_objects (
+ acpi_handle obj_handle,
+ u32 nesting_level,
+ void *context,
+ void **return_value);
+
/*
* dbdisasm - AML disassembler
acpi_db_decode_internal_object (
acpi_operand_object *obj_desc);
+u32
+acpi_db_block_type (
+ acpi_parse_object *op);
+
+acpi_status
+acpi_ps_display_object_pathname (
+ acpi_walk_state *walk_state,
+ acpi_parse_object *op);
+
/*
* dbdisply - debug display commands
*/
-
void
acpi_db_display_method_info (
acpi_parse_object *op);
acpi_operand_object *obj_desc,
acpi_walk_state *walk_state);
+void
+acpi_db_dump_parser_descriptor (
+ acpi_parse_object *op);
+
+void *
+acpi_db_get_pointer (
+ void *target);
+
/*
* dbexec - debugger control method execution
NATIVE_CHAR *num_loops_arg,
NATIVE_CHAR *method_name_arg);
+acpi_status
+acpi_db_execute_method (
+ acpi_db_method_info *info,
+ acpi_buffer *return_obj);
+
+void
+acpi_db_execute_setup (
+ acpi_db_method_info *info);
+
+u32
+acpi_db_get_outstanding_allocations (
+ void);
+
+void ACPI_SYSTEM_XFACE
+acpi_db_method_thread (
+ void *context);
+
/*
* dbfileio - Debugger file I/O commands
NATIVE_CHAR *user_argument,
ARGUMENT_INFO *arguments);
+acpi_status
+ae_local_load_table (
+ acpi_table_header *table_ptr);
void
acpi_db_close_debug_file (
NATIVE_CHAR prompt,
acpi_parse_object *op);
+void
+acpi_db_display_help (
+ NATIVE_CHAR *help_type);
+
+NATIVE_CHAR *
+acpi_db_get_next_token (
+ NATIVE_CHAR *string,
+ NATIVE_CHAR **next);
+
+u32
+acpi_db_get_line (
+ NATIVE_CHAR *input_buffer);
+
+u32
+acpi_db_match_command (
+ NATIVE_CHAR *user_command);
+
+void
+acpi_db_single_thread (
+ void);
+
/*
* dbstats - Generation and display of ACPI table statistics
acpi_db_display_statistics (
NATIVE_CHAR *type_arg);
+acpi_status
+acpi_db_classify_one_object (
+ acpi_handle obj_handle,
+ u32 nesting_level,
+ void *context,
+ void **return_value);
+
+void
+acpi_db_count_namespace_objects (
+ void);
+
+void
+acpi_db_enumerate_object (
+ acpi_operand_object *obj_desc);
+
/*
* dbutils - AML debugger utilities
/******************************************************************************
*
* Name: acdispat.h - dispatcher (parser to interpreter interface)
- * $Revision: 52 $
+ * $Revision: 54 $
*
*****************************************************************************/
/* dsopcode - support for late evaluation */
+acpi_status
+acpi_ds_execute_arguments (
+ acpi_namespace_node *node,
+ acpi_namespace_node *scope_node,
+ u32 aml_length,
+ u8 *aml_start);
+
acpi_status
acpi_ds_get_buffer_field_arguments (
acpi_operand_object *obj_desc);
acpi_ds_get_package_arguments (
acpi_operand_object *obj_desc);
+acpi_status
+acpi_ds_init_buffer_field (
+ u16 aml_opcode,
+ acpi_operand_object *obj_desc,
+ acpi_operand_object *buffer_desc,
+ acpi_operand_object *offset_desc,
+ acpi_operand_object *length_desc,
+ acpi_operand_object *result_desc);
+
+acpi_status
+acpi_ds_eval_buffer_field_operands (
+ acpi_walk_state *walk_state,
+ acpi_parse_object *op);
+
+acpi_status
+acpi_ds_eval_region_operands (
+ acpi_walk_state *walk_state,
+ acpi_parse_object *op);
+
+acpi_status
+acpi_ds_eval_data_object_operands (
+ acpi_walk_state *walk_state,
+ acpi_parse_object *op,
+ acpi_operand_object *obj_desc);
+
+acpi_status
+acpi_ds_initialize_region (
+ acpi_handle obj_handle);
+
/* dsctrl - Parser/Interpreter interface, control stack routines */
/* dsfield - Parser/Interpreter interface for AML fields */
+acpi_status
+acpi_ds_get_field_names (
+ ACPI_CREATE_FIELD_INFO *info,
+ acpi_walk_state *walk_state,
+ acpi_parse_object *arg);
+
acpi_status
acpi_ds_create_field (
acpi_parse_object *op,
acpi_walk_state *walk_state,
acpi_operand_object ***node);
-acpi_status
+void
acpi_ds_method_data_delete_all (
acpi_walk_state *walk_state);
acpi_walk_state *walk_state,
acpi_operand_object **dest_desc);
-acpi_status
+void
acpi_ds_method_data_delete_value (
u16 opcode,
u32 index,
acpi_walk_state *walk_state,
acpi_namespace_node **node);
-acpi_status
+void
acpi_ds_method_data_init (
acpi_walk_state *walk_state);
acpi_parse_object *op);
-/* dsregn - Parser/Interpreter interface - Op Region parsing */
-
-acpi_status
-acpi_ds_eval_buffer_field_operands (
- acpi_walk_state *walk_state,
- acpi_parse_object *op);
-
-acpi_status
-acpi_ds_eval_region_operands (
- acpi_walk_state *walk_state,
- acpi_parse_object *op);
-
-acpi_status
-acpi_ds_eval_data_object_operands (
- acpi_walk_state *walk_state,
- acpi_parse_object *op,
- acpi_operand_object *obj_desc);
-
-acpi_status
-acpi_ds_initialize_region (
- acpi_handle obj_handle);
-
-
/* dsutils - Parser/Interpreter interface utility routines */
u8
/******************************************************************************
*
* Name: acevents.h - Event subcomponent prototypes and defines
- * $Revision: 76 $
+ * $Revision: 79 $
*
*****************************************************************************/
acpi_ev_acquire_global_lock(
u32 timeout);
-void
+acpi_status
acpi_ev_release_global_lock(
void);
*/
acpi_status
-acpi_ev_install_default_address_space_handlers (
+acpi_ev_init_address_spaces (
void);
acpi_status
u32 function,
ACPI_PHYSICAL_ADDRESS address,
u32 bit_width,
- acpi_integer *value);
+ void *value);
acpi_status
acpi_ev_addr_handler_helper (
void *context,
void **return_value);
-void
-acpi_ev_disassociate_region_from_handler(
- acpi_operand_object *region_obj,
- u8 acpi_ns_is_locked);
-
acpi_status
-acpi_ev_associate_region_and_handler (
+acpi_ev_attach_region (
acpi_operand_object *handler_obj,
acpi_operand_object *region_obj,
u8 acpi_ns_is_locked);
+void
+acpi_ev_detach_region (
+ acpi_operand_object *region_obj,
+ u8 acpi_ns_is_locked);
+
/*
* Evregini - Region initialization and setup
/******************************************************************************
*
* Name: acexcep.h - Exception codes returned by the ACPI subsystem
- * $Revision: 59 $
+ * $Revision: 63 $
*
*****************************************************************************/
#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_INVALID_TABLE_LENGTH (acpi_status) (0x0006 | AE_CODE_ACPI_TABLES)
-#define AE_CODE_TBL_MAX 0x0005
+#define AE_CODE_TBL_MAX 0x0006
/*
#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_AML_ALIGNMENT (acpi_status) (0x001D | AE_CODE_AML)
+#define AE_AML_NO_RESOURCE_END_TAG (acpi_status) (0x001E | AE_CODE_AML)
+#define AE_AML_BAD_RESOURCE_VALUE (acpi_status) (0x001F | AE_CODE_AML)
-#define AE_CODE_AML_MAX 0x001C
+#define AE_CODE_AML_MAX 0x001F
/*
* Internal exceptions used for control
"AE_BAD_HEADER",
"AE_BAD_CHECKSUM",
"AE_BAD_VALUE",
- "AE_TABLE_NOT_SUPPORTED"
+ "AE_TABLE_NOT_SUPPORTED",
+ "AE_INVALID_TABLE_LENGTH"
};
NATIVE_CHAR const *acpi_gbl_exception_names_aml[] =
"AE_AML_INVALID_RESOURCE_TYPE",
"AE_AML_INVALID_INDEX",
"AE_AML_REGISTER_LIMIT",
- "AE_AML_NO_WHILE"
+ "AE_AML_NO_WHILE",
+ "AE_AML_ALIGNMENT",
+ "AE_AML_NO_RESOURCE_END_TAG",
+ "AE_AML_BAD_RESOURCE_VALUE"
};
NATIVE_CHAR const *acpi_gbl_exception_names_ctrl[] =
/******************************************************************************
*
* Name: acglobal.h - Declarations for global variables
- * $Revision: 121 $
+ * $Revision: 125 $
*
*****************************************************************************/
ACPI_EXTERN FACS_DESCRIPTOR *acpi_gbl_FACS;
ACPI_EXTERN acpi_common_facs acpi_gbl_common_fACS;
+/*
+ * Handle both ACPI 1.0 and ACPI 2.0 Integer widths
+ * If we are running a method that exists in a 32-bit ACPI table.
+ * Use only 32 bits of the Integer for conversion.
+ */
+ACPI_EXTERN u8 acpi_gbl_integer_bit_width;
+ACPI_EXTERN u8 acpi_gbl_integer_byte_width;
+
/*
* Since there may be multiple SSDTs and PSDTS, a single pointer is not
* sufficient; Therefore, there isn't one!
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 ACPI_INIT_HANDLER acpi_gbl_init_handler;
ACPI_EXTERN acpi_walk_state *acpi_gbl_breakpoint_walk;
ACPI_EXTERN acpi_handle acpi_gbl_global_lock_semaphore;
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];
+extern const acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES];
/*****************************************************************************
*
****************************************************************************/
-ACPI_EXTERN ACPI_BIT_REGISTER_INFO acpi_gbl_bit_register_info[ACPI_NUM_BITREG];
+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;
#ifdef ENABLE_DEBUGGER
-ACPI_EXTERN u8 acpi_gbl_method_executing;
-ACPI_EXTERN u8 acpi_gbl_db_terminate_threads;
+extern u8 acpi_gbl_method_executing;
+extern u8 acpi_gbl_db_terminate_threads;
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;
/******************************************************************************
*
* Name: achware.h -- hardware specific interfaces
- * $Revision: 58 $
+ * $Revision: 60 $
*
*****************************************************************************/
acpi_hw_get_bit_register_info (
u32 register_id);
-u32
-acpi_hw_bit_register_read (
- u32 register_id,
- u32 flags);
-
-u32
-acpi_hw_bit_register_write (
- u32 register_id,
- u32 value,
- u32 flags);
-
-u32
+acpi_status
acpi_hw_register_read (
u8 use_lock,
- u32 register_id);
+ u32 register_id,
+ u32 *return_value);
-void
+acpi_status
acpi_hw_register_write (
u8 use_lock,
u32 register_id,
u32 value);
-u32
+acpi_status
acpi_hw_low_level_read (
u32 width,
+ u32 *value,
acpi_generic_address *reg,
u32 offset);
-void
+acpi_status
acpi_hw_low_level_write (
u32 width,
u32 value,
acpi_generic_address *reg,
u32 offset);
-void
+acpi_status
acpi_hw_clear_acpi_status (
void);
/* GPE support */
-void
+u8
+acpi_hw_get_gpe_bit_mask (
+ u32 gpe_number);
+
+acpi_status
acpi_hw_enable_gpe (
u32 gpe_number);
acpi_hw_enable_gpe_for_wakeup (
u32 gpe_number);
-void
+acpi_status
acpi_hw_disable_gpe (
u32 gpe_number);
acpi_hw_disable_gpe_for_wakeup (
u32 gpe_number);
-void
+acpi_status
acpi_hw_clear_gpe (
u32 gpe_number);
-void
+acpi_status
acpi_hw_get_gpe_status (
u32 gpe_number,
acpi_event_status *event_status);
-void
+acpi_status
acpi_hw_disable_non_wakeup_gpes (
void);
-void
+acpi_status
acpi_hw_enable_non_wakeup_gpes (
void);
-/* Sleep Prototypes */
-
-acpi_status
-acpi_hw_get_sleep_type_data (
- u8 sleep_state,
- u8 *slp_typ_a,
- u8 *slp_typ_b);
-
-
/* ACPI Timer prototypes */
acpi_status
/******************************************************************************
*
* Name: acinterp.h - Interpreter subcomponent prototypes and defines
- * $Revision: 133 $
+ * $Revision: 137 $
*
*****************************************************************************/
acpi_operand_object **stack_ptr,
acpi_walk_state *walk_state);
+acpi_status
+acpi_ex_check_object_type (
+ acpi_object_type type_needed,
+ acpi_object_type this_type,
+ void *object);
/*
* exxface - External interpreter interfaces
acpi_operand_object **result_desc,
acpi_walk_state *walk_state);
+u32
+acpi_ex_convert_to_ascii (
+ acpi_integer integer,
+ u32 base,
+ u8 *string);
/*
* exfield - ACPI AML (p-code) execution - field manipulation
acpi_ex_opcode_6A_0T_1R (
acpi_walk_state *walk_state);
+u8
+acpi_ex_do_match (
+ u32 match_op,
+ acpi_integer package_value,
+ acpi_integer match_value);
+
acpi_status
acpi_ex_get_object_reference (
acpi_operand_object *obj_desc,
acpi_operand_object *obj_desc,
acpi_walk_state *walk_state);
-acpi_status
+void
acpi_ex_release_all_mutexes (
ACPI_THREAD_STATE *thread);
*/
void
-acpi_ex_show_hex_value (
- u32 byte_count,
- u8 *aml_start,
- u32 lead_space);
-
-
-acpi_status
acpi_ex_dump_operand (
acpi_operand_object *entry_desc);
acpi_operand_object *object,
u32 flags);
-
void
acpi_ex_dump_node (
acpi_namespace_node *node,
u32 flags);
+void
+acpi_ex_out_string (
+ char *title,
+ char *value);
+
+void
+acpi_ex_out_pointer (
+ char *title,
+ void *value);
+
+void
+acpi_ex_out_integer (
+ char *title,
+ u32 value);
+
+void
+acpi_ex_out_address (
+ char *title,
+ ACPI_PHYSICAL_ADDRESS value);
+
/*
* exnames - interpreter/scanner name load/execute
acpi_ex_acquire_global_lock (
u32 rule);
-acpi_status
+void
acpi_ex_release_global_lock (
u8 locked);
acpi_integer value,
u32 base);
-acpi_status
+void
acpi_ex_eisa_id_to_string (
u32 numeric_id,
NATIVE_CHAR *out_string);
-acpi_status
+void
acpi_ex_unsigned_integer_to_string (
acpi_integer value,
NATIVE_CHAR *out_string);
/******************************************************************************
*
* Name: aclocal.h - Internal data types used across the ACPI subsystem
- * $Revision: 162 $
+ * $Revision: 167 $
*
*****************************************************************************/
#define ACPI_LOGICAL_ADDRESSING 0x00
#define ACPI_PHYSICAL_ADDRESSING 0x01
-/* Object descriptor types */
-
-#define ACPI_CACHED_OBJECT 0x11 /* ORed in when object is cached */
-#define ACPI_DESC_TYPE_STATE 0x20
-#define ACPI_DESC_TYPE_STATE_UPDATE 0x21
-#define ACPI_DESC_TYPE_STATE_PACKAGE 0x22
-#define ACPI_DESC_TYPE_STATE_CONTROL 0x23
-#define ACPI_DESC_TYPE_STATE_RPSCOPE 0x24
-#define ACPI_DESC_TYPE_STATE_PSCOPE 0x25
-#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
-#define ACPI_DESC_TYPE_NAMED 0xAA
+/* Total number of aml opcodes defined */
+
+#define AML_NUM_OPCODES 0x7E
/*****************************************************************************
u8 *aml_start;
u64 physical_address;
u32 aml_length;
- u32 length;
+ ACPI_SIZE length;
u32 count;
acpi_owner_id table_id;
u8 type;
/* Forward declarations */
struct acpi_walk_state;
-struct acpi_parse_obj;
struct acpi_obj_mutex;
+union acpi_parse_obj;
#define ACPI_STATE_COMMON /* Two 32-bit fields and a pointer */\
typedef struct acpi_control_state
{
ACPI_STATE_COMMON
- struct acpi_parse_obj *predicate_op;
+ union acpi_parse_obj *predicate_op;
u8 *aml_predicate_start; /* Start of if/while predicate */
u8 *package_end; /* End of if/while block */
u16 opcode;
typedef struct acpi_pscope_state
{
ACPI_STATE_COMMON
- struct acpi_parse_obj *op; /* current op being parsed */
+ union 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 */
typedef
acpi_status (*acpi_parse_downwards) (
struct acpi_walk_state *walk_state,
- struct acpi_parse_obj **out_op);
+ union acpi_parse_obj **out_op);
typedef
acpi_status (*acpi_parse_upwards) (
NATIVE_CHAR *string; /* NULL terminated string */
u8 *buffer; /* buffer or string */
NATIVE_CHAR *name; /* NULL terminated string */
- struct acpi_parse_obj *arg; /* arguments and contained ops */
+ union acpi_parse_obj *arg; /* arguments and contained ops */
} acpi_parse_value;
#define ACPI_PARSE_COMMON \
u8 data_type; /* To differentiate various internal objs */\
u8 flags; /* Type of Op */\
- u16 opcode; /* AML opcode */\
+ u16 aml_opcode; /* AML opcode */\
u32 aml_offset; /* offset of declaration in AML */\
- struct acpi_parse_obj *parent; /* parent op */\
- struct acpi_parse_obj *next; /* next op */\
+ union acpi_parse_obj *parent; /* parent op */\
+ union acpi_parse_obj *next; /* next op */\
ACPI_DEBUG_ONLY_MEMBERS (\
- NATIVE_CHAR op_name[16]) /* op name (debug only) */\
+ NATIVE_CHAR aml_op_name[16]) /* op name (debug only) */\
/* NON-DEBUG members below: */\
acpi_namespace_node *node; /* for use by interpreter */\
acpi_parse_value value; /* Value or args associated with the opcode */\
/*
* generic operation (eg. If, While, Store)
*/
-typedef struct acpi_parse_obj
+typedef struct acpi_parseobj_common
{
ACPI_PARSE_COMMON
-} acpi_parse_object;
+} ACPI_PARSE_OBJ_COMMON;
/*
* Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and Op_regions),
* and bytelists.
*/
-typedef struct acpi_parse2_obj
+typedef struct acpi_parseobj_named
{
ACPI_PARSE_COMMON
u8 *data; /* AML body or bytelist data */
u32 length; /* AML length */
u32 name; /* 4-byte name or zero if no name */
-} acpi_parse2_object;
+} ACPI_PARSE_OBJ_NAMED;
+
+
+/* The parse node is the fundamental element of the parse tree */
+
+typedef struct acpi_parseobj_asl
+{
+ ACPI_PARSE_COMMON
+
+ union acpi_parse_obj *child;
+
+
+ union acpi_parse_obj *parent_method;
+ char *filename;
+ char *external_name;
+ char *namepath;
+ u32 extra_value;
+ u32 column;
+ u32 line_number;
+ u32 logical_line_number;
+ u32 logical_byte_offset;
+ u32 end_line;
+ u32 end_logical_line;
+ u16 parse_opcode;
+ u32 acpi_btype;
+ u32 aml_length;
+ u32 aml_subtree_length;
+ u32 final_aml_length;
+ u32 final_aml_offset;
+ u8 aml_opcode_length;
+ u8 aml_pkg_len_bytes;
+ u16 compile_flags;
+ u8 extra;
+ char parse_op_name[12];
+
+} ACPI_PARSE_OBJ_ASL;
+
+
+typedef union acpi_parse_obj
+{
+ ACPI_PARSE_OBJ_COMMON common;
+ ACPI_PARSE_OBJ_NAMED named;
+ ACPI_PARSE_OBJ_ASL asl;
+
+} acpi_parse_object;
/*
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 */
+ union 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;
+ union acpi_parse_obj *start_scope;
} acpi_parse_state;
#define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x09
-/*
- * Bit_register IDs
- * These are bitfields defined within the full ACPI registers
- */
-#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_ASCII_ZERO 0x30
+
/*****************************************************************************
*
* Debugger
/******************************************************************************
*
* Name: acmacros.h - C macros for the entire subsystem.
- * $Revision: 115 $
+ * $Revision: 123 $
*
*****************************************************************************/
* Data manipulation macros
*/
-#define ACPI_LOWORD(l) ((u16)(NATIVE_UINT)(l))
-#define ACPI_HIWORD(l) ((u16)((((NATIVE_UINT)(l)) >> 16) & 0xFFFF))
+#define ACPI_LOWORD(l) ((u16)(u32)(l))
+#define ACPI_HIWORD(l) ((u16)((((u32)(l)) >> 16) & 0xFFFF))
#define ACPI_LOBYTE(l) ((u8)(u16)(l))
#define ACPI_HIBYTE(l) ((u8)((((u16)(l)) >> 8) & 0xFF))
-#ifdef _IA16
+#if ACPI_MACHINE_WIDTH == 16
+
/*
* For 16-bit addresses, we have to assume that the upper 32 bits
* are zero.
*/
-#define ACPI_LODWORD(l) (l)
-#define ACPI_HIDWORD(l) (0)
+#define ACPI_LODWORD(l) ((u32)(l))
+#define ACPI_HIDWORD(l) ((u32)(0))
#define ACPI_GET_ADDRESS(a) ((a).lo)
-#define ACPI_STORE_ADDRESS(a,b) {(a).hi=0;(a).lo=(b);}
+#define ACPI_STORE_ADDRESS(a,b) {(a).hi=0;(a).lo=(u32)(b);}
#define ACPI_VALID_ADDRESS(a) ((a).hi | (a).lo)
#else
* acpi_integer is 32-bits, no 64-bit support on this platform
*/
#define ACPI_LODWORD(l) ((u32)(l))
-#define ACPI_HIDWORD(l) (0)
+#define ACPI_HIDWORD(l) ((u32)(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
*/
#define ACPI_LODWORD(l) ((u32)(u64)(l))
-#define ACPI_HIDWORD(l) ((u32)(((*(uint64_struct *)(&l))).hi))
+#define ACPI_HIDWORD(l) ((u32)(((*(uint64_struct *)(void *)(&l))).hi))
#define ACPI_GET_ADDRESS(a) (a)
-#define ACPI_STORE_ADDRESS(a,b) ((a)=(b))
+#define ACPI_STORE_ADDRESS(a,b) ((a)=(ACPI_PHYSICAL_ADDRESS)(b))
#define ACPI_VALID_ADDRESS(a) (a)
#endif
#endif
/* Pointer arithmetic */
-#define ACPI_PTR_ADD(t,a,b) (t *) ((char *)(a) + (b))
+#define ACPI_PTR_ADD(t,a,b) (t *) (void *)((char *)(a) + (NATIVE_UINT)(b))
#define ACPI_PTR_DIFF(a,b) (NATIVE_UINT) ((char *)(a) - (char *)(b))
/* Pointer/Integer type conversions */
-#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)
+#define ACPI_TO_POINTER(i) ACPI_PTR_ADD (void, (void *) NULL,(NATIVE_UINT)i)
+#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,(void *) NULL)
+#define ACPI_OFFSET(d,f) (ACPI_SIZE) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL)
+#define ACPI_FADT_OFFSET(f) ACPI_OFFSET (FADT_DESCRIPTOR, f)
+#define ACPI_CAST_PTR(t, p) ((t *)(void *)(p))
+#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **)(void *)(p))
-#ifdef _IA16
+#if ACPI_MACHINE_WIDTH == 16
+#define ACPI_STORE_POINTER(d,s) ACPI_MOVE_UNALIGNED32_TO_32(d,s)
#define ACPI_PHYSADDR_TO_PTR(i) (void *)(i)
-#define ACPI_PTR_TO_PHYSADDR(i) (char *)(i)
+#define ACPI_PTR_TO_PHYSADDR(i) (u32) (char *)(i)
#else
#define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i)
#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i)
/* The hardware supports unaligned transfers, just do the move */
-#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)
+#define ACPI_MOVE_UNALIGNED16_TO_16(d,s) *(u16 *)(void *)(d) = *(u16 *)(void *)(s)
+#define ACPI_MOVE_UNALIGNED32_TO_32(d,s) *(u32 *)(void *)(d) = *(u32 *)(void *)(s)
+#define ACPI_MOVE_UNALIGNED16_TO_32(d,s) *(u32 *)(void *)(d) = *(u16 *)(void *)(s)
+#define ACPI_MOVE_UNALIGNED64_TO_64(d,s) *(u64 *)(void *)(d) = *(u64 *)(void *)(s)
#else
/*
* the destination (or both) is/are unaligned.
*/
-#define ACPI_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 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\
+ ((u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];}
-#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 ACPI_MOVE_UNALIGNED32_TO_32(d,s) {((u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\
+ ((u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\
+ ((u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[2];\
+ ((u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[3];}
-#define ACPI_MOVE_UNALIGNED16_TO_32(d,s) {(*(u32*)(d)) = 0; ACPI_MOVE_UNALIGNED16_TO_16(d,s);}
+#define ACPI_MOVE_UNALIGNED16_TO_32(d,s) {(*(u32*)(void *)(d)) = 0; ACPI_MOVE_UNALIGNED16_TO_16(d,s);}
-#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];}
+#define ACPI_MOVE_UNALIGNED64_TO_64(d,s) {((u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\
+ ((u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\
+ ((u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[2];\
+ ((u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[3];\
+ ((u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[4];\
+ ((u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[5];\
+ ((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[6];\
+ ((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[7];}
#endif
/*
* Rounding macros (Power of two boundaries only)
*/
-#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 ACPI_ROUND_DOWN(value,boundary) (((NATIVE_UINT)(value)) & (~(((NATIVE_UINT) boundary)-1)))
+#define ACPI_ROUND_UP(value,boundary) ((((NATIVE_UINT)(value)) + (((NATIVE_UINT) boundary)-1)) & (~(((NATIVE_UINT) boundary)-1)))
#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)
* 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 ACPI_MASK_BITS_ABOVE(position) (~(((acpi_integer)(-1)) << ((u32) (position))))
-#define ACPI_MASK_BITS_BELOW(position) (((acpi_integer)(-1)) << ((u32) (position)))
+#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((u32) (position))))
+#define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((u32) (position)))
#define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7'))
/* Macros for GAS addressing */
-#ifndef _IA16
+#if ACPI_MACHINE_WIDTH != 16
#define ACPI_PCI_DEVICE_MASK (u64) 0x0000FFFF00000000
#define ACPI_PCI_FUNCTION_MASK (u64) 0x00000000FFFF0000
#define ACPI_PCI_REGISTER_MASK (u64) 0x000000000000FFFF
-#define ACPI_PCI_FUNCTION(a) (u16) ((((a) & ACPI_PCI_FUNCTION_MASK) >> 16))
-#define ACPI_PCI_DEVICE(a) (u16) ((((a) & ACPI_PCI_DEVICE_MASK) >> 32))
-#define ACPI_PCI_REGISTER(a) (u16) (((a) & ACPI_PCI_REGISTER_MASK))
+/*
+ * Obsolete
+ */
+
+/*
+#define ACPI_PCI_FUNCTION(a) (u16) ((((u64)((u64)(a) & ACPI_PCI_FUNCTION_MASK)) >> 16))
+#define ACPI_PCI_DEVICE(a) (u16) ((((u64)((u64)(a) & ACPI_PCI_DEVICE_MASK)) >> 32))
+#define ACPI_PCI_REGISTER(a) (u16) (((u64)((u64)(a) & ACPI_PCI_REGISTER_MASK)))
+*/
+
+
+#define ACPI_PCI_DEVICE(a) (u16) ((ACPI_HIDWORD ((a))) & 0x0000FFFF)
+#define ACPI_PCI_FUNCTION(a) (u16) ((ACPI_LODWORD ((a))) >> 16)
+#define ACPI_PCI_REGISTER(a) (u16) ((ACPI_LODWORD ((a))) & 0x0000FFFF)
#else
*
* The "Descriptor" field is the first field in both structures.
*/
-#define ACPI_GET_DESCRIPTOR_TYPE(d) (((acpi_namespace_node *)d)->descriptor)
-#define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((acpi_namespace_node *)d)->descriptor = t)
+#define ACPI_GET_DESCRIPTOR_TYPE(d) (((ACPI_DESCRIPTOR *)(void *)(d))->descriptor_id)
+#define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((ACPI_DESCRIPTOR *)(void *)(d))->descriptor_id = t)
/* Macro to test the object type */
-#define ACPI_GET_OBJECT_TYPE(d) (((acpi_operand_object *)d)->common.type)
+#define ACPI_GET_OBJECT_TYPE(d) (((acpi_operand_object *)(void *)d)->common.type)
/* Macro to check the table flags for SINGLE or MULTIPLE tables are allowed */
* as a pointer to an acpi_table_header. (b+1) then points past the header,
* and ((u8 *)b+b->Length) points one byte past the end of the table.
*/
-#ifndef _IA16
+#if ACPI_MACHINE_WIDTH != 16
#define ACPI_IS_IN_ACPI_TABLE(a,b) (((u8 *)(a) >= (u8 *)(b + 1)) &&\
((u8 *)(a) < ((u8 *)b + b->length)))
/*
* Macros for the master AML opcode table
*/
-#ifdef ACPI_DEBUG
+#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER)
#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,obj_type,class,type,flags) {Pargs,Iargs,flags,obj_type,class,type}
a.register_bit_width = (u8) ACPI_MUL_8 (b);\
a.register_bit_offset = 0;\
a.reserved = 0;\
- ACPI_STORE_ADDRESS (a.address,c);}
+ ACPI_STORE_ADDRESS (a.address,(ACPI_PHYSICAL_ADDRESS) c);}
/* ACPI V1.0 entries -- address space is always I/O */
* One of the FUNCTION_TRACE macros above must be used in conjunction with these macros
* so that "_Proc_name" is defined.
*/
-#define return_VOID {acpi_ut_exit(__LINE__,&_dbg);return;}
-#define return_ACPI_STATUS(s) {acpi_ut_status_exit(__LINE__,&_dbg,s);return(s);}
-#define return_VALUE(s) {acpi_ut_value_exit(__LINE__,&_dbg,s);return(s);}
-#define return_PTR(s) {acpi_ut_ptr_exit(__LINE__,&_dbg,(u8 *)s);return(s);}
+#ifdef ACPI_USE_DO_WHILE_0
+#define ACPI_DO_WHILE0(a) do a while(0)
+#else
+#define ACPI_DO_WHILE0(a) a
+#endif
+#define return_VOID ACPI_DO_WHILE0 ({acpi_ut_exit(__LINE__,&_dbg);return;})
+#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({acpi_ut_status_exit(__LINE__,&_dbg,(s));return((s));})
+#define return_VALUE(s) ACPI_DO_WHILE0 ({acpi_ut_value_exit(__LINE__,&_dbg,(acpi_integer)(s));return((s));})
+#define return_PTR(s) ACPI_DO_WHILE0 ({acpi_ut_ptr_exit(__LINE__,&_dbg,(u8 *)(s));return((s));})
/* Conditional execution */
#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_PATHNAME(a,b,c,d) (void) 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))
#define return_VALUE(s) return(s)
#define return_PTR(s) return(s)
+#ifdef ENABLE_DEBUGGER
+#define _OPCODE_NAMES
+#endif
+
#endif
/*
* For 16-bit code, we want to shrink some things even though
* we are using ACPI_DEBUG to get the debug output
*/
-#ifdef _IA16
+#if ACPI_MACHINE_WIDTH == 16
#undef ACPI_DEBUG_ONLY_MEMBERS
#undef _VERBOSE_STRUCTURES
#define ACPI_DEBUG_ONLY_MEMBERS(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_ALLOCATE(a) acpi_ut_allocate((ACPI_SIZE)(a),_COMPONENT,_THIS_MODULE,__LINE__)
+#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate((ACPI_SIZE)(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_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_ALLOCATE(a) acpi_ut_allocate_and_track((ACPI_SIZE)(a),_COMPONENT,_THIS_MODULE,__LINE__)
+#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate_and_track((ACPI_SIZE)(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
/******************************************************************************
*
* Name: acnamesp.h - Namespace subcomponent prototypes and defines
- * $Revision: 123 $
+ * $Revision: 125 $
*
*****************************************************************************/
acpi_namespace_node *parent,
acpi_namespace_node *child);
-acpi_status
+void
acpi_ns_delete_namespace_by_owner (
u16 table_id);
* Top-level namespace access - nsaccess
*/
-
acpi_status
acpi_ns_root_initialize (
void);
* Named object allocation/deallocation - nsalloc
*/
-
acpi_namespace_node *
acpi_ns_create_node (
u32 name);
acpi_ns_delete_node (
acpi_namespace_node *node);
-acpi_status
+void
acpi_ns_delete_namespace_subtree (
acpi_namespace_node *parent_handle);
u32 num_segments,
char *pathname);
+acpi_status
+acpi_ns_dump_one_device (
+ acpi_handle obj_handle,
+ u32 level,
+ void *context,
+ void **return_value);
+
void
acpi_ns_dump_root_devices (
void);
+acpi_status
+acpi_ns_dump_one_object (
+ acpi_handle obj_handle,
+ u32 level,
+ void *context,
+ void **return_value);
+
void
acpi_ns_dump_objects (
acpi_object_type type,
acpi_ns_opens_scope (
acpi_object_type type);
+void
+acpi_ns_build_external_path (
+ acpi_namespace_node *node,
+ ACPI_SIZE size,
+ NATIVE_CHAR *name_buffer);
+
NATIVE_CHAR *
acpi_ns_get_external_pathname (
acpi_namespace_node *node);
acpi_ns_build_internal_name (
acpi_namestring_info *info);
-acpi_status
+void
acpi_ns_get_internal_name_length (
acpi_namestring_info *info);
/******************************************************************************
*
* Name: acobject.h - Definition of acpi_operand_object (Internal object only)
- * $Revision: 110 $
+ * $Revision: 111 $
*
*****************************************************************************/
} acpi_operand_object;
+
+/******************************************************************************
+ *
+ * ACPI_DESCRIPTOR - objects that share a common descriptor identifier
+ *
+ *****************************************************************************/
+
+
+/* Object descriptor types */
+
+#define ACPI_DESC_TYPE_CACHED 0x11 /* Used only when object is cached */
+#define ACPI_DESC_TYPE_STATE 0x20
+#define ACPI_DESC_TYPE_STATE_UPDATE 0x21
+#define ACPI_DESC_TYPE_STATE_PACKAGE 0x22
+#define ACPI_DESC_TYPE_STATE_CONTROL 0x23
+#define ACPI_DESC_TYPE_STATE_RPSCOPE 0x24
+#define ACPI_DESC_TYPE_STATE_PSCOPE 0x25
+#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_OPERAND 0x88
+#define ACPI_DESC_TYPE_NAMED 0xAA
+
+
+typedef union acpi_desc
+{
+ u8 descriptor_id; /* To differentiate various internal objs */\
+ acpi_operand_object object;
+ acpi_namespace_node node;
+ acpi_parse_object op;
+
+} ACPI_DESCRIPTOR;
+
+
#endif /* _ACOBJECT_H */
/******************************************************************************
*
* Module Name: acparser.h - AML Parser subcomponent prototypes and defines
- * $Revision: 58 $
+ * $Revision: 59 $
*
*****************************************************************************/
acpi_ps_get_opcode_size (
u32 opcode);
-u8
+void
acpi_ps_complete_this_op (
acpi_walk_state *walk_state,
acpi_parse_object *op);
acpi_purge_cached_objects (
void);
+acpi_status
+acpi_install_initialization_handler (
+ ACPI_INIT_HANDLER handler,
+ u32 function);
/*
* ACPI Memory manager
* Hardware (ACPI device) interfaces
*/
+acpi_status
+acpi_get_register (
+ u32 register_id,
+ u32 *return_value,
+ u32 flags);
+
+acpi_status
+acpi_set_register (
+ u32 register_id,
+ u32 value,
+ u32 flags);
+
acpi_status
acpi_set_firmware_waking_vector (
ACPI_PHYSICAL_ADDRESS physical_address);
acpi_get_firmware_waking_vector (
ACPI_PHYSICAL_ADDRESS *physical_address);
+acpi_status
+acpi_get_sleep_type_data (
+ u8 sleep_state,
+ u8 *slp_typ_a,
+ u8 *slp_typ_b);
acpi_status
acpi_enter_sleep_state_prep (
- u8 sleep_state);
+ u8 sleep_state);
acpi_status
acpi_enter_sleep_state (
- u8 sleep_state);
+ u8 sleep_state);
acpi_status
acpi_leave_sleep_state (
- u8 sleep_state);
+ u8 sleep_state);
+
#endif /* __ACXFACE_H__ */
/******************************************************************************
*
* Name: acresrc.h - Resource Manager function prototypes
- * $Revision: 30 $
+ * $Revision: 33 $
*
*****************************************************************************/
/*
- *Function prototypes called from Acpi_rs_create*
+ * Function prototypes called from Acpi_rs_create*
*/
+void
+acpi_rs_dump_irq (
+ acpi_resource_data *data);
+
+void
+acpi_rs_dump_address16 (
+ acpi_resource_data *data);
+
+void
+acpi_rs_dump_address32 (
+ acpi_resource_data *data);
+
+void
+acpi_rs_dump_address64 (
+ acpi_resource_data *data);
+
+void
+acpi_rs_dump_dma (
+ acpi_resource_data *data);
+
+void
+acpi_rs_dump_io (
+ acpi_resource_data *data);
+
+void
+acpi_rs_dump_extended_irq (
+ acpi_resource_data *data);
+
+void
+acpi_rs_dump_fixed_io (
+ acpi_resource_data *data);
+
+void
+acpi_rs_dump_fixed_memory32 (
+ acpi_resource_data *data);
+
+void
+acpi_rs_dump_memory24 (
+ acpi_resource_data *data);
+
+void
+acpi_rs_dump_memory32 (
+ acpi_resource_data *data);
+
+void
+acpi_rs_dump_start_depend_fns (
+ acpi_resource_data *data);
+
+void
+acpi_rs_dump_vendor_specific (
+ acpi_resource_data *data);
void
acpi_rs_dump_resource_list (
u32 *size);
acpi_status
-acpi_rs_calculate_list_length (
+acpi_rs_get_list_length (
u8 *byte_stream_buffer,
u32 byte_stream_buffer_length,
ACPI_SIZE *size_needed);
acpi_status
-acpi_rs_calculate_byte_stream_length (
+acpi_rs_get_byte_stream_length (
acpi_resource *linked_list_buffer,
ACPI_SIZE *size_needed);
acpi_status
-acpi_rs_calculate_pci_routing_table_length (
+acpi_rs_get_pci_routing_table_length (
acpi_operand_object *package_object,
ACPI_SIZE *buffer_size_needed);
acpi_status
acpi_rs_list_to_byte_stream (
acpi_resource *linked_list,
- u32 byte_stream_size_needed,
+ ACPI_SIZE byte_stream_size_needed,
u8 *output_buffer);
acpi_status
/******************************************************************************
*
* Name: acstruct.h - Internal structs
- * $Revision: 17 $
+ * $Revision: 19 $
*
*****************************************************************************/
* the tree (for whatever reason), and for control method execution.
*/
-#define ACPI_NEXT_OP_DOWNWARD 1
-#define ACPI_NEXT_OP_UPWARD 2
+#define ACPI_NEXT_OP_DOWNWARD 1
+#define ACPI_NEXT_OP_UPWARD 2
-#define ACPI_WALK_NON_METHOD 0
-#define ACPI_WALK_METHOD 1
-#define ACPI_WALK_METHOD_RESTART 2
+#define ACPI_WALK_NON_METHOD 0
+#define ACPI_WALK_METHOD 1
+#define ACPI_WALK_METHOD_RESTART 2
+#define ACPI_WALK_CONST_REQUIRED 3
+#define ACPI_WALK_CONST_OPTIONAL 4
typedef struct acpi_walk_state
{
typedef struct acpi_init_walk_info
{
u16 method_count;
+ u16 device_count;
u16 op_region_count;
u16 field_count;
u16 buffer_count;
/******************************************************************************
*
* Name: actables.h - ACPI table management
- * $Revision: 36 $
+ * $Revision: 41 $
*
*****************************************************************************/
* tbget - Table "get" routines
*/
+void
+acpi_tb_table_override (
+ acpi_table_desc *table_info);
+
+acpi_status
+acpi_tb_get_table_with_override (
+ ACPI_POINTER *address,
+ acpi_table_desc *table_info);
+
acpi_status
acpi_tb_get_table_ptr (
acpi_table_type table_type,
acpi_tb_get_table_pointer (
ACPI_POINTER *address,
u32 flags,
- u32 *size,
+ ACPI_SIZE *size,
acpi_table_header **table_ptr);
/*
acpi_status
acpi_tb_get_all_tables (
- u32 number_of_tables,
- acpi_table_header *buffer_ptr);
+ u32 number_of_tables);
/*
acpi_status
acpi_tb_install_table (
- acpi_table_header *table_ptr,
acpi_table_desc *table_info);
acpi_status
acpi_status
acpi_tb_recognize_table (
- acpi_table_header *table_ptr,
acpi_table_desc *table_info);
acpi_status
acpi_status
acpi_tb_map_acpi_table (
ACPI_PHYSICAL_ADDRESS physical_address,
- u32 *size,
+ ACPI_SIZE *size,
acpi_table_header **logical_address);
acpi_status
/******************************************************************************
*
* Name: actypes.h - Common data types for the entire ACPI subsystem
- * $Revision: 227 $
+ * $Revision: 237 $
*
*****************************************************************************/
/*! [Begin] no source code translation (keep the typedefs) */
+
+
+/*
+ * Data type ranges
+ */
+#define ACPI_UINT8_MAX (UINT8) 0xFF
+#define ACPI_UINT16_MAX (UINT16) 0xFFFF
+#define ACPI_UINT32_MAX (UINT32) 0xFFFFFFFF
+#define ACPI_UINT64_MAX (UINT64) 0xFFFFFFFFFFFFFFFF
+#define ACPI_ASCII_MAX 0x7F
+
+
+
/*
* Data types - Fixed across all compilation models
*
* BOOLEAN Logical Boolean.
- * 1 byte value containing a 0 for FALSE or a 1 for TRUE.
- * Other values are undefined.
- *
* INT8 8-bit (1 byte) signed value
* UINT8 8-bit (1 byte) unsigned value
* INT16 16-bit (2 byte) signed value
* NATIVE_UINT 32-bit on IA-32, 64-bit on IA-64 unsigned value
*/
+#ifndef ACPI_MACHINE_WIDTH
+#error ACPI_MACHINE_WIDTH not defined
+#endif
-#ifdef _IA64
+#if ACPI_MACHINE_WIDTH == 64
/*
* 64-bit type definitions
*/
typedef COMPILER_DEPENDENT_INT64 INT64;
typedef COMPILER_DEPENDENT_UINT64 UINT64;
+typedef INT64 NATIVE_INT;
typedef UINT64 NATIVE_UINT;
-typedef UINT64 NATIVE_INT;
+
+typedef UINT32 NATIVE_UINT_MAX32;
+typedef UINT64 NATIVE_UINT_MIN32;
typedef UINT64 ACPI_TBLPTR;
typedef UINT64 ACPI_IO_ADDRESS;
#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
+#define ACPI_MAX_PTR ACPI_UINT64_MAX
+#define ACPI_SIZE_MAX ACPI_UINT64_MAX
-#elif _IA16
+#elif ACPI_MACHINE_WIDTH == 16
/*
* 16-bit type definitions
*/
typedef UINT16 NATIVE_UINT;
typedef INT16 NATIVE_INT;
+typedef UINT16 NATIVE_UINT_MAX32;
+typedef UINT32 NATIVE_UINT_MIN32;
+
typedef UINT32 ACPI_TBLPTR;
typedef UINT32 ACPI_IO_ADDRESS;
typedef char *ACPI_PHYSICAL_ADDRESS;
-typedef UINT32 ACPI_SIZE;
+typedef UINT16 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
+#define ACPI_MAX_PTR ACPI_UINT16_MAX
+#define ACPI_SIZE_MAX ACPI_UINT16_MAX
/*
* (16-bit only) internal integers must be 32-bits, so
#define ACPI_NO_INTEGER64_SUPPORT
-#else
+#elif ACPI_MACHINE_WIDTH == 32
/*
* 32-bit type definitions (default)
*/
typedef COMPILER_DEPENDENT_INT64 INT64;
typedef COMPILER_DEPENDENT_UINT64 UINT64;
-typedef UINT32 NATIVE_UINT;
typedef INT32 NATIVE_INT;
+typedef UINT32 NATIVE_UINT;
+
+typedef UINT32 NATIVE_UINT_MAX32;
+typedef UINT32 NATIVE_UINT_MIN32;
typedef UINT64 ACPI_TBLPTR;
typedef UINT32 ACPI_IO_ADDRESS;
#define ALIGNED_ADDRESS_BOUNDARY 0x00000004
#define _HW_ALIGNMENT_SUPPORT
-#define ACPI_MAX_PTR 0xFFFFFFFF
-#endif
+#define ACPI_MAX_PTR ACPI_UINT32_MAX
+#define ACPI_SIZE_MAX ACPI_UINT32_MAX
+#else
+#error unknown ACPI_MACHINE_WIDTH
+#endif
/*
typedef char NATIVE_CHAR;
-/*
- * Data type ranges
- */
-#define ACPI_UINT8_MAX (UINT8) 0xFF
-#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, defined here to enable
* Pointer overlays to avoid lots of typecasting for
* code that accepts both physical and logical pointers.
*/
-typedef union acpi_pointers
+typedef union acpi_ptrs
{
ACPI_PHYSICAL_ADDRESS physical;
void *logical;
typedef struct acpi_pointer
{
u32 pointer_type;
- ACPI_POINTERS pointer;
+ union acpi_ptrs pointer;
} ACPI_POINTER;
} uint64_overlay;
+typedef struct
+{
+ u32 lo;
+ u32 hi;
+
+} UINT32_STRUCT;
+
/*
* Acpi integer width. In ACPI version 1, integers are
#define ACPI_MAX_BCD_DIGITS 16
#define ACPI_MAX_DECIMAL_DIGITS 19
-#ifdef _IA64
+#if ACPI_MACHINE_WIDTH == 64
#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 64-bit divide */
#endif
#endif
* Constants with special meanings
*/
-#define ACPI_ROOT_OBJECT (acpi_handle) ACPI_PTR_ADD (char, NULL, ACPI_UINT32_MAX)
+#define ACPI_ROOT_OBJECT (acpi_handle) ACPI_PTR_ADD (char, NULL, ACPI_MAX_PTR)
/*
#define ACPI_ADR_SPACE_DATA_TABLE (ACPI_ADR_SPACE_TYPE) 7
+/*
+ * Bit_register IDs
+ * These are bitfields defined within the full ACPI registers
+ */
+#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
+
/*
* External ACPI object definition
*/
u32 function,
void *data);
+typedef
+acpi_status (*ACPI_INIT_HANDLER) (
+ acpi_handle object,
+ u32 function);
+
+#define ACPI_INIT_DEVICE_INI 1
+
/* Address Spaces (Operation Regions */
void *handler_context,
void *region_context);
-#define ACPI_DEFAULT_HANDLER ((acpi_adr_space_handler) NULL)
+#define ACPI_DEFAULT_HANDLER NULL
typedef
ACPI_PHYSICAL_ADDRESS address;
ACPI_PHYSICAL_ADDRESS mapped_physical_address;
u8 *mapped_logical_address;
- u32 mapped_length;
+ ACPI_SIZE mapped_length;
} acpi_mem_space_context;
/******************************************************************************
*
* Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
- * $Revision: 130 $
+ * $Revision: 137 $
*
*****************************************************************************/
acpi_ut_hardware_initialize (
void);
-acpi_status
+void
acpi_ut_subsystem_shutdown (
void);
* Ut_global - Global data structures and procedures
*/
-#ifdef ACPI_DEBUG
+#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER)
NATIVE_CHAR *
acpi_ut_get_mutex_name (
acpi_ut_get_event_name (
u32 event_id);
-u8
+char
acpi_ut_hex_to_ascii_char (
acpi_integer integer,
u32 position);
const NATIVE_CHAR *src_string,
NATIVE_UINT count);
-u32
+int
acpi_ut_strncmp (
const NATIVE_CHAR *string1,
const NATIVE_CHAR *string2,
NATIVE_UINT value,
NATIVE_UINT count);
-u32
+int
acpi_ut_to_upper (
- u32 c);
+ int c);
-u32
+int
acpi_ut_to_lower (
- u32 c);
+ int c);
+
+extern const u8 _acpi_ctype[];
+
+#define _ACPI_XA 0x00 /* extra alphabetic - not supported */
+#define _ACPI_XS 0x40 /* extra space */
+#define _ACPI_BB 0x00 /* BEL, BS, etc. - not supported */
+#define _ACPI_CN 0x20 /* CR, FF, HT, NL, VT */
+#define _ACPI_DI 0x04 /* '0'-'9' */
+#define _ACPI_LO 0x02 /* 'a'-'z' */
+#define _ACPI_PU 0x10 /* punctuation */
+#define _ACPI_SP 0x08 /* space */
+#define _ACPI_UP 0x01 /* 'A'-'Z' */
+#define _ACPI_XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */
+
+#define ACPI_IS_DIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI))
+#define ACPI_IS_SPACE(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP))
+#define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
+#define ACPI_IS_UPPER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP))
+#define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
#endif /* ACPI_USE_SYSTEM_CLIBRARY */
u8 *buffer,
u32 *space_used);
+acpi_status
+acpi_ut_copy_ielement_to_eelement (
+ u8 object_type,
+ acpi_operand_object *source_object,
+ acpi_generic_state *state,
+ void *context);
+
+acpi_status
+acpi_ut_copy_ielement_to_ielement (
+ u8 object_type,
+ acpi_operand_object *source_object,
+ acpi_generic_state *state,
+ void *context);
+
acpi_status
acpi_ut_copy_iobject_to_eobject (
acpi_operand_object *obj,
acpi_ut_delete_internal_simple_object (
acpi_operand_object *object);
-acpi_status
+void
acpi_ut_delete_internal_object_list (
acpi_operand_object **obj_list);
acpi_operand_object *obj,
ACPI_SIZE *obj_length);
+acpi_status
+acpi_ut_get_element_length (
+ u8 object_type,
+ acpi_operand_object *source_object,
+ acpi_generic_state *state,
+ void *context);
+
/*
* Ut_state - Generic state creation/cache routines
acpi_ut_valid_acpi_character (
NATIVE_CHAR character);
+acpi_status
+acpi_ut_strtoul64 (
+ NATIVE_CHAR *string,
+ u32 base,
+ acpi_integer *ret_integer);
+
NATIVE_CHAR *
acpi_ut_strupr (
NATIVE_CHAR *src_string);
acpi_ut_resolve_package_references (
acpi_operand_object *obj_desc);
+acpi_status
+acpi_ut_resolve_reference (
+ u8 object_type,
+ acpi_operand_object *source_object,
+ acpi_generic_state *state,
+ void *context);
+
u8 *
acpi_ut_get_resource_end_tag (
acpi_operand_object *obj_desc);
u8 *buffer,
u32 length);
+u32
+acpi_ut_dword_byte_swap (
+ u32 value);
+
+void
+acpi_ut_set_integer_width (
+ u8 revision);
+
#ifdef ACPI_DEBUG
void
acpi_ut_display_init_pathname (
u32 component,
NATIVE_CHAR *module,
u32 line);
+
+acpi_debug_mem_block *
+acpi_ut_find_allocation (
+ u32 list_id,
+ void *allocation);
+
acpi_status
acpi_ut_track_allocation (
u32 list_id,
* Name: amlcode.h - Definitions for AML, as included in "definition blocks"
* Declarations and definitions contained herein are derived
* directly from the ACPI specification.
- * $Revision: 67 $
+ * $Revision: 68 $
*
*****************************************************************************/
#ifndef __AMLCODE_H__
#define __AMLCODE_H__
-
/* primary opcodes */
#define AML_NULL_CHAR (u16) 0x00
#define AML_CREATE 0x0004
#define AML_MATH 0x0002
#define AML_LOGICAL 0x0001
+#define AML_CONSTANT 0x1000
/* Convenient flag groupings */
/******************************************************************************
*
* Name: acenv.h - Generation environment specific items
- * $Revision: 86 $
+ * $Revision: 94 $
*
*****************************************************************************/
#ifdef _ACPI_ASL_COMPILER
#define ACPI_DEBUG
#define ACPI_APPLICATION
-#define ENABLE_DEBUGGER
+/* #define ENABLE_DEBUGGER */
#define ACPI_USE_SYSTEM_CLIBRARY
#endif
* 2) This is NOT a 16-bit version of the code (not enough real-mode memory)
*/
#ifdef ACPI_DEBUG
-#ifndef _IA16
+#if ACPI_MACHINE_WIDTH != 16
#define ACPI_DBG_TRACK_ALLOCATIONS
#endif
#endif
#elif defined(_AED_EFI)
#include "acefi.h"
-#elif defined(MSDOS)
-#include "acdos16.h"
-
#elif defined(WIN32)
#include "acwin.h"
#elif defined(WIN64)
#include "acwin64.h"
+#elif defined(MSDOS) /* Must appear after WIN32 and WIN64 check */
+#include "acdos16.h"
+
#elif defined(__FreeBSD__)
#include "acfreebsd.h"
#define ACPI_USE_STANDARD_HEADERS
+#define COMPILER_DEPENDENT_INT64 long long
+#define COMPILER_DEPENDENT_UINT64 unsigned long long
+
+
/* Name of host operating system (returned by the _OS_ namespace object) */
#define ACPI_OS_NAME "Intel ACPI/CA Core Subsystem"
*/
#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_STRUPR(s) (void) acpi_ut_strupr ((s))
+#define ACPI_STRLEN(s) (ACPI_SIZE) strlen((s))
+#define ACPI_STRCPY(d,s) (void) strcpy((d), (s))
+#define ACPI_STRNCPY(d,s,n) (void) strncpy((d), (s), (ACPI_SIZE)(n))
+#define ACPI_STRNCMP(d,s,n) strncmp((d), (s), (ACPI_SIZE)(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_STRCAT(d,s) (void) strcat((d), (s))
+#define ACPI_STRNCAT(d,s,n) strncat((d), (s), (ACPI_SIZE)(n))
+#define ACPI_STRTOUL(d,s,n) strtoul((d), (s), (ACPI_SIZE)(n))
+#define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (ACPI_SIZE)(n))
+#define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (ACPI_SIZE)(n))
#define ACPI_TOUPPER toupper
#define ACPI_TOLOWER tolower
#define ACPI_IS_XDIGIT isxdigit
+#define ACPI_IS_DIGIT isdigit
+#define ACPI_IS_SPACE isspace
+#define ACPI_IS_UPPER isupper
/******************************************************************************
*
#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_STRUPR(s) (void) acpi_ut_strupr ((s))
+#define ACPI_STRLEN(s) (ACPI_SIZE) acpi_ut_strlen ((s))
+#define ACPI_STRCPY(d,s) (void) acpi_ut_strcpy ((d), (s))
+#define ACPI_STRNCPY(d,s,n) (void) acpi_ut_strncpy ((d), (s), (ACPI_SIZE)(n))
+#define ACPI_STRNCMP(d,s,n) acpi_ut_strncmp ((d), (s), (ACPI_SIZE)(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_STRCAT(d,s) (void) acpi_ut_strcat ((d), (s))
+#define ACPI_STRNCAT(d,s,n) acpi_ut_strncat ((d), (s), (ACPI_SIZE)(n))
+#define ACPI_STRTOUL(d,s,n) acpi_ut_strtoul ((d), (s), (ACPI_SIZE)(n))
+#define ACPI_MEMCPY(d,s,n) (void) acpi_ut_memcpy ((d), (s), (ACPI_SIZE)(n))
+#define ACPI_MEMSET(d,v,n) (void) acpi_ut_memset ((d), (v), (ACPI_SIZE)(n))
#define ACPI_TOUPPER acpi_ut_to_upper
#define ACPI_TOLOWER acpi_ut_to_lower
/******************************************************************************
*
* Name: acgcc.h - GCC specific defines, etc.
- * $Revision: 22 $
+ * $Revision: 23 $
*
*****************************************************************************/
#ifndef __ACGCC_H__
#define __ACGCC_H__
-
-#ifdef __ia64__
-#define _IA64
-
-#define COMPILER_DEPENDENT_INT64 long
-#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 BREAKPOINT3
-#define ACPI_DISABLE_IRQS() __cli()
-#define ACPI_ENABLE_IRQS() __sti()
-
-/*! [Begin] no source code translation */
-
-#include <asm/pal.h>
-
-#define halt() ia64_pal_halt_light() /* PAL_HALT[_LIGHT] */
-#define safe_halt() ia64_pal_halt(1) /* PAL_HALT */
-
-
-#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \
- do { \
- __asm__ volatile ("1: ld4 r29=%1\n" \
- ";;\n" \
- "mov ar.ccv=r29\n" \
- "mov r2=r29\n" \
- "shr.u r30=r29,1\n" \
- "and r29=-4,r29\n" \
- ";;\n" \
- "add r29=2,r29\n" \
- "and r30=1,r30\n" \
- ";;\n" \
- "add r29=r29,r30\n" \
- ";;\n" \
- "cmpxchg4.acq r30=%1,r29,ar.ccv\n" \
- ";;\n" \
- "cmp.eq p6,p7=r2,r30\n" \
- "(p7) br.dpnt.few 1b\n" \
- "cmp.gt p8,p9=3,r29\n" \
- ";;\n" \
- "(p8) mov %0=-1\n" \
- "(p9) mov %0=r0\n" \
- :"=r"(Acq):"m"(GLptr):"r2","r29","r30","memory"); \
- } while (0)
-
-#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \
- do { \
- __asm__ volatile ("1: ld4 r29=%1\n" \
- ";;\n" \
- "mov ar.ccv=r29\n" \
- "mov r2=r29\n" \
- "and r29=-4,r29\n" \
- ";;\n" \
- "cmpxchg4.acq r30=%1,r29,ar.ccv\n" \
- ";;\n" \
- "cmp.eq p6,p7=r2,r30\n" \
- "(p7) br.dpnt.few 1b\n" \
- "and %0=1,r2\n" \
- ";;\n" \
- :"=r"(Acq):"m"(GLptr):"r2","r29","r30","memory"); \
- } while (0)
-/*! [End] no source code translation !*/
-
-
-#else /* DO IA32 */
-
-#define COMPILER_DEPENDENT_INT64 long long
-#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 BREAKPOINT3
-#define ACPI_DISABLE_IRQS() __cli()
-#define ACPI_ENABLE_IRQS() __sti()
-
-/*! [Begin] no source code translation
- *
- * A brief explanation as GNU inline assembly is a bit hairy
- * %0 is the output parameter in EAX ("=a")
- * %1 and %2 are the input parameters in ECX ("c")
- * and an immediate value ("i") respectively
- * All actual register references are preceded with "%%" as in "%%edx"
- * Immediate values in the assembly are preceded by "$" as in "$0x1"
- * The final asm parameter are the operation altered non-output registers.
- */
-#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \
- do { \
- int dummy; \
- asm("1: movl (%1),%%eax;" \
- "movl %%eax,%%edx;" \
- "andl %2,%%edx;" \
- "btsl $0x1,%%edx;" \
- "adcl $0x0,%%edx;" \
- "lock; cmpxchgl %%edx,(%1);" \
- "jnz 1b;" \
- "cmpb $0x3,%%dl;" \
- "sbbl %%eax,%%eax" \
- :"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~1L):"dx"); \
- } while(0)
-
-#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \
- do { \
- int dummy; \
- asm("1: movl (%1),%%eax;" \
- "movl %%eax,%%edx;" \
- "andl %2,%%edx;" \
- "lock; cmpxchgl %%edx,(%1);" \
- "jnz 1b;" \
- "andl $0x1,%%eax" \
- :"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~3L):"dx"); \
- } while(0)
-
-
-/*
- * Math helper asm macros
- */
-#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
- asm("divl %2;" \
- :"=a"(q32), "=d"(r32) \
- :"r"(d32), \
- "0"(n_lo), "1"(n_hi))
-
-
-#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))
-
-/*! [End] no source code translation !*/
-
-#endif /* IA 32 */
-
/* This macro is used to tag functions as "printf-like" because
* some compilers (like GCC) can catch printf format string problems.
*/
/******************************************************************************
*
* Name: aclinux.h - OS specific defines, etc.
- * $Revision: 19 $
+ * $Revision: 25 $
*
*****************************************************************************/
#include <asm/system.h>
#include <asm/atomic.h>
#include <asm/div64.h>
+#include <asm/acpi.h>
#define strtoul simple_strtoul
-#ifdef _IA64
-#define ACPI_FLUSH_CPU_CACHE()
-#else
-#define ACPI_FLUSH_CPU_CACHE() wbinvd()
-#endif
+#define ACPI_MACHINE_WIDTH BITS_PER_LONG
#else /* !__KERNEL__ */
#include <stdlib.h>
#include <ctype.h>
+#if defined(__ia64__) || defined(__x86_64__)
+#define ACPI_MACHINE_WIDTH 64
+#define COMPILER_DEPENDENT_INT64 long
+#define COMPILER_DEPENDENT_UINT64 unsigned long
+#else
+#define ACPI_MACHINE_WIDTH 32
+#define COMPILER_DEPENDENT_INT64 long long
+#define COMPILER_DEPENDENT_UINT64 unsigned long long
+#define ACPI_USE_NATIVE_DIVIDE
+#endif
+
#endif /* __KERNEL__ */
/* Linux uses GCC */
#include "acgcc.h"
#undef DEBUGGER_THREADING
-#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED
-
+#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED
#endif /* __ACLINUX_H__ */
/*******************************************************************************
*
* Module Name: nsaccess - Top-level functions for accessing ACPI namespace
- * $Revision: 153 $
+ * $Revision: 155 $
*
******************************************************************************/
#include "acpi.h"
#include "amlcode.h"
-#include "acinterp.h"
#include "acnamesp.h"
#include "acdispat.h"
/* Store pointer to value descriptor in the Node */
- acpi_ns_attach_object (new_node, obj_desc, obj_desc->common.type);
+ status = acpi_ns_attach_object (new_node, obj_desc, obj_desc->common.type);
/* Remove local reference to the object */
num_segments = 0;
this_node = acpi_gbl_root_node;
+ pathname = "";
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
- "Null Pathname (Zero segments), Flags=%x\n", flags));
+ "Null Pathname (Zero segments), Flags=%X\n", flags));
}
else {
/*
* Parent Prefixes (in which case the name's scope is relative
* to the current scope).
*/
- if (*pathname == AML_ROOT_PREFIX) {
+ if (*pathname == (u8) AML_ROOT_PREFIX) {
/* Pathname is fully qualified, start from the root */
this_node = acpi_gbl_root_node;
* the parent node for each prefix instance.
*/
this_node = prefix_node;
- while (*pathname == AML_PARENT_PREFIX) {
+ while (*pathname == (u8) AML_PARENT_PREFIX) {
/*
* Point past this prefix to the name segment
* part or the next Parent Prefix
num_segments = 0;
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
- "Prefix-only Pathname (Zero name segments), Flags=%x\n", flags));
+ "Prefix-only Pathname (Zero name segments), Flags=%X\n", flags));
break;
case AML_DUAL_NAME_PREFIX:
/*******************************************************************************
*
* Module Name: nsalloc - Namespace allocation and deletion utilities
- * $Revision: 72 $
+ * $Revision: 74 $
*
******************************************************************************/
#include "acpi.h"
#include "acnamesp.h"
-#include "acinterp.h"
#define _COMPONENT ACPI_NAMESPACE
* real definition is found later.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] is a forward reference\n",
- (char *) &node->name));
+ node->name.ascii));
}
/*
}
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%4.4s added to %p at %p\n",
- (char *) &node->name, parent_node, node));
+ node->name.ascii, parent_node, node));
/*
* Increment the reference count(s) of all parents up to
*
******************************************************************************/
-acpi_status
+void
acpi_ns_delete_namespace_subtree (
acpi_namespace_node *parent_node)
{
if (!parent_node) {
- return_ACPI_STATUS (AE_OK);
+ return_VOID;
}
/*
}
}
- return_ACPI_STATUS (AE_OK);
+ return_VOID;
}
*
******************************************************************************/
-acpi_status
+void
acpi_ns_delete_namespace_by_owner (
u16 owner_id)
{
}
}
- return_ACPI_STATUS (AE_OK);
+ return_VOID;
}
/******************************************************************************
*
* Module Name: nsdump - table dumping routines for debug
- * $Revision: 129 $
+ * $Revision: 135 $
*
*****************************************************************************/
#include "acpi.h"
-#include "acinterp.h"
#include "acnamesp.h"
-#include "actables.h"
#include "acparser.h"
}
else {
if (acpi_ns_exist_downstream_sibling (this_node + 1)) {
- downstream_sibling_mask |= (1 << (level - 1));
+ downstream_sibling_mask |= ((u32) 1 << (level - 1));
acpi_os_printf ("+");
}
else {
- downstream_sibling_mask &= ACPI_UINT32_MAX ^ (1 << (level - 1));
+ downstream_sibling_mask &= ACPI_UINT32_MAX ^ ((u32) 1 << (level - 1));
acpi_os_printf ("+");
}
}
if (!acpi_ut_valid_acpi_name (this_node->name.integer)) {
- ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n", this_node->name));
+ ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n", this_node->name.integer));
}
/*
* Now we can print out the pertinent information
*/
acpi_os_printf (" %4.4s %-12s %p",
- (char *) &this_node->name, acpi_ut_get_type_name (type), this_node);
+ this_node->name.ascii, acpi_ut_get_type_name (type), this_node);
dbg_level = acpi_dbg_level;
acpi_dbg_level = 0;
switch (type) {
case ACPI_TYPE_PROCESSOR:
- acpi_os_printf (" ID %d Addr %.4X Len %.4X\n",
+ acpi_os_printf (" ID %hd Addr %.4X Len %.4X\n",
obj_desc->processor.proc_id,
obj_desc->processor.address,
obj_desc->processor.length);
case ACPI_TYPE_METHOD:
- acpi_os_printf (" Args %d Len %.4X Aml %p \n",
+ acpi_os_printf (" Args %hd Len %.4X Aml %p \n",
obj_desc->method.param_count,
obj_desc->method.aml_length,
obj_desc->method.aml_start);
if (obj_desc->buffer.length > 0) {
acpi_os_printf (" =");
for (i = 0; (i < obj_desc->buffer.length && i < 12); i++) {
- acpi_os_printf (" %.2X", obj_desc->buffer.pointer[i]);
+ acpi_os_printf (" %.2hX", obj_desc->buffer.pointer[i]);
}
}
acpi_os_printf ("\n");
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);
+ obj_desc->buffer_field.buffer_obj->buffer.node->name.ascii);
}
break;
case INTERNAL_TYPE_REGION_FIELD:
acpi_os_printf (" Rgn [%4.4s]",
- (char *) &obj_desc->common_field.region_obj->region.node->name);
+ obj_desc->common_field.region_obj->region.node->name.ascii);
break;
case INTERNAL_TYPE_BANK_FIELD:
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);
+ obj_desc->common_field.region_obj->region.node->name.ascii,
+ obj_desc->bank_field.bank_obj->common_field.node->name.ascii);
break;
case INTERNAL_TYPE_INDEX_FIELD:
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);
+ obj_desc->index_field.index_obj->common_field.node->name.ascii,
+ obj_desc->index_field.data_obj->common_field.node->name.ascii);
break;
case INTERNAL_TYPE_REGION_FIELD:
case INTERNAL_TYPE_BANK_FIELD:
case INTERNAL_TYPE_INDEX_FIELD:
- acpi_os_printf (" Off %.2X Len %.2X Acc %.2d\n",
+ acpi_os_printf (" Off %.2X Len %.2X Acc %.2hd\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;
- }
+ default:
+ break;
+ }
break;
break;
- case ACPI_DESC_TYPE_INTERNAL:
+ case ACPI_DESC_TYPE_OPERAND:
obj_type = obj_desc->common.type;
bytes_to_dump = 32;
}
else {
- acpi_os_printf ("(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 %s, %X)\n",
+ acpi_ut_get_type_name (obj_type), obj_type);
bytes_to_dump = sizeof (acpi_operand_object);
}
break;
/* If value is NOT an internal object, we are done */
- if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_INTERNAL) {
+ if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_OPERAND) {
goto cleanup;
}
*/
switch (obj_type) {
case ACPI_TYPE_STRING:
- obj_desc = (acpi_operand_object *) obj_desc->string.pointer;
+ obj_desc = (void *) obj_desc->string.pointer;
break;
case ACPI_TYPE_BUFFER:
- obj_desc = (acpi_operand_object *) obj_desc->buffer.pointer;
+ obj_desc = (void *) obj_desc->buffer.pointer;
break;
case ACPI_TYPE_BUFFER_FIELD:
break;
case ACPI_TYPE_PACKAGE:
- obj_desc = (acpi_operand_object *) obj_desc->package.elements;
+ obj_desc = (void *) obj_desc->package.elements;
break;
case ACPI_TYPE_METHOD:
- obj_desc = (acpi_operand_object *) obj_desc->method.aml_start;
+ obj_desc = (void *) obj_desc->method.aml_start;
break;
case INTERNAL_TYPE_REGION_FIELD:
- obj_desc = (acpi_operand_object *) obj_desc->field.region_obj;
+ obj_desc = (void *) obj_desc->field.region_obj;
break;
case INTERNAL_TYPE_BANK_FIELD:
- obj_desc = (acpi_operand_object *) obj_desc->bank_field.region_obj;
+ obj_desc = (void *) obj_desc->bank_field.region_obj;
break;
case INTERNAL_TYPE_INDEX_FIELD:
- obj_desc = (acpi_operand_object *) obj_desc->index_field.index_obj;
+ obj_desc = (void *) obj_desc->index_field.index_obj;
break;
- default:
+ default:
goto cleanup;
}
info.display_type = display_type;
- acpi_ns_walk_namespace (type, start_handle, max_depth, ACPI_NS_WALK_NO_UNLOCK, acpi_ns_dump_one_object,
- (void *) &info, NULL);
+ (void) acpi_ns_walk_namespace (type, start_handle, max_depth,
+ ACPI_NS_WALK_NO_UNLOCK, acpi_ns_dump_one_object,
+ (void *) &info, NULL);
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " "));
}
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " HID: %s, ADR: %8.8X%8.8X, Status: %x\n",
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " HID: %s, ADR: %8.8X%8.8X, Status: %X\n",
info.hardware_id,
ACPI_HIDWORD (info.address), ACPI_LODWORD (info.address),
info.current_status));
acpi_ns_dump_root_devices (void)
{
acpi_handle sys_bus_handle;
+ acpi_status status;
ACPI_FUNCTION_NAME ("Ns_dump_root_devices");
return;
}
- acpi_get_handle (0, ACPI_NS_SYSTEM_BUS, &sys_bus_handle);
+ status = acpi_get_handle (0, ACPI_NS_SYSTEM_BUS, &sys_bus_handle);
+ if (ACPI_FAILURE (status)) {
+ return;
+ }
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, ACPI_NS_WALK_NO_UNLOCK,
- acpi_ns_dump_one_device, NULL, NULL);
+
+ status = 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);
}
#endif
info.owner_id = ACPI_UINT32_MAX;
info.display_type = ACPI_DISPLAY_SUMMARY;
- acpi_ns_dump_one_object (handle, 1, &info, NULL);
+ (void) acpi_ns_dump_one_object (handle, 1, &info, NULL);
}
#endif
*
* Module Name: nseval - Object evaluation interfaces -- includes control
* method lookup and execution.
- * $Revision: 112 $
+ * $Revision: 114 $
*
******************************************************************************/
#include "acpi.h"
-#include "amlcode.h"
#include "acparser.h"
#include "acinterp.h"
#include "acnamesp.h"
*return_object = local_return_object;
}
+ /* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */
- /* Map AE_RETURN_VALUE to AE_OK, we are done with it */
-
- if (status == AE_CTRL_RETURN_VALUE) {
- status = AE_OK;
- }
+ status = AE_OK;
}
/*
ACPI_DUMP_PATHNAME (method_node, "Ns_execute_control_method: Executing",
ACPI_LV_INFO, _COMPONENT);
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Method at AML address %p Length %x\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Method at AML address %p Length %X\n",
obj_desc->method.aml_start + 1, obj_desc->method.aml_length - 1));
/*
acpi_operand_object **return_obj_desc)
{
acpi_status status = AE_OK;
- acpi_operand_object *obj_desc;
+ acpi_namespace_node *resolved_node = node;
ACPI_FUNCTION_TRACE ("Ns_get_object_value");
* Node may be a field that must be read, etc.) -- we can't just grab
* the object out of the node.
*/
- obj_desc = (acpi_operand_object *) node;
/*
* Use Resolve_node_to_value() to get the associated value. This call
status = acpi_ex_enter_interpreter ();
if (ACPI_SUCCESS (status)) {
- status = acpi_ex_resolve_node_to_value ((acpi_namespace_node **) &obj_desc, NULL);
+ status = acpi_ex_resolve_node_to_value (&resolved_node, NULL);
/*
* If Acpi_ex_resolve_node_to_value() succeeded, the return value was
- * placed in Obj_desc.
+ * placed in Resolved_node.
*/
acpi_ex_exit_interpreter ();
if (ACPI_SUCCESS (status)) {
status = AE_CTRL_RETURN_VALUE;
- *return_obj_desc = obj_desc;
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returning obj %p\n", *return_obj_desc));
+ *return_obj_desc = ACPI_CAST_PTR (acpi_operand_object, resolved_node);
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returning obj %p\n", resolved_node));
}
}
/******************************************************************************
*
* Module Name: nsinit - namespace initialization
- * $Revision: 43 $
+ * $Revision: 47 $
*
*****************************************************************************/
ACPI_UINT32_MAX, acpi_ns_init_one_object,
&info, NULL);
if (ACPI_FAILURE (status)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Walk_namespace failed! %x\n", status));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Walk_namespace failed! %s\n",
+ acpi_format_exception (status)));
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
- "\n Initialized %d/%d Regions %d/%d Fields %d/%d Buffers %d/%d Packages (%d nodes)\n",
+ "\nInitialized %hd/%hd Regions %hd/%hd Fields %hd/%hd Buffers %hd/%hd Packages (%hd nodes)\n",
info.op_region_init, info.op_region_count,
info.field_init, info.field_count,
info.buffer_init, info.buffer_count,
info.package_init, info.package_count, info.object_count));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "%d Control Methods found\n", info.method_count));
+ "%hd Control Methods found\n", info.method_count));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "%d Op Regions found\n", info.op_region_count));
+ "%hd Op Regions found\n", info.op_region_count));
return_ACPI_STATUS (AE_OK);
}
ACPI_UINT32_MAX, FALSE, acpi_ns_init_one_device, &info, NULL);
if (ACPI_FAILURE (status)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Walk_namespace failed! %x\n", status));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Walk_namespace failed! %s\n",
+ acpi_format_exception (status)));
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
- "\n%d Devices found containing: %d _STA, %d _INI methods\n",
+ "\n%hd Devices found containing: %hd _STA, %hd _INI methods\n",
info.device_count, info.num_STA, info.num_INI));
return_ACPI_STATUS (status);
info->package_init++;
status = acpi_ds_get_package_arguments (obj_desc);
break;
+
+ default:
+ /* No other types can get here */
+ break;
}
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR, "\n"));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Could not execute arguments for [%4.4s] (%s), %s\n",
- (char *) &node->name, acpi_ut_get_type_name (type), acpi_format_exception (status)));
+ node->name.ascii, acpi_ut_get_type_name (type), acpi_format_exception (status)));
}
if (!(acpi_dbg_level & ACPI_LV_INIT)) {
*/
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 */
+ if (ACPI_FAILURE (status)) {
+ /* No _INI (AE_NOT_FOUND) means device requires no initialization */
- status = AE_OK;
- }
+ if (status != AE_NOT_FOUND) {
+ /* Ignore error and move on to next device */
- else if (ACPI_FAILURE (status)) {
- /* Ignore error and move on to next device */
+ #ifdef ACPI_DEBUG
+ NATIVE_CHAR *scope_name = acpi_ns_get_external_pathname (obj_handle);
-#ifdef ACPI_DEBUG
- 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)));
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "%s._INI failed: %s\n",
- scope_name, acpi_format_exception (status)));
+ ACPI_MEM_FREE (scope_name);
+ #endif
+ }
- ACPI_MEM_FREE (scope_name);
-#endif
+ status = AE_OK;
}
-
else {
/* Count of successful INIs */
info->num_INI++;
}
- return_ACPI_STATUS (AE_OK);
+ if (acpi_gbl_init_handler) {
+ /* External initialization handler is present, call it */
+
+ status = acpi_gbl_init_handler (obj_handle, ACPI_INIT_DEVICE_INI);
+ }
+
+
+ return_ACPI_STATUS (status);
}
/******************************************************************************
*
* Module Name: nsload - namespace loading/expanding/contracting procedures
- * $Revision: 53 $
+ * $Revision: 55 $
*
*****************************************************************************/
#include "acpi.h"
-#include "acinterp.h"
#include "acnamesp.h"
#include "amlcode.h"
#include "acparser.h"
#include "acdispat.h"
-#include "acdebug.h"
#define _COMPONENT ACPI_NAMESPACE
/* Ignore exceptions from these */
- acpi_ns_load_table_by_type (ACPI_TABLE_SSDT);
- acpi_ns_load_table_by_type (ACPI_TABLE_PSDT);
+ (void) acpi_ns_load_table_by_type (ACPI_TABLE_SSDT);
+ (void) acpi_ns_load_table_by_type (ACPI_TABLE_PSDT);
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
"ACPI Namespace successfully loaded at root %p\n",
return_ACPI_STATUS (AE_NO_MEMORY);
}
- ((acpi_parse2_object *) parse_root)->name = ACPI_ROOT_NAME;
+ parse_root->named.name = ACPI_ROOT_NAME;
/* Create and initialize a new walk state */
acpi_ns_delete_children (child_handle);
child_handle = parent_handle;
- acpi_get_parent (parent_handle, &parent_handle);
+ status = acpi_get_parent (parent_handle, &parent_handle);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
}
}
/*******************************************************************************
*
* Module Name: nsnames - Name manipulation and search
- * $Revision: 74 $
+ * $Revision: 77 $
*
******************************************************************************/
#include "acpi.h"
#include "amlcode.h"
-#include "acinterp.h"
#include "acnamesp.h"
ACPI_SIZE size,
NATIVE_CHAR *name_buffer)
{
- u32 index;
+ ACPI_SIZE index;
acpi_namespace_node *parent_node;
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]));
+ (u32) index, (u32) size, &name_buffer[size]));
}
return;
acpi_ns_build_external_path (node, required_size, buffer->pointer);
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X] \n", (char *) buffer->pointer, required_size));
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X] \n", (char *) buffer->pointer, (u32) required_size));
return_ACPI_STATUS (AE_OK);
}
*
* Module Name: nsobject - Utilities for objects attached to namespace
* table entries
- * $Revision: 80 $
+ * $Revision: 82 $
*
******************************************************************************/
#include "acpi.h"
-#include "amlcode.h"
#include "acnamesp.h"
-#include "acinterp.h"
-#include "actables.h"
#define _COMPONENT ACPI_NAMESPACE
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Installing %p into Node %p [%4.4s]\n",
- obj_desc, node, (char *) &node->name));
-
- /*
- * Must increment the new value's reference count
- * (if it is an internal object)
- */
- acpi_ut_add_reference (obj_desc);
+ obj_desc, node, node->name.ascii));
/* Detach an existing attached object if present */
acpi_ns_detach_object (node);
}
+ if (obj_desc) {
+ /*
+ * Must increment the new value's reference count
+ * (if it is an internal object)
+ */
+ acpi_ut_add_reference (obj_desc);
- /*
- * Handle objects with multiple descriptors - walk
- * to the end of the descriptor list
- */
- last_obj_desc = obj_desc;
- while (last_obj_desc->common.next_object) {
- last_obj_desc = last_obj_desc->common.next_object;
- }
+ /*
+ * Handle objects with multiple descriptors - walk
+ * to the end of the descriptor list
+ */
+ last_obj_desc = obj_desc;
+ while (last_obj_desc->common.next_object) {
+ last_obj_desc = last_obj_desc->common.next_object;
+ }
- /* Install the object at the front of the object list */
+ /* Install the object at the front of the object list */
- last_obj_desc->common.next_object = node->object;
+ last_obj_desc->common.next_object = node->object;
+ }
node->type = (u8) object_type;
node->object = obj_desc;
/* Clear the entry in all cases */
node->object = NULL;
- if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_INTERNAL) {
+ if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_OPERAND) {
node->object = obj_desc->common.next_object;
if (node->object &&
(node->object->common.type != INTERNAL_TYPE_DATA)) {
node->type = ACPI_TYPE_ANY;
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Node %p [%4.4s] Object %p\n",
- node, (char *) &node->name, obj_desc));
+ node, node->name.ascii, obj_desc));
/* Remove one reference on the object (and all subobjects) */
}
if (!node->object ||
- ((ACPI_GET_DESCRIPTOR_TYPE (node->object) != ACPI_DESC_TYPE_INTERNAL) &&
- (ACPI_GET_DESCRIPTOR_TYPE (node->object) != ACPI_DESC_TYPE_NAMED)) ||
+ ((ACPI_GET_DESCRIPTOR_TYPE (node->object) != ACPI_DESC_TYPE_OPERAND) &&
+ (ACPI_GET_DESCRIPTOR_TYPE (node->object) != ACPI_DESC_TYPE_NAMED)) ||
(node->object->common.type == INTERNAL_TYPE_DATA)) {
return_PTR (NULL);
}
/*******************************************************************************
*
* Module Name: nssearch - Namespace search
- * $Revision: 84 $
+ * $Revision: 85 $
*
******************************************************************************/
#include "acpi.h"
-#include "amlcode.h"
-#include "acinterp.h"
#include "acnamesp.h"
*
* Module Name: nsutils - Utilities for accessing ACPI namespace, accessing
* parents and siblings and Scope manipulation
- * $Revision: 105 $
+ * $Revision: 109 $
*
*****************************************************************************/
#include "acpi.h"
#include "acnamesp.h"
-#include "acinterp.h"
#include "amlcode.h"
#include "actables.h"
*
******************************************************************************/
-acpi_status
+void
acpi_ns_get_internal_name_length (
acpi_namestring_info *info)
{
4 + info->num_carats;
info->next_external_char = next_external_char;
-
- return (AE_OK);
}
NATIVE_CHAR *internal_name = info->internal_name;
NATIVE_CHAR *external_name = info->next_external_char;
NATIVE_CHAR *result = NULL;
- u32 i;
+ NATIVE_UINT_MIN32 i;
ACPI_FUNCTION_TRACE ("Ns_build_internal_name");
else {
/* Convert the character to uppercase and save it */
- result[i] = (char) ACPI_TOUPPER (*external_name);
+ result[i] = (char) ACPI_TOUPPER ((int) *external_name);
external_name++;
}
}
u32 *converted_name_length,
char **converted_name)
{
- u32 prefix_length = 0;
- u32 names_index = 0;
- u32 num_segments = 0;
- u32 i = 0;
- u32 j = 0;
- u32 required_length;
+ NATIVE_UINT_MIN32 prefix_length = 0;
+ NATIVE_UINT_MIN32 names_index = 0;
+ NATIVE_UINT_MIN32 num_segments = 0;
+ NATIVE_UINT_MIN32 i = 0;
+ NATIVE_UINT_MIN32 j = 0;
+ NATIVE_UINT_MIN32 required_length;
ACPI_FUNCTION_TRACE ("Ns_externalize_name");
}
break;
+
+ default:
+ break;
}
/*
}
if (converted_name_length) {
- *converted_name_length = required_length;
+ *converted_name_length = (u32) required_length;
}
return_ACPI_STATUS (AE_OK);
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, child_node->name.ascii,
+ parent_node, parent_node->name.ascii));
if (parent_node->name.integer) {
- return_VALUE (parent_node->name.integer);
+ return_VALUE ((acpi_name) parent_node->name.integer);
}
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "unable to find parent of %p (%4.4s)\n",
- child_node, (char *) &child_node->name));
+ child_node, child_node->name.ascii));
}
return_VALUE (ACPI_UNKNOWN_NAME);
/******************************************************************************
*
* Module Name: nswalk - Functions for walking the ACPI namespace
- * $Revision: 32 $
+ * $Revision: 33 $
*
*****************************************************************************/
#include "acpi.h"
-#include "acinterp.h"
#include "acnamesp.h"
*
* Module Name: nsxfname - Public interfaces to the ACPI subsystem
* ACPI Namespace oriented interfaces
- * $Revision: 90 $
+ * $Revision: 91 $
*
*****************************************************************************/
#include "acpi.h"
-#include "acinterp.h"
#include "acnamesp.h"
-#include "amlcode.h"
-#include "acparser.h"
-#include "acdispat.h"
-#include "acevents.h"
#define _COMPONENT ACPI_NAMESPACE
/* Just copy the ACPI name from the Node and zero terminate it */
- ACPI_STRNCPY (buffer->pointer, (NATIVE_CHAR *) &node->name,
+ ACPI_STRNCPY (buffer->pointer, node->name.ascii,
ACPI_NAME_SIZE);
((NATIVE_CHAR *) buffer->pointer) [ACPI_NAME_SIZE] = 0;
status = AE_OK;
*
* Module Name: nsxfobj - Public interfaces to the ACPI subsystem
* ACPI Object oriented interfaces
- * $Revision: 108 $
+ * $Revision: 112 $
*
******************************************************************************/
#include "acpi.h"
-#include "acinterp.h"
#include "acnamesp.h"
-#include "acdispat.h"
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("nsxfobj")
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_evaluate_object_typed
+ *
+ * PARAMETERS: Handle - Object handle (optional)
+ * *Pathname - Object pathname (optional)
+ * **External_params - List of parameters to pass to method,
+ * terminated by NULL. May be NULL
+ * if no parameters are being passed.
+ * *Return_buffer - Where to put method's return value (if
+ * any). If NULL, no value is returned.
+ * Return_type - Expected type of return object
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Find and evaluate the given object, passing the given
+ * parameters if necessary. One of "Handle" or "Pathname" must
+ * be valid (non-null)
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_evaluate_object_typed (
+ acpi_handle handle,
+ acpi_string pathname,
+ acpi_object_list *external_params,
+ acpi_buffer *return_buffer,
+ acpi_object_type return_type)
+{
+ acpi_status status;
+ u8 must_free = FALSE;
+
+
+ ACPI_FUNCTION_TRACE ("Acpi_evaluate_object_typed");
+
+
+ /* Return buffer must be valid */
+
+ if (!return_buffer) {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ if (return_buffer->length == ACPI_ALLOCATE_BUFFER) {
+ must_free = TRUE;
+ }
+
+ /* Evaluate the object */
+
+ status = acpi_evaluate_object (handle, pathname, external_params, return_buffer);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+
+ /* Type ANY means "don't care" */
+
+ if (return_type == ACPI_TYPE_ANY) {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ if (return_buffer->length == 0) {
+ /* Error because caller specifically asked for a return value */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "No return value\n"));
+
+ return_ACPI_STATUS (AE_NULL_OBJECT);
+ }
+
+ /* Examine the object type returned from Evaluate_object */
+
+ if (((acpi_object *) return_buffer->pointer)->type == return_type) {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Return object type does not match requested type */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Incorrect return type [%s] requested [%s]\n",
+ acpi_ut_get_type_name (((acpi_object *) return_buffer->pointer)->type),
+ acpi_ut_get_type_name (return_type)));
+
+ if (must_free) {
+ /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */
+
+ acpi_os_free (return_buffer->pointer);
+ return_buffer->pointer = NULL;
+ }
+
+ return_buffer->length = 0;
+ return_ACPI_STATUS (AE_TYPE);
+}
+
+
/*******************************************************************************
*
* FUNCTION: 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) *
+ internal_params = ACPI_MEM_CALLOCATE (((ACPI_SIZE) external_params->count + 1) *
sizeof (void *));
if (!internal_params) {
return_ACPI_STATUS (AE_NO_MEMORY);
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Needed buffer size %X, %s\n",
- buffer_space_needed, acpi_format_exception (status)));
+ (u32) buffer_space_needed, acpi_format_exception (status)));
}
else {
/*
}
}
- info->user_function (obj_handle, nesting_level, info->context, return_value);
- return (AE_OK);
+ status = info->user_function (obj_handle, nesting_level, info->context, return_value);
+ return (status);
}
/******************************************************************************
*
* Module Name: psargs - Parse AML opcode arguments
- * $Revision: 58 $
+ * $Revision: 61 $
*
*****************************************************************************/
(encoded_length & 0x0F));
parser_state->aml += 3;
break;
+
+ default:
+ /* Can't get here, only 2 bits / 4 cases */
+ break;
}
return_VALUE (length);
acpi_ps_get_next_namestring (
acpi_parse_state *parser_state)
{
- u8 *start = parser_state->aml;
- u8 *end = parser_state->aml;
- u32 length;
+ u8 *start = parser_state->aml;
+ u8 *end = parser_state->aml;
ACPI_FUNCTION_TRACE ("Ps_get_next_namestring");
end++;
break;
-
case AML_DUAL_NAME_PREFIX:
- /* two name segments */
+ /* Two name segments */
end += 9;
break;
-
case AML_MULTI_NAME_PREFIX_OP:
- /* multiple name segments */
+ /* Multiple name segments, 4 chars each */
- length = (u32) ACPI_GET8 (end + 1) * 4;
- end += 2 + length;
+ end += 2 + ((ACPI_SIZE) ACPI_GET8 (end + 1) * 4);
break;
-
default:
- /* single name segment */
- /* assert (Acpi_ps_is_lead (GET8 (End))); */
+ /* Single name segment */
end += 4;
break;
}
parser_state->aml = (u8*) end;
-
return_PTR ((NATIVE_CHAR *) start);
}
/* Null name case, create a null namepath object */
acpi_ps_init_op (arg, AML_INT_NAMEPATH_OP);
- arg->value.name = path;
+ arg->common.value.name = path;
return_VOID;
}
}
if (op) {
- if (op->opcode == AML_METHOD_OP) {
+ if (op->common.aml_opcode == AML_METHOD_OP) {
/*
* The name refers to a control method, so this namepath is a
* method invocation. We need to 1) Get the number of arguments
* object into a METHODCALL object.
*/
count = acpi_ps_get_arg (op, 0);
- if (count && count->opcode == AML_BYTE_OP) {
+ if (count && count->common.aml_opcode == AML_BYTE_OP) {
name_op = acpi_ps_alloc_op (AML_INT_NAMEPATH_OP);
if (name_op) {
/* Change arg into a METHOD CALL and attach the name */
acpi_ps_init_op (arg, AML_INT_METHODCALL_OP);
- name_op->value.name = path;
+ name_op->common.value.name = path;
/* Point METHODCALL/NAME to the METHOD Node */
- name_op->node = (acpi_namespace_node *) op;
+ name_op->common.node = (acpi_namespace_node *) op;
acpi_ps_append_arg (arg, name_op);
- *arg_count = (u32) count->value.integer &
+ *arg_count = (u32) count->common.value.integer &
METHOD_FLAGS_ARG_COUNT;
}
}
* pathname
*/
acpi_ps_init_op (arg, AML_INT_NAMEPATH_OP);
- arg->value.name = path;
+ arg->common.value.name = path;
return_VOID;
/* Null name case, create a null namepath object */
acpi_ps_init_op (arg, AML_INT_NAMEPATH_OP);
- arg->value.name = path;
+ arg->common.value.name = path;
return_VOID;
}
+ /*
+ * Lookup the name in the internal namespace
+ */
+ scope_info.scope.node = NULL;
+ node = parser_state->start_node;
+ if (node) {
+ scope_info.scope.node = node;
+ }
- if (method_call) {
- /*
- * Lookup the name in the internal namespace
- */
- scope_info.scope.node = NULL;
- node = parser_state->start_node;
- if (node) {
- scope_info.scope.node = node;
- }
-
- /*
- * Lookup object. We don't want to add anything new to the namespace
- * here, however. So we use MODE_EXECUTE. Allow searching of the
- * 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, ACPI_IMODE_EXECUTE,
- ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL,
- &node);
- if (ACPI_SUCCESS (status)) {
- if (node->type == ACPI_TYPE_METHOD) {
- method_node = node;
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "method - %p Path=%p\n",
- method_node, path));
-
- name_op = acpi_ps_alloc_op (AML_INT_NAMEPATH_OP);
- if (name_op) {
- /* Change arg into a METHOD CALL and attach name to it */
+ /*
+ * Lookup object. We don't want to add anything new to the namespace
+ * here, however. So we use MODE_EXECUTE. Allow searching of the
+ * 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, ACPI_IMODE_EXECUTE,
+ ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL,
+ &node);
+ if (ACPI_SUCCESS (status)) {
+ if (node->type == ACPI_TYPE_METHOD) {
+ method_node = node;
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "method - %p Path=%p\n",
+ method_node, path));
- acpi_ps_init_op (arg, AML_INT_METHODCALL_OP);
+ name_op = acpi_ps_alloc_op (AML_INT_NAMEPATH_OP);
+ if (name_op) {
+ /* Change arg into a METHOD CALL and attach name to it */
- name_op->value.name = path;
+ acpi_ps_init_op (arg, AML_INT_METHODCALL_OP);
- /* Point METHODCALL/NAME to the METHOD Node */
+ name_op->common.value.name = path;
- name_op->node = method_node;
- acpi_ps_append_arg (arg, name_op);
+ /* Point METHODCALL/NAME to the METHOD Node */
- if (!acpi_ns_get_attached_object (method_node)) {
- return_VOID;
- }
+ name_op->common.node = method_node;
+ acpi_ps_append_arg (arg, name_op);
- *arg_count = (acpi_ns_get_attached_object (method_node))->method.param_count;
+ if (!acpi_ns_get_attached_object (method_node)) {
+ return_VOID;
}
- return_VOID;
+ *arg_count = (acpi_ns_get_attached_object (method_node))->method.param_count;
}
- /*
- * Else this is normal named object reference.
- * Just init the NAMEPATH object with the pathname.
- * (See code below)
- */
+ return_VOID;
}
+
+ /*
+ * Else this is normal named object reference.
+ * Just init the NAMEPATH object with the pathname.
+ * (See code below)
+ */
}
/*
* pathname.
*/
acpi_ps_init_op (arg, AML_INT_NAMEPATH_OP);
- arg->value.name = path;
+ arg->common.value.name = path;
return_VOID;
switch (arg_type) {
-
case ARGP_BYTEDATA:
acpi_ps_init_op (arg, AML_BYTE_OP);
- arg->value.integer = (u32) ACPI_GET8 (parser_state->aml);
+ arg->common.value.integer = (u32) ACPI_GET8 (parser_state->aml);
parser_state->aml++;
break;
/* Get 2 bytes from the AML stream */
- ACPI_MOVE_UNALIGNED16_TO_32 (&arg->value.integer, parser_state->aml);
+ ACPI_MOVE_UNALIGNED16_TO_32 (&arg->common.value.integer, parser_state->aml);
parser_state->aml += 2;
break;
/* Get 4 bytes from the AML stream */
- ACPI_MOVE_UNALIGNED32_TO_32 (&arg->value.integer, parser_state->aml);
+ ACPI_MOVE_UNALIGNED32_TO_32 (&arg->common.value.integer, parser_state->aml);
parser_state->aml += 4;
break;
/* Get 8 bytes from the AML stream */
- ACPI_MOVE_UNALIGNED64_TO_64 (&arg->value.integer, parser_state->aml);
+ ACPI_MOVE_UNALIGNED64_TO_64 (&arg->common.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->common.value.string = (char *) parser_state->aml;
while (ACPI_GET8 (parser_state->aml) != '\0') {
parser_state->aml++;
case ARGP_NAMESTRING:
acpi_ps_init_op (arg, AML_INT_NAMEPATH_OP);
- arg->value.name = acpi_ps_get_next_namestring (parser_state);
+ arg->common.value.name = acpi_ps_get_next_namestring (parser_state);
+ break;
+
+
+ default:
+ ACPI_REPORT_ERROR (("Invalid Arg_type %X\n", arg_type));
break;
}
acpi_ps_get_next_field (
acpi_parse_state *parser_state)
{
- u32 aml_offset = parser_state->aml -
- parser_state->aml_start;
+ u32 aml_offset = ACPI_PTR_DIFF (parser_state->aml,
+ parser_state->aml_start);
acpi_parse_object *field;
u16 opcode;
u32 name;
/* determine field type */
switch (ACPI_GET8 (parser_state->aml)) {
-
default:
opcode = AML_INT_NAMEDFIELD_OP;
break;
-
case 0x00:
opcode = AML_INT_RESERVEDFIELD_OP;
parser_state->aml++;
break;
-
case 0x01:
opcode = AML_INT_ACCESSFIELD_OP;
/* Allocate a new field op */
field = acpi_ps_alloc_op (opcode);
- if (field) {
- field->aml_offset = aml_offset;
+ if (!field) {
+ return_PTR (NULL);
+ }
- /* Decode the field type */
+ field->common.aml_offset = aml_offset;
- switch (opcode) {
- case AML_INT_NAMEDFIELD_OP:
+ /* Decode the field type */
- /* Get the 4-character name */
+ switch (opcode) {
+ case AML_INT_NAMEDFIELD_OP:
- ACPI_MOVE_UNALIGNED32_TO_32 (&name, parser_state->aml);
- acpi_ps_set_name (field, name);
- parser_state->aml += 4;
+ /* Get the 4-character name */
- /* Get the length which is encoded as a package length */
+ ACPI_MOVE_UNALIGNED32_TO_32 (&name, parser_state->aml);
+ acpi_ps_set_name (field, name);
+ parser_state->aml += 4;
- field->value.size = acpi_ps_get_next_package_length (parser_state);
- break;
+ /* Get the length which is encoded as a package length */
+ field->common.value.size = acpi_ps_get_next_package_length (parser_state);
+ break;
- case AML_INT_RESERVEDFIELD_OP:
- /* Get the length which is encoded as a package length */
+ case AML_INT_RESERVEDFIELD_OP:
- field->value.size = acpi_ps_get_next_package_length (parser_state);
- break;
+ /* Get the length which is encoded as a package length */
+ field->common.value.size = acpi_ps_get_next_package_length (parser_state);
+ break;
- case AML_INT_ACCESSFIELD_OP:
- /*
- * 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;
- }
+ case AML_INT_ACCESSFIELD_OP:
+
+ /*
+ * Get Access_type and Access_attrib and merge into the field Op
+ * Access_type is first operand, Access_attribute is second
+ */
+ field->common.value.integer32 = (ACPI_GET8 (parser_state->aml) << 8);
+ parser_state->aml++;
+ field->common.value.integer32 |= ACPI_GET8 (parser_state->aml);
+ parser_state->aml++;
+ break;
+
+ default:
+ /* Opcode was set in previous switch */
+ break;
}
return_PTR (field);
}
if (prev) {
- prev->next = field;
+ prev->common.next = field;
}
else {
if (arg) {
/* fill in bytelist data */
- arg->value.size = (parser_state->pkg_end - parser_state->aml);
- ((acpi_parse2_object *) arg)->data = parser_state->aml;
+ arg->common.value.size = ACPI_PTR_DIFF (parser_state->pkg_end, parser_state->aml);
+ arg->named.data = parser_state->aml;
}
/* skip to End of byte data */
*arg_count = ACPI_VAR_ARGS;
}
break;
+
+ default:
+ ACPI_REPORT_ERROR (("Invalid Arg_type: %X\n", arg_type));
+ break;
}
return_PTR (arg);
/******************************************************************************
*
* Module Name: psopcode - Parser/Interpreter opcode information table
- * $Revision: 66 $
+ * $Revision: 69 $
*
*****************************************************************************/
#define _UNKNOWN_OPCODE 0x02 /* An example unknown opcode */
#define MAX_EXTENDED_OPCODE 0x88
-#define NUM_EXTENDED_OPCODE MAX_EXTENDED_OPCODE + 1
+#define NUM_EXTENDED_OPCODE (MAX_EXTENDED_OPCODE + 1)
#define MAX_INTERNAL_OPCODE
-#define NUM_INTERNAL_OPCODE MAX_INTERNAL_OPCODE + 1
+#define NUM_INTERNAL_OPCODE (MAX_INTERNAL_OPCODE + 1)
/*******************************************************************************
*/
-static const acpi_opcode_info acpi_gbl_aml_op_info[] =
+const acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] =
{
/*! [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),
+/* 00 */ ACPI_OP ("Zero", ARGP_ZERO_OP, ARGI_ZERO_OP, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT),
+/* 01 */ ACPI_OP ("One", ARGP_ONE_OP, ARGI_ONE_OP, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT),
/* 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),
+/* 04 */ ACPI_OP ("ByteConst", ARGP_BYTE_OP, ARGI_BYTE_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT),
+/* 05 */ ACPI_OP ("WordConst", ARGP_WORD_OP, ARGI_WORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT),
+/* 06 */ ACPI_OP ("DwordConst", ARGP_DWORD_OP, ARGI_DWORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT),
+/* 07 */ ACPI_OP ("String", ARGP_STRING_OP, ARGI_STRING_OP, ACPI_TYPE_STRING, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT),
/* 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_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER),
-/* 0A */ ACPI_OP ("Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER),
+/* 09 */ ACPI_OP ("Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP, ACPI_TYPE_BUFFER, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER | AML_CONSTANT),
+/* 0A */ ACPI_OP ("Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER | AML_CONSTANT),
/* 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),
/* 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),
+/* 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 | AML_CONSTANT),
+/* 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 | AML_CONSTANT),
+/* 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 | AML_CONSTANT),
+/* 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 | AML_CONSTANT),
+/* 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 | AML_CONSTANT),
+/* 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 | AML_CONSTANT),
+/* 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 | AML_CONSTANT),
+/* 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 | AML_CONSTANT),
+/* 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 | AML_CONSTANT),
+/* 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 | AML_CONSTANT),
+/* 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 | AML_CONSTANT),
+/* 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 | AML_CONSTANT),
+/* 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 | AML_CONSTANT),
+/* 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 | AML_CONSTANT),
+/* 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 | AML_CONSTANT),
+/* 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 | AML_CONSTANT),
+/* 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 | AML_CONSTANT),
/* 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),
+/* 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 | AML_CONSTANT),
+/* 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 | AML_CONSTANT),
/* 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),
+/* 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 | AML_CONSTANT),
+/* 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 | AML_CONSTANT),
+/* 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 | AML_CONSTANT),
+/* 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 | AML_CONSTANT),
+/* 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 | AML_CONSTANT),
+/* 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 | AML_CONSTANT),
/* 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),
/* 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),
+/* 45 */ ACPI_OP ("Ones", ARGP_ONES_OP, ARGI_ONES_OP, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT),
/* Prefixed opcodes (Two-byte opcodes with a prefix op) */
/* 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),
+/* 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 | AML_CONSTANT),
+/* 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 | AML_CONSTANT),
/* 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),
/* Internal opcodes that map to invalid AML opcodes */
-/* 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),
+/* 60 */ ACPI_OP ("LNotEqual", ARGP_LNOTEQUAL_OP, ARGI_LNOTEQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT),
+/* 61 */ ACPI_OP ("LLessEqual", ARGP_LLESSEQUAL_OP, ARGI_LLESSEQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT),
+/* 62 */ ACPI_OP ("LGreaterEqual", ARGP_LGREATEREQUAL_OP, ARGI_LGREATEREQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT),
/* 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),
/* ACPI 2.0 opcodes */
-/* 6E */ ACPI_OP ("QwordConst", ARGP_QWORD_OP, ARGI_QWORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0),
+/* 6E */ ACPI_OP ("QwordConst", ARGP_QWORD_OP, ARGI_QWORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT),
/* 6F */ ACPI_OP ("Package /*Var*/", ARGP_VAR_PACKAGE_OP, ARGI_VAR_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, 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),
+/* 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 | AML_CONSTANT),
+/* 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 | AML_CONSTANT),
/* 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),
+/* 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 | AML_CONSTANT),
+/* 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 | AML_CONSTANT),
+/* 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 | AML_CONSTANT),
+/* 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 | AML_CONSTANT),
+/* 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 | AML_CONSTANT),
/* 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),
+/* 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 | AML_CONSTANT),
/* 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),
}
/* Else fall through to error case below */
+ /*lint -fallthrough */
default:
#endif
}
-
/******************************************************************************
*
* Module Name: psparse - Parser top level AML parse routines
- * $Revision: 121 $
+ * $Revision: 127 $
*
*****************************************************************************/
#include "acdispat.h"
#include "amlcode.h"
#include "acnamesp.h"
-#include "acdebug.h"
#include "acinterp.h"
#define _COMPONENT ACPI_PARSER
ACPI_MODULE_NAME ("psparse")
-u32 acpi_gbl_depth = 0;
-extern u32 acpi_gbl_scope_depth;
+static u32 acpi_gbl_depth = 0;
/*******************************************************************************
* PARAMETERS: Walk_state - Current State
* Op - Op to complete
*
- * RETURN: TRUE if Op and subtree was deleted
+ * RETURN: None.
*
* DESCRIPTION: Perform any cleanup at the completion of an Op.
*
******************************************************************************/
-u8
+void
acpi_ps_complete_this_op (
acpi_walk_state *walk_state,
acpi_parse_object *op)
/* Check for null Op, can happen if AML code is corrupt */
if (!op) {
- return_VALUE (TRUE);
+ return_VOID;
}
/* Delete this op and the subtree below it if asked to */
(walk_state->op_info->class != AML_CLASS_ARGUMENT)) {
/* Make sure that we only delete this subtree */
- if (op->parent) {
+ if (op->common.parent) {
/*
* Check if we need to replace the operator and its subtree
* with a return value op (placeholder op)
*/
- parent_info = acpi_ps_get_opcode_info (op->parent->opcode);
+ parent_info = acpi_ps_get_opcode_info (op->common.parent->common.aml_opcode);
switch (parent_info->class) {
case AML_CLASS_CONTROL:
*/
replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP);
if (!replacement_op) {
- return_VALUE (FALSE);
+ return_VOID;
}
break;
* These opcodes contain Term_arg operands. The current
* op must be replaced by a placeholder return op
*/
- if ((op->parent->opcode == AML_REGION_OP) ||
- (op->parent->opcode == AML_DATA_REGION_OP) ||
- (op->parent->opcode == AML_BUFFER_OP) ||
- (op->parent->opcode == AML_PACKAGE_OP) ||
- (op->parent->opcode == AML_VAR_PACKAGE_OP)) {
+ if ((op->common.parent->common.aml_opcode == AML_REGION_OP) ||
+ (op->common.parent->common.aml_opcode == AML_DATA_REGION_OP) ||
+ (op->common.parent->common.aml_opcode == AML_BUFFER_OP) ||
+ (op->common.parent->common.aml_opcode == AML_PACKAGE_OP) ||
+ (op->common.parent->common.aml_opcode == AML_VAR_PACKAGE_OP)) {
replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP);
if (!replacement_op) {
- return_VALUE (FALSE);
+ return_VOID;
}
}
- if ((op->parent->opcode == AML_NAME_OP) &&
+ if ((op->common.parent->common.aml_opcode == AML_NAME_OP) &&
(walk_state->descending_callback != acpi_ds_exec_begin_op)) {
- if ((op->opcode == AML_BUFFER_OP) ||
- (op->opcode == AML_PACKAGE_OP) ||
- (op->opcode == AML_VAR_PACKAGE_OP)) {
- replacement_op = acpi_ps_alloc_op (op->opcode);
+ if ((op->common.aml_opcode == AML_BUFFER_OP) ||
+ (op->common.aml_opcode == AML_PACKAGE_OP) ||
+ (op->common.aml_opcode == AML_VAR_PACKAGE_OP)) {
+ replacement_op = acpi_ps_alloc_op (op->common.aml_opcode);
if (!replacement_op) {
- return_VALUE (FALSE);
+ return_VOID;
}
- ((acpi_parse2_object *) replacement_op)->data =
- ((acpi_parse2_object *) op)->data;
- ((acpi_parse2_object *) replacement_op)->length =
- ((acpi_parse2_object *) op)->length;
+ replacement_op->named.data = op->named.data;
+ replacement_op->named.length = op->named.length;
}
}
break;
default:
replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP);
if (!replacement_op) {
- return_VALUE (FALSE);
+ return_VOID;
}
}
/* We must unlink this op from the parent tree */
- prev = op->parent->value.arg;
+ prev = op->common.parent->common.value.arg;
if (prev == op) {
/* This op is the first in the list */
if (replacement_op) {
- replacement_op->parent = op->parent;
- replacement_op->value.arg = NULL;
- replacement_op->node = op->node;
- op->parent->value.arg = replacement_op;
- replacement_op->next = op->next;
+ replacement_op->common.parent = op->common.parent;
+ replacement_op->common.value.arg = NULL;
+ replacement_op->common.node = op->common.node;
+ op->common.parent->common.value.arg = replacement_op;
+ replacement_op->common.next = op->common.next;
}
else {
- op->parent->value.arg = op->next;
+ op->common.parent->common.value.arg = op->common.next;
}
}
else while (prev) {
/* Traverse all siblings in the parent's argument list */
- next = prev->next;
+ next = prev->common.next;
if (next == op) {
if (replacement_op) {
- replacement_op->parent = op->parent;
- replacement_op->value.arg = NULL;
- replacement_op->node = op->node;
- prev->next = replacement_op;
- replacement_op->next = op->next;
+ replacement_op->common.parent = op->common.parent;
+ replacement_op->common.value.arg = NULL;
+ replacement_op->common.node = op->common.node;
+ prev->common.next = replacement_op;
+ replacement_op->common.next = op->common.next;
next = NULL;
}
else {
- prev->next = op->next;
+ prev->common.next = op->common.next;
next = NULL;
}
}
acpi_ps_delete_parse_tree (op);
- return_VALUE (TRUE);
+ return_VOID;
}
- return_VALUE (FALSE);
+ return_VOID;
#else
- return (FALSE);
+ return;
#endif
}
status = AE_CTRL_TRANSFER;
walk_state->prev_op = op;
walk_state->method_call_op = op;
- walk_state->method_call_node = (op->value.arg)->node;
+ walk_state->method_call_node = (op->common.value.arg)->common.node;
/* Will return value (if any) be used by the caller? */
ACPI_FUNCTION_TRACE_PTR ("Ps_parse_loop", walk_state);
+ if (walk_state->descending_callback == NULL) {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
parser_state = &walk_state->parser_state;
walk_state->arg_types = 0;
* was just completed
*/
if ((parser_state->scope->parse_scope.op) &&
- ((parser_state->scope->parse_scope.op->opcode == AML_IF_OP) ||
- (parser_state->scope->parse_scope.op->opcode == AML_WHILE_OP)) &&
+ ((parser_state->scope->parse_scope.op->common.aml_opcode == AML_IF_OP) ||
+ (parser_state->scope->parse_scope.op->common.aml_opcode == AML_WHILE_OP)) &&
(walk_state->control_state) &&
(walk_state->control_state->common.state ==
ACPI_CONTROL_PREDICATE_EXECUTING)) {
* Iterative parsing loop, while there is more aml to process:
*/
while ((parser_state->aml < parser_state->aml_end) || (op)) {
+ aml_op_start = parser_state->aml;
if (!op) {
/* Get the next opcode from the AML stream */
- aml_op_start = parser_state->aml;
- walk_state->aml_offset = parser_state->aml - parser_state->aml_start;
- walk_state->opcode = acpi_ps_peek_opcode (parser_state);
+ walk_state->aml_offset = ACPI_PTR_DIFF (parser_state->aml, parser_state->aml_start);
+ walk_state->opcode = acpi_ps_peek_opcode (parser_state);
/*
* First cut to determine what we have found:
/* Create Op structure and append to parent's argument list */
if (walk_state->op_info->flags & AML_NAMED) {
- pre_op.value.arg = NULL;
- pre_op.opcode = walk_state->opcode;
+ pre_op.common.value.arg = NULL;
+ pre_op.common.aml_opcode = walk_state->opcode;
while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) != ARGP_NAME) {
arg = acpi_ps_get_next_arg (parser_state,
INCREMENT_ARG_LIST (walk_state->arg_types);
- if (walk_state->descending_callback != NULL) {
- /*
- * Find the object. This will either insert the object into
- * the namespace or simply look it up
- */
- walk_state->op = NULL;
+ /*
+ * Find the object. This will either insert the object into
+ * the namespace or simply look it up
+ */
+ walk_state->op = NULL;
- status = walk_state->descending_callback (walk_state, &op);
- if (ACPI_FAILURE (status)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "During name lookup/catalog, %s\n",
- acpi_format_exception (status)));
- goto close_this_op;
- }
+ status = walk_state->descending_callback (walk_state, &op);
+ if (ACPI_FAILURE (status)) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "During name lookup/catalog, %s\n",
+ acpi_format_exception (status)));
+ goto close_this_op;
+ }
- if (op == NULL) {
- continue;
- }
+ if (op == NULL) {
+ continue;
+ }
- status = acpi_ps_next_parse_state (walk_state, op, status);
- if (status == AE_CTRL_PENDING) {
- status = AE_OK;
- goto close_this_op;
- }
+ status = acpi_ps_next_parse_state (walk_state, op, status);
+ if (status == AE_CTRL_PENDING) {
+ status = AE_OK;
+ goto close_this_op;
+ }
- if (ACPI_FAILURE (status)) {
- goto close_this_op;
- }
+ if (ACPI_FAILURE (status)) {
+ goto close_this_op;
}
- acpi_ps_append_arg (op, pre_op.value.arg);
+ acpi_ps_append_arg (op, pre_op.common.value.arg);
acpi_gbl_depth++;
- if (op->opcode == AML_REGION_OP) {
+ if (op->common.aml_opcode == AML_REGION_OP) {
/*
* Defer final parsing of an Operation_region body,
* because we don't have enough info in the first pass
*
* (Length is unknown until parse of the body complete)
*/
- ((acpi_parse2_object * ) op)->data = aml_op_start;
- ((acpi_parse2_object * ) op)->length = 0;
+ op->named.data = aml_op_start;
+ op->named.length = 0;
}
}
else {
* Backup to beginning of Create_xXXfield declaration
* Body_length is unknown until we parse the body
*/
- ((acpi_parse2_object * ) op)->data = aml_op_start;
- ((acpi_parse2_object * ) op)->length = 0;
+ op->named.data = aml_op_start;
+ op->named.length = 0;
}
acpi_ps_append_arg (acpi_ps_get_parent_scope (parser_state), op);
}
}
- op->aml_offset = walk_state->aml_offset;
+ op->common.aml_offset = walk_state->aml_offset;
if (walk_state->op_info) {
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
- "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));
+ "Opcode %4.4hX [%s] Op %p Aml %p Aml_offset %5.5X\n",
+ op->common.aml_opcode, walk_state->op_info->name,
+ op, parser_state->aml, op->common.aml_offset));
}
}
if (walk_state->arg_types) /* Are there any arguments that must be processed? */ {
/* Get arguments */
- switch (op->opcode) {
+ switch (op->common.aml_opcode) {
case AML_BYTE_OP: /* AML_BYTEDATA_ARG */
case AML_WORD_OP: /* AML_WORDDATA_ARG */
case AML_DWORD_OP: /* AML_DWORDATA_ARG */
/* Op is not a constant or string, append each argument */
while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) && !walk_state->arg_count) {
- walk_state->aml_offset = parser_state->aml - parser_state->aml_start;
+ walk_state->aml_offset = ACPI_PTR_DIFF (parser_state->aml,
+ parser_state->aml_start);
arg = acpi_ps_get_next_arg (parser_state,
GET_CURRENT_ARG_TYPE (walk_state->arg_types),
&walk_state->arg_count);
if (arg) {
- arg->aml_offset = walk_state->aml_offset;
+ arg->common.aml_offset = walk_state->aml_offset;
acpi_ps_append_arg (op, arg);
}
INCREMENT_ARG_LIST (walk_state->arg_types);
}
- switch (op->opcode) {
+ switch (op->common.aml_opcode) {
case AML_METHOD_OP:
/* For a method, save the length and address of the body */
* 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);
+ op->named.data = parser_state->aml;
+ op->named.length = (u32) (parser_state->pkg_end - parser_state->aml);
/*
* Skip body of method. For Op_regions, we must continue
* parsing because the opregion is not a standalone
case AML_PACKAGE_OP:
case AML_VAR_PACKAGE_OP:
- if ((op->parent) &&
- (op->parent->opcode == AML_NAME_OP) &&
+ if ((op->common.parent) &&
+ (op->common.parent->common.aml_opcode == AML_NAME_OP) &&
(walk_state->descending_callback != acpi_ds_exec_begin_op)) {
/*
* Skip parsing of
* because we don't have enough info in the first pass
* to parse them correctly.
*/
- ((acpi_parse2_object * ) op)->data = aml_op_start;
- ((acpi_parse2_object * ) op)->length = (u32) (parser_state->pkg_end -
- aml_op_start);
+ op->named.data = aml_op_start;
+ op->named.length = (u32) (parser_state->pkg_end - aml_op_start);
/*
* Skip body
*/
walk_state->control_state->control.package_end = parser_state->pkg_end;
}
break;
+
+ default:
+ /* No action for all other opcodes */
+ break;
}
break;
}
if (walk_state->arg_count) {
/* There are arguments (complex ones), push Op and prepare for argument */
- acpi_ps_push_scope (parser_state, op, walk_state->arg_types, walk_state->arg_count);
+ status = acpi_ps_push_scope (parser_state, op, walk_state->arg_types, walk_state->arg_count);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
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);
+ walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
if (walk_state->op_info->flags & AML_NAMED) {
if (acpi_gbl_depth) {
acpi_gbl_depth--;
}
- if (op->opcode == AML_REGION_OP) {
+ if (op->common.aml_opcode == AML_REGION_OP) {
/*
* Skip parsing of control method or opregion body,
* because we don't have enough info in the first pass
* 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);
+ op->named.length = (u32) (parser_state->aml - op->named.data);
}
}
*
* Body_length is unknown until we parse the body
*/
- ((acpi_parse2_object * ) op)->length = (u32) (parser_state->aml -
- ((acpi_parse2_object * ) op)->data);
+ op->named.length = (u32) (parser_state->aml - op->named.data);
}
/* This op complete, notify the dispatcher */
if (walk_state->ascending_callback != NULL) {
walk_state->op = op;
- walk_state->opcode = op->opcode;
+ walk_state->opcode = op->common.aml_opcode;
status = walk_state->ascending_callback (walk_state);
status = acpi_ps_next_parse_state (walk_state, op, status);
*/
parser_state->scope->parse_scope.arg_count--;
- /* Close this Op (may result in parse subtree deletion) */
+ /* Close this Op (will result in parse subtree deletion) */
- if (acpi_ps_complete_this_op (walk_state, op)) {
- op = NULL;
- }
+ acpi_ps_complete_this_op (walk_state, op);
+ op = NULL;
switch (status) {
case AE_OK:
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;
+ walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
+ walk_state->opcode = op->common.aml_opcode;
status = walk_state->ascending_callback (walk_state);
status = acpi_ps_next_parse_state (walk_state, op, status);
/* Pop off scopes until we find the While */
- while (!op || (op->opcode != AML_WHILE_OP)) {
+ while (!op || (op->common.aml_opcode != AML_WHILE_OP)) {
acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types, &walk_state->arg_count);
}
/* Close this iteration of the While loop */
walk_state->op = op;
- walk_state->op_info = acpi_ps_get_opcode_info (op->opcode);
- walk_state->opcode = op->opcode;
+ walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
+ walk_state->opcode = op->common.aml_opcode;
status = walk_state->ascending_callback (walk_state);
status = acpi_ps_next_parse_state (walk_state, op, status);
if (op) {
if (walk_state->ascending_callback != NULL) {
walk_state->op = op;
- walk_state->op_info = acpi_ps_get_opcode_info (op->opcode);
- walk_state->opcode = op->opcode;
+ walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
+ walk_state->opcode = op->common.aml_opcode;
status = walk_state->ascending_callback (walk_state);
status = acpi_ps_next_parse_state (walk_state, op, status);
* there's lots of cleanup to do
*/
if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) {
- acpi_ds_terminate_control_method (walk_state);
+ status = acpi_ds_terminate_control_method (walk_state);
+ if (ACPI_FAILURE (status)) {
+ ACPI_REPORT_ERROR (("Could not terminate control method properly\n"));
+ status = AE_OK;
+
+ /* Ignore error and continue */
+ }
}
/* Delete this walk state and all linked control states */
* 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 |= ACPI_WALK_METHOD_RESTART;
+ status = acpi_ds_restart_control_method (walk_state, previous_walk_state->return_desc);
+ if (ACPI_SUCCESS (status)) {
+ walk_state->walk_type |= ACPI_WALK_METHOD_RESTART;
+ }
}
else {
/* On error, delete any return object */
/* Normal exit */
acpi_ex_release_all_mutexes (thread);
- acpi_ut_delete_generic_state ((acpi_generic_state *) thread);
+ acpi_ut_delete_generic_state (ACPI_CAST_PTR (acpi_generic_state, thread));
acpi_gbl_current_walk_list = prev_walk_list;
return_ACPI_STATUS (status);
}
/******************************************************************************
*
* Module Name: pstree - Parser op tree manipulation/traversal/search
- * $Revision: 37 $
+ * $Revision: 39 $
*
*****************************************************************************/
/* Get the info structure for this opcode */
- op_info = acpi_ps_get_opcode_info (op->opcode);
+ op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
if (op_info->class == AML_CLASS_UNKNOWN) {
/* Invalid opcode or ASCII character */
/* Get the requested argument object */
- arg = op->value.arg;
+ arg = op->common.value.arg;
while (arg && argn) {
argn--;
- arg = arg->next;
+ arg = arg->common.next;
}
return (arg);
/* Get the info structure for this opcode */
- op_info = acpi_ps_get_opcode_info (op->opcode);
+ op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
if (op_info->class == AML_CLASS_UNKNOWN) {
/* Invalid opcode */
- ACPI_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->common.aml_opcode));
return;
}
/* Append the argument to the linked argument list */
- if (op->value.arg) {
+ if (op->common.value.arg) {
/* Append to existing argument list */
- prev_arg = op->value.arg;
- while (prev_arg->next) {
- prev_arg = prev_arg->next;
+ prev_arg = op->common.value.arg;
+ while (prev_arg->common.next) {
+ prev_arg = prev_arg->common.next;
}
- prev_arg->next = arg;
+ prev_arg->common.next = arg;
}
else {
/* No argument list, this will be the first argument */
- op->value.arg = arg;
+ op->common.value.arg = arg;
}
/* Set the parent in this arg and any args linked after it */
while (arg) {
- arg->parent = op;
- arg = arg->next;
+ arg->common.parent = op;
+ arg = arg->common.next;
}
}
ACPI_FUNCTION_ENTRY ();
- switch (op->opcode) {
+ switch (op->common.aml_opcode) {
case AML_SCOPE_OP:
case AML_ELSE_OP:
case AML_DEVICE_OP:
child = acpi_ps_get_arg (op, 3);
break;
+
+ default:
+ /* All others have no children */
+ break;
}
return (child);
/* look for a sibling */
- next = op->next;
+ next = op->common.next;
if (next) {
return (next);
}
/* look for a sibling of parent */
- parent = op->parent;
+ parent = op->common.parent;
while (parent) {
arg = acpi_ps_get_arg (parent, 0);
while (arg && (arg != origin) && (arg != op)) {
- arg = arg->next;
+ arg = arg->common.next;
}
if (arg == origin) {
return (NULL);
}
- if (parent->next) {
+ if (parent->common.next) {
/* found sibling of parent */
- return (parent->next);
+
+ return (parent->common.next);
}
op = parent;
- parent = parent->parent;
+ parent = parent->common.parent;
}
return (next);
/******************************************************************************
*
* Module Name: psutils - Parser miscellaneous utilities (Parser only)
- * $Revision: 50 $
+ * $Revision: 51 $
*
*****************************************************************************/
ACPI_FUNCTION_ENTRY ();
- op->data_type = ACPI_DESC_TYPE_PARSER;
- op->opcode = opcode;
+ op->common.data_type = ACPI_DESC_TYPE_PARSER;
+ op->common.aml_opcode = opcode;
- ACPI_DEBUG_ONLY_MEMBERS (ACPI_STRNCPY (op->op_name,
- (acpi_ps_get_opcode_info (opcode))->name, sizeof (op->op_name)));
+ ACPI_DEBUG_ONLY_MEMBERS (ACPI_STRNCPY (op->common.aml_op_name,
+ (acpi_ps_get_opcode_info (opcode))->name, sizeof (op->common.aml_op_name)));
}
/* Allocate the minimum required size object */
if (op_info->flags & AML_DEFER) {
- size = sizeof (acpi_parse2_object);
+ size = sizeof (ACPI_PARSE_OBJ_NAMED);
flags = ACPI_PARSEOP_DEFERRED;
}
else if (op_info->flags & AML_NAMED) {
- size = sizeof (acpi_parse2_object);
+ size = sizeof (ACPI_PARSE_OBJ_NAMED);
flags = ACPI_PARSEOP_NAMED;
}
else if (opcode == AML_INT_BYTELIST_OP) {
- size = sizeof (acpi_parse2_object);
+ size = sizeof (ACPI_PARSE_OBJ_NAMED);
flags = ACPI_PARSEOP_BYTELIST;
}
else {
- size = sizeof (acpi_parse_object);
+ size = sizeof (ACPI_PARSE_OBJ_COMMON);
flags = ACPI_PARSEOP_GENERIC;
}
- if (size == sizeof (acpi_parse_object)) {
+ if (size == sizeof (ACPI_PARSE_OBJ_COMMON)) {
/*
* The generic op is by far the most common (16 to 1)
*/
if (op) {
acpi_ps_init_op (op, opcode);
- op->flags = flags;
+ op->common.flags = flags;
}
return (op);
ACPI_FUNCTION_NAME ("Ps_free_op");
- if (op->opcode == AML_INT_RETURN_VALUE_OP) {
+ if (op->common.aml_opcode == AML_INT_RETURN_VALUE_OP) {
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n", op));
}
- if (op->flags == ACPI_PARSEOP_GENERIC) {
+ if (op->common.flags == ACPI_PARSEOP_GENERIC) {
acpi_ut_release_to_cache (ACPI_MEM_LIST_PSNODE, op);
}
else {
/* The "generic" object has no name associated with it */
- if (op->flags & ACPI_PARSEOP_GENERIC) {
+ if (op->common.flags & ACPI_PARSEOP_GENERIC) {
return (0);
}
/* Only the "Extended" parse objects have a name */
- return (((acpi_parse2_object *) op)->name);
+ return (op->named.name);
}
/* The "generic" object has no name associated with it */
- if (op->flags & ACPI_PARSEOP_GENERIC) {
+ if (op->common.flags & ACPI_PARSEOP_GENERIC) {
return;
}
- ((acpi_parse2_object *) op)->name = name;
+ op->named.name = name;
}
/******************************************************************************
*
* Module Name: pswalk - Parser routines to walk parsed op tree(s)
- * $Revision: 63 $
+ * $Revision: 67 $
*
*****************************************************************************/
#include "acpi.h"
-#include "amlcode.h"
#include "acparser.h"
#include "acdispat.h"
-#include "acnamesp.h"
-#include "acinterp.h"
#define _COMPONENT ACPI_PARSER
ACPI_MODULE_NAME ("pswalk")
* No more children, this Op is complete. Save Next and Parent
* in case the Op object gets deleted by the callback routine
*/
- next = op->next;
- parent = op->parent;
+ next = op->common.next;
+ parent = op->common.parent;
walk_state->op = op;
- walk_state->op_info = acpi_ps_get_opcode_info (op->opcode);
- walk_state->opcode = op->opcode;
+ walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
+ walk_state->opcode = op->common.aml_opcode;
status = ascending_callback (walk_state);
while (parent) {
/* We are moving up the tree, therefore this parent Op is complete */
- grand_parent = parent->parent;
- next = parent->next;
+ grand_parent = parent->common.parent;
+ next = parent->common.next;
walk_state->op = parent;
- walk_state->op_info = acpi_ps_get_opcode_info (parent->opcode);
- walk_state->opcode = parent->opcode;
+ walk_state->op_info = acpi_ps_get_opcode_info (parent->common.aml_opcode);
+ walk_state->opcode = parent->common.aml_opcode;
status = ascending_callback (walk_state);
{
acpi_walk_state *walk_state;
ACPI_THREAD_STATE *thread;
+ acpi_status status;
ACPI_FUNCTION_TRACE_PTR ("Ps_delete_parse_tree", subtree_root);
return_VOID;
}
-
walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT, NULL, NULL, thread);
if (!walk_state) {
return_VOID;
/* Visit all nodes in the subtree */
while (walk_state->next_op) {
- acpi_ps_get_next_walk_op (walk_state, walk_state->next_op,
+ status = acpi_ps_get_next_walk_op (walk_state, walk_state->next_op,
acpi_ps_delete_completed_op);
+ if (ACPI_FAILURE (status)) {
+ break;
+ }
}
/* We are done with this walk */
- acpi_ut_delete_generic_state ((acpi_generic_state *) thread);
+ acpi_ut_delete_generic_state (ACPI_CAST_PTR (acpi_generic_state, thread));
acpi_ds_delete_walk_state (walk_state);
return_VOID;
/******************************************************************************
*
* Module Name: psxface - Parser external interfaces
- * $Revision: 61 $
+ * $Revision: 64 $
*
*****************************************************************************/
status = acpi_ps_parse_aml (walk_state);
acpi_ps_delete_parse_tree (op);
-
/*
* 2) Execute the method. Performs second pass parse simultaneously
*/
/* Init new op with the method name and pointer back to the NS node */
acpi_ps_set_name (op, method_node->name.integer);
- op->node = method_node;
+ op->common.node = method_node;
/* Create and initialize a new walk 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);
}
/* Take away the extra reference that we gave the parameters above */
for (i = 0; params[i]; i++) {
- acpi_ut_update_object_reference (params[i], REF_DECREMENT);
+ /* Ignore errors, just do them all */
+
+ (void) acpi_ut_update_object_reference (params[i], REF_DECREMENT);
}
}
/*******************************************************************************
*
* Module Name: rsaddr - Address resource descriptors (16/32/64)
- * $Revision: 24 $
+ * $Revision: 26 $
*
******************************************************************************/
ACPI_SIZE *structure_size)
{
u8 *buffer = byte_stream_buffer;
- acpi_resource *output_struct = (acpi_resource *) *output_buffer;
- NATIVE_CHAR *temp_ptr;
+ acpi_resource *output_struct = (void *) *output_buffer;
+ u8 *temp_ptr;
ACPI_SIZE struct_size = ACPI_SIZEOF_RESOURCE (acpi_resource_address16);
u32 index;
u16 temp16;
output_struct->data.address16.resource_source.string_ptr =
(NATIVE_CHAR *)((u8 * )output_struct + struct_size);
- temp_ptr = output_struct->data.address16.resource_source.string_ptr;
+ temp_ptr = (u8 *) output_struct->data.address16.resource_source.string_ptr;
/* Copy the string into the buffer */
/*
* Set the Length parameter
*/
- output_struct->length = struct_size;
+ output_struct->length = (u32) struct_size;
/*
* Return the final size of the structure
* Buffer needs to be set to the length of the sting + one for the
* terminating null
*/
- buffer += (ACPI_STRLEN (linked_list->data.address16.resource_source.string_ptr)
- + 1);
+ buffer += (ACPI_STRLEN (linked_list->data.address16.resource_source.string_ptr) + 1);
}
/*
ACPI_SIZE *structure_size)
{
u8 *buffer;
- acpi_resource *output_struct;
+ acpi_resource *output_struct= (void *) *output_buffer;
u16 temp16;
u8 temp8;
- NATIVE_CHAR *temp_ptr;
+ u8 *temp_ptr;
ACPI_SIZE struct_size;
u32 index;
buffer = byte_stream_buffer;
- output_struct = (acpi_resource *) *output_buffer;
-
struct_size = ACPI_SIZEOF_RESOURCE (acpi_resource_address32);
/*
output_struct->data.address32.resource_source.string_ptr =
(NATIVE_CHAR *)((u8 *)output_struct + struct_size);
- temp_ptr = output_struct->data.address32.resource_source.string_ptr;
+ temp_ptr = (u8 *) output_struct->data.address32.resource_source.string_ptr;
/* Copy the string into the buffer */
/*
* Set the Length parameter
*/
- output_struct->length = struct_size;
+ output_struct->length = (u32) struct_size;
/*
* Return the final size of the structure
/*
* Set a pointer to the Length field - to be filled in later
*/
- length_field = (u16 *) buffer;
+ length_field = ACPI_CAST_PTR (u16, buffer);
buffer += 2;
/*
ACPI_SIZE *structure_size)
{
u8 *buffer;
- acpi_resource *output_struct;
+ acpi_resource *output_struct = (void *) *output_buffer;
u16 temp16;
u8 temp8;
- NATIVE_CHAR *temp_ptr;
+ u8 *temp_ptr;
ACPI_SIZE struct_size;
u32 index;
buffer = byte_stream_buffer;
- output_struct = (acpi_resource *) *output_buffer;
-
struct_size = ACPI_SIZEOF_RESOURCE (acpi_resource_address64);
/*
output_struct->data.address64.resource_source.string_ptr =
(NATIVE_CHAR *)((u8 *)output_struct + struct_size);
- temp_ptr = output_struct->data.address64.resource_source.string_ptr;
+ temp_ptr = (u8 *) output_struct->data.address64.resource_source.string_ptr;
/* Copy the string into the buffer */
/*
* Set the Length parameter
*/
- output_struct->length = struct_size;
+ output_struct->length = (u32) struct_size;
/*
* Return the final size of the structure
* Set a pointer to the Length field - to be filled in later
*/
- length_field = (u16 *)buffer;
+ length_field = ACPI_CAST_PTR (u16, buffer);
buffer += 2;
/*
/*******************************************************************************
*
* Module Name: rscalc - Calculate stream and list lengths
- * $Revision: 39 $
+ * $Revision: 42 $
*
******************************************************************************/
/*******************************************************************************
*
- * FUNCTION: Acpi_rs_calculate_byte_stream_length
+ * FUNCTION: Acpi_rs_get_byte_stream_length
*
* PARAMETERS: Linked_list - Pointer to the resource linked list
* Size_needed - u32 pointer of the size buffer needed
******************************************************************************/
acpi_status
-acpi_rs_calculate_byte_stream_length (
+acpi_rs_get_byte_stream_length (
acpi_resource *linked_list,
ACPI_SIZE *size_needed)
{
u8 done = FALSE;
- ACPI_FUNCTION_TRACE ("Rs_calculate_byte_stream_length");
+ ACPI_FUNCTION_TRACE ("Rs_get_byte_stream_length");
while (!done) {
*/
segment_size = 16;
- if (NULL != linked_list->data.address16.resource_source.string_ptr) {
- segment_size += (1 +
- linked_list->data.address16.resource_source.string_length);
+ if (linked_list->data.address16.resource_source.string_ptr) {
+ segment_size += linked_list->data.address16.resource_source.string_length;
+ segment_size++;
}
break;
*/
segment_size = 26;
- if (NULL != linked_list->data.address32.resource_source.string_ptr) {
- segment_size += (1 +
- linked_list->data.address32.resource_source.string_length);
+ if (linked_list->data.address32.resource_source.string_ptr) {
+ segment_size += linked_list->data.address32.resource_source.string_length;
+ segment_size++;
}
break;
*/
segment_size = 46;
- if (NULL != linked_list->data.address64.resource_source.string_ptr) {
- segment_size += (1 +
- linked_list->data.address64.resource_source.string_length);
+ if (linked_list->data.address64.resource_source.string_ptr) {
+ segment_size += linked_list->data.address64.resource_source.string_length;
+ segment_size++;
}
break;
* Resource Source + 1 for the null.
*/
segment_size = 9 +
- ((linked_list->data.extended_irq.number_of_interrupts - 1) * 4);
+ (((ACPI_SIZE) linked_list->data.extended_irq.number_of_interrupts - 1) * 4);
- if (NULL != ex_irq->resource_source.string_ptr) {
- segment_size += (1 +
- linked_list->data.extended_irq.resource_source.string_length);
+ if (ex_irq && ex_irq->resource_source.string_ptr) {
+ segment_size += linked_list->data.extended_irq.resource_source.string_length;
+ segment_size++;
}
break;
/*******************************************************************************
*
- * FUNCTION: Acpi_rs_calculate_list_length
+ * FUNCTION: Acpi_rs_get_list_length
*
* PARAMETERS: Byte_stream_buffer - Pointer to the resource byte stream
* Byte_stream_buffer_length - Size of Byte_stream_buffer
******************************************************************************/
acpi_status
-acpi_rs_calculate_list_length (
+acpi_rs_get_list_length (
u8 *byte_stream_buffer,
u32 byte_stream_buffer_length,
ACPI_SIZE *size_needed)
u8 additional_bytes;
- ACPI_FUNCTION_TRACE ("Rs_calculate_list_length");
+ ACPI_FUNCTION_TRACE ("Rs_get_list_length");
while (bytes_parsed < byte_stream_buffer_length) {
/*******************************************************************************
*
- * FUNCTION: Acpi_rs_calculate_pci_routing_table_length
+ * FUNCTION: Acpi_rs_get_pci_routing_table_length
*
* PARAMETERS: Package_object - Pointer to the package object
* Buffer_size_needed - u32 pointer of the size buffer
******************************************************************************/
acpi_status
-acpi_rs_calculate_pci_routing_table_length (
+acpi_rs_get_pci_routing_table_length (
acpi_operand_object *package_object,
ACPI_SIZE *buffer_size_needed)
{
u32 number_of_elements;
- u32 temp_size_needed = 0;
+ ACPI_SIZE temp_size_needed = 0;
acpi_operand_object **top_object_list;
u32 index;
acpi_operand_object *package_element;
u32 table_index;
- ACPI_FUNCTION_TRACE ("Rs_calculate_pci_routing_table_length");
+ ACPI_FUNCTION_TRACE ("Rs_get_pci_routing_table_length");
number_of_elements = package_object->package.count;
/*
* Was a String type found?
*/
- if (TRUE == name_found) {
+ if (name_found) {
if (ACPI_TYPE_STRING == (*sub_object_list)->common.type) {
/*
* The length String.Length field includes the
/*******************************************************************************
*
* Module Name: rscreate - Create resource lists/tables
- * $Revision: 53 $
+ * $Revision: 56 $
*
******************************************************************************/
* Pass the Byte_stream_buffer into a module that can calculate
* the buffer size needed for the linked list
*/
- status = acpi_rs_calculate_list_length (byte_stream_start, byte_stream_buffer_length,
+ status = acpi_rs_get_list_length (byte_stream_start, byte_stream_buffer_length,
&list_size_needed);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Status=%X List_size_needed=%X\n",
- status, list_size_needed));
+ status, (u32) list_size_needed));
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));
+ output_buffer->pointer, (u32) output_buffer->length));
return_ACPI_STATUS (AE_OK);
}
/*
* Get the required buffer length
*/
- status = acpi_rs_calculate_pci_routing_table_length (package_object,
+ status = acpi_rs_get_pci_routing_table_length (package_object,
&buffer_size_needed);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Buffer_size_needed = %X\n", buffer_size_needed));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Buffer_size_needed = %X\n", (u32) buffer_size_needed));
/* Validate/Allocate/Clear caller buffer */
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;
+ user_prt = ACPI_CAST_PTR (acpi_pci_routing_table, buffer);
for (index = 0; index < number_of_elements; index++) {
/*
* be zero because we cleared the return buffer earlier
*/
buffer += user_prt->length;
- user_prt = (acpi_pci_routing_table *) buffer;
+ user_prt = ACPI_CAST_PTR (acpi_pci_routing_table, buffer);
/*
* Fill in the Length field with the information we have at this point.
(u32) ((u8 *) user_prt->source - (u8 *) output_buffer->pointer);
path_buffer.pointer = user_prt->source;
- status = acpi_ns_handle_to_pathname ((acpi_handle *) node, &path_buffer);
+ status = acpi_ns_handle_to_pathname ((acpi_handle) node, &path_buffer);
user_prt->length += ACPI_STRLEN (user_prt->source) + 1; /* include null terminator */
break;
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Output_buffer %p Length %X\n",
- output_buffer->pointer, output_buffer->length));
+ output_buffer->pointer, (u32) output_buffer->length));
return_ACPI_STATUS (AE_OK);
}
* 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,
+ status = acpi_rs_get_byte_stream_length (linked_list_buffer,
&byte_stream_size_needed);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Byte_stream_size_needed=%X, %s\n",
- byte_stream_size_needed, acpi_format_exception (status)));
+ (u32) byte_stream_size_needed, acpi_format_exception (status)));
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));
+ output_buffer->pointer, (u32) output_buffer->length));
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
* Module Name: rsdump - Functions to display the resource structures.
- * $Revision: 29 $
+ * $Revision: 32 $
*
******************************************************************************/
ACPI_MODULE_NAME ("rsdump")
-#ifdef ACPI_DEBUG
+#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER)
/*******************************************************************************
*
void
acpi_rs_dump_start_depend_fns (
- acpi_resource_data *data)
+ acpi_resource_data *data)
{
- acpi_resource_start_dpf *sdf_data = (acpi_resource_start_dpf *) data;
+ acpi_resource_start_dpf *sdf_data = (acpi_resource_start_dpf *) data;
ACPI_FUNCTION_ENTRY ();
if (acpi_dbg_level & ACPI_LV_RESOURCES && _COMPONENT & acpi_dbg_layer) {
while (!done) {
- acpi_os_printf ("Resource structure %x.\n", count++);
+ acpi_os_printf ("Resource structure %X.\n", count++);
switch (resource->id) {
case ACPI_RSTYPE_IRQ:
if (acpi_dbg_level & ACPI_LV_RESOURCES && _COMPONENT & acpi_dbg_layer) {
- prt_element = (acpi_pci_routing_table *) buffer;
+ prt_element = ACPI_CAST_PTR (acpi_pci_routing_table, buffer);
while (!done) {
acpi_os_printf ("PCI IRQ Routing Table structure %X.\n", count++);
buffer += prt_element->length;
- prt_element = (acpi_pci_routing_table *) buffer;
+ prt_element = ACPI_CAST_PTR (acpi_pci_routing_table, buffer);
if(0 == prt_element->length) {
done = TRUE;
/*******************************************************************************
*
* Module Name: rsio - IO and DMA resource descriptors
- * $Revision: 17 $
+ * $Revision: 20 $
*
******************************************************************************/
ACPI_SIZE *structure_size)
{
u8 *buffer = byte_stream_buffer;
- acpi_resource *output_struct = (acpi_resource *) *output_buffer;
+ acpi_resource *output_struct = (void *) *output_buffer;
u16 temp16 = 0;
u8 temp8 = 0;
ACPI_SIZE struct_size = ACPI_SIZEOF_RESOURCE (acpi_resource_io);
/*
* Set the Length parameter
*/
- output_struct->length = struct_size;
+ output_struct->length = (u32) struct_size;
/*
* Return the final size of the structure
ACPI_SIZE *structure_size)
{
u8 *buffer = byte_stream_buffer;
- acpi_resource *output_struct = (acpi_resource *) *output_buffer;
+ acpi_resource *output_struct = (void *) *output_buffer;
u16 temp16 = 0;
u8 temp8 = 0;
ACPI_SIZE struct_size = ACPI_SIZEOF_RESOURCE (acpi_resource_fixed_io);
/*
* Set the Length parameter
*/
- output_struct->length = struct_size;
+ output_struct->length = (u32) struct_size;
/*
* Return the final size of the structure
ACPI_SIZE *structure_size)
{
u8 *buffer = byte_stream_buffer;
- acpi_resource *output_struct = (acpi_resource *) *output_buffer;
+ acpi_resource *output_struct = (void *) *output_buffer;
u8 temp8 = 0;
u8 index;
u8 i;
i++;
}
}
+ if (i == 0) {
+ /* Zero channels is invalid! */
+
+ return_ACPI_STATUS (AE_BAD_DATA);
+ }
output_struct->data.dma.number_of_channels = i;
/*
* Calculate the structure size based upon the number of interrupts
*/
- struct_size += (output_struct->data.dma.number_of_channels - 1) * 4;
+ struct_size += ((ACPI_SIZE) output_struct->data.dma.number_of_channels - 1) * 4;
/*
* Point to Byte 2
/*
* Set the Length parameter
*/
- output_struct->length = struct_size;
+ output_struct->length = (u32) struct_size;
/*
* Return the final size of the structure
/*******************************************************************************
*
* Module Name: rsirq - IRQ resource descriptors
- * $Revision: 24 $
+ * $Revision: 28 $
*
******************************************************************************/
ACPI_SIZE *structure_size)
{
u8 *buffer = byte_stream_buffer;
- acpi_resource *output_struct = (acpi_resource *) *output_buffer;
+ acpi_resource *output_struct = (void *) *output_buffer;
u16 temp16 = 0;
u8 temp8 = 0;
u8 index;
/* Decode the IRQ bits */
for (i = 0, index = 0; index < 16; index++) {
- if((temp16 >> index) & 0x01) {
+ if ((temp16 >> index) & 0x01) {
output_struct->data.irq.interrupts[i] = index;
i++;
}
}
+
+ if (i == 0) {
+ /* Zero interrupts is invalid! */
+
+ return_ACPI_STATUS (AE_BAD_DATA);
+ }
output_struct->data.irq.number_of_interrupts = i;
/*
* Calculate the structure size based upon the number of interrupts
*/
- struct_size += (output_struct->data.irq.number_of_interrupts - 1) * 4;
+ struct_size += ((ACPI_SIZE) output_struct->data.irq.number_of_interrupts - 1) * 4;
/*
* Point to Byte 3 if it is used
/*
* Set the Length parameter
*/
- output_struct->length = struct_size;
+ output_struct->length = (u32) struct_size;
/*
* Return the final size of the structure
ACPI_SIZE *structure_size)
{
u8 *buffer = byte_stream_buffer;
- acpi_resource *output_struct = (acpi_resource *) *output_buffer;
+ acpi_resource *output_struct = (void *) *output_buffer;
u16 temp16 = 0;
u8 temp8 = 0;
- NATIVE_CHAR *temp_ptr;
+ u8 *temp_ptr;
u8 index;
ACPI_SIZE struct_size = ACPI_SIZEOF_RESOURCE (acpi_resource_ext_irq);
* Cycle through every IRQ in the table
*/
for (index = 0; index < temp8; index++) {
- output_struct->data.extended_irq.interrupts[index] =
- (u32)*buffer;
+ ACPI_MOVE_UNALIGNED32_TO_32 (
+ &output_struct->data.extended_irq.interrupts[index], buffer);
/* Point to the next IRQ */
* stream that are default.
*/
if (*bytes_consumed >
- (u32)(output_struct->data.extended_irq.number_of_interrupts * 4) + 5) {
+ ((ACPI_SIZE) output_struct->data.extended_irq.number_of_interrupts * 4) + 5) {
/* Dereference the Index */
temp8 = *buffer;
output_struct->data.extended_irq.resource_source.string_ptr =
(NATIVE_CHAR *)(output_struct + struct_size);
- temp_ptr = output_struct->data.extended_irq.resource_source.string_ptr;
+ temp_ptr = (u8 *) output_struct->data.extended_irq.resource_source.string_ptr;
/* Copy the string into the buffer */
/*
* Set the Length parameter
*/
- output_struct->length = struct_size;
+ output_struct->length = (u32) struct_size;
/*
* Return the final size of the structure
/*
* Set a pointer to the Length field - to be filled in later
*/
- length_field = (u16 *)buffer;
+ length_field = ACPI_CAST_PTR (u16, buffer);
buffer += 2;
/*
/*******************************************************************************
*
* Module Name: rslist - Linked list utilities
- * $Revision: 26 $
+ * $Revision: 30 $
*
******************************************************************************/
* Large Resource Type -- All bits are valid
*/
return (resource_start_byte);
+
+
+ default:
+ /* No other types of resource descriptor */
+ break;
}
return (0xFF);
u8 *output_buffer)
{
acpi_status status;
- u32 bytes_parsed = 0;
+ ACPI_SIZE bytes_parsed = 0;
u8 resource_type = 0;
ACPI_SIZE bytes_consumed = 0;
u8 *buffer = output_buffer;
while (bytes_parsed < byte_stream_buffer_length &&
- FALSE == end_tag_processed) {
+ !end_tag_processed) {
/*
* The next byte in the stream is the resource type
*/
default:
/*
- * Invalid/Unknowns resource type
+ * Invalid/Unknown resource type
*/
- status = AE_AML_ERROR;
+ status = AE_AML_INVALID_RESOURCE_TYPE;
break;
}
/*
* Set the Buffer to the next structure
*/
- resource = (acpi_resource *)buffer;
+ resource = ACPI_CAST_PTR (acpi_resource, buffer);
resource->length = ACPI_ALIGN_RESOURCE_SIZE(resource->length);
buffer += ACPI_ALIGN_RESOURCE_SIZE(structure_size);
/*
* Check the reason for exiting the while loop
*/
- if (TRUE != end_tag_processed) {
- return_ACPI_STATUS (AE_AML_ERROR);
+ if (!end_tag_processed) {
+ return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG);
}
return_ACPI_STATUS (AE_OK);
* PARAMETERS: Linked_list - Pointer to the resource linked list
* Byte_steam_size_needed - Calculated size of the byte stream
* needed from calling
- * Acpi_rs_calculate_byte_stream_length()
+ * Acpi_rs_get_byte_stream_length()
* The size of the Output_buffer is
* guaranteed to be >=
* Byte_stream_size_needed
acpi_status
acpi_rs_list_to_byte_stream (
acpi_resource *linked_list,
- u32 byte_stream_size_needed,
+ ACPI_SIZE byte_stream_size_needed,
u8 *output_buffer)
{
acpi_status status;
/*******************************************************************************
*
* Module Name: rsmem24 - Memory resource descriptors
- * $Revision: 17 $
+ * $Revision: 20 $
*
******************************************************************************/
ACPI_SIZE *structure_size)
{
u8 *buffer = byte_stream_buffer;
- acpi_resource *output_struct = (acpi_resource *) *output_buffer;
+ acpi_resource *output_struct = (void *) *output_buffer;
u16 temp16 = 0;
u8 temp8 = 0;
ACPI_SIZE struct_size = ACPI_SIZEOF_RESOURCE (acpi_resource_mem24);
ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
buffer += 2;
- *bytes_consumed = temp16 + 3;
+ *bytes_consumed = (ACPI_SIZE) temp16 + 3;
output_struct->id = ACPI_RSTYPE_MEM24;
/*
/*
* Set the Length parameter
*/
- output_struct->length = struct_size;
+ output_struct->length = (u32) struct_size;
/*
* Return the final size of the structure
ACPI_SIZE *structure_size)
{
u8 *buffer = byte_stream_buffer;
- acpi_resource *output_struct = (acpi_resource *) *output_buffer;
+ acpi_resource *output_struct = (void *) *output_buffer;
u16 temp16 = 0;
u8 temp8 = 0;
ACPI_SIZE struct_size = ACPI_SIZEOF_RESOURCE (acpi_resource_mem32);
ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
buffer += 2;
- *bytes_consumed = temp16 + 3;
+ *bytes_consumed = (ACPI_SIZE) temp16 + 3;
output_struct->id = ACPI_RSTYPE_MEM32;
/*
* Set the Length parameter
*/
- output_struct->length = struct_size;
+ output_struct->length = (u32) struct_size;
/*
* Return the final size of the structure
ACPI_SIZE *structure_size)
{
u8 *buffer = byte_stream_buffer;
- acpi_resource *output_struct = (acpi_resource *) *output_buffer;
+ acpi_resource *output_struct = (void *) *output_buffer;
u16 temp16 = 0;
u8 temp8 = 0;
ACPI_SIZE struct_size = ACPI_SIZEOF_RESOURCE (acpi_resource_fixed_mem32);
ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
buffer += 2;
- *bytes_consumed = temp16 + 3;
+ *bytes_consumed = (ACPI_SIZE) temp16 + 3;
output_struct->id = ACPI_RSTYPE_FIXED_MEM32;
/*
* Set the Length parameter
*/
- output_struct->length = struct_size;
+ output_struct->length = (u32) struct_size;
/*
* Return the final size of the structure
/*******************************************************************************
*
* Module Name: rsmisc - Miscellaneous resource descriptors
- * $Revision: 20 $
+ * $Revision: 24 $
*
******************************************************************************/
u8 **output_buffer,
ACPI_SIZE *structure_size)
{
- acpi_resource *output_struct = (acpi_resource *) *output_buffer;
+ acpi_resource *output_struct = (void *) *output_buffer;
ACPI_SIZE struct_size = ACPI_RESOURCE_LENGTH;
ACPI_SIZE *structure_size)
{
u8 *buffer = byte_stream_buffer;
- acpi_resource *output_struct = (acpi_resource *) *output_buffer;
+ acpi_resource *output_struct = (void *) *output_buffer;
u16 temp16 = 0;
u8 temp8 = 0;
u8 index;
/* Calculate bytes consumed */
- *bytes_consumed = temp16 + 3;
+ *bytes_consumed = (ACPI_SIZE) temp16 + 3;
/* Point to the first vendor byte */
/* Calculate bytes consumed */
- *bytes_consumed = temp16 + 1;
+ *bytes_consumed = (ACPI_SIZE) temp16 + 1;
/* Point to the first vendor byte */
/*
* Set the Length parameter
*/
- output_struct->length = struct_size;
+ output_struct->length = (u32) struct_size;
/*
* Return the final size of the structure
* Small Item, Set the descriptor field
*/
temp8 = 0x70;
- temp8 |= linked_list->data.vendor_specific.length;
+ temp8 |= (u8) linked_list->data.vendor_specific.length;
*buffer = temp8;
buffer += 1;
ACPI_SIZE *structure_size)
{
u8 *buffer = byte_stream_buffer;
- acpi_resource *output_struct = (acpi_resource *) *output_buffer;
+ acpi_resource *output_struct = (void *) *output_buffer;
u8 temp8 = 0;
ACPI_SIZE struct_size = ACPI_SIZEOF_RESOURCE (acpi_resource_start_dpf);
output_struct->data.start_dpf.compatibility_priority = temp8 & 0x03;
if (3 == output_struct->data.start_dpf.compatibility_priority) {
- return_ACPI_STATUS (AE_AML_ERROR);
+ return_ACPI_STATUS (AE_AML_BAD_RESOURCE_VALUE);
}
/*
output_struct->data.start_dpf.performance_robustness = (temp8 >> 2) & 0x03;
if (3 == output_struct->data.start_dpf.performance_robustness) {
- return_ACPI_STATUS (AE_AML_ERROR);
+ return_ACPI_STATUS (AE_AML_BAD_RESOURCE_VALUE);
}
}
else {
/*
* Set the Length parameter
*/
- output_struct->length = struct_size;
+ output_struct->length = (u32) struct_size;
/*
* Return the final size of the structure
u8 **output_buffer,
ACPI_SIZE *structure_size)
{
- acpi_resource *output_struct = (acpi_resource *) *output_buffer;
+ acpi_resource *output_struct = (void *) *output_buffer;
ACPI_SIZE struct_size = ACPI_RESOURCE_LENGTH;
/*
* Set the Length parameter
*/
- output_struct->length = struct_size;
+ output_struct->length = (u32) struct_size;
/*
* Return the final size of the structure
/*******************************************************************************
*
* Module Name: rsutils - Utilities for the resource manager
- * $Revision: 29 $
+ * $Revision: 30 $
*
******************************************************************************/
/*
* Set up the parameter object
*/
- params[0]->buffer.length = buffer.length;
+ params[0]->buffer.length = (u32) buffer.length;
params[0]->buffer.pointer = buffer.pointer;
params[1] = NULL;
/*******************************************************************************
*
* Module Name: rsxface - Public interfaces to the resource manager
- * $Revision: 18 $
+ * $Revision: 19 $
*
******************************************************************************/
#include "acpi.h"
-#include "acinterp.h"
-#include "acnamesp.h"
#include "acresrc.h"
#define _COMPONENT ACPI_RESOURCES
/******************************************************************************
*
* Module Name: tbconvrt - ACPI Table conversion utilities
- * $Revision: 36 $
+ * $Revision: 41 $
*
*****************************************************************************/
ACPI_FUNCTION_ENTRY ();
-#ifndef _IA64
+#if ACPI_MACHINE_WIDTH != 64
if (RSDP->revision < 2) {
pointer_size = sizeof (u32);
acpi_table_desc *table_info,
u32 *number_of_tables)
{
- u32 table_size;
+ ACPI_SIZE table_size;
u32 i;
xsdt_descriptor *new_table;
/* Compute size of the converted XSDT */
- table_size = (*number_of_tables * sizeof (u64)) + sizeof (acpi_table_header);
+ table_size = ((ACPI_SIZE) *number_of_tables * sizeof (u64)) + sizeof (acpi_table_header);
/* Allocate an XSDT */
/* Copy the header and set the length */
ACPI_MEMCPY (new_table, table_info->pointer, sizeof (acpi_table_header));
- new_table->header.length = table_size;
+ new_table->header.length = (u32) table_size;
/* Copy the table pointers */
}
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_tb_convert_fadt1
+ *
+ * PARAMETERS: Local_fadt - Pointer to new FADT
+ * Original_fadt - Pointer to old FADT
+ *
+ * RETURN: Populates Local_fadt
+ *
+ * DESCRIPTION: Convert an ACPI 1.0 FADT to common internal format
+ *
+ ******************************************************************************/
+
+static void
+acpi_tb_convert_fadt1 (
+ fadt_descriptor_rev2 *local_fadt,
+ fadt_descriptor_rev1 *original_fadt)
+{
+
+
+ /* ACPI 1.0 FACS */
+ /* The BIOS stored FADT should agree with Revision 1.0 */
+
+ /*
+ * 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.
+ */
+ ACPI_MEMCPY (local_fadt, original_fadt, sizeof (fadt_descriptor_rev1));
+
+ /* Convert table pointers to 64-bit fields */
+
+ ACPI_STORE_ADDRESS (local_fadt->Xfirmware_ctrl, local_fadt->V1_firmware_ctrl);
+ ACPI_STORE_ADDRESS (local_fadt->Xdsdt, local_fadt->V1_dsdt);
+
+ /*
+ * System Interrupt Model isn't used in ACPI 2.0 (Local_fadt->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".
+ */
+ local_fadt->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, leave it zeroed.
+ */
+ local_fadt->pstate_cnt = 0;
+
+ /*
+ * Support for the _CST object and C States change notification.
+ * This data item hasn't any 1.0 equivalence so leave it zero.
+ */
+ local_fadt->cst_cnt = 0;
+
+ /*
+ * Since there isn't any equivalence in 1.0 and since it highly likely
+ * that a 1.0 system has legacy support.
+ */
+ local_fadt->iapc_boot_arch = BAF_LEGACY_DEVICES;
+
+ /*
+ * Convert the V1.0 block addresses to V2.0 GAS structures
+ */
+ ASL_BUILD_GAS_FROM_V1_ENTRY (local_fadt->Xpm1a_evt_blk, local_fadt->pm1_evt_len, local_fadt->V1_pm1a_evt_blk);
+ ASL_BUILD_GAS_FROM_V1_ENTRY (local_fadt->Xpm1b_evt_blk, local_fadt->pm1_evt_len, local_fadt->V1_pm1b_evt_blk);
+ ASL_BUILD_GAS_FROM_V1_ENTRY (local_fadt->Xpm1a_cnt_blk, local_fadt->pm1_cnt_len, local_fadt->V1_pm1a_cnt_blk);
+ ASL_BUILD_GAS_FROM_V1_ENTRY (local_fadt->Xpm1b_cnt_blk, local_fadt->pm1_cnt_len, local_fadt->V1_pm1b_cnt_blk);
+ ASL_BUILD_GAS_FROM_V1_ENTRY (local_fadt->Xpm2_cnt_blk, local_fadt->pm2_cnt_len, local_fadt->V1_pm2_cnt_blk);
+ ASL_BUILD_GAS_FROM_V1_ENTRY (local_fadt->Xpm_tmr_blk, local_fadt->pm_tm_len, local_fadt->V1_pm_tmr_blk);
+ ASL_BUILD_GAS_FROM_V1_ENTRY (local_fadt->Xgpe0_blk, local_fadt->gpe0_blk_len, local_fadt->V1_gpe0_blk);
+ ASL_BUILD_GAS_FROM_V1_ENTRY (local_fadt->Xgpe1_blk, local_fadt->gpe1_blk_len, local_fadt->V1_gpe1_blk);
+
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_tb_convert_fadt2
+ *
+ * PARAMETERS: Local_fadt - Pointer to new FADT
+ * Original_fadt - Pointer to old FADT
+ *
+ * RETURN: Populates Local_fadt
+ *
+ * DESCRIPTION: Convert an ACPI 2.0 FADT to common internal format.
+ * Handles optional "X" fields.
+ *
+ ******************************************************************************/
+
+static void
+acpi_tb_convert_fadt2 (
+ fadt_descriptor_rev2 *local_fadt,
+ fadt_descriptor_rev2 *original_fadt)
+{
+
+ /* We have an ACPI 2.0 FADT but we must copy it to our local buffer */
+
+ ACPI_MEMCPY (local_fadt, original_fadt, sizeof (fadt_descriptor_rev2));
+
+ /*
+ * "X" fields are optional extensions to the original V1.0 fields, so
+ * we must selectively expand V1.0 fields if the corresponding X field
+ * is zero.
+ */
+ if (!(ACPI_GET_ADDRESS (local_fadt->Xfirmware_ctrl))) {
+ ACPI_STORE_ADDRESS (local_fadt->Xfirmware_ctrl, local_fadt->V1_firmware_ctrl);
+ }
+
+ if (!(ACPI_GET_ADDRESS (local_fadt->Xdsdt))) {
+ ACPI_STORE_ADDRESS (local_fadt->Xdsdt, local_fadt->V1_dsdt);
+ }
+
+ if (!(ACPI_GET_ADDRESS (local_fadt->Xpm1a_evt_blk.address))) {
+ ASL_BUILD_GAS_FROM_V1_ENTRY (local_fadt->Xpm1a_evt_blk,
+ local_fadt->pm1_evt_len, local_fadt->V1_pm1a_evt_blk);
+ }
+
+ if (!(ACPI_GET_ADDRESS (local_fadt->Xpm1b_evt_blk.address))) {
+ ASL_BUILD_GAS_FROM_V1_ENTRY (local_fadt->Xpm1b_evt_blk,
+ local_fadt->pm1_evt_len, local_fadt->V1_pm1b_evt_blk);
+ }
+
+ if (!(ACPI_GET_ADDRESS (local_fadt->Xpm1a_cnt_blk.address))) {
+ ASL_BUILD_GAS_FROM_V1_ENTRY (local_fadt->Xpm1a_cnt_blk,
+ local_fadt->pm1_cnt_len, local_fadt->V1_pm1a_cnt_blk);
+ }
+
+ if (!(ACPI_GET_ADDRESS (local_fadt->Xpm1b_cnt_blk.address))) {
+ ASL_BUILD_GAS_FROM_V1_ENTRY (local_fadt->Xpm1b_cnt_blk,
+ local_fadt->pm1_cnt_len, local_fadt->V1_pm1b_cnt_blk);
+ }
+
+ if (!(ACPI_GET_ADDRESS (local_fadt->Xpm2_cnt_blk.address))) {
+ ASL_BUILD_GAS_FROM_V1_ENTRY (local_fadt->Xpm2_cnt_blk,
+ local_fadt->pm2_cnt_len, local_fadt->V1_pm2_cnt_blk);
+ }
+
+ if (!(ACPI_GET_ADDRESS (local_fadt->Xpm_tmr_blk.address))) {
+ ASL_BUILD_GAS_FROM_V1_ENTRY (local_fadt->Xpm_tmr_blk,
+ local_fadt->pm_tm_len, local_fadt->V1_pm_tmr_blk);
+ }
+
+ if (!(ACPI_GET_ADDRESS (local_fadt->Xgpe0_blk.address))) {
+ ASL_BUILD_GAS_FROM_V1_ENTRY (local_fadt->Xgpe0_blk,
+ local_fadt->gpe0_blk_len, local_fadt->V1_gpe0_blk);
+ }
+
+ if (!(ACPI_GET_ADDRESS (local_fadt->Xgpe1_blk.address))) {
+ ASL_BUILD_GAS_FROM_V1_ENTRY (local_fadt->Xgpe1_blk,
+ local_fadt->gpe1_blk_len, local_fadt->V1_gpe1_blk);
+ }
+}
+
/*******************************************************************************
*
* FUNCTION: Acpi_tb_convert_table_fadt
acpi_status
acpi_tb_convert_table_fadt (void)
{
- fadt_descriptor_rev1 *FADT1;
- fadt_descriptor_rev2 *FADT2;
+ fadt_descriptor_rev2 *local_fadt;
acpi_table_desc *table_desc;
* Acpi_gbl_FADT is valid
* Allocate and zero the 2.0 FADT buffer
*/
- FADT2 = ACPI_MEM_CALLOCATE (sizeof (fadt_descriptor_rev2));
- if (FADT2 == NULL) {
+ local_fadt = ACPI_MEM_CALLOCATE (sizeof (fadt_descriptor_rev2));
+ if (local_fadt == 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
+ * FADT length and version validation. The table must be at least as
+ * long as the version 1.0 FADT
*/
+ if (acpi_gbl_FADT->header.length < sizeof (fadt_descriptor_rev1)) {
+ ACPI_REPORT_ERROR (("Invalid FADT table length: 0x%X\n", acpi_gbl_FADT->header.length));
+ return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH);
+ }
+
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 */
+ if (acpi_gbl_FADT->header.length < sizeof (fadt_descriptor_rev2)) {
+ /* Length is too short to be a V2.0 table */
+
+ ACPI_REPORT_WARNING (("Inconsistent FADT length (0x%X) and revision (0x%X), using FADT V1.0 portion of table\n",
+ acpi_gbl_FADT->header.length, acpi_gbl_FADT->header.revision));
+
+ acpi_tb_convert_fadt1 (local_fadt, (void *) acpi_gbl_FADT);
+ }
+ else {
+ /* Valid V2.0 table */
- *FADT2 = *((fadt_descriptor_rev2*) acpi_gbl_FADT);
+ acpi_tb_convert_fadt2 (local_fadt, acpi_gbl_FADT);
+ }
}
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.
- */
- 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 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, 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 leave it zero.
- */
- FADT2->cst_cnt = 0;
-
- /*
- * 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
- * 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_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->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);
+ /* Valid V1.0 table */
+
+ acpi_tb_convert_fadt1 (local_fadt, (void *) acpi_gbl_FADT);
}
/*
- * Global FADT pointer will point to the common V2.0 FADT
+ * Global FADT pointer will point to the new common V2.0 FADT
*/
- acpi_gbl_FADT = FADT2;
+ acpi_gbl_FADT = local_fadt;
acpi_gbl_FADT->header.length = sizeof (FADT_DESCRIPTOR);
/* Free the original table */
/* Install the new table */
- table_desc->pointer = (acpi_table_header *) acpi_gbl_FADT;
+ table_desc->pointer = (acpi_table_header *) acpi_gbl_FADT;
table_desc->base_pointer = acpi_gbl_FADT;
- table_desc->allocation = ACPI_MEM_ALLOCATED;
- table_desc->length = sizeof (fadt_descriptor_rev2);
+ table_desc->allocation = ACPI_MEM_ALLOCATED;
+ table_desc->length = sizeof (fadt_descriptor_rev2);
/* Dump the entire FADT */
acpi_tb_build_common_facs (
acpi_table_desc *table_info)
{
- facs_descriptor_rev1 *FACS1;
- facs_descriptor_rev2 *FACS2;
-
ACPI_FUNCTION_TRACE ("Tb_build_common_facs");
+ /* Absolute minimum length is 24, but the ACPI spec says 64 */
+
+ if (acpi_gbl_FACS->length < 24) {
+ ACPI_REPORT_ERROR (("Invalid FACS table length: 0x%X\n", acpi_gbl_FACS->length));
+ return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH);
+ }
+
+ if (acpi_gbl_FACS->length < 64) {
+ ACPI_REPORT_WARNING (("FACS is shorter than the ACPI specification allows: 0x%X, using anyway\n",
+ acpi_gbl_FACS->length));
+ }
+
/* Copy fields to the new FACS */
- if (acpi_gbl_RSDP->revision < 2) {
- /* ACPI 1.0 FACS */
+ acpi_gbl_common_fACS.global_lock = &(acpi_gbl_FACS->global_lock);
- FACS1 = (facs_descriptor_rev1 *) acpi_gbl_FACS;
+ if ((acpi_gbl_RSDP->revision < 2) ||
+ (acpi_gbl_FACS->length < 32) ||
+ (!(ACPI_GET_ADDRESS (acpi_gbl_FACS->Xfirmware_waking_vector)))) {
+ /* ACPI 1.0 FACS or short table or optional X_ field is zero */
- 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.firmware_waking_vector = ACPI_CAST_PTR (u64, &(acpi_gbl_FACS->firmware_waking_vector));
acpi_gbl_common_fACS.vector_width = 32;
}
else {
- /* ACPI 2.0 FACS */
+ /* ACPI 2.0 FACS with valid X_ field */
- FACS2 = (facs_descriptor_rev2 *) acpi_gbl_FACS;
-
- acpi_gbl_common_fACS.global_lock = &(FACS2->global_lock);
- acpi_gbl_common_fACS.firmware_waking_vector = &FACS2->Xfirmware_waking_vector;
+ acpi_gbl_common_fACS.firmware_waking_vector = &acpi_gbl_FACS->Xfirmware_waking_vector;
acpi_gbl_common_fACS.vector_width = 64;
}
- return_ACPI_STATUS (AE_OK);
+ return_ACPI_STATUS (AE_OK);
}
/******************************************************************************
*
* Module Name: tbget - ACPI Table get* routines
- * $Revision: 67 $
+ * $Revision: 77 $
*
*****************************************************************************/
ACPI_MODULE_NAME ("tbget")
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_tb_table_override
+ *
+ * PARAMETERS: *Table_info - Info for current table
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Attempts override of current table with a new one if provided
+ * by the host OS.
+ *
+ ******************************************************************************/
+
+void
+acpi_tb_table_override (
+ acpi_table_desc *table_info)
+{
+ acpi_table_header *new_table;
+ acpi_status status;
+ ACPI_POINTER address;
+ acpi_table_desc new_table_info;
+
+
+ ACPI_FUNCTION_TRACE ("Acpi_tb_table_override");
+
+
+ status = acpi_os_table_override (table_info->pointer, &new_table);
+ if (ACPI_FAILURE (status)) {
+ /* Some severe error from the OSL, but we basically ignore it */
+
+ ACPI_REPORT_ERROR (("Could not override ACPI table, %s\n",
+ acpi_format_exception (status)));
+ return_VOID;
+ }
+
+ if (!new_table) {
+ /* No table override */
+
+ return_VOID;
+ }
+
+ /*
+ * We have a new table to override the old one. Get a copy of
+ * the new one. We know that the new table has a logical pointer.
+ */
+ address.pointer_type = ACPI_LOGICAL_POINTER;
+ address.pointer.logical = new_table;
+
+ status = acpi_tb_get_table (&address, &new_table_info);
+ if (ACPI_FAILURE (status)) {
+ ACPI_REPORT_ERROR (("Could not copy ACPI table override\n"));
+ return_VOID;
+ }
+
+ /*
+ * Delete the original table
+ */
+ acpi_tb_delete_single_table (table_info);
+
+ /* Copy the table info */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Successful table override [%4.4s]\n",
+ ((acpi_table_header *) new_table_info.pointer)->signature));
+
+ ACPI_MEMCPY (table_info, &new_table_info, sizeof (acpi_table_desc));
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_tb_get_table_with_override
+ *
+ * PARAMETERS: Address - Physical or logical address of table
+ * *Table_info - Where the table info is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Gets and installs the table with possible table override by OS.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_tb_get_table_with_override (
+ ACPI_POINTER *address,
+ acpi_table_desc *table_info)
+{
+ acpi_status status;
+
+
+ ACPI_FUNCTION_TRACE ("Acpi_tb_get_table_with_override");
+
+
+ status = acpi_tb_get_table (address, table_info);
+ if (ACPI_FAILURE (status)) {
+ ACPI_REPORT_ERROR (("Could not get ACPI table, %s\n",
+ acpi_format_exception (status)));
+ return_ACPI_STATUS (status);
+ }
+
+ /*
+ * Attempt override. It either happens or it doesn't, no status
+ */
+ acpi_tb_table_override (table_info);
+
+ /* Install the table */
+
+ status = acpi_tb_install_table (table_info);
+ if (ACPI_FAILURE (status)) {
+ ACPI_REPORT_ERROR (("Could not install ACPI table, %s\n",
+ acpi_format_exception (status)));
+ }
+
+ return_ACPI_STATUS (status);
+}
+
+
/*******************************************************************************
*
* FUNCTION: Acpi_tb_get_table_ptr
*
* FUNCTION: Acpi_tb_get_table
*
- * PARAMETERS: Physical_address - Physical address of table to retrieve
- * *Buffer_ptr - If Buffer_ptr is valid, read data from
- * buffer rather than searching memory
- * *Table_info - Where the table info is returned
+ * PARAMETERS: Address - Physical address of table to retrieve
+ * *Table_info - Where the table info is returned
*
* RETURN: Status
*
{
acpi_table_header *table_header = NULL;
acpi_table_header *full_table = NULL;
- u32 size;
+ ACPI_SIZE size;
u8 allocation;
acpi_status status = AE_OK;
/* Copy the entire table (including header) to the local buffer */
- size = table_header->length;
+ size = (ACPI_SIZE) table_header->length;
ACPI_MEMCPY (full_table, table_header, size);
/* Save allocation type */
* FUNCTION: Acpi_tb_get_all_tables
*
* PARAMETERS: Number_of_tables - Number of tables to get
- * Table_ptr - Input buffer pointer, optional
*
* RETURN: Status
*
acpi_status
acpi_tb_get_all_tables (
- u32 number_of_tables,
- acpi_table_header *table_ptr)
+ u32 number_of_tables)
{
acpi_status status = AE_OK;
u32 index;
/* Recognize and install the table */
- status = acpi_tb_install_table (table_ptr, &table_info);
+ status = acpi_tb_install_table (&table_info);
if (ACPI_FAILURE (status)) {
/*
* Unrecognized or unsupported table, delete it and ignore the
* error. Just get as many tables as we can, later we will
* determine if there are enough tables to continue.
*/
- acpi_tb_uninstall_table (&table_info);
+ (void) acpi_tb_uninstall_table (&table_info);
status = AE_OK;
}
}
+ if (!acpi_gbl_FADT) {
+ ACPI_REPORT_ERROR (("No FADT present in R/XSDT\n"));
+ return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+ }
+
/*
* Convert the FADT to a common format. This allows earlier revisions of the
* table to coexist with newer versions, using common access code.
status = acpi_tb_get_table (&address, &table_info);
if (ACPI_FAILURE (status)) {
- ACPI_REPORT_ERROR (("Could not get the FACS\n"));
+ ACPI_REPORT_ERROR (("Could not get the FACS, %s\n",
+ acpi_format_exception (status)));
return_ACPI_STATUS (status);
}
/* Install the FACS */
- status = acpi_tb_install_table (table_ptr, &table_info);
+ status = acpi_tb_install_table (&table_info);
if (ACPI_FAILURE (status)) {
- ACPI_REPORT_ERROR (("Could not install the FACS\n"));
+ ACPI_REPORT_ERROR (("Could not install the FACS, %s\n",
+ acpi_format_exception (status)));
return_ACPI_STATUS (status);
}
*/
status = acpi_tb_build_common_facs (&table_info);
if (ACPI_FAILURE (status)) {
- ACPI_REPORT_ERROR (("Could not convert FACS to common internal format\n"));
return_ACPI_STATUS (status);
}
/*
- * Get the DSDT (We know that the FADT is valid now)
+ * Get/install the DSDT (We know that the FADT is valid now)
*/
address.pointer_type = acpi_gbl_table_flags;
address.pointer.value = ACPI_GET_ADDRESS (acpi_gbl_FADT->Xdsdt);
- status = acpi_tb_get_table (&address, &table_info);
+ status = acpi_tb_get_table_with_override (&address, &table_info);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Could not get the DSDT\n"));
return_ACPI_STATUS (status);
}
- /* Install the DSDT */
+ /* Set Integer Width (32/64) based upon DSDT revision */
- status = acpi_tb_install_table (table_ptr, &table_info);
- if (ACPI_FAILURE (status)) {
- ACPI_REPORT_ERROR (("Could not install the DSDT\n"));
- return_ACPI_STATUS (status);
- }
+ acpi_ut_set_integer_width (acpi_gbl_DSDT->revision);
/* Dump the entire DSDT */
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
- "Hex dump of entire DSDT, size %d (0x%X)\n",
- acpi_gbl_DSDT->length, acpi_gbl_DSDT->length));
+ "Hex dump of entire DSDT, size %d (0x%X), Integer width = %d\n",
+ acpi_gbl_DSDT->length, acpi_gbl_DSDT->length, acpi_gbl_integer_bit_width));
ACPI_DUMP_BUFFER ((u8 *) acpi_gbl_DSDT, acpi_gbl_DSDT->length);
/* Always delete the RSDP mapping, we are done with it */
/* The RSDP supplied is OK */
- table_info.pointer = (acpi_table_header *) rsdp;
+ table_info.pointer = ACPI_CAST_PTR (acpi_table_header, rsdp);
table_info.length = sizeof (RSDP_DESCRIPTOR);
table_info.allocation = ACPI_MEM_MAPPED;
table_info.base_pointer = rsdp;
/* Save the RSDP in a global for easy access */
- acpi_gbl_RSDP = (RSDP_DESCRIPTOR *) table_info.pointer;
+ acpi_gbl_RSDP = ACPI_CAST_PTR (RSDP_DESCRIPTOR, table_info.pointer);
return_ACPI_STATUS (status);
acpi_tb_validate_rsdt (
acpi_table_header *table_ptr)
{
- u32 no_match;
+ int no_match;
ACPI_FUNCTION_NAME ("Tb_validate_rsdt");
ACPI_DUMP_BUFFER (acpi_gbl_RSDP, 20);
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR,
- "RSDT/XSDT signature at %X is invalid\n",
- acpi_gbl_RSDP->rsdt_physical_address));
+ "RSDT/XSDT signature at %X (%p) is invalid\n",
+ acpi_gbl_RSDP->rsdt_physical_address,
+ (void *) (NATIVE_UINT) acpi_gbl_RSDP->rsdt_physical_address));
return (AE_BAD_SIGNATURE);
}
acpi_tb_get_table_pointer (
ACPI_POINTER *address,
u32 flags,
- u32 *size,
+ ACPI_SIZE *size,
acpi_table_header **table_ptr)
{
acpi_status status = AE_OK;
*table_ptr = address->pointer.logical;
*size = 0;
break;
+
+ default:
+ return (AE_BAD_PARAMETER);
}
}
else {
status = AE_BAD_PARAMETER;
break;
+
+ default:
+ return (AE_BAD_PARAMETER);
}
}
ACPI_FUNCTION_TRACE ("Tb_get_table_rsdt");
- /*
- * Get the RSDT from the RSDP
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "RSDP located at %p, RSDT physical=%8.8X%8.8X \n",
- acpi_gbl_RSDP,
- ACPI_HIDWORD (acpi_gbl_RSDP->rsdt_physical_address),
- ACPI_LODWORD (acpi_gbl_RSDP->rsdt_physical_address)));
-
-
- /* Get the RSDT/XSDT */
+ /* Get the RSDT/XSDT from the RSDP */
acpi_tb_get_rsdt_address (&address);
status = acpi_tb_get_table (&address, &table_info);
if (ACPI_FAILURE (status)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not get the RSDT, %s\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not get the R/XSDT, %s\n",
acpi_format_exception (status)));
return_ACPI_STATUS (status);
}
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "RSDP located at %p, RSDT physical=%8.8X%8.8X \n",
+ acpi_gbl_RSDP,
+ ACPI_HIDWORD (address.pointer.value),
+ ACPI_LODWORD (address.pointer.value)));
+
/* Check the RSDT or XSDT signature */
status = acpi_tb_validate_rsdt (table_info.pointer);
/******************************************************************************
*
* Module Name: tbinstal - ACPI table installation and removal
- * $Revision: 57 $
+ * $Revision: 61 $
*
*****************************************************************************/
*
* FUNCTION: Acpi_tb_install_table
*
- * PARAMETERS: Table_ptr - Input buffer pointer, optional
- * Table_info - Return value from Acpi_tb_get_table
+ * PARAMETERS: Table_info - Return value from Acpi_tb_get_table
*
* RETURN: Status
*
acpi_status
acpi_tb_install_table (
- acpi_table_header *table_ptr,
acpi_table_desc *table_info)
{
acpi_status status;
* Check the table signature and make sure it is recognized
* Also checks the header checksum
*/
- status = acpi_tb_recognize_table (table_ptr, table_info);
+ status = acpi_tb_recognize_table (table_info);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
*
* FUNCTION: Acpi_tb_recognize_table
*
- * PARAMETERS: Table_ptr - Input buffer pointer, optional
- * Table_info - Return value from Acpi_tb_get_table
+ * PARAMETERS: Table_info - Return value from Acpi_tb_get_table
*
* RETURN: Status
*
acpi_status
acpi_tb_recognize_table (
- acpi_table_header *table_ptr,
acpi_table_desc *table_info)
{
acpi_table_header *table_header;
/* Return the table type and length via the info struct */
- table_info->length = table_header->length;
+ table_info->length = (ACPI_SIZE) table_header->length;
/*
* Validate checksum for _most_ tables,
*/
if (table_info->type != ACPI_TABLE_FACS) {
status = acpi_tb_verify_table_checksum (table_header);
- if (ACPI_FAILURE (status) &&
- (!ACPI_CHECKSUM_ABORT)) {
+
+#if (!ACPI_CHECKSUM_ABORT)
+ if (ACPI_FAILURE (status)) {
/* Ignore the error if configuration says so */
status = AE_OK;
}
+#endif
}
return_ACPI_STATUS (status);
acpi_os_unmap_memory (table_desc->base_pointer, table_desc->length);
break;
+
+ default:
+ break;
}
}
}
*
* PARAMETERS: Table_info - A table info struct
*
- * RETURN: None.
+ * RETURN: Pointer to the next table in the list (of same type)
*
* DESCRIPTION: Free the memory associated with an internal ACPI table that
* is either installed or has never been installed.
acpi_table_desc *next_desc;
- ACPI_FUNCTION_TRACE_PTR ("Tb_delete_single_table", table_desc);
+ ACPI_FUNCTION_TRACE_PTR ("Acpi_tb_uninstall_table", table_desc);
if (!table_desc) {
/******************************************************************************
*
* Module Name: tbutils - Table manipulation utilities
- * $Revision: 51 $
+ * $Revision: 53 $
*
*****************************************************************************/
#include "acpi.h"
#include "actables.h"
-#include "acinterp.h"
#define _COMPONENT ACPI_TABLES
/* Ensure that the signature is 4 ASCII characters */
- ACPI_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",
acpi_status
acpi_tb_map_acpi_table (
ACPI_PHYSICAL_ADDRESS physical_address,
- u32 *size,
+ ACPI_SIZE *size,
acpi_table_header **logical_address)
{
acpi_table_header *table;
- u32 table_size = *size;
+ ACPI_SIZE table_size = *size;
acpi_status status = AE_OK;
/* Extract the full table length before we delete the mapping */
- table_size = table->length;
+ table_size = (ACPI_SIZE) table->length;
/*
* Validate the header and delete the mapping.
if (checksum) {
ACPI_REPORT_WARNING (("Invalid checksum (%X) in table %4.4s\n",
- checksum, (char *) &table_header->signature));
+ checksum, table_header->signature));
status = AE_BAD_CHECKSUM;
}
*
* Module Name: tbxface - Public interfaces to the ACPI subsystem
* ACPI table oriented interfaces
- * $Revision: 52 $
+ * $Revision: 57 $
*
*****************************************************************************/
#include "acpi.h"
#include "acnamesp.h"
-#include "acinterp.h"
#include "actables.h"
/* Now get the rest of the tables */
- status = acpi_tb_get_all_tables (number_of_tables, NULL);
+ status = acpi_tb_get_all_tables (number_of_tables);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Acpi_load_tables: Error getting required tables (DSDT/FADT/FACS): %s\n",
acpi_format_exception (status)));
/* Install the new table into the local data structures */
- status = acpi_tb_install_table (NULL, &table_info);
+ status = acpi_tb_install_table (&table_info);
if (ACPI_FAILURE (status)) {
/* Free table allocated by Acpi_tb_get_table */
if (ACPI_FAILURE (status)) {
/* Uninstall table and free the buffer */
- acpi_tb_uninstall_table (table_info.installed_desc);
+ (void) acpi_tb_uninstall_table (table_info.installed_desc);
}
return_ACPI_STATUS (status);
{
acpi_table_header *tbl_ptr;
acpi_status status;
- u32 table_length;
+ ACPI_SIZE table_length;
ACPI_FUNCTION_TRACE ("Acpi_get_table");
table_length = sizeof (RSDP_DESCRIPTOR);
}
else {
- table_length = tbl_ptr->length;
+ table_length = (ACPI_SIZE) tbl_ptr->length;
}
/* Validate/Allocate/Clear caller buffer */
/******************************************************************************
*
* Module Name: tbxfroot - Find the root ACPI table (RSDT)
- * $Revision: 61 $
+ * $Revision: 63 $
*
*****************************************************************************/
acpi_table_header *rsdt_ptr = NULL;
acpi_table_header *table_ptr;
acpi_status status;
- u32 rsdt_size = 0;
- u32 table_size;
+ ACPI_SIZE rsdt_size = 0;
+ ACPI_SIZE table_size;
u32 table_count;
u32 i;
u32 j;
}
}
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "RSDP located at %p, RSDT physical=%8.8X%8.8X \n",
- 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 */
acpi_tb_get_rsdt_address (&address);
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "RSDP located at %p, RSDT physical=%8.8X%8.8X \n",
+ acpi_gbl_RSDP,
+ ACPI_HIDWORD (address.pointer.value),
+ ACPI_LODWORD (address.pointer.value)));
+
status = acpi_tb_get_table_pointer (&address, flags, &rsdt_size, &rsdt_ptr);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
/* TBD: Move to a new file */
-#ifndef _IA16
+#if ACPI_MACHINE_WIDTH != 16
/*******************************************************************************
*
/* Found it, return the physical address */
phys_addr = LO_RSDP_WINDOW_BASE;
- phys_addr += (mem_rover - table_ptr);
+ phys_addr += ACPI_PTR_DIFF (mem_rover,table_ptr);
table_info->physical_address = phys_addr;
return_ACPI_STATUS (AE_OK);
/* Found it, return the physical address */
phys_addr = HI_RSDP_WINDOW_BASE;
- phys_addr += (mem_rover - table_ptr);
+ phys_addr += ACPI_PTR_DIFF (mem_rover, table_ptr);
table_info->physical_address = phys_addr;
return_ACPI_STATUS (AE_OK);
/******************************************************************************
*
* Module Name: utalloc - local cache and memory allocation routines
- * $Revision: 121 $
+ * $Revision: 127 $
*
*****************************************************************************/
#include "acpi.h"
-#include "acparser.h"
-#include "acinterp.h"
-#include "acnamesp.h"
-#include "acglobal.h"
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("utalloc")
/* Mark the object as cached */
ACPI_MEMSET (object, 0xCA, cache_info->object_size);
- ACPI_SET_DESCRIPTOR_TYPE (object, ACPI_CACHED_OBJECT);
+ ACPI_SET_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_CACHED);
/* Put the object at the head of the cache list */
- * (char **) (((char *) object) + cache_info->link_offset) = cache_info->list_head;
+ * (ACPI_CAST_INDIRECT_PTR (char, &(((char *) object)[cache_info->link_offset]))) = cache_info->list_head;
cache_info->list_head = object;
cache_info->cache_depth++;
/* There is an object available, use it */
object = cache_info->list_head;
- cache_info->list_head = * (char **) (((char *) object) + cache_info->link_offset);
+ cache_info->list_head = *(ACPI_CAST_INDIRECT_PTR (char, &(((char *) object)[cache_info->link_offset])));
ACPI_MEM_TRACKING (cache_info->cache_hits++);
cache_info->cache_depth--;
while (cache_info->list_head) {
/* Delete one cached state object */
- next = * (char **) (((char *) cache_info->list_head) + cache_info->link_offset);
+ next = *(ACPI_CAST_INDIRECT_PTR (char, &(((char *) cache_info->list_head)[cache_info->link_offset])));
ACPI_MEM_FREE (cache_info->list_head);
cache_info->list_head = next;
/* Report allocation error */
_ACPI_REPORT_ERROR (module, line, component,
- ("Ut_allocate: Could not allocate size %X\n", size));
+ ("Ut_allocate: Could not allocate size %X\n", (u32) size));
return_PTR (NULL);
}
/* Report allocation error */
_ACPI_REPORT_ERROR (module, line, component,
- ("Ut_callocate: Could not allocate size %X\n", size));
+ ("Ut_callocate: Could not allocate size %X\n", (u32) size));
return_PTR (NULL);
}
/* Report allocation error */
_ACPI_REPORT_ERROR (module, line, component,
- ("Ut_callocate: Could not allocate size %X\n", size));
+ ("Ut_callocate: Could not allocate size %X\n", (u32) size));
return (NULL);
}
u32 line)
{
acpi_debug_mem_block *debug_block;
+ acpi_status status;
ACPI_FUNCTION_TRACE_PTR ("Ut_free", allocation);
return_VOID;
}
- debug_block = (acpi_debug_mem_block *)
- (((char *) allocation) - sizeof (acpi_debug_mem_header));
+ debug_block = ACPI_CAST_PTR (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);
+ status = acpi_ut_remove_allocation (ACPI_MEM_LIST_GLOBAL, debug_block,
+ component, module, line);
+ if (ACPI_FAILURE (status)) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not free memory, %s\n",
+ acpi_format_exception (status)));
+ }
+
acpi_os_free (debug_block);
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p freed\n", allocation));
NATIVE_CHAR *module)
{
acpi_debug_mem_block *element;
+ ACPI_DESCRIPTOR *descriptor;
u32 num_outstanding = 0;
((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) {
+ descriptor = ACPI_CAST_PTR (ACPI_DESCRIPTOR, &element->user_space);
+ if (descriptor->descriptor_id != ACPI_DESC_TYPE_CACHED) {
acpi_os_printf ("%p Len %04X %9.9s-%d ",
- &element->user_space, element->size, element->module,
+ descriptor, element->size, element->module,
element->line);
/* Most of the elements will be internal objects. */
- switch (ACPI_GET_DESCRIPTOR_TYPE (&element->user_space)) {
- case ACPI_DESC_TYPE_INTERNAL:
- 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);
+ switch (ACPI_GET_DESCRIPTOR_TYPE (descriptor)) {
+ case ACPI_DESC_TYPE_OPERAND:
+ acpi_os_printf ("Obj_type %12.12s R%hd",
+ acpi_ut_get_type_name (descriptor->object.common.type),
+ descriptor->object.common.reference_count);
break;
case ACPI_DESC_TYPE_PARSER:
- acpi_os_printf ("Parse_obj Opcode %04X",
- ((acpi_parse_object *)(&element->user_space))->opcode);
+ acpi_os_printf ("Parse_obj Aml_opcode %04hX",
+ descriptor->op.asl.aml_opcode);
break;
case ACPI_DESC_TYPE_NAMED:
acpi_os_printf ("Node %4.4s",
- (char *) &((acpi_namespace_node *)(&element->user_space))->name);
+ descriptor->node.name.ascii);
break;
case ACPI_DESC_TYPE_STATE:
case ACPI_DESC_TYPE_STATE_THREAD:
acpi_os_printf ("THREAD State_obj");
break;
+
+ default:
+ /* All types should appear above */
+ break;
}
acpi_os_printf ( "\n");
if (!num_outstanding) {
ACPI_DEBUG_PRINT ((ACPI_DB_OK,
- "No outstanding allocations.\n"));
+ "No outstanding allocations.\n"));
}
else {
ACPI_DEBUG_PRINT ((ACPI_DB_OK,
/******************************************************************************
*
* Module Name: utcopy - Internal to external object translation utilities
- * $Revision: 95 $
+ * $Revision: 98 $
*
*****************************************************************************/
#include "acpi.h"
-#include "acinterp.h"
#include "acnamesp.h"
#include "amlcode.h"
external_object->string.pointer = (NATIVE_CHAR *) data_space;
external_object->string.length = internal_object->string.length;
- *buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD (internal_object->string.length + 1);
+ *buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD ((ACPI_SIZE) internal_object->string.length + 1);
ACPI_MEMCPY ((void *) data_space, (void *) internal_object->string.pointer,
- internal_object->string.length + 1);
+ (ACPI_SIZE) internal_object->string.length + 1);
break;
buffer.length = MAX_STRING_LENGTH;
buffer.pointer = data_space;
- status = acpi_ns_handle_to_pathname ((acpi_handle *) internal_object->reference.node,
+ status = acpi_ns_handle_to_pathname ((acpi_handle) internal_object->reference.node,
&buffer);
/* Converted (external) string length is returned from above */
- external_object->string.length = buffer.length;
+ external_object->string.length = (u32) buffer.length;
*buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD (buffer.length);
break;
*/
target_object->type = ACPI_TYPE_PACKAGE;
target_object->package.count = source_object->package.count;
- target_object->package.elements = (acpi_object *) info->free_space;
+ target_object->package.elements = ACPI_CAST_PTR (acpi_object, info->free_space);
/*
* Pass the new package object back to the package walk routine
* update the buffer length counter
*/
object_space = ACPI_ROUND_UP_TO_NATIVE_WORD (
- target_object->package.count * sizeof (acpi_object));
+ (ACPI_SIZE) target_object->package.count * sizeof (acpi_object));
break;
/*
* First package at head of the buffer
*/
- external_object = (acpi_object *) buffer;
+ external_object = ACPI_CAST_PTR (acpi_object, buffer);
/*
* Free space begins right after the first package
external_object->type = internal_object->common.type;
external_object->package.count = internal_object->package.count;
- external_object->package.elements = (acpi_object *) info.free_space;
+ external_object->package.elements = ACPI_CAST_PTR (acpi_object, info.free_space);
/*
* Build an array of ACPI_OBJECTS in the buffer
case ACPI_TYPE_STRING:
- internal_object->string.pointer = ACPI_MEM_CALLOCATE (external_object->string.length + 1);
+ internal_object->string.pointer = ACPI_MEM_CALLOCATE ((ACPI_SIZE) external_object->string.length + 1);
if (!internal_object->string.pointer) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
internal_object->integer.value = external_object->integer.value;
break;
+
+ default:
+ /* Other types can't get here */
+ break;
}
*ret_internal_object = internal_object;
dest_desc->common.flags = source_desc->common.flags;
/* Fall through to common string/buffer case */
+ /*lint -fallthrough */
case ACPI_TYPE_STRING:
source_desc->string.length);
}
break;
+
+ default:
+ /* Nothing to do for other simple objects */
+ break;
}
return (AE_OK);
/*
* Create the object array and walk the source package tree
*/
- dest_obj->package.elements = ACPI_MEM_CALLOCATE ((source_obj->package.count + 1) *
+ dest_obj->package.elements = ACPI_MEM_CALLOCATE (((ACPI_SIZE) source_obj->package.count + 1) *
sizeof (void *));
if (!dest_obj->package.elements) {
ACPI_REPORT_ERROR (
/******************************************************************************
*
* Module Name: utdebug - Debug print routines
- * $Revision: 97 $
+ * $Revision: 103 $
*
*****************************************************************************/
ACPI_MODULE_NAME ("utdebug")
-u32 acpi_gbl_prev_thread_id = 0xFFFFFFFF;
-char *acpi_gbl_fn_entry_str = "----Entry";
-char *acpi_gbl_fn_exit_str = "----Exit-";
-
-
#ifdef ACPI_DEBUG
+static u32 acpi_gbl_prev_thread_id = 0xFFFFFFFF;
+static char *acpi_gbl_fn_entry_str = "----Entry";
+static char *acpi_gbl_fn_exit_str = "----Exit-";
+
/*****************************************************************************
*
return;
}
-
/*
* Thread tracking and context switch notification
*/
* Display the module name, current line number, thread ID (if requested),
* current procedure nesting level, and the current procedure name
*/
- acpi_os_printf ("%8s-%04d ", dbg_info->module_name, line_number);
+ acpi_os_printf ("%8s-%04ld ", dbg_info->module_name, line_number);
if (ACPI_LV_THREADS & acpi_dbg_level) {
- acpi_os_printf ("[%04X] ", thread_id, acpi_gbl_nesting_level, dbg_info->proc_name);
+ acpi_os_printf ("[%04lX] ", thread_id, acpi_gbl_nesting_level, dbg_info->proc_name);
}
- acpi_os_printf ("[%02d] %-22.22s: ", acpi_gbl_nesting_level, dbg_info->proc_name);
-
+ acpi_os_printf ("[%02ld] %-22.22s: ", acpi_gbl_nesting_level, dbg_info->proc_name);
va_start (args, format);
acpi_os_vprintf (format, args);
}
va_start (args, format);
-
acpi_os_vprintf (format, args);
}
u32 display,
u32 component_id)
{
- u32 i = 0;
- u32 j;
+ NATIVE_UINT i = 0;
+ NATIVE_UINT j;
u32 temp32;
u8 buf_char;
display = DB_BYTE_DISPLAY;
}
- acpi_os_printf ("\n_offset Value\n");
+ acpi_os_printf ("\nOffset Value\n");
/*
* Nasty little dump buffer routine!
acpi_os_printf ("%05X ", i);
-
/* Print 16 hex chars */
for (j = 0; j < 16;) {
}
}
-
/*
* Print the ASCII equivalent characters
* But watch out for the bad unprintable ones...
*/
-
for (j = 0; j < 16; j++) {
if (i + j >= count) {
acpi_os_printf ("\n");
/*******************************************************************************
*
* Module Name: utdelete - object deletion and reference count utilities
- * $Revision: 88 $
+ * $Revision: 90 $
*
******************************************************************************/
#include "acpi.h"
#include "acinterp.h"
#include "acnamesp.h"
-#include "actables.h"
-#include "acparser.h"
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("utdelete")
object, object->mutex.semaphore));
acpi_ex_unlink_mutex (object);
- acpi_os_delete_semaphore (object->mutex.semaphore);
+ (void) acpi_os_delete_semaphore (object->mutex.semaphore);
break;
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Event %p, Semaphore %p\n",
object, object->event.semaphore));
- acpi_os_delete_semaphore (object->event.semaphore);
+ (void) acpi_os_delete_semaphore (object->event.semaphore);
object->event.semaphore = NULL;
break;
/* Delete the method semaphore if it exists */
if (object->method.semaphore) {
- acpi_os_delete_semaphore (object->method.semaphore);
+ (void) acpi_os_delete_semaphore (object->method.semaphore);
object->method.semaphore = NULL;
}
break;
*
* PARAMETERS: *Obj_list - Pointer to the list to be deleted
*
- * RETURN: Status - the status of the call
+ * RETURN: None
*
* DESCRIPTION: This function deletes an internal object list, including both
* simple objects and package objects
*
******************************************************************************/
-acpi_status
+void
acpi_ut_delete_internal_object_list (
acpi_operand_object **obj_list)
{
/* Free the combined parameter pointer list and object array */
ACPI_MEM_FREE (obj_list);
- return_ACPI_STATUS (AE_OK);
+ return_VOID;
}
status = acpi_ut_create_update_state_and_push (object->device.addr_handler,
action, &state_list);
if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ goto error_exit;
}
acpi_ut_update_ref_count (object->device.sys_handler, action);
status = acpi_ut_create_update_state_and_push (
object->package.elements[i], action, &state_list);
if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ goto error_exit;
}
}
break;
status = acpi_ut_create_update_state_and_push (
object->buffer_field.buffer_obj, action, &state_list);
-
if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ goto error_exit;
}
break;
status = acpi_ut_create_update_state_and_push (
object->field.region_obj, action, &state_list);
if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ goto error_exit;
}
break;
status = acpi_ut_create_update_state_and_push (
object->bank_field.bank_obj, action, &state_list);
if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ goto error_exit;
}
status = acpi_ut_create_update_state_and_push (
object->bank_field.region_obj, action, &state_list);
if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ goto error_exit;
}
break;
status = acpi_ut_create_update_state_and_push (
object->index_field.index_obj, action, &state_list);
if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ goto error_exit;
}
status = acpi_ut_create_update_state_and_push (
object->index_field.data_obj, action, &state_list);
if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ goto error_exit;
}
break;
case ACPI_TYPE_REGION:
case INTERNAL_TYPE_REFERENCE:
+ default:
/* No subobjects */
break;
}
return_ACPI_STATUS (AE_OK);
+
+
+error_exit:
+
+ ACPI_REPORT_ERROR (("Could not update object reference count, %s\n",
+ acpi_format_exception (status)));
+
+ return_ACPI_STATUS (status);
}
/*
* We have a valid ACPI internal object, now increment the reference count
*/
- acpi_ut_update_object_reference (object, REF_INCREMENT);
+ (void) acpi_ut_update_object_reference (object, REF_INCREMENT);
return_VOID;
}
* if the reference count becomes 0. (Must also decrement the ref count
* of all subobjects!)
*/
- acpi_ut_update_object_reference (object, REF_DECREMENT);
+ (void) acpi_ut_update_object_reference (object, REF_DECREMENT);
return_VOID;
}
/******************************************************************************
*
* Module Name: uteval - Object evaluation
- * $Revision: 38 $
+ * $Revision: 39 $
*
*****************************************************************************/
if (ACPI_FAILURE (status)) {
if (status == AE_NOT_FOUND) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s on %4.4s was not found\n",
- object_name, (char *) &device_node->name));
+ object_name, device_node->name.ascii));
}
else {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s on %4.4s failed with status %s\n",
- object_name, (char *) &device_node->name,
+ object_name, device_node->name.ascii,
acpi_format_exception (status)));
}
if (ACPI_FAILURE (status)) {
if (status == AE_NOT_FOUND) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "_HID on %4.4s was not found\n",
- (char *) &device_node->name));
+ device_node->name.ascii));
}
else {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_HID on %4.4s failed %s\n",
- (char *) &device_node->name, acpi_format_exception (status)));
+ device_node->name.ascii, acpi_format_exception (status)));
}
return_ACPI_STATUS (status);
if (ACPI_FAILURE (status)) {
if (status == AE_NOT_FOUND) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "_CID on %4.4s was not found\n",
- (char *)&device_node->name));
+ device_node->name.ascii));
}
else {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_CID on %4.4s failed %s\n",
- (char *)&device_node->name, acpi_format_exception (status)));
+ device_node->name.ascii, acpi_format_exception (status)));
}
return_ACPI_STATUS (status);
if (ACPI_FAILURE (status)) {
if (status == AE_NOT_FOUND) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "_UID on %4.4s was not found\n",
- (char *) &device_node->name));
+ device_node->name.ascii));
}
else {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"_UID on %4.4s failed %s\n",
- (char *) &device_node->name, acpi_format_exception (status)));
+ device_node->name.ascii, acpi_format_exception (status)));
}
return (status);
if (AE_NOT_FOUND == status) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"_STA on %4.4s was not found, assuming present.\n",
- (char *) &device_node->name));
+ device_node->name.ascii));
*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,
+ device_node->name.ascii,
acpi_format_exception (status)));
}
/******************************************************************************
*
* Module Name: utglobal - Global variables for the ACPI subsystem
- * $Revision: 155 $
+ * $Revision: 161 $
*
*****************************************************************************/
#define DEFINE_ACPI_GLOBALS
#include "acpi.h"
-#include "acevents.h"
#include "acnamesp.h"
-#include "acinterp.h"
-#include "amlcode.h"
-
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("utglobal")
*/
const acpi_predefined_names acpi_gbl_pre_defined_names[] =
-{ {"_GPE", INTERNAL_TYPE_DEF_ANY},
- {"_PR_", INTERNAL_TYPE_DEF_ANY},
- {"_SB_", ACPI_TYPE_DEVICE},
- {"_SI_", INTERNAL_TYPE_DEF_ANY},
- {"_TZ_", INTERNAL_TYPE_DEF_ANY},
+{ {"_GPE", INTERNAL_TYPE_DEF_ANY, NULL},
+ {"_PR_", INTERNAL_TYPE_DEF_ANY, NULL},
+ {"_SB_", ACPI_TYPE_DEVICE, NULL},
+ {"_SI_", INTERNAL_TYPE_DEF_ANY, NULL},
+ {"_TZ_", INTERNAL_TYPE_DEF_ANY, NULL},
{"_REV", ACPI_TYPE_INTEGER, "2"},
{"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME},
{"_GL_", ACPI_TYPE_MUTEX, "0"},
- {NULL, ACPI_TYPE_ANY} /* Table terminator */
+ {NULL, ACPI_TYPE_ANY, NULL} /* Table terminator */
};
/* Hex to ASCII conversion table */
-const NATIVE_CHAR acpi_gbl_hex_to_ascii[] =
+static const NATIVE_CHAR acpi_gbl_hex_to_ascii[] =
{'0','1','2','3','4','5','6','7',
- '8','9','A','B','C','D','E','F'};
+ '8','9','A','B','C','D','E','F'};
/*****************************************************************************
*
*
****************************************************************************/
-u8
+char
acpi_ut_hex_to_ascii_char (
acpi_integer integer,
u32 position)
/* Region type decoding */
-const NATIVE_CHAR *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] =
+static const NATIVE_CHAR *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] =
{
"System_memory",
"System_iO",
/* Event type decoding */
-const NATIVE_CHAR *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] =
+static const NATIVE_CHAR *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] =
{
"PM_Timer",
"Global_lock",
}
-#ifdef ACPI_DEBUG
+#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER)
/*
* Strings and procedures used for debug only
}
+/* Various strings for future use */
+
+#if 0
+#include "amlcode.h"
+
/* Data used in keeping track of fields */
-const NATIVE_CHAR *acpi_gbl_FEnames[NUM_FIELD_NAMES] =
+static const NATIVE_CHAR *acpi_gbl_FEnames[NUM_FIELD_NAMES] =
{
"skip",
"?access?"
}; /* FE = Field Element */
-const NATIVE_CHAR *acpi_gbl_match_ops[NUM_MATCH_OPS] =
+static const NATIVE_CHAR *acpi_gbl_match_ops[NUM_MATCH_OPS] =
{
"Error",
"MTR",
/* Access type decoding */
-const NATIVE_CHAR *acpi_gbl_access_types[NUM_ACCESS_TYPES] =
+static const NATIVE_CHAR *acpi_gbl_access_types[NUM_ACCESS_TYPES] =
{
"Any_acc",
"Byte_acc",
/* Update rule decoding */
-const NATIVE_CHAR *acpi_gbl_update_rules[NUM_UPDATE_RULES] =
+static const NATIVE_CHAR *acpi_gbl_update_rules[NUM_UPDATE_RULES] =
{
"Preserve",
"Write_as_ones",
"Write_as_zeros"
};
+#endif /* Future use */
#endif
acpi_gbl_next_method_owner_id = ACPI_FIRST_METHOD_ID;
}
break;
+
+ default:
+ break;
}
(void) acpi_ut_release_mutex (ACPI_MTX_CACHES);
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) 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_PSNODE].link_offset = (u16) ACPI_PTR_DIFF (&(((acpi_parse_object *) NULL)->common.next), NULL);
+ acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE_EXT].link_offset = (u16) ACPI_PTR_DIFF (&(((acpi_parse_object *) NULL)->common.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_memory_lists[ACPI_MEM_LIST_PSNODE].object_size = sizeof (acpi_parse_object);
- acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE_EXT].object_size = sizeof (acpi_parse2_object);
+ acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE].object_size = sizeof (ACPI_PARSE_OBJ_COMMON);
+ acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE_EXT].object_size = sizeof (ACPI_PARSE_OBJ_NAMED);
acpi_gbl_memory_lists[ACPI_MEM_LIST_OPERAND].object_size = sizeof (acpi_operand_object);
acpi_gbl_memory_lists[ACPI_MEM_LIST_WALK].object_size = sizeof (acpi_walk_state);
acpi_gbl_sys_notify.handler = NULL;
acpi_gbl_drv_notify.handler = NULL;
+ acpi_gbl_init_handler = NULL;
/* Global "typed" ACPI table pointers */
#ifdef ACPI_DEBUG
- acpi_gbl_lowest_stack_pointer = ACPI_UINT32_MAX;
+ acpi_gbl_lowest_stack_pointer = ACPI_SIZE_MAX;
#endif
return_VOID;
/******************************************************************************
*
* Module Name: utinit - Common ACPI subsystem initialization
- * $Revision: 109 $
+ * $Revision: 112 $
*
*****************************************************************************/
#include "acpi.h"
-#include "achware.h"
#include "acnamesp.h"
#include "acevents.h"
{
ACPI_REPORT_WARNING (
- ("Invalid FADT value %s=%lX at offset %lX FADT=%p\n",
+ ("Invalid FADT value %s=%X at offset %X FADT=%p\n",
register_name, value, offset, acpi_gbl_FADT));
}
*
******************************************************************************/
-acpi_status
+void
acpi_ut_subsystem_shutdown (void)
{
if (acpi_gbl_shutdown) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "ACPI Subsystem is already terminated\n"));
- return_ACPI_STATUS (AE_OK);
+ return_VOID;
}
/* Subsystem appears active, go ahead and shut it down */
/* Purge the local caches */
- acpi_purge_cached_objects ();
+ (void) acpi_purge_cached_objects ();
/* Debug only - display leftover memory allocation, if any */
acpi_ut_dump_allocations (ACPI_UINT32_MAX, NULL);
#endif
- return_ACPI_STATUS (AE_OK);
+ return_VOID;
}
/*******************************************************************************
*
* Module Name: utmath - Integer math support routines
- * $Revision: 10 $
+ * $Revision: 11 $
*
******************************************************************************/
*/
partial1 = quotient.part.lo * divisor.part.hi;
partial2.full = (acpi_integer) quotient.part.lo * divisor.part.lo;
- partial3.full = partial2.part.hi + partial1;
+ partial3.full = (acpi_integer) partial2.part.hi + partial1;
remainder.part.hi = partial3.part.lo;
remainder.part.lo = partial2.part.lo;
}
remainder.full = remainder.full - dividend.full;
- remainder.part.hi = -((s32) remainder.part.hi);
- remainder.part.lo = -((s32) remainder.part.lo);
+ remainder.part.hi = (u32) -((s32) remainder.part.hi);
+ remainder.part.lo = (u32) -((s32) remainder.part.lo);
if (remainder.part.lo) {
remainder.part.hi--;
/*******************************************************************************
*
* Module Name: utmisc - common utility procedures
- * $Revision: 67 $
+ * $Revision: 75 $
*
******************************************************************************/
#include "acpi.h"
-#include "acevents.h"
-#include "achware.h"
#include "acnamesp.h"
-#include "acinterp.h"
#include "amlcode.h"
-#include "acdebug.h"
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("utmisc")
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ut_dword_byte_swap
+ *
+ * PARAMETERS: Value - Value to be converted
+ *
+ * DESCRIPTION: Convert a 32-bit value to big-endian (swap the bytes)
+ *
+ ******************************************************************************/
+
+u32
+acpi_ut_dword_byte_swap (
+ u32 value)
+{
+ union {
+ u32 value;
+ u8 bytes[4];
+ } out;
+
+ union {
+ u32 value;
+ u8 bytes[4];
+ } in;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ in.value = value;
+
+ out.bytes[0] = in.bytes[3];
+ out.bytes[1] = in.bytes[2];
+ out.bytes[2] = in.bytes[1];
+ out.bytes[3] = in.bytes[0];
+
+ return (out.value);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ut_set_integer_width
+ *
+ * PARAMETERS: Revision From DSDT header
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Set the global integer bit width based upon the revision
+ * of the DSDT. For Revision 1 and 0, Integers are 32 bits.
+ * For Revision 2 and above, Integers are 64 bits. Yes, this
+ * makes a difference.
+ *
+ ******************************************************************************/
+
+void
+acpi_ut_set_integer_width (
+ u8 revision)
+{
+
+ if (revision <= 1) {
+ acpi_gbl_integer_bit_width = 32;
+ acpi_gbl_integer_byte_width = 4;
+ }
+ else {
+ acpi_gbl_integer_bit_width = 64;
+ acpi_gbl_integer_byte_width = 8;
+ }
+}
+
+
#ifdef ACPI_DEBUG
/*******************************************************************************
*
}
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ut_strtoul64
+ *
+ * PARAMETERS: String - Null terminated string
+ * Terminater - Where a pointer to the terminating byte is returned
+ * Base - Radix of the string
+ *
+ * RETURN: Converted value
+ *
+ * DESCRIPTION: Convert a string into an unsigned value.
+ *
+ ******************************************************************************/
+#define NEGATIVE 1
+#define POSITIVE 0
+
+acpi_status
+acpi_ut_strtoul64 (
+ NATIVE_CHAR *string,
+ u32 base,
+ acpi_integer *ret_integer)
+{
+ u32 index;
+ acpi_integer return_value = 0;
+ acpi_status status = AE_OK;
+ acpi_integer dividend;
+ acpi_integer quotient;
+
+
+ *ret_integer = 0;
+
+ switch (base) {
+ case 0:
+ case 8:
+ case 10:
+ case 16:
+ break;
+
+ default:
+ /*
+ * The specified Base parameter is not in the domain of
+ * this function:
+ */
+ return (AE_BAD_PARAMETER);
+ }
+
+ /*
+ * skip over any white space in the buffer:
+ */
+ while (ACPI_IS_SPACE (*string) || *string == '\t') {
+ ++string;
+ }
+
+ /*
+ * If the input parameter Base is zero, then we need to
+ * determine if it is octal, decimal, or hexadecimal:
+ */
+ if (base == 0) {
+ if (*string == '0') {
+ if (ACPI_TOLOWER (*(++string)) == 'x') {
+ base = 16;
+ ++string;
+ }
+ else {
+ base = 8;
+ }
+ }
+ else {
+ base = 10;
+ }
+ }
+
+ /*
+ * For octal and hexadecimal bases, skip over the leading
+ * 0 or 0x, if they are present.
+ */
+ if (base == 8 && *string == '0') {
+ string++;
+ }
+
+ if (base == 16 &&
+ *string == '0' &&
+ ACPI_TOLOWER (*(++string)) == 'x') {
+ string++;
+ }
+
+ /* Main loop: convert the string to an unsigned long */
+
+ while (*string) {
+ if (ACPI_IS_DIGIT (*string)) {
+ index = ((u8) *string) - '0';
+ }
+ else {
+ index = (u8) ACPI_TOUPPER (*string);
+ if (ACPI_IS_UPPER ((char) index)) {
+ index = index - 'A' + 10;
+ }
+ else {
+ goto error_exit;
+ }
+ }
+
+ if (index >= base) {
+ goto error_exit;
+ }
+
+ /* Check to see if value is out of range: */
+
+ dividend = ACPI_INTEGER_MAX - (acpi_integer) index;
+ (void) acpi_ut_short_divide (÷nd, base, "ient, NULL);
+ if (return_value > quotient) {
+ goto error_exit;
+ }
+
+ return_value *= base;
+ return_value += index;
+ ++string;
+ }
+
+ *ret_integer = return_value;
+ return (status);
+
+
+error_exit:
+ switch (base) {
+ case 8:
+ status = AE_BAD_OCTAL_CONSTANT;
+ break;
+
+ case 10:
+ status = AE_BAD_DECIMAL_CONSTANT;
+ break;
+
+ case 16:
+ status = AE_BAD_HEX_CONSTANT;
+ break;
+
+ default:
+ /* Base validated above */
+ break;
+ }
+
+ return (status);
+}
+
+
/*******************************************************************************
*
* FUNCTION: Acpi_ut_strupr
* Delete each predefined mutex object
*/
for (i = 0; i < NUM_MTX; i++) {
- acpi_ut_delete_mutex (i);
+ (void) acpi_ut_delete_mutex (i);
}
return_VOID;
source_object->common.type = ACPI_TYPE_INTEGER;
source_object->integer.value = ACPI_INTEGER_MAX;
break;
+
+ default:
+ /* Other types not supported */
+ return (AE_SUPPORT);
}
}
break;
info->num_packages++;
state->pkg.this_target_obj = NULL;
break;
+
+ default:
+ return (AE_BAD_PARAMETER);
}
return (AE_OK);
* case below.
*/
if ((!this_source_obj) ||
- (ACPI_GET_DESCRIPTOR_TYPE (this_source_obj) != ACPI_DESC_TYPE_INTERNAL) ||
+ (ACPI_GET_DESCRIPTOR_TYPE (this_source_obj) != ACPI_DESC_TYPE_OPERAND) ||
(this_source_obj->common.type != ACPI_TYPE_PACKAGE)) {
status = walk_callback (ACPI_COPY_TYPE_SIMPLE, this_source_obj,
state, context);
/******************************************************************************
*
* Module Name: utobject - ACPI object create/delete/size/cache routines
- * $Revision: 68 $
+ * $Revision: 73 $
*
*****************************************************************************/
#include "acpi.h"
-#include "acinterp.h"
#include "acnamesp.h"
-#include "actables.h"
#include "amlcode.h"
object->common.next_object = second_object;
break;
+
+ default:
+ /* All others have no secondary object */
+ break;
}
/* Save the object type in the object descriptor */
/* Check the descriptor type field */
switch (ACPI_GET_DESCRIPTOR_TYPE (object)) {
- case ACPI_DESC_TYPE_INTERNAL:
+ case ACPI_DESC_TYPE_OPERAND:
/* The object appears to be a valid acpi_operand_object */
/* Mark the descriptor type */
- ACPI_SET_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_INTERNAL);
+ ACPI_SET_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_OPERAND);
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p Size %X\n",
- object, sizeof (acpi_operand_object)));
+ object, (u32) sizeof (acpi_operand_object)));
return_PTR (object);
}
/* Object must be an acpi_operand_object */
- if (ACPI_GET_DESCRIPTOR_TYPE (object) != ACPI_DESC_TYPE_INTERNAL) {
+ if (ACPI_GET_DESCRIPTOR_TYPE (object) != ACPI_DESC_TYPE_OPERAND) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Obj %p is not an ACPI object\n", object));
return_VOID;
case ACPI_TYPE_STRING:
- length += internal_object->string.length + 1;
+ length += (ACPI_SIZE) internal_object->string.length + 1;
break;
case ACPI_TYPE_BUFFER:
- length += internal_object->buffer.length;
+ length += (ACPI_SIZE) internal_object->buffer.length;
break;
info->num_packages++;
state->pkg.this_target_obj = NULL;
break;
+
+
+ default:
+
+ /* No other types allowed */
+
+ return (AE_BAD_PARAMETER);
}
return (status);
* Round up to the next machine word.
*/
info.length += ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (acpi_object)) *
- info.num_packages;
+ (ACPI_SIZE) info.num_packages;
/* Return the total package length */
ACPI_FUNCTION_ENTRY ();
- if ((ACPI_GET_DESCRIPTOR_TYPE (internal_object) == ACPI_DESC_TYPE_INTERNAL) &&
+ if ((ACPI_GET_DESCRIPTOR_TYPE (internal_object) == ACPI_DESC_TYPE_OPERAND) &&
(internal_object->common.type == ACPI_TYPE_PACKAGE)) {
status = acpi_ut_get_package_object_size (internal_object, obj_length);
}
/******************************************************************************
*
* Module Name: utxface - External interfaces for "global" ACPI functions
- * $Revision: 92 $
+ * $Revision: 96 $
*
*****************************************************************************/
#include "acpi.h"
#include "acevents.h"
-#include "achware.h"
#include "acnamesp.h"
-#include "acinterp.h"
-#include "amlcode.h"
-#include "acdebug.h"
-#include "acexcep.h"
#include "acparser.h"
#include "acdispat.h"
-
+#include "acdebug.h"
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("utxface")
/* If configured, initialize the AML debugger */
- ACPI_DEBUGGER_EXEC (acpi_db_initialize ());
+ ACPI_DEBUGGER_EXEC (status = acpi_db_initialize ());
return_ACPI_STATUS (status);
}
if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Installing default address space handlers\n"));
- status = acpi_ev_install_default_address_space_handlers ();
+ status = acpi_ev_init_address_spaces ();
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
acpi_status
acpi_terminate (void)
{
+ acpi_status status;
+
+
ACPI_FUNCTION_TRACE ("Acpi_terminate");
/* Now we can shutdown the OS-dependent layer */
- acpi_os_terminate ();
-
-
- return_ACPI_STATUS (AE_OK);
+ status = acpi_os_terminate ();
+ return_ACPI_STATUS (status);
}
}
+/*****************************************************************************
+ *
+ * FUNCTION: Acpi_install_initialization_handler
+ *
+ * PARAMETERS: Handler - Callback procedure
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Install an initialization handler
+ *
+ * TBD: When a second function is added, must save the Function also.
+ *
+ ****************************************************************************/
+
+acpi_status
+acpi_install_initialization_handler (
+ ACPI_INIT_HANDLER handler,
+ u32 function)
+{
+
+ if (!handler) {
+ return (AE_BAD_PARAMETER);
+ }
+
+ if (acpi_gbl_init_handler) {
+ return (AE_ALREADY_EXISTS);
+ }
+
+ acpi_gbl_init_handler = handler;
+ return AE_OK;
+}
+
+
/*****************************************************************************
*
* FUNCTION: Acpi_purge_cached_objects