]> git.neil.brown.name Git - history.git/commitdiff
Clean up code based on things flagged by lint
authorAndy Grover <agrover@dexter.groveronline.com>
Wed, 29 May 2002 08:27:53 +0000 (01:27 -0700)
committerAndy Grover <agrover@dexter.groveronline.com>
Wed, 29 May 2002 08:27:53 +0000 (01:27 -0700)
Improved error checking on hw accesses
Moved arch specific macros to arch/asm/acpi.h

125 files changed:
drivers/acpi/debugger/dbcmds.c
drivers/acpi/debugger/dbdisasm.c
drivers/acpi/debugger/dbdisply.c
drivers/acpi/debugger/dbexec.c
drivers/acpi/debugger/dbfileio.c
drivers/acpi/debugger/dbhistry.c
drivers/acpi/debugger/dbinput.c
drivers/acpi/debugger/dbstats.c
drivers/acpi/debugger/dbutils.c
drivers/acpi/debugger/dbxface.c
drivers/acpi/dispatcher/dsfield.c
drivers/acpi/dispatcher/dsmethod.c
drivers/acpi/dispatcher/dsmthdat.c
drivers/acpi/dispatcher/dsobject.c
drivers/acpi/dispatcher/dsopcode.c
drivers/acpi/dispatcher/dsutils.c
drivers/acpi/dispatcher/dswexec.c
drivers/acpi/dispatcher/dswload.c
drivers/acpi/dispatcher/dswstate.c
drivers/acpi/events/evevent.c
drivers/acpi/events/evmisc.c
drivers/acpi/events/evregion.c
drivers/acpi/events/evrgnini.c
drivers/acpi/events/evsci.c
drivers/acpi/events/evxface.c
drivers/acpi/events/evxfevnt.c
drivers/acpi/events/evxfregn.c
drivers/acpi/executer/exconfig.c
drivers/acpi/executer/exconvrt.c
drivers/acpi/executer/excreate.c
drivers/acpi/executer/exdump.c
drivers/acpi/executer/exfield.c
drivers/acpi/executer/exfldio.c
drivers/acpi/executer/exmisc.c
drivers/acpi/executer/exmutex.c
drivers/acpi/executer/exnames.c
drivers/acpi/executer/exoparg1.c
drivers/acpi/executer/exoparg2.c
drivers/acpi/executer/exoparg3.c
drivers/acpi/executer/exprep.c
drivers/acpi/executer/exregion.c
drivers/acpi/executer/exresnte.c
drivers/acpi/executer/exresolv.c
drivers/acpi/executer/exresop.c
drivers/acpi/executer/exstore.c
drivers/acpi/executer/exstoren.c
drivers/acpi/executer/exstorob.c
drivers/acpi/executer/exsystem.c
drivers/acpi/executer/exutils.c
drivers/acpi/hardware/hwacpi.c
drivers/acpi/hardware/hwgpe.c
drivers/acpi/hardware/hwregs.c
drivers/acpi/hardware/hwsleep.c
drivers/acpi/hardware/hwtimer.c
drivers/acpi/include/acconfig.h
drivers/acpi/include/acdebug.h
drivers/acpi/include/acdispat.h
drivers/acpi/include/acevents.h
drivers/acpi/include/acexcep.h
drivers/acpi/include/acglobal.h
drivers/acpi/include/achware.h
drivers/acpi/include/acinterp.h
drivers/acpi/include/aclocal.h
drivers/acpi/include/acmacros.h
drivers/acpi/include/acnamesp.h
drivers/acpi/include/acobject.h
drivers/acpi/include/acparser.h
drivers/acpi/include/acpixf.h
drivers/acpi/include/acresrc.h
drivers/acpi/include/acstruct.h
drivers/acpi/include/actables.h
drivers/acpi/include/actypes.h
drivers/acpi/include/acutils.h
drivers/acpi/include/amlcode.h
drivers/acpi/include/platform/acenv.h
drivers/acpi/include/platform/acgcc.h
drivers/acpi/include/platform/aclinux.h
drivers/acpi/namespace/nsaccess.c
drivers/acpi/namespace/nsalloc.c
drivers/acpi/namespace/nsdump.c
drivers/acpi/namespace/nseval.c
drivers/acpi/namespace/nsinit.c
drivers/acpi/namespace/nsload.c
drivers/acpi/namespace/nsnames.c
drivers/acpi/namespace/nsobject.c
drivers/acpi/namespace/nssearch.c
drivers/acpi/namespace/nsutils.c
drivers/acpi/namespace/nswalk.c
drivers/acpi/namespace/nsxfname.c
drivers/acpi/namespace/nsxfobj.c
drivers/acpi/parser/psargs.c
drivers/acpi/parser/psopcode.c
drivers/acpi/parser/psparse.c
drivers/acpi/parser/pstree.c
drivers/acpi/parser/psutils.c
drivers/acpi/parser/pswalk.c
drivers/acpi/parser/psxface.c
drivers/acpi/resources/rsaddr.c
drivers/acpi/resources/rscalc.c
drivers/acpi/resources/rscreate.c
drivers/acpi/resources/rsdump.c
drivers/acpi/resources/rsio.c
drivers/acpi/resources/rsirq.c
drivers/acpi/resources/rslist.c
drivers/acpi/resources/rsmemory.c
drivers/acpi/resources/rsmisc.c
drivers/acpi/resources/rsutils.c
drivers/acpi/resources/rsxface.c
drivers/acpi/tables/tbconvrt.c
drivers/acpi/tables/tbget.c
drivers/acpi/tables/tbinstal.c
drivers/acpi/tables/tbutils.c
drivers/acpi/tables/tbxface.c
drivers/acpi/tables/tbxfroot.c
drivers/acpi/utilities/utalloc.c
drivers/acpi/utilities/utcopy.c
drivers/acpi/utilities/utdebug.c
drivers/acpi/utilities/utdelete.c
drivers/acpi/utilities/uteval.c
drivers/acpi/utilities/utglobal.c
drivers/acpi/utilities/utinit.c
drivers/acpi/utilities/utmath.c
drivers/acpi/utilities/utmisc.c
drivers/acpi/utilities/utobject.c
drivers/acpi/utilities/utxface.c

index 11bdca2d2016dc54945efa3786ec448e5eb82fcf..9cc5b842ca496b6e1b4f77d9cb6a34120743cb84 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * 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
@@ -47,7 +43,7 @@
  * 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"},
@@ -97,13 +93,13 @@ acpi_db_walk_for_references (
        /* 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);
@@ -135,7 +131,7 @@ acpi_db_find_references (
 
        /* 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);
 }
 
@@ -275,8 +271,8 @@ acpi_db_set_method_breakpoint (
        /* 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 */
@@ -482,6 +478,7 @@ acpi_db_send_notify (
        u32                     value)
 {
        acpi_namespace_node     *node;
+       acpi_status             status;
 
 
        /* Translate name to an Named object */
@@ -499,7 +496,10 @@ acpi_db_send_notify (
 
                 /* 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:
@@ -536,6 +536,7 @@ acpi_db_set_method_data (
        u32                     value;
        acpi_walk_state         *walk_state;
        acpi_operand_object     *obj_desc;
+       acpi_status             status;
 
 
        /* Validate Type_arg */
@@ -578,12 +579,16 @@ acpi_db_set_method_data (
 
                /* 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);
@@ -594,12 +599,16 @@ acpi_db_set_method_data (
 
                /* 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);
@@ -678,6 +687,10 @@ acpi_db_walk_for_specific_objects (
                case ACPI_TYPE_BUFFER:
                        acpi_os_printf (" Length %X", obj_desc->buffer.length);
                        break;
+
+               default:
+                       /* Ignore other object types */
+                       break;
                }
        }
 
@@ -722,7 +735,7 @@ acpi_db_display_objects (
 
        /* 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);
@@ -762,7 +775,7 @@ acpi_db_walk_and_match_name (
                /* 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);
@@ -812,7 +825,7 @@ acpi_db_find_name_in_namespace (
 
        /* 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);
@@ -899,7 +912,8 @@ void
 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;
@@ -964,7 +978,7 @@ get_crs:
        }
 
        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);
@@ -997,7 +1011,7 @@ get_prs:
        }
 
        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));
        }
 
 
@@ -1010,4 +1024,89 @@ cleanup:
 }
 
 
+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 */
index 22ebb184497a5c00c9fb2b521e4ec061cc989cf5..bd65226da239a1e6e9e9b6bec83bb149437d55b6 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: dbdisasm - parser op tree display routines
- *              $Revision: 61 $
+ *              $Revision: 66 $
  *
  ******************************************************************************/
 
@@ -40,7 +40,7 @@
 #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 = "....";
@@ -63,7 +63,7 @@ acpi_db_block_type (
        acpi_parse_object       *op)
 {
 
-       switch (op->opcode) {
+       switch (op->common.aml_opcode) {
        case AML_METHOD_OP:
                return (BLOCK_BRACE);
 
@@ -101,15 +101,15 @@ acpi_ps_display_object_pathname (
        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 */
@@ -155,11 +155,11 @@ acpi_ps_display_object_pathname (
 
        /* 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)) {
@@ -174,7 +174,7 @@ acpi_ps_display_object_pathname (
 
                /* Save it for next time. */
 
-               op->node = node;
+               op->common.node = node;
        }
 
        /* Convert Named_desc/handle to a full pathname */
@@ -244,10 +244,10 @@ acpi_db_display_op (
 
                /* 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) {
@@ -276,9 +276,9 @@ acpi_db_display_op (
                /* 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);
                                }
 
@@ -293,7 +293,8 @@ acpi_db_display_op (
 
                /* 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 */
@@ -308,10 +309,10 @@ acpi_db_display_op (
 
                /* 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");
@@ -438,7 +439,7 @@ acpi_db_display_path (
 
        /* 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;
        }
@@ -446,7 +447,7 @@ acpi_db_display_path (
        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 {
@@ -454,9 +455,9 @@ acpi_db_display_path (
                }
 
                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;
                }
        }
@@ -468,17 +469,17 @@ acpi_db_display_path (
 
                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 */
 
@@ -489,7 +490,7 @@ acpi_db_display_path (
                                }
 
                                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 {
@@ -497,8 +498,8 @@ acpi_db_display_path (
                                        }
 
                                        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 {
@@ -544,18 +545,19 @@ acpi_db_display_opcode (
 
        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;
 
@@ -563,10 +565,10 @@ acpi_db_display_opcode (
        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;
 
@@ -574,10 +576,10 @@ acpi_db_display_opcode (
        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;
 
@@ -585,20 +587,20 @@ acpi_db_display_opcode (
        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\">");
@@ -608,8 +610,8 @@ acpi_db_display_opcode (
 
        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>\"");
@@ -619,38 +621,38 @@ acpi_db_display_opcode (
 
        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]);
@@ -663,12 +665,13 @@ acpi_db_display_opcode (
 
                /* 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]);
@@ -680,7 +683,7 @@ acpi_db_display_opcode (
        if (!op_info) {
                /* If there is another element in the list, add a comma */
 
-               if (op->next) {
+               if (op->common.next) {
                        acpi_os_printf (",");
                }
        }
@@ -688,13 +691,13 @@ acpi_db_display_opcode (
        /*
         * 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);
                }
        }
 }
index 1b64fa8d4cd019d49a5a2c8546f15a6641c98528..e16cd8e815607058dc0bfc667baddc301e2ff118 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * 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"
 
@@ -61,7 +59,7 @@ acpi_db_get_pointer (
        void                    *obj_ptr;
 
 
-#ifdef _IA16
+#if ACPI_MACHINE_WIDTH == 16
 #include <stdio.h>
 
        /* Have to handle 16-bit pointers of the form segment:offset */
@@ -101,16 +99,16 @@ acpi_db_dump_parser_descriptor (
        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);
 }
 
 
@@ -190,7 +188,7 @@ acpi_db_decode_and_display_object (
                        goto dump_nte;
 
 
-               case ACPI_DESC_TYPE_INTERNAL:
+               case ACPI_DESC_TYPE_OPERAND:
 
                        /* This is a ACPI OPERAND OBJECT */
 
@@ -266,7 +264,7 @@ dump_nte:
 
        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;
@@ -307,8 +305,8 @@ acpi_db_decode_internal_object (
        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;
 
 
@@ -335,6 +333,11 @@ acpi_db_decode_internal_object (
                        acpi_os_printf (" %2.2X", obj_desc->buffer.pointer[i]);
                }
                break;
+
+
+       default:
+               /* No additional display for other types */
+               break;
        }
 }
 
@@ -379,7 +382,7 @@ acpi_db_display_internal_object (
        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) {
@@ -391,11 +394,11 @@ acpi_db_display_internal_object (
                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;
                }
 
@@ -517,13 +520,13 @@ acpi_db_display_method_info (
        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;
@@ -540,7 +543,7 @@ acpi_db_display_method_info (
 
                /* 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) {
@@ -604,7 +607,7 @@ acpi_db_display_locals (void)
 
        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;
@@ -650,7 +653,7 @@ acpi_db_display_arguments (void)
        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;
@@ -696,7 +699,7 @@ acpi_db_display_results (void)
        }
 
        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];
@@ -721,7 +724,6 @@ acpi_db_display_results (void)
 void
 acpi_db_display_calling_tree (void)
 {
-       u32                     i;
        acpi_walk_state         *walk_state;
        acpi_namespace_node     *node;
 
@@ -735,10 +737,10 @@ acpi_db_display_calling_tree (void)
        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;
        }
index 8472f359b49874661a6d5c128251460aa4c3cd4a..08bcb7ec3fa43d73c515e587bb15777d8fbbad46 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * 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
 
@@ -41,7 +33,7 @@
         ACPI_MODULE_NAME    ("dbexec")
 
 
-acpi_db_method_info         acpi_gbl_db_method_info;
+static acpi_db_method_info  acpi_gbl_db_method_info;
 
 
 /*******************************************************************************
@@ -127,7 +119,7 @@ acpi_db_execute_method (
 
 void
 acpi_db_execute_setup (
-       acpi_db_method_info         *info)
+       acpi_db_method_info     *info)
 {
 
        /* Catenate the current scope to the supplied name */
@@ -172,7 +164,8 @@ acpi_db_execute_setup (
  ******************************************************************************/
 
 u32
-acpi_db_get_outstanding_allocations (void)
+acpi_db_get_outstanding_allocations (
+       void)
 {
        u32                     outstanding = 0;
 
@@ -309,7 +302,10 @@ acpi_db_method_thread (
 
        /* 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");
+       }
 }
 
 
@@ -373,7 +369,10 @@ acpi_db_create_execution_threads (
        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 */
@@ -386,7 +385,7 @@ acpi_db_create_execution_threads (
 
        /* 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);
index 79ecce462ead356d30fb549ef61b115cc445c4b9..ee7a0d0fadb4aea4fb12274f59d2ffbf758a79b9 100644 (file)
@@ -2,7 +2,7 @@
  *
  * 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 $
  *
  ******************************************************************************/
 
@@ -28,8 +28,6 @@
 #include "acpi.h"
 #include "acdebug.h"
 #include "acnamesp.h"
-#include "acparser.h"
-#include "acevents.h"
 #include "actables.h"
 
 #ifdef ENABLE_DEBUGGER
@@ -167,7 +165,7 @@ acpi_db_open_debug_file (
  *
  ******************************************************************************/
 
-acpi_status
+static acpi_status
 acpi_db_load_table(
        FILE                    *fp,
        acpi_table_header       **table_ptr,
@@ -285,7 +283,7 @@ ae_local_load_table (
 
        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 */
 
@@ -371,7 +369,7 @@ acpi_db_load_acpi_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",
@@ -382,7 +380,7 @@ acpi_db_load_acpi_table (
        }
 
        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;
 
index d780bdd216fed5a170a9117c7c9c451dc59036db..d70e6863feb98c1f55620b919a27ab8950730484 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * 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
 
@@ -54,11 +46,11 @@ typedef struct history_info
 } 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;
 
 
 /*******************************************************************************
index bc7ef52f2882729c776faff28b23353e28926905..04bb3bb9a49ba6d6d42caed0cf0f5d6c5caacb24 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * 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"
 
 
@@ -67,6 +63,7 @@ enum acpi_ex_debugger_commands
        CMD_HISTORY_EXE,
        CMD_HISTORY_LAST,
        CMD_INFORMATION,
+       CMD_INTEGRITY,
        CMD_INTO,
        CMD_LEVEL,
        CMD_LIST,
@@ -97,7 +94,7 @@ enum acpi_ex_debugger_commands
 #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},
@@ -120,6 +117,7 @@ const COMMAND_INFO          acpi_gbl_db_commands[] =
        {"!",            1},
        {"!!",           0},
        {"INFORMATION",  0},
+       {"INTEGRITY",    0},
        {"INTO",         0},
        {"LEVEL",        0},
        {"LIST",         0},
@@ -190,7 +188,7 @@ acpi_db_display_help (
        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");
@@ -209,7 +207,7 @@ acpi_db_display_help (
                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");
@@ -227,7 +225,7 @@ acpi_db_display_help (
                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");
@@ -244,14 +242,14 @@ acpi_db_display_help (
                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;
        }
 }
@@ -526,7 +524,7 @@ acpi_db_command_dispatch (
                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:
@@ -574,6 +572,10 @@ acpi_db_command_dispatch (
                acpi_db_display_method_info (op);
                break;
 
+       case CMD_INTEGRITY:
+               acpi_db_check_integrity ();
+               break;
+
        case CMD_INTO:
                if (op)
                {
@@ -623,7 +625,7 @@ acpi_db_command_dispatch (
                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:
@@ -636,7 +638,8 @@ acpi_db_command_dispatch (
                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:
@@ -668,11 +671,11 @@ acpi_db_command_dispatch (
                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]);
@@ -722,6 +725,7 @@ acpi_db_command_dispatch (
                return (AE_CTRL_TERMINATE);
 
        case CMD_NOT_FOUND:
+       default:
                acpi_os_printf ("Unknown Command\n");
                return (AE_CTRL_TRUE);
        }
@@ -794,13 +798,11 @@ void
 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);
 }
 
 
@@ -847,8 +849,7 @@ acpi_db_user_commands (
 
                /* 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 */
 
@@ -882,7 +883,7 @@ acpi_db_user_commands (
         * 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);
 }
 
index 1c97a8d1ea1fe4edc804f65fa759824cbe6b919b..2cd35a06df9fc15da1976ae78a9b98f41e65d20c 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: dbstats - Generation and display of ACPI table statistics
- *              $Revision: 55 $
+ *              $Revision: 59 $
  *
  ******************************************************************************/
 
@@ -26,8 +26,6 @@
 
 #include <acpi.h>
 #include <acdebug.h>
-#include <amlcode.h>
-#include <acparser.h>
 #include <acnamesp.h>
 
 #ifdef ENABLE_DEBUGGER
@@ -38,7 +36,7 @@
 /*
  * Statistics subcommands
  */
-ARGUMENT_INFO               acpi_db_stat_types [] =
+static ARGUMENT_INFO        acpi_db_stat_types [] =
 { {"ALLOCATIONS"},
        {"OBJECTS"},
        {"MEMORY"},
@@ -49,13 +47,13 @@ ARGUMENT_INFO               acpi_db_stat_types [] =
        {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
 
 
 /*******************************************************************************
@@ -143,6 +141,9 @@ acpi_db_enumerate_object (
                acpi_db_enumerate_object (obj_desc->thermal_zone.drv_handler);
                acpi_db_enumerate_object (obj_desc->thermal_zone.addr_handler);
                break;
+
+       default:
+               break;
        }
 }
 
@@ -232,7 +233,7 @@ acpi_db_classify_one_object (
  *
  ******************************************************************************/
 
-acpi_status
+void
 acpi_db_count_namespace_objects (
        void)
 {
@@ -249,10 +250,8 @@ acpi_db_count_namespace_objects (
                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
@@ -305,14 +304,14 @@ acpi_db_display_statistics (
        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)
@@ -321,13 +320,13 @@ acpi_db_display_statistics (
                }
                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");
 
@@ -345,7 +344,7 @@ acpi_db_display_statistics (
 #endif
                break;
 
-       case CMD_MEMORY:
+       case CMD_STAT_MEMORY:
 
 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
                acpi_os_printf ("\n----Object and Cache Statistics---------------------------------------------\n");
@@ -391,9 +390,9 @@ acpi_db_display_statistics (
 
                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);
 
@@ -407,9 +406,9 @@ acpi_db_display_statistics (
                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));
@@ -436,23 +435,29 @@ acpi_db_display_statistics (
 
                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;
        }
 
index 08beb41b5e44e56534ecd1e2ed94e535b21075d0..50a921723f48676730343fdcf996abfaa8eab601 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: dbutils - AML debugger utilities
- *              $Revision: 52 $
+ *              $Revision: 55 $
  *
  ******************************************************************************/
 
@@ -28,9 +28,6 @@
 #include "acparser.h"
 #include "amlcode.h"
 #include "acnamesp.h"
-#include "acparser.h"
-#include "acevents.h"
-#include "acinterp.h"
 #include "acdebug.h"
 #include "acdispat.h"
 
@@ -87,7 +84,7 @@ acpi_db_dump_buffer (
        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);
@@ -259,7 +256,7 @@ acpi_db_second_pass_parse (
        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;
@@ -272,10 +269,11 @@ acpi_db_second_pass_parse (
 
        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);
@@ -283,32 +281,32 @@ acpi_db_second_pass_parse (
                                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! */
                        /*
                         *
index 44ea2e7cad7c49f7e9042288e91de51cb0de0c74..d0cad6347c5dc15b25e9fdcd033a328115932da4 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * 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"
 
 
@@ -71,11 +66,12 @@ acpi_db_single_step (
 
        /* 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;
@@ -83,8 +79,9 @@ acpi_db_single_step (
 
        /* 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;
@@ -95,7 +92,7 @@ acpi_db_single_step (
         * 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);
        }
 
@@ -103,6 +100,10 @@ acpi_db_single_step (
        case AML_CLASS_UNKNOWN:
        case AML_CLASS_ARGUMENT:    /* constants, literals, etc.  do nothing */
                return (AE_OK);
+
+       default:
+               /* All other opcodes -- continue */
+               break;
        }
 
        /*
@@ -123,12 +124,12 @@ acpi_db_single_step (
                 */
                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)) {
@@ -138,25 +139,25 @@ acpi_db_single_step (
                                 * 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;
                                }
                        }
                }
@@ -165,8 +166,8 @@ acpi_db_single_step (
 
                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");
                        }
@@ -175,13 +176,13 @@ acpi_db_single_step (
                        }
                }
 
-               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;
        }
@@ -197,7 +198,7 @@ acpi_db_single_step (
         * 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);
@@ -212,7 +213,7 @@ acpi_db_single_step (
         * 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 */
@@ -261,7 +262,7 @@ acpi_db_single_step (
 
                        /* 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);
@@ -287,9 +288,11 @@ acpi_db_single_step (
  *
  ******************************************************************************/
 
-int
+acpi_status
 acpi_db_initialize (void)
 {
+       acpi_status             status;
+
 
        /* Init globals */
 
@@ -309,7 +312,7 @@ acpi_db_initialize (void)
 
        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);
 
@@ -327,12 +330,24 @@ acpi_db_initialize (void)
        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) {
@@ -341,7 +356,7 @@ acpi_db_initialize (void)
                acpi_gbl_db_opt_stats = FALSE;
        }
 
-       return (0);
+       return (AE_OK);
 }
 
 
index c5c365cc9f9c926440c06c440b87c513912ddba3..2905956eb273a4946cdb058d194618df9cc8c98a 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: dsfield - Dispatcher field routines
- *              $Revision: 62 $
+ *              $Revision: 65 $
  *
  *****************************************************************************/
 
@@ -74,7 +74,7 @@ acpi_ds_create_buffer_field (
 
        /* 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 {
@@ -102,7 +102,7 @@ acpi_ds_create_buffer_field (
        /*
         * 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)) {
@@ -113,7 +113,7 @@ acpi_ds_create_buffer_field (
         * 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
@@ -144,8 +144,8 @@ acpi_ds_create_buffer_field (
         * 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 */
@@ -187,6 +187,7 @@ acpi_ds_get_field_names (
        acpi_parse_object       *arg)
 {
        acpi_status             status;
+       acpi_integer            position;
 
 
        ACPI_FUNCTION_TRACE_PTR ("Ds_get_field_names", info);
@@ -205,16 +206,18 @@ acpi_ds_get_field_names (
                 * 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;
 
 
@@ -227,9 +230,9 @@ acpi_ds_get_field_names (
                         * 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;
 
 
@@ -238,7 +241,7 @@ acpi_ds_get_field_names (
                        /* 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)) {
@@ -247,11 +250,11 @@ acpi_ds_get_field_names (
                                }
 
                                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 */
 
@@ -263,8 +266,10 @@ acpi_ds_get_field_names (
 
                        /* 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);
@@ -277,11 +282,11 @@ acpi_ds_get_field_names (
                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);
@@ -308,7 +313,7 @@ acpi_ds_create_field (
        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;
 
@@ -318,9 +323,9 @@ acpi_ds_create_field (
 
        /* 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, &region_node);
                if (ACPI_FAILURE (status)) {
@@ -330,8 +335,8 @@ acpi_ds_create_field (
 
        /* 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 */
@@ -339,7 +344,7 @@ acpi_ds_create_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);
 }
@@ -365,7 +370,7 @@ acpi_ds_init_field_objects (
        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;
@@ -389,6 +394,9 @@ acpi_ds_init_field_objects (
                arg = acpi_ps_get_arg (op, 3);
                type = INTERNAL_TYPE_INDEX_FIELD;
                break;
+
+       default:
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        /*
@@ -397,9 +405,9 @@ acpi_ds_init_field_objects (
        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);
@@ -409,18 +417,22 @@ acpi_ds_init_field_objects (
                                }
 
                                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);
 }
 
 
@@ -444,7 +456,7 @@ acpi_ds_create_bank_field (
        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;
 
@@ -454,9 +466,9 @@ acpi_ds_create_bank_field (
 
        /* 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, &region_node);
                if (ACPI_FAILURE (status)) {
@@ -466,8 +478,8 @@ acpi_ds_create_bank_field (
 
        /* 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)) {
@@ -476,20 +488,20 @@ acpi_ds_create_bank_field (
 
        /* 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);
 }
@@ -525,8 +537,8 @@ acpi_ds_create_index_field (
 
        /* 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)) {
@@ -535,8 +547,8 @@ acpi_ds_create_index_field (
 
        /* 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)) {
@@ -545,8 +557,8 @@ acpi_ds_create_index_field (
 
        /* 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 */
@@ -554,7 +566,7 @@ acpi_ds_create_index_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);
 }
index 0dd4e72104408ec77e7e2227ebf1ff174284661a..094ba815e04b1ffff707969893164d896876483f 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: dsmethod - Parser/Interpreter interface - control method parsing
- *              $Revision: 81 $
+ *              $Revision: 86 $
  *
  *****************************************************************************/
 
@@ -30,8 +30,6 @@
 #include "acdispat.h"
 #include "acinterp.h"
 #include "acnamesp.h"
-#include "actables.h"
-#include "acdebug.h"
 
 
 #define _COMPONENT          ACPI_DISPATCHER
@@ -78,7 +76,7 @@ acpi_ds_parse_method (
        }
 
        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 */
 
@@ -112,7 +110,7 @@ acpi_ds_parse_method (
        /* 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
@@ -124,8 +122,7 @@ acpi_ds_parse_method (
 
        /* 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);
        }
@@ -152,8 +149,9 @@ acpi_ds_parse_method (
                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);
@@ -348,8 +346,8 @@ acpi_ds_call_control_method (
 
        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);
 
@@ -357,7 +355,7 @@ acpi_ds_call_control_method (
        /* 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);
 
@@ -444,6 +442,10 @@ acpi_ds_terminate_control_method (
        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;
@@ -468,8 +470,14 @@ acpi_ds_terminate_control_method (
        /* 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 */
index f9005e997ac6d150c9896b24f74fe6ca2f101d05..7ce3aaab876c03c05632b847975e69e2ce620a67 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: dsmthdat - control method arguments and local variables
- *              $Revision: 59 $
+ *              $Revision: 61 $
  *
  ******************************************************************************/
 
@@ -25,9 +25,7 @@
 
 
 #include "acpi.h"
-#include "acparser.h"
 #include "acdispat.h"
-#include "acinterp.h"
 #include "amlcode.h"
 #include "acnamesp.h"
 
@@ -57,7 +55,7 @@
  *
  ******************************************************************************/
 
-acpi_status
+void
 acpi_ds_method_data_init (
        acpi_walk_state         *walk_state)
 {
@@ -90,7 +88,7 @@ acpi_ds_method_data_init (
                walk_state->local_variables[i].flags       = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL;
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_VOID;
 }
 
 
@@ -100,14 +98,14 @@ acpi_ds_method_data_init (
  *
  * 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)
 {
@@ -127,7 +125,7 @@ acpi_ds_method_data_delete_all (
                        /* Detach object (if present) and remove a reference */
 
                        acpi_ns_detach_object (&walk_state->local_variables[index]);
-          }
+               }
        }
 
        /* Detach the arguments */
@@ -143,7 +141,7 @@ acpi_ds_method_data_delete_all (
                }
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_VOID;
 }
 
 
@@ -435,6 +433,9 @@ acpi_ds_method_data_get_value (
                                index, node));
 
                        return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL);
+
+               default:
+                       return_ACPI_STATUS (AE_AML_INTERNAL);
                }
        }
 
@@ -457,14 +458,14 @@ acpi_ds_method_data_get_value (
  *              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,
@@ -482,7 +483,7 @@ acpi_ds_method_data_delete_value (
 
        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 */
@@ -497,7 +498,7 @@ acpi_ds_method_data_delete_value (
        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
@@ -506,7 +507,7 @@ acpi_ds_method_data_delete_value (
                acpi_ut_remove_reference (object);
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_VOID;
 }
 
 
index 86de246626931c870e5a6ef669a877658ccfc808..084924bd3fdba8bbfdf6aaa6cdcd772d0f103161 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: dsobject - Dispatcher object management routines
- *              $Revision: 91 $
+ *              $Revision: 99 $
  *
  *****************************************************************************/
 
@@ -28,7 +28,6 @@
 #include "acparser.h"
 #include "amlcode.h"
 #include "acdispat.h"
-#include "acinterp.h"
 #include "acnamesp.h"
 
 #define _COMPONENT          ACPI_DISPATCHER
@@ -65,15 +64,11 @@ acpi_ds_init_one_object (
        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
@@ -83,6 +78,8 @@ acpi_ds_init_one_object (
                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);
@@ -90,7 +87,12 @@ acpi_ds_init_one_object (
        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;
@@ -107,9 +109,11 @@ acpi_ds_init_one_object (
                /*
                 * 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;
                }
 
                /*
@@ -119,7 +123,7 @@ acpi_ds_init_one_object (
                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 */
@@ -135,6 +139,13 @@ acpi_ds_init_one_object (
                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;
        }
@@ -177,10 +188,10 @@ acpi_ds_initialize_objects (
                "**** 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 */
@@ -188,16 +199,17 @@ acpi_ds_initialize_objects (
        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);
 }
@@ -251,8 +263,8 @@ acpi_ds_init_object_from_op (
                 * 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;
 
 
@@ -262,21 +274,21 @@ acpi_ds_init_object_from_op (
                 * 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
@@ -313,10 +325,10 @@ acpi_ds_init_object_from_op (
 
                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;
@@ -327,7 +339,7 @@ acpi_ds_init_object_from_op (
 
        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;
@@ -366,31 +378,30 @@ acpi_ds_build_internal_object (
        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;
@@ -404,12 +415,12 @@ acpi_ds_build_internal_object (
 
        /* 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);
@@ -443,7 +454,7 @@ acpi_ds_build_internal_buffer_obj (
 {
        acpi_parse_object       *arg;
        acpi_operand_object     *obj_desc;
-       acpi_parse2_object      *byte_list;
+       acpi_parse_object       *byte_list;
        u32                     byte_list_length = 0;
 
 
@@ -472,20 +483,20 @@ acpi_ds_build_internal_buffer_obj (
         * 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;
        }
 
        /*
@@ -516,12 +527,12 @@ acpi_ds_build_internal_buffer_obj (
        /* 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);
 }
 
@@ -560,11 +571,10 @@ acpi_ds_build_internal_package_obj (
 
        /* 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;
@@ -581,7 +591,7 @@ acpi_ds_build_internal_package_obj (
                        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;
@@ -589,11 +599,11 @@ acpi_ds_build_internal_package_obj (
        /* 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;
        }
 
        /*
@@ -610,7 +620,7 @@ acpi_ds_build_internal_package_obj (
         * 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);
@@ -621,13 +631,13 @@ acpi_ds_build_internal_package_obj (
         * 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,
@@ -635,11 +645,11 @@ acpi_ds_build_internal_package_obj (
                }
 
                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);
 }
 
@@ -679,7 +689,7 @@ acpi_ds_create_node (
                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);
@@ -687,7 +697,7 @@ acpi_ds_create_node (
 
        /* 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);
        }
index 195acd40cde25736a9f9f128704e54fd4f5cb3ef..a3d8453ab454a1f3d5fd5c19ed5e706350651083 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Module Name: dsopcode - Dispatcher Op Region support and handling of
  *                         "control" opcodes
- *              $Revision: 74 $
+ *              $Revision: 79 $
  *
  *****************************************************************************/
 
@@ -32,7 +32,6 @@
 #include "acinterp.h"
 #include "acnamesp.h"
 #include "acevents.h"
-#include "actables.h"
 
 #define _COMPONENT          ACPI_DISPATCHER
         ACPI_MODULE_NAME    ("dsopcode")
@@ -43,7 +42,8 @@
  * 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.
  *
@@ -77,7 +77,7 @@ acpi_ds_execute_arguments (
 
        /* 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 */
 
@@ -105,9 +105,9 @@ acpi_ds_execute_arguments (
 
        /* 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 */
@@ -117,7 +117,7 @@ acpi_ds_execute_arguments (
                return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
-       op->node = scope_node;
+       op->common.node = scope_node;
 
        /* Create and initialize a new parser state */
 
@@ -175,7 +175,7 @@ acpi_ds_get_buffer_field_arguments (
 
        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 */
 
@@ -320,7 +320,7 @@ acpi_ds_get_region_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),
@@ -337,7 +337,7 @@ acpi_ds_get_region_arguments (
  *
  * RETURN:      Status
  *
- * DESCRIPTION:
+ * DESCRIPTION: Front end to Ev_initialize_region
  *
  ****************************************************************************/
 
@@ -360,110 +360,76 @@ acpi_ds_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;
 
@@ -471,8 +437,8 @@ acpi_ds_eval_buffer_field_operands (
 
                /* 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;
 
@@ -480,8 +446,8 @@ acpi_ds_eval_buffer_field_operands (
 
                /* 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;
 
@@ -489,8 +455,8 @@ acpi_ds_eval_buffer_field_operands (
 
                /* 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;
 
@@ -498,8 +464,8 @@ acpi_ds_eval_buffer_field_operands (
 
                /* 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;
 
@@ -507,105 +473,157 @@ acpi_ds_eval_buffer_field_operands (
 
                /* 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);
@@ -616,7 +634,8 @@ cleanup:
  *
  * 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
  *
@@ -643,15 +662,15 @@ acpi_ds_eval_region_operands (
        /*
         * 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 */
 
@@ -662,13 +681,13 @@ acpi_ds_eval_region_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);
@@ -711,7 +730,9 @@ acpi_ds_eval_region_operands (
  *
  * 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
  *
@@ -737,7 +758,7 @@ acpi_ds_eval_data_object_operands (
 
        /* 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);
        }
@@ -756,13 +777,17 @@ acpi_ds_eval_data_object_operands (
 
        /* 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);
@@ -784,10 +809,10 @@ acpi_ds_eval_data_object_operands (
                 * 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;
                }
        }
@@ -823,9 +848,9 @@ acpi_ds_exec_begin_control_op (
 
 
        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:
 
@@ -845,7 +870,7 @@ acpi_ds_exec_begin_control_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 */
@@ -902,7 +927,7 @@ acpi_ds_exec_end_control_op (
        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));
@@ -952,17 +977,17 @@ acpi_ds_exec_end_control_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);
                        }
@@ -995,7 +1020,7 @@ acpi_ds_exec_end_control_op (
                         *
                         * 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);
@@ -1039,7 +1064,7 @@ acpi_ds_exec_end_control_op (
 
                /* 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. */
 
@@ -1070,7 +1095,7 @@ acpi_ds_exec_end_control_op (
 
                /* Return status depending on opcode */
 
-               if (op->opcode == AML_BREAK_OP) {
+               if (op->common.aml_opcode == AML_BREAK_OP) {
                        status = AE_CTRL_BREAK;
                }
                else {
@@ -1082,7 +1107,7 @@ acpi_ds_exec_end_control_op (
        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;
index 40fa8fe36046f0f9c3be6565e1dcbf1eb4cf9e56..fa6697bc9248b2442869e35c3e5a9e41fce19ee8 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: dsutils - Dispatcher utilities
- *              $Revision: 89 $
+ *              $Revision: 92 $
  *
  ******************************************************************************/
 
@@ -74,14 +74,14 @@ acpi_ds_is_result_used (
         * 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);
@@ -96,7 +96,7 @@ acpi_ds_is_result_used (
        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 */
@@ -114,6 +114,11 @@ acpi_ds_is_result_used (
                                (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 */
@@ -132,12 +137,12 @@ acpi_ds_is_result_used (
 
        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.
@@ -160,16 +165,16 @@ acpi_ds_is_result_used (
 
 result_used:
        ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] used by Parent [%s] Op=%p\n",
-                       acpi_ps_get_opcode_name (op->opcode),
-                       acpi_ps_get_opcode_name (op->parent->opcode), op));
+                       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);
 
@@ -253,6 +258,7 @@ acpi_ds_create_operand (
        u32                     arg_index)
 {
        acpi_status             status = AE_OK;
+       acpi_status             status2;
        NATIVE_CHAR             *name_string;
        u32                     name_length;
        acpi_operand_object     *obj_desc;
@@ -268,13 +274,13 @@ acpi_ds_create_operand (
 
        /* 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)) {
@@ -292,12 +298,12 @@ acpi_ds_create_operand (
                 * 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;
@@ -313,20 +319,20 @@ acpi_ds_create_operand (
                                 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;
                        }
 
@@ -338,10 +344,12 @@ acpi_ds_create_operand (
                                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);
+                               }
                        }
                }
 
@@ -368,7 +376,7 @@ acpi_ds_create_operand (
        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
@@ -381,7 +389,7 @@ acpi_ds_create_operand (
                }
 
                else {
-                       opcode = arg->opcode;
+                       opcode = arg->common.aml_opcode;
                }
 
                /* Get the object type of the argument */
@@ -413,7 +421,6 @@ acpi_ds_create_operand (
                                return_ACPI_STATUS (status);
                        }
                }
-
                else {
                        /* Create an ACPI_INTERNAL_OBJECT for the argument */
 
@@ -430,7 +437,7 @@ acpi_ds_create_operand (
                                acpi_ut_delete_object_desc (obj_desc);
                                return_ACPI_STATUS (status);
                        }
-          }
+               }
 
                /* Put the operand object on the object stack */
 
@@ -487,7 +494,7 @@ acpi_ds_create_operands (
 
                /* Move on to next argument, if any */
 
-               arg = arg->next;
+               arg = arg->common.next;
                arg_count++;
        }
 
@@ -500,7 +507,7 @@ cleanup:
         * 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)));
index 6d57e8f98b56a36900d934d0e0671ed3284b45c7..12c46192c75a7b3efe17af55dfc348dd39afd1f4 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Module Name: dswexec - Dispatcher method execution callbacks;
  *                        dispatch to interpreter.
- *              $Revision: 90 $
+ *              $Revision: 92 $
  *
  *****************************************************************************/
 
@@ -40,7 +40,7 @@
 /*
  * 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,
@@ -200,13 +200,17 @@ acpi_ds_exec_begin_op (
 
                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);
+                       }
                }
        }
 
@@ -241,7 +245,7 @@ acpi_ds_exec_begin_op (
 
        /* 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;
        }
 
@@ -273,7 +277,7 @@ acpi_ds_exec_begin_op (
                        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;
@@ -336,11 +340,11 @@ acpi_ds_exec_end_op (
        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 */
 
@@ -432,8 +436,11 @@ acpi_ds_exec_end_op (
                        /* 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;
 
 
@@ -451,7 +458,7 @@ acpi_ds_exec_end_op (
 
                        /* 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
@@ -503,26 +510,28 @@ acpi_ds_exec_end_op (
                        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:
@@ -552,7 +561,7 @@ acpi_ds_exec_end_op (
                                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));
 
@@ -585,7 +594,7 @@ acpi_ds_exec_end_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;
index 23a2e034069496725e1bcf8d0e98370e88404f56..6a6d5581f46dfa8bae8d699ccede829a4e43ed46 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: dswload - Dispatcher namespace load callbacks
- *              $Revision: 62 $
+ *              $Revision: 66 $
  *
  *****************************************************************************/
 
@@ -115,21 +115,21 @@ acpi_ds_load1_begin_op (
        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);
                }
@@ -142,7 +142,7 @@ acpi_ds_load1_begin_op (
        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
@@ -167,13 +167,13 @@ acpi_ds_load1_begin_op (
 
        /* 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;
@@ -202,6 +202,7 @@ acpi_ds_load1_end_op (
 {
        acpi_parse_object       *op;
        acpi_object_type        object_type;
+       acpi_status             status = AE_OK;
 
 
        ACPI_FUNCTION_NAME ("Ds_load1_end_op");
@@ -224,24 +225,26 @@ acpi_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;
                }
        }
 
@@ -251,10 +254,10 @@ acpi_ds_load1_end_op (
                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);
 }
 
 
@@ -282,7 +285,6 @@ acpi_ds_load2_begin_op (
        acpi_status             status;
        acpi_object_type        object_type;
        NATIVE_CHAR             *buffer_ptr;
-       void                    *original = NULL;
 
 
        ACPI_FUNCTION_NAME ("Ds_load2_begin_op");
@@ -305,7 +307,7 @@ acpi_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 */
 
@@ -315,7 +317,7 @@ acpi_ds_load2_begin_op (
                else {
                        /* Get name from the op */
 
-                       buffer_ptr = (NATIVE_CHAR *) &((acpi_parse2_object *)op)->name;
+                       buffer_ptr = (NATIVE_CHAR *) &op->named.name;
                }
        }
        else {
@@ -329,7 +331,7 @@ acpi_ds_load2_begin_op (
        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         ||
@@ -347,9 +349,12 @@ acpi_ds_load2_begin_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);
@@ -381,24 +386,19 @@ acpi_ds_load2_begin_op (
 
                        /* 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);
@@ -445,11 +445,11 @@ acpi_ds_load2_end_op (
                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);
@@ -463,7 +463,7 @@ acpi_ds_load2_end_op (
         * 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
@@ -477,7 +477,11 @@ acpi_ds_load2_end_op (
        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);
+               }
        }
 
        /*
@@ -510,11 +514,11 @@ acpi_ds_load2_end_op (
 
        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:
@@ -529,21 +533,25 @@ acpi_ds_load2_end_op (
 
         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;
@@ -556,7 +564,7 @@ acpi_ds_load2_end_op (
                        goto cleanup;
                }
 
-               switch (op->opcode) {
+               switch (op->common.aml_opcode) {
                case AML_PROCESSOR_OP:
 
                        status = acpi_ex_create_processor (walk_state);
@@ -606,7 +614,7 @@ acpi_ds_load2_end_op (
 
        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
@@ -621,9 +629,8 @@ acpi_ds_load2_end_op (
                                        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;
 
@@ -655,6 +662,11 @@ acpi_ds_load2_end_op (
 
                        status = acpi_ds_create_node (walk_state, node, op);
                        break;
+
+
+               default:
+                       /* All NAMED_COMPLEX opcodes must be handled above */
+                       break;
                }
                break;
 
@@ -674,7 +686,7 @@ acpi_ds_load2_end_op (
                /*
                 * 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));
@@ -691,7 +703,7 @@ acpi_ds_load2_end_op (
                         * 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;
index ecff248de9b234efea46349e20612b1026b85556..c4f610a1209ead075cd11f66b2af9e9bd0f0b758 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * 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")
@@ -126,13 +124,12 @@ acpi_ds_result_remove (
                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]) {
@@ -237,7 +234,7 @@ acpi_ds_result_pop_from_bottom (
        acpi_operand_object     **object,
        acpi_walk_state         *walk_state)
 {
-       u32                     index;
+       NATIVE_UINT             index;
        acpi_generic_state      *state;
 
 
@@ -251,7 +248,6 @@ acpi_ds_result_pop_from_bottom (
                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);
@@ -273,7 +269,7 @@ acpi_ds_result_pop_from_bottom (
 
        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);
        }
 
@@ -329,7 +325,6 @@ acpi_ds_result_push (
                return (AE_BAD_PARAMETER);
        }
 
-
        state->results.obj_desc [state->results.num_results] = object;
        state->results.num_results++;
 
@@ -694,7 +689,6 @@ acpi_ds_obj_stack_get_value (
                return_PTR (NULL);
        }
 
-
        return_PTR (walk_state->operands[(NATIVE_UINT)(walk_state->num_operands - 1) -
                          index]);
 }
@@ -728,7 +722,6 @@ acpi_ds_get_current_walk_state (
        ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Ds_get_current_walk_state, =%p\n",
                thread->walk_state_list));
 
-
        return (thread->walk_state_list);
 }
 
@@ -918,7 +911,6 @@ acpi_ds_init_aml_walk (
                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);
@@ -928,13 +920,15 @@ acpi_ds_init_aml_walk (
 
                /* 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  */
 
@@ -946,9 +940,8 @@ acpi_ds_init_aml_walk (
                }
        }
 
-       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
 
@@ -984,7 +977,6 @@ acpi_ds_delete_walk_state (
                return;
        }
 
-
        if (walk_state->parser_state.scope) {
                ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p walk still has a scope list\n", walk_state));
        }
index 1571da67d3f01229842d27e4d9986988bb3a1a74..de815fa4f08b331e0a4d7952cb0d255d05d91643 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: evevent - Fixed and General Purpose Even handling and dispatch
- *              $Revision: 78 $
+ *              $Revision: 88 $
  *
  *****************************************************************************/
 
@@ -24,7 +24,6 @@
  */
 
 #include "acpi.h"
-#include "achware.h"
 #include "acevents.h"
 #include "acnamesp.h"
 
@@ -159,6 +158,7 @@ acpi_ev_fixed_event_initialize (
        void)
 {
        NATIVE_UINT             i;
+       acpi_status             status;
 
 
        /*
@@ -172,8 +172,11 @@ acpi_ev_fixed_event_initialize (
                /* 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);
+                       }
                }
        }
 
@@ -200,7 +203,7 @@ acpi_ev_fixed_event_detect (
        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");
@@ -208,10 +211,10 @@ acpi_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",
@@ -259,7 +262,7 @@ acpi_ev_fixed_event_dispatch (
 
        /* 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);
 
        /*
@@ -267,7 +270,7 @@ acpi_ev_fixed_event_dispatch (
         * 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 (
@@ -299,13 +302,14 @@ acpi_ev_fixed_event_dispatch (
 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");
@@ -372,8 +376,9 @@ acpi_ev_gpe_initialize (void)
        /*
         * 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"));
@@ -383,12 +388,13 @@ acpi_ev_gpe_initialize (void)
        /* 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,
@@ -400,7 +406,8 @@ acpi_ev_gpe_initialize (void)
         * 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"));
@@ -423,14 +430,17 @@ acpi_ev_gpe_initialize (void)
 
                        /* 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;
@@ -455,19 +465,26 @@ acpi_ev_gpe_initialize (void)
                         * 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)));
@@ -520,6 +537,7 @@ acpi_ev_save_method_info (
        u32                     gpe_number_index;
        NATIVE_CHAR             name[ACPI_NAME_SIZE + 1];
        u8                      type;
+       acpi_status             status;
 
 
        ACPI_FUNCTION_NAME ("Ev_save_method_info");
@@ -528,7 +546,7 @@ acpi_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;
 
        /*
@@ -583,7 +601,10 @@ acpi_ev_save_method_info (
        /*
         * 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));
@@ -652,6 +673,8 @@ acpi_ev_gpe_detect (void)
        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");
@@ -665,16 +688,22 @@ acpi_ev_gpe_detect (void)
        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));
 
@@ -731,6 +760,7 @@ acpi_ev_asynch_execute_gpe_method (
        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");
@@ -745,12 +775,14 @@ acpi_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;
        }
 
@@ -759,7 +791,11 @@ acpi_ev_asynch_execute_gpe_method (
                 * 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) {
@@ -767,13 +803,16 @@ acpi_ev_asynch_execute_gpe_method (
                 * 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;
 }
 
@@ -798,6 +837,7 @@ acpi_ev_gpe_dispatch (
 {
        u32                     gpe_number_index;
        ACPI_GPE_NUMBER_INFO    *gpe_info;
+       acpi_status             status;
 
 
        ACPI_FUNCTION_TRACE ("Ev_gpe_dispatch");
@@ -820,7 +860,11 @@ acpi_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);
+               }
        }
 
        /*
@@ -840,7 +884,11 @@ acpi_ev_gpe_dispatch (
                 * 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.
@@ -860,14 +908,22 @@ acpi_ev_gpe_dispatch (
                 * 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);
index bc20c4f836d1432732b051214dcffa6bcd98a4d8..6b3e5d28c2422f0c1be12cde867fe7457523afc8 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: evmisc - Miscellaneous event manager support functions
- *              $Revision: 48 $
+ *              $Revision: 53 $
  *
  *****************************************************************************/
 
@@ -27,7 +27,6 @@
 #include "acevents.h"
 #include "acnamesp.h"
 #include "acinterp.h"
-#include "achware.h"
 
 #define _COMPONENT          ACPI_EVENTS
         ACPI_MODULE_NAME    ("evmisc")
@@ -178,7 +177,7 @@ acpi_ev_queue_notify_request (
        }
 
        /*
-        * 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) {
@@ -186,25 +185,21 @@ acpi_ev_queue_notify_request (
 
                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);
                }
        }
 
@@ -323,14 +318,19 @@ static void ACPI_SYSTEM_XFACE
 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"));
+               }
        }
 }
 
@@ -352,6 +352,7 @@ acpi_ev_global_lock_handler (
        void                    *context)
 {
        u8                      acquired = FALSE;
+       acpi_status             status;
 
 
        /*
@@ -367,8 +368,14 @@ acpi_ev_global_lock_handler (
 
                /* 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);
@@ -487,10 +494,11 @@ acpi_ev_acquire_global_lock (
  *
  ******************************************************************************/
 
-void
+acpi_status
 acpi_ev_release_global_lock (void)
 {
        u8                      pending = FALSE;
+       acpi_status             status = AE_OK;
 
 
        ACPI_FUNCTION_TRACE ("Ev_release_global_lock");
@@ -498,7 +506,7 @@ acpi_ev_release_global_lock (void)
 
        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 */
@@ -507,7 +515,7 @@ acpi_ev_release_global_lock (void)
        if (acpi_gbl_global_lock_thread_count) {
                /* There are still some threads holding the lock, cannot release */
 
-               return_VOID;
+               return_ACPI_STATUS (AE_OK);
        }
 
        /*
@@ -522,10 +530,10 @@ acpi_ev_release_global_lock (void)
         * 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);
 }
 
 
index c587ff0badd9fe0aa92027108199b602ef2fee8e..1866003a8a8552d536d15255a56e0deaf595f2c9 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: evregion - ACPI Address_space (Op_region) handler dispatch
- *              $Revision: 128 $
+ *              $Revision: 133 $
  *
  *****************************************************************************/
 
@@ -28,7 +28,6 @@
 #include "acevents.h"
 #include "acnamesp.h"
 #include "acinterp.h"
-#include "amlcode.h"
 
 #define _COMPONENT          ACPI_EVENTS
         ACPI_MODULE_NAME    ("evregion")
@@ -36,7 +35,7 @@
 
 /*******************************************************************************
  *
- * 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");
 
 
        /*
@@ -166,7 +165,7 @@ acpi_ev_execute_reg_method (
        /*
         *  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;
 
@@ -209,9 +208,10 @@ acpi_ev_address_space_dispatch (
        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;
@@ -267,7 +267,10 @@ acpi_ev_address_space_dispatch (
 
                /* 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
@@ -325,7 +328,10 @@ acpi_ev_address_space_dispatch (
                 * 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);
@@ -333,7 +339,7 @@ acpi_ev_address_space_dispatch (
 
 /*******************************************************************************
  *
- * 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?
@@ -346,7 +352,7 @@ acpi_ev_address_space_dispatch (
  ******************************************************************************/
 
 void
-acpi_ev_disassociate_region_from_handler(
+acpi_ev_detach_region(
        acpi_operand_object     *region_obj,
        u8                      acpi_ns_is_locked)
 {
@@ -359,12 +365,12 @@ acpi_ev_disassociate_region_from_handler(
        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;
 
@@ -410,7 +416,12 @@ acpi_ev_disassociate_region_from_handler(
                        /*
                         *  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);
@@ -473,7 +484,7 @@ acpi_ev_disassociate_region_from_handler(
 
 /*******************************************************************************
  *
- * FUNCTION:    Acpi_ev_associate_region_and_handler
+ * FUNCTION:    Acpi_ev_attach_region
  *
  * PARAMETERS:  Handler_obj     - Handler Object
  *              Region_obj      - Region Object
@@ -487,15 +498,16 @@ acpi_ev_disassociate_region_from_handler(
  ******************************************************************************/
 
 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,
@@ -519,13 +531,19 @@ acpi_ev_associate_region_and_handler (
         * 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);
@@ -665,12 +683,12 @@ acpi_ev_addr_handler_helper (
         *
         *  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);
 }
index 2382f31ccccaed68bffee2c6bdd96709d960d363..e0f7b9b68910d043bea4439b57c6c77177053809 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: evrgnini- ACPI Address_space (Op_region) init
- *              $Revision: 57 $
+ *              $Revision: 61 $
  *
  *****************************************************************************/
 
@@ -27,8 +27,6 @@
 #include "acpi.h"
 #include "acevents.h"
 #include "acnamesp.h"
-#include "acinterp.h"
-#include "amlcode.h"
 
 #define _COMPONENT          ACPI_EVENTS
         ACPI_MODULE_NAME    ("evrgnini")
@@ -205,12 +203,12 @@ acpi_ev_pci_config_region_setup (
        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));
        }
 
        /*
@@ -235,9 +233,13 @@ acpi_ev_pci_config_region_setup (
                        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;
                                }
                        }
@@ -457,7 +459,7 @@ acpi_ev_initialize_region (
                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:
@@ -474,6 +476,10 @@ acpi_ev_initialize_region (
 
                                handler_obj = obj_desc->thermal_zone.addr_handler;
                                break;
+
+                       default:
+                               /* Ignore other objects */
+                               break;
                        }
 
                        while (handler_obj) {
@@ -489,8 +495,8 @@ acpi_ev_initialize_region (
                                        /*
                                         *  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);
                                }
index 0cf6dbde0b3a2587c91bbf103a78b134eb236633..fd347f315d963aa6fc3ff7fe41fb9c9241aa8dad 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Module Name: evsci - System Control Interrupt configuration and
  *                      legacy to ACPI mode state transition functions
- *              $Revision: 83 $
+ *              $Revision: 86 $
  *
  ******************************************************************************/
 
@@ -25,8 +25,6 @@
  */
 
 #include "acpi.h"
-#include "acnamesp.h"
-#include "achware.h"
 #include "acevents.h"
 
 
@@ -53,6 +51,8 @@ acpi_ev_sci_handler (
        void                    *context)
 {
        u32                     interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED;
+       u32                     value;
+       acpi_status             status;
 
 
        ACPI_FUNCTION_TRACE("Ev_sci_handler");
@@ -62,7 +62,12 @@ acpi_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);
@@ -135,15 +140,18 @@ acpi_ev_install_sci_handler (void)
 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);
 }
 
 
index b0b6bf50c72110a2cbb35c79e3ef668b588130da..d172574de8474de20b774c84ec7045edf8765fc1 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * 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
@@ -516,8 +514,12 @@ acpi_install_gpe_handler (
 
        /* 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:
@@ -566,7 +568,10 @@ acpi_remove_gpe_handler (
 
        /* 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)) {
@@ -576,7 +581,7 @@ acpi_remove_gpe_handler (
        /* 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;
        }
@@ -651,13 +656,15 @@ acpi_status
 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);
 }
 
 
index 1cf5433caaf0769fc85147c39778565530da3b55..5c357d08f745809535d8bc336e100314ab5634d7 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * 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")
@@ -118,7 +114,7 @@ acpi_disable (void)
 
        /* Unload the SCI interrupt handler  */
 
-       acpi_ev_remove_sci_handler ();
+       status = acpi_ev_remove_sci_handler ();
        return_ACPI_STATUS (status);
 }
 
@@ -144,6 +140,7 @@ acpi_enable_event (
        u32                     flags)
 {
        acpi_status             status = AE_OK;
+       u32                     value;
 
 
        ACPI_FUNCTION_TRACE ("Acpi_enable_event");
@@ -156,7 +153,7 @@ acpi_enable_event (
 
                /* Decode the Fixed Event */
 
-               if (event > ACPI_NUM_FIXED_EVENTS) {
+               if (event > ACPI_EVENT_MAX) {
                        return_ACPI_STATUS (AE_BAD_PARAMETER);
                }
 
@@ -164,13 +161,21 @@ acpi_enable_event (
                 * 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);
@@ -188,7 +193,10 @@ acpi_enable_event (
 
                /* 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);
@@ -226,6 +234,7 @@ acpi_disable_event (
        u32                     flags)
 {
        acpi_status             status = AE_OK;
+       u32                     value;
 
 
        ACPI_FUNCTION_TRACE ("Acpi_disable_event");
@@ -238,7 +247,7 @@ acpi_disable_event (
 
                /* Decode the Fixed Event */
 
-               if (event > ACPI_NUM_FIXED_EVENTS) {
+               if (event > ACPI_EVENT_MAX) {
                        return_ACPI_STATUS (AE_BAD_PARAMETER);
                }
 
@@ -246,11 +255,19 @@ acpi_disable_event (
                 * 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);
@@ -275,7 +292,7 @@ acpi_disable_event (
                        acpi_hw_disable_gpe_for_wakeup (event);
                }
                else {
-                       acpi_hw_disable_gpe (event);
+                       status = acpi_hw_disable_gpe (event);
                }
                break;
 
@@ -319,7 +336,7 @@ acpi_clear_event (
 
                /* Decode the Fixed Event */
 
-               if (event > ACPI_NUM_FIXED_EVENTS) {
+               if (event > ACPI_EVENT_MAX) {
                        return_ACPI_STATUS (AE_BAD_PARAMETER);
                }
 
@@ -327,7 +344,7 @@ acpi_clear_event (
                 * 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;
 
@@ -340,7 +357,7 @@ acpi_clear_event (
                        return_ACPI_STATUS (AE_BAD_PARAMETER);
                }
 
-               acpi_hw_clear_gpe (event);
+               status = acpi_hw_clear_gpe (event);
                break;
 
 
@@ -393,14 +410,14 @@ acpi_get_event_status (
 
                /* 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;
 
 
@@ -414,7 +431,7 @@ acpi_get_event_status (
 
                /* 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;
 
 
index 13cc8c896788861bed9a45c104d7c6235a4ff409..2f560f74c3474f5002e7ec665d5c6299b2497dc2 100644 (file)
@@ -2,7 +2,7 @@
  *
  * 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
@@ -356,7 +354,7 @@ acpi_remove_address_space_handler (
                                 * 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
index 19836ed7a309bfa79e04834c4203d11ce79da8ac..a1b2e4ffee0d6290c0086e79c3b98c1b4bce0967 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * 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
@@ -77,11 +75,11 @@ acpi_ex_add_table (
        /* 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;
        }
@@ -92,7 +90,7 @@ acpi_ex_add_table (
        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;
        }
 
@@ -227,10 +225,10 @@ acpi_ex_load_table_op (
        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);
                }
        }
 
@@ -267,7 +265,6 @@ acpi_ex_load_op (
        acpi_table_header       table_header;
        u32                     i;
 
-
        ACPI_FUNCTION_TRACE ("Ex_load_op");
 
 
@@ -285,7 +282,7 @@ acpi_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);
                        }
@@ -308,7 +305,7 @@ acpi_ex_load_op (
                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;
                        }
@@ -334,7 +331,7 @@ acpi_ex_load_op (
                        goto cleanup;
                }
 
-               table_ptr = (acpi_table_header *) buffer_desc->buffer.pointer;
+               table_ptr = ACPI_CAST_PTR (acpi_table_header, buffer_desc->buffer.pointer);
                break;
 
 
@@ -352,7 +349,7 @@ acpi_ex_load_op (
                                 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;
        }
@@ -368,7 +365,7 @@ acpi_ex_load_op (
 
        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);
@@ -417,7 +414,7 @@ acpi_ex_unload_table (
         * 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);
@@ -431,14 +428,11 @@ acpi_ex_unload_table (
         * 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) */
 
index 91baea48d8139a177bac012736d7d8b2b7a61e38..014728cbe33de87f9572779851c94c6efa0551f3 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * 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
@@ -60,9 +56,9 @@ acpi_ex_convert_to_integer (
        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);
@@ -74,12 +70,12 @@ acpi_ex_convert_to_integer (
                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;
 
@@ -87,24 +83,6 @@ acpi_ex_convert_to_integer (
                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
@@ -118,8 +96,8 @@ acpi_ex_convert_to_integer (
 
        /* 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;
        }
 
        /*
@@ -128,13 +106,14 @@ acpi_ex_convert_to_integer (
        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;
 
 
@@ -153,6 +132,19 @@ acpi_ex_convert_to_integer (
                        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 */
@@ -192,7 +184,6 @@ acpi_ex_convert_to_buffer (
 {
        acpi_operand_object     *ret_desc;
        u32                     i;
-       u32                     integer_size = sizeof (acpi_integer);
        u8                      *new_buf;
 
 
@@ -210,20 +201,10 @@ acpi_ex_convert_to_buffer (
                        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"));
@@ -233,7 +214,7 @@ acpi_ex_convert_to_buffer (
 
                /* 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;
@@ -286,7 +267,7 @@ acpi_ex_convert_to_ascii (
        u32                     i;
        u32                     j;
        u32                     k = 0;
-       u8                      hex_digit;
+       char                    hex_digit;
        acpi_integer            digit;
        u32                     remainder;
        u32                     length = sizeof (acpi_integer);
@@ -305,7 +286,7 @@ acpi_ex_convert_to_ascii (
 
                        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 */
@@ -333,7 +314,7 @@ acpi_ex_convert_to_ascii (
                        }
 
                        if (!leading_zero) {
-                               string[k] = hex_digit;
+                               string[k] = (u8) hex_digit;
                                k++;
                        }
                }
@@ -385,7 +366,6 @@ acpi_ex_convert_to_string (
        u32                     i;
        u32                     index;
        u32                     string_length;
-       u32                     integer_size = sizeof (acpi_integer);
        u8                      *new_buf;
        u8                      *pointer;
 
@@ -396,17 +376,7 @@ acpi_ex_convert_to_string (
        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;
                }
@@ -421,7 +391,7 @@ acpi_ex_convert_to_string (
 
                /* 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"));
@@ -429,7 +399,6 @@ acpi_ex_convert_to_string (
                        return_ACPI_STATUS (AE_NO_MEMORY);
                }
 
-
                /* Convert */
 
                i = acpi_ex_convert_to_ascii (obj_desc->integer.value, base, new_buf);
@@ -486,7 +455,7 @@ acpi_ex_convert_to_string (
                        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"));
@@ -500,7 +469,7 @@ acpi_ex_convert_to_string (
                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++;
@@ -512,7 +481,6 @@ acpi_ex_convert_to_string (
                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) {
@@ -641,6 +609,11 @@ acpi_ex_convert_to_target_type (
                         */
                        status = acpi_ex_convert_to_buffer (source_desc, result_desc, walk_state);
                        break;
+
+
+               default:
+                       status = AE_AML_INTERNAL;
+                       break;
                }
                break;
 
@@ -661,7 +634,6 @@ acpi_ex_convert_to_target_type (
                status = AE_AML_INTERNAL;
        }
 
-
        /*
         * Source-to-Target conversion semantics:
         *
index 1b876c70d5f5e32de0bd57ca6c143ea45c6b9a2d..4b530a143004eca6a7e29ec6812ad093499bf970 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * 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"
 
 
@@ -234,7 +232,7 @@ acpi_ex_create_region (
 
        /* 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,
@@ -323,7 +321,7 @@ acpi_ex_create_table_region (
 
        /* 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,
index 6640c3d6d08c22d5ed4f9ae0cebc5862daa4a80c..eb414ac3dadb581b89ded190800b224f5c1e7b93 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: exdump - Interpreter debug output routines
- *              $Revision: 147 $
+ *              $Revision: 153 $
  *
  *****************************************************************************/
 
@@ -28,7 +28,6 @@
 #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
@@ -137,20 +52,22 @@ acpi_ex_show_hex_value (
  *
  ****************************************************************************/
 
-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) {
@@ -160,19 +77,19 @@ acpi_ex_dump_operand (
                 * 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 */
@@ -265,7 +182,7 @@ acpi_ex_dump_operand (
 
                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:
@@ -343,18 +260,13 @@ acpi_ex_dump_operand (
                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;
 
 
@@ -389,7 +301,6 @@ acpi_ex_dump_operand (
                        acpi_os_printf ("%c",
                                         obj_desc->string.pointer[i]);
                }
-
                acpi_os_printf ("\"\n");
                break;
 
@@ -429,13 +340,11 @@ acpi_ex_dump_operand (
                {
                        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);
@@ -490,13 +399,13 @@ acpi_ex_dump_operand (
 
 
        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;
 }
 
 
@@ -540,7 +449,6 @@ acpi_ex_dump_operands (
                note = "?";
        }
 
-
        ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
                "************* Operand Stack Contents (Opcode [%s], %d Operands)\n",
                ident, num_levels));
@@ -550,16 +458,12 @@ acpi_ex_dump_operands (
                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,
@@ -611,7 +515,8 @@ acpi_ex_out_address (
        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,
@@ -648,8 +553,7 @@ acpi_ex_dump_node (
                }
        }
 
-
-       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);
@@ -691,7 +595,7 @@ acpi_ex_dump_object_descriptor (
                }
        }
 
-       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;
@@ -709,7 +613,7 @@ acpi_ex_dump_object_descriptor (
        {
        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;
@@ -739,7 +643,7 @@ acpi_ex_dump_object_descriptor (
 
                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]);
@@ -811,7 +715,7 @@ acpi_ex_dump_object_descriptor (
 
                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);
@@ -862,6 +766,10 @@ acpi_ex_dump_object_descriptor (
                        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;
 
index 426e807ad8043c22df6e01600e7841c3082c44af..1326c3371a0228d03eb173773daef59c81c02243 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * 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
@@ -61,7 +57,6 @@ acpi_ex_read_data_from_field (
        acpi_status             status;
        acpi_operand_object     *buffer_desc;
        u32                     length;
-       u32                     integer_size;
        void                    *buffer;
        u8                      locked;
 
@@ -99,19 +94,7 @@ acpi_ex_read_data_from_field (
         * 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);
@@ -139,7 +122,7 @@ acpi_ex_read_data_from_field (
                        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;
        }
index db3d691bc56b9ed9c80c3833a8b528bbed5bf780..d4ffd5e5b9270bae7d8040d2b392aec4fdeb074d 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: exfldio - Aml Field I/O
- *              $Revision: 84 $
+ *              $Revision: 86 $
  *
  *****************************************************************************/
 
@@ -27,8 +27,6 @@
 #include "acpi.h"
 #include "acinterp.h"
 #include "amlcode.h"
-#include "acnamesp.h"
-#include "achware.h"
 #include "acevents.h"
 #include "acdispat.h"
 
@@ -67,7 +65,7 @@ acpi_ex_setup_region (
        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);
        }
@@ -99,8 +97,8 @@ acpi_ex_setup_region (
                         */
                        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));
                }
 
                /*
@@ -109,9 +107,9 @@ acpi_ex_setup_region (
                 */
                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);
        }
@@ -235,7 +233,7 @@ acpi_ex_register_overflow (
                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.
@@ -343,7 +341,7 @@ acpi_ex_field_datum_io (
                /* 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);
                }
 
@@ -363,7 +361,7 @@ acpi_ex_field_datum_io (
                 * Region_field case and write the datum to the Operation Region
                 */
 
-               /* No break; ! */
+               /*lint -fallthrough */
 
 
        case INTERNAL_TYPE_REGION_FIELD:
@@ -387,7 +385,7 @@ acpi_ex_field_datum_io (
                /* 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);
                }
 
@@ -472,7 +470,7 @@ acpi_ex_write_with_update_rule (
 
        /* 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) {
@@ -509,7 +507,7 @@ acpi_ex_write_with_update_rule (
 
                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);
                }
@@ -579,6 +577,10 @@ acpi_ex_get_buffer_datum(
 
                ACPI_MOVE_UNALIGNED64_TO_64 (datum, &(((u64 *) buffer) [offset]));
                break;
+
+       default:
+               /* Should not get here */
+               break;
        }
 }
 
@@ -631,6 +633,10 @@ acpi_ex_set_buffer_datum (
 
                ACPI_MOVE_UNALIGNED64_TO_64 (&(((u64 *) buffer)[offset]), &merged_datum);
                break;
+
+       default:
+               /* Should not get here */
+               break;
        }
 }
 
@@ -685,7 +691,7 @@ acpi_ex_extract_from_field (
                           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));
 
        /*
@@ -863,7 +869,7 @@ acpi_ex_insert_into_field (
        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));
 
        /*
index e447d0d81ba974ce48fc14b3a07f8fa3e0428f44..becf07f496b48f9f37a52ec12c59541f2c3ca5b6 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes
- *              $Revision: 100 $
+ *              $Revision: 104 $
  *
  *****************************************************************************/
 
@@ -26,7 +26,6 @@
 
 
 #include "acpi.h"
-#include "acparser.h"
 #include "acinterp.h"
 #include "amlcode.h"
 #include "acdispat.h"
@@ -63,7 +62,7 @@ acpi_ex_get_object_reference (
 
 
        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;
@@ -81,7 +80,7 @@ acpi_ex_get_object_reference (
 
                        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:
@@ -189,11 +188,11 @@ acpi_ex_concat_template (
         * 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));
 
@@ -237,7 +236,6 @@ acpi_ex_do_concatenate (
        acpi_integer            this_integer;
        acpi_operand_object     *return_desc;
        NATIVE_CHAR             *new_buf;
-       u32                     integer_size = sizeof (acpi_integer);
 
 
        ACPI_FUNCTION_ENTRY ();
@@ -252,17 +250,6 @@ acpi_ex_do_concatenate (
        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);
@@ -272,7 +259,7 @@ acpi_ex_do_concatenate (
 
                /* 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
@@ -286,16 +273,16 @@ acpi_ex_do_concatenate (
                /* 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;
                }
 
@@ -311,8 +298,8 @@ acpi_ex_do_concatenate (
 
                /* 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"));
@@ -341,8 +328,8 @@ acpi_ex_do_concatenate (
                        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"));
@@ -531,6 +518,9 @@ acpi_ex_do_logical_op (
                        return (TRUE);
                }
                break;
+
+       default:
+               break;
        }
 
        return (FALSE);
index ceb9981dc3b0222941bb189e9f47f1ef19460d7b..1bc3a9f2289d300285ac7fd46c65fefb2565fb2b 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: exmutex - ASL Mutex Acquire/Release functions
- *              $Revision: 10 $
+ *              $Revision: 13 $
  *
  *****************************************************************************/
 
@@ -27,9 +27,6 @@
 
 #include "acpi.h"
 #include "acinterp.h"
-#include "acnamesp.h"
-#include "achware.h"
-#include "acevents.h"
 
 #define _COMPONENT          ACPI_EXECUTER
         ACPI_MODULE_NAME    ("exmutex")
@@ -269,12 +266,13 @@ acpi_ex_release_mutex (
  *
  ******************************************************************************/
 
-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 ();
@@ -293,14 +291,15 @@ acpi_ex_release_all_mutexes (
 
                 /* 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);
 }
 
 
index 9c73eee0532e41a0f4d7a0058d82bf863729ee2b..6cd074a23d8b8cacb1f65de5e96e080c1148f845 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: exnames - interpreter/scanner name load/execute
- *              $Revision: 90 $
+ *              $Revision: 91 $
  *
  *****************************************************************************/
 
@@ -28,7 +28,6 @@
 #include "acpi.h"
 #include "acinterp.h"
 #include "amlcode.h"
-#include "acnamesp.h"
 
 #define _COMPONENT          ACPI_EXECUTER
         ACPI_MODULE_NAME    ("exnames")
@@ -148,10 +147,10 @@ acpi_ex_name_segment (
        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");
@@ -170,17 +169,17 @@ acpi_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';
@@ -195,7 +194,7 @@ acpi_ex_name_segment (
                                "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.
@@ -213,7 +212,7 @@ acpi_ex_name_segment (
                        *aml_address, aml_address));
        }
 
-       *in_aml_address = aml_address;
+       *in_aml_address = (u8 *) aml_address;
        return_ACPI_STATUS (status);
 }
 
index d3fa5930d9e511cb0a4abaebb092591cff61dd0d..c26186e48eab8908da6bbe281fe7f5dd27394646 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: exoparg1 - AML execution - opcodes with 1 argument
- *              $Revision: 135 $
+ *              $Revision: 137 $
  *
  *****************************************************************************/
 
@@ -212,7 +212,7 @@ acpi_ex_opcode_1A_1T_1R (
        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:
@@ -222,156 +222,159 @@ acpi_ex_opcode_1A_1T_1R (
        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) */
@@ -520,7 +523,7 @@ acpi_ex_opcode_1A_0T_1R (
                 * 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);
@@ -628,6 +631,11 @@ acpi_ex_opcode_1A_0T_1R (
                        case INTERNAL_TYPE_INDEX_FIELD:
 
                                type = ACPI_TYPE_FIELD_UNIT;
+                               break;
+
+                       default:
+                               /* No change to Type required */
+                               break;
                        }
 
                }
@@ -722,8 +730,11 @@ acpi_ex_opcode_1A_0T_1R (
 
                                        /* 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
@@ -750,13 +761,15 @@ acpi_ex_opcode_1A_0T_1R (
                                 * 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;
 
 
index 127bb5f59819ae6e055304812768b021259a91eb..265dc08860c67598cb039a708fd6154c551efa99 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * 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
index b18a34700c8f646a5f731b974203e49c2b23c881..11f0858510dea29cc4710f195ff72f80b79b6781 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: exoparg3 - AML execution - opcodes with 3 arguments
- *              $Revision: 9 $
+ *              $Revision: 13 $
  *
  *****************************************************************************/
 
@@ -87,7 +87,7 @@ acpi_ex_opcode_3A_0T_0R (
        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));
 
@@ -102,7 +102,7 @@ acpi_ex_opcode_3A_0T_0R (
                /*
                 * 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 */
 
@@ -145,8 +145,8 @@ acpi_ex_opcode_3A_1T_1R (
        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));
@@ -167,8 +167,8 @@ acpi_ex_opcode_3A_1T_1R (
 
                /* 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
@@ -180,12 +180,12 @@ acpi_ex_opcode_3A_1T_1R (
 
                        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;
@@ -199,7 +199,7 @@ acpi_ex_opcode_3A_1T_1R (
                        /* 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;
 
index cf0a8cb7d64faea009b76ed0670ffcd11fe08ea4..a30fe7bb0099c927891689b0e40f4a2c7e49061f 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: exprep - ACPI AML (p-code) execution - field prep utilities
- *              $Revision: 115 $
+ *              $Revision: 117 $
  *
  *****************************************************************************/
 
@@ -29,7 +29,6 @@
 #include "acinterp.h"
 #include "amlcode.h"
 #include "acnamesp.h"
-#include "acparser.h"
 
 
 #define _COMPONENT          ACPI_EXECUTER
@@ -57,16 +56,15 @@ acpi_ex_decode_field_access (
        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:
@@ -86,6 +84,8 @@ acpi_ex_decode_field_access (
 
                /* Use the length to set the access type */
 
+               length = obj_desc->common_field.bit_length;
+
                if (length <= 8) {
                        bit_length = 8;
                }
@@ -135,7 +135,7 @@ acpi_ex_decode_field_access (
                /* 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);
        }
@@ -410,6 +410,10 @@ acpi_ex_prep_field_value (
                        obj_desc->index_field.index_obj,
                        obj_desc->index_field.data_obj));
                break;
+
+       default:
+               /* No other types should get here */
+               break;
        }
 
        /*
@@ -420,7 +424,7 @@ acpi_ex_prep_field_value (
                          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 */
 
index 137e5d127f66bb46b3c24c1110b9488eabda1769..e08ecea43876fe70a57ec259016ff306e5d29cbf 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * 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
@@ -68,8 +64,10 @@ acpi_ex_system_memory_space_handler (
        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");
 
@@ -99,6 +97,18 @@ acpi_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
@@ -122,7 +132,7 @@ acpi_ex_system_memory_space_handler (
                 * 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;
                }
@@ -132,6 +142,8 @@ acpi_ex_system_memory_space_handler (
                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);
                }
@@ -153,27 +165,38 @@ acpi_ex_system_memory_space_handler (
                "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;
@@ -186,15 +209,21 @@ acpi_ex_system_memory_space_handler (
                        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;
@@ -316,7 +345,7 @@ acpi_ex_pci_config_space_handler (
         *
         */
        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",
@@ -469,6 +498,7 @@ acpi_ex_data_table_space_handler (
                break;
 
        case ACPI_WRITE:
+       default:
 
                return_ACPI_STATUS (AE_SUPPORT);
        }
index e74a0ec2e5d41dcb0f3db6c9675f709b0e945b3c..7548575a25457b390ed01968b6f1d8d6ef0a1dda 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * 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
index 3c5bb78447ede1521ae2180864aad67c3a2630a7..204b9be93abb12bbbed5c018fa814f60b4464aa3 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * 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
@@ -75,7 +71,7 @@ acpi_ex_resolve_to_value (
         * 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);
@@ -87,7 +83,8 @@ acpi_ex_resolve_to_value (
         * 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);
@@ -217,6 +214,10 @@ acpi_ex_resolve_object_to_value (
                        case AML_REVISION_OP:
                                obj_desc->integer.value = ACPI_CA_SUPPORT_LEVEL;
                                break;
+
+                       default:
+                               /* No other opcodes can get here */
+                               break;
                        }
 
                        /*
index 652552b0c9c6fa87134ac57e1fd8e3020b2630af..27edf13850ab224203d833588533a09cdb18f39f 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * 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
@@ -168,7 +165,7 @@ acpi_ex_resolve_operands (
                        break;
 
 
-               case ACPI_DESC_TYPE_INTERNAL:
+               case ACPI_DESC_TYPE_OPERAND:
 
                        /* ACPI internal object */
 
@@ -243,7 +240,7 @@ acpi_ex_resolve_operands (
                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
@@ -253,6 +250,7 @@ acpi_ex_resolve_operands (
                        }
 
                        /* Else not a string - fall through to the normal Reference case below */
+                       /*lint -fallthrough */
 
                case ARGI_REFERENCE:            /* References: */
                case ARGI_INTEGER_REF:
@@ -300,6 +298,10 @@ acpi_ex_resolve_operands (
                                goto next_operand;
                        }
                        break;
+
+               default:
+                       /* All cases covered above */
+                       break;
                }
 
 
index 1a024377c8c80c1ebfc6843bad440add6256d422..f15d3a625362ef4ee3d8d814b05b70d0f9b53c7a 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * 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
@@ -328,7 +326,7 @@ acpi_ex_store_object_to_index (
 
                case ACPI_TYPE_STRING:
 
-                       value = source_desc->string.pointer[0];
+                       value = (u8) source_desc->string.pointer[0];
                        break;
 
                default:
index ad6707d4bdd88a9cb8b3afc2f7e859222ad93812..a50ed360e2981cad5878573f91efe1d1b1ebf7f9 100644 (file)
@@ -3,7 +3,7 @@
  *
  * 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
index 438e795789291942ab6249dcc6161dd8c2420c72..4409186661bd34f3695a4abb2ca48c190fdac77c 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * 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
@@ -166,7 +161,7 @@ acpi_ex_store_string_to_string (
                        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);
                }
index 5789f4679680d644d15e589c3e5014f06a7166b5..bb93a30f5276af35f91fde915e04c1207a9fdf42 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: exsystem - Interface to OS services
- *              $Revision: 71 $
+ *              $Revision: 73 $
  *
  *****************************************************************************/
 
@@ -27,8 +27,6 @@
 
 #include "acpi.h"
 #include "acinterp.h"
-#include "acnamesp.h"
-#include "achware.h"
 #include "acevents.h"
 
 #define _COMPONENT          ACPI_EXECUTER
@@ -246,8 +244,8 @@ acpi_ex_system_release_mutex (
         * 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);
@@ -350,7 +348,7 @@ acpi_ex_system_reset_event (
         */
        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;
        }
 
index 13356fc19f7874d96550528b88c97026da596936..2f937fb9b12774c80bf009dd7590d0d9581ef1b5 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * 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")
@@ -74,7 +71,7 @@ acpi_ex_enter_interpreter (void)
 
        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);
@@ -111,6 +108,9 @@ acpi_ex_exit_interpreter (void)
 
 
        status = acpi_ut_release_mutex (ACPI_MTX_EXECUTE);
+       if (ACPI_FAILURE (status)) {
+               ACPI_REPORT_ERROR (("Could not release interpreter mutex\n"));
+       }
 
        return_VOID;
 }
@@ -177,7 +177,7 @@ acpi_ex_truncate_for32bit_table (
                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
@@ -245,10 +245,12 @@ acpi_ex_acquire_global_lock (
  *
  ******************************************************************************/
 
-acpi_status
+void
 acpi_ex_release_global_lock (
        u8                      locked_by_me)
 {
+       acpi_status             status;
+
 
        ACPI_FUNCTION_TRACE ("Ex_release_global_lock");
 
@@ -258,10 +260,13 @@ acpi_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"));
+               }
+       }
 }
 
 
@@ -281,67 +286,30 @@ acpi_ex_digits_needed (
        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 (&current_value, base, &quotient, 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
@@ -353,31 +321,29 @@ _ntohl (
  *
  ******************************************************************************/
 
-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);
 }
 
 
@@ -392,7 +358,7 @@ acpi_ex_eisa_id_to_string (
  *
  ******************************************************************************/
 
-acpi_status
+void
 acpi_ex_unsigned_integer_to_string (
        acpi_integer            value,
        NATIVE_CHAR             *out_string)
@@ -400,6 +366,7 @@ acpi_ex_unsigned_integer_to_string (
        u32                     count;
        u32                     digits_needed;
        u32                     remainder;
+       acpi_integer            quotient;
 
 
        ACPI_FUNCTION_ENTRY ();
@@ -409,11 +376,10 @@ acpi_ex_unsigned_integer_to_string (
        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, &quotient, &remainder);
+               out_string[count-1] = (NATIVE_CHAR) ('0' + remainder);\
+               value = quotient;
        }
-
-       return (AE_OK);
 }
 
 
index e5ca1e5bb7c482bbc7357adf7480afd2234b29f7..c8f3af8cfbb83eff0aa2a23cd785c6188ca7740c 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: hwacpi - ACPI Hardware Initialization/Mode Interface
- *              $Revision: 53 $
+ *              $Revision: 58 $
  *
  *****************************************************************************/
 
@@ -26,7 +26,6 @@
 
 
 #include "acpi.h"
-#include "achware.h"
 
 
 #define _COMPONENT          ACPI_HARDWARE
@@ -91,35 +90,57 @@ acpi_hw_set_mode (
        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);
@@ -142,11 +163,18 @@ acpi_hw_set_mode (
 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 {
index 7b23c9105b2543ddf838dbeb691a355729781f50..de5b6d250eb1893d6a008215955ba183421164c4 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: hwgpe - Low level GPE enable/disable/clear functions
- *              $Revision: 40 $
+ *              $Revision: 41 $
  *
  *****************************************************************************/
 
@@ -25,8 +25,6 @@
  */
 
 #include "acpi.h"
-#include "achware.h"
-#include "acnamesp.h"
 #include "acevents.h"
 
 #define _COMPONENT          ACPI_HARDWARE
@@ -45,7 +43,7 @@
  *
  ******************************************************************************/
 
-u32
+u8
 acpi_hw_get_gpe_bit_mask (
        u32                     gpe_number)
 {
@@ -65,13 +63,14 @@ acpi_hw_get_gpe_bit_mask (
  *
  ******************************************************************************/
 
-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 ();
@@ -89,10 +88,16 @@ acpi_hw_enable_gpe (
         * 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);
 }
 
 
@@ -114,7 +119,7 @@ acpi_hw_enable_gpe_for_wakeup (
        u32                     gpe_number)
 {
        u32                     register_index;
-       u32                     bit_mask;
+       u                     bit_mask;
 
 
        ACPI_FUNCTION_ENTRY ();
@@ -147,13 +152,14 @@ acpi_hw_enable_gpe_for_wakeup (
  *
  ******************************************************************************/
 
-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 ();
@@ -171,12 +177,20 @@ acpi_hw_disable_gpe (
         * 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);
 }
 
 
@@ -198,7 +212,7 @@ acpi_hw_disable_gpe_for_wakeup (
        u32                     gpe_number)
 {
        u32                     register_index;
-       u32                     bit_mask;
+       u                     bit_mask;
 
 
        ACPI_FUNCTION_ENTRY ();
@@ -231,12 +245,13 @@ acpi_hw_disable_gpe_for_wakeup (
  *
  ******************************************************************************/
 
-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 ();
@@ -254,8 +269,10 @@ acpi_hw_clear_gpe (
         * 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);
 }
 
 
@@ -271,22 +288,23 @@ acpi_hw_clear_gpe (
  *
  ******************************************************************************/
 
-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;
+       u                     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;
@@ -302,7 +320,11 @@ acpi_hw_get_gpe_status (
 
        /* 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;
        }
@@ -315,10 +337,15 @@ acpi_hw_get_gpe_status (
 
        /* 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);
 }
 
 
@@ -338,12 +365,14 @@ acpi_hw_get_gpe_status (
  *
  ******************************************************************************/
 
-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 ();
@@ -356,15 +385,24 @@ acpi_hw_disable_non_wakeup_gpes (
                 * 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);
 }
 
 
@@ -380,12 +418,13 @@ acpi_hw_disable_non_wakeup_gpes (
  *
  ******************************************************************************/
 
-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 ();
@@ -398,7 +437,11 @@ acpi_hw_enable_non_wakeup_gpes (
                 * 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);
 }
index 0991a9ca6db45f56dceb48d78e2623009fb526a1..762ce6aac2b0a679605559bd9b654c93e6f250da 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Module Name: hwregs - Read/write access functions for the various ACPI
  *                       control and status registers.
- *              $Revision: 121 $
+ *              $Revision: 130 $
  *
  ******************************************************************************/
 
@@ -27,7 +27,6 @@
 
 
 #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;
 
@@ -64,36 +63,46 @@ acpi_hw_clear_acpi_status (void)
 
        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
@@ -107,7 +116,7 @@ acpi_hw_clear_acpi_status (void)
  ******************************************************************************/
 
 acpi_status
-acpi_hw_get_sleep_type_data (
+acpi_get_sleep_type_data (
        u8                      sleep_state,
        u8                      *sleep_type_a,
        u8                      *sleep_type_b)
@@ -116,7 +125,7 @@ acpi_hw_get_sleep_type_data (
        acpi_operand_object     *obj_desc;
 
 
-       ACPI_FUNCTION_TRACE ("Hw_get_sleep_type_data");
+       ACPI_FUNCTION_TRACE ("Acpi_get_sleep_type_data");
 
 
        /*
@@ -213,7 +222,7 @@ acpi_hw_get_bit_register_info (
 
 /*******************************************************************************
  *
- * FUNCTION:    Acpi_hw_bit_register_read
+ * FUNCTION:    Acpi_get_register
  *
  * PARAMETERS:  Register_id     - index of ACPI Register to access
  *              Use_lock        - Lock the hardware
@@ -225,24 +234,20 @@ acpi_hw_get_bit_register_info (
  *
  ******************************************************************************/
 
-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);
@@ -250,66 +255,86 @@ acpi_hw_bit_register_read (
                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, &register_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, &register_value);
+       if (ACPI_FAILURE (status)) {
+               goto unlock_and_exit;
+       }
 
        /*
         * Decode the Register ID
@@ -327,10 +352,11 @@ acpi_hw_bit_register_write (
                 * 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;
@@ -338,9 +364,11 @@ acpi_hw_bit_register_write (
 
        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;
 
 
@@ -353,29 +381,36 @@ acpi_hw_bit_register_write (
                 */
                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, &register_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;
 
@@ -384,16 +419,19 @@ acpi_hw_bit_register_write (
                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);
 }
 
 
@@ -411,73 +449,98 @@ acpi_hw_bit_register_write (
  *
  ******************************************************************************/
 
-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);
 }
 
 
@@ -495,68 +558,82 @@ acpi_hw_register_read (
  *
  ******************************************************************************/
 
-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;
 
 
@@ -564,20 +641,21 @@ acpi_hw_register_write (
 
                /* 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);
 }
 
 
@@ -595,30 +673,33 @@ acpi_hw_register_write (
  *
  ******************************************************************************/
 
-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:
@@ -627,17 +708,19 @@ acpi_hw_low_level_read (
        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;
 
 
@@ -647,13 +730,20 @@ acpi_hw_low_level_read (
                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);
 }
 
 
@@ -673,7 +763,7 @@ acpi_hw_low_level_read (
  *
  ******************************************************************************/
 
-void
+acpi_status
 acpi_hw_low_level_write (
        u32                     width,
        u32                     value,
@@ -684,20 +774,21 @@ acpi_hw_low_level_write (
        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.
@@ -705,17 +796,19 @@ acpi_hw_low_level_write (
        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;
 
 
@@ -725,9 +818,18 @@ acpi_hw_low_level_write (
                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);
 }
index a0a5642b766b3b36b3e1c38cc0d65a6d5526af63..2267d62ed4a099528b4f85c01529e78b117d5afa 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface
- *              $Revision: 37 $
+ *              $Revision: 45 $
  *
  *****************************************************************************/
 
@@ -25,8 +25,6 @@
  */
 
 #include "acpi.h"
-#include "acnamesp.h"
-#include "achware.h"
 
 #define _COMPONENT          ACPI_HARDWARE
         ACPI_MODULE_NAME    ("hwsleep")
@@ -56,10 +54,12 @@ acpi_set_firmware_waking_vector (
        /* 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);
@@ -95,10 +95,12 @@ acpi_get_firmware_waking_vector (
        /* 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);
@@ -135,7 +137,7 @@ acpi_enter_sleep_state_prep (
        /*
         * _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);
@@ -182,10 +184,12 @@ acpi_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");
@@ -193,7 +197,7 @@ 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);
        }
@@ -204,16 +208,34 @@ acpi_enter_sleep_state (
 
        /* 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 */
@@ -228,8 +250,15 @@ acpi_enter_sleep_state (
 
        /* 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 */
 
@@ -237,26 +266,48 @@ acpi_enter_sleep_state (
        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);
 }
@@ -311,7 +362,13 @@ acpi_leave_sleep_state (
 
        /* _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);
 }
index 869efbf8fcc7a3e145a133cb2e7846d3c628edf6..3f56f3c34fcce1d0da1eba8c284b7064672903ee 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Name: hwtimer.c - ACPI Power Management Timer Interface
- *              $Revision: 20 $
+ *              $Revision: 21 $
  *
  *****************************************************************************/
 
@@ -25,7 +25,6 @@
  */
 
 #include "acpi.h"
-#include "achware.h"
 
 #define _COMPONENT          ACPI_HARDWARE
         ACPI_MODULE_NAME    ("hwtimer")
@@ -81,6 +80,9 @@ acpi_status
 acpi_get_timer (
        u32                     *ticks)
 {
+       acpi_status             status;
+
+
        ACPI_FUNCTION_TRACE ("Acpi_get_timer");
 
 
@@ -88,9 +90,9 @@ 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);
 }
 
 
index 08a8f74214d0a89e5feb6da158031e2ad3e2e778..66d06700f2c30ffd1bd9c127e6ef9f5893c540b2 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acconfig.h - Global configuration constants
- *       $Revision: 96 $
+ *       $Revision: 102 $
  *
  *****************************************************************************/
 
@@ -54,7 +54,7 @@
 
 /* Version string */
 
-#define ACPI_CA_VERSION             0x20020403
+#define ACPI_CA_VERSION             0x20020517
 
 /* Version of ACPI supported */
 
index 05604fa10ee059590bd90071d82ca0d4fef4a9cd..cdeccc3e73d8644665ba88389bef7fbd124c2492 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acdebug.h - ACPI/AML debugger
- *       $Revision: 58 $
+ *       $Revision: 61 $
  *
  *****************************************************************************/
 
@@ -63,7 +63,7 @@ typedef struct argument_info
  * dbapi - external debugger interfaces
  */
 
-int
+acpi_status
 acpi_db_initialize (
        void);
 
@@ -82,7 +82,6 @@ acpi_db_single_step (
  * dbcmds - debug commands and output routines
  */
 
-
 void
 acpi_db_display_table_info (
        NATIVE_CHAR             *table_arg);
@@ -153,6 +152,38 @@ void
 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
@@ -181,12 +212,20 @@ void
 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);
@@ -231,6 +270,14 @@ acpi_db_display_argument_object (
        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
@@ -248,6 +295,23 @@ acpi_db_create_execution_threads (
        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
@@ -258,6 +322,9 @@ acpi_db_match_argument (
        NATIVE_CHAR             *user_argument,
        ARGUMENT_INFO           *arguments);
 
+acpi_status
+ae_local_load_table (
+       acpi_table_header       *table_ptr);
 
 void
 acpi_db_close_debug_file (
@@ -310,6 +377,27 @@ acpi_db_user_commands (
        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
@@ -325,6 +413,21 @@ acpi_status
 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
index 9c26d10632f8fa9383b661cf4cec67af4f708358..182193be6ea06b1aac96cd133432c577f13ebc46 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acdispat.h - dispatcher (parser to interpreter interface)
- *       $Revision: 52 $
+ *       $Revision: 54 $
  *
  *****************************************************************************/
 
@@ -57,6 +57,13 @@ acpi_ds_obj_stack_pop_object (
 
 /* 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);
@@ -73,6 +80,35 @@ acpi_status
 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 */
 
@@ -108,6 +144,12 @@ acpi_ds_exec_end_op (
 
 /* 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,
@@ -180,7 +222,7 @@ acpi_ds_method_data_get_entry (
        acpi_walk_state         *walk_state,
        acpi_operand_object     ***node);
 
-acpi_status
+void
 acpi_ds_method_data_delete_all (
        acpi_walk_state         *walk_state);
 
@@ -201,7 +243,7 @@ acpi_ds_method_data_get_value (
        acpi_walk_state         *walk_state,
        acpi_operand_object     **dest_desc);
 
-acpi_status
+void
 acpi_ds_method_data_delete_value (
        u16                     opcode,
        u32                     index,
@@ -220,7 +262,7 @@ acpi_ds_method_data_get_node (
        acpi_walk_state         *walk_state,
        acpi_namespace_node     **node);
 
-acpi_status
+void
 acpi_ds_method_data_init (
        acpi_walk_state         *walk_state);
 
@@ -308,29 +350,6 @@ acpi_ds_create_node (
        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
index e9109ceb840af4b2df6e3981a088239d05b31f32..1978bf724640edde4d67ca53b69377fe186daeaf 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acevents.h - Event subcomponent prototypes and defines
- *       $Revision: 76 $
+ *       $Revision: 79 $
  *
  *****************************************************************************/
 
@@ -65,7 +65,7 @@ acpi_status
 acpi_ev_acquire_global_lock(
        u32                     timeout);
 
-void
+acpi_status
 acpi_ev_release_global_lock(
        void);
 
@@ -116,7 +116,7 @@ acpi_ev_gpe_detect (
  */
 
 acpi_status
-acpi_ev_install_default_address_space_handlers (
+acpi_ev_init_address_spaces (
        void);
 
 acpi_status
@@ -125,7 +125,7 @@ acpi_ev_address_space_dispatch (
        u32                     function,
        ACPI_PHYSICAL_ADDRESS   address,
        u32                     bit_width,
-       acpi_integer            *value);
+       void                    *value);
 
 acpi_status
 acpi_ev_addr_handler_helper (
@@ -134,17 +134,17 @@ 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
index 80f3d5efea33f2b46fb3e547be2fab6e9ec09c4d..9d23725e76d5791dd678504a0bdfa186fdf20c37 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * 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
@@ -215,7 +219,8 @@ NATIVE_CHAR const   *acpi_gbl_exception_names_tbl[] =
        "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[] =
@@ -247,7 +252,10 @@ 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[] =
index b8cb052a4ae13233bc74d433b1df739a55de8ba6..6c01afbcecf80cf67157ee6502b1777776dd3b96 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acglobal.h - Declarations for global variables
- *       $Revision: 121 $
+ *       $Revision: 125 $
  *
  *****************************************************************************/
 
@@ -79,6 +79,14 @@ ACPI_EXTERN acpi_table_header          *acpi_gbl_DSDT;
 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!
@@ -109,6 +117,7 @@ ACPI_EXTERN acpi_mutex_info             acpi_gbl_acpi_mutex_info [NUM_MTX];
 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;
 
@@ -131,6 +140,7 @@ extern u8                               acpi_gbl_shutdown;
 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];
 
 
 /*****************************************************************************
@@ -186,7 +196,7 @@ ACPI_EXTERN acpi_parse_object           *acpi_gbl_parsed_namespace_root;
  *
  ****************************************************************************/
 
-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;
 
@@ -229,13 +239,11 @@ ACPI_EXTERN u8                          acpi_gbl_db_output_flags;
 
 #ifdef ENABLE_DEBUGGER
 
-ACPI_EXTERN u8                          acpi_gbl_method_executing;
-ACPI_EXTERN u8                          acpi_gbl_db_terminate_threads;
+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;
index f0c39513028f3855e0830b0e0f16b1a41c832094..f4df5ca0dfe38e92a8232f4a913d01691fce8ff3 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: achware.h -- hardware specific interfaces
- *       $Revision: 58 $
+ *       $Revision: 60 $
  *
  *****************************************************************************/
 
@@ -64,49 +64,44 @@ ACPI_BIT_REGISTER_INFO *
 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);
 
@@ -114,7 +109,7 @@ void
 acpi_hw_enable_gpe_for_wakeup (
        u32                     gpe_number);
 
-void
+acpi_status
 acpi_hw_disable_gpe (
        u32                     gpe_number);
 
@@ -122,33 +117,24 @@ void
 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
index 6d722c8a4ebe6cf6e9abbc2a05c70f59d7798520..5c48bf1a32c346e657412eb28dbc3bc100c7d78b 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acinterp.h - Interpreter subcomponent prototypes and defines
- *       $Revision: 133 $
+ *       $Revision: 137 $
  *
  *****************************************************************************/
 
@@ -36,6 +36,11 @@ acpi_ex_resolve_operands (
        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
@@ -83,6 +88,11 @@ acpi_ex_convert_to_target_type (
        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
@@ -172,6 +182,12 @@ acpi_status
 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,
@@ -283,7 +299,7 @@ acpi_ex_release_mutex (
        acpi_operand_object     *obj_desc,
        acpi_walk_state         *walk_state);
 
-acpi_status
+void
 acpi_ex_release_all_mutexes (
        ACPI_THREAD_STATE       *thread);
 
@@ -423,13 +439,6 @@ acpi_ex_resolve_object_to_value (
  */
 
 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);
 
@@ -448,12 +457,31 @@ acpi_ex_dump_object_descriptor (
        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
@@ -586,7 +614,7 @@ u8
 acpi_ex_acquire_global_lock (
        u32                     rule);
 
-acpi_status
+void
 acpi_ex_release_global_lock (
        u8                      locked);
 
@@ -595,12 +623,12 @@ acpi_ex_digits_needed (
        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);
index 087292580840869b4475568575031bd28993c8f4..a0a355102e8cca2e7fdee9bb02bcba3a4187adfd 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: aclocal.h - Internal data types used across the ACPI subsystem
- *       $Revision: 162 $
+ *       $Revision: 167 $
  *
  *****************************************************************************/
 
@@ -37,23 +37,9 @@ typedef u32                             ACPI_MUTEX_HANDLE;
 #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
 
 
 /*****************************************************************************
@@ -234,7 +220,7 @@ typedef struct acpi_table_desc
        u8                      *aml_start;
        u64                     physical_address;
        u32                     aml_length;
-       u32                     length;
+       ACPI_SIZE               length;
        u32                     count;
        acpi_owner_id           table_id;
        u8                      type;
@@ -411,8 +397,8 @@ typedef struct
 
 /* 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 */\
@@ -463,7 +449,7 @@ typedef struct acpi_pkg_state
 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;
@@ -485,7 +471,7 @@ typedef struct acpi_scope_state
 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 */
@@ -526,7 +512,7 @@ typedef struct acpi_result_values
 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) (
@@ -609,7 +595,7 @@ typedef union acpi_parse_val
        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;
 
@@ -617,12 +603,12 @@ typedef union acpi_parse_val
 #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 */\
@@ -631,24 +617,68 @@ typedef union acpi_parse_val
 /*
  * 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;
 
 
 /*
@@ -663,10 +693,10 @@ typedef struct acpi_parse_state
        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;
 
@@ -712,38 +742,6 @@ typedef struct
 #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
@@ -871,6 +869,7 @@ typedef struct
 
 #define ACPI_ASCII_ZERO                      0x30
 
+
 /*****************************************************************************
  *
  * Debugger
index 24a9006b03d2b7b0acff4b8fdb282c40f89265f7..1e10b2182e2af98d176916cd5421e22ebb4b788a 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * 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
@@ -55,7 +56,7 @@
  * 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
 
index 2217e317de373c7b06e570661877643353097d99..c5a90435c3f7df13dc3c2679e2497e4aa5142fa2 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acnamesp.h - Namespace subcomponent prototypes and defines
- *       $Revision: 123 $
+ *       $Revision: 125 $
  *
  *****************************************************************************/
 
@@ -108,7 +108,7 @@ acpi_ns_get_next_node (
        acpi_namespace_node     *parent,
        acpi_namespace_node     *child);
 
-acpi_status
+void
 acpi_ns_delete_namespace_by_owner (
        u16                     table_id);
 
@@ -139,7 +139,6 @@ acpi_ns_load_table_by_type (
  * Top-level namespace access - nsaccess
  */
 
-
 acpi_status
 acpi_ns_root_initialize (
        void);
@@ -159,7 +158,6 @@ acpi_ns_lookup (
  * Named object allocation/deallocation - nsalloc
  */
 
-
 acpi_namespace_node *
 acpi_ns_create_node (
        u32                     name);
@@ -168,7 +166,7 @@ void
 acpi_ns_delete_node (
        acpi_namespace_node     *node);
 
-acpi_status
+void
 acpi_ns_delete_namespace_subtree (
        acpi_namespace_node     *parent_handle);
 
@@ -220,10 +218,24 @@ acpi_ns_print_pathname (
        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,
@@ -289,6 +301,12 @@ u32
 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);
@@ -408,7 +426,7 @@ acpi_status
 acpi_ns_build_internal_name (
        acpi_namestring_info    *info);
 
-acpi_status
+void
 acpi_ns_get_internal_name_length (
        acpi_namestring_info    *info);
 
index 902cfb4756eba956dc4ca294f830f6f2374f123a..9e1352f78328ed0bbb924aa85e928cae3fd29bcc 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Name: acobject.h - Definition of acpi_operand_object  (Internal object only)
- *       $Revision: 110 $
+ *       $Revision: 111 $
  *
  *****************************************************************************/
 
@@ -482,4 +482,41 @@ typedef union acpi_operand_obj
 
 } 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 */
index a946415931d6a7af531092aa2c44f58b889f1d1a..2d4ee6bbe70f025a1ff0ff325b30a4d0fc3cf7a2 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: acparser.h - AML Parser subcomponent prototypes and defines
- *       $Revision: 58 $
+ *       $Revision: 59 $
  *
  *****************************************************************************/
 
@@ -134,7 +134,7 @@ u32
 acpi_ps_get_opcode_size (
        u32                     opcode);
 
-u8
+void
 acpi_ps_complete_this_op (
        acpi_walk_state         *walk_state,
        acpi_parse_object       *op);
index 885c5ac3d7991ade60aeb34584835364f9087cd7..9a8d3407634db18d55c8053885fdd97f1eeb2878 100644 (file)
@@ -71,6 +71,10 @@ acpi_status
 acpi_purge_cached_objects (
        void);
 
+acpi_status
+acpi_install_initialization_handler (
+       ACPI_INIT_HANDLER       handler,
+       u32                     function);
 
 /*
  * ACPI Memory manager
@@ -329,6 +333,18 @@ acpi_get_irq_routing_table (
  * 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);
@@ -337,17 +353,23 @@ acpi_status
 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__ */
index dee8f3f7357718d4fe111ede0bf6b9df6232e50c..601647cb0cf1025155cf09d7a6ab848725bd6507 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acresrc.h - Resource Manager function prototypes
- *       $Revision: 30 $
+ *       $Revision: 33 $
  *
  *****************************************************************************/
 
@@ -69,8 +69,59 @@ acpi_rs_create_pci_routing_table (
 
 
 /*
- *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 (
@@ -87,18 +138,18 @@ acpi_rs_get_byte_stream_start (
        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);
 
@@ -111,7 +162,7 @@ acpi_rs_byte_stream_to_list (
 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
index d51d35987982b91d747e7ff980f2c27af63be946..d1cbc98adf76d91191e9b7195c902e95095c295b 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * 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
 {
@@ -102,6 +104,7 @@ 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;
index aae3943a159f5d61f060a8fe0dac80209a26bb29..bec0094bebefb03f29c802d13f5c08145e46ef81 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: actables.h - ACPI table management
- *       $Revision: 36 $
+ *       $Revision: 41 $
  *
  *****************************************************************************/
 
@@ -63,6 +63,15 @@ acpi_tb_get_table_count (
  * 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,
@@ -90,7 +99,7 @@ acpi_status
 acpi_tb_get_table_pointer (
        ACPI_POINTER            *address,
        u32                     flags,
-       u32                     *size,
+       ACPI_SIZE               *size,
        acpi_table_header       **table_ptr);
 
 /*
@@ -99,8 +108,7 @@ acpi_tb_get_table_pointer (
 
 acpi_status
 acpi_tb_get_all_tables (
-       u32                     number_of_tables,
-       acpi_table_header       *buffer_ptr);
+       u32                     number_of_tables);
 
 
 /*
@@ -109,7 +117,6 @@ acpi_tb_get_all_tables (
 
 acpi_status
 acpi_tb_install_table (
-       acpi_table_header       *table_ptr,
        acpi_table_desc         *table_info);
 
 acpi_status
@@ -119,7 +126,6 @@ acpi_tb_match_signature (
 
 acpi_status
 acpi_tb_recognize_table (
-       acpi_table_header       *table_ptr,
        acpi_table_desc         *table_info);
 
 acpi_status
@@ -186,7 +192,7 @@ acpi_tb_find_table (
 acpi_status
 acpi_tb_map_acpi_table (
        ACPI_PHYSICAL_ADDRESS   physical_address,
-       u32                     *size,
+       ACPI_SIZE               *size,
        acpi_table_header       **logical_address);
 
 acpi_status
index 2d3a6885c1841c37aa81109a539d33c87429209f..bb146cabf3594b754b28b2ca9343435e69a7fa57 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * 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
  */
@@ -60,8 +73,11 @@ typedef unsigned int                    UINT32;
 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;
@@ -70,10 +86,11 @@ typedef UINT64                          ACPI_SIZE;
 
 #define ALIGNED_ADDRESS_BOUNDARY        0x00000008      /* No hardware alignment support in IA64 */
 #define ACPI_USE_NATIVE_DIVIDE                          /* Native 64-bit integer support */
-#define ACPI_MAX_PTR                    0xFFFFFFFFFFFFFFFF
+#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
  */
@@ -94,15 +111,19 @@ typedef struct
 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
@@ -111,7 +132,7 @@ typedef UINT32                          ACPI_SIZE;
 #define ACPI_NO_INTEGER64_SUPPORT
 
 
-#else
+#elif ACPI_MACHINE_WIDTH == 32
 /*
  * 32-bit type definitions (default)
  */
@@ -123,8 +144,11 @@ typedef unsigned int                    UINT32;
 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;
@@ -133,9 +157,12 @@ typedef UINT32                          ACPI_SIZE;
 
 #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
 
 
 /*
@@ -147,16 +174,6 @@ typedef NATIVE_UINT                     ACPI_PTRDIFF;
 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
@@ -175,7 +192,7 @@ typedef UINT64                          u64;
  * 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;
@@ -186,7 +203,7 @@ typedef union acpi_pointers
 typedef struct acpi_pointer
 {
        u32                         pointer_type;
-       ACPI_POINTERS               pointer;
+       union acpi_ptrs             pointer;
 
 } ACPI_POINTER;
 
@@ -238,6 +255,13 @@ typedef union
 
 } uint64_overlay;
 
+typedef struct
+{
+       u32                         lo;
+       u32                         hi;
+
+} UINT32_STRUCT;
+
 
 /*
  * Acpi integer width. In ACPI version 1, integers are
@@ -271,7 +295,7 @@ typedef u64                             acpi_integer;
 #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
@@ -281,7 +305,7 @@ typedef u64                             acpi_integer;
  * 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)
 
 
 /*
@@ -561,6 +585,37 @@ typedef u8                              ACPI_ADR_SPACE_TYPE;
 #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
  */
@@ -720,6 +775,13 @@ void (*ACPI_OBJECT_HANDLER) (
        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 */
 
@@ -732,7 +794,7 @@ acpi_status (*acpi_adr_space_handler) (
        void                        *handler_context,
        void                        *region_context);
 
-#define ACPI_DEFAULT_HANDLER        ((acpi_adr_space_handler) NULL)
+#define ACPI_DEFAULT_HANDLER        NULL
 
 
 typedef
@@ -807,7 +869,7 @@ typedef struct
        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;
 
 
index 4f42e8f975aea8a5c48a1a52beb215379eed50d6..c595adbd08bba4c389fa778ba27c6391590cf1ec 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
- *       $Revision: 130 $
+ *       $Revision: 137 $
  *
  *****************************************************************************/
 
@@ -82,7 +82,7 @@ acpi_status
 acpi_ut_hardware_initialize (
        void);
 
-acpi_status
+void
 acpi_ut_subsystem_shutdown (
        void);
 
@@ -94,7 +94,7 @@ acpi_ut_validate_fadt (
  * Ut_global - Global data structures and procedures
  */
 
-#ifdef ACPI_DEBUG
+#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER)
 
 NATIVE_CHAR *
 acpi_ut_get_mutex_name (
@@ -115,7 +115,7 @@ NATIVE_CHAR *
 acpi_ut_get_event_name (
        u32                     event_id);
 
-u8
+char
 acpi_ut_hex_to_ascii_char (
        acpi_integer            integer,
        u32                     position);
@@ -150,7 +150,7 @@ acpi_ut_strncpy (
        const NATIVE_CHAR       *src_string,
        NATIVE_UINT             count);
 
-u32
+int
 acpi_ut_strncmp (
        const NATIVE_CHAR       *string1,
        const NATIVE_CHAR       *string2,
@@ -195,13 +195,32 @@ acpi_ut_memset (
        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 */
 
@@ -222,6 +241,20 @@ acpi_ut_build_package_object (
        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,
@@ -386,7 +419,7 @@ void
 acpi_ut_delete_internal_simple_object (
        acpi_operand_object     *object);
 
-acpi_status
+void
 acpi_ut_delete_internal_object_list (
        acpi_operand_object     **obj_list);
 
@@ -524,6 +557,13 @@ acpi_ut_get_object_size(
        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
@@ -613,6 +653,12 @@ u8
 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);
@@ -621,6 +667,13 @@ acpi_status
 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);
@@ -630,6 +683,14 @@ acpi_ut_generate_checksum (
        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 (
@@ -705,6 +766,12 @@ acpi_ut_free_and_track (
        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,
index acf95229facf869cf3bcfec84c03506fbc323f0d..ddcffdf80897a8c0eb7538c2b2045377ade2c74d 100644 (file)
@@ -3,7 +3,7 @@
  * 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 $
  *
  *****************************************************************************/
 
@@ -28,7 +28,6 @@
 #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 */
 
index 8e44609ad2b55f80f44b9aa524090c51ffc2eb6d..7287110d279c21d361b0bf2e16862c83a064ec2e 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acenv.h - Generation environment specific items
- *       $Revision: 86 $
+ *       $Revision: 94 $
  *
  *****************************************************************************/
 
@@ -51,7 +51,7 @@
 #ifdef _ACPI_ASL_COMPILER
 #define ACPI_DEBUG
 #define ACPI_APPLICATION
-#define ENABLE_DEBUGGER
+/* #define ENABLE_DEBUGGER */
 #define ACPI_USE_SYSTEM_CLIBRARY
 #endif
 
@@ -61,7 +61,7 @@
  * 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
 
 /******************************************************************************
  *
@@ -234,17 +241,17 @@ typedef char *va_list;
 
 
 #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
 
index 725104600d064f20dddf78b8ae03eb1b3f0ce2af..afb8d9a2fc8f99e66c3ecb6c041529164aa508cc 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * 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.
  */
index ab518aa3e9bdb8baeae96d9245cb29771d512a4a..d441c20099db5f1e58d09ddac6d91dfea5eb5abf 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * 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 */
@@ -62,7 +70,6 @@
 #include "acgcc.h"
 
 #undef DEBUGGER_THREADING
-#define DEBUGGER_THREADING          DEBUGGER_SINGLE_THREADED
-
+#define DEBUGGER_THREADING     DEBUGGER_SINGLE_THREADED
 
 #endif /* __ACLINUX_H__ */
index 9ced42a7a9738fa3766fc3ec5a8f570da5ad4a94..9fd0418f26284c514c3c7322771ae17005849da0 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: nsaccess - Top-level functions for accessing ACPI namespace
- *              $Revision: 153 $
+ *              $Revision: 155 $
  *
  ******************************************************************************/
 
@@ -26,7 +26,6 @@
 
 #include "acpi.h"
 #include "amlcode.h"
-#include "acinterp.h"
 #include "acnamesp.h"
 #include "acdispat.h"
 
@@ -180,7 +179,7 @@ acpi_ns_root_initialize (void)
 
                        /* 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 */
 
@@ -298,9 +297,10 @@ acpi_ns_lookup (
 
                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 {
                /*
@@ -316,7 +316,7 @@ acpi_ns_lookup (
                 * 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;
@@ -340,7 +340,7 @@ acpi_ns_lookup (
                         * 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
@@ -382,7 +382,7 @@ acpi_ns_lookup (
                        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:
index 657d5a1dd23f7c2b2b48a1cf09bf3f46561afdca..a9dee5ffb2d944a817e86f40e5b73530b6acab6c 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: nsalloc - Namespace allocation and deletion utilities
- *              $Revision: 72 $
+ *              $Revision: 74 $
  *
  ******************************************************************************/
 
@@ -26,7 +26,6 @@
 
 #include "acpi.h"
 #include "acnamesp.h"
-#include "acinterp.h"
 
 
 #define _COMPONENT          ACPI_NAMESPACE
@@ -207,7 +206,7 @@ acpi_ns_install_node (
                 * real definition is found later.
                 */
                ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] is a forward reference\n",
-                       (char *) &node->name));
+                       node->name.ascii));
        }
 
        /*
@@ -232,7 +231,7 @@ acpi_ns_install_node (
        }
 
        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
@@ -339,7 +338,7 @@ acpi_ns_delete_children (
  *
  ******************************************************************************/
 
-acpi_status
+void
 acpi_ns_delete_namespace_subtree (
        acpi_namespace_node     *parent_node)
 {
@@ -351,7 +350,7 @@ acpi_ns_delete_namespace_subtree (
 
 
        if (!parent_node) {
-               return_ACPI_STATUS (AE_OK);
+               return_VOID;
        }
 
        /*
@@ -403,7 +402,7 @@ acpi_ns_delete_namespace_subtree (
                }
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_VOID;
 }
 
 
@@ -475,7 +474,7 @@ acpi_ns_remove_reference (
  *
  ******************************************************************************/
 
-acpi_status
+void
 acpi_ns_delete_namespace_by_owner (
        u16                     owner_id)
 {
@@ -553,7 +552,7 @@ acpi_ns_delete_namespace_by_owner (
                }
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_VOID;
 }
 
 
index da57eb539ee6cb9a33f6f28196832d9a57dc7794..470b2846c11204371c2065199754cc355b150106 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: nsdump - table dumping routines for debug
- *              $Revision: 129 $
+ *              $Revision: 135 $
  *
  *****************************************************************************/
 
@@ -25,9 +25,7 @@
 
 
 #include "acpi.h"
-#include "acinterp.h"
 #include "acnamesp.h"
-#include "actables.h"
 #include "acparser.h"
 
 
@@ -202,11 +200,11 @@ acpi_ns_dump_one_object (
                }
                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 ("+");
                        }
 
@@ -229,14 +227,14 @@ acpi_ns_dump_one_object (
        }
 
        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;
@@ -256,7 +254,7 @@ acpi_ns_dump_one_object (
                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);
@@ -271,7 +269,7 @@ acpi_ns_dump_one_object (
 
                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);
@@ -309,7 +307,7 @@ acpi_ns_dump_one_object (
                                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");
@@ -361,7 +359,7 @@ acpi_ns_dump_one_object (
                        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;
 
@@ -369,23 +367,23 @@ acpi_ns_dump_one_object (
                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;
 
 
@@ -402,14 +400,16 @@ acpi_ns_dump_one_object (
                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;
 
 
@@ -498,7 +498,7 @@ acpi_ns_dump_one_object (
                        break;
 
 
-               case ACPI_DESC_TYPE_INTERNAL:
+               case ACPI_DESC_TYPE_OPERAND:
 
                        obj_type = obj_desc->common.type;
 
@@ -507,8 +507,8 @@ acpi_ns_dump_one_object (
                                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;
@@ -525,7 +525,7 @@ acpi_ns_dump_one_object (
 
                /* 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;
                }
 
@@ -534,11 +534,11 @@ acpi_ns_dump_one_object (
                 */
                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:
@@ -546,26 +546,26 @@ acpi_ns_dump_one_object (
                        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;
                }
 
@@ -613,8 +613,9 @@ acpi_ns_dump_objects (
        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);
 }
 
 
@@ -655,7 +656,7 @@ acpi_ns_dump_one_device (
                        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));
@@ -679,6 +680,7 @@ void
 acpi_ns_dump_root_devices (void)
 {
        acpi_handle             sys_bus_handle;
+       acpi_status             status;
 
 
        ACPI_FUNCTION_NAME ("Ns_dump_root_devices");
@@ -690,11 +692,16 @@ acpi_ns_dump_root_devices (void)
                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
@@ -772,7 +779,7 @@ acpi_ns_dump_entry (
        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
index 1c0be0c84b4eb88641bf5237c7af9d76c02d077a..ff2e6e870d4cdaa003ea1432589dec64f4089a87 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Module Name: nseval - Object evaluation interfaces -- includes control
  *                       method lookup and execution.
- *              $Revision: 112 $
+ *              $Revision: 114 $
  *
  ******************************************************************************/
 
@@ -26,7 +26,6 @@
 
 
 #include "acpi.h"
-#include "amlcode.h"
 #include "acparser.h"
 #include "acinterp.h"
 #include "acnamesp.h"
@@ -332,12 +331,9 @@ acpi_ns_evaluate_by_handle (
                        *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;
        }
 
        /*
@@ -393,7 +389,7 @@ acpi_ns_execute_control_method (
        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));
 
        /*
@@ -444,7 +440,7 @@ acpi_ns_get_object_value (
        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");
@@ -455,7 +451,6 @@ acpi_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
@@ -482,17 +477,17 @@ acpi_ns_get_object_value (
 
        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));
                }
        }
 
index 14b14cf067056fff987f668b8dd262733ccfe2d9..6e2aff7a282768b003a520b46f85ecf32ab0818f 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: nsinit - namespace initialization
- *              $Revision: 43 $
+ *              $Revision: 47 $
  *
  *****************************************************************************/
 
@@ -71,19 +71,20 @@ acpi_ns_initialize_objects (
                          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);
 }
@@ -130,11 +131,12 @@ acpi_ns_initialize_devices (
                          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);
@@ -259,13 +261,17 @@ acpi_ns_init_one_object (
                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)) {
@@ -357,30 +363,36 @@ acpi_ns_init_one_device (
         */
        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);
 }
index d1047985ce98d00cc9a785564643a9f7a7ab849e..149a713dc38fabb583db8c34c8cc8c9259574ab1 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * 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
@@ -78,8 +76,8 @@ acpi_ns_load_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",
@@ -122,7 +120,7 @@ acpi_ns_one_complete_parse (
                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 */
 
@@ -497,7 +495,10 @@ acpi_ns_delete_subtree (
                        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);
+                       }
                }
        }
 
index 6d1571a2ed32e3753f68f06b616ef84e44928f56..cf51ec2129ccb93a7f0cdcaebb96072ed3b75787 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: nsnames - Name manipulation and search
- *              $Revision: 74 $
+ *              $Revision: 77 $
  *
  ******************************************************************************/
 
@@ -26,7 +26,6 @@
 
 #include "acpi.h"
 #include "amlcode.h"
-#include "acinterp.h"
 #include "acnamesp.h"
 
 
@@ -55,7 +54,7 @@ acpi_ns_build_external_path (
        ACPI_SIZE               size,
        NATIVE_CHAR             *name_buffer)
 {
-       u32                     index;
+       ACPI_SIZE               index;
        acpi_namespace_node     *parent_node;
 
 
@@ -97,7 +96,7 @@ acpi_ns_build_external_path (
        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;
@@ -236,7 +235,7 @@ acpi_ns_handle_to_pathname (
 
        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);
 }
 
index 066700b0fb2a1be57992894caebf52198bfa36c1..a2f8989ceb0eeb3c1a19ea81e9087b2d6c7aed92 100644 (file)
@@ -2,7 +2,7 @@
  *
  * 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
@@ -141,13 +138,7 @@ acpi_ns_attach_object (
        }
 
        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 */
 
@@ -155,19 +146,26 @@ acpi_ns_attach_object (
                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;
@@ -209,7 +207,7 @@ acpi_ns_detach_object (
        /* 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)) {
@@ -222,7 +220,7 @@ acpi_ns_detach_object (
        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) */
 
@@ -255,8 +253,8 @@ acpi_ns_get_attached_object (
        }
 
        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);
        }
index 9e50ed1fdc605048967892fe6717a5cc6b026a98..fc5e8e71d79a748c1d1bddc9d7c4c51104ba19f6 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: nssearch - Namespace search
- *              $Revision: 84 $
+ *              $Revision: 85 $
  *
  ******************************************************************************/
 
@@ -25,8 +25,6 @@
 
 
 #include "acpi.h"
-#include "amlcode.h"
-#include "acinterp.h"
 #include "acnamesp.h"
 
 
index 4026a7d43582ca53d4a3a1d15d0fb258c13cbfbb..fba4f7a90b67e5714c4ff57d9960c65afe631721 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Module Name: nsutils - Utilities for accessing ACPI namespace, accessing
  *                        parents and siblings and Scope manipulation
- *              $Revision: 105 $
+ *              $Revision: 109 $
  *
  *****************************************************************************/
 
@@ -27,7 +27,6 @@
 
 #include "acpi.h"
 #include "acnamesp.h"
-#include "acinterp.h"
 #include "amlcode.h"
 #include "actables.h"
 
@@ -146,7 +145,7 @@ acpi_ns_local (
  *
  ******************************************************************************/
 
-acpi_status
+void
 acpi_ns_get_internal_name_length (
        acpi_namestring_info    *info)
 {
@@ -204,8 +203,6 @@ acpi_ns_get_internal_name_length (
                          4 + info->num_carats;
 
        info->next_external_char = next_external_char;
-
-       return (AE_OK);
 }
 
 
@@ -230,7 +227,7 @@ acpi_ns_build_internal_name (
        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");
@@ -293,7 +290,7 @@ acpi_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++;
                        }
                }
@@ -410,12 +407,12 @@ acpi_ns_externalize_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");
@@ -447,6 +444,9 @@ acpi_ns_externalize_name (
                }
 
                break;
+
+       default:
+               break;
        }
 
        /*
@@ -534,7 +534,7 @@ acpi_ns_externalize_name (
        }
 
        if (converted_name_length) {
-               *converted_name_length = required_length;
+               *converted_name_length = (u32) required_length;
        }
 
        return_ACPI_STATUS (AE_OK);
@@ -818,16 +818,16 @@ acpi_ns_find_parent_name (
                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);
index 4cfcef7e0ef962d2377951539418a90b20d79945..a207136d9c644e3e70238fcae6b127701745ea6e 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: nswalk - Functions for walking the ACPI namespace
- *              $Revision: 32 $
+ *              $Revision: 33 $
  *
  *****************************************************************************/
 
@@ -25,7 +25,6 @@
 
 
 #include "acpi.h"
-#include "acinterp.h"
 #include "acnamesp.h"
 
 
index 4f021fee720b4ed471aea649aa1232912791aff1..160781ab04644f083abfe5b416a768b4fa00cca7 100644 (file)
@@ -2,7 +2,7 @@
  *
  * 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
@@ -185,7 +180,7 @@ acpi_get_name (
 
        /* 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;
index 3f88c8edd79c3b10297e069540a4c9a52b4e7446..def0a73189503757437e7fa0a2d5fe395e7ff679 100644 (file)
@@ -2,7 +2,7 @@
  *
  * 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
@@ -82,7 +173,7 @@ 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);
@@ -198,7 +289,7 @@ acpi_evaluate_object (
                                                 */
                                                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 {
                                                /*
@@ -602,8 +693,8 @@ acpi_ns_get_device_callback (
                }
        }
 
-       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);
 }
 
 
index 9415c5dbc864d2ddcd483fdea5b6397b3ba880e7..bd9dab948f383db29aa2a022e149b9fee8b7c790 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: psargs - Parse AML opcode arguments
- *              $Revision: 58 $
+ *              $Revision: 61 $
  *
  *****************************************************************************/
 
@@ -93,6 +93,10 @@ acpi_ps_get_next_package_length (
                                  (encoded_length & 0x0F));
                parser_state->aml += 3;
                break;
+
+       default:
+               /* Can't get here, only 2 bits / 4 cases */
+               break;
        }
 
        return_VALUE (length);
@@ -148,9 +152,8 @@ NATIVE_CHAR *
 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");
@@ -177,35 +180,29 @@ acpi_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);
 }
 
@@ -255,7 +252,7 @@ acpi_ps_get_next_namepath (
                /* 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;
        }
 
@@ -271,7 +268,7 @@ acpi_ps_get_next_namepath (
                }
 
                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
@@ -279,21 +276,21 @@ acpi_ps_get_next_namepath (
                                 * 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;
                                        }
                                }
@@ -315,7 +312,7 @@ acpi_ps_get_next_namepath (
         * pathname
         */
        acpi_ps_init_op (arg, AML_INT_NAMEPATH_OP);
-       arg->value.name = path;
+       arg->common.value.name = path;
 
 
        return_VOID;
@@ -348,65 +345,62 @@ acpi_ps_get_next_namepath (
                /* 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)
+                */
        }
 
        /*
@@ -415,7 +409,7 @@ acpi_ps_get_next_namepath (
         * pathname.
         */
        acpi_ps_init_op (arg, AML_INT_NAMEPATH_OP);
-       arg->value.name = path;
+       arg->common.value.name = path;
 
 
        return_VOID;
@@ -448,11 +442,10 @@ acpi_ps_get_next_simple_arg (
 
 
        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;
 
@@ -463,7 +456,7 @@ acpi_ps_get_next_simple_arg (
 
                /* 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;
 
@@ -474,7 +467,7 @@ acpi_ps_get_next_simple_arg (
 
                /* 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;
 
@@ -485,7 +478,7 @@ acpi_ps_get_next_simple_arg (
 
                /* 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;
 
@@ -493,7 +486,7 @@ acpi_ps_get_next_simple_arg (
        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++;
@@ -506,7 +499,12 @@ acpi_ps_get_next_simple_arg (
        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;
        }
 
@@ -530,8 +528,8 @@ acpi_parse_object *
 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;
@@ -543,20 +541,17 @@ acpi_ps_get_next_field (
        /* 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;
@@ -568,46 +563,52 @@ acpi_ps_get_next_field (
        /* 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);
@@ -682,7 +683,7 @@ acpi_ps_get_next_arg (
                                }
 
                                if (prev) {
-                                       prev->next = field;
+                                       prev->common.next = field;
                                }
 
                                else {
@@ -708,8 +709,8 @@ acpi_ps_get_next_arg (
                        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 */
@@ -762,6 +763,10 @@ acpi_ps_get_next_arg (
                        *arg_count = ACPI_VAR_ARGS;
                }
                break;
+
+       default:
+               ACPI_REPORT_ERROR (("Invalid Arg_type: %X\n", arg_type));
+               break;
        }
 
        return_PTR (arg);
index a7a4ee001d93f32951143e540db247be5964ec53..7926498f19153a944f05e4aab0764ffcade5c24b 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: psopcode - Parser/Interpreter opcode information table
- *              $Revision: 66 $
+ *              $Revision: 69 $
  *
  *****************************************************************************/
 
@@ -45,9 +45,9 @@
 #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),
@@ -482,39 +482,39 @@ static const acpi_opcode_info    acpi_gbl_aml_op_info[] =
 /* 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),
@@ -522,7 +522,7 @@ static const acpi_opcode_info    acpi_gbl_aml_op_info[] =
 /* 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) */
 
@@ -538,8 +538,8 @@ static const acpi_opcode_info    acpi_gbl_aml_op_info[] =
 /* 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),
@@ -555,9 +555,9 @@ static const acpi_opcode_info    acpi_gbl_aml_op_info[] =
 
 /* 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),
@@ -573,18 +573,18 @@ static const acpi_opcode_info    acpi_gbl_aml_op_info[] =
 
 /* 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),
@@ -702,6 +702,7 @@ acpi_ps_get_opcode_info (
                }
 
                /* Else fall through to error case below */
+               /*lint -fallthrough */
 
        default:
 
@@ -750,4 +751,3 @@ acpi_ps_get_opcode_name (
 #endif
 }
 
-
index 39ba75dfd48371505d79bddc524639f4b8549518..18d3b6f4882a783ba5345c3178e31da1dbe40f82 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * 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;
 
 
 /*******************************************************************************
@@ -172,13 +170,13 @@ acpi_ps_find_object (
  * 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)
@@ -196,7 +194,7 @@ acpi_ps_complete_this_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 */
@@ -205,12 +203,12 @@ acpi_ps_complete_this_op (
                (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:
@@ -224,7 +222,7 @@ acpi_ps_complete_this_op (
                                 */
                                replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP);
                                if (!replacement_op) {
-                                       return_VALUE (FALSE);
+                                       return_VOID;
                                }
                                break;
 
@@ -234,31 +232,29 @@ acpi_ps_complete_this_op (
                                 * 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;
@@ -266,25 +262,25 @@ acpi_ps_complete_this_op (
                        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;
                                }
                        }
 
@@ -293,18 +289,18 @@ acpi_ps_complete_this_op (
                        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;
                                        }
                                }
@@ -317,13 +313,13 @@ acpi_ps_complete_this_op (
 
                acpi_ps_delete_parse_tree (op);
 
-               return_VALUE (TRUE);
+               return_VOID;
        }
 
-       return_VALUE (FALSE);
+       return_VOID;
 
 #else
-       return (FALSE);
+       return;
 #endif
 }
 
@@ -422,7 +418,7 @@ acpi_ps_next_parse_state (
                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? */
 
@@ -469,6 +465,10 @@ acpi_ps_parse_loop (
 
        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;
@@ -483,8 +483,8 @@ acpi_ps_parse_loop (
                         * 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)) {
@@ -526,12 +526,12 @@ acpi_ps_parse_loop (
         * 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:
@@ -578,8 +578,8 @@ acpi_ps_parse_loop (
                        /* 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,
@@ -593,39 +593,37 @@ acpi_ps_parse_loop (
 
                                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
@@ -638,8 +636,8 @@ acpi_ps_parse_loop (
                                         *
                                         * (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 {
@@ -656,8 +654,8 @@ acpi_ps_parse_loop (
                                         * 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);
@@ -682,12 +680,13 @@ acpi_ps_parse_loop (
                                }
                        }
 
-                       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));
                        }
                }
 
@@ -699,7 +698,7 @@ acpi_ps_parse_loop (
                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 */
@@ -724,19 +723,20 @@ acpi_ps_parse_loop (
                                /* 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 */
@@ -746,9 +746,8 @@ acpi_ps_parse_loop (
                                         * 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
@@ -762,17 +761,16 @@ acpi_ps_parse_loop (
                                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
                                                 */
@@ -787,6 +785,10 @@ acpi_ps_parse_loop (
                                                walk_state->control_state->control.package_end = parser_state->pkg_end;
                                        }
                                        break;
+
+                               default:
+                                       /* No action for all other opcodes */
+                                       break;
                                }
                                break;
                        }
@@ -797,20 +799,23 @@ acpi_ps_parse_loop (
                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
@@ -819,8 +824,7 @@ acpi_ps_parse_loop (
                                 * 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);
                        }
                }
 
@@ -831,15 +835,14 @@ acpi_ps_parse_loop (
                         *
                         * 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);
@@ -856,11 +859,10 @@ close_this_op:
                 */
                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:
@@ -882,8 +884,8 @@ close_this_op:
                        acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types, &walk_state->arg_count);
 
                        walk_state->op    = op;
-                       walk_state->op_info = acpi_ps_get_opcode_info (op->opcode);
-                       walk_state->opcode = op->opcode;
+                       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);
@@ -899,15 +901,15 @@ close_this_op:
 
                        /* 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);
@@ -983,8 +985,8 @@ close_this_op:
                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);
@@ -1125,7 +1127,13 @@ acpi_ps_parse_aml (
                 * 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 */
@@ -1147,8 +1155,10 @@ acpi_ps_parse_aml (
                                 * 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 */
@@ -1181,7 +1191,7 @@ acpi_ps_parse_aml (
        /* 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);
 }
index 7e7a345e9f5a95a329531fc2fe0d18d8b2658b60..4bd3d6e530be93eb994e174646422a034c079292 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: pstree - Parser op tree manipulation/traversal/search
- *              $Revision: 37 $
+ *              $Revision: 39 $
  *
  *****************************************************************************/
 
@@ -59,7 +59,7 @@ acpi_ps_get_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 or ASCII character */
 
@@ -76,10 +76,10 @@ acpi_ps_get_arg (
 
        /* 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);
@@ -117,11 +117,12 @@ acpi_ps_append_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;
        }
 
@@ -136,28 +137,28 @@ acpi_ps_append_arg (
 
        /* 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;
        }
 }
 
@@ -184,7 +185,7 @@ acpi_ps_get_child (
        ACPI_FUNCTION_ENTRY ();
 
 
-       switch (op->opcode) {
+       switch (op->common.aml_opcode) {
        case AML_SCOPE_OP:
        case AML_ELSE_OP:
        case AML_DEVICE_OP:
@@ -219,6 +220,10 @@ acpi_ps_get_child (
                child = acpi_ps_get_arg (op, 3);
                break;
 
+
+       default:
+               /* All others have no children */
+               break;
        }
 
        return (child);
@@ -265,19 +270,19 @@ acpi_ps_get_depth_next (
 
        /* 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) {
@@ -286,13 +291,14 @@ acpi_ps_get_depth_next (
                        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);
index ab4bfad3c24c76fc0f9f5d7f3645de722825881c..d556abe96fb67b0389a479d3f8c0f4deaa01fa8d 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: psutils - Parser miscellaneous utilities (Parser only)
- *              $Revision: 50 $
+ *              $Revision: 51 $
  *
  *****************************************************************************/
 
@@ -54,11 +54,11 @@ acpi_ps_init_op (
        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)));
 }
 
 
@@ -94,23 +94,23 @@ acpi_ps_alloc_op (
        /* 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)
                 */
@@ -124,7 +124,7 @@ acpi_ps_alloc_op (
 
        if (op) {
                acpi_ps_init_op (op, opcode);
-               op->flags = flags;
+               op->common.flags = flags;
        }
 
        return (op);
@@ -151,11 +151,11 @@ acpi_ps_free_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 {
@@ -231,13 +231,13 @@ acpi_ps_get_name (
 
        /* 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);
 }
 
 
@@ -252,10 +252,10 @@ acpi_ps_set_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;
 }
 
index a94a7d7d38dc8b9151080a077aa6188d714d0b9a..87819892523fc3df13b3799fed9f7324e6a40d9a 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * 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")
@@ -84,12 +81,12 @@ acpi_ps_get_next_walk_op (
                 * 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);
 
@@ -142,12 +139,12 @@ acpi_ps_get_next_walk_op (
        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);
 
@@ -238,6 +235,7 @@ acpi_ps_delete_parse_tree (
 {
        acpi_walk_state         *walk_state;
        ACPI_THREAD_STATE       *thread;
+       acpi_status             status;
 
 
        ACPI_FUNCTION_TRACE_PTR ("Ps_delete_parse_tree", subtree_root);
@@ -254,7 +252,6 @@ acpi_ps_delete_parse_tree (
                return_VOID;
        }
 
-
        walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT, NULL, NULL, thread);
        if (!walk_state) {
                return_VOID;
@@ -274,13 +271,16 @@ acpi_ps_delete_parse_tree (
        /* 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;
index 6676970aa5e97b1f788ff5d749e0d5b396a1d202..fa5ef392a3f9dcdc8c756093cbaa49e0727f7b68 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: psxface - Parser external interfaces
- *              $Revision: 61 $
+ *              $Revision: 64 $
  *
  *****************************************************************************/
 
@@ -140,7 +140,6 @@ acpi_psx_execute (
        status = acpi_ps_parse_aml (walk_state);
        acpi_ps_delete_parse_tree (op);
 
-
        /*
         * 2) Execute the method.  Performs second pass parse simultaneously
         */
@@ -158,12 +157,11 @@ acpi_psx_execute (
        /* 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);
        }
@@ -185,7 +183,9 @@ acpi_psx_execute (
                /* 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);
                }
        }
 
index a509fdec7c365dac43f1308e2da4124e6f58e96a..7ce69c37c9d3b394a63f09af3c3ad8afe05c0e9f 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: rsaddr - Address resource descriptors (16/32/64)
- *              $Revision: 24 $
+ *              $Revision: 26 $
  *
  ******************************************************************************/
 
@@ -60,8 +60,8 @@ acpi_rs_address16_resource (
        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;
@@ -200,7 +200,7 @@ acpi_rs_address16_resource (
                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 */
 
@@ -238,7 +238,7 @@ acpi_rs_address16_resource (
        /*
         * Set the Length parameter
         */
-       output_struct->length = struct_size;
+       output_struct->length = (u32) struct_size;
 
        /*
         * Return the final size of the structure
@@ -390,8 +390,7 @@ acpi_rs_address16_stream (
                 * 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);
        }
 
        /*
@@ -439,10 +438,10 @@ acpi_rs_address32_resource (
        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;
 
@@ -451,8 +450,6 @@ acpi_rs_address32_resource (
 
 
        buffer = byte_stream_buffer;
-       output_struct = (acpi_resource *) *output_buffer;
-
        struct_size = ACPI_SIZEOF_RESOURCE (acpi_resource_address32);
 
        /*
@@ -588,7 +585,7 @@ acpi_rs_address32_resource (
                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 */
 
@@ -624,7 +621,7 @@ acpi_rs_address32_resource (
        /*
         * Set the Length parameter
         */
-       output_struct->length = struct_size;
+       output_struct->length = (u32) struct_size;
 
        /*
         * Return the final size of the structure
@@ -676,7 +673,7 @@ acpi_rs_address32_stream (
        /*
         * 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;
 
        /*
@@ -823,10 +820,10 @@ acpi_rs_address64_resource (
        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;
 
@@ -835,8 +832,6 @@ acpi_rs_address64_resource (
 
 
        buffer = byte_stream_buffer;
-       output_struct = (acpi_resource *) *output_buffer;
-
        struct_size = ACPI_SIZEOF_RESOURCE (acpi_resource_address64);
 
        /*
@@ -975,7 +970,7 @@ acpi_rs_address64_resource (
                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 */
 
@@ -1012,7 +1007,7 @@ acpi_rs_address64_resource (
        /*
         * Set the Length parameter
         */
-       output_struct->length = struct_size;
+       output_struct->length = (u32) struct_size;
 
        /*
         * Return the final size of the structure
@@ -1065,7 +1060,7 @@ acpi_rs_address64_stream (
         * 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;
 
        /*
index 55a99e714fc995c207c4eb55b147a363b82a23c1..ab566770e90da7648491387a79cea8a11d96e118 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: rscalc - Calculate stream and list lengths
- *              $Revision: 39 $
+ *              $Revision: 42 $
  *
  ******************************************************************************/
 
@@ -35,7 +35,7 @@
 
 /*******************************************************************************
  *
- * 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
@@ -50,7 +50,7 @@
  ******************************************************************************/
 
 acpi_status
-acpi_rs_calculate_byte_stream_length (
+acpi_rs_get_byte_stream_length (
        acpi_resource           *linked_list,
        ACPI_SIZE               *size_needed)
 {
@@ -60,7 +60,7 @@ acpi_rs_calculate_byte_stream_length (
        u8                      done = FALSE;
 
 
-       ACPI_FUNCTION_TRACE ("Rs_calculate_byte_stream_length");
+       ACPI_FUNCTION_TRACE ("Rs_get_byte_stream_length");
 
 
        while (!done) {
@@ -180,9 +180,9 @@ acpi_rs_calculate_byte_stream_length (
                         */
                        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;
 
@@ -196,9 +196,9 @@ acpi_rs_calculate_byte_stream_length (
                         */
                        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;
 
@@ -212,9 +212,9 @@ acpi_rs_calculate_byte_stream_length (
                         */
                        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;
 
@@ -229,11 +229,11 @@ acpi_rs_calculate_byte_stream_length (
                         * 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;
 
@@ -268,7 +268,7 @@ acpi_rs_calculate_byte_stream_length (
 
 /*******************************************************************************
  *
- * 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
@@ -285,7 +285,7 @@ acpi_rs_calculate_byte_stream_length (
  ******************************************************************************/
 
 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)
@@ -304,7 +304,7 @@ acpi_rs_calculate_list_length (
        u8                      additional_bytes;
 
 
-       ACPI_FUNCTION_TRACE ("Rs_calculate_list_length");
+       ACPI_FUNCTION_TRACE ("Rs_get_list_length");
 
 
        while (bytes_parsed < byte_stream_buffer_length) {
@@ -705,7 +705,7 @@ acpi_rs_calculate_list_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
@@ -721,12 +721,12 @@ acpi_rs_calculate_list_length (
  ******************************************************************************/
 
 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;
@@ -735,7 +735,7 @@ acpi_rs_calculate_pci_routing_table_length (
        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;
@@ -788,7 +788,7 @@ acpi_rs_calculate_pci_routing_table_length (
                /*
                 * 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
index 2a750c3eda32a32df15e710f40bcbacb927a0db0..b2f29cf4c255e6f56c2cf549023deb5baf820899 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: rscreate - Create resource lists/tables
- *              $Revision: 53 $
+ *              $Revision: 56 $
  *
  ******************************************************************************/
 
@@ -79,11 +79,11 @@ acpi_rs_create_resource_list (
         * 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);
        }
@@ -104,7 +104,7 @@ acpi_rs_create_resource_list (
        }
 
        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);
 }
 
@@ -157,13 +157,13 @@ acpi_rs_create_pci_routing_table (
        /*
         * 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 */
 
@@ -179,7 +179,7 @@ acpi_rs_create_pci_routing_table (
        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++) {
                /*
@@ -189,7 +189,7 @@ acpi_rs_create_pci_routing_table (
                 * 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.
@@ -257,7 +257,7 @@ acpi_rs_create_pci_routing_table (
                                           (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;
@@ -316,7 +316,7 @@ acpi_rs_create_pci_routing_table (
        }
 
        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);
 }
 
@@ -359,11 +359,11 @@ acpi_rs_create_byte_stream (
         * 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);
        }
@@ -384,7 +384,7 @@ acpi_rs_create_byte_stream (
        }
 
        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);
 }
 
index c28cddcdd3e03c79c3a406f90508882c48bd78b3..575cb938030014740b47fb13558730332642da1f 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: rsdump - Functions to display the resource structures.
- *              $Revision: 29 $
+ *              $Revision: 32 $
  *
  ******************************************************************************/
 
@@ -31,7 +31,7 @@
         ACPI_MODULE_NAME    ("rsdump")
 
 
-#ifdef ACPI_DEBUG
+#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER)
 
 /*******************************************************************************
  *
@@ -172,9 +172,9 @@ acpi_rs_dump_dma (
 
 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 ();
@@ -977,7 +977,7 @@ acpi_rs_dump_resource_list (
 
        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:
@@ -1082,7 +1082,7 @@ acpi_rs_dump_irq_list (
 
 
        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++);
@@ -1100,7 +1100,7 @@ acpi_rs_dump_irq_list (
 
                        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;
index ab09fa5ec7284b4f4804c90ba8fda1af3da5c946..67bf92135ba00e25cce8e3cc46e22855e0f07a12 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: rsio - IO and DMA resource descriptors
- *              $Revision: 17 $
+ *              $Revision: 20 $
  *
  ******************************************************************************/
 
@@ -60,7 +60,7 @@ acpi_rs_io_resource (
        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);
@@ -119,7 +119,7 @@ acpi_rs_io_resource (
        /*
         * Set the Length parameter
         */
-       output_struct->length = struct_size;
+       output_struct->length = (u32) struct_size;
 
        /*
         * Return the final size of the structure
@@ -158,7 +158,7 @@ acpi_rs_fixed_io_resource (
        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);
@@ -193,7 +193,7 @@ acpi_rs_fixed_io_resource (
        /*
         * Set the Length parameter
         */
-       output_struct->length = struct_size;
+       output_struct->length = (u32) struct_size;
 
        /*
         * Return the final size of the structure
@@ -377,7 +377,7 @@ acpi_rs_dma_resource (
        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;
@@ -407,13 +407,18 @@ acpi_rs_dma_resource (
                        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
@@ -443,7 +448,7 @@ acpi_rs_dma_resource (
        /*
         * Set the Length parameter
         */
-       output_struct->length = struct_size;
+       output_struct->length = (u32) struct_size;
 
        /*
         * Return the final size of the structure
index fc9ea44cc328614357b872afde930008a21ab927..6ef919942e0234acad9ffe4108d1c8856be82729 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: rsirq - IRQ resource descriptors
- *              $Revision: 24 $
+ *              $Revision: 28 $
  *
  ******************************************************************************/
 
@@ -60,7 +60,7 @@ acpi_rs_irq_resource (
        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;
@@ -90,17 +90,23 @@ acpi_rs_irq_resource (
        /* 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
@@ -149,7 +155,7 @@ acpi_rs_irq_resource (
        /*
         * Set the Length parameter
         */
-       output_struct->length = struct_size;
+       output_struct->length = (u32) struct_size;
 
        /*
         * Return the final size of the structure
@@ -279,10 +285,10 @@ acpi_rs_extended_irq_resource (
        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);
 
@@ -351,8 +357,8 @@ acpi_rs_extended_irq_resource (
         * 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 */
 
@@ -367,7 +373,7 @@ acpi_rs_extended_irq_resource (
         * 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;
@@ -383,7 +389,7 @@ acpi_rs_extended_irq_resource (
                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 */
 
@@ -419,7 +425,7 @@ acpi_rs_extended_irq_resource (
        /*
         * Set the Length parameter
         */
-       output_struct->length = struct_size;
+       output_struct->length = (u32) struct_size;
 
        /*
         * Return the final size of the structure
@@ -470,7 +476,7 @@ acpi_rs_extended_irq_stream (
        /*
         * 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;
 
        /*
index 2ffd506f53aa0ca3435c4d4a03fc796ba42d42f8..28bb26bb52978188c5209ac0e4f427d48ed7e8c2 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: rslist - Linked list utilities
- *              $Revision: 26 $
+ *              $Revision: 30 $
  *
  ******************************************************************************/
 
@@ -70,6 +70,11 @@ acpi_rs_get_resource_type (
                 * Large Resource Type -- All bits are valid
                 */
                return (resource_start_byte);
+
+
+       default:
+               /* No other types of resource descriptor */
+               break;
        }
 
        return (0xFF);
@@ -99,7 +104,7 @@ acpi_rs_byte_stream_to_list (
        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;
@@ -111,7 +116,7 @@ acpi_rs_byte_stream_to_list (
 
 
        while (bytes_parsed < byte_stream_buffer_length &&
-                       FALSE == end_tag_processed) {
+                       !end_tag_processed) {
                /*
                 * The next byte in the stream is the resource type
                 */
@@ -265,9 +270,9 @@ acpi_rs_byte_stream_to_list (
 
                default:
                        /*
-                        * Invalid/Unknowns resource type
+                        * Invalid/Unknown resource type
                         */
-                       status = AE_AML_ERROR;
+                       status = AE_AML_INVALID_RESOURCE_TYPE;
                        break;
                }
 
@@ -288,7 +293,7 @@ acpi_rs_byte_stream_to_list (
                /*
                 * 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);
 
@@ -297,8 +302,8 @@ acpi_rs_byte_stream_to_list (
        /*
         * 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);
@@ -312,7 +317,7 @@ acpi_rs_byte_stream_to_list (
  * 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
@@ -329,7 +334,7 @@ acpi_rs_byte_stream_to_list (
 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;
index ef00af5183834bdcad180b8fa43f4f1051a8fd34..092cc52c149b2af4ae4e690de7f3dcf82cd4a27f 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: rsmem24 - Memory resource descriptors
- *              $Revision: 17 $
+ *              $Revision: 20 $
  *
  ******************************************************************************/
 
@@ -60,7 +60,7 @@ acpi_rs_memory24_resource (
        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);
@@ -76,7 +76,7 @@ acpi_rs_memory24_resource (
 
        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;
 
        /*
@@ -116,7 +116,7 @@ acpi_rs_memory24_resource (
        /*
         * Set the Length parameter
         */
-       output_struct->length = struct_size;
+       output_struct->length = (u32) struct_size;
 
        /*
         * Return the final size of the structure
@@ -237,7 +237,7 @@ acpi_rs_memory32_range_resource (
        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);
@@ -253,7 +253,7 @@ acpi_rs_memory32_range_resource (
 
        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;
 
@@ -303,7 +303,7 @@ acpi_rs_memory32_range_resource (
        /*
         * Set the Length parameter
         */
-       output_struct->length = struct_size;
+       output_struct->length = (u32) struct_size;
 
        /*
         * Return the final size of the structure
@@ -342,7 +342,7 @@ acpi_rs_fixed_memory32_resource (
        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);
@@ -358,7 +358,7 @@ acpi_rs_fixed_memory32_resource (
        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;
 
@@ -385,7 +385,7 @@ acpi_rs_fixed_memory32_resource (
        /*
         * Set the Length parameter
         */
-       output_struct->length = struct_size;
+       output_struct->length = (u32) struct_size;
 
        /*
         * Return the final size of the structure
index c253d41a322b66609d1d1b843d5b2d0953b173b4..4736517fea048b1bddba23a31a6500a1c5342b7c 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: rsmisc - Miscellaneous resource descriptors
- *              $Revision: 20 $
+ *              $Revision: 24 $
  *
  ******************************************************************************/
 
@@ -59,7 +59,7 @@ acpi_rs_end_tag_resource (
        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;
 
 
@@ -170,7 +170,7 @@ acpi_rs_vendor_resource (
        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;
@@ -197,7 +197,7 @@ acpi_rs_vendor_resource (
 
                /* Calculate bytes consumed */
 
-               *bytes_consumed = temp16 + 3;
+               *bytes_consumed = (ACPI_SIZE) temp16 + 3;
 
                /* Point to the first vendor byte */
 
@@ -211,7 +211,7 @@ acpi_rs_vendor_resource (
 
                /* Calculate bytes consumed */
 
-               *bytes_consumed = temp16 + 1;
+               *bytes_consumed = (ACPI_SIZE) temp16 + 1;
 
                /* Point to the first vendor byte */
 
@@ -236,7 +236,7 @@ acpi_rs_vendor_resource (
        /*
         * Set the Length parameter
         */
-       output_struct->length = struct_size;
+       output_struct->length = (u32) struct_size;
 
        /*
         * Return the final size of the structure
@@ -297,7 +297,7 @@ acpi_rs_vendor_stream (
                 * 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;
@@ -350,7 +350,7 @@ acpi_rs_start_depend_fns_resource (
        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);
 
@@ -380,7 +380,7 @@ acpi_rs_start_depend_fns_resource (
                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);
                }
 
                /*
@@ -389,7 +389,7 @@ acpi_rs_start_depend_fns_resource (
                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 {
@@ -403,7 +403,7 @@ acpi_rs_start_depend_fns_resource (
        /*
         * Set the Length parameter
         */
-       output_struct->length = struct_size;
+       output_struct->length = (u32) struct_size;
 
        /*
         * Return the final size of the structure
@@ -441,7 +441,7 @@ acpi_rs_end_depend_fns_resource (
        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;
 
 
@@ -461,7 +461,7 @@ acpi_rs_end_depend_fns_resource (
        /*
         * Set the Length parameter
         */
-       output_struct->length = struct_size;
+       output_struct->length = (u32) struct_size;
 
        /*
         * Return the final size of the structure
index c02750ae4c8553d0223cc107d537feb78e847e65..4484929cd30f88dbb9af1f9450ed7ac63c145ccd 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: rsutils - Utilities for the resource manager
- *              $Revision: 29 $
+ *              $Revision: 30 $
  *
  ******************************************************************************/
 
@@ -317,7 +317,7 @@ acpi_rs_set_srs_method_data (
        /*
         * 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;
 
index 16fe573ec00606fb15c0c527657913be64110eb9..e59889dd6b0d53f09d29ac1d6275e40233c09aab 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: rsxface - Public interfaces to the resource manager
- *              $Revision: 18 $
+ *              $Revision: 19 $
  *
  ******************************************************************************/
 
@@ -25,8 +25,6 @@
 
 
 #include "acpi.h"
-#include "acinterp.h"
-#include "acnamesp.h"
 #include "acresrc.h"
 
 #define _COMPONENT          ACPI_RESOURCES
index e2b284d6487200793b138f2fea9f33bd647a1b12..bc995a1efe5ebcfebf8c56bc6bca507097fd2e8b 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: tbconvrt - ACPI Table conversion utilities
- *              $Revision: 36 $
+ *              $Revision: 41 $
  *
  *****************************************************************************/
 
@@ -55,7 +55,7 @@ acpi_tb_get_table_count (
        ACPI_FUNCTION_ENTRY ();
 
 
-#ifndef _IA64
+#if ACPI_MACHINE_WIDTH != 64
 
        if (RSDP->revision < 2) {
                pointer_size = sizeof (u32);
@@ -93,7 +93,7 @@ acpi_tb_convert_to_xsdt (
        acpi_table_desc         *table_info,
        u32                     *number_of_tables)
 {
-       u32                     table_size;
+       ACPI_SIZE               table_size;
        u32                     i;
        xsdt_descriptor         *new_table;
 
@@ -107,7 +107,7 @@ acpi_tb_convert_to_xsdt (
 
        /* 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 */
 
@@ -119,7 +119,7 @@ acpi_tb_convert_to_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 */
 
@@ -149,6 +149,165 @@ acpi_tb_convert_to_xsdt (
 }
 
 
+/*******************************************************************************
+ *
+ * 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
@@ -170,8 +329,7 @@ acpi_tb_convert_to_xsdt (
 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;
 
 
@@ -182,97 +340,45 @@ acpi_tb_convert_table_fadt (void)
         * 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 */
@@ -282,10 +388,10 @@ acpi_tb_convert_table_fadt (void)
 
        /* 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 */
 
@@ -315,35 +421,42 @@ acpi_status
 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);
 }
 
 
index b367dbe55422732145df4669cd9361b0c01a0934..1b40b281321436742e61700ce687966fd806e92c 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * 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
@@ -112,10 +229,8 @@ 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
  *
@@ -130,7 +245,7 @@ acpi_tb_get_table (
 {
        acpi_table_header       *table_header = NULL;
        acpi_table_header       *full_table = NULL;
-       u32                     size;
+       ACPI_SIZE               size;
        u8                      allocation;
        acpi_status             status = AE_OK;
 
@@ -159,7 +274,7 @@ acpi_tb_get_table (
 
                /* 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 */
@@ -213,7 +328,6 @@ acpi_tb_get_table (
  * FUNCTION:    Acpi_tb_get_all_tables
  *
  * PARAMETERS:  Number_of_tables    - Number of tables to get
- *              Table_ptr           - Input buffer pointer, optional
  *
  * RETURN:      Status
  *
@@ -230,8 +344,7 @@ acpi_tb_get_table (
 
 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;
@@ -268,18 +381,23 @@ acpi_tb_get_all_tables (
 
                /* 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.
@@ -299,15 +417,17 @@ acpi_tb_get_all_tables (
 
        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);
        }
 
@@ -317,35 +437,30 @@ acpi_tb_get_all_tables (
         */
        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 */
@@ -428,7 +543,7 @@ acpi_tb_verify_rsdp (
 
        /* 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;
@@ -442,7 +557,7 @@ acpi_tb_verify_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);
 
 
@@ -508,7 +623,7 @@ acpi_status
 acpi_tb_validate_rsdt (
        acpi_table_header       *table_ptr)
 {
-       u32                     no_match;
+       int                     no_match;
 
 
        ACPI_FUNCTION_NAME ("Tb_validate_rsdt");
@@ -535,8 +650,9 @@ acpi_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);
        }
@@ -563,7 +679,7 @@ acpi_status
 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;
@@ -590,6 +706,9 @@ acpi_tb_get_table_pointer (
                        *table_ptr = address->pointer.logical;
                        *size = 0;
                        break;
+
+               default:
+                       return (AE_BAD_PARAMETER);
                }
        }
        else {
@@ -605,6 +724,9 @@ acpi_tb_get_table_pointer (
 
                        status = AE_BAD_PARAMETER;
                        break;
+
+               default:
+                       return (AE_BAD_PARAMETER);
                }
        }
 
@@ -636,26 +758,22 @@ acpi_tb_get_table_rsdt (
        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);
index a62063ea026a9b8c59d88458ad0d385590e8bd35..6d02e5702e3285dc0d1283af23c8988bfd3faa63 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: tbinstal - ACPI table installation and removal
- *              $Revision: 57 $
+ *              $Revision: 61 $
  *
  *****************************************************************************/
 
@@ -84,8 +84,7 @@ acpi_tb_match_signature (
  *
  * 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
  *
@@ -97,7 +96,6 @@ acpi_tb_match_signature (
 
 acpi_status
 acpi_tb_install_table (
-       acpi_table_header       *table_ptr,
        acpi_table_desc         *table_info)
 {
        acpi_status             status;
@@ -109,7 +107,7 @@ acpi_tb_install_table (
         * 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);
        }
@@ -137,8 +135,7 @@ acpi_tb_install_table (
  *
  * 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
  *
@@ -156,7 +153,6 @@ acpi_tb_install_table (
 
 acpi_status
 acpi_tb_recognize_table (
-       acpi_table_header       *table_ptr,
        acpi_table_desc         *table_info)
 {
        acpi_table_header       *table_header;
@@ -193,7 +189,7 @@ acpi_tb_recognize_table (
 
        /* 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,
@@ -201,12 +197,14 @@ acpi_tb_recognize_table (
         */
        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);
@@ -497,6 +495,9 @@ acpi_tb_delete_single_table (
 
                        acpi_os_unmap_memory (table_desc->base_pointer, table_desc->length);
                        break;
+
+               default:
+                       break;
                }
        }
 }
@@ -508,7 +509,7 @@ acpi_tb_delete_single_table (
  *
  * 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.
@@ -523,7 +524,7 @@ acpi_tb_uninstall_table (
        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) {
index 170d7f5f3e9bd9d0107ddaf3674a90d60beb33d0..04cb51e4d3f5115dc5a8cb6a5756ecebfc5cc0b1 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: tbutils - Table manipulation utilities
- *              $Revision: 51 $
+ *              $Revision: 53 $
  *
  *****************************************************************************/
 
@@ -26,7 +26,6 @@
 
 #include "acpi.h"
 #include "actables.h"
-#include "acinterp.h"
 
 
 #define _COMPONENT          ACPI_TABLES
@@ -116,7 +115,7 @@ acpi_tb_validate_table_header (
 
        /* 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",
@@ -162,11 +161,11 @@ acpi_tb_validate_table_header (
 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;
 
 
@@ -186,7 +185,7 @@ acpi_tb_map_acpi_table (
 
                /* 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.
@@ -255,7 +254,7 @@ acpi_tb_verify_table_checksum (
 
        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;
        }
index d5114143c6d4f77068b6aac483e9ba7e3ff3b2cc..99de3856c5ee4ebf1bbc2c3739dba4be0e4c1bca 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Module Name: tbxface - Public interfaces to the ACPI subsystem
  *                         ACPI table oriented interfaces
- *              $Revision: 52 $
+ *              $Revision: 57 $
  *
  *****************************************************************************/
 
@@ -27,7 +27,6 @@
 
 #include "acpi.h"
 #include "acnamesp.h"
-#include "acinterp.h"
 #include "actables.h"
 
 
@@ -91,7 +90,7 @@ acpi_load_tables (void)
 
        /* 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)));
@@ -165,7 +164,7 @@ acpi_load_table (
 
        /* 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 */
 
@@ -196,7 +195,7 @@ acpi_load_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);
@@ -358,7 +357,7 @@ acpi_get_table (
 {
        acpi_table_header       *tbl_ptr;
        acpi_status             status;
-       u32                     table_length;
+       ACPI_SIZE               table_length;
 
 
        ACPI_FUNCTION_TRACE ("Acpi_get_table");
@@ -408,7 +407,7 @@ 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 */
index fdb384cbc2d3c1a21d8a49c27c0ebe0901a02cf2..f49b2bbdbcc12df91bbff5df29c6a962b2515355 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: tbxfroot - Find the root ACPI table (RSDT)
- *              $Revision: 61 $
+ *              $Revision: 63 $
  *
  *****************************************************************************/
 
@@ -123,8 +123,8 @@ acpi_get_firmware_table (
        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;
@@ -187,16 +187,16 @@ acpi_get_firmware_table (
                }
        }
 
-       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);
@@ -272,7 +272,7 @@ cleanup:
 
 /* TBD: Move to a new file */
 
-#ifndef _IA16
+#if ACPI_MACHINE_WIDTH != 16
 
 /*******************************************************************************
  *
@@ -417,7 +417,7 @@ acpi_tb_find_rsdp (
                        /* 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);
@@ -439,7 +439,7 @@ acpi_tb_find_rsdp (
                        /* 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);
index 6c36604eafec2cd573e777ddbfbc59050b789dea..bfce4d9aa1bc99821bc51186bee6b93deb9d0609 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * 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")
@@ -77,11 +73,11 @@ acpi_ut_release_to_cache (
                /* 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++;
 
@@ -128,7 +124,7 @@ acpi_ut_acquire_from_cache (
                /* 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--;
@@ -191,7 +187,7 @@ acpi_ut_delete_generic_cache (
        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;
@@ -362,7 +358,7 @@ acpi_ut_allocate (
                /* 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);
        }
@@ -412,7 +408,7 @@ acpi_ut_callocate (
                /* 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);
        }
 
@@ -514,7 +510,7 @@ acpi_ut_callocate_and_track (
                /* 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);
        }
 
@@ -555,6 +551,7 @@ acpi_ut_free_and_track (
        u32                     line)
 {
        acpi_debug_mem_block    *debug_block;
+       acpi_status             status;
 
 
        ACPI_FUNCTION_TRACE_PTR ("Ut_free", allocation);
@@ -567,14 +564,19 @@ acpi_ut_free_and_track (
                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));
@@ -864,6 +866,7 @@ acpi_ut_dump_allocations (
        NATIVE_CHAR             *module)
 {
        acpi_debug_mem_block    *element;
+       ACPI_DESCRIPTOR         *descriptor;
        u32                     num_outstanding = 0;
 
 
@@ -883,28 +886,29 @@ acpi_ut_dump_allocations (
                        ((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:
@@ -946,6 +950,10 @@ acpi_ut_dump_allocations (
                                case ACPI_DESC_TYPE_STATE_THREAD:
                                        acpi_os_printf ("THREAD State_obj");
                                        break;
+
+                               default:
+                                       /* All types should appear above */
+                                       break;
                                }
 
                                acpi_os_printf ( "\n");
@@ -961,7 +969,7 @@ acpi_ut_dump_allocations (
 
        if (!num_outstanding) {
                ACPI_DEBUG_PRINT ((ACPI_DB_OK,
-                               "No outstanding allocations.\n"));
+                       "No outstanding allocations.\n"));
        }
        else {
                ACPI_DEBUG_PRINT ((ACPI_DB_OK,
index 4e2f9fb72691f27c93649f2ad60088bc2adf5abe..f6822fe5d79da621eed422aa8aecb1c69e8c4aab 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: utcopy - Internal to external object translation utilities
- *              $Revision: 95 $
+ *              $Revision: 98 $
  *
  *****************************************************************************/
 
@@ -25,7 +25,6 @@
 
 
 #include "acpi.h"
-#include "acinterp.h"
 #include "acnamesp.h"
 #include "amlcode.h"
 
@@ -92,10 +91,10 @@ acpi_ut_copy_isimple_to_esimple (
 
                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;
 
 
@@ -153,12 +152,12 @@ acpi_ut_copy_isimple_to_esimple (
                        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;
 
@@ -257,7 +256,7 @@ acpi_ut_copy_ielement_to_eelement (
                 */
                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
@@ -269,7 +268,7 @@ acpi_ut_copy_ielement_to_eelement (
                 * 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;
 
 
@@ -319,7 +318,7 @@ acpi_ut_copy_ipackage_to_epackage (
        /*
         * 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
@@ -331,7 +330,7 @@ acpi_ut_copy_ipackage_to_epackage (
 
        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
@@ -456,7 +455,7 @@ acpi_ut_copy_esimple_to_isimple (
 
        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);
                }
@@ -488,6 +487,10 @@ acpi_ut_copy_esimple_to_isimple (
 
                internal_object->integer.value  = external_object->integer.value;
                break;
+
+       default:
+               /* Other types can't get here */
+               break;
        }
 
        *ret_internal_object = internal_object;
@@ -657,6 +660,7 @@ acpi_ut_copy_simple_object (
                dest_desc->common.flags = source_desc->common.flags;
 
                /* Fall through to common string/buffer case */
+               /*lint -fallthrough */
 
        case ACPI_TYPE_STRING:
 
@@ -677,6 +681,10 @@ acpi_ut_copy_simple_object (
                                          source_desc->string.length);
                }
                break;
+
+       default:
+               /* Nothing to do for other simple objects */
+               break;
        }
 
        return (AE_OK);
@@ -803,7 +811,7 @@ acpi_ut_copy_ipackage_to_ipackage (
        /*
         * 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 (
index 2033175edb25720ace910e6234c43dfd9a818cef..e47e29fb68969b0c25ed0d7577070a6efa52426e 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * 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-";
+
 
 /*****************************************************************************
  *
@@ -132,7 +131,6 @@ acpi_ut_debug_print (
                return;
        }
 
-
        /*
         * Thread tracking and context switch notification
         */
@@ -151,14 +149,13 @@ acpi_ut_debug_print (
         * 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);
@@ -202,7 +199,6 @@ acpi_ut_debug_print_raw (
        }
 
        va_start (args, format);
-
        acpi_os_vprintf (format, args);
 }
 
@@ -495,8 +491,8 @@ acpi_ut_dump_buffer (
        u32                     display,
        u32                     component_id)
 {
-       u32                     i = 0;
-       u32                     j;
+       NATIVE_UINT             i = 0;
+       NATIVE_UINT             j;
        u32                     temp32;
        u8                      buf_char;
 
@@ -512,7 +508,7 @@ acpi_ut_dump_buffer (
                display = DB_BYTE_DISPLAY;
        }
 
-       acpi_os_printf ("\n_offset Value\n");
+       acpi_os_printf ("\nOffset Value\n");
 
        /*
         * Nasty little dump buffer routine!
@@ -522,7 +518,6 @@ acpi_ut_dump_buffer (
 
                acpi_os_printf ("%05X  ", i);
 
-
                /* Print 16 hex chars */
 
                for (j = 0; j < 16;) {
@@ -576,12 +571,10 @@ acpi_ut_dump_buffer (
                        }
                }
 
-
                /*
                 * 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");
index 30631f8987c04eb1563c34dbc17559466ee430b6..f064c05b6391c489980cb3e4bcf9cce65bb7e0c0 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: utdelete - object deletion and reference count utilities
- *              $Revision: 88 $
+ *              $Revision: 90 $
  *
  ******************************************************************************/
 
@@ -27,8 +27,6 @@
 #include "acpi.h"
 #include "acinterp.h"
 #include "acnamesp.h"
-#include "actables.h"
-#include "acparser.h"
 
 #define _COMPONENT          ACPI_UTILITIES
         ACPI_MODULE_NAME    ("utdelete")
@@ -114,7 +112,7 @@ acpi_ut_delete_internal_obj (
                        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;
 
 
@@ -123,7 +121,7 @@ acpi_ut_delete_internal_obj (
                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;
 
@@ -135,7 +133,7 @@ acpi_ut_delete_internal_obj (
                /* 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;
@@ -205,14 +203,14 @@ acpi_ut_delete_internal_obj (
  *
  * 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)
 {
@@ -231,7 +229,7 @@ acpi_ut_delete_internal_object_list (
        /* Free the combined parameter pointer list and object array */
 
        ACPI_MEM_FREE (obj_list);
-       return_ACPI_STATUS (AE_OK);
+       return_VOID;
 }
 
 
@@ -411,7 +409,7 @@ acpi_ut_update_object_reference (
                        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);
@@ -448,7 +446,7 @@ acpi_ut_update_object_reference (
                                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;
@@ -458,9 +456,8 @@ acpi_ut_update_object_reference (
 
                        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;
 
@@ -470,7 +467,7 @@ acpi_ut_update_object_reference (
                        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;
 
@@ -480,13 +477,13 @@ acpi_ut_update_object_reference (
                        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;
 
@@ -496,19 +493,20 @@ acpi_ut_update_object_reference (
                        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;
@@ -527,6 +525,14 @@ acpi_ut_update_object_reference (
        }
 
        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);
 }
 
 
@@ -561,7 +567,7 @@ acpi_ut_add_reference (
        /*
         * 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;
 }
 
@@ -610,7 +616,7 @@ acpi_ut_remove_reference (
         * 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;
 }
 
index a4d5db47ce6e041f0a3415c2b6e42ccc016aff81..bb9a36ec4401cc1ab304a0a87f3605504794ecb1 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: uteval - Object evaluation
- *              $Revision: 38 $
+ *              $Revision: 39 $
  *
  *****************************************************************************/
 
@@ -69,11 +69,11 @@ acpi_ut_evaluate_numeric_object (
        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)));
                }
 
@@ -148,11 +148,11 @@ acpi_ut_execute_HID (
        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);
@@ -231,11 +231,11 @@ acpi_ut_execute_CID (
        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);
@@ -325,12 +325,12 @@ acpi_ut_execute_UID (
        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);
@@ -411,7 +411,7 @@ acpi_ut_execute_STA (
        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;
@@ -419,7 +419,7 @@ acpi_ut_execute_STA (
 
        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)));
        }
 
index 7968a23b884f236b3d59bd9ef095d2a486f850f0..6bfb8bfc706b2cb7752ca77a383a697104e3be10 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * 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")
@@ -180,15 +176,15 @@ const NATIVE_CHAR           *acpi_gbl_db_sleep_states[ACPI_NUM_SLEEP_STATES] = {
  */
 
 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 */
 };
 
 
@@ -243,9 +239,9 @@ const u8                        acpi_gbl_ns_properties[] =
 
 /* 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'};
 
 /*****************************************************************************
  *
@@ -261,7 +257,7 @@ const NATIVE_CHAR           acpi_gbl_hex_to_ascii[] =
  *
  ****************************************************************************/
 
-u8
+char
 acpi_ut_hex_to_ascii_char (
        acpi_integer            integer,
        u32                     position)
@@ -361,7 +357,7 @@ acpi_fixed_event_info       acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] =
 
 /* 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",
@@ -407,7 +403,7 @@ acpi_ut_get_region_name (
 
 /* 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",
@@ -431,7 +427,7 @@ acpi_ut_get_event_name (
 }
 
 
-#ifdef ACPI_DEBUG
+#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER)
 
 /*
  * Strings and procedures used for debug only
@@ -545,16 +541,21 @@ acpi_ut_get_type_name (
 }
 
 
+/* 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",
@@ -568,7 +569,7 @@ const NATIVE_CHAR *acpi_gbl_match_ops[NUM_MATCH_OPS] =
 
 /* 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",
@@ -581,12 +582,13 @@ const NATIVE_CHAR *acpi_gbl_access_types[NUM_ACCESS_TYPES] =
 
 /* 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
 
@@ -670,6 +672,9 @@ acpi_ut_allocate_owner_id (
                        acpi_gbl_next_method_owner_id = ACPI_FIRST_METHOD_ID;
                }
                break;
+
+       default:
+               break;
        }
 
        (void) acpi_ut_release_mutex (ACPI_MTX_CACHES);
@@ -702,15 +707,15 @@ acpi_ut_init_globals (
        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);
 
@@ -753,6 +758,7 @@ acpi_ut_init_globals (
 
        acpi_gbl_sys_notify.handler         = NULL;
        acpi_gbl_drv_notify.handler         = NULL;
+       acpi_gbl_init_handler               = NULL;
 
        /* Global "typed" ACPI table pointers */
 
@@ -802,7 +808,7 @@ acpi_ut_init_globals (
 
 
 #ifdef ACPI_DEBUG
-       acpi_gbl_lowest_stack_pointer       = ACPI_UINT32_MAX;
+       acpi_gbl_lowest_stack_pointer       = ACPI_SIZE_MAX;
 #endif
 
        return_VOID;
index 108b922126142ecc0032e098c2255982f1d8e97a..262d5374539d1110cb21813d3e70441a1e8eb016 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: utinit - Common ACPI subsystem initialization
- *              $Revision: 109 $
+ *              $Revision: 112 $
  *
  *****************************************************************************/
 
@@ -25,7 +25,6 @@
 
 
 #include "acpi.h"
-#include "achware.h"
 #include "acnamesp.h"
 #include "acevents.h"
 
@@ -56,7 +55,7 @@ acpi_ut_fadt_register_error (
 {
 
        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));
 }
 
@@ -181,7 +180,7 @@ acpi_ut_terminate (void)
  *
  ******************************************************************************/
 
-acpi_status
+void
 acpi_ut_subsystem_shutdown (void)
 {
 
@@ -191,7 +190,7 @@ 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 */
@@ -213,7 +212,7 @@ acpi_ut_subsystem_shutdown (void)
 
        /* Purge the local caches */
 
-       acpi_purge_cached_objects ();
+       (void) acpi_purge_cached_objects ();
 
        /* Debug only - display leftover memory allocation, if any */
 
@@ -221,7 +220,7 @@ acpi_ut_subsystem_shutdown (void)
        acpi_ut_dump_allocations (ACPI_UINT32_MAX, NULL);
 #endif
 
-       return_ACPI_STATUS (AE_OK);
+       return_VOID;
 }
 
 
index 85caf3e3999a4211e0f6bc00cbe69e4a7e0eca1c..708564435aba2003125cd3f4e11b2e6f6c8071d8 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: utmath - Integer math support routines
- *              $Revision: 10 $
+ *              $Revision: 11 $
  *
  ******************************************************************************/
 
@@ -193,7 +193,7 @@ acpi_ut_divide (
                 */
                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;
@@ -213,8 +213,8 @@ acpi_ut_divide (
                        }
 
                        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--;
index 72d24b04bc4146907952b5930c5d5b5d994a296f..bcab6fd234edfae00fc71ffea1b32c77f5e63ebd 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * 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
 /*******************************************************************************
  *
@@ -143,6 +209,152 @@ acpi_ut_valid_acpi_character (
 }
 
 
+/*******************************************************************************
+ *
+ * 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 (&dividend, base, &quotient, 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
@@ -239,7 +451,7 @@ acpi_ut_mutex_terminate (
         * 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;
@@ -933,6 +1145,10 @@ acpi_ut_resolve_reference (
                                source_object->common.type = ACPI_TYPE_INTEGER;
                                source_object->integer.value = ACPI_INTEGER_MAX;
                                break;
+
+                       default:
+                               /* Other types not supported */
+                               return (AE_SUPPORT);
                        }
                }
                break;
@@ -945,6 +1161,9 @@ acpi_ut_resolve_reference (
                info->num_packages++;
                state->pkg.this_target_obj = NULL;
                break;
+
+       default:
+               return (AE_BAD_PARAMETER);
        }
 
        return (AE_OK);
@@ -1040,7 +1259,7 @@ acpi_ut_walk_package_tree (
                 *    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);
index 600f648628233112f86f3d915068c4d723049dc0..90e7cc213d7d60e13d8fa3325479e9f057e73d28 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: utobject - ACPI object create/delete/size/cache routines
- *              $Revision: 68 $
+ *              $Revision: 73 $
  *
  *****************************************************************************/
 
@@ -25,9 +25,7 @@
 
 
 #include "acpi.h"
-#include "acinterp.h"
 #include "acnamesp.h"
-#include "actables.h"
 #include "amlcode.h"
 
 
@@ -97,6 +95,10 @@ acpi_ut_create_internal_object_dbg (
 
                object->common.next_object = second_object;
                break;
+
+       default:
+               /* All others have no secondary object */
+               break;
        }
 
        /* Save the object type in the object descriptor */
@@ -142,7 +144,7 @@ acpi_ut_valid_internal_object (
        /* 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  */
 
@@ -210,10 +212,10 @@ acpi_ut_allocate_object_desc_dbg (
 
        /* 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);
 }
@@ -240,7 +242,7 @@ acpi_ut_delete_object_desc (
 
        /* 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;
@@ -337,13 +339,13 @@ acpi_ut_get_simple_object_size (
 
        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;
 
 
@@ -461,6 +463,13 @@ acpi_ut_get_element_length (
                info->num_packages++;
                state->pkg.this_target_obj = NULL;
                break;
+
+
+       default:
+
+               /* No other types allowed */
+
+               return (AE_BAD_PARAMETER);
        }
 
        return (status);
@@ -512,7 +521,7 @@ acpi_ut_get_package_object_size (
         * 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 */
 
@@ -546,7 +555,7 @@ acpi_ut_get_object_size(
        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);
        }
index 38e7b31840c51d4a2e408e1a5ec062ce96540a41..df3a71f5d57c9586b0d537ec4853aded19e8432e 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * 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")
@@ -102,7 +97,7 @@ acpi_initialize_subsystem (
 
        /* If configured, initialize the AML debugger */
 
-       ACPI_DEBUGGER_EXEC (acpi_db_initialize ());
+       ACPI_DEBUGGER_EXEC (status = acpi_db_initialize ());
 
        return_ACPI_STATUS (status);
 }
@@ -139,7 +134,7 @@ acpi_enable_subsystem (
        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);
                }
@@ -251,6 +246,9 @@ acpi_enable_subsystem (
 acpi_status
 acpi_terminate (void)
 {
+       acpi_status         status;
+
+
        ACPI_FUNCTION_TRACE ("Acpi_terminate");
 
 
@@ -277,10 +275,8 @@ acpi_terminate (void)
 
        /* Now we can shutdown the OS-dependent layer */
 
-       acpi_os_terminate ();
-
-
-       return_ACPI_STATUS (AE_OK);
+       status = acpi_os_terminate ();
+       return_ACPI_STATUS (status);
 }
 
 
@@ -399,6 +395,39 @@ acpi_get_system_info (
 }
 
 
+/*****************************************************************************
+ *
+ * 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