]> git.hungrycats.org Git - linux/commitdiff
v2.4.9.15 -> v2.4.10
authorLinus Torvalds <torvalds@athlon.transmeta.com>
Tue, 5 Feb 2002 04:19:51 +0000 (20:19 -0800)
committerLinus Torvalds <torvalds@athlon.transmeta.com>
Tue, 5 Feb 2002 04:19:51 +0000 (20:19 -0800)
  - Andrew Grover: ACPI update
  - Al Viro: block devices..
  - Andrea Arcangeli: fix list manipulation bogosity
  - Trond Myklebust: 64-bit file locking fixes
  - Brad Hards: USB CDC ethernet
  - Chris Mason: reiserfs speedup
  - Robert Love: re-merge AMD 761 GART support that was lost in -ac merge
  - Adam Richter: check pci_module_init() return value

205 files changed:
Documentation/Configure.help
MAINTAINERS
Makefile
drivers/acpi/Makefile
drivers/acpi/acpi_ksyms.c
drivers/acpi/debugger/Makefile [new file with mode: 0644]
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/dswscope.c
drivers/acpi/dispatcher/dswstate.c
drivers/acpi/driver.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/exdyadic.c
drivers/acpi/executer/exfield.c
drivers/acpi/executer/exfldio.c
drivers/acpi/executer/exmisc.c
drivers/acpi/executer/exmonad.c
drivers/acpi/executer/exmutex.c
drivers/acpi/executer/exnames.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/executer/exxface.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/acoutput.h
drivers/acpi/include/acparser.h
drivers/acpi/include/acpiosxf.h
drivers/acpi/include/acpixf.h
drivers/acpi/include/acresrc.h
drivers/acpi/include/acstruct.h
drivers/acpi/include/actables.h
drivers/acpi/include/actbl.h
drivers/acpi/include/actbl1.h
drivers/acpi/include/actbl2.h
drivers/acpi/include/actbl71.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/kdb/README.txt [new file with mode: 0644]
drivers/acpi/kdb/kdbm_acpi.c [new file with mode: 0644]
drivers/acpi/namespace/nsaccess.c
drivers/acpi/namespace/nsalloc.c
drivers/acpi/namespace/nsdump.c [new file with mode: 0644]
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/os.c
drivers/acpi/ospm/ac_adapter/ac.c
drivers/acpi/ospm/ac_adapter/ac_osl.c
drivers/acpi/ospm/battery/bt.c
drivers/acpi/ospm/battery/bt_osl.c
drivers/acpi/ospm/busmgr/bm.c
drivers/acpi/ospm/busmgr/bm_osl.c
drivers/acpi/ospm/busmgr/bmdriver.c
drivers/acpi/ospm/busmgr/bmnotify.c
drivers/acpi/ospm/busmgr/bmpm.c
drivers/acpi/ospm/busmgr/bmpower.c
drivers/acpi/ospm/busmgr/bmrequest.c
drivers/acpi/ospm/busmgr/bmsearch.c
drivers/acpi/ospm/busmgr/bmutils.c
drivers/acpi/ospm/button/bn.c
drivers/acpi/ospm/button/bn_osl.c
drivers/acpi/ospm/ec/ec_osl.c
drivers/acpi/ospm/ec/ecgpe.c
drivers/acpi/ospm/ec/ecmain.c
drivers/acpi/ospm/ec/ecspace.c
drivers/acpi/ospm/ec/ectransx.c
drivers/acpi/ospm/include/ac.h
drivers/acpi/ospm/include/bm.h
drivers/acpi/ospm/include/bmpower.h
drivers/acpi/ospm/include/bn.h
drivers/acpi/ospm/include/bt.h
drivers/acpi/ospm/include/ec.h
drivers/acpi/ospm/include/pr.h
drivers/acpi/ospm/include/sm.h
drivers/acpi/ospm/include/tz.h
drivers/acpi/ospm/processor/pr.c
drivers/acpi/ospm/processor/pr_osl.c
drivers/acpi/ospm/processor/prperf.c
drivers/acpi/ospm/processor/prpower.c
drivers/acpi/ospm/system/sm.c
drivers/acpi/ospm/system/sm_osl.c
drivers/acpi/ospm/thermal/tz.c
drivers/acpi/ospm/thermal/tz_osl.c
drivers/acpi/ospm/thermal/tzpolicy.c
drivers/acpi/parser/psargs.c
drivers/acpi/parser/psfind.c [deleted file]
drivers/acpi/parser/psopcode.c
drivers/acpi/parser/psparse.c
drivers/acpi/parser/psscope.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/utmisc.c
drivers/acpi/utilities/utobject.c
drivers/acpi/utilities/utxface.c
drivers/atm/firestream.c
drivers/block/rd.c
drivers/char/Config.in
drivers/char/agp/agp.h
drivers/char/agp/agpgart_be.c
drivers/ide/hptraid.c
drivers/ide/pdcraid.c
drivers/net/irda/toshoboe.c
drivers/sound/maestro.c
drivers/usb/CDCEther.c
drivers/usb/CDCEther.h
drivers/usb/Config.in
drivers/usb/Makefile
drivers/usb/acm.c
fs/block_dev.c
fs/lockd/clntproc.c
fs/lockd/xdr.c
fs/locks.c
fs/nfs/file.c
fs/reiserfs/journal.c
include/linux/acpi.h
include/linux/agp_backend.h
include/linux/fcntl.h
include/linux/fs.h
mm/vmscan.c

index f89cbef0309c2d1665abfdb9be9bec8279f8e449..dcb1390f6568895f28231ad46ee2828a51dd3c15 100644 (file)
@@ -2578,10 +2578,10 @@ CONFIG_AGP_VIA
   the GLX component for XFree86 3.3.6, which can be downloaded from
   http://utah-glx.sourceforge.net/ .
 
-AMD Irongate support
+AMD Irongate, 761, and 762 support
 CONFIG_AGP_AMD
   This option gives you AGP support for the GLX component of the
-  XFree86 4.x on AMD Irongate and 761 chipsets.
+  XFree86 4.x on AMD Irongate, 761, and 762 chipsets.
 
   For the moment, you should probably say N, unless you want to test
   the GLX component for XFree86 3.3.6, which can be downloaded from
@@ -11572,6 +11572,29 @@ CONFIG_USB_CATC
   The module will be called catc.o. If you want to compile it as a
   module, say M here and read <file:Documentation/modules.txt>.
 
+USB Communication Class Ethernet driver
+CONFIG_USB_CDCETHER
+  This driver supports devices conforming to the Communication Device
+  Class Ethernet Control Model.  This is used in some cable modems.
+  For more details on the specification, get the Communication Device
+  Class specification from <http://www.usb.org>.
+
+  This driver should work with the following devices:
+        * Ericsson PipeRider (all variants)
+        * Motorola (DM100 and SB4100)
+        * Broadcom Cable Modem (reference design)
+        * Toshiba PCX1100U and possibly other cable modems
+
+  The device creates a network device (ethX, where X depends on what
+  other networking devices you have in use), as for a normal PCI
+  or ISA based ethernet network card.
+
+  This code is also available as a module ( = code which can be
+  inserted in and removed from the running kernel whenever you want).
+  The module will be called CDCEther.o.  If you want to compile it as
+  a module, say M here and read <file:Documentation/modules.txt>.
+
+
 USB Kodak DC-2xx Camera support
 CONFIG_USB_DC2XX
   Say Y here if you want to connect this type of still camera to
index 536fca6721e2434c15db0178f40afb32451e7261..19fd52b67e9f9b2e47f5c7bbef677c531535b0a2 100644 (file)
@@ -1458,7 +1458,7 @@ W:        http://www.kroah.com/linux-usb/
 
 USB CDC ETHERNET DRIVER
 P:     Brad Hards
-M:     bhards@bigpond.net.au
+M:     bradh@frogmouth.net
 L:     linux-usb-users@lists.sourceforge.net
 L:     linux-usb-devel@lists.sourceforge.net
 S:     Maintained
@@ -1481,7 +1481,7 @@ S:        Maintained
 
 USB KAWASAKI LSI DRIVER
 P:     Brad Hards
-M:     bhards@bigpond.net.au
+M:     bradh@frogmouth.net
 L:     linux-usb-users@lists.sourceforge.net
 L:     linux-usb-devel@lists.sourceforge.net
 S:     Maintained
index 447e51566b590c89f04e6a86c9ef9e906a8cb4de..708e8964dfeaabbe24bef1d1023213dccc100b2d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 4
 SUBLEVEL = 10
-EXTRAVERSION =-pre15
+EXTRAVERSION =
 
 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 
index 00989cdff43c9eaeb47a6a3ca851178c692662c8..5524a916230a1f988931b697edc88830dc874c03 100644 (file)
@@ -1,6 +1,5 @@
 #
 # Makefile for the Linux ACPI interpreter
-# (It's a mess, but it's all here for a reason.)
 # 
 
 O_TARGET := acpi.o
@@ -22,9 +21,12 @@ acpi-subdirs := utilities dispatcher events hardware \
                executer namespace parser resources tables
 
 ifdef CONFIG_ACPI_DEBUG
-  ACPI_CFLAGS += -DACPI_DEBUG -Wno-unused #-DENABLE_DEBUGGER
+  ACPI_CFLAGS += -DACPI_DEBUG -Wno-unused
+endif
 
-  #acpi-subdirs += debugger
+ifdef CONFIG_ACPI_DEBUGGER
+  ACPI_CFLAGS += -DENABLE_DEBUGGER
+  acpi-subdirs += debugger
 endif
 
 EXTRA_CFLAGS += $(ACPI_CFLAGS)
index 16adf02369db5d5aa555981ad880744e17a903b3..c9192460d64dabb19c76ed2758eaf8b4ec4343af 100644 (file)
@@ -38,26 +38,19 @@ EXPORT_SYMBOL(acpi_in_debugger);
 EXPORT_SYMBOL(acpi_db_user_commands);
 #endif
 
+EXPORT_SYMBOL(acpi_gbl_FADT);
+
 EXPORT_SYMBOL(acpi_os_free);
-EXPORT_SYMBOL(acpi_os_breakpoint);
 EXPORT_SYMBOL(acpi_os_printf);
 EXPORT_SYMBOL(acpi_os_callocate);
 EXPORT_SYMBOL(acpi_os_sleep);
-EXPORT_SYMBOL(acpi_os_sleep_usec);
-EXPORT_SYMBOL(acpi_os_in8);
-EXPORT_SYMBOL(acpi_os_out8);
+EXPORT_SYMBOL(acpi_os_stall);
 EXPORT_SYMBOL(acpi_os_queue_for_execution);
 
 EXPORT_SYMBOL(acpi_dbg_layer);
 EXPORT_SYMBOL(acpi_dbg_level);
-EXPORT_SYMBOL(function_exit);
-EXPORT_SYMBOL(function_trace);
-EXPORT_SYMBOL(function_status_exit);
-EXPORT_SYMBOL(function_value_exit);
-EXPORT_SYMBOL(debug_print_raw);
-EXPORT_SYMBOL(debug_print_prefix);
 
-EXPORT_SYMBOL(acpi_ut_format_exception);
+EXPORT_SYMBOL(acpi_format_exception);
 
 EXPORT_SYMBOL(acpi_get_handle);
 EXPORT_SYMBOL(acpi_get_parent);
@@ -96,11 +89,20 @@ EXPORT_SYMBOL(acpi_os_create_semaphore);
 EXPORT_SYMBOL(acpi_os_delete_semaphore);
 EXPORT_SYMBOL(acpi_os_wait_semaphore);
 
-EXPORT_SYMBOL(acpi_os_in32);
-EXPORT_SYMBOL(acpi_os_out32);
+EXPORT_SYMBOL(acpi_os_read_port);
+EXPORT_SYMBOL(acpi_os_write_port);
+
 EXPORT_SYMBOL(acpi_fadt);
 EXPORT_SYMBOL(acpi_hw_register_bit_access);
 EXPORT_SYMBOL(acpi_hw_obtain_sleep_type_register_data);
 EXPORT_SYMBOL(acpi_enter_sleep_state);
 EXPORT_SYMBOL(acpi_get_system_info);
+EXPORT_SYMBOL(acpi_leave_sleep_state);
+/*EXPORT_SYMBOL(acpi_save_state_mem);*/
+/*EXPORT_SYMBOL(acpi_save_state_disk);*/
+EXPORT_SYMBOL(acpi_hw_register_read);
+EXPORT_SYMBOL(acpi_set_firmware_waking_vector);
+EXPORT_SYMBOL(acpi_subsystem_status);
+
 
+EXPORT_SYMBOL(acpi_os_signal);
diff --git a/drivers/acpi/debugger/Makefile b/drivers/acpi/debugger/Makefile
new file mode 100644 (file)
index 0000000..0714c08
--- /dev/null
@@ -0,0 +1,12 @@
+#
+# Makefile for all Linux ACPI interpreter subdirectories
+# EXCEPT for the ospm directory
+#
+
+O_TARGET := $(notdir $(CURDIR)).o
+
+obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c))
+
+EXTRA_CFLAGS += $(ACPI_CFLAGS)
+
+include $(TOPDIR)/Rules.make
index 44fc6ea61cff6e565e7000c807807763c5d3d942..e3c193759dae252c2ee0c8cedc109697ef9566c4 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: dbcmds - debug commands and output routines
- *              $Revision: 60 $
+ *              $Revision: 65 $
  *
  ******************************************************************************/
 
@@ -47,7 +47,7 @@
  * These object types map directly to the ACPI_TYPES
  */
 
-ARGUMENT_INFO               acpi_db_object_types [] =
+ARGUMENT_INFO         acpi_db_object_types [] =
 { {"ANY"},
        {"NUMBERS"},
        {"STRINGS"},
@@ -81,15 +81,15 @@ ARGUMENT_INFO               acpi_db_object_types [] =
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_db_walk_for_references (
-       ACPI_HANDLE             obj_handle,
+       acpi_handle             obj_handle,
        u32                     nesting_level,
        void                    *context,
        void                    **return_value)
 {
-       ACPI_OPERAND_OBJECT     *obj_desc = (ACPI_OPERAND_OBJECT *) context;
-       ACPI_NAMESPACE_NODE     *node = (ACPI_NAMESPACE_NODE *) obj_handle;
+       acpi_operand_object     *obj_desc = (acpi_operand_object *) context;
+       acpi_namespace_node     *node = (acpi_namespace_node *) obj_handle;
 
 
        /* Check for match against the namespace node itself */
@@ -131,12 +131,12 @@ void
 acpi_db_find_references (
        NATIVE_CHAR             *object_arg)
 {
-       ACPI_OPERAND_OBJECT     *obj_desc;
+       acpi_operand_object     *obj_desc;
 
 
        /* Convert string to object pointer */
 
-       obj_desc = (ACPI_OPERAND_OBJECT *) STRTOUL (object_arg, NULL, 16);
+       obj_desc = (acpi_operand_object *) STRTOUL (object_arg, NULL, 16);
 
        /* Search all nodes in namespace */
 
@@ -221,13 +221,14 @@ acpi_db_unload_acpi_table (
        NATIVE_CHAR             *instance_arg)
 {
        u32                     i;
-       ACPI_STATUS             status;
+       acpi_status             status;
 
 
        /* Search all tables for the target type */
 
        for (i = 0; i < NUM_ACPI_TABLES; i++) {
-               if (!STRNCMP (table_arg, acpi_gbl_acpi_table_data[i].signature, acpi_gbl_acpi_table_data[i].sig_length)) {
+               if (!STRNCMP (table_arg, acpi_gbl_acpi_table_data[i].signature,
+                               acpi_gbl_acpi_table_data[i].sig_length)) {
                        /* Found the table, unload it */
 
                        status = acpi_unload_table (i);
@@ -235,7 +236,8 @@ acpi_db_unload_acpi_table (
                                acpi_os_printf ("[%s] unloaded and uninstalled\n", table_arg);
                        }
                        else {
-                               acpi_os_printf ("%s, while unloading [%s]\n", acpi_ut_format_exception (status), table_arg);
+                               acpi_os_printf ("%s, while unloading [%s]\n",
+                                       acpi_format_exception (status), table_arg);
                        }
 
                        return;
@@ -264,8 +266,8 @@ acpi_db_unload_acpi_table (
 void
 acpi_db_set_method_breakpoint (
        NATIVE_CHAR             *location,
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *op)
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *op)
 {
        u32                     address;
 
@@ -304,7 +306,7 @@ acpi_db_set_method_breakpoint (
 
 void
 acpi_db_set_method_call_breakpoint (
-       ACPI_PARSE_OBJECT       *op)
+       acpi_parse_object       *op)
 {
 
 
@@ -335,7 +337,7 @@ acpi_db_set_method_call_breakpoint (
 void
 acpi_db_disassemble_aml (
        NATIVE_CHAR             *statements,
-       ACPI_PARSE_OBJECT       *op)
+       acpi_parse_object       *op)
 {
        u32                     num_statements = 8;
 
@@ -373,7 +375,7 @@ acpi_db_dump_namespace (
        NATIVE_CHAR             *start_arg,
        NATIVE_CHAR             *depth_arg)
 {
-       ACPI_HANDLE             subtree_entry = acpi_gbl_root_node;
+       acpi_handle             subtree_entry = acpi_gbl_root_node;
        u32                     max_depth = ACPI_UINT32_MAX;
 
 
@@ -383,8 +385,8 @@ acpi_db_dump_namespace (
                /* Check if numeric argument, must be a Node */
 
                if ((start_arg[0] >= 0x30) && (start_arg[0] <= 0x39)) {
-                       subtree_entry = (ACPI_HANDLE) STRTOUL (start_arg, NULL, 16);
-                       if (!acpi_os_readable (subtree_entry, sizeof (ACPI_NAMESPACE_NODE))) {
+                       subtree_entry = (acpi_handle) STRTOUL (start_arg, NULL, 16);
+                       if (!acpi_os_readable (subtree_entry, sizeof (acpi_namespace_node))) {
                                acpi_os_printf ("Address %p is invalid in this address space\n", subtree_entry);
                                return;
                        }
@@ -443,7 +445,7 @@ acpi_db_dump_namespace_by_owner (
        NATIVE_CHAR             *owner_arg,
        NATIVE_CHAR             *depth_arg)
 {
-       ACPI_HANDLE             subtree_entry = acpi_gbl_root_node;
+       acpi_handle             subtree_entry = acpi_gbl_root_node;
        u32                     max_depth = ACPI_UINT32_MAX;
        u16                     owner_id;
 
@@ -488,7 +490,7 @@ acpi_db_send_notify (
        NATIVE_CHAR             *name,
        u32                     value)
 {
-       ACPI_NAMESPACE_NODE     *node;
+       acpi_namespace_node     *node;
 
 
        /* Translate name to an Named object */
@@ -541,8 +543,8 @@ acpi_db_set_method_data (
        NATIVE_CHAR             type;
        u32                     index;
        u32                     value;
-       ACPI_WALK_STATE         *walk_state;
-       ACPI_OPERAND_OBJECT     *obj_desc;
+       acpi_walk_state         *walk_state;
+       acpi_operand_object     *obj_desc;
 
 
        /* Validate Type_arg */
@@ -631,20 +633,20 @@ acpi_db_set_method_data (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_db_walk_for_specific_objects (
-       ACPI_HANDLE             obj_handle,
+       acpi_handle             obj_handle,
        u32                     nesting_level,
        void                    *context,
        void                    **return_value)
 {
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_STATUS             status;
+       acpi_operand_object     *obj_desc;
+       acpi_status             status;
        u32                     buf_size;
        NATIVE_CHAR             buffer[64];
 
 
-       obj_desc = ((ACPI_NAMESPACE_NODE *)obj_handle)->object;
+       obj_desc = ((acpi_namespace_node *)obj_handle)->object;
        buf_size = sizeof (buffer) / sizeof (*buffer);
 
        /* Get and display the full pathname to this object */
@@ -707,12 +709,12 @@ acpi_db_walk_for_specific_objects (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_db_display_objects (
        NATIVE_CHAR             *obj_type_arg,
        NATIVE_CHAR             *display_count_arg)
 {
-       ACPI_OBJECT_TYPE8       type;
+       acpi_object_type8       type;
 
 
        /* Get the object type */
@@ -751,14 +753,14 @@ acpi_db_display_objects (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_db_walk_and_match_name (
-       ACPI_HANDLE             obj_handle,
+       acpi_handle             obj_handle,
        u32                     nesting_level,
        void                    *context,
        void                    **return_value)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
        NATIVE_CHAR             *requested_name = (NATIVE_CHAR *) context;
        u32                     i;
        u32                     buf_size;
@@ -771,7 +773,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] != ((NATIVE_CHAR *) (&((acpi_namespace_node *) obj_handle)->name))[i])) {
                        /* No match, just exit */
 
                        return (AE_OK);
@@ -790,7 +792,7 @@ acpi_db_walk_and_match_name (
 
        else {
                acpi_os_printf ("%32s (%p) - %s\n", buffer, obj_handle,
-                       acpi_ut_get_type_name (((ACPI_NAMESPACE_NODE *) obj_handle)->type));
+                       acpi_ut_get_type_name (((acpi_namespace_node *) obj_handle)->type));
        }
 
        return (AE_OK);
@@ -810,7 +812,7 @@ acpi_db_walk_and_match_name (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_db_find_name_in_namespace (
        NATIVE_CHAR             *name_arg)
 {
@@ -849,7 +851,7 @@ acpi_db_set_scope (
 {
 
        if (!name || name[0] == 0) {
-               acpi_os_printf ("Current scope: %s\n", scope_buf);
+               acpi_os_printf ("Current scope: %s\n", acpi_gbl_db_scope_buf);
                return;
        }
 
@@ -858,16 +860,16 @@ acpi_db_set_scope (
        /* TBD: [Future] Validate scope here */
 
        if (name[0] == '\\') {
-               STRCPY (scope_buf, name);
-               STRCAT (scope_buf, "\\");
+               STRCPY (acpi_gbl_db_scope_buf, name);
+               STRCAT (acpi_gbl_db_scope_buf, "\\");
        }
 
        else {
-               STRCAT (scope_buf, name);
-               STRCAT (scope_buf, "\\");
+               STRCAT (acpi_gbl_db_scope_buf, name);
+               STRCAT (acpi_gbl_db_scope_buf, "\\");
        }
 
-       acpi_os_printf ("New scope: %s\n", scope_buf);
+       acpi_os_printf ("New scope: %s\n", acpi_gbl_db_scope_buf);
 }
 
 
@@ -888,21 +890,22 @@ acpi_db_display_resources (
        NATIVE_CHAR             *object_arg)
 {
 #ifndef _IA16
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_STATUS             status;
-       ACPI_BUFFER             return_obj;
+       acpi_operand_object     *obj_desc;
+       acpi_status             status;
+       acpi_buffer             return_obj;
 
 
        acpi_db_set_output_destination (DB_REDIRECTABLE_OUTPUT);
 
        /* Convert string to object pointer */
 
-       obj_desc = (ACPI_OPERAND_OBJECT *) STRTOUL (object_arg, NULL, 16);
+       obj_desc = (acpi_operand_object *) STRTOUL (object_arg, NULL, 16);
 
        /* Prepare for a return object of arbitrary size */
 
-       return_obj.pointer          = buffer;
-       return_obj.length           = BUFFER_SIZE;
+       return_obj.pointer          = acpi_gbl_db_buffer;
+       return_obj.length           = ACPI_DEBUG_BUFFER_SIZE;
+
 
        /* _PRT */
 
@@ -910,69 +913,75 @@ acpi_db_display_resources (
 
        status = acpi_evaluate_object (obj_desc, "_PRT", NULL, &return_obj);
        if (ACPI_FAILURE (status)) {
-               acpi_os_printf ("Could not obtain _PRT: %s\n", acpi_ut_format_exception (status));
-               goto go_cRS;
+               acpi_os_printf ("Could not obtain _PRT: %s\n", acpi_format_exception (status));
+               goto get_crs;
        }
 
-       return_obj.pointer          = buffer;
-       return_obj.length           = BUFFER_SIZE;
+       return_obj.pointer          = acpi_gbl_db_buffer;
+       return_obj.length           = ACPI_DEBUG_BUFFER_SIZE;
 
        status = acpi_get_irq_routing_table (obj_desc, &return_obj);
        if (ACPI_FAILURE (status)) {
-               acpi_os_printf ("Get_irq_routing_table failed: %s\n", acpi_ut_format_exception (status));
-               goto go_cRS;
+               acpi_os_printf ("Get_irq_routing_table failed: %s\n", acpi_format_exception (status));
        }
 
+       else {
+               acpi_rs_dump_irq_list ((u8 *) acpi_gbl_db_buffer);
+       }
 
-       acpi_rs_dump_irq_list((u8 *)buffer);
 
        /* _CRS */
-go_cRS:
+
+get_crs:
        acpi_os_printf ("Evaluating _CRS\n");
 
-       return_obj.pointer          = buffer;
-       return_obj.length           = BUFFER_SIZE;
+       return_obj.pointer          = acpi_gbl_db_buffer;
+       return_obj.length           = ACPI_DEBUG_BUFFER_SIZE;
 
        status = acpi_evaluate_object (obj_desc, "_CRS", NULL, &return_obj);
        if (ACPI_FAILURE (status)) {
-               acpi_os_printf ("Could not obtain _CRS: %s\n", acpi_ut_format_exception (status));
-               goto go_pRS;
+               acpi_os_printf ("Could not obtain _CRS: %s\n", acpi_format_exception (status));
+               goto get_prs;
        }
 
-       return_obj.pointer          = buffer;
-       return_obj.length           = BUFFER_SIZE;
+       return_obj.pointer          = acpi_gbl_db_buffer;
+       return_obj.length           = ACPI_DEBUG_BUFFER_SIZE;
 
        status = acpi_get_current_resources (obj_desc, &return_obj);
        if (ACPI_FAILURE (status)) {
-               acpi_os_printf ("Acpi_get_current_resources failed: %s\n", acpi_ut_format_exception (status));
-               goto go_pRS;
+               acpi_os_printf ("Acpi_get_current_resources failed: %s\n", acpi_format_exception (status));
+       }
+
+       else {
+               acpi_rs_dump_resource_list ((acpi_resource *) acpi_gbl_db_buffer);
        }
 
-       acpi_rs_dump_resource_list ((ACPI_RESOURCE *) buffer);
 
        /* _PRS */
-go_pRS:
+
+get_prs:
        acpi_os_printf ("Evaluating _PRS\n");
 
-       return_obj.pointer          = buffer;
-       return_obj.length           = BUFFER_SIZE;
+       return_obj.pointer          = acpi_gbl_db_buffer;
+       return_obj.length           = ACPI_DEBUG_BUFFER_SIZE;
 
        status = acpi_evaluate_object (obj_desc, "_PRS", NULL, &return_obj);
        if (ACPI_FAILURE (status)) {
-               acpi_os_printf ("Could not obtain _PRS: %s\n", acpi_ut_format_exception (status));
+               acpi_os_printf ("Could not obtain _PRS: %s\n", acpi_format_exception (status));
                goto cleanup;
        }
 
-       return_obj.pointer          = buffer;
-       return_obj.length           = BUFFER_SIZE;
+       return_obj.pointer          = acpi_gbl_db_buffer;
+       return_obj.length           = ACPI_DEBUG_BUFFER_SIZE;
 
        status = acpi_get_possible_resources (obj_desc, &return_obj);
        if (ACPI_FAILURE (status)) {
-               acpi_os_printf ("Acpi_get_possible_resources failed: %s\n", acpi_ut_format_exception (status));
-               goto cleanup;
+               acpi_os_printf ("Acpi_get_possible_resources failed: %s\n", acpi_format_exception (status));
        }
 
-       acpi_rs_dump_resource_list ((ACPI_RESOURCE *) buffer);
+       else {
+               acpi_rs_dump_resource_list ((acpi_resource *) acpi_gbl_db_buffer);
+       }
 
 
 cleanup:
index 041a797c903d14b3db6241b5c398ff53d0d5de6a..625cfeb56d9136666b22ff32a98944507052eeb3 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: dbdisasm - parser op tree display routines
- *              $Revision: 40 $
+ *              $Revision: 48 $
  *
  ******************************************************************************/
 
@@ -44,7 +44,7 @@
 #define DB_FULL_OP_INFO     "%5.5X #%4.4X [%2.2d]  "
 
 
-NATIVE_CHAR                 *INDENT_STRING = "....";
+NATIVE_CHAR                 *acpi_gbl_db_disasm_indent = "....";
 
 
 /*******************************************************************************
@@ -61,7 +61,7 @@ NATIVE_CHAR                 *INDENT_STRING = "....";
 
 u32
 acpi_db_block_type (
-       ACPI_PARSE_OBJECT       *op)
+       acpi_parse_object       *op)
 {
 
        switch (op->opcode) {
@@ -95,11 +95,11 @@ acpi_db_block_type (
 
 #ifdef PARSER_ONLY
 
-ACPI_STATUS
+acpi_status
 acpi_ps_display_object_pathname (
-       ACPI_PARSE_OBJECT       *op)
+       acpi_parse_object       *op)
 {
-       ACPI_PARSE_OBJECT       *target_op;
+       acpi_parse_object       *target_op;
 
 
        /* Search parent tree up to the root if necessary */
@@ -112,7 +112,6 @@ acpi_ps_display_object_pathname (
                 * (such as _OS_).  Rather than worry about looking up all
                 * the predefined names, just display the name as given
                 */
-
                acpi_os_printf (" **** Path not found in parse tree");
        }
 
@@ -129,12 +128,12 @@ acpi_ps_display_object_pathname (
 
 #else
 
-ACPI_STATUS
+acpi_status
 acpi_ps_display_object_pathname (
-       ACPI_PARSE_OBJECT       *op)
+       acpi_parse_object       *op)
 {
-       ACPI_STATUS             status;
-       ACPI_NAMESPACE_NODE     *node;
+       acpi_status             status;
+       acpi_namespace_node     *node;
        NATIVE_CHAR             buffer[MAX_SHOW_ENTRY];
        u32                     buffer_size = MAX_SHOW_ENTRY;
 
@@ -183,13 +182,13 @@ acpi_ps_display_object_pathname (
 
 void
 acpi_db_display_op (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *origin,
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *origin,
        u32                     num_opcodes)
 {
-       ACPI_PARSE_OBJECT       *op = origin;
-       ACPI_PARSE_OBJECT       *arg;
-       ACPI_PARSE_OBJECT       *depth;
+       acpi_parse_object       *op = origin;
+       acpi_parse_object       *arg;
+       acpi_parse_object       *depth;
        u32                     depth_count = 0;
        u32                     last_depth = 0;
        u32                     i;
@@ -201,7 +200,7 @@ acpi_db_display_op (
                        /* indentation */
 
                        depth_count = 0;
-                       if (!opt_verbose) {
+                       if (!acpi_gbl_db_opt_verbose) {
                                depth_count++;
                        }
 
@@ -226,7 +225,7 @@ acpi_db_display_op (
                        if (depth_count > last_depth) {
                                VERBOSE_PRINT ((DB_NO_OP_INFO, last_depth));
                                for (i = 0; i < last_depth; i++) {
-                                       acpi_os_printf (INDENT_STRING);
+                                       acpi_os_printf ("%s", acpi_gbl_db_disasm_indent);
                                }
 
                                if (acpi_db_block_type (op) == BLOCK_PAREN) {
@@ -243,7 +242,7 @@ acpi_db_display_op (
                                for (j = 0; j < (last_depth - depth_count); j++) {
                                        VERBOSE_PRINT ((DB_NO_OP_INFO, last_depth - j));
                                        for (i = 0; i < (last_depth - j - 1); i++) {
-                                               acpi_os_printf (INDENT_STRING);
+                                               acpi_os_printf ("%s", acpi_gbl_db_disasm_indent);
                                        }
 
                                        if (acpi_db_block_type (op) == BLOCK_PAREN) {
@@ -263,7 +262,7 @@ acpi_db_display_op (
                        /* Indent the output according to the depth count */
 
                        for (i = 0; i < depth_count; i++) {
-                               acpi_os_printf (INDENT_STRING);
+                               acpi_os_printf ("%s", acpi_gbl_db_disasm_indent);
                        }
 
 
@@ -275,7 +274,7 @@ acpi_db_display_op (
 
                        if ((op->opcode == AML_INT_NAMEPATH_OP && op->value.name)  &&
                                (op->parent) &&
-                               (opt_verbose)) {
+                               (acpi_gbl_db_opt_verbose)) {
                                acpi_ps_display_object_pathname (op);
                        }
 
@@ -298,7 +297,7 @@ acpi_db_display_op (
                for (i = 0; i < last_depth; i++) {
                        VERBOSE_PRINT ((DB_NO_OP_INFO, last_depth - i));
                        for (j = 0; j < depth_count; j++) {
-                               acpi_os_printf (INDENT_STRING);
+                               acpi_os_printf ("%s", acpi_gbl_db_disasm_indent);
                        }
                        acpi_os_printf ("}\n");
                        depth_count--;
@@ -393,23 +392,25 @@ acpi_db_display_namestring (
 
 void
 acpi_db_display_path (
-       ACPI_PARSE_OBJECT       *op)
+       acpi_parse_object       *op)
 {
-       ACPI_PARSE_OBJECT       *prev;
-       ACPI_PARSE_OBJECT       *search;
+       acpi_parse_object       *prev;
+       acpi_parse_object       *search;
        u32                     name;
        u8                      do_dot = FALSE;
-       ACPI_PARSE_OBJECT       *name_path;
+       acpi_parse_object       *name_path;
+       const acpi_opcode_info  *op_info;
 
 
        /* We are only interested in named objects */
 
-       if (!acpi_ps_is_node_op (op->opcode)) {
+       op_info = acpi_ps_get_opcode_info (op->opcode);
+       if (!(op_info->flags & AML_NSNODE)) {
                return;
        }
 
 
-       if (acpi_ps_is_create_field_op (op->opcode)) {
+       if (op_info->flags & AML_CREATE) {
                /* Field creation - check for a fully qualified namepath */
 
                if (op->opcode == AML_CREATE_FIELD_OP) {
@@ -443,35 +444,38 @@ acpi_db_display_path (
                        search = search->parent;
                }
 
-               if (prev && !acpi_ps_is_field_op (search->opcode)) {
-                       /* below root scope, append scope name */
-
-                       if (do_dot) {
-                               /* append dot */
+               if (prev) {
+                       op_info = acpi_ps_get_opcode_info (search->opcode);
+                       if (!(op_info->flags & AML_FIELD)) {
+                               /* below root scope, append scope name */
 
-                               acpi_os_printf (".");
-                       }
+                               if (do_dot) {
+                                       /* append dot */
 
-                       if (acpi_ps_is_create_field_op (search->opcode)) {
-                               if (op->opcode == AML_CREATE_FIELD_OP) {
-                                       name_path = acpi_ps_get_arg (op, 3);
+                                       acpi_os_printf (".");
                                }
-                               else {
-                                       name_path = acpi_ps_get_arg (op, 2);
+
+                               if (op_info->flags & AML_CREATE) {
+                                       if (op->opcode == AML_CREATE_FIELD_OP) {
+                                               name_path = acpi_ps_get_arg (op, 3);
+                                       }
+                                       else {
+                                               name_path = acpi_ps_get_arg (op, 2);
+                                       }
+
+                                       if ((name_path) &&
+                                               (name_path->value.string)) {
+                                               acpi_os_printf ("%4.4s", name_path->value.string);
+                                       }
                                }
 
-                               if ((name_path) &&
-                                       (name_path->value.string)) {
-                                       acpi_os_printf ("%4.4s", name_path->value.string);
+                               else {
+                                       name = acpi_ps_get_name (search);
+                                       acpi_os_printf ("%4.4s", &name);
                                }
-                       }
 
-                       else {
-                               name = acpi_ps_get_name (search);
-                               acpi_os_printf ("%4.4s", &name);
+                               do_dot = TRUE;
                        }
-
-                       do_dot = TRUE;
                }
 
                prev = search;
@@ -496,13 +500,13 @@ acpi_db_display_path (
 
 void
 acpi_db_display_opcode (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *op)
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *op)
 {
        u8                      *byte_data;
        u32                     byte_count;
        u32                     i;
-       ACPI_OPCODE_INFO        *opc = NULL;
+       const acpi_opcode_info  *op_info = NULL;
        u32                     name;
 
 
@@ -517,12 +521,12 @@ acpi_db_display_opcode (
 
        case AML_BYTE_OP:
 
-               if (opt_verbose) {
-                       acpi_os_printf ("(u8) 0x%2.2X", op->value.integer & ACPI_UINT8_MAX);
+               if (acpi_gbl_db_opt_verbose) {
+                       acpi_os_printf ("(u8) 0x%2.2X", op->value.integer8);
                }
 
                else {
-                       acpi_os_printf ("0x%2.2X", op->value.integer & ACPI_UINT8_MAX);
+                       acpi_os_printf ("0x%2.2X", op->value.integer8);
                }
 
                break;
@@ -530,12 +534,12 @@ acpi_db_display_opcode (
 
        case AML_WORD_OP:
 
-               if (opt_verbose) {
-                       acpi_os_printf ("(u16) 0x%4.4X", op->value.integer & ACPI_UINT16_MAX);
+               if (acpi_gbl_db_opt_verbose) {
+                       acpi_os_printf ("(u16) 0x%4.4X", op->value.integer16);
                }
 
                else {
-                       acpi_os_printf ("0x%4.4X", op->value.integer & ACPI_UINT16_MAX);
+                       acpi_os_printf ("0x%4.4X", op->value.integer16);
                }
 
                break;
@@ -543,12 +547,27 @@ acpi_db_display_opcode (
 
        case AML_DWORD_OP:
 
-               if (opt_verbose) {
-                       acpi_os_printf ("(u32) 0x%8.8X", op->value.integer);
+               if (acpi_gbl_db_opt_verbose) {
+                       acpi_os_printf ("(u32) 0x%8.8X", op->value.integer32);
                }
 
                else {
-                       acpi_os_printf ("0x%8.8X", op->value.integer);
+                       acpi_os_printf ("0x%8.8X", op->value.integer32);
+               }
+
+               break;
+
+
+       case AML_QWORD_OP:
+
+               if (acpi_gbl_db_opt_verbose) {
+                       acpi_os_printf ("(UINT64) 0x%8.8X%8.8X", op->value.integer64.hi,
+                                        op->value.integer64.lo);
+               }
+
+               else {
+                       acpi_os_printf ("0x%8.8X%8.8X", op->value.integer64.hi,
+                                        op->value.integer64.lo);
                }
 
                break;
@@ -588,33 +607,33 @@ acpi_db_display_opcode (
 
        case AML_INT_NAMEDFIELD_OP:
 
-               acpi_os_printf ("Named_field (Length 0x%8.8X)  ", op->value.integer);
+               acpi_os_printf ("Named_field (Length 0x%8.8X)  ", op->value.integer32);
                break;
 
 
        case AML_INT_RESERVEDFIELD_OP:
 
-               acpi_os_printf ("Reserved_field (Length 0x%8.8X) ", op->value.integer);
+               acpi_os_printf ("Reserved_field (Length 0x%8.8X) ", op->value.integer32);
                break;
 
 
        case AML_INT_ACCESSFIELD_OP:
 
-               acpi_os_printf ("Access_field (Length 0x%8.8X) ", op->value.integer);
+               acpi_os_printf ("Access_field (Length 0x%8.8X) ", op->value.integer32);
                break;
 
 
        case AML_INT_BYTELIST_OP:
 
-               if (opt_verbose) {
-                       acpi_os_printf ("Byte_list   (Length 0x%8.8X)  ", op->value.integer);
+               if (acpi_gbl_db_opt_verbose) {
+                       acpi_os_printf ("Byte_list   (Length 0x%8.8X)  ", op->value.integer32);
                }
 
                else {
-                       acpi_os_printf ("0x%2.2X", op->value.integer);
+                       acpi_os_printf ("0x%2.2X", op->value.integer32);
 
-                       byte_count = op->value.integer;
-                       byte_data = ((ACPI_PARSE2_OBJECT *) op)->data;
+                       byte_count = op->value.integer32;
+                       byte_data = ((acpi_parse2_object *) op)->data;
 
                        for (i = 0; i < byte_count; i++) {
                                acpi_os_printf (", 0x%2.2X", byte_data[i]);
@@ -628,8 +647,8 @@ acpi_db_display_opcode (
 
                /* Just get the opcode name and print it */
 
-               opc = acpi_ps_get_opcode_info (op->opcode);
-               acpi_os_printf ("%s", opc->name);
+               op_info = acpi_ps_get_opcode_info (op->opcode);
+               acpi_os_printf ("%s", op_info->name);
 
 
 #ifndef PARSER_ONLY
@@ -643,8 +662,7 @@ acpi_db_display_opcode (
                break;
        }
 
-
-       if (!opc) {
+       if (!op_info) {
                /* If there is another element in the list, add a comma */
 
                if (op->next) {
@@ -652,16 +670,15 @@ acpi_db_display_opcode (
                }
        }
 
-
        /*
         * If this is a named opcode, print the associated name value
         */
-
-       if (op && acpi_ps_is_named_op (op->opcode)) {
+       op_info = acpi_ps_get_opcode_info (op->opcode);
+       if (op && (op_info->flags & AML_NAMED)) {
                name = acpi_ps_get_name (op);
                acpi_os_printf (" %4.4s", &name);
 
-               if (opt_verbose) {
+               if (acpi_gbl_db_opt_verbose) {
                        acpi_os_printf (" (Path \\");
                        acpi_db_display_path (op);
                        acpi_os_printf (")");
index 35ad6288af6787b6e3dcfd3d6fc3b165a4ac674c..643dc4d9185c260708a3ef17ba89c47ad27dd016 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: dbdisply - debug display commands
- *              $Revision: 45 $
+ *              $Revision: 52 $
  *
  ******************************************************************************/
 
@@ -97,9 +97,9 @@ acpi_db_get_pointer (
 
 void
 acpi_db_dump_parser_descriptor (
-       ACPI_PARSE_OBJECT       *op)
+       acpi_parse_object       *op)
 {
-       ACPI_OPCODE_INFO        *info;
+       const acpi_opcode_info  *info;
 
 
        info = acpi_ps_get_opcode_info (op->opcode);
@@ -135,11 +135,11 @@ acpi_db_decode_and_display_object (
        NATIVE_CHAR             *output_type)
 {
        void                    *obj_ptr;
-       ACPI_NAMESPACE_NODE     *node;
+       acpi_namespace_node     *node;
        u32                     display = DB_BYTE_DISPLAY;
        NATIVE_CHAR             buffer[80];
-       ACPI_BUFFER             ret_buf;
-       ACPI_STATUS             status;
+       acpi_buffer             ret_buf;
+       acpi_status             status;
        u32                     size;
 
 
@@ -180,7 +180,7 @@ acpi_db_decode_and_display_object (
                if (VALID_DESCRIPTOR_TYPE ((obj_ptr), ACPI_DESC_TYPE_NAMED)) {
                        /* This is a Node */
 
-                       if (!acpi_os_readable (obj_ptr, sizeof (ACPI_NAMESPACE_NODE))) {
+                       if (!acpi_os_readable (obj_ptr, sizeof (acpi_namespace_node))) {
                                acpi_os_printf ("Cannot read entire Named object at address %p\n", obj_ptr);
                                return;
                        }
@@ -192,26 +192,26 @@ acpi_db_decode_and_display_object (
                else if (VALID_DESCRIPTOR_TYPE ((obj_ptr), ACPI_DESC_TYPE_INTERNAL)) {
                        /* This is an ACPI OBJECT */
 
-                       if (!acpi_os_readable (obj_ptr, sizeof (ACPI_OPERAND_OBJECT))) {
+                       if (!acpi_os_readable (obj_ptr, sizeof (acpi_operand_object))) {
                                acpi_os_printf ("Cannot read entire ACPI object at address %p\n", obj_ptr);
                                return;
                        }
 
-                       acpi_ut_dump_buffer (obj_ptr, sizeof (ACPI_OPERAND_OBJECT), display, ACPI_UINT32_MAX);
+                       acpi_ut_dump_buffer (obj_ptr, sizeof (acpi_operand_object), display, ACPI_UINT32_MAX);
                        acpi_ex_dump_object_descriptor (obj_ptr, 1);
                }
 
                else if (VALID_DESCRIPTOR_TYPE ((obj_ptr), ACPI_DESC_TYPE_PARSER)) {
                        /* This is an Parser Op object */
 
-                       if (!acpi_os_readable (obj_ptr, sizeof (ACPI_PARSE_OBJECT))) {
+                       if (!acpi_os_readable (obj_ptr, sizeof (acpi_parse_object))) {
                                acpi_os_printf ("Cannot read entire Parser object at address %p\n", obj_ptr);
                                return;
                        }
 
 
-                       acpi_ut_dump_buffer (obj_ptr, sizeof (ACPI_PARSE_OBJECT), display, ACPI_UINT32_MAX);
-                       acpi_db_dump_parser_descriptor ((ACPI_PARSE_OBJECT *) obj_ptr);
+                       acpi_ut_dump_buffer (obj_ptr, sizeof (acpi_parse_object), display, ACPI_UINT32_MAX);
+                       acpi_db_dump_parser_descriptor ((acpi_parse_object *) obj_ptr);
                }
 
                else {
@@ -249,22 +249,22 @@ dump_nte:
                acpi_os_printf ("Object Pathname: %s\n", ret_buf.pointer);
        }
 
-       if (!acpi_os_readable (node, sizeof (ACPI_NAMESPACE_NODE))) {
+       if (!acpi_os_readable (node, sizeof (acpi_namespace_node))) {
                acpi_os_printf ("Invalid Named object at address %p\n", node);
                return;
        }
 
-       acpi_ut_dump_buffer ((void *) node, sizeof (ACPI_NAMESPACE_NODE), display, ACPI_UINT32_MAX);
+       acpi_ut_dump_buffer ((void *) node, sizeof (acpi_namespace_node), display, ACPI_UINT32_MAX);
        acpi_ex_dump_node (node, 1);
 
        if (node->object) {
                acpi_os_printf ("\n_attached Object (%p):\n", node->object);
-               if (!acpi_os_readable (node->object, sizeof (ACPI_OPERAND_OBJECT))) {
+               if (!acpi_os_readable (node->object, sizeof (acpi_operand_object))) {
                        acpi_os_printf ("Invalid internal ACPI Object at address %p\n", node->object);
                        return;
                }
 
-               acpi_ut_dump_buffer (node->object, sizeof (ACPI_OPERAND_OBJECT), display, ACPI_UINT32_MAX);
+               acpi_ut_dump_buffer (node->object, sizeof (acpi_operand_object), display, ACPI_UINT32_MAX);
                acpi_ex_dump_object_descriptor (node->object, 1);
        }
 }
@@ -284,7 +284,7 @@ dump_nte:
 
 void
 acpi_db_decode_internal_object (
-       ACPI_OPERAND_OBJECT     *obj_desc)
+       acpi_operand_object     *obj_desc)
 {
        u32                     i;
 
@@ -297,15 +297,30 @@ acpi_db_decode_internal_object (
 
        switch (obj_desc->common.type) {
        case ACPI_TYPE_INTEGER:
-               acpi_os_printf (" %.8X", obj_desc->integer.value);
+
+               acpi_os_printf (" %.8X%.8X", HIDWORD (obj_desc->integer.value),
+                                LODWORD (obj_desc->integer.value));
                break;
 
+
        case ACPI_TYPE_STRING:
-               acpi_os_printf ("(%d) \"%.16s\"...",
+
+               acpi_os_printf ("(%d) \"%.24s",
                                obj_desc->string.length, obj_desc->string.pointer);
+
+               if (obj_desc->string.length > 24)
+               {
+                       acpi_os_printf ("...");
+               }
+               else
+               {
+                       acpi_os_printf ("\"");
+               }
                break;
 
+
        case ACPI_TYPE_BUFFER:
+
                acpi_os_printf ("(%d)", obj_desc->buffer.length);
                for (i = 0; (i < 8) && (i < obj_desc->buffer.length); i++) {
                        acpi_os_printf (" %2.2X", obj_desc->buffer.pointer[i]);
@@ -330,8 +345,8 @@ acpi_db_decode_internal_object (
 
 void
 acpi_db_display_internal_object (
-       ACPI_OPERAND_OBJECT     *obj_desc,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_operand_object     *obj_desc,
+       acpi_walk_state         *walk_state)
 {
        u8                      type;
 
@@ -352,18 +367,17 @@ acpi_db_display_internal_object (
 
        else if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) {
                acpi_os_printf ("<Node>          Name %4.4s Type-%s",
-                                 &((ACPI_NAMESPACE_NODE *)obj_desc)->name,
-                                 acpi_ut_get_type_name (((ACPI_NAMESPACE_NODE *) obj_desc)->type));
-               if (((ACPI_NAMESPACE_NODE *) obj_desc)->flags & ANOBJ_METHOD_ARG) {
+                                 &((acpi_namespace_node *)obj_desc)->name,
+                                 acpi_ut_get_type_name (((acpi_namespace_node *) obj_desc)->type));
+               if (((acpi_namespace_node *) obj_desc)->flags & ANOBJ_METHOD_ARG) {
                        acpi_os_printf (" [Method Arg]");
                }
-               if (((ACPI_NAMESPACE_NODE *) obj_desc)->flags & ANOBJ_METHOD_LOCAL) {
+               if (((acpi_namespace_node *) obj_desc)->flags & ANOBJ_METHOD_LOCAL) {
                        acpi_os_printf (" [Method Local]");
                }
        }
 
        else if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_INTERNAL)) {
-               acpi_os_printf ("<Obj> ");
                type = obj_desc->common.type;
                if (type > INTERNAL_TYPE_MAX) {
                        acpi_os_printf (" Type %x [Invalid Type]", type);
@@ -376,29 +390,35 @@ acpi_db_display_internal_object (
                case INTERNAL_TYPE_REFERENCE:
                        switch (obj_desc->reference.opcode) {
                        case AML_ZERO_OP:
-                               acpi_os_printf ("[Const]   Number %.8X", 0);
+                               acpi_os_printf ("[Const]         Zero (0) [Null Target]", 0);
                                break;
 
                        case AML_ONES_OP:
-                               acpi_os_printf ("[Const]   Number %.8X", ACPI_UINT32_MAX);
+                               acpi_os_printf ("[Const]         Ones (0xFFFFFFFFFFFFFFFF) [No Limit]");
                                break;
 
                        case AML_ONE_OP:
-                               acpi_os_printf ("[Const]   Number %.8X", 1);
+                               acpi_os_printf ("[Const]         One (1)");
+                               break;
+
+                       case AML_REVISION_OP:
+                               acpi_os_printf ("[Const]         Revision (%X)", ACPI_CA_VERSION);
                                break;
 
                        case AML_LOCAL_OP:
-                               acpi_os_printf ("[Local%d] ", obj_desc->reference.offset);
+                               acpi_os_printf ("[Local%d]", obj_desc->reference.offset);
                                if (walk_state) {
                                        obj_desc = walk_state->local_variables[obj_desc->reference.offset].object;
+                                       acpi_os_printf (" %p", obj_desc);
                                        acpi_db_decode_internal_object (obj_desc);
                                }
                                break;
 
                        case AML_ARG_OP:
-                               acpi_os_printf ("[Arg%d]   ", obj_desc->reference.offset);
+                               acpi_os_printf ("[Arg%d] ", obj_desc->reference.offset);
                                if (walk_state) {
                                        obj_desc = walk_state->arguments[obj_desc->reference.offset].object;
+                                       acpi_os_printf (" %p", obj_desc);
                                        acpi_db_decode_internal_object (obj_desc);
                                }
                                break;
@@ -419,6 +439,7 @@ acpi_db_display_internal_object (
                        break;
 
                default:
+                       acpi_os_printf ("<Obj> ");
                        acpi_os_printf ("         ");
                        acpi_db_decode_internal_object (obj_desc);
                        break;
@@ -447,14 +468,14 @@ acpi_db_display_internal_object (
 
 void
 acpi_db_display_method_info (
-       ACPI_PARSE_OBJECT       *start_op)
+       acpi_parse_object       *start_op)
 {
-       ACPI_WALK_STATE         *walk_state;
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_NAMESPACE_NODE     *node;
-       ACPI_PARSE_OBJECT       *root_op;
-       ACPI_PARSE_OBJECT       *op;
-       ACPI_OPCODE_INFO        *op_info;
+       acpi_walk_state         *walk_state;
+       acpi_operand_object     *obj_desc;
+       acpi_namespace_node     *node;
+       acpi_parse_object       *root_op;
+       acpi_parse_object       *op;
+       const acpi_opcode_info  *op_info;
        u32                     num_ops = 0;
        u32                     num_operands = 0;
        u32                     num_operators = 0;
@@ -559,9 +580,9 @@ void
 acpi_db_display_locals (void)
 {
        u32                     i;
-       ACPI_WALK_STATE         *walk_state;
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_NAMESPACE_NODE     *node;
+       acpi_walk_state         *walk_state;
+       acpi_operand_object     *obj_desc;
+       acpi_namespace_node     *node;
 
 
        walk_state = acpi_ds_get_current_walk_state (acpi_gbl_current_walk_list);
@@ -600,11 +621,11 @@ void
 acpi_db_display_arguments (void)
 {
        u32                     i;
-       ACPI_WALK_STATE         *walk_state;
-       ACPI_OPERAND_OBJECT     *obj_desc;
+       acpi_walk_state         *walk_state;
+       acpi_operand_object     *obj_desc;
        u32                     num_args;
        u32                     concurrency;
-       ACPI_NAMESPACE_NODE     *node;
+       acpi_namespace_node     *node;
 
 
        walk_state = acpi_ds_get_current_walk_state (acpi_gbl_current_walk_list);
@@ -645,10 +666,10 @@ void
 acpi_db_display_results (void)
 {
        u32                     i;
-       ACPI_WALK_STATE         *walk_state;
-       ACPI_OPERAND_OBJECT     *obj_desc;
+       acpi_walk_state         *walk_state;
+       acpi_operand_object     *obj_desc;
        u32                     num_results = 0;
-       ACPI_NAMESPACE_NODE     *node;
+       acpi_namespace_node     *node;
 
 
        walk_state = acpi_ds_get_current_walk_state (acpi_gbl_current_walk_list);
@@ -690,8 +711,8 @@ void
 acpi_db_display_calling_tree (void)
 {
        u32                     i;
-       ACPI_WALK_STATE         *walk_state;
-       ACPI_NAMESPACE_NODE     *node;
+       acpi_walk_state         *walk_state;
+       acpi_namespace_node     *node;
 
 
        walk_state = acpi_ds_get_current_walk_state (acpi_gbl_current_walk_list);
@@ -729,15 +750,14 @@ acpi_db_display_calling_tree (void)
 
 void
 acpi_db_display_result_object (
-       ACPI_OPERAND_OBJECT     *obj_desc,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_operand_object     *obj_desc,
+       acpi_walk_state         *walk_state)
 {
 
        /* TBD: [Future] We don't always want to display the result.
         * For now, only display if single stepping
         * however, this output is very useful in other contexts also
         */
-
        if (!acpi_gbl_cm_single_step) {
                return;
        }
@@ -763,8 +783,8 @@ acpi_db_display_result_object (
 
 void
 acpi_db_display_argument_object (
-       ACPI_OPERAND_OBJECT     *obj_desc,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_operand_object     *obj_desc,
+       acpi_walk_state         *walk_state)
 {
 
 
index 80935f9b54aa440b9b3b525912d0dcec4b1d23b8..817a3cce2836b44abaf4aa3819b15535ce392c06 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: dbexec - debugger control method execution
- *              $Revision: 26 $
+ *              $Revision: 34 $
  *
  ******************************************************************************/
 
@@ -41,7 +41,7 @@
         MODULE_NAME         ("dbexec")
 
 
-DB_METHOD_INFO              info;
+db_method_info              acpi_gbl_db_method_info;
 
 
 /*******************************************************************************
@@ -57,18 +57,18 @@ DB_METHOD_INFO              info;
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_db_execute_method (
-       DB_METHOD_INFO          *info,
-       ACPI_BUFFER             *return_obj)
+       db_method_info          *info,
+       acpi_buffer             *return_obj)
 {
-       ACPI_STATUS             status;
-       ACPI_OBJECT_LIST        param_objects;
-       ACPI_OBJECT             params[MTH_NUM_ARGS];
+       acpi_status             status;
+       acpi_object_list        param_objects;
+       acpi_object             params[MTH_NUM_ARGS];
        u32                     i;
 
 
-       if (output_to_file && !acpi_dbg_level) {
+       if (acpi_gbl_db_output_to_file && !acpi_dbg_level) {
                acpi_os_printf ("Warning: debug output is not enabled!\n");
        }
 
@@ -100,8 +100,8 @@ acpi_db_execute_method (
 
        /* Prepare for a return object of arbitrary size */
 
-       return_obj->pointer          = buffer;
-       return_obj->length           = BUFFER_SIZE;
+       return_obj->pointer          = acpi_gbl_db_buffer;
+       return_obj->length           = ACPI_DEBUG_BUFFER_SIZE;
 
 
        /* Do the actual method execution */
@@ -129,7 +129,7 @@ acpi_db_execute_method (
 
 void
 acpi_db_execute_setup (
-       DB_METHOD_INFO          *info)
+       db_method_info          *info)
 {
 
        /* Catenate the current scope to the supplied name */
@@ -137,7 +137,7 @@ acpi_db_execute_setup (
        info->pathname[0] = 0;
        if ((info->name[0] != '\\') &&
                (info->name[0] != '/')) {
-               STRCAT (info->pathname, scope_buf);
+               STRCAT (info->pathname, acpi_gbl_db_scope_buf);
        }
 
        STRCAT (info->pathname, info->name);
@@ -159,6 +159,40 @@ acpi_db_execute_setup (
 }
 
 
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_db_get_outstanding_allocations
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Current global allocation count minus cache entries
+ *
+ * DESCRIPTION: Determine the current number of "outstanding" allocations --
+ *              those allocations that have not been freed and also are not
+ *              in one of the various object caches.
+ *
+ ******************************************************************************/
+
+u32
+acpi_db_get_outstanding_allocations (void)
+{
+       u32                     i;
+       u32                     outstanding = 0;
+
+
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+
+       for (i = ACPI_MEM_LIST_FIRST_CACHE_LIST; i < ACPI_NUM_MEM_LISTS; i++) {
+               outstanding += (acpi_gbl_memory_lists[i].total_allocated -
+                                 acpi_gbl_memory_lists[i].total_freed -
+                                 acpi_gbl_memory_lists[i].cache_depth);
+       }
+#endif
+
+       return (outstanding);
+}
+
+
 /*******************************************************************************
  *
  * FUNCTION:    Acpi_db_execute
@@ -180,21 +214,51 @@ acpi_db_execute (
        NATIVE_CHAR             **args,
        u32                     flags)
 {
-       ACPI_STATUS             status;
-       ACPI_BUFFER             return_obj;
+       acpi_status             status;
+       acpi_buffer             return_obj;
+
+
+#ifdef ACPI_DEBUG
+       u32                     previous_allocations;
+       u32                     allocations;
+
+
+       /* Memory allocation tracking */
+
+       previous_allocations = acpi_db_get_outstanding_allocations ();
+#endif
+
+       acpi_gbl_db_method_info.name = name;
+       acpi_gbl_db_method_info.args = args;
+       acpi_gbl_db_method_info.flags = flags;
 
+       acpi_db_execute_setup (&acpi_gbl_db_method_info);
+       status = acpi_db_execute_method (&acpi_gbl_db_method_info, &return_obj);
 
-       info.name = name;
-       info.args = args;
-       info.flags = flags;
+       /*
+        * Allow any handlers in separate threads to complete.
+        * (Such as Notify handlers invoked from AML executed above).
+        */
+       acpi_os_sleep (0, 10);
 
-       acpi_db_execute_setup (&info);
-       status = acpi_db_execute_method (&info, &return_obj);
 
+#ifdef ACPI_DEBUG
+
+       /* Memory allocation tracking */
+
+       allocations = acpi_db_get_outstanding_allocations () - previous_allocations;
+
+       acpi_db_set_output_destination (DB_DUPLICATE_OUTPUT);
+
+       if (allocations > 0) {
+               acpi_os_printf ("Outstanding: %ld allocations after execution\n",
+                                 allocations);
+       }
+#endif
 
        if (ACPI_FAILURE (status)) {
                acpi_os_printf ("Execution of %s failed with status %s\n",
-                       info.pathname, acpi_ut_format_exception (status));
+                       acpi_gbl_db_method_info.pathname, acpi_format_exception (status));
        }
 
        else {
@@ -202,7 +266,7 @@ acpi_db_execute (
 
                if (return_obj.length) {
                        acpi_os_printf ("Execution of %s returned object %p Buflen %X\n",
-                               info.pathname, return_obj.pointer, return_obj.length);
+                               acpi_gbl_db_method_info.pathname, return_obj.pointer, return_obj.length);
                        acpi_db_dump_object (return_obj.pointer, 1);
                }
        }
@@ -228,10 +292,10 @@ void
 acpi_db_method_thread (
        void                    *context)
 {
-       ACPI_STATUS             status;
-       DB_METHOD_INFO          *info = context;
+       acpi_status             status;
+       db_method_info          *info = context;
        u32                     i;
-       ACPI_BUFFER             return_obj;
+       acpi_buffer             return_obj;
 
 
        for (i = 0; i < info->num_loops; i++) {
@@ -245,7 +309,6 @@ acpi_db_method_thread (
                }
        }
 
-
        /* Signal our completion */
 
        acpi_os_signal_semaphore (info->thread_gate, 1);
@@ -272,11 +335,11 @@ acpi_db_create_execution_threads (
        NATIVE_CHAR             *num_loops_arg,
        NATIVE_CHAR             *method_name_arg)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
        u32                     num_threads;
        u32                     num_loops;
        u32                     i;
-       ACPI_HANDLE             thread_gate;
+       acpi_handle             thread_gate;
 
 
        /* Get the arguments */
@@ -294,19 +357,19 @@ acpi_db_create_execution_threads (
 
        status = acpi_os_create_semaphore (1, 0, &thread_gate);
        if (ACPI_FAILURE (status)) {
-               acpi_os_printf ("Could not create semaphore, %s\n", acpi_ut_format_exception (status));
+               acpi_os_printf ("Could not create semaphore, %s\n", acpi_format_exception (status));
                return;
        }
 
        /* Setup the context to be passed to each thread */
 
-       info.name = method_name_arg;
-       info.args = NULL;
-       info.flags = 0;
-       info.num_loops = num_loops;
-       info.thread_gate = thread_gate;
+       acpi_gbl_db_method_info.name = method_name_arg;
+       acpi_gbl_db_method_info.args = NULL;
+       acpi_gbl_db_method_info.flags = 0;
+       acpi_gbl_db_method_info.num_loops = num_loops;
+       acpi_gbl_db_method_info.thread_gate = thread_gate;
 
-       acpi_db_execute_setup (&info);
+       acpi_db_execute_setup (&acpi_gbl_db_method_info);
 
 
        /* Create the threads */
@@ -314,7 +377,7 @@ 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, &info);
+               acpi_os_queue_for_execution (OSD_PRIORITY_MED, acpi_db_method_thread, &acpi_gbl_db_method_info);
        }
 
 
index afeec27614984993967be65850b36766cead0abd..a416fc28449ae333c25988cbc5a27d5b1be3a36b 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: 41 $
+ *              $Revision: 48 $
  *
  ******************************************************************************/
 
         MODULE_NAME         ("dbfileio")
 
 
-ACPI_PARSE_OBJECT           *root;
-
 #ifdef ACPI_APPLICATION
 #include <stdio.h>
-FILE                        *debug_file = NULL;
+FILE                        *acpi_gbl_debug_file = NULL;
 #endif
 
 
@@ -64,7 +62,7 @@ FILE                        *debug_file = NULL;
  *
  ******************************************************************************/
 
-ACPI_OBJECT_TYPE8
+acpi_object_type8
 acpi_db_match_argument (
        NATIVE_CHAR             *user_argument,
        ARGUMENT_INFO           *arguments)
@@ -78,7 +76,7 @@ acpi_db_match_argument (
 
        for (i = 0; arguments[i].name; i++) {
                if (STRSTR (arguments[i].name, user_argument) == arguments[i].name) {
-                       return ((ACPI_OBJECT_TYPE8) i);
+                       return ((acpi_object_type8) i);
                }
        }
 
@@ -107,11 +105,11 @@ acpi_db_close_debug_file (
 
 #ifdef ACPI_APPLICATION
 
-       if (debug_file) {
-          fclose (debug_file);
-          debug_file = NULL;
-          output_to_file = FALSE;
-          acpi_os_printf ("Debug output file %s closed\n", debug_filename);
+       if (acpi_gbl_debug_file) {
+          fclose (acpi_gbl_debug_file);
+          acpi_gbl_debug_file = NULL;
+          acpi_gbl_db_output_to_file = FALSE;
+          acpi_os_printf ("Debug output file %s closed\n", acpi_gbl_db_debug_filename);
        }
 #endif
 
@@ -138,11 +136,11 @@ acpi_db_open_debug_file (
 #ifdef ACPI_APPLICATION
 
        acpi_db_close_debug_file ();
-       debug_file = fopen (name, "w+");
-       if (debug_file) {
+       acpi_gbl_debug_file = fopen (name, "w+");
+       if (acpi_gbl_debug_file) {
                acpi_os_printf ("Debug output file %s opened\n", name);
-               STRCPY (debug_filename, name);
-               output_to_file = TRUE;
+               STRCPY (acpi_gbl_db_debug_filename, name);
+               acpi_gbl_db_output_to_file = TRUE;
        }
        else {
                acpi_os_printf ("Could not open debug file %s\n", name);
@@ -167,22 +165,22 @@ acpi_db_open_debug_file (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_db_load_table(
        FILE                    *fp,
-       ACPI_TABLE_HEADER       **table_ptr,
+       acpi_table_header       **table_ptr,
        u32                     *table_length)
 {
-       ACPI_TABLE_HEADER       table_header;
+       acpi_table_header       table_header;
        u8                      *aml_ptr;
        u32                     aml_length;
        u32                     actual;
-       ACPI_STATUS             status;
+       acpi_status             status;
 
 
        /* Read the table header */
 
-       if (fread (&table_header, 1, sizeof (table_header), fp) != sizeof (ACPI_TABLE_HEADER)) {
+       if (fread (&table_header, 1, sizeof (table_header), fp) != sizeof (acpi_table_header)) {
                acpi_os_printf ("Couldn't read the table header\n");
                return (AE_BAD_SIGNATURE);
        }
@@ -204,15 +202,17 @@ acpi_db_load_table(
                STRNCMP ((char *) table_header.signature, PSDT_SIG, 4) &&
                STRNCMP ((char *) table_header.signature, SSDT_SIG, 4)) {
                acpi_os_printf ("Table signature is invalid\n");
+               DUMP_BUFFER (&table_header, sizeof (acpi_table_header));
                return (AE_ERROR);
        }
 
        /* Allocate a buffer for the table */
 
        *table_length = table_header.length;
-       *table_ptr = (ACPI_TABLE_HEADER *) acpi_ut_allocate ((size_t) *table_length);
+       *table_ptr = ACPI_MEM_ALLOCATE ((size_t) *table_length);
        if (!*table_ptr) {
-               acpi_os_printf ("Could not allocate memory for the table (size=%X)\n", table_header.length);
+               acpi_os_printf ("Could not allocate memory for ACPI table %4.4s (size=%X)\n",
+                                table_header.signature, table_header.length);
                return (AE_NO_MEMORY);
        }
 
@@ -238,7 +238,7 @@ acpi_db_load_table(
 
 
        acpi_os_printf ("Error - could not read the table file\n");
-       acpi_ut_free (*table_ptr);
+       ACPI_MEM_FREE (*table_ptr);
        *table_ptr = NULL;
        *table_length = 0;
 
@@ -265,16 +265,18 @@ acpi_db_load_table(
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 ae_local_load_table (
-       ACPI_TABLE_HEADER       *table_ptr)
+       acpi_table_header       *table_ptr)
 {
-       ACPI_STATUS             status;
-       ACPI_TABLE_DESC         table_info;
+       acpi_status             status;
+       acpi_table_desc         table_info;
+
 
+       FUNCTION_TRACE ("Ae_local_load_table");
 
        if (!table_ptr) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        /* Install the new table into the local data structures */
@@ -286,7 +288,7 @@ ae_local_load_table (
                /* Free table allocated by Acpi_tb_get_table */
 
                acpi_tb_delete_single_table (&table_info);
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
 
@@ -295,12 +297,12 @@ ae_local_load_table (
        if (ACPI_FAILURE (status)) {
                /* Uninstall table and free the buffer */
 
-               acpi_tb_uninstall_table (table_info.installed_desc);
-               return (status);
+               acpi_tb_delete_acpi_table (ACPI_TABLE_DSDT);
+               return_ACPI_STATUS (status);
        }
 #endif
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -316,14 +318,14 @@ ae_local_load_table (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_db_load_acpi_table (
        NATIVE_CHAR             *filename)
 {
 #ifdef ACPI_APPLICATION
        FILE                    *fp;
-       ACPI_STATUS             status;
-       ACPI_TABLE_HEADER       *table_ptr;
+       acpi_status             status;
+       acpi_table_header       *table_ptr;
        u32                     table_length;
 
 
@@ -356,11 +358,13 @@ acpi_db_load_acpi_table (
                        acpi_os_printf ("Table %4.4s is already installed\n",
                                          &table_ptr->signature);
                }
+
                else {
                        acpi_os_printf ("Could not install table, %s\n",
-                                         acpi_ut_format_exception (status));
+                                         acpi_format_exception (status));
                }
-               acpi_ut_free (table_ptr);
+
+               ACPI_MEM_FREE (table_ptr);
                return (status);
        }
 
index fdfe73e1e863636e8e862c315530644ac4d00442..69e809a61054172f66fb770ab09b2537a8fc8832 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: dbhistry - debugger HISTORY command
- *              $Revision: 18 $
+ *              $Revision: 19 $
  *
  *****************************************************************************/
 
@@ -54,11 +54,11 @@ typedef struct history_info
 } HISTORY_INFO;
 
 
-HISTORY_INFO                history_buffer[HISTORY_SIZE];
-u16                         lo_history = 0;
-u16                         num_history = 0;
-u16                         next_history_index = 0;
-u32                         next_cmd_num = 1;
+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;
 
 
 /*******************************************************************************
@@ -81,28 +81,29 @@ acpi_db_add_to_history (
 
        /* Put command into the next available slot */
 
-       STRCPY (history_buffer[next_history_index].command, command_line);
-       history_buffer[next_history_index].cmd_num = next_cmd_num;
+       STRCPY (acpi_gbl_history_buffer[acpi_gbl_next_history_index].command, command_line);
+
+       acpi_gbl_history_buffer[acpi_gbl_next_history_index].cmd_num = acpi_gbl_next_cmd_num;
 
        /* Adjust indexes */
 
-       if ((num_history == HISTORY_SIZE) &&
-               (next_history_index == lo_history)) {
-               lo_history++;
-               if (lo_history >= HISTORY_SIZE) {
-                       lo_history = 0;
+       if ((acpi_gbl_num_history == HISTORY_SIZE) &&
+               (acpi_gbl_next_history_index == acpi_gbl_lo_history)) {
+               acpi_gbl_lo_history++;
+               if (acpi_gbl_lo_history >= HISTORY_SIZE) {
+                       acpi_gbl_lo_history = 0;
                }
        }
 
-       next_history_index++;
-       if (next_history_index >= HISTORY_SIZE) {
-               next_history_index = 0;
+       acpi_gbl_next_history_index++;
+       if (acpi_gbl_next_history_index >= HISTORY_SIZE) {
+               acpi_gbl_next_history_index = 0;
        }
 
 
-       next_cmd_num++;
-       if (num_history < HISTORY_SIZE) {
-               num_history++;
+       acpi_gbl_next_cmd_num++;
+       if (acpi_gbl_num_history < HISTORY_SIZE) {
+               acpi_gbl_num_history++;
        }
 
 }
@@ -127,12 +128,13 @@ acpi_db_display_history (void)
        u16                     history_index;
 
 
-       history_index = lo_history;
+       history_index = acpi_gbl_lo_history;
 
        /* Dump entire history buffer */
 
-       for (i = 0; i < num_history; i++) {
-               acpi_os_printf ("%ld %s\n", history_buffer[history_index].cmd_num, history_buffer[history_index].command);
+       for (i = 0; i < acpi_gbl_num_history; i++) {
+               acpi_os_printf ("%ld %s\n", acpi_gbl_history_buffer[history_index].cmd_num,
+                                acpi_gbl_history_buffer[history_index].command);
 
                history_index++;
                if (history_index >= HISTORY_SIZE) {
@@ -165,7 +167,7 @@ acpi_db_get_from_history (
 
 
        if (command_num_arg == NULL) {
-               cmd_num = next_cmd_num - 1;
+               cmd_num = acpi_gbl_next_cmd_num - 1;
        }
 
        else {
@@ -175,12 +177,12 @@ acpi_db_get_from_history (
 
        /* Search history buffer */
 
-       history_index = lo_history;
-       for (i = 0; i < num_history; i++) {
-               if (history_buffer[history_index].cmd_num == cmd_num) {
+       history_index = acpi_gbl_lo_history;
+       for (i = 0; i < acpi_gbl_num_history; i++) {
+               if (acpi_gbl_history_buffer[history_index].cmd_num == cmd_num) {
                        /* Found the commnad, return it */
 
-                       return (history_buffer[history_index].command);
+                       return (acpi_gbl_history_buffer[history_index].command);
                }
 
 
index 10193c84b3da5e8a434136bd69cbfe92758a9c2d..22a022a7bdfa038bc66bbada0f17a7730d7c151e 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: dbinput - user front-end to the AML debugger
- *              $Revision: 61 $
+ *              $Revision: 68 $
  *
  ******************************************************************************/
 
  * Globals that are specific to the debugger
  */
 
-NATIVE_CHAR             line_buf[80];
-NATIVE_CHAR             parsed_buf[80];
-NATIVE_CHAR             scope_buf[40];
-NATIVE_CHAR             debug_filename[40];
-NATIVE_CHAR             *args[DB_MAX_ARGS];
-NATIVE_CHAR             *buffer;
-NATIVE_CHAR             *filename = NULL;
-u8                      output_to_file = FALSE;
+NATIVE_CHAR                 acpi_gbl_db_line_buf[80];
+NATIVE_CHAR                 acpi_gbl_db_parsed_buf[80];
+NATIVE_CHAR                 acpi_gbl_db_scope_buf[40];
+NATIVE_CHAR                 acpi_gbl_db_debug_filename[40];
+NATIVE_CHAR                 *acpi_gbl_db_args[DB_MAX_ARGS];
+NATIVE_CHAR                 *acpi_gbl_db_buffer;
+NATIVE_CHAR                 *acpi_gbl_db_filename = NULL;
+u8                          acpi_gbl_db_output_to_file = FALSE;
 
 
-u32                     acpi_gbl_db_debug_level = 0x0FFFFFFF;
-u32                     acpi_gbl_db_console_debug_level = NORMAL_DEFAULT | TRACE_TABLES;
-u8                      acpi_gbl_db_output_flags = DB_CONSOLE_OUTPUT;
+u32                         acpi_gbl_db_debug_level = ACPI_LV_VERBOSITY2;
+u32                         acpi_gbl_db_console_debug_level = NORMAL_DEFAULT | ACPI_LV_TABLES;
+u8                          acpi_gbl_db_output_flags = DB_CONSOLE_OUTPUT;
 
 
-u8                      opt_tables      = FALSE;
-u8                      opt_disasm      = FALSE;
-u8                      opt_stats       = FALSE;
-u8                      opt_parse_jit   = FALSE;
-u8                      opt_verbose     = TRUE;
-u8                      opt_ini_methods = TRUE;
+u8                          acpi_gbl_db_opt_tables    = FALSE;
+u8                          acpi_gbl_db_opt_disasm    = FALSE;
+u8                          acpi_gbl_db_opt_stats     = FALSE;
+u8                          acpi_gbl_db_opt_parse_jit = FALSE;
+u8                          acpi_gbl_db_opt_verbose   = TRUE;
+u8                          acpi_gbl_db_opt_ini_methods = TRUE;
+
+/*
+ * Statistic globals
+ */
+u16                         acpi_gbl_obj_type_count[INTERNAL_TYPE_NODE_MAX+1];
+u16                         acpi_gbl_node_type_count[INTERNAL_TYPE_NODE_MAX+1];
+u16                         acpi_gbl_obj_type_count_misc;
+u16                         acpi_gbl_node_type_count_misc;
+u32                         acpi_gbl_num_nodes;
+u32                         acpi_gbl_num_objects;
 
 
+u32                         acpi_gbl_size_of_parse_tree;
+u32                         acpi_gbl_size_of_method_trees;
+u32                         acpi_gbl_size_of_node_entries;
+u32                         acpi_gbl_size_of_acpi_objects;
+
 /*
  * Top-level debugger commands.
  *
@@ -125,7 +140,7 @@ enum acpi_ex_debugger_commands
 #define CMD_FIRST_VALID     2
 
 
-COMMAND_INFO                commands[] =
+const COMMAND_INFO          acpi_gbl_db_commands[] =
 { {"<NOT FOUND>",  0},
        {"<NULL>",       0},
        {"ALLOCATIONS",  0},
@@ -172,7 +187,7 @@ COMMAND_INFO                commands[] =
        {"TERMINATE",    0},
        {"THREADS",      3},
        {"TREE",         0},
-       {"UNLOAD",       0},
+       {"UNLOAD",       1},
        {NULL,           0}
 };
 
@@ -201,7 +216,7 @@ acpi_db_display_help (
        {
                acpi_os_printf ("ACPI CA Debugger Commands\n\n");
                acpi_os_printf ("The following classes of commands are available. Help is available for\n");
-               acpi_os_printf ("each class by entering \"help <class_name>\"\n\n");
+               acpi_os_printf ("each class by entering \"Help <Class_name>\"\n\n");
                acpi_os_printf ("  [GENERAL]       General-Purpose Commands\n");
                acpi_os_printf ("  [NAMESPACE]     Namespace Access Commands\n");
                acpi_os_printf ("  [METHOD]        Control Method Execution Commands\n");
@@ -233,7 +248,7 @@ acpi_db_display_help (
                acpi_os_printf ("Stats [Allocations|Memory|Misc\n");
                acpi_os_printf ("     |Objects|Tables]             Display namespace and memory statistics\n");
                acpi_os_printf ("Tables                            Display info about loaded ACPI tables\n");
-               acpi_os_printf ("Unload                            Unload an ACPI table\n");
+               acpi_os_printf ("Unload <Table_sig> [Instance]     Unload an ACPI table\n");
                acpi_os_printf ("! <Command_number>                Execute command from history buffer\n");
                acpi_os_printf ("!!                                Execute last command again\n");
                return;
@@ -378,14 +393,14 @@ acpi_db_get_line (
        NATIVE_CHAR             *this;
 
 
-       STRCPY (parsed_buf, input_buffer);
-       STRUPR (parsed_buf);
+       STRCPY (acpi_gbl_db_parsed_buf, input_buffer);
+       STRUPR (acpi_gbl_db_parsed_buf);
 
-       this = parsed_buf;
+       this = acpi_gbl_db_parsed_buf;
        for (i = 0; i < DB_MAX_ARGS; i++)
        {
-               args[i] = acpi_db_get_next_token (this, &next);
-               if (!args[i])
+               acpi_gbl_db_args[i] = acpi_db_get_next_token (this, &next);
+               if (!acpi_gbl_db_args[i])
                {
                        break;
                }
@@ -396,9 +411,9 @@ acpi_db_get_line (
 
        /* Uppercase the actual command */
 
-       if (args[0])
+       if (acpi_gbl_db_args[0])
        {
-               STRUPR (args[0]);
+               STRUPR (acpi_gbl_db_args[0]);
        }
 
        count = i;
@@ -435,9 +450,9 @@ acpi_db_match_command (
                return (CMD_NULL);
        }
 
-       for (i = CMD_FIRST_VALID; commands[i].name; i++)
+       for (i = CMD_FIRST_VALID; acpi_gbl_db_commands[i].name; i++)
        {
-               if (STRSTR (commands[i].name, user_command) == commands[i].name)
+               if (STRSTR (acpi_gbl_db_commands[i].name, user_command) == acpi_gbl_db_commands[i].name)
                {
                        return (i);
                }
@@ -463,17 +478,17 @@ acpi_db_match_command (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_db_command_dispatch (
        NATIVE_CHAR             *input_buffer,
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *op)
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *op)
 {
        u32                     temp;
        u32                     command_index;
        u32                     param_count;
        NATIVE_CHAR             *command_line;
-       ACPI_STATUS             status = AE_CTRL_TRUE;
+       acpi_status             status = AE_CTRL_TRUE;
 
 
        /* If Acpi_terminate has been called, terminate this thread */
@@ -484,15 +499,15 @@ acpi_db_command_dispatch (
        }
 
        param_count = acpi_db_get_line (input_buffer);
-       command_index = acpi_db_match_command (args[0]);
+       command_index = acpi_db_match_command (acpi_gbl_db_args[0]);
        temp = 0;
 
        /* Verify that we have the minimum number of params */
 
-       if (param_count < commands[command_index].min_args)
+       if (param_count < acpi_gbl_db_commands[command_index].min_args)
        {
                acpi_os_printf ("%d parameters entered, [%s] requires %d parameters\n",
-                                 param_count, commands[command_index].name, commands[command_index].min_args);
+                                 param_count, acpi_gbl_db_commands[command_index].name, acpi_gbl_db_commands[command_index].min_args);
                return (AE_CTRL_TRUE);
        }
 
@@ -508,7 +523,10 @@ acpi_db_command_dispatch (
                break;
 
        case CMD_ALLOCATIONS:
+
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
                acpi_ut_dump_current_allocations ((u32) -1, NULL);
+#endif
                break;
 
        case CMD_ARGS:
@@ -517,7 +535,7 @@ acpi_db_command_dispatch (
                break;
 
        case CMD_BREAKPOINT:
-               acpi_db_set_method_breakpoint (args[1], walk_state, op);
+               acpi_db_set_method_breakpoint (acpi_gbl_db_args[1], walk_state, op);
                break;
 
        case CMD_CALL:
@@ -530,11 +548,11 @@ acpi_db_command_dispatch (
                break;
 
        case CMD_DEBUG:
-               acpi_db_execute (args[1], &args[2], EX_SINGLE_STEP);
+               acpi_db_execute (acpi_gbl_db_args[1], &acpi_gbl_db_args[2], EX_SINGLE_STEP);
                break;
 
        case CMD_DUMP:
-               acpi_db_decode_and_display_object (args[1], args[2]);
+               acpi_db_decode_and_display_object (acpi_gbl_db_args[1], acpi_gbl_db_args[2]);
                break;
 
        case CMD_ENABLEACPI:
@@ -551,11 +569,11 @@ acpi_db_command_dispatch (
                break;
 
        case CMD_EXECUTE:
-               acpi_db_execute (args[1], &args[2], EX_NO_SINGLE_STEP);
+               acpi_db_execute (acpi_gbl_db_args[1], &acpi_gbl_db_args[2], EX_NO_SINGLE_STEP);
                break;
 
        case CMD_FIND:
-               acpi_db_find_name_in_namespace (args[1]);
+               acpi_db_find_name_in_namespace (acpi_gbl_db_args[1]);
                break;
 
        case CMD_GO:
@@ -564,7 +582,7 @@ acpi_db_command_dispatch (
 
        case CMD_HELP:
        case CMD_HELP2:
-               acpi_db_display_help (args[1]);
+               acpi_db_display_help (acpi_gbl_db_args[1]);
                break;
 
        case CMD_HISTORY:
@@ -572,7 +590,7 @@ acpi_db_command_dispatch (
                break;
 
        case CMD_HISTORY_EXE:
-               command_line = acpi_db_get_from_history (args[1]);
+               command_line = acpi_db_get_from_history (acpi_gbl_db_args[1]);
                if (!command_line)
                {
                        return (AE_CTRL_TRUE);
@@ -624,23 +642,23 @@ acpi_db_command_dispatch (
                else if (param_count == 2)
                {
                        temp = acpi_gbl_db_console_debug_level;
-                       acpi_gbl_db_console_debug_level = STRTOUL (args[1], NULL, 16);
+                       acpi_gbl_db_console_debug_level = STRTOUL (acpi_gbl_db_args[1], NULL, 16);
                        acpi_os_printf ("Debug Level for console output was %8.8lX, now %8.8lX\n", temp, acpi_gbl_db_console_debug_level);
                }
                else
                {
                        temp = acpi_gbl_db_debug_level;
-                       acpi_gbl_db_debug_level = STRTOUL (args[1], NULL, 16);
+                       acpi_gbl_db_debug_level = STRTOUL (acpi_gbl_db_args[1], NULL, 16);
                        acpi_os_printf ("Debug Level for file output was %8.8lX, now %8.8lX\n", temp, acpi_gbl_db_debug_level);
                }
                break;
 
        case CMD_LIST:
-               acpi_db_disassemble_aml (args[1], op);
+               acpi_db_disassemble_aml (acpi_gbl_db_args[1], op);
                break;
 
        case CMD_LOAD:
-               status = acpi_db_load_acpi_table (args[1]);
+               status = acpi_db_load_acpi_table (acpi_gbl_db_args[1]);
                if (ACPI_FAILURE (status))
                {
                        return (status);
@@ -656,40 +674,40 @@ acpi_db_command_dispatch (
                break;
 
        case CMD_METHODS:
-               acpi_db_display_objects ("METHOD", args[1]);
+               acpi_db_display_objects ("METHOD", acpi_gbl_db_args[1]);
                break;
 
        case CMD_NAMESPACE:
-               acpi_db_dump_namespace (args[1], args[2]);
+               acpi_db_dump_namespace (acpi_gbl_db_args[1], acpi_gbl_db_args[2]);
                break;
 
        case CMD_NOTIFY:
-               temp = STRTOUL (args[2], NULL, 0);
-               acpi_db_send_notify (args[1], temp);
+               temp = STRTOUL (acpi_gbl_db_args[2], NULL, 0);
+               acpi_db_send_notify (acpi_gbl_db_args[1], temp);
                break;
 
        case CMD_OBJECT:
-               acpi_db_display_objects (STRUPR (args[1]), args[2]);
+               acpi_db_display_objects (STRUPR (acpi_gbl_db_args[1]), acpi_gbl_db_args[2]);
                break;
 
        case CMD_OPEN:
-               acpi_db_open_debug_file (args[1]);
+               acpi_db_open_debug_file (acpi_gbl_db_args[1]);
                break;
 
        case CMD_OWNER:
-               acpi_db_dump_namespace_by_owner (args[1], args[2]);
+               acpi_db_dump_namespace_by_owner (acpi_gbl_db_args[1], acpi_gbl_db_args[2]);
                break;
 
        case CMD_PREFIX:
-               acpi_db_set_scope (args[1]);
+               acpi_db_set_scope (acpi_gbl_db_args[1]);
                break;
 
        case CMD_REFERENCES:
-               acpi_db_find_references (args[1]);
+               acpi_db_find_references (acpi_gbl_db_args[1]);
                break;
 
        case CMD_RESOURCES:
-               acpi_db_display_resources (args[1]);
+               acpi_db_display_resources (acpi_gbl_db_args[1]);
                break;
 
        case CMD_RESULTS:
@@ -697,11 +715,11 @@ acpi_db_command_dispatch (
                break;
 
        case CMD_SET:
-               acpi_db_set_method_data (args[1], args[2], args[3]);
+               acpi_db_set_method_data (acpi_gbl_db_args[1], acpi_gbl_db_args[2], acpi_gbl_db_args[3]);
                break;
 
        case CMD_STATS:
-               acpi_db_display_statistics (args[1]);
+               acpi_db_display_statistics (acpi_gbl_db_args[1]);
                break;
 
        case CMD_STOP:
@@ -709,7 +727,7 @@ acpi_db_command_dispatch (
                break;
 
        case CMD_TABLES:
-               acpi_db_display_table_info (args[1]);
+               acpi_db_display_table_info (acpi_gbl_db_args[1]);
                break;
 
        case CMD_TERMINATE:
@@ -722,7 +740,7 @@ acpi_db_command_dispatch (
                break;
 
        case CMD_THREADS:
-               acpi_db_create_execution_threads (args[1], args[2], args[3]);
+               acpi_db_create_execution_threads (acpi_gbl_db_args[1], acpi_gbl_db_args[2], acpi_gbl_db_args[3]);
                break;
 
        case CMD_TREE:
@@ -730,7 +748,7 @@ acpi_db_command_dispatch (
                break;
 
        case CMD_UNLOAD:
-               acpi_db_unload_acpi_table (args[1], args[2]);
+               acpi_db_unload_acpi_table (acpi_gbl_db_args[1], acpi_gbl_db_args[2]);
                break;
 
        case CMD_EXIT:
@@ -741,7 +759,7 @@ acpi_db_command_dispatch (
                        return (AE_CTRL_TERMINATE);
                }
 
-               if (!output_to_file)
+               if (!acpi_gbl_db_output_to_file)
                {
                        acpi_dbg_level = DEBUG_DEFAULT;
                }
@@ -785,7 +803,7 @@ void
 acpi_db_execute_thread (
        void                    *context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
 
 
        while (status != AE_CTRL_TERMINATE)
@@ -794,7 +812,7 @@ acpi_db_execute_thread (
                acpi_gbl_step_to_next_call = FALSE;
 
                acpi_ut_acquire_mutex (ACPI_MTX_DEBUG_CMD_READY);
-               status = acpi_db_command_dispatch (line_buf, NULL, NULL);
+               status = acpi_db_command_dispatch (acpi_gbl_db_line_buf, NULL, NULL);
                acpi_ut_release_mutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
        }
 }
@@ -817,13 +835,13 @@ void
 acpi_db_single_thread (
        void)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
 
 
        acpi_gbl_method_executing = FALSE;
        acpi_gbl_step_to_next_call = FALSE;
 
-       status = acpi_db_command_dispatch (line_buf, NULL, NULL);
+       status = acpi_db_command_dispatch (acpi_gbl_db_line_buf, NULL, NULL);
 }
 
 
@@ -841,12 +859,12 @@ acpi_db_single_thread (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_db_user_commands (
        NATIVE_CHAR             prompt,
-       ACPI_PARSE_OBJECT       *op)
+       acpi_parse_object       *op)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
 
 
        /* TBD: [Restructure] Need a separate command line buffer for step mode */
@@ -870,7 +888,7 @@ acpi_db_user_commands (
 
                /* Get the user input line */
 
-               acpi_os_get_line (line_buf);
+               acpi_os_get_line (acpi_gbl_db_line_buf);
 
 
                /* Check for single or multithreaded debug */
@@ -881,7 +899,6 @@ acpi_db_user_commands (
                         * Signal the debug thread that we have a command to execute,
                         * and wait for the command to complete.
                         */
-
                        acpi_ut_release_mutex (ACPI_MTX_DEBUG_CMD_READY);
                        acpi_ut_acquire_mutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
                }
index c26c42654d713666c1254971a06567660af9c276..e7791e569d9704b75e6476f62aec7e98846f2160 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: dbstats - Generation and display of ACPI table statistics
- *              $Revision: 40 $
+ *              $Revision: 47 $
  *
  ******************************************************************************/
 
@@ -45,6 +45,7 @@ ARGUMENT_INFO               acpi_db_stat_types [] =
        {"MISC"},
        {"TABLES"},
        {"SIZES"},
+       {"STACK"},
        {NULL}           /* Must be null terminated */
 };
 
@@ -54,23 +55,7 @@ ARGUMENT_INFO               acpi_db_stat_types [] =
 #define CMD_MISC            3
 #define CMD_TABLES          4
 #define CMD_SIZES           5
-
-
-/*
- * Statistic globals
- */
-u16                         acpi_gbl_obj_type_count[INTERNAL_TYPE_NODE_MAX+1];
-u16                         acpi_gbl_node_type_count[INTERNAL_TYPE_NODE_MAX+1];
-u16                         acpi_gbl_obj_type_count_misc;
-u16                         acpi_gbl_node_type_count_misc;
-u32                         num_nodes;
-u32                         num_objects;
-
-
-u32                         size_of_parse_tree;
-u32                         size_of_method_trees;
-u32                         size_of_node_entries;
-u32                         size_of_acpi_objects;
+#define CMD_STACK           6
 
 
 /*******************************************************************************
@@ -90,7 +75,7 @@ u32                         size_of_acpi_objects;
 
 void
 acpi_db_enumerate_object (
-       ACPI_OPERAND_OBJECT     *obj_desc)
+       acpi_operand_object     *obj_desc)
 {
        u32                     type;
        u32                     i;
@@ -104,7 +89,7 @@ acpi_db_enumerate_object (
 
        /* Enumerate this object first */
 
-       num_objects++;
+       acpi_gbl_num_objects++;
 
        type = obj_desc->common.type;
        if (type > INTERNAL_TYPE_NODE_MAX)
@@ -172,27 +157,27 @@ acpi_db_enumerate_object (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_db_classify_one_object (
-       ACPI_HANDLE             obj_handle,
+       acpi_handle             obj_handle,
        u32                     nesting_level,
        void                    *context,
        void                    **return_value)
 {
-       ACPI_NAMESPACE_NODE     *node;
-       ACPI_OPERAND_OBJECT     *obj_desc;
+       acpi_namespace_node     *node;
+       acpi_operand_object     *obj_desc;
        u32                     type;
 
 
-       num_nodes++;
+       acpi_gbl_num_nodes++;
 
-       node = (ACPI_NAMESPACE_NODE *) obj_handle;
-       obj_desc = ((ACPI_NAMESPACE_NODE *) obj_handle)->object;
+       node = (acpi_namespace_node *) obj_handle;
+       obj_desc = ((acpi_namespace_node *) obj_handle)->object;
 
        acpi_db_enumerate_object (obj_desc);
 
        type = node->type;
-       if (type > INTERNAL_TYPE_INVALID)
+       if (type > INTERNAL_TYPE_NODE_MAX)
        {
                acpi_gbl_node_type_count_misc++;
        }
@@ -220,10 +205,10 @@ acpi_db_classify_one_object (
        Num_grammar_elements++;
        Op = Acpi_ps_get_depth_next (Root, Op);
 
-       Size_of_parse_tree          = (Num_grammar_elements - Num_method_elements) * (u32) sizeof (ACPI_PARSE_OBJECT);
-       Size_of_method_trees        = Num_method_elements * (u32) sizeof (ACPI_PARSE_OBJECT);
-       Size_of_node_entries        = Num_nodes * (u32) sizeof (ACPI_NAMESPACE_NODE);
-       Size_of_acpi_objects        = Num_nodes * (u32) sizeof (ACPI_OPERAND_OBJECT);
+       Size_of_parse_tree          = (Num_grammar_elements - Num_method_elements) * (u32) sizeof (acpi_parse_object);
+       Size_of_method_trees        = Num_method_elements * (u32) sizeof (acpi_parse_object);
+       Size_of_node_entries        = Num_nodes * (u32) sizeof (acpi_namespace_node);
+       Size_of_acpi_objects        = Num_nodes * (u32) sizeof (acpi_operand_object);
 
        */
 }
@@ -242,18 +227,18 @@ acpi_db_classify_one_object (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_db_count_namespace_objects (
        void)
 {
        u32                     i;
 
 
-       num_nodes = 0;
-       num_objects = 0;
+       acpi_gbl_num_nodes = 0;
+       acpi_gbl_num_objects = 0;
 
        acpi_gbl_obj_type_count_misc = 0;
-       for (i = 0; i < INTERNAL_TYPE_INVALID; i++)
+       for (i = 0; i < (INTERNAL_TYPE_NODE_MAX -1); i++)
        {
                acpi_gbl_obj_type_count [i] = 0;
                acpi_gbl_node_type_count [i] = 0;
@@ -280,12 +265,14 @@ acpi_db_count_namespace_objects (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_db_display_statistics (
        NATIVE_CHAR             *type_arg)
 {
        u32                     i;
        u32                     type;
+       u32                     outstanding;
+       u32                     size;
 
 
        if (!acpi_gbl_DSDT)
@@ -307,17 +294,14 @@ acpi_db_display_statistics (
                return (AE_OK);
        }
 
-#ifndef PARSER_ONLY
-
-       acpi_db_count_namespace_objects ();
-#endif
-
 
        switch (type)
        {
 #ifndef PARSER_ONLY
        case CMD_ALLOCATIONS:
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
                acpi_ut_dump_allocation_info ();
+#endif
                break;
 #endif
 
@@ -332,6 +316,10 @@ acpi_db_display_statistics (
 
        case CMD_OBJECTS:
 
+#ifndef PARSER_ONLY
+
+               acpi_db_count_namespace_objects ();
+
                acpi_os_printf ("\n_objects defined in the current namespace:\n\n");
 
                acpi_os_printf ("%16.16s % 10.10s % 10.10s\n", "ACPI_TYPE", "NODES", "OBJECTS");
@@ -345,54 +333,55 @@ acpi_db_display_statistics (
                        acpi_gbl_node_type_count_misc, acpi_gbl_obj_type_count_misc);
 
                acpi_os_printf ("%16.16s % 10ld% 10ld\n", "TOTALS:",
-                       num_nodes, num_objects);
-
-
-/*
-               Acpi_os_printf ("\n");
+                       acpi_gbl_num_nodes, acpi_gbl_num_objects);
 
-               Acpi_os_printf ("ASL/AML Grammar Usage:\n\n");
-               Acpi_os_printf ("Elements Inside Methods:....% 7ld\n", Num_method_elements);
-               Acpi_os_printf ("Elements Outside Methods:...% 7ld\n", Num_grammar_elements - Num_method_elements);
-               Acpi_os_printf ("Total Grammar Elements:.....% 7ld\n", Num_grammar_elements);
-*/
+#endif
                break;
 
        case CMD_MEMORY:
 
-               acpi_os_printf ("\n_dynamic Memory Estimates:\n\n");
-               acpi_os_printf ("Parse Tree without Methods:.% 7ld\n", size_of_parse_tree);
-               acpi_os_printf ("Control Method Parse Trees:.% 7ld (If parsed simultaneously)\n", size_of_method_trees);
-               acpi_os_printf ("Namespace Nodes:............% 7ld (%d nodes)\n", sizeof (ACPI_NAMESPACE_NODE) * num_nodes, num_nodes);
-               acpi_os_printf ("Named Internal Objects......% 7ld\n", size_of_acpi_objects);
-               acpi_os_printf ("State Cache size............% 7ld\n", acpi_gbl_generic_state_cache_depth * sizeof (ACPI_GENERIC_STATE));
-               acpi_os_printf ("Parse Cache size............% 7ld\n", acpi_gbl_parse_cache_depth * sizeof (ACPI_PARSE_OBJECT));
-               acpi_os_printf ("Object Cache size...........% 7ld\n", acpi_gbl_object_cache_depth * sizeof (ACPI_OPERAND_OBJECT));
-               acpi_os_printf ("Walk_state Cache size........% 7ld\n", acpi_gbl_walk_state_cache_depth * sizeof (ACPI_WALK_STATE));
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+               acpi_os_printf ("\n----Object and Cache Statistics---------------------------------------------\n");
 
-               acpi_os_printf ("\n");
+               for (i = 0; i < ACPI_NUM_MEM_LISTS; i++)
+               {
+                       acpi_os_printf ("\n%s\n", acpi_gbl_memory_lists[i].list_name);
+
+                       if (acpi_gbl_memory_lists[i].max_cache_depth > 0)
+                       {
+                               acpi_os_printf ("  Cache: [Depth Max Avail Size]         % 7d % 7d % 7d % 7d B\n",
+                                               acpi_gbl_memory_lists[i].cache_depth,
+                                               acpi_gbl_memory_lists[i].max_cache_depth,
+                                               acpi_gbl_memory_lists[i].max_cache_depth - acpi_gbl_memory_lists[i].cache_depth,
+                                               (acpi_gbl_memory_lists[i].cache_depth * acpi_gbl_memory_lists[i].object_size));
+
+                               acpi_os_printf ("  Cache: [Requests Hits Misses Obj_size] % 7d % 7d % 7d % 7d B\n",
+                                               acpi_gbl_memory_lists[i].cache_requests,
+                                               acpi_gbl_memory_lists[i].cache_hits,
+                                               acpi_gbl_memory_lists[i].cache_requests - acpi_gbl_memory_lists[i].cache_hits,
+                                               acpi_gbl_memory_lists[i].object_size);
+                       }
+
+                       outstanding = acpi_gbl_memory_lists[i].total_allocated -
+                                         acpi_gbl_memory_lists[i].total_freed -
+                                         acpi_gbl_memory_lists[i].cache_depth;
+
+                       if (acpi_gbl_memory_lists[i].object_size)
+                       {
+                               size = ROUND_UP_TO_1_k (outstanding * acpi_gbl_memory_lists[i].object_size);
+                       }
+                       else
+                       {
+                               size = ROUND_UP_TO_1_k (acpi_gbl_memory_lists[i].current_total_size);
+                       }
+
+                       acpi_os_printf ("  Mem:   [Alloc Free Outstanding Size]  % 7d % 7d % 7d % 7d Kb\n",
+                                       acpi_gbl_memory_lists[i].total_allocated,
+                                       acpi_gbl_memory_lists[i].total_freed,
+                                       outstanding, size);
+               }
+#endif
 
-               acpi_os_printf ("Cache Statistics:\n\n");
-               acpi_os_printf ("State Cache requests........% 7ld\n", acpi_gbl_state_cache_requests);
-               acpi_os_printf ("State Cache hits............% 7ld\n", acpi_gbl_state_cache_hits);
-               acpi_os_printf ("State Cache depth...........% 7ld (%d remaining entries)\n", acpi_gbl_generic_state_cache_depth,
-                                 MAX_STATE_CACHE_DEPTH - acpi_gbl_generic_state_cache_depth);
-               acpi_os_printf ("Parse Cache requests........% 7ld\n", acpi_gbl_parse_cache_requests);
-               acpi_os_printf ("Parse Cache hits............% 7ld\n", acpi_gbl_parse_cache_hits);
-               acpi_os_printf ("Parse Cache depth...........% 7ld (%d remaining entries)\n", acpi_gbl_parse_cache_depth,
-                                 MAX_PARSE_CACHE_DEPTH - acpi_gbl_parse_cache_depth);
-               acpi_os_printf ("Ext Parse Cache requests....% 7ld\n", acpi_gbl_ext_parse_cache_requests);
-               acpi_os_printf ("Ext Parse Cache hits........% 7ld\n", acpi_gbl_ext_parse_cache_hits);
-               acpi_os_printf ("Ext Parse Cache depth.......% 7ld (%d remaining entries)\n", acpi_gbl_ext_parse_cache_depth,
-                                 MAX_EXTPARSE_CACHE_DEPTH - acpi_gbl_ext_parse_cache_depth);
-               acpi_os_printf ("Object Cache requests.......% 7ld\n", acpi_gbl_object_cache_requests);
-               acpi_os_printf ("Object Cache hits...........% 7ld\n", acpi_gbl_object_cache_hits);
-               acpi_os_printf ("Object Cache depth..........% 7ld (%d remaining entries)\n", acpi_gbl_object_cache_depth,
-                                 MAX_OBJECT_CACHE_DEPTH - acpi_gbl_object_cache_depth);
-               acpi_os_printf ("Walk_state Cache requests....% 7ld\n", acpi_gbl_walk_state_cache_requests);
-               acpi_os_printf ("Walk_state Cache hits........% 7ld\n", acpi_gbl_walk_state_cache_hits);
-               acpi_os_printf ("Walk_state Cache depth.......% 7ld (%d remaining entries)\n", acpi_gbl_walk_state_cache_depth,
-                                 MAX_WALK_CACHE_DEPTH - acpi_gbl_walk_state_cache_depth);
                break;
 
        case CMD_MISC:
@@ -439,13 +428,24 @@ 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 ("Operand_object %3d\n", sizeof (ACPI_OPERAND_OBJECT));
-               acpi_os_printf ("Namespace_node %3d\n", sizeof (ACPI_NAMESPACE_NODE));
+               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 ("Operand_object %3d\n", sizeof (acpi_operand_object));
+               acpi_os_printf ("Namespace_node %3d\n", sizeof (acpi_namespace_node));
 
                break;
 
+
+       case CMD_STACK:
+
+               size = acpi_gbl_entry_stack_pointer - acpi_gbl_lowest_stack_pointer;
+
+               acpi_os_printf ("\n_subsystem 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);
+               break;
        }
 
        acpi_os_printf ("\n");
index 214c8e8eca89b3f6432939ebe13f4d4217ef892f..069baced35ef57de2d3f078e56ab5febeddbd319 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: dbutils - AML debugger utilities
- *              $Revision: 37 $
+ *              $Revision: 43 $
  *
  ******************************************************************************/
 
@@ -62,7 +62,7 @@ acpi_db_set_output_destination (
        acpi_gbl_db_output_flags = (u8) output_flags;
 
        if (output_flags & DB_REDIRECTABLE_OUTPUT) {
-               if (output_to_file) {
+               if (acpi_gbl_db_output_to_file) {
                        acpi_dbg_level = acpi_gbl_db_debug_level;
                }
        }
@@ -91,7 +91,7 @@ acpi_db_dump_buffer (
 
        acpi_os_printf ("\n_location %X:\n", address);
 
-       acpi_dbg_level |= TRACE_TABLES;
+       acpi_dbg_level |= ACPI_LV_TABLES;
        acpi_ut_dump_buffer ((u8 *) address, 64, DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
 }
 
@@ -111,7 +111,7 @@ acpi_db_dump_buffer (
 
 void
 acpi_db_dump_object (
-       ACPI_OBJECT             *obj_desc,
+       acpi_object             *obj_desc,
        u32                     level)
 {
        u32                     i;
@@ -129,12 +129,14 @@ acpi_db_dump_object (
        switch (obj_desc->type) {
        case ACPI_TYPE_ANY:
 
-               acpi_os_printf ("[Object Reference] Value: %p\n", obj_desc->reference.handle);
+               acpi_os_printf ("[Object Reference] = %p\n", obj_desc->reference.handle);
                break;
 
 
        case ACPI_TYPE_INTEGER:
-               acpi_os_printf ("[Number] Value: %ld (%lX)\n", obj_desc->integer.value, obj_desc->integer.value);
+
+               acpi_os_printf ("[Integer] = %X%8.8X\n", HIDWORD (obj_desc->integer.value),
+                                LODWORD (obj_desc->integer.value));
                break;
 
 
@@ -150,7 +152,7 @@ acpi_db_dump_object (
 
        case ACPI_TYPE_BUFFER:
 
-               acpi_os_printf ("[Buffer] Value: ");
+               acpi_os_printf ("[Buffer] = ");
                acpi_ut_dump_buffer ((u8 *) obj_desc->buffer.pointer, obj_desc->buffer.length, DB_DWORD_DISPLAY, _COMPONENT);
                break;
 
@@ -166,17 +168,23 @@ acpi_db_dump_object (
 
 
        case INTERNAL_TYPE_REFERENCE:
-               acpi_os_printf ("[Object Reference] Value: %p\n", obj_desc->reference.handle);
+
+               acpi_os_printf ("[Object Reference] = %p\n", obj_desc->reference.handle);
                break;
 
+
        case ACPI_TYPE_PROCESSOR:
+
                acpi_os_printf ("[Processor]\n");
                break;
 
+
        case ACPI_TYPE_POWER:
+
                acpi_os_printf ("[Power Resource]\n");
                break;
 
+
        default:
 
                acpi_os_printf ("[Unknown Type] %X \n", obj_desc->type);
@@ -247,15 +255,15 @@ acpi_db_prep_namestring (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_db_second_pass_parse (
-       ACPI_PARSE_OBJECT       *root)
+       acpi_parse_object       *root)
 {
-       ACPI_PARSE_OBJECT       *op = root;
-       ACPI_PARSE2_OBJECT      *method;
-       ACPI_PARSE_OBJECT       *search_op;
-       ACPI_PARSE_OBJECT       *start_op;
-       ACPI_STATUS             status = AE_OK;
+       acpi_parse_object       *op = root;
+       acpi_parse2_object      *method;
+       acpi_parse_object       *search_op;
+       acpi_parse_object       *start_op;
+       acpi_status             status = AE_OK;
        u32                     base_aml_offset;
 
 
@@ -263,7 +271,7 @@ acpi_db_second_pass_parse (
 
        while (op) {
                if (op->opcode == AML_METHOD_OP) {
-                       method = (ACPI_PARSE2_OBJECT *) op;
+                       method = (acpi_parse2_object *) op;
                        status = acpi_ps_parse_aml (op, method->data, method->length, 0,
                                         NULL, NULL, NULL, acpi_ds_load1_begin_op, acpi_ds_load1_end_op);
 
@@ -311,13 +319,13 @@ acpi_db_second_pass_parse (
  *
  ******************************************************************************/
 
-ACPI_NAMESPACE_NODE *
+acpi_namespace_node *
 acpi_db_local_ns_lookup (
        NATIVE_CHAR             *name)
 {
        NATIVE_CHAR             *internal_path;
-       ACPI_STATUS             status;
-       ACPI_NAMESPACE_NODE     *node = NULL;
+       acpi_status             status;
+       acpi_namespace_node     *node = NULL;
 
 
        acpi_db_prep_namestring (name);
@@ -339,11 +347,11 @@ acpi_db_local_ns_lookup (
                           NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, NULL, &node);
 
        if (ACPI_FAILURE (status)) {
-               acpi_os_printf ("Could not locate name: %s %s\n", name, acpi_ut_format_exception (status));
+               acpi_os_printf ("Could not locate name: %s %s\n", name, acpi_format_exception (status));
        }
 
 
-       acpi_ut_free (internal_path);
+       ACPI_MEM_FREE (internal_path);
 
        return (node);
 }
index c4e76d4a65f8d1b647192b2ee2d148456149ed87..32a082e4fb43f9d73b89c37a5615a2f952e40b37 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: dbxface - AML Debugger external interfaces
- *              $Revision: 37 $
+ *              $Revision: 41 $
  *
  ******************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_db_single_step (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *op,
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *op,
        u8                      op_type)
 {
-       ACPI_PARSE_OBJECT       *next;
-       ACPI_STATUS             status = AE_OK;
+       acpi_parse_object       *next;
+       acpi_status             status = AE_OK;
        u32                     original_debug_level;
-       ACPI_PARSE_OBJECT       *display_op;
+       acpi_parse_object       *display_op;
 
 
+       FUNCTION_ENTRY ();
+
        /* Is there a breakpoint set? */
 
        if (walk_state->method_breakpoint) {
@@ -81,12 +83,10 @@ 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) {
                return (AE_OK);
        }
@@ -109,16 +109,14 @@ acpi_db_single_step (
                }
        }
 
-
        /*
         * Under certain debug conditions, display this opcode and its operands
         */
-
-       if ((output_to_file)                    ||
+       if ((acpi_gbl_db_output_to_file)        ||
                (acpi_gbl_cm_single_step)           ||
-               (acpi_dbg_level & TRACE_PARSE)) {
-               if ((output_to_file)                ||
-                       (acpi_dbg_level & TRACE_PARSE)) {
+               (acpi_dbg_level & ACPI_LV_PARSE)) {
+               if ((acpi_gbl_db_output_to_file)    ||
+                       (acpi_dbg_level & ACPI_LV_PARSE)) {
                        acpi_os_printf ("\n[Aml_debug] Next AML Opcode to execute:\n");
                }
 
@@ -127,9 +125,8 @@ acpi_db_single_step (
                 * and disable parser trace output for the duration of the display because
                 * we don't want the extraneous debug output)
                 */
-
                original_debug_level = acpi_dbg_level;
-               acpi_dbg_level &= ~(TRACE_PARSE | TRACE_FUNCTIONS);
+               acpi_dbg_level &= ~(ACPI_LV_PARSE | ACPI_LV_FUNCTIONS);
                next = op->next;
                op->next = NULL;
 
@@ -160,14 +157,12 @@ acpi_db_single_step (
                        /* TBD */
                }
 
-
                /* Restore everything */
 
                op->next = next;
                acpi_os_printf ("\n");
                acpi_dbg_level = original_debug_level;
-   }
-
+       }
 
        /* If we are not single stepping, just continue executing the method */
 
@@ -180,7 +175,6 @@ acpi_db_single_step (
         * If we are executing a step-to-call command,
         * Check if this is a method call.
         */
-
        if (acpi_gbl_step_to_next_call) {
                if (op->opcode != AML_INT_METHODCALL_OP) {
                        /* Not a method call, just keep executing */
@@ -198,7 +192,6 @@ 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) {
                acpi_gbl_cm_single_step = FALSE; /* No more single step while executing called method */
 
@@ -244,15 +237,14 @@ acpi_db_single_step (
 
                        /* Get the user input line */
 
-                       acpi_os_get_line (line_buf);
+                       acpi_os_get_line (acpi_gbl_db_line_buf);
                }
 
-               status = acpi_db_command_dispatch (line_buf, walk_state, op);
+               status = acpi_db_command_dispatch (acpi_gbl_db_line_buf, walk_state, op);
        }
 
        /* Acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); */
 
-
        /* User commands complete, continue execution of the interrupted method */
 
        return (status);
@@ -278,12 +270,12 @@ acpi_db_initialize (void)
 
        /* Init globals */
 
-       buffer = acpi_os_allocate (BUFFER_SIZE);
+       acpi_gbl_db_buffer = acpi_os_allocate (ACPI_DEBUG_BUFFER_SIZE);
 
        /* Initial scope is the root */
 
-       scope_buf [0] = '\\';
-       scope_buf [1] = 0;
+       acpi_gbl_db_scope_buf [0] = '\\';
+       acpi_gbl_db_scope_buf [1] = 0;
 
 
        /*
@@ -291,7 +283,6 @@ acpi_db_initialize (void)
         * a separate thread so that the front end can be in another address
         * space, environment, or even another machine.
         */
-
        if (acpi_gbl_debugger_configuration & DEBUGGER_MULTI_THREADED) {
                /* These were created with one unit, grab it */
 
@@ -303,13 +294,12 @@ acpi_db_initialize (void)
                acpi_os_queue_for_execution (0, acpi_db_execute_thread, NULL);
        }
 
-       if (!opt_verbose) {
-               INDENT_STRING = "    ";
-               opt_disasm = TRUE;
-               opt_stats = FALSE;
+       if (!acpi_gbl_db_opt_verbose) {
+               acpi_gbl_db_disasm_indent = " ";
+               acpi_gbl_db_opt_disasm = TRUE;
+               acpi_gbl_db_opt_stats = FALSE;
        }
 
-
        return (0);
 }
 
index 1a8c9405af40203589c12b22451d71e7f9b18e4c..61ffa91f786b7d0a82a8b49610975d0da8b5a7d7 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: dsfield - Dispatcher field routines
- *              $Revision: 41 $
+ *              $Revision: 44 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_create_field (
-       ACPI_PARSE_OBJECT       *op,
-       ACPI_NAMESPACE_NODE     *region_node,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_parse_object       *op,
+       acpi_namespace_node     *region_node,
+       acpi_walk_state         *walk_state)
 {
-       ACPI_STATUS             status = AE_AML_ERROR;
-       ACPI_PARSE_OBJECT       *arg;
-       ACPI_NAMESPACE_NODE     *node;
+       acpi_status             status = AE_AML_ERROR;
+       acpi_parse_object       *arg;
+       acpi_namespace_node     *node;
        u8                      field_flags;
        u32                     field_bit_position = 0;
 
 
+       FUNCTION_TRACE_PTR ("Ds_create_field", op);
+
+
        /* First arg is the name of the parent Op_region */
 
        arg = op->value.arg;
@@ -81,7 +84,7 @@ acpi_ds_create_field (
                                  ACPI_TYPE_REGION, IMODE_EXECUTE,
                                  NS_SEARCH_PARENT, walk_state, &region_node);
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
        }
 
@@ -115,23 +118,22 @@ acpi_ds_create_field (
                case AML_INT_NAMEDFIELD_OP:
 
                        status = acpi_ns_lookup (walk_state->scope_info,
-                                         (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)arg)->name,
+                                         (NATIVE_CHAR *) &((acpi_parse2_object *)arg)->name,
                                          INTERNAL_TYPE_REGION_FIELD, IMODE_LOAD_PASS1,
                                          NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
                                          NULL, &node);
                        if (ACPI_FAILURE (status)) {
-                               return (status);
+                               return_ACPI_STATUS (status);
                        }
 
                        /*
                         * Initialize an object for the new Node that is on
                         * the object stack
                         */
-
                        status = acpi_ex_prep_region_field_value (node, region_node, field_flags,
                                          field_bit_position, arg->value.size);
                        if (ACPI_FAILURE (status)) {
-                               return (status);
+                               return_ACPI_STATUS (status);
                        }
 
                        /* Keep track of bit position for *next* field */
@@ -143,7 +145,7 @@ acpi_ds_create_field (
                arg = arg->next;
        }
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -161,21 +163,24 @@ acpi_ds_create_field (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_create_bank_field (
-       ACPI_PARSE_OBJECT       *op,
-       ACPI_NAMESPACE_NODE     *region_node,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_parse_object       *op,
+       acpi_namespace_node     *region_node,
+       acpi_walk_state         *walk_state)
 {
-       ACPI_STATUS             status = AE_AML_ERROR;
-       ACPI_PARSE_OBJECT       *arg;
-       ACPI_NAMESPACE_NODE     *register_node;
-       ACPI_NAMESPACE_NODE     *node;
+       acpi_status             status = AE_AML_ERROR;
+       acpi_parse_object       *arg;
+       acpi_namespace_node     *register_node;
+       acpi_namespace_node     *node;
        u32                     bank_value;
        u8                      field_flags;
        u32                     field_bit_position = 0;
 
 
+       FUNCTION_TRACE_PTR ("Ds_create_bank_field", op);
+
+
        /* First arg is the name of the parent Op_region */
 
        arg = op->value.arg;
@@ -184,7 +189,7 @@ acpi_ds_create_bank_field (
                                  ACPI_TYPE_REGION, IMODE_EXECUTE,
                                  NS_SEARCH_PARENT, walk_state, &region_node);
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
        }
 
@@ -197,19 +202,19 @@ acpi_ds_create_bank_field (
                          NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
                          NULL, &register_node);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Third arg is the Bank_value */
 
        arg = arg->next;
-       bank_value = arg->value.integer;
+       bank_value = arg->value.integer32;
 
 
        /* Next arg is the field flags */
 
        arg = arg->next;
-       field_flags = (u8) arg->value.integer;
+       field_flags = arg->value.integer8;
 
        /* Each remaining arg is a Named Field */
 
@@ -236,24 +241,23 @@ acpi_ds_create_bank_field (
                case AML_INT_NAMEDFIELD_OP:
 
                        status = acpi_ns_lookup (walk_state->scope_info,
-                                         (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)arg)->name,
+                                         (NATIVE_CHAR *) &((acpi_parse2_object *)arg)->name,
                                          INTERNAL_TYPE_REGION_FIELD, IMODE_LOAD_PASS1,
                                          NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
                                          NULL, &node);
                        if (ACPI_FAILURE (status)) {
-                               return (status);
+                               return_ACPI_STATUS (status);
                        }
 
                        /*
                         * Initialize an object for the new Node that is on
                         * the object stack
                         */
-
                        status = acpi_ex_prep_bank_field_value (node, region_node, register_node,
                                          bank_value, field_flags, field_bit_position,
                                          arg->value.size);
                        if (ACPI_FAILURE (status)) {
-                               return (status);
+                               return_ACPI_STATUS (status);
                        }
 
                        /* Keep track of bit position for the *next* field */
@@ -266,7 +270,7 @@ acpi_ds_create_bank_field (
                arg = arg->next;
        }
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -284,21 +288,24 @@ acpi_ds_create_bank_field (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_create_index_field (
-       ACPI_PARSE_OBJECT       *op,
-       ACPI_NAMESPACE_NODE     *region_node,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_parse_object       *op,
+       acpi_namespace_node     *region_node,
+       acpi_walk_state         *walk_state)
 {
-       ACPI_STATUS             status;
-       ACPI_PARSE_OBJECT       *arg;
-       ACPI_NAMESPACE_NODE     *node;
-       ACPI_NAMESPACE_NODE     *index_register_node;
-       ACPI_NAMESPACE_NODE     *data_register_node;
+       acpi_status             status;
+       acpi_parse_object       *arg;
+       acpi_namespace_node     *node;
+       acpi_namespace_node     *index_register_node;
+       acpi_namespace_node     *data_register_node;
        u8                      field_flags;
        u32                     field_bit_position = 0;
 
 
+       FUNCTION_TRACE_PTR ("Ds_create_index_field", op);
+
+
        arg = op->value.arg;
 
        /* First arg is the name of the Index register */
@@ -308,7 +315,7 @@ acpi_ds_create_index_field (
                          NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
                          NULL, &index_register_node);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Second arg is the data register */
@@ -320,7 +327,7 @@ acpi_ds_create_index_field (
                          NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
                          NULL, &data_register_node);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
 
@@ -355,24 +362,23 @@ acpi_ds_create_index_field (
                case AML_INT_NAMEDFIELD_OP:
 
                        status = acpi_ns_lookup (walk_state->scope_info,
-                                         (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)arg)->name,
+                                         (NATIVE_CHAR *) &((acpi_parse2_object *)arg)->name,
                                          INTERNAL_TYPE_INDEX_FIELD, IMODE_LOAD_PASS1,
                                          NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
                                          NULL, &node);
                        if (ACPI_FAILURE (status)) {
-                               return (status);
+                               return_ACPI_STATUS (status);
                        }
 
                        /*
                         * Initialize an object for the new Node that is on
                         * the object stack
                         */
-
                        status = acpi_ex_prep_index_field_value (node, index_register_node,
                                          data_register_node, field_flags,
                                          field_bit_position, arg->value.size);
                        if (ACPI_FAILURE (status)) {
-                               return (status);
+                               return_ACPI_STATUS (status);
                        }
 
                        /* Keep track of bit position for the *next* field */
@@ -383,6 +389,8 @@ acpi_ds_create_index_field (
 
                default:
 
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid opcode in field list: %X\n",
+                               arg->opcode));
                        status = AE_AML_ERROR;
                        break;
                }
@@ -390,7 +398,7 @@ acpi_ds_create_index_field (
                arg = arg->next;
        }
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
index 324defed4e3c457fd5183b671079fb8682ac7786..169d42537fed5f30dd87ed476b2efd2b31284a4b 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: dsmethod - Parser/Interpreter interface - control method parsing
- *              $Revision: 63 $
+ *              $Revision: 65 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_parse_method (
-       ACPI_HANDLE             obj_handle)
+       acpi_handle             obj_handle)
 {
-       ACPI_STATUS             status;
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_PARSE_OBJECT       *op;
-       ACPI_NAMESPACE_NODE     *node;
-       ACPI_OWNER_ID           owner_id;
+       acpi_status             status;
+       acpi_operand_object     *obj_desc;
+       acpi_parse_object       *op;
+       acpi_namespace_node     *node;
+       acpi_owner_id           owner_id;
+
+
+       FUNCTION_TRACE_PTR ("Ds_parse_method", obj_handle);
 
 
        /* Parameter Validation */
 
        if (!obj_handle) {
-               return (AE_NULL_ENTRY);
+               return_ACPI_STATUS (AE_NULL_ENTRY);
        }
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Parsing [%4.4s] **** Named_obj=%p\n",
+               &((acpi_namespace_node *)obj_handle)->name, obj_handle));
+
 
        /* Extract the method object from the method Node */
 
-       node = (ACPI_NAMESPACE_NODE *) obj_handle;
+       node = (acpi_namespace_node *) obj_handle;
        obj_desc = node->object;
        if (!obj_desc) {
-               return (AE_NULL_OBJECT);
+               return_ACPI_STATUS (AE_NULL_OBJECT);
        }
 
         /* Create a mutex for the method if there is a concurrency limit */
@@ -90,7 +96,7 @@ acpi_ds_parse_method (
                                   obj_desc->method.concurrency,
                                   &obj_desc->method.semaphore);
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
        }
 
@@ -100,7 +106,7 @@ acpi_ds_parse_method (
         */
        op = acpi_ps_alloc_op (AML_METHOD_OP);
        if (!op) {
-               return (AE_NO_MEMORY);
+               return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
        /* Init new op with the method name and pointer back to the Node */
@@ -126,7 +132,7 @@ acpi_ds_parse_method (
                           acpi_ds_load1_begin_op, acpi_ds_load1_end_op);
 
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Get a new Owner_id for objects created by this method */
@@ -134,12 +140,15 @@ acpi_ds_parse_method (
        owner_id = acpi_ut_allocate_owner_id (OWNER_TYPE_METHOD);
        obj_desc->method.owning_id = owner_id;
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** [%4.4s] Parsed **** Named_obj=%p Op=%p\n",
+               &((acpi_namespace_node *)obj_handle)->name, obj_handle, op));
+
        /* Install the parsed tree in the method object */
        /* TBD: [Restructure] Obsolete field? */
 
        acpi_ps_delete_parse_tree (op);
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -161,17 +170,20 @@ acpi_ds_parse_method (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_begin_method_execution (
-       ACPI_NAMESPACE_NODE     *method_node,
-       ACPI_OPERAND_OBJECT     *obj_desc,
-       ACPI_NAMESPACE_NODE     *calling_method_node)
+       acpi_namespace_node     *method_node,
+       acpi_operand_object     *obj_desc,
+       acpi_namespace_node     *calling_method_node)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+
+       FUNCTION_TRACE_PTR ("Ds_begin_method_execution", method_node);
 
 
        if (!method_node) {
-               return (AE_NULL_ENTRY);
+               return_ACPI_STATUS (AE_NULL_ENTRY);
        }
 
 
@@ -190,7 +202,7 @@ acpi_ds_begin_method_execution (
                 */
                if (method_node == calling_method_node) {
                        if (obj_desc->method.thread_count >= obj_desc->method.concurrency) {
-                               return (AE_AML_METHOD_LIMIT);
+                               return_ACPI_STATUS (AE_AML_METHOD_LIMIT);
                        }
                }
 
@@ -209,7 +221,7 @@ acpi_ds_begin_method_execution (
         */
        obj_desc->method.thread_count++;
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -226,31 +238,36 @@ acpi_ds_begin_method_execution (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_call_control_method (
-       ACPI_WALK_LIST          *walk_list,
-       ACPI_WALK_STATE         *this_walk_state,
-       ACPI_PARSE_OBJECT       *op)
+       acpi_walk_list          *walk_list,
+       acpi_walk_state         *this_walk_state,
+       acpi_parse_object       *op)
 {
-       ACPI_STATUS             status;
-       ACPI_NAMESPACE_NODE     *method_node;
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_WALK_STATE         *next_walk_state;
-       ACPI_PARSE_STATE        *parser_state;
+       acpi_status             status;
+       acpi_namespace_node     *method_node;
+       acpi_operand_object     *obj_desc;
+       acpi_walk_state         *next_walk_state;
+       acpi_parse_state        *parser_state;
        u32                     i;
 
 
+       FUNCTION_TRACE_PTR ("Ds_call_control_method", this_walk_state);
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Execute method %p, currentstate=%p\n",
+               this_walk_state->prev_op, this_walk_state));
+
        /*
         * Get the namespace entry for the control method we are about to call
         */
        method_node = this_walk_state->method_call_node;
        if (!method_node) {
-               return (AE_NULL_ENTRY);
+               return_ACPI_STATUS (AE_NULL_ENTRY);
        }
 
        obj_desc = acpi_ns_get_attached_object (method_node);
        if (!obj_desc) {
-               return (AE_NULL_OBJECT);
+               return_ACPI_STATUS (AE_NULL_OBJECT);
        }
 
 
@@ -259,7 +276,7 @@ acpi_ds_call_control_method (
        status = acpi_ds_begin_method_execution (method_node, obj_desc,
                          this_walk_state->method_node);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Create and initialize a new parser state */
@@ -267,7 +284,7 @@ acpi_ds_call_control_method (
        parser_state = acpi_ps_create_state (obj_desc->method.pcode,
                           obj_desc->method.pcode_length);
        if (!parser_state) {
-               return (AE_NO_MEMORY);
+               return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
        acpi_ps_init_scope (parser_state, NULL);
@@ -281,7 +298,7 @@ acpi_ds_call_control_method (
        if (!next_walk_state) {
                /* TBD: delete parser state */
 
-               return (AE_NO_MEMORY);
+               return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
        next_walk_state->walk_type          = WALK_METHOD;
@@ -323,7 +340,7 @@ acpi_ds_call_control_method (
 
        op = acpi_ps_alloc_op (AML_SCOPE_OP);
        if (!op) {
-               return (AE_NO_MEMORY);
+               return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
        status = acpi_ps_parse_aml (op, obj_desc->method.pcode,
@@ -348,7 +365,10 @@ acpi_ds_call_control_method (
        this_walk_state->num_operands = 0;
 
 
-       return (AE_OK);
+       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Starting nested execution, newstate=%p\n",
+               next_walk_state));
+
+       return_ACPI_STATUS (AE_OK);
 
 
        /* On error, we must delete the new walk state */
@@ -356,7 +376,7 @@ acpi_ds_call_control_method (
 cleanup:
        acpi_ds_terminate_control_method (next_walk_state);
        acpi_ds_delete_walk_state (next_walk_state);
-       return (status);
+       return_ACPI_STATUS (status);
 
 }
 
@@ -374,12 +394,15 @@ cleanup:
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_restart_control_method (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_OPERAND_OBJECT     *return_desc)
+       acpi_walk_state         *walk_state,
+       acpi_operand_object     *return_desc)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE_PTR ("Ds_restart_control_method", walk_state);
 
 
        if (return_desc) {
@@ -391,7 +414,7 @@ acpi_ds_restart_control_method (
                        status = acpi_ds_result_push (return_desc, walk_state);
                        if (ACPI_FAILURE (status)) {
                                acpi_ut_remove_reference (return_desc);
-                               return (status);
+                               return_ACPI_STATUS (status);
                        }
                }
 
@@ -405,8 +428,13 @@ acpi_ds_restart_control_method (
 
        }
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+               "Method=%p Return=%p Return_used?=%X Res_stack=%p State=%p\n",
+               walk_state->method_call_op, return_desc, walk_state->return_used,
+               walk_state->results, walk_state));
 
-       return (AE_OK);
+
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -424,19 +452,22 @@ acpi_ds_restart_control_method (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_terminate_control_method (
-       ACPI_WALK_STATE         *walk_state)
+       acpi_walk_state         *walk_state)
 {
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_NAMESPACE_NODE     *method_node;
+       acpi_operand_object     *obj_desc;
+       acpi_namespace_node     *method_node;
+
+
+       FUNCTION_TRACE_PTR ("Ds_terminate_control_method", walk_state);
 
 
        /* The method object should be stored in the walk state */
 
        obj_desc = walk_state->method_desc;
        if (!obj_desc) {
-               return (AE_OK);
+               return_ACPI_STATUS (AE_OK);
        }
 
        /* Delete all arguments and locals */
@@ -488,7 +519,7 @@ acpi_ds_terminate_control_method (
        }
 
        acpi_ut_release_mutex (ACPI_MTX_PARSER);
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
index 626b9980aeb9b7ae9db73f689d6fe621bb76a531..29e3dac1001cbd4bb86438f1cdb243c0cb65fe41 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: dsmthdat - control method arguments and local variables
- *              $Revision: 46 $
+ *              $Revision: 49 $
  *
  ******************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_method_data_init (
-       ACPI_WALK_STATE         *walk_state)
+       acpi_walk_state         *walk_state)
 {
        u32                     i;
 
 
+       FUNCTION_TRACE ("Ds_method_data_init");
+
        /*
         * Walk_state fields are initialized to zero by the
-        * Acpi_ut_callocate().
+        * ACPI_MEM_CALLOCATE().
         *
         * An Node is assigned to each argument and local so
         * that Ref_of() can return a pointer to the Node.
@@ -89,7 +91,7 @@ acpi_ds_method_data_init (
                walk_state->local_variables[i].flags  = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL;
        }
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -106,19 +108,26 @@ acpi_ds_method_data_init (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_method_data_delete_all (
-       ACPI_WALK_STATE         *walk_state)
+       acpi_walk_state         *walk_state)
 {
        u32                     index;
-       ACPI_OPERAND_OBJECT     *object;
+       acpi_operand_object     *object;
+
+
+       FUNCTION_TRACE ("Ds_method_data_delete_all");
 
 
        /* Delete the locals */
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Deleting local variables in %p\n", walk_state));
+
        for (index = 0; index < MTH_NUM_LOCALS; index++) {
                object = walk_state->local_variables[index].object;
                if (object) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Local%d=%p\n", index, object));
+
                        /* Remove first */
 
                        walk_state->local_variables[index].object = NULL;
@@ -132,9 +141,13 @@ acpi_ds_method_data_delete_all (
 
        /* Delete the arguments */
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Deleting arguments in %p\n", walk_state));
+
        for (index = 0; index < MTH_NUM_ARGS; index++) {
                object = walk_state->arguments[index].object;
                if (object) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Arg%d=%p\n", index, object));
+
                        /* Remove first */
 
                        walk_state->arguments[index].object = NULL;
@@ -145,7 +158,7 @@ acpi_ds_method_data_delete_all (
                }
        }
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -163,19 +176,23 @@ acpi_ds_method_data_delete_all (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_method_data_init_args (
-       ACPI_OPERAND_OBJECT     **params,
+       acpi_operand_object     **params,
        u32                     max_param_count,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_walk_state         *walk_state)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
        u32                     mindex;
        u32                     pindex;
 
 
+       FUNCTION_TRACE_PTR ("Ds_method_data_init_args", params);
+
+
        if (!params) {
-               return (AE_OK);
+               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "No param list passed to method\n"));
+               return_ACPI_STATUS (AE_OK);
        }
 
        /* Copy passed parameters into the new method stack frame  */
@@ -203,7 +220,8 @@ acpi_ds_method_data_init_args (
                }
        }
 
-       return (AE_OK);
+       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%d args passed to method\n", pindex));
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -223,29 +241,32 @@ acpi_ds_method_data_init_args (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_method_data_get_entry (
        u16                     opcode,
        u32                     index,
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_OPERAND_OBJECT     ***entry)
+       acpi_walk_state         *walk_state,
+       acpi_operand_object     ***entry)
 {
 
+       FUNCTION_TRACE_U32 ("Ds_method_data_get_entry", index);
+
 
        /*
         * Get the requested object.
         * The stack "Opcode" is either a Local_variable or an Argument
         */
-
        switch (opcode) {
 
        case AML_LOCAL_OP:
 
                if (index > MTH_MAX_LOCAL) {
-                       return (AE_BAD_PARAMETER);
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Local_var index %d is invalid (max %d)\n",
+                               index, MTH_MAX_LOCAL));
+                       return_ACPI_STATUS (AE_BAD_PARAMETER);
                }
 
-               *entry = (ACPI_OPERAND_OBJECT  **)
+               *entry = (acpi_operand_object  **)
                                 &walk_state->local_variables[index].object;
                break;
 
@@ -253,20 +274,23 @@ acpi_ds_method_data_get_entry (
        case AML_ARG_OP:
 
                if (index > MTH_MAX_ARG) {
-                       return (AE_BAD_PARAMETER);
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Arg index %d is invalid (max %d)\n",
+                               index, MTH_MAX_ARG));
+                       return_ACPI_STATUS (AE_BAD_PARAMETER);
                }
 
-               *entry = (ACPI_OPERAND_OBJECT  **)
+               *entry = (acpi_operand_object  **)
                                 &walk_state->arguments[index].object;
                break;
 
 
        default:
-               return (AE_BAD_PARAMETER);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Opcode %d is invalid\n", opcode));
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -285,22 +309,25 @@ acpi_ds_method_data_get_entry (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_method_data_set_entry (
        u16                     opcode,
        u32                     index,
-       ACPI_OPERAND_OBJECT     *object,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_operand_object     *object,
+       acpi_walk_state         *walk_state)
 {
-       ACPI_STATUS             status;
-       ACPI_OPERAND_OBJECT     **entry;
+       acpi_status             status;
+       acpi_operand_object     **entry;
+
+
+       FUNCTION_TRACE ("Ds_method_data_set_entry");
 
 
        /* Get a pointer to the stack entry to set */
 
        status = acpi_ds_method_data_get_entry (opcode, index, walk_state, &entry);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Increment ref count so object can't be deleted while installed */
@@ -311,7 +338,7 @@ acpi_ds_method_data_set_entry (
 
        *entry = object;
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -329,22 +356,25 @@ acpi_ds_method_data_set_entry (
  *
  ******************************************************************************/
 
-ACPI_OBJECT_TYPE8
+acpi_object_type8
 acpi_ds_method_data_get_type (
        u16                     opcode,
        u32                     index,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_walk_state         *walk_state)
 {
-       ACPI_STATUS             status;
-       ACPI_OPERAND_OBJECT     **entry;
-       ACPI_OPERAND_OBJECT     *object;
+       acpi_status             status;
+       acpi_operand_object     **entry;
+       acpi_operand_object     *object;
+
+
+       FUNCTION_TRACE ("Ds_method_data_get_type");
 
 
        /* Get a pointer to the requested stack entry */
 
        status = acpi_ds_method_data_get_entry (opcode, index, walk_state, &entry);
        if (ACPI_FAILURE (status)) {
-               return ((ACPI_TYPE_NOT_FOUND));
+               return_VALUE ((ACPI_TYPE_NOT_FOUND));
        }
 
        /* Get the object from the method stack */
@@ -355,10 +385,10 @@ acpi_ds_method_data_get_type (
 
        if (!object) {
                /* Any == 0 => "uninitialized" -- see spec 15.2.3.5.2.28 */
-               return (ACPI_TYPE_ANY);
+               return_VALUE (ACPI_TYPE_ANY);
        }
 
-       return (object->common.type);
+       return_VALUE (object->common.type);
 }
 
 
@@ -375,13 +405,16 @@ acpi_ds_method_data_get_type (
  *
  ******************************************************************************/
 
-ACPI_NAMESPACE_NODE *
+acpi_namespace_node *
 acpi_ds_method_data_get_node (
        u16                     opcode,
        u32                     index,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_walk_state         *walk_state)
 {
-       ACPI_NAMESPACE_NODE     *node = NULL;
+       acpi_namespace_node     *node = NULL;
+
+
+       FUNCTION_TRACE ("Ds_method_data_get_node");
 
 
        switch (opcode) {
@@ -389,7 +422,9 @@ acpi_ds_method_data_get_node (
        case AML_LOCAL_OP:
 
                if (index > MTH_MAX_LOCAL) {
-                       return (node);
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Local index %d is invalid (max %d)\n",
+                               index, MTH_MAX_LOCAL));
+                       return_PTR (node);
                }
 
                node =  &walk_state->local_variables[index];
@@ -399,7 +434,9 @@ acpi_ds_method_data_get_node (
        case AML_ARG_OP:
 
                if (index > MTH_MAX_ARG) {
-                       return (node);
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Arg index %d is invalid (max %d)\n",
+                               index, MTH_MAX_ARG));
+                       return_PTR (node);
                }
 
                node = &walk_state->arguments[index];
@@ -407,11 +444,12 @@ acpi_ds_method_data_get_node (
 
 
        default:
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Opcode %d is invalid\n", opcode));
                break;
        }
 
 
-       return (node);
+       return_PTR (node);
 }
 
 
@@ -433,22 +471,26 @@ acpi_ds_method_data_get_node (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_method_data_get_value (
        u16                     opcode,
        u32                     index,
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_OPERAND_OBJECT     **dest_desc)
+       acpi_walk_state         *walk_state,
+       acpi_operand_object     **dest_desc)
 {
-       ACPI_STATUS             status;
-       ACPI_OPERAND_OBJECT     **entry;
-       ACPI_OPERAND_OBJECT     *object;
+       acpi_status             status;
+       acpi_operand_object     **entry;
+       acpi_operand_object     *object;
+
+
+       FUNCTION_TRACE ("Ds_method_data_get_value");
 
 
        /* Validate the object descriptor */
 
        if (!dest_desc) {
-               return (AE_BAD_PARAMETER);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null object descriptor pointer\n"));
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
 
@@ -456,7 +498,7 @@ acpi_ds_method_data_get_value (
 
        status = acpi_ds_method_data_get_entry (opcode, index, walk_state, &entry);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Get the object from the method stack */
@@ -474,16 +516,21 @@ acpi_ds_method_data_get_value (
                 * was referenced by the method (via the ASL)
                 * before it was initialized.  Either case is an error.
                 */
-
                switch (opcode) {
                case AML_ARG_OP:
 
-                       return (AE_AML_UNINITIALIZED_ARG);
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Arg[%d] at entry %p\n",
+                               index, entry));
+
+                       return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG);
                        break;
 
                case AML_LOCAL_OP:
 
-                       return (AE_AML_UNINITIALIZED_LOCAL);
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Local[%d] at entry %p\n",
+                               index, entry));
+
+                       return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL);
                        break;
                }
        }
@@ -493,11 +540,10 @@ acpi_ds_method_data_get_value (
         * Index points to initialized and valid object stack value.
         * Return an additional reference to the object
         */
-
        *dest_desc = object;
        acpi_ut_add_reference (object);
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -516,22 +562,25 @@ acpi_ds_method_data_get_value (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_method_data_delete_value (
        u16                     opcode,
        u32                     index,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_walk_state         *walk_state)
 {
-       ACPI_STATUS             status;
-       ACPI_OPERAND_OBJECT     **entry;
-       ACPI_OPERAND_OBJECT     *object;
+       acpi_status             status;
+       acpi_operand_object     **entry;
+       acpi_operand_object     *object;
+
+
+       FUNCTION_TRACE ("Ds_method_data_delete_value");
 
 
        /* Get a pointer to the requested entry */
 
        status = acpi_ds_method_data_get_entry (opcode, index, walk_state, &entry);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Get the current entry in this slot k */
@@ -545,7 +594,6 @@ acpi_ds_method_data_delete_value (
         */
        *entry = NULL;
 
-
        if ((object) &&
                (VALID_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_INTERNAL))) {
                /*
@@ -556,8 +604,7 @@ acpi_ds_method_data_delete_value (
                acpi_ut_remove_reference (object);
        }
 
-
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -578,21 +625,26 @@ acpi_ds_method_data_delete_value (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_store_object_to_local (
        u16                     opcode,
        u32                     index,
-       ACPI_OPERAND_OBJECT     *src_desc,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_operand_object     *src_desc,
+       acpi_walk_state         *walk_state)
 {
-       ACPI_STATUS             status;
-       ACPI_OPERAND_OBJECT     **entry;
+       acpi_status             status;
+       acpi_operand_object     **entry;
+
+
+       FUNCTION_TRACE ("Ds_method_data_set_value");
+       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode=%d Idx=%d Obj=%p\n",
+               opcode, index, src_desc));
 
 
        /* Parameter validation */
 
        if (!src_desc) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
 
@@ -604,6 +656,7 @@ acpi_ds_store_object_to_local (
        }
 
        if (*entry == src_desc) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p already installed!\n", src_desc));
                goto cleanup;
        }
 
@@ -614,7 +667,6 @@ acpi_ds_store_object_to_local (
         * is an object reference stored there, we have to do
         * an indirect store!
         */
-
        if (*entry) {
                /*
                 * Check for an indirect store if an argument
@@ -632,20 +684,23 @@ acpi_ds_store_object_to_local (
                 *
                 * Weird, but true.
                 */
-
                if ((opcode == AML_ARG_OP) &&
                        (VALID_DESCRIPTOR_TYPE (*entry, ACPI_DESC_TYPE_NAMED))) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+                               "Arg (%p) is an Obj_ref(Node), storing in %p\n",
+                               src_desc, *entry));
+
                        /* Detach an existing object from the Node */
 
-                       acpi_ns_detach_object ((ACPI_NAMESPACE_NODE *) *entry);
+                       acpi_ns_detach_object ((acpi_namespace_node *) *entry);
 
                        /*
                         * Store this object into the Node
                         * (do the indirect store)
                         */
-                       status = acpi_ns_attach_object ((ACPI_NAMESPACE_NODE *) *entry, src_desc,
+                       status = acpi_ns_attach_object ((acpi_namespace_node *) *entry, src_desc,
                                           src_desc->common.type);
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
 
 
@@ -681,13 +736,13 @@ acpi_ds_store_object_to_local (
 
        /* Normal exit */
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 
 
        /* Error exit */
 
 cleanup:
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
index 6b242ec2bbe2372e216f93d2f65d7540e6424021..6b7a20d22a48818a1bc6313d4a45f245dd030c09 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: dsobject - Dispatcher object management routines
- *              $Revision: 65 $
+ *              $Revision: 75 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_init_one_object (
-       ACPI_HANDLE             obj_handle,
+       acpi_handle             obj_handle,
        u32                     level,
        void                    *context,
        void                    **return_value)
 {
-       ACPI_OBJECT_TYPE8       type;
-       ACPI_STATUS             status;
+       acpi_object_type8       type;
+       acpi_status             status;
        ACPI_INIT_WALK_INFO     *info = (ACPI_INIT_WALK_INFO *) context;
        u8                      table_revision;
 
@@ -78,8 +78,7 @@ acpi_ds_init_one_object (
         * We are only interested in objects owned by the table that
         * was just loaded
         */
-
-       if (((ACPI_NAMESPACE_NODE *) obj_handle)->owner_id !=
+       if (((acpi_namespace_node *) obj_handle)->owner_id !=
                        info->table_desc->table_id) {
                return (AE_OK);
        }
@@ -103,14 +102,16 @@ acpi_ds_init_one_object (
 
                info->method_count++;
 
+               if (!(acpi_dbg_level & ACPI_LV_INIT)) {
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "."));
+               }
 
                /*
                 * Set the execution data width (32 or 64) based upon the
                 * revision number of the parent ACPI table.
                 */
-
                if (table_revision == 1) {
-                       ((ACPI_NAMESPACE_NODE *)obj_handle)->flags |= ANOBJ_DATA_WIDTH_32;
+                       ((acpi_namespace_node *)obj_handle)->flags |= ANOBJ_DATA_WIDTH_32;
                }
 
                /*
@@ -123,6 +124,9 @@ acpi_ds_init_one_object (
                /* TBD: [Errors] what do we do with an error? */
 
                if (ACPI_FAILURE (status)) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Method %p [%4.4s] parse failed! %s\n",
+                               obj_handle, &((acpi_namespace_node *)obj_handle)->name,
+                               acpi_format_exception (status)));
                        break;
                }
 
@@ -158,15 +162,23 @@ acpi_ds_init_one_object (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_initialize_objects (
-       ACPI_TABLE_DESC         *table_desc,
-       ACPI_NAMESPACE_NODE     *start_node)
+       acpi_table_desc         *table_desc,
+       acpi_namespace_node     *start_node)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
        ACPI_INIT_WALK_INFO     info;
 
 
+       FUNCTION_TRACE ("Ds_initialize_objects");
+
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+               "**** 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;
@@ -177,8 +189,19 @@ 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));
+       }
 
-       return (AE_OK);
+       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));
+       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+               "%d Op Regions found\n", info.op_region_count));
+
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -198,23 +221,25 @@ acpi_ds_initialize_objects (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_init_object_from_op (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *op,
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *op,
        u16                     opcode,
-       ACPI_OPERAND_OBJECT     **obj_desc)
+       acpi_operand_object     **ret_obj_desc)
 {
-       ACPI_STATUS             status;
-       ACPI_PARSE_OBJECT       *arg;
-       ACPI_PARSE2_OBJECT      *byte_list;
-       ACPI_OPERAND_OBJECT     *arg_desc;
-       ACPI_OPCODE_INFO        *op_info;
+       acpi_status             status;
+       acpi_parse_object       *arg;
+       acpi_parse2_object      *byte_list;
+       acpi_operand_object     *arg_desc;
+       const acpi_opcode_info  *op_info;
+       acpi_operand_object     *obj_desc;
 
 
        PROC_NAME ("Ds_init_object_from_op");
 
 
+       obj_desc = *ret_obj_desc;
        op_info = acpi_ps_get_opcode_info (opcode);
        if (ACPI_GET_OP_TYPE (op_info) != ACPI_OP_TYPE_OPCODE) {
                /* Unknown opcode */
@@ -225,7 +250,7 @@ acpi_ds_init_object_from_op (
 
        /* Get and prepare the first argument */
 
-       switch ((*obj_desc)->common.type) {
+       switch (obj_desc->common.type) {
        case ACPI_TYPE_BUFFER:
 
                /* First arg is a number */
@@ -245,48 +270,51 @@ acpi_ds_init_object_from_op (
                /* We are expecting a number */
 
                if (arg_desc->common.type != ACPI_TYPE_INTEGER) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                               "Expecting number, got obj: %p type %X\n",
+                               arg_desc, arg_desc->common.type));
                        acpi_ut_remove_reference (arg_desc);
                        return (AE_TYPE);
                }
 
                /* Get the value, delete the internal object */
 
-               (*obj_desc)->buffer.length = (u32) arg_desc->integer.value;
+               obj_desc->buffer.length = (u32) arg_desc->integer.value;
                acpi_ut_remove_reference (arg_desc);
 
                /* Allocate the buffer */
 
-               if ((*obj_desc)->buffer.length == 0) {
-                       (*obj_desc)->buffer.pointer = NULL;
+               if (obj_desc->buffer.length == 0) {
+                       obj_desc->buffer.pointer = NULL;
                        REPORT_WARNING (("Buffer created with zero length in AML\n"));
                        break;
                }
 
                else {
-                       (*obj_desc)->buffer.pointer =
-                                         acpi_ut_callocate ((*obj_desc)->buffer.length);
+                       obj_desc->buffer.pointer = ACPI_MEM_CALLOCATE (
+                                          obj_desc->buffer.length);
 
-                       if (!(*obj_desc)->buffer.pointer) {
+                       if (!obj_desc->buffer.pointer) {
                                return (AE_NO_MEMORY);
                        }
                }
 
                /*
-                * Second arg is the buffer data (optional)
-                * Byte_list can be either individual bytes or a
-                * string initializer!
+                * Second arg is the buffer data (optional) Byte_list can be either
+                * individual bytes or a string initializer.
                 */
+               arg = op->value.arg;         /* skip first arg */
 
-               /* skip first arg */
-               arg = op->value.arg;
-               byte_list = (ACPI_PARSE2_OBJECT *) arg->next;
+               byte_list = (acpi_parse2_object *) arg->next;
                if (byte_list) {
                        if (byte_list->opcode != AML_INT_BYTELIST_OP) {
+                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Expecting bytelist, got: %x\n",
+                                       byte_list));
                                return (AE_TYPE);
                        }
 
-                       MEMCPY ((*obj_desc)->buffer.pointer, byte_list->data,
-                                       (*obj_desc)->buffer.length);
+                       MEMCPY (obj_desc->buffer.pointer, byte_list->data,
+                                       obj_desc->buffer.length);
                }
 
                break;
@@ -295,26 +323,30 @@ acpi_ds_init_object_from_op (
        case ACPI_TYPE_PACKAGE:
 
                /*
-                * When called, an internal package object has already
-                *  been built and is pointed to by *Obj_desc.
-                *  Acpi_ds_build_internal_object build another internal
-                *  package object, so remove reference to the original
-                *  so that it is deleted.  Error checking is done
-                *  within the remove reference function.
+                * When called, an internal package object has already been built and
+                * is pointed to by Obj_desc. Acpi_ds_build_internal_object builds another
+                * internal package object, so remove reference to the original so
+                * that it is deleted.  Error checking is done within the remove
+                * reference function.
                 */
-               acpi_ut_remove_reference(*obj_desc);
-
-               status = acpi_ds_build_internal_object (walk_state, op, obj_desc);
+               acpi_ut_remove_reference (obj_desc);
+               status = acpi_ds_build_internal_object (walk_state, op, ret_obj_desc);
                break;
 
        case ACPI_TYPE_INTEGER:
-               (*obj_desc)->integer.value = op->value.integer;
+               obj_desc->integer.value = op->value.integer;
                break;
 
 
        case ACPI_TYPE_STRING:
-               (*obj_desc)->string.pointer = op->value.string;
-               (*obj_desc)->string.length = STRLEN (op->value.string);
+               obj_desc->string.pointer = op->value.string;
+               obj_desc->string.length = STRLEN (op->value.string);
+
+               /*
+                * The string is contained in the ACPI table, don't ever try
+                * to delete it
+                */
+               obj_desc->common.flags |= AOPOBJ_STATIC_POINTER;
                break;
 
 
@@ -329,27 +361,29 @@ acpi_ds_init_object_from_op (
 
                        /* Split the opcode into a base opcode + offset */
 
-                       (*obj_desc)->reference.opcode = AML_LOCAL_OP;
-                       (*obj_desc)->reference.offset = opcode - AML_LOCAL_OP;
+                       obj_desc->reference.opcode = AML_LOCAL_OP;
+                       obj_desc->reference.offset = opcode - AML_LOCAL_OP;
                        break;
 
+
                case OPTYPE_METHOD_ARGUMENT:
 
                        /* Split the opcode into a base opcode + offset */
 
-                       (*obj_desc)->reference.opcode = AML_ARG_OP;
-                       (*obj_desc)->reference.offset = opcode - AML_ARG_OP;
+                       obj_desc->reference.opcode = AML_ARG_OP;
+                       obj_desc->reference.offset = opcode - AML_ARG_OP;
                        break;
 
+
                default: /* Constants, Literals, etc.. */
 
                        if (op->opcode == AML_INT_NAMEPATH_OP) {
                                /* Node was saved in Op */
 
-                               (*obj_desc)->reference.node = op->node;
+                               obj_desc->reference.node = op->node;
                        }
 
-                       (*obj_desc)->reference.opcode = opcode;
+                       obj_desc->reference.opcode = opcode;
                        break;
                }
 
@@ -358,6 +392,9 @@ acpi_ds_init_object_from_op (
 
        default:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unimplemented data type: %x\n",
+                       obj_desc->common.type));
+
                break;
        }
 
@@ -379,33 +416,35 @@ acpi_ds_init_object_from_op (
  *
  ****************************************************************************/
 
-static ACPI_STATUS
+static acpi_status
 acpi_ds_build_internal_simple_obj (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *op,
-       ACPI_OPERAND_OBJECT     **obj_desc_ptr)
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *op,
+       acpi_operand_object     **obj_desc_ptr)
 {
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_OBJECT_TYPE8       type;
-       ACPI_STATUS             status;
+       acpi_operand_object     *obj_desc;
+       acpi_object_type8       type;
+       acpi_status             status;
        u32                     length;
        char                    *name;
 
 
+       FUNCTION_TRACE ("Ds_build_internal_simple_obj");
+
+
        if (op->opcode == AML_INT_NAMEPATH_OP) {
                /*
                 * This is an object reference.  If The name was
                 * previously looked up in the NS, it is stored in this op.
                 * Otherwise, go ahead and look it up now
                 */
-
                if (!op->node) {
                        status = acpi_ns_lookup (walk_state->scope_info,
                                          op->value.string, ACPI_TYPE_ANY,
                                          IMODE_EXECUTE,
                                          NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE,
                                          NULL,
-                                         (ACPI_NAMESPACE_NODE **)&(op->node));
+                                         (acpi_namespace_node **)&(op->node));
 
                        if (ACPI_FAILURE (status)) {
                                if (status == AE_NOT_FOUND) {
@@ -415,17 +454,19 @@ acpi_ds_build_internal_simple_obj (
                                        if (name) {
                                                REPORT_WARNING (("Reference %s at AML %X not found\n",
                                                                 name, op->aml_offset));
-                                               acpi_ut_free (name);
+                                               ACPI_MEM_FREE (name);
                                        }
+
                                        else {
                                                REPORT_WARNING (("Reference %s at AML %X not found\n",
                                                                   op->value.string, op->aml_offset));
                                        }
+
                                        *obj_desc_ptr = NULL;
                                }
 
                                else {
-                                       return (status);
+                                       return_ACPI_STATUS (status);
                                }
                        }
                }
@@ -447,18 +488,18 @@ acpi_ds_build_internal_simple_obj (
 
        obj_desc = acpi_ut_create_internal_object (type);
        if (!obj_desc) {
-               return (AE_NO_MEMORY);
+               return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
        status = acpi_ds_init_object_from_op (walk_state, op, op->opcode, &obj_desc);
        if (ACPI_FAILURE (status)) {
                acpi_ut_remove_reference (obj_desc);
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        *obj_desc_ptr = obj_desc;
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -476,39 +517,49 @@ acpi_ds_build_internal_simple_obj (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_build_internal_package_obj (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *op,
-       ACPI_OPERAND_OBJECT     **obj_desc_ptr)
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *op,
+       acpi_operand_object     **obj_desc_ptr)
 {
-       ACPI_PARSE_OBJECT       *arg;
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_STATUS             status = AE_OK;
+       acpi_parse_object       *arg;
+       acpi_operand_object     *obj_desc;
+       acpi_status             status = AE_OK;
+
+
+       FUNCTION_TRACE ("Ds_build_internal_package_obj");
 
 
        obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_PACKAGE);
+       *obj_desc_ptr = obj_desc;
        if (!obj_desc) {
-               return (AE_NO_MEMORY);
+               return_ACPI_STATUS (AE_NO_MEMORY);
+       }
+
+       if (op->opcode == AML_VAR_PACKAGE_OP) {
+               /*
+                * Variable length package parameters are evaluated JIT
+                */
+               return_ACPI_STATUS (AE_OK);
        }
 
        /* The first argument must be the package length */
 
        arg = op->value.arg;
-       obj_desc->package.count = arg->value.integer;
+       obj_desc->package.count = arg->value.integer32;
 
        /*
         * Allocate the array of pointers (ptrs to the
         * individual objects) Add an extra pointer slot so
         * that the list is always null terminated.
         */
-
-       obj_desc->package.elements =
-               acpi_ut_callocate ((obj_desc->package.count + 1) * sizeof (void *));
+       obj_desc->package.elements = ACPI_MEM_CALLOCATE (
+                        (obj_desc->package.count + 1) * sizeof (void *));
 
        if (!obj_desc->package.elements) {
                acpi_ut_delete_object_desc (obj_desc);
-               return (AE_NO_MEMORY);
+               return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
        obj_desc->package.next_element = obj_desc->package.elements;
@@ -516,7 +567,6 @@ acpi_ds_build_internal_package_obj (
        /*
         * Now init the elements of the package
         */
-
        arg = arg->next;
        while (arg) {
                if (arg->opcode == AML_PACKAGE_OP) {
@@ -533,8 +583,8 @@ acpi_ds_build_internal_package_obj (
                arg = arg->next;
        }
 
-       *obj_desc_ptr = obj_desc;
-       return (status);
+       obj_desc->package.flags |= AOPOBJ_DATA_VALID;
+       return_ACPI_STATUS (status);
 }
 
 
@@ -552,21 +602,27 @@ acpi_ds_build_internal_package_obj (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_build_internal_object (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *op,
-       ACPI_OPERAND_OBJECT     **obj_desc_ptr)
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *op,
+       acpi_operand_object     **obj_desc_ptr)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
 
 
-       if (op->opcode == AML_PACKAGE_OP) {
+       switch (op->opcode) {
+       case AML_PACKAGE_OP:
+       case AML_VAR_PACKAGE_OP:
+
                status = acpi_ds_build_internal_package_obj (walk_state, op, obj_desc_ptr);
-       }
+               break;
+
+
+       default:
 
-       else {
                status = acpi_ds_build_internal_simple_obj (walk_state, op, obj_desc_ptr);
+               break;
        }
 
        return (status);
@@ -586,31 +642,32 @@ acpi_ds_build_internal_object (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_create_node (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_NAMESPACE_NODE     *node,
-       ACPI_PARSE_OBJECT       *op)
+       acpi_walk_state         *walk_state,
+       acpi_namespace_node     *node,
+       acpi_parse_object       *op)
 {
-       ACPI_STATUS             status;
-       ACPI_OPERAND_OBJECT     *obj_desc;
+       acpi_status             status;
+       acpi_operand_object     *obj_desc;
+
+
+       FUNCTION_TRACE_PTR ("Ds_create_node", op);
 
 
        if (!op->value.arg) {
                /* No arguments, there is nothing to do */
 
-               return (AE_OK);
+               return_ACPI_STATUS (AE_OK);
        }
 
-
        /* Build an internal object for the argument(s) */
 
        status = acpi_ds_build_internal_object (walk_state, op->value.arg, &obj_desc);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
-
        /* Re-type the object according to it's argument */
 
        node->type = obj_desc->common.type;
@@ -622,14 +679,13 @@ acpi_ds_create_node (
                goto cleanup;
        }
 
-       return (status);
+       return_ACPI_STATUS (status);
 
 
 cleanup:
 
        acpi_ut_remove_reference (obj_desc);
-
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
index e3cfa1634ad437a80f21fb5cb0abaf37965993c6..8ab88cae6448fb8a6f613151dcee10726ec10900 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Module Name: dsopcode - Dispatcher Op Region support and handling of
  *                         "control" opcodes
- *              $Revision: 44 $
+ *              $Revision: 52 $
  *
  *****************************************************************************/
 
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_get_buffer_field_arguments (
-       ACPI_OPERAND_OBJECT     *obj_desc)
+       acpi_operand_object     *obj_desc)
 {
-       ACPI_OPERAND_OBJECT     *extra_desc;
-       ACPI_NAMESPACE_NODE     *node;
-       ACPI_PARSE_OBJECT       *op;
-       ACPI_PARSE_OBJECT       *field_op;
-       ACPI_STATUS             status;
-       ACPI_TABLE_DESC         *table_desc;
+       acpi_operand_object     *extra_desc;
+       acpi_namespace_node     *node;
+       acpi_parse_object       *op;
+       acpi_parse_object       *field_op;
+       acpi_status             status;
+       acpi_table_desc         *table_desc;
+
+
+       FUNCTION_TRACE_PTR ("Ds_get_buffer_field_arguments", obj_desc);
 
 
        if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
-               return (AE_OK);
+               return_ACPI_STATUS (AE_OK);
        }
 
 
@@ -73,11 +76,15 @@ acpi_ds_get_buffer_field_arguments (
        extra_desc = obj_desc->buffer_field.extra;
        node = obj_desc->buffer_field.node;
 
+       DEBUG_EXEC(acpi_ut_display_init_pathname (node, " [Field]"));
+       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] Buffer_field JIT Init\n",
+               &node->name));
+
+
        /*
         * Allocate a new parser op to be the root of the parsed
         * Op_region tree
         */
-
        op = acpi_ps_alloc_op (AML_SCOPE_OP);
        if (!op) {
                return (AE_NO_MEMORY);
@@ -91,7 +98,7 @@ acpi_ds_get_buffer_field_arguments (
 
        status = acpi_tb_handle_to_object (node->owner_id, &table_desc);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Pass1: Parse the entire Buffer_field declaration */
@@ -101,10 +108,9 @@ acpi_ds_get_buffer_field_arguments (
                          NULL, NULL, NULL, acpi_ds_load1_begin_op, acpi_ds_load1_end_op);
        if (ACPI_FAILURE (status)) {
                acpi_ps_delete_parse_tree (op);
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
-
        /* Get and init the actual Fiel_unit_op created above */
 
        field_op = op->value.arg;
@@ -141,7 +147,7 @@ acpi_ds_get_buffer_field_arguments (
        acpi_ut_remove_reference (obj_desc->buffer_field.extra);
        obj_desc->buffer_field.extra = NULL;
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -158,20 +164,23 @@ acpi_ds_get_buffer_field_arguments (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_get_region_arguments (
-       ACPI_OPERAND_OBJECT     *obj_desc)
+       acpi_operand_object     *obj_desc)
 {
-       ACPI_OPERAND_OBJECT     *extra_desc = NULL;
-       ACPI_NAMESPACE_NODE     *node;
-       ACPI_PARSE_OBJECT       *op;
-       ACPI_PARSE_OBJECT       *region_op;
-       ACPI_STATUS             status;
-       ACPI_TABLE_DESC         *table_desc;
+       acpi_operand_object     *extra_desc = NULL;
+       acpi_namespace_node     *node;
+       acpi_parse_object       *op;
+       acpi_parse_object       *region_op;
+       acpi_status             status;
+       acpi_table_desc         *table_desc;
+
+
+       FUNCTION_TRACE_PTR ("Ds_get_region_arguments", obj_desc);
 
 
        if (obj_desc->region.flags & AOPOBJ_DATA_VALID) {
-               return (AE_OK);
+               return_ACPI_STATUS (AE_OK);
        }
 
 
@@ -180,11 +189,16 @@ acpi_ds_get_region_arguments (
        extra_desc = obj_desc->region.extra;
        node = obj_desc->region.node;
 
+       DEBUG_EXEC(acpi_ut_display_init_pathname (node, " [Operation Region]"));
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] Op_region Init at AML %p[%x]\n",
+               &node->name, extra_desc->extra.pcode,
+               *(u32*) extra_desc->extra.pcode));
+
        /*
         * Allocate a new parser op to be the root of the parsed
         * Op_region tree
         */
-
        op = acpi_ps_alloc_op (AML_SCOPE_OP);
        if (!op) {
                return (AE_NO_MEMORY);
@@ -198,7 +212,7 @@ acpi_ds_get_region_arguments (
 
        status = acpi_tb_handle_to_object (node->owner_id, &table_desc);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Parse the entire Op_region declaration, creating a parse tree */
@@ -206,13 +220,11 @@ acpi_ds_get_region_arguments (
        status = acpi_ps_parse_aml (op, extra_desc->extra.pcode,
                          extra_desc->extra.pcode_length, 0,
                          NULL, NULL, NULL, acpi_ds_load1_begin_op, acpi_ds_load1_end_op);
-
        if (ACPI_FAILURE (status)) {
                acpi_ps_delete_parse_tree (op);
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
-
        /* Get and init the actual Region_op created above */
 
        region_op = op->value.arg;
@@ -223,7 +235,7 @@ acpi_ds_get_region_arguments (
        region_op->node = node;
        acpi_ps_delete_parse_tree (op);
 
-       /* Acpi_evaluate the address and length arguments for the Op_region */
+       /* Evaluate the address and length arguments for the Op_region */
 
        op = acpi_ps_alloc_op (AML_SCOPE_OP);
        if (!op) {
@@ -242,7 +254,7 @@ acpi_ds_get_region_arguments (
 
        acpi_ps_delete_parse_tree (op);
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -258,12 +270,12 @@ acpi_ds_get_region_arguments (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_initialize_region (
-       ACPI_HANDLE             obj_handle)
+       acpi_handle             obj_handle)
 {
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_STATUS             status;
+       acpi_operand_object     *obj_desc;
+       acpi_status             status;
 
 
        obj_desc = acpi_ns_get_attached_object (obj_handle);
@@ -304,33 +316,32 @@ acpi_ds_initialize_region (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_eval_buffer_field_operands (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *op)
+       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;
+       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_OPERAND_OBJECT     *res_desc = NULL;
-       ACPI_OPERAND_OBJECT     *cnt_desc = NULL;
-       ACPI_OPERAND_OBJECT     *off_desc = NULL;
-       ACPI_OPERAND_OBJECT     *src_desc = NULL;
-       u32                     num_operands = 3;
+       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 */
@@ -341,55 +352,59 @@ acpi_ds_eval_buffer_field_operands (
 
        status = acpi_ds_create_operands (walk_state, next_op);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        obj_desc = acpi_ns_get_attached_object (node);
        if (!obj_desc) {
-               return (AE_NOT_EXIST);
+               return_ACPI_STATUS (AE_NOT_EXIST);
        }
 
 
        /* Resolve the operands */
 
        status = acpi_ex_resolve_operands (op->opcode, WALK_OPERANDS, walk_state);
+       DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, acpi_ps_get_opcode_name (op->opcode),
+                         walk_state->num_operands, "after Acpi_ex_resolve_operands");
 
-       /* Get the operands */
+       if (ACPI_FAILURE (status)) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) bad operand(s) (%X)\n",
+                       acpi_ps_get_opcode_name (op->opcode), status));
 
-       status |= acpi_ds_obj_stack_pop_object (&res_desc, walk_state);
-       if (AML_CREATE_FIELD_OP == op->opcode) {
-               num_operands = 4;
-               status |= acpi_ds_obj_stack_pop_object (&cnt_desc, walk_state);
+               goto cleanup;
        }
 
-       status |= acpi_ds_obj_stack_pop_object (&off_desc, walk_state);
-       status |= acpi_ds_obj_stack_pop_object (&src_desc, walk_state);
-
-       if (ACPI_FAILURE (status)) {
-               /* Invalid parameters on object stack  */
+       /* Get the operands */
 
-               goto cleanup;
+       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;
 
+       offset = (u32) off_desc->integer.value;
 
        /*
         * If Res_desc is a Name, it will be a direct name pointer after
         * Acpi_ex_resolve_operands()
         */
-
        if (!VALID_DESCRIPTOR_TYPE (res_desc, ACPI_DESC_TYPE_NAMED)) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) destination must be a Node\n",
+                       acpi_ps_get_opcode_name (op->opcode)));
+
                status = AE_AML_OPERAND_TYPE;
                goto cleanup;
        }
 
-
        /*
         * Setup the Bit offsets and counts, according to the opcode
         */
-
        switch (op->opcode) {
 
        /* Def_create_field */
@@ -466,6 +481,9 @@ acpi_ds_eval_buffer_field_operands (
 
        default:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                       "Internal error - unknown field creation opcode %02x\n",
+                       op->opcode));
                status = AE_AML_BAD_OPCODE;
                goto cleanup;
        }
@@ -474,7 +492,6 @@ acpi_ds_eval_buffer_field_operands (
        /*
         * Setup field according to the object type
         */
-
        switch (src_desc->common.type) {
 
        /* Source_buff :=  Term_arg=>Buffer */
@@ -483,6 +500,9 @@ acpi_ds_eval_buffer_field_operands (
 
                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;
                }
@@ -495,7 +515,7 @@ acpi_ds_eval_buffer_field_operands (
                status = acpi_ex_prep_common_field_object (obj_desc, field_flags,
                                  bit_offset, bit_count);
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
 
                obj_desc->buffer_field.buffer_obj = src_desc;
@@ -512,7 +532,17 @@ acpi_ds_eval_buffer_field_operands (
 
        default:
 
+               if ((src_desc->common.type > (u8) INTERNAL_TYPE_REFERENCE) || !acpi_ut_valid_object_type (src_desc->common.type)) /* TBD: This line MUST be a single line until Acpi_src can handle it (block deletion) */ {
+                       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)));
+               }
 
                status = AE_AML_OPERAND_TYPE;
                goto cleanup;
@@ -550,7 +580,7 @@ cleanup:
                obj_desc->buffer_field.flags |= AOPOBJ_DATA_VALID;
        }
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -567,48 +597,56 @@ cleanup:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_eval_region_operands (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *op)
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *op)
 {
-       ACPI_STATUS             status;
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_OPERAND_OBJECT     *operand_desc;
-       ACPI_NAMESPACE_NODE     *node;
-       ACPI_PARSE_OBJECT       *next_op;
+       acpi_status             status;
+       acpi_operand_object     *obj_desc;
+       acpi_operand_object     *operand_desc;
+       acpi_namespace_node     *node;
+       acpi_parse_object       *next_op;
+
+
+       FUNCTION_TRACE_PTR ("Ds_eval_region_operands", op);
 
 
        /*
         * This is where we evaluate the address and length fields of the Op_region declaration
         */
-
        node =  op->node;
 
        /* Next_op points to the op that holds the Space_iD */
+
        next_op = op->value.arg;
 
        /* Next_op points to address op */
+
        next_op = next_op->next;
 
        /* Acpi_evaluate/create the address and length operands */
 
        status = acpi_ds_create_operands (walk_state, next_op);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Resolve the length and address operands to numbers */
 
        status = acpi_ex_resolve_operands (op->opcode, WALK_OPERANDS, walk_state);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
+       DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE,
+                         acpi_ps_get_opcode_name (op->opcode),
+                         1, "after Acpi_ex_resolve_operands");
+
 
        obj_desc = acpi_ns_get_attached_object (node);
        if (!obj_desc) {
-               return (AE_NOT_EXIST);
+               return_ACPI_STATUS (AE_NOT_EXIST);
        }
 
        /*
@@ -630,11 +668,15 @@ acpi_ds_eval_region_operands (
        acpi_ut_remove_reference (operand_desc);
 
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Rgn_obj %p Addr %8.8lX%8.8lX Len %X\n",
+               obj_desc, HIDWORD(obj_desc->region.address), LODWORD(obj_desc->region.address),
+               obj_desc->region.length));
+
        /* Now the address and length are valid for this opregion */
 
        obj_desc->region.flags |= AOPOBJ_DATA_VALID;
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -652,18 +694,21 @@ acpi_ds_eval_region_operands (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_exec_begin_control_op (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *op)
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *op)
 {
-       ACPI_STATUS             status = AE_OK;
-       ACPI_GENERIC_STATE      *control_state;
+       acpi_status             status = AE_OK;
+       acpi_generic_state      *control_state;
 
 
        PROC_NAME ("Ds_exec_begin_control_op");
 
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", op,
+               op->opcode, walk_state));
+
        switch (op->opcode) {
        case AML_IF_OP:
        case AML_WHILE_OP:
@@ -673,7 +718,6 @@ acpi_ds_exec_begin_control_op (
                 * constructs. We need to manage these as a stack, in order
                 * to handle nesting.
                 */
-
                control_state = acpi_ut_create_control_state ();
                if (!control_state) {
                        status = AE_NO_MEMORY;
@@ -733,13 +777,13 @@ acpi_ds_exec_begin_control_op (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_exec_end_control_op (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *op)
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *op)
 {
-       ACPI_STATUS             status = AE_OK;
-       ACPI_GENERIC_STATE      *control_state;
+       acpi_status             status = AE_OK;
+       acpi_generic_state      *control_state;
 
 
        PROC_NAME ("Ds_exec_end_control_op");
@@ -748,11 +792,12 @@ acpi_ds_exec_end_control_op (
        switch (op->opcode) {
        case AML_IF_OP:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[IF_OP] Op=%p\n", op));
+
                /*
                 * Save the result of the predicate in case there is an
                 * ELSE to come
                 */
-
                walk_state->last_predicate =
                        (u8) walk_state->control_state->common.value;
 
@@ -760,7 +805,6 @@ acpi_ds_exec_end_control_op (
                 * Pop the control state that was created at the start
                 * of the IF and free it
                 */
-
                control_state = acpi_ut_pop_generic_state (&walk_state->control_state);
                acpi_ut_delete_generic_state (control_state);
                break;
@@ -773,12 +817,16 @@ acpi_ds_exec_end_control_op (
 
        case AML_WHILE_OP:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", op));
+
                if (walk_state->control_state->common.value) {
                        /* Predicate was true, go back and evaluate it again! */
 
                        status = AE_CTRL_PENDING;
                }
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] termination! Op=%p\n", op));
+
                /* Pop this control state and free it */
 
                control_state = acpi_ut_pop_generic_state (&walk_state->control_state);
@@ -790,6 +838,8 @@ 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));
 
                /*
                 * One optional operand -- the return value
@@ -819,7 +869,6 @@ acpi_ds_exec_end_control_op (
                         * value.  This is the only place where Walk_state->Return_desc
                         * is set to anything other than zero!
                         */
-
                        walk_state->return_desc = walk_state->operands[0];
                }
 
@@ -834,7 +883,6 @@ acpi_ds_exec_end_control_op (
                         *
                         * Allow references created by the Index operator to return unchanged.
                         */
-
                        if (VALID_DESCRIPTOR_TYPE (walk_state->results->results.obj_desc [0], ACPI_DESC_TYPE_INTERNAL) &&
                                ((walk_state->results->results.obj_desc [0])->common.type == INTERNAL_TYPE_REFERENCE) &&
                                ((walk_state->results->results.obj_desc [0])->reference.opcode != AML_INDEX_OP)) {
@@ -860,7 +908,12 @@ acpi_ds_exec_end_control_op (
                }
 
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+                       "Completed RETURN_OP State=%p, Ret_val=%p\n",
+                       walk_state, walk_state->return_desc));
+
                /* End the control method execution right now */
+
                status = AE_CTRL_TERMINATE;
                break;
 
@@ -873,17 +926,22 @@ acpi_ds_exec_end_control_op (
 
        case AML_BREAK_POINT_OP:
 
-               /* Call up to the OS dependent layer to handle this */
+               /* Call up to the OS service layer to handle this */
 
-               acpi_os_breakpoint (NULL);
+               acpi_os_signal (ACPI_SIGNAL_BREAKPOINT, "Executed AML Breakpoint opcode");
 
-               /* If it returns, we are done! */
+               /* If and when it returns, all done. */
 
                break;
 
 
        case AML_BREAK_OP:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+                       "Break to end of current package, Op=%p\n", op));
+
+               /* TBD: update behavior for ACPI 2.0 */
+
                /*
                 * As per the ACPI specification:
                 *      "The break operation causes the current package
@@ -895,13 +953,21 @@ acpi_ds_exec_end_control_op (
                 * the current package, and execution will continue one
                 * level up, starting with the completion of the parent Op.
                 */
-
                status = AE_CTRL_FALSE;
                break;
 
 
+       case AML_CONTINUE_OP: /* ACPI 2.0 */
+
+               status = AE_NOT_IMPLEMENTED;
+               break;
+
+
        default:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown control opcode=%X Op=%p\n",
+                       op->opcode, op));
+
                status = AE_AML_BAD_OPCODE;
                break;
        }
index 3661b1601b6237c88c5bb814e670e87a92c48c1b..1626577c7045e34c7e7a57b00a9ff2981796b9a2 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: dsutils - Dispatcher utilities
- *              $Revision: 58 $
+ *              $Revision: 72 $
  *
  ******************************************************************************/
 
 
 u8
 acpi_ds_is_result_used (
-       ACPI_PARSE_OBJECT       *op,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_parse_object       *op,
+       acpi_walk_state         *walk_state)
 {
-       ACPI_OPCODE_INFO        *parent_info;
+       const acpi_opcode_info  *parent_info;
+
+
+       FUNCTION_TRACE_PTR ("Ds_is_result_used", op);
 
 
        /* Must have both an Op and a Result Object */
 
        if (!op) {
-               return (TRUE);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Op\n"));
+               return_VALUE (TRUE);
        }
 
 
@@ -72,7 +76,7 @@ acpi_ds_is_result_used (
         * invoked from another method has a parent.
         */
        if (!op->parent) {
-               return (FALSE);
+               return_VALUE (FALSE);
        }
 
 
@@ -82,7 +86,8 @@ acpi_ds_is_result_used (
 
        parent_info = acpi_ps_get_opcode_info (op->parent->opcode);
        if (ACPI_GET_OP_TYPE (parent_info) != ACPI_OP_TYPE_OPCODE) {
-               return (FALSE);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown parent opcode. Op=%X\n", op));
+               return_VALUE (FALSE);
        }
 
 
@@ -92,7 +97,6 @@ acpi_ds_is_result_used (
         * Otherwise leave it as is, it will be deleted when it is used
         * as an operand later.
         */
-
        switch (ACPI_GET_OP_CLASS (parent_info)) {
        /*
         * In these cases, the parent will never use the return object
@@ -104,7 +108,9 @@ acpi_ds_is_result_used (
 
                        /* Never delete the return value associated with a return opcode */
 
-                       return (TRUE);
+                       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+                               "Result used, [RETURN] opcode=%X Op=%X\n", op->opcode, op));
+                       return_VALUE (TRUE);
                        break;
 
                case AML_IF_OP:
@@ -114,10 +120,12 @@ acpi_ds_is_result_used (
                         * If we are executing the predicate AND this is the predicate op,
                         * we will use the return value!
                         */
-
                        if ((walk_state->control_state->common.state == CONTROL_PREDICATE_EXECUTING) &&
                                (walk_state->control_state->control.predicate_op == op)) {
-                               return (TRUE);
+                               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+                                       "Result used as a predicate, [IF/WHILE] opcode=%X Op=%X\n",
+                                       op->opcode, op));
+                               return_VALUE (TRUE);
                        }
 
                        break;
@@ -140,10 +148,16 @@ acpi_ds_is_result_used (
                        (op->parent->opcode == AML_CREATE_WORD_FIELD_OP)    ||
                        (op->parent->opcode == AML_CREATE_DWORD_FIELD_OP)   ||
                        (op->parent->opcode == AML_CREATE_QWORD_FIELD_OP)) {
-                       return (TRUE);
+                       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+                               "Result used, [Region or Create_field] opcode=%X Op=%X\n",
+                               op->opcode, op));
+                       return_VALUE (TRUE);
                }
 
-               return (FALSE);
+               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+                       "Result not used, Parent opcode=%X Op=%X\n", op->opcode, op));
+
+               return_VALUE (FALSE);
                break;
 
        /*
@@ -154,7 +168,7 @@ acpi_ds_is_result_used (
                break;
        }
 
-       return (TRUE);
+       return_VALUE (TRUE);
 }
 
 
@@ -177,36 +191,38 @@ acpi_ds_is_result_used (
 
 void
 acpi_ds_delete_result_if_not_used (
-       ACPI_PARSE_OBJECT       *op,
-       ACPI_OPERAND_OBJECT     *result_obj,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_parse_object       *op,
+       acpi_operand_object     *result_obj,
+       acpi_walk_state         *walk_state)
 {
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_STATUS             status;
+       acpi_operand_object     *obj_desc;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE_PTR ("Ds_delete_result_if_not_used", result_obj);
 
 
        if (!op) {
-               return;
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Op\n"));
+               return_VOID;
        }
 
        if (!result_obj) {
-               return;
+               return_VOID;
        }
 
 
        if (!acpi_ds_is_result_used (op, walk_state)) {
                /*
-                * Must pop the result stack (Obj_desc should be equal
-                *  to Result_obj)
+                * Must pop the result stack (Obj_desc should be equal to Result_obj)
                 */
-
                status = acpi_ds_result_pop (&obj_desc, walk_state);
                if (ACPI_SUCCESS (status)) {
                        acpi_ut_remove_reference (result_obj);
                }
        }
 
-       return;
+       return_VOID;
 }
 
 
@@ -226,34 +242,40 @@ acpi_ds_delete_result_if_not_used (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_create_operand (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *arg,
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *arg,
        u32                     arg_index)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        NATIVE_CHAR             *name_string;
        u32                     name_length;
-       ACPI_OBJECT_TYPE8       data_type;
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_PARSE_OBJECT       *parent_op;
+       acpi_object_type8       data_type;
+       acpi_operand_object     *obj_desc;
+       acpi_parse_object       *parent_op;
        u16                     opcode;
        u32                     flags;
-       OPERATING_MODE          interpreter_mode;
+       operating_mode          interpreter_mode;
+       const acpi_opcode_info  *op_info;
+
+
+       FUNCTION_TRACE_PTR ("Ds_create_operand", arg);
 
 
        /* A valid name must be looked up in the namespace */
 
        if ((arg->opcode == AML_INT_NAMEPATH_OP) &&
                (arg->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,
                                  &name_string, &name_length);
 
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
 
                /*
@@ -267,9 +289,9 @@ 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;
-               if ((acpi_ps_is_node_op (parent_op->opcode)) &&
+               op_info = acpi_ps_get_opcode_info (parent_op->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)) {
@@ -288,17 +310,16 @@ acpi_ds_create_operand (
                                 ACPI_TYPE_ANY, interpreter_mode,
                                 NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE,
                                 walk_state,
-                                (ACPI_NAMESPACE_NODE **) &obj_desc);
+                                (acpi_namespace_node **) &obj_desc);
 
                /* Free the namestring created above */
 
-               acpi_ut_free (name_string);
+               ACPI_MEM_FREE (name_string);
 
                /*
                 * 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) {
                                /*
@@ -307,7 +328,7 @@ acpi_ds_create_operand (
                                 * indicate this to the interpreter, set the
                                 * object to the root
                                 */
-                               obj_desc = (ACPI_OPERAND_OBJECT *) acpi_gbl_root_node;
+                               obj_desc = (acpi_operand_object *) acpi_gbl_root_node;
                                status = AE_OK;
                        }
 
@@ -323,14 +344,14 @@ acpi_ds_create_operand (
                /* Check status from the lookup */
 
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
 
                /* Put the resulting object onto the current object stack */
 
                status = acpi_ds_obj_stack_push (obj_desc, walk_state);
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
                DEBUGGER_EXEC (acpi_db_display_argument_object (obj_desc, walk_state));
        }
@@ -348,6 +369,8 @@ acpi_ds_create_operand (
                         */
                        opcode = AML_ZERO_OP;       /* Has no arguments! */
 
+                       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Null namepath: Arg=%p\n", arg));
+
                        /*
                         * TBD: [Investigate] anything else needed for the
                         * zero op lvalue?
@@ -363,10 +386,13 @@ acpi_ds_create_operand (
 
                data_type = acpi_ds_map_opcode_to_data_type (opcode, &flags);
                if (data_type == INTERNAL_TYPE_INVALID) {
-                       return (AE_NOT_IMPLEMENTED);
+                       return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
                }
 
                if (flags & OP_HAS_RETURN_VALUE) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+                               "Argument previously created, already stacked \n"));
+
                        DEBUGGER_EXEC (acpi_db_display_argument_object (walk_state->operands [walk_state->num_operands - 1], walk_state));
 
                        /*
@@ -379,7 +405,9 @@ acpi_ds_create_operand (
                                 * Only error is underflow, and this indicates
                                 * a missing or null operand!
                                 */
-                               return (status);
+                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Missing or null operand, %s\n",
+                                       acpi_format_exception (status)));
+                               return_ACPI_STATUS (status);
                        }
 
                }
@@ -389,7 +417,7 @@ acpi_ds_create_operand (
 
                        obj_desc = acpi_ut_create_internal_object (data_type);
                        if (!obj_desc) {
-                               return (AE_NO_MEMORY);
+                               return_ACPI_STATUS (AE_NO_MEMORY);
                        }
 
                        /* Initialize the new object */
@@ -398,7 +426,7 @@ acpi_ds_create_operand (
                                         opcode, &obj_desc);
                        if (ACPI_FAILURE (status)) {
                                acpi_ut_delete_object_desc (obj_desc);
-                               return (status);
+                               return_ACPI_STATUS (status);
                        }
           }
 
@@ -406,13 +434,13 @@ acpi_ds_create_operand (
 
                status = acpi_ds_obj_stack_push (obj_desc, walk_state);
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
 
                DEBUGGER_EXEC (acpi_db_display_argument_object (obj_desc, walk_state));
        }
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -430,16 +458,19 @@ acpi_ds_create_operand (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_create_operands (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *first_arg)
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *first_arg)
 {
-       ACPI_STATUS             status = AE_OK;
-       ACPI_PARSE_OBJECT       *arg;
+       acpi_status             status = AE_OK;
+       acpi_parse_object       *arg;
        u32                     arg_count = 0;
 
 
+       FUNCTION_TRACE_PTR ("Ds_create_operands", first_arg);
+
+
        /* For all arguments in the list... */
 
        arg = first_arg;
@@ -449,13 +480,16 @@ acpi_ds_create_operands (
                        goto cleanup;
                }
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Arg #%d (%p) done, Arg1=%p\n",
+                       arg_count, arg, first_arg));
+
                /* Move on to next argument, if any */
 
                arg = arg->next;
                arg_count++;
        }
 
-       return (status);
+       return_ACPI_STATUS (status);
 
 
 cleanup:
@@ -464,10 +498,11 @@ cleanup:
         * pop everything off of the operand stack and delete those
         * objects
         */
-
        acpi_ds_obj_stack_pop_and_delete (arg_count, walk_state);
 
-       return (status);
+       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "While creating Arg %d - %s\n",
+               (arg_count + 1), acpi_format_exception (status)));
+       return_ACPI_STATUS (status);
 }
 
 
@@ -485,12 +520,15 @@ cleanup:
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_resolve_operands (
-       ACPI_WALK_STATE         *walk_state)
+       acpi_walk_state         *walk_state)
 {
        u32                     i;
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+
+       FUNCTION_TRACE_PTR ("Ds_resolve_operands", walk_state);
 
 
        /*
@@ -502,7 +540,6 @@ acpi_ds_resolve_operands (
         * TBD: [Investigate] Note from previous parser:
         *   Ref_of problem with Acpi_ex_resolve_to_value() conversion.
         */
-
        for (i = 0; i < walk_state->num_operands; i++) {
                status = acpi_ex_resolve_to_value (&walk_state->operands[i], walk_state);
                if (ACPI_FAILURE (status)) {
@@ -510,7 +547,7 @@ acpi_ds_resolve_operands (
                }
        }
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -529,13 +566,13 @@ acpi_ds_resolve_operands (
  *
  ******************************************************************************/
 
-ACPI_OBJECT_TYPE8
+acpi_object_type8
 acpi_ds_map_opcode_to_data_type (
        u16                     opcode,
        u32                     *out_flags)
 {
-       ACPI_OBJECT_TYPE8       data_type = INTERNAL_TYPE_INVALID;
-       ACPI_OPCODE_INFO        *op_info;
+       acpi_object_type8       data_type = INTERNAL_TYPE_INVALID;
+       const acpi_opcode_info  *op_info;
        u32                     flags = 0;
 
 
@@ -546,6 +583,7 @@ acpi_ds_map_opcode_to_data_type (
        if (ACPI_GET_OP_TYPE (op_info) != ACPI_OP_TYPE_OPCODE) {
                /* Unknown opcode */
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown AML opcode: %x\n", opcode));
                return (data_type);
        }
 
@@ -557,6 +595,7 @@ acpi_ds_map_opcode_to_data_type (
                case AML_BYTE_OP:
                case AML_WORD_OP:
                case AML_DWORD_OP:
+               case AML_QWORD_OP:
 
                        data_type = ACPI_TYPE_INTEGER;
                        break;
@@ -572,6 +611,8 @@ acpi_ds_map_opcode_to_data_type (
                        break;
 
                default:
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                               "Unknown (type LITERAL) AML opcode: %x\n", opcode));
                        break;
                }
                break;
@@ -586,11 +627,14 @@ acpi_ds_map_opcode_to_data_type (
                        break;
 
                case AML_PACKAGE_OP:
+               case AML_VAR_PACKAGE_OP:
 
                        data_type = ACPI_TYPE_PACKAGE;
                        break;
 
                default:
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                               "Unknown (type DATA_TERM) AML opcode: %x\n", opcode));
                        break;
                }
                break;
@@ -609,14 +653,16 @@ acpi_ds_map_opcode_to_data_type (
        case OPTYPE_DYADIC2:
        case OPTYPE_DYADIC2_r:
        case OPTYPE_DYADIC2_s:
-       case OPTYPE_INDEX:
-       case OPTYPE_MATCH:
+       case OPTYPE_TRIADIC:
+       case OPTYPE_QUADRADIC:
+       case OPTYPE_HEXADIC:
        case OPTYPE_RETURN:
 
                flags = OP_HAS_RETURN_VALUE;
                data_type = ACPI_TYPE_ANY;
                break;
 
+
        case OPTYPE_METHOD_CALL:
 
                flags = OP_HAS_RETURN_VALUE;
@@ -640,6 +686,8 @@ acpi_ds_map_opcode_to_data_type (
 
        default:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                       "Unimplemented data type opcode: %x\n", opcode));
                break;
        }
 
@@ -666,11 +714,14 @@ acpi_ds_map_opcode_to_data_type (
  *
  ******************************************************************************/
 
-ACPI_OBJECT_TYPE8
+acpi_object_type8
 acpi_ds_map_named_opcode_to_data_type (
        u16                     opcode)
 {
-       ACPI_OBJECT_TYPE8       data_type;
+       acpi_object_type8       data_type;
+
+
+       FUNCTION_ENTRY ();
 
 
        /* Decode Opcode */
index 19a4ffe3fb362603d22586ae39e9834bfd85a33a..0d3fb96c15cde74b13b9f92e3c415217c513dbb3 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Module Name: dswexec - Dispatcher method execution callbacks;
  *                        dispatch to interpreter.
- *              $Revision: 61 $
+ *              $Revision: 70 $
  *
  *****************************************************************************/
 
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_get_predicate_value (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *op,
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *op,
        u32                     has_result_obj)
 {
-       ACPI_STATUS             status = AE_OK;
-       ACPI_OPERAND_OBJECT     *obj_desc;
+       acpi_status             status = AE_OK;
+       acpi_operand_object     *obj_desc;
+
+
+       FUNCTION_TRACE_PTR ("Ds_get_predicate_value", walk_state);
 
 
        walk_state->control_state->common.state = 0;
@@ -65,26 +68,33 @@ acpi_ds_get_predicate_value (
        if (has_result_obj) {
                status = acpi_ds_result_pop (&obj_desc, walk_state);
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                               "Could not get result from predicate evaluation, %s\n",
+                               acpi_format_exception (status)));
+
+                       return_ACPI_STATUS (status);
                }
        }
 
        else {
                status = acpi_ds_create_operand (walk_state, op, 0);
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
 
                status = acpi_ex_resolve_to_value (&walk_state->operands [0], walk_state);
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
 
                obj_desc = walk_state->operands [0];
        }
 
        if (!obj_desc) {
-               return (AE_AML_NO_OPERAND);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No predicate Obj_desc=%X State=%X\n",
+                       obj_desc, walk_state));
+
+               return_ACPI_STATUS (AE_AML_NO_OPERAND);
        }
 
 
@@ -92,8 +102,11 @@ acpi_ds_get_predicate_value (
         * Result of predicate evaluation currently must
         * be a number
         */
-
        if (obj_desc->common.type != ACPI_TYPE_INTEGER) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                       "Bad predicate (not a number) Obj_desc=%X State=%X Type=%X\n",
+                       obj_desc, walk_state, obj_desc->common.type));
+
                status = AE_AML_OPERAND_TYPE;
                goto cleanup;
        }
@@ -107,7 +120,6 @@ acpi_ds_get_predicate_value (
         * Save the result of the predicate evaluation on
         * the control stack
         */
-
        if (obj_desc->integer.value) {
                walk_state->control_state->common.value = TRUE;
        }
@@ -117,7 +129,6 @@ acpi_ds_get_predicate_value (
                 * Predicate is FALSE, we will just toss the
                 * rest of the package
                 */
-
                walk_state->control_state->common.value = FALSE;
                status = AE_CTRL_FALSE;
        }
@@ -125,6 +136,9 @@ acpi_ds_get_predicate_value (
 
 cleanup:
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%X\n",
+               walk_state->control_state->common.value, op));
+
         /* Break to debugger to display result */
 
        DEBUGGER_EXEC (acpi_db_display_result_object (obj_desc, walk_state));
@@ -133,12 +147,10 @@ cleanup:
         * Delete the predicate result object (we know that
         * we don't need it anymore)
         */
-
        acpi_ut_remove_reference (obj_desc);
 
        walk_state->control_state->common.state = CONTROL_NORMAL;
-
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -158,21 +170,25 @@ cleanup:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_exec_begin_op (
        u16                     opcode,
-       ACPI_PARSE_OBJECT       *op,
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       **out_op)
+       acpi_parse_object       *op,
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       **out_op)
 {
-       ACPI_OPCODE_INFO        *op_info;
-       ACPI_STATUS             status = AE_OK;
+       const acpi_opcode_info  *op_info;
+       acpi_status             status = AE_OK;
+       u8                      opcode_class;
+
+
+       FUNCTION_TRACE_PTR ("Ds_exec_begin_op", op);
 
 
        if (!op) {
                status = acpi_ds_load2_begin_op (opcode, NULL, walk_state, out_op);
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
 
                op = *out_op;
@@ -183,7 +199,7 @@ acpi_ds_exec_begin_op (
                        *out_op = op;
                }
 
-               return (AE_OK);
+               return_ACPI_STATUS (AE_OK);
        }
 
        /*
@@ -191,10 +207,12 @@ acpi_ds_exec_begin_op (
         * must be the beginning of the associated predicate.
         * Save this knowledge in the current scope descriptor
         */
-
        if ((walk_state->control_state) &&
                (walk_state->control_state->common.state ==
                        CONTROL_CONDITIONAL_EXECUTING)) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Exec predicate Op=%X State=%X\n",
+                                 op, walk_state));
+
                walk_state->control_state->common.state = CONTROL_PREDICATE_EXECUTING;
 
                /* Save start of predicate */
@@ -204,24 +222,23 @@ acpi_ds_exec_begin_op (
 
 
        op_info = acpi_ps_get_opcode_info (op->opcode);
+       opcode_class = (u8) ACPI_GET_OP_CLASS (op_info);
 
        /* We want to send namepaths to the load code */
 
        if (op->opcode == AML_INT_NAMEPATH_OP) {
-               op_info->flags = OPTYPE_NAMED_OBJECT;
+               opcode_class = OPTYPE_NAMED_OBJECT;
        }
 
-
        /*
         * Handle the opcode based upon the opcode type
         */
-
-       switch (ACPI_GET_OP_CLASS (op_info)) {
+       switch (opcode_class) {
        case OPTYPE_CONTROL:
 
                status = acpi_ds_result_stack_push (walk_state);
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
 
                status = acpi_ds_exec_begin_control_op (walk_state, op);
@@ -238,7 +255,6 @@ acpi_ds_exec_begin_op (
                         * will be deleted upon completion of the execution
                         * of this method.
                         */
-
                        status = acpi_ds_load2_begin_op (op->opcode, op, walk_state, NULL);
                }
 
@@ -260,9 +276,9 @@ acpi_ds_exec_begin_op (
        case OPTYPE_DYADIC2_r:
        case OPTYPE_DYADIC2_s:
        case OPTYPE_RECONFIGURATION:
-       case OPTYPE_INDEX:
-       case OPTYPE_MATCH:
-       case OPTYPE_FATAL:
+       case OPTYPE_TRIADIC:
+       case OPTYPE_QUADRADIC:
+       case OPTYPE_HEXADIC:
        case OPTYPE_CREATE_FIELD:
 
                /* Start a new result/operand state */
@@ -277,7 +293,7 @@ acpi_ds_exec_begin_op (
 
        /* Nothing to do here during method execution */
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -297,18 +313,22 @@ acpi_ds_exec_begin_op (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_exec_end_op (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *op)
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *op)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        u16                     opcode;
        u8                      optype;
-       ACPI_PARSE_OBJECT       *next_op;
-       ACPI_PARSE_OBJECT       *first_arg;
-       ACPI_OPERAND_OBJECT     *result_obj = NULL;
-       ACPI_OPCODE_INFO        *op_info;
+       acpi_parse_object       *next_op;
+       acpi_parse_object       *first_arg;
+       acpi_operand_object     *result_obj = NULL;
+       const acpi_opcode_info  *op_info;
+       u32                     i;
+
+
+       FUNCTION_TRACE_PTR ("Ds_exec_end_op", op);
 
 
        opcode = (u16) op->opcode;
@@ -316,7 +336,8 @@ acpi_ds_exec_end_op (
 
        op_info = acpi_ps_get_opcode_info (op->opcode);
        if (ACPI_GET_OP_TYPE (op_info) != ACPI_OP_TYPE_OPCODE) {
-               return (AE_NOT_IMPLEMENTED);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode %X\n", op->opcode));
+               return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
        }
 
        optype = (u8) ACPI_GET_OP_CLASS (op_info);
@@ -333,7 +354,7 @@ acpi_ds_exec_end_op (
        /* Call debugger for single step support (DEBUG build only) */
 
        DEBUGGER_EXEC (status = acpi_db_single_step (walk_state, op, optype));
-       DEBUGGER_EXEC (if (ACPI_FAILURE (status)) {return (status);});
+       DEBUGGER_EXEC (if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status);});
 
 
        /* Decode the opcode */
@@ -341,11 +362,14 @@ acpi_ds_exec_end_op (
        switch (optype) {
        case OPTYPE_UNDEFINED:
 
-               return (AE_NOT_IMPLEMENTED);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Undefined opcode type Op=%X\n", op));
+               return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
                break;
 
 
        case OPTYPE_BOGUS:
+               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Internal opcode=%X type Op=%X\n",
+                       opcode, op));
                break;
 
        case OPTYPE_CONSTANT:           /* argument type only */
@@ -366,9 +390,9 @@ acpi_ds_exec_end_op (
        case OPTYPE_DYADIC2_r:
        case OPTYPE_DYADIC2_s:
        case OPTYPE_RECONFIGURATION:
-       case OPTYPE_INDEX:
-       case OPTYPE_MATCH:
-       case OPTYPE_FATAL:
+       case OPTYPE_TRIADIC:
+       case OPTYPE_QUADRADIC:
+       case OPTYPE_HEXADIC:
 
 
                /* Build resolved operand stack */
@@ -385,6 +409,34 @@ acpi_ds_exec_end_op (
                        goto cleanup;
                }
 
+               /* Resolve all operands */
+
+               status = acpi_ex_resolve_operands (opcode,
+                                 &(walk_state->operands [walk_state->num_operands -1]),
+                                 walk_state);
+               if (ACPI_FAILURE (status)) {
+                       /* TBD: must pop and delete operands */
+
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "[%s]: Could not resolve operands, %s\n",
+                               acpi_ps_get_opcode_name (opcode), acpi_format_exception (status)));
+
+                       /*
+                        * On error, we must delete all the operands and clear the
+                        * operand stack
+                        */
+                       for (i = 0; i < walk_state->num_operands; i++) {
+                               acpi_ut_remove_reference (walk_state->operands[i]);
+                               walk_state->operands[i] = NULL;
+                       }
+
+                       walk_state->num_operands = 0;
+
+                       goto cleanup;
+               }
+
+               DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, acpi_ps_get_opcode_name (opcode),
+                                 walk_state->num_operands, "after Ex_resolve_operands");
+
                switch (optype) {
                case OPTYPE_MONADIC1:
 
@@ -442,19 +494,23 @@ acpi_ds_exec_end_op (
                        break;
 
 
-               case OPTYPE_INDEX:  /* Type 2 opcode with 3 operands */
+               case OPTYPE_TRIADIC:    /* Opcode with 3 operands */
 
                        /* 3 Operands, 1 External_result, 1 Internal_result */
 
-                       status = acpi_ex_index (walk_state, &result_obj);
+                       status = acpi_ex_triadic (opcode, walk_state, &result_obj);
+                       break;
+
+
+               case OPTYPE_QUADRADIC:  /* Opcode with 4 operands */
                        break;
 
 
-               case OPTYPE_MATCH:  /* Type 2 opcode with 6 operands */
+               case OPTYPE_HEXADIC:    /* Opcode with 6 operands */
 
                        /* 6 Operands, 0 External_result, 1 Internal_result */
 
-                       status = acpi_ex_match (walk_state, &result_obj);
+                       status = acpi_ex_hexadic (opcode, walk_state, &result_obj);
                        break;
 
 
@@ -464,15 +520,14 @@ acpi_ds_exec_end_op (
 
                        status = acpi_ex_reconfiguration (opcode, walk_state);
                        break;
+               }
 
+               /* Clear the operand stack */
 
-               case OPTYPE_FATAL:
-
-                       /* 3 Operands, 0 External_result, 0 Internal_result */
-
-                       status = acpi_ex_fatal (walk_state);
-                       break;
+               for (i = 0; i < walk_state->num_operands; i++) {
+                       walk_state->operands[i] = NULL;
                }
+               walk_state->num_operands = 0;
 
                /*
                 * If a result object was returned from above, push it on the
@@ -498,6 +553,8 @@ acpi_ds_exec_end_op (
 
        case OPTYPE_METHOD_CALL:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Method invocation, Op=%X\n", op));
+
                /*
                 * (AML_METHODCALL) Op->Value->Arg->Node contains
                 * the method Node pointer
@@ -524,7 +581,6 @@ acpi_ds_exec_end_op (
                 * references here (Local variables, arguments
                 * to *this* method, etc.)
                 */
-
                status = acpi_ds_resolve_operands (walk_state);
                if (ACPI_FAILURE (status)) {
                        break;
@@ -540,12 +596,15 @@ acpi_ds_exec_end_op (
                 * Return now; we don't want to disturb anything,
                 * especially the operand count!
                 */
-               return (status);
+               return_ACPI_STATUS (status);
                break;
 
 
        case OPTYPE_CREATE_FIELD:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+                       "Executing Create_field Buffer/Index Op=%X\n", op));
+
                status = acpi_ds_load2_end_op (walk_state, op);
                if (ACPI_FAILURE (status)) {
                        break;
@@ -565,6 +624,9 @@ acpi_ds_exec_end_op (
                switch (op->opcode) {
                case AML_REGION_OP:
 
+                       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+                               "Executing Op_region Address/Length Op=%X\n", op));
+
                        status = acpi_ds_eval_region_operands (walk_state, op);
                        if (ACPI_FAILURE (status)) {
                                break;
@@ -596,6 +658,10 @@ acpi_ds_exec_end_op (
 
        default:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                       "Unimplemented opcode, type=%X Opcode=%X Op=%X\n",
+                       optype, op->opcode, op));
+
                status = AE_NOT_IMPLEMENTED;
                break;
        }
@@ -641,7 +707,7 @@ cleanup:
        but don't delete it */
        walk_state->num_operands = 0;
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
index 98a9616706bdfd1c1a667b09fd06016cda188a87..cd8277ec4e6682bf19f7d498e3c04ae822ddf2c4 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: dswload - Dispatcher namespace load callbacks
- *              $Revision: 37 $
+ *              $Revision: 44 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_load1_begin_op (
        u16                     opcode,
-       ACPI_PARSE_OBJECT       *op,
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       **out_op)
+       acpi_parse_object       *op,
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       **out_op)
 {
-       ACPI_NAMESPACE_NODE     *node;
-       ACPI_STATUS             status;
-       ACPI_OBJECT_TYPE8       data_type;
+       acpi_namespace_node     *node;
+       acpi_status             status;
+       acpi_object_type8       data_type;
        NATIVE_CHAR             *path;
+       const acpi_opcode_info  *op_info;
 
 
        PROC_NAME ("Ds_load1_begin_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 (!acpi_ps_is_named_op (opcode)) {
+       op_info = acpi_ps_get_opcode_info (opcode);
+       if (!(op_info->flags & AML_NAMED)) {
                *out_op = op;
                return (AE_OK);
        }
 
-
        /* Check if this object has already been installed in the namespace */
 
        if (op && op->node) {
@@ -88,6 +91,14 @@ acpi_ds_load1_begin_op (
        data_type = acpi_ds_map_named_opcode_to_data_type (opcode);
 
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+               "State=%p Op=%p Type=%x\n", walk_state, op, data_type));
+
+
+       if (opcode == AML_SCOPE_OP) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+                       "State=%p Op=%p Type=%x\n", walk_state, op, data_type));
+       }
 
        /*
         * Enter the named type into the internal namespace.  We enter the name
@@ -112,19 +123,16 @@ acpi_ds_load1_begin_op (
 
        /* Initialize */
 
-       ((ACPI_PARSE2_OBJECT *)op)->name = node->name;
+       ((acpi_parse2_object *)op)->name = node->name;
 
        /*
         * 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;
-
-
        acpi_ps_append_arg (acpi_ps_get_parent_scope (walk_state->parser_state), op);
 
        *out_op = op;
-
        return (status);
 }
 
@@ -144,22 +152,26 @@ acpi_ds_load1_begin_op (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_load1_end_op (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *op)
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *op)
 {
-       ACPI_OBJECT_TYPE8       data_type;
+       acpi_object_type8       data_type;
+       const acpi_opcode_info  *op_info;
 
 
        PROC_NAME ("Ds_load1_end_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 (!acpi_ps_is_named_op (op->opcode)) {
+       op_info = acpi_ps_get_opcode_info (op->opcode);
+       if (!(op_info->flags & AML_NAMED)) {
                return (AE_OK);
        }
 
-
        /* Get the type to determine if we should pop the scope */
 
        data_type = acpi_ds_map_named_opcode_to_data_type (op->opcode);
@@ -170,20 +182,21 @@ acpi_ds_load1_end_op (
                if (op->value.arg) {
                        data_type = acpi_ds_map_opcode_to_data_type (
                                          (op->value.arg)->opcode, NULL);
-                       ((ACPI_NAMESPACE_NODE *)op->node)->type =
+                       ((acpi_namespace_node *)op->node)->type =
                                          (u8) data_type;
                }
        }
 
-
        /* Pop the scope stack */
 
        if (acpi_ns_opens_scope (data_type)) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s): Popping scope for Op %p\n",
+                       acpi_ut_get_type_name (data_type), op));
+
                acpi_ds_scope_stack_pop (walk_state);
        }
 
        return (AE_OK);
-
 }
 
 
@@ -201,33 +214,36 @@ acpi_ds_load1_end_op (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_load2_begin_op (
        u16                     opcode,
-       ACPI_PARSE_OBJECT       *op,
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       **out_op)
+       acpi_parse_object       *op,
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       **out_op)
 {
-       ACPI_NAMESPACE_NODE     *node;
-       ACPI_STATUS             status;
-       ACPI_OBJECT_TYPE8       data_type;
+       acpi_namespace_node     *node;
+       acpi_status             status;
+       acpi_object_type8       data_type;
        NATIVE_CHAR             *buffer_ptr;
        void                    *original = NULL;
+       const acpi_opcode_info  *op_info;
 
 
        PROC_NAME ("Ds_load2_begin_op");
+       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state));
+
 
        /* We only care about Namespace opcodes here */
 
-       if (!acpi_ps_is_namespace_op (opcode) &&
+       op_info = acpi_ps_get_opcode_info (opcode);
+       if (!(op_info->flags & AML_NSOPCODE) &&
                opcode != AML_INT_NAMEPATH_OP) {
                return (AE_OK);
        }
 
+       /* TBD: [Restructure] Temp! same code as in psparse */
 
-       /* Temp! same code as in psparse */
-
-       if (!acpi_ps_is_named_op (opcode)) {
+       if (!(op_info->flags & AML_NAMED)) {
                return (AE_OK);
        }
 
@@ -249,7 +265,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 *) &((acpi_parse2_object *)op)->name;
                }
        }
 
@@ -262,6 +278,9 @@ acpi_ds_load2_begin_op (
 
        data_type = acpi_ds_map_named_opcode_to_data_type (opcode);
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+               "State=%p Op=%p Type=%x\n", walk_state, op, data_type));
+
 
        if (opcode == AML_FIELD_OP          ||
                opcode == AML_BANK_FIELD_OP     ||
@@ -275,10 +294,8 @@ acpi_ds_load2_begin_op (
                 * The Name_path is an object reference to an existing object. Don't enter the
                 * name into the namespace, but look it up for use later
                 */
-               status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr,
-                                data_type, IMODE_EXECUTE,
-                                NS_SEARCH_PARENT, walk_state,
-                                &(node));
+               status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, data_type,
+                                 IMODE_EXECUTE, NS_SEARCH_PARENT, walk_state, &(node));
        }
 
        else {
@@ -287,9 +304,7 @@ acpi_ds_load2_begin_op (
                        node = op->node;
 
                        if (acpi_ns_opens_scope (data_type)) {
-                               status = acpi_ds_scope_stack_push (node,
-                                                  data_type,
-                                                  walk_state);
+                               status = acpi_ds_scope_stack_push (node, data_type, walk_state);
                                if (ACPI_FAILURE (status)) {
                                        return (status);
                                }
@@ -318,17 +333,24 @@ acpi_ds_load2_begin_op (
 
                        /* Initialize */
 
-                       ((ACPI_PARSE2_OBJECT *)op)->name = node->name;
+                       ((acpi_parse2_object *)op)->name = node->name;
                        *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));
+                       }
+               }
        }
 
        return (status);
@@ -350,25 +372,37 @@ acpi_ds_load2_begin_op (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_load2_end_op (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *op)
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *op)
 {
-       ACPI_STATUS             status = AE_OK;
-       ACPI_OBJECT_TYPE8      data_type;
-       ACPI_NAMESPACE_NODE     *node;
-       ACPI_PARSE_OBJECT       *arg;
-       ACPI_NAMESPACE_NODE     *new_node;
+       acpi_status             status = AE_OK;
+       acpi_object_type8       data_type;
+       acpi_namespace_node     *node;
+       acpi_parse_object       *arg;
+       acpi_namespace_node     *new_node;
+       const acpi_opcode_info  *op_info;
 
 
        PROC_NAME ("Ds_load2_end_op");
-       if (!acpi_ps_is_namespace_object_op (op->opcode)) {
+       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state));
+
+
+       /* Only interested in opcodes that have namespace objects */
+
+       op_info = acpi_ps_get_opcode_info (op->opcode);
+       if (!(op_info->flags & AML_NSOBJECT)) {
                return (AE_OK);
        }
 
        if (op->opcode == AML_SCOPE_OP) {
-               if (((ACPI_PARSE2_OBJECT *)op)->name == -1) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+                       "Ending scope Op=%p State=%p\n", op, walk_state));
+
+               if (((acpi_parse2_object *)op)->name == -1) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unnamed scope! Op=%p State=%p\n",
+                               op, walk_state));
                        return (AE_OK);
                }
        }
@@ -386,7 +420,6 @@ acpi_ds_load2_end_op (
         * Put the Node on the object stack (Contains the ACPI Name of
         * this object)
         */
-
        walk_state->operands[0] = (void *) node;
        walk_state->num_operands = 1;
 
@@ -394,10 +427,11 @@ acpi_ds_load2_end_op (
 
        if (acpi_ns_opens_scope (data_type)) {
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n",
+                       acpi_ut_get_type_name (data_type), op));
                acpi_ds_scope_stack_pop (walk_state);
        }
 
-
        /*
         * Named operations are as follows:
         *
@@ -443,6 +477,9 @@ acpi_ds_load2_end_op (
                 * Create the field object, but the field buffer and index must
                 * be evaluated later during the execution phase
                 */
+               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+                       "Create_xxx_field: State=%p Op=%p Named_obj=%p\n",
+                       walk_state, op, node));
 
                /* Get the Name_string argument */
 
@@ -487,8 +524,8 @@ acpi_ds_load2_end_op (
                         * The Field definition is not fully parsed at this time.
                         * (We must save the address of the AML for the buffer and index operands)
                         */
-                       status = acpi_ex_create_buffer_field (((ACPI_PARSE2_OBJECT *) op)->data,
-                                         ((ACPI_PARSE2_OBJECT *) op)->length,
+                       status = acpi_ex_create_buffer_field (((acpi_parse2_object *) op)->data,
+                                         ((acpi_parse2_object *) op)->length,
                                          new_node, walk_state);
                }
                break;
@@ -496,17 +533,18 @@ acpi_ds_load2_end_op (
 
        case AML_INT_METHODCALL_OP:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+                       "RESOLVING-Method_call: State=%p Op=%p Named_obj=%p\n",
+                       walk_state, op, node));
+
                /*
                 * Lookup the method name and save the Node
                 */
-
                status = acpi_ns_lookup (walk_state->scope_info, arg->value.string,
                                  ACPI_TYPE_ANY, IMODE_LOAD_PASS2,
                                  NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE,
                                  walk_state, &(new_node));
-
                if (ACPI_SUCCESS (status)) {
-
                        /* TBD: has name already been resolved by here ??*/
 
                        /* TBD: [Restructure] Make sure that what we found is indeed a method! */
@@ -527,11 +565,18 @@ acpi_ds_load2_end_op (
 
                /* Nothing to do other than enter object into namespace */
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+                       "LOADING-Processor: State=%p Op=%p Named_obj=%p\n",
+                       walk_state, op, node));
+
                status = acpi_ex_create_processor (op, node);
                if (ACPI_FAILURE (status)) {
                        goto cleanup;
                }
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+                       "Completed Processor Init, Op=%p State=%p entry=%p\n",
+                       op, walk_state, node));
                break;
 
 
@@ -539,11 +584,18 @@ acpi_ds_load2_end_op (
 
                /* Nothing to do other than enter object into namespace */
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+                       "LOADING-Power_resource: State=%p Op=%p Named_obj=%p\n",
+                       walk_state, op, node));
+
                status = acpi_ex_create_power_resource (op, node);
                if (ACPI_FAILURE (status)) {
                        goto cleanup;
                }
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+                       "Completed Power_resource Init, Op=%p State=%p entry=%p\n",
+                       op, walk_state, node));
                break;
 
 
@@ -551,11 +603,18 @@ acpi_ds_load2_end_op (
 
                /* Nothing to do other than enter object into namespace */
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+                       "LOADING-Thermal_zone: State=%p Op=%p Named_obj=%p\n",
+                       walk_state, op, node));
                break;
 
 
        case AML_FIELD_OP:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+                       "LOADING-Field: State=%p Op=%p Named_obj=%p\n",
+                       walk_state, op, node));
+
                arg = op->value.arg;
 
                status = acpi_ds_create_field (op, arg->node, walk_state);
@@ -564,15 +623,23 @@ acpi_ds_load2_end_op (
 
        case AML_INDEX_FIELD_OP:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+                       "LOADING-Index_field: State=%p Op=%p Named_obj=%p\n",
+                       walk_state, op, node));
+
                arg = op->value.arg;
 
-               status = acpi_ds_create_index_field (op, (ACPI_HANDLE) arg->node,
+               status = acpi_ds_create_index_field (op, (acpi_handle) arg->node,
                                   walk_state);
                break;
 
 
        case AML_BANK_FIELD_OP:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+                       "LOADING-Bank_field: State=%p Op=%p Named_obj=%p\n",
+                       walk_state, op, node));
+
                arg = op->value.arg;
                status = acpi_ds_create_bank_field (op, arg->node, walk_state);
                break;
@@ -583,16 +650,23 @@ acpi_ds_load2_end_op (
         */
        case AML_METHOD_OP:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+                       "LOADING-Method: State=%p Op=%p Named_obj=%p\n",
+                       walk_state, op, node));
+
                if (!node->object) {
-                       status = acpi_ex_create_method (((ACPI_PARSE2_OBJECT *) op)->data,
-                                          ((ACPI_PARSE2_OBJECT *) op)->length,
-                                          arg->value.integer, node);
+                       status = acpi_ex_create_method (((acpi_parse2_object *) op)->data,
+                                          ((acpi_parse2_object *) op)->length,
+                                          arg->value.integer32, node);
                }
                break;
 
 
        case AML_MUTEX_OP:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+                       "LOADING-Mutex: Op=%p State=%p\n", op, walk_state));
+
                status = acpi_ds_create_operands (walk_state, arg);
                if (ACPI_FAILURE (status)) {
                        goto cleanup;
@@ -604,6 +678,9 @@ acpi_ds_load2_end_op (
 
        case AML_EVENT_OP:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+                       "LOADING-Event: Op=%p State=%p\n", op, walk_state));
+
                status = acpi_ds_create_operands (walk_state, arg);
                if (ACPI_FAILURE (status)) {
                        goto cleanup;
@@ -619,14 +696,21 @@ acpi_ds_load2_end_op (
                        break;
                }
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+                       "LOADING-Opregion: Op=%p State=%p Named_obj=%p\n",
+                       op, walk_state, node));
+
                /*
                 * The Op_region is not fully parsed at this time. Only valid argument is the Space_id.
                 * (We must save the address of the AML of the address and length operands)
                 */
-               status = acpi_ex_create_region (((ACPI_PARSE2_OBJECT *) op)->data,
-                                 ((ACPI_PARSE2_OBJECT *) op)->length,
+               status = acpi_ex_create_region (((acpi_parse2_object *) op)->data,
+                                 ((acpi_parse2_object *) op)->length,
                                                 (ACPI_ADR_SPACE_TYPE) arg->value.integer, walk_state);
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+                       "Completed Op_region Init, Op=%p State=%p entry=%p\n",
+                       op, walk_state, node));
                break;
 
 
@@ -634,6 +718,9 @@ acpi_ds_load2_end_op (
 
        case AML_ALIAS_OP:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+                       "LOADING-Alias: Op=%p State=%p\n", op, walk_state));
+
                status = acpi_ds_create_operands (walk_state, arg);
                if (ACPI_FAILURE (status)) {
                        goto cleanup;
@@ -645,12 +732,14 @@ acpi_ds_load2_end_op (
 
        case AML_NAME_OP:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+                       "LOADING-Name: Op=%p State=%p\n", op, walk_state));
+
                /*
                 * Because of the execution pass through the non-control-method
                 * parts of the table, we can arrive here twice.  Only init
                 * the named object node the first time through
                 */
-
                if (!node->object) {
                        status = acpi_ds_create_node (walk_state, node, op);
                }
@@ -660,6 +749,9 @@ acpi_ds_load2_end_op (
 
        case AML_INT_NAMEPATH_OP:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+                       "LOADING-Name_path object: State=%p Op=%p Named_obj=%p\n",
+                       walk_state, op, node));
                break;
 
 
index dc0c0179257bbbebc5b8cac3e2bc8dae74ebff31..601796129a1325f4bfda8f97ae4a5120c4d5f2cd 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: dswscope - Scope stack manipulation
- *              $Revision: 45 $
+ *              $Revision: 48 $
  *
  *****************************************************************************/
 
 
 void
 acpi_ds_scope_stack_clear (
-       ACPI_WALK_STATE         *walk_state)
+       acpi_walk_state         *walk_state)
 {
-       ACPI_GENERIC_STATE      *scope_info;
+       acpi_generic_state      *scope_info;
+
+       PROC_NAME ("Ds_scope_stack_clear");
 
 
        while (walk_state->scope_info) {
@@ -60,6 +62,8 @@ acpi_ds_scope_stack_clear (
                scope_info = walk_state->scope_info;
                walk_state->scope_info = scope_info->scope.next;
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+                       "Popped object type %X\n", scope_info->common.value));
                acpi_ut_delete_generic_state (scope_info);
        }
 }
@@ -77,20 +81,23 @@ acpi_ds_scope_stack_clear (
  *
  ***************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_scope_stack_push (
-       ACPI_NAMESPACE_NODE     *node,
-       ACPI_OBJECT_TYPE8       type,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_namespace_node     *node,
+       acpi_object_type8       type,
+       acpi_walk_state         *walk_state)
 {
-       ACPI_GENERIC_STATE      *scope_info;
+       acpi_generic_state      *scope_info;
+
+
+       FUNCTION_TRACE ("Ds_scope_stack_push");
 
 
        if (!node) {
-               /*  invalid scope   */
+               /* Invalid scope   */
 
                REPORT_ERROR (("Ds_scope_stack_push: null scope passed\n"));
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        /* Make sure object type is valid */
@@ -104,7 +111,7 @@ acpi_ds_scope_stack_push (
 
        scope_info = acpi_ut_create_generic_state ();
        if (!scope_info) {
-               return (AE_NO_MEMORY);
+               return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
        /* Init new scope object */
@@ -116,7 +123,7 @@ acpi_ds_scope_stack_push (
 
        acpi_ut_push_generic_state (&walk_state->scope_info, scope_info);
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -137,25 +144,30 @@ acpi_ds_scope_stack_push (
  *
  ***************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_scope_stack_pop (
-       ACPI_WALK_STATE         *walk_state)
+       acpi_walk_state         *walk_state)
 {
-       ACPI_GENERIC_STATE      *scope_info;
+       acpi_generic_state      *scope_info;
+
+
+       FUNCTION_TRACE ("Ds_scope_stack_pop");
 
 
        /*
         * Pop scope info object off the stack.
         */
-
        scope_info = acpi_ut_pop_generic_state (&walk_state->scope_info);
        if (!scope_info) {
-               return (AE_STACK_UNDERFLOW);
+               return_ACPI_STATUS (AE_STACK_UNDERFLOW);
        }
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+               "Popped object type %X\n", scope_info->common.value));
+
        acpi_ut_delete_generic_state (scope_info);
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
index 0374d4270c7bbdfd653aeba8eb0b1a6d5539b5dd..f0c6617cf7f9a3d4c67d8d07f3d510bafa402970 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: dswstate - Dispatcher parse tree walk management routines
- *              $Revision: 45 $
+ *              $Revision: 51 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_result_insert (
        void                    *object,
        u32                     index,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_walk_state         *walk_state)
 {
-       ACPI_GENERIC_STATE      *state;
+       acpi_generic_state      *state;
 
 
        PROC_NAME ("Ds_result_insert");
@@ -62,20 +62,33 @@ acpi_ds_result_insert (
 
        state = walk_state->results;
        if (!state) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n",
+                       walk_state));
                return (AE_NOT_EXIST);
        }
 
        if (index >= OBJ_NUM_OPERANDS) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                       "Index out of range: %X Obj=%p State=%p Num=%X\n",
+                       index, object, walk_state, state->results.num_results));
                return (AE_BAD_PARAMETER);
        }
 
        if (!object) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                       "Null Object! Index=%X Obj=%p State=%p Num=%X\n",
+                       index, object, walk_state, state->results.num_results));
                return (AE_BAD_PARAMETER);
        }
 
        state->results.obj_desc [index] = object;
        state->results.num_results++;
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+               "Obj=%p [%s] State=%p Num=%X Cur=%X\n",
+               object, object ? acpi_ut_get_type_name (((acpi_operand_object *) object)->common.type) : "NULL",
+               walk_state, state->results.num_results, walk_state->current_result));
+
        return (AE_OK);
 }
 
@@ -94,13 +107,13 @@ acpi_ds_result_insert (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_result_remove (
-       ACPI_OPERAND_OBJECT     **object,
+       acpi_operand_object     **object,
        u32                     index,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_walk_state         *walk_state)
 {
-       ACPI_GENERIC_STATE      *state;
+       acpi_generic_state      *state;
 
 
        PROC_NAME ("Ds_result_remove");
@@ -108,14 +121,24 @@ acpi_ds_result_remove (
 
        state = walk_state->results;
        if (!state) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n",
+                       walk_state));
                return (AE_NOT_EXIST);
        }
 
+       if (index >= OBJ_NUM_OPERANDS) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                       "Index out of range: %X State=%p Num=%X\n",
+                       index, walk_state, state->results.num_results));
+       }
 
 
        /* Check for a valid result object */
 
        if (!state->results.obj_desc [index]) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                       "Null operand! State=%p #Ops=%X, Index=%X\n",
+                       walk_state, state->results.num_results, index));
                return (AE_AML_NO_RETURN_VALUE);
        }
 
@@ -126,6 +149,11 @@ acpi_ds_result_remove (
        *object = state->results.obj_desc [index];
        state->results.obj_desc [index] = NULL;
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+               "Obj=%p [%s] Index=%X State=%p Num=%X\n",
+               *object, (*object) ? acpi_ut_get_type_name ((*object)->common.type) : "NULL",
+               index, walk_state, state->results.num_results));
+
        return (AE_OK);
 }
 
@@ -144,13 +172,13 @@ acpi_ds_result_remove (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_result_pop (
-       ACPI_OPERAND_OBJECT     **object,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_operand_object     **object,
+       acpi_walk_state         *walk_state)
 {
        u32                     index;
-       ACPI_GENERIC_STATE      *state;
+       acpi_generic_state      *state;
 
 
        PROC_NAME ("Ds_result_pop");
@@ -161,8 +189,9 @@ acpi_ds_result_pop (
                return (AE_OK);
        }
 
-
        if (!state->results.num_results) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Result stack is empty! State=%p\n",
+                       walk_state));
                return (AE_AML_NO_RETURN_VALUE);
        }
 
@@ -177,11 +206,15 @@ acpi_ds_result_pop (
                        *object = state->results.obj_desc [index -1];
                        state->results.obj_desc [index -1] = NULL;
 
+                       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] Index=%X State=%p Num=%X\n",
+                               *object, (*object) ? acpi_ut_get_type_name ((*object)->common.type) : "NULL",
+                               index -1, walk_state, state->results.num_results));
+
                        return (AE_OK);
                }
        }
 
-
+       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", walk_state));
        return (AE_AML_NO_RETURN_VALUE);
 }
 
@@ -199,13 +232,13 @@ acpi_ds_result_pop (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_result_pop_from_bottom (
-       ACPI_OPERAND_OBJECT     **object,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_operand_object     **object,
+       acpi_walk_state         *walk_state)
 {
        u32                     index;
-       ACPI_GENERIC_STATE      *state;
+       acpi_generic_state      *state;
 
 
        PROC_NAME ("Ds_result_pop_from_bottom");
@@ -213,11 +246,14 @@ acpi_ds_result_pop_from_bottom (
 
        state = walk_state->results;
        if (!state) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                       "Warning: No result object pushed! State=%p\n", walk_state));
                return (AE_NOT_EXIST);
        }
 
 
        if (!state->results.num_results) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", walk_state));
                return (AE_AML_NO_RETURN_VALUE);
        }
 
@@ -225,7 +261,6 @@ acpi_ds_result_pop_from_bottom (
 
        *object = state->results.obj_desc [0];
 
-
        /* Push entire stack down one element */
 
        for (index = 0; index < state->results.num_results; index++) {
@@ -237,9 +272,15 @@ acpi_ds_result_pop_from_bottom (
        /* Check for a valid result object */
 
        if (!*object) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null operand! State=%p #Ops=%X, Index=%X\n",
+                       walk_state, state->results.num_results, index));
                return (AE_AML_NO_RETURN_VALUE);
        }
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s], Results=%p State=%p\n",
+               *object, (*object) ? acpi_ut_get_type_name ((*object)->common.type) : "NULL",
+               state, walk_state));
+
 
        return (AE_OK);
 }
@@ -258,12 +299,12 @@ acpi_ds_result_pop_from_bottom (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_result_push (
-       ACPI_OPERAND_OBJECT     *object,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_operand_object     *object,
+       acpi_walk_state         *walk_state)
 {
-       ACPI_GENERIC_STATE      *state;
+       acpi_generic_state      *state;
 
 
        PROC_NAME ("Ds_result_push");
@@ -271,14 +312,20 @@ acpi_ds_result_push (
 
        state = walk_state->results;
        if (!state) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result stack frame\n"));
                return (AE_AML_INTERNAL);
        }
 
        if (state->results.num_results == OBJ_NUM_OPERANDS) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                       "Result stack overflow: Obj=%p State=%p Num=%X\n",
+                       object, walk_state, state->results.num_results));
                return (AE_STACK_OVERFLOW);
        }
 
        if (!object) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Object! Obj=%p State=%p Num=%X\n",
+                       object, walk_state, state->results.num_results));
                return (AE_BAD_PARAMETER);
        }
 
@@ -286,6 +333,10 @@ acpi_ds_result_push (
        state->results.obj_desc [state->results.num_results] = object;
        state->results.num_results++;
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p Num=%X Cur=%X\n",
+               object, object ? acpi_ut_get_type_name (((acpi_operand_object *) object)->common.type) : "NULL",
+               walk_state, state->results.num_results, walk_state->current_result));
+
        return (AE_OK);
 }
 
@@ -303,11 +354,13 @@ acpi_ds_result_push (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_result_stack_push (
-       ACPI_WALK_STATE         *walk_state)
+       acpi_walk_state         *walk_state)
 {
-       ACPI_GENERIC_STATE      *state;
+       acpi_generic_state      *state;
+
+       PROC_NAME ("Ds_result_stack_push");
 
 
        state = acpi_ut_create_generic_state ();
@@ -317,6 +370,9 @@ acpi_ds_result_stack_push (
 
        acpi_ut_push_generic_state (&walk_state->results, state);
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Results=%p State=%p\n",
+               state, walk_state));
+
        return (AE_OK);
 }
 
@@ -333,22 +389,30 @@ acpi_ds_result_stack_push (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_result_stack_pop (
-       ACPI_WALK_STATE         *walk_state)
+       acpi_walk_state         *walk_state)
 {
-       ACPI_GENERIC_STATE      *state;
+       acpi_generic_state      *state;
+
+       PROC_NAME ("Ds_result_stack_pop");
 
 
        /* Check for stack underflow */
 
        if (walk_state->results == NULL) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Underflow - State=%p\n",
+                       walk_state));
                return (AE_AML_NO_OPERAND);
        }
 
 
        state = acpi_ut_pop_generic_state (&walk_state->results);
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+               "Result=%p Remaining_results=%X State=%p\n",
+               state, state->results.num_results, walk_state));
+
        acpi_ut_delete_generic_state (state);
 
        return (AE_OK);
@@ -368,13 +432,16 @@ acpi_ds_result_stack_pop (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_obj_stack_delete_all (
-       ACPI_WALK_STATE         *walk_state)
+       acpi_walk_state         *walk_state)
 {
        u32                     i;
 
 
+       FUNCTION_TRACE_PTR ("Ds_obj_stack_delete_all", walk_state);
+
+
        /* The stack size is configurable, but fixed */
 
        for (i = 0; i < OBJ_NUM_OPERANDS; i++) {
@@ -384,7 +451,7 @@ acpi_ds_obj_stack_delete_all (
                }
        }
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -401,16 +468,20 @@ acpi_ds_obj_stack_delete_all (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_obj_stack_push (
        void                    *object,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_walk_state         *walk_state)
 {
+       PROC_NAME ("Ds_obj_stack_push");
 
 
        /* Check for stack overflow */
 
        if (walk_state->num_operands >= OBJ_NUM_OPERANDS) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                       "overflow! Obj=%p State=%p #Ops=%X\n",
+                       object, walk_state, walk_state->num_operands));
                return (AE_STACK_OVERFLOW);
        }
 
@@ -419,10 +490,15 @@ acpi_ds_obj_stack_push (
        walk_state->operands [walk_state->num_operands] = object;
        walk_state->num_operands++;
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n",
+                         object, acpi_ut_get_type_name (((acpi_operand_object *) object)->common.type),
+                         walk_state, walk_state->num_operands));
+
        return (AE_OK);
 }
 
 
+#if 0
 /*******************************************************************************
  *
  * FUNCTION:    Acpi_ds_obj_stack_pop_object
@@ -437,16 +513,20 @@ acpi_ds_obj_stack_push (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_obj_stack_pop_object (
-       ACPI_OPERAND_OBJECT     **object,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_operand_object     **object,
+       acpi_walk_state         *walk_state)
 {
+       PROC_NAME ("Ds_obj_stack_pop_object");
 
 
        /* Check for stack underflow */
 
        if (walk_state->num_operands == 0) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                       "Missing operand/stack empty! State=%p #Ops=%X\n",
+                       walk_state, walk_state->num_operands));
                *object = NULL;
                return (AE_AML_NO_OPERAND);
        }
@@ -458,6 +538,9 @@ acpi_ds_obj_stack_pop_object (
        /* Check for a valid operand */
 
        if (!walk_state->operands [walk_state->num_operands]) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                       "Null operand! State=%p #Ops=%X\n",
+                       walk_state, walk_state->num_operands));
                *object = NULL;
                return (AE_AML_NO_OPERAND);
        }
@@ -467,9 +550,13 @@ acpi_ds_obj_stack_pop_object (
        *object = walk_state->operands [walk_state->num_operands];
        walk_state->operands [walk_state->num_operands] = NULL;
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n",
+                         *object, acpi_ut_get_type_name ((*object)->common.type),
+                         walk_state, walk_state->num_operands));
+
        return (AE_OK);
 }
-
+#endif
 
 /*******************************************************************************
  *
@@ -485,18 +572,23 @@ acpi_ds_obj_stack_pop_object (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_obj_stack_pop (
        u32                     pop_count,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_walk_state         *walk_state)
 {
        u32                     i;
 
+       PROC_NAME ("Ds_obj_stack_pop");
+
 
        for (i = 0; i < pop_count; i++) {
                /* Check for stack underflow */
 
                if (walk_state->num_operands == 0) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                               "Underflow! Count=%X State=%p #Ops=%X\n",
+                               pop_count, walk_state, walk_state->num_operands));
                        return (AE_STACK_UNDERFLOW);
                }
 
@@ -506,6 +598,9 @@ acpi_ds_obj_stack_pop (
                walk_state->operands [walk_state->num_operands] = NULL;
        }
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n",
+                         pop_count, walk_state, walk_state->num_operands));
+
        return (AE_OK);
 }
 
@@ -524,19 +619,24 @@ acpi_ds_obj_stack_pop (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ds_obj_stack_pop_and_delete (
        u32                     pop_count,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_walk_state         *walk_state)
 {
        u32                     i;
-       ACPI_OPERAND_OBJECT     *obj_desc;
+       acpi_operand_object     *obj_desc;
+
+       PROC_NAME ("Ds_obj_stack_pop_and_delete");
 
 
        for (i = 0; i < pop_count; i++) {
                /* Check for stack underflow */
 
                if (walk_state->num_operands == 0) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                               "Underflow! Count=%X State=%p #Ops=%X\n",
+                               pop_count, walk_state, walk_state->num_operands));
                        return (AE_STACK_UNDERFLOW);
                }
 
@@ -550,6 +650,9 @@ acpi_ds_obj_stack_pop_and_delete (
                }
        }
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n",
+                         pop_count, walk_state, walk_state->num_operands));
+
        return (AE_OK);
 }
 
@@ -572,24 +675,26 @@ acpi_ds_obj_stack_pop_and_delete (
 void *
 acpi_ds_obj_stack_get_value (
        u32                     index,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_walk_state         *walk_state)
 {
 
+       FUNCTION_TRACE_PTR ("Ds_obj_stack_get_value", walk_state);
+
 
        /* Can't do it if the stack is empty */
 
        if (walk_state->num_operands == 0) {
-               return (NULL);
+               return_PTR (NULL);
        }
 
        /* or if the index is past the top of the stack */
 
        if (index > (walk_state->num_operands - (u32) 1)) {
-               return (NULL);
+               return_PTR (NULL);
        }
 
 
-       return (walk_state->operands[(NATIVE_UINT)(walk_state->num_operands - 1) -
+       return_PTR (walk_state->operands[(NATIVE_UINT)(walk_state->num_operands - 1) -
                          index]);
 }
 
@@ -607,11 +712,16 @@ acpi_ds_obj_stack_get_value (
  *
  ******************************************************************************/
 
-ACPI_WALK_STATE *
+acpi_walk_state *
 acpi_ds_get_current_walk_state (
-       ACPI_WALK_LIST          *walk_list)
+       acpi_walk_list          *walk_list)
 
 {
+       PROC_NAME ("Ds_get_current_walk_state");
+
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Ds_get_current_walk_state, =%p\n",
+               walk_list->walk_state));
 
        if (!walk_list) {
                return (NULL);
@@ -636,15 +746,16 @@ acpi_ds_get_current_walk_state (
 
 static void
 acpi_ds_push_walk_state (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_WALK_LIST          *walk_list)
+       acpi_walk_state         *walk_state,
+       acpi_walk_list          *walk_list)
 {
+       FUNCTION_TRACE ("Ds_push_walk_state");
 
 
        walk_state->next    = walk_list->walk_state;
        walk_list->walk_state = walk_state;
 
-       return;
+       return_VOID;
 }
 
 
@@ -662,11 +773,14 @@ acpi_ds_push_walk_state (
  *
  ******************************************************************************/
 
-ACPI_WALK_STATE *
+acpi_walk_state *
 acpi_ds_pop_walk_state (
-       ACPI_WALK_LIST          *walk_list)
+       acpi_walk_list          *walk_list)
 {
-       ACPI_WALK_STATE         *walk_state;
+       acpi_walk_state         *walk_state;
+
+
+       FUNCTION_TRACE ("Ds_pop_walk_state");
 
 
        walk_state = walk_list->walk_state;
@@ -683,7 +797,7 @@ acpi_ds_pop_walk_state (
                 */
        }
 
-       return (walk_state);
+       return_PTR (walk_state);
 }
 
 
@@ -701,45 +815,23 @@ acpi_ds_pop_walk_state (
  *
  ******************************************************************************/
 
-ACPI_WALK_STATE *
+acpi_walk_state *
 acpi_ds_create_walk_state (
-       ACPI_OWNER_ID           owner_id,
-       ACPI_PARSE_OBJECT       *origin,
-       ACPI_OPERAND_OBJECT     *mth_desc,
-       ACPI_WALK_LIST          *walk_list)
+       acpi_owner_id           owner_id,
+       acpi_parse_object       *origin,
+       acpi_operand_object     *mth_desc,
+       acpi_walk_list          *walk_list)
 {
-       ACPI_WALK_STATE         *walk_state;
-       ACPI_STATUS             status;
+       acpi_walk_state         *walk_state;
+       acpi_status             status;
 
 
-       acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
-       acpi_gbl_walk_state_cache_requests++;
+       FUNCTION_TRACE ("Ds_create_walk_state");
 
-       /* Check the cache first */
 
-       if (acpi_gbl_walk_state_cache) {
-               /* There is an object available, use it */
-
-               walk_state = acpi_gbl_walk_state_cache;
-               acpi_gbl_walk_state_cache = walk_state->next;
-
-               acpi_gbl_walk_state_cache_hits++;
-               acpi_gbl_walk_state_cache_depth--;
-
-               acpi_ut_release_mutex (ACPI_MTX_CACHES);
-       }
-
-       else {
-               /* The cache is empty, create a new object */
-
-               /* Avoid deadlock with Acpi_ut_callocate */
-
-               acpi_ut_release_mutex (ACPI_MTX_CACHES);
-
-               walk_state = acpi_ut_callocate (sizeof (ACPI_WALK_STATE));
-               if (!walk_state) {
-                       return (NULL);
-               }
+       walk_state = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_WALK);
+       if (!walk_state) {
+               return_PTR (NULL);
        }
 
        walk_state->data_type       = ACPI_DESC_TYPE_WALK;
@@ -758,15 +850,14 @@ acpi_ds_create_walk_state (
 
        status = acpi_ds_result_stack_push (walk_state);
        if (ACPI_FAILURE (status)) {
-               return (NULL);
+               return_PTR (NULL);
        }
 
-
        /* Put the new state at the head of the walk list */
 
        acpi_ds_push_walk_state (walk_state, walk_list);
 
-       return (walk_state);
+       return_PTR (walk_state);
 }
 
 
@@ -784,9 +875,12 @@ acpi_ds_create_walk_state (
 
 void
 acpi_ds_delete_walk_state (
-       ACPI_WALK_STATE         *walk_state)
+       acpi_walk_state         *walk_state)
 {
-       ACPI_GENERIC_STATE      *state;
+       acpi_generic_state      *state;
+
+
+       FUNCTION_TRACE_PTR ("Ds_delete_walk_state", walk_state);
 
 
        if (!walk_state) {
@@ -794,6 +888,7 @@ acpi_ds_delete_walk_state (
        }
 
        if (walk_state->data_type != ACPI_DESC_TYPE_WALK) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p is not a valid walk state\n", walk_state));
                return;
        }
 
@@ -825,34 +920,8 @@ acpi_ds_delete_walk_state (
                acpi_ut_delete_generic_state (state);
        }
 
-
-       /* If walk cache is full, just free this wallkstate object */
-
-       if (acpi_gbl_walk_state_cache_depth >= MAX_WALK_CACHE_DEPTH) {
-               acpi_ut_free (walk_state);
-       }
-
-       /* Otherwise put this object back into the cache */
-
-       else {
-               acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
-
-               /* Clear the state */
-
-               MEMSET (walk_state, 0, sizeof (ACPI_WALK_STATE));
-               walk_state->data_type = ACPI_DESC_TYPE_WALK;
-
-               /* Put the object at the head of the global cache list */
-
-               walk_state->next = acpi_gbl_walk_state_cache;
-               acpi_gbl_walk_state_cache = walk_state;
-               acpi_gbl_walk_state_cache_depth++;
-
-
-               acpi_ut_release_mutex (ACPI_MTX_CACHES);
-       }
-
-       return;
+       acpi_ut_release_to_cache (ACPI_MEM_LIST_WALK, walk_state);
+       return_VOID;
 }
 
 
@@ -873,21 +942,11 @@ void
 acpi_ds_delete_walk_state_cache (
        void)
 {
-       ACPI_WALK_STATE         *next;
-
+       FUNCTION_TRACE ("Ds_delete_walk_state_cache");
 
-       /* Traverse the global cache list */
-
-       while (acpi_gbl_walk_state_cache) {
-               /* Delete one cached state object */
-
-               next = acpi_gbl_walk_state_cache->next;
-               acpi_ut_free (acpi_gbl_walk_state_cache);
-               acpi_gbl_walk_state_cache = next;
-               acpi_gbl_walk_state_cache_depth--;
-       }
 
-       return;
+       acpi_ut_delete_generic_cache (ACPI_MEM_LIST_WALK);
+       return_VOID;
 }
 
 
index c595150d840d688d78bf4e6de6659813f7f11bbe..22053cd67d32a3a4a0b97b4d6281e522e99d75ff 100644 (file)
 #include "acpi.h"
 #include "driver.h"
 
-#ifdef CONFIG_ACPI_KERNEL_CONFIG
-#include <asm/efi.h>
-#define ACPI_USE_EFI
-#endif
-
 
 #define _COMPONENT     OS_DEPENDENT
        MODULE_NAME     ("driver")
@@ -61,9 +56,8 @@ static int acpi_disabled = 0;
 int
 acpi_init(void)
 {
-       ACPI_PHYSICAL_ADDRESS   rsdp_phys;
-       ACPI_BUFFER             buffer;
-       ACPI_SYSTEM_INFO        sys_info;
+       acpi_buffer             buffer;
+       acpi_system_info        sys_info;
 
        if (PM_IS_ACTIVE()) {
                printk(KERN_NOTICE "ACPI: APM is already active, exiting\n");
@@ -81,18 +75,8 @@ acpi_init(void)
                return -ENODEV;
        }
 
-#ifndef ACPI_USE_EFI
-       if (!ACPI_SUCCESS(acpi_find_root_pointer(&rsdp_phys))) {
-               printk(KERN_ERR "ACPI: System description tables not found\n");
-               return -ENODEV;
-       }
-#else
-       rsdp_phys = efi.acpi;
-#endif
-
        /* from this point on, on error we must call acpi_terminate() */
-
-       if (!ACPI_SUCCESS(acpi_load_tables(rsdp_phys))) {
+       if (!ACPI_SUCCESS(acpi_load_tables())) {
                printk(KERN_ERR "ACPI: System description table load failed\n");
                acpi_terminate();
                return -ENODEV;
index 81522156028085bc5abf30375e6dedc518a4a832..605d8a6f68aed230a3081cbd61e30e193efafe68 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Module Name: evevent - Fixed and General Purpose Acpi_event
  *                          handling and dispatch
- *              $Revision: 43 $
+ *              $Revision: 50 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ev_initialize (
        void)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Ev_initialize");
 
 
        /* Make sure we have ACPI tables */
 
        if (!acpi_gbl_DSDT) {
-               return (AE_NO_ACPI_TABLES);
+               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No ACPI tables present!\n"));
+               return_ACPI_STATUS (AE_NO_ACPI_TABLES);
        }
 
 
        /* Make sure the BIOS supports ACPI mode */
 
        if (SYS_MODE_LEGACY == acpi_hw_get_mode_capabilities()) {
-               return (AE_ERROR);
+               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "ACPI Mode is not supported!\n"));
+               return_ACPI_STATUS (AE_ERROR);
        }
 
 
@@ -75,22 +80,24 @@ acpi_ev_initialize (
         * done prior to enabling SCIs to prevent interrupts from occuring
         * before handers are installed.
         */
-
        status = acpi_ev_fixed_event_initialize ();
        if (ACPI_FAILURE (status)) {
-               return (status);
+               ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, "Unable to initialize fixed events.\n"));
+               return_ACPI_STATUS (status);
        }
 
        status = acpi_ev_gpe_initialize ();
        if (ACPI_FAILURE (status)) {
-               return (status);
+               ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, "Unable to initialize general purpose events.\n"));
+               return_ACPI_STATUS (status);
        }
 
        /* Install the SCI handler */
 
        status = acpi_ev_install_sci_handler ();
        if (ACPI_FAILURE (status)) {
-               return (status);
+               ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, "Unable to install System Control Interrupt Handler\n"));
+               return_ACPI_STATUS (status);
        }
 
 
@@ -98,18 +105,20 @@ acpi_ev_initialize (
 
        status = acpi_ev_init_gpe_control_methods ();
        if (ACPI_FAILURE (status)) {
-               return (status);
+               ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, "Unable to initialize Gpe control methods\n"));
+               return_ACPI_STATUS (status);
        }
 
        /* Install the handler for the Global Lock */
 
        status = acpi_ev_init_global_lock_handler ();
        if (ACPI_FAILURE (status)) {
-               return (status);
+               ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, "Unable to initialize Global Lock handler\n"));
+               return_ACPI_STATUS (status);
        }
 
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -125,7 +134,7 @@ acpi_ev_initialize (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ev_fixed_event_initialize(void)
 {
        int                     i = 0;
@@ -160,20 +169,27 @@ acpi_ev_fixed_event_initialize(void)
  ******************************************************************************/
 
 u32
-acpi_ev_fixed_event_detect(void)
+acpi_ev_fixed_event_detect (void)
 {
        u32                     int_status = INTERRUPT_NOT_HANDLED;
        u32                     status_register;
        u32                     enable_register;
 
+
+       PROC_NAME ("Ev_fixed_event_detect");
+
+
        /*
         * Read the fixed feature status and enable registers, as all the cases
         * depend on their values.
         */
-
        status_register = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, PM1_STS);
        enable_register = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, PM1_EN);
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
+               "Fixed Acpi_event Block: Enable %08X Status %08X\n",
+               enable_register, status_register));
+
 
        /* power management timer roll over */
 
@@ -224,7 +240,11 @@ u32
 acpi_ev_fixed_event_dispatch (
        u32                     event)
 {
-       u32 register_id;
+       u32                     register_id;
+
+
+       FUNCTION_ENTRY ();
+
 
        /* Clear the status bit */
 
@@ -292,7 +312,7 @@ acpi_ev_fixed_event_dispatch (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ev_gpe_initialize (void)
 {
        u32                     i;
@@ -303,6 +323,8 @@ acpi_ev_gpe_initialize (void)
        u16                     gpe1_register_count;
 
 
+       FUNCTION_TRACE ("Ev_gpe_initialize");
+
        /*
         * Set up various GPE counts
         *
@@ -319,24 +341,24 @@ acpi_ev_gpe_initialize (void)
         * FADT table contain zeros. The GPE0_LEN and GPE1_LEN do not need
         * to be the same size."
         */
-
        gpe0register_count          = (u16) DIV_2 (acpi_gbl_FADT->gpe0blk_len);
        gpe1_register_count         = (u16) DIV_2 (acpi_gbl_FADT->gpe1_blk_len);
        acpi_gbl_gpe_register_count = gpe0register_count + gpe1_register_count;
 
        if (!acpi_gbl_gpe_register_count) {
                REPORT_WARNING (("Zero GPEs are defined in the FADT\n"));
-               return (AE_OK);
+               return_ACPI_STATUS (AE_OK);
        }
 
        /*
         * Allocate the Gpe information block
         */
-
-       acpi_gbl_gpe_registers = acpi_ut_callocate (acpi_gbl_gpe_register_count *
-                        sizeof (ACPI_GPE_REGISTERS));
+       acpi_gbl_gpe_registers = ACPI_MEM_CALLOCATE (acpi_gbl_gpe_register_count *
+                         sizeof (ACPI_GPE_REGISTERS));
        if (!acpi_gbl_gpe_registers) {
-               return (AE_NO_MEMORY);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                       "Could not allocate the Gpe_registers block\n"));
+               return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
        /*
@@ -344,12 +366,12 @@ acpi_ev_gpe_initialize (void)
         * There are eight distinct GP events per register.
         * Initialization to zeros is sufficient
         */
-
-       acpi_gbl_gpe_info = acpi_ut_callocate (MUL_8 (acpi_gbl_gpe_register_count) *
-                        sizeof (ACPI_GPE_LEVEL_INFO));
+       acpi_gbl_gpe_info = ACPI_MEM_CALLOCATE (MUL_8 (acpi_gbl_gpe_register_count) *
+                         sizeof (acpi_gpe_level_info));
        if (!acpi_gbl_gpe_info) {
-               acpi_ut_free (acpi_gbl_gpe_registers);
-               return (AE_NO_MEMORY);
+               ACPI_MEM_FREE (acpi_gbl_gpe_registers);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not allocate the Gpe_info block\n"));
+               return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
        /* Set the Gpe validation table to GPE_INVALID */
@@ -386,8 +408,8 @@ acpi_ev_gpe_initialize (void)
                 * are cleared by writing a '1', while enable registers are cleared
                 * by writing a '0'.
                 */
-               acpi_os_out8 (acpi_gbl_gpe_registers[register_index].enable_addr, 0x00);
-               acpi_os_out8 (acpi_gbl_gpe_registers[register_index].status_addr, 0xFF);
+               acpi_os_write_port (acpi_gbl_gpe_registers[register_index].enable_addr, 0x00, 8);
+               acpi_os_write_port (acpi_gbl_gpe_registers[register_index].status_addr, 0xFF, 8);
 
                register_index++;
        }
@@ -414,13 +436,17 @@ acpi_ev_gpe_initialize (void)
                 * are cleared by writing a '1', while enable registers are cleared
                 * by writing a '0'.
                 */
-               acpi_os_out8 (acpi_gbl_gpe_registers[register_index].enable_addr, 0x00);
-               acpi_os_out8 (acpi_gbl_gpe_registers[register_index].status_addr, 0xFF);
+               acpi_os_write_port (acpi_gbl_gpe_registers[register_index].enable_addr, 0x00, 8);
+               acpi_os_write_port (acpi_gbl_gpe_registers[register_index].status_addr, 0xFF, 8);
 
                register_index++;
        }
 
-       return (AE_OK);
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "GPE registers: %X@%p (Blk0) %X@%p (Blk1)\n",
+               gpe0register_count, acpi_gbl_FADT->Xgpe0blk.address, gpe1_register_count,
+               acpi_gbl_FADT->Xgpe1_blk.address));
+
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -446,9 +472,9 @@ acpi_ev_gpe_initialize (void)
  *
  ******************************************************************************/
 
-static ACPI_STATUS
+static acpi_status
 acpi_ev_save_method_info (
-       ACPI_HANDLE             obj_handle,
+       acpi_handle             obj_handle,
        u32                     level,
        void                    *obj_desc,
        void                    **return_value)
@@ -463,7 +489,7 @@ acpi_ev_save_method_info (
 
        /* Extract the name from the object and convert to a string */
 
-       MOVE_UNALIGNED32_TO_32 (name, &((ACPI_NAMESPACE_NODE *) obj_handle)->name);
+       MOVE_UNALIGNED32_TO_32 (name, &((acpi_namespace_node *) obj_handle)->name);
        name[ACPI_NAME_SIZE] = 0;
 
        /*
@@ -478,6 +504,9 @@ acpi_ev_save_method_info (
        else {
                /* Unknown method type, just ignore it! */
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                       "Unknown GPE method type: %s (name not of form _Lnn or _Enn)\n",
+                       name));
                return (AE_OK);
        }
 
@@ -487,6 +516,9 @@ acpi_ev_save_method_info (
        if (gpe_number == ACPI_UINT32_MAX) {
                /* Conversion failed; invalid method, just ignore it */
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                       "Could not extract GPE number from name: %s (name not of form _Lnn or _Enn)\n",
+                       name));
                return (AE_OK);
        }
 
@@ -502,7 +534,6 @@ acpi_ev_save_method_info (
         * Now we can add this information to the Gpe_info block
         * for use during dispatch of this GPE.
         */
-
        acpi_gbl_gpe_info [gpe_number].type         = type;
        acpi_gbl_gpe_info [gpe_number].method_handle = obj_handle;
 
@@ -510,9 +541,10 @@ acpi_ev_save_method_info (
        /*
         * Enable the GPE (SCIs should be disabled at this point)
         */
-
        acpi_hw_enable_gpe (gpe_number);
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Registered GPE method %s as GPE number %X\n",
+               name, gpe_number));
        return (AE_OK);
 }
 
@@ -531,17 +563,20 @@ acpi_ev_save_method_info (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ev_init_gpe_control_methods (void)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Ev_init_gpe_control_methods");
 
 
        /* Get a permanent handle to the _GPE object */
 
        status = acpi_get_handle (NULL, "\\_GPE", &acpi_gbl_gpe_obj_handle);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Traverse the namespace under \_GPE to find all methods there */
@@ -550,7 +585,7 @@ acpi_ev_init_gpe_control_methods (void)
                          ACPI_UINT32_MAX, acpi_ev_save_method_info,
                          NULL, NULL);
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -576,23 +611,31 @@ acpi_ev_gpe_detect (void)
        u8                      bit_mask;
 
 
+       PROC_NAME ("Ev_gpe_detect");
+
+
        /*
         * Read all of the 8-bit GPE status and enable registers
         * in both of the register blocks, saving all of it.
         * Find all currently active GP events.
         */
-
        for (i = 0; i < acpi_gbl_gpe_register_count; i++) {
-               acpi_gbl_gpe_registers[i].status =
-                                  acpi_os_in8 (acpi_gbl_gpe_registers[i].status_addr);
+               acpi_os_read_port (acpi_gbl_gpe_registers[i].status_addr,
+                               &acpi_gbl_gpe_registers[i].status, 8);
 
-               acpi_gbl_gpe_registers[i].enable =
-                                  acpi_os_in8 (acpi_gbl_gpe_registers[i].enable_addr);
+               acpi_os_read_port (acpi_gbl_gpe_registers[i].enable_addr,
+                               &acpi_gbl_gpe_registers[i].enable, 8);
+
+               ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
+                       "GPE block at %X - Enable %08X Status %08X\n",
+                       acpi_gbl_gpe_registers[i].enable_addr,
+                       acpi_gbl_gpe_registers[i].status,
+                       acpi_gbl_gpe_registers[i].enable));
 
                /* First check if there is anything active at all in this register */
 
                enabled_status_byte = (u8) (acpi_gbl_gpe_registers[i].status &
-                                 acpi_gbl_gpe_registers[i].enable);
+                                  acpi_gbl_gpe_registers[i].enable);
 
                if (!enabled_status_byte) {
                        /* No active GPEs in this register, move on */
@@ -610,8 +653,8 @@ acpi_ev_gpe_detect (void)
                                 * Found an active GPE.  Dispatch the event to a handler
                                 * or method.
                                 */
-                               int_status |=
-                                       acpi_ev_gpe_dispatch (acpi_gbl_gpe_registers[i].gpe_base + j);
+                               int_status |= acpi_ev_gpe_dispatch (
+                                                 acpi_gbl_gpe_registers[i].gpe_base + j);
                        }
                }
        }
@@ -641,8 +684,10 @@ acpi_ev_asynch_execute_gpe_method (
        void                    *context)
 {
        u32                     gpe_number = (u32) context;
-       ACPI_GPE_LEVEL_INFO     gpe_info;
+       acpi_gpe_level_info     gpe_info;
+
 
+       FUNCTION_TRACE ("Ev_asynch_execute_gpe_method");
 
        /*
         * Take a snapshot of the GPE info for this level
@@ -674,7 +719,7 @@ acpi_ev_asynch_execute_gpe_method (
         */
        acpi_hw_enable_gpe (gpe_number);
 
-       return;
+       return_VOID;
 }
 
 
@@ -701,14 +746,18 @@ u32
 acpi_ev_gpe_dispatch (
        u32                     gpe_number)
 {
-       ACPI_GPE_LEVEL_INFO     gpe_info;
+       acpi_gpe_level_info     gpe_info;
+
+
+       FUNCTION_TRACE ("Ev_gpe_dispatch");
 
 
        /*
         * Valid GPE number?
         */
        if (acpi_gbl_gpe_valid[gpe_number] == ACPI_GPE_INVALID) {
-               return (INTERRUPT_NOT_HANDLED);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid GPE bit [%X].\n", gpe_number));
+               return_VALUE (INTERRUPT_NOT_HANDLED);
        }
 
        /*
@@ -732,16 +781,20 @@ acpi_ev_gpe_dispatch (
                 */
        if (gpe_info.handler) {
                /* Invoke function handler (at interrupt level). */
+
                gpe_info.handler (gpe_info.context);
 
                /* Level-Triggered? */
+
                if (gpe_info.type & ACPI_EVENT_LEVEL_TRIGGERED) {
                        acpi_hw_clear_gpe (gpe_number);
                }
 
                /* Enable GPE */
+
                acpi_hw_enable_gpe (gpe_number);
        }
+
        /*
         * Method Handler (e.g. _Exx/_Lxx)?
         */
@@ -756,6 +809,7 @@ acpi_ev_gpe_dispatch (
                        REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to queue handler for GPE bit [%X]\n", gpe_number));
                }
        }
+
        /*
         * No Handler? Report an error and leave the GPE disabled.
         */
@@ -763,10 +817,11 @@ acpi_ev_gpe_dispatch (
                REPORT_ERROR (("Acpi_ev_gpe_dispatch: No installed handler for GPE [%X]\n", gpe_number));
 
                /* Level-Triggered? */
+
                if (gpe_info.type & ACPI_EVENT_LEVEL_TRIGGERED) {
                        acpi_hw_clear_gpe (gpe_number);
                }
        }
 
-       return (INTERRUPT_HANDLED);
+       return_VALUE (INTERRUPT_HANDLED);
 }
index 73cce01854e54d1750c6ecc0ba656644181ee0be..9c71efc9472490f7ceac8a93713e33286399475e 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Module Name: evmisc - ACPI device notification handler dispatch
  *                       and ACPI Global Lock support
- *              $Revision: 31 $
+ *              $Revision: 33 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ev_queue_notify_request (
-       ACPI_NAMESPACE_NODE     *node,
+       acpi_namespace_node     *node,
        u32                     notify_value)
 {
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_OPERAND_OBJECT     *handler_obj = NULL;
-       ACPI_GENERIC_STATE      *notify_info;
-       ACPI_STATUS             status = AE_OK;
+       acpi_operand_object     *obj_desc;
+       acpi_operand_object     *handler_obj = NULL;
+       acpi_generic_state      *notify_info;
+       acpi_status             status = AE_OK;
 
 
        PROC_NAME ("Ev_queue_notify_request");
@@ -67,21 +67,28 @@ acpi_ev_queue_notify_request (
         * For value 0x80 (Status Change) on the power button or sleep button,
         * initiate soft-off or sleep operation?
         */
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+               "Dispatching Notify(%X) on node %p\n", notify_value, node));
 
        switch (notify_value) {
        case 0:
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: Re-enumerate Devices\n"));
                break;
 
        case 1:
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: Ejection Request\n"));
                break;
 
        case 2:
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: Device Wake\n"));
                break;
 
        case 0x80:
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: Status Change\n"));
                break;
 
        default:
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Unknown Notify Value: %lx \n", notify_value));
                break;
        }
 
@@ -89,7 +96,6 @@ acpi_ev_queue_notify_request (
        /*
         * Get the notify object attached to the device Node
         */
-
        obj_desc = acpi_ns_get_attached_object (node);
        if (obj_desc) {
 
@@ -142,6 +148,7 @@ acpi_ev_queue_notify_request (
        if (!handler_obj) {
                /* There is no per-device notify handler for this device */
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "No notify handler for node %p \n", node));
        }
 
        return (status);
@@ -165,17 +172,19 @@ void
 acpi_ev_notify_dispatch (
        void                    *context)
 {
-       ACPI_GENERIC_STATE      *notify_info = (ACPI_GENERIC_STATE *) context;
+       acpi_generic_state      *notify_info = (acpi_generic_state *) context;
        ACPI_NOTIFY_HANDLER     global_handler = NULL;
        void                    *global_context = NULL;
-       ACPI_OPERAND_OBJECT     *handler_obj;
+       acpi_operand_object     *handler_obj;
+
+
+       FUNCTION_ENTRY ();
 
 
        /*
         * We will invoke a global notify handler if installed.
         * This is done _before_ we invoke the per-device handler attached to the device.
         */
-
        if (notify_info->notify.value <= MAX_SYS_NOTIFY) {
                /* Global system notification handler */
 
@@ -209,7 +218,6 @@ acpi_ev_notify_dispatch (
                                  handler_obj->notify_handler.context);
        }
 
-
        /* All done with the info object */
 
        acpi_ut_delete_generic_state (notify_info);
@@ -269,7 +277,6 @@ acpi_ev_global_lock_handler (
         * If we don't get it now, it will be marked pending and we will
         * take another interrupt when it becomes free.
         */
-
        global_lock = acpi_gbl_FACS->global_lock;
        ACPI_ACQUIRE_GLOBAL_LOCK (global_lock, acquired);
        if (acquired) {
@@ -297,10 +304,13 @@ acpi_ev_global_lock_handler (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ev_init_global_lock_handler (void)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Ev_init_global_lock_handler");
 
 
        acpi_gbl_global_lock_present = TRUE;
@@ -319,7 +329,7 @@ acpi_ev_init_global_lock_handler (void)
                status = AE_OK;
        }
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -333,18 +343,20 @@ acpi_ev_init_global_lock_handler (void)
  *
  *****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ev_acquire_global_lock(void)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        u8                      acquired = FALSE;
        void                    *global_lock;
 
 
+       FUNCTION_TRACE ("Ev_acquire_global_lock");
+
        /* Make sure that we actually have a global lock */
 
        if (!acpi_gbl_global_lock_present) {
-               return (AE_NO_GLOBAL_LOCK);
+               return_ACPI_STATUS (AE_NO_GLOBAL_LOCK);
        }
 
        /* One more thread wants the global lock */
@@ -355,13 +367,13 @@ acpi_ev_acquire_global_lock(void)
        /* If we (OS side) have the hardware lock already, we are done */
 
        if (acpi_gbl_global_lock_acquired) {
-               return (AE_OK);
+               return_ACPI_STATUS (AE_OK);
        }
 
        /* Only if the FACS is valid */
 
        if (!acpi_gbl_FACS) {
-               return (AE_OK);
+               return_ACPI_STATUS (AE_OK);
        }
 
 
@@ -372,8 +384,10 @@ acpi_ev_acquire_global_lock(void)
        if (acquired) {
           /* We got the lock */
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Acquired the Global Lock\n"));
+
                acpi_gbl_global_lock_acquired = TRUE;
-               return (AE_OK);
+               return_ACPI_STATUS (AE_OK);
        }
 
 
@@ -381,15 +395,15 @@ acpi_ev_acquire_global_lock(void)
         * Did not get the lock.  The pending bit was set above, and we must now
         * wait until we get the global lock released interrupt.
         */
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Waiting for the HW Global Lock\n"));
 
         /*
          * Acquire the global lock semaphore first.
          * Since this wait will block, we must release the interpreter
          */
-
        status = acpi_ex_system_wait_semaphore (acpi_gbl_global_lock_semaphore,
                          ACPI_UINT32_MAX);
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -408,9 +422,12 @@ acpi_ev_release_global_lock (void)
        void                    *global_lock;
 
 
+       FUNCTION_TRACE ("Ev_release_global_lock");
+
+
        if (!acpi_gbl_global_lock_thread_count) {
                REPORT_WARNING(("Global Lock has not be acquired, cannot release\n"));
-               return;
+               return_VOID;
        }
 
    /* One fewer thread has the global lock */
@@ -424,7 +441,6 @@ acpi_ev_release_global_lock (void)
                 * No more threads holding lock, we can do the actual hardware
                 * release
                 */
-
                global_lock = acpi_gbl_FACS->global_lock;
                ACPI_RELEASE_GLOBAL_LOCK (global_lock, pending);
                acpi_gbl_global_lock_acquired = FALSE;
@@ -439,5 +455,5 @@ acpi_ev_release_global_lock (void)
                }
        }
 
-       return;
+       return_VOID;
 }
index 8850d9c261667cd46fd15d9d2c4310c3b97aece6..e43163363ed3eb75cdd98389df5dd6cad437be58 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: evregion - ACPI Address_space (Op_region) handler dispatch
- *              $Revision: 103 $
+ *              $Revision: 110 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ev_install_default_address_space_handlers (
        void)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Ev_install_default_address_space_handlers");
 
 
        /*
@@ -68,13 +71,12 @@ acpi_ev_install_default_address_space_handlers (
         * NOTE: We ignore AE_EXIST because this means that a handler has
         * already been installed (via Acpi_install_address_space_handler)
         */
-
        status = acpi_install_address_space_handler (acpi_gbl_root_node,
                           ACPI_ADR_SPACE_SYSTEM_MEMORY,
                           ACPI_DEFAULT_HANDLER, NULL, NULL);
        if ((ACPI_FAILURE (status)) &&
                (status != AE_EXIST)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        status = acpi_install_address_space_handler (acpi_gbl_root_node,
@@ -82,7 +84,7 @@ acpi_ev_install_default_address_space_handlers (
                           ACPI_DEFAULT_HANDLER, NULL, NULL);
        if ((ACPI_FAILURE (status)) &&
                (status != AE_EXIST)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        status = acpi_install_address_space_handler (acpi_gbl_root_node,
@@ -90,11 +92,11 @@ acpi_ev_install_default_address_space_handlers (
                           ACPI_DEFAULT_HANDLER, NULL, NULL);
        if ((ACPI_FAILURE (status)) &&
                (status != AE_EXIST)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -113,19 +115,20 @@ acpi_ev_install_default_address_space_handlers (
  *
  ******************************************************************************/
 
-static ACPI_STATUS
+static acpi_status
 acpi_ev_execute_reg_method (
-       ACPI_OPERAND_OBJECT    *region_obj,
+       acpi_operand_object    *region_obj,
        u32                     function)
 {
-       ACPI_OPERAND_OBJECT    *params[3];
-       ACPI_OPERAND_OBJECT     space_id_desc;
-       ACPI_OPERAND_OBJECT     function_desc;
-       ACPI_STATUS             status;
+       acpi_operand_object    *params[3];
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Ev_execute_reg_method");
 
 
        if (region_obj->region.extra->extra.method_REG == NULL) {
-               return (AE_OK);
+               return_ACPI_STATUS (AE_OK);
        }
 
        /*
@@ -137,31 +140,36 @@ acpi_ev_execute_reg_method (
         *          0 for disconnecting the handler
         *          Passed as a parameter
         */
+       params[0] = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+       if (!params[0]) {
+               return_ACPI_STATUS (AE_NO_MEMORY);
+       }
 
-       acpi_ut_init_static_object (&space_id_desc);
-       acpi_ut_init_static_object (&function_desc);
+       params[1] = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+       if (!params[1]) {
+               acpi_ut_remove_reference (params[0]);
+               return_ACPI_STATUS (AE_NO_MEMORY);
+       }
 
-       /*
-        *  Method requires two parameters.
-        */
-       params [0] = &space_id_desc;
-       params [1] = &function_desc;
-       params [2] = NULL;
+       params[2] = NULL;
 
        /*
         *  Set up the parameter objects
         */
-       space_id_desc.common.type  = ACPI_TYPE_INTEGER;
-       space_id_desc.integer.value = region_obj->region.space_id;
-
-       function_desc.common.type  = ACPI_TYPE_INTEGER;
-       function_desc.integer.value = function;
+       params[0]->integer.value  = region_obj->region.space_id;
+       params[1]->integer.value = function;
 
        /*
         *  Execute the method, no return value
         */
+       DEBUG_EXEC(acpi_ut_display_init_pathname (region_obj->region.extra->extra.method_REG, " [Method]"));
        status = acpi_ns_evaluate_by_handle (region_obj->region.extra->extra.method_REG, params, NULL);
-       return (status);
+
+
+       acpi_ut_remove_reference (params[0]);
+       acpi_ut_remove_reference (params[1]);
+
+       return_ACPI_STATUS (status);
 }
 
 
@@ -183,27 +191,33 @@ acpi_ev_execute_reg_method (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ev_address_space_dispatch (
-       ACPI_OPERAND_OBJECT     *region_obj,
+       acpi_operand_object     *region_obj,
        u32                     function,
        ACPI_PHYSICAL_ADDRESS   address,
        u32                     bit_width,
        u32                     *value)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
        ACPI_ADR_SPACE_HANDLER  handler;
        ACPI_ADR_SPACE_SETUP    region_setup;
-       ACPI_OPERAND_OBJECT     *handler_desc;
+       acpi_operand_object     *handler_desc;
        void                    *region_context = NULL;
 
 
+       FUNCTION_TRACE ("Ev_address_space_dispatch");
+
+
        /*
         * Ensure that there is a handler associated with this region
         */
        handler_desc = region_obj->region.addr_handler;
        if (!handler_desc) {
-               return(AE_NOT_EXIST);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "no handler for region(%p) [%s]\n",
+                       region_obj, acpi_ut_get_region_name (region_obj->region.space_id)));
+
+               return_ACPI_STATUS(AE_NOT_EXIST);
        }
 
        /*
@@ -219,7 +233,9 @@ acpi_ev_address_space_dispatch (
                        /*
                         *  Bad news, no init routine and not init'd
                         */
-                       return (AE_UNKNOWN_STATUS);
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No init routine for region(%p) [%s]\n",
+                               region_obj, acpi_ut_get_region_name (region_obj->region.space_id)));
+                       return_ACPI_STATUS (AE_UNKNOWN_STATUS);
                }
 
                /*
@@ -239,7 +255,10 @@ acpi_ev_address_space_dispatch (
                 *  Init routine may fail
                 */
                if (ACPI_FAILURE (status)) {
-                       return(status);
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Region Init: %s [%s]\n",
+                               acpi_format_exception (status),
+                               acpi_ut_get_region_name (region_obj->region.space_id)));
+                       return_ACPI_STATUS(status);
                }
 
                region_obj->region.flags |= AOPOBJ_INITIALIZED;
@@ -256,6 +275,11 @@ acpi_ev_address_space_dispatch (
         */
        handler = handler_desc->addr_handler.handler;
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
+               "Addrhandler %p (%p), Address %8.8lX%8.8lX\n",
+               &region_obj->region.addr_handler->addr_handler, handler, HIDWORD(address),
+               LODWORD(address)));
+
        if (!(handler_desc->addr_handler.flags & ADDR_HANDLER_DEFAULT_INSTALLED)) {
                /*
                 *  For handlers other than the default (supplied) handlers, we must
@@ -272,15 +296,21 @@ acpi_ev_address_space_dispatch (
                         handler_desc->addr_handler.context,
                         region_obj->region.extra->extra.region_context);
 
+       if (ACPI_FAILURE (status)) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Region handler: %s [%s]\n",
+                       acpi_format_exception (status),
+                       acpi_ut_get_region_name (region_obj->region.space_id)));
+       }
 
        if (!(handler_desc->addr_handler.flags & ADDR_HANDLER_DEFAULT_INSTALLED)) {
-               /* We just returned from a non-default handler, we must re-enter the
-               interpreter */
-
+               /*
+                * We just returned from a non-default handler, we must re-enter the
+                * interpreter
+                */
                acpi_ex_enter_interpreter ();
        }
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 /*******************************************************************************
@@ -299,15 +329,18 @@ acpi_ev_address_space_dispatch (
 
 void
 acpi_ev_disassociate_region_from_handler(
-       ACPI_OPERAND_OBJECT     *region_obj,
+       acpi_operand_object     *region_obj,
        u8                      acpi_ns_is_locked)
 {
-       ACPI_OPERAND_OBJECT     *handler_obj;
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_OPERAND_OBJECT     **last_obj_ptr;
+       acpi_operand_object     *handler_obj;
+       acpi_operand_object     *obj_desc;
+       acpi_operand_object     **last_obj_ptr;
        ACPI_ADR_SPACE_SETUP    region_setup;
        void                    *region_context;
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Ev_disassociate_region_from_handler");
 
 
        region_context = region_obj->region.extra->extra.region_context;
@@ -315,20 +348,18 @@ acpi_ev_disassociate_region_from_handler(
        /*
         *  Get the address handler from the region object
         */
-
        handler_obj = region_obj->region.addr_handler;
        if (!handler_obj) {
                /*
                 *  This region has no handler, all done
                 */
-               return;
+               return_VOID;
        }
 
 
        /*
         *  Find this region in the handler's list
         */
-
        obj_desc = handler_obj->addr_handler.region_list;
        last_obj_ptr = &handler_obj->addr_handler.region_list;
 
@@ -337,6 +368,9 @@ acpi_ev_disassociate_region_from_handler(
                 *  See if this is the one
                 */
                if (obj_desc == region_obj) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
+                               "Removing Region %p from address handler %p\n",
+                               region_obj, handler_obj));
                        /*
                         *  This is it, remove it from the handler's list
                         */
@@ -366,6 +400,11 @@ acpi_ev_disassociate_region_from_handler(
                        /*
                         *  Init routine may fail, Just ignore errors
                         */
+                       if (ACPI_FAILURE (status)) {
+                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s from region init, [%s]\n",
+                                       acpi_format_exception (status),
+                                       acpi_ut_get_region_name (region_obj->region.space_id)));
+                       }
 
                        region_obj->region.flags &= ~(AOPOBJ_INITIALIZED);
 
@@ -379,11 +418,9 @@ acpi_ev_disassociate_region_from_handler(
                         *  If the region is on the handler's list
                         *  this better be the region's handler
                         */
-                       ACPI_ASSERT (region_obj->region.addr_handler == handler_obj);
-
                        region_obj->region.addr_handler = NULL;
 
-                       return;
+                       return_VOID;
 
                } /* found the right handler */
 
@@ -397,7 +434,11 @@ acpi_ev_disassociate_region_from_handler(
        /*
         *  If we get here, the region was not in the handler's region list
         */
-       return;
+       ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
+               "Cannot remove region %p from address handler %p\n",
+               region_obj, handler_obj));
+
+       return_VOID;
 }
 
 
@@ -416,34 +457,32 @@ acpi_ev_disassociate_region_from_handler(
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ev_associate_region_and_handler (
-       ACPI_OPERAND_OBJECT     *handler_obj,
-       ACPI_OPERAND_OBJECT     *region_obj,
+       acpi_operand_object     *handler_obj,
+       acpi_operand_object     *region_obj,
        u8                      acpi_ns_is_locked)
 {
-       ACPI_STATUS     status;
+       acpi_status     status;
 
 
-       ACPI_ASSERT (region_obj->region.space_id == handler_obj->addr_handler.space_id);
-       ACPI_ASSERT (region_obj->region.addr_handler == 0);
+       FUNCTION_TRACE ("Ev_associate_region_and_handler");
+
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
+               "Adding Region %p to address handler %p [%s]\n",
+               region_obj, handler_obj, acpi_ut_get_region_name (region_obj->region.space_id)));
+
 
        /*
         *  Link this region to the front of the handler's list
         */
-
        region_obj->region.next = handler_obj->addr_handler.region_list;
        handler_obj->addr_handler.region_list = region_obj;
 
        /*
         *  set the region's handler
         */
-
-/*
-       Handler_obj->Common.Reference_count =
-                         (u16) (Handler_obj->Common.Reference_count +
-                         Region_obj->Common.Reference_count - 1);
-*/
        region_obj->region.addr_handler = handler_obj;
 
        /*
@@ -459,7 +498,7 @@ acpi_ev_associate_region_and_handler (
                acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
        }
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -482,24 +521,24 @@ acpi_ev_associate_region_and_handler (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ev_addr_handler_helper (
-       ACPI_HANDLE             obj_handle,
+       acpi_handle             obj_handle,
        u32                     level,
        void                    *context,
        void                    **return_value)
 {
-       ACPI_OPERAND_OBJECT     *handler_obj;
-       ACPI_OPERAND_OBJECT     *tmp_obj;
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_NAMESPACE_NODE     *node;
-       ACPI_STATUS             status;
+       acpi_operand_object     *handler_obj;
+       acpi_operand_object     *tmp_obj;
+       acpi_operand_object     *obj_desc;
+       acpi_namespace_node     *node;
+       acpi_status             status;
 
 
        PROC_NAME ("Ev_addr_handler_helper");
 
 
-       handler_obj = (ACPI_OPERAND_OBJECT *) context;
+       handler_obj = (acpi_operand_object *) context;
 
        /* Parameter validation */
 
@@ -518,7 +557,6 @@ acpi_ev_addr_handler_helper (
         *  We only care about regions.and objects
         *  that can have address handlers
         */
-
        if ((node->type != ACPI_TYPE_DEVICE) &&
                (node->type != ACPI_TYPE_REGION) &&
                (node != acpi_gbl_root_node)) {
@@ -551,6 +589,11 @@ acpi_ev_addr_handler_helper (
                                /*
                                 *  It's for the same address space
                                 */
+                               ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
+                                       "Found handler for region [%s] in device %p(%p) handler %p\n",
+                                       acpi_ut_get_region_name (handler_obj->addr_handler.space_id),
+                                       obj_desc, tmp_obj, handler_obj));
+
                                /*
                                 *  Since the object we found it on was a device, then it
                                 *  means that someone has already installed a handler for
@@ -578,8 +621,6 @@ acpi_ev_addr_handler_helper (
        /*
         *  Only here if it was a region
         */
-       ACPI_ASSERT (obj_desc->common.type == ACPI_TYPE_REGION);
-
        if (obj_desc->region.space_id != handler_obj->addr_handler.space_id) {
                /*
                 *  This region is for a different address space
index 1e1f66b033ad701abe20644277378f8f186fd552..92dc3f5a9dacf25ef1206ce7173c4c63d8347bc4 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: evrgnini- ACPI Address_space (Op_region) init
- *              $Revision: 40 $
+ *              $Revision: 46 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ev_system_memory_region_setup (
-       ACPI_HANDLE             handle,
+       acpi_handle             handle,
        u32                     function,
        void                    *handler_context,
        void                    **region_context)
 {
+       FUNCTION_TRACE ("Ev_system_memory_region_setup");
+
 
        if (function == ACPI_REGION_DEACTIVATE) {
                if (*region_context) {
-                       acpi_ut_free (*region_context);
+                       ACPI_MEM_FREE (*region_context);
                        *region_context = NULL;
                }
-               return (AE_OK);
+               return_ACPI_STATUS (AE_OK);
        }
 
 
        /* Activate.  Create a new context */
 
-       *region_context = acpi_ut_callocate (sizeof (ACPI_MEM_SPACE_CONTEXT));
+       *region_context = ACPI_MEM_CALLOCATE (sizeof (acpi_mem_space_context));
        if (!(*region_context)) {
-               return (AE_NO_MEMORY);
+               return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -92,13 +94,15 @@ acpi_ev_system_memory_region_setup (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ev_io_space_region_setup (
-       ACPI_HANDLE             handle,
+       acpi_handle             handle,
        u32                     function,
        void                    *handler_context,
        void                    **region_context)
 {
+       FUNCTION_TRACE ("Ev_io_space_region_setup");
+
 
        if (function == ACPI_REGION_DEACTIVATE) {
                *region_context = NULL;
@@ -107,7 +111,7 @@ acpi_ev_io_space_region_setup (
                *region_context = handler_context;
        }
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -128,46 +132,51 @@ acpi_ev_io_space_region_setup (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ev_pci_config_region_setup (
-       ACPI_HANDLE             handle,
+       acpi_handle             handle,
        u32                     function,
        void                    *handler_context,
        void                    **region_context)
 {
-       ACPI_STATUS             status = AE_OK;
-       ACPI_INTEGER            temp;
-       ACPI_PCI_SPACE_CONTEXT  *pci_context = *region_context;
-       ACPI_OPERAND_OBJECT     *handler_obj;
-       ACPI_NAMESPACE_NODE     *node;
-       ACPI_OPERAND_OBJECT     *region_obj = (ACPI_OPERAND_OBJECT *) handle;
+       acpi_status             status = AE_OK;
+       acpi_integer            temp;
+       acpi_pci_id             *pci_id = *region_context;
+       acpi_operand_object     *handler_obj;
+       acpi_namespace_node     *node;
+       acpi_operand_object     *region_obj = (acpi_operand_object *) handle;
        ACPI_DEVICE_ID          object_hID;
 
 
+       FUNCTION_TRACE ("Ev_pci_config_region_setup");
+
+
        handler_obj = region_obj->region.addr_handler;
        if (!handler_obj) {
                /*
                 *  No installed handler. This shouldn't happen because the dispatch
                 *  routine checks before we get here, but we check again just in case.
                 */
-               return (AE_NOT_EXIST);
+               ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
+                       "Attempting to init a region %X, with no handler\n", region_obj));
+               return_ACPI_STATUS (AE_NOT_EXIST);
        }
 
        if (function == ACPI_REGION_DEACTIVATE) {
-               if (pci_context) {
-                       acpi_ut_free (pci_context);
+               if (pci_id) {
+                       ACPI_MEM_FREE (pci_id);
                        *region_context = NULL;
                }
 
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
 
        /* Create a new context */
 
-       pci_context = acpi_ut_callocate (sizeof (ACPI_PCI_SPACE_CONTEXT));
-       if (!pci_context) {
-               return (AE_NO_MEMORY);
+       pci_id = ACPI_MEM_CALLOCATE (sizeof (acpi_pci_id));
+       if (!pci_id) {
+               return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
        /*
@@ -179,8 +188,6 @@ acpi_ev_pci_config_region_setup (
         *  First get device and function numbers from the _ADR object
         *  in the parent's scope.
         */
-       ACPI_ASSERT (region_obj->region.node);
-
        node = acpi_ns_get_parent_object (region_obj->region.node);
 
 
@@ -193,7 +200,8 @@ acpi_ev_pci_config_region_setup (
         *  do nothing on failures.
         */
        if (ACPI_SUCCESS (status)) {
-               pci_context->dev_func = (u32) temp;
+               pci_id->device = HIWORD (temp);
+               pci_id->function = LOWORD (temp);
        }
 
        /*
@@ -232,19 +240,24 @@ acpi_ev_pci_config_region_setup (
                node = handler_obj->addr_handler.node;
        }
 
+       /*
+        * The PCI segment number comes from the _SEG method
+        */
        status = acpi_ut_evaluate_numeric_object (METHOD_NAME__SEG, node, &temp);
        if (ACPI_SUCCESS (status)) {
-               pci_context->seg = (u32) temp;
+               pci_id->segment = LOWORD (temp);
        }
 
+       /*
+        * The PCI bus number comes from the _BBN method
+        */
        status = acpi_ut_evaluate_numeric_object (METHOD_NAME__BBN, node, &temp);
        if (ACPI_SUCCESS (status)) {
-               pci_context->bus = (u32) temp;
+               pci_id->bus = LOWORD (temp);
        }
 
-       *region_context = pci_context;
-
-       return (AE_OK);
+       *region_context = pci_id;
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -263,13 +276,15 @@ acpi_ev_pci_config_region_setup (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ev_default_region_setup (
-       ACPI_HANDLE             handle,
+       acpi_handle             handle,
        u32                     function,
        void                    *handler_context,
        void                    **region_context)
 {
+       FUNCTION_TRACE ("Ev_default_region_setup");
+
 
        if (function == ACPI_REGION_DEACTIVATE) {
                *region_context = NULL;
@@ -278,7 +293,7 @@ acpi_ev_default_region_setup (
                *region_context = handler_context;
        }
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -303,26 +318,27 @@ acpi_ev_default_region_setup (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ev_initialize_region (
-       ACPI_OPERAND_OBJECT     *region_obj,
+       acpi_operand_object     *region_obj,
        u8                      acpi_ns_locked)
 {
-       ACPI_OPERAND_OBJECT     *handler_obj;
-       ACPI_OPERAND_OBJECT     *obj_desc;
+       acpi_operand_object     *handler_obj;
+       acpi_operand_object     *obj_desc;
        ACPI_ADR_SPACE_TYPE     space_id;
-       ACPI_NAMESPACE_NODE     *node;
-       ACPI_STATUS             status;
-       ACPI_NAMESPACE_NODE     *method_node;
-       ACPI_NAME               *reg_name_ptr = (ACPI_NAME *) METHOD_NAME__REG;
+       acpi_namespace_node     *node;
+       acpi_status             status;
+       acpi_namespace_node     *method_node;
+       acpi_name               *reg_name_ptr = (acpi_name *) METHOD_NAME__REG;
+
+
+       FUNCTION_TRACE_U32 ("Ev_initialize_region", acpi_ns_locked);
 
 
        if (!region_obj) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
-       ACPI_ASSERT (region_obj->region.node);
-
        node = acpi_ns_get_parent_object (region_obj->region.node);
        space_id = region_obj->region.space_id;
 
@@ -381,12 +397,16 @@ acpi_ev_initialize_region (
                                 *  see if it has the type we want
                                 */
                                if (handler_obj->addr_handler.space_id == space_id) {
+                                       ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
+                                               "Found handler %p for region %p in obj %p\n",
+                                               handler_obj, region_obj, obj_desc));
+
                                        /*
                                         *  Found it! Now update the region and the handler
                                         */
                                        acpi_ev_associate_region_and_handler (handler_obj, region_obj,
                                                        acpi_ns_locked);
-                                       return (AE_OK);
+                                       return_ACPI_STATUS (AE_OK);
                                }
 
                                handler_obj = handler_obj->addr_handler.next;
@@ -405,6 +425,10 @@ acpi_ev_initialize_region (
        /*
         *  If we get here, there is no handler for this region
         */
-       return (AE_NOT_EXIST);
+       ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
+               "No handler for Region_type %s(%X) (Region_obj %p)\n",
+               acpi_ut_get_region_name (space_id), space_id, region_obj));
+
+       return_ACPI_STATUS (AE_NOT_EXIST);
 }
 
index 7d9b67d9815b4752df9e2c5a9751bcbcce37b46a..f49d1bd3a5d2534f834a68a797f77e803c3fcace 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Module Name: evsci - System Control Interrupt configuration and
  *                      legacy to ACPI mode state transition functions
- *              $Revision: 72 $
+ *              $Revision: 74 $
  *
  ******************************************************************************/
 
@@ -64,6 +64,9 @@ acpi_ev_sci_handler (void *context)
        u32                     interrupt_handled = INTERRUPT_NOT_HANDLED;
 
 
+       FUNCTION_TRACE("Ev_sci_handler");
+
+
        /*
         * Make sure that ACPI is enabled by checking SCI_EN.  Note that we are
         * required to treat the SCI interrupt as sharable, level, active low.
@@ -71,7 +74,7 @@ acpi_ev_sci_handler (void *context)
        if (!acpi_hw_register_bit_access (ACPI_READ, ACPI_MTX_DO_NOT_LOCK, SCI_EN)) {
                /* ACPI is not enabled;  this interrupt cannot be for us */
 
-               return (INTERRUPT_NOT_HANDLED);
+               return_VALUE (INTERRUPT_NOT_HANDLED);
        }
 
        /*
@@ -88,7 +91,7 @@ acpi_ev_sci_handler (void *context)
         */
        interrupt_handled |= acpi_ev_gpe_detect ();
 
-       return (interrupt_handled);
+       return_VALUE (interrupt_handled);
 }
 
 
@@ -107,14 +110,15 @@ acpi_ev_sci_handler (void *context)
 u32
 acpi_ev_install_sci_handler (void)
 {
-       u32                     except = AE_OK;
+       u32                     status = AE_OK;
+
 
+       FUNCTION_TRACE ("Ev_install_sci_handler");
 
-       except = acpi_os_install_interrupt_handler ((u32) acpi_gbl_FADT->sci_int,
-                         acpi_ev_sci_handler,
-                         NULL);
 
-       return (except);
+       status = acpi_os_install_interrupt_handler ((u32) acpi_gbl_FADT->sci_int,
+                          acpi_ev_sci_handler, NULL);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -133,9 +137,12 @@ acpi_ev_install_sci_handler (void)
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ev_remove_sci_handler (void)
 {
+       FUNCTION_TRACE ("Ev_remove_sci_handler");
+
+
 #if 0
        /* TBD:[Investigate] Figure this out!!  Disable all events first ???  */
 
@@ -166,7 +173,7 @@ acpi_ev_remove_sci_handler (void)
        acpi_os_remove_interrupt_handler ((u32) acpi_gbl_FADT->sci_int,
                           acpi_ev_sci_handler);
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -188,6 +195,9 @@ acpi_ev_restore_acpi_state (void)
        u32                     index;
 
 
+       FUNCTION_TRACE ("Ev_restore_acpi_state");
+
+
        /* Restore the state of the chipset enable bits. */
 
        if (acpi_gbl_restore_acpi_chipset == TRUE) {
@@ -232,7 +242,7 @@ acpi_ev_restore_acpi_state (void)
                }
        }
 
-       return;
+       return_VOID;
 }
 
 
@@ -252,20 +262,21 @@ void
 acpi_ev_terminate (void)
 {
 
+       FUNCTION_TRACE ("Ev_terminate");
+
 
        /*
         * Free global tables, etc.
         */
-
        if (acpi_gbl_gpe_registers) {
-               acpi_ut_free (acpi_gbl_gpe_registers);
+               ACPI_MEM_FREE (acpi_gbl_gpe_registers);
        }
 
        if (acpi_gbl_gpe_info) {
-               acpi_ut_free (acpi_gbl_gpe_info);
+               ACPI_MEM_FREE (acpi_gbl_gpe_info);
        }
 
-       return;
+       return_VOID;
 }
 
 
index 5dde5afe0553f39c6529d199d9cc513af0a7362c..4b1c90be2ac558161b6da8aadf46883af72dddd5 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: evxface - External interfaces for ACPI events
- *              $Revision: 110 $
+ *              $Revision: 112 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_install_fixed_event_handler (
        u32                     event,
        ACPI_EVENT_HANDLER      handler,
        void                    *context)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Acpi_install_fixed_event_handler");
 
 
        /* Ensure that ACPI has been initialized */
 
        ACPI_IS_INITIALIZATION_COMPLETE (status);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Parameter validation */
 
        if (event > ACPI_EVENT_MAX) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
@@ -90,17 +93,23 @@ acpi_install_fixed_event_handler (
 
        status = acpi_enable_event (event, ACPI_EVENT_FIXED);
        if (!ACPI_SUCCESS (status)) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Could not enable fixed event.\n"));
+
                /* Remove the handler */
 
                acpi_gbl_fixed_event_handlers[event].handler = NULL;
                acpi_gbl_fixed_event_handlers[event].context = NULL;
        }
 
+       else {
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+                       "Enabled fixed event %X, Handler=%p\n", event, handler));
+       }
 
 
 cleanup:
        acpi_ut_release_mutex (ACPI_MTX_EVENTS);
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -117,25 +126,28 @@ cleanup:
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_remove_fixed_event_handler (
        u32                     event,
        ACPI_EVENT_HANDLER      handler)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+
+       FUNCTION_TRACE ("Acpi_remove_fixed_event_handler");
 
 
        /* Ensure that ACPI has been initialized */
 
        ACPI_IS_INITIALIZATION_COMPLETE (status);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Parameter validation */
 
        if (event > ACPI_EVENT_MAX) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
@@ -150,10 +162,17 @@ acpi_remove_fixed_event_handler (
        acpi_gbl_fixed_event_handlers[event].context = NULL;
 
 
+       if (!ACPI_SUCCESS(status)) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_WARN,
+                       "Could not write to fixed event enable register.\n"));
+       }
 
+       else {
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Disabled fixed event %X.\n", event));
+       }
 
        acpi_ut_release_mutex (ACPI_MTX_EVENTS);
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -174,31 +193,34 @@ acpi_remove_fixed_event_handler (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_install_notify_handler (
-       ACPI_HANDLE             device,
+       acpi_handle             device,
        u32                     handler_type,
        ACPI_NOTIFY_HANDLER     handler,
        void                    *context)
 {
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_OPERAND_OBJECT     *notify_obj;
-       ACPI_NAMESPACE_NODE     *device_node;
-       ACPI_STATUS             status = AE_OK;
+       acpi_operand_object     *obj_desc;
+       acpi_operand_object     *notify_obj;
+       acpi_namespace_node     *device_node;
+       acpi_status             status = AE_OK;
+
+
+       FUNCTION_TRACE ("Acpi_install_notify_handler");
 
 
        /* Ensure that ACPI has been initialized */
 
        ACPI_IS_INITIALIZATION_COMPLETE (status);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Parameter validation */
 
        if ((!handler) ||
                (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
@@ -318,7 +340,7 @@ acpi_install_notify_handler (
 
 unlock_and_exit:
        acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -337,30 +359,33 @@ unlock_and_exit:
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_remove_notify_handler (
-       ACPI_HANDLE             device,
+       acpi_handle             device,
        u32                     handler_type,
        ACPI_NOTIFY_HANDLER     handler)
 {
-       ACPI_OPERAND_OBJECT     *notify_obj;
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_NAMESPACE_NODE     *device_node;
-       ACPI_STATUS             status = AE_OK;
+       acpi_operand_object     *notify_obj;
+       acpi_operand_object     *obj_desc;
+       acpi_namespace_node     *device_node;
+       acpi_status             status = AE_OK;
+
+
+       FUNCTION_TRACE ("Acpi_remove_notify_handler");
 
 
        /* Ensure that ACPI has been initialized */
 
        ACPI_IS_INITIALIZATION_COMPLETE (status);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Parameter validation */
 
        if ((!handler) ||
                (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
@@ -379,6 +404,8 @@ acpi_remove_notify_handler (
         */
        if (device == ACPI_ROOT_OBJECT) {
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing notify handler for ROOT object.\n"));
+
                if (((handler_type == ACPI_SYSTEM_NOTIFY) &&
                          !acpi_gbl_sys_notify.handler) ||
                        ((handler_type == ACPI_DEVICE_NOTIFY) &&
@@ -453,7 +480,7 @@ acpi_remove_notify_handler (
 
 unlock_and_exit:
        acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -474,33 +501,36 @@ unlock_and_exit:
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_install_gpe_handler (
        u32                     gpe_number,
        u32                     type,
        ACPI_GPE_HANDLER        handler,
        void                    *context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+
+       FUNCTION_TRACE ("Acpi_install_gpe_handler");
 
 
        /* Ensure that ACPI has been initialized */
 
        ACPI_IS_INITIALIZATION_COMPLETE (status);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Parameter validation */
 
        if (!handler || (gpe_number > ACPI_GPE_MAX)) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        /* Ensure that we have a valid GPE number */
 
        if (acpi_gbl_gpe_valid[gpe_number] == ACPI_GPE_INVALID) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
@@ -525,7 +555,7 @@ acpi_install_gpe_handler (
 
 cleanup:
        acpi_ut_release_mutex (ACPI_MTX_EVENTS);
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -542,31 +572,34 @@ cleanup:
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_remove_gpe_handler (
        u32                     gpe_number,
        ACPI_GPE_HANDLER        handler)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+
+       FUNCTION_TRACE ("Acpi_remove_gpe_handler");
 
 
        /* Ensure that ACPI has been initialized */
 
        ACPI_IS_INITIALIZATION_COMPLETE (status);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Parameter validation */
 
        if (!handler || (gpe_number > ACPI_GPE_MAX)) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        /* Ensure that we have a valid GPE number */
 
        if (acpi_gbl_gpe_valid[gpe_number] == ACPI_GPE_INVALID) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        /* Disable the GPE before removing the handler */
@@ -590,7 +623,7 @@ acpi_remove_gpe_handler (
 
 cleanup:
        acpi_ut_release_mutex (ACPI_MTX_EVENTS);
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -606,11 +639,11 @@ cleanup:
  * DESCRIPTION: Acquire the ACPI Global Lock
  *
  ******************************************************************************/
-ACPI_STATUS
+acpi_status
 acpi_acquire_global_lock (
        void)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
 
 
        /* Ensure that ACPI has been initialized */
@@ -629,7 +662,6 @@ acpi_acquire_global_lock (
         * TBD: [Restructure] add timeout param to internal interface, and
         * perhaps INTERPRETER_LOCKED
         */
-
        status = acpi_ev_acquire_global_lock ();
        acpi_ex_exit_interpreter ();
 
@@ -649,11 +681,11 @@ acpi_acquire_global_lock (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_release_global_lock (
        void)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
 
 
        /* Ensure that ACPI has been initialized */
index 542a7707aedf1387320f64fa5344f2d3722c7897..7109d1847f92408b5fb2f2b54fd5f8fe6f5e0c0d 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: evxfevnt - External Interfaces, ACPI event disable/enable
- *              $Revision: 33 $
+ *              $Revision: 36 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_enable (void)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Acpi_enable");
 
 
        /* Make sure we've got ACPI tables */
 
        if (!acpi_gbl_DSDT) {
-               return (AE_NO_ACPI_TABLES);
+               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No ACPI tables present!\n"));
+               return_ACPI_STATUS (AE_NO_ACPI_TABLES);
        }
 
        /* Make sure the BIOS supports ACPI mode */
 
        if (SYS_MODE_LEGACY == acpi_hw_get_mode_capabilities()) {
-               return (AE_ERROR);
+               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Only legacy mode supported!\n"));
+               return_ACPI_STATUS (AE_ERROR);
        }
 
        /* Transition to ACPI mode */
 
        status = acpi_hw_set_mode (SYS_MODE_ACPI);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, "Could not transition to ACPI mode.\n"));
+               return_ACPI_STATUS (status);
        }
 
-       return (status);
+       ACPI_DEBUG_PRINT ((ACPI_DB_OK, "Transition to ACPI mode successful\n"));
+
+       return_ACPI_STATUS (status);
 }
 
 
@@ -89,24 +97,28 @@ acpi_enable (void)
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_disable (void)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Acpi_disable");
 
 
        /* Ensure that ACPI has been initialized */
 
        ACPI_IS_INITIALIZATION_COMPLETE (status);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Restore original mode  */
 
        status = acpi_hw_set_mode (acpi_gbl_original_mode);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unable to transition to original mode"));
+               return_ACPI_STATUS (status);
        }
 
        /* Unload the SCI interrupt handler  */
@@ -114,7 +126,7 @@ acpi_disable (void)
        acpi_ev_remove_sci_handler ();
        acpi_ev_restore_acpi_state ();
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -131,20 +143,23 @@ acpi_disable (void)
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_enable_event (
        u32                     event,
        u32                     type)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        u32                     register_id;
 
 
+       FUNCTION_TRACE ("Acpi_enable_event");
+
+
        /* Ensure that ACPI has been initialized */
 
        ACPI_IS_INITIALIZATION_COMPLETE (status);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* The Type must be either Fixed Acpi_event or GPE */
@@ -177,7 +192,7 @@ acpi_enable_event (
                        break;
 
                default:
-                       return (AE_BAD_PARAMETER);
+                       return_ACPI_STATUS (AE_BAD_PARAMETER);
                        break;
                }
 
@@ -185,11 +200,12 @@ acpi_enable_event (
                 * Enable the requested fixed event (by writing a one to the
                 * enable register bit)
                 */
-
                acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, register_id, 1);
 
                if (1 != acpi_hw_register_bit_access(ACPI_READ, ACPI_MTX_LOCK, register_id)) {
-                       return (AE_NO_HARDWARE_RESPONSE);
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                               "Fixed event bit clear when it should be set\n"));
+                       return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
                }
 
                break;
@@ -201,7 +217,7 @@ acpi_enable_event (
 
                if ((event > ACPI_GPE_MAX) ||
                        (acpi_gbl_gpe_valid[event] == ACPI_GPE_INVALID)) {
-                       return (AE_BAD_PARAMETER);
+                       return_ACPI_STATUS (AE_BAD_PARAMETER);
                }
 
 
@@ -217,7 +233,7 @@ acpi_enable_event (
        }
 
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -234,20 +250,23 @@ acpi_enable_event (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_disable_event (
        u32                     event,
        u32                     type)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        u32                     register_id;
 
 
+       FUNCTION_TRACE ("Acpi_disable_event");
+
+
        /* Ensure that ACPI has been initialized */
 
        ACPI_IS_INITIALIZATION_COMPLETE (status);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* The Type must be either Fixed Acpi_event or GPE */
@@ -280,7 +299,7 @@ acpi_disable_event (
                        break;
 
                default:
-                       return (AE_BAD_PARAMETER);
+                       return_ACPI_STATUS (AE_BAD_PARAMETER);
                        break;
                }
 
@@ -288,11 +307,12 @@ acpi_disable_event (
                 * Disable the requested fixed event (by writing a zero to the
                 * enable register bit)
                 */
-
                acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, register_id, 0);
 
                if (0 != acpi_hw_register_bit_access(ACPI_READ, ACPI_MTX_LOCK, register_id)) {
-                       return (AE_NO_HARDWARE_RESPONSE);
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                               "Fixed event bit set when it should be clear,\n"));
+                       return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
                }
 
                break;
@@ -304,7 +324,7 @@ acpi_disable_event (
 
                if ((event > ACPI_GPE_MAX) ||
                        (acpi_gbl_gpe_valid[event] == ACPI_GPE_INVALID)) {
-                       return (AE_BAD_PARAMETER);
+                       return_ACPI_STATUS (AE_BAD_PARAMETER);
                }
 
                /* Disable the requested GPE number */
@@ -317,7 +337,7 @@ acpi_disable_event (
                status = AE_BAD_PARAMETER;
        }
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -334,20 +354,23 @@ acpi_disable_event (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_clear_event (
        u32                     event,
        u32                     type)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        u32                     register_id;
 
 
+       FUNCTION_TRACE ("Acpi_clear_event");
+
+
        /* Ensure that ACPI has been initialized */
 
        ACPI_IS_INITIALIZATION_COMPLETE (status);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* The Type must be either Fixed Acpi_event or GPE */
@@ -380,7 +403,7 @@ acpi_clear_event (
                        break;
 
                default:
-                       return (AE_BAD_PARAMETER);
+                       return_ACPI_STATUS (AE_BAD_PARAMETER);
                        break;
                }
 
@@ -388,7 +411,6 @@ acpi_clear_event (
                 * Clear the requested fixed event (By writing a one to the
                 * status register bit)
                 */
-
                acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, register_id, 1);
                break;
 
@@ -399,7 +421,7 @@ acpi_clear_event (
 
                if ((event > ACPI_GPE_MAX) ||
                        (acpi_gbl_gpe_valid[event] == ACPI_GPE_INVALID)) {
-                       return (AE_BAD_PARAMETER);
+                       return_ACPI_STATUS (AE_BAD_PARAMETER);
                }
 
 
@@ -412,7 +434,7 @@ acpi_clear_event (
                status = AE_BAD_PARAMETER;
        }
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -432,25 +454,28 @@ acpi_clear_event (
  ******************************************************************************/
 
 
-ACPI_STATUS
+acpi_status
 acpi_get_event_status (
        u32                     event,
        u32                     type,
-       ACPI_EVENT_STATUS       *event_status)
+       acpi_event_status       *event_status)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        u32                     register_id;
 
 
+       FUNCTION_TRACE ("Acpi_get_event_status");
+
+
        /* Ensure that ACPI has been initialized */
 
        ACPI_IS_INITIALIZATION_COMPLETE (status);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        if (!event_status) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
 
@@ -484,7 +509,7 @@ acpi_get_event_status (
                        break;
 
                default:
-                       return (AE_BAD_PARAMETER);
+                       return_ACPI_STATUS (AE_BAD_PARAMETER);
                        break;
                }
 
@@ -500,7 +525,7 @@ acpi_get_event_status (
 
                if ((event > ACPI_GPE_MAX) ||
                        (acpi_gbl_gpe_valid[event] == ACPI_GPE_INVALID)) {
-                       return (AE_BAD_PARAMETER);
+                       return_ACPI_STATUS (AE_BAD_PARAMETER);
                }
 
 
@@ -514,7 +539,6 @@ acpi_get_event_status (
                status = AE_BAD_PARAMETER;
        }
 
-
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
index c4a7f55d0585b7e689761aa04bf6b85deee0878e..37f058a4fee014b431e101d3b15b57072a247104 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Module Name: evxfregn - External Interfaces, ACPI Operation Regions and
  *                         Address Spaces.
- *              $Revision: 34 $
+ *              $Revision: 36 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_install_address_space_handler (
-       ACPI_HANDLE             device,
+       acpi_handle             device,
        ACPI_ADR_SPACE_TYPE     space_id,
        ACPI_ADR_SPACE_HANDLER  handler,
        ACPI_ADR_SPACE_SETUP    setup,
        void                    *context)
 {
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_OPERAND_OBJECT     *handler_obj;
-       ACPI_NAMESPACE_NODE     *node;
-       ACPI_STATUS             status = AE_OK;
-       ACPI_OBJECT_TYPE8       type;
+       acpi_operand_object     *obj_desc;
+       acpi_operand_object     *handler_obj;
+       acpi_namespace_node     *node;
+       acpi_status             status = AE_OK;
+       acpi_object_type8       type;
        u16                     flags = 0;
 
 
+       FUNCTION_TRACE ("Acpi_install_address_space_handler");
+
+
        /* Ensure that ACPI has been initialized */
 
        ACPI_IS_INITIALIZATION_COMPLETE (status);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Parameter validation */
@@ -80,7 +83,7 @@ acpi_install_address_space_handler (
        if ((!device)   ||
                ((!handler)  && (handler != ACPI_DEFAULT_HANDLER)) ||
                (space_id > ACPI_MAX_ADDRESS_SPACE)) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
@@ -98,7 +101,6 @@ acpi_install_address_space_handler (
         *  and the root.  This is where the default handlers
         *  get placed.
         */
-
        if ((node->type != ACPI_TYPE_DEVICE)     &&
                (node->type != ACPI_TYPE_PROCESSOR)  &&
                (node->type != ACPI_TYPE_THERMAL)    &&
@@ -143,7 +145,6 @@ acpi_install_address_space_handler (
        /*
         *  Check for an existing internal object
         */
-
        obj_desc = acpi_ns_get_attached_object (node);
        if (obj_desc) {
                /*
@@ -172,6 +173,9 @@ acpi_install_address_space_handler (
        }
 
        else {
+               ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
+                       "Creating object on Device %p while installing handler\n", node));
+
                /* Obj_desc does not exist, create one */
 
                if (node->type == ACPI_TYPE_ANY) {
@@ -201,6 +205,10 @@ acpi_install_address_space_handler (
                }
        }
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
+               "Installing address handler for region %s(%X) on Device %p(%p)\n",
+               acpi_ut_get_region_name (space_id), space_id, node, obj_desc));
+
        /*
         *  Now we can install the handler
         *
@@ -243,7 +251,6 @@ acpi_install_address_space_handler (
        /*
         *  Place this handler 1st on the list
         */
-
        handler_obj->common.reference_count =
                         (u16) (handler_obj->common.reference_count +
                         obj_desc->common.reference_count - 1);
@@ -252,7 +259,7 @@ acpi_install_address_space_handler (
 
 unlock_and_exit:
        acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -269,25 +276,28 @@ unlock_and_exit:
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_remove_address_space_handler (
-       ACPI_HANDLE             device,
+       acpi_handle             device,
        ACPI_ADR_SPACE_TYPE     space_id,
        ACPI_ADR_SPACE_HANDLER  handler)
 {
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_OPERAND_OBJECT     *handler_obj;
-       ACPI_OPERAND_OBJECT     *region_obj;
-       ACPI_OPERAND_OBJECT     **last_obj_ptr;
-       ACPI_NAMESPACE_NODE     *node;
-       ACPI_STATUS             status = AE_OK;
+       acpi_operand_object     *obj_desc;
+       acpi_operand_object     *handler_obj;
+       acpi_operand_object     *region_obj;
+       acpi_operand_object     **last_obj_ptr;
+       acpi_namespace_node     *node;
+       acpi_status             status = AE_OK;
+
+
+       FUNCTION_TRACE ("Acpi_remove_address_space_handler");
 
 
        /* Ensure that ACPI has been initialized */
 
        ACPI_IS_INITIALIZATION_COMPLETE (status);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Parameter validation */
@@ -295,7 +305,7 @@ acpi_remove_address_space_handler (
        if ((!device)   ||
                ((!handler)  && (handler != ACPI_DEFAULT_HANDLER)) ||
                (space_id > ACPI_MAX_ADDRESS_SPACE)) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
@@ -323,18 +333,21 @@ acpi_remove_address_space_handler (
        /*
         *  find the address handler the user requested
         */
-
        handler_obj = obj_desc->device.addr_handler;
        last_obj_ptr = &obj_desc->device.addr_handler;
        while (handler_obj) {
                /*
                 *  We have a handler, see if user requested this one
                 */
-
                if(handler_obj->addr_handler.space_id == space_id) {
                        /*
                         *  Got it, first dereference this in the Regions
                         */
+                       ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
+                               "Removing address handler %p(%p) for region %s on Device %p(%p)\n",
+                               handler_obj, handler, acpi_ut_get_region_name (space_id),
+                               node, obj_desc));
+
                        region_obj = handler_obj->addr_handler.region_list;
 
                        /* Walk the handler's region list */
@@ -383,12 +396,16 @@ acpi_remove_address_space_handler (
        /*
         *  The handler does not exist
         */
+       ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
+               "Unable to remove address handler %p for %s(%X), Dev_node %p, obj %p\n",
+               handler, acpi_ut_get_region_name (space_id), space_id, node, obj_desc));
+
        status = AE_NOT_EXIST;
 
 
 unlock_and_exit:
        acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
index f57be75e8c04fc093bafb47ca6afdb67ac660f8d..82bfd875ae31f20a5701b48fda1cfaa757366805 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes)
- *              $Revision: 34 $
+ *              $Revision: 41 $
  *
  *****************************************************************************/
 
  *
  ****************************************************************************/
 
-static ACPI_STATUS
+static acpi_status
 acpi_ex_load_table_op (
-       ACPI_OPERAND_OBJECT     *rgn_desc,
-       ACPI_HANDLE             *ddb_handle)
+       acpi_operand_object     *rgn_desc,
+       acpi_operand_object     **ddb_handle)
 {
-       ACPI_STATUS             status;
-       ACPI_OPERAND_OBJECT     *table_desc = NULL;
+       acpi_status             status;
+       acpi_operand_object     *table_desc = NULL;
        u8                      *table_ptr;
        u8                      *table_data_ptr;
-       ACPI_TABLE_HEADER       table_header;
-       ACPI_TABLE_DESC         table_info;
+       acpi_table_header       table_header;
+       acpi_table_desc         table_info;
        u32                     i;
 
 
+       FUNCTION_TRACE ("Ex_load_table");
+
        /* TBD: [Unhandled] Object can be either a field or an opregion */
 
 
        /* Get the table header */
 
        table_header.length = 0;
-       for (i = 0; i < sizeof (ACPI_TABLE_HEADER); i++) {
+       for (i = 0; i < sizeof (acpi_table_header); i++) {
                status = acpi_ev_address_space_dispatch (rgn_desc, ACPI_READ_ADR_SPACE,
                                   (ACPI_PHYSICAL_ADDRESS) i, 8,
                                   (u32 *) ((u8 *) &table_header + i));
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
        }
 
        /* Allocate a buffer for the entire table */
 
-       table_ptr = acpi_ut_allocate (table_header.length);
+       table_ptr = ACPI_MEM_ALLOCATE (table_header.length);
        if (!table_ptr) {
-               return (AE_NO_MEMORY);
+               return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
        /* Copy the header to the buffer */
 
-       MEMCPY (table_ptr, &table_header, sizeof (ACPI_TABLE_HEADER));
-       table_data_ptr = table_ptr + sizeof (ACPI_TABLE_HEADER);
+       MEMCPY (table_ptr, &table_header, sizeof (acpi_table_header));
+       table_data_ptr = table_ptr + sizeof (acpi_table_header);
 
 
        /* Get the table from the op region */
@@ -113,6 +115,9 @@ acpi_ex_load_table_op (
                (!STRNCMP (table_header.signature,
                                 acpi_gbl_acpi_table_data[ACPI_TABLE_SSDT].signature,
                                 acpi_gbl_acpi_table_data[ACPI_TABLE_SSDT].sig_length))) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                       "Table has invalid signature [%4.4s], must be SSDT or PSDT\n",
+                       table_header.signature));
                status = AE_BAD_SIGNATURE;
                goto cleanup;
        }
@@ -128,7 +133,7 @@ acpi_ex_load_table_op (
 
        /* Install the new table into the local data structures */
 
-       table_info.pointer     = (ACPI_TABLE_HEADER *) table_ptr;
+       table_info.pointer     = (acpi_table_header *) table_ptr;
        table_info.length      = table_header.length;
        table_info.allocation  = ACPI_MEM_ALLOCATED;
        table_info.base_pointer = table_ptr;
@@ -162,14 +167,14 @@ acpi_ex_load_table_op (
 
        *ddb_handle = table_desc;
 
-       return (status);
+       return_ACPI_STATUS (status);
 
 
 cleanup:
 
-       acpi_ut_free (table_desc);
-       acpi_ut_free (table_ptr);
-       return (status);
+       ACPI_MEM_FREE (table_desc);
+       ACPI_MEM_FREE (table_ptr);
+       return_ACPI_STATUS (status);
 
 }
 
@@ -186,41 +191,42 @@ cleanup:
  *
  ****************************************************************************/
 
-static ACPI_STATUS
+static acpi_status
 acpi_ex_unload_table (
-       ACPI_HANDLE             ddb_handle)
+       acpi_operand_object     *ddb_handle)
 {
-       ACPI_STATUS             status = AE_NOT_IMPLEMENTED;
-       ACPI_OPERAND_OBJECT     *table_desc = (ACPI_OPERAND_OBJECT *) ddb_handle;
-       ACPI_TABLE_DESC         *table_info;
+       acpi_status             status = AE_NOT_IMPLEMENTED;
+       acpi_operand_object     *table_desc = ddb_handle;
+       acpi_table_desc         *table_info;
 
 
-       /* Validate the handle */
-       /* Although the handle is partially validated in Acpi_ex_reconfiguration(),
-        *  when it calls Acpi_ex_resolve_operands(), the handle is more completely
-        *  validated here.
-        */
+       FUNCTION_TRACE ("Ex_unload_table");
 
+
+       /*
+        * Validate the handle
+        * Although the handle is partially validated in Acpi_ex_reconfiguration(),
+        * when it calls Acpi_ex_resolve_operands(), the handle is more completely
+        * validated here.
+        */
        if ((!ddb_handle) ||
                (!VALID_DESCRIPTOR_TYPE (ddb_handle, ACPI_DESC_TYPE_INTERNAL)) ||
-               (((ACPI_OPERAND_OBJECT  *)ddb_handle)->common.type !=
+               (((acpi_operand_object  *)ddb_handle)->common.type !=
                                INTERNAL_TYPE_REFERENCE)) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
-
        /* Get the actual table descriptor from the Ddb_handle */
 
-       table_info = (ACPI_TABLE_DESC *) table_desc->reference.object;
+       table_info = (acpi_table_desc *) table_desc->reference.object;
 
        /*
         * 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 (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Delete the table itself */
@@ -231,7 +237,7 @@ acpi_ex_unload_table (
 
        acpi_ut_remove_reference (table_desc);
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -248,57 +254,43 @@ acpi_ex_unload_table (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_reconfiguration (
        u16                     opcode,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_walk_state         *walk_state)
 {
-       ACPI_STATUS             status;
-       ACPI_OPERAND_OBJECT     *region_desc = NULL;
-       ACPI_HANDLE             *ddb_handle;
+       acpi_operand_object     **operand = &walk_state->operands[0];
+       acpi_status             status;
 
 
-       /* Resolve the operands */
+       FUNCTION_TRACE ("Ex_reconfiguration");
 
-       status = acpi_ex_resolve_operands (opcode, WALK_OPERANDS, walk_state);
-       /* Get the table handle, common for both opcodes */
+#define ddb_handle          operand[0]
+#define region_desc         operand[1]
 
-       status |= acpi_ds_obj_stack_pop_object ((ACPI_OPERAND_OBJECT **) &ddb_handle,
-                        walk_state);
 
        switch (opcode) {
 
        case AML_LOAD_OP:
 
-               /* Get the region or field descriptor */
-
-               status |= acpi_ds_obj_stack_pop_object (&region_desc, walk_state);
-               if (ACPI_FAILURE (status)) {
-                       acpi_ut_remove_reference (region_desc);
-                       return (status);
-               }
-
-               status = acpi_ex_load_table_op (region_desc, ddb_handle);
+               status = acpi_ex_load_table_op (region_desc, &ddb_handle);
                break;
 
 
        case AML_UNLOAD_OP:
 
-               if (ACPI_FAILURE (status)) {
-                       return (status);
-               }
-
                status = acpi_ex_unload_table (ddb_handle);
                break;
 
 
        default:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "bad opcode=%X\n", opcode));
                status = AE_AML_BAD_OPCODE;
                break;
        }
 
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
index 37f2788451201d8bdc27b07ef058b1c984b402dd..92f6c117718ed0040fdc2e6afc032271cd73289f 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: exconvrt - Object conversion routines
- *              $Revision: 13 $
+ *              $Revision: 22 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_convert_to_integer (
-       ACPI_OPERAND_OBJECT     **obj_desc,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_operand_object     *obj_desc,
+       acpi_operand_object     **result_desc,
+       acpi_walk_state         *walk_state)
 {
        u32                     i;
-       ACPI_OPERAND_OBJECT     *ret_desc;
+       acpi_operand_object     *ret_desc;
        u32                     count;
        char                    *pointer;
-       ACPI_INTEGER            result;
-       u32                     integer_size = sizeof (ACPI_INTEGER);
+       acpi_integer            result;
+       u32                     integer_size = sizeof (acpi_integer);
 
 
-       switch ((*obj_desc)->common.type) {
+       FUNCTION_ENTRY ();
+
+
+       switch (obj_desc->common.type) {
        case ACPI_TYPE_INTEGER:
+               *result_desc = obj_desc;
                return (AE_OK);
 
        case ACPI_TYPE_STRING:
-               pointer = (*obj_desc)->string.pointer;
-               count = (*obj_desc)->string.length;
+               pointer = obj_desc->string.pointer;
+               count   = obj_desc->string.length;
                break;
 
        case ACPI_TYPE_BUFFER:
-               pointer = (char *) (*obj_desc)->buffer.pointer;
-               count = (*obj_desc)->buffer.length;
+               pointer = (char *) obj_desc->buffer.pointer;
+               count   = obj_desc->buffer.length;
                break;
 
        default:
@@ -122,7 +127,7 @@ acpi_ex_convert_to_integer (
        /*
         * String conversion is different than Buffer conversion
         */
-       switch ((*obj_desc)->common.type) {
+       switch (obj_desc->common.type) {
        case ACPI_TYPE_STRING:
 
                /* TBD: Need to use 64-bit STRTOUL */
@@ -131,7 +136,6 @@ acpi_ex_convert_to_integer (
                 * Convert string to an integer
                 * String must be hexadecimal as per the ACPI specification
                 */
-
                result = STRTOUL (pointer, NULL, 16);
                break;
 
@@ -148,7 +152,7 @@ acpi_ex_convert_to_integer (
                         * Little endian is used, meaning that the first byte of the buffer
                         * is the LSB of the integer
                         */
-                       result |= (((ACPI_INTEGER) pointer[i]) << (i * 8));
+                       result |= (((acpi_integer) pointer[i]) << (i * 8));
                }
 
                break;
@@ -158,12 +162,13 @@ acpi_ex_convert_to_integer (
 
        ret_desc->integer.value = result;
 
-       if (walk_state->opcode != AML_STORE_OP) {
-               acpi_ut_remove_reference (*obj_desc);
+       if (*result_desc == obj_desc) {
+               if (walk_state->opcode != AML_STORE_OP) {
+                       acpi_ut_remove_reference (obj_desc);
+               }
        }
 
-       *obj_desc = ret_desc;
-
+       *result_desc = ret_desc;
        return (AE_OK);
 }
 
@@ -182,18 +187,22 @@ acpi_ex_convert_to_integer (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_convert_to_buffer (
-       ACPI_OPERAND_OBJECT     **obj_desc,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_operand_object     *obj_desc,
+       acpi_operand_object     **result_desc,
+       acpi_walk_state         *walk_state)
 {
-       ACPI_OPERAND_OBJECT     *ret_desc;
+       acpi_operand_object     *ret_desc;
        u32                     i;
-       u32                     integer_size = sizeof (ACPI_INTEGER);
+       u32                     integer_size = sizeof (acpi_integer);
        u8                      *new_buf;
 
 
-       switch ((*obj_desc)->common.type) {
+       FUNCTION_ENTRY ();
+
+
+       switch (obj_desc->common.type) {
        case ACPI_TYPE_INTEGER:
 
                /*
@@ -218,7 +227,7 @@ acpi_ex_convert_to_buffer (
                /* Need enough space for one integers */
 
                ret_desc->buffer.length = integer_size;
-               new_buf = acpi_ut_callocate (integer_size);
+               new_buf = ACPI_MEM_CALLOCATE (integer_size);
                if (!new_buf) {
                        REPORT_ERROR
                                (("Ex_dyadic2_r/Concat_op: Buffer allocation failure\n"));
@@ -229,24 +238,29 @@ acpi_ex_convert_to_buffer (
                /* Copy the integer to the buffer */
 
                for (i = 0; i < integer_size; i++) {
-                       new_buf[i] = (u8) ((*obj_desc)->integer.value >> (i * 8));
+                       new_buf[i] = (u8) (obj_desc->integer.value >> (i * 8));
                }
                ret_desc->buffer.pointer = new_buf;
 
                /* Return the new buffer descriptor */
 
-               if (walk_state->opcode != AML_STORE_OP) {
-                       acpi_ut_remove_reference (*obj_desc);
+               if (*result_desc == obj_desc) {
+                       if (walk_state->opcode != AML_STORE_OP) {
+                               acpi_ut_remove_reference (obj_desc);
+                       }
                }
-               *obj_desc = ret_desc;
+
+               *result_desc = ret_desc;
                break;
 
 
        case ACPI_TYPE_STRING:
+               *result_desc = obj_desc;
                break;
 
 
        case ACPI_TYPE_BUFFER:
+               *result_desc = obj_desc;
                break;
 
 
@@ -259,6 +273,98 @@ acpi_ex_convert_to_buffer (
 }
 
 
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_convert_ascii
+ *
+ * PARAMETERS:  Integer
+ *
+ * RETURN:      Actual string length
+ *
+ * DESCRIPTION: Convert an ACPI Integer to a hex string
+ *
+ ******************************************************************************/
+
+u32
+acpi_ex_convert_to_ascii (
+       acpi_integer            integer,
+       u32                     base,
+       u8                      *string)
+{
+       u32                     i;
+       u32                     j;
+       u32                     k = 0;
+       u8                      hex_digit;
+       acpi_integer            digit;
+       u8                      leading_zero = TRUE;
+       u32                     length = sizeof (acpi_integer);
+
+
+       FUNCTION_ENTRY ();
+
+
+       switch (base) {
+       case 10:
+
+               for (i = ACPI_MAX_DECIMAL_DIGITS; i > 0 ; i--) {
+                       /* Divide by nth factor of 10 */
+
+                       digit = integer;
+                       for (j = 1; j < i; j++) {
+                               digit = ACPI_DIVIDE (digit, 10);
+                       }
+
+                       /* Create the decimal digit */
+
+                       if (digit != 0) {
+                               leading_zero = FALSE;
+                       }
+
+                       if (!leading_zero) {
+                               string[k] = (u8) (ASCII_ZERO + ACPI_MODULO (digit, 10));
+                               k++;
+                       }
+               }
+               break;
+
+       case 16:
+
+               /* Copy the integer to the buffer */
+
+               for (i = 0, j = ((length * 2) -1); i < (length * 2); i++, j--) {
+
+                       hex_digit = acpi_ut_hex_to_ascii_char (integer, (j * 4));
+                       if (hex_digit != ASCII_ZERO) {
+                               leading_zero = FALSE;
+                       }
+
+                       if (!leading_zero) {
+                               string[k] = hex_digit;
+                               k++;
+                       }
+               }
+               break;
+
+       default:
+               break;
+       }
+
+       /*
+        * Since leading zeros are supressed, we must check for the case where
+        * the integer equals 0.
+        *
+        * Finally, null terminate the string and return the length
+        */
+       if (!k) {
+               string [0] = ASCII_ZERO;
+               k = 1;
+       }
+       string [k] = 0;
+
+       return (k);
+}
+
+
 /*******************************************************************************
  *
  * FUNCTION:    Acpi_ex_convert_to_string
@@ -273,29 +379,28 @@ acpi_ex_convert_to_buffer (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_convert_to_string (
-       ACPI_OPERAND_OBJECT     **obj_desc,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_operand_object     *obj_desc,
+       acpi_operand_object     **result_desc,
+       u32                     base,
+       u32                     max_length,
+       acpi_walk_state         *walk_state)
 {
-       ACPI_OPERAND_OBJECT     *ret_desc;
+       acpi_operand_object     *ret_desc;
        u32                     i;
        u32                     index;
-       u32                     integer_size = sizeof (ACPI_INTEGER);
+       u32                     string_length;
+       u32                     integer_size = sizeof (acpi_integer);
        u8                      *new_buf;
        u8                      *pointer;
 
 
-       switch ((*obj_desc)->common.type) {
-       case ACPI_TYPE_INTEGER:
+       FUNCTION_ENTRY ();
 
-               /*
-                * Create a new String
-                */
-               ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_STRING);
-               if (!ret_desc) {
-                       return (AE_NO_MEMORY);
-               }
+
+       switch (obj_desc->common.type) {
+       case ACPI_TYPE_INTEGER:
 
                /* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
 
@@ -308,10 +413,22 @@ acpi_ex_convert_to_string (
                        integer_size = sizeof (u32);
                }
 
+               string_length = integer_size * 2;
+               if (base == 10) {
+                       string_length = ACPI_MAX_DECIMAL_DIGITS;
+               }
+
+               /*
+                * Create a new String
+                */
+               ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_STRING);
+               if (!ret_desc) {
+                       return (AE_NO_MEMORY);
+               }
+
                /* Need enough space for one ASCII integer plus null terminator */
 
-               ret_desc->string.length = (integer_size * 2) + 1;
-               new_buf = acpi_ut_callocate (ret_desc->string.length);
+               new_buf = ACPI_MEM_CALLOCATE (string_length + 1);
                if (!new_buf) {
                        REPORT_ERROR
                                (("Ex_convert_to_string: Buffer allocation failure\n"));
@@ -319,45 +436,64 @@ acpi_ex_convert_to_string (
                        return (AE_NO_MEMORY);
                }
 
-               /* Copy the integer to the buffer */
 
-               for (i = 0; i < (integer_size * 2); i++) {
-                       new_buf[i] = acpi_gbl_hex_to_ascii [((*obj_desc)->integer.value >> (i * 4)) & 0xF];
-               }
+               /* Convert */
 
-               /* Null terminate */
+               i = acpi_ex_convert_to_ascii (obj_desc->integer.value, base, new_buf);
+
+               /* Null terminate at the correct place */
+
+               if (max_length < i) {
+                       new_buf[max_length] = 0;
+                       ret_desc->string.length = max_length;
+               }
+               else {
+                       new_buf [i] = 0;
+                       ret_desc->string.length = i;
+               }
 
-               new_buf [i] = 0;
                ret_desc->buffer.pointer = new_buf;
 
                /* Return the new buffer descriptor */
 
-               if (walk_state->opcode != AML_STORE_OP) {
-                       acpi_ut_remove_reference (*obj_desc);
+               if (*result_desc == obj_desc) {
+                       if (walk_state->opcode != AML_STORE_OP) {
+                               acpi_ut_remove_reference (obj_desc);
+                       }
                }
-               *obj_desc = ret_desc;
 
-               return (AE_OK);
+               *result_desc = ret_desc;
+               break;
 
 
        case ACPI_TYPE_BUFFER:
 
-               if (((*obj_desc)->buffer.length * 3) > ACPI_MAX_STRING_CONVERSION) {
-                       return (AE_AML_STRING_LIMIT);
+               string_length = obj_desc->buffer.length * 3;
+               if (base == 10) {
+                       string_length = obj_desc->buffer.length * 4;
+               }
+
+               if (max_length > ACPI_MAX_STRING_CONVERSION) {
+                       if (string_length > ACPI_MAX_STRING_CONVERSION) {
+                               return (AE_AML_STRING_LIMIT);
+                       }
                }
 
                /*
-                * Create a new String
+                * Create a new string object
                 */
                ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_STRING);
                if (!ret_desc) {
                        return (AE_NO_MEMORY);
                }
 
-               /* Need enough space for one ASCII integer plus null terminator */
+               /* String length is the lesser of the Max or the actual length */
 
-               ret_desc->string.length = (*obj_desc)->buffer.length * 3;
-               new_buf = acpi_ut_callocate (ret_desc->string.length + 1);
+               if (max_length < string_length) {
+                       string_length = max_length;
+               }
+
+               new_buf = ACPI_MEM_CALLOCATE (string_length + 1);
                if (!new_buf) {
                        REPORT_ERROR
                                (("Ex_convert_to_string: Buffer allocation failure\n"));
@@ -368,30 +504,45 @@ acpi_ex_convert_to_string (
                /*
                 * Convert each byte of the buffer to two ASCII characters plus a space.
                 */
-               pointer = (*obj_desc)->buffer.pointer;
+               pointer = obj_desc->buffer.pointer;
                index = 0;
-               for (i = 0; i < (*obj_desc)->buffer.length; i++) {
-                       new_buf[index + 0] = acpi_gbl_hex_to_ascii [pointer[i] & 0x0F];
-                       new_buf[index + 1] = acpi_gbl_hex_to_ascii [(pointer[i] >> 4) & 0x0F];
-                       new_buf[index + 2] = ' ';
-                       index += 3;
+               for (i = 0, index = 0; i < obj_desc->buffer.length; i++) {
+                       index = acpi_ex_convert_to_ascii (pointer[i], base, &new_buf[index]);
+
+                       new_buf[index] = ' ';
+                       index++;
                }
 
                /* Null terminate */
 
-               new_buf [index] = 0;
+               new_buf [index-1] = 0;
                ret_desc->buffer.pointer = new_buf;
+               ret_desc->string.length = STRLEN ((char *) new_buf);
+
 
                /* Return the new buffer descriptor */
 
-               if (walk_state->opcode != AML_STORE_OP) {
-                       acpi_ut_remove_reference (*obj_desc);
+               if (*result_desc == obj_desc) {
+                       if (walk_state->opcode != AML_STORE_OP) {
+                               acpi_ut_remove_reference (obj_desc);
+                       }
                }
-               *obj_desc = ret_desc;
+
+               *result_desc = ret_desc;
                break;
 
 
        case ACPI_TYPE_STRING:
+
+               if (max_length >= obj_desc->string.length) {
+                       *result_desc = obj_desc;
+               }
+
+               else {
+                       /* Must copy the string first and then truncate it */
+
+                       return (AE_NOT_IMPLEMENTED);
+               }
                break;
 
 
@@ -417,20 +568,22 @@ acpi_ex_convert_to_string (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_convert_to_target_type (
-       ACPI_OBJECT_TYPE8       destination_type,
-       ACPI_OPERAND_OBJECT     **obj_desc,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_object_type8       destination_type,
+       acpi_operand_object     **obj_desc,
+       acpi_walk_state         *walk_state)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+
+       FUNCTION_TRACE ("Ex_convert_to_target_type");
 
 
        /*
         * If required by the target,
         * perform implicit conversion on the source before we store it.
         */
-
        switch (GET_CURRENT_ARG_TYPE (walk_state->op_info->runtime_args)) {
        case ARGI_SIMPLE_TARGET:
        case ARGI_FIXED_TARGET:
@@ -447,6 +600,10 @@ acpi_ex_convert_to_target_type (
                        /* No conversion allowed for these types */
 
                        if (destination_type != (*obj_desc)->common.type) {
+                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                                       "Target does not allow conversion of type %s to %s\n",
+                                       acpi_ut_get_type_name ((*obj_desc)->common.type),
+                                       acpi_ut_get_type_name (destination_type)));
                                status = AE_TYPE;
                        }
                }
@@ -464,7 +621,7 @@ acpi_ex_convert_to_target_type (
                         * These types require an Integer operand.  We can convert
                         * a Buffer or a String to an Integer if necessary.
                         */
-                       status = acpi_ex_convert_to_integer (obj_desc, walk_state);
+                       status = acpi_ex_convert_to_integer (*obj_desc, obj_desc, walk_state);
                        break;
 
 
@@ -474,7 +631,7 @@ acpi_ex_convert_to_target_type (
                         * The operand must be a String.  We can convert an
                         * Integer or Buffer if necessary
                         */
-                       status = acpi_ex_convert_to_string (obj_desc, walk_state);
+                       status = acpi_ex_convert_to_string (*obj_desc, obj_desc, 16, ACPI_UINT32_MAX, walk_state);
                        break;
 
 
@@ -484,7 +641,7 @@ acpi_ex_convert_to_target_type (
                         * The operand must be a String.  We can convert an
                         * Integer or Buffer if necessary
                         */
-                       status = acpi_ex_convert_to_buffer (obj_desc, walk_state);
+                       status = acpi_ex_convert_to_buffer (*obj_desc, obj_desc, walk_state);
                        break;
                }
                break;
@@ -498,6 +655,11 @@ acpi_ex_convert_to_target_type (
 
 
        default:
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                       "Unknown Target type ID 0x%X Op %s Dest_type %s\n",
+                       GET_CURRENT_ARG_TYPE (walk_state->op_info->runtime_args),
+                       walk_state->op_info->name, acpi_ut_get_type_name (destination_type)));
+
                status = AE_AML_INTERNAL;
        }
 
@@ -512,7 +674,7 @@ acpi_ex_convert_to_target_type (
                status = AE_OK;
        }
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
index 1db86dcd2d107a951249fd79499a2c292103d88d..64b5a5425c38af44b4cdf1bf066d54b26bee26ff 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: excreate - Named object creation
- *              $Revision: 63 $
+ *              $Revision: 66 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_create_buffer_field (
        u8                      *aml_ptr,
        u32                     aml_length,
-       ACPI_NAMESPACE_NODE     *node,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_namespace_node     *node,
+       acpi_walk_state         *walk_state)
 {
-       ACPI_STATUS             status;
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_OPERAND_OBJECT     *tmp_desc;
+       acpi_status             status;
+       acpi_operand_object     *obj_desc;
+       acpi_operand_object     *tmp_desc;
+
+
+       FUNCTION_TRACE ("Ex_create_buffer_field");
 
 
        /* Create the descriptor */
@@ -90,7 +93,6 @@ acpi_ex_create_buffer_field (
        /*
         * Allocate a method object for this field unit
         */
-
        obj_desc->buffer_field.extra = acpi_ut_create_internal_object (
                           INTERNAL_TYPE_EXTRA);
        if (!obj_desc->buffer_field.extra) {
@@ -103,7 +105,6 @@ acpi_ex_create_buffer_field (
         * opcode and operands -- since the buffer and index
         * operands must be evaluated.
         */
-
        obj_desc->buffer_field.extra->extra.pcode     = aml_ptr;
        obj_desc->buffer_field.extra->extra.pcode_length = aml_length;
        obj_desc->buffer_field.node = node;
@@ -135,15 +136,21 @@ acpi_ex_create_buffer_field (
                         * There is an existing object here;  delete it and zero out the
                         * object field within the Node
                         */
+                       DUMP_PATHNAME (node,
+                               "Ex_create_buffer_field: Removing Current Reference",
+                               ACPI_LV_BFIELD, _COMPONENT);
+
+                       DUMP_ENTRY (node, ACPI_LV_BFIELD);
+                       DUMP_STACK_ENTRY (tmp_desc);
 
                        acpi_ut_remove_reference (tmp_desc);
-                       acpi_ns_attach_object ((ACPI_NAMESPACE_NODE *) node, NULL,
+                       acpi_ns_attach_object ((acpi_namespace_node *) node, NULL,
                                         ACPI_TYPE_ANY);
                }
 
                /* Set the type to ANY (or the store below will fail) */
 
-               ((ACPI_NAMESPACE_NODE *) node)->type = ACPI_TYPE_ANY;
+               ((acpi_namespace_node *) node)->type = ACPI_TYPE_ANY;
 
                break;
 
@@ -156,7 +163,7 @@ acpi_ex_create_buffer_field (
 
        /* Store constructed field descriptor in result location */
 
-       status = acpi_ex_store (obj_desc, (ACPI_OPERAND_OBJECT *) node,
+       status = acpi_ex_store (obj_desc, (acpi_operand_object *) node,
                          walk_state);
 
        /*
@@ -168,7 +175,7 @@ acpi_ex_create_buffer_field (
        }
 
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 
 
 cleanup:
@@ -182,7 +189,7 @@ cleanup:
                obj_desc = NULL;
        }
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -199,22 +206,22 @@ cleanup:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_create_alias (
-       ACPI_WALK_STATE         *walk_state)
+       acpi_walk_state         *walk_state)
 {
-       ACPI_NAMESPACE_NODE     *source_node;
-       ACPI_NAMESPACE_NODE     *alias_node;
-       ACPI_STATUS             status;
+       acpi_namespace_node     *source_node;
+       acpi_namespace_node     *alias_node;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Ex_create_alias");
 
 
        /* Get the source/alias operands (both namespace nodes) */
 
-       status = acpi_ds_obj_stack_pop_object ((ACPI_OPERAND_OBJECT **) &source_node,
-                        walk_state);
-       if (ACPI_FAILURE (status)) {
-               return (status);
-       }
+       source_node = (acpi_namespace_node *) walk_state->operands[walk_state->num_operands -1];
+       walk_state->num_operands--;
 
        /*
         * Don't pop it, it gets removed in the calling routine
@@ -241,7 +248,7 @@ acpi_ex_create_alias (
 
        /* Since both operands are Nodes, we don't need to delete them */
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -257,15 +264,16 @@ acpi_ex_create_alias (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_create_event (
-       ACPI_WALK_STATE         *walk_state)
+       acpi_walk_state         *walk_state)
 {
-       ACPI_STATUS             status;
-       ACPI_OPERAND_OBJECT     *obj_desc;
+       acpi_status             status;
+       acpi_operand_object     *obj_desc;
 
 
- BREAKPOINT3;
+       FUNCTION_TRACE ("Ex_create_event");
+
 
        obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_EVENT);
        if (!obj_desc) {
@@ -297,7 +305,7 @@ acpi_ex_create_event (
 
 cleanup:
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -314,21 +322,22 @@ cleanup:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_create_mutex (
-       ACPI_WALK_STATE         *walk_state)
+       acpi_walk_state         *walk_state)
 {
-       ACPI_STATUS             status = AE_OK;
-       ACPI_OPERAND_OBJECT     *sync_desc;
-       ACPI_OPERAND_OBJECT     *obj_desc;
+       acpi_status             status = AE_OK;
+       acpi_operand_object     *sync_desc;
+       acpi_operand_object     *obj_desc;
+
+
+       FUNCTION_TRACE_PTR ("Ex_create_mutex", WALK_OPERANDS);
 
 
        /* Get the operand */
 
-       status = acpi_ds_obj_stack_pop_object (&sync_desc, walk_state);
-       if (ACPI_FAILURE (status)) {
-               return (status);
-       }
+       sync_desc = walk_state->operands[walk_state->num_operands -1];
+       walk_state->num_operands--;
 
        /* Attempt to allocate a new object */
 
@@ -365,7 +374,7 @@ cleanup:
 
        acpi_ut_remove_reference (sync_desc);
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -384,16 +393,19 @@ cleanup:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_create_region (
        u8                      *aml_ptr,
        u32                     aml_length,
        u8                      region_space,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_walk_state         *walk_state)
 {
-       ACPI_STATUS             status;
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_NAMESPACE_NODE     *node;
+       acpi_status             status;
+       acpi_operand_object     *obj_desc;
+       acpi_namespace_node     *node;
+
+
+       FUNCTION_TRACE ("Ex_create_region");
 
 
        /*
@@ -403,13 +415,16 @@ acpi_ex_create_region (
        if ((region_space >= NUM_REGION_TYPES) &&
                (region_space < USER_REGION_BEGIN)) {
                REPORT_ERROR (("Invalid Address_space type %X\n", region_space));
-               return (AE_AML_INVALID_SPACE_ID);
+               return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID);
        }
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (%X)\n",
+                         acpi_ut_get_region_name (region_space), region_space));
+
 
        /* Get the Node from the object stack  */
 
-       node = (ACPI_NAMESPACE_NODE *) acpi_ds_obj_stack_get_value (0, walk_state);
+       node = (acpi_namespace_node *) acpi_ds_obj_stack_get_value (0, walk_state);
 
        /* Create the region descriptor */
 
@@ -422,7 +437,6 @@ acpi_ex_create_region (
        /*
         * Allocate a method object for this region.
         */
-
        obj_desc->region.extra = acpi_ut_create_internal_object (
                         INTERNAL_TYPE_EXTRA);
        if (!obj_desc->region.extra) {
@@ -434,7 +448,6 @@ acpi_ex_create_region (
         * Remember location in AML stream of address & length
         * operands since they need to be evaluated at run time.
         */
-
        obj_desc->region.extra->extra.pcode      = aml_ptr;
        obj_desc->region.extra->extra.pcode_length = aml_length;
 
@@ -460,7 +473,6 @@ acpi_ex_create_region (
         * If we have a valid region, initialize it
         * Namespace is NOT locked at this point.
         */
-
        status = acpi_ev_initialize_region (obj_desc, FALSE);
 
        if (ACPI_FAILURE (status)) {
@@ -487,7 +499,7 @@ cleanup:
                }
        }
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -505,19 +517,22 @@ cleanup:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_create_processor (
-       ACPI_PARSE_OBJECT       *op,
-       ACPI_NAMESPACE_NODE     *processor_node)
+       acpi_parse_object       *op,
+       acpi_namespace_node     *processor_node)
 {
-       ACPI_STATUS             status;
-       ACPI_PARSE_OBJECT       *arg;
-       ACPI_OPERAND_OBJECT     *obj_desc;
+       acpi_status             status;
+       acpi_parse_object       *arg;
+       acpi_operand_object     *obj_desc;
+
+
+       FUNCTION_TRACE_PTR ("Ex_create_processor", op);
 
 
        obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_PROCESSOR);
        if (!obj_desc) {
-               return (AE_NO_MEMORY);
+               return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
        /* Install the new processor object in the parent Node */
@@ -526,14 +541,14 @@ acpi_ex_create_processor (
                           (u8) ACPI_TYPE_PROCESSOR);
        if (ACPI_FAILURE (status)) {
                acpi_ut_delete_object_desc (obj_desc);
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Get first arg and verify existence */
 
        arg = op->value.arg;
        if (!arg) {
-               return (AE_AML_NO_OPERAND);
+               return_ACPI_STATUS (AE_AML_NO_OPERAND);
        }
 
        /* First arg is the Processor ID */
@@ -544,7 +559,7 @@ acpi_ex_create_processor (
 
        arg = arg->next;
        if (!arg) {
-               return (AE_AML_NO_OPERAND);
+               return_ACPI_STATUS (AE_AML_NO_OPERAND);
        }
 
        /* Second arg is the PBlock Address */
@@ -555,13 +570,13 @@ acpi_ex_create_processor (
 
        arg = arg->next;
        if (!arg) {
-               return (AE_AML_NO_OPERAND);
+               return_ACPI_STATUS (AE_AML_NO_OPERAND);
        }
 
        /* Third arg is the PBlock Length */
 
        obj_desc->processor.length = (u8) arg->value.integer;
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -579,19 +594,22 @@ acpi_ex_create_processor (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_create_power_resource (
-       ACPI_PARSE_OBJECT       *op,
-       ACPI_NAMESPACE_NODE     *power_node)
+       acpi_parse_object       *op,
+       acpi_namespace_node     *power_node)
 {
-       ACPI_STATUS             status;
-       ACPI_PARSE_OBJECT       *arg;
-       ACPI_OPERAND_OBJECT     *obj_desc;
+       acpi_status             status;
+       acpi_parse_object       *arg;
+       acpi_operand_object     *obj_desc;
+
+
+       FUNCTION_TRACE_PTR ("Ex_create_power_resource", op);
 
 
        obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_POWER);
        if (!obj_desc) {
-               return (AE_NO_MEMORY);
+               return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
        /* Install the new power resource object in the parent Node */
@@ -599,7 +617,7 @@ acpi_ex_create_power_resource (
        status = acpi_ns_attach_object (power_node, obj_desc,
                          (u8) ACPI_TYPE_POWER);
        if (ACPI_FAILURE (status)) {
-               return(status);
+               return_ACPI_STATUS(status);
        }
 
 
@@ -607,7 +625,7 @@ acpi_ex_create_power_resource (
 
        arg = op->value.arg;
        if (!arg) {
-               return (AE_AML_NO_OPERAND);
+               return_ACPI_STATUS (AE_AML_NO_OPERAND);
        }
 
        /* First arg is the System_level */
@@ -618,14 +636,14 @@ acpi_ex_create_power_resource (
 
        arg = arg->next;
        if (!arg) {
-               return (AE_AML_NO_OPERAND);
+               return_ACPI_STATUS (AE_AML_NO_OPERAND);
        }
 
        /* Second arg is the PBlock Address */
 
        obj_desc->power_resource.resource_order = (u16) arg->value.integer;
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -644,22 +662,25 @@ acpi_ex_create_power_resource (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_create_method (
        u8                      *aml_ptr,
        u32                     aml_length,
        u32                     method_flags,
-       ACPI_NAMESPACE_NODE     *method)
+       acpi_namespace_node     *method)
 {
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_STATUS             status;
+       acpi_operand_object     *obj_desc;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE_PTR ("Ex_create_method", method);
 
 
        /* Create a new method object */
 
        obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_METHOD);
        if (!obj_desc) {
-          return (AE_NO_MEMORY);
+          return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
        /* Get the method's AML pointer/length from the Op */
@@ -671,7 +692,6 @@ acpi_ex_create_method (
         * First argument is the Method Flags (contains parameter count for the
         * method)
         */
-
        obj_desc->method.method_flags = (u8) method_flags;
        obj_desc->method.param_count = (u8) (method_flags &
                          METHOD_FLAGS_ARG_COUNT);
@@ -700,7 +720,7 @@ acpi_ex_create_method (
                acpi_ut_delete_object_desc (obj_desc);
        }
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
index 48de2d96733de33181b1e3e8d3902f69e5c4780d..ef8cdb833c758d70f0b822c4ba6026e48d0ccd13 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: exdump - Interpreter debug output routines
- *              $Revision: 114 $
+ *              $Revision: 123 $
  *
  *****************************************************************************/
 
@@ -29,6 +29,7 @@
 #include "amlcode.h"
 #include "acnamesp.h"
 #include "actables.h"
+#include "acparser.h"
 
 #define _COMPONENT          ACPI_EXECUTER
         MODULE_NAME         ("exdump")
  * The following routines are used for debug output only
  */
 
+#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_ptr            - 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_ptr 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_ptr,
+       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    */
+
+
+       FUNCTION_TRACE ("Ex_show_hex_value");
+
+
+       if (!aml_ptr) {
+               REPORT_ERROR (("Ex_show_hex_value: null pointer\n"));
+       }
+
+       /*
+        * AML numbers are always stored little-endian,
+        * even if the processor is big-endian.
+        */
+       for (current_aml_ptr = aml_ptr + byte_count,
+                       value = 0;
+                       current_aml_ptr > aml_ptr; ) {
+               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);
+       }
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, ""));
+
+       for (length = lead_space; length; --length ) {
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_LOAD, " "));
+       }
+
+       while (byte_count--) {
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_LOAD, "%02x", *aml_ptr++));
+
+               if (byte_count) {
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_LOAD, " "));
+               }
+       }
+
+       if (show_decimal_value) {
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_LOAD, " [%ld]", value));
+       }
+
+       if (0 == lead_space) {
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_LOAD, " "));
+       }
+
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_LOAD, "\n"));
+       return_VOID;
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_dump_operand
+ *
+ * PARAMETERS:  *Entry_desc         - Pointer to entry to be dumped
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Dump a stack entry
+ *
+ ****************************************************************************/
+
+acpi_status
+acpi_ex_dump_operand (
+       acpi_operand_object     *entry_desc)
+{
+       u8                      *buf = NULL;
+       u32                     length;
+       u32                     i;
+
+
+       PROC_NAME ("Ex_dump_operand")
+
+
+       if (!entry_desc) {
+               /*
+                * This usually indicates that something serious is wrong --
+                * since most (if not all)
+                * code that dumps the stack expects something to be there!
+                */
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null stack entry ptr\n"));
+               return (AE_OK);
+       }
+
+       if (VALID_DESCRIPTOR_TYPE (entry_desc, ACPI_DESC_TYPE_NAMED)) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%p NS Node: ", entry_desc));
+               DUMP_ENTRY (entry_desc, ACPI_LV_INFO);
+               return (AE_OK);
+       }
+
+       if (acpi_tb_system_table_pointer (entry_desc)) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%p is an AML pointer\n",
+                       entry_desc));
+               return (AE_OK);
+       }
+
+       if (!VALID_DESCRIPTOR_TYPE (entry_desc, ACPI_DESC_TYPE_INTERNAL)) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%p Is not a local object \n", entry_desc));
+               DUMP_BUFFER (entry_desc, sizeof (acpi_operand_object));
+               return (AE_OK);
+       }
+
+       /*  Entry_desc is a valid object */
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%p ", entry_desc));
+
+       switch (entry_desc->common.type) {
+       case INTERNAL_TYPE_REFERENCE:
+
+               switch (entry_desc->reference.opcode) {
+               case AML_ZERO_OP:
+
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: Zero\n"));
+                       break;
+
+
+               case AML_ONE_OP:
+
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: One\n"));
+                       break;
+
+
+               case AML_ONES_OP:
+
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: Ones\n"));
+                       break;
+
+
+               case AML_REVISION_OP:
+
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: Revision\n"));
+                       break;
+
+
+               case AML_DEBUG_OP:
+
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: Debug\n"));
+                       break;
+
+
+               case AML_NAME_OP:
+
+                       DUMP_PATHNAME (entry_desc->reference.object, "Reference: Name: ",
+                                         ACPI_LV_INFO, _COMPONENT);
+                       DUMP_ENTRY (entry_desc->reference.object, ACPI_LV_INFO);
+                       break;
+
+
+               case AML_INDEX_OP:
+
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: Index %p\n",
+                                        entry_desc->reference.object));
+                       break;
+
+
+               case AML_ARG_OP:
+
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: Arg%d",
+                                        entry_desc->reference.offset));
+
+                       if (ACPI_TYPE_INTEGER == entry_desc->common.type) {
+                               /* Value is a Number */
+
+                               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, " value is [%ld]",
+                                                 entry_desc->integer.value));
+                       }
+
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\n"));
+                       break;
+
+
+               case AML_LOCAL_OP:
+
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: Local%d",
+                                        entry_desc->reference.offset));
+
+                       if (ACPI_TYPE_INTEGER == entry_desc->common.type) {
+
+                               /* Value is a Number */
+
+                               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, " value is [%ld]",
+                                                 entry_desc->integer.value));
+                       }
+
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\n"));
+                       break;
+
+
+               case AML_INT_NAMEPATH_OP:
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference.Node->Name %x\n",
+                                        entry_desc->reference.node->name));
+                       break;
+
+               default:
+
+                       /*  unknown opcode  */
+
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Unknown opcode=%X\n",
+                               entry_desc->reference.opcode));
+                       break;
+
+               }
+
+               break;
+
+
+       case ACPI_TYPE_BUFFER:
+
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Buffer len %X @ %p \n",
+                                entry_desc->buffer.length,
+                                entry_desc->buffer.pointer));
+
+               length = entry_desc->buffer.length;
+
+               if (length > 64) {
+                       length = 64;
+               }
+
+               /* Debug only -- dump the buffer contents */
+
+               if (entry_desc->buffer.pointer) {
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Buffer Contents: "));
+
+                       for (buf = entry_desc->buffer.pointer; length--; ++buf) {
+                               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO,
+                                       length ? " %02x" : " %02x", *buf));
+                       }
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO,"\n"));
+               }
+
+               break;
+
+
+       case ACPI_TYPE_INTEGER:
+
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Integer %8.8X%8.8X\n",
+                                HIDWORD (entry_desc->integer.value),
+                                LODWORD (entry_desc->integer.value)));
+               break;
+
+
+       case INTERNAL_TYPE_IF:
+
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "If [Integer] %8.8X%8.8X\n",
+                                HIDWORD (entry_desc->integer.value),
+                                LODWORD (entry_desc->integer.value)));
+               break;
+
+
+       case INTERNAL_TYPE_WHILE:
+
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "While [Integer] %8.8X%8.8X\n",
+                                HIDWORD (entry_desc->integer.value),
+                                LODWORD (entry_desc->integer.value)));
+               break;
+
+
+       case ACPI_TYPE_PACKAGE:
+
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Package count %X @ %p\n",
+                                entry_desc->package.count, entry_desc->package.elements));
+
+               /*
+                * If elements exist, package vector pointer is valid,
+                * and debug_level exceeds 1, dump package's elements.
+                */
+               if (entry_desc->package.count &&
+                       entry_desc->package.elements &&
+                       acpi_dbg_level > 1) {
+                       acpi_operand_object**element;
+                       u16                 element_index;
+
+                       for (element_index = 0, element = entry_desc->package.elements;
+                                 element_index < entry_desc->package.count;
+                                 ++element_index, ++element) {
+                               acpi_ex_dump_operand (*element);
+                       }
+               }
+
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\n"));
+
+               break;
+
+
+       case ACPI_TYPE_REGION:
+
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Region %s (%X)",
+                       acpi_ut_get_region_name (entry_desc->region.space_id),
+                       entry_desc->region.space_id));
+
+               /*
+                * If the address and length have not been evaluated,
+                * don't print them.
+                */
+               if (!(entry_desc->region.flags & AOPOBJ_DATA_VALID)) {
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\n"));
+               }
+               else {
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, " base %p Length %X\n",
+                               entry_desc->region.address, entry_desc->region.length));
+               }
+               break;
+
+
+       case ACPI_TYPE_STRING:
+
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "String length %X @ %p \"",
+                                entry_desc->string.length, entry_desc->string.pointer));
+
+               for (i = 0; i < entry_desc->string.length; i++) {
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "%c",
+                                        entry_desc->string.pointer[i]));
+               }
+
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\"\n"));
+               break;
+
+
+       case INTERNAL_TYPE_BANK_FIELD:
+
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Bank_field\n"));
+               break;
+
+
+       case INTERNAL_TYPE_REGION_FIELD:
+
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO,
+                       "Region_field: bits=%X bitaccwidth=%X lock=%X update=%X at byte=%lX bit=%X of below:\n",
+                       entry_desc->field.bit_length,    entry_desc->field.access_bit_width,
+                       entry_desc->field.lock_rule,     entry_desc->field.update_rule,
+                       entry_desc->field.base_byte_offset, entry_desc->field.start_field_bit_offset));
+               DUMP_STACK_ENTRY (entry_desc->field.region_obj);
+               break;
+
+
+       case INTERNAL_TYPE_INDEX_FIELD:
+
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Index_field\n"));
+               break;
+
+
+       case ACPI_TYPE_BUFFER_FIELD:
+
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO,
+                       "Buffer_field: %X bits at byte %lX bit %X of \n",
+                       entry_desc->buffer_field.bit_length, entry_desc->buffer_field.base_byte_offset,
+                       entry_desc->buffer_field.start_field_bit_offset));
+
+               if (!entry_desc->buffer_field.buffer_obj)
+               {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "*NULL* \n"));
+               }
+
+               else if (ACPI_TYPE_BUFFER !=
+                                 entry_desc->buffer_field.buffer_obj->common.type)
+               {
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "*not a Buffer* \n"));
+               }
+
+               else
+               {
+                       DUMP_STACK_ENTRY (entry_desc->buffer_field.buffer_obj);
+               }
+
+               break;
+
+
+       case ACPI_TYPE_EVENT:
+
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Event\n"));
+               break;
+
+
+       case ACPI_TYPE_METHOD:
+
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO,
+                       "Method(%X) @ %p:%lX\n",
+                       entry_desc->method.param_count,
+                       entry_desc->method.pcode, entry_desc->method.pcode_length));
+               break;
+
+
+       case ACPI_TYPE_MUTEX:
+
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Mutex\n"));
+               break;
+
+
+       case ACPI_TYPE_DEVICE:
+
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Device\n"));
+               break;
+
+
+       case ACPI_TYPE_POWER:
+
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Power\n"));
+               break;
+
+
+       case ACPI_TYPE_PROCESSOR:
+
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Processor\n"));
+               break;
+
+
+       case ACPI_TYPE_THERMAL:
+
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Thermal\n"));
+               break;
+
+
+       default:
+               /*  unknown Entry_desc->Common.Type value   */
+
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Unknown Type %X\n",
+                       entry_desc->common.type));
+
+               /* Back up to previous entry */
+
+               entry_desc--;
+
+
+               /* TBD: [Restructure]  Change to use dump object routine !! */
+               /*       What is all of this?? */
+
+               DUMP_BUFFER (entry_desc, sizeof (acpi_operand_object));
+               DUMP_BUFFER (++entry_desc, sizeof (acpi_operand_object));
+               DUMP_BUFFER (++entry_desc, sizeof (acpi_operand_object));
+               break;
+
+       }
+
+       return (AE_OK);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_dump_operands
+ *
+ * PARAMETERS:  Interpreter_mode     - Load or Exec
+ *              *Ident              - Identification
+ *              Num_levels          - # of stack entries to dump above line
+ *              *Note               - Output notation
+ *
+ * DESCRIPTION: Dump the object stack
+ *
+ ****************************************************************************/
+
+void
+acpi_ex_dump_operands (
+       acpi_operand_object     **operands,
+       operating_mode          interpreter_mode,
+       NATIVE_CHAR             *ident,
+       u32                     num_levels,
+       NATIVE_CHAR             *note,
+       NATIVE_CHAR             *module_name,
+       u32                     line_number)
+{
+       NATIVE_UINT             i;
+       acpi_operand_object     **entry_desc;
+
+
+       PROC_NAME ("Ex_dump_operands");
+
+
+       if (!ident)
+       {
+               ident = "?";
+       }
+
+       if (!note)
+       {
+               note = "?";
+       }
+
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+               "************* Operand Stack Contents (Opcode [%s], %d Operands)\n",
+               ident, num_levels));
+
+       if (num_levels == 0)
+       {
+               num_levels = 1;
+       }
+
+       /* Dump the stack starting at the top, working down */
+
+       for (i = 0; num_levels > 0; i--, num_levels--)
+       {
+               entry_desc = &operands[i];
+
+               if (ACPI_FAILURE (acpi_ex_dump_operand (*entry_desc)))
+               {
+                       break;
+               }
+       }
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+               "************* Stack dump from %s(%d), %s\n",
+               module_name, line_number, note));
+       return;
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_dump_node
+ *
+ * PARAMETERS:  *Node           - Descriptor to dump
+ *              Flags               - Force display
+ *
+ * DESCRIPTION: Dumps the members of the given.Node
+ *
+ ****************************************************************************/
+
+void
+acpi_ex_dump_node (
+       acpi_namespace_node     *node,
+       u32                     flags)
+{
+
+       FUNCTION_ENTRY ();
+
+
+       if (!flags)
+       {
+               if (!((ACPI_LV_OBJECTS & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer)))
+               {
+                       return;
+               }
+       }
+
+
+       acpi_os_printf ("%20s : %4.4s\n", "Name",           &node->name);
+       acpi_os_printf ("%20s : %s\n",  "Type",             acpi_ut_get_type_name (node->type));
+       acpi_os_printf ("%20s : %X\n",  "Flags",            node->flags);
+       acpi_os_printf ("%20s : %X\n",  "Owner Id",         node->owner_id);
+       acpi_os_printf ("%20s : %X\n",  "Reference Count",  node->reference_count);
+       acpi_os_printf ("%20s : %p\n",  "Attached Object",  node->object);
+       acpi_os_printf ("%20s : %p\n",  "Child_list",       node->child);
+       acpi_os_printf ("%20s : %p\n",  "Next_peer",        node->peer);
+       acpi_os_printf ("%20s : %p\n",  "Parent",           acpi_ns_get_parent_object (node));
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Acpi_ex_dump_object_descriptor
+ *
+ * PARAMETERS:  *Object             - Descriptor to dump
+ *              Flags               - Force display
+ *
+ * DESCRIPTION: Dumps the members of the object descriptor given.
+ *
+ ****************************************************************************/
+
+void
+acpi_ex_dump_object_descriptor (
+       acpi_operand_object     *obj_desc,
+       u32                     flags)
+{
+       const acpi_opcode_info  *op_info;
+
+
+       FUNCTION_TRACE ("Ex_dump_object_descriptor");
+
+
+       if (!flags)
+       {
+               if (!((ACPI_LV_OBJECTS & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer)))
+               {
+                       return;
+               }
+       }
+
+       if (!(VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_INTERNAL)))
+       {
+               acpi_os_printf ("%p is not a valid ACPI object\n", obj_desc);
+               return;
+       }
+
+       /* Common Fields */
+
+       acpi_os_printf ("%20s : %X\n", "Reference Count", obj_desc->common.reference_count);
+       acpi_os_printf ("%20s : %X\n", "Flags", obj_desc->common.flags);
+
+       /* Object-specific Fields */
+
+       switch (obj_desc->common.type)
+       {
+       case ACPI_TYPE_INTEGER:
+
+               acpi_os_printf ("%20s : %s\n", "Type", "Integer");
+               acpi_os_printf ("%20s : %X%8.8X\n", "Value", HIDWORD (obj_desc->integer.value),
+                                 LODWORD (obj_desc->integer.value));
+               break;
+
+
+       case ACPI_TYPE_STRING:
+
+               acpi_os_printf ("%20s : %s\n", "Type", "String");
+               acpi_os_printf ("%20s : %X\n", "Length", obj_desc->string.length);
+               acpi_os_printf ("%20s : %p\n", "Pointer", obj_desc->string.pointer);
+               break;
+
+
+       case ACPI_TYPE_BUFFER:
+
+               acpi_os_printf ("%20s : %s\n", "Type", "Buffer");
+               acpi_os_printf ("%20s : %X\n", "Length", obj_desc->buffer.length);
+               acpi_os_printf ("%20s : %p\n", "Pointer", obj_desc->buffer.pointer);
+               break;
+
+
+       case ACPI_TYPE_PACKAGE:
+
+               acpi_os_printf ("%20s : %s\n", "Type", "Package");
+               acpi_os_printf ("%20s : %X\n", "Flags", obj_desc->package.flags);
+               acpi_os_printf ("%20s : %X\n", "Count", obj_desc->package.count);
+               acpi_os_printf ("%20s : %p\n", "Elements", obj_desc->package.elements);
+               acpi_os_printf ("%20s : %p\n", "Next_element", obj_desc->package.next_element);
+               break;
+
+
+       case ACPI_TYPE_BUFFER_FIELD:
+
+               acpi_os_printf ("%20s : %s\n", "Type", "Buffer_field");
+               acpi_os_printf ("%20s : %X\n", "Bit_length", obj_desc->buffer_field.bit_length);
+               acpi_os_printf ("%20s : %X\n", "Bit_offset", obj_desc->buffer_field.start_field_bit_offset);
+               acpi_os_printf ("%20s : %X\n", "Base_byte_offset",obj_desc->buffer_field.base_byte_offset);
+               acpi_os_printf ("%20s : %p\n", "Buffer_obj", obj_desc->buffer_field.buffer_obj);
+               break;
+
+
+       case ACPI_TYPE_DEVICE:
+
+               acpi_os_printf ("%20s : %s\n", "Type", "Device");
+               acpi_os_printf ("%20s : %p\n", "Addr_handler", obj_desc->device.addr_handler);
+               acpi_os_printf ("%20s : %p\n", "Sys_handler", obj_desc->device.sys_handler);
+               acpi_os_printf ("%20s : %p\n", "Drv_handler", obj_desc->device.drv_handler);
+               break;
+
+       case ACPI_TYPE_EVENT:
+
+               acpi_os_printf ("%20s : %s\n", "Type", "Event");
+               acpi_os_printf ("%20s : %X\n", "Semaphore", obj_desc->event.semaphore);
+               break;
+
+
+       case ACPI_TYPE_METHOD:
+
+               acpi_os_printf ("%20s : %s\n", "Type", "Method");
+               acpi_os_printf ("%20s : %X\n", "Param_count", obj_desc->method.param_count);
+               acpi_os_printf ("%20s : %X\n", "Concurrency", obj_desc->method.concurrency);
+               acpi_os_printf ("%20s : %p\n", "Semaphore", obj_desc->method.semaphore);
+               acpi_os_printf ("%20s : %X\n", "Pcode_length", obj_desc->method.pcode_length);
+               acpi_os_printf ("%20s : %X\n", "Pcode", obj_desc->method.pcode);
+               break;
+
+
+       case ACPI_TYPE_MUTEX:
+
+               acpi_os_printf ("%20s : %s\n", "Type", "Mutex");
+               acpi_os_printf ("%20s : %X\n", "Sync_level", obj_desc->mutex.sync_level);
+               acpi_os_printf ("%20s : %p\n", "Owner", obj_desc->mutex.owner);
+               acpi_os_printf ("%20s : %X\n", "Acquisition_depth", obj_desc->mutex.acquisition_depth);
+               acpi_os_printf ("%20s : %p\n", "Semaphore", obj_desc->mutex.semaphore);
+               break;
+
+
+       case ACPI_TYPE_REGION:
+
+               acpi_os_printf ("%20s : %s\n", "Type", "Region");
+               acpi_os_printf ("%20s : %X\n", "Space_id", obj_desc->region.space_id);
+               acpi_os_printf ("%20s : %X\n", "Flags", obj_desc->region.flags);
+               acpi_os_printf ("%20s : %X\n", "Address", obj_desc->region.address);
+               acpi_os_printf ("%20s : %X\n", "Length", obj_desc->region.length);
+               acpi_os_printf ("%20s : %p\n", "Addr_handler", obj_desc->region.addr_handler);
+               acpi_os_printf ("%20s : %p\n", "Next", obj_desc->region.next);
+               break;
+
+
+       case ACPI_TYPE_POWER:
+
+               acpi_os_printf ("%20s : %s\n", "Type", "Power_resource");
+               acpi_os_printf ("%20s : %X\n", "System_level", obj_desc->power_resource.system_level);
+               acpi_os_printf ("%20s : %X\n", "Resource_order", obj_desc->power_resource.resource_order);
+               acpi_os_printf ("%20s : %p\n", "Sys_handler", obj_desc->power_resource.sys_handler);
+               acpi_os_printf ("%20s : %p\n", "Drv_handler", obj_desc->power_resource.drv_handler);
+               break;
+
+
+       case ACPI_TYPE_PROCESSOR:
+
+               acpi_os_printf ("%20s : %s\n", "Type", "Processor");
+               acpi_os_printf ("%20s : %X\n", "Processor ID", obj_desc->processor.proc_id);
+               acpi_os_printf ("%20s : %X\n", "Length", obj_desc->processor.length);
+               acpi_os_printf ("%20s : %X\n", "Address", obj_desc->processor.address);
+               acpi_os_printf ("%20s : %p\n", "Sys_handler", obj_desc->processor.sys_handler);
+               acpi_os_printf ("%20s : %p\n", "Drv_handler", obj_desc->processor.drv_handler);
+               acpi_os_printf ("%20s : %p\n", "Addr_handler", obj_desc->processor.addr_handler);
+               break;
+
+
+       case ACPI_TYPE_THERMAL:
+
+               acpi_os_printf ("%20s : %s\n", "Type", "Thermal_zone");
+               acpi_os_printf ("%20s : %p\n", "Sys_handler", obj_desc->thermal_zone.sys_handler);
+               acpi_os_printf ("%20s : %p\n", "Drv_handler", obj_desc->thermal_zone.drv_handler);
+               acpi_os_printf ("%20s : %p\n", "Addr_handler", obj_desc->thermal_zone.addr_handler);
+               break;
+
+
+       case INTERNAL_TYPE_REGION_FIELD:
+
+               acpi_os_printf ("%20s : %p\n", "Access_bit_width", obj_desc->field.access_bit_width);
+               acpi_os_printf ("%20s : %p\n", "Bit_length", obj_desc->field.bit_length);
+               acpi_os_printf ("%20s : %p\n", "Base_byte_offset",obj_desc->field.base_byte_offset);
+               acpi_os_printf ("%20s : %p\n", "Bit_offset", obj_desc->field.start_field_bit_offset);
+               acpi_os_printf ("%20s : %p\n", "Region_obj", obj_desc->field.region_obj);
+               break;
+
+
+       case INTERNAL_TYPE_BANK_FIELD:
+
+               acpi_os_printf ("%20s : %s\n", "Type", "Bank_field");
+               acpi_os_printf ("%20s : %X\n", "Access_bit_width", obj_desc->bank_field.access_bit_width);
+               acpi_os_printf ("%20s : %X\n", "Lock_rule", obj_desc->bank_field.lock_rule);
+               acpi_os_printf ("%20s : %X\n", "Update_rule", obj_desc->bank_field.update_rule);
+               acpi_os_printf ("%20s : %X\n", "Bit_length", obj_desc->bank_field.bit_length);
+               acpi_os_printf ("%20s : %X\n", "Bit_offset", obj_desc->bank_field.start_field_bit_offset);
+               acpi_os_printf ("%20s : %X\n", "Base_byte_offset", obj_desc->bank_field.base_byte_offset);
+               acpi_os_printf ("%20s : %X\n", "Value", obj_desc->bank_field.value);
+               acpi_os_printf ("%20s : %p\n", "Region_obj", obj_desc->bank_field.region_obj);
+               acpi_os_printf ("%20s : %X\n", "Bank_register_obj", obj_desc->bank_field.bank_register_obj);
+               break;
+
+
+       case INTERNAL_TYPE_INDEX_FIELD:
+
+               acpi_os_printf ("%20s : %s\n", "Type", "Index_field");
+               acpi_os_printf ("%20s : %X\n", "Access_bit_width", obj_desc->index_field.access_bit_width);
+               acpi_os_printf ("%20s : %X\n", "Lock_rule", obj_desc->index_field.lock_rule);
+               acpi_os_printf ("%20s : %X\n", "Update_rule", obj_desc->index_field.update_rule);
+               acpi_os_printf ("%20s : %X\n", "Bit_length", obj_desc->index_field.bit_length);
+               acpi_os_printf ("%20s : %X\n", "Bit_offset", obj_desc->index_field.start_field_bit_offset);
+               acpi_os_printf ("%20s : %X\n", "Value", obj_desc->index_field.value);
+               acpi_os_printf ("%20s : %X\n", "Index", obj_desc->index_field.index_obj);
+               acpi_os_printf ("%20s : %X\n", "Data", obj_desc->index_field.data_obj);
+               break;
+
+
+       case INTERNAL_TYPE_REFERENCE:
+
+               op_info = acpi_ps_get_opcode_info (obj_desc->reference.opcode);
+
+               acpi_os_printf ("%20s : %s\n", "Type", "Reference");
+               acpi_os_printf ("%20s : %X\n", "Target_type", obj_desc->reference.target_type);
+               acpi_os_printf ("%20s : %s\n", "Opcode", op_info->name);
+               acpi_os_printf ("%20s : %X\n", "Offset", obj_desc->reference.offset);
+               acpi_os_printf ("%20s : %p\n", "Obj_desc", obj_desc->reference.object);
+               acpi_os_printf ("%20s : %p\n", "Node", obj_desc->reference.node);
+               acpi_os_printf ("%20s : %p\n", "Where", obj_desc->reference.where);
+               break;
+
+
+       case INTERNAL_TYPE_ADDRESS_HANDLER:
+
+               acpi_os_printf ("%20s : %s\n", "Type", "Address Handler");
+               acpi_os_printf ("%20s : %X\n", "Space_id", obj_desc->addr_handler.space_id);
+               acpi_os_printf ("%20s : %p\n", "Next", obj_desc->addr_handler.next);
+               acpi_os_printf ("%20s : %p\n", "Region_list", obj_desc->addr_handler.region_list);
+               acpi_os_printf ("%20s : %p\n", "Node", obj_desc->addr_handler.node);
+               acpi_os_printf ("%20s : %p\n", "Handler", obj_desc->addr_handler.handler);
+               acpi_os_printf ("%20s : %p\n", "Context", obj_desc->addr_handler.context);
+               break;
+
+
+       case INTERNAL_TYPE_NOTIFY:
+
+               acpi_os_printf ("%20s : %s\n", "Type", "Notify Handler");
+               acpi_os_printf ("%20s : %p\n", "Node", obj_desc->notify_handler.node);
+               acpi_os_printf ("%20s : %p\n", "Handler", obj_desc->notify_handler.handler);
+               acpi_os_printf ("%20s : %p\n", "Context", obj_desc->notify_handler.context);
+               break;
+
+
+       case INTERNAL_TYPE_ALIAS:
+       case INTERNAL_TYPE_FIELD_DEFN:
+       case INTERNAL_TYPE_BANK_FIELD_DEFN:
+       case INTERNAL_TYPE_INDEX_FIELD_DEFN:
+       case INTERNAL_TYPE_IF:
+       case INTERNAL_TYPE_ELSE:
+       case INTERNAL_TYPE_WHILE:
+       case INTERNAL_TYPE_SCOPE:
+       case INTERNAL_TYPE_DEF_ANY:
+
+               acpi_os_printf ("*** Structure display not implemented for type %X! ***\n",
+                       obj_desc->common.type);
+               break;
+
+
+       default:
+
+               acpi_os_printf ("*** Cannot display unknown type %X! ***\n", obj_desc->common.type);
+               break;
+       }
+
+       return_VOID;
+}
+
+#endif
 
index 8bce8ea48e48ccd3bb00783ceb1e8be03be2d70d..17184e2c10fc9dbccdb2fa646aa3c35099a669ce 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
- * Module Name: exdyadic - ACPI AML (p-code) execution for dyadic operators
- *              $Revision: 77 $
+ * Module Name: exdyadic - ACPI AML execution for dyadic (2-operand) operators
+ *              $Revision: 88 $
  *
  *****************************************************************************/
 
@@ -41,8 +41,9 @@
  *
  * FUNCTION:    Acpi_ex_do_concatenate
  *
- * PARAMETERS:  *Obj_desc       - Object to be converted.  Must be an
- *                                Integer, Buffer, or String
+ * PARAMETERS:  *Obj_desc           - Object to be converted.  Must be an
+ *                                    Integer, Buffer, or String
+ *              Walk_state          - Current walk state
  *
  * RETURN:      Status
  *
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_do_concatenate (
-       ACPI_OPERAND_OBJECT     *obj_desc,
-       ACPI_OPERAND_OBJECT     *obj_desc2,
-       ACPI_OPERAND_OBJECT     **actual_ret_desc,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_operand_object     *obj_desc,
+       acpi_operand_object     *obj_desc2,
+       acpi_operand_object     **actual_ret_desc,
+       acpi_walk_state         *walk_state)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
        u32                     i;
-       ACPI_INTEGER            this_integer;
-       ACPI_OPERAND_OBJECT     *ret_desc;
+       acpi_integer            this_integer;
+       acpi_operand_object     *ret_desc;
        NATIVE_CHAR             *new_buf;
-       u32                     integer_size = sizeof (ACPI_INTEGER);
+       u32                     integer_size = sizeof (acpi_integer);
+
+
+       FUNCTION_ENTRY ();
 
 
        /*
@@ -95,7 +99,7 @@ acpi_ex_do_concatenate (
                /* Need enough space for two integers */
 
                ret_desc->buffer.length = integer_size * 2;
-               new_buf = acpi_ut_callocate (ret_desc->buffer.length);
+               new_buf = ACPI_MEM_CALLOCATE (ret_desc->buffer.length);
                if (!new_buf) {
                        REPORT_ERROR
                                (("Ex_do_concatenate: Buffer allocation failure\n"));
@@ -133,7 +137,7 @@ acpi_ex_do_concatenate (
 
                /* Operand1 is string  */
 
-               new_buf = acpi_ut_allocate (obj_desc->string.length +
+               new_buf = ACPI_MEM_ALLOCATE (obj_desc->string.length +
                                  obj_desc2->string.length + 1);
                if (!new_buf) {
                        REPORT_ERROR
@@ -163,7 +167,7 @@ acpi_ex_do_concatenate (
                        return (AE_NO_MEMORY);
                }
 
-               new_buf = acpi_ut_allocate (obj_desc->buffer.length +
+               new_buf = ACPI_MEM_ALLOCATE (obj_desc->buffer.length +
                                  obj_desc2->buffer.length);
                if (!new_buf) {
                        REPORT_ERROR
@@ -208,6 +212,7 @@ cleanup:
  * FUNCTION:    Acpi_ex_dyadic1
  *
  * PARAMETERS:  Opcode              - The opcode to be executed
+ *              Walk_state          - Current walk state
  *
  * RETURN:      Status
  *
@@ -218,47 +223,35 @@ cleanup:
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_dyadic1 (
        u16                     opcode,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_walk_state         *walk_state)
 {
-       ACPI_OPERAND_OBJECT     *obj_desc = NULL;
-       ACPI_OPERAND_OBJECT     *val_desc = NULL;
-       ACPI_NAMESPACE_NODE     *node;
-       ACPI_STATUS             status = AE_OK;
-
-
-       /* Resolve all operands */
-
-       status = acpi_ex_resolve_operands (opcode, WALK_OPERANDS, walk_state);
-       /* Get the operands */
+       acpi_operand_object     **operand = &walk_state->operands[0];
+       acpi_namespace_node     *node;
+       acpi_status             status = AE_OK;
 
-       status |= acpi_ds_obj_stack_pop_object (&val_desc, walk_state);
-       status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state);
-       if (ACPI_FAILURE (status)) {
-               /* Invalid parameters on object stack  */
 
-               goto cleanup;
-       }
+       FUNCTION_TRACE_PTR ("Ex_dyadic1", WALK_OPERANDS);
 
 
        /* Examine the opcode */
 
        switch (opcode) {
 
-       /* Def_notify  :=  Notify_op   Notify_object   Notify_value */
+       /* Def_notify  :=  Notify_op   (0)Notify_object   (1)Notify_value */
 
        case AML_NOTIFY_OP:
 
                /* The Obj_desc is actually an Node */
 
-               node = (ACPI_NAMESPACE_NODE *) obj_desc;
-               obj_desc = NULL;
+               node = (acpi_namespace_node *) operand[0];
+               operand[0] = NULL;
 
                /* Object must be a device or thermal zone */
 
-               if (node && val_desc) {
+               if (node && operand[1]) {
                        switch (node->type) {
                        case ACPI_TYPE_DEVICE:
                        case ACPI_TYPE_THERMAL:
@@ -270,12 +263,14 @@ acpi_ex_dyadic1 (
                                 * from this thread -- because handlers may in turn run other
                                 * control methods.
                                 */
-
                                status = acpi_ev_queue_notify_request (node,
-                                                (u32) val_desc->integer.value);
+                                                (u32) operand[1]->integer.value);
                                break;
 
                        default:
+                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unexpected notify object type %X\n",
+                                       operand[0]->common.type));
+
                                status = AE_AML_OPERAND_TYPE;
                                break;
                        }
@@ -289,15 +284,13 @@ acpi_ex_dyadic1 (
        }
 
 
-cleanup:
-
        /* Always delete both operands */
 
-       acpi_ut_remove_reference (val_desc);
-       acpi_ut_remove_reference (obj_desc);
+       acpi_ut_remove_reference (operand[1]);
+       acpi_ut_remove_reference (operand[0]);
 
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -306,6 +299,8 @@ cleanup:
  * FUNCTION:    Acpi_ex_dyadic2_r
  *
  * PARAMETERS:  Opcode              - The opcode to be executed
+ *              Walk_state          - Current walk state
+ *              Return_desc         - Where to store the return object
  *
  * RETURN:      Status
  *
@@ -316,38 +311,19 @@ cleanup:
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_dyadic2_r (
        u16                     opcode,
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_OPERAND_OBJECT     **return_desc)
+       acpi_walk_state         *walk_state,
+       acpi_operand_object     **return_desc)
 {
-       ACPI_OPERAND_OBJECT     *obj_desc   = NULL;
-       ACPI_OPERAND_OBJECT     *obj_desc2  = NULL;
-       ACPI_OPERAND_OBJECT     *res_desc   = NULL;
-       ACPI_OPERAND_OBJECT     *res_desc2  = NULL;
-       ACPI_OPERAND_OBJECT     *ret_desc   = NULL;
-       ACPI_OPERAND_OBJECT     *ret_desc2  = NULL;
-       ACPI_STATUS             status      = AE_OK;
-       u32                     num_operands = 3;
-
-
-       /* Resolve all operands */
+       acpi_operand_object     **operand = &walk_state->operands[0];
+       acpi_operand_object     *ret_desc   = NULL;
+       acpi_operand_object     *ret_desc2  = NULL;
+       acpi_status             status      = AE_OK;
 
-       status = acpi_ex_resolve_operands (opcode, WALK_OPERANDS, walk_state);
-       /* Get all operands */
 
-       if (AML_DIVIDE_OP == opcode) {
-               num_operands = 4;
-               status |= acpi_ds_obj_stack_pop_object (&res_desc2, walk_state);
-       }
-
-       status |= acpi_ds_obj_stack_pop_object (&res_desc, walk_state);
-       status |= acpi_ds_obj_stack_pop_object (&obj_desc2, walk_state);
-       status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state);
-       if (ACPI_FAILURE (status)) {
-               goto cleanup;
-       }
+       FUNCTION_TRACE_U32 ("Ex_dyadic2_r", opcode);
 
 
        /* Create an internal return object if necessary */
@@ -360,6 +336,7 @@ acpi_ex_dyadic2_r (
        case AML_BIT_NOR_OP:
        case AML_BIT_XOR_OP:
        case AML_DIVIDE_OP:
+       case AML_MOD_OP:
        case AML_MULTIPLY_OP:
        case AML_SHIFT_LEFT_OP:
        case AML_SHIFT_RIGHT_OP:
@@ -378,15 +355,14 @@ acpi_ex_dyadic2_r (
        /*
         * Execute the opcode
         */
-
        switch (opcode) {
 
        /* Def_add :=  Add_op  Operand1    Operand2    Result  */
 
        case AML_ADD_OP:
 
-               ret_desc->integer.value = obj_desc->integer.value +
-                                obj_desc2->integer.value;
+               ret_desc->integer.value = operand[0]->integer.value +
+                                 operand[1]->integer.value;
                break;
 
 
@@ -394,8 +370,8 @@ acpi_ex_dyadic2_r (
 
        case AML_BIT_AND_OP:
 
-               ret_desc->integer.value = obj_desc->integer.value &
-                                obj_desc2->integer.value;
+               ret_desc->integer.value = operand[0]->integer.value &
+                                 operand[1]->integer.value;
                break;
 
 
@@ -403,8 +379,8 @@ acpi_ex_dyadic2_r (
 
        case AML_BIT_NAND_OP:
 
-               ret_desc->integer.value = ~(obj_desc->integer.value &
-                                  obj_desc2->integer.value);
+               ret_desc->integer.value = ~(operand[0]->integer.value &
+                                operand[1]->integer.value);
                break;
 
 
@@ -412,8 +388,8 @@ acpi_ex_dyadic2_r (
 
        case AML_BIT_OR_OP:
 
-               ret_desc->integer.value = obj_desc->integer.value |
-                                obj_desc2->integer.value;
+               ret_desc->integer.value = operand[0]->integer.value |
+                                 operand[1]->integer.value;
                break;
 
 
@@ -421,8 +397,8 @@ acpi_ex_dyadic2_r (
 
        case AML_BIT_NOR_OP:
 
-               ret_desc->integer.value = ~(obj_desc->integer.value |
-                                  obj_desc2->integer.value);
+               ret_desc->integer.value = ~(operand[0]->integer.value |
+                                operand[1]->integer.value);
                break;
 
 
@@ -430,8 +406,8 @@ acpi_ex_dyadic2_r (
 
        case AML_BIT_XOR_OP:
 
-               ret_desc->integer.value = obj_desc->integer.value ^
-                                obj_desc2->integer.value;
+               ret_desc->integer.value = operand[0]->integer.value ^
+                                 operand[1]->integer.value;
                break;
 
 
@@ -439,9 +415,9 @@ acpi_ex_dyadic2_r (
 
        case AML_DIVIDE_OP:
 
-               if (!obj_desc2->integer.value) {
+               if (!operand[1]->integer.value) {
                        REPORT_ERROR
-                               (("Ex_dyadic2_r/Divide_op: Divide by zero\n"));
+                               (("Divide_op: Divide by zero\n"));
 
                        status = AE_AML_DIVIDE_BY_ZERO;
                        goto cleanup;
@@ -455,13 +431,32 @@ acpi_ex_dyadic2_r (
 
                /* Remainder (modulo) */
 
-               ret_desc->integer.value  = ACPI_MODULO (obj_desc->integer.value,
-                                 obj_desc2->integer.value);
+               ret_desc->integer.value  = ACPI_MODULO (operand[0]->integer.value,
+                                 operand[1]->integer.value);
 
                /* Result (what we used to call the quotient) */
 
-               ret_desc2->integer.value = ACPI_DIVIDE (obj_desc->integer.value,
-                                 obj_desc2->integer.value);
+               ret_desc2->integer.value = ACPI_DIVIDE (operand[0]->integer.value,
+                                 operand[1]->integer.value);
+               break;
+
+
+       /* Def_mod  :=  Mod_op Dividend Divisor Remainder */
+
+       case AML_MOD_OP:    /* ACPI 2.0 */
+
+               if (!operand[1]->integer.value) {
+                       REPORT_ERROR
+                               (("Mod_op: Divide by zero\n"));
+
+                       status = AE_AML_DIVIDE_BY_ZERO;
+                       goto cleanup;
+               }
+
+               /* Remainder (modulo) */
+
+               ret_desc->integer.value  = ACPI_MODULO (operand[0]->integer.value,
+                                 operand[1]->integer.value);
                break;
 
 
@@ -469,8 +464,8 @@ acpi_ex_dyadic2_r (
 
        case AML_MULTIPLY_OP:
 
-               ret_desc->integer.value = obj_desc->integer.value *
-                                obj_desc2->integer.value;
+               ret_desc->integer.value = operand[0]->integer.value *
+                                 operand[1]->integer.value;
                break;
 
 
@@ -478,8 +473,8 @@ acpi_ex_dyadic2_r (
 
        case AML_SHIFT_LEFT_OP:
 
-               ret_desc->integer.value = obj_desc->integer.value <<
-                                obj_desc2->integer.value;
+               ret_desc->integer.value = operand[0]->integer.value <<
+                                 operand[1]->integer.value;
                break;
 
 
@@ -487,8 +482,8 @@ acpi_ex_dyadic2_r (
 
        case AML_SHIFT_RIGHT_OP:
 
-               ret_desc->integer.value = obj_desc->integer.value >>
-                                obj_desc2->integer.value;
+               ret_desc->integer.value = operand[0]->integer.value >>
+                                 operand[1]->integer.value;
                break;
 
 
@@ -496,8 +491,8 @@ acpi_ex_dyadic2_r (
 
        case AML_SUBTRACT_OP:
 
-               ret_desc->integer.value = obj_desc->integer.value -
-                                obj_desc2->integer.value;
+               ret_desc->integer.value = operand[0]->integer.value -
+                                 operand[1]->integer.value;
                break;
 
 
@@ -505,7 +500,6 @@ acpi_ex_dyadic2_r (
 
        case AML_CONCAT_OP:
 
-
                /*
                 * Convert the second operand if necessary.  The first operand
                 * determines the type of the second operand, (See the Data Types
@@ -513,18 +507,17 @@ acpi_ex_dyadic2_r (
                 * guaranteed to be either Integer/String/Buffer by the operand
                 * resolution mechanism above.
                 */
-
-               switch (obj_desc->common.type) {
+               switch (operand[0]->common.type) {
                case ACPI_TYPE_INTEGER:
-                       status = acpi_ex_convert_to_integer (&obj_desc2, walk_state);
+                       status = acpi_ex_convert_to_integer (operand[1], &operand[1], walk_state);
                        break;
 
                case ACPI_TYPE_STRING:
-                       status = acpi_ex_convert_to_string (&obj_desc2, walk_state);
+                       status = acpi_ex_convert_to_string (operand[1], &operand[1], 16, ACPI_UINT32_MAX, walk_state);
                        break;
 
                case ACPI_TYPE_BUFFER:
-                       status = acpi_ex_convert_to_buffer (&obj_desc2, walk_state);
+                       status = acpi_ex_convert_to_buffer (operand[1], &operand[1], walk_state);
                        break;
 
                default:
@@ -541,13 +534,31 @@ acpi_ex_dyadic2_r (
                 * (Both are Integer, String, or Buffer), and we can now perform the
                 * concatenation.
                 */
-               status = acpi_ex_do_concatenate (obj_desc, obj_desc2, &ret_desc, walk_state);
+               status = acpi_ex_do_concatenate (operand[0], operand[1], &ret_desc, walk_state);
                if (ACPI_FAILURE (status)) {
                        goto cleanup;
                }
                break;
 
 
+       /* Def_to_string := Buffer, Length, Result */
+
+       case AML_TO_STRING_OP:  /* ACPI 2.0 */
+
+               status = acpi_ex_convert_to_string (operand[0], &ret_desc, 16,
+                                 (u32) operand[1]->integer.value, walk_state);
+               break;
+
+
+       /* Def_concat_res := Buffer, Buffer, Result */
+
+       case AML_CONCAT_RES_OP:  /* ACPI 2.0 */
+
+               status = AE_NOT_IMPLEMENTED;
+               goto cleanup;
+               break;
+
+
        default:
 
                REPORT_ERROR (("Acpi_ex_dyadic2_r: Unknown dyadic opcode %X\n",
@@ -558,25 +569,28 @@ acpi_ex_dyadic2_r (
 
 
        /*
-        * Store the result of the operation (which is now in Obj_desc) into
+        * Store the result of the operation (which is now in Operand[0]) into
         * the result descriptor, or the location pointed to by the result
-        * descriptor (Res_desc).
+        * descriptor (Operand[2]).
         */
-
-       status = acpi_ex_store (ret_desc, res_desc, walk_state);
+       status = acpi_ex_store (ret_desc, operand[2], walk_state);
        if (ACPI_FAILURE (status)) {
                goto cleanup;
        }
 
        if (AML_DIVIDE_OP == opcode) {
-               status = acpi_ex_store (ret_desc2, res_desc2, walk_state);
+               status = acpi_ex_store (ret_desc2, operand[3], walk_state);
 
                /*
                 * Since the remainder is not returned, remove a reference to
                 * the object we created earlier
                 */
+               acpi_ut_remove_reference (ret_desc);
+               *return_desc = ret_desc2;
+       }
 
-               acpi_ut_remove_reference (ret_desc2);
+       else {
+               *return_desc = ret_desc;
        }
 
 
@@ -584,8 +598,8 @@ cleanup:
 
        /* Always delete the operands */
 
-       acpi_ut_remove_reference (obj_desc);
-       acpi_ut_remove_reference (obj_desc2);
+       acpi_ut_remove_reference (operand[0]);
+       acpi_ut_remove_reference (operand[1]);
 
 
        /* Delete return object on error */
@@ -593,8 +607,8 @@ cleanup:
        if (ACPI_FAILURE (status)) {
                /* On failure, delete the result ops */
 
-               acpi_ut_remove_reference (res_desc);
-               acpi_ut_remove_reference (res_desc2);
+               acpi_ut_remove_reference (operand[2]);
+               acpi_ut_remove_reference (operand[3]);
 
                if (ret_desc) {
                        /* And delete the internal return object */
@@ -606,8 +620,7 @@ cleanup:
 
        /* Set the return object and exit */
 
-       *return_desc = ret_desc;
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -616,6 +629,8 @@ cleanup:
  * FUNCTION:    Acpi_ex_dyadic2_s
  *
  * PARAMETERS:  Opcode              - The opcode to be executed
+ *              Walk_state          - Current walk state
+ *              Return_desc         - Where to store the return object
  *
  * RETURN:      Status
  *
@@ -625,30 +640,18 @@ cleanup:
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_dyadic2_s (
        u16                     opcode,
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_OPERAND_OBJECT     **return_desc)
+       acpi_walk_state         *walk_state,
+       acpi_operand_object     **return_desc)
 {
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_OPERAND_OBJECT     *time_desc;
-       ACPI_OPERAND_OBJECT     *ret_desc = NULL;
-       ACPI_STATUS             status;
-
-
-       /* Resolve all operands */
-
-       status = acpi_ex_resolve_operands (opcode, WALK_OPERANDS, walk_state);
-       /* Get all operands */
+       acpi_operand_object     **operand = &walk_state->operands[0];
+       acpi_operand_object     *ret_desc = NULL;
+       acpi_status             status;
 
-       status |= acpi_ds_obj_stack_pop_object (&time_desc, walk_state);
-       status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state);
-       if (ACPI_FAILURE (status)) {
-               /* Invalid parameters on object stack  */
 
-               goto cleanup;
-       }
+       FUNCTION_TRACE_PTR ("Ex_dyadic2_s", WALK_OPERANDS);
 
 
        /* Create the internal return object */
@@ -672,7 +675,7 @@ acpi_ex_dyadic2_s (
 
        case AML_ACQUIRE_OP:
 
-               status = acpi_ex_acquire_mutex (time_desc, obj_desc, walk_state);
+               status = acpi_ex_acquire_mutex (operand[1], operand[0], walk_state);
                break;
 
 
@@ -680,7 +683,7 @@ acpi_ex_dyadic2_s (
 
        case AML_WAIT_OP:
 
-               status = acpi_ex_system_wait_event (time_desc, obj_desc);
+               status = acpi_ex_system_wait_event (operand[1], operand[0]);
                break;
 
 
@@ -696,7 +699,6 @@ acpi_ex_dyadic2_s (
         * Return a boolean indicating if operation timed out
         * (TRUE) or not (FALSE)
         */
-
        if (status == AE_TIME) {
                ret_desc->integer.value = ACPI_INTEGER_MAX;  /* TRUE, op timed out */
                status = AE_OK;
@@ -707,8 +709,8 @@ cleanup:
 
        /* Delete params */
 
-       acpi_ut_remove_reference (time_desc);
-       acpi_ut_remove_reference (obj_desc);
+       acpi_ut_remove_reference (operand[1]);
+       acpi_ut_remove_reference (operand[0]);
 
        /* Delete return object on error */
 
@@ -722,7 +724,7 @@ cleanup:
        /* Set the return object and exit */
 
        *return_desc = ret_desc;
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -731,6 +733,8 @@ cleanup:
  * FUNCTION:    Acpi_ex_dyadic2
  *
  * PARAMETERS:  Opcode              - The opcode to be executed
+ *              Walk_state          - Current walk state
+ *              Return_desc         - Where to store the return object
  *
  * RETURN:      Status
  *
@@ -742,31 +746,19 @@ cleanup:
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_dyadic2 (
        u16                     opcode,
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_OPERAND_OBJECT     **return_desc)
+       acpi_walk_state         *walk_state,
+       acpi_operand_object     **return_desc)
 {
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_OPERAND_OBJECT     *obj_desc2;
-       ACPI_OPERAND_OBJECT     *ret_desc = NULL;
-       ACPI_STATUS             status;
+       acpi_operand_object     **operand = &walk_state->operands[0];
+       acpi_operand_object     *ret_desc = NULL;
+       acpi_status             status = AE_OK;
        u8                      lboolean;
 
 
-       /* Resolve all operands */
-
-       status = acpi_ex_resolve_operands (opcode, WALK_OPERANDS, walk_state);
-       /* Get all operands */
-
-       status |= acpi_ds_obj_stack_pop_object (&obj_desc2, walk_state);
-       status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state);
-       if (ACPI_FAILURE (status)) {
-               /* Invalid parameters on object stack  */
-
-               goto cleanup;
-       }
+       FUNCTION_TRACE_PTR ("Ex_dyadic2", WALK_OPERANDS);
 
 
        /* Create the internal return object */
@@ -780,7 +772,6 @@ acpi_ex_dyadic2 (
        /*
         * Execute the Opcode
         */
-
        lboolean = FALSE;
        switch (opcode) {
 
@@ -788,8 +779,8 @@ acpi_ex_dyadic2 (
 
        case AML_LAND_OP:
 
-               lboolean = (u8) (obj_desc->integer.value &&
-                                 obj_desc2->integer.value);
+               lboolean = (u8) (operand[0]->integer.value &&
+                                 operand[1]->integer.value);
                break;
 
 
@@ -797,8 +788,8 @@ acpi_ex_dyadic2 (
 
        case AML_LEQUAL_OP:
 
-               lboolean = (u8) (obj_desc->integer.value ==
-                                 obj_desc2->integer.value);
+               lboolean = (u8) (operand[0]->integer.value ==
+                                 operand[1]->integer.value);
                break;
 
 
@@ -806,8 +797,8 @@ acpi_ex_dyadic2 (
 
        case AML_LGREATER_OP:
 
-               lboolean = (u8) (obj_desc->integer.value >
-                                 obj_desc2->integer.value);
+               lboolean = (u8) (operand[0]->integer.value >
+                                 operand[1]->integer.value);
                break;
 
 
@@ -815,8 +806,8 @@ acpi_ex_dyadic2 (
 
        case AML_LLESS_OP:
 
-               lboolean = (u8) (obj_desc->integer.value <
-                                 obj_desc2->integer.value);
+               lboolean = (u8) (operand[0]->integer.value <
+                                 operand[1]->integer.value);
                break;
 
 
@@ -824,8 +815,17 @@ acpi_ex_dyadic2 (
 
        case AML_LOR_OP:
 
-               lboolean = (u8) (obj_desc->integer.value ||
-                                 obj_desc2->integer.value);
+               lboolean = (u8) (operand[0]->integer.value ||
+                                 operand[1]->integer.value);
+               break;
+
+
+       /* Def_copy := Source, Destination */
+
+       case AML_COPY_OP:   /* ACPI 2.0 */
+
+               status = AE_NOT_IMPLEMENTED;
+               goto cleanup;
                break;
 
 
@@ -852,8 +852,8 @@ cleanup:
 
        /* Always delete operands */
 
-       acpi_ut_remove_reference (obj_desc);
-       acpi_ut_remove_reference (obj_desc2);
+       acpi_ut_remove_reference (operand[0]);
+       acpi_ut_remove_reference (operand[1]);
 
 
        /* Delete return object on error */
@@ -868,7 +868,7 @@ cleanup:
        /* Set the return object and exit */
 
        *return_desc = ret_desc;
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
index 252772367f63f4b45934bf615685c46de9bd005b..8a65f02ead2aa1dbf0c33c1b8cb67e2b1f99882b 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: exfield - ACPI AML (p-code) execution - field manipulation
- *              $Revision: 90 $
+ *              $Revision: 95 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_read_data_from_field (
-       ACPI_OPERAND_OBJECT     *obj_desc,
-       ACPI_OPERAND_OBJECT     **ret_buffer_desc)
+       acpi_operand_object     *obj_desc,
+       acpi_operand_object     **ret_buffer_desc)
 {
-       ACPI_STATUS             status;
-       ACPI_OPERAND_OBJECT     *buffer_desc;
+       acpi_status             status;
+       acpi_operand_object     *buffer_desc;
        u32                     length;
        void                    *buffer;
 
 
+       FUNCTION_TRACE_PTR ("Ex_read_data_from_field", obj_desc);
+
+
        /* Parameter validation */
 
        if (!obj_desc) {
-               return (AE_AML_NO_OPERAND);
+               return_ACPI_STATUS (AE_AML_NO_OPERAND);
        }
 
        /*
         * Allocate a buffer for the contents of the field.
         *
-        * If the field is larger than the size of an ACPI_INTEGER, create
+        * If the field is larger than the size of an acpi_integer, create
         * a BUFFER to hold it.  Otherwise, use an INTEGER.  This allows
         * the use of arithmetic operators on the returned value if the
         * field size is equal or smaller than an Integer.
         *
         * Note: Field.length is in bits.
         */
-
        length = ROUND_BITS_UP_TO_BYTES (obj_desc->field.bit_length);
 
-       if (length > sizeof (ACPI_INTEGER)) {
+       if (length > sizeof (acpi_integer)) {
                /* Field is too large for an Integer, create a Buffer instead */
 
                buffer_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
                if (!buffer_desc) {
-                       return (AE_NO_MEMORY);
+                       return_ACPI_STATUS (AE_NO_MEMORY);
                }
 
                /* Create the actual read buffer */
 
-               buffer_desc->buffer.pointer = acpi_ut_callocate (length);
+               buffer_desc->buffer.pointer = ACPI_MEM_CALLOCATE (length);
                if (!buffer_desc->buffer.pointer) {
                        acpi_ut_remove_reference (buffer_desc);
-                       return (AE_NO_MEMORY);
+                       return_ACPI_STATUS (AE_NO_MEMORY);
                }
 
                buffer_desc->buffer.length = length;
@@ -107,7 +109,7 @@ acpi_ex_read_data_from_field (
 
                buffer_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
                if (!buffer_desc) {
-                       return (AE_NO_MEMORY);
+                       return_ACPI_STATUS (AE_NO_MEMORY);
                }
 
                length = sizeof (buffer_desc->integer.value);
@@ -147,7 +149,7 @@ acpi_ex_read_data_from_field (
                *ret_buffer_desc = buffer_desc;
        }
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -167,20 +169,23 @@ acpi_ex_read_data_from_field (
  ******************************************************************************/
 
 
-ACPI_STATUS
+acpi_status
 acpi_ex_write_data_to_field (
-       ACPI_OPERAND_OBJECT     *source_desc,
-       ACPI_OPERAND_OBJECT     *obj_desc)
+       acpi_operand_object     *source_desc,
+       acpi_operand_object     *obj_desc)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
        u32                     length;
        void                    *buffer;
 
 
+       FUNCTION_TRACE_PTR ("Ex_write_data_to_field", obj_desc);
+
+
        /* Parameter validation */
 
        if (!source_desc || !obj_desc) {
-               return (AE_AML_NO_OPERAND);
+               return_ACPI_STATUS (AE_AML_NO_OPERAND);
        }
 
 
@@ -204,7 +209,7 @@ acpi_ex_write_data_to_field (
                break;
 
        default:
-               return (AE_AML_OPERAND_TYPE);
+               return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
        }
 
 
@@ -229,11 +234,11 @@ acpi_ex_write_data_to_field (
                break;
 
        default:
-               return (AE_AML_INTERNAL);
+               return_ACPI_STATUS (AE_AML_INTERNAL);
        }
 
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -252,14 +257,17 @@ acpi_ex_write_data_to_field (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_access_buffer_field (
        u32                     mode,
-       ACPI_OPERAND_OBJECT     *obj_desc,
+       acpi_operand_object     *obj_desc,
        void                    *buffer,
        u32                     buffer_length)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE_PTR ("Ex_access_buffer_field", obj_desc);
 
 
        /*
@@ -269,14 +277,14 @@ acpi_ex_access_buffer_field (
        if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) {
                status = acpi_ds_get_buffer_field_arguments (obj_desc);
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
        }
 
 
        status = acpi_ex_common_access_field (mode, obj_desc, buffer, buffer_length);
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -295,17 +303,20 @@ acpi_ex_access_buffer_field (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_access_region_field (
        u32                     mode,
-       ACPI_OPERAND_OBJECT     *obj_desc,
+       acpi_operand_object     *obj_desc,
        void                    *buffer,
        u32                     buffer_length)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
        u8                      locked;
 
 
+       FUNCTION_TRACE_PTR ("Ex_access_region_field", obj_desc);
+
+
        /*
         * Get the global lock if needed
         */
@@ -319,7 +330,7 @@ acpi_ex_access_region_field (
         */
        acpi_ex_release_global_lock (locked);
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -338,17 +349,20 @@ acpi_ex_access_region_field (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_access_bank_field (
        u32                     mode,
-       ACPI_OPERAND_OBJECT     *obj_desc,
+       acpi_operand_object     *obj_desc,
        void                    *buffer,
        u32                     buffer_length)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
        u8                      locked;
 
 
+       FUNCTION_TRACE_PTR ("Ex_access_bank_field", obj_desc);
+
+
        /*
         * Get the global lock if needed
         */
@@ -361,7 +375,6 @@ acpi_ex_access_bank_field (
         * Bank_field ASL declaration. The Bank_register is always a Field in
         * an operation region.
         */
-
        status = acpi_ex_common_access_field (ACPI_WRITE,
                         obj_desc->bank_field.bank_register_obj,
                         &obj_desc->bank_field.value,
@@ -383,7 +396,7 @@ cleanup:
         */
        acpi_ex_release_global_lock (locked);
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -402,17 +415,20 @@ cleanup:
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_access_index_field (
        u32                     mode,
-       ACPI_OPERAND_OBJECT     *obj_desc,
+       acpi_operand_object     *obj_desc,
        void                    *buffer,
        u32                     buffer_length)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
        u8                      locked;
 
 
+       FUNCTION_TRACE_PTR ("Ex_access_index_field", obj_desc);
+
+
        /*
         * Get the global lock if needed
         */
@@ -441,7 +457,7 @@ cleanup:
         */
        acpi_ex_release_global_lock (locked);
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -461,14 +477,25 @@ cleanup:
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_common_access_field (
        u32                     mode,
-       ACPI_OPERAND_OBJECT     *obj_desc,
+       acpi_operand_object     *obj_desc,
        void                    *buffer,
        u32                     buffer_length)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE_PTR ("Ex_common_access_field", obj_desc);
+
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Obj=%p Type=%X Buf=%p Len=%X\n",
+               obj_desc, obj_desc->common.type, buffer, buffer_length));
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode=%d Bit_len=%X Bit_off=%X Byte_off=%X\n",
+               mode, obj_desc->common_field.bit_length,
+               obj_desc->common_field.start_field_bit_offset,
+               obj_desc->common_field.base_byte_offset));
 
 
        /* Perform the actual read or write of the field */
@@ -488,11 +515,12 @@ acpi_ex_common_access_field (
 
        default:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown I/O Mode: %X\n", mode));
                status = AE_BAD_PARAMETER;
                break;
        }
 
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
index 129b252c3ad05d19ab0c4a544779666a96c996fc..39df9a6ba9fdc7a7cb2d62f10bfba0b4a010091c 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: exfldio - Aml Field I/O
- *              $Revision: 57 $
+ *              $Revision: 64 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_setup_field (
-       ACPI_OPERAND_OBJECT     *obj_desc,
+       acpi_operand_object     *obj_desc,
        u32                     field_datum_byte_offset)
 {
-       ACPI_STATUS             status = AE_OK;
-       ACPI_OPERAND_OBJECT     *rgn_desc;
+       acpi_status             status = AE_OK;
+       acpi_operand_object     *rgn_desc;
 
 
-       /* Parameter validation */
+       FUNCTION_TRACE_U32 ("Ex_setup_field", field_datum_byte_offset);
+
 
        rgn_desc = obj_desc->common_field.region_obj;
-       if (!obj_desc || !rgn_desc) {
-               return (AE_AML_NO_OPERAND);
-       }
 
        if (ACPI_TYPE_REGION != rgn_desc->common.type) {
-               return (AE_AML_OPERAND_TYPE);
+               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);
        }
 
 
@@ -80,7 +80,7 @@ acpi_ex_setup_field (
 
                status = acpi_ds_get_region_arguments (rgn_desc);
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
        }
 
@@ -99,16 +99,25 @@ acpi_ex_setup_field (
                         * than the region itself.  For example, a region of length one
                         * byte, and a field with Dword access specified.
                         */
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                               "Field access width (%d bytes) too large for region size (%X)\n",
+                               obj_desc->common_field.access_byte_width, rgn_desc->region.length));
                }
 
                /*
                 * Offset rounded up to next multiple of field width
                 * exceeds region length, indicate an error
                 */
-               return (AE_AML_REGION_LIMIT);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                       "Field base+offset+width %X+%X+%X exceeds region size (%X bytes) field=%p region=%p\n",
+                       obj_desc->common_field.base_byte_offset, field_datum_byte_offset,
+                       obj_desc->common_field.access_byte_width,
+                       rgn_desc->region.length, obj_desc, rgn_desc));
+
+               return_ACPI_STATUS (AE_AML_REGION_LIMIT);
        }
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -125,18 +134,21 @@ acpi_ex_setup_field (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_read_field_datum (
-       ACPI_OPERAND_OBJECT     *obj_desc,
+       acpi_operand_object     *obj_desc,
        u32                     field_datum_byte_offset,
        u32                     *value)
 {
-       ACPI_STATUS             status;
-       ACPI_OPERAND_OBJECT     *rgn_desc;
+       acpi_status             status;
+       acpi_operand_object     *rgn_desc;
        ACPI_PHYSICAL_ADDRESS   address;
        u32                     local_value;
 
 
+       FUNCTION_TRACE_U32 ("Ex_read_field_datum", field_datum_byte_offset);
+
+
        if (!value) {
                local_value = 0;
                value = &local_value;   /*  support reads without saving value  */
@@ -174,7 +186,7 @@ acpi_ex_read_field_datum (
                 */
                status = acpi_ex_setup_field (obj_desc, field_datum_byte_offset);
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
 
 
@@ -189,23 +201,43 @@ acpi_ex_read_field_datum (
                address = rgn_desc->region.address + obj_desc->common_field.base_byte_offset +
                                 field_datum_byte_offset;
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Region %s(%X) width %X base:off %X:%X at %8.8lX%8.8lX\n",
+                       acpi_ut_get_region_name (rgn_desc->region.space_id),
+                       rgn_desc->region.space_id, obj_desc->common_field.access_bit_width,
+                       obj_desc->common_field.base_byte_offset, field_datum_byte_offset,
+                       HIDWORD(address), LODWORD(address)));
+
 
                /* Invoke the appropriate Address_space/Op_region handler */
 
                status = acpi_ev_address_space_dispatch (rgn_desc, ACPI_READ_ADR_SPACE,
                                  address, obj_desc->common_field.access_bit_width, value);
+               if (status == AE_NOT_IMPLEMENTED) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Region %s(%X) not implemented\n",
+                               acpi_ut_get_region_name (rgn_desc->region.space_id),
+                               rgn_desc->region.space_id));
+               }
 
+               else if (status == AE_NOT_EXIST) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Region %s(%X) has no handler\n",
+                               acpi_ut_get_region_name (rgn_desc->region.space_id),
+                               rgn_desc->region.space_id));
+               }
                break;
 
 
        default:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p, wrong source type - %s\n",
+                       obj_desc, acpi_ut_get_type_name (obj_desc->common.type)));
                status = AE_AML_INTERNAL;
                break;
        }
 
 
-       return (status);
+       ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Returned value=%08lX \n", *value));
+
+       return_ACPI_STATUS (status);
 }
 
 
@@ -234,6 +266,9 @@ acpi_ex_get_buffer_datum(
        u32                     offset)
 {
 
+       FUNCTION_ENTRY ();
+
+
        switch (byte_granularity) {
        case ACPI_FIELD_BYTE_GRANULARITY:
                *datum = ((u8 *) buffer) [offset];
@@ -275,6 +310,9 @@ acpi_ex_set_buffer_datum (
        u32                     offset)
 {
 
+       FUNCTION_ENTRY ();
+
+
        switch (byte_granularity) {
        case ACPI_FIELD_BYTE_GRANULARITY:
                ((u8 *) buffer) [offset] = (u8) merged_datum;
@@ -304,13 +342,13 @@ acpi_ex_set_buffer_datum (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_extract_from_field (
-       ACPI_OPERAND_OBJECT     *obj_desc,
+       acpi_operand_object     *obj_desc,
        void                    *buffer,
        u32                     buffer_length)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
        u32                     field_datum_byte_offset;
        u32                     datum_offset;
        u32                     previous_raw_datum;
@@ -320,18 +358,29 @@ acpi_ex_extract_from_field (
        u32                     datum_count;
 
 
+       FUNCTION_TRACE ("Ex_extract_from_field");
+
+
        /*
         * The field must fit within the caller's buffer
         */
        byte_field_length = ROUND_BITS_UP_TO_BYTES (obj_desc->common_field.bit_length);
        if (byte_field_length > buffer_length) {
-               return (AE_BUFFER_OVERFLOW);
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Field size %X (bytes) too large for buffer (%X)\n",
+                       byte_field_length, buffer_length));
+
+               return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
        }
 
        /* Convert field byte count to datum count, round up if necessary */
 
        datum_count = ROUND_UP_TO (byte_field_length, obj_desc->common_field.access_byte_width);
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+               "Byte_len=%x, Datum_len=%x, Bit_gran=%x, Byte_gran=%x\n",
+               byte_field_length, datum_count, obj_desc->common_field.access_bit_width,
+               obj_desc->common_field.access_byte_width));
+
 
        /*
         * Clear the caller's buffer (the whole buffer length as given)
@@ -347,7 +396,7 @@ acpi_ex_extract_from_field (
 
        status = acpi_ex_read_field_datum (obj_desc, field_datum_byte_offset, &previous_raw_datum);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
 
@@ -370,7 +419,7 @@ acpi_ex_extract_from_field (
                acpi_ex_set_buffer_datum (merged_datum, buffer, obj_desc->common_field.access_byte_width,
                                datum_offset);
 
-               return (AE_OK);
+               return_ACPI_STATUS (AE_OK);
        }
 
 
@@ -396,7 +445,7 @@ acpi_ex_extract_from_field (
                         */
                        status = acpi_ex_read_field_datum (obj_desc, field_datum_byte_offset, &this_raw_datum);
                        if (ACPI_FAILURE (status)) {
-                               return (status);
+                               return_ACPI_STATUS (status);
                        }
                }
 
@@ -453,7 +502,7 @@ acpi_ex_extract_from_field (
        }
 
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -470,17 +519,20 @@ acpi_ex_extract_from_field (
  *
  ******************************************************************************/
 
-static ACPI_STATUS
+static acpi_status
 acpi_ex_write_field_datum (
-       ACPI_OPERAND_OBJECT     *obj_desc,
+       acpi_operand_object     *obj_desc,
        u32                     field_datum_byte_offset,
        u32                     value)
 {
-       ACPI_STATUS             status = AE_OK;
-       ACPI_OPERAND_OBJECT     *rgn_desc = NULL;
+       acpi_status             status = AE_OK;
+       acpi_operand_object     *rgn_desc = NULL;
        ACPI_PHYSICAL_ADDRESS   address;
 
 
+       FUNCTION_TRACE_U32 ("Ex_write_field_datum", field_datum_byte_offset);
+
+
        /*
         * Buffer_fields - Read from a Buffer
         * Other Fields - Read from a Operation Region.
@@ -508,7 +560,7 @@ acpi_ex_write_field_datum (
                 */
                status = acpi_ex_setup_field (obj_desc, field_datum_byte_offset);
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
 
                /*
@@ -523,24 +575,45 @@ acpi_ex_write_field_datum (
                                 obj_desc->common_field.base_byte_offset +
                                 field_datum_byte_offset;
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
+                       "Store %X in Region %s(%X) at %8.8lX%8.8lX width %X\n",
+                       value, acpi_ut_get_region_name (rgn_desc->region.space_id),
+                       rgn_desc->region.space_id, HIDWORD(address), LODWORD(address),
+                       obj_desc->common_field.access_bit_width));
+
                /* Invoke the appropriate Address_space/Op_region handler */
 
                status = acpi_ev_address_space_dispatch (rgn_desc, ACPI_WRITE_ADR_SPACE,
                                  address, obj_desc->common_field.access_bit_width, &value);
 
+               if (status == AE_NOT_IMPLEMENTED) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                               "**** Region type %s(%X) not implemented\n",
+                               acpi_ut_get_region_name (rgn_desc->region.space_id),
+                               rgn_desc->region.space_id));
+               }
 
+               else if (status == AE_NOT_EXIST) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                               "**** Region type %s(%X) does not have a handler\n",
+                               acpi_ut_get_region_name (rgn_desc->region.space_id),
+                               rgn_desc->region.space_id));
+               }
 
                break;
 
 
        default:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p, wrong source type - %s\n",
+                       obj_desc, acpi_ut_get_type_name (obj_desc->common.type)));
                status = AE_AML_INTERNAL;
                break;
        }
 
 
-       return (status);
+       ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value written=%08lX \n", value));
+       return_ACPI_STATUS (status);
 }
 
 
@@ -557,18 +630,21 @@ acpi_ex_write_field_datum (
  *
  ******************************************************************************/
 
-static ACPI_STATUS
+static acpi_status
 acpi_ex_write_field_datum_with_update_rule (
-       ACPI_OPERAND_OBJECT     *obj_desc,
+       acpi_operand_object     *obj_desc,
        u32                     mask,
        u32                     field_value,
        u32                     field_datum_byte_offset)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        u32                     merged_value;
        u32                     current_value;
 
 
+       FUNCTION_TRACE ("Ex_write_field_datum_with_update_rule");
+
+
        /* Start with the new bits  */
 
        merged_value = field_value;
@@ -617,7 +693,10 @@ acpi_ex_write_field_datum_with_update_rule (
 
 
                default:
-                       return (AE_AML_OPERAND_VALUE);
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                               "Write_with_update_rule: Unknown Update_rule setting: %x\n",
+                               obj_desc->common_field.update_rule));
+                       return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
                        break;
                }
        }
@@ -628,7 +707,10 @@ acpi_ex_write_field_datum_with_update_rule (
        status = acpi_ex_write_field_datum (obj_desc, field_datum_byte_offset,
                          merged_value);
 
-       return (status);
+       ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Mask %X Datum_offset %X Value %X, Merged_value %X\n",
+               mask, field_datum_byte_offset, field_value, merged_value));
+
+       return_ACPI_STATUS (status);
 }
 
 
@@ -645,13 +727,13 @@ acpi_ex_write_field_datum_with_update_rule (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_insert_into_field (
-       ACPI_OPERAND_OBJECT     *obj_desc,
+       acpi_operand_object     *obj_desc,
        void                    *buffer,
        u32                     buffer_length)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
        u32                     field_datum_byte_offset;
        u32                     datum_offset;
        u32                     mask;
@@ -662,6 +744,9 @@ acpi_ex_insert_into_field (
        u32                     datum_count;
 
 
+       FUNCTION_TRACE ("Ex_insert_into_field");
+
+
        /*
         * Incoming buffer must be at least as long as the field, we do not
         * allow "partial" field writes.  We do not care if the buffer is
@@ -670,15 +755,23 @@ acpi_ex_insert_into_field (
         */
        byte_field_length = ROUND_BITS_UP_TO_BYTES (obj_desc->common_field.bit_length);
        if (buffer_length < byte_field_length) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Buffer length %X too small for field %X\n",
+                       buffer_length, byte_field_length));
+
                /* TBD: Need a better error code */
 
-               return (AE_BUFFER_OVERFLOW);
+               return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
        }
 
        /* Convert byte count to datum count, round up if necessary */
 
        datum_count = ROUND_UP_TO (byte_field_length, obj_desc->common_field.access_byte_width);
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+               "Byte_len=%x, Datum_len=%x, Bit_gran=%x, Byte_gran=%x\n",
+               byte_field_length, datum_count, obj_desc->common_field.access_bit_width,
+               obj_desc->common_field.access_byte_width));
+
 
        /*
         * Break the request into up to three parts (similar to an I/O request):
@@ -725,14 +818,14 @@ acpi_ex_insert_into_field (
        status = acpi_ex_write_field_datum_with_update_rule (obj_desc, mask, merged_datum,
                           field_datum_byte_offset);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* If the entire field fits within one datum, we are done. */
 
        if ((datum_count == 1) &&
           (obj_desc->common_field.access_flags & AFIELD_SINGLE_DATUM)) {
-               return (AE_OK);
+               return_ACPI_STATUS (AE_OK);
        }
 
        /*
@@ -799,7 +892,7 @@ acpi_ex_insert_into_field (
                        status = acpi_ex_write_field_datum_with_update_rule (obj_desc, mask,
                                          merged_datum, field_datum_byte_offset);
                        if (ACPI_FAILURE (status)) {
-                               return (status);
+                               return_ACPI_STATUS (status);
                        }
                }
 
@@ -809,7 +902,7 @@ acpi_ex_insert_into_field (
                        status = acpi_ex_write_field_datum (obj_desc,
                                          field_datum_byte_offset, merged_datum);
                        if (ACPI_FAILURE (status)) {
-                               return (status);
+                               return_ACPI_STATUS (status);
                        }
                }
 
@@ -821,7 +914,7 @@ acpi_ex_insert_into_field (
        }
 
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
index a23b77a4c30b46faab1623c04099fc50ef6b6aef..552e5e4f96f827fc0b410874095716807eefa8e1 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes
- *              $Revision: 77 $
+ *              $Revision: 83 $
  *
  *****************************************************************************/
 
 
 /*******************************************************************************
  *
- * FUNCTION:    Acpi_ex_fatal
+ * FUNCTION:    Acpi_ex_triadic
  *
- * PARAMETERS:  none
+ * PARAMETERS:  Opcode              - The opcode to be executed
+ *              Walk_state          - Current walk state
+ *              Return_desc         - Where to store the return object
  *
- * RETURN:      Status.  If the OS returns from the OSD call, we just keep
- *              on going.
+ * RETURN:      Status
  *
- * DESCRIPTION: Execute Fatal operator
+ * DESCRIPTION: Execute Triadic operator (3 operands)
  *
- * ACPI SPECIFICATION REFERENCES:
- *  Def_fatal   :=  Fatal_op Fatal_type Fatal_code  Fatal_arg
- *  Fatal_type  :=  Byte_data
- *  Fatal_code  :=  DWord_data
- *  Fatal_arg   :=  Term_arg=>Integer
+ * ALLOCATION:  Deletes one operand descriptor -- other remains on stack
  *
  ******************************************************************************/
 
-ACPI_STATUS
-acpi_ex_fatal (
-       ACPI_WALK_STATE         *walk_state)
+acpi_status
+acpi_ex_triadic (
+       u16                     opcode,
+       acpi_walk_state         *walk_state,
+       acpi_operand_object     **return_desc)
 {
-       ACPI_OPERAND_OBJECT     *type_desc;
-       ACPI_OPERAND_OBJECT     *code_desc;
-       ACPI_OPERAND_OBJECT     *arg_desc;
-       ACPI_STATUS             status;
-
-
-       /* Resolve operands */
+       acpi_operand_object     **operand = &walk_state->operands[0];
+       acpi_operand_object     *ret_desc = NULL;
+       acpi_operand_object     *tmp_desc;
+       ACPI_SIGNAL_FATAL_INFO  *fatal;
+       acpi_status             status = AE_OK;
 
-       status = acpi_ex_resolve_operands (AML_FATAL_OP, WALK_OPERANDS, walk_state);
-       /* Get operands */
 
-       status |= acpi_ds_obj_stack_pop_object (&arg_desc, walk_state);
-       status |= acpi_ds_obj_stack_pop_object (&code_desc, walk_state);
-       status |= acpi_ds_obj_stack_pop_object (&type_desc, walk_state);
-       if (ACPI_FAILURE (status)) {
-               /* Invalid parameters on object stack  */
+       FUNCTION_TRACE ("Ex_triadic");
 
-               goto cleanup;
-       }
 
+#define obj_desc1           operand[0]
+#define obj_desc2           operand[1]
+#define res_desc            operand[2]
 
-       /* Def_fatal   :=  Fatal_op Fatal_type Fatal_code  Fatal_arg   */
 
+       switch (opcode) {
 
-       /*
-        * TBD: [Unhandled] call OSD interface to notify OS of fatal error
-        * requiring shutdown!
-        */
+       case AML_FATAL_OP:
 
+               /* Def_fatal   :=  Fatal_op Fatal_type  Fatal_code  Fatal_arg   */
 
-cleanup:
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+                       "Fatal_op: Type %x Code %x Arg %x <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
+                       (u32) obj_desc1->integer.value, (u32) obj_desc2->integer.value,
+                       (u32) res_desc->integer.value));
 
-       /* Free the operands */
 
-       acpi_ut_remove_reference (arg_desc);
-       acpi_ut_remove_reference (code_desc);
-       acpi_ut_remove_reference (type_desc);
+               fatal = ACPI_MEM_ALLOCATE (sizeof (ACPI_SIGNAL_FATAL_INFO));
+               if (fatal) {
+                       fatal->type = (u32) obj_desc1->integer.value;
+                       fatal->code = (u32) obj_desc2->integer.value;
+                       fatal->argument = (u32) res_desc->integer.value;
+               }
 
+               /*
+                * Signal the OS
+                */
+               acpi_os_signal (ACPI_SIGNAL_FATAL, fatal);
 
-       /* If we get back from the OS call, we might as well keep going. */
-
-       REPORT_WARNING (("An AML \"fatal\" Opcode (Fatal_op) was executed\n"));
-       return (AE_OK);
-}
+               /* Might return while OS is shutting down */
 
+               ACPI_MEM_FREE (fatal);
+               break;
 
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_ex_index
- *
- * PARAMETERS:  none
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Execute Index operator
- *
- * ALLOCATION:  Deletes one operand descriptor -- other remains on stack
- *
- *  ACPI SPECIFICATION REFERENCES:
- *  Def_index   :=  Index_op Buff_pkg_obj Index_value Result
- *  Index_value :=  Term_arg=>Integer
- *  Name_string :=  <Root_char Name_path> | <Prefix_path Name_path>
- *  Result      :=  Super_name
- *  Super_name  :=  Name_string | Arg_obj | Local_obj | Debug_obj | Def_index
- *                             Local4_op | Local5_op | Local6_op | Local7_op
- *
- ******************************************************************************/
 
-ACPI_STATUS
-acpi_ex_index (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_OPERAND_OBJECT     **return_desc)
-{
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_OPERAND_OBJECT     *idx_desc;
-       ACPI_OPERAND_OBJECT     *res_desc;
-       ACPI_OPERAND_OBJECT     *ret_desc = NULL;
-       ACPI_OPERAND_OBJECT     *tmp_desc;
-       ACPI_STATUS             status;
+       case AML_MID_OP:
 
+               /* Def_mid      := Mid_op Source Index Length Result */
 
-       /* Resolve operands */
-       /* First operand can be either a package or a buffer */
+               /* Create the internal return object (string or buffer) */
 
-       status = acpi_ex_resolve_operands (AML_INDEX_OP, WALK_OPERANDS, walk_state);
-       /* Get all operands */
+               break;
 
-       status |= acpi_ds_obj_stack_pop_object (&res_desc, walk_state);
-       status |= acpi_ds_obj_stack_pop_object (&idx_desc, walk_state);
-       status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state);
-       if (ACPI_FAILURE (status)) {
-               /* Invalid parameters on object stack  */
 
-               goto cleanup;
-       }
+       case AML_INDEX_OP:
 
+               /* Def_index    := Index_op Source Index Destination */
 
-       /* Create the internal return object */
+               /* Create the internal return object */
 
-       ret_desc = acpi_ut_create_internal_object (INTERNAL_TYPE_REFERENCE);
-       if (!ret_desc) {
-               status = AE_NO_MEMORY;
-               goto cleanup;
-       }
+               ret_desc = acpi_ut_create_internal_object (INTERNAL_TYPE_REFERENCE);
+               if (!ret_desc) {
+                       status = AE_NO_MEMORY;
+                       goto cleanup;
+               }
 
+               /*
+                * At this point, the Obj_desc1 operand is either a Package or a Buffer
+                */
+               if (obj_desc1->common.type == ACPI_TYPE_PACKAGE) {
+                       /* Object to be indexed is a Package */
 
-       /*
-        * At this point, the Obj_desc operand is either a Package or a Buffer
-        */
+                       if (obj_desc2->integer.value >= obj_desc1->package.count) {
+                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Index value beyond package end\n"));
+                               status = AE_AML_PACKAGE_LIMIT;
+                               goto cleanup;
+                       }
 
-       if (obj_desc->common.type == ACPI_TYPE_PACKAGE) {
-               /* Object to be indexed is a Package */
+                       if ((res_desc->common.type == INTERNAL_TYPE_REFERENCE) &&
+                               (res_desc->reference.opcode == AML_ZERO_OP)) {
+                               /*
+                                * There is no actual result descriptor (the Zero_op Result
+                                * descriptor is a placeholder), so just delete the placeholder and
+                                * return a reference to the package element
+                                */
+                               acpi_ut_remove_reference (res_desc);
+                       }
 
-               if (idx_desc->integer.value >= obj_desc->package.count) {
-                       status = AE_AML_PACKAGE_LIMIT;
-                       goto cleanup;
-               }
+                       else {
+                               /*
+                                * Each element of the package is an internal object.  Get the one
+                                * we are after.
+                                */
+                               tmp_desc                      = obj_desc1->package.elements[obj_desc2->integer.value];
+                               ret_desc->reference.opcode    = AML_INDEX_OP;
+                               ret_desc->reference.target_type = tmp_desc->common.type;
+                               ret_desc->reference.object    = tmp_desc;
+
+                               status = acpi_ex_store (ret_desc, res_desc, walk_state);
+                               ret_desc->reference.object    = NULL;
+                       }
 
-               if ((res_desc->common.type == INTERNAL_TYPE_REFERENCE) &&
-                       (res_desc->reference.opcode == AML_ZERO_OP)) {
                        /*
-                        * There is no actual result descriptor (the Zero_op Result
-                        * descriptor is a placeholder), so just delete the placeholder and
-                        * return a reference to the package element
+                        * The local return object must always be a reference to the package element,
+                        * not the element itself.
                         */
-
-                       acpi_ut_remove_reference (res_desc);
+                       ret_desc->reference.opcode    = AML_INDEX_OP;
+                       ret_desc->reference.target_type = ACPI_TYPE_PACKAGE;
+                       ret_desc->reference.where     = &obj_desc1->package.elements[obj_desc2->integer.value];
                }
 
                else {
-                       /*
-                        * Each element of the package is an internal object.  Get the one
-                        * we are after.
-                        */
+                       /* Object to be indexed is a Buffer */
 
-                       tmp_desc                      = obj_desc->package.elements[idx_desc->integer.value];
-                       ret_desc->reference.opcode    = AML_INDEX_OP;
-                       ret_desc->reference.target_type = tmp_desc->common.type;
-                       ret_desc->reference.object    = tmp_desc;
-
-                       status = acpi_ex_store (ret_desc, res_desc, walk_state);
-                       ret_desc->reference.object    = NULL;
-               }
-
-               /*
-                * The local return object must always be a reference to the package element,
-                * not the element itself.
-                */
-               ret_desc->reference.opcode    = AML_INDEX_OP;
-               ret_desc->reference.target_type = ACPI_TYPE_PACKAGE;
-               ret_desc->reference.where     = &obj_desc->package.elements[idx_desc->integer.value];
-       }
+                       if (obj_desc2->integer.value >= obj_desc1->buffer.length) {
+                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Index value beyond end of buffer\n"));
+                               status = AE_AML_BUFFER_LIMIT;
+                               goto cleanup;
+                       }
 
-       else {
-               /* Object to be indexed is a Buffer */
+                       ret_desc->reference.opcode      = AML_INDEX_OP;
+                       ret_desc->reference.target_type = ACPI_TYPE_BUFFER_FIELD;
+                       ret_desc->reference.object      = obj_desc1;
+                       ret_desc->reference.offset      = (u32) obj_desc2->integer.value;
 
-               if (idx_desc->integer.value >= obj_desc->buffer.length) {
-                       status = AE_AML_BUFFER_LIMIT;
-                       goto cleanup;
+                       status = acpi_ex_store (ret_desc, res_desc, walk_state);
                }
-
-               ret_desc->reference.opcode      = AML_INDEX_OP;
-               ret_desc->reference.target_type = ACPI_TYPE_BUFFER_FIELD;
-               ret_desc->reference.object      = obj_desc;
-               ret_desc->reference.offset      = (u32) idx_desc->integer.value;
-
-               status = acpi_ex_store (ret_desc, res_desc, walk_state);
+               break;
        }
 
 
@@ -233,8 +193,8 @@ cleanup:
 
        /* Always delete operands */
 
-       acpi_ut_remove_reference (obj_desc);
-       acpi_ut_remove_reference (idx_desc);
+       acpi_ut_remove_reference (obj_desc1);
+       acpi_ut_remove_reference (obj_desc2);
 
        /* Delete return object on error */
 
@@ -250,239 +210,227 @@ cleanup:
        /* Set the return object and exit */
 
        *return_desc = ret_desc;
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
 /*******************************************************************************
  *
- * FUNCTION:    Acpi_ex_match
+ * FUNCTION:    Acpi_ex_hexadic
  *
- * PARAMETERS:  none
+ * PARAMETERS:  Opcode              - The opcode to be executed
+ *              Walk_state          - Current walk state
+ *              Return_desc         - Where to store the return object
  *
  * RETURN:      Status
  *
  * DESCRIPTION: Execute Match operator
  *
- * ACPI SPECIFICATION REFERENCES:
- *  Def_match   :=  Match_op Search_pkg Opcode1     Operand1
- *                              Opcode2 Operand2    Start_index
- *  Opcode1     :=  Byte_data: MTR, MEQ, MLE, MLT, MGE, or MGT
- *  Opcode2     :=  Byte_data: MTR, MEQ, MLE, MLT, MGE, or MGT
- *  Operand1    :=  Term_arg=>Integer
- *  Operand2    :=  Term_arg=>Integer
- *  Search_pkg  :=  Term_arg=>Package_object
- *  Start_index :=  Term_arg=>Integer
- *
  ******************************************************************************/
 
-ACPI_STATUS
-acpi_ex_match (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_OPERAND_OBJECT     **return_desc)
+acpi_status
+acpi_ex_hexadic (
+       u16                     opcode,
+       acpi_walk_state         *walk_state,
+       acpi_operand_object     **return_desc)
 {
-       ACPI_OPERAND_OBJECT     *pkg_desc;
-       ACPI_OPERAND_OBJECT     *op1_desc;
-       ACPI_OPERAND_OBJECT     *V1_desc;
-       ACPI_OPERAND_OBJECT     *op2_desc;
-       ACPI_OPERAND_OBJECT     *V2_desc;
-       ACPI_OPERAND_OBJECT     *start_desc;
-       ACPI_OPERAND_OBJECT     *ret_desc = NULL;
-       ACPI_STATUS             status;
+       acpi_operand_object     **operand = &walk_state->operands[0];
+       acpi_operand_object     *ret_desc = NULL;
+       acpi_status             status = AE_OK;
        u32                     index;
        u32                     match_value = (u32) -1;
 
 
-       /* Resolve all operands */
+       FUNCTION_TRACE ("Ex_hexadic");
 
-       status = acpi_ex_resolve_operands (AML_MATCH_OP, WALK_OPERANDS, walk_state);
-       /* Get all operands */
+#define pkg_desc            operand[0]
+#define op1_desc            operand[1]
+#define V1_desc             operand[2]
+#define op2_desc            operand[3]
+#define V2_desc             operand[4]
+#define start_desc          operand[5]
 
-       status |= acpi_ds_obj_stack_pop_object (&start_desc, walk_state);
-       status |= acpi_ds_obj_stack_pop_object (&V2_desc, walk_state);
-       status |= acpi_ds_obj_stack_pop_object (&op2_desc, walk_state);
-       status |= acpi_ds_obj_stack_pop_object (&V1_desc, walk_state);
-       status |= acpi_ds_obj_stack_pop_object (&op1_desc, walk_state);
-       status |= acpi_ds_obj_stack_pop_object (&pkg_desc, walk_state);
 
-       if (ACPI_FAILURE (status)) {
-               /* Invalid parameters on object stack  */
-
-               goto cleanup;
-       }
+       switch (opcode) {
 
-       /* Validate match comparison sub-opcodes */
+               case AML_MATCH_OP:
 
-       if ((op1_desc->integer.value > MAX_MATCH_OPERATOR) ||
-               (op2_desc->integer.value > MAX_MATCH_OPERATOR)) {
-               status = AE_AML_OPERAND_VALUE;
-               goto cleanup;
-       }
+               /* Validate match comparison sub-opcodes */
 
-       index = (u32) start_desc->integer.value;
-       if (index >= (u32) pkg_desc->package.count) {
-               status = AE_AML_PACKAGE_LIMIT;
-               goto cleanup;
-       }
+               if ((op1_desc->integer.value > MAX_MATCH_OPERATOR) ||
+                       (op2_desc->integer.value > MAX_MATCH_OPERATOR)) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "operation encoding out of range\n"));
+                       status = AE_AML_OPERAND_VALUE;
+                       goto cleanup;
+               }
 
-       ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
-       if (!ret_desc) {
-               status = AE_NO_MEMORY;
-               goto cleanup;
+               index = (u32) start_desc->integer.value;
+               if (index >= (u32) pkg_desc->package.count) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Start position value out of range\n"));
+                       status = AE_AML_PACKAGE_LIMIT;
+                       goto cleanup;
+               }
 
-       }
+               ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+               if (!ret_desc) {
+                       status = AE_NO_MEMORY;
+                       goto cleanup;
 
-       /*
-        * Examine each element until a match is found.  Within the loop,
-        * "continue" signifies that the current element does not match
-        * and the next should be examined.
-        * Upon finding a match, the loop will terminate via "break" at
-        * the bottom.  If it terminates "normally", Match_value will be -1
-        * (its initial value) indicating that no match was found.  When
-        * returned as a Number, this will produce the Ones value as specified.
-        */
-
-       for ( ; index < pkg_desc->package.count; ++index) {
-               /*
-                * Treat any NULL or non-numeric elements as non-matching.
-                * TBD [Unhandled] - if an element is a Name,
-                *      should we examine its value?
-                */
-               if (!pkg_desc->package.elements[index] ||
-                       ACPI_TYPE_INTEGER != pkg_desc->package.elements[index]->common.type) {
-                       continue;
                }
 
                /*
-                * Within these switch statements:
-                *      "break" (exit from the switch) signifies a match;
-                *      "continue" (proceed to next iteration of enclosing
-                *          "for" loop) signifies a non-match.
+                * Examine each element until a match is found.  Within the loop,
+                * "continue" signifies that the current element does not match
+                * and the next should be examined.
+                * Upon finding a match, the loop will terminate via "break" at
+                * the bottom.  If it terminates "normally", Match_value will be -1
+                * (its initial value) indicating that no match was found.  When
+                * returned as a Number, this will produce the Ones value as specified.
                 */
-               switch (op1_desc->integer.value) {
+               for ( ; index < pkg_desc->package.count; ++index) {
+                       /*
+                        * Treat any NULL or non-numeric elements as non-matching.
+                        * TBD [Unhandled] - if an element is a Name,
+                        *      should we examine its value?
+                        */
+                       if (!pkg_desc->package.elements[index] ||
+                               ACPI_TYPE_INTEGER != pkg_desc->package.elements[index]->common.type) {
+                               continue;
+                       }
 
-               case MATCH_MTR:   /* always true */
+                       /*
+                        * Within these switch statements:
+                        *      "break" (exit from the switch) signifies a match;
+                        *      "continue" (proceed to next iteration of enclosing
+                        *          "for" loop) signifies a non-match.
+                        */
+                       switch (op1_desc->integer.value) {
 
-                       break;
+                       case MATCH_MTR:   /* always true */
 
+                               break;
 
-               case MATCH_MEQ:   /* true if equal   */
 
-                       if (pkg_desc->package.elements[index]->integer.value
-                                != V1_desc->integer.value) {
-                               continue;
-                       }
-                       break;
+                       case MATCH_MEQ:   /* true if equal   */
 
+                               if (pkg_desc->package.elements[index]->integer.value
+                                        != V1_desc->integer.value) {
+                                       continue;
+                               }
+                               break;
 
-               case MATCH_MLE:   /* true if less than or equal  */
 
-                       if (pkg_desc->package.elements[index]->integer.value
-                                > V1_desc->integer.value) {
-                               continue;
-                       }
-                       break;
+                       case MATCH_MLE:   /* true if less than or equal  */
 
+                               if (pkg_desc->package.elements[index]->integer.value
+                                        > V1_desc->integer.value) {
+                                       continue;
+                               }
+                               break;
 
-               case MATCH_MLT:   /* true if less than   */
 
-                       if (pkg_desc->package.elements[index]->integer.value
-                                >= V1_desc->integer.value) {
-                               continue;
-                       }
-                       break;
+                       case MATCH_MLT:   /* true if less than   */
 
+                               if (pkg_desc->package.elements[index]->integer.value
+                                        >= V1_desc->integer.value) {
+                                       continue;
+                               }
+                               break;
 
-               case MATCH_MGE:   /* true if greater than or equal   */
 
-                       if (pkg_desc->package.elements[index]->integer.value
-                                < V1_desc->integer.value) {
-                               continue;
-                       }
-                       break;
+                       case MATCH_MGE:   /* true if greater than or equal   */
+
+                               if (pkg_desc->package.elements[index]->integer.value
+                                        < V1_desc->integer.value) {
+                                       continue;
+                               }
+                               break;
+
+
+                       case MATCH_MGT:   /* true if greater than    */
+
+                               if (pkg_desc->package.elements[index]->integer.value
+                                        <= V1_desc->integer.value) {
+                                       continue;
+                               }
+                               break;
 
 
-               case MATCH_MGT:   /* true if greater than    */
+                       default:    /* undefined   */
 
-                       if (pkg_desc->package.elements[index]->integer.value
-                                <= V1_desc->integer.value) {
                                continue;
                        }
-                       break;
 
 
-               default:    /* undefined   */
+                       switch(op2_desc->integer.value) {
 
-                       continue;
-               }
+                       case MATCH_MTR:
 
+                               break;
 
-               switch(op2_desc->integer.value) {
 
-               case MATCH_MTR:
+                       case MATCH_MEQ:
 
-                       break;
+                               if (pkg_desc->package.elements[index]->integer.value
+                                        != V2_desc->integer.value) {
+                                       continue;
+                               }
+                               break;
 
 
-               case MATCH_MEQ:
+                       case MATCH_MLE:
 
-                       if (pkg_desc->package.elements[index]->integer.value
-                                != V2_desc->integer.value) {
-                               continue;
-                       }
-                       break;
+                               if (pkg_desc->package.elements[index]->integer.value
+                                        > V2_desc->integer.value) {
+                                       continue;
+                               }
+                               break;
 
 
-               case MATCH_MLE:
+                       case MATCH_MLT:
 
-                       if (pkg_desc->package.elements[index]->integer.value
-                                > V2_desc->integer.value) {
-                               continue;
-                       }
-                       break;
+                               if (pkg_desc->package.elements[index]->integer.value
+                                        >= V2_desc->integer.value) {
+                                       continue;
+                               }
+                               break;
 
 
-               case MATCH_MLT:
+                       case MATCH_MGE:
 
-                       if (pkg_desc->package.elements[index]->integer.value
-                                >= V2_desc->integer.value) {
-                               continue;
-                       }
-                       break;
+                               if (pkg_desc->package.elements[index]->integer.value
+                                        < V2_desc->integer.value) {
+                                       continue;
+                               }
+                               break;
 
 
-               case MATCH_MGE:
+                       case MATCH_MGT:
 
-                       if (pkg_desc->package.elements[index]->integer.value
-                                < V2_desc->integer.value) {
-                               continue;
-                       }
-                       break;
+                               if (pkg_desc->package.elements[index]->integer.value
+                                        <= V2_desc->integer.value) {
+                                       continue;
+                               }
+                               break;
 
 
-               case MATCH_MGT:
+                       default:
 
-                       if (pkg_desc->package.elements[index]->integer.value
-                                <= V2_desc->integer.value) {
                                continue;
                        }
-                       break;
 
+                       /* Match found: exit from loop */
 
-               default:
-
-                       continue;
+                       match_value = index;
+                       break;
                }
 
-               /* Match found: exit from loop */
+               /* Match_value is the return value */
 
-               match_value = index;
+               ret_desc->integer.value = match_value;
                break;
-       }
-
-       /* Match_value is the return value */
 
-       ret_desc->integer.value = match_value;
+       }
 
 
 cleanup:
@@ -509,5 +457,5 @@ cleanup:
        /* Set the return object and exit */
 
        *return_desc = ret_desc;
-       return (status);
+       return_ACPI_STATUS (status);
 }
index 07b8b2d73ea5ba335b30ddde02129db7c9c7ddb8..3c5eddb275372729a4b4333d445db06551f2dfb2 100644 (file)
@@ -1,8 +1,8 @@
 
 /******************************************************************************
  *
- * Module Name: exmonad - ACPI AML (p-code) execution for monadic operators
- *              $Revision: 99 $
+ * Module Name: exmonad - ACPI AML execution for monadic (1 operand) operators
+ *              $Revision: 111 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-static ACPI_STATUS
+static acpi_status
 acpi_ex_get_object_reference (
-       ACPI_OPERAND_OBJECT     *obj_desc,
-       ACPI_OPERAND_OBJECT     **ret_desc,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_operand_object     *obj_desc,
+       acpi_operand_object     **ret_desc,
+       acpi_walk_state         *walk_state)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+
+       FUNCTION_TRACE_PTR ("Ex_get_object_reference", obj_desc);
 
 
        if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_INTERNAL)) {
@@ -81,6 +84,8 @@ acpi_ex_get_object_reference (
 
                default:
 
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(Internal) Unknown Ref subtype %02x\n",
+                               obj_desc->reference.opcode));
                        *ret_desc = NULL;
                        status = AE_AML_INTERNAL;
                        goto cleanup;
@@ -102,9 +107,13 @@ acpi_ex_get_object_reference (
 
 cleanup:
 
-       return (status);
+       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p Ref=%p\n", obj_desc, *ret_desc));
+       return_ACPI_STATUS (status);
 }
 
+#define obj_desc            operand[0]
+#define res_desc            operand[1]
+
 
 /*******************************************************************************
  *
@@ -119,24 +128,16 @@ cleanup:
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_monadic1 (
        u16                     opcode,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_walk_state         *walk_state)
 {
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_STATUS             status;
-
+       acpi_operand_object     **operand = &walk_state->operands[0];
+       acpi_status             status;
 
-       /* Resolve all operands */
 
-       status = acpi_ex_resolve_operands (opcode, WALK_OPERANDS, walk_state);
-       /* Get all operands */
-
-       status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state);
-       if (ACPI_FAILURE (status)) {
-               goto cleanup;
-       }
+       FUNCTION_TRACE_PTR ("Ex_monadic1", WALK_OPERANDS);
 
 
        /* Examine the opcode */
@@ -195,13 +196,11 @@ acpi_ex_monadic1 (
        } /* switch */
 
 
-cleanup:
-
        /* Always delete the operand */
 
        acpi_ut_remove_reference (obj_desc);
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -218,33 +217,23 @@ cleanup:
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_monadic2_r (
        u16                     opcode,
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_OPERAND_OBJECT     **return_desc)
+       acpi_walk_state         *walk_state,
+       acpi_operand_object     **return_desc)
 {
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_OPERAND_OBJECT     *res_desc;
-       ACPI_OPERAND_OBJECT     *ret_desc = NULL;
-       ACPI_OPERAND_OBJECT     *ret_desc2 = NULL;
+       acpi_operand_object     **operand = &walk_state->operands[0];
+       acpi_operand_object     *ret_desc = NULL;
+       acpi_operand_object     *ret_desc2 = NULL;
        u32                     res_val;
-       ACPI_STATUS             status;
+       acpi_status             status = AE_OK;
        u32                     i;
        u32                     j;
-       ACPI_INTEGER            digit;
-
-
-       /* Resolve all operands */
+       acpi_integer            digit;
 
-       status = acpi_ex_resolve_operands (opcode, WALK_OPERANDS, walk_state);
-       /* Get all operands */
 
-       status |= acpi_ds_obj_stack_pop_object (&res_desc, walk_state);
-       status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state);
-       if (ACPI_FAILURE (status)) {
-               goto cleanup;
-       }
+       FUNCTION_TRACE_PTR ("Ex_monadic2_r", WALK_OPERANDS);
 
 
        /* Create a return object of type NUMBER for most opcodes */
@@ -325,11 +314,13 @@ acpi_ex_monadic2_r (
                for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++) {
                        /* Get one BCD digit */
 
-                       digit = (ACPI_INTEGER) ((obj_desc->integer.value >> (i * 4)) & 0xF);
+                       digit = (acpi_integer) ((obj_desc->integer.value >> (i * 4)) & 0xF);
 
                        /* Check the range of the digit */
 
                        if (digit > 9) {
+                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "BCD digit too large: \n",
+                                       digit));
                                status = AE_AML_NUMERIC_OVERFLOW;
                                goto cleanup;
                        }
@@ -353,6 +344,8 @@ acpi_ex_monadic2_r (
 
 
                if (obj_desc->integer.value > ACPI_MAX_BCD_VALUE) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "BCD overflow: %d\n",
+                               obj_desc->integer.value));
                        status = AE_AML_NUMERIC_OVERFLOW;
                        goto cleanup;
                }
@@ -363,7 +356,7 @@ acpi_ex_monadic2_r (
 
                        digit = obj_desc->integer.value;
                        for (j = 0; j < i; j++) {
-                               digit /= 10;
+                               digit = ACPI_DIVIDE (digit, 10);
                        }
 
                        /* Create the BCD digit */
@@ -384,20 +377,17 @@ acpi_ex_monadic2_r (
                 * different than the return value stored in the result descriptor
                 * (There are really two return values)
                 */
-
-               if ((ACPI_NAMESPACE_NODE *) obj_desc == acpi_gbl_root_node) {
+               if ((acpi_namespace_node *) obj_desc == acpi_gbl_root_node) {
                        /*
                         * This means that the object does not exist in the namespace,
                         * return FALSE
                         */
-
                        ret_desc->integer.value = 0;
 
                        /*
                         * Must delete the result descriptor since there is no reference
                         * being returned
                         */
-
                        acpi_ut_remove_reference (res_desc);
                        goto cleanup;
                }
@@ -429,27 +419,22 @@ acpi_ex_monadic2_r (
                 * Do the store, and be careful about deleting the source object,
                 * since the object itself may have been stored.
                 */
-
                status = acpi_ex_store (obj_desc, res_desc, walk_state);
                if (ACPI_FAILURE (status)) {
                        /* On failure, just delete the Obj_desc */
 
                        acpi_ut_remove_reference (obj_desc);
+                       return_ACPI_STATUS (status);
                }
 
-               else {
-                       /*
-                        * Normally, we would remove a reference on the Obj_desc parameter;
-                        * But since it is being used as the internal return object
-                        * (meaning we would normally increment it), the two cancel out,
-                        * and we simply don't do anything.
-                        */
-                       *return_desc = obj_desc;
-               }
-
-               obj_desc = NULL;
-               return (status);
-
+               /*
+                * Normally, we would remove a reference on the Obj_desc parameter;
+                * But since it is being used as the internal return object
+                * (meaning we would normally increment it), the two cancel out,
+                * and we simply don't do anything.
+                */
+               *return_desc = obj_desc;
+               return_ACPI_STATUS (status);
                break;
 
 
@@ -457,7 +442,29 @@ acpi_ex_monadic2_r (
 
                /* Reference, returning an Reference */
 
-               return (AE_OK);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Debug_op should never get here!\n"));
+               return_ACPI_STATUS (AE_OK);
+               break;
+
+
+       /*
+        * ACPI 2.0 Opcodes
+        */
+       case AML_TO_DECSTRING_OP:
+               status = acpi_ex_convert_to_string (obj_desc, &ret_desc, 10, ACPI_UINT32_MAX, walk_state);
+               break;
+
+
+       case AML_TO_HEXSTRING_OP:
+               status = acpi_ex_convert_to_string (obj_desc, &ret_desc, 16, ACPI_UINT32_MAX, walk_state);
+               break;
+
+       case AML_TO_BUFFER_OP:
+               status = acpi_ex_convert_to_buffer (obj_desc, &ret_desc, walk_state);
+               break;
+
+       case AML_TO_INTEGER_OP:
+               status = acpi_ex_convert_to_integer (obj_desc, &ret_desc, walk_state);
                break;
 
 
@@ -471,6 +478,8 @@ acpi_ex_monadic2_r (
        case AML_SHIFT_LEFT_BIT_OP:
        case AML_SHIFT_RIGHT_BIT_OP:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s is unimplemented\n",
+                                 acpi_ps_get_opcode_name (opcode)));
                status = AE_SUPPORT;
                goto cleanup;
                break;
@@ -506,7 +515,7 @@ cleanup:
        /* Set the return object and exit */
 
        *return_desc = ret_desc;
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -524,42 +533,25 @@ cleanup:
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_monadic2 (
        u16                     opcode,
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_OPERAND_OBJECT     **return_desc)
+       acpi_walk_state         *walk_state,
+       acpi_operand_object     **return_desc)
 {
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_OPERAND_OBJECT     *tmp_desc;
-       ACPI_OPERAND_OBJECT     *ret_desc = NULL;
-       ACPI_STATUS             resolve_status;
-       ACPI_STATUS             status;
+       acpi_operand_object     **operand = &walk_state->operands[0];
+       acpi_operand_object     *tmp_desc;
+       acpi_operand_object     *ret_desc = NULL;
+       acpi_status             status = AE_OK;
        u32                     type;
-       ACPI_INTEGER            value;
-
-
-       /* Attempt to resolve the operands */
-
-       resolve_status = acpi_ex_resolve_operands (opcode, WALK_OPERANDS, walk_state);
-       /* Always get all operands */
-
-       status = acpi_ds_obj_stack_pop_object (&obj_desc, walk_state);
-
-       /* Now we can check the status codes */
+       acpi_integer            value;
 
-       if (ACPI_FAILURE (resolve_status)) {
-               goto cleanup;
-       }
 
-       if (ACPI_FAILURE (status)) {
-               goto cleanup;
-       }
+       FUNCTION_TRACE_PTR ("Ex_monadic2", WALK_OPERANDS);
 
 
        /* Get the operand and decode the opcode */
 
-
        switch (opcode) {
 
        /*  Def_lNot := LNot_op Operand */
@@ -587,9 +579,8 @@ acpi_ex_monadic2 (
                 * can be either an Node or an internal object.
                 *
                 * TBD: [Future] This may be the prototype code for all cases where
-                * an Reference is expected!! 10/99
+                * a Reference is expected!! 10/99
                 */
-
                if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) {
                        ret_desc = obj_desc;
                }
@@ -599,7 +590,6 @@ acpi_ex_monadic2 (
                         * Duplicate the Reference in a new object so that we can resolve it
                         * without destroying the original Reference object
                         */
-
                        ret_desc = acpi_ut_create_internal_object (INTERNAL_TYPE_REFERENCE);
                        if (!ret_desc) {
                                status = AE_NO_MEMORY;
@@ -616,9 +606,11 @@ acpi_ex_monadic2 (
                 * Convert the Ret_desc Reference to a Number
                 * (This deletes the original Ret_desc)
                 */
-
                status = acpi_ex_resolve_operands (AML_LNOT_OP, &ret_desc, walk_state);
                if (ACPI_FAILURE (status)) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s: bad operand(s) %s\n",
+                               acpi_ps_get_opcode_name (opcode), acpi_format_exception(status)));
+
                        goto cleanup;
                }
 
@@ -655,6 +647,7 @@ acpi_ex_monadic2 (
                        case AML_ZERO_OP:
                        case AML_ONE_OP:
                        case AML_ONES_OP:
+                       case AML_REVISION_OP:
 
                                /* Constants are of type Number */
 
@@ -708,7 +701,7 @@ acpi_ex_monadic2 (
                        /*
                         * It's not a Reference, so it must be a direct name pointer.
                         */
-                       type = acpi_ns_get_type ((ACPI_NAMESPACE_NODE *) obj_desc);
+                       type = acpi_ns_get_type ((acpi_namespace_node *) obj_desc);
 
                        /* Convert internal types to external types */
 
@@ -739,7 +732,7 @@ acpi_ex_monadic2 (
        case AML_SIZE_OF_OP:
 
                if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) {
-                       obj_desc = acpi_ns_get_attached_object ((ACPI_NAMESPACE_NODE *) obj_desc);
+                       obj_desc = acpi_ns_get_attached_object ((acpi_namespace_node *) obj_desc);
                }
 
                if (!obj_desc) {
@@ -773,6 +766,8 @@ acpi_ex_monadic2 (
 
                        default:
 
+                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Not Buf/Str/Pkg - found type %X\n",
+                                       obj_desc->common.type));
                                status = AE_AML_OPERAND_TYPE;
                                goto cleanup;
                        }
@@ -782,7 +777,6 @@ acpi_ex_monadic2 (
                 * Now that we have the size of the object, create a result
                 * object to hold the value
                 */
-
                ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
                if (!ret_desc) {
                        status = AE_NO_MEMORY;
@@ -845,7 +839,7 @@ acpi_ex_monadic2 (
                if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) {
                        /* Get the actual object from the Node (This is the dereference) */
 
-                       ret_desc = ((ACPI_NAMESPACE_NODE *) obj_desc)->object;
+                       ret_desc = ((acpi_namespace_node *) obj_desc)->object;
 
                        /* Returning a pointer to the object, add another reference! */
 
@@ -857,9 +851,11 @@ acpi_ex_monadic2 (
                         * This must be a reference object produced by the Index
                         * ASL operation -- check internal opcode
                         */
-
                        if ((obj_desc->reference.opcode != AML_INDEX_OP) &&
                                (obj_desc->reference.opcode != AML_REF_OF_OP)) {
+                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode in ref(%p) - %X\n",
+                                       obj_desc, obj_desc->reference.opcode));
+
                                status = AE_TYPE;
                                goto cleanup;
                        }
@@ -873,7 +869,6 @@ acpi_ex_monadic2 (
                                 * 1) A Buffer
                                 * 2) A Package
                                 */
-
                                if (obj_desc->reference.target_type == ACPI_TYPE_BUFFER_FIELD) {
                                        /*
                                         * The target is a buffer, we must create a new object that
@@ -905,7 +900,6 @@ acpi_ex_monadic2 (
                                         * element of the package.  We must add another reference to
                                         * this object, however.
                                         */
-
                                        ret_desc = *(obj_desc->reference.where);
                                        if (!ret_desc) {
                                                /*
@@ -914,6 +908,8 @@ acpi_ex_monadic2 (
                                                 * severe error.
                                                 */
 
+                                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "NULL package element obj %p\n",
+                                                       obj_desc));
                                                status = AE_AML_UNINITIALIZED_ELEMENT;
                                                goto cleanup;
                                        }
@@ -922,6 +918,8 @@ acpi_ex_monadic2 (
                                }
 
                                else {
+                                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Target_type %X in obj %p\n",
+                                               obj_desc->reference.target_type, obj_desc));
                                        status = AE_AML_OPERAND_TYPE;
                                        goto cleanup;
                                }
@@ -967,6 +965,6 @@ cleanup:
        }
 
        *return_desc = ret_desc;
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
index ac72f7c08716eda77d750a0c614d0416a72c65bc..41b3024c7f57a974c0ad0680bbcca5a16b632cf6 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: exmutex - ASL Mutex Acquire/Release functions
- *              $Revision: 5 $
+ *              $Revision: 7 $
  *
  *****************************************************************************/
 
@@ -49,7 +49,7 @@
 
 void
 acpi_ex_unlink_mutex (
-       ACPI_OPERAND_OBJECT     *obj_desc)
+       acpi_operand_object     *obj_desc)
 {
 
        if (obj_desc->mutex.next) {
@@ -76,8 +76,8 @@ acpi_ex_unlink_mutex (
 
 void
 acpi_ex_link_mutex (
-       ACPI_OPERAND_OBJECT     *obj_desc,
-       ACPI_OPERAND_OBJECT     *list_head)
+       acpi_operand_object     *obj_desc,
+       acpi_operand_object     *list_head)
 {
 
        /* This object will be the first object in the list */
@@ -110,17 +110,19 @@ acpi_ex_link_mutex (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_acquire_mutex (
-       ACPI_OPERAND_OBJECT     *time_desc,
-       ACPI_OPERAND_OBJECT     *obj_desc,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_operand_object     *time_desc,
+       acpi_operand_object     *obj_desc,
+       acpi_walk_state         *walk_state)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
 
 
+       FUNCTION_TRACE_PTR ("Ex_acquire_mutex", obj_desc);
+
        if (!obj_desc) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        /*
@@ -128,7 +130,7 @@ acpi_ex_acquire_mutex (
         * mutex.  This mechanism provides some deadlock prevention
         */
        if (walk_state->current_sync_level > obj_desc->mutex.sync_level) {
-               return (AE_AML_MUTEX_ORDER);
+               return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
        }
 
        /*
@@ -137,7 +139,7 @@ acpi_ex_acquire_mutex (
         */
        if (obj_desc->mutex.owner == walk_state) {
                obj_desc->mutex.acquisition_depth++;
-               return (AE_OK);
+               return_ACPI_STATUS (AE_OK);
        }
 
        /* Acquire the mutex, wait if necessary */
@@ -146,7 +148,7 @@ acpi_ex_acquire_mutex (
        if (ACPI_FAILURE (status)) {
                /* Includes failure from a timeout on Time_desc */
 
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Have the mutex, update mutex and walk info */
@@ -157,10 +159,10 @@ acpi_ex_acquire_mutex (
 
        /* Link the mutex to the walk state for force-unlock at method exit */
 
-       acpi_ex_link_mutex (obj_desc, (ACPI_OPERAND_OBJECT *)
+       acpi_ex_link_mutex (obj_desc, (acpi_operand_object *)
                         &(walk_state->walk_list->acquired_mutex_list));
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -176,28 +178,31 @@ acpi_ex_acquire_mutex (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_release_mutex (
-       ACPI_OPERAND_OBJECT     *obj_desc,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_operand_object     *obj_desc,
+       acpi_walk_state         *walk_state)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Ex_release_mutex");
 
 
        if (!obj_desc) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
-       /*  The mutex must have been previously acquired in order to release it */
+       /* The mutex must have been previously acquired in order to release it */
 
        if (!obj_desc->mutex.owner) {
-               return (AE_AML_MUTEX_NOT_ACQUIRED);
+               return_ACPI_STATUS (AE_AML_MUTEX_NOT_ACQUIRED);
        }
 
        /* The Mutex is owned, but this thread must be the owner */
 
        if (obj_desc->mutex.owner != walk_state) {
-               return (AE_AML_NOT_OWNER);
+               return_ACPI_STATUS (AE_AML_NOT_OWNER);
        }
 
        /*
@@ -205,7 +210,7 @@ acpi_ex_release_mutex (
         * equal to the current sync level
         */
        if (obj_desc->mutex.sync_level > walk_state->current_sync_level) {
-               return (AE_AML_MUTEX_ORDER);
+               return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
        }
 
        /*
@@ -215,7 +220,7 @@ acpi_ex_release_mutex (
        if (obj_desc->mutex.acquisition_depth != 0) {
                /* Just decrement the depth and return */
 
-               return (AE_OK);
+               return_ACPI_STATUS (AE_OK);
        }
 
 
@@ -232,7 +237,7 @@ acpi_ex_release_mutex (
 
        acpi_ex_unlink_mutex (obj_desc);
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -248,12 +253,15 @@ acpi_ex_release_mutex (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_release_all_mutexes (
-       ACPI_OPERAND_OBJECT     *list_head)
+       acpi_operand_object     *list_head)
 {
-       ACPI_OPERAND_OBJECT     *next = list_head->mutex.next;
-       ACPI_OPERAND_OBJECT     *this;
+       acpi_operand_object     *next = list_head->mutex.next;
+       acpi_operand_object     *this;
+
+
+       FUNCTION_ENTRY ();
 
 
        /*
index dd23faa813fd49bcbde619335949043c3e6fc339..95df0aa8123e48e2a14f9db7bb79229099dab55b 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: exnames - interpreter/scanner name load/execute
- *              $Revision: 79 $
+ *              $Revision: 83 $
  *
  *****************************************************************************/
 
@@ -67,13 +67,14 @@ acpi_ex_allocate_name_string (
        NATIVE_CHAR             *name_string;
        u32                      size_needed;
 
+       FUNCTION_TRACE ("Ex_allocate_name_string");
+
 
        /*
         * Allow room for all \ and ^ prefixes, all segments, and a Multi_name_prefix.
         * Also, one byte for the null terminator.
         * This may actually be somewhat longer than needed.
         */
-
        if (prefix_count == (u32) -1) {
                /* Special case for root */
 
@@ -87,11 +88,10 @@ acpi_ex_allocate_name_string (
         * Allocate a buffer for the name.
         * This buffer must be deleted by the caller!
         */
-
-       name_string = acpi_ut_allocate (size_needed);
+       name_string = ACPI_MEM_ALLOCATE (size_needed);
        if (!name_string) {
-               REPORT_ERROR (("Ex_allocate_name_string: name allocation failure\n"));
-               return (NULL);
+               REPORT_ERROR (("Ex_allocate_name_string: Could not allocate size %d\n", size_needed));
+               return_PTR (NULL);
        }
 
        temp_ptr = name_string;
@@ -128,10 +128,9 @@ acpi_ex_allocate_name_string (
         * Terminate string following prefixes. Acpi_ex_name_segment() will
         * append the segment(s)
         */
-
        *temp_ptr = 0;
 
-       return (name_string);
+       return_PTR (name_string);
 }
 
 /*******************************************************************************
@@ -146,17 +145,20 @@ acpi_ex_allocate_name_string (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_name_segment (
        u8                      **in_aml_address,
        NATIVE_CHAR             *name_string)
 {
        u8                      *aml_address = *in_aml_address;
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        u32                     index;
        NATIVE_CHAR             char_buf[5];
 
 
+       FUNCTION_TRACE ("Ex_name_segment");
+
+
        /*
         * If first character is a digit, then we know that we aren't looking at a
         * valid name segment
@@ -164,13 +166,17 @@ acpi_ex_name_segment (
        char_buf[0] = *aml_address;
 
        if ('0' <= char_buf[0] && char_buf[0] <= '9') {
-               return (AE_CTRL_PENDING);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "leading digit: %c\n", char_buf[0]));
+               return_ACPI_STATUS (AE_CTRL_PENDING);
        }
 
+       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]));
        }
 
 
@@ -183,8 +189,14 @@ acpi_ex_name_segment (
 
                if (name_string) {
                        STRCAT (name_string, char_buf);
+                       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+                               "Appended to - %s \n", name_string));
                }
 
+               else {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+                               "No Name string - %s \n", char_buf));
+               }
        }
 
        else if (4 == index) {
@@ -192,6 +204,9 @@ acpi_ex_name_segment (
                 * First character was not a valid name character,
                 * so we are looking at something other than a name.
                 */
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+                       "Leading character is not alpha: %02Xh (not a name)\n",
+                       char_buf[0]));
                status = AE_CTRL_PENDING;
        }
 
@@ -199,10 +214,12 @@ acpi_ex_name_segment (
                /* Segment started with one or more valid characters, but fewer than 4 */
 
                status = AE_AML_BAD_NAME;
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad character %02x in name, at %p\n",
+                       *aml_address, aml_address));
        }
 
        *in_aml_address = aml_address;
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -219,14 +236,14 @@ acpi_ex_name_segment (
  ******************************************************************************/
 
 
-ACPI_STATUS
+acpi_status
 acpi_ex_get_name_string (
-       ACPI_OBJECT_TYPE8       data_type,
+       acpi_object_type8       data_type,
        u8                      *in_aml_address,
        NATIVE_CHAR             **out_name_string,
        u32                     *out_name_length)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        u8                      *aml_address = in_aml_address;
        NATIVE_CHAR             *name_string = NULL;
        u32                     num_segments;
@@ -235,6 +252,9 @@ acpi_ex_get_name_string (
        u8                      has_prefix = FALSE;
 
 
+       FUNCTION_TRACE_PTR ("Ex_get_name_string", aml_address);
+
+
        if (INTERNAL_TYPE_REGION_FIELD == data_type  ||
                INTERNAL_TYPE_BANK_FIELD == data_type    ||
                INTERNAL_TYPE_INDEX_FIELD == data_type) {
@@ -254,12 +274,13 @@ acpi_ex_get_name_string (
                 * Data_type is not a field name.
                 * Examine first character of name for root or parent prefix operators
                 */
-
                switch (*aml_address) {
 
                case AML_ROOT_PREFIX:
 
                        prefix = *aml_address++;
+                       ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Root_prefix: %x\n", prefix));
+
                        /*
                         * Remember that we have a Root_prefix --
                         * see comment in Acpi_ex_allocate_name_string()
@@ -275,6 +296,8 @@ acpi_ex_get_name_string (
 
                        do {
                                prefix = *aml_address++;
+                               ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Parent_prefix: %x\n", prefix));
+
                                ++prefix_count;
 
                        } while (*aml_address == AML_PARENT_PREFIX);
@@ -295,6 +318,8 @@ acpi_ex_get_name_string (
                case AML_DUAL_NAME_PREFIX:
 
                        prefix = *aml_address++;
+                       ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Dual_name_prefix: %x\n", prefix));
+
                        name_string = acpi_ex_allocate_name_string (prefix_count, 2);
                        if (!name_string) {
                                status = AE_NO_MEMORY;
@@ -302,6 +327,7 @@ acpi_ex_get_name_string (
                        }
 
                        /* Indicate that we processed a prefix */
+
                        has_prefix = TRUE;
 
                        status = acpi_ex_name_segment (&aml_address, name_string);
@@ -314,6 +340,8 @@ acpi_ex_get_name_string (
                case AML_MULTI_NAME_PREFIX_OP:
 
                        prefix = *aml_address++;
+                       ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Multi_name_prefix: %x\n", prefix));
+
                        /* Fetch count of segments remaining in name path */
 
                        num_segments = *aml_address++;
@@ -325,6 +353,7 @@ acpi_ex_get_name_string (
                        }
 
                        /* Indicate that we processed a prefix */
+
                        has_prefix = TRUE;
 
                        while (num_segments &&
@@ -339,6 +368,9 @@ acpi_ex_get_name_string (
 
                        /* Null_name valid as of 8-12-98 ASL/AML Grammar Update */
 
+                       if (-1 == prefix_count) {
+                               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Name_seg is \"\\\" followed by NULL\n"));
+                       }
 
                        /* Consume the NULL byte */
 
@@ -381,7 +413,7 @@ acpi_ex_get_name_string (
        *out_name_string = name_string;
        *out_name_length = (u32) (aml_address - in_aml_address);
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
index 20992bb46bc34661de79cd1101a6307134683aff..b2e5135472572e9cccdc157d7e7a81c4b095a3bc 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: exprep - ACPI AML (p-code) execution - field prep utilities
- *              $Revision: 90 $
+ *              $Revision: 95 $
  *
  *****************************************************************************/
 
@@ -43,7 +43,7 @@
  * PARAMETERS:  Access          - Encoded field access bits
  *              Length          - Field length.
  *
- * RETURN:      Field granularity (8, 16, or 32)
+ * RETURN:      Field granularity (8, 16, 32 or 64)
  *
  * DESCRIPTION: Decode the Access_type bits of a field definition.
  *
 static u32
 acpi_ex_decode_field_access_type (
        u32                     access,
-       u16                     length)
+       u16                     length,
+       u32                     *alignment)
 {
+       PROC_NAME ("Ex_decode_field_access_type");
+
 
        switch (access) {
        case ACCESS_ANY_ACC:
 
+               *alignment = 8;
+
                /* Use the length to set the access type */
 
                if (length <= 8) {
@@ -79,24 +84,31 @@ acpi_ex_decode_field_access_type (
                break;
 
        case ACCESS_BYTE_ACC:
+               *alignment = 8;
                return (8);
                break;
 
        case ACCESS_WORD_ACC:
+               *alignment = 16;
                return (16);
                break;
 
        case ACCESS_DWORD_ACC:
+               *alignment = 32;
                return (32);
                break;
 
        case ACCESS_QWORD_ACC:  /* ACPI 2.0 */
+               *alignment = 64;
                return (64);
                break;
 
        default:
                /* Invalid field access type */
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                       "Unknown field access type %x\n",
+                       access));
                return (0);
        }
 }
@@ -120,17 +132,21 @@ acpi_ex_decode_field_access_type (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_prep_common_field_object (
-       ACPI_OPERAND_OBJECT     *obj_desc,
+       acpi_operand_object     *obj_desc,
        u8                      field_flags,
        u32                     field_bit_position,
        u32                     field_bit_length)
 {
        u32                     access_bit_width;
+       u32                     alignment;
        u32                     nearest_byte_address;
 
 
+       FUNCTION_TRACE ("Ex_prep_common_field_object");
+
+
        /*
         * Note: the structure being initialized is the
         * ACPI_COMMON_FIELD_INFO;  No structure fields outside of the common area
@@ -147,13 +163,20 @@ acpi_ex_prep_common_field_object (
 
        obj_desc->common_field.bit_length = (u16) field_bit_length;
 
-       /* Decode the access type so we can compute offsets */
-
+       /*
+        * Decode the access type so we can compute offsets.  The access type gives
+        * two pieces of information - the width of each field access and the
+        * necessary alignment of the access.  For Any_acc, the width used is the
+        * largest necessary/possible in an attempt to access the whole field in one
+        * I/O operation.  However, for Any_acc, the alignment is 8. For all other
+        * access types (Byte, Word, Dword, Qword), the width is the same as the
+        * alignment.
+        */
        access_bit_width = acpi_ex_decode_field_access_type (
                           ((field_flags & ACCESS_TYPE_MASK) >> ACCESS_TYPE_SHIFT),
-                          obj_desc->field.bit_length);
+                          obj_desc->field.bit_length, &alignment);
        if (!access_bit_width) {
-               return (AE_AML_OPERAND_VALUE);
+               return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
        }
 
        /* Setup width (access granularity) fields */
@@ -164,9 +187,10 @@ acpi_ex_prep_common_field_object (
        if (obj_desc->common.type == ACPI_TYPE_BUFFER_FIELD) {
                /*
                 * Buffer_field access can be on any byte boundary, so the
-                * granularity is always 8
+                * alignment is always 8 (regardless of any alignment implied by the
+                * field access type.)
                 */
-               access_bit_width = 8;
+               alignment = 8;
        }
 
 
@@ -177,7 +201,7 @@ acpi_ex_prep_common_field_object (
         */
        nearest_byte_address                      = ROUND_BITS_DOWN_TO_BYTES (field_bit_position);
        obj_desc->common_field.base_byte_offset   = ROUND_DOWN (nearest_byte_address,
-                          DIV_8 (access_bit_width));
+                          DIV_8 (alignment));
 
        /*
         * Start_field_bit_offset is the offset of the first bit of the field within a field datum.
@@ -213,7 +237,7 @@ acpi_ex_prep_common_field_object (
        }
 
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -229,51 +253,62 @@ acpi_ex_prep_common_field_object (
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Construct an ACPI_OPERAND_OBJECT  of type Def_field and
+ * DESCRIPTION: Construct an acpi_operand_object  of type Def_field and
  *              connect it to the parent Node.
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_prep_region_field_value (
-       ACPI_NAMESPACE_NODE     *node,
-       ACPI_HANDLE             region_node,
+       acpi_namespace_node     *node,
+       acpi_handle             region_node,
        u8                      field_flags,
        u32                     field_bit_position,
        u32                     field_bit_length)
 {
-       ACPI_OPERAND_OBJECT     *obj_desc;
+       acpi_operand_object     *obj_desc;
        u32                     type;
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Ex_prep_region_field_value");
 
 
        /* Parameter validation */
 
        if (!region_node) {
-               return (AE_AML_NO_OPERAND);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Region_node\n"));
+               return_ACPI_STATUS (AE_AML_NO_OPERAND);
        }
 
        type = acpi_ns_get_type (region_node);
        if (type != ACPI_TYPE_REGION) {
-               return (AE_AML_OPERAND_TYPE);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Needed Region, found type %X %s\n",
+                       type, acpi_ut_get_type_name (type)));
+               return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
        }
 
        /* Allocate a new object */
 
        obj_desc = acpi_ut_create_internal_object (INTERNAL_TYPE_REGION_FIELD);
        if (!obj_desc) {
-               return (AE_NO_MEMORY);
+               return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
 
        /* Obj_desc and Region valid */
 
+       DUMP_OPERANDS ((acpi_operand_object  **) &node, IMODE_EXECUTE,
+                         "Ex_prep_region_field_value", 1, "case Region_field");
+       DUMP_OPERANDS ((acpi_operand_object  **) &region_node, IMODE_EXECUTE,
+                         "Ex_prep_region_field_value", 1, "case Region_field");
+
        /* Initialize areas of the object that are common to all fields */
 
        status = acpi_ex_prep_common_field_object (obj_desc, field_flags,
                          field_bit_position, field_bit_length);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Initialize areas of the object that are specific to this field type */
@@ -287,13 +322,20 @@ acpi_ex_prep_region_field_value (
 
        /* Debug info */
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Bitoff=%X Off=%X Gran=%X Region %p\n",
+               obj_desc->field.start_field_bit_offset, obj_desc->field.base_byte_offset,
+               obj_desc->field.access_bit_width, obj_desc->field.region_obj));
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "set Named_obj %p (%4.4s) val = %p\n",
+               node, &(node->name), obj_desc));
+
 
        /*
         * Store the constructed descriptor (Obj_desc) into the parent Node,
         * preserving the current type of that Named_obj.
         */
        status = acpi_ns_attach_object (node, obj_desc, (u8) acpi_ns_get_type (node));
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -316,47 +358,58 @@ acpi_ex_prep_region_field_value (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_prep_bank_field_value (
-       ACPI_NAMESPACE_NODE     *node,
-       ACPI_NAMESPACE_NODE     *region_node,
-       ACPI_NAMESPACE_NODE     *bank_register_node,
+       acpi_namespace_node     *node,
+       acpi_namespace_node     *region_node,
+       acpi_namespace_node     *bank_register_node,
        u32                     bank_val,
        u8                      field_flags,
        u32                     field_bit_position,
        u32                     field_bit_length)
 {
-       ACPI_OPERAND_OBJECT     *obj_desc;
+       acpi_operand_object     *obj_desc;
        u32                     type;
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Ex_prep_bank_field_value");
 
 
        /* Parameter validation */
 
        if (!region_node) {
-               return (AE_AML_NO_OPERAND);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Region_node\n"));
+               return_ACPI_STATUS (AE_AML_NO_OPERAND);
        }
 
        type = acpi_ns_get_type (region_node);
        if (type != ACPI_TYPE_REGION) {
-               return (AE_AML_OPERAND_TYPE);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Needed Region, found type %X %s\n",
+                       type, acpi_ut_get_type_name (type)));
+               return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
        }
 
        /* Allocate a new object */
 
        obj_desc = acpi_ut_create_internal_object (INTERNAL_TYPE_BANK_FIELD);
        if (!obj_desc) {
-               return (AE_NO_MEMORY);
+               return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
        /*  Obj_desc and Region valid   */
 
+       DUMP_OPERANDS ((acpi_operand_object  **) &node, IMODE_EXECUTE,
+                         "Ex_prep_bank_field_value", 1, "case Bank_field");
+       DUMP_OPERANDS ((acpi_operand_object  **) &region_node, IMODE_EXECUTE,
+                         "Ex_prep_bank_field_value", 1, "case Bank_field");
+
        /* Initialize areas of the object that are common to all fields */
 
        status = acpi_ex_prep_common_field_object (obj_desc, field_flags,
                          field_bit_position, field_bit_length);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Initialize areas of the object that are specific to this field type */
@@ -372,13 +425,21 @@ acpi_ex_prep_bank_field_value (
 
        /* Debug info */
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Bit_off=%X Off=%X Gran=%X Region %p Bank_reg %p\n",
+               obj_desc->bank_field.start_field_bit_offset, obj_desc->bank_field.base_byte_offset,
+               obj_desc->field.access_bit_width, obj_desc->bank_field.region_obj,
+               obj_desc->bank_field.bank_register_obj));
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Set Named_obj %p (%4.4s) val=%p\n",
+               node, &(node->name), obj_desc));
+
 
        /*
         * Store the constructed descriptor (Obj_desc) into the parent Node,
         * preserving the current type of that Named_obj.
         */
        status = acpi_ns_attach_object (node, obj_desc, (u8) acpi_ns_get_type (node));
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -395,35 +456,39 @@ acpi_ex_prep_bank_field_value (
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Construct an ACPI_OPERAND_OBJECT  of type Index_field and
+ * DESCRIPTION: Construct an acpi_operand_object  of type Index_field and
  *              connect it to the parent Node.
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_prep_index_field_value (
-       ACPI_NAMESPACE_NODE     *node,
-       ACPI_NAMESPACE_NODE     *index_reg,
-       ACPI_NAMESPACE_NODE     *data_reg,
+       acpi_namespace_node     *node,
+       acpi_namespace_node     *index_reg,
+       acpi_namespace_node     *data_reg,
        u8                      field_flags,
        u32                     field_bit_position,
        u32                     field_bit_length)
 {
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_STATUS             status;
+       acpi_operand_object     *obj_desc;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Ex_prep_index_field_value");
 
 
        /* Parameter validation */
 
        if (!index_reg || !data_reg) {
-               return (AE_AML_NO_OPERAND);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null handle\n"));
+               return_ACPI_STATUS (AE_AML_NO_OPERAND);
        }
 
        /* Allocate a new object descriptor */
 
        obj_desc = acpi_ut_create_internal_object (INTERNAL_TYPE_INDEX_FIELD);
        if (!obj_desc) {
-               return (AE_NO_MEMORY);
+               return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
        /* Initialize areas of the object that are common to all fields */
@@ -431,7 +496,7 @@ acpi_ex_prep_index_field_value (
        status = acpi_ex_prep_common_field_object (obj_desc, field_flags,
                          field_bit_position, field_bit_length);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Initialize areas of the object that are specific to this field type */
@@ -448,12 +513,20 @@ acpi_ex_prep_index_field_value (
 
        /* Debug info */
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "bitoff=%X off=%X gran=%X Index %p Data %p\n",
+               obj_desc->index_field.start_field_bit_offset, obj_desc->index_field.base_byte_offset,
+               obj_desc->field.access_bit_width, obj_desc->index_field.index_obj,
+               obj_desc->index_field.data_obj));
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "set Named_obj %p (%4.4s) val = %p\n",
+               node, &(node->name), obj_desc));
+
 
        /*
         * Store the constructed descriptor (Obj_desc) into the parent Node,
         * preserving the current type of that Named_obj.
         */
        status = acpi_ns_attach_object (node, obj_desc, (u8) acpi_ns_get_type (node));
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
index 695d39c42b7ec6dd6f44124925b8228102137091..da346d7d63438b7ba59cb5ed7cad80866dd817e7 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: exregion - ACPI default Op_region (address space) handlers
- *              $Revision: 48 $
+ *              $Revision: 58 $
  *
  *****************************************************************************/
 
@@ -55,7 +55,7 @@
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_system_memory_space_handler (
        u32                     function,
        ACPI_PHYSICAL_ADDRESS   address,
@@ -64,12 +64,15 @@ acpi_ex_system_memory_space_handler (
        void                    *handler_context,
        void                    *region_context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        void                    *logical_addr_ptr = NULL;
-       ACPI_MEM_SPACE_CONTEXT  *mem_info = region_context;
+       acpi_mem_space_context  *mem_info = region_context;
        u32                     length;
 
 
+       FUNCTION_TRACE ("Ex_system_memory_space_handler");
+
+
        /* Validate and translate the bit width */
 
        switch (bit_width) {
@@ -86,7 +89,9 @@ acpi_ex_system_memory_space_handler (
                break;
 
        default:
-               return (AE_AML_OPERAND_VALUE);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid System_memory width %d\n",
+                       bit_width));
+               return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
                break;
        }
 
@@ -96,15 +101,13 @@ acpi_ex_system_memory_space_handler (
         * Is 1) Address below the current mapping? OR
         *    2) Address beyond the current mapping?
         */
-
        if ((address < mem_info->mapped_physical_address) ||
-               (((ACPI_INTEGER) address + length) >
-                       ((ACPI_INTEGER) mem_info->mapped_physical_address + mem_info->mapped_length))) {
+               (((acpi_integer) address + length) >
+                       ((acpi_integer) mem_info->mapped_physical_address + mem_info->mapped_length))) {
                /*
                 * The request cannot be resolved by the current memory mapping;
                 * Delete the existing mapping and create a new one.
                 */
-
                if (mem_info->mapped_length) {
                        /* Valid mapping, delete it */
 
@@ -119,10 +122,10 @@ acpi_ex_system_memory_space_handler (
                status = acpi_os_map_memory (address, SYSMEM_REGION_WINDOW_SIZE,
                                  (void **) &mem_info->mapped_logical_address);
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
 
-               /* TBD: should these pointers go to 64-bit in all cases ? */
+               /* Save the physical address and mapping size */
 
                mem_info->mapped_physical_address = address;
                mem_info->mapped_length = SYSMEM_REGION_WINDOW_SIZE;
@@ -137,9 +140,13 @@ acpi_ex_system_memory_space_handler (
        /* TBD: should these pointers go to 64-bit in all cases ? */
 
        logical_addr_ptr = mem_info->mapped_logical_address +
-                         ((ACPI_INTEGER) address - (ACPI_INTEGER) mem_info->mapped_physical_address);
+                         ((acpi_integer) address - (acpi_integer) mem_info->mapped_physical_address);
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+               "IO %d (%d width) Address=%8.8lX%8.8lX\n", function, bit_width,
+               HIDWORD (address), LODWORD (address)));
 
-       /* Perform the memory read or write */
+   /* Perform the memory read or write */
 
        switch (function) {
 
@@ -186,7 +193,7 @@ acpi_ex_system_memory_space_handler (
                break;
        }
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -208,7 +215,7 @@ acpi_ex_system_memory_space_handler (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_system_io_space_handler (
        u32                     function,
        ACPI_PHYSICAL_ADDRESS   address,
@@ -217,57 +224,30 @@ acpi_ex_system_io_space_handler (
        void                    *handler_context,
        void                    *region_context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
 
 
-       /* Decode the function parameter */
-
-       switch (function) {
-
-       case ACPI_READ_ADR_SPACE:
+       FUNCTION_TRACE ("Ex_system_io_space_handler");
 
-               switch (bit_width) {
-               /* I/O Port width */
 
-               case 8:
-                       *value = (u32) acpi_os_in8 ((ACPI_IO_ADDRESS) address);
-                       break;
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+               "IO %d (%d width) Address=%8.8lX%8.8lX\n", function, bit_width,
+               HIDWORD (address), LODWORD (address)));
 
-               case 16:
-                       *value = (u32) acpi_os_in16 ((ACPI_IO_ADDRESS) address);
-                       break;
+       /* Decode the function parameter */
 
-               case 32:
-                       *value = acpi_os_in32 ((ACPI_IO_ADDRESS) address);
-                       break;
+       switch (function) {
 
-               default:
-                       status = AE_AML_OPERAND_VALUE;
-               }
+       case ACPI_READ_ADR_SPACE:
 
+               *value = 0;
+               status = acpi_os_read_port ((ACPI_IO_ADDRESS) address, value, bit_width);
                break;
 
 
        case ACPI_WRITE_ADR_SPACE:
 
-               switch (bit_width) {
-               /* I/O Port width */
-               case 8:
-                       acpi_os_out8 ((ACPI_IO_ADDRESS) address, (u8) *value);
-                       break;
-
-               case 16:
-                       acpi_os_out16 ((ACPI_IO_ADDRESS) address, (u16) *value);
-                       break;
-
-               case 32:
-                       acpi_os_out32 ((ACPI_IO_ADDRESS) address, *value);
-                       break;
-
-               default:
-                       status = AE_AML_OPERAND_VALUE;
-               }
-
+               status = acpi_os_write_port ((ACPI_IO_ADDRESS) address, *value, bit_width);
                break;
 
 
@@ -276,9 +256,10 @@ acpi_ex_system_io_space_handler (
                break;
        }
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
+
 /*******************************************************************************
  *
  * FUNCTION:    Acpi_ex_pci_config_space_handler
@@ -297,7 +278,7 @@ acpi_ex_system_io_space_handler (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_pci_config_space_handler (
        u32                     function,
        ACPI_PHYSICAL_ADDRESS   address,
@@ -306,94 +287,46 @@ acpi_ex_pci_config_space_handler (
        void                    *handler_context,
        void                    *region_context)
 {
-       ACPI_STATUS             status = AE_OK;
-       u32                     pci_bus;
-       u32                     dev_func;
-       u8                      pci_reg;
-       ACPI_PCI_SPACE_CONTEXT  *PCIcontext;
+       acpi_status             status = AE_OK;
+       acpi_pci_id             *pci_id;
+       u16                     pci_register;
+
+
+       FUNCTION_TRACE ("Ex_pci_config_space_handler");
 
 
        /*
         *  The arguments to Acpi_os(Read|Write)Pci_cfg(Byte|Word|Dword) are:
         *
-        *  Seg_bus - 0xSSSSBBBB    - SSSS is the PCI bus segment
-        *                            BBBB is the PCI bus number
-        *
-        *  Dev_func - 0xDDDDFFFF   - DDDD is the PCI device number
-        *                            FFFF is the PCI device function number
-        *
-        *  Reg_num - Config space register must be < 40h
+        *  Pci_segment is the PCI bus segment range 0-31
+        *  Pci_bus     is the PCI bus number range 0-255
+        *  Pci_device  is the PCI device number range 0-31
+        *  Pci_function is the PCI device function number
+        *  Pci_register is the Config space register range 0-255 bytes
         *
-        *  Value - input value for write, output for read
+        *  Value - input value for write, output address for read
         *
         */
+       pci_id      = (acpi_pci_id *) region_context;
+       pci_register = (u16) address;
 
-       PCIcontext = (ACPI_PCI_SPACE_CONTEXT *) region_context;
-
-       pci_bus = LOWORD (PCIcontext->seg) << 16;
-       pci_bus |= LOWORD (PCIcontext->bus);
-
-       dev_func = PCIcontext->dev_func;
-
-       pci_reg = (u8) address;
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+               "IO %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n",
+               function, bit_width, pci_id->segment, pci_id->bus, pci_id->device,
+               pci_id->function, pci_register));
 
        switch (function) {
 
        case ACPI_READ_ADR_SPACE:
 
-               *value  = 0;
-
-               switch (bit_width) {
-               /* PCI Register width */
-
-               case 8:
-                       status = acpi_os_read_pci_cfg_byte (pci_bus, dev_func, pci_reg,
-                                          (u8 *) value);
-                       break;
-
-               case 16:
-                       status = acpi_os_read_pci_cfg_word (pci_bus, dev_func, pci_reg,
-                                          (u16 *) value);
-                       break;
-
-               case 32:
-                       status = acpi_os_read_pci_cfg_dword (pci_bus, dev_func, pci_reg,
-                                          value);
-                       break;
-
-               default:
-                       status = AE_AML_OPERAND_VALUE;
-
-               } /* Switch bit_width */
-
+               *value = 0;
+               status = acpi_os_read_pci_configuration (pci_id, pci_register, value, bit_width);
                break;
 
 
        case ACPI_WRITE_ADR_SPACE:
 
-               switch (bit_width) {
-               /* PCI Register width */
-
-               case 8:
-                       status = acpi_os_write_pci_cfg_byte (pci_bus, dev_func, pci_reg,
-                                        *(u8 *) value);
-                       break;
-
-               case 16:
-                       status = acpi_os_write_pci_cfg_word (pci_bus, dev_func, pci_reg,
-                                        *(u16 *) value);
-                       break;
-
-               case 32:
-                       status = acpi_os_write_pci_cfg_dword (pci_bus, dev_func, pci_reg,
-                                        *value);
-                       break;
-
-               default:
-                       status = AE_AML_OPERAND_VALUE;
-
-               } /* Switch bit_width */
-
+               status = acpi_os_write_pci_configuration (pci_id, pci_register, *value, bit_width);
                break;
 
 
@@ -401,9 +334,8 @@ acpi_ex_pci_config_space_handler (
 
                status = AE_BAD_PARAMETER;
                break;
-
        }
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
index a5b5f7213b748dec6b55381f6c49a82fa3fed5b4..a8f4b80140cb9eb7623aa2f2fa67fb9bf5d746e5 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: exresnte - AML Interpreter object resolution
- *              $Revision: 37 $
+ *              $Revision: 41 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_resolve_node_to_value (
-       ACPI_NAMESPACE_NODE     **stack_ptr,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_namespace_node     **stack_ptr,
+       acpi_walk_state         *walk_state)
 
 {
-       ACPI_STATUS             status = AE_OK;
-       ACPI_OPERAND_OBJECT     *val_desc;
-       ACPI_OPERAND_OBJECT     *obj_desc = NULL;
-       ACPI_NAMESPACE_NODE     *node;
-       u8                      *aml_pointer = NULL;
-       ACPI_OBJECT_TYPE8       entry_type;
-       ACPI_INTEGER            temp_val;
-       u8                      attached_aml_pointer = FALSE;
-       u8                      aml_opcode = 0;
+       acpi_status             status = AE_OK;
+       acpi_operand_object     *val_desc;
+       acpi_operand_object     *obj_desc = NULL;
+       acpi_namespace_node     *node;
+       acpi_object_type8       entry_type;
+       acpi_integer            temp_val;
+
+
+       FUNCTION_TRACE ("Ex_resolve_node_to_value");
 
 
        /*
-        * The stack pointer points to a ACPI_NAMESPACE_NODE (Node).  Get the
+        * The stack pointer points to a acpi_namespace_node (Node).  Get the
         * object that is attached to the Node.
         */
-
        node      = *stack_ptr;
        val_desc  = acpi_ns_get_attached_object (node);
-       entry_type = acpi_ns_get_type ((ACPI_HANDLE) node);
+       entry_type = acpi_ns_get_type ((acpi_handle) node);
 
-       /*
-        * The Val_desc attached to the Node can be either:
-        * 1) An internal ACPI object
-        * 2) A pointer into the AML stream (into one of the ACPI system tables)
-        */
-
-       if (acpi_tb_system_table_pointer (val_desc)) {
-               /* CAN THIS EVERY HAPPEN NOW?  TBD!!! */
-
-               attached_aml_pointer = TRUE;
-               aml_opcode = *((u8 *) val_desc);
-               aml_pointer = ((u8 *) val_desc) + 1;
-
-       }
+       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Entry=%p Val_desc=%p Type=%X\n",
+                node, val_desc, entry_type));
 
 
        /*
-        * Several Entry_types do not require further processing, so
-        *  we will return immediately
-        */
-       /* Devices rarely have an attached object, return the Node
-        *  and Method locals and arguments have a pseudo-Node
+        * Several object types require no further processing:
+        * 1) Devices rarely have an attached object, return the Node
+        * 2) Method locals and arguments have a pseudo-Node
         */
        if (entry_type == ACPI_TYPE_DEVICE ||
                (node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) {
-               return (AE_OK);
+               return_ACPI_STATUS (AE_OK);
        }
 
        if (!val_desc) {
-               return (AE_AML_NO_OPERAND);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object attached to node %p\n",
+                       node));
+               return_ACPI_STATUS (AE_AML_NO_OPERAND);
        }
 
        /*
@@ -130,18 +117,10 @@ acpi_ex_resolve_node_to_value (
 
        case ACPI_TYPE_PACKAGE:
 
-               if (attached_aml_pointer) {
-                       /*
-                        * This means that the package initialization is not parsed
-                        * -- should not happen
-                        */
-                       return (AE_NOT_IMPLEMENTED);
-               }
-
-               /* Val_desc is an internal object in all cases by the time we get here */
-
                if (ACPI_TYPE_PACKAGE != val_desc->common.type) {
-                       return (AE_AML_OPERAND_TYPE);
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Package, type %s\n",
+                               acpi_ut_get_type_name (val_desc->common.type)));
+                       return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
                }
 
                /* Return an additional reference to the object */
@@ -153,18 +132,10 @@ acpi_ex_resolve_node_to_value (
 
        case ACPI_TYPE_BUFFER:
 
-               if (attached_aml_pointer) {
-                       /*
-                        * This means that the buffer initialization is not parsed
-                        * -- should not happen
-                        */
-                       return (AE_NOT_IMPLEMENTED);
-               }
-
-               /* Val_desc is an internal object in all cases by the time we get here */
-
                if (ACPI_TYPE_BUFFER != val_desc->common.type) {
-                       return (AE_AML_OPERAND_TYPE);
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Buffer, type %s\n",
+                               acpi_ut_get_type_name (val_desc->common.type)));
+                       return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
                }
 
                /* Return an additional reference to the object */
@@ -176,43 +147,25 @@ acpi_ex_resolve_node_to_value (
 
        case ACPI_TYPE_STRING:
 
-               if (attached_aml_pointer) {
-                       /* Allocate a new string object */
-
-                       obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_STRING);
-                       if (!obj_desc) {
-                               return (AE_NO_MEMORY);
-                       }
-
-                       /* Init the internal object */
-
-                       obj_desc->string.pointer = (NATIVE_CHAR *) aml_pointer;
-                       obj_desc->string.length = STRLEN (obj_desc->string.pointer);
+               if (ACPI_TYPE_STRING != val_desc->common.type) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a String, type %s\n",
+                               acpi_ut_get_type_name (val_desc->common.type)));
+                       return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
                }
 
-               else {
-                       if (ACPI_TYPE_STRING != val_desc->common.type) {
-                               return (AE_AML_OPERAND_TYPE);
-                       }
-
-                       /* Return an additional reference to the object */
-
-                       obj_desc = val_desc;
-                       acpi_ut_add_reference (obj_desc);
-               }
+               /* Return an additional reference to the object */
 
+               obj_desc = val_desc;
+               acpi_ut_add_reference (obj_desc);
                break;
 
 
        case ACPI_TYPE_INTEGER:
 
-               /*
-                * The Node has an attached internal object, make sure that it's a
-                * number
-                */
-
                if (ACPI_TYPE_INTEGER != val_desc->common.type) {
-                       return (AE_AML_OPERAND_TYPE);
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Integer, type %s\n",
+                               acpi_ut_get_type_name (val_desc->common.type)));
+                       return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
                }
 
                /* Return an additional reference to the object */
@@ -227,6 +180,9 @@ acpi_ex_resolve_node_to_value (
        case INTERNAL_TYPE_BANK_FIELD:
        case INTERNAL_TYPE_INDEX_FIELD:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Field_read Node=%p Val_desc=%p Type=%X\n",
+                       node, val_desc, entry_type));
+
                status = acpi_ex_read_data_from_field (val_desc, &obj_desc);
                break;
 
@@ -234,7 +190,6 @@ acpi_ex_resolve_node_to_value (
        /*
         * For these objects, just return the object attached to the Node
         */
-
        case ACPI_TYPE_MUTEX:
        case ACPI_TYPE_METHOD:
        case ACPI_TYPE_POWER:
@@ -243,7 +198,6 @@ acpi_ex_resolve_node_to_value (
        case ACPI_TYPE_EVENT:
        case ACPI_TYPE_REGION:
 
-
                /* Return an additional reference to the object */
 
                obj_desc = val_desc;
@@ -255,7 +209,10 @@ acpi_ex_resolve_node_to_value (
 
        case ACPI_TYPE_ANY:
 
-               return (AE_AML_OPERAND_TYPE);  /* Cannot be AE_TYPE */
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Untyped entry %p, no attached object!\n",
+                       node));
+
+               return_ACPI_STATUS (AE_AML_OPERAND_TYPE);  /* Cannot be AE_TYPE */
                break;
 
 
@@ -282,16 +239,24 @@ acpi_ex_resolve_node_to_value (
                        temp_val = ACPI_INTEGER_MAX;
                        break;
 
+               case AML_REVISION_OP:
+
+                       temp_val = ACPI_CA_VERSION;
+                       break;
+
                default:
 
-                       return (AE_AML_BAD_OPCODE);
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported reference opcode %X\n",
+                               val_desc->reference.opcode));
+
+                       return_ACPI_STATUS (AE_AML_BAD_OPCODE);
                }
 
                /* Create object for result */
 
                obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
                if (!obj_desc) {
-                       return (AE_NO_MEMORY);
+                       return_ACPI_STATUS (AE_NO_MEMORY);
                }
 
                obj_desc->integer.value = temp_val;
@@ -306,7 +271,10 @@ acpi_ex_resolve_node_to_value (
 
        default:
 
-               return (AE_AML_OPERAND_TYPE);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Node %p - Unknown object type %X\n",
+                       node, entry_type));
+
+               return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 
        } /* switch (Entry_type) */
 
@@ -314,7 +282,7 @@ acpi_ex_resolve_node_to_value (
        /* Put the object descriptor on the stack */
 
        *stack_ptr = (void *) obj_desc;
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
index 275c31767da2cc01ad74d8940a3fef94c01b6379..077c617ae1c6f2471b70ef72708b65cfa6194370 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: exresolv - AML Interpreter object resolution
- *              $Revision: 95 $
+ *              $Revision: 99 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_get_buffer_field_value (
-       ACPI_OPERAND_OBJECT     *obj_desc,
-       ACPI_OPERAND_OBJECT     *result_desc)
+       acpi_operand_object     *obj_desc,
+       acpi_operand_object     *result_desc)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
        u32                     mask;
        u8                      *location;
 
 
+       FUNCTION_TRACE ("Ex_get_buffer_field_value");
+
+
        /*
         * Parameter validation
         */
        if (!obj_desc) {
-               return (AE_AML_NO_OPERAND);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null field pointer\n"));
+               return_ACPI_STATUS (AE_AML_NO_OPERAND);
        }
 
        if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) {
                status = acpi_ds_get_buffer_field_arguments (obj_desc);
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
        }
 
        if (!obj_desc->buffer_field.buffer_obj) {
-               return (AE_AML_INTERNAL);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null container pointer\n"));
+               return_ACPI_STATUS (AE_AML_INTERNAL);
        }
 
        if (ACPI_TYPE_BUFFER != obj_desc->buffer_field.buffer_obj->common.type) {
-               return (AE_AML_OPERAND_TYPE);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - container is not a Buffer\n"));
+               return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
        }
 
        if (!result_desc) {
-               return (AE_AML_INTERNAL);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null result pointer\n"));
+               return_ACPI_STATUS (AE_AML_INTERNAL);
        }
 
 
@@ -123,7 +130,15 @@ acpi_ex_get_buffer_field_value (
        result_desc->integer.value =
                (result_desc->integer.value >> obj_desc->buffer_field.start_field_bit_offset) & mask;
 
-       return (AE_OK);
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+               "** Read from buffer %p byte %ld bit %d width %d addr %p mask %08lx val %08lx\n",
+               obj_desc->buffer_field.buffer_obj->buffer.pointer,
+               obj_desc->buffer_field.base_byte_offset,
+               obj_desc->buffer_field.start_field_bit_offset,
+               obj_desc->buffer_field.bit_length,
+               location, mask, result_desc->integer.value));
+
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -132,8 +147,8 @@ acpi_ex_get_buffer_field_value (
  * FUNCTION:    Acpi_ex_resolve_to_value
  *
  * PARAMETERS:  **Stack_ptr         - Points to entry on Obj_stack, which can
- *                                    be either an (ACPI_OPERAND_OBJECT *)
- *                                    or an ACPI_HANDLE.
+ *                                    be either an (acpi_operand_object *)
+ *                                    or an acpi_handle.
  *              Walk_state          - Current method state
  *
  * RETURN:      Status
@@ -142,28 +157,32 @@ acpi_ex_get_buffer_field_value (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_resolve_to_value (
-       ACPI_OPERAND_OBJECT     **stack_ptr,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_operand_object     **stack_ptr,
+       acpi_walk_state         *walk_state)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE_PTR ("Ex_resolve_to_value", stack_ptr);
 
 
        if (!stack_ptr || !*stack_ptr) {
-               return (AE_AML_NO_OPERAND);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null pointer\n"));
+               return_ACPI_STATUS (AE_AML_NO_OPERAND);
        }
 
 
        /*
         * The entity pointed to by the Stack_ptr can be either
-        * 1) A valid ACPI_OPERAND_OBJECT, or
-        * 2) A ACPI_NAMESPACE_NODE (Named_obj)
+        * 1) A valid acpi_operand_object, or
+        * 2) A acpi_namespace_node (Named_obj)
         */
        if (VALID_DESCRIPTOR_TYPE (*stack_ptr, ACPI_DESC_TYPE_INTERNAL)) {
                status = acpi_ex_resolve_object_to_value (stack_ptr, walk_state);
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
        }
 
@@ -172,15 +191,16 @@ acpi_ex_resolve_to_value (
         * was called (i.e., we can't use an _else_ here.)
         */
        if (VALID_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_namespace_node **) stack_ptr,
                                  walk_state);
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
        }
 
 
-       return (AE_OK);
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Resolved object %p\n", *stack_ptr));
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -199,21 +219,24 @@ acpi_ex_resolve_to_value (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_resolve_object_to_value (
-       ACPI_OPERAND_OBJECT     **stack_ptr,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_operand_object     **stack_ptr,
+       acpi_walk_state         *walk_state)
 {
-       ACPI_STATUS             status = AE_OK;
-       ACPI_OPERAND_OBJECT     *stack_desc;
+       acpi_status             status = AE_OK;
+       acpi_operand_object     *stack_desc;
        void                    *temp_node;
-       ACPI_OPERAND_OBJECT     *obj_desc;
+       acpi_operand_object     *obj_desc;
        u16                     opcode;
 
 
+       FUNCTION_TRACE ("Ex_resolve_object_to_value");
+
+
        stack_desc = *stack_ptr;
 
-       /* This is an ACPI_OPERAND_OBJECT  */
+       /* This is an acpi_operand_object  */
 
        switch (stack_desc->common.type) {
 
@@ -251,7 +274,7 @@ acpi_ex_resolve_object_to_value (
                        status = acpi_ds_method_data_get_value (opcode,
                                          stack_desc->reference.offset, walk_state, &obj_desc);
                        if (ACPI_FAILURE (status)) {
-                               return (status);
+                               return_ACPI_STATUS (status);
                        }
 
                        /*
@@ -261,35 +284,55 @@ acpi_ex_resolve_object_to_value (
                        acpi_ut_remove_reference (stack_desc);
                        *stack_ptr = obj_desc;
 
+                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "[Arg/Local %d] Value_obj is %p\n",
+                               stack_desc->reference.offset, obj_desc));
                        break;
 
 
                /*
-                * TBD: [Restructure] These next three opcodes change the type of
-                * the object, which is actually a no-no.
+                * For constants, we must change the reference/constant object
+                * to a real integer object
                 */
                case AML_ZERO_OP:
+               case AML_ONE_OP:
+               case AML_ONES_OP:
+               case AML_REVISION_OP:
 
-                       stack_desc->common.type = (u8) ACPI_TYPE_INTEGER;
-                       stack_desc->integer.value = 0;
-                       break;
+                       /* Create a new integer object */
 
+                       obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+                       if (!obj_desc) {
+                               return_ACPI_STATUS (AE_NO_MEMORY);
+                       }
 
-               case AML_ONE_OP:
+                       switch (opcode) {
+                       case AML_ZERO_OP:
+                               obj_desc->integer.value = 0;
+                               break;
 
-                       stack_desc->common.type = (u8) ACPI_TYPE_INTEGER;
-                       stack_desc->integer.value = 1;
-                       break;
+                       case AML_ONE_OP:
+                               obj_desc->integer.value = 1;
+                               break;
 
+                       case AML_ONES_OP:
+                               obj_desc->integer.value = ACPI_INTEGER_MAX;
 
-               case AML_ONES_OP:
+                               /* Truncate value if we are executing from a 32-bit ACPI table */
 
-                       stack_desc->common.type = (u8) ACPI_TYPE_INTEGER;
-                       stack_desc->integer.value = ACPI_INTEGER_MAX;
+                               acpi_ex_truncate_for32bit_table (obj_desc, walk_state);
+                               break;
 
-                       /* Truncate value if we are executing from a 32-bit ACPI table */
+                       case AML_REVISION_OP:
+                               obj_desc->integer.value = ACPI_CA_VERSION;
+                               break;
+                       }
 
-                       acpi_ex_truncate_for32bit_table (stack_desc, walk_state);
+                       /*
+                        * Remove a reference from the original reference object
+                        * and put the new object in its place
+                        */
+                       acpi_ut_remove_reference (stack_desc);
+                       *stack_ptr = obj_desc;
                        break;
 
 
@@ -320,6 +363,9 @@ acpi_ex_resolve_object_to_value (
                                         * A NULL object descriptor means an unitialized element of
                                         * the package, can't dereference it
                                         */
+                                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                                               "Attempt to deref an Index to NULL pkg element Idx=%p\n",
+                                               stack_desc));
                                        status = AE_AML_UNINITIALIZED_ELEMENT;
                                }
                                break;
@@ -327,6 +373,9 @@ acpi_ex_resolve_object_to_value (
                        default:
                                /* Invalid reference object */
 
+                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                                       "Unknown Target_type %X in Index/Reference obj %p\n",
+                                       stack_desc->reference.target_type, stack_desc));
                                status = AE_AML_INTERNAL;
                                break;
                        }
@@ -342,6 +391,8 @@ acpi_ex_resolve_object_to_value (
 
                default:
 
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Reference object subtype %02X in %p\n",
+                               opcode, stack_desc));
                        status = AE_AML_INTERNAL;
                        break;
 
@@ -354,7 +405,7 @@ acpi_ex_resolve_object_to_value (
 
                obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_ANY);
                if (!obj_desc) {
-                       return (AE_NO_MEMORY);
+                       return_ACPI_STATUS (AE_NO_MEMORY);
                }
 
                status = acpi_ex_get_buffer_field_value (stack_desc, obj_desc);
@@ -371,7 +422,7 @@ acpi_ex_resolve_object_to_value (
 
                obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_ANY);
                if (!obj_desc) {
-                       return (AE_NO_MEMORY);
+                       return_ACPI_STATUS (AE_NO_MEMORY);
                }
 
                /* TBD: WRONG! */
@@ -395,7 +446,7 @@ acpi_ex_resolve_object_to_value (
        }   /* switch (Stack_desc->Common.Type) */
 
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
index b9d45a86061cebbd332887600e6bb801ccd3d795..60965f6388c571d583df8362e22d4fbfe113c11d 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: exresop - AML Interpreter operand/object resolution
- *              $Revision: 29 $
+ *              $Revision: 38 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_check_object_type (
-       ACPI_OBJECT_TYPE        type_needed,
-       ACPI_OBJECT_TYPE        this_type,
+       acpi_object_type        type_needed,
+       acpi_object_type        this_type,
        void                    *object)
 {
+       PROC_NAME ("Ex_check_object_type");
 
 
        if (type_needed == ACPI_TYPE_ANY) {
@@ -68,6 +69,11 @@ acpi_ex_check_object_type (
        }
 
        if (type_needed != this_type) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+                       "Needed [%s], found [%s] %p\n",
+                       acpi_ut_get_type_name (type_needed),
+                       acpi_ut_get_type_name (this_type), object));
+
                return (AE_AML_OPERAND_TYPE);
        }
 
@@ -94,33 +100,42 @@ acpi_ex_check_object_type (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_resolve_operands (
        u16                     opcode,
-       ACPI_OPERAND_OBJECT     **stack_ptr,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_operand_object     **stack_ptr,
+       acpi_walk_state         *walk_state)
 {
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_STATUS             status = AE_OK;
+       acpi_operand_object     *obj_desc;
+       acpi_status             status = AE_OK;
        u8                      object_type;
        void                    *temp_node;
        u32                     arg_types;
-       ACPI_OPCODE_INFO        *op_info;
+       const acpi_opcode_info  *op_info;
        u32                     this_arg_type;
-       ACPI_OBJECT_TYPE        type_needed;
+       acpi_object_type        type_needed;
+
+
+       FUNCTION_TRACE_U32 ("Ex_resolve_operands", opcode);
 
 
        op_info = acpi_ps_get_opcode_info (opcode);
        if (ACPI_GET_OP_TYPE (op_info) != ACPI_OP_TYPE_OPCODE) {
-               return (AE_AML_BAD_OPCODE);
+               return_ACPI_STATUS (AE_AML_BAD_OPCODE);
        }
 
 
        arg_types = op_info->runtime_args;
        if (arg_types == ARGI_INVALID_OPCODE) {
-               return (AE_AML_INTERNAL);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - %X is not a valid AML opcode\n",
+                       opcode));
+
+               return_ACPI_STATUS (AE_AML_INTERNAL);
        }
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode %X Operand_types=%X \n",
+               opcode, arg_types));
+
 
        /*
         * Normal exit is with (Arg_types == 0) at end of argument list.
@@ -129,10 +144,12 @@ acpi_ex_resolve_operands (
         * to) the required type; if stack underflows; or upon
         * finding a NULL stack entry (which should not happen).
         */
-
        while (GET_CURRENT_ARG_TYPE (arg_types)) {
                if (!stack_ptr || !*stack_ptr) {
-                       return (AE_AML_INTERNAL);
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null stack entry at %X\n",
+                               stack_ptr));
+
+                       return_ACPI_STATUS (AE_AML_INTERNAL);
                }
 
                /* Extract useful items */
@@ -144,7 +161,7 @@ acpi_ex_resolve_operands (
                if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) {
                        /* Node */
 
-                       object_type = ((ACPI_NAMESPACE_NODE *) obj_desc)->type;
+                       object_type = ((acpi_namespace_node *) obj_desc)->type;
                }
 
                else if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_INTERNAL)) {
@@ -152,20 +169,22 @@ acpi_ex_resolve_operands (
 
                        object_type = obj_desc->common.type;
 
-                       /* Check for bad ACPI_OBJECT_TYPE */
+                       /* Check for bad acpi_object_type */
 
                        if (!acpi_ex_validate_object_type (object_type)) {
-                               return (AE_AML_OPERAND_TYPE);
+                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad operand object type [%X]\n",
+                                       object_type));
+
+                               return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
                        }
 
                        if (object_type == (u8) INTERNAL_TYPE_REFERENCE) {
                                /*
                                 * Decode the Reference
                                 */
-
                                op_info = acpi_ps_get_opcode_info (opcode);
                                if (ACPI_GET_OP_TYPE (op_info) != ACPI_OP_TYPE_OPCODE) {
-                                       return (AE_AML_BAD_OPCODE);
+                                       return_ACPI_STATUS (AE_AML_BAD_OPCODE);
                                }
 
 
@@ -178,11 +197,18 @@ acpi_ex_resolve_operands (
                                case AML_INDEX_OP:
                                case AML_ARG_OP:
                                case AML_LOCAL_OP:
+                               case AML_REVISION_OP:
 
+                                       DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+                                               "Reference Opcode: %s\n", op_info->name)));
                                        break;
 
                                default:
-                                       return (AE_AML_OPERAND_TYPE);
+                                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+                                               "Reference Opcode: Unknown [%02x]\n",
+                                               obj_desc->reference.opcode));
+
+                                       return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
                                        break;
                                }
                        }
@@ -191,14 +217,17 @@ acpi_ex_resolve_operands (
                else {
                        /* Invalid descriptor */
 
-                       return (AE_AML_OPERAND_TYPE);
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                               "Bad descriptor type %X in Obj %p\n",
+                               obj_desc->common.data_type, obj_desc));
+
+                       return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
                }
 
 
                /*
                 * Get one argument type, point to the next
                 */
-
                this_arg_type = GET_CURRENT_ARG_TYPE (arg_types);
                INCREMENT_ARG_LIST (arg_types);
 
@@ -207,7 +236,6 @@ acpi_ex_resolve_operands (
                 * Handle cases where the object does not need to be
                 * resolved to a value
                 */
-
                switch (this_arg_type) {
 
                case ARGI_REFERENCE:            /* References */
@@ -227,7 +255,7 @@ acpi_ex_resolve_operands (
                        status = acpi_ex_check_object_type (INTERNAL_TYPE_REFERENCE,
                                          object_type, obj_desc);
                        if (ACPI_FAILURE (status)) {
-                               return (status);
+                               return_ACPI_STATUS (status);
                        }
 
 
@@ -236,7 +264,6 @@ acpi_ex_resolve_operands (
                                 * Convert an indirect name ptr to direct name ptr and put
                                 * it on the stack
                                 */
-
                                temp_node = obj_desc->reference.object;
                                acpi_ut_remove_reference (obj_desc);
                                (*stack_ptr) = temp_node;
@@ -254,7 +281,6 @@ acpi_ex_resolve_operands (
                         * Instead, we just want to store the reference object.
                         * -- All others must be resolved below.
                         */
-
                        if ((opcode == AML_STORE_OP) &&
                                ((*stack_ptr)->common.type == INTERNAL_TYPE_REFERENCE) &&
                                ((*stack_ptr)->reference.opcode == AML_INDEX_OP)) {
@@ -267,10 +293,9 @@ acpi_ex_resolve_operands (
                /*
                 * Resolve this object to a value
                 */
-
                status = acpi_ex_resolve_to_value (stack_ptr, walk_state);
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
 
 
@@ -328,20 +353,23 @@ acpi_ex_resolve_operands (
                /*
                 * The more complex cases allow multiple resolved object types
                 */
-
                case ARGI_INTEGER:   /* Number */
 
                        /*
                         * Need an operand of type ACPI_TYPE_INTEGER,
                         * But we can implicitly convert from a STRING or BUFFER
                         */
-                       status = acpi_ex_convert_to_integer (stack_ptr, walk_state);
+                       status = acpi_ex_convert_to_integer (*stack_ptr, stack_ptr, walk_state);
                        if (ACPI_FAILURE (status)) {
                                if (status == AE_TYPE) {
-                                       return (AE_AML_OPERAND_TYPE);
+                                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+                                               "Needed [Integer/String/Buffer], found [%s] %p\n",
+                                               acpi_ut_get_type_name ((*stack_ptr)->common.type), *stack_ptr));
+
+                                       return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
                                }
 
-                               return (status);
+                               return_ACPI_STATUS (status);
                        }
 
                        goto next_operand;
@@ -354,13 +382,17 @@ acpi_ex_resolve_operands (
                         * Need an operand of type ACPI_TYPE_BUFFER,
                         * But we can implicitly convert from a STRING or INTEGER
                         */
-                       status = acpi_ex_convert_to_buffer (stack_ptr, walk_state);
+                       status = acpi_ex_convert_to_buffer (*stack_ptr, stack_ptr, walk_state);
                        if (ACPI_FAILURE (status)) {
                                if (status == AE_TYPE) {
-                                       return (AE_AML_OPERAND_TYPE);
+                                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+                                               "Needed [Integer/String/Buffer], found [%s] %p\n",
+                                               acpi_ut_get_type_name ((*stack_ptr)->common.type), *stack_ptr));
+
+                                       return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
                                }
 
-                               return (status);
+                               return_ACPI_STATUS (status);
                        }
 
                        goto next_operand;
@@ -373,13 +405,17 @@ acpi_ex_resolve_operands (
                         * Need an operand of type ACPI_TYPE_STRING,
                         * But we can implicitly convert from a BUFFER or INTEGER
                         */
-                       status = acpi_ex_convert_to_string (stack_ptr, walk_state);
+                       status = acpi_ex_convert_to_string (*stack_ptr, stack_ptr, 16, ACPI_UINT32_MAX, walk_state);
                        if (ACPI_FAILURE (status)) {
                                if (status == AE_TYPE) {
-                                       return (AE_AML_OPERAND_TYPE);
+                                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+                                               "Needed [Integer/String/Buffer], found [%s] %p\n",
+                                               acpi_ut_get_type_name ((*stack_ptr)->common.type), *stack_ptr));
+
+                                       return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
                                }
 
-                               return (status);
+                               return_ACPI_STATUS (status);
                        }
 
                        goto next_operand;
@@ -393,7 +429,11 @@ acpi_ex_resolve_operands (
                        if ((ACPI_TYPE_INTEGER != (*stack_ptr)->common.type) &&
                                (ACPI_TYPE_STRING != (*stack_ptr)->common.type) &&
                                (ACPI_TYPE_BUFFER != (*stack_ptr)->common.type)) {
-                               return (AE_AML_OPERAND_TYPE);
+                               ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+                                       "Needed [Integer/String/Buffer], found [%s] %p\n",
+                                       acpi_ut_get_type_name ((*stack_ptr)->common.type), *stack_ptr));
+
+                               return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
                        }
                        goto next_operand;
                        break;
@@ -415,7 +455,11 @@ acpi_ex_resolve_operands (
                                ((*stack_ptr)->common.type != ACPI_TYPE_STRING) &&
                                ((*stack_ptr)->common.type != ACPI_TYPE_PACKAGE) &&
                                ((*stack_ptr)->common.type != INTERNAL_TYPE_REFERENCE)) {
-                               return (AE_AML_OPERAND_TYPE);
+                               ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+                                       "Needed [Buf/Str/Pkg/Ref], found [%s] %p\n",
+                                       acpi_ut_get_type_name ((*stack_ptr)->common.type), *stack_ptr));
+
+                               return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
                        }
 
                        /*
@@ -423,7 +467,11 @@ acpi_ex_resolve_operands (
                         */
                        if ((*stack_ptr)->common.type == INTERNAL_TYPE_REFERENCE) {
                                if (!(*stack_ptr)->reference.node) {
-                                       return (AE_AML_OPERAND_TYPE);
+                                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+                                               "Needed [Node Reference], found [%p]\n",
+                                               *stack_ptr));
+
+                                       return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
                                }
                        }
                        goto next_operand;
@@ -437,7 +485,11 @@ acpi_ex_resolve_operands (
                        if (((*stack_ptr)->common.type != ACPI_TYPE_BUFFER) &&
                                ((*stack_ptr)->common.type != ACPI_TYPE_STRING) &&
                                ((*stack_ptr)->common.type != ACPI_TYPE_PACKAGE)) {
-                               return (AE_AML_OPERAND_TYPE);
+                               ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+                                       "Needed [Buf/Pkg], found [%s] %p\n",
+                                       acpi_ut_get_type_name ((*stack_ptr)->common.type), *stack_ptr));
+
+                               return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
                        }
                        goto next_operand;
                        break;
@@ -447,7 +499,11 @@ acpi_ex_resolve_operands (
 
                        /* Unknown type */
 
-                       return (AE_BAD_PARAMETER);
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                               "Internal - Unknown ARGI type %X\n",
+                               this_arg_type));
+
+                       return_ACPI_STATUS (AE_BAD_PARAMETER);
                }
 
 
@@ -458,7 +514,7 @@ acpi_ex_resolve_operands (
                status = acpi_ex_check_object_type (type_needed,
                                  (*stack_ptr)->common.type, *stack_ptr);
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
 
 
@@ -474,7 +530,7 @@ next_operand:
        }   /* while (*Types) */
 
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
index 87835d6b68524c1fab35f185bcf0cbe4fe5ea993..7daab63b3a8814b871b7468392c462dd4b40528e 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: exstore - AML Interpreter object store support
- *              $Revision: 139 $
+ *              $Revision: 148 $
  *
  *****************************************************************************/
 
@@ -44,7 +44,7 @@
  *
  * PARAMETERS:  *Val_desc           - Value to be stored
  *              *Dest_desc          - Where to store it.  Must be an NS node
- *                                    or an ACPI_OPERAND_OBJECT of type
+ *                                    or an acpi_operand_object of type
  *                                    Reference; if the latter the descriptor
  *                                    will be either reused or deleted.
  *
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_store (
-       ACPI_OPERAND_OBJECT     *val_desc,
-       ACPI_OPERAND_OBJECT     *dest_desc,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_operand_object     *val_desc,
+       acpi_operand_object     *dest_desc,
+       acpi_walk_state         *walk_state)
 {
-       ACPI_STATUS             status = AE_OK;
-       ACPI_OPERAND_OBJECT     *ref_desc = dest_desc;
+       acpi_status             status = AE_OK;
+       acpi_operand_object     *ref_desc = dest_desc;
+
+
+       FUNCTION_TRACE_PTR ("Ex_store", dest_desc);
 
 
        /* Validate parameters */
 
        if (!val_desc || !dest_desc) {
-               return (AE_AML_NO_OPERAND);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null pointer\n"));
+               return_ACPI_STATUS (AE_AML_NO_OPERAND);
        }
 
        /* Dest_desc can be either a namespace node or an ACPI object */
@@ -81,11 +85,11 @@ acpi_ex_store (
                 * Storing an object into a Name "container"
                 */
                status = acpi_ex_store_object_to_node (val_desc,
-                                (ACPI_NAMESPACE_NODE *) dest_desc, walk_state);
+                                (acpi_namespace_node *) dest_desc, walk_state);
 
                /* All done, that's it */
 
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
 
@@ -94,7 +98,15 @@ acpi_ex_store (
        if (dest_desc->common.type != INTERNAL_TYPE_REFERENCE) {
                /* Destination is not an Reference */
 
-               return (AE_AML_OPERAND_TYPE);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                       "Destination is not a Reference_obj [%p]\n", dest_desc));
+
+               DUMP_STACK_ENTRY (val_desc);
+               DUMP_STACK_ENTRY (dest_desc);
+               DUMP_OPERANDS (&dest_desc, IMODE_EXECUTE, "Ex_store",
+                                 2, "Target is not a Reference_obj");
+
+               return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
        }
 
 
@@ -107,7 +119,6 @@ acpi_ex_store (
         * 4) Store to the debug object
         * 5) Store to a constant -- a noop
         */
-
        switch (ref_desc->reference.opcode) {
 
        case AML_NAME_OP:
@@ -143,38 +154,53 @@ acpi_ex_store (
                 * Storing to the Debug object causes the value stored to be
                 * displayed and otherwise has no effect -- see ACPI Specification
                 */
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Write to Debug Object: ****:\n\n"));
+
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %s: ",
+                                 acpi_ut_get_type_name (val_desc->common.type)));
+
                switch (val_desc->common.type) {
                case ACPI_TYPE_INTEGER:
 
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%X (%d)\n",
+                               (u32) val_desc->integer.value, (u32) val_desc->integer.value));
                        break;
 
 
                case ACPI_TYPE_BUFFER:
 
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Length 0x%X\n",
+                               (u32) val_desc->buffer.length));
                        break;
 
 
                case ACPI_TYPE_STRING:
 
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s\n", val_desc->string.pointer));
                        break;
 
 
                case ACPI_TYPE_PACKAGE:
 
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Elements - 0x%X\n",
+                               (u32) val_desc->package.elements));
                        break;
 
 
                default:
 
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "@0x%p\n", val_desc));
                        break;
                }
 
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\n"));
                break;
 
 
        case AML_ZERO_OP:
        case AML_ONE_OP:
        case AML_ONES_OP:
+       case AML_REVISION_OP:
 
                /*
                 * Storing to a constant is a no-op -- see ACPI Specification
@@ -185,8 +211,13 @@ acpi_ex_store (
 
        default:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - Unknown Reference subtype %02x\n",
+                       ref_desc->reference.opcode));
+
                /* TBD: [Restructure] use object dump routine !! */
 
+               DUMP_BUFFER (ref_desc, sizeof (acpi_operand_object));
+
                status = AE_AML_INTERNAL;
                break;
 
@@ -199,7 +230,7 @@ acpi_ex_store (
                acpi_ut_remove_reference (ref_desc);
        }
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -216,24 +247,26 @@ acpi_ex_store (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_store_object_to_index (
-       ACPI_OPERAND_OBJECT     *val_desc,
-       ACPI_OPERAND_OBJECT     *dest_desc,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_operand_object     *val_desc,
+       acpi_operand_object     *dest_desc,
+       acpi_walk_state         *walk_state)
 {
-       ACPI_STATUS             status = AE_OK;
-       ACPI_OPERAND_OBJECT     *obj_desc;
+       acpi_status             status = AE_OK;
+       acpi_operand_object     *obj_desc;
        u32                     length;
        u32                     i;
        u8                      value = 0;
 
 
+       FUNCTION_TRACE ("Ex_store_object_to_index");
+
+
        /*
         * Destination must be a reference pointer, and
         * must point to either a buffer or a package
         */
-
        switch (dest_desc->reference.target_type) {
        case ACPI_TYPE_PACKAGE:
                /*
@@ -278,7 +311,7 @@ acpi_ex_store_object_to_index (
                                 */
                                obj_desc = acpi_ut_create_internal_object (val_desc->common.type);
                                if (!obj_desc) {
-                                       return (AE_NO_MEMORY);
+                                       return_ACPI_STATUS (AE_NO_MEMORY);
                                }
 
                                /*
@@ -288,7 +321,7 @@ acpi_ex_store_object_to_index (
                                        status = acpi_ut_copy_ipackage_to_ipackage (val_desc, obj_desc, walk_state);
                                        if (ACPI_FAILURE (status)) {
                                                acpi_ut_remove_reference (obj_desc);
-                                               return (status);
+                                               return_ACPI_STATUS (status);
                                        }
                                }
 
@@ -297,7 +330,6 @@ acpi_ex_store_object_to_index (
                                 * reference to the newly created descriptor for now being
                                 * part of the parent package
                                 */
-
                                *(dest_desc->reference.where) = obj_desc;
                                acpi_ut_add_reference (obj_desc);
                        }
@@ -315,7 +347,9 @@ acpi_ex_store_object_to_index (
                                         * An error occurrered when copying the internal object
                                         * so delete the reference.
                                         */
-                                       return (AE_AML_OPERAND_TYPE);
+                                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                                               "Unable to copy the internal object\n"));
+                                       return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
                                }
                        }
                }
@@ -339,14 +373,13 @@ acpi_ex_store_object_to_index (
                 */
                obj_desc = dest_desc->reference.object;
                if (obj_desc->common.type != ACPI_TYPE_BUFFER) {
-                       return (AE_AML_OPERAND_TYPE);
+                       return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
                }
 
                /*
                 * The assignment of the individual elements will be slightly
                 * different for each source type.
                 */
-
                switch (val_desc->common.type) {
                case ACPI_TYPE_INTEGER:
                        /*
@@ -354,7 +387,7 @@ acpi_ex_store_object_to_index (
                         * This loop to assign each of the elements is somewhat
                         * backward because of the Big Endian-ness of IA-64
                         */
-                       length = sizeof (ACPI_INTEGER);
+                       length = sizeof (acpi_integer);
                        for (i = length; i != 0; i--) {
                                value = (u8)(val_desc->integer.value >> (MUL_8 (i - 1)));
                                obj_desc->buffer.pointer[dest_desc->reference.offset] = value;
@@ -369,7 +402,7 @@ acpi_ex_store_object_to_index (
                         */
                        length = val_desc->buffer.length;
                        for (i = 0; i < length; i++) {
-                               value = *(val_desc->buffer.pointer + i);
+                               value = val_desc->buffer.pointer[i];
                                obj_desc->buffer.pointer[dest_desc->reference.offset] = value;
                        }
                        break;
@@ -382,7 +415,7 @@ acpi_ex_store_object_to_index (
                         */
                        length = val_desc->string.length;
                        for (i = 0; i < length; i++) {
-                               value = *(val_desc->string.pointer + i);
+                               value = val_desc->string.pointer[i];
                                obj_desc->buffer.pointer[dest_desc->reference.offset] = value;
                        }
                        break;
@@ -392,6 +425,9 @@ acpi_ex_store_object_to_index (
 
                        /* Other types are invalid */
 
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                               "Source must be Number/Buffer/String type, not %X\n",
+                               val_desc->common.type));
                        status = AE_AML_OPERAND_TYPE;
                        break;
                }
@@ -399,12 +435,13 @@ acpi_ex_store_object_to_index (
 
 
        default:
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Target is not a Package or Buffer_field\n"));
                status = AE_AML_OPERAND_TYPE;
                break;
        }
 
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -435,22 +472,23 @@ acpi_ex_store_object_to_index (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_store_object_to_node (
-       ACPI_OPERAND_OBJECT     *source_desc,
-       ACPI_NAMESPACE_NODE     *node,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_operand_object     *source_desc,
+       acpi_namespace_node     *node,
+       acpi_walk_state         *walk_state)
 {
-       ACPI_STATUS             status = AE_OK;
-       ACPI_OPERAND_OBJECT     *target_desc;
-       ACPI_OBJECT_TYPE8       target_type = ACPI_TYPE_ANY;
+       acpi_status             status = AE_OK;
+       acpi_operand_object     *target_desc;
+       acpi_object_type8       target_type = ACPI_TYPE_ANY;
+
+
+       FUNCTION_TRACE ("Ex_store_object_to_node");
 
 
        /*
         * Assuming the parameters were already validated
         */
-       ACPI_ASSERT((node) && (source_desc));
-
 
        /*
         * Get current type of the node, and object attached to Node
@@ -458,6 +496,10 @@ acpi_ex_store_object_to_node (
        target_type = acpi_ns_get_type (node);
        target_desc = acpi_ns_get_attached_object (node);
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Storing %p(%s) into node %p(%s)\n",
+               node, acpi_ut_get_type_name (source_desc->common.type),
+               source_desc, acpi_ut_get_type_name (target_type)));
+
 
        /*
         * Resolve the source object to an actual value
@@ -465,7 +507,7 @@ acpi_ex_store_object_to_node (
         */
        status = acpi_ex_resolve_object (&source_desc, target_type, walk_state);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
 
@@ -497,7 +539,7 @@ acpi_ex_store_object_to_node (
                 */
                status = acpi_ex_store_object (source_desc, target_type, &target_desc, walk_state);
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
 
                /*
@@ -506,11 +548,19 @@ acpi_ex_store_object_to_node (
                 * Source_desc reference count is incremented by Attach_object.
                 */
                status = acpi_ns_attach_object (node, target_desc, target_type);
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+                       "Store %s into %s via Convert/Attach\n",
+                       acpi_ut_get_type_name (target_desc->common.type),
+                       acpi_ut_get_type_name (target_type)));
                break;
 
 
        default:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+                       "Storing %s (%p) directly into node (%p), no implicit conversion\n",
+                       acpi_ut_get_type_name (source_desc->common.type), source_desc, node));
+
                /* No conversions for all other types.  Just attach the source object */
 
                status = acpi_ns_attach_object (node, source_desc, source_desc->common.type);
@@ -519,7 +569,7 @@ acpi_ex_store_object_to_node (
        }
 
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -549,20 +599,25 @@ acpi_ex_store_object_to_node (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_store_object_to_object (
-       ACPI_OPERAND_OBJECT     *source_desc,
-       ACPI_OPERAND_OBJECT     *dest_desc,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_operand_object     *source_desc,
+       acpi_operand_object     *dest_desc,
+       acpi_walk_state         *walk_state)
 {
-       ACPI_STATUS             status = AE_OK;
-       ACPI_OBJECT_TYPE8       destination_type = dest_desc->common.type;
+       acpi_status             status = AE_OK;
+       acpi_object_type8       destination_type = dest_desc->common.type;
+
+
+       FUNCTION_TRACE ("Ex_store_object_to_object");
 
 
        /*
         *  Assuming the parameters are valid!
         */
-       ACPI_ASSERT((dest_desc) && (source_desc));
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Storing %p(%s) to %p(%s)\n",
+                         source_desc, acpi_ut_get_type_name (source_desc->common.type),
+                         dest_desc, acpi_ut_get_type_name (dest_desc->common.type)));
 
 
        /*
@@ -575,7 +630,10 @@ acpi_ex_store_object_to_object (
                break;
 
        default:
-               return (AE_NOT_IMPLEMENTED);
+               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Store into %s not implemented\n",
+                       acpi_ut_get_type_name (dest_desc->common.type)));
+
+               return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
        }
 
 
@@ -585,7 +643,7 @@ acpi_ex_store_object_to_object (
         */
        status = acpi_ex_resolve_object (&source_desc, destination_type, walk_state);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
 
@@ -595,6 +653,6 @@ acpi_ex_store_object_to_object (
        status = acpi_ex_store_object (source_desc, destination_type, &dest_desc, walk_state);
 
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
index c3877ae01dd110d449318e5f1903a16f171ec3e7..9c0e157c2c66ea60e3329395018e7dad6568a252 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Module Name: exstoren - AML Interpreter object store support,
  *                        Store to Node (namespace object)
- *              $Revision: 38 $
+ *              $Revision: 40 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_resolve_object (
-       ACPI_OPERAND_OBJECT     **source_desc_ptr,
-       ACPI_OBJECT_TYPE8       target_type,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_operand_object     **source_desc_ptr,
+       acpi_object_type8       target_type,
+       acpi_walk_state         *walk_state)
 {
-       ACPI_OPERAND_OBJECT     *source_desc = *source_desc_ptr;
-       ACPI_STATUS             status = AE_OK;
+       acpi_operand_object     *source_desc = *source_desc_ptr;
+       acpi_status             status = AE_OK;
+
+
+       FUNCTION_TRACE ("Ex_resolve_object");
 
 
        /*
@@ -108,6 +111,10 @@ acpi_ex_resolve_object (
                                /*
                                 * Conversion successful but still not a valid type
                                 */
+                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                                       "Cannot assign type %s to %s (must be type Int/Str/Buf)\n",
+                                       acpi_ut_get_type_name ((*source_desc_ptr)->common.type),
+                                       acpi_ut_get_type_name (target_type)));
                                status = AE_AML_OPERAND_TYPE;
                        }
                }
@@ -119,6 +126,7 @@ acpi_ex_resolve_object (
                /*
                 * Aliases are resolved by Acpi_ex_prep_operands
                 */
+               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Store into Alias - should never happen\n"));
                status = AE_AML_INTERNAL;
                break;
 
@@ -133,7 +141,7 @@ acpi_ex_resolve_object (
                break;
        }
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -155,15 +163,18 @@ acpi_ex_resolve_object (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_store_object (
-       ACPI_OPERAND_OBJECT     *source_desc,
-       ACPI_OBJECT_TYPE8       target_type,
-       ACPI_OPERAND_OBJECT     **target_desc_ptr,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_operand_object     *source_desc,
+       acpi_object_type8       target_type,
+       acpi_operand_object     **target_desc_ptr,
+       acpi_walk_state         *walk_state)
 {
-       ACPI_OPERAND_OBJECT     *target_desc = *target_desc_ptr;
-       ACPI_STATUS             status = AE_OK;
+       acpi_operand_object     *target_desc = *target_desc_ptr;
+       acpi_status             status = AE_OK;
+
+
+       FUNCTION_TRACE ("Ex_store_object");
 
 
        /*
@@ -175,7 +186,7 @@ acpi_ex_store_object (
         */
        status = acpi_ex_convert_to_target_type (target_type, &source_desc, walk_state);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /*
@@ -190,7 +201,6 @@ acpi_ex_store_object (
                 * The target namespace node is uninitialized (has no target object),
                 * and will take on the type of the source object
                 */
-
                *target_desc_ptr = source_desc;
                break;
 
@@ -230,12 +240,15 @@ acpi_ex_store_object (
                /*
                 * All other types come here.
                 */
+               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Store into type %s not implemented\n",
+                       acpi_ut_get_type_name (target_type)));
+
                status = AE_NOT_IMPLEMENTED;
                break;
        }
 
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
index f6626aad79c68930556bd71649308c374f3d264e..5a5c55605f210d44266f349900466525dfa5032b 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: exstorob - AML Interpreter object store support, store to object
- *              $Revision: 32 $
+ *              $Revision: 37 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_copy_buffer_to_buffer (
-       ACPI_OPERAND_OBJECT     *source_desc,
-       ACPI_OPERAND_OBJECT     *target_desc)
+       acpi_operand_object     *source_desc,
+       acpi_operand_object     *target_desc)
 {
        u32                     length;
        u8                      *buffer;
 
 
+       PROC_NAME ("Ex_copy_buffer_to_buffer");
+
+
        /*
         * We know that Source_desc is a buffer by now
         */
@@ -71,7 +74,7 @@ acpi_ex_copy_buffer_to_buffer (
         * buffer of the proper length
         */
        if (target_desc->buffer.length == 0) {
-               target_desc->buffer.pointer = acpi_ut_allocate (length);
+               target_desc->buffer.pointer = ACPI_MEM_ALLOCATE (length);
                if (!target_desc->buffer.pointer) {
                        return (AE_NO_MEMORY);
                }
@@ -86,16 +89,19 @@ acpi_ex_copy_buffer_to_buffer (
        if (length <= target_desc->buffer.length) {
                /* Clear existing buffer and copy in the new one */
 
-               MEMSET(target_desc->buffer.pointer, 0, target_desc->buffer.length);
-               MEMCPY(target_desc->buffer.pointer, buffer, length);
+               MEMSET (target_desc->buffer.pointer, 0, target_desc->buffer.length);
+               MEMCPY (target_desc->buffer.pointer, buffer, length);
        }
 
        else {
                /*
                 * Truncate the source, copy only what will fit
                 */
-               MEMCPY(target_desc->buffer.pointer, buffer, target_desc->buffer.length);
+               MEMCPY (target_desc->buffer.pointer, buffer, target_desc->buffer.length);
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+                       "Truncating src buffer from %X to %X\n",
+                       length, target_desc->buffer.length));
        }
 
        return (AE_OK);
@@ -115,15 +121,18 @@ acpi_ex_copy_buffer_to_buffer (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_copy_string_to_string (
-       ACPI_OPERAND_OBJECT     *source_desc,
-       ACPI_OPERAND_OBJECT     *target_desc)
+       acpi_operand_object     *source_desc,
+       acpi_operand_object     *target_desc)
 {
        u32                     length;
        u8                      *buffer;
 
 
+       FUNCTION_ENTRY ();
+
+
        /*
         * We know that Source_desc is a string by now.
         */
@@ -136,8 +145,8 @@ acpi_ex_copy_string_to_string (
        if (length < target_desc->string.length) {
                /* Clear old string and copy in the new one */
 
-               MEMSET(target_desc->string.pointer, 0, target_desc->string.length);
-               MEMCPY(target_desc->string.pointer, buffer, length);
+               MEMSET (target_desc->string.pointer, 0, target_desc->string.length);
+               MEMCPY (target_desc->string.pointer, buffer, length);
        }
 
        else {
@@ -146,21 +155,20 @@ acpi_ex_copy_string_to_string (
                 * large enough to hold the value
                 */
                if (target_desc->string.pointer &&
-                       !acpi_tb_system_table_pointer (target_desc->string.pointer)) {
+                  (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) {
                        /*
                         * Only free if not a pointer into the DSDT
                         */
-                       acpi_ut_free(target_desc->string.pointer);
+                       ACPI_MEM_FREE (target_desc->string.pointer);
                }
 
-               target_desc->string.pointer = acpi_ut_allocate (length + 1);
+               target_desc->string.pointer = ACPI_MEM_ALLOCATE (length + 1);
                if (!target_desc->string.pointer) {
                        return (AE_NO_MEMORY);
                }
-               target_desc->string.length = length;
-
 
-               MEMCPY(target_desc->string.pointer, buffer, length);
+               target_desc->string.length = length;
+               MEMCPY (target_desc->string.pointer, buffer, length);
        }
 
        return (AE_OK);
index 3c558ec2023cbb28afc63bebd84634ba86886244..10b504d122a543d586a97dbb7bc510f1651fc4a2 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: exsystem - Interface to OS services
- *              $Revision: 62 $
+ *              $Revision: 67 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_system_wait_semaphore (
-       ACPI_HANDLE             semaphore,
+       acpi_handle             semaphore,
        u32                     timeout)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Ex_system_wait_semaphore");
 
 
        status = acpi_os_wait_semaphore (semaphore, 1, 0);
        if (ACPI_SUCCESS (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        if (status == AE_TIME) {
@@ -70,6 +73,9 @@ acpi_ex_system_wait_semaphore (
 
                status = acpi_os_wait_semaphore (semaphore, 1, timeout);
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*** Thread awake after blocking, %s\n",
+                       acpi_format_exception (status)));
+
                /* Reacquire the interpreter */
 
                status = acpi_ex_enter_interpreter ();
@@ -80,7 +86,7 @@ acpi_ex_system_wait_semaphore (
                }
        }
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -100,13 +106,15 @@ void
 acpi_ex_system_do_stall (
        u32                     how_long)
 {
+       FUNCTION_ENTRY ();
+
 
        if (how_long > 1000) /* 1 millisecond */ {
                /* Since this thread will sleep, we must release the interpreter */
 
                acpi_ex_exit_interpreter ();
 
-               acpi_os_sleep_usec (how_long);
+               acpi_os_stall (how_long);
 
                /* And now we must get the interpreter again */
 
@@ -114,7 +122,7 @@ acpi_ex_system_do_stall (
        }
 
        else {
-               acpi_os_sleep_usec (how_long);
+               acpi_os_sleep (0, (how_long / 1000) + 1);
        }
 }
 
@@ -135,6 +143,10 @@ void
 acpi_ex_system_do_suspend (
        u32                     how_long)
 {
+
+       FUNCTION_ENTRY ();
+
+
        /* Since this thread will sleep, we must release the interpreter */
 
        acpi_ex_exit_interpreter ();
@@ -163,30 +175,32 @@ acpi_ex_system_do_suspend (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_system_acquire_mutex (
-       ACPI_OPERAND_OBJECT     *time_desc,
-       ACPI_OPERAND_OBJECT     *obj_desc)
+       acpi_operand_object     *time_desc,
+       acpi_operand_object     *obj_desc)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+
+       FUNCTION_TRACE_PTR ("Ex_system_acquire_mutex", obj_desc);
 
 
        if (!obj_desc) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        /*
         * Support for the _GL_ Mutex object -- go get the global lock
         */
-
        if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) {
                status = acpi_ev_acquire_global_lock ();
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        status = acpi_ex_system_wait_semaphore (obj_desc->mutex.semaphore,
                          (u32) time_desc->integer.value);
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -205,15 +219,18 @@ acpi_ex_system_acquire_mutex (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_system_release_mutex (
-       ACPI_OPERAND_OBJECT     *obj_desc)
+       acpi_operand_object     *obj_desc)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+
+       FUNCTION_TRACE ("Ex_system_release_mutex");
 
 
        if (!obj_desc) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        /*
@@ -221,11 +238,11 @@ acpi_ex_system_release_mutex (
         */
        if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) {
                acpi_ev_release_global_lock ();
-               return (AE_OK);
+               return_ACPI_STATUS (AE_OK);
        }
 
        status = acpi_os_signal_semaphore (obj_desc->mutex.semaphore, 1);
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -242,18 +259,21 @@ acpi_ex_system_release_mutex (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_system_signal_event (
-       ACPI_OPERAND_OBJECT     *obj_desc)
+       acpi_operand_object     *obj_desc)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+
+       FUNCTION_TRACE ("Ex_system_signal_event");
 
 
        if (obj_desc) {
                status = acpi_os_signal_semaphore (obj_desc->event.semaphore, 1);
        }
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -272,12 +292,15 @@ acpi_ex_system_signal_event (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_system_wait_event (
-       ACPI_OPERAND_OBJECT     *time_desc,
-       ACPI_OPERAND_OBJECT     *obj_desc)
+       acpi_operand_object     *time_desc,
+       acpi_operand_object     *obj_desc)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+
+       FUNCTION_TRACE ("Ex_system_wait_event");
 
 
        if (obj_desc) {
@@ -286,7 +309,7 @@ acpi_ex_system_wait_event (
        }
 
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -302,19 +325,21 @@ acpi_ex_system_wait_event (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_system_reset_event (
-       ACPI_OPERAND_OBJECT     *obj_desc)
+       acpi_operand_object     *obj_desc)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        void                    *temp_semaphore;
 
 
+       FUNCTION_ENTRY ();
+
+
        /*
         * We are going to simply delete the existing semaphore and
         * create a new one!
         */
-
        status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, 0, &temp_semaphore);
        if (ACPI_SUCCESS (status)) {
                acpi_os_delete_semaphore (obj_desc->event.semaphore);
index 82da3171538c211940af56ef0563d08fcc037e07..26cb7c3d96fde1c0dd99644ad09f3c032cc16cbf 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: exutils - interpreter/scanner utilities
- *              $Revision: 79 $
+ *              $Revision: 84 $
  *
  *****************************************************************************/
 
  */
 
 
+/*
+ * DEFINE_AML_GLOBALS is tested in amlcode.h
+ * to determine whether certain global names should be "defined" or only
+ * "declared" in the current compilation.  This enhances maintainability
+ * by enabling a single header file to embody all knowledge of the names
+ * in question.
+ *
+ * Exactly one module of any executable should #define DEFINE_GLOBALS
+ * before #including the header files which use this convention.  The
+ * names in question will be defined and initialized in that module,
+ * and declared as extern in all other modules which #include those
+ * header files.
+ */
+
+#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
         MODULE_NAME         ("exutils")
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_enter_interpreter (void)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+       FUNCTION_TRACE ("Ex_enter_interpreter");
 
 
        status = acpi_ut_acquire_mutex (ACPI_MTX_EXECUTE);
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -83,10 +102,12 @@ acpi_ex_enter_interpreter (void)
 void
 acpi_ex_exit_interpreter (void)
 {
+       FUNCTION_TRACE ("Ex_exit_interpreter");
+
 
        acpi_ut_release_mutex (ACPI_MTX_EXECUTE);
 
-       return;
+       return_VOID;
 }
 
 
@@ -102,9 +123,12 @@ acpi_ex_exit_interpreter (void)
 
 u8
 acpi_ex_validate_object_type (
-       ACPI_OBJECT_TYPE        type)
+       acpi_object_type        type)
 {
 
+       FUNCTION_ENTRY ();
+
+
        if ((type > ACPI_TYPE_MAX && type < INTERNAL_TYPE_BEGIN) ||
                (type > INTERNAL_TYPE_MAX)) {
                return (FALSE);
@@ -131,15 +155,17 @@ acpi_ex_validate_object_type (
 
 void
 acpi_ex_truncate_for32bit_table (
-       ACPI_OPERAND_OBJECT     *obj_desc,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_operand_object     *obj_desc,
+       acpi_walk_state         *walk_state)
 {
 
+       FUNCTION_ENTRY ();
+
+
        /*
         * Object must be a valid number and we must be executing
         * a control method
         */
-
        if ((!obj_desc) ||
                (obj_desc->common.type != ACPI_TYPE_INTEGER) ||
                (!walk_state->method_node)) {
@@ -151,7 +177,7 @@ acpi_ex_truncate_for32bit_table (
                 * 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
                 */
-               obj_desc->integer.value &= (ACPI_INTEGER) ACPI_UINT32_MAX;
+               obj_desc->integer.value &= (acpi_integer) ACPI_UINT32_MAX;
        }
 }
 
@@ -175,7 +201,10 @@ acpi_ex_acquire_global_lock (
        u32                     rule)
 {
        u8                      locked = FALSE;
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Ex_acquire_global_lock");
 
 
        /* Only attempt lock if the Rule says so */
@@ -188,9 +217,13 @@ acpi_ex_acquire_global_lock (
                        locked = TRUE;
                }
 
+               else {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not acquire Global Lock, %s\n",
+                               acpi_format_exception (status)));
+               }
        }
 
-       return (locked);
+       return_VALUE (locked);
 }
 
 
@@ -207,11 +240,13 @@ acpi_ex_acquire_global_lock (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_release_global_lock (
        u8                      locked_by_me)
 {
 
+       FUNCTION_TRACE ("Ex_release_global_lock");
+
 
        /* Only attempt unlock if the caller locked it */
 
@@ -222,7 +257,7 @@ acpi_ex_release_global_lock (
        }
 
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -239,24 +274,27 @@ acpi_ex_release_global_lock (
 
 u32
 acpi_ex_digits_needed (
-       ACPI_INTEGER            val,
+       acpi_integer            val,
        u32                     base)
 {
        u32                     num_digits = 0;
 
 
+       FUNCTION_TRACE ("Ex_digits_needed");
+
+
        if (base < 1) {
                REPORT_ERROR (("Ex_digits_needed: Internal error - Invalid base\n"));
        }
 
        else {
                /*
-                * ACPI_INTEGER is unsigned, which is why we don't worry about the '-'
+                * acpi_integer is unsigned, which is why we don't worry about the '-'
                 */
                for (num_digits = 1; (val = ACPI_DIVIDE (val,base)); ++num_digits) { ; }
        }
 
-       return (num_digits);
+       return_VALUE (num_digits);
 }
 
 
@@ -285,6 +323,9 @@ _ntohl (
        } in;
 
 
+       FUNCTION_ENTRY ();
+
+
        in.value = value;
 
        out.bytes[0] = in.bytes[3];
@@ -307,13 +348,17 @@ _ntohl (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_eisa_id_to_string (
        u32                     numeric_id,
        NATIVE_CHAR             *out_string)
 {
        u32                     id;
 
+
+       FUNCTION_ENTRY ();
+
+
        /* swap to big-endian to get contiguous bits */
 
        id = _ntohl (numeric_id);
@@ -321,10 +366,10 @@ acpi_ex_eisa_id_to_string (
        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_gbl_hex_to_ascii[(id >> 12) & 0xf];
-       out_string[4] = acpi_gbl_hex_to_ascii[(id >> 8) & 0xf];
-       out_string[5] = acpi_gbl_hex_to_ascii[(id >> 4) & 0xf];
-       out_string[6] = acpi_gbl_hex_to_ascii[id & 0xf];
+       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[7] = 0;
 
        return (AE_OK);
@@ -342,17 +387,19 @@ acpi_ex_eisa_id_to_string (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_unsigned_integer_to_string (
-       ACPI_INTEGER            value,
+       acpi_integer            value,
        NATIVE_CHAR             *out_string)
 {
        u32                     count;
        u32                     digits_needed;
 
 
-       digits_needed = acpi_ex_digits_needed (value, 10);
+       FUNCTION_ENTRY ();
+
 
+       digits_needed = acpi_ex_digits_needed (value, 10);
        out_string[digits_needed] = '\0';
 
        for (count = digits_needed; count > 0; count--) {
index 6b91aed8e5d6b25cadc5513c4b0af52d6e12076d..51efc293bdb59446933b1f1bb85cd8615262bd2c 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: exxface - External interpreter interfaces
- *              $Revision: 27 $
+ *              $Revision: 29 $
  *
  *****************************************************************************/
 
@@ -32,6 +32,7 @@
 #define _COMPONENT          ACPI_EXECUTER
         MODULE_NAME         ("exxface")
 
+#if 0
 
 /*
  * DEFINE_AML_GLOBALS is tested in amlcode.h
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ex_execute_method (
-       ACPI_NAMESPACE_NODE     *method_node,
-       ACPI_OPERAND_OBJECT     **params,
-       ACPI_OPERAND_OBJECT     **return_obj_desc)
+       acpi_namespace_node     *method_node,
+       acpi_operand_object     **params,
+       acpi_operand_object     **return_obj_desc)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Ex_execute_method");
 
 
        /*
         * The point here is to lock the interpreter and call the low
         * level execute.
         */
-
        status = acpi_ex_enter_interpreter ();
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        status = acpi_psx_execute (method_node, params, return_obj_desc);
 
        acpi_ex_exit_interpreter ();
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
+#endif
index 261d3756cc61e9781fbedb025d0efc3e05f622b6..fdc4023de4a28dbaf98198a130629121a8eeaef8 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: hwacpi - ACPI Hardware Initialization/Mode Interface
- *              $Revision: 40 $
+ *              $Revision: 45 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_hw_initialize (
        void)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        u32                     index;
 
 
+       FUNCTION_TRACE ("Hw_initialize");
+
+
        /* We must have the ACPI tables by the time we get here */
 
        if (!acpi_gbl_FADT) {
                acpi_gbl_restore_acpi_chipset = FALSE;
 
-               return (AE_NO_ACPI_TABLES);
-       }
-
-       /* Must support *some* mode! */
-/*
-       if (!(System_flags & SYS_MODES_MASK))
-       {
-               Restore_acpi_chipset = FALSE;
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No FADT!\n"));
 
-               return (AE_ERROR);
+               return_ACPI_STATUS (AE_NO_ACPI_TABLES);
        }
 
-*/
-
+       /* Identify current ACPI/legacy mode   */
 
        switch (acpi_gbl_system_flags & SYS_MODES_MASK) {
-               /* Identify current ACPI/legacy mode   */
-
        case (SYS_MODE_ACPI):
 
                acpi_gbl_original_mode = SYS_MODE_ACPI;
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "System supports ACPI mode only.\n"));
                break;
 
 
        case (SYS_MODE_LEGACY):
 
                acpi_gbl_original_mode = SYS_MODE_LEGACY;
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+                       "Tables loaded from buffer, hardware assumed to support LEGACY mode only.\n"));
                break;
 
 
@@ -97,6 +93,12 @@ acpi_hw_initialize (
                        acpi_gbl_original_mode = SYS_MODE_LEGACY;
                }
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+                       "System supports both ACPI and LEGACY modes.\n"));
+
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+                       "System is currently in %s mode.\n",
+                       (acpi_gbl_original_mode == SYS_MODE_ACPI) ? "ACPI" : "LEGACY"));
                break;
        }
 
@@ -118,23 +120,22 @@ acpi_hw_initialize (
                 * coded here. If this changes in the spec, this code will need to
                 * be modified. The PM1b_evt_blk behaves as expected.
                 */
-
-               acpi_gbl_pm1_enable_register_save = (u16) acpi_hw_register_read (ACPI_MTX_LOCK, PM1_EN);
+               acpi_gbl_pm1_enable_register_save = (u16) acpi_hw_register_read (
+                                  ACPI_MTX_LOCK, PM1_EN);
 
 
                /*
                 * The GPEs behave similarly, except that the length of the register
                 * block is not fixed, so the buffer must be allocated with malloc
                 */
-
                if (ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xgpe0blk.address) &&
                        acpi_gbl_FADT->gpe0blk_len) {
                        /* GPE0 specified in FADT  */
 
-                       acpi_gbl_gpe0enable_register_save =
-                               acpi_ut_allocate (DIV_2 (acpi_gbl_FADT->gpe0blk_len));
+                       acpi_gbl_gpe0enable_register_save = ACPI_MEM_ALLOCATE (
+                                          DIV_2 (acpi_gbl_FADT->gpe0blk_len));
                        if (!acpi_gbl_gpe0enable_register_save) {
-                               return (AE_NO_MEMORY);
+                               return_ACPI_STATUS (AE_NO_MEMORY);
                        }
 
                        /* Save state of GPE0 enable bits */
@@ -153,10 +154,10 @@ acpi_hw_initialize (
                        acpi_gbl_FADT->gpe1_blk_len) {
                        /* GPE1 defined */
 
-                       acpi_gbl_gpe1_enable_register_save =
-                               acpi_ut_allocate (DIV_2 (acpi_gbl_FADT->gpe1_blk_len));
+                       acpi_gbl_gpe1_enable_register_save = ACPI_MEM_ALLOCATE (
+                                          DIV_2 (acpi_gbl_FADT->gpe1_blk_len));
                        if (!acpi_gbl_gpe1_enable_register_save) {
-                               return (AE_NO_MEMORY);
+                               return_ACPI_STATUS (AE_NO_MEMORY);
                        }
 
                        /* save state of GPE1 enable bits */
@@ -172,7 +173,7 @@ acpi_hw_initialize (
                }
        }
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -189,18 +190,22 @@ acpi_hw_initialize (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_hw_set_mode (
        u32                     mode)
 {
 
-       ACPI_STATUS             status = AE_NO_HARDWARE_RESPONSE;
+       acpi_status             status = AE_NO_HARDWARE_RESPONSE;
+
+
+       FUNCTION_TRACE ("Hw_set_mode");
 
 
        if (mode == SYS_MODE_ACPI) {
                /* BIOS should have disabled ALL fixed and GP events */
 
-               acpi_os_out8 (acpi_gbl_FADT->smi_cmd, acpi_gbl_FADT->acpi_enable);
+               acpi_os_write_port (acpi_gbl_FADT->smi_cmd, acpi_gbl_FADT->acpi_enable, 8);
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Attempting to enable ACPI mode\n"));
        }
 
        else if (mode == SYS_MODE_LEGACY) {
@@ -208,15 +213,21 @@ acpi_hw_set_mode (
                 * BIOS should clear all fixed status bits and restore fixed event
                 * enable bits to default
                 */
-
-               acpi_os_out8 (acpi_gbl_FADT->smi_cmd, acpi_gbl_FADT->acpi_disable);
+               acpi_os_write_port (acpi_gbl_FADT->smi_cmd, acpi_gbl_FADT->acpi_disable, 8);
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+                                "Attempting to enable Legacy (non-ACPI) mode\n"));
        }
 
+       /* Give the platform some time to react */
+
+       acpi_os_stall (5000);
+
        if (acpi_hw_get_mode () == mode) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode %X successfully enabled\n", mode));
                status = AE_OK;
        }
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -237,15 +248,18 @@ u32
 acpi_hw_get_mode (void)
 {
 
+       FUNCTION_TRACE ("Hw_get_mode");
+
 
        if (acpi_hw_register_bit_access (ACPI_READ, ACPI_MTX_LOCK, SCI_EN)) {
-               return (SYS_MODE_ACPI);
+               return_VALUE (SYS_MODE_ACPI);
        }
        else {
-               return (SYS_MODE_LEGACY);
+               return_VALUE (SYS_MODE_LEGACY);
        }
 }
 
+
 /******************************************************************************
  *
  * FUNCTION:    Acpi_hw_get_mode_capabilities
@@ -263,6 +277,8 @@ u32
 acpi_hw_get_mode_capabilities (void)
 {
 
+       FUNCTION_TRACE ("Hw_get_mode_capabilities");
+
 
        if (!(acpi_gbl_system_flags & SYS_MODES_MASK)) {
                if (acpi_hw_get_mode () == SYS_MODE_LEGACY) {
@@ -272,7 +288,6 @@ acpi_hw_get_mode_capabilities (void)
                         * tables.  Therefore since we're in SYS_MODE_LEGACY, the system
                         * must support both modes
                         */
-
                        acpi_gbl_system_flags |= (SYS_MODE_ACPI | SYS_MODE_LEGACY);
                }
 
@@ -299,7 +314,7 @@ acpi_hw_get_mode_capabilities (void)
                }
        }
 
-       return (acpi_gbl_system_flags & SYS_MODES_MASK);
+       return_VALUE (acpi_gbl_system_flags & SYS_MODES_MASK);
 }
 
 
index 7fc3997b52291c370eae1dc67155b7993f655731..025712a4dd2ce47bd32d616ccef1a4a6a51ccd7c 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Module Name: hwgpe - Low level GPE enable/disable/clear functions
- *              $Revision: 29 $
+ *              $Revision: 32 $
  *
  *****************************************************************************/
 
@@ -49,9 +49,13 @@ void
 acpi_hw_enable_gpe (
        u32                     gpe_number)
 {
-       u                     in_byte;
+       u32                     in_byte;
        u32                     register_index;
-       u8                      bit_mask;
+       u32                     bit_mask;
+
+
+       FUNCTION_ENTRY ();
+
 
        /*
         * Translate GPE number to index into global registers array.
@@ -67,9 +71,10 @@ 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_os_in8 (acpi_gbl_gpe_registers[register_index].enable_addr);
-       acpi_os_out8 (acpi_gbl_gpe_registers[register_index].enable_addr,
-                        (u8)(in_byte | bit_mask));
+       in_byte = 0;
+       acpi_os_read_port (acpi_gbl_gpe_registers[register_index].enable_addr, &in_byte, 8);
+       acpi_os_write_port (acpi_gbl_gpe_registers[register_index].enable_addr,
+                          (in_byte | bit_mask), 8);
 }
 
 
@@ -89,9 +94,13 @@ void
 acpi_hw_disable_gpe (
        u32                     gpe_number)
 {
-       u                     in_byte;
+       u32                     in_byte;
        u32                     register_index;
-       u8                      bit_mask;
+       u32                     bit_mask;
+
+
+       FUNCTION_ENTRY ();
+
 
        /*
         * Translate GPE number to index into global registers array.
@@ -107,9 +116,10 @@ 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_os_in8 (acpi_gbl_gpe_registers[register_index].enable_addr);
-       acpi_os_out8 (acpi_gbl_gpe_registers[register_index].enable_addr,
-                        (u8)(in_byte & ~bit_mask));
+       in_byte = 0;
+       acpi_os_read_port (acpi_gbl_gpe_registers[register_index].enable_addr, &in_byte, 8);
+       acpi_os_write_port (acpi_gbl_gpe_registers[register_index].enable_addr,
+                        (in_byte & ~bit_mask), 8);
 }
 
 
@@ -130,7 +140,11 @@ acpi_hw_clear_gpe (
        u32                     gpe_number)
 {
        u32                     register_index;
-       u8                      bit_mask;
+       u32                     bit_mask;
+
+
+       FUNCTION_ENTRY ();
+
 
        /*
         * Translate GPE number to index into global registers array.
@@ -146,7 +160,7 @@ acpi_hw_clear_gpe (
         * Write a one to the appropriate bit in the status register to
         * clear this GPE.
         */
-       acpi_os_out8 (acpi_gbl_gpe_registers[register_index].status_addr, bit_mask);
+       acpi_os_write_port (acpi_gbl_gpe_registers[register_index].status_addr, bit_mask, 8);
 }
 
 
@@ -165,11 +179,15 @@ acpi_hw_clear_gpe (
 void
 acpi_hw_get_gpe_status (
        u32                     gpe_number,
-       ACPI_EVENT_STATUS       *event_status)
+       acpi_event_status       *event_status)
 {
-       u                     in_byte = 0;
+       u32                     in_byte = 0;
        u32                     register_index = 0;
-       u8                      bit_mask = 0;
+       u32                     bit_mask = 0;
+
+
+       FUNCTION_ENTRY ();
+
 
        if (!event_status) {
                return;
@@ -190,8 +208,8 @@ acpi_hw_get_gpe_status (
        /*
         * Enabled?:
         */
-       in_byte = acpi_os_in8 (acpi_gbl_gpe_registers[register_index].enable_addr);
-
+       in_byte = 0;
+       acpi_os_read_port (acpi_gbl_gpe_registers[register_index].enable_addr, &in_byte, 8);
        if (bit_mask & in_byte) {
                (*event_status) |= ACPI_EVENT_FLAG_ENABLED;
        }
@@ -199,8 +217,8 @@ acpi_hw_get_gpe_status (
        /*
         * Set?
         */
-       in_byte = acpi_os_in8 (acpi_gbl_gpe_registers[register_index].status_addr);
-
+       in_byte = 0;
+       acpi_os_read_port (acpi_gbl_gpe_registers[register_index].status_addr, &in_byte, 8);
        if (bit_mask & in_byte) {
                (*event_status) |= ACPI_EVENT_FLAG_SET;
        }
index 3ff93075eb36ea5add4bb240f7ba1ac0362f1068..36458b4a53a24e8f8d11ed00ab327efaba5ab778 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Module Name: hwregs - Read/write access functions for the various ACPI
  *                       control and status registers.
- *              $Revision: 97 $
+ *              $Revision: 109 $
  *
  ******************************************************************************/
 
         MODULE_NAME         ("hwregs")
 
 
-/* This matches the #defines in actypes.h. */
-
-NATIVE_CHAR                 *sleep_state_table[] = {"\\_S0_","\\_S1_","\\_S2_","\\_S3_",
-                         "\\_S4_","\\_S5_","\\_S4_b"};
-
-
 /*******************************************************************************
  *
  * FUNCTION:    Acpi_hw_get_bit_shift
@@ -55,13 +49,17 @@ NATIVE_CHAR                 *sleep_state_table[] = {"\\_S0_","\\_S1_","\\_S2_","
 
 u32
 acpi_hw_get_bit_shift (
-       u32                     mask) {
+       u32                     mask)
+{
        u32                     shift;
 
 
+       FUNCTION_TRACE ("Hw_get_bit_shift");
+
+
        for (shift = 0; ((mask >> shift) & 1) == 0; shift++) { ; }
 
-       return (shift);
+       return_VALUE (shift);
 }
 
 
@@ -84,14 +82,23 @@ acpi_hw_clear_acpi_status (void)
        u16                     index;
 
 
+       FUNCTION_TRACE ("Hw_clear_acpi_status");
+
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %04X to %04X\n",
+               ALL_FIXED_STS_BITS,
+               (u16) ACPI_GET_ADDRESS (acpi_gbl_FADT->Xpm1a_evt_blk.address)));
+
+
        acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE);
 
        acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, PM1_STS, ALL_FIXED_STS_BITS);
 
 
        if (ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xpm1b_evt_blk.address)) {
-               acpi_os_out16 ((ACPI_IO_ADDRESS) ACPI_GET_ADDRESS (acpi_gbl_FADT->Xpm1b_evt_blk.address),
-                       (u16) ALL_FIXED_STS_BITS);
+               acpi_os_write_port ((ACPI_IO_ADDRESS)
+                       ACPI_GET_ADDRESS (acpi_gbl_FADT->Xpm1b_evt_blk.address),
+                       ALL_FIXED_STS_BITS, 16);
        }
 
        /* now clear the GPE Bits */
@@ -100,9 +107,9 @@ acpi_hw_clear_acpi_status (void)
                gpe_length = (u16) DIV_2 (acpi_gbl_FADT->gpe0blk_len);
 
                for (index = 0; index < gpe_length; index++) {
-                       acpi_os_out8 ((ACPI_IO_ADDRESS) (
+                       acpi_os_write_port ((ACPI_IO_ADDRESS) (
                                ACPI_GET_ADDRESS (acpi_gbl_FADT->Xgpe0blk.address) + index),
-                               (u8) 0xff);
+                                       0xFF, 8);
                }
        }
 
@@ -110,14 +117,14 @@ acpi_hw_clear_acpi_status (void)
                gpe_length = (u16) DIV_2 (acpi_gbl_FADT->gpe1_blk_len);
 
                for (index = 0; index < gpe_length; index++) {
-                       acpi_os_out8 ((ACPI_IO_ADDRESS) (
+                       acpi_os_write_port ((ACPI_IO_ADDRESS) (
                                ACPI_GET_ADDRESS (acpi_gbl_FADT->Xgpe1_blk.address) + index),
-                               (u8) 0xff);
+                               0xFF, 8);
                }
        }
 
        acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
-       return;
+       return_VOID;
 }
 
 
@@ -136,37 +143,39 @@ acpi_hw_clear_acpi_status (void)
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_hw_obtain_sleep_type_register_data (
        u8                      sleep_state,
        u8                      *slp_typ_a,
        u8                      *slp_typ_b)
 {
-       ACPI_STATUS             status = AE_OK;
-       ACPI_OPERAND_OBJECT     *obj_desc;
+       acpi_status             status = AE_OK;
+       acpi_operand_object     *obj_desc;
+
+
+       FUNCTION_TRACE ("Hw_obtain_sleep_type_register_data");
 
 
        /*
         *  Validate parameters
         */
-
        if ((sleep_state > ACPI_S_STATES_MAX) ||
                !slp_typ_a || !slp_typ_b) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        /*
         *  Acpi_evaluate the namespace object containing the values for this state
         */
-
-       status = acpi_ns_evaluate_by_name (sleep_state_table[sleep_state], NULL, &obj_desc);
+       status = acpi_ns_evaluate_by_name ((NATIVE_CHAR *) acpi_gbl_db_sleep_states[sleep_state],
+                         NULL, &obj_desc);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        if (!obj_desc) {
                REPORT_ERROR (("Missing Sleep State object\n"));
-               return (AE_NOT_EXIST);
+               return_ACPI_STATUS (AE_NOT_EXIST);
        }
 
        /*
@@ -207,10 +216,14 @@ acpi_hw_obtain_sleep_type_register_data (
        }
 
 
+       if (ACPI_FAILURE (status)) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad Sleep object %p type %X\n",
+                       obj_desc, obj_desc->common.type));
+       }
 
        acpi_ut_remove_reference (obj_desc);
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -244,6 +257,9 @@ acpi_hw_register_bit_access (
        va_list                 marker;
 
 
+       FUNCTION_TRACE ("Hw_register_bit_access");
+
+
        if (read_write == ACPI_WRITE) {
                va_start (marker, register_id);
                value = va_arg (marker, u32);
@@ -261,7 +277,6 @@ acpi_hw_register_bit_access (
         * Check bit id to fine locate Register offset.
         * Check Mask to determine Register offset, and then read-write.
         */
-
        switch (REGISTER_BLOCK_ID (register_id)) {
        case PM1_STS:
 
@@ -309,7 +324,6 @@ acpi_hw_register_bit_access (
                         * others should be written as 0 so they will be left
                         * unchanged
                         */
-
                        value <<= acpi_hw_get_bit_shift (mask);
                        value &= mask;
 
@@ -402,6 +416,8 @@ acpi_hw_register_bit_access (
                 */
                register_value = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, PM1_CONTROL);
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM1 control: Read %X\n", register_value));
+
                if (read_write == ACPI_WRITE) {
                        register_value &= ~mask;
                        value          <<= acpi_hw_get_bit_shift (mask);
@@ -417,7 +433,6 @@ acpi_hw_register_bit_access (
                         * Therefore, pass the Register_id, not just generic PM1_CONTROL,
                         * because we need to do different things. Yuck.
                         */
-
                        acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, register_id,
                                        (u16) register_value);
                }
@@ -438,12 +453,18 @@ acpi_hw_register_bit_access (
 
                register_value = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, PM2_CONTROL);
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM2 control: Read %X from %p\n",
+                       register_value, ACPI_GET_ADDRESS (acpi_gbl_FADT->Xpm2_cnt_blk.address)));
+
                if (read_write == ACPI_WRITE) {
                        register_value &= ~mask;
                        value          <<= acpi_hw_get_bit_shift (mask);
                        value          &= mask;
                        register_value |= value;
 
+                       ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %04X to %p\n", register_value,
+                               acpi_gbl_FADT->Xpm2_cnt_blk.address));
+
                        acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
                                           PM2_CONTROL, (u8) (register_value));
                }
@@ -455,6 +476,9 @@ acpi_hw_register_bit_access (
                mask = TMR_VAL_MASK;
                register_value = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK,
                                 PM_TIMER);
+               ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM_TIMER: Read %X from %p\n",
+                       register_value, ACPI_GET_ADDRESS (acpi_gbl_FADT->Xpm_tmr_blk.address)));
+
                break;
 
 
@@ -474,7 +498,6 @@ acpi_hw_register_bit_access (
                 *     gpe_block_id is one of GPE[01]_EN_BLOCK and GPE[01]_STS_BLOCK
                 *     gpe_bit_number is relative from the gpe_block (0x00~0xFF)
                 */
-
                mask = REGISTER_BIT_ID(register_id); /* gpe_bit_number */
                register_id = REGISTER_BLOCK_ID(register_id) | (mask >> 3);
                mask = acpi_gbl_decode_to8bit [mask % 8];
@@ -494,15 +517,21 @@ acpi_hw_register_bit_access (
                /* Now get the current Enable Bits in the selected Reg */
 
                register_value = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, register_id);
+               ACPI_DEBUG_PRINT ((ACPI_DB_IO, "GPE Enable bits: Read %X from %X\n",
+                       register_value, register_id));
+
                if (read_write == ACPI_WRITE) {
                        register_value &= ~mask;
                        value          <<= acpi_hw_get_bit_shift (mask);
                        value          &= mask;
                        register_value |= value;
 
-                       /* This write will put the Action state into the General Purpose */
-                       /* Enable Register indexed by the value in Mask */
-
+                       /*
+                        * This write will put the Action state into the General Purpose
+                        * Enable Register indexed by the value in Mask
+                        */
+                       ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %04X to %04X\n",
+                               register_value, register_id));
                        acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, register_id,
                                (u8) register_value);
                        register_value = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK,
@@ -513,6 +542,7 @@ acpi_hw_register_bit_access (
 
        case SMI_CMD_BLOCK:
        case PROCESSOR_BLOCK:
+
                /* Not used by any callers at this time - therefore, not implemented */
 
        default:
@@ -529,7 +559,8 @@ acpi_hw_register_bit_access (
        register_value &= mask;
        register_value >>= acpi_hw_get_bit_shift (mask);
 
-       return (register_value);
+       ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Register I/O: returning %X\n", register_value));
+       return_VALUE (register_value);
 }
 
 
@@ -552,10 +583,13 @@ acpi_hw_register_read (
        u8                      use_lock,
        u32                     register_id)
 {
-       u32                     value       = 0;
+       u32                     value = 0;
        u32                     bank_offset;
 
 
+       FUNCTION_TRACE ("Hw_register_read");
+
+
        if (ACPI_MTX_LOCK == use_lock) {
                acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE);
        }
@@ -596,40 +630,42 @@ acpi_hw_register_read (
                break;
 
 
+       /*
+        * For the GPE? Blocks, the lower word of Register_id contains the
+        * byte offset for which to read, as each part of each block may be
+        * several bytes long.
+        */
        case GPE0_STS_BLOCK: /* 8-bit access */
 
-               value =  acpi_hw_low_level_read (8, &acpi_gbl_FADT->Xgpe0blk, 0);
+               bank_offset = REGISTER_BIT_ID(register_id);
+               value = acpi_hw_low_level_read (8, &acpi_gbl_FADT->Xgpe0blk, bank_offset);
                break;
 
-
        case GPE0_EN_BLOCK: /* 8-bit access */
 
-               bank_offset = DIV_2 (acpi_gbl_FADT->gpe0blk_len);
-               value =  acpi_hw_low_level_read (8, &acpi_gbl_FADT->Xgpe0blk, bank_offset);
+               bank_offset = DIV_2 (acpi_gbl_FADT->gpe0blk_len) + REGISTER_BIT_ID(register_id);
+               value = acpi_hw_low_level_read (8, &acpi_gbl_FADT->Xgpe0blk, bank_offset);
                break;
 
-
        case GPE1_STS_BLOCK: /* 8-bit access */
 
-               value =  acpi_hw_low_level_read (8, &acpi_gbl_FADT->Xgpe1_blk, 0);
+               bank_offset = REGISTER_BIT_ID(register_id);
+               value = acpi_hw_low_level_read (8, &acpi_gbl_FADT->Xgpe1_blk, bank_offset);
                break;
 
-
        case GPE1_EN_BLOCK: /* 8-bit access */
 
-               bank_offset = DIV_2 (acpi_gbl_FADT->gpe1_blk_len);
-               value =  acpi_hw_low_level_read (8, &acpi_gbl_FADT->Xgpe1_blk, bank_offset);
+               bank_offset = DIV_2 (acpi_gbl_FADT->gpe1_blk_len) + REGISTER_BIT_ID(register_id);
+               value = acpi_hw_low_level_read (8, &acpi_gbl_FADT->Xgpe1_blk, bank_offset);
                break;
 
-
        case SMI_CMD_BLOCK: /* 8bit */
 
-               value = (u32) acpi_os_in8 (acpi_gbl_FADT->smi_cmd);
+               acpi_os_read_port (acpi_gbl_FADT->smi_cmd, &value, 8);
                break;
 
-
        default:
-               value = 0;
+               /* Value will be returned as 0 */
                break;
        }
 
@@ -638,7 +674,7 @@ acpi_hw_register_read (
                acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
        }
 
-       return (value);
+       return_VALUE (value);
 }
 
 
@@ -665,6 +701,9 @@ acpi_hw_register_write (
        u32                     bank_offset;
 
 
+       FUNCTION_TRACE ("Hw_register_write");
+
+
        if (ACPI_MTX_LOCK == use_lock) {
                acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE);
        }
@@ -719,26 +758,28 @@ acpi_hw_register_write (
 
        case GPE0_STS_BLOCK: /* 8-bit access */
 
-               acpi_hw_low_level_write (8, value, &acpi_gbl_FADT->Xgpe0blk, 0);
+               bank_offset = REGISTER_BIT_ID(register_id);
+               acpi_hw_low_level_write (8, value, &acpi_gbl_FADT->Xgpe0blk, bank_offset);
                break;
 
 
        case GPE0_EN_BLOCK: /* 8-bit access */
 
-               bank_offset = DIV_2 (acpi_gbl_FADT->gpe0blk_len);
+               bank_offset = DIV_2 (acpi_gbl_FADT->gpe0blk_len) + REGISTER_BIT_ID(register_id);
                acpi_hw_low_level_write (8, value, &acpi_gbl_FADT->Xgpe0blk, bank_offset);
                break;
 
 
        case GPE1_STS_BLOCK: /* 8-bit access */
 
-               acpi_hw_low_level_write (8, value, &acpi_gbl_FADT->Xgpe1_blk, 0);
+               bank_offset = REGISTER_BIT_ID(register_id);
+               acpi_hw_low_level_write (8, value, &acpi_gbl_FADT->Xgpe1_blk, bank_offset);
                break;
 
 
        case GPE1_EN_BLOCK: /* 8-bit access */
 
-               bank_offset = DIV_2 (acpi_gbl_FADT->gpe1_blk_len);
+               bank_offset = DIV_2 (acpi_gbl_FADT->gpe1_blk_len) + REGISTER_BIT_ID(register_id);
                acpi_hw_low_level_write (8, value, &acpi_gbl_FADT->Xgpe1_blk, bank_offset);
                break;
 
@@ -748,7 +789,7 @@ acpi_hw_register_write (
                /* For 2.0, SMI_CMD is always in IO space */
                /* TBD: what about 1.0? 0.71? */
 
-               acpi_os_out8 (acpi_gbl_FADT->smi_cmd, (u8) value);
+               acpi_os_write_port (acpi_gbl_FADT->smi_cmd, value, 8);
                break;
 
 
@@ -762,7 +803,7 @@ acpi_hw_register_write (
                acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
        }
 
-       return;
+       return_VOID;
 }
 
 
@@ -783,14 +824,17 @@ acpi_hw_register_write (
 u32
 acpi_hw_low_level_read (
        u32                     width,
-       ACPI_GENERIC_ADDRESS    *reg,
+       acpi_generic_address    *reg,
        u32                     offset)
 {
        u32                     value = 0;
        ACPI_PHYSICAL_ADDRESS   mem_address;
        ACPI_IO_ADDRESS         io_address;
-       u32                     pci_register;
-       u32                     pci_dev_func;
+       acpi_pci_id             pci_id;
+       u16                     pci_register;
+
+
+       FUNCTION_ENTRY ();
 
 
        /*
@@ -807,23 +851,12 @@ acpi_hw_low_level_read (
         * Three address spaces supported:
         * Memory, Io, or PCI config.
         */
-
        switch (reg->address_space_id) {
        case ACPI_ADR_SPACE_SYSTEM_MEMORY:
 
                mem_address = (ACPI_PHYSICAL_ADDRESS) (ACPI_GET_ADDRESS (reg->address) + offset);
 
-               switch (width) {
-               case 8:
-                       value = acpi_os_mem_in8 (mem_address);
-                       break;
-               case 16:
-                       value = acpi_os_mem_in16 (mem_address);
-                       break;
-               case 32:
-                       value = acpi_os_mem_in32 (mem_address);
-                       break;
-               }
+               acpi_os_read_memory (mem_address, &value, width);
                break;
 
 
@@ -831,36 +864,19 @@ acpi_hw_low_level_read (
 
                io_address = (ACPI_IO_ADDRESS) (ACPI_GET_ADDRESS (reg->address) + offset);
 
-               switch (width) {
-               case 8:
-                       value = acpi_os_in8 (io_address);
-                       break;
-               case 16:
-                       value = acpi_os_in16 (io_address);
-                       break;
-               case 32:
-                       value = acpi_os_in32 (io_address);
-                       break;
-               }
+               acpi_os_read_port (io_address, &value, width);
                break;
 
 
        case ACPI_ADR_SPACE_PCI_CONFIG:
 
-               pci_dev_func = ACPI_PCI_DEVFUN  (ACPI_GET_ADDRESS (reg->address));
-               pci_register = ACPI_PCI_REGISTER (ACPI_GET_ADDRESS (reg->address)) + offset;
+               pci_id.segment = 0;
+               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);
 
-               switch (width) {
-               case 8:
-                       acpi_os_read_pci_cfg_byte (0, pci_dev_func, pci_register, (u8 *) &value);
-                       break;
-               case 16:
-                       acpi_os_read_pci_cfg_word (0, pci_dev_func, pci_register, (u16 *) &value);
-                       break;
-               case 32:
-                       acpi_os_read_pci_cfg_dword (0, pci_dev_func, pci_register, (u32 *) &value);
-                       break;
-               }
+               acpi_os_read_pci_configuration (&pci_id, pci_register, &value, width);
                break;
        }
 
@@ -888,13 +904,16 @@ void
 acpi_hw_low_level_write (
        u32                     width,
        u32                     value,
-       ACPI_GENERIC_ADDRESS    *reg,
+       acpi_generic_address    *reg,
        u32                     offset)
 {
        ACPI_PHYSICAL_ADDRESS   mem_address;
        ACPI_IO_ADDRESS         io_address;
-       u32                     pci_register;
-       u32                     pci_dev_func;
+       acpi_pci_id             pci_id;
+       u16                     pci_register;
+
+
+       FUNCTION_ENTRY ();
 
 
        /*
@@ -911,23 +930,12 @@ acpi_hw_low_level_write (
         * Three address spaces supported:
         * Memory, Io, or PCI config.
         */
-
        switch (reg->address_space_id) {
        case ACPI_ADR_SPACE_SYSTEM_MEMORY:
 
                mem_address = (ACPI_PHYSICAL_ADDRESS) (ACPI_GET_ADDRESS (reg->address) + offset);
 
-               switch (width) {
-               case 8:
-                       acpi_os_mem_out8 (mem_address, (u8) value);
-                       break;
-               case 16:
-                       acpi_os_mem_out16 (mem_address, (u16) value);
-                       break;
-               case 32:
-                       acpi_os_mem_out32 (mem_address, (u32) value);
-                       break;
-               }
+               acpi_os_write_memory (mem_address, value, width);
                break;
 
 
@@ -935,36 +943,19 @@ acpi_hw_low_level_write (
 
                io_address = (ACPI_IO_ADDRESS) (ACPI_GET_ADDRESS (reg->address) + offset);
 
-               switch (width) {
-               case 8:
-                       acpi_os_out8 (io_address, (u8) value);
-                       break;
-               case 16:
-                       acpi_os_out16 (io_address, (u16) value);
-                       break;
-               case 32:
-                       acpi_os_out32 (io_address, (u32) value);
-                       break;
-               }
+               acpi_os_write_port (io_address, value, width);
                break;
 
 
        case ACPI_ADR_SPACE_PCI_CONFIG:
 
-               pci_dev_func = ACPI_PCI_DEVFUN  (ACPI_GET_ADDRESS (reg->address));
-               pci_register = ACPI_PCI_REGISTER (ACPI_GET_ADDRESS (reg->address)) + offset;
+               pci_id.segment = 0;
+               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);
 
-               switch (width) {
-               case 8:
-                       acpi_os_write_pci_cfg_byte (0, pci_dev_func, pci_register, (u8) value);
-                       break;
-               case 16:
-                       acpi_os_write_pci_cfg_word (0, pci_dev_func, pci_register, (u16) value);
-                       break;
-               case 32:
-                       acpi_os_write_pci_cfg_dword (0, pci_dev_func, pci_register, (u32) value);
-                       break;
-               }
+               acpi_os_write_pci_configuration (&pci_id, pci_register, value, width);
                break;
        }
 }
index a787b66999f78dc20dfc5d2567bed5fcbbf76a71..a8aa3396ab5d918f6e1d39c9a597340b8f7aa56f 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface
- *              $Revision: 12 $
+ *              $Revision: 21 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_set_firmware_waking_vector (
        ACPI_PHYSICAL_ADDRESS physical_address)
 {
 
+       FUNCTION_TRACE ("Acpi_set_firmware_waking_vector");
+
 
        /* Make sure that we have an FACS */
 
        if (!acpi_gbl_FACS) {
-               return (AE_NO_ACPI_TABLES);
+               return_ACPI_STATUS (AE_NO_ACPI_TABLES);
        }
 
        /* Set the vector */
@@ -66,7 +68,7 @@ acpi_set_firmware_waking_vector (
                *acpi_gbl_FACS->firmware_waking_vector = physical_address;
        }
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -84,20 +86,22 @@ acpi_set_firmware_waking_vector (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_get_firmware_waking_vector (
        ACPI_PHYSICAL_ADDRESS *physical_address)
 {
 
+       FUNCTION_TRACE ("Acpi_get_firmware_waking_vector");
+
 
        if (!physical_address) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        /* Make sure that we have an FACS */
 
        if (!acpi_gbl_FACS) {
-               return (AE_NO_ACPI_TABLES);
+               return_ACPI_STATUS (AE_NO_ACPI_TABLES);
        }
 
        /* Get the vector */
@@ -109,7 +113,7 @@ acpi_get_firmware_waking_vector (
                *physical_address = *acpi_gbl_FACS->firmware_waking_vector;
        }
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 /******************************************************************************
@@ -124,23 +128,25 @@ acpi_get_firmware_waking_vector (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_enter_sleep_state (
        u8                  sleep_state)
 {
-       ACPI_STATUS         status;
-       ACPI_OBJECT_LIST    arg_list;
-       ACPI_OBJECT         arg;
+       acpi_status         status;
+       acpi_object_list    arg_list;
+       acpi_object         arg;
        u8                  type_a;
        u8                  type_b;
        u16                 PM1_acontrol;
        u16                 PM1_bcontrol;
 
 
+       FUNCTION_TRACE ("Acpi_enter_sleep_state");
+
+
        /*
         * _PSW methods could be run here to enable wake-on keyboard, LAN, etc.
         */
-
        status = acpi_hw_obtain_sleep_type_register_data (sleep_state, &type_a, &type_b);
        if (!ACPI_SUCCESS (status)) {
                return status;
@@ -156,38 +162,109 @@ acpi_enter_sleep_state (
        arg.type = ACPI_TYPE_INTEGER;
        arg.integer.value = sleep_state;
 
-       acpi_evaluate_object(NULL, "\\_PTS", &arg_list, NULL);
-       acpi_evaluate_object(NULL, "\\_GTS", &arg_list, NULL);
+       acpi_evaluate_object (NULL, "\\_PTS", &arg_list, NULL);
+       acpi_evaluate_object (NULL, "\\_GTS", &arg_list, NULL);
 
        /* clear wake status */
 
-       acpi_hw_register_bit_access(ACPI_WRITE, ACPI_MTX_LOCK, WAK_STS, 1);
+       acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, WAK_STS, 1);
+
+       disable ();
 
-       disable();
+       /* TODO: disable all non-wake GPEs here */
 
-       PM1_acontrol = (u16) acpi_hw_register_read(ACPI_MTX_LOCK, PM1_CONTROL);
+       PM1_acontrol = (u16) acpi_hw_register_read (ACPI_MTX_LOCK, PM1_CONTROL);
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_OK, "Entering S%d\n", sleep_state));
 
        /* mask off SLP_EN and SLP_TYP fields */
-       PM1_acontrol &= 0xC3FF;
+
+       PM1_acontrol &= ~(SLP_TYPE_X_MASK | SLP_EN_MASK);
        PM1_bcontrol = PM1_acontrol;
 
        /* mask in SLP_TYP */
+
        PM1_acontrol |= (type_a << acpi_hw_get_bit_shift (SLP_TYPE_X_MASK));
        PM1_bcontrol |= (type_b << acpi_hw_get_bit_shift (SLP_TYPE_X_MASK));
 
-       /* write #1: fill in SLP_TYPE data */
-       acpi_hw_register_write(ACPI_MTX_LOCK, PM1_a_CONTROL, PM1_acontrol);
-       acpi_hw_register_write(ACPI_MTX_LOCK, PM1_b_CONTROL, PM1_bcontrol);
+       /* write #1: fill in SLP_TYP data */
+
+       acpi_hw_register_write (ACPI_MTX_LOCK, PM1_a_CONTROL, PM1_acontrol);
+       acpi_hw_register_write (ACPI_MTX_LOCK, PM1_b_CONTROL, PM1_bcontrol);
 
        /* mask in SLP_EN */
+
        PM1_acontrol |= (1 << acpi_hw_get_bit_shift (SLP_EN_MASK));
        PM1_bcontrol |= (1 << acpi_hw_get_bit_shift (SLP_EN_MASK));
 
-       /* write #2: the whole tamale */
-       acpi_hw_register_write(ACPI_MTX_LOCK, PM1_a_CONTROL, PM1_acontrol);
-       acpi_hw_register_write(ACPI_MTX_LOCK, PM1_b_CONTROL, PM1_bcontrol);
+       /* flush caches */
+
+       wbinvd();
+
+       /* write #2: SLP_TYP + SLP_EN */
+
+       acpi_hw_register_write (ACPI_MTX_LOCK, PM1_a_CONTROL, PM1_acontrol);
+       acpi_hw_register_write (ACPI_MTX_LOCK, PM1_b_CONTROL, PM1_bcontrol);
+
+       /*
+        * 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, PM1_CONTROL,
+                       (1 << acpi_hw_get_bit_shift (SLP_EN_MASK)));
+       }
+
+       /* wait until we enter sleep state */
+
+       do {
+               acpi_os_stall(10000);
+       }
+       while (!acpi_hw_register_bit_access (ACPI_READ, ACPI_MTX_LOCK, WAK_STS));
+
+       enable ();
+
+       return_ACPI_STATUS (AE_OK);
+}
+
+/******************************************************************************
+ *
+ * FUNCTION:    Acpi_leave_sleep_state
+ *
+ * PARAMETERS:  Sleep_state         - Which sleep state we just exited
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Perform OS-independent ACPI cleanup after a sleep
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_leave_sleep_state (
+       u8                  sleep_state)
+{
+       acpi_object_list    arg_list;
+       acpi_object         arg;
+
+
+       FUNCTION_TRACE ("Acpi_leave_sleep_state");
+
+
+       MEMSET (&arg_list, 0, sizeof(arg_list));
+       arg_list.count = 1;
+       arg_list.pointer = &arg;
+
+       MEMSET (&arg, 0, sizeof(arg));
+       arg.type = ACPI_TYPE_INTEGER;
+       arg.integer.value = sleep_state;
+
+       acpi_evaluate_object (NULL, "\\_BFS", &arg_list, NULL);
+       acpi_evaluate_object (NULL, "\\_WAK", &arg_list, NULL);
+
+       /* _WAK returns stuff - do we want to look at it? */
 
-       enable();
+       /* Re-enable GPEs */
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
index 78b768f6db0070e8693eaa6cd3b459f74eb46eab..32ed9d8e96f490831564bd1fd6d8f6a6da2b62c6 100644 (file)
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Name: hwtimer.c - ACPI Power Management Timer Interface
- *              $Revision: 10 $
+ *              $Revision: 12 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_get_timer_resolution (
        u32                     *resolution)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Acpi_get_timer_resolution");
 
 
        /* Ensure that ACPI has been initialized */
 
        ACPI_IS_INITIALIZATION_COMPLETE (status);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        if (!resolution) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        if (0 == acpi_gbl_FADT->tmr_val_ext) {
                *resolution = 24;
        }
+
        else {
                *resolution = 32;
        }
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -84,27 +88,31 @@ acpi_get_timer_resolution (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_get_timer (
        u32                     *ticks)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Acpi_get_timer");
 
 
        /* Ensure that ACPI has been initialized */
 
        ACPI_IS_INITIALIZATION_COMPLETE (status);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        if (!ticks) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
-       *ticks = acpi_os_in32 ((ACPI_IO_ADDRESS) ACPI_GET_ADDRESS (acpi_gbl_FADT->Xpm_tmr_blk.address));
+       acpi_os_read_port ((ACPI_IO_ADDRESS)
+               ACPI_GET_ADDRESS (acpi_gbl_FADT->Xpm_tmr_blk.address), ticks, 32);
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -134,7 +142,7 @@ acpi_get_timer (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_get_timer_duration (
        u32                     start_ticks,
        u32                     end_ticks,
@@ -147,8 +155,11 @@ acpi_get_timer_duration (
        u32                     remainder = 0;
 
 
+       FUNCTION_TRACE ("Acpi_get_timer_duration");
+
+
        if (!time_elapsed) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        /*
@@ -159,19 +170,24 @@ acpi_get_timer_duration (
        if (start_ticks < end_ticks) {
                delta_ticks = end_ticks - start_ticks;
        }
+
        else if (start_ticks > end_ticks) {
                /* 24-bit Timer */
+
                if (0 == acpi_gbl_FADT->tmr_val_ext) {
                        delta_ticks = (((0x00FFFFFF - start_ticks) + end_ticks) & 0x00FFFFFF);
                }
+
                /* 32-bit Timer */
+
                else {
                        delta_ticks = (0xFFFFFFFF - start_ticks) + end_ticks;
                }
        }
+
        else {
                *time_elapsed = 0;
-               return (AE_OK);
+               return_ACPI_STATUS (AE_OK);
        }
 
        /*
@@ -200,22 +216,26 @@ acpi_get_timer_duration (
         */
 
        /* Step #1 */
+
        seconds = delta_ticks / PM_TIMER_FREQUENCY;
        remainder = delta_ticks % PM_TIMER_FREQUENCY;
 
        /* Step #2 */
+
        milliseconds = (remainder * 1000) / PM_TIMER_FREQUENCY;
        remainder = (remainder * 1000) % PM_TIMER_FREQUENCY;
 
        /* Step #3 */
+
        microseconds = (remainder * 1000) / PM_TIMER_FREQUENCY;
 
        /* Step #4 */
+
        *time_elapsed = seconds * 1000000;
        *time_elapsed += milliseconds * 1000;
        *time_elapsed += microseconds;
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
index 02710386539213fab14f37e8cb5226d6e57dc4a4..8e0eee4f030ba3c0d789b22b02f06d842616da5a 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acconfig.h - Global configuration constants
- *       $Revision: 65 $
+ *       $Revision: 69 $
  *
  *****************************************************************************/
 
@@ -53,7 +53,7 @@
 
 /* Version string */
 
-#define ACPI_CA_VERSION             0x20010615
+#define ACPI_CA_VERSION             0x20010831
 
 
 /* Maximum objects in the various object caches */
@@ -62,7 +62,7 @@
 #define MAX_PARSE_CACHE_DEPTH       96          /* Parse tree objects */
 #define MAX_EXTPARSE_CACHE_DEPTH    64          /* Parse tree objects */
 #define MAX_OBJECT_CACHE_DEPTH      64          /* Interpreter operand objects */
-#define MAX_WALK_CACHE_DEPTH        2           /* Objects for parse tree walks (method execution) */
+#define MAX_WALK_CACHE_DEPTH        4           /* Objects for parse tree walks (method execution) */
 
 
 /* String size constants */
index 5a8da59a4c705ced617c05ce5b41627f03c07d5e..a47885f17a9e44fa6a65c30433448f7af6ab577e 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acdebug.h - ACPI/AML debugger
- *       $Revision: 44 $
+ *       $Revision: 47 $
  *
  *****************************************************************************/
 
@@ -38,50 +38,44 @@ extern NATIVE_CHAR              *optarg;
 extern u8                       *aml_ptr;
 extern u32                      aml_length;
 
-extern u8                       opt_tables;
-extern u8                       opt_disasm;
-extern u8                       opt_stats;
-extern u8                       opt_parse_jit;
-extern u8                       opt_verbose;
-extern u8                       opt_ini_methods;
-
-
-extern NATIVE_CHAR              *args[DB_MAX_ARGS];
-extern NATIVE_CHAR              line_buf[80];
-extern NATIVE_CHAR              scope_buf[40];
-extern NATIVE_CHAR              debug_filename[40];
-extern u8                       output_to_file;
-extern NATIVE_CHAR              *buffer;
-extern NATIVE_CHAR              *filename;
-extern NATIVE_CHAR              *INDENT_STRING;
+extern u8                       acpi_gbl_db_opt_tables;
+extern u8                       acpi_gbl_db_opt_disasm;
+extern u8                       acpi_gbl_db_opt_stats;
+extern u8                       acpi_gbl_db_opt_parse_jit;
+extern u8                       acpi_gbl_db_opt_verbose;
+extern u8                       acpi_gbl_db_opt_ini_methods;
+
+
+extern NATIVE_CHAR              *acpi_gbl_db_args[DB_MAX_ARGS];
+extern NATIVE_CHAR              acpi_gbl_db_line_buf[80];
+extern NATIVE_CHAR              acpi_gbl_db_scope_buf[40];
+extern NATIVE_CHAR              acpi_gbl_db_debug_filename[40];
+extern u8                       acpi_gbl_db_output_to_file;
+extern NATIVE_CHAR              *acpi_gbl_db_buffer;
+extern NATIVE_CHAR              *acpi_gbl_db_filename;
+extern NATIVE_CHAR              *acpi_gbl_db_disasm_indent;
 extern u8                       acpi_gbl_db_output_flags;
 extern u32                      acpi_gbl_db_debug_level;
 extern u32                      acpi_gbl_db_console_debug_level;
 
-extern u32                      num_names;
-extern u32                      num_methods;
-extern u32                      num_regions;
-extern u32                      num_packages;
-extern u32                      num_aliases;
-extern u32                      num_devices;
-extern u32                      num_field_defs;
-extern u32                      num_thermal_zones;
-extern u32                      num_nodes;
-extern u32                      num_grammar_elements;
-extern u32                      num_method_elements ;
-extern u32                      num_mutexes;
-extern u32                      num_power_resources;
-extern u32                      num_bank_fields ;
-extern u32                      num_index_fields;
-extern u32                      num_events;
-
-extern u32                      size_of_parse_tree;
-extern u32                      size_of_method_trees;
-extern u32                      size_of_nTes;
-extern u32                      size_of_acpi_objects;
-
-
-#define BUFFER_SIZE             4196
+/*
+ * Statistic globals
+ */
+extern u16                      acpi_gbl_obj_type_count[INTERNAL_TYPE_NODE_MAX+1];
+extern u16                      acpi_gbl_node_type_count[INTERNAL_TYPE_NODE_MAX+1];
+extern u16                      acpi_gbl_obj_type_count_misc;
+extern u16                      acpi_gbl_node_type_count_misc;
+extern u32                      acpi_gbl_num_nodes;
+extern u32                      acpi_gbl_num_objects;
+
+
+extern u32                      acpi_gbl_size_of_parse_tree;
+extern u32                      acpi_gbl_size_of_method_trees;
+extern u32                      acpi_gbl_size_of_node_entries;
+extern u32                      acpi_gbl_size_of_acpi_objects;
+
+
+#define ACPI_DEBUG_BUFFER_SIZE  4196
 
 #define DB_REDIRECTABLE_OUTPUT  0x01
 #define DB_CONSOLE_OUTPUT       0x02
@@ -105,7 +99,7 @@ typedef struct argument_info
 
 #define PARAM_LIST(pl)                  pl
 
-#define DBTEST_OUTPUT_LEVEL(lvl)        if (opt_verbose)
+#define DBTEST_OUTPUT_LEVEL(lvl)        if (acpi_gbl_db_opt_verbose)
 
 #define VERBOSE_PRINT(fp)               DBTEST_OUTPUT_LEVEL(lvl) {\
                          acpi_os_printf PARAM_LIST(fp);}
@@ -125,10 +119,10 @@ int
 acpi_db_initialize (
        void);
 
-ACPI_STATUS
+acpi_status
 acpi_db_single_step (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *op,
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *op,
        u8                      op_type);
 
 
@@ -149,17 +143,17 @@ acpi_db_unload_acpi_table (
 void
 acpi_db_set_method_breakpoint (
        NATIVE_CHAR             *location,
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *op);
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *op);
 
 void
 acpi_db_set_method_call_breakpoint (
-       ACPI_PARSE_OBJECT       *op);
+       acpi_parse_object       *op);
 
 void
 acpi_db_disassemble_aml (
        NATIVE_CHAR             *statements,
-       ACPI_PARSE_OBJECT       *op);
+       acpi_parse_object       *op);
 
 void
 acpi_db_dump_namespace (
@@ -182,12 +176,12 @@ acpi_db_set_method_data (
        NATIVE_CHAR             *index_arg,
        NATIVE_CHAR             *value_arg);
 
-ACPI_STATUS
+acpi_status
 acpi_db_display_objects (
        NATIVE_CHAR             *obj_type_arg,
        NATIVE_CHAR             *display_count_arg);
 
-ACPI_STATUS
+acpi_status
 acpi_db_find_name_in_namespace (
        NATIVE_CHAR             *name_arg);
 
@@ -214,8 +208,8 @@ acpi_db_display_resources (
 
 void
 acpi_db_display_op (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *origin,
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *origin,
        u32                     num_opcodes);
 
 void
@@ -224,16 +218,16 @@ acpi_db_display_namestring (
 
 void
 acpi_db_display_path (
-       ACPI_PARSE_OBJECT       *op);
+       acpi_parse_object       *op);
 
 void
 acpi_db_display_opcode (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *op);
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *op);
 
 void
 acpi_db_decode_internal_object (
-       ACPI_OPERAND_OBJECT     *obj_desc);
+       acpi_operand_object     *obj_desc);
 
 
 /*
@@ -243,7 +237,7 @@ acpi_db_decode_internal_object (
 
 void
 acpi_db_display_method_info (
-       ACPI_PARSE_OBJECT       *op);
+       acpi_parse_object       *op);
 
 void
 acpi_db_decode_and_display_object (
@@ -252,17 +246,17 @@ acpi_db_decode_and_display_object (
 
 void
 acpi_db_display_result_object (
-       ACPI_OPERAND_OBJECT     *obj_desc,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_operand_object     *obj_desc,
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_db_display_all_methods (
        NATIVE_CHAR             *display_count_arg);
 
 void
 acpi_db_display_internal_object (
-       ACPI_OPERAND_OBJECT     *obj_desc,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_operand_object     *obj_desc,
+       acpi_walk_state         *walk_state);
 
 void
 acpi_db_display_arguments (
@@ -282,8 +276,8 @@ acpi_db_display_calling_tree (
 
 void
 acpi_db_display_argument_object (
-       ACPI_OPERAND_OBJECT     *obj_desc,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_operand_object     *obj_desc,
+       acpi_walk_state         *walk_state);
 
 
 /*
@@ -307,7 +301,7 @@ acpi_db_create_execution_threads (
  * dbfileio - Debugger file I/O commands
  */
 
-ACPI_OBJECT_TYPE8
+acpi_object_type8
 acpi_db_match_argument (
        NATIVE_CHAR             *user_argument,
        ARGUMENT_INFO           *arguments);
@@ -321,7 +315,7 @@ void
 acpi_db_open_debug_file (
        NATIVE_CHAR             *name);
 
-ACPI_STATUS
+acpi_status
 acpi_db_load_acpi_table (
        NATIVE_CHAR             *filename);
 
@@ -346,20 +340,20 @@ acpi_db_get_from_history (
  * dbinput - user front-end to the AML debugger
  */
 
-ACPI_STATUS
+acpi_status
 acpi_db_command_dispatch (
        NATIVE_CHAR             *input_buffer,
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *op);
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *op);
 
 void
 acpi_db_execute_thread (
        void                    *context);
 
-ACPI_STATUS
+acpi_status
 acpi_db_user_commands (
        NATIVE_CHAR             prompt,
-       ACPI_PARSE_OBJECT       *op);
+       acpi_parse_object       *op);
 
 
 /*
@@ -368,11 +362,11 @@ acpi_db_user_commands (
 
 void
 acpi_db_generate_statistics (
-       ACPI_PARSE_OBJECT       *root,
+       acpi_parse_object       *root,
        u8                      is_method);
 
 
-ACPI_STATUS
+acpi_status
 acpi_db_display_statistics (
        NATIVE_CHAR             *type_arg);
 
@@ -391,7 +385,7 @@ acpi_db_dump_buffer (
 
 void
 acpi_db_dump_object (
-       ACPI_OBJECT             *obj_desc,
+       acpi_object             *obj_desc,
        u32                     level);
 
 void
@@ -399,11 +393,11 @@ acpi_db_prep_namestring (
        NATIVE_CHAR             *name);
 
 
-ACPI_STATUS
+acpi_status
 acpi_db_second_pass_parse (
-       ACPI_PARSE_OBJECT       *root);
+       acpi_parse_object       *root);
 
-ACPI_NAMESPACE_NODE *
+acpi_namespace_node *
 acpi_db_local_ns_lookup (
        NATIVE_CHAR             *name);
 
index 7a9aba1856e9d79bd4d10eefcf10681d598bf990..6643ac16ff21ec257a6c7d9cdda48009de8a2301 100644 (file)
 
 /* Common interfaces */
 
-ACPI_STATUS
+acpi_status
 acpi_ds_obj_stack_push (
        void                    *object,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_obj_stack_pop (
        u32                     pop_count,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_walk_state         *walk_state);
 
 void *
 acpi_ds_obj_stack_get_value (
        u32                     index,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_obj_stack_pop_object (
-       ACPI_OPERAND_OBJECT     **object,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_operand_object     **object,
+       acpi_walk_state         *walk_state);
 
 
 /* dsopcode - support for late evaluation */
 
-ACPI_STATUS
+acpi_status
 acpi_ds_get_buffer_field_arguments (
-       ACPI_OPERAND_OBJECT     *obj_desc);
+       acpi_operand_object     *obj_desc);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_get_region_arguments (
-       ACPI_OPERAND_OBJECT     *rgn_desc);
+       acpi_operand_object     *rgn_desc);
 
 
 /* dsctrl - Parser/Interpreter interface, control stack routines */
 
 
-ACPI_STATUS
+acpi_status
 acpi_ds_exec_begin_control_op (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *op);
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *op);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_exec_end_control_op (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *op);
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *op);
 
 
 /* dsexec - Parser/Interpreter interface, method execution callbacks */
 
 
-ACPI_STATUS
+acpi_status
 acpi_ds_get_predicate_value (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *op,
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *op,
        u32                     has_result_obj);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_exec_begin_op (
        u16                     opcode,
-       ACPI_PARSE_OBJECT       *op,
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       **out_op);
+       acpi_parse_object       *op,
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       **out_op);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_exec_end_op (
-       ACPI_WALK_STATE         *state,
-       ACPI_PARSE_OBJECT       *op);
+       acpi_walk_state         *state,
+       acpi_parse_object       *op);
 
 
 /* dsfield - Parser/Interpreter interface for AML fields */
 
 
-ACPI_STATUS
+acpi_status
 acpi_ds_create_field (
-       ACPI_PARSE_OBJECT       *op,
-       ACPI_NAMESPACE_NODE     *region_node,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_parse_object       *op,
+       acpi_namespace_node     *region_node,
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_create_bank_field (
-       ACPI_PARSE_OBJECT       *op,
-       ACPI_NAMESPACE_NODE     *region_node,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_parse_object       *op,
+       acpi_namespace_node     *region_node,
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_create_index_field (
-       ACPI_PARSE_OBJECT       *op,
-       ACPI_NAMESPACE_NODE     *region_node,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_parse_object       *op,
+       acpi_namespace_node     *region_node,
+       acpi_walk_state         *walk_state);
 
 
 /* dsload - Parser/Interpreter interface, namespace load callbacks */
 
-ACPI_STATUS
+acpi_status
 acpi_ds_load1_begin_op (
        u16                     opcode,
-       ACPI_PARSE_OBJECT       *op,
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       **out_op);
+       acpi_parse_object       *op,
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       **out_op);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_load1_end_op (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *op);
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *op);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_load2_begin_op (
        u16                     opcode,
-       ACPI_PARSE_OBJECT       *op,
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       **out_op);
+       acpi_parse_object       *op,
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       **out_op);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_load2_end_op (
-       ACPI_WALK_STATE         *state,
-       ACPI_PARSE_OBJECT       *op);
+       acpi_walk_state         *state,
+       acpi_parse_object       *op);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_load3_begin_op (
        u16                     opcode,
-       ACPI_PARSE_OBJECT       *op,
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       **out_op);
+       acpi_parse_object       *op,
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       **out_op);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_load3_end_op (
-       ACPI_WALK_STATE         *state,
-       ACPI_PARSE_OBJECT       *op);
+       acpi_walk_state         *state,
+       acpi_parse_object       *op);
 
 
 /* dsmthdat - method data (locals/args) */
 
 
-ACPI_STATUS
+acpi_status
 acpi_ds_store_object_to_local (
        u16                     opcode,
        u32                     index,
-       ACPI_OPERAND_OBJECT     *src_desc,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_operand_object     *src_desc,
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_method_data_get_entry (
        u16                     opcode,
        u32                     index,
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_OPERAND_OBJECT     ***node);
+       acpi_walk_state         *walk_state,
+       acpi_operand_object     ***node);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_method_data_delete_all (
-       ACPI_WALK_STATE         *walk_state);
+       acpi_walk_state         *walk_state);
 
 u8
 acpi_ds_is_method_value (
-       ACPI_OPERAND_OBJECT     *obj_desc);
+       acpi_operand_object     *obj_desc);
 
-ACPI_OBJECT_TYPE8
+acpi_object_type8
 acpi_ds_method_data_get_type (
        u16                     opcode,
        u32                     index,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_method_data_get_value (
        u16                     opcode,
        u32                     index,
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_OPERAND_OBJECT     **dest_desc);
+       acpi_walk_state         *walk_state,
+       acpi_operand_object     **dest_desc);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_method_data_delete_value (
        u16                     opcode,
        u32                     index,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_method_data_init_args (
-       ACPI_OPERAND_OBJECT     **params,
+       acpi_operand_object     **params,
        u32                     max_param_count,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_walk_state         *walk_state);
 
-ACPI_NAMESPACE_NODE *
+acpi_namespace_node *
 acpi_ds_method_data_get_node (
        u16                     opcode,
        u32                     index,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_method_data_init (
-       ACPI_WALK_STATE         *walk_state);
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_method_data_set_entry (
        u16                     opcode,
        u32                     index,
-       ACPI_OPERAND_OBJECT     *object,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_operand_object     *object,
+       acpi_walk_state         *walk_state);
 
 
 /* dsmethod - Parser/Interpreter interface - control method parsing */
 
-ACPI_STATUS
+acpi_status
 acpi_ds_parse_method (
-       ACPI_HANDLE             obj_handle);
+       acpi_handle             obj_handle);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_call_control_method (
-       ACPI_WALK_LIST          *walk_list,
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *op);
+       acpi_walk_list          *walk_list,
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *op);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_restart_control_method (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_OPERAND_OBJECT     *return_desc);
+       acpi_walk_state         *walk_state,
+       acpi_operand_object     *return_desc);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_terminate_control_method (
-       ACPI_WALK_STATE         *walk_state);
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_begin_method_execution (
-       ACPI_NAMESPACE_NODE     *method_node,
-       ACPI_OPERAND_OBJECT     *obj_desc,
-       ACPI_NAMESPACE_NODE     *calling_method_node);
+       acpi_namespace_node     *method_node,
+       acpi_operand_object     *obj_desc,
+       acpi_namespace_node     *calling_method_node);
 
 
 /* dsobj - Parser/Interpreter interface - object initialization and conversion */
 
-ACPI_STATUS
+acpi_status
 acpi_ds_init_one_object (
-       ACPI_HANDLE             obj_handle,
+       acpi_handle             obj_handle,
        u32                     level,
        void                    *context,
        void                    **return_value);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_initialize_objects (
-       ACPI_TABLE_DESC         *table_desc,
-       ACPI_NAMESPACE_NODE     *start_node);
+       acpi_table_desc         *table_desc,
+       acpi_namespace_node     *start_node);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_build_internal_package_obj (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *op,
-       ACPI_OPERAND_OBJECT     **obj_desc);
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *op,
+       acpi_operand_object     **obj_desc);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_build_internal_object (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *op,
-       ACPI_OPERAND_OBJECT     **obj_desc_ptr);
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *op,
+       acpi_operand_object     **obj_desc_ptr);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_init_object_from_op (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *op,
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *op,
        u16                     opcode,
-       ACPI_OPERAND_OBJECT     **obj_desc);
+       acpi_operand_object     **obj_desc);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_create_node (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_NAMESPACE_NODE     *node,
-       ACPI_PARSE_OBJECT       *op);
+       acpi_walk_state         *walk_state,
+       acpi_namespace_node     *node,
+       acpi_parse_object       *op);
 
 
 /* dsregn - Parser/Interpreter interface - Op Region parsing */
 
-ACPI_STATUS
+acpi_status
 acpi_ds_eval_buffer_field_operands (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *op);
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *op);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_eval_region_operands (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *op);
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *op);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_initialize_region (
-       ACPI_HANDLE             obj_handle);
+       acpi_handle             obj_handle);
 
 
 /* dsutils - Parser/Interpreter interface utility routines */
 
 u8
 acpi_ds_is_result_used (
-       ACPI_PARSE_OBJECT       *op,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_parse_object       *op,
+       acpi_walk_state         *walk_state);
 
 void
 acpi_ds_delete_result_if_not_used (
-       ACPI_PARSE_OBJECT       *op,
-       ACPI_OPERAND_OBJECT     *result_obj,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_parse_object       *op,
+       acpi_operand_object     *result_obj,
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_create_operand (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *arg,
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *arg,
        u32                     args_remaining);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_create_operands (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *first_arg);
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *first_arg);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_resolve_operands (
-       ACPI_WALK_STATE         *walk_state);
+       acpi_walk_state         *walk_state);
 
-ACPI_OBJECT_TYPE8
+acpi_object_type8
 acpi_ds_map_opcode_to_data_type (
        u16                     opcode,
        u32                     *out_flags);
 
-ACPI_OBJECT_TYPE8
+acpi_object_type8
 acpi_ds_map_named_opcode_to_data_type (
        u16                     opcode);
 
@@ -358,93 +358,93 @@ acpi_ds_map_named_opcode_to_data_type (
  * dswscope - Scope Stack manipulation
  */
 
-ACPI_STATUS
+acpi_status
 acpi_ds_scope_stack_push (
-       ACPI_NAMESPACE_NODE     *node,
-       ACPI_OBJECT_TYPE8       type,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_namespace_node     *node,
+       acpi_object_type8       type,
+       acpi_walk_state         *walk_state);
 
 
-ACPI_STATUS
+acpi_status
 acpi_ds_scope_stack_pop (
-       ACPI_WALK_STATE         *walk_state);
+       acpi_walk_state         *walk_state);
 
 void
 acpi_ds_scope_stack_clear (
-       ACPI_WALK_STATE         *walk_state);
+       acpi_walk_state         *walk_state);
 
 
 /* Acpi_dswstate - parser WALK_STATE management routines */
 
-ACPI_WALK_STATE *
+acpi_walk_state *
 acpi_ds_create_walk_state (
-       ACPI_OWNER_ID           owner_id,
-       ACPI_PARSE_OBJECT       *origin,
-       ACPI_OPERAND_OBJECT     *mth_desc,
-       ACPI_WALK_LIST          *walk_list);
+       acpi_owner_id           owner_id,
+       acpi_parse_object       *origin,
+       acpi_operand_object     *mth_desc,
+       acpi_walk_list          *walk_list);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_obj_stack_delete_all (
-       ACPI_WALK_STATE         *walk_state);
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_obj_stack_pop_and_delete (
        u32                     pop_count,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_walk_state         *walk_state);
 
 void
 acpi_ds_delete_walk_state (
-       ACPI_WALK_STATE         *walk_state);
+       acpi_walk_state         *walk_state);
 
-ACPI_WALK_STATE *
+acpi_walk_state *
 acpi_ds_pop_walk_state (
-       ACPI_WALK_LIST          *walk_list);
+       acpi_walk_list          *walk_list);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_result_stack_pop (
-       ACPI_WALK_STATE         *walk_state);
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_result_stack_push (
-       ACPI_WALK_STATE         *walk_state);
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_result_stack_clear (
-       ACPI_WALK_STATE         *walk_state);
+       acpi_walk_state         *walk_state);
 
-ACPI_WALK_STATE *
+acpi_walk_state *
 acpi_ds_get_current_walk_state (
-       ACPI_WALK_LIST          *walk_list);
+       acpi_walk_list          *walk_list);
 
 void
 acpi_ds_delete_walk_state_cache (
        void);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_result_insert (
        void                    *object,
        u32                     index,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_result_remove (
-       ACPI_OPERAND_OBJECT     **object,
+       acpi_operand_object     **object,
        u32                     index,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_result_pop (
-       ACPI_OPERAND_OBJECT     **object,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_operand_object     **object,
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_result_push (
-       ACPI_OPERAND_OBJECT     *object,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_operand_object     *object,
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ds_result_pop_from_bottom (
-       ACPI_OPERAND_OBJECT     **object,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_operand_object     **object,
+       acpi_walk_state         *walk_state);
 
 #endif /* _ACDISPAT_H_ */
index cb422a5ffec679eeafb667efacae73258553dc6e..3004f9bcbdb123e0519579d321009208746a2701 100644 (file)
@@ -27,7 +27,7 @@
 #define __ACEVENTS_H__
 
 
-ACPI_STATUS
+acpi_status
 acpi_ev_initialize (
        void);
 
@@ -36,7 +36,7 @@ acpi_ev_initialize (
  * Acpi_evfixed - Fixed event handling
  */
 
-ACPI_STATUS
+acpi_status
 acpi_ev_fixed_event_initialize (
        void);
 
@@ -53,7 +53,7 @@ acpi_ev_fixed_event_dispatch (
  * Acpi_evglock - Global Lock support
  */
 
-ACPI_STATUS
+acpi_status
 acpi_ev_acquire_global_lock(
        void);
 
@@ -61,7 +61,7 @@ void
 acpi_ev_release_global_lock(
        void);
 
-ACPI_STATUS
+acpi_status
 acpi_ev_init_global_lock_handler (
        void);
 
@@ -70,11 +70,11 @@ acpi_ev_init_global_lock_handler (
  * Acpi_evgpe - GPE handling and dispatch
  */
 
-ACPI_STATUS
+acpi_status
 acpi_ev_gpe_initialize (
        void);
 
-ACPI_STATUS
+acpi_status
 acpi_ev_init_gpe_control_methods (
        void);
 
@@ -91,9 +91,9 @@ acpi_ev_gpe_detect (
  * Acpi_evnotify - Device Notify handling and dispatch
  */
 
-ACPI_STATUS
+acpi_status
 acpi_ev_queue_notify_request (
-       ACPI_NAMESPACE_NODE     *node,
+       acpi_namespace_node     *node,
        u32                     notify_value);
 
 void
@@ -104,36 +104,36 @@ acpi_ev_notify_dispatch (
  * Acpi_evregion - Address Space handling
  */
 
-ACPI_STATUS
+acpi_status
 acpi_ev_install_default_address_space_handlers (
        void);
 
-ACPI_STATUS
+acpi_status
 acpi_ev_address_space_dispatch (
-       ACPI_OPERAND_OBJECT    *region_obj,
+       acpi_operand_object    *region_obj,
        u32                     function,
        ACPI_PHYSICAL_ADDRESS   address,
        u32                     bit_width,
        u32                     *value);
 
 
-ACPI_STATUS
+acpi_status
 acpi_ev_addr_handler_helper (
-       ACPI_HANDLE             obj_handle,
+       acpi_handle             obj_handle,
        u32                     level,
        void                    *context,
        void                    **return_value);
 
 void
 acpi_ev_disassociate_region_from_handler(
-       ACPI_OPERAND_OBJECT    *region_obj,
+       acpi_operand_object    *region_obj,
        u8                      acpi_ns_is_locked);
 
 
-ACPI_STATUS
+acpi_status
 acpi_ev_associate_region_and_handler (
-       ACPI_OPERAND_OBJECT     *handler_obj,
-       ACPI_OPERAND_OBJECT     *region_obj,
+       acpi_operand_object     *handler_obj,
+       acpi_operand_object     *region_obj,
        u8                      acpi_ns_is_locked);
 
 
@@ -141,37 +141,37 @@ acpi_ev_associate_region_and_handler (
  * Acpi_evregini - Region initialization and setup
  */
 
-ACPI_STATUS
+acpi_status
 acpi_ev_system_memory_region_setup (
-       ACPI_HANDLE             handle,
+       acpi_handle             handle,
        u32                     function,
        void                    *handler_context,
        void                    **region_context);
 
-ACPI_STATUS
+acpi_status
 acpi_ev_io_space_region_setup (
-       ACPI_HANDLE             handle,
+       acpi_handle             handle,
        u32                     function,
        void                    *handler_context,
        void                    **region_context);
 
-ACPI_STATUS
+acpi_status
 acpi_ev_pci_config_region_setup (
-       ACPI_HANDLE             handle,
+       acpi_handle             handle,
        u32                     function,
        void                    *handler_context,
        void                    **region_context);
 
-ACPI_STATUS
+acpi_status
 acpi_ev_default_region_setup (
-       ACPI_HANDLE             handle,
+       acpi_handle             handle,
        u32                     function,
        void                    *handler_context,
        void                    **region_context);
 
-ACPI_STATUS
+acpi_status
 acpi_ev_initialize_region (
-       ACPI_OPERAND_OBJECT     *region_obj,
+       acpi_operand_object     *region_obj,
        u8                      acpi_ns_locked);
 
 
@@ -183,7 +183,7 @@ u32
 acpi_ev_install_sci_handler (
        void);
 
-ACPI_STATUS
+acpi_status
 acpi_ev_remove_sci_handler (
        void);
 
index af6dabb7b0c3dd4abe5af719a0a6a6138000a650..2020e45cd627cc5feee1a0b7286a36663e9408e3 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acexcep.h - Exception codes returned by the ACPI subsystem
- *       $Revision: 46 $
+ *       $Revision: 50 $
  *
  *****************************************************************************/
 
 #define ACPI_FAILURE(a)                 (a)
 
 
-#define AE_OK                           (ACPI_STATUS) 0x0000
+#define AE_OK                           (acpi_status) 0x0000
 
 /*
  * Environmental exceptions
  */
-#define AE_ERROR                        (ACPI_STATUS) (0x0001 | AE_CODE_ENVIRONMENTAL)
-#define AE_NO_ACPI_TABLES               (ACPI_STATUS) (0x0002 | AE_CODE_ENVIRONMENTAL)
-#define AE_NO_NAMESPACE                 (ACPI_STATUS) (0x0003 | AE_CODE_ENVIRONMENTAL)
-#define AE_NO_MEMORY                    (ACPI_STATUS) (0x0004 | AE_CODE_ENVIRONMENTAL)
-#define AE_NOT_FOUND                    (ACPI_STATUS) (0x0005 | AE_CODE_ENVIRONMENTAL)
-#define AE_NOT_EXIST                    (ACPI_STATUS) (0x0006 | AE_CODE_ENVIRONMENTAL)
-#define AE_EXIST                        (ACPI_STATUS) (0x0007 | AE_CODE_ENVIRONMENTAL)
-#define AE_TYPE                         (ACPI_STATUS) (0x0008 | AE_CODE_ENVIRONMENTAL)
-#define AE_NULL_OBJECT                  (ACPI_STATUS) (0x0009 | AE_CODE_ENVIRONMENTAL)
-#define AE_NULL_ENTRY                   (ACPI_STATUS) (0x000A | AE_CODE_ENVIRONMENTAL)
-#define AE_BUFFER_OVERFLOW              (ACPI_STATUS) (0x000B | AE_CODE_ENVIRONMENTAL)
-#define AE_STACK_OVERFLOW               (ACPI_STATUS) (0x000C | AE_CODE_ENVIRONMENTAL)
-#define AE_STACK_UNDERFLOW              (ACPI_STATUS) (0x000D | AE_CODE_ENVIRONMENTAL)
-#define AE_NOT_IMPLEMENTED              (ACPI_STATUS) (0x000E | AE_CODE_ENVIRONMENTAL)
-#define AE_VERSION_MISMATCH             (ACPI_STATUS) (0x000F | AE_CODE_ENVIRONMENTAL)
-#define AE_SUPPORT                      (ACPI_STATUS) (0x0010 | AE_CODE_ENVIRONMENTAL)
-#define AE_SHARE                        (ACPI_STATUS) (0x0011 | AE_CODE_ENVIRONMENTAL)
-#define AE_LIMIT                        (ACPI_STATUS) (0x0012 | AE_CODE_ENVIRONMENTAL)
-#define AE_TIME                         (ACPI_STATUS) (0x0013 | AE_CODE_ENVIRONMENTAL)
-#define AE_UNKNOWN_STATUS               (ACPI_STATUS) (0x0014 | AE_CODE_ENVIRONMENTAL)
-#define AE_ACQUIRE_DEADLOCK             (ACPI_STATUS) (0x0015 | AE_CODE_ENVIRONMENTAL)
-#define AE_RELEASE_DEADLOCK             (ACPI_STATUS) (0x0016 | AE_CODE_ENVIRONMENTAL)
-#define AE_NOT_ACQUIRED                 (ACPI_STATUS) (0x0017 | AE_CODE_ENVIRONMENTAL)
-#define AE_ALREADY_ACQUIRED             (ACPI_STATUS) (0x0018 | AE_CODE_ENVIRONMENTAL)
-#define AE_NO_HARDWARE_RESPONSE         (ACPI_STATUS) (0x0019 | AE_CODE_ENVIRONMENTAL)
-#define AE_NO_GLOBAL_LOCK               (ACPI_STATUS) (0x001A | AE_CODE_ENVIRONMENTAL)
+#define AE_ERROR                        (acpi_status) (0x0001 | AE_CODE_ENVIRONMENTAL)
+#define AE_NO_ACPI_TABLES               (acpi_status) (0x0002 | AE_CODE_ENVIRONMENTAL)
+#define AE_NO_NAMESPACE                 (acpi_status) (0x0003 | AE_CODE_ENVIRONMENTAL)
+#define AE_NO_MEMORY                    (acpi_status) (0x0004 | AE_CODE_ENVIRONMENTAL)
+#define AE_NOT_FOUND                    (acpi_status) (0x0005 | AE_CODE_ENVIRONMENTAL)
+#define AE_NOT_EXIST                    (acpi_status) (0x0006 | AE_CODE_ENVIRONMENTAL)
+#define AE_EXIST                        (acpi_status) (0x0007 | AE_CODE_ENVIRONMENTAL)
+#define AE_TYPE                         (acpi_status) (0x0008 | AE_CODE_ENVIRONMENTAL)
+#define AE_NULL_OBJECT                  (acpi_status) (0x0009 | AE_CODE_ENVIRONMENTAL)
+#define AE_NULL_ENTRY                   (acpi_status) (0x000A | AE_CODE_ENVIRONMENTAL)
+#define AE_BUFFER_OVERFLOW              (acpi_status) (0x000B | AE_CODE_ENVIRONMENTAL)
+#define AE_STACK_OVERFLOW               (acpi_status) (0x000C | AE_CODE_ENVIRONMENTAL)
+#define AE_STACK_UNDERFLOW              (acpi_status) (0x000D | AE_CODE_ENVIRONMENTAL)
+#define AE_NOT_IMPLEMENTED              (acpi_status) (0x000E | AE_CODE_ENVIRONMENTAL)
+#define AE_VERSION_MISMATCH             (acpi_status) (0x000F | AE_CODE_ENVIRONMENTAL)
+#define AE_SUPPORT                      (acpi_status) (0x0010 | AE_CODE_ENVIRONMENTAL)
+#define AE_SHARE                        (acpi_status) (0x0011 | AE_CODE_ENVIRONMENTAL)
+#define AE_LIMIT                        (acpi_status) (0x0012 | AE_CODE_ENVIRONMENTAL)
+#define AE_TIME                         (acpi_status) (0x0013 | AE_CODE_ENVIRONMENTAL)
+#define AE_UNKNOWN_STATUS               (acpi_status) (0x0014 | AE_CODE_ENVIRONMENTAL)
+#define AE_ACQUIRE_DEADLOCK             (acpi_status) (0x0015 | AE_CODE_ENVIRONMENTAL)
+#define AE_RELEASE_DEADLOCK             (acpi_status) (0x0016 | AE_CODE_ENVIRONMENTAL)
+#define AE_NOT_ACQUIRED                 (acpi_status) (0x0017 | AE_CODE_ENVIRONMENTAL)
+#define AE_ALREADY_ACQUIRED             (acpi_status) (0x0018 | AE_CODE_ENVIRONMENTAL)
+#define AE_NO_HARDWARE_RESPONSE         (acpi_status) (0x0019 | AE_CODE_ENVIRONMENTAL)
+#define AE_NO_GLOBAL_LOCK               (acpi_status) (0x001A | AE_CODE_ENVIRONMENTAL)
 
 #define AE_CODE_ENV_MAX                 0x001A
 
 /*
  * Programmer exceptions
  */
-#define AE_BAD_PARAMETER                (ACPI_STATUS) (0x0001 | AE_CODE_PROGRAMMER)
-#define AE_BAD_CHARACTER                (ACPI_STATUS) (0x0002 | AE_CODE_PROGRAMMER)
-#define AE_BAD_PATHNAME                 (ACPI_STATUS) (0x0003 | AE_CODE_PROGRAMMER)
-#define AE_BAD_DATA                     (ACPI_STATUS) (0x0004 | AE_CODE_PROGRAMMER)
-#define AE_BAD_ADDRESS                  (ACPI_STATUS) (0x0005 | AE_CODE_PROGRAMMER)
+#define AE_BAD_PARAMETER                (acpi_status) (0x0001 | AE_CODE_PROGRAMMER)
+#define AE_BAD_CHARACTER                (acpi_status) (0x0002 | AE_CODE_PROGRAMMER)
+#define AE_BAD_PATHNAME                 (acpi_status) (0x0003 | AE_CODE_PROGRAMMER)
+#define AE_BAD_DATA                     (acpi_status) (0x0004 | AE_CODE_PROGRAMMER)
+#define AE_BAD_ADDRESS                  (acpi_status) (0x0005 | AE_CODE_PROGRAMMER)
 
 #define AE_CODE_PGM_MAX                 0x0005
 
 /*
  * Acpi table exceptions
  */
-#define AE_BAD_SIGNATURE                (ACPI_STATUS) (0x0001 | AE_CODE_ACPI_TABLES)
-#define AE_BAD_HEADER                   (ACPI_STATUS) (0x0002 | AE_CODE_ACPI_TABLES)
-#define AE_BAD_CHECKSUM                 (ACPI_STATUS) (0x0003 | AE_CODE_ACPI_TABLES)
-#define AE_BAD_VALUE                    (ACPI_STATUS) (0x0004 | AE_CODE_ACPI_TABLES)
+#define AE_BAD_SIGNATURE                (acpi_status) (0x0001 | AE_CODE_ACPI_TABLES)
+#define AE_BAD_HEADER                   (acpi_status) (0x0002 | AE_CODE_ACPI_TABLES)
+#define AE_BAD_CHECKSUM                 (acpi_status) (0x0003 | AE_CODE_ACPI_TABLES)
+#define AE_BAD_VALUE                    (acpi_status) (0x0004 | AE_CODE_ACPI_TABLES)
 
 #define AE_CODE_TBL_MAX                 0x0003
 
  * AML exceptions.  These are caused by problems with
  * the actual AML byte stream
  */
-#define AE_AML_ERROR                    (ACPI_STATUS) (0x0001 | AE_CODE_AML)
-#define AE_AML_PARSE                    (ACPI_STATUS) (0x0002 | AE_CODE_AML)
-#define AE_AML_BAD_OPCODE               (ACPI_STATUS) (0x0003 | AE_CODE_AML)
-#define AE_AML_NO_OPERAND               (ACPI_STATUS) (0x0004 | AE_CODE_AML)
-#define AE_AML_OPERAND_TYPE             (ACPI_STATUS) (0x0005 | AE_CODE_AML)
-#define AE_AML_OPERAND_VALUE            (ACPI_STATUS) (0x0006 | AE_CODE_AML)
-#define AE_AML_UNINITIALIZED_LOCAL      (ACPI_STATUS) (0x0007 | AE_CODE_AML)
-#define AE_AML_UNINITIALIZED_ARG        (ACPI_STATUS) (0x0008 | AE_CODE_AML)
-#define AE_AML_UNINITIALIZED_ELEMENT    (ACPI_STATUS) (0x0009 | AE_CODE_AML)
-#define AE_AML_NUMERIC_OVERFLOW         (ACPI_STATUS) (0x000A | AE_CODE_AML)
-#define AE_AML_REGION_LIMIT             (ACPI_STATUS) (0x000B | AE_CODE_AML)
-#define AE_AML_BUFFER_LIMIT             (ACPI_STATUS) (0x000C | AE_CODE_AML)
-#define AE_AML_PACKAGE_LIMIT            (ACPI_STATUS) (0x000D | AE_CODE_AML)
-#define AE_AML_DIVIDE_BY_ZERO           (ACPI_STATUS) (0x000E | AE_CODE_AML)
-#define AE_AML_BAD_NAME                 (ACPI_STATUS) (0x000F | AE_CODE_AML)
-#define AE_AML_NAME_NOT_FOUND           (ACPI_STATUS) (0x0010 | AE_CODE_AML)
-#define AE_AML_INTERNAL                 (ACPI_STATUS) (0x0011 | AE_CODE_AML)
-#define AE_AML_INVALID_SPACE_ID         (ACPI_STATUS) (0x0012 | AE_CODE_AML)
-#define AE_AML_STRING_LIMIT             (ACPI_STATUS) (0x0013 | AE_CODE_AML)
-#define AE_AML_NO_RETURN_VALUE          (ACPI_STATUS) (0x0014 | AE_CODE_AML)
-#define AE_AML_METHOD_LIMIT             (ACPI_STATUS) (0x0015 | AE_CODE_AML)
-#define AE_AML_NOT_OWNER                (ACPI_STATUS) (0x0016 | AE_CODE_AML)
-#define AE_AML_MUTEX_ORDER              (ACPI_STATUS) (0x0017 | AE_CODE_AML)
-#define AE_AML_MUTEX_NOT_ACQUIRED       (ACPI_STATUS) (0x0018 | AE_CODE_AML)
-#define AE_AML_INVALID_RESOURCE_TYPE    (ACPI_STATUS) (0x0019 | AE_CODE_AML)
+#define AE_AML_ERROR                    (acpi_status) (0x0001 | AE_CODE_AML)
+#define AE_AML_PARSE                    (acpi_status) (0x0002 | AE_CODE_AML)
+#define AE_AML_BAD_OPCODE               (acpi_status) (0x0003 | AE_CODE_AML)
+#define AE_AML_NO_OPERAND               (acpi_status) (0x0004 | AE_CODE_AML)
+#define AE_AML_OPERAND_TYPE             (acpi_status) (0x0005 | AE_CODE_AML)
+#define AE_AML_OPERAND_VALUE            (acpi_status) (0x0006 | AE_CODE_AML)
+#define AE_AML_UNINITIALIZED_LOCAL      (acpi_status) (0x0007 | AE_CODE_AML)
+#define AE_AML_UNINITIALIZED_ARG        (acpi_status) (0x0008 | AE_CODE_AML)
+#define AE_AML_UNINITIALIZED_ELEMENT    (acpi_status) (0x0009 | AE_CODE_AML)
+#define AE_AML_NUMERIC_OVERFLOW         (acpi_status) (0x000A | AE_CODE_AML)
+#define AE_AML_REGION_LIMIT             (acpi_status) (0x000B | AE_CODE_AML)
+#define AE_AML_BUFFER_LIMIT             (acpi_status) (0x000C | AE_CODE_AML)
+#define AE_AML_PACKAGE_LIMIT            (acpi_status) (0x000D | AE_CODE_AML)
+#define AE_AML_DIVIDE_BY_ZERO           (acpi_status) (0x000E | AE_CODE_AML)
+#define AE_AML_BAD_NAME                 (acpi_status) (0x000F | AE_CODE_AML)
+#define AE_AML_NAME_NOT_FOUND           (acpi_status) (0x0010 | AE_CODE_AML)
+#define AE_AML_INTERNAL                 (acpi_status) (0x0011 | AE_CODE_AML)
+#define AE_AML_INVALID_SPACE_ID         (acpi_status) (0x0012 | AE_CODE_AML)
+#define AE_AML_STRING_LIMIT             (acpi_status) (0x0013 | AE_CODE_AML)
+#define AE_AML_NO_RETURN_VALUE          (acpi_status) (0x0014 | AE_CODE_AML)
+#define AE_AML_METHOD_LIMIT             (acpi_status) (0x0015 | AE_CODE_AML)
+#define AE_AML_NOT_OWNER                (acpi_status) (0x0016 | AE_CODE_AML)
+#define AE_AML_MUTEX_ORDER              (acpi_status) (0x0017 | AE_CODE_AML)
+#define AE_AML_MUTEX_NOT_ACQUIRED       (acpi_status) (0x0018 | AE_CODE_AML)
+#define AE_AML_INVALID_RESOURCE_TYPE    (acpi_status) (0x0019 | AE_CODE_AML)
 
 #define AE_CODE_AML_MAX                 0x0019
 
 /*
  * Internal exceptions used for control
  */
-#define AE_CTRL_RETURN_VALUE            (ACPI_STATUS) (0x0001 | AE_CODE_CONTROL)
-#define AE_CTRL_PENDING                 (ACPI_STATUS) (0x0002 | AE_CODE_CONTROL)
-#define AE_CTRL_TERMINATE               (ACPI_STATUS) (0x0003 | AE_CODE_CONTROL)
-#define AE_CTRL_TRUE                    (ACPI_STATUS) (0x0004 | AE_CODE_CONTROL)
-#define AE_CTRL_FALSE                   (ACPI_STATUS) (0x0005 | AE_CODE_CONTROL)
-#define AE_CTRL_DEPTH                   (ACPI_STATUS) (0x0006 | AE_CODE_CONTROL)
-#define AE_CTRL_END                     (ACPI_STATUS) (0x0007 | AE_CODE_CONTROL)
-#define AE_CTRL_TRANSFER                (ACPI_STATUS) (0x0008 | AE_CODE_CONTROL)
+#define AE_CTRL_RETURN_VALUE            (acpi_status) (0x0001 | AE_CODE_CONTROL)
+#define AE_CTRL_PENDING                 (acpi_status) (0x0002 | AE_CODE_CONTROL)
+#define AE_CTRL_TERMINATE               (acpi_status) (0x0003 | AE_CODE_CONTROL)
+#define AE_CTRL_TRUE                    (acpi_status) (0x0004 | AE_CODE_CONTROL)
+#define AE_CTRL_FALSE                   (acpi_status) (0x0005 | AE_CODE_CONTROL)
+#define AE_CTRL_DEPTH                   (acpi_status) (0x0006 | AE_CODE_CONTROL)
+#define AE_CTRL_END                     (acpi_status) (0x0007 | AE_CODE_CONTROL)
+#define AE_CTRL_TRANSFER                (acpi_status) (0x0008 | AE_CODE_CONTROL)
 
 #define AE_CODE_CTRL_MAX                0x0008
 
  * String versions of the exception codes above
  * These strings must match the corresponding defines exactly
  */
-static NATIVE_CHAR          *acpi_gbl_exception_names_env[] =
+NATIVE_CHAR const   *acpi_gbl_exception_names_env[] =
 {
        "AE_OK",
        "AE_ERROR",
@@ -184,7 +184,7 @@ static NATIVE_CHAR          *acpi_gbl_exception_names_env[] =
        "AE_NO_GLOBAL_LOCK",
 };
 
-static NATIVE_CHAR          *acpi_gbl_exception_names_pgm[] =
+NATIVE_CHAR const   *acpi_gbl_exception_names_pgm[] =
 {
        "AE_BAD_PARAMETER",
        "AE_BAD_CHARACTER",
@@ -193,7 +193,7 @@ static NATIVE_CHAR          *acpi_gbl_exception_names_pgm[] =
        "AE_BAD_ADDRESS",
 };
 
-static NATIVE_CHAR          *acpi_gbl_exception_names_tbl[] =
+NATIVE_CHAR const   *acpi_gbl_exception_names_tbl[] =
 {
        "AE_BAD_SIGNATURE",
        "AE_BAD_HEADER",
@@ -201,7 +201,7 @@ static NATIVE_CHAR          *acpi_gbl_exception_names_tbl[] =
        "AE_BAD_VALUE",
 };
 
-static NATIVE_CHAR          *acpi_gbl_exception_names_aml[] =
+NATIVE_CHAR const   *acpi_gbl_exception_names_aml[] =
 {
        "AE_AML_ERROR",
        "AE_AML_PARSE",
@@ -230,7 +230,7 @@ static NATIVE_CHAR          *acpi_gbl_exception_names_aml[] =
        "AE_AML_INVALID_RESOURCE_TYPE",
 };
 
-static NATIVE_CHAR          *acpi_gbl_exception_names_ctrl[] =
+NATIVE_CHAR const   *acpi_gbl_exception_names_ctrl[] =
 {
        "AE_CTRL_RETURN_VALUE",
        "AE_CTRL_PENDING",
@@ -242,8 +242,7 @@ static NATIVE_CHAR          *acpi_gbl_exception_names_ctrl[] =
        "AE_CTRL_TRANSFER",
 };
 
-
-#endif /* DEFINE_ACPI_GLOBALS */
+#endif /* ACPI GLOBALS */
 
 
 #endif /* __ACEXCEP_H__ */
index 83c58ff9c74004c55a4699ebc21c3e6e6173aea9..36593fb47c8e734579f4d46fe2301af0776f1779 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acglobal.h - Declarations for global variables
- *       $Revision: 101 $
+ *       $Revision: 106 $
  *
  *****************************************************************************/
 
@@ -40,8 +40,6 @@
 #endif
 
 
-extern      NATIVE_CHAR                 *msg_acpi_error_break;
-
 /*****************************************************************************
  *
  * Debug support
@@ -53,7 +51,6 @@ extern      NATIVE_CHAR                 *msg_acpi_error_break;
 extern      u32                         acpi_dbg_level;
 extern      u32                         acpi_dbg_layer;
 
-
 /* Procedure nesting level for debug output */
 
 extern      u32                         acpi_gbl_nesting_level;
@@ -75,10 +72,10 @@ extern      u32                         acpi_gbl_nesting_level;
  *
  */
 ACPI_EXTERN RSDP_DESCRIPTOR             *acpi_gbl_RSDP;
-ACPI_EXTERN XSDT_DESCRIPTOR             *acpi_gbl_XSDT;
+ACPI_EXTERN xsdt_descriptor             *acpi_gbl_XSDT;
 ACPI_EXTERN FADT_DESCRIPTOR             *acpi_gbl_FADT;
-ACPI_EXTERN ACPI_TABLE_HEADER           *acpi_gbl_DSDT;
-ACPI_EXTERN ACPI_COMMON_FACS            *acpi_gbl_FACS;
+ACPI_EXTERN acpi_table_header           *acpi_gbl_DSDT;
+ACPI_EXTERN acpi_common_facs            *acpi_gbl_FACS;
 
 /*
  * Since there may be multiple SSDTs and PSDTS, a single pointer is not
@@ -89,7 +86,7 @@ ACPI_EXTERN ACPI_COMMON_FACS            *acpi_gbl_FACS;
 /*
  * ACPI Table info arrays
  */
-extern      ACPI_TABLE_DESC             acpi_gbl_acpi_tables[NUM_ACPI_TABLES];
+extern      acpi_table_desc             acpi_gbl_acpi_tables[NUM_ACPI_TABLES];
 extern      ACPI_TABLE_SUPPORT          acpi_gbl_acpi_table_data[NUM_ACPI_TABLES];
 
 /*
@@ -107,16 +104,13 @@ 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 u8                         *acpi_gbl_gpe0enable_register_save;
 ACPI_EXTERN u8                         *acpi_gbl_gpe1_enable_register_save;
-ACPI_EXTERN ACPI_WALK_STATE            *acpi_gbl_breakpoint_walk;
-ACPI_EXTERN ACPI_GENERIC_STATE         *acpi_gbl_generic_state_cache;
-ACPI_EXTERN ACPI_PARSE_OBJECT          *acpi_gbl_parse_cache;
-ACPI_EXTERN ACPI_PARSE2_OBJECT         *acpi_gbl_ext_parse_cache;
-ACPI_EXTERN ACPI_OPERAND_OBJECT        *acpi_gbl_object_cache;
-ACPI_EXTERN ACPI_WALK_STATE            *acpi_gbl_walk_state_cache;
-ACPI_EXTERN ACPI_HANDLE                 acpi_gbl_global_lock_semaphore;
-
+ACPI_EXTERN acpi_walk_state            *acpi_gbl_breakpoint_walk;
+ACPI_EXTERN acpi_handle                 acpi_gbl_global_lock_semaphore;
 
 ACPI_EXTERN u32                         acpi_gbl_global_lock_thread_count;
 ACPI_EXTERN u32                         acpi_gbl_restore_acpi_chipset;
@@ -124,45 +118,22 @@ ACPI_EXTERN u32                         acpi_gbl_original_mode;
 ACPI_EXTERN u32                         acpi_gbl_edge_level_save;
 ACPI_EXTERN u32                         acpi_gbl_irq_enable_save;
 ACPI_EXTERN u32                         acpi_gbl_rsdp_original_location;
-
-ACPI_EXTERN u32                         acpi_gbl_state_cache_requests;
-ACPI_EXTERN u32                         acpi_gbl_state_cache_hits;
-ACPI_EXTERN u32                         acpi_gbl_parse_cache_requests;
-ACPI_EXTERN u32                         acpi_gbl_parse_cache_hits;
-ACPI_EXTERN u32                         acpi_gbl_ext_parse_cache_requests;
-ACPI_EXTERN u32                         acpi_gbl_ext_parse_cache_hits;
-ACPI_EXTERN u32                         acpi_gbl_object_cache_requests;
-ACPI_EXTERN u32                         acpi_gbl_object_cache_hits;
-ACPI_EXTERN u32                         acpi_gbl_walk_state_cache_requests;
-ACPI_EXTERN u32                         acpi_gbl_walk_state_cache_hits;
 ACPI_EXTERN u32                         acpi_gbl_ns_lookup_count;
 ACPI_EXTERN u32                         acpi_gbl_ps_find_count;
-
-
-ACPI_EXTERN u16                         acpi_gbl_generic_state_cache_depth;
-ACPI_EXTERN u16                         acpi_gbl_parse_cache_depth;
-ACPI_EXTERN u16                         acpi_gbl_ext_parse_cache_depth;
-ACPI_EXTERN u16                         acpi_gbl_object_cache_depth;
-ACPI_EXTERN u16                         acpi_gbl_walk_state_cache_depth;
 ACPI_EXTERN u16                         acpi_gbl_pm1_enable_register_save;
 ACPI_EXTERN u16                         acpi_gbl_next_table_owner_id;
 ACPI_EXTERN u16                         acpi_gbl_next_method_owner_id;
-
 ACPI_EXTERN u8                          acpi_gbl_debugger_configuration;
 ACPI_EXTERN u8                          acpi_gbl_global_lock_acquired;
 ACPI_EXTERN u8                          acpi_gbl_step_to_next_call;
 ACPI_EXTERN u8                          acpi_gbl_acpi_hardware_present;
 ACPI_EXTERN u8                          acpi_gbl_global_lock_present;
 
-ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER  acpi_gbl_drv_notify;
-ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER  acpi_gbl_sys_notify;
-
-
 extern u8                               acpi_gbl_shutdown;
 extern u32                              acpi_gbl_system_flags;
 extern u32                              acpi_gbl_startup_flags;
-extern u8                               acpi_gbl_decode_to8bit[8];
-extern NATIVE_CHAR                      acpi_gbl_hex_to_ascii[16];
+extern const u8                         acpi_gbl_decode_to8bit[8];
+extern const NATIVE_CHAR                *acpi_gbl_db_sleep_states[ACPI_NUM_SLEEP_STATES];
 
 
 /*****************************************************************************
@@ -175,21 +146,21 @@ extern NATIVE_CHAR                      acpi_gbl_hex_to_ascii[16];
 #define NUM_PREDEFINED_NAMES            9
 
 
-ACPI_EXTERN ACPI_NAMESPACE_NODE         acpi_gbl_root_node_struct;
-ACPI_EXTERN ACPI_NAMESPACE_NODE        *acpi_gbl_root_node;
-
-extern u8                               acpi_gbl_ns_properties[NUM_NS_TYPES];
-extern PREDEFINED_NAMES                 acpi_gbl_pre_defined_names [NUM_PREDEFINED_NAMES];
-
+ACPI_EXTERN acpi_namespace_node         acpi_gbl_root_node_struct;
+ACPI_EXTERN acpi_namespace_node        *acpi_gbl_root_node;
 
-/* Used to detect memory leaks (DEBUG ONLY) */
+extern const u8                         acpi_gbl_ns_properties[NUM_NS_TYPES];
+extern const predefined_names           acpi_gbl_pre_defined_names [NUM_PREDEFINED_NAMES];
 
 #ifdef ACPI_DEBUG
-ACPI_EXTERN ACPI_ALLOCATION_INFO        *acpi_gbl_head_alloc_ptr;
-ACPI_EXTERN ACPI_ALLOCATION_INFO        *acpi_gbl_tail_alloc_ptr;
+ACPI_EXTERN u32                         acpi_gbl_current_node_count;
+ACPI_EXTERN u32                         acpi_gbl_current_node_size;
+ACPI_EXTERN u32                         acpi_gbl_max_concurrent_node_count;
+ACPI_EXTERN u32                         acpi_gbl_entry_stack_pointer;
+ACPI_EXTERN u32                         acpi_gbl_lowest_stack_pointer;
+ACPI_EXTERN u32                         acpi_gbl_deepest_nesting;
 #endif
 
-
 /*****************************************************************************
  *
  * Interpreter globals
@@ -197,13 +168,11 @@ ACPI_EXTERN ACPI_ALLOCATION_INFO        *acpi_gbl_tail_alloc_ptr;
  ****************************************************************************/
 
 
-ACPI_EXTERN ACPI_WALK_LIST             *acpi_gbl_current_walk_list;
+ACPI_EXTERN acpi_walk_list             *acpi_gbl_current_walk_list;
 
-/*
- * Table of Address Space handlers
- */
-ACPI_EXTERN ACPI_ADR_SPACE_INFO         acpi_gbl_address_spaces[ACPI_NUM_ADDRESS_SPACES];
+/* Address Space handlers */
 
+ACPI_EXTERN ACPI_ADR_SPACE_INFO         acpi_gbl_address_spaces[ACPI_NUM_ADDRESS_SPACES];
 
 /* Control method single step flag */
 
@@ -216,16 +185,7 @@ ACPI_EXTERN u8                          acpi_gbl_cm_single_step;
  *
  ****************************************************************************/
 
-ACPI_EXTERN ACPI_PARSE_OBJECT           *acpi_gbl_parsed_namespace_root;
-
-/*****************************************************************************
- *
- * Hardware globals
- *
- ****************************************************************************/
-
-extern ACPI_C_STATE_HANDLER             acpi_hw_cx_handlers[MAX_CX_STATES];
-extern u32                              acpi_hw_active_cx_state;
+ACPI_EXTERN acpi_parse_object           *acpi_gbl_parsed_namespace_root;
 
 
 /*****************************************************************************
@@ -235,11 +195,10 @@ extern u32                              acpi_hw_active_cx_state;
  ****************************************************************************/
 
 ACPI_EXTERN ACPI_FIXED_EVENT_INFO       acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS];
-
-ACPI_EXTERN ACPI_HANDLE                 acpi_gbl_gpe_obj_handle;
+ACPI_EXTERN acpi_handle                 acpi_gbl_gpe_obj_handle;
 ACPI_EXTERN u32                         acpi_gbl_gpe_register_count;
-ACPI_EXTERN ACPI_GPE_REGISTERS          *acpi_gbl_gpe_registers;
-ACPI_EXTERN ACPI_GPE_LEVEL_INFO         *acpi_gbl_gpe_info;
+ACPI_EXTERN ACPI_GPE_REGISTERS         *acpi_gbl_gpe_registers;
+ACPI_EXTERN acpi_gpe_level_info        *acpi_gbl_gpe_info;
 
 /*
  * Gpe validation and translation table
@@ -269,27 +228,5 @@ ACPI_EXTERN u8                          acpi_gbl_method_executing;
 ACPI_EXTERN u8                          acpi_gbl_db_terminate_threads;
 #endif
 
-/* Memory allocation metrics - Debug Only! */
-
-#ifdef ACPI_DEBUG
-
-ACPI_EXTERN u32                         acpi_gbl_current_alloc_size;
-ACPI_EXTERN u32                         acpi_gbl_current_alloc_count;
-ACPI_EXTERN u32                         acpi_gbl_running_alloc_size;
-ACPI_EXTERN u32                         acpi_gbl_running_alloc_count;
-ACPI_EXTERN u32                         acpi_gbl_max_concurrent_alloc_size;
-ACPI_EXTERN u32                         acpi_gbl_max_concurrent_alloc_count;
-ACPI_EXTERN u32                         acpi_gbl_current_object_count;
-ACPI_EXTERN u32                         acpi_gbl_current_object_size;
-ACPI_EXTERN u32                         acpi_gbl_max_concurrent_object_count;
-ACPI_EXTERN u32                         acpi_gbl_max_concurrent_object_size;
-ACPI_EXTERN u32                         acpi_gbl_running_object_count;
-ACPI_EXTERN u32                         acpi_gbl_running_object_size;
-ACPI_EXTERN u32                         acpi_gbl_current_node_count;
-ACPI_EXTERN u32                         acpi_gbl_current_node_size;
-ACPI_EXTERN u32                         acpi_gbl_max_concurrent_node_count;
-
-#endif
-
 
 #endif /* __ACGLOBAL_H__ */
index 9734d7bfddfd02e66992e62d25c00838b6a84486..e68a49f4f0952c7b0affe0415030cb8e07c55739 100644 (file)
 /* Prototypes */
 
 
-ACPI_STATUS
+acpi_status
 acpi_hw_initialize (
        void);
 
-ACPI_STATUS
+acpi_status
 acpi_hw_shutdown (
        void);
 
-ACPI_STATUS
+acpi_status
 acpi_hw_initialize_system_info (
        void);
 
-ACPI_STATUS
+acpi_status
 acpi_hw_set_mode (
        u32                     mode);
 
@@ -82,14 +82,14 @@ acpi_hw_register_write (
 u32
 acpi_hw_low_level_read (
        u32                     width,
-       ACPI_GENERIC_ADDRESS    *reg,
+       acpi_generic_address    *reg,
        u32                     offset);
 
 void
 acpi_hw_low_level_write (
        u32                     width,
        u32                     value,
-       ACPI_GENERIC_ADDRESS    *reg,
+       acpi_generic_address    *reg,
        u32                     offset);
 
 void
@@ -118,11 +118,11 @@ acpi_hw_clear_gpe (
 void
 acpi_hw_get_gpe_status (
        u32                     gpe_number,
-       ACPI_EVENT_STATUS       *event_status);
+       acpi_event_status       *event_status);
 
 /* Sleep Prototypes */
 
-ACPI_STATUS
+acpi_status
 acpi_hw_obtain_sleep_type_register_data (
        u8                      sleep_state,
        u8                      *slp_typ_a,
@@ -131,15 +131,15 @@ acpi_hw_obtain_sleep_type_register_data (
 
 /* ACPI Timer prototypes */
 
-ACPI_STATUS
+acpi_status
 acpi_get_timer_resolution (
        u32                     *resolution);
 
-ACPI_STATUS
+acpi_status
 acpi_get_timer (
        u32                     *ticks);
 
-ACPI_STATUS
+acpi_status
 acpi_get_timer_duration (
        u32                     start_ticks,
        u32                     end_ticks,
index 17b52a14d985855969884f30a2e38f0ccc60002d..5652e8e632e90a94f09621cac719ab7a713a35e9 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acinterp.h - Interpreter subcomponent prototypes and defines
- *       $Revision: 102 $
+ *       $Revision: 106 $
  *
  *****************************************************************************/
 
 #define METHOD_DELETE_AT_COMPLETION 0x2
 
 
-ACPI_STATUS
+acpi_status
 acpi_ex_resolve_operands (
        u16                     opcode,
-       ACPI_OPERAND_OBJECT     **stack_ptr,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_operand_object     **stack_ptr,
+       acpi_walk_state         *walk_state);
 
 
 /*
  * amxface - External interpreter interfaces
  */
 
-ACPI_STATUS
+acpi_status
 acpi_ex_load_table (
-       ACPI_TABLE_TYPE         table_id);
+       acpi_table_type         table_id);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_execute_method (
-       ACPI_NAMESPACE_NODE     *method_node,
-       ACPI_OPERAND_OBJECT     **params,
-       ACPI_OPERAND_OBJECT     **return_obj_desc);
+       acpi_namespace_node     *method_node,
+       acpi_operand_object     **params,
+       acpi_operand_object     **return_obj_desc);
 
 
 /*
  * amconvrt - object conversion
  */
 
-ACPI_STATUS
+acpi_status
 acpi_ex_convert_to_integer (
-       ACPI_OPERAND_OBJECT     **obj_desc,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_operand_object     *obj_desc,
+       acpi_operand_object     **result_desc,
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_convert_to_buffer (
-       ACPI_OPERAND_OBJECT     **obj_desc,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_operand_object     *obj_desc,
+       acpi_operand_object     **result_desc,
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_convert_to_string (
-       ACPI_OPERAND_OBJECT     **obj_desc,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_operand_object     *obj_desc,
+       acpi_operand_object     **result_desc,
+       u32                     base,
+       u32                     max_length,
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_convert_to_target_type (
-       ACPI_OBJECT_TYPE8       destination_type,
-       ACPI_OPERAND_OBJECT     **obj_desc,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_object_type8       destination_type,
+       acpi_operand_object     **obj_desc,
+       acpi_walk_state         *walk_state);
 
 
 /*
  * amfield - ACPI AML (p-code) execution - field manipulation
  */
 
-ACPI_STATUS
+acpi_status
 acpi_ex_extract_from_field (
-       ACPI_OPERAND_OBJECT     *obj_desc,
+       acpi_operand_object     *obj_desc,
        void                    *buffer,
        u32                     buffer_length);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_insert_into_field (
-       ACPI_OPERAND_OBJECT     *obj_desc,
+       acpi_operand_object     *obj_desc,
        void                    *buffer,
        u32                     buffer_length);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_setup_field (
-       ACPI_OPERAND_OBJECT     *obj_desc,
+       acpi_operand_object     *obj_desc,
        u32                     field_byte_offset);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_read_field_datum (
-       ACPI_OPERAND_OBJECT     *obj_desc,
+       acpi_operand_object     *obj_desc,
        u32                     field_byte_offset,
        u32                     *value);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_common_access_field (
        u32                     mode,
-       ACPI_OPERAND_OBJECT     *obj_desc,
+       acpi_operand_object     *obj_desc,
        void                    *buffer,
        u32                     buffer_length);
 
 
-ACPI_STATUS
+acpi_status
 acpi_ex_access_index_field (
        u32                     mode,
-       ACPI_OPERAND_OBJECT     *obj_desc,
+       acpi_operand_object     *obj_desc,
        void                    *buffer,
        u32                     buffer_length);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_access_bank_field (
        u32                     mode,
-       ACPI_OPERAND_OBJECT     *obj_desc,
+       acpi_operand_object     *obj_desc,
        void                    *buffer,
        u32                     buffer_length);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_access_region_field (
        u32                     mode,
-       ACPI_OPERAND_OBJECT     *obj_desc,
+       acpi_operand_object     *obj_desc,
        void                    *buffer,
        u32                     buffer_length);
 
 
-ACPI_STATUS
+acpi_status
 acpi_ex_access_buffer_field (
        u32                     mode,
-       ACPI_OPERAND_OBJECT     *obj_desc,
+       acpi_operand_object     *obj_desc,
        void                    *buffer,
        u32                     buffer_length);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_read_data_from_field (
-       ACPI_OPERAND_OBJECT     *obj_desc,
-       ACPI_OPERAND_OBJECT     **ret_buffer_desc);
+       acpi_operand_object     *obj_desc,
+       acpi_operand_object     **ret_buffer_desc);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_write_data_to_field (
-       ACPI_OPERAND_OBJECT     *source_desc,
-       ACPI_OPERAND_OBJECT     *obj_desc);
+       acpi_operand_object     *source_desc,
+       acpi_operand_object     *obj_desc);
 
 /*
  * ammisc - ACPI AML (p-code) execution - specific opcodes
  */
 
-ACPI_STATUS
+acpi_status
+acpi_ex_triadic (
+       u16                     opcode,
+       acpi_walk_state         *walk_state,
+       acpi_operand_object     **return_desc);
+
+acpi_status
+acpi_ex_hexadic (
+       u16                     opcode,
+       acpi_walk_state         *walk_state,
+       acpi_operand_object     **return_desc);
+
+acpi_status
 acpi_ex_create_buffer_field (
        u8                      *aml_ptr,
        u32                     aml_length,
-       ACPI_NAMESPACE_NODE     *node,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_namespace_node     *node,
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_reconfiguration (
        u16                     opcode,
-       ACPI_WALK_STATE         *walk_state);
-
-ACPI_STATUS
-acpi_ex_fatal (
-       ACPI_WALK_STATE         *walk_state);
-
-ACPI_STATUS
-acpi_ex_index (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_OPERAND_OBJECT     **return_desc);
-
-ACPI_STATUS
-acpi_ex_match (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_OPERAND_OBJECT     **return_desc);
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_create_mutex (
-       ACPI_WALK_STATE         *walk_state);
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_create_processor (
-       ACPI_PARSE_OBJECT       *op,
-       ACPI_NAMESPACE_NODE     *processor_node);
+       acpi_parse_object       *op,
+       acpi_namespace_node     *processor_node);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_create_power_resource (
-       ACPI_PARSE_OBJECT       *op,
-       ACPI_NAMESPACE_NODE     *power_node);
+       acpi_parse_object       *op,
+       acpi_namespace_node     *power_node);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_create_region (
        u8                      *aml_ptr,
        u32                     aml_length,
        u8                      region_space,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_create_event (
-       ACPI_WALK_STATE         *walk_state);
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_create_alias (
-       ACPI_WALK_STATE         *walk_state);
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_create_method (
        u8                      *aml_ptr,
        u32                     aml_length,
        u32                     method_flags,
-       ACPI_NAMESPACE_NODE     *method);
+       acpi_namespace_node     *method);
 
 
 /*
  * ammutex - mutex support
  */
 
-ACPI_STATUS
+acpi_status
 acpi_ex_acquire_mutex (
-       ACPI_OPERAND_OBJECT     *time_desc,
-       ACPI_OPERAND_OBJECT     *obj_desc,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_operand_object     *time_desc,
+       acpi_operand_object     *obj_desc,
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_release_mutex (
-       ACPI_OPERAND_OBJECT     *obj_desc,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_operand_object     *obj_desc,
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_release_all_mutexes (
-       ACPI_OPERAND_OBJECT     *mutex_list);
+       acpi_operand_object     *mutex_list);
 
 void
 acpi_ex_unlink_mutex (
-       ACPI_OPERAND_OBJECT     *obj_desc);
+       acpi_operand_object     *obj_desc);
 
 
 /*
  * amprep - ACPI AML (p-code) execution - prep utilities
  */
 
-ACPI_STATUS
+acpi_status
 acpi_ex_prep_common_field_object (
-       ACPI_OPERAND_OBJECT     *obj_desc,
+       acpi_operand_object     *obj_desc,
        u8                      field_flags,
        u32                     field_position,
        u32                     field_length);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_prep_region_field_value (
-       ACPI_NAMESPACE_NODE     *node,
-       ACPI_HANDLE             region,
+       acpi_namespace_node     *node,
+       acpi_handle             region,
        u8                      field_flags,
        u32                     field_position,
        u32                     field_length);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_prep_bank_field_value (
-       ACPI_NAMESPACE_NODE     *node,
-       ACPI_NAMESPACE_NODE     *region_node,
-       ACPI_NAMESPACE_NODE     *bank_register_node,
+       acpi_namespace_node     *node,
+       acpi_namespace_node     *region_node,
+       acpi_namespace_node     *bank_register_node,
        u32                     bank_val,
        u8                      field_flags,
        u32                     field_position,
        u32                     field_length);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_prep_index_field_value (
-       ACPI_NAMESPACE_NODE     *node,
-       ACPI_NAMESPACE_NODE     *index_reg,
-       ACPI_NAMESPACE_NODE     *data_reg,
+       acpi_namespace_node     *node,
+       acpi_namespace_node     *index_reg,
+       acpi_namespace_node     *data_reg,
        u8                      field_flags,
        u32                     field_position,
        u32                     field_length);
@@ -303,10 +306,10 @@ acpi_ex_prep_index_field_value (
  * amsystem - Interface to OS services
  */
 
-ACPI_STATUS
+acpi_status
 acpi_ex_system_do_notify_op (
-       ACPI_OPERAND_OBJECT     *value,
-       ACPI_OPERAND_OBJECT     *obj_desc);
+       acpi_operand_object     *value,
+       acpi_operand_object     *obj_desc);
 
 void
 acpi_ex_system_do_suspend(
@@ -316,31 +319,31 @@ void
 acpi_ex_system_do_stall (
        u32                     time);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_system_acquire_mutex(
-       ACPI_OPERAND_OBJECT     *time,
-       ACPI_OPERAND_OBJECT     *obj_desc);
+       acpi_operand_object     *time,
+       acpi_operand_object     *obj_desc);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_system_release_mutex(
-       ACPI_OPERAND_OBJECT     *obj_desc);
+       acpi_operand_object     *obj_desc);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_system_signal_event(
-       ACPI_OPERAND_OBJECT     *obj_desc);
+       acpi_operand_object     *obj_desc);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_system_wait_event(
-       ACPI_OPERAND_OBJECT     *time,
-       ACPI_OPERAND_OBJECT     *obj_desc);
+       acpi_operand_object     *time,
+       acpi_operand_object     *obj_desc);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_system_reset_event(
-       ACPI_OPERAND_OBJECT     *obj_desc);
+       acpi_operand_object     *obj_desc);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_system_wait_semaphore (
-       ACPI_HANDLE             semaphore,
+       acpi_handle             semaphore,
        u32                     timeout);
 
 
@@ -348,75 +351,75 @@ acpi_ex_system_wait_semaphore (
  * ammonadic - ACPI AML (p-code) execution, monadic operators
  */
 
-ACPI_STATUS
+acpi_status
 acpi_ex_monadic1 (
        u16                     opcode,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_monadic2 (
        u16                     opcode,
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_OPERAND_OBJECT     **return_desc);
+       acpi_walk_state         *walk_state,
+       acpi_operand_object     **return_desc);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_monadic2_r (
        u16                     opcode,
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_OPERAND_OBJECT     **return_desc);
+       acpi_walk_state         *walk_state,
+       acpi_operand_object     **return_desc);
 
 
 /*
  * amdyadic - ACPI AML (p-code) execution, dyadic operators
  */
 
-ACPI_STATUS
+acpi_status
 acpi_ex_dyadic1 (
        u16                     opcode,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_dyadic2 (
        u16                     opcode,
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_OPERAND_OBJECT     **return_desc);
+       acpi_walk_state         *walk_state,
+       acpi_operand_object     **return_desc);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_dyadic2_r (
        u16                     opcode,
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_OPERAND_OBJECT     **return_desc);
+       acpi_walk_state         *walk_state,
+       acpi_operand_object     **return_desc);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_dyadic2_s (
        u16                     opcode,
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_OPERAND_OBJECT     **return_desc);
+       acpi_walk_state         *walk_state,
+       acpi_operand_object     **return_desc);
 
 
 /*
  * amresolv  - Object resolution and get value functions
  */
 
-ACPI_STATUS
+acpi_status
 acpi_ex_resolve_to_value (
-       ACPI_OPERAND_OBJECT     **stack_ptr,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_operand_object     **stack_ptr,
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_resolve_node_to_value (
-       ACPI_NAMESPACE_NODE     **stack_ptr,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_namespace_node     **stack_ptr,
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_resolve_object_to_value (
-       ACPI_OPERAND_OBJECT     **stack_ptr,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_operand_object     **stack_ptr,
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_get_buffer_field_value (
-       ACPI_OPERAND_OBJECT     *field_desc,
-       ACPI_OPERAND_OBJECT     *result_desc);
+       acpi_operand_object     *field_desc,
+       acpi_operand_object     *result_desc);
 
 
 /*
@@ -430,14 +433,14 @@ acpi_ex_show_hex_value (
        u32                     lead_space);
 
 
-ACPI_STATUS
+acpi_status
 acpi_ex_dump_operand (
-       ACPI_OPERAND_OBJECT     *entry_desc);
+       acpi_operand_object     *entry_desc);
 
 void
 acpi_ex_dump_operands (
-       ACPI_OPERAND_OBJECT     **operands,
-       OPERATING_MODE          interpreter_mode,
+       acpi_operand_object     **operands,
+       operating_mode          interpreter_mode,
        NATIVE_CHAR             *ident,
        u32                     num_levels,
        NATIVE_CHAR             *note,
@@ -446,13 +449,13 @@ acpi_ex_dump_operands (
 
 void
 acpi_ex_dump_object_descriptor (
-       ACPI_OPERAND_OBJECT     *object,
+       acpi_operand_object     *object,
        u32                     flags);
 
 
 void
 acpi_ex_dump_node (
-       ACPI_NAMESPACE_NODE     *node,
+       acpi_namespace_node     *node,
        u32                     flags);
 
 
@@ -469,110 +472,110 @@ u32
 acpi_ex_good_char (
        u32                     character);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_name_segment (
        u8                      **in_aml_address,
        NATIVE_CHAR             *name_string);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_get_name_string (
-       ACPI_OBJECT_TYPE8       data_type,
+       acpi_object_type8       data_type,
        u8                      *in_aml_address,
        NATIVE_CHAR             **out_name_string,
        u32                     *out_name_length);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_do_name (
-       ACPI_OBJECT_TYPE        data_type,
-       OPERATING_MODE          load_exec_mode);
+       acpi_object_type        data_type,
+       operating_mode          load_exec_mode);
 
 
 /*
  * amstore - Object store support
  */
 
-ACPI_STATUS
+acpi_status
 acpi_ex_store (
-       ACPI_OPERAND_OBJECT     *val_desc,
-       ACPI_OPERAND_OBJECT     *dest_desc,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_operand_object     *val_desc,
+       acpi_operand_object     *dest_desc,
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_store_object_to_index (
-       ACPI_OPERAND_OBJECT     *val_desc,
-       ACPI_OPERAND_OBJECT     *dest_desc,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_operand_object     *val_desc,
+       acpi_operand_object     *dest_desc,
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_store_object_to_node (
-       ACPI_OPERAND_OBJECT     *source_desc,
-       ACPI_NAMESPACE_NODE     *node,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_operand_object     *source_desc,
+       acpi_namespace_node     *node,
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_store_object_to_object (
-       ACPI_OPERAND_OBJECT     *source_desc,
-       ACPI_OPERAND_OBJECT     *dest_desc,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_operand_object     *source_desc,
+       acpi_operand_object     *dest_desc,
+       acpi_walk_state         *walk_state);
 
 
 /*
  *
  */
 
-ACPI_STATUS
+acpi_status
 acpi_ex_resolve_object (
-       ACPI_OPERAND_OBJECT     **source_desc_ptr,
-       ACPI_OBJECT_TYPE8       target_type,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_operand_object     **source_desc_ptr,
+       acpi_object_type8       target_type,
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_store_object (
-       ACPI_OPERAND_OBJECT     *source_desc,
-       ACPI_OBJECT_TYPE8       target_type,
-       ACPI_OPERAND_OBJECT     **target_desc_ptr,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_operand_object     *source_desc,
+       acpi_object_type8       target_type,
+       acpi_operand_object     **target_desc_ptr,
+       acpi_walk_state         *walk_state);
 
 
 /*
  * amcopy - object copy
  */
 
-ACPI_STATUS
+acpi_status
 acpi_ex_copy_buffer_to_buffer (
-       ACPI_OPERAND_OBJECT     *source_desc,
-       ACPI_OPERAND_OBJECT     *target_desc);
+       acpi_operand_object     *source_desc,
+       acpi_operand_object     *target_desc);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_copy_string_to_string (
-       ACPI_OPERAND_OBJECT     *source_desc,
-       ACPI_OPERAND_OBJECT     *target_desc);
+       acpi_operand_object     *source_desc,
+       acpi_operand_object     *target_desc);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_copy_integer_to_index_field (
-       ACPI_OPERAND_OBJECT     *source_desc,
-       ACPI_OPERAND_OBJECT     *target_desc);
+       acpi_operand_object     *source_desc,
+       acpi_operand_object     *target_desc);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_copy_integer_to_bank_field (
-       ACPI_OPERAND_OBJECT     *source_desc,
-       ACPI_OPERAND_OBJECT     *target_desc);
+       acpi_operand_object     *source_desc,
+       acpi_operand_object     *target_desc);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_copy_data_to_named_field (
-       ACPI_OPERAND_OBJECT     *source_desc,
-       ACPI_NAMESPACE_NODE     *node);
+       acpi_operand_object     *source_desc,
+       acpi_namespace_node     *node);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_copy_integer_to_buffer_field (
-       ACPI_OPERAND_OBJECT     *source_desc,
-       ACPI_OPERAND_OBJECT     *target_desc);
+       acpi_operand_object     *source_desc,
+       acpi_operand_object     *target_desc);
 
 /*
  * amutils - interpreter/scanner utilities
  */
 
-ACPI_STATUS
+acpi_status
 acpi_ex_enter_interpreter (
        void);
 
@@ -582,34 +585,34 @@ acpi_ex_exit_interpreter (
 
 void
 acpi_ex_truncate_for32bit_table (
-       ACPI_OPERAND_OBJECT     *obj_desc,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_operand_object     *obj_desc,
+       acpi_walk_state         *walk_state);
 
 u8
 acpi_ex_validate_object_type (
-       ACPI_OBJECT_TYPE        type);
+       acpi_object_type        type);
 
 u8
 acpi_ex_acquire_global_lock (
        u32                     rule);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_release_global_lock (
        u8                      locked);
 
 u32
 acpi_ex_digits_needed (
-       ACPI_INTEGER            value,
+       acpi_integer            value,
        u32                     base);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_eisa_id_to_string (
        u32                     numeric_id,
        NATIVE_CHAR             *out_string);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_unsigned_integer_to_string (
-       ACPI_INTEGER            value,
+       acpi_integer            value,
        NATIVE_CHAR             *out_string);
 
 
@@ -617,7 +620,7 @@ acpi_ex_unsigned_integer_to_string (
  * amregion - default Op_region handlers
  */
 
-ACPI_STATUS
+acpi_status
 acpi_ex_system_memory_space_handler (
        u32                     function,
        ACPI_PHYSICAL_ADDRESS   address,
@@ -626,7 +629,7 @@ acpi_ex_system_memory_space_handler (
        void                    *handler_context,
        void                    *region_context);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_system_io_space_handler (
        u32                     function,
        ACPI_PHYSICAL_ADDRESS   address,
@@ -635,7 +638,7 @@ acpi_ex_system_io_space_handler (
        void                    *handler_context,
        void                    *region_context);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_pci_config_space_handler (
        u32                     function,
        ACPI_PHYSICAL_ADDRESS   address,
@@ -644,7 +647,7 @@ acpi_ex_pci_config_space_handler (
        void                    *handler_context,
        void                    *region_context);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_embedded_controller_space_handler (
        u32                     function,
        ACPI_PHYSICAL_ADDRESS   address,
@@ -653,7 +656,7 @@ acpi_ex_embedded_controller_space_handler (
        void                    *handler_context,
        void                    *region_context);
 
-ACPI_STATUS
+acpi_status
 acpi_ex_sm_bus_space_handler (
        u32                     function,
        ACPI_PHYSICAL_ADDRESS   address,
index c72beef4ba2e79b0eec2786d135852913f5c9d5d..219c5da0446fc916e2243f53b87fc17df5eb177f 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: aclocal.h - Internal data types used across the ACPI subsystem
- *       $Revision: 123 $
+ *       $Revision: 130 $
  *
  *****************************************************************************/
 
@@ -129,7 +129,7 @@ typedef struct acpi_mutex_info
 #define ACPI_MTX_LOCK                   1
 
 
-typedef u16                             ACPI_OWNER_ID;
+typedef u16                             acpi_owner_id;
 #define OWNER_TYPE_TABLE                0x0
 #define OWNER_TYPE_METHOD               0x1
 #define FIRST_METHOD_ID                 0x0000
@@ -137,7 +137,7 @@ typedef u16                             ACPI_OWNER_ID;
 
 /* TBD: [Restructure] get rid of the need for this! */
 
-#define TABLE_ID_DSDT                   (ACPI_OWNER_ID) 0x8000
+#define TABLE_ID_DSDT                   (acpi_owner_id) 0x8000
 
 
 /* Field access granularities */
@@ -162,7 +162,7 @@ typedef enum
        IMODE_LOAD_PASS2                = 0x02,
        IMODE_EXECUTE                   = 0x0E
 
-} OPERATING_MODE;
+} operating_mode;
 
 
 /*
@@ -187,7 +187,7 @@ typedef struct acpi_node
        u16                     reference_count; /* Current count of references and children */
        u8                      flags;
 
-} ACPI_NAMESPACE_NODE;
+} acpi_namespace_node;
 
 
 #define ENTRY_NOT_FOUND             NULL
@@ -214,25 +214,25 @@ typedef struct acpi_table_desc
        struct acpi_table_desc  *prev;
        struct acpi_table_desc  *next;
        struct acpi_table_desc  *installed_desc;
-       ACPI_TABLE_HEADER       *pointer;
+       acpi_table_header       *pointer;
        void                    *base_pointer;
        u8                      *aml_pointer;
        UINT64                  physical_address;
        u32                     aml_length;
        u32                     length;
        u32                     count;
-       ACPI_OWNER_ID           table_id;
+       acpi_owner_id           table_id;
        u8                      type;
        u8                      allocation;
        u8                      loaded_into_namespace;
 
-} ACPI_TABLE_DESC;
+} acpi_table_desc;
 
 
 typedef struct
 {
        NATIVE_CHAR             *search_for;
-       ACPI_HANDLE             *list;
+       acpi_handle             *list;
        u32                     *count;
 
 } FIND_CONTEXT;
@@ -240,7 +240,7 @@ typedef struct
 
 typedef struct
 {
-       ACPI_NAMESPACE_NODE     *node;
+       acpi_namespace_node     *node;
 } NS_SEARCH_DATA;
 
 
@@ -250,10 +250,10 @@ typedef struct
 typedef struct
 {
        NATIVE_CHAR             *name;
-       ACPI_OBJECT_TYPE8       type;
+       acpi_object_type8       type;
        NATIVE_CHAR             *val;
 
-} PREDEFINED_NAMES;
+} predefined_names;
 
 
 /* Object types used during package copies */
@@ -287,6 +287,7 @@ typedef struct acpi_namestring_info
 /* Status bits. */
 
 #define ACPI_STATUS_PMTIMER             0x0001
+#define ACPI_STATUS_BUSMASTER           0x0010
 #define ACPI_STATUS_GLOBAL              0x0020
 #define ACPI_STATUS_POWER_BUTTON        0x0100
 #define ACPI_STATUS_SLEEP_BUTTON        0x0200
@@ -336,11 +337,11 @@ typedef struct
 {
        u8                      type;           /* Level or Edge */
 
-       ACPI_HANDLE             method_handle;  /* Method handle for direct (fast) execution */
+       acpi_handle             method_handle;  /* Method handle for direct (fast) execution */
        ACPI_GPE_HANDLER        handler;        /* Address of handler, if any */
        void                    *context;       /* Context to be passed to handler */
 
-} ACPI_GPE_LEVEL_INFO;
+} acpi_gpe_level_info;
 
 
 /* Information about each particular fixed event */
@@ -445,7 +446,7 @@ typedef struct acpi_control_state
 typedef struct acpi_scope_state
 {
        ACPI_STATE_COMMON
-       ACPI_NAMESPACE_NODE     *node;
+       acpi_namespace_node     *node;
 
 } ACPI_SCOPE_STATE;
 
@@ -483,7 +484,7 @@ typedef struct acpi_result_values
 typedef struct acpi_notify_info
 {
        ACPI_STATE_COMMON
-       ACPI_NAMESPACE_NODE     *node;
+       acpi_namespace_node     *node;
        union acpi_operand_obj  *handler_obj;
 
 } ACPI_NOTIFY_INFO;
@@ -502,18 +503,18 @@ typedef union acpi_gen_state
        ACPI_RESULT_VALUES      results;
        ACPI_NOTIFY_INFO        notify;
 
-} ACPI_GENERIC_STATE;
+} acpi_generic_state;
 
 
 typedef
-ACPI_STATUS (*ACPI_PARSE_DOWNWARDS) (
+acpi_status (*acpi_parse_downwards) (
        u16                     opcode,
        struct acpi_parse_obj   *op,
        struct acpi_walk_state  *walk_state,
        struct acpi_parse_obj   **out_op);
 
 typedef
-ACPI_STATUS (*ACPI_PARSE_UPWARDS) (
+acpi_status (*acpi_parse_upwards) (
        struct acpi_walk_state  *walk_state,
        struct acpi_parse_obj   *op);
 
@@ -537,26 +538,45 @@ ACPI_STATUS (*ACPI_PARSE_UPWARDS) (
 #define ACPI_GET_OP_ARGS(a)             ((a)->flags & ACPI_OP_ARGS_MASK)
 #define ACPI_GET_OP_TYPE(a)             ((a)->flags & ACPI_OP_TYPE_MASK)
 
+/*
+ * Flags byte: 0-4 (5 bits) = Opcode Class  (0x001F
+ *             5   (1 bit)  = Has arguments flag
+ *             6-7 (2 bits) = Reserved
+ */
+#define AML_NO_ARGS         0
+#define AML_HAS_ARGS        0x0020
+#define AML_NSOBJECT        0x0100
+#define AML_NSOPCODE        0x0200
+#define AML_NSNODE          0x0400
+#define AML_NAMED           0x0800
+#define AML_DEFER           0x1000
+#define AML_FIELD           0x2000
+#define AML_CREATE          0x4000
+
 
 /*
  * AML opcode, name, and argument layout
  */
 typedef struct acpi_opcode_info
 {
-       u8                      flags;          /* Opcode type, Has_args flag */
        u32                     parse_args;     /* Grammar/Parse time arguments */
        u32                     runtime_args;   /* Interpret time arguments */
+       u16                     flags;          /* Opcode type, Has_args flag */
 
 #ifdef _OPCODE_NAMES
        NATIVE_CHAR             *name;          /* op name (debug only) */
 #endif
 
-} ACPI_OPCODE_INFO;
+} acpi_opcode_info;
 
 
 typedef union acpi_parse_val
 {
-       u32                     integer;        /* integer constant */
+       acpi_integer            integer;        /* integer constant (Up to 64 bits) */
+       uint64_struct           integer64;      /* Structure overlay for 2 32-bit Dwords */
+       u32                     integer32;      /* integer constant, 32 bits only */
+       u16                     integer16;      /* integer constant, 16 bits only */
+       u8                      integer8;       /* integer constant, 8 bits only */
        u32                     size;           /* bytelist or field size */
        NATIVE_CHAR             *string;        /* NULL terminated string */
        u8                      *buffer;        /* buffer or string */
@@ -576,7 +596,7 @@ typedef union acpi_parse_val
        DEBUG_ONLY_MEMBERS (\
        NATIVE_CHAR             op_name[16])    /* op name (debug only) */\
                          /* NON-DEBUG members below: */\
-       ACPI_NAMESPACE_NODE     *node;          /* for use by interpreter */\
+       acpi_namespace_node     *node;          /* for use by interpreter */\
        ACPI_PARSE_VALUE        value;          /* Value or args associated with the opcode */\
 
 
@@ -586,7 +606,7 @@ typedef union acpi_parse_val
 typedef struct acpi_parse_obj
 {
        ACPI_PARSE_COMMON
-} ACPI_PARSE_OBJECT;
+} acpi_parse_object;
 
 
 /*
@@ -600,7 +620,7 @@ typedef struct acpi_parse2_obj
        u32                     length;         /* AML length */
        u32                     name;           /* 4-byte name or zero if no name */
 
-} ACPI_PARSE2_OBJECT;
+} acpi_parse2_object;
 
 
 /*
@@ -615,12 +635,12 @@ typedef struct acpi_parse_state
        u8                      *aml_end;       /* (last + 1) AML byte */
        u8                      *pkg_start;     /* current package begin */
        u8                      *pkg_end;       /* current package end */
-       ACPI_PARSE_OBJECT       *start_op;      /* root of parse tree */
+       acpi_parse_object       *start_op;      /* root of parse tree */
        struct acpi_node        *start_node;
-       ACPI_GENERIC_STATE      *scope;         /* current scope */
+       acpi_generic_state      *scope;         /* current scope */
        struct acpi_parse_state *next;
 
-} ACPI_PARSE_STATE;
+} acpi_parse_state;
 
 
 /*****************************************************************************
@@ -631,22 +651,7 @@ typedef struct acpi_parse_state
 
 
 /* PCI */
-
 #define PCI_ROOT_HID_STRING             "PNP0A03"
-#define PCI_ROOT_HID_VALUE              0x030AD041       /* EISAID("PNP0A03") */
-
-
-/* Sleep states */
-
-#define SLWA_DEBUG_LEVEL                4
-#define GTS_CALL                        0
-#define GTS_WAKE                        1
-
-/* Cx States */
-
-#define MAX_CX_STATE_LATENCY            0xFFFFFFFF
-#define MAX_CX_STATES                   4
-
 
 /*
  * The #define's and enum below establish an abstract way of identifying what
@@ -831,11 +836,19 @@ typedef struct acpi_parse_state
 
 typedef struct
 {
-       NATIVE_CHAR             buffer[ACPI_DEVICE_ID_LENGTH];
+       char            buffer[ACPI_DEVICE_ID_LENGTH];
 
 } ACPI_DEVICE_ID;
 
 
+/*****************************************************************************
+ *
+ * Miscellaneous
+ *
+ ****************************************************************************/
+
+#define ASCII_ZERO                      0x30
+
 /*****************************************************************************
  *
  * Debugger
@@ -844,14 +857,14 @@ typedef struct
 
 typedef struct dbmethodinfo
 {
-       ACPI_HANDLE             thread_gate;
+       acpi_handle             thread_gate;
        NATIVE_CHAR             *name;
        NATIVE_CHAR             **args;
        u32                     flags;
        u32                     num_loops;
        NATIVE_CHAR             pathname[128];
 
-} DB_METHOD_INFO;
+} db_method_info;
 
 
 /*****************************************************************************
@@ -860,28 +873,80 @@ typedef struct dbmethodinfo
  *
  ****************************************************************************/
 
+typedef struct
+{
+       u32                     component_id;
+       NATIVE_CHAR             *proc_name;
+       NATIVE_CHAR             *module_name;
+
+} ACPI_DEBUG_PRINT_INFO;
+
 
 /* Entry for a memory allocation (debug only) */
 
-#ifdef ACPI_DEBUG
 
 #define MEM_MALLOC                      0
 #define MEM_CALLOC                      1
 #define MAX_MODULE_NAME                 16
 
-typedef struct acpi_allocation_info
-{
-       struct acpi_allocation_info *previous;
-       struct acpi_allocation_info *next;
-       void                        *address;
-       u32                         size;
-       u32                         component;
-       u32                         line;
-       NATIVE_CHAR                 module[MAX_MODULE_NAME];
+#define ACPI_COMMON_DEBUG_MEM_HEADER \
+       struct acpi_debug_mem_block *previous; \
+       struct acpi_debug_mem_block *next; \
+       u32                         size; \
+       u32                         component; \
+       u32                         line; \
+       NATIVE_CHAR                 module[MAX_MODULE_NAME]; \
        u8                          alloc_type;
 
-} ACPI_ALLOCATION_INFO;
 
+typedef struct
+{
+       ACPI_COMMON_DEBUG_MEM_HEADER
+
+} ACPI_DEBUG_MEM_HEADER;
+
+typedef struct acpi_debug_mem_block
+{
+       ACPI_COMMON_DEBUG_MEM_HEADER
+       UINT64                      user_space;
+
+} ACPI_DEBUG_MEM_BLOCK;
+
+
+#define ACPI_MEM_LIST_GLOBAL            0
+#define ACPI_MEM_LIST_NSNODE            1
+
+#define ACPI_MEM_LIST_FIRST_CACHE_LIST  2
+#define ACPI_MEM_LIST_STATE             2
+#define ACPI_MEM_LIST_PSNODE            3
+#define ACPI_MEM_LIST_PSNODE_EXT        4
+#define ACPI_MEM_LIST_OPERAND           5
+#define ACPI_MEM_LIST_WALK              6
+#define ACPI_MEM_LIST_MAX               6
+#define ACPI_NUM_MEM_LISTS              7
+
+
+typedef struct
+{
+       void                        *list_head;
+       u16                         link_offset;
+       u16                         max_cache_depth;
+       u16                         cache_depth;
+       u16                         object_size;
+
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+
+       /* Statistics for debug memory tracking only */
+
+       u32                         total_allocated;
+       u32                         total_freed;
+       u32                         current_total_size;
+       u32                         cache_requests;
+       u32                         cache_hits;
+       char                        *list_name;
 #endif
 
+} ACPI_MEMORY_LIST;
+
+
 #endif /* __ACLOCAL_H__ */
index c8a97d98eb52dda8337f7d2186de7e7989e83d4a..9fe5c95ee5ff21575bd916e19bc20f7353cb65a7 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acmacros.h - C macros for the entire subsystem.
- *       $Revision: 72 $
+ *       $Revision: 94 $
  *
  *****************************************************************************/
 
 #ifndef __ACMACROS_H__
 #define __ACMACROS_H__
 
+
 /*
  * Data manipulation macros
  */
 
-#ifndef LODWORD
-#define LODWORD(l)                      ((u32)(UINT64)(l))
-#endif
-
-#ifndef HIDWORD
-#define HIDWORD(l)                      ((u32)((((UINT64)(l)) >> 32) & 0xFFFFFFFF))
-#endif
-
 #ifndef LOWORD
 #define LOWORD(l)                       ((u16)(NATIVE_UINT)(l))
 #endif
  * For 16-bit addresses, we have to assume that the upper 32 bits
  * are zero.
  */
+#ifndef LODWORD
+#define LODWORD(l)                      (l)
+#endif
+
+#ifndef HIDWORD
+#define HIDWORD(l)                      (0)
+#endif
+
 #define ACPI_GET_ADDRESS(a)             ((a).lo)
 #define ACPI_STORE_ADDRESS(a,b)         {(a).hi=0;(a).lo=(b);}
 #define ACPI_VALID_ADDRESS(a)           ((a).hi | (a).lo)
 
 #else
+#ifdef ACPI_NO_INTEGER64_SUPPORT
+/*
+ * acpi_integer is 32-bits, no 64-bit support on this platform
+ */
+#ifndef LODWORD
+#define LODWORD(l)                      ((u32)(l))
+#endif
+
+#ifndef HIDWORD
+#define HIDWORD(l)                      (0)
+#endif
+
+#define ACPI_GET_ADDRESS(a)             (a)
+#define ACPI_STORE_ADDRESS(a,b)         ((a)=(b))
+#define ACPI_VALID_ADDRESS(a)           (a)
+
+#else
+
 /*
- * Full 64-bit address on 32-bit and 64-bit platforms
+ * Full 64-bit address/integer on both 32-bit and 64-bit platforms
  */
+#ifndef LODWORD
+#define LODWORD(l)                      ((u32)(UINT64)(l))
+#endif
+
+#ifndef HIDWORD
+#define HIDWORD(l)                      ((u32)(((*(uint64_struct *)(&l))).hi))
+#endif
+
 #define ACPI_GET_ADDRESS(a)             (a)
 #define ACPI_STORE_ADDRESS(a,b)         ((a)=(b))
 #define ACPI_VALID_ADDRESS(a)           (a)
+#endif
 #endif
 
  /*
 /*
  * Rounding macros (Power of two boundaries only)
  */
-
 #define ROUND_DOWN(value,boundary)      ((value) & (~((boundary)-1)))
 #define ROUND_UP(value,boundary)        (((value) + ((boundary)-1)) & (~((boundary)-1)))
 
  * MASK_BITS_ABOVE creates a mask starting AT the position and above
  * MASK_BITS_BELOW creates a mask starting one bit BELOW the position
  */
-
-
 #define MASK_BITS_ABOVE(position)       (~(((u32)(-1)) << ((u32) (position))))
 #define MASK_BITS_BELOW(position)       (((u32)(-1)) << ((u32) (position)))
 
-#ifdef DEBUG_ASSERT
-#undef DEBUG_ASSERT
-#endif
-
 
 /* Macros for GAS addressing */
 
+#ifndef _IA16
+
 #define ACPI_PCI_DEVICE_MASK            (UINT64) 0x0000FFFF00000000
 #define ACPI_PCI_FUNCTION_MASK          (UINT64) 0x00000000FFFF0000
 #define ACPI_PCI_REGISTER_MASK          (UINT64) 0x000000000000FFFF
 
-#define ACPI_PCI_FUNCTION(a)            (u32) ((((a) & ACPI_PCI_FUNCTION_MASK) >> 16))
-#define ACPI_PCI_DEVICE(a)              (u32) ((((a) & ACPI_PCI_DEVICE_MASK) >> 32))
-
-#ifndef _IA16
-#define ACPI_PCI_REGISTER(a)            (u32) (((a) & ACPI_PCI_REGISTER_MASK))
-#define ACPI_PCI_DEVFUN(a)              (u32) ((ACPI_PCI_DEVICE(a) << 16) | ACPI_PCI_FUNCTION(a))
+#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))
 
 #else
-#define ACPI_PCI_REGISTER(a)            (u32) (((a) & 0x0000FFFF))
-#define ACPI_PCI_DEVFUN(a)              (u32) ((((a) & 0xFFFF0000) >> 16))
+
+/* No support for GAS and PCI IDs in 16-bit mode  */
+
+#define ACPI_PCI_FUNCTION(a)            (u16) ((a) & 0xFFFF0000)
+#define ACPI_PCI_DEVICE(a)              (u16) ((a) & 0x0000FFFF)
+#define ACPI_PCI_REGISTER(a)            (u16) ((a) & 0x0000FFFF)
 
 #endif
 
 /*
- * An ACPI_HANDLE (which is actually an ACPI_NAMESPACE_NODE *) can appear in some contexts,
- * such as on ap_obj_stack, where a pointer to an ACPI_OPERAND_OBJECT can also
+ * An acpi_handle (which is actually an acpi_namespace_node *) can appear in some contexts,
+ * such as on ap_obj_stack, where a pointer to an acpi_operand_object can also
  * appear.  This macro is used to distinguish them.
  *
  * The Data_type field is the first field in both structures.
  */
-
-#define VALID_DESCRIPTOR_TYPE(d,t)      (((ACPI_NAMESPACE_NODE *)d)->data_type == t)
+#define VALID_DESCRIPTOR_TYPE(d,t)      (((acpi_namespace_node *)d)->data_type == t)
 
 
 /* Macro to test the object type */
 
-#define IS_THIS_OBJECT_TYPE(d,t)        (((ACPI_OPERAND_OBJECT  *)d)->common.type == (u8)t)
+#define IS_THIS_OBJECT_TYPE(d,t)        (((acpi_operand_object  *)d)->common.type == (u8)t)
 
 /* Macro to check the table flags for SINGLE or MULTIPLE tables are allowed */
 
 /*
  * Macro to check if a pointer is within an ACPI table.
  * Parameter (a) is the pointer to check.  Parameter (b) must be defined
- * as a pointer to an ACPI_TABLE_HEADER.  (b+1) then points past the header,
+ * 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
 #define 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
-#define OP_INFO_ENTRY(flags,name,Pargs,Iargs)     {flags,Pargs,Iargs,name}
+#define ACPI_OP(name,Pargs,Iargs,flags)     {Pargs,Iargs,flags,name}
 #else
-#define OP_INFO_ENTRY(flags,name,Pargs,Iargs)     {flags,Pargs,Iargs}
+#define ACPI_OP(name,Pargs,Iargs,flags)     {Pargs,Iargs,flags}
 #endif
 
 #define ARG_TYPE_WIDTH                  5
 
 #ifdef ACPI_DEBUG
 
-#define REPORT_INFO(fp)                 {_report_info(_THIS_MODULE,__LINE__,_COMPONENT); \
-                                                                                       debug_print_raw PARAM_LIST(fp);}
-#define REPORT_ERROR(fp)                {_report_error(_THIS_MODULE,__LINE__,_COMPONENT); \
-                                                                                       debug_print_raw PARAM_LIST(fp);}
-#define REPORT_WARNING(fp)              {_report_warning(_THIS_MODULE,__LINE__,_COMPONENT); \
-                                                                                       debug_print_raw PARAM_LIST(fp);}
+#define REPORT_INFO(fp)                 {acpi_ut_report_info(_THIS_MODULE,__LINE__,_COMPONENT); \
+                                                                                       acpi_os_printf PARAM_LIST(fp);}
+#define REPORT_ERROR(fp)                {acpi_ut_report_error(_THIS_MODULE,__LINE__,_COMPONENT); \
+                                                                                       acpi_os_printf PARAM_LIST(fp);}
+#define REPORT_WARNING(fp)              {acpi_ut_report_warning(_THIS_MODULE,__LINE__,_COMPONENT); \
+                                                                                       acpi_os_printf PARAM_LIST(fp);}
 
 #else
 
-#define REPORT_INFO(fp)                 {_report_info("ACPI",__LINE__,_COMPONENT); \
-                                                                                       debug_print_raw PARAM_LIST(fp);}
-#define REPORT_ERROR(fp)                {_report_error("ACPI",__LINE__,_COMPONENT); \
-                                                                                       debug_print_raw PARAM_LIST(fp);}
-#define REPORT_WARNING(fp)              {_report_warning("ACPI",__LINE__,_COMPONENT); \
-                                                                                       debug_print_raw PARAM_LIST(fp);}
+#define REPORT_INFO(fp)                 {acpi_ut_report_info("ACPI",__LINE__,_COMPONENT); \
+                                                                                       acpi_os_printf PARAM_LIST(fp);}
+#define REPORT_ERROR(fp)                {acpi_ut_report_error("ACPI",__LINE__,_COMPONENT); \
+                                                                                       acpi_os_printf PARAM_LIST(fp);}
+#define REPORT_WARNING(fp)              {acpi_ut_report_warning("ACPI",__LINE__,_COMPONENT); \
+                                                                                       acpi_os_printf PARAM_LIST(fp);}
 
 #endif
 
 /* Error reporting.  These versions pass thru the module and line# */
 
-#define _REPORT_INFO(a,b,c,fp)          {_report_info(a,b,c); \
-                                                                                       debug_print_raw PARAM_LIST(fp);}
-#define _REPORT_ERROR(a,b,c,fp)         {_report_error(a,b,c); \
-                                                                                       debug_print_raw PARAM_LIST(fp);}
-#define _REPORT_WARNING(a,b,c,fp)       {_report_warning(a,b,c); \
-                                                                                       debug_print_raw PARAM_LIST(fp);}
-
-/* Buffer dump macros */
-
-#define DUMP_BUFFER(a,b)                acpi_ut_dump_buffer((u8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT)
+#define _REPORT_INFO(a,b,c,fp)          {acpi_ut_report_info(a,b,c); \
+                                                                                       acpi_os_printf PARAM_LIST(fp);}
+#define _REPORT_ERROR(a,b,c,fp)         {acpi_ut_report_error(a,b,c); \
+                                                                                       acpi_os_printf PARAM_LIST(fp);}
+#define _REPORT_WARNING(a,b,c,fp)       {acpi_ut_report_warning(a,b,c); \
+                                                                                       acpi_os_printf PARAM_LIST(fp);}
 
 /*
  * Debug macros that are conditionally compiled
  * as a local string ("_Proc_name) so that it can be also used by the function exit macros below.
  */
 
-#define PROC_NAME(a)                    char * _proc_name = a;
-#define FUNCTION_TRACE(a)               char * _proc_name = a;\
-                                                                               function_trace(_THIS_MODULE,__LINE__,_COMPONENT,a)
-#define FUNCTION_TRACE_PTR(a,b)         char * _proc_name = a;\
-                                                                               function_trace_ptr(_THIS_MODULE,__LINE__,_COMPONENT,a,(void *)b)
-#define FUNCTION_TRACE_U32(a,b)         char * _proc_name = a;\
-                                                                               function_trace_u32(_THIS_MODULE,__LINE__,_COMPONENT,a,(u32)b)
-#define FUNCTION_TRACE_STR(a,b)         char * _proc_name = a;\
-                                                                               function_trace_str(_THIS_MODULE,__LINE__,_COMPONENT,a,(NATIVE_CHAR *)b)
+#define PROC_NAME(a)                    ACPI_DEBUG_PRINT_INFO _dbg;     \
+                                                                               _dbg.component_id = _COMPONENT; \
+                                                                               _dbg.proc_name   = a;           \
+                                                                               _dbg.module_name = _THIS_MODULE;
+
+#define FUNCTION_TRACE(a)               PROC_NAME(a)\
+                                                                               acpi_ut_trace(__LINE__,&_dbg)
+#define FUNCTION_TRACE_PTR(a,b)         PROC_NAME(a)\
+                                                                               acpi_ut_trace_ptr(__LINE__,&_dbg,(void *)b)
+#define FUNCTION_TRACE_U32(a,b)         PROC_NAME(a)\
+                                                                               acpi_ut_trace_u32(__LINE__,&_dbg,(u32)b)
+#define FUNCTION_TRACE_STR(a,b)         PROC_NAME(a)\
+                                                                               acpi_ut_trace_str(__LINE__,&_dbg,(NATIVE_CHAR *)b)
+
+#define FUNCTION_ENTRY()                acpi_ut_track_stack_ptr()
+
 /*
  * Function exit tracing.
  * WARNING: These macros include a return statement.  This is usually considered
  * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros
  * so that "_Proc_name" is defined.
  */
-#define return_VOID                     {function_exit(_THIS_MODULE,__LINE__,_COMPONENT,_proc_name);return;}
-#define return_ACPI_STATUS(s)           {function_status_exit(_THIS_MODULE,__LINE__,_COMPONENT,_proc_name,s);return(s);}
-#define return_VALUE(s)                 {function_value_exit(_THIS_MODULE,__LINE__,_COMPONENT,_proc_name,s);return(s);}
-#define return_PTR(s)                   {function_ptr_exit(_THIS_MODULE,__LINE__,_COMPONENT,_proc_name,(u8 *)s);return(s);}
+#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);}
 
 
 /* Conditional execution */
 #define DUMP_TABLES(a,b)                acpi_ns_dump_tables(a,b)
 #define DUMP_PATHNAME(a,b,c,d)          acpi_ns_dump_pathname(a,b,c,d)
 #define DUMP_RESOURCE_LIST(a)           acpi_rs_dump_resource_list(a)
-#define BREAK_MSG(a)                    acpi_os_breakpoint (a)
+#define DUMP_BUFFER(a,b)                acpi_ut_dump_buffer((u8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT)
+#define BREAK_MSG(a)                    acpi_os_signal (ACPI_SIGNAL_BREAKPOINT,(a))
+
 
 /*
  * Generate INT3 on ACPI_ERROR (Debug only!)
 
 #define ERROR_BREAK
 #ifdef  ERROR_BREAK
-#define BREAK_ON_ERROR(lvl)             if ((lvl)&ACPI_ERROR) acpi_os_breakpoint("Fatal error encountered\n")
+#define BREAK_ON_ERROR(lvl)              if ((lvl)&ACPI_ERROR) acpi_os_signal(ACPI_SIGNAL_BREAKPOINT,"Fatal error encountered\n")
 #else
 #define BREAK_ON_ERROR(lvl)
 #endif
  * Print iff:
  *    1) Debug print for the current component is enabled
  *    2) Debug error level or trace level for the print statement is enabled
- *
  */
 
-#define TEST_DEBUG_SWITCH(lvl)          if (((lvl) & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))
-
-#define DEBUG_PRINT(lvl,fp)             TEST_DEBUG_SWITCH(lvl) {\
-                                                                                       debug_print_prefix (_THIS_MODULE,__LINE__);\
-                                                                                       debug_print_raw PARAM_LIST(fp);\
-                                                                                       BREAK_ON_ERROR(lvl);}
-
-#define DEBUG_PRINTP(lvl,fp)            TEST_DEBUG_SWITCH(lvl) {\
-                                                                                       debug_print_prefix (_THIS_MODULE,__LINE__);\
-                                                                                       debug_print_raw ("%s: ",_proc_name);\
-                                                                                       debug_print_raw PARAM_LIST(fp);\
-                                                                                       BREAK_ON_ERROR(lvl);}
-
-#define DEBUG_PRINT_RAW(lvl,fp)         TEST_DEBUG_SWITCH(lvl) {\
-                                                                                       debug_print_raw PARAM_LIST(fp);}
-
-
-/* Assert macros */
-
-#define ACPI_ASSERT(exp)                if(!(exp)) \
-                                                                                       acpi_os_dbg_assert(#exp, __FILE__, __LINE__, "Failed Assertion")
-
-#define DEBUG_ASSERT(msg, exp)          if(!(exp)) \
-                                                                                       acpi_os_dbg_assert(#exp, __FILE__, __LINE__, msg)
+#define ACPI_DEBUG_PRINT(pl)            acpi_ut_debug_print PARAM_LIST(pl)
+#define ACPI_DEBUG_PRINT_RAW(pl)        acpi_ut_debug_print_raw PARAM_LIST(pl)
 
 
 #else
 #define FUNCTION_EXIT
 #define FUNCTION_STATUS_EXIT(s)
 #define FUNCTION_VALUE_EXIT(s)
+#define FUNCTION_ENTRY()
 #define DUMP_STACK_ENTRY(a)
 #define DUMP_OPERANDS(a,b,c,d,e)
 #define DUMP_ENTRY(a,b)
 #define DUMP_TABLES(a,b)
 #define DUMP_PATHNAME(a,b,c,d)
 #define DUMP_RESOURCE_LIST(a)
-#define DEBUG_PRINT(l,f)
-#define DEBUG_PRINTP(l,f)
-#define DEBUG_PRINT_RAW(l,f)
+#define DUMP_BUFFER(a,b)
+#define ACPI_DEBUG_PRINT(pl)
+#define ACPI_DEBUG_PRINT_RAW(pl)
 #define BREAK_MSG(a)
 
 #define return_VOID                     return
 #define return_VALUE(s)                 return(s)
 #define return_PTR(s)                   return(s)
 
-#define ACPI_ASSERT(exp)
-#define DEBUG_ASSERT(msg, exp)
-
 #endif
 
 /*
 
 
 #ifdef ACPI_DEBUG
-
 /*
  * 1) Set name to blanks
  * 2) Copy the object name
  */
-
 #define ADD_OBJECT_NAME(a,b)            MEMSET (a->common.name, ' ', sizeof (a->common.name));\
                                                                                STRNCPY (a->common.name, acpi_gbl_ns_type_names[b], sizeof (a->common.name))
-
 #else
 
 #define ADD_OBJECT_NAME(a,b)
-
 #endif
 
 
  * Memory allocation tracking (DEBUG ONLY)
  */
 
-#ifndef ACPI_DEBUG_TRACK_ALLOCATIONS
+#ifndef ACPI_DBG_TRACK_ALLOCATIONS
 
-#define acpi_ut_add_element_to_alloc_list(a,b,c,d,e,f)
-#define acpi_ut_delete_element_from_alloc_list(a,b,c,d)
-#define acpi_ut_dump_current_allocations(a,b)
-#define acpi_ut_dump_allocation_info()
+/* Memory allocation */
+
+#define ACPI_MEM_ALLOCATE(a)            acpi_os_allocate(a)
+#define ACPI_MEM_CALLOCATE(a)           acpi_os_callocate(a)
+#define ACPI_MEM_FREE(a)                acpi_os_free(a)
+#define ACPI_MEM_TRACKING(a)
 
-#define DECREMENT_OBJECT_METRICS(a)
-#define INCREMENT_OBJECT_METRICS(a)
-#define INITIALIZE_ALLOCATION_METRICS()
-#define DECREMENT_NAME_TABLE_METRICS(a)
-#define INCREMENT_NAME_TABLE_METRICS(a)
 
 #else
 
-#define INITIALIZE_ALLOCATION_METRICS() \
-       acpi_gbl_current_object_count = 0; \
-       acpi_gbl_current_object_size = 0; \
-       acpi_gbl_running_object_count = 0; \
-       acpi_gbl_running_object_size = 0; \
-       acpi_gbl_max_concurrent_object_count = 0; \
-       acpi_gbl_max_concurrent_object_size = 0; \
-       acpi_gbl_current_alloc_size = 0; \
-       acpi_gbl_current_alloc_count = 0; \
-       acpi_gbl_running_alloc_size = 0; \
-       acpi_gbl_running_alloc_count = 0; \
-       acpi_gbl_max_concurrent_alloc_size = 0; \
-       acpi_gbl_max_concurrent_alloc_count = 0; \
-       acpi_gbl_current_node_count = 0; \
-       acpi_gbl_current_node_size = 0; \
-       acpi_gbl_max_concurrent_node_count = 0
-
-
-#define DECREMENT_OBJECT_METRICS(a) \
-       acpi_gbl_current_object_count--; \
-       acpi_gbl_current_object_size -= a
-
-#define INCREMENT_OBJECT_METRICS(a) \
-       acpi_gbl_current_object_count++; \
-       acpi_gbl_running_object_count++; \
-       if (acpi_gbl_max_concurrent_object_count < acpi_gbl_current_object_count) \
-       { \
-               acpi_gbl_max_concurrent_object_count = acpi_gbl_current_object_count; \
-       } \
-       acpi_gbl_running_object_size += a; \
-       acpi_gbl_current_object_size += a; \
-       if (acpi_gbl_max_concurrent_object_size < acpi_gbl_current_object_size) \
-       { \
-               acpi_gbl_max_concurrent_object_size = acpi_gbl_current_object_size; \
-       }
-
-#define DECREMENT_NAME_TABLE_METRICS(a) \
-       acpi_gbl_current_node_count--; \
-       acpi_gbl_current_node_size -= (a)
-
-#define INCREMENT_NAME_TABLE_METRICS(a) \
-       acpi_gbl_current_node_count++; \
-       acpi_gbl_current_node_size+= (a); \
-       if (acpi_gbl_max_concurrent_node_count < acpi_gbl_current_node_count) \
-       { \
-               acpi_gbl_max_concurrent_node_count = acpi_gbl_current_node_count; \
-       }
-#endif /* ACPI_DEBUG_TRACK_ALLOCATIONS */
+/* Memory allocation */
+
+#define ACPI_MEM_ALLOCATE(a)            acpi_ut_allocate(a,_COMPONENT,_THIS_MODULE,__LINE__)
+#define ACPI_MEM_CALLOCATE(a)           acpi_ut_callocate(a, _COMPONENT,_THIS_MODULE,__LINE__)
+#define ACPI_MEM_FREE(a)                acpi_ut_free(a,_COMPONENT,_THIS_MODULE,__LINE__)
+#define ACPI_MEM_TRACKING(a)            a
+
+#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
+
 
+#define ACPI_GET_STACK_POINTER          _asm {mov eax, ebx}
 
 #endif /* ACMACROS_H */
index 9d166a5e74e1000003ee55637df096f108ce892d..440372cb87b25d1c529bbe48ef4b5c755852a4ed 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acnamesp.h - Namespace subcomponent prototypes and defines
- *       $Revision: 106 $
+ *       $Revision: 107 $
  *
  *****************************************************************************/
 
 
 /* To search the entire name space, pass this as Search_base */
 
-#define NS_ALL                  ((ACPI_HANDLE)0)
+#define NS_ALL                  ((acpi_handle)0)
 
 /*
  * Elements of Acpi_ns_properties are bit significant
- * and should be one-to-one with values of ACPI_OBJECT_TYPE
+ * and should be one-to-one with values of acpi_object_type
  */
 #define NSP_NORMAL              0
 #define NSP_NEWSCOPE            1   /* a definition of this type opens a name scope */
 #define NS_WALK_NO_UNLOCK       FALSE
 
 
-ACPI_STATUS
+acpi_status
 acpi_ns_load_namespace (
        void);
 
-ACPI_STATUS
+acpi_status
 acpi_ns_initialize_objects (
        void);
 
-ACPI_STATUS
+acpi_status
 acpi_ns_initialize_devices (
        void);
 
 
 /* Namespace init - nsxfinit */
 
-ACPI_STATUS
+acpi_status
 acpi_ns_init_one_device (
-       ACPI_HANDLE             obj_handle,
+       acpi_handle             obj_handle,
        u32                     nesting_level,
        void                    *context,
        void                    **return_value);
 
-ACPI_STATUS
+acpi_status
 acpi_ns_init_one_object (
-       ACPI_HANDLE             obj_handle,
+       acpi_handle             obj_handle,
        u32                     level,
        void                    *context,
        void                    **return_value);
 
 
-ACPI_STATUS
+acpi_status
 acpi_ns_walk_namespace (
-       ACPI_OBJECT_TYPE8       type,
-       ACPI_HANDLE             start_object,
+       acpi_object_type8       type,
+       acpi_handle             start_object,
        u32                     max_depth,
        u8                      unlock_before_callback,
        ACPI_WALK_CALLBACK      user_function,
@@ -103,38 +103,38 @@ acpi_ns_walk_namespace (
        void                    **return_value);
 
 
-ACPI_NAMESPACE_NODE *
+acpi_namespace_node *
 acpi_ns_get_next_object (
-       ACPI_OBJECT_TYPE8       type,
-       ACPI_NAMESPACE_NODE     *parent,
-       ACPI_NAMESPACE_NODE     *child);
+       acpi_object_type8       type,
+       acpi_namespace_node     *parent,
+       acpi_namespace_node     *child);
 
 
-ACPI_STATUS
+acpi_status
 acpi_ns_delete_namespace_by_owner (
        u16                     table_id);
 
 
 /* Namespace loading - nsload */
 
-ACPI_STATUS
+acpi_status
 acpi_ns_one_complete_parse (
        u32                     pass_number,
-       ACPI_TABLE_DESC         *table_desc);
+       acpi_table_desc         *table_desc);
 
-ACPI_STATUS
+acpi_status
 acpi_ns_parse_table (
-       ACPI_TABLE_DESC         *table_desc,
-       ACPI_NAMESPACE_NODE     *scope);
+       acpi_table_desc         *table_desc,
+       acpi_namespace_node     *scope);
 
-ACPI_STATUS
+acpi_status
 acpi_ns_load_table (
-       ACPI_TABLE_DESC         *table_desc,
-       ACPI_NAMESPACE_NODE     *node);
+       acpi_table_desc         *table_desc,
+       acpi_namespace_node     *node);
 
-ACPI_STATUS
+acpi_status
 acpi_ns_load_table_by_type (
-       ACPI_TABLE_TYPE         table_type);
+       acpi_table_type         table_type);
 
 
 /*
@@ -142,19 +142,19 @@ acpi_ns_load_table_by_type (
  */
 
 
-ACPI_STATUS
+acpi_status
 acpi_ns_root_initialize (
        void);
 
-ACPI_STATUS
+acpi_status
 acpi_ns_lookup (
-       ACPI_GENERIC_STATE      *scope_info,
+       acpi_generic_state      *scope_info,
        NATIVE_CHAR             *name,
-       ACPI_OBJECT_TYPE8       type,
-       OPERATING_MODE          interpreter_mode,
+       acpi_object_type8       type,
+       operating_mode          interpreter_mode,
        u32                     flags,
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_NAMESPACE_NODE     **ret_node);
+       acpi_walk_state         *walk_state,
+       acpi_namespace_node     **ret_node);
 
 
 /*
@@ -162,38 +162,38 @@ acpi_ns_lookup (
  */
 
 
-ACPI_NAMESPACE_NODE *
+acpi_namespace_node *
 acpi_ns_create_node (
-       u32                     acpi_name);
+       u32                     name);
 
 void
 acpi_ns_delete_node (
-       ACPI_NAMESPACE_NODE     *node);
+       acpi_namespace_node     *node);
 
-ACPI_STATUS
+acpi_status
 acpi_ns_delete_namespace_subtree (
-       ACPI_NAMESPACE_NODE     *parent_handle);
+       acpi_namespace_node     *parent_handle);
 
 void
 acpi_ns_detach_object (
-       ACPI_NAMESPACE_NODE     *node);
+       acpi_namespace_node     *node);
 
 void
 acpi_ns_delete_children (
-       ACPI_NAMESPACE_NODE     *parent);
+       acpi_namespace_node     *parent);
 
 
 /*
  * Namespace modification - nsmodify
  */
 
-ACPI_STATUS
+acpi_status
 acpi_ns_unload_namespace (
-       ACPI_HANDLE             handle);
+       acpi_handle             handle);
 
-ACPI_STATUS
+acpi_status
 acpi_ns_delete_subtree (
-       ACPI_HANDLE             start_handle);
+       acpi_handle             start_handle);
 
 
 /*
@@ -202,17 +202,17 @@ acpi_ns_delete_subtree (
 
 void
 acpi_ns_dump_tables (
-       ACPI_HANDLE             search_base,
+       acpi_handle             search_base,
        u32                     max_depth);
 
 void
 acpi_ns_dump_entry (
-       ACPI_HANDLE             handle,
+       acpi_handle             handle,
        u32                     debug_level);
 
-ACPI_STATUS
+acpi_status
 acpi_ns_dump_pathname (
-       ACPI_HANDLE             handle,
+       acpi_handle             handle,
        NATIVE_CHAR             *msg,
        u32                     level,
        u32                     component);
@@ -223,58 +223,58 @@ acpi_ns_dump_root_devices (
 
 void
 acpi_ns_dump_objects (
-       ACPI_OBJECT_TYPE8       type,
+       acpi_object_type8       type,
        u32                     max_depth,
        u32                     ownder_id,
-       ACPI_HANDLE             start_handle);
+       acpi_handle             start_handle);
 
 
 /*
  * Namespace evaluation functions - nseval
  */
 
-ACPI_STATUS
+acpi_status
 acpi_ns_evaluate_by_handle (
-       ACPI_NAMESPACE_NODE     *prefix_node,
-       ACPI_OPERAND_OBJECT     **params,
-       ACPI_OPERAND_OBJECT     **return_object);
+       acpi_namespace_node     *prefix_node,
+       acpi_operand_object     **params,
+       acpi_operand_object     **return_object);
 
-ACPI_STATUS
+acpi_status
 acpi_ns_evaluate_by_name (
        NATIVE_CHAR             *pathname,
-       ACPI_OPERAND_OBJECT     **params,
-       ACPI_OPERAND_OBJECT     **return_object);
+       acpi_operand_object     **params,
+       acpi_operand_object     **return_object);
 
-ACPI_STATUS
+acpi_status
 acpi_ns_evaluate_relative (
-       ACPI_NAMESPACE_NODE     *prefix_node,
+       acpi_namespace_node     *prefix_node,
        NATIVE_CHAR             *pathname,
-       ACPI_OPERAND_OBJECT     **params,
-       ACPI_OPERAND_OBJECT     **return_object);
+       acpi_operand_object     **params,
+       acpi_operand_object     **return_object);
 
-ACPI_STATUS
+acpi_status
 acpi_ns_execute_control_method (
-       ACPI_NAMESPACE_NODE     *method_node,
-       ACPI_OPERAND_OBJECT     **params,
-       ACPI_OPERAND_OBJECT     **return_obj_desc);
+       acpi_namespace_node     *method_node,
+       acpi_operand_object     **params,
+       acpi_operand_object     **return_obj_desc);
 
-ACPI_STATUS
+acpi_status
 acpi_ns_get_object_value (
-       ACPI_NAMESPACE_NODE     *object_node,
-       ACPI_OPERAND_OBJECT     **return_obj_desc);
+       acpi_namespace_node     *object_node,
+       acpi_operand_object     **return_obj_desc);
 
 
 /*
  * Parent/Child/Peer utility functions - nsfamily
  */
 
-ACPI_NAME
+acpi_name
 acpi_ns_find_parent_name (
-       ACPI_NAMESPACE_NODE     *node_to_search);
+       acpi_namespace_node     *node_to_search);
 
 u8
 acpi_ns_exist_downstream_sibling (
-       ACPI_NAMESPACE_NODE     *this_node);
+       acpi_namespace_node     *this_node);
 
 
 /*
@@ -283,77 +283,77 @@ acpi_ns_exist_downstream_sibling (
 
 u32
 acpi_ns_opens_scope (
-       ACPI_OBJECT_TYPE8       type);
+       acpi_object_type8       type);
 
 NATIVE_CHAR *
 acpi_ns_get_table_pathname (
-       ACPI_NAMESPACE_NODE     *node);
+       acpi_namespace_node     *node);
 
 NATIVE_CHAR *
 acpi_ns_name_of_current_scope (
-       ACPI_WALK_STATE         *walk_state);
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ns_handle_to_pathname (
-       ACPI_HANDLE             obj_handle,
+       acpi_handle             obj_handle,
        u32                     *buf_size,
        NATIVE_CHAR             *user_buffer);
 
 u8
 acpi_ns_pattern_match (
-       ACPI_NAMESPACE_NODE     *obj_node,
+       acpi_namespace_node     *obj_node,
        NATIVE_CHAR             *search_for);
 
 
-ACPI_STATUS
+acpi_status
 acpi_ns_get_node (
        NATIVE_CHAR             *pathname,
-       ACPI_NAMESPACE_NODE     *in_prefix_node,
-       ACPI_NAMESPACE_NODE     **out_node);
+       acpi_namespace_node     *in_prefix_node,
+       acpi_namespace_node     **out_node);
 
 u32
 acpi_ns_get_pathname_length (
-       ACPI_NAMESPACE_NODE     *node);
+       acpi_namespace_node     *node);
 
 
 /*
  * Object management for NTEs - nsobject
  */
 
-ACPI_STATUS
+acpi_status
 acpi_ns_attach_object (
-       ACPI_NAMESPACE_NODE     *node,
-       ACPI_OPERAND_OBJECT     *object,
-       ACPI_OBJECT_TYPE8       type);
+       acpi_namespace_node     *node,
+       acpi_operand_object     *object,
+       acpi_object_type8       type);
 
 
 /*
  * Namespace searching and entry - nssearch
  */
 
-ACPI_STATUS
+acpi_status
 acpi_ns_search_and_enter (
        u32                     entry_name,
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_NAMESPACE_NODE     *node,
-       OPERATING_MODE          interpreter_mode,
-       ACPI_OBJECT_TYPE8       type,
+       acpi_walk_state         *walk_state,
+       acpi_namespace_node     *node,
+       operating_mode          interpreter_mode,
+       acpi_object_type8       type,
        u32                     flags,
-       ACPI_NAMESPACE_NODE     **ret_node);
+       acpi_namespace_node     **ret_node);
 
-ACPI_STATUS
+acpi_status
 acpi_ns_search_node (
        u32                     entry_name,
-       ACPI_NAMESPACE_NODE     *node,
-       ACPI_OBJECT_TYPE8       type,
-       ACPI_NAMESPACE_NODE     **ret_node);
+       acpi_namespace_node     *node,
+       acpi_object_type8       type,
+       acpi_namespace_node     **ret_node);
 
 void
 acpi_ns_install_node (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_NAMESPACE_NODE     *parent_node,   /* Parent */
-       ACPI_NAMESPACE_NODE     *node,      /* New Child*/
-       ACPI_OBJECT_TYPE8       type);
+       acpi_walk_state         *walk_state,
+       acpi_namespace_node     *parent_node,   /* Parent */
+       acpi_namespace_node     *node,      /* New Child*/
+       acpi_object_type8       type);
 
 
 /*
@@ -368,58 +368,58 @@ u8
 acpi_ns_valid_path_separator (
        NATIVE_CHAR             sep);
 
-ACPI_OBJECT_TYPE8
+acpi_object_type8
 acpi_ns_get_type (
-       ACPI_NAMESPACE_NODE     *node);
+       acpi_namespace_node     *node);
 
 void *
 acpi_ns_get_attached_object (
-       ACPI_NAMESPACE_NODE     *node);
+       acpi_namespace_node     *node);
 
 u32
 acpi_ns_local (
-       ACPI_OBJECT_TYPE8       type);
+       acpi_object_type8       type);
 
-ACPI_STATUS
+acpi_status
 acpi_ns_build_internal_name (
        ACPI_NAMESTRING_INFO    *info);
 
-ACPI_STATUS
+acpi_status
 acpi_ns_get_internal_name_length (
        ACPI_NAMESTRING_INFO    *info);
 
-ACPI_STATUS
+acpi_status
 acpi_ns_internalize_name (
        NATIVE_CHAR             *dotted_name,
        NATIVE_CHAR             **converted_name);
 
-ACPI_STATUS
+acpi_status
 acpi_ns_externalize_name (
        u32                     internal_name_length,
        NATIVE_CHAR             *internal_name,
        u32                     *converted_name_length,
        NATIVE_CHAR             **converted_name);
 
-ACPI_NAMESPACE_NODE *
+acpi_namespace_node *
 acpi_ns_convert_handle_to_entry (
-       ACPI_HANDLE             handle);
+       acpi_handle             handle);
 
-ACPI_HANDLE
+acpi_handle
 acpi_ns_convert_entry_to_handle(
-       ACPI_NAMESPACE_NODE     *node);
+       acpi_namespace_node     *node);
 
 void
 acpi_ns_terminate (
        void);
 
-ACPI_NAMESPACE_NODE *
+acpi_namespace_node *
 acpi_ns_get_parent_object (
-       ACPI_NAMESPACE_NODE     *node);
+       acpi_namespace_node     *node);
 
 
-ACPI_NAMESPACE_NODE *
+acpi_namespace_node *
 acpi_ns_get_next_valid_object (
-       ACPI_NAMESPACE_NODE     *node);
+       acpi_namespace_node     *node);
 
 
 #endif /* __ACNAMESP_H__ */
index a2a421887a00086ef575b11596467b4cf1fd2c09..91bc9bb6efdeee0077c473cb42eeb93712c12a62 100644 (file)
@@ -1,8 +1,8 @@
 
 /******************************************************************************
  *
- * Name: acobject.h - Definition of ACPI_OPERAND_OBJECT  (Internal object only)
- *       $Revision: 89 $
+ * Name: acobject.h - Definition of acpi_operand_object  (Internal object only)
+ *       $Revision: 90 $
  *
  *****************************************************************************/
 
 
 
 /*
- * The ACPI_OPERAND_OBJECT  is used to pass AML operands from the dispatcher
+ * The acpi_operand_object  is used to pass AML operands from the dispatcher
  * to the interpreter, and to keep track of the various handlers such as
  * address space handlers and notify handlers.  The object is a constant
  * size in order to allow them to be cached and reused.
  *
- * All variants of the ACPI_OPERAND_OBJECT  are defined with the same
+ * All variants of the acpi_operand_object  are defined with the same
  * sequence of field types, with fields that are not used in a particular
  * variant being named "Reserved".  This is not strictly necessary, but
  * may in some circumstances simplify understanding if these structures
 
 #define ACPI_OBJECT_COMMON_HEADER           /* SIZE/ALIGNMENT: 32-bits plus trailing 8-bit flag */\
        u8                          data_type;          /* To differentiate various internal objs */\
-       u8                          type;               /* ACPI_OBJECT_TYPE */\
+       u8                          type;               /* acpi_object_type */\
        u16                         reference_count;    /* For object deletion management */\
        u8                          flags; \
 
 /* Defines for flag byte above */
 
 #define AOPOBJ_STATIC_ALLOCATION    0x1
-#define AOPOBJ_DATA_VALID           0x2
-#define AOPOBJ_INITIALIZED          0x4
+#define AOPOBJ_STATIC_POINTER       0x2
+#define AOPOBJ_DATA_VALID           0x4
+#define AOPOBJ_ZERO_CONST           0x4
+#define AOPOBJ_INITIALIZED          0x8
 
 
 /*
@@ -122,7 +124,7 @@ typedef struct /* NUMBER - has value */
 {
        ACPI_OBJECT_COMMON_HEADER
 
-       ACPI_INTEGER                value;
+       acpi_integer                value;
 
 } ACPI_OBJECT_INTEGER;
 
@@ -193,7 +195,7 @@ typedef struct /* METHOD */
 
        u8                          concurrency;
        u8                          thread_count;
-       ACPI_OWNER_ID               owning_id;
+       acpi_owner_id               owning_id;
 
 } ACPI_OBJECT_METHOD;
 
@@ -222,7 +224,7 @@ typedef struct /* REGION */
        union acpi_operand_obj      *extra;             /* Pointer to executable AML (in region definition) */
 
        union acpi_operand_obj      *addr_handler;      /* Handler for system notifies */
-       ACPI_NAMESPACE_NODE         *node;              /* containing object */
+       acpi_namespace_node         *node;              /* containing object */
        union acpi_operand_obj      *next;
 
 } ACPI_OBJECT_REGION;
@@ -324,7 +326,7 @@ typedef struct /* BUFFER FIELD */
        ACPI_COMMON_FIELD_INFO
 
        union acpi_operand_obj      *extra;             /* Pointer to executable AML (in field definition) */
-       ACPI_NAMESPACE_NODE         *node;              /* Parent (containing) object node */
+       acpi_namespace_node         *node;              /* Parent (containing) object node */
        union acpi_operand_obj      *buffer_obj;        /* Containing Buffer object */
 
 } ACPI_OBJECT_BUFFER_FIELD;
@@ -338,7 +340,7 @@ typedef struct /* NOTIFY HANDLER */
 {
        ACPI_OBJECT_COMMON_HEADER
 
-       ACPI_NAMESPACE_NODE         *node;               /* Parent device */
+       acpi_namespace_node         *node;               /* Parent device */
        ACPI_NOTIFY_HANDLER         handler;
        void                        *context;
 
@@ -358,7 +360,7 @@ typedef struct /* ADDRESS HANDLER */
        u16                         hflags;
        ACPI_ADR_SPACE_HANDLER      handler;
 
-       ACPI_NAMESPACE_NODE         *node;              /* Parent device */
+       acpi_namespace_node         *node;              /* Parent device */
        void                        *context;
        ACPI_ADR_SPACE_SETUP        setup;
        union acpi_operand_obj      *region_list;       /* regions using this handler */
@@ -380,8 +382,8 @@ typedef struct /* Reference - Local object type */
        u16                         opcode;
        u32                         offset;             /* Used for Arg_op, Local_op, and Index_op */
 
-       void                        *object;            /* Name_op=>HANDLE to obj, Index_op=>ACPI_OPERAND_OBJECT */
-       ACPI_NAMESPACE_NODE         *node;
+       void                        *object;            /* Name_op=>HANDLE to obj, Index_op=>acpi_operand_object */
+       acpi_namespace_node         *node;
        union acpi_operand_obj      **where;
 
 } ACPI_OBJECT_REFERENCE;
@@ -402,7 +404,7 @@ typedef struct /* EXTRA */
        u16                         word_fill1;
        u32                         pcode_length;
        u8                          *pcode;
-       ACPI_NAMESPACE_NODE         *method_REG;        /* _REG method for this region (if any) */
+       acpi_namespace_node         *method_REG;        /* _REG method for this region (if any) */
        void                        *region_context;    /* Region-specific data */
 
 } ACPI_OBJECT_EXTRA;
@@ -410,7 +412,7 @@ typedef struct /* EXTRA */
 
 /******************************************************************************
  *
- * ACPI_OPERAND_OBJECT  Descriptor - a giant union of all of the above
+ * acpi_operand_object  Descriptor - a giant union of all of the above
  *
  *****************************************************************************/
 
@@ -440,6 +442,6 @@ typedef union acpi_operand_obj
        ACPI_OBJECT_ADDR_HANDLER    addr_handler;
        ACPI_OBJECT_EXTRA           extra;
 
-} ACPI_OPERAND_OBJECT;
+} acpi_operand_object;
 
 #endif /* _ACOBJECT_H */
index 354406a6362ec692376d63ee2098a73dd714fd8e..c766fc92f0c9f5b614ffe3fe239fbee2cec5988d 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acoutput.h -- debug output
- *       $Revision: 78 $
+ *       $Revision: 84 $
  *
  *****************************************************************************/
 
@@ -32,7 +32,7 @@
  * component basis and a per-exception-type basis.
  */
 
-/* Component IDs -- used in the global "Debug_layer" */
+/* Component IDs are used in the global "Debug_layer" */
 
 #define ACPI_UTILITIES              0x00000001
 #define ACPI_HARDWARE               0x00000002
 #define ACPI_DEBUGGER               0x00000200
 #define ACPI_OS_SERVICES            0x00000400
 
-#define ACPI_BUS                    0x00001000
-#define ACPI_SYSTEM                 0x00002000
-#define ACPI_POWER                  0x00004000
-#define ACPI_EC                     0x00008000
-#define ACPI_AC_ADAPTER             0x00010000
-#define ACPI_BATTERY                0x00020000
-#define ACPI_BUTTON                 0x00040000
-#define ACPI_PROCESSOR              0x00080000
-#define ACPI_THERMAL                0x00100000
+#define ACPI_BUS                    0x00010000
+#define ACPI_SYSTEM                 0x00020000
+#define ACPI_POWER                  0x00040000
+#define ACPI_EC                     0x00080000
+#define ACPI_AC_ADAPTER             0x00100000
+#define ACPI_BATTERY                0x00200000
+#define ACPI_BUTTON                 0x00400000
+#define ACPI_PROCESSOR              0x00800000
+#define ACPI_THERMAL                0x01000000
+#define ACPI_FAN                    0x02000000
 
-#define ACPI_ALL_COMPONENTS         0x00FFFFFF
+#define ACPI_ALL_COMPONENTS         0x0FFFFFFF
 
 #define ACPI_COMPONENT_DEFAULT      (ACPI_ALL_COMPONENTS)
 
 #define ACPI_TOOLS                  0x20000000
 
 
+/*
+ * Raw debug output levels, do not use these in the DEBUG_PRINT macros
+ */
+
+#define ACPI_LV_OK                  0x00000001
+#define ACPI_LV_INFO                0x00000002
+#define ACPI_LV_WARN                0x00000004
+#define ACPI_LV_ERROR               0x00000008
+#define ACPI_LV_FATAL               0x00000010
+#define ACPI_LV_DEBUG_OBJECT        0x00000020
+#define ACPI_LV_ALL_EXCEPTIONS      0x0000003F
+
+
+/* Trace verbosity level 1 [Standard Trace Level] */
+
+#define ACPI_LV_PARSE               0x00000040
+#define ACPI_LV_LOAD                0x00000080
+#define ACPI_LV_DISPATCH            0x00000100
+#define ACPI_LV_EXEC                0x00000200
+#define ACPI_LV_NAMES               0x00000400
+#define ACPI_LV_OPREGION            0x00000800
+#define ACPI_LV_BFIELD              0x00001000
+#define ACPI_LV_TABLES              0x00002000
+#define ACPI_LV_VALUES              0x00004000
+#define ACPI_LV_OBJECTS             0x00008000
+#define ACPI_LV_RESOURCES           0x00010000
+#define ACPI_LV_USER_REQUESTS       0x00020000
+#define ACPI_LV_PACKAGE             0x00040000
+#define ACPI_LV_INIT                0x00080000
+#define ACPI_LV_VERBOSITY1          0x000FFF40 | ACPI_LV_ALL_EXCEPTIONS
+
+/* Trace verbosity level 2 [Function tracing and memory allocation] */
+
+#define ACPI_LV_ALLOCATIONS         0x00100000
+#define ACPI_LV_FUNCTIONS           0x00200000
+#define ACPI_LV_VERBOSITY2          0x00300000 | ACPI_LV_VERBOSITY1
+#define ACPI_LV_ALL                 ACPI_LV_VERBOSITY2
+
+/* Trace verbosity level 3 [Threading, I/O, and Interrupts] */
+
+#define ACPI_LV_MUTEX               0x01000000
+#define ACPI_LV_THREADS             0x02000000
+#define ACPI_LV_IO                  0x04000000
+#define ACPI_LV_INTERRUPTS          0x08000000
+#define ACPI_LV_VERBOSITY3          0x0F000000 | ACPI_LV_VERBOSITY2
+
+/*
+ * Debug level macros that are used in the DEBUG_PRINT macros
+ */
+
+#define ACPI_DEBUG_LEVEL(dl)       dl,__LINE__,&_dbg
+
 /* Exception level -- used in the global "Debug_level" */
 
-#define ACPI_OK                     0x00000001
-#define ACPI_INFO                   0x00000002
-#define ACPI_WARN                   0x00000004
-#define ACPI_ERROR                  0x00000008
-#define ACPI_FATAL                  0x00000010
-#define ACPI_DEBUG_OBJECT           0x00000020
-#define ACPI_ALL                    0x0000003F
+#define ACPI_DB_OK                  ACPI_DEBUG_LEVEL (ACPI_LV_OK)
+#define ACPI_DB_INFO                ACPI_DEBUG_LEVEL (ACPI_LV_INFO)
+#define ACPI_DB_WARN                ACPI_DEBUG_LEVEL (ACPI_LV_WARN)
+#define ACPI_DB_ERROR               ACPI_DEBUG_LEVEL (ACPI_LV_ERROR)
+#define ACPI_DB_FATAL               ACPI_DEBUG_LEVEL (ACPI_LV_FATAL)
+#define ACPI_DB_DEBUG_OBJECT        ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT)
+#define ACPI_DB_ALL_EXCEPTIONS      ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS)
 
 
 /* Trace level -- also used in the global "Debug_level" */
 
-#define TRACE_THREADS               0x00000080
-#define TRACE_PARSE                 0x00000100
-#define TRACE_DISPATCH              0x00000200
-#define TRACE_LOAD                  0x00000400
-#define TRACE_EXEC                  0x00000800
-#define TRACE_NAMES                 0x00001000
-#define TRACE_OPREGION              0x00002000
-#define TRACE_BFIELD                0x00004000
-#define TRACE_TRASH                 0x00008000
-#define TRACE_TABLES                0x00010000
-#define TRACE_FUNCTIONS             0x00020000
-#define TRACE_VALUES                0x00040000
-#define TRACE_OBJECTS               0x00080000
-#define TRACE_ALLOCATIONS           0x00100000
-#define TRACE_RESOURCES             0x00200000
-#define TRACE_IO                    0x00400000
-#define TRACE_INTERRUPTS            0x00800000
-#define TRACE_USER_REQUESTS         0x01000000
-#define TRACE_PACKAGE               0x02000000
-#define TRACE_MUTEX                 0x04000000
-#define TRACE_INIT                  0x08000000
-
-#define TRACE_ALL                   0x0FFFFF80
+#define ACPI_DB_THREADS             ACPI_DEBUG_LEVEL (ACPI_LV_THREADS)
+#define ACPI_DB_PARSE               ACPI_DEBUG_LEVEL (ACPI_LV_PARSE)
+#define ACPI_DB_DISPATCH            ACPI_DEBUG_LEVEL (ACPI_LV_DISPATCH)
+#define ACPI_DB_LOAD                ACPI_DEBUG_LEVEL (ACPI_LV_LOAD)
+#define ACPI_DB_EXEC                ACPI_DEBUG_LEVEL (ACPI_LV_EXEC)
+#define ACPI_DB_NAMES               ACPI_DEBUG_LEVEL (ACPI_LV_NAMES)
+#define ACPI_DB_OPREGION            ACPI_DEBUG_LEVEL (ACPI_LV_OPREGION)
+#define ACPI_DB_BFIELD              ACPI_DEBUG_LEVEL (ACPI_LV_BFIELD)
+#define ACPI_DB_TABLES              ACPI_DEBUG_LEVEL (ACPI_LV_TABLES)
+#define ACPI_DB_FUNCTIONS           ACPI_DEBUG_LEVEL (ACPI_LV_FUNCTIONS)
+#define ACPI_DB_VALUES              ACPI_DEBUG_LEVEL (ACPI_LV_VALUES)
+#define ACPI_DB_OBJECTS             ACPI_DEBUG_LEVEL (ACPI_LV_OBJECTS)
+#define ACPI_DB_ALLOCATIONS         ACPI_DEBUG_LEVEL (ACPI_LV_ALLOCATIONS)
+#define ACPI_DB_RESOURCES           ACPI_DEBUG_LEVEL (ACPI_LV_RESOURCES)
+#define ACPI_DB_IO                  ACPI_DEBUG_LEVEL (ACPI_LV_IO)
+#define ACPI_DB_INTERRUPTS          ACPI_DEBUG_LEVEL (ACPI_LV_INTERRUPTS)
+#define ACPI_DB_USER_REQUESTS       ACPI_DEBUG_LEVEL (ACPI_LV_USER_REQUESTS)
+#define ACPI_DB_PACKAGE             ACPI_DEBUG_LEVEL (ACPI_LV_PACKAGE)
+#define ACPI_DB_MUTEX               ACPI_DEBUG_LEVEL (ACPI_LV_MUTEX)
+#define ACPI_DB_INIT                ACPI_DEBUG_LEVEL (ACPI_LV_INIT)
+
+#define ACPI_DB_ALL                 ACPI_DEBUG_LEVEL (0x0FFFFF80)
 
 
 /* Exceptionally verbose output -- also used in the global "Debug_level" */
 
-#define VERBOSE_AML_DISASSEMBLE     0x10000000
-#define VERBOSE_INFO                0x20000000
-#define VERBOSE_TABLES              0x40000000
-#define VERBOSE_EVENTS              0x80000000
+#define ACPI_DB_AML_DISASSEMBLE     0x10000000
+#define ACPI_DB_VERBOSE_INFO        0x20000000
+#define ACPI_DB_FULL_TABLES         0x40000000
+#define ACPI_DB_EVENTS              0x80000000
 
-#define VERBOSE_ALL                 0xF0000000
+#define ACPI_DB_VERBOSE             0xF0000000
 
 
 /* Defaults for Debug_level, debug and normal */
 
-#define DEBUG_DEFAULT               (ACPI_OK | ACPI_WARN | ACPI_ERROR | ACPI_DEBUG_OBJECT)
-#define NORMAL_DEFAULT              (ACPI_OK | ACPI_WARN | ACPI_ERROR | ACPI_DEBUG_OBJECT)
-#define DEBUG_ALL                   (VERBOSE_AML_DISASSEMBLE | TRACE_ALL | ACPI_ALL)
+#define DEBUG_DEFAULT               (ACPI_LV_OK | ACPI_LV_WARN | ACPI_LV_ERROR | ACPI_LV_DEBUG_OBJECT)
+#define NORMAL_DEFAULT              (ACPI_LV_OK | ACPI_LV_WARN | ACPI_LV_ERROR | ACPI_LV_DEBUG_OBJECT)
+#define DEBUG_ALL                   (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL)
 
 /* Misc defines */
 
index 9b4bfabeae1dde4fd2498c4e9fef21a8d015cf52..ff81546b5edb7d34e057b90647658655016504c5 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: acparser.h - AML Parser subcomponent prototypes and defines
- *       $Revision: 49 $
+ *       $Revision: 51 $
  *
  *****************************************************************************/
 
 
 /* psapi - Parser external interfaces */
 
-ACPI_STATUS
+acpi_status
 acpi_psx_load_table (
        u8                      *pcode_addr,
        u32                     pcode_length);
 
-ACPI_STATUS
+acpi_status
 acpi_psx_execute (
-       ACPI_NAMESPACE_NODE     *method_node,
-       ACPI_OPERAND_OBJECT     **params,
-       ACPI_OPERAND_OBJECT     **return_obj_desc);
-
-
-u8
-acpi_ps_is_namespace_object_op (
-       u16                     opcode);
-u8
-acpi_ps_is_namespace_op (
-       u16                     opcode);
-
+       acpi_namespace_node     *method_node,
+       acpi_operand_object     **params,
+       acpi_operand_object     **return_obj_desc);
 
 /******************************************************************************
  *
@@ -81,43 +72,43 @@ acpi_ps_is_namespace_op (
 
 u8 *
 acpi_ps_get_next_package_end (
-       ACPI_PARSE_STATE        *parser_state);
+       acpi_parse_state        *parser_state);
 
 u32
 acpi_ps_get_next_package_length (
-       ACPI_PARSE_STATE        *parser_state);
+       acpi_parse_state        *parser_state);
 
 NATIVE_CHAR *
 acpi_ps_get_next_namestring (
-       ACPI_PARSE_STATE        *parser_state);
+       acpi_parse_state        *parser_state);
 
 void
 acpi_ps_get_next_simple_arg (
-       ACPI_PARSE_STATE        *parser_state,
+       acpi_parse_state        *parser_state,
        u32                     arg_type,       /* type of argument */
-       ACPI_PARSE_OBJECT       *arg);           /* (OUT) argument data */
+       acpi_parse_object       *arg);           /* (OUT) argument data */
 
 void
 acpi_ps_get_next_namepath (
-       ACPI_PARSE_STATE        *parser_state,
-       ACPI_PARSE_OBJECT       *arg,
+       acpi_parse_state        *parser_state,
+       acpi_parse_object       *arg,
        u32                     *arg_count,
        u8                      method_call);
 
-ACPI_PARSE_OBJECT *
+acpi_parse_object *
 acpi_ps_get_next_field (
-       ACPI_PARSE_STATE        *parser_state);
+       acpi_parse_state        *parser_state);
 
-ACPI_PARSE_OBJECT *
+acpi_parse_object *
 acpi_ps_get_next_arg (
-       ACPI_PARSE_STATE        *parser_state,
+       acpi_parse_state        *parser_state,
        u32                     arg_type,
        u32                     *arg_count);
 
 
 /* psopcode - AML Opcode information */
 
-ACPI_OPCODE_INFO *
+const acpi_opcode_info *
 acpi_ps_get_opcode_info (
        u16                     opcode);
 
@@ -128,151 +119,151 @@ acpi_ps_get_opcode_name (
 
 /* psparse - top level parsing routines */
 
-ACPI_STATUS
+acpi_status
 acpi_ps_find_object (
        u16                     opcode,
-       ACPI_PARSE_OBJECT       *op,
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       **out_op);
+       acpi_parse_object       *op,
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       **out_op);
 
 void
 acpi_ps_delete_parse_tree (
-       ACPI_PARSE_OBJECT       *root);
+       acpi_parse_object       *root);
 
-ACPI_STATUS
+acpi_status
 acpi_ps_parse_loop (
-       ACPI_WALK_STATE         *walk_state);
+       acpi_walk_state         *walk_state);
 
-ACPI_STATUS
+acpi_status
 acpi_ps_parse_aml (
-       ACPI_PARSE_OBJECT       *start_scope,
+       acpi_parse_object       *start_scope,
        u8                      *aml,
        u32                     aml_size,
        u32                     parse_flags,
-       ACPI_NAMESPACE_NODE     *method_node,
-       ACPI_OPERAND_OBJECT     **params,
-       ACPI_OPERAND_OBJECT     **caller_return_desc,
-       ACPI_PARSE_DOWNWARDS    descending_callback,
-       ACPI_PARSE_UPWARDS      ascending_callback);
+       acpi_namespace_node     *method_node,
+       acpi_operand_object     **params,
+       acpi_operand_object     **caller_return_desc,
+       acpi_parse_downwards    descending_callback,
+       acpi_parse_upwards      ascending_callback);
 
-ACPI_STATUS
+acpi_status
 acpi_ps_parse_table (
        u8                      *aml,
        u32                     aml_size,
-       ACPI_PARSE_DOWNWARDS    descending_callback,
-       ACPI_PARSE_UPWARDS      ascending_callback,
-       ACPI_PARSE_OBJECT       **root_object);
+       acpi_parse_downwards    descending_callback,
+       acpi_parse_upwards      ascending_callback,
+       acpi_parse_object       **root_object);
 
 u16
 acpi_ps_peek_opcode (
-       ACPI_PARSE_STATE        *state);
+       acpi_parse_state        *state);
 
 
 /* psscope - Scope stack management routines */
 
 
-ACPI_STATUS
+acpi_status
 acpi_ps_init_scope (
-       ACPI_PARSE_STATE        *parser_state,
-       ACPI_PARSE_OBJECT       *root);
+       acpi_parse_state        *parser_state,
+       acpi_parse_object       *root);
 
-ACPI_PARSE_OBJECT *
+acpi_parse_object *
 acpi_ps_get_parent_scope (
-       ACPI_PARSE_STATE        *state);
+       acpi_parse_state        *state);
 
 u8
 acpi_ps_has_completed_scope (
-       ACPI_PARSE_STATE        *parser_state);
+       acpi_parse_state        *parser_state);
 
 void
 acpi_ps_pop_scope (
-       ACPI_PARSE_STATE        *parser_state,
-       ACPI_PARSE_OBJECT       **op,
+       acpi_parse_state        *parser_state,
+       acpi_parse_object       **op,
        u32                     *arg_list,
        u32                     *arg_count);
 
-ACPI_STATUS
+acpi_status
 acpi_ps_push_scope (
-       ACPI_PARSE_STATE        *parser_state,
-       ACPI_PARSE_OBJECT       *op,
+       acpi_parse_state        *parser_state,
+       acpi_parse_object       *op,
        u32                     remaining_args,
        u32                     arg_count);
 
 void
 acpi_ps_cleanup_scope (
-       ACPI_PARSE_STATE        *state);
+       acpi_parse_state        *state);
 
 
 /* pstree - parse tree manipulation routines */
 
 void
 acpi_ps_append_arg(
-       ACPI_PARSE_OBJECT       *op,
-       ACPI_PARSE_OBJECT       *arg);
+       acpi_parse_object       *op,
+       acpi_parse_object       *arg);
 
-ACPI_PARSE_OBJECT*
+acpi_parse_object*
 acpi_ps_find (
-       ACPI_PARSE_OBJECT       *scope,
+       acpi_parse_object       *scope,
        NATIVE_CHAR             *path,
        u16                     opcode,
        u32                     create);
 
-ACPI_PARSE_OBJECT *
+acpi_parse_object *
 acpi_ps_get_arg(
-       ACPI_PARSE_OBJECT       *op,
+       acpi_parse_object       *op,
        u32                      argn);
 
-ACPI_PARSE_OBJECT *
+acpi_parse_object *
 acpi_ps_get_child (
-       ACPI_PARSE_OBJECT       *op);
+       acpi_parse_object       *op);
 
-ACPI_PARSE_OBJECT *
+acpi_parse_object *
 acpi_ps_get_depth_next (
-       ACPI_PARSE_OBJECT       *origin,
-       ACPI_PARSE_OBJECT       *op);
+       acpi_parse_object       *origin,
+       acpi_parse_object       *op);
 
 
 /* pswalk - parse tree walk routines */
 
-ACPI_STATUS
+acpi_status
 acpi_ps_walk_parsed_aml (
-       ACPI_PARSE_OBJECT       *start_op,
-       ACPI_PARSE_OBJECT       *end_op,
-       ACPI_OPERAND_OBJECT     *mth_desc,
-       ACPI_NAMESPACE_NODE     *start_node,
-       ACPI_OPERAND_OBJECT     **params,
-       ACPI_OPERAND_OBJECT     **caller_return_desc,
-       ACPI_OWNER_ID           owner_id,
-       ACPI_PARSE_DOWNWARDS    descending_callback,
-       ACPI_PARSE_UPWARDS      ascending_callback);
-
-ACPI_STATUS
+       acpi_parse_object       *start_op,
+       acpi_parse_object       *end_op,
+       acpi_operand_object     *mth_desc,
+       acpi_namespace_node     *start_node,
+       acpi_operand_object     **params,
+       acpi_operand_object     **caller_return_desc,
+       acpi_owner_id           owner_id,
+       acpi_parse_downwards    descending_callback,
+       acpi_parse_upwards      ascending_callback);
+
+acpi_status
 acpi_ps_get_next_walk_op (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *op,
-       ACPI_PARSE_UPWARDS      ascending_callback);
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *op,
+       acpi_parse_upwards      ascending_callback);
 
 
 /* psutils - parser utilities */
 
 
-ACPI_PARSE_STATE *
+acpi_parse_state *
 acpi_ps_create_state (
        u8                      *aml,
        u32                     aml_size);
 
 void
 acpi_ps_init_op (
-       ACPI_PARSE_OBJECT       *op,
+       acpi_parse_object       *op,
        u16                     opcode);
 
-ACPI_PARSE_OBJECT *
+acpi_parse_object *
 acpi_ps_alloc_op (
        u16                     opcode);
 
 void
 acpi_ps_free_op (
-       ACPI_PARSE_OBJECT       *op);
+       acpi_parse_object       *op);
 
 void
 acpi_ps_delete_parse_cache (
@@ -286,41 +277,13 @@ u8
 acpi_ps_is_prefix_char (
        u32                     c);
 
-u8
-acpi_ps_is_named_op (
-       u16                     opcode);
-
-u8
-acpi_ps_is_node_op (
-       u16                     opcode);
-
-u8
-acpi_ps_is_deferred_op (
-       u16                     opcode);
-
-u8
-acpi_ps_is_bytelist_op(
-       u16                     opcode);
-
-u8
-acpi_ps_is_field_op(
-       u16                     opcode);
-
-u8
-acpi_ps_is_create_field_op (
-       u16                     opcode);
-
-ACPI_PARSE2_OBJECT*
-acpi_ps_to_extended_op(
-       ACPI_PARSE_OBJECT       *op);
-
 u32
 acpi_ps_get_name(
-       ACPI_PARSE_OBJECT       *op);
+       acpi_parse_object       *op);
 
 void
 acpi_ps_set_name(
-       ACPI_PARSE_OBJECT       *op,
+       acpi_parse_object       *op,
        u32                     name);
 
 
@@ -330,17 +293,17 @@ u32
 acpi_ps_sprint_path (
        NATIVE_CHAR             *buffer_start,
        u32                     buffer_size,
-       ACPI_PARSE_OBJECT       *op);
+       acpi_parse_object       *op);
 
 u32
 acpi_ps_sprint_op (
        NATIVE_CHAR             *buffer_start,
        u32                     buffer_size,
-       ACPI_PARSE_OBJECT       *op);
+       acpi_parse_object       *op);
 
 void
 acpi_ps_show (
-       ACPI_PARSE_OBJECT       *op);
+       acpi_parse_object       *op);
 
 
 #endif /* __ACPARSER_H__ */
index a82e55ea655809d86d66e6bab489a57752b58abd..750d306c4764b39d51a711eee90d699dcce4e2cd 100644 (file)
 #define ACPI_MUTEX_SEM              1
 
 
+/* Functions for Acpi_os_signal */
+
+#define ACPI_SIGNAL_FATAL           0
+#define ACPI_SIGNAL_BREAKPOINT      1
+
+typedef struct acpi_fatal_info
+{
+       u32                     type;
+       u32                     code;
+       u32                     argument;
+
+} ACPI_SIGNAL_FATAL_INFO;
+
+
 /*
  * Types specific to the OS service interfaces
  */
@@ -61,38 +75,43 @@ void (*OSD_EXECUTION_CALLBACK) (
  * OSL Initialization and shutdown primitives
  */
 
-ACPI_STATUS
+acpi_status
 acpi_os_initialize (
        void);
 
-ACPI_STATUS
+acpi_status
 acpi_os_terminate (
        void);
 
+acpi_status
+acpi_os_get_root_pointer (
+       u32                     flags,
+       ACPI_PHYSICAL_ADDRESS   *rsdp_physical_address);
+
 
 /*
  * Synchronization primitives
  */
 
-ACPI_STATUS
+acpi_status
 acpi_os_create_semaphore (
        u32                     max_units,
        u32                     initial_units,
-       ACPI_HANDLE             *out_handle);
+       acpi_handle             *out_handle);
 
-ACPI_STATUS
+acpi_status
 acpi_os_delete_semaphore (
-       ACPI_HANDLE             handle);
+       acpi_handle             handle);
 
-ACPI_STATUS
+acpi_status
 acpi_os_wait_semaphore (
-       ACPI_HANDLE             handle,
+       acpi_handle             handle,
        u32                     units,
        u32                     timeout);
 
-ACPI_STATUS
+acpi_status
 acpi_os_signal_semaphore (
-       ACPI_HANDLE             handle,
+       acpi_handle             handle,
        u32                     units);
 
 
@@ -112,7 +131,7 @@ void
 acpi_os_free (
        void *                  memory);
 
-ACPI_STATUS
+acpi_status
 acpi_os_map_memory (
        ACPI_PHYSICAL_ADDRESS   physical_address,
        u32                     length,
@@ -123,7 +142,7 @@ acpi_os_unmap_memory (
        void                    *logical_address,
        u32                     length);
 
-ACPI_STATUS
+acpi_status
 acpi_os_get_physical_address (
        void                    *logical_address,
        ACPI_PHYSICAL_ADDRESS   *physical_address);
@@ -133,13 +152,13 @@ acpi_os_get_physical_address (
  * Interrupt handlers
  */
 
-ACPI_STATUS
+acpi_status
 acpi_os_install_interrupt_handler (
        u32                     interrupt_number,
        OSD_HANDLER             service_routine,
        void                    *context);
 
-ACPI_STATUS
+acpi_status
 acpi_os_remove_interrupt_handler (
        u32                     interrupt_number,
        OSD_HANDLER             service_routine);
@@ -153,7 +172,7 @@ u32
 acpi_os_get_thread_id (
        void);
 
-ACPI_STATUS
+acpi_status
 acpi_os_queue_for_execution (
        u32                     priority,
        OSD_EXECUTION_CALLBACK  function,
@@ -165,131 +184,70 @@ acpi_os_sleep (
        u32                     milliseconds);
 
 void
-acpi_os_sleep_usec (
+acpi_os_stall (
        u32                     microseconds);
 
 
 /*
- * Platform/Hardware independent I/O interfaces
+ * Platform and hardware-independent I/O interfaces
  */
 
-u8
-acpi_os_in8 (
-       ACPI_IO_ADDRESS         in_port);
+acpi_status
+acpi_os_read_port (
+       ACPI_IO_ADDRESS         address,
+       void                    *value,
+       u32                     width);
 
 
-u16
-acpi_os_in16 (
-       ACPI_IO_ADDRESS         in_port);
-
-u32
-acpi_os_in32 (
-       ACPI_IO_ADDRESS         in_port);
-
-void
-acpi_os_out8 (
-       ACPI_IO_ADDRESS         out_port,
-       u8                      value);
-
-void
-acpi_os_out16 (
-       ACPI_IO_ADDRESS         out_port,
-       u16                     value);
-
-void
-acpi_os_out32 (
-       ACPI_IO_ADDRESS         out_port,
-       u32                     value);
+acpi_status
+acpi_os_write_port (
+       ACPI_IO_ADDRESS         address,
+       NATIVE_UINT             value,
+       u32                     width);
 
 
 /*
- * Platform/Hardware independent physical memory interfaces
+ * Platform and hardware-independent physical memory interfaces
  */
 
-u8
-acpi_os_mem_in8 (
-       ACPI_PHYSICAL_ADDRESS   in_addr);
+acpi_status
+acpi_os_read_memory (
+       ACPI_PHYSICAL_ADDRESS   address,
+       void                    *value,
+       u32                     width);
 
-u16
-acpi_os_mem_in16 (
-       ACPI_PHYSICAL_ADDRESS   in_addr);
 
-u32
-acpi_os_mem_in32 (
-       ACPI_PHYSICAL_ADDRESS   in_addr);
-
-void
-acpi_os_mem_out8 (
-       ACPI_PHYSICAL_ADDRESS   out_addr,
-       u8                      value);
-
-void
-acpi_os_mem_out16 (
-       ACPI_PHYSICAL_ADDRESS   out_addr,
-       u16                     value);
-
-void
-acpi_os_mem_out32 (
-       ACPI_PHYSICAL_ADDRESS   out_addr,
-       u32                     value);
+acpi_status
+acpi_os_write_memory (
+       ACPI_PHYSICAL_ADDRESS   address,
+       NATIVE_UINT             value,
+       u32                     width);
 
 
 /*
- * Standard access to PCI configuration space
+ * Platform and hardware-independent PCI configuration space access
  */
 
-ACPI_STATUS
-acpi_os_read_pci_cfg_byte (
-       u32                     bus,
-       u32                     device_function,
-       u32                     register,
-       u8                      *value);
-
-ACPI_STATUS
-acpi_os_read_pci_cfg_word (
-       u32                     bus,
-       u32                     device_function,
+acpi_status
+acpi_os_read_pci_configuration (
+       acpi_pci_id             *pci_id,
        u32                     register,
-       u16                     *value);
-
-ACPI_STATUS
-acpi_os_read_pci_cfg_dword (
-       u32                     bus,
-       u32                     device_function,
-       u32                     register,
-       u32                     *value);
-
-ACPI_STATUS
-acpi_os_write_pci_cfg_byte (
-       u32                     bus,
-       u32                     device_function,
-       u32                     register,
-       u8                      value);
-
-ACPI_STATUS
-acpi_os_write_pci_cfg_word (
-       u32                     bus,
-       u32                     device_function,
-       u32                     register,
-       u16                     value);
+       void                    *value,
+       u32                     width);
 
 
-ACPI_STATUS
-acpi_os_write_pci_cfg_dword (
-       u32                     bus,
-       u32                     device_function,
+acpi_status
+acpi_os_write_pci_configuration (
+       acpi_pci_id             *pci_id,
        u32                     register,
-       u32                     value);
+       NATIVE_UINT             value,
+       u32                     width);
 
 
 /*
  * Miscellaneous
  */
 
-ACPI_STATUS
-acpi_os_breakpoint (
-       NATIVE_CHAR             *message);
-
 u8
 acpi_os_readable (
        void                    *pointer,
@@ -305,6 +263,10 @@ u32
 acpi_os_get_timer (
        void);
 
+acpi_status
+acpi_os_signal (
+       u32                     function,
+       void                    *info);
 
 /*
  * Debug print routines
index eb09f04e110436c0f83fd1b5d5b1f432f16237bd..11abcccb4e0c25a1f466f0a2b714dc4241df0148 100644 (file)
 #include "actbl.h"
 
 
-/*
+ /*
  * Global interfaces
  */
 
-ACPI_STATUS
+acpi_status
 acpi_initialize_subsystem (
        void);
 
-ACPI_STATUS
+acpi_status
 acpi_enable_subsystem (
        u32                     flags);
 
-ACPI_STATUS
+acpi_status
 acpi_terminate (
        void);
 
-ACPI_STATUS
+acpi_status
+acpi_subsystem_status (
+       void);
+
+acpi_status
 acpi_enable (
        void);
 
-ACPI_STATUS
+acpi_status
 acpi_disable (
        void);
 
-ACPI_STATUS
-acpi_get_system_info(
-       ACPI_BUFFER             *ret_buffer);
+acpi_status
+acpi_get_system_info (
+       acpi_buffer             *ret_buffer);
 
-ACPI_STATUS
+const char *
 acpi_format_exception (
-       ACPI_STATUS             exception,
-       ACPI_BUFFER             *out_buffer);
+       acpi_status             exception);
 
 
 /*
@@ -86,262 +89,236 @@ acpi_free (
  * ACPI table manipulation interfaces
  */
 
-ACPI_STATUS
+acpi_status
 acpi_find_root_pointer (
+       u32                     flags,
        ACPI_PHYSICAL_ADDRESS   *rsdp_physical_address);
 
-ACPI_STATUS
+acpi_status
 acpi_load_tables (
-       ACPI_PHYSICAL_ADDRESS   rsdp_physical_address);
+       void);
 
-ACPI_STATUS
+acpi_status
 acpi_load_table (
-       ACPI_TABLE_HEADER       *table_ptr);
+       acpi_table_header       *table_ptr);
 
-ACPI_STATUS
+acpi_status
 acpi_unload_table (
-       ACPI_TABLE_TYPE         table_type);
+       acpi_table_type         table_type);
 
-ACPI_STATUS
+acpi_status
 acpi_get_table_header (
-       ACPI_TABLE_TYPE         table_type,
+       acpi_table_type         table_type,
        u32                     instance,
-       ACPI_TABLE_HEADER       *out_table_header);
+       acpi_table_header       *out_table_header);
 
-ACPI_STATUS
+acpi_status
 acpi_get_table (
-       ACPI_TABLE_TYPE         table_type,
+       acpi_table_type         table_type,
        u32                     instance,
-       ACPI_BUFFER             *ret_buffer);
+       acpi_buffer             *ret_buffer);
 
-ACPI_STATUS
+acpi_status
 acpi_get_firmware_table (
-       ACPI_STRING             signature,
+       acpi_string             signature,
        u32                     instance,
        u32                     flags,
-       ACPI_TABLE_HEADER       **table_pointer);
+       acpi_table_header       **table_pointer);
 
 
 /*
  * Namespace and name interfaces
  */
 
-ACPI_STATUS
+acpi_status
 acpi_walk_namespace (
-       ACPI_OBJECT_TYPE        type,
-       ACPI_HANDLE             start_object,
+       acpi_object_type        type,
+       acpi_handle             start_object,
        u32                     max_depth,
        ACPI_WALK_CALLBACK      user_function,
        void                    *context,
        void *                  *return_value);
 
-ACPI_STATUS
+acpi_status
 acpi_get_devices (
        NATIVE_CHAR             *HID,
        ACPI_WALK_CALLBACK      user_function,
        void                    *context,
        void                    **return_value);
 
-ACPI_STATUS
+acpi_status
 acpi_get_name (
-       ACPI_HANDLE             handle,
+       acpi_handle             handle,
        u32                     name_type,
-       ACPI_BUFFER             *ret_path_ptr);
+       acpi_buffer             *ret_path_ptr);
 
-ACPI_STATUS
+acpi_status
 acpi_get_handle (
-       ACPI_HANDLE             parent,
-       ACPI_STRING             pathname,
-       ACPI_HANDLE             *ret_handle);
+       acpi_handle             parent,
+       acpi_string             pathname,
+       acpi_handle             *ret_handle);
 
 
 /*
  * Object manipulation and enumeration
  */
 
-ACPI_STATUS
+acpi_status
 acpi_evaluate_object (
-       ACPI_HANDLE             object,
-       ACPI_STRING             pathname,
-       ACPI_OBJECT_LIST        *parameter_objects,
-       ACPI_BUFFER             *return_object_buffer);
+       acpi_handle             object,
+       acpi_string             pathname,
+       acpi_object_list        *parameter_objects,
+       acpi_buffer             *return_object_buffer);
 
-ACPI_STATUS
+acpi_status
 acpi_get_object_info (
-       ACPI_HANDLE             device,
-       ACPI_DEVICE_INFO        *info);
+       acpi_handle             device,
+       acpi_device_info        *info);
 
-ACPI_STATUS
+acpi_status
 acpi_get_next_object (
-       ACPI_OBJECT_TYPE        type,
-       ACPI_HANDLE             parent,
-       ACPI_HANDLE             child,
-       ACPI_HANDLE             *out_handle);
+       acpi_object_type        type,
+       acpi_handle             parent,
+       acpi_handle             child,
+       acpi_handle             *out_handle);
 
-ACPI_STATUS
+acpi_status
 acpi_get_type (
-       ACPI_HANDLE             object,
-       ACPI_OBJECT_TYPE        *out_type);
+       acpi_handle             object,
+       acpi_object_type        *out_type);
 
-ACPI_STATUS
+acpi_status
 acpi_get_parent (
-       ACPI_HANDLE             object,
-       ACPI_HANDLE             *out_handle);
+       acpi_handle             object,
+       acpi_handle             *out_handle);
 
 
 /*
  * Event handler interfaces
  */
 
-ACPI_STATUS
+acpi_status
 acpi_install_fixed_event_handler (
        u32                     acpi_event,
        ACPI_EVENT_HANDLER      handler,
        void                    *context);
 
-ACPI_STATUS
+acpi_status
 acpi_remove_fixed_event_handler (
        u32                     acpi_event,
        ACPI_EVENT_HANDLER      handler);
 
-ACPI_STATUS
+acpi_status
 acpi_install_notify_handler (
-       ACPI_HANDLE             device,
+       acpi_handle             device,
        u32                     handler_type,
        ACPI_NOTIFY_HANDLER     handler,
        void                    *context);
 
-ACPI_STATUS
+acpi_status
 acpi_remove_notify_handler (
-       ACPI_HANDLE             device,
+       acpi_handle             device,
        u32                     handler_type,
        ACPI_NOTIFY_HANDLER     handler);
 
-ACPI_STATUS
+acpi_status
 acpi_install_address_space_handler (
-       ACPI_HANDLE             device,
+       acpi_handle             device,
        ACPI_ADR_SPACE_TYPE     space_id,
        ACPI_ADR_SPACE_HANDLER  handler,
        ACPI_ADR_SPACE_SETUP    setup,
        void                    *context);
 
-ACPI_STATUS
+acpi_status
 acpi_remove_address_space_handler (
-       ACPI_HANDLE             device,
+       acpi_handle             device,
        ACPI_ADR_SPACE_TYPE     space_id,
        ACPI_ADR_SPACE_HANDLER  handler);
 
-ACPI_STATUS
+acpi_status
 acpi_install_gpe_handler (
        u32                     gpe_number,
        u32                     type,
        ACPI_GPE_HANDLER        handler,
        void                    *context);
 
-ACPI_STATUS
+acpi_status
 acpi_acquire_global_lock (
        void);
 
-ACPI_STATUS
+acpi_status
 acpi_release_global_lock (
        void);
 
-ACPI_STATUS
+acpi_status
 acpi_remove_gpe_handler (
        u32                     gpe_number,
        ACPI_GPE_HANDLER        handler);
 
-ACPI_STATUS
+acpi_status
 acpi_enable_event (
        u32                     acpi_event,
        u32                     type);
 
-ACPI_STATUS
+acpi_status
 acpi_disable_event (
        u32                     acpi_event,
        u32                     type);
 
-ACPI_STATUS
+acpi_status
 acpi_clear_event (
        u32                     acpi_event,
        u32                     type);
 
-ACPI_STATUS
+acpi_status
 acpi_get_event_status (
        u32                     acpi_event,
        u32                     type,
-       ACPI_EVENT_STATUS       *event_status);
+       acpi_event_status       *event_status);
 
 /*
  * Resource interfaces
  */
 
-ACPI_STATUS
+acpi_status
 acpi_get_current_resources(
-       ACPI_HANDLE             device_handle,
-       ACPI_BUFFER             *ret_buffer);
+       acpi_handle             device_handle,
+       acpi_buffer             *ret_buffer);
 
-ACPI_STATUS
+acpi_status
 acpi_get_possible_resources(
-       ACPI_HANDLE             device_handle,
-       ACPI_BUFFER             *ret_buffer);
+       acpi_handle             device_handle,
+       acpi_buffer             *ret_buffer);
 
-ACPI_STATUS
+acpi_status
 acpi_set_current_resources (
-       ACPI_HANDLE             device_handle,
-       ACPI_BUFFER             *in_buffer);
+       acpi_handle             device_handle,
+       acpi_buffer             *in_buffer);
 
-ACPI_STATUS
+acpi_status
 acpi_get_irq_routing_table (
-       ACPI_HANDLE             bus_device_handle,
-       ACPI_BUFFER             *ret_buffer);
+       acpi_handle             bus_device_handle,
+       acpi_buffer             *ret_buffer);
 
 
 /*
  * Hardware (ACPI device) interfaces
  */
 
-ACPI_STATUS
+acpi_status
 acpi_set_firmware_waking_vector (
        ACPI_PHYSICAL_ADDRESS   physical_address);
 
-ACPI_STATUS
+acpi_status
 acpi_get_firmware_waking_vector (
        ACPI_PHYSICAL_ADDRESS   *physical_address);
 
-ACPI_STATUS
+acpi_status
 acpi_enter_sleep_state (
        u8 sleep_state);
 
-ACPI_STATUS
-acpi_get_processor_throttling_info (
-       ACPI_HANDLE             processor_handle,
-       ACPI_BUFFER             *user_buffer);
-
-ACPI_STATUS
-acpi_set_processor_throttling_state (
-       ACPI_HANDLE             processor_handle,
-       u32                     throttle_state);
-
-ACPI_STATUS
-acpi_get_processor_throttling_state (
-       ACPI_HANDLE             processor_handle,
-       u32                     *throttle_state);
-
-ACPI_STATUS
-acpi_get_processor_cx_info (
-       ACPI_HANDLE             processor_handle,
-       ACPI_BUFFER             *user_buffer);
-
-ACPI_STATUS
-acpi_set_processor_sleep_state (
-       ACPI_HANDLE             processor_handle,
-       u32                     cx_state);
-
-ACPI_STATUS
-acpi_processor_sleep (
-       ACPI_HANDLE             processor_handle,
-       u32                     *pm_timer_ticks);
-
+acpi_status
+acpi_leave_sleep_state (
+       u8 sleep_state);
 
 #endif /* __ACXFACE_H__ */
index 9937a9ac19647379a2883b0672f19fd5da656929..254b6ee32dd723b02c0d1f765b6d2a0f20179170 100644 (file)
  *  Function prototypes called from Acpi* APIs
  */
 
-ACPI_STATUS
+acpi_status
 acpi_rs_get_prt_method_data (
-       ACPI_HANDLE             handle,
-       ACPI_BUFFER             *ret_buffer);
+       acpi_handle             handle,
+       acpi_buffer             *ret_buffer);
 
 
-ACPI_STATUS
+acpi_status
 acpi_rs_get_crs_method_data (
-       ACPI_HANDLE             handle,
-       ACPI_BUFFER             *ret_buffer);
+       acpi_handle             handle,
+       acpi_buffer             *ret_buffer);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_get_prs_method_data (
-       ACPI_HANDLE             handle,
-       ACPI_BUFFER             *ret_buffer);
+       acpi_handle             handle,
+       acpi_buffer             *ret_buffer);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_set_srs_method_data (
-       ACPI_HANDLE             handle,
-       ACPI_BUFFER             *ret_buffer);
+       acpi_handle             handle,
+       acpi_buffer             *ret_buffer);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_create_resource_list (
-       ACPI_OPERAND_OBJECT     *byte_stream_buffer,
+       acpi_operand_object     *byte_stream_buffer,
        u8                      *output_buffer,
        u32                     *output_buffer_length);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_create_byte_stream (
-       ACPI_RESOURCE           *linked_list_buffer,
+       acpi_resource           *linked_list_buffer,
        u8                      *output_buffer,
        u32                     *output_buffer_length);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_create_pci_routing_table (
-       ACPI_OPERAND_OBJECT     *method_return_object,
+       acpi_operand_object     *method_return_object,
        u8                      *output_buffer,
        u32                     *output_buffer_length);
 
@@ -77,177 +77,177 @@ acpi_rs_create_pci_routing_table (
 
 void
 acpi_rs_dump_resource_list (
-       ACPI_RESOURCE           *resource);
+       acpi_resource           *resource);
 
 void
 acpi_rs_dump_irq_list (
        u8                      *route_table);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_get_byte_stream_start (
        u8                      *byte_stream_buffer,
        u8                      **byte_stream_start,
        u32                     *size);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_calculate_list_length (
        u8                      *byte_stream_buffer,
        u32                     byte_stream_buffer_length,
        u32                     *size_needed);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_calculate_byte_stream_length (
-       ACPI_RESOURCE           *linked_list_buffer,
+       acpi_resource           *linked_list_buffer,
        u32                     *size_needed);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_calculate_pci_routing_table_length (
-       ACPI_OPERAND_OBJECT     *package_object,
+       acpi_operand_object     *package_object,
        u32                     *buffer_size_needed);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_byte_stream_to_list (
        u8                      *byte_stream_buffer,
        u32                     byte_stream_buffer_length,
        u8                      **output_buffer);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_list_to_byte_stream (
-       ACPI_RESOURCE           *linked_list,
+       acpi_resource           *linked_list,
        u32                     byte_stream_size_needed,
        u8                      **output_buffer);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_io_resource (
        u8                      *byte_stream_buffer,
        u32                     *bytes_consumed,
        u8                      **output_buffer,
        u32                     *structure_size);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_fixed_io_resource (
        u8                      *byte_stream_buffer,
        u32                     *bytes_consumed,
        u8                      **output_buffer,
        u32                     *structure_size);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_io_stream (
-       ACPI_RESOURCE           *linked_list,
+       acpi_resource           *linked_list,
        u8                      **output_buffer,
        u32                     *bytes_consumed);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_fixed_io_stream (
-       ACPI_RESOURCE           *linked_list,
+       acpi_resource           *linked_list,
        u8                      **output_buffer,
        u32                     *bytes_consumed);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_irq_resource (
        u8                      *byte_stream_buffer,
        u32                     *bytes_consumed,
        u8                      **output_buffer,
        u32                     *structure_size);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_irq_stream (
-       ACPI_RESOURCE           *linked_list,
+       acpi_resource           *linked_list,
        u8                      **output_buffer,
        u32                     *bytes_consumed);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_dma_resource (
        u8                      *byte_stream_buffer,
        u32                     *bytes_consumed,
        u8                      **output_buffer,
        u32                     *structure_size);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_dma_stream (
-       ACPI_RESOURCE           *linked_list,
+       acpi_resource           *linked_list,
        u8                      **output_buffer,
        u32                     *bytes_consumed);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_address16_resource (
        u8                      *byte_stream_buffer,
        u32                     *bytes_consumed,
        u8                      **output_buffer,
        u32                     *structure_size);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_address16_stream (
-       ACPI_RESOURCE           *linked_list,
+       acpi_resource           *linked_list,
        u8                      **output_buffer,
        u32                     *bytes_consumed);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_address32_resource (
        u8                      *byte_stream_buffer,
        u32                     *bytes_consumed,
        u8                      **output_buffer,
        u32                     *structure_size);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_address32_stream (
-       ACPI_RESOURCE           *linked_list,
+       acpi_resource           *linked_list,
        u8                      **output_buffer,
        u32                     *bytes_consumed);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_address64_resource (
        u8                      *byte_stream_buffer,
        u32                     *bytes_consumed,
        u8                      **output_buffer,
        u32                     *structure_size);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_address64_stream (
-       ACPI_RESOURCE           *linked_list,
+       acpi_resource           *linked_list,
        u8                      **output_buffer,
        u32                     *bytes_consumed);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_start_dependent_functions_resource (
        u8                      *byte_stream_buffer,
        u32                     *bytes_consumed,
        u8                      **output_buffer,
        u32                     *structure_size);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_end_dependent_functions_resource (
        u8                      *byte_stream_buffer,
        u32                     *bytes_consumed,
        u8                      **output_buffer,
        u32                     *structure_size);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_start_dependent_functions_stream (
-       ACPI_RESOURCE           *linked_list,
+       acpi_resource           *linked_list,
        u8                      **output_buffer,
        u32                     *bytes_consumed);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_end_dependent_functions_stream (
-       ACPI_RESOURCE           *linked_list,
+       acpi_resource           *linked_list,
        u8                      **output_buffer,
        u32                     *bytes_consumed);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_memory24_resource (
        u8                      *byte_stream_buffer,
        u32                     *bytes_consumed,
        u8                      **output_buffer,
        u32                     *structure_size);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_memory24_stream (
-       ACPI_RESOURCE           *linked_list,
+       acpi_resource           *linked_list,
        u8                      **output_buffer,
        u32                     *bytes_consumed);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_memory32_range_resource (
        u8                      *byte_stream_buffer,
        u32                     *bytes_consumed,
@@ -255,61 +255,61 @@ acpi_rs_memory32_range_resource (
        u32                     *structure_size
 );
 
-ACPI_STATUS
+acpi_status
 acpi_rs_fixed_memory32_resource (
        u8                      *byte_stream_buffer,
        u32                     *bytes_consumed,
        u8                      **output_buffer,
        u32                     *structure_size);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_memory32_range_stream (
-       ACPI_RESOURCE           *linked_list,
+       acpi_resource           *linked_list,
        u8                      **output_buffer,
        u32                     *bytes_consumed);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_fixed_memory32_stream (
-       ACPI_RESOURCE           *linked_list,
+       acpi_resource           *linked_list,
        u8                      **output_buffer,
        u32                     *bytes_consumed);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_extended_irq_resource (
        u8                      *byte_stream_buffer,
        u32                     *bytes_consumed,
        u8                      **output_buffer,
        u32                     *structure_size);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_extended_irq_stream (
-       ACPI_RESOURCE           *linked_list,
+       acpi_resource           *linked_list,
        u8                      **output_buffer,
        u32                     *bytes_consumed);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_end_tag_resource (
        u8                      *byte_stream_buffer,
        u32                     *bytes_consumed,
        u8                      **output_buffer,
        u32                     *structure_size);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_end_tag_stream (
-       ACPI_RESOURCE           *linked_list,
+       acpi_resource           *linked_list,
        u8                      **output_buffer,
        u32                     *bytes_consumed);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_vendor_resource (
        u8                      *byte_stream_buffer,
        u32                     *bytes_consumed,
        u8                      **output_buffer,
        u32                     *structure_size);
 
-ACPI_STATUS
+acpi_status
 acpi_rs_vendor_stream (
-       ACPI_RESOURCE           *linked_list,
+       acpi_resource           *linked_list,
        u8                      **output_buffer,
        u32                     *bytes_consumed);
 
index 9f18f43e2e7783e2e2e28b8cadce391e5d641314..c399897ccdd78f480174ec2fe27186ff2779fea8 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acstruct.h - Internal structs
- *       $Revision: 3 $
+ *       $Revision: 5 $
  *
  *****************************************************************************/
 
 
 typedef struct acpi_walk_state
 {
-       u8                      data_type;                          /* To differentiate various internal objs */\
-       ACPI_OWNER_ID           owner_id;                           /* Owner of objects created during the walk */
+       u8                      data_type;                          /* To differentiate various internal objs MUST BE FIRST!*/\
+       acpi_owner_id           owner_id;                           /* Owner of objects created during the walk */
        u8                      last_predicate;                     /* Result of last predicate */
        u8                      next_op_info;                       /* Info about Next_op */
        u8                      num_operands;                       /* Stack pointer for Operands[] array */
        u8                      current_result;                     /* */
 
        struct acpi_walk_state  *next;                              /* Next Walk_state in list */
-       ACPI_PARSE_OBJECT       *origin;                            /* Start of walk [Obsolete] */
+       acpi_parse_object       *origin;                            /* Start of walk [Obsolete] */
 
 /* TBD: Obsolete with removal of WALK procedure ? */
-       ACPI_PARSE_OBJECT       *prev_op;                           /* Last op that was processed */
-       ACPI_PARSE_OBJECT       *next_op;                           /* next op to be processed */
+       acpi_parse_object       *prev_op;                           /* Last op that was processed */
+       acpi_parse_object       *next_op;                           /* next op to be processed */
 
 
-       ACPI_GENERIC_STATE      *results;                           /* Stack of accumulated results */
-       ACPI_GENERIC_STATE      *control_state;                     /* List of control states (nested IFs) */
-       ACPI_GENERIC_STATE      *scope_info;                        /* Stack of nested scopes */
-       ACPI_PARSE_STATE        *parser_state;                      /* Current state of parser */
+       acpi_generic_state      *results;                           /* Stack of accumulated results */
+       acpi_generic_state      *control_state;                     /* List of control states (nested IFs) */
+       acpi_generic_state      *scope_info;                        /* Stack of nested scopes */
+       acpi_parse_state        *parser_state;                      /* Current state of parser */
        u8                      *aml_last_while;
-       ACPI_OPCODE_INFO        *op_info;                           /* Info on current opcode */
-       ACPI_PARSE_DOWNWARDS    descending_callback;
-       ACPI_PARSE_UPWARDS      ascending_callback;
+       const acpi_opcode_info  *op_info;                           /* Info on current opcode */
+       acpi_parse_downwards    descending_callback;
+       acpi_parse_upwards      ascending_callback;
 
        union acpi_operand_obj  *return_desc;                       /* Return object, if any */
        union acpi_operand_obj  *method_desc;                       /* Method descriptor if running a method */
        struct acpi_node        *method_node;                       /* Method Node if running a method */
-       ACPI_PARSE_OBJECT       *method_call_op;                    /* Method_call Op if running a method */
+       acpi_parse_object       *method_call_op;                    /* Method_call Op if running a method */
        struct acpi_node        *method_call_node;                  /* Called method Node*/
        union acpi_operand_obj  *operands[OBJ_NUM_OPERANDS];        /* Operands passed to the interpreter */
        struct acpi_node        arguments[MTH_NUM_ARGS];            /* Control method arguments */
@@ -93,7 +93,7 @@ typedef struct acpi_walk_state
        u32                     method_breakpoint;
 
 
-} ACPI_WALK_STATE;
+} acpi_walk_state;
 
 
 /*
@@ -103,10 +103,10 @@ typedef struct acpi_walk_state
 typedef struct acpi_walk_list
 {
 
-       ACPI_WALK_STATE         *walk_state;
+       acpi_walk_state         *walk_state;
        ACPI_OBJECT_MUTEX       acquired_mutex_list;               /* List of all currently acquired mutexes */
 
-} ACPI_WALK_LIST;
+} acpi_walk_list;
 
 
 /* Info used by Acpi_ps_init_objects */
@@ -119,7 +119,7 @@ typedef struct acpi_init_walk_info
        u16                     op_region_init;
        u16                     field_init;
        u16                     object_count;
-       ACPI_TABLE_DESC         *table_desc;
+       acpi_table_desc         *table_desc;
 
 } ACPI_INIT_WALK_INFO;
 
@@ -131,7 +131,7 @@ typedef struct acpi_device_walk_info
        u16                     device_count;
        u16                     num_STA;
        u16                     num_INI;
-       ACPI_TABLE_DESC         *table_desc;
+       acpi_table_desc         *table_desc;
 
 } ACPI_DEVICE_WALK_INFO;
 
index 24588be82b5a072edcd577ac1b2ff186aa557c8c..fdf328abd727ec5b8e504b7c9c48c7221d7e5c44 100644 (file)
 #define SIZE_IN_HEADER          0
 
 
-ACPI_STATUS
+acpi_status
 acpi_tb_handle_to_object (
        u16                     table_id,
-       ACPI_TABLE_DESC         **table_desc);
+       acpi_table_desc         **table_desc);
 
 /*
  * tbconvrt - Table conversion routines
  */
 
-ACPI_STATUS
+acpi_status
 acpi_tb_convert_to_xsdt (
-       ACPI_TABLE_DESC         *table_info,
+       acpi_table_desc         *table_info,
        u32                     *number_of_tables);
 
-ACPI_STATUS
+acpi_status
 acpi_tb_convert_table_fadt (
        void);
 
-ACPI_STATUS
+acpi_status
 acpi_tb_build_common_facs (
-       ACPI_TABLE_DESC         *table_info);
+       acpi_table_desc         *table_info);
 
 u32
 acpi_tb_get_table_count (
        RSDP_DESCRIPTOR         *RSDP,
-       ACPI_TABLE_HEADER       *RSDT);
+       acpi_table_header       *RSDT);
 
 /*
  * tbget - Table "get" routines
  */
 
-ACPI_STATUS
+acpi_status
 acpi_tb_get_table_ptr (
-       ACPI_TABLE_TYPE         table_type,
+       acpi_table_type         table_type,
        u32                     instance,
-       ACPI_TABLE_HEADER       **table_ptr_loc);
+       acpi_table_header       **table_ptr_loc);
 
-ACPI_STATUS
+acpi_status
 acpi_tb_get_table (
        ACPI_PHYSICAL_ADDRESS   physical_address,
-       ACPI_TABLE_HEADER       *buffer_ptr,
-       ACPI_TABLE_DESC         *table_info);
+       acpi_table_header       *buffer_ptr,
+       acpi_table_desc         *table_info);
 
-ACPI_STATUS
+acpi_status
 acpi_tb_verify_rsdp (
        ACPI_PHYSICAL_ADDRESS   RSDP_physical_address);
 
-ACPI_STATUS
+acpi_status
 acpi_tb_get_table_facs (
-       ACPI_TABLE_HEADER       *buffer_ptr,
-       ACPI_TABLE_DESC         *table_info);
+       acpi_table_header       *buffer_ptr,
+       acpi_table_desc         *table_info);
 
 ACPI_PHYSICAL_ADDRESS
 acpi_tb_get_rsdt_address (
        void);
 
-ACPI_STATUS
+acpi_status
 acpi_tb_validate_rsdt (
-       ACPI_TABLE_HEADER       *table_ptr);
+       acpi_table_header       *table_ptr);
 
-ACPI_STATUS
+acpi_status
 acpi_tb_get_table_pointer (
        ACPI_PHYSICAL_ADDRESS   physical_address,
        u32                     flags,
        u32                     *size,
-       ACPI_TABLE_HEADER       **table_ptr);
+       acpi_table_header       **table_ptr);
 
 /*
  * tbgetall - Get all firmware ACPI tables
  */
 
-ACPI_STATUS
+acpi_status
 acpi_tb_get_all_tables (
        u32                     number_of_tables,
-       ACPI_TABLE_HEADER       *buffer_ptr);
+       acpi_table_header       *buffer_ptr);
 
 
 /*
  * tbinstall - Table installation
  */
 
-ACPI_STATUS
+acpi_status
 acpi_tb_install_table (
-       ACPI_TABLE_HEADER       *table_ptr,
-       ACPI_TABLE_DESC         *table_info);
+       acpi_table_header       *table_ptr,
+       acpi_table_desc         *table_info);
 
-ACPI_STATUS
+acpi_status
 acpi_tb_recognize_table (
-       ACPI_TABLE_HEADER       *table_ptr,
-       ACPI_TABLE_DESC         *table_info);
+       acpi_table_header       *table_ptr,
+       acpi_table_desc         *table_info);
 
-ACPI_STATUS
+acpi_status
 acpi_tb_init_table_descriptor (
-       ACPI_TABLE_TYPE         table_type,
-       ACPI_TABLE_DESC         *table_info);
+       acpi_table_type         table_type,
+       acpi_table_desc         *table_info);
 
 
 /*
@@ -139,26 +139,26 @@ acpi_tb_delete_acpi_tables (
 
 void
 acpi_tb_delete_acpi_table (
-       ACPI_TABLE_TYPE         type);
+       acpi_table_type         type);
 
 void
 acpi_tb_delete_single_table (
-       ACPI_TABLE_DESC         *table_desc);
+       acpi_table_desc         *table_desc);
 
-ACPI_TABLE_DESC *
+acpi_table_desc *
 acpi_tb_uninstall_table (
-       ACPI_TABLE_DESC         *table_desc);
+       acpi_table_desc         *table_desc);
 
 void
 acpi_tb_free_acpi_tables_of_type (
-       ACPI_TABLE_DESC         *table_info);
+       acpi_table_desc         *table_info);
 
 
 /*
  * tbrsd - RSDP, RSDT utilities
  */
 
-ACPI_STATUS
+acpi_status
 acpi_tb_get_table_rsdt (
        u32                     *number_of_tables);
 
@@ -167,9 +167,9 @@ acpi_tb_scan_memory_for_rsdp (
        u8                      *start_address,
        u32                     length);
 
-ACPI_STATUS
+acpi_status
 acpi_tb_find_rsdp (
-       ACPI_TABLE_DESC         *table_info,
+       acpi_table_desc         *table_info,
        u32                     flags);
 
 
@@ -181,24 +181,24 @@ u8
 acpi_tb_system_table_pointer (
        void                    *where);
 
-ACPI_STATUS
+acpi_status
 acpi_tb_map_acpi_table (
        ACPI_PHYSICAL_ADDRESS   physical_address,
        u32                     *size,
-       ACPI_TABLE_HEADER       **logical_address);
+       acpi_table_header       **logical_address);
 
-ACPI_STATUS
+acpi_status
 acpi_tb_verify_table_checksum (
-       ACPI_TABLE_HEADER       *table_header);
+       acpi_table_header       *table_header);
 
 u8
 acpi_tb_checksum (
        void                    *buffer,
        u32                     length);
 
-ACPI_STATUS
+acpi_status
 acpi_tb_validate_table_header (
-       ACPI_TABLE_HEADER       *table_header);
+       acpi_table_header       *table_header);
 
 
 #endif /* __ACTABLES_H__ */
index c3b14bbd71b75737ec5462a5eb1e1f3ced79e7ff..e306f3090f46baa904841bd7f973b41f8cedab76 100644 (file)
@@ -64,9 +64,9 @@
  * constant if the underlying tables are changed
  */
 #define RSDT_DESCRIPTOR         RSDT_DESCRIPTOR_REV2
-#define XSDT_DESCRIPTOR         XSDT_DESCRIPTOR_REV2
-#define FACS_DESCRIPTOR         FACS_DESCRIPTOR_REV2
-#define FADT_DESCRIPTOR         FADT_DESCRIPTOR_REV2
+#define xsdt_descriptor         XSDT_DESCRIPTOR_REV2
+#define FACS_DESCRIPTOR         facs_descriptor_rev2
+#define FADT_DESCRIPTOR         fadt_descriptor_rev2
 
 
 #pragma pack(1)
@@ -104,7 +104,7 @@ typedef struct  /* ACPI common table header */
        NATIVE_CHAR             asl_compiler_id [4];    /* ASL compiler vendor ID */
        u32                     asl_compiler_revision;  /* ASL compiler revision number */
 
-} ACPI_TABLE_HEADER;
+} acpi_table_header;
 
 
 typedef struct  /* Common FACS for internal use */
@@ -113,12 +113,12 @@ typedef struct  /* Common FACS for internal use */
        UINT64                  *firmware_waking_vector;
        u8                      vector_width;
 
-} ACPI_COMMON_FACS;
+} acpi_common_facs;
 
 
 typedef struct  /* APIC Table */
 {
-       ACPI_TABLE_HEADER       header;                 /* table header */
+       acpi_table_header       header;                 /* table header */
        u32                     local_apic_address;     /* Physical address for accessing local APICs */
        u32                     PCATcompat      : 1;    /* a one indicates system also has dual 8259s */
        u32                     reserved1       : 31;
@@ -166,7 +166,7 @@ typedef struct  /* IO APIC */
 */
 typedef struct  /* Smart Battery Description Table */
 {
-       ACPI_TABLE_HEADER       header;
+       acpi_table_header       header;
        u32                     warning_level;
        u32                     low_level;
        u32                     critical_level;
index 5c68ca05051915a65b0da5e610e48708c8f911dc..490e097d3fef5ec5cfd02bdfb900e90fbd970167 100644 (file)
@@ -34,7 +34,7 @@
 /*************************************/
 typedef struct
 {
-       ACPI_TABLE_HEADER       header;                 /* Table header */
+       acpi_table_header       header;                 /* Table header */
        u32                     table_offset_entry [1]; /* Array of pointers to other */
                         /* ACPI tables */
 } RSDT_DESCRIPTOR_REV1;
@@ -55,7 +55,7 @@ typedef struct
        u32                     reserved1       : 31;   /* must be 0 */
        u8                      resverved3 [40];        /* reserved - must be zero */
 
-} FACS_DESCRIPTOR_REV1;
+} facs_descriptor_rev1;
 
 
 /************************************/
@@ -64,7 +64,7 @@ typedef struct
 /************************************/
 typedef struct
 {
-       ACPI_TABLE_HEADER       header;                 /* table header */
+       acpi_table_header       header;                 /* table header */
        u32                     firmware_ctrl;          /* Physical address of FACS */
        u32                     dsdt;                   /* Physical address of DSDT */
        u8                      model;                  /* System Interrupt Model */
@@ -114,7 +114,7 @@ typedef struct
        u32                     tmr_val_ext     : 1;    /* tmr_val is 32 bits */
        u32                     reserved5       : 23;   /* reserved - must be zero */
 
-}  FADT_DESCRIPTOR_REV1;
+}  fadt_descriptor_rev1;
 
 #pragma pack()
 
index 2b781525550d87274af9b0c2ad1d415803272eb6..bcb352920071c00f2fa1b6ce3fc33d18c6d888a3 100644 (file)
@@ -53,7 +53,7 @@
  */
 typedef struct
 {
-       ACPI_TABLE_HEADER       header;                 /* Table header */
+       acpi_table_header       header;                 /* Table header */
        u32                     table_offset_entry [1]; /* Array of pointers to  */
                         /* other tables' headers */
 } RSDT_DESCRIPTOR_REV2;
@@ -64,7 +64,7 @@ typedef struct
  */
 typedef struct
 {
-       ACPI_TABLE_HEADER       header;                 /* Table header */
+       acpi_table_header       header;                 /* Table header */
        UINT64                  table_offset_entry [1]; /* Array of pointers to  */
                         /* other tables' headers */
 } XSDT_DESCRIPTOR_REV2;
@@ -86,7 +86,7 @@ typedef struct
        u8                      version;                /* Version of this table */
        u8                      reserved3 [31];         /* reserved - must be zero */
 
-} FACS_DESCRIPTOR_REV2;
+} facs_descriptor_rev2;
 
 
 /*
@@ -100,7 +100,7 @@ typedef struct
        u8                      reserved;               /* Must be 0 */
        UINT64                  address;                /* 64-bit address of struct or register */
 
-} ACPI_GENERIC_ADDRESS;
+} acpi_generic_address;
 
 
 /*
@@ -108,7 +108,7 @@ typedef struct
  */
 typedef struct
 {
-       ACPI_TABLE_HEADER       header;             /* table header */
+       acpi_table_header       header;             /* table header */
        u32                     V1_firmware_ctrl;   /* 32-bit physical address of FACS */
        u32                     V1_dsdt;            /* 32-bit physical address of DSDT */
        u8                      reserved1;          /* System Interrupt Model isn't used in ACPI 2.0*/
@@ -163,21 +163,21 @@ typedef struct
                           /* must be executed after writing the SLP_TYPx register. */
        u32                     reserved6   : 18;   /* reserved - must be zero */
 
-       ACPI_GENERIC_ADDRESS    reset_register;     /* Reset register address in GAS format */
+       acpi_generic_address    reset_register;     /* Reset register address in GAS format */
        u8                      reset_value;        /* Value to write to the Reset_register port to reset the system. */
        u8                      reserved7[3];       /* These three bytes must be zero */
        UINT64                  Xfirmware_ctrl;     /* 64-bit physical address of FACS */
        UINT64                  Xdsdt;              /* 64-bit physical address of DSDT */
-       ACPI_GENERIC_ADDRESS    Xpm1a_evt_blk;      /* Extended Power Mgt 1a Acpi_event Reg Blk address */
-       ACPI_GENERIC_ADDRESS    Xpm1b_evt_blk;      /* Extended Power Mgt 1b Acpi_event Reg Blk address */
-       ACPI_GENERIC_ADDRESS    Xpm1a_cnt_blk;      /* Extended Power Mgt 1a Control Reg Blk address */
-       ACPI_GENERIC_ADDRESS    Xpm1b_cnt_blk;      /* Extended Power Mgt 1b Control Reg Blk address */
-       ACPI_GENERIC_ADDRESS    Xpm2_cnt_blk;       /* Extended Power Mgt 2 Control Reg Blk address */
-       ACPI_GENERIC_ADDRESS    Xpm_tmr_blk;        /* Extended Power Mgt Timer Ctrl Reg Blk address */
-       ACPI_GENERIC_ADDRESS    Xgpe0blk;           /* Extended General Purpose Acpi_event 0 Reg Blk address */
-       ACPI_GENERIC_ADDRESS    Xgpe1_blk;          /* Extended General Purpose Acpi_event 1 Reg Blk address */
-
-}  FADT_DESCRIPTOR_REV2;
+       acpi_generic_address    Xpm1a_evt_blk;      /* Extended Power Mgt 1a Acpi_event Reg Blk address */
+       acpi_generic_address    Xpm1b_evt_blk;      /* Extended Power Mgt 1b Acpi_event Reg Blk address */
+       acpi_generic_address    Xpm1a_cnt_blk;      /* Extended Power Mgt 1a Control Reg Blk address */
+       acpi_generic_address    Xpm1b_cnt_blk;      /* Extended Power Mgt 1b Control Reg Blk address */
+       acpi_generic_address    Xpm2_cnt_blk;       /* Extended Power Mgt 2 Control Reg Blk address */
+       acpi_generic_address    Xpm_tmr_blk;        /* Extended Power Mgt Timer Ctrl Reg Blk address */
+       acpi_generic_address    Xgpe0blk;           /* Extended General Purpose Acpi_event 0 Reg Blk address */
+       acpi_generic_address    Xgpe1_blk;          /* Extended General Purpose Acpi_event 1 Reg Blk address */
+
+}  fadt_descriptor_rev2;
 
 
 #pragma pack()
index 5c561f8166b56fff9eca916984568e2210150485..ffbc535d24e6c73f6c20e0602238566f835f96ab 100644 (file)
@@ -61,7 +61,7 @@ typedef struct  /* Root System Descriptor Pointer */
 /*****************************************/
 typedef struct
 {
-       ACPI_TABLE_HEADER   header;                 /* Table header */
+       acpi_table_header   header;                 /* Table header */
        u32                 reserved_pad;           /* IA64 alignment, must be 0 */
        UINT64              table_offset_entry [1]; /* Array of pointers to other */
                           /* tables' headers */
@@ -84,7 +84,7 @@ typedef struct
        u32                 reserved1     : 31;   /* must be 0 */
        u8                  reserved3 [28];       /* reserved - must be zero */
 
-} FACS_DESCRIPTOR_REV071;
+} facs_descriptor_rev071;
 
 
 /******************************************/
@@ -93,7 +93,7 @@ typedef struct
 /******************************************/
 typedef struct
 {
-       ACPI_TABLE_HEADER   header;             /* table header */
+       acpi_table_header   header;             /* table header */
        u32                 reserved_pad;       /* IA64 alignment, must be 0 */
        UINT64              firmware_ctrl;      /* 64-bit Physical address of FACS */
        UINT64              dsdt;               /* 64-bit Physical address of DSDT */
@@ -139,7 +139,7 @@ typedef struct
        u32                 dock_cap    : 1;    /* Supports Docking */
        u32                 reserved6   : 22;    /* reserved - must be zero */
 
-}  FADT_DESCRIPTOR_REV071;
+}  fadt_descriptor_rev071;
 
 #pragma pack()
 
index 708e6e2d952d2e60a881d72ef4128ecd8d25ea54..5ae22a0b16566f1335dfb9b023c06b2f666e2397 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: actypes.h - Common data types for the entire ACPI subsystem
- *       $Revision: 180 $
+ *       $Revision: 188 $
  *
  *****************************************************************************/
 
@@ -189,10 +189,17 @@ typedef UINT64                          u64;
  * Local datatypes
  */
 
-typedef u32                             ACPI_STATUS;    /* All ACPI Exceptions */
-typedef u32                             ACPI_NAME;      /* 4-s8 ACPI name */
-typedef char*                           ACPI_STRING;    /* Null terminated ASCII string */
-typedef void*                           ACPI_HANDLE;    /* Actually a ptr to an Node */
+typedef u32                             acpi_status;    /* All ACPI Exceptions */
+typedef u32                             acpi_name;      /* 4-byte ACPI name */
+typedef char*                           acpi_string;    /* Null terminated ASCII string */
+typedef void*                           acpi_handle;    /* Actually a ptr to an Node */
+
+typedef struct
+{
+       u32                                     lo;
+       u32                                     hi;
+
+} uint64_struct;
 
 
 /*
@@ -206,21 +213,23 @@ typedef void*                           ACPI_HANDLE;    /* Actually a ptr to an
 
 /* 32-bit integers only, no 64-bit support */
 
-typedef u32                             ACPI_INTEGER;
+typedef u32                             acpi_integer;
 #define ACPI_INTEGER_MAX                ACPI_UINT32_MAX
 #define ACPI_INTEGER_BIT_SIZE           32
 #define ACPI_MAX_BCD_VALUE              99999999
 #define ACPI_MAX_BCD_DIGITS             8
+#define ACPI_MAX_DECIMAL_DIGITS         10
 
 #else
 
 /* 64-bit integers */
 
-typedef UINT64                          ACPI_INTEGER;
+typedef UINT64                          acpi_integer;
 #define ACPI_INTEGER_MAX                ACPI_UINT64_MAX
 #define ACPI_INTEGER_BIT_SIZE           64
 #define ACPI_MAX_BCD_VALUE              9999999999999999
 #define ACPI_MAX_BCD_DIGITS             16
+#define ACPI_MAX_DECIMAL_DIGITS         19
 
 #endif
 
@@ -229,7 +238,7 @@ typedef UINT64                          ACPI_INTEGER;
  * Constants with special meanings
  */
 
-#define ACPI_ROOT_OBJECT                (ACPI_HANDLE)(-1)
+#define ACPI_ROOT_OBJECT                (acpi_handle)(-1)
 
 
 /*
@@ -243,6 +252,10 @@ typedef UINT64                          ACPI_INTEGER;
 #define ACPI_NO_DEVICE_INIT             0x10
 #define ACPI_NO_OBJECT_INIT             0x20
 
+/*
+ * Initialization state
+ */
+#define ACPI_INITIALIZED_OK             0x01
 
 /*
  * Power state values
@@ -256,8 +269,6 @@ typedef UINT64                          ACPI_INTEGER;
 #define ACPI_STATE_S3                   (u8) 3
 #define ACPI_STATE_S4                   (u8) 4
 #define ACPI_STATE_S5                   (u8) 5
-/* let's pretend S4_bIOS didn't exist for now. ASG */
-#define ACPI_STATE_S4_bIOS              (u8) 6
 #define ACPI_S_STATES_MAX               ACPI_STATE_S5
 #define ACPI_S_STATE_COUNT              6
 
@@ -278,22 +289,22 @@ typedef UINT64                          ACPI_INTEGER;
 #define ACPI_NOTIFY_DEVICE_CHECK_LIGHT  (u8) 4
 #define ACPI_NOTIFY_FREQUENCY_MISMATCH  (u8) 5
 #define ACPI_NOTIFY_BUS_MODE_MISMATCH   (u8) 6
-#define ACPI_NOTIFY_POWER_FAULT                (u8) 7
+#define ACPI_NOTIFY_POWER_FAULT         (u8) 7
 
 
 /*
  *  Table types.  These values are passed to the table related APIs
  */
 
-typedef u32                             ACPI_TABLE_TYPE;
+typedef u32                             acpi_table_type;
 
-#define ACPI_TABLE_RSDP                 (ACPI_TABLE_TYPE) 0
-#define ACPI_TABLE_DSDT                 (ACPI_TABLE_TYPE) 1
-#define ACPI_TABLE_FADT                 (ACPI_TABLE_TYPE) 2
-#define ACPI_TABLE_FACS                 (ACPI_TABLE_TYPE) 3
-#define ACPI_TABLE_PSDT                 (ACPI_TABLE_TYPE) 4
-#define ACPI_TABLE_SSDT                 (ACPI_TABLE_TYPE) 5
-#define ACPI_TABLE_XSDT                 (ACPI_TABLE_TYPE) 6
+#define ACPI_TABLE_RSDP                 (acpi_table_type) 0
+#define ACPI_TABLE_DSDT                 (acpi_table_type) 1
+#define ACPI_TABLE_FADT                 (acpi_table_type) 2
+#define ACPI_TABLE_FACS                 (acpi_table_type) 3
+#define ACPI_TABLE_PSDT                 (acpi_table_type) 4
+#define ACPI_TABLE_SSDT                 (acpi_table_type) 5
+#define ACPI_TABLE_XSDT                 (acpi_table_type) 6
 #define ACPI_TABLE_MAX                  6
 #define NUM_ACPI_TABLES                 (ACPI_TABLE_MAX+1)
 
@@ -308,8 +319,8 @@ typedef u32                             ACPI_TABLE_TYPE;
  * and Acpi_ns_type_names arrays
  */
 
-typedef u32                             ACPI_OBJECT_TYPE;
-typedef u8                              ACPI_OBJECT_TYPE8;
+typedef u32                             acpi_object_type;
+typedef u8                              acpi_object_type8;
 
 
 #define ACPI_TYPE_ANY                   0  /* 0x00  */
@@ -411,40 +422,40 @@ typedef u8                              ACPI_OBJECT_TYPE8;
  * Fixed & general purpose...
  */
 
-typedef u32                             ACPI_EVENT_TYPE;
+typedef u32                             acpi_event_type;
 
-#define ACPI_EVENT_FIXED                (ACPI_EVENT_TYPE) 0
-#define ACPI_EVENT_GPE                  (ACPI_EVENT_TYPE) 1
+#define ACPI_EVENT_FIXED                (acpi_event_type) 0
+#define ACPI_EVENT_GPE                  (acpi_event_type) 1
 
 /*
  * Fixed events
  */
 
-#define ACPI_EVENT_PMTIMER              (ACPI_EVENT_TYPE) 0
+#define ACPI_EVENT_PMTIMER              (acpi_event_type) 0
        /*
         * There's no bus master event so index 1 is used for IRQ's that are not
         * handled by the SCI handler
         */
-#define ACPI_EVENT_NOT_USED             (ACPI_EVENT_TYPE) 1
-#define ACPI_EVENT_GLOBAL               (ACPI_EVENT_TYPE) 2
-#define ACPI_EVENT_POWER_BUTTON         (ACPI_EVENT_TYPE) 3
-#define ACPI_EVENT_SLEEP_BUTTON         (ACPI_EVENT_TYPE) 4
-#define ACPI_EVENT_RTC                  (ACPI_EVENT_TYPE) 5
-#define ACPI_EVENT_GENERAL              (ACPI_EVENT_TYPE) 6
+#define ACPI_EVENT_NOT_USED             (acpi_event_type) 1
+#define ACPI_EVENT_GLOBAL               (acpi_event_type) 2
+#define ACPI_EVENT_POWER_BUTTON         (acpi_event_type) 3
+#define ACPI_EVENT_SLEEP_BUTTON         (acpi_event_type) 4
+#define ACPI_EVENT_RTC                  (acpi_event_type) 5
+#define ACPI_EVENT_GENERAL              (acpi_event_type) 6
 #define ACPI_EVENT_MAX                  6
-#define ACPI_NUM_FIXED_EVENTS           (ACPI_EVENT_TYPE) 7
+#define ACPI_NUM_FIXED_EVENTS           (acpi_event_type) 7
 
 #define ACPI_GPE_INVALID                0xFF
 #define ACPI_GPE_MAX                    0xFF
 #define ACPI_NUM_GPE                    256
 
-#define ACPI_EVENT_LEVEL_TRIGGERED      (ACPI_EVENT_TYPE) 1
-#define ACPI_EVENT_EDGE_TRIGGERED       (ACPI_EVENT_TYPE) 2
+#define ACPI_EVENT_LEVEL_TRIGGERED      (acpi_event_type) 1
+#define ACPI_EVENT_EDGE_TRIGGERED       (acpi_event_type) 2
 
 /*
  * Acpi_event Status:
  * -------------
- * The encoding of ACPI_EVENT_STATUS is illustrated below.
+ * The encoding of acpi_event_status is illustrated below.
  * Note that a set bit (1) indicates the property is TRUE
  * (e.g. if bit 0 is set then the event is enabled).
  * +---------------+-+-+
@@ -455,11 +466,11 @@ typedef u32                             ACPI_EVENT_TYPE;
  *          |       +--- Set?
  *          +----------- <Reserved>
  */
-typedef u32                             ACPI_EVENT_STATUS;
+typedef u32                             acpi_event_status;
 
-#define ACPI_EVENT_FLAG_DISABLED        (ACPI_EVENT_STATUS) 0x00
-#define ACPI_EVENT_FLAG_ENABLED         (ACPI_EVENT_STATUS) 0x01
-#define ACPI_EVENT_FLAG_SET             (ACPI_EVENT_STATUS) 0x02
+#define ACPI_EVENT_FLAG_DISABLED        (acpi_event_status) 0x00
+#define ACPI_EVENT_FLAG_ENABLED         (acpi_event_status) 0x01
+#define ACPI_EVENT_FLAG_SET             (acpi_event_status) 0x02
 
 
 /* Notify types */
@@ -490,44 +501,44 @@ typedef u8                              ACPI_ADR_SPACE_TYPE;
 
 typedef union acpi_obj
 {
-       ACPI_OBJECT_TYPE            type;   /* See definition of Acpi_ns_type for values */
+       acpi_object_type            type;   /* See definition of Acpi_ns_type for values */
        struct
        {
-               ACPI_OBJECT_TYPE            type;
-               ACPI_INTEGER                value;      /* The actual number */
+               acpi_object_type            type;
+               acpi_integer                value;      /* The actual number */
        } integer;
 
        struct
        {
-               ACPI_OBJECT_TYPE            type;
+               acpi_object_type            type;
                u32                         length;     /* # of bytes in string, excluding trailing null */
                NATIVE_CHAR                 *pointer;   /* points to the string value */
        } string;
 
        struct
        {
-               ACPI_OBJECT_TYPE            type;
+               acpi_object_type            type;
                u32                         length;     /* # of bytes in buffer */
                u8                          *pointer;   /* points to the buffer */
        } buffer;
 
        struct
        {
-               ACPI_OBJECT_TYPE            type;
+               acpi_object_type            type;
                u32                         fill1;
-               ACPI_HANDLE                 handle;     /* object reference */
+               acpi_handle                 handle;     /* object reference */
        } reference;
 
        struct
        {
-               ACPI_OBJECT_TYPE            type;
+               acpi_object_type            type;
                u32                         count;      /* # of elements in package */
                union acpi_obj              *elements;  /* Pointer to an array of ACPI_OBJECTs */
        } package;
 
        struct
        {
-               ACPI_OBJECT_TYPE            type;
+               acpi_object_type            type;
                u32                         proc_id;
                ACPI_IO_ADDRESS             pblk_address;
                u32                         pblk_length;
@@ -535,12 +546,12 @@ typedef union acpi_obj
 
        struct
        {
-               ACPI_OBJECT_TYPE            type;
+               acpi_object_type            type;
                u32                         system_level;
                u32                         resource_order;
        } power_resource;
 
-} ACPI_OBJECT, *PACPI_OBJECT;
+} acpi_object, *PACPI_OBJECT;
 
 
 /*
@@ -550,9 +561,9 @@ typedef union acpi_obj
 typedef struct acpi_obj_list
 {
        u32                         count;
-       ACPI_OBJECT                 *pointer;
+       acpi_object                 *pointer;
 
-} ACPI_OBJECT_LIST, *PACPI_OBJECT_LIST;
+} acpi_object_list, *PACPI_OBJECT_LIST;
 
 
 /*
@@ -564,7 +575,7 @@ typedef struct
        u32                         length;         /* Length in bytes of the buffer */
        void                        *pointer;       /* pointer to buffer */
 
-} ACPI_BUFFER;
+} acpi_buffer;
 
 
 /*
@@ -585,30 +596,6 @@ typedef struct
 #define SYS_MODE_LEGACY                 0x0002
 #define SYS_MODES_MASK                  0x0003
 
-/*
- *  ACPI CPU Cx state handler
- */
-typedef
-ACPI_STATUS (*ACPI_SET_C_STATE_HANDLER) (
-       NATIVE_UINT                 pblk_address);
-
-/*
- *  ACPI Cx State info
- */
-typedef struct
-{
-       u32                         state_number;
-       u32                         latency;
-} ACPI_CX_STATE;
-
-/*
- *  ACPI CPU throttling info
- */
-typedef struct
-{
-       u32                         state_number;
-       u32                         percent_of_clock;
-} ACPI_CPU_THROTTLING_STATE;
 
 /*
  * ACPI Table Info.  One per ACPI table _type_
@@ -636,19 +623,7 @@ typedef struct _acpi_sys_info
        u32                         num_table_types;
        ACPI_TABLE_INFO             table_info [NUM_ACPI_TABLES];
 
-} ACPI_SYSTEM_INFO;
-
-
-/*
- *  System Initiailization data.  This data is passed to ACPIInitialize
- *  copyied to global data and retained by ACPI CA
- */
-
-typedef struct _acpi_init_data
-{
-       void                        *RSDP_physical_address; /*  Address of RSDP, needed it it is    */
-                         /*  not found in the IA32 manner        */
-} ACPI_INIT_DATA;
+} acpi_system_info;
 
 
 /*
@@ -665,7 +640,7 @@ void (*ACPI_GPE_HANDLER) (
 
 typedef
 void (*ACPI_NOTIFY_HANDLER) (
-       ACPI_HANDLE                 device,
+       acpi_handle                 device,
        u32                         value,
        void                        *context);
 
@@ -676,7 +651,7 @@ void (*ACPI_NOTIFY_HANDLER) (
 #define ACPI_WRITE_ADR_SPACE    2
 
 typedef
-ACPI_STATUS (*ACPI_ADR_SPACE_HANDLER) (
+acpi_status (*ACPI_ADR_SPACE_HANDLER) (
        u32                         function,
        ACPI_PHYSICAL_ADDRESS       address,
        u32                         bit_width,
@@ -688,8 +663,8 @@ ACPI_STATUS (*ACPI_ADR_SPACE_HANDLER) (
 
 
 typedef
-ACPI_STATUS (*ACPI_ADR_SPACE_SETUP) (
-       ACPI_HANDLE                 region_handle,
+acpi_status (*ACPI_ADR_SPACE_SETUP) (
+       acpi_handle                 region_handle,
        u32                         function,
        void                        *handler_context,
        void                        **region_context);
@@ -698,8 +673,8 @@ ACPI_STATUS (*ACPI_ADR_SPACE_SETUP) (
 #define ACPI_REGION_DEACTIVATE  1
 
 typedef
-ACPI_STATUS (*ACPI_WALK_CALLBACK) (
-       ACPI_HANDLE                 obj_handle,
+acpi_status (*ACPI_WALK_CALLBACK) (
+       acpi_handle                 obj_handle,
        u32                         nesting_level,
        void                        *context,
        void                        **return_value);
@@ -720,14 +695,14 @@ ACPI_STATUS (*ACPI_WALK_CALLBACK) (
 
 
 #define ACPI_COMMON_OBJ_INFO \
-       ACPI_OBJECT_TYPE            type;           /* ACPI object type */ \
-       ACPI_NAME                   name            /* ACPI object Name */
+       acpi_object_type            type;           /* ACPI object type */ \
+       acpi_name                   name            /* ACPI object Name */
 
 
 typedef struct
 {
        ACPI_COMMON_OBJ_INFO;
-} ACPI_OBJ_INFO_HEADER;
+} acpi_obj_info_header;
 
 
 typedef struct
@@ -737,19 +712,20 @@ typedef struct
        u32                         valid;              /*  Are the next bits legit? */
        NATIVE_CHAR                 hardware_id[9];     /*  _HID value if any */
        NATIVE_CHAR                 unique_id[9];       /*  _UID value if any */
-       ACPI_INTEGER                address;            /*  _ADR value if any */
+       acpi_integer                address;            /*  _ADR value if any */
        u32                         current_status;     /*  _STA value */
-} ACPI_DEVICE_INFO;
+} acpi_device_info;
 
 
 /* Context structs for address space handlers */
 
 typedef struct
 {
-       u32                         seg;
-       u32                         bus;
-       u32                         dev_func;
-} ACPI_PCI_SPACE_CONTEXT;
+       u16                         segment;
+       u16                         bus;
+       u16                         device;
+       u16                         function;
+} acpi_pci_id;
 
 
 typedef struct
@@ -757,14 +733,12 @@ typedef struct
        ACPI_PHYSICAL_ADDRESS       mapped_physical_address;
        u8                          *mapped_logical_address;
        u32                         mapped_length;
-} ACPI_MEM_SPACE_CONTEXT;
+} acpi_mem_space_context;
 
 
-/*
- * C-state handler
- */
+/* Sleep states */
 
-typedef ACPI_STATUS (*ACPI_C_STATE_HANDLER) (ACPI_IO_ADDRESS, u32*);
+#define ACPI_NUM_SLEEP_STATES           7
 
 
 /*
@@ -859,7 +833,7 @@ typedef struct
        u32                         number_of_interrupts;
        u32                         interrupts[1];
 
-} ACPI_RESOURCE_IRQ;
+} acpi_resource_irq;
 
 typedef struct
 {
@@ -869,14 +843,14 @@ typedef struct
        u32                         number_of_channels;
        u32                         channels[1];
 
-} ACPI_RESOURCE_DMA;
+} acpi_resource_dma;
 
 typedef struct
 {
        u32                         compatibility_priority;
        u32                         performance_robustness;
 
-} ACPI_RESOURCE_START_DPF;
+} acpi_resource_start_dpf;
 
 /*
  * END_DEPENDENT_FUNCTIONS_RESOURCE struct is not
@@ -891,21 +865,21 @@ typedef struct
        u32                         alignment;
        u32                         range_length;
 
-} ACPI_RESOURCE_IO;
+} acpi_resource_io;
 
 typedef struct
 {
        u32                         base_address;
        u32                         range_length;
 
-} ACPI_RESOURCE_FIXED_IO;
+} acpi_resource_fixed_io;
 
 typedef struct
 {
        u32                         length;
        u8                          reserved[1];
 
-} ACPI_RESOURCE_VENDOR;
+} acpi_resource_vendor;
 
 typedef struct
 {
@@ -915,7 +889,7 @@ typedef struct
        u32                         alignment;
        u32                         range_length;
 
-} ACPI_RESOURCE_MEM24;
+} acpi_resource_mem24;
 
 typedef struct
 {
@@ -925,7 +899,7 @@ typedef struct
        u32                         alignment;
        u32                         range_length;
 
-} ACPI_RESOURCE_MEM32;
+} acpi_resource_mem32;
 
 typedef struct
 {
@@ -933,36 +907,36 @@ typedef struct
        u32                         range_base_address;
        u32                         range_length;
 
-} ACPI_RESOURCE_FIXED_MEM32;
+} acpi_resource_fixed_mem32;
 
 typedef struct
 {
        u16                         cache_attribute;
        u16                         read_write_attribute;
 
-} ACPI_MEMORY_ATTRIBUTE;
+} acpi_memory_attribute;
 
 typedef struct
 {
        u16                         range_attribute;
        u16                         reserved;
 
-} ACPI_IO_ATTRIBUTE;
+} acpi_io_attribute;
 
 typedef struct
 {
        u16                         reserved1;
        u16                         reserved2;
 
-} ACPI_BUS_ATTRIBUTE;
+} acpi_bus_attribute;
 
 typedef union
 {
-       ACPI_MEMORY_ATTRIBUTE       memory;
-       ACPI_IO_ATTRIBUTE           io;
-       ACPI_BUS_ATTRIBUTE          bus;
+       acpi_memory_attribute       memory;
+       acpi_io_attribute           io;
+       acpi_bus_attribute          bus;
 
-} ACPI_RESOURCE_ATTRIBUTE;
+} acpi_resource_attribute;
 
 typedef struct
 {
@@ -970,7 +944,7 @@ typedef struct
        u32                         string_length;
        NATIVE_CHAR                 *string_ptr;
 
-} ACPI_RESOURCE_SOURCE;
+} acpi_resource_source;
 
 typedef struct
 {
@@ -979,15 +953,15 @@ typedef struct
        u32                         decode;
        u32                         min_address_fixed;
        u32                         max_address_fixed;
-       ACPI_RESOURCE_ATTRIBUTE     attribute;
+       acpi_resource_attribute     attribute;
        u32                         granularity;
        u32                         min_address_range;
        u32                         max_address_range;
        u32                         address_translation_offset;
        u32                         address_length;
-       ACPI_RESOURCE_SOURCE        resource_source;
+       acpi_resource_source        resource_source;
 
-} ACPI_RESOURCE_ADDRESS16;
+} acpi_resource_address16;
 
 typedef struct
 {
@@ -996,15 +970,15 @@ typedef struct
        u32                         decode;
        u32                         min_address_fixed;
        u32                         max_address_fixed;
-       ACPI_RESOURCE_ATTRIBUTE     attribute;
+       acpi_resource_attribute     attribute;
        u32                         granularity;
        u32                         min_address_range;
        u32                         max_address_range;
        u32                         address_translation_offset;
        u32                         address_length;
-       ACPI_RESOURCE_SOURCE        resource_source;
+       acpi_resource_source        resource_source;
 
-} ACPI_RESOURCE_ADDRESS32;
+} acpi_resource_address32;
 
 typedef struct
 {
@@ -1013,15 +987,15 @@ typedef struct
        u32                         decode;
        u32                         min_address_fixed;
        u32                         max_address_fixed;
-       ACPI_RESOURCE_ATTRIBUTE     attribute;
+       acpi_resource_attribute     attribute;
        UINT64                      granularity;
        UINT64                      min_address_range;
        UINT64                      max_address_range;
        UINT64                      address_translation_offset;
        UINT64                      address_length;
-       ACPI_RESOURCE_SOURCE        resource_source;
+       acpi_resource_source        resource_source;
 
-} ACPI_RESOURCE_ADDRESS64;
+} acpi_resource_address64;
 
 typedef struct
 {
@@ -1030,10 +1004,10 @@ typedef struct
        u32                         active_high_low;
        u32                         shared_exclusive;
        u32                         number_of_interrupts;
-       ACPI_RESOURCE_SOURCE        resource_source;
+       acpi_resource_source        resource_source;
        u32                         interrupts[1];
 
-} ACPI_RESOURCE_EXT_IRQ;
+} acpi_resource_ext_irq;
 
 
 /* ACPI_RESOURCE_TYPEs */
@@ -1054,40 +1028,40 @@ typedef struct
 #define ACPI_RSTYPE_ADDRESS64           13
 #define ACPI_RSTYPE_EXT_IRQ             14
 
-typedef u32                     ACPI_RESOURCE_TYPE;
+typedef u32                     acpi_resource_type;
 
 typedef union
 {
-       ACPI_RESOURCE_IRQ           irq;
-       ACPI_RESOURCE_DMA           dma;
-       ACPI_RESOURCE_START_DPF     start_dpf;
-       ACPI_RESOURCE_IO            io;
-       ACPI_RESOURCE_FIXED_IO      fixed_io;
-       ACPI_RESOURCE_VENDOR        vendor_specific;
-       ACPI_RESOURCE_MEM24         memory24;
-       ACPI_RESOURCE_MEM32         memory32;
-       ACPI_RESOURCE_FIXED_MEM32   fixed_memory32;
-       ACPI_RESOURCE_ADDRESS16     address16;
-       ACPI_RESOURCE_ADDRESS32     address32;
-       ACPI_RESOURCE_ADDRESS64     address64;
-       ACPI_RESOURCE_EXT_IRQ       extended_irq;
-
-} ACPI_RESOURCE_DATA;
+       acpi_resource_irq           irq;
+       acpi_resource_dma           dma;
+       acpi_resource_start_dpf     start_dpf;
+       acpi_resource_io            io;
+       acpi_resource_fixed_io      fixed_io;
+       acpi_resource_vendor        vendor_specific;
+       acpi_resource_mem24         memory24;
+       acpi_resource_mem32         memory32;
+       acpi_resource_fixed_mem32   fixed_memory32;
+       acpi_resource_address16     address16;
+       acpi_resource_address32     address32;
+       acpi_resource_address64     address64;
+       acpi_resource_ext_irq       extended_irq;
+
+} acpi_resource_data;
 
 typedef struct acpi_resource
 {
-       ACPI_RESOURCE_TYPE          id;
+       acpi_resource_type          id;
        u32                         length;
-       ACPI_RESOURCE_DATA          data;
+       acpi_resource_data          data;
 
-} ACPI_RESOURCE;
+} acpi_resource;
 
 #define ACPI_RESOURCE_LENGTH            12
 #define ACPI_RESOURCE_LENGTH_NO_DATA    8       /* Id + Length fields */
 
 #define SIZEOF_RESOURCE(type)   (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (type))
 
-#define NEXT_RESOURCE(res)      (ACPI_RESOURCE *)((u8 *) res + res->length)
+#define NEXT_RESOURCE(res)      (acpi_resource *)((u8 *) res + res->length)
 
 
 /*
@@ -1099,11 +1073,11 @@ typedef struct pci_routing_table
 {
        u32                         length;
        u32                         pin;
-       ACPI_INTEGER                address;        /* here for 64-bit alignment */
+       acpi_integer                address;        /* here for 64-bit alignment */
        u32                         source_index;
        NATIVE_CHAR                 source[4];      /* pad to 64 bits so sizeof() works in all cases */
 
-} PCI_ROUTING_TABLE;
+} pci_routing_table;
 
 
 /*
index 00ae54e5d00ca846fdf64d26fcd91c10ba0c048e..58f7fc972af64f31ae46a65d9176534e235556ef 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
- *       $Revision: 100 $
+ *       $Revision: 113 $
  *
  *****************************************************************************/
 
 
 
 typedef
-ACPI_STATUS (*ACPI_PKG_CALLBACK) (
+acpi_status (*ACPI_PKG_CALLBACK) (
        u8                      object_type,
-       ACPI_OPERAND_OBJECT     *source_object,
-       ACPI_GENERIC_STATE      *state,
+       acpi_operand_object     *source_object,
+       acpi_generic_state      *state,
        void                    *context);
 
 
-ACPI_STATUS
+acpi_status
 acpi_ut_walk_package_tree (
-       ACPI_OPERAND_OBJECT     *source_object,
+       acpi_operand_object     *source_object,
        void                    *target_object,
        ACPI_PKG_CALLBACK       walk_callback,
        void                    *context);
@@ -49,7 +49,7 @@ typedef struct acpi_pkg_info
        u32                     length;
        u32                     object_space;
        u32                     num_packages;
-} ACPI_PKG_INFO;
+} acpi_pkg_info;
 
 #define REF_INCREMENT       (u16) 0
 #define REF_DECREMENT       (u16) 1
@@ -78,15 +78,15 @@ acpi_ut_terminate (
  * Ut_init - miscellaneous initialization and shutdown
  */
 
-ACPI_STATUS
+acpi_status
 acpi_ut_hardware_initialize (
        void);
 
-ACPI_STATUS
+acpi_status
 acpi_ut_subsystem_shutdown (
        void);
 
-ACPI_STATUS
+acpi_status
 acpi_ut_validate_fadt (
        void);
 
@@ -111,11 +111,16 @@ acpi_ut_get_region_name (
 #endif
 
 
+u8
+acpi_ut_hex_to_ascii_char (
+       acpi_integer            integer,
+       u32                     position);
+
 u8
 acpi_ut_valid_object_type (
        u32                     type);
 
-ACPI_OWNER_ID
+acpi_owner_id
 acpi_ut_allocate_owner_id (
        u32                     id_type);
 
@@ -200,168 +205,128 @@ acpi_ut_to_lower (
  * Ut_copy - Object construction and conversion interfaces
  */
 
-ACPI_STATUS
+acpi_status
 acpi_ut_build_simple_object(
-       ACPI_OPERAND_OBJECT     *obj,
-       ACPI_OBJECT             *user_obj,
+       acpi_operand_object     *obj,
+       acpi_object             *user_obj,
        u8                      *data_space,
        u32                     *buffer_space_used);
 
-ACPI_STATUS
+acpi_status
 acpi_ut_build_package_object (
-       ACPI_OPERAND_OBJECT     *obj,
+       acpi_operand_object     *obj,
        u8                      *buffer,
        u32                     *space_used);
 
-ACPI_STATUS
+acpi_status
 acpi_ut_copy_iobject_to_eobject (
-       ACPI_OPERAND_OBJECT     *obj,
-       ACPI_BUFFER             *ret_buffer);
+       acpi_operand_object     *obj,
+       acpi_buffer             *ret_buffer);
 
-ACPI_STATUS
+acpi_status
 acpi_ut_copy_esimple_to_isimple(
-       ACPI_OBJECT             *user_obj,
-       ACPI_OPERAND_OBJECT     *obj);
+       acpi_object             *user_obj,
+       acpi_operand_object     **return_obj);
 
-ACPI_STATUS
+acpi_status
 acpi_ut_copy_eobject_to_iobject (
-       ACPI_OBJECT             *obj,
-       ACPI_OPERAND_OBJECT     *internal_obj);
+       acpi_object             *obj,
+       acpi_operand_object     **internal_obj);
 
-ACPI_STATUS
+acpi_status
 acpi_ut_copy_isimple_to_isimple (
-       ACPI_OPERAND_OBJECT     *source_obj,
-       ACPI_OPERAND_OBJECT     *dest_obj);
+       acpi_operand_object     *source_obj,
+       acpi_operand_object     *dest_obj);
 
-ACPI_STATUS
+acpi_status
 acpi_ut_copy_ipackage_to_ipackage (
-       ACPI_OPERAND_OBJECT     *source_obj,
-       ACPI_OPERAND_OBJECT     *dest_obj,
-       ACPI_WALK_STATE         *walk_state);
+       acpi_operand_object     *source_obj,
+       acpi_operand_object     *dest_obj,
+       acpi_walk_state         *walk_state);
 
 
 /*
  * Ut_create - Object creation
  */
 
-ACPI_STATUS
+acpi_status
 acpi_ut_update_object_reference (
-       ACPI_OPERAND_OBJECT     *object,
+       acpi_operand_object     *object,
        u16                     action);
 
-ACPI_OPERAND_OBJECT  *
-_ut_create_internal_object (
-       NATIVE_CHAR             *module_name,
-       u32                     line_number,
-       u32                     component_id,
-       ACPI_OBJECT_TYPE8       type);
-
 
 /*
  * Ut_debug - Debug interfaces
  */
 
-u32
-get_debug_level (
+void
+acpi_ut_init_stack_ptr_trace (
        void);
 
 void
-set_debug_level (
-       u32                     level);
+acpi_ut_track_stack_ptr (
+       void);
 
 void
-function_trace (
-       NATIVE_CHAR             *module_name,
+acpi_ut_trace (
        u32                     line_number,
-       u32                     component_id,
-       NATIVE_CHAR             *function_name);
+       ACPI_DEBUG_PRINT_INFO   *dbg_info);
 
 void
-function_trace_ptr (
-       NATIVE_CHAR             *module_name,
+acpi_ut_trace_ptr (
        u32                     line_number,
-       u32                     component_id,
-       NATIVE_CHAR             *function_name,
+       ACPI_DEBUG_PRINT_INFO   *dbg_info,
        void                    *pointer);
 
 void
-function_trace_u32 (
-       NATIVE_CHAR             *module_name,
+acpi_ut_trace_u32 (
        u32                     line_number,
-       u32                     component_id,
-       NATIVE_CHAR             *function_name,
+       ACPI_DEBUG_PRINT_INFO   *dbg_info,
        u32                     integer);
 
 void
-function_trace_str (
-       NATIVE_CHAR             *module_name,
+acpi_ut_trace_str (
        u32                     line_number,
-       u32                     component_id,
-       NATIVE_CHAR             *function_name,
+       ACPI_DEBUG_PRINT_INFO   *dbg_info,
        NATIVE_CHAR             *string);
 
 void
-function_exit (
-       NATIVE_CHAR             *module_name,
+acpi_ut_exit (
        u32                     line_number,
-       u32                     component_id,
-       NATIVE_CHAR             *function_name);
+       ACPI_DEBUG_PRINT_INFO   *dbg_info);
 
 void
-function_status_exit (
-       NATIVE_CHAR             *module_name,
+acpi_ut_status_exit (
        u32                     line_number,
-       u32                     component_id,
-       NATIVE_CHAR             *function_name,
-       ACPI_STATUS             status);
+       ACPI_DEBUG_PRINT_INFO   *dbg_info,
+       acpi_status             status);
 
 void
-function_value_exit (
-       NATIVE_CHAR             *module_name,
+acpi_ut_value_exit (
        u32                     line_number,
-       u32                     component_id,
-       NATIVE_CHAR             *function_name,
-       ACPI_INTEGER            value);
+       ACPI_DEBUG_PRINT_INFO   *dbg_info,
+       acpi_integer            value);
 
 void
-function_ptr_exit (
-       NATIVE_CHAR             *module_name,
+acpi_ut_ptr_exit (
        u32                     line_number,
-       u32                     component_id,
-       NATIVE_CHAR             *function_name,
+       ACPI_DEBUG_PRINT_INFO   *dbg_info,
        u8                      *ptr);
 
 void
-debug_print_prefix (
-       NATIVE_CHAR             *module_name,
-       u32                     line_number);
-
-void
-debug_print (
-       NATIVE_CHAR             *module_name,
-       u32                     line_number,
-       u32                     component_id,
-       u32                     print_level,
-       NATIVE_CHAR             *format, ...);
-
-void
-debug_print_raw (
-       NATIVE_CHAR             *format, ...);
-
-void
-_report_info (
+acpi_ut_report_info (
        NATIVE_CHAR             *module_name,
        u32                     line_number,
        u32                     component_id);
 
 void
-_report_error (
+acpi_ut_report_error (
        NATIVE_CHAR             *module_name,
        u32                     line_number,
        u32                     component_id);
 
 void
-_report_warning (
+acpi_ut_report_warning (
        NATIVE_CHAR             *module_name,
        u32                     line_number,
        u32                     component_id);
@@ -373,6 +338,22 @@ acpi_ut_dump_buffer (
        u32                     display,
        u32                     component_id);
 
+void
+acpi_ut_debug_print (
+       u32                     requested_debug_level,
+       u32                     line_number,
+       ACPI_DEBUG_PRINT_INFO   *dbg_info,
+       char                    *format,
+       ...);
+
+void
+acpi_ut_debug_print_raw (
+       u32                     requested_debug_level,
+       u32                     line_number,
+       ACPI_DEBUG_PRINT_INFO   *dbg_info,
+       char                    *format,
+       ...);
+
 
 /*
  * Ut_delete - Object deletion
@@ -380,19 +361,19 @@ acpi_ut_dump_buffer (
 
 void
 acpi_ut_delete_internal_obj (
-       ACPI_OPERAND_OBJECT     *object);
+       acpi_operand_object     *object);
 
 void
 acpi_ut_delete_internal_package_object (
-       ACPI_OPERAND_OBJECT     *object);
+       acpi_operand_object     *object);
 
 void
 acpi_ut_delete_internal_simple_object (
-       ACPI_OPERAND_OBJECT     *object);
+       acpi_operand_object     *object);
 
-ACPI_STATUS
+acpi_status
 acpi_ut_delete_internal_object_list (
-       ACPI_OPERAND_OBJECT     **obj_list);
+       acpi_operand_object     **obj_list);
 
 
 /*
@@ -410,42 +391,33 @@ acpi_ut_delete_internal_object_list (
 #define METHOD_NAME__BBN        "_BBN"
 
 
-ACPI_STATUS
+acpi_status
 acpi_ut_evaluate_numeric_object (
        NATIVE_CHAR             *object_name,
-       ACPI_NAMESPACE_NODE     *device_node,
-       ACPI_INTEGER            *address);
+       acpi_namespace_node     *device_node,
+       acpi_integer            *address);
 
-ACPI_STATUS
+acpi_status
 acpi_ut_execute_HID (
-       ACPI_NAMESPACE_NODE     *device_node,
+       acpi_namespace_node     *device_node,
        ACPI_DEVICE_ID          *hid);
 
-ACPI_STATUS
+acpi_status
 acpi_ut_execute_STA (
-       ACPI_NAMESPACE_NODE     *device_node,
+       acpi_namespace_node     *device_node,
        u32                     *status_flags);
 
-ACPI_STATUS
+acpi_status
 acpi_ut_execute_UID (
-       ACPI_NAMESPACE_NODE     *device_node,
+       acpi_namespace_node     *device_node,
        ACPI_DEVICE_ID          *uid);
 
 
-/*
- * Ut_error - exception interfaces
- */
-
-NATIVE_CHAR *
-acpi_ut_format_exception (
-       ACPI_STATUS             status);
-
-
 /*
  * Ut_mutex - mutual exclusion interfaces
  */
 
-ACPI_STATUS
+acpi_status
 acpi_ut_mutex_initialize (
        void);
 
@@ -453,19 +425,19 @@ void
 acpi_ut_mutex_terminate (
        void);
 
-ACPI_STATUS
+acpi_status
 acpi_ut_create_mutex (
        ACPI_MUTEX_HANDLE       mutex_id);
 
-ACPI_STATUS
+acpi_status
 acpi_ut_delete_mutex (
        ACPI_MUTEX_HANDLE       mutex_id);
 
-ACPI_STATUS
+acpi_status
 acpi_ut_acquire_mutex (
        ACPI_MUTEX_HANDLE       mutex_id);
 
-ACPI_STATUS
+acpi_status
 acpi_ut_release_mutex (
        ACPI_MUTEX_HANDLE       mutex_id);
 
@@ -474,18 +446,25 @@ acpi_ut_release_mutex (
  * Ut_object - internal object create/delete/cache routines
  */
 
+acpi_operand_object  *
+acpi_ut_create_internal_object_dbg (
+       NATIVE_CHAR             *module_name,
+       u32                     line_number,
+       u32                     component_id,
+       acpi_object_type8       type);
+
 void *
-_ut_allocate_object_desc (
+acpi_ut_allocate_object_desc_dbg (
        NATIVE_CHAR             *module_name,
        u32                     line_number,
        u32                     component_id);
 
-#define acpi_ut_create_internal_object(t) _ut_create_internal_object(_THIS_MODULE,__LINE__,_COMPONENT,t)
-#define acpi_ut_allocate_object_desc()  _ut_allocate_object_desc(_THIS_MODULE,__LINE__,_COMPONENT)
+#define acpi_ut_create_internal_object(t) acpi_ut_create_internal_object_dbg (_THIS_MODULE,__LINE__,_COMPONENT,t)
+#define acpi_ut_allocate_object_desc()  acpi_ut_allocate_object_desc_dbg (_THIS_MODULE,__LINE__,_COMPONENT)
 
 void
 acpi_ut_delete_object_desc (
-       ACPI_OPERAND_OBJECT     *object);
+       acpi_operand_object     *object);
 
 u8
 acpi_ut_valid_internal_object (
@@ -498,29 +477,29 @@ acpi_ut_valid_internal_object (
 
 void
 acpi_ut_add_reference (
-       ACPI_OPERAND_OBJECT     *object);
+       acpi_operand_object     *object);
 
 void
 acpi_ut_remove_reference (
-       ACPI_OPERAND_OBJECT     *object);
+       acpi_operand_object     *object);
 
 /*
  * Ut_size - Object size routines
  */
 
-ACPI_STATUS
+acpi_status
 acpi_ut_get_simple_object_size (
-       ACPI_OPERAND_OBJECT     *obj,
+       acpi_operand_object     *obj,
        u32                     *obj_length);
 
-ACPI_STATUS
+acpi_status
 acpi_ut_get_package_object_size (
-       ACPI_OPERAND_OBJECT     *obj,
+       acpi_operand_object     *obj,
        u32                     *obj_length);
 
-ACPI_STATUS
+acpi_status
 acpi_ut_get_object_size(
-       ACPI_OPERAND_OBJECT     *obj,
+       acpi_operand_object     *obj,
        u32                     *obj_length);
 
 
@@ -530,49 +509,49 @@ acpi_ut_get_object_size(
 
 void
 acpi_ut_push_generic_state (
-       ACPI_GENERIC_STATE      **list_head,
-       ACPI_GENERIC_STATE      *state);
+       acpi_generic_state      **list_head,
+       acpi_generic_state      *state);
 
-ACPI_GENERIC_STATE *
+acpi_generic_state *
 acpi_ut_pop_generic_state (
-       ACPI_GENERIC_STATE      **list_head);
+       acpi_generic_state      **list_head);
 
 
-ACPI_GENERIC_STATE *
+acpi_generic_state *
 acpi_ut_create_generic_state (
        void);
 
-ACPI_GENERIC_STATE *
+acpi_generic_state *
 acpi_ut_create_update_state (
-       ACPI_OPERAND_OBJECT     *object,
+       acpi_operand_object     *object,
        u16                     action);
 
-ACPI_GENERIC_STATE *
+acpi_generic_state *
 acpi_ut_create_pkg_state (
        void                    *internal_object,
        void                    *external_object,
        u16                     index);
 
-ACPI_STATUS
+acpi_status
 acpi_ut_create_update_state_and_push (
-       ACPI_OPERAND_OBJECT     *object,
+       acpi_operand_object     *object,
        u16                     action,
-       ACPI_GENERIC_STATE      **state_list);
+       acpi_generic_state      **state_list);
 
-ACPI_STATUS
+acpi_status
 acpi_ut_create_pkg_state_and_push (
        void                    *internal_object,
        void                    *external_object,
        u16                     index,
-       ACPI_GENERIC_STATE      **state_list);
+       acpi_generic_state      **state_list);
 
-ACPI_GENERIC_STATE *
+acpi_generic_state *
 acpi_ut_create_control_state (
        void);
 
 void
 acpi_ut_delete_generic_state (
-       ACPI_GENERIC_STATE      *state);
+       acpi_generic_state      *state);
 
 void
 acpi_ut_delete_generic_state_cache (
@@ -598,52 +577,62 @@ NATIVE_CHAR *
 acpi_ut_strupr (
        NATIVE_CHAR             *src_string);
 
-ACPI_STATUS
+acpi_status
 acpi_ut_resolve_package_references (
-       ACPI_OPERAND_OBJECT     *obj_desc);
+       acpi_operand_object     *obj_desc);
 
 
 #ifdef ACPI_DEBUG
 void
 acpi_ut_display_init_pathname (
-       ACPI_HANDLE             obj_handle,
+       acpi_handle             obj_handle,
        char                    *path);
 
 #endif
 
 
 /*
- * Memory allocation functions and related macros.
- * Macros that expand to include filename and line number
+ * Utalloc - memory allocation and object caching
  */
 
 void *
-_ut_allocate (
+acpi_ut_acquire_from_cache (
+       u32                     list_id);
+
+void
+acpi_ut_release_to_cache (
+       u32                     list_id,
+       void                    *object);
+
+void
+acpi_ut_delete_generic_cache (
+       u32                     list_id);
+
+
+/* Debug Memory allocation functions */
+
+void *
+acpi_ut_allocate (
        u32                     size,
        u32                     component,
        NATIVE_CHAR             *module,
        u32                     line);
 
 void *
-_ut_callocate (
+acpi_ut_callocate (
        u32                     size,
        u32                     component,
        NATIVE_CHAR             *module,
        u32                     line);
 
 void
-_ut_free (
+acpi_ut_free (
        void                    *address,
        u32                     component,
        NATIVE_CHAR             *module,
        u32                     line);
 
-void
-acpi_ut_init_static_object (
-       ACPI_OPERAND_OBJECT     *obj_desc);
-
-
-#ifdef ACPI_DEBUG_TRACK_ALLOCATIONS
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
 void
 acpi_ut_dump_allocation_info (
        void);
@@ -655,9 +644,4 @@ acpi_ut_dump_current_allocations (
 #endif
 
 
-#define acpi_ut_allocate(a) _ut_allocate(a,_COMPONENT,_THIS_MODULE,__LINE__)
-#define acpi_ut_callocate(a) _ut_callocate(a, _COMPONENT,_THIS_MODULE,__LINE__)
-#define acpi_ut_free(a)     _ut_free(a,_COMPONENT,_THIS_MODULE,__LINE__)
-
-
 #endif /* _ACUTILS_H */
index dacf02b3b6053393c54c57274df4e9c28ac06dd3..3c4fa958a9aee72d71bc2ad3fe89cb11053e5bf9 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: 52 $
+ *       $Revision: 53 $
  *
  *****************************************************************************/
 
 #define OPTYPE_MONADIC1             6
 #define OPTYPE_DYADIC1              7
 
-
 /* Type 2 opcodes */
 
 #define OPTYPE_MONADIC2             8
 #define OPTYPE_DYADIC2              10
 #define OPTYPE_DYADIC2_r             11
 #define OPTYPE_DYADIC2_s             12
-#define OPTYPE_INDEX                13
-#define OPTYPE_MATCH                14
 
-/* Generic for an op that returns a value */
+/* Multi-operand (>=3) opcodes */
 
-#define OPTYPE_METHOD_CALL          15
+#define OPTYPE_TRIADIC              13
+#define OPTYPE_QUADRADIC            14
+#define OPTYPE_HEXADIC              15
+
+/* Generic for an op that returns a value */
 
+#define OPTYPE_METHOD_CALL          16
 
 /* Misc */
 
-#define OPTYPE_CREATE_FIELD         16
-#define OPTYPE_FATAL                17
+#define OPTYPE_CREATE_FIELD         17
 #define OPTYPE_CONTROL              18
 #define OPTYPE_RECONFIGURATION      19
 #define OPTYPE_NAMED_OBJECT         20
index 27656545f7005889669cab6c8717db58109287f8..623b1370b1bb40df9caf9b9f1a3c7b8a036fe7d1 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acenv.h - Generation environment specific items
- *       $Revision: 75 $
+ *       $Revision: 76 $
  *
  *****************************************************************************/
 
@@ -62,7 +62,7 @@
  */
 #ifdef ACPI_DEBUG
 #ifndef _IA16
-#define ACPI_DEBUG_TRACK_ALLOCATIONS
+#define ACPI_DBG_TRACK_ALLOCATIONS
 #endif
 #endif
 
index 8c62e903addf807ab169302de2cfae6a5d3ea27a..a6b62c9694bc165252a8e439e39b9155fb8a4cf9 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acgcc.h - GCC specific defines, etc.
- *       $Revision: 6 $
+ *       $Revision: 9 $
  *
  *****************************************************************************/
 
@@ -39,6 +39,7 @@
 #define BREAKPOINT3
 #define disable() __cli()
 #define enable()  __sti()
+#define wbinvd()
 
 /*! [Begin] no source code translation */
 
 #define disable() __cli()
 #define enable()  __sti()
 #define halt()    __asm__ __volatile__ ("sti; hlt":::"memory")
+#define wbinvd()  __asm__ __volatile__ ("wbinvd":::"memory")
 
 /*! [Begin] no source code translation
  *
diff --git a/drivers/acpi/kdb/README.txt b/drivers/acpi/kdb/README.txt
new file mode 100644 (file)
index 0000000..700c6b2
--- /dev/null
@@ -0,0 +1,36 @@
+Using the ACPI debugger with kdb
+--------------------------------
+
+ACPI CA includes a full-featured debugger, which allows the examination of
+a running system's ACPI tables, as well as running and stepping through
+control methods.
+
+Configuration
+-------------
+1) Edit the main acpi Makefile. On the ACPI_CFLAGS line, remove the '#', thus
+   enabling the debugger.
+
+2) Download the latest kdb patch from:
+
+   ftp://oss.sgi.com/www/projects/kdb/download/ix86/ 
+
+   Follow the instructions at http://oss.sgi.com/projects/kdb/ on how to
+   install the patch and configure KDB.
+
+3) This would probably be a good time to recompile the kernel, and make sure
+   kdb works (Hitting the Pause key should drop you into it. Type "go" to exit
+   it.
+
+4) The kdb <--> ACPI debugger interface is a module. Type "make modules", and
+   it will be built and placed in drivers/acpi/kdb.
+
+5) Change to that directory and type "insmod kdbm_acpi.o". This loads the
+   module we just built.
+
+6) Break back into kdb. If you type help, you should now see "acpi" listed as
+   a command, at the bottom.
+
+7) Type "acpi". You are now in the ACPI debugger. While hosted by kdb, it is
+   wholly separate, and has many ACPI-specific commands. Type "?" or "help"
+   to get a listing of the command categories, and then "help <category>" for
+   a list of commands and their descriptions
diff --git a/drivers/acpi/kdb/kdbm_acpi.c b/drivers/acpi/kdb/kdbm_acpi.c
new file mode 100644 (file)
index 0000000..e14ea39
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ *  kdbm_acpi.c - kdb debugger module interface for ACPI debugger
+ *
+ *  Copyright (C) 2000 Andrew Grover
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <linux/types.h>
+#include <linux/kdb.h>
+#include <linux/module.h>
+
+#include "acpi.h"
+#include "acdebug.h"
+
+extern int acpi_in_debugger;
+
+static int
+kdbm_acpi(int argc, const char **argv, const char **envp, struct pt_regs *regs)
+{
+       acpi_in_debugger = 1;
+
+       acpi_db_user_commands(DB_COMMAND_PROMPT, NULL);
+
+       acpi_in_debugger = 0;
+
+       return 0;
+}
+
+int
+init_module(void)
+{
+       kdb_register("acpi", kdbm_acpi, "", "Enter ACPI debugger", 0);
+
+       return 0;
+}
+
+void
+cleanup_module(void)
+{
+       kdb_unregister("acpi");
+}
index f53c2052a09b0ef255cea82bd64bf649c3f17ad3..548b96b45cf9d0dc5b8f05ae7231a89d3601a616 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: nsaccess - Top-level functions for accessing ACPI namespace
- *              $Revision: 126 $
+ *              $Revision: 133 $
  *
  ******************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_root_initialize (void)
 {
-       ACPI_STATUS             status = AE_OK;
-       PREDEFINED_NAMES        *init_val = NULL;
-       ACPI_NAMESPACE_NODE     *new_node;
-       ACPI_OPERAND_OBJECT     *obj_desc;
+       acpi_status             status = AE_OK;
+       const predefined_names  *init_val = NULL;
+       acpi_namespace_node     *new_node;
+       acpi_operand_object     *obj_desc;
+
+
+       FUNCTION_TRACE ("Ns_root_initialize");
 
 
        acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
@@ -64,7 +67,6 @@ acpi_ns_root_initialize (void)
         * The global root ptr is initially NULL, so a non-NULL value indicates
         * that Acpi_ns_root_initialize() has already been called; just return.
         */
-
        if (acpi_gbl_root_node) {
                status = AE_OK;
                goto unlock_and_exit;
@@ -75,30 +77,34 @@ acpi_ns_root_initialize (void)
         * Tell the rest of the subsystem that the root is initialized
         * (This is OK because the namespace is locked)
         */
-
        acpi_gbl_root_node = &acpi_gbl_root_node_struct;
 
 
        /* Enter the pre-defined names in the name table */
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Entering predefined entries into namespace\n"));
+
        for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) {
                status = acpi_ns_lookup (NULL, init_val->name, init_val->type,
                                 IMODE_LOAD_PASS2, NS_NO_UPSEARCH,
                                 NULL, &new_node);
 
+               if (ACPI_FAILURE (status) || (!new_node)) /* Must be on same line for code converter */ {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                               "Could not create predefined name %s, %s\n",
+                               init_val->name, acpi_format_exception (status)));
+               }
 
                /*
                 * Name entered successfully.
                 * If entry in Pre_defined_names[] specifies an
                 * initial value, create the initial value.
                 */
-
                if (init_val->val) {
                        /*
                         * Entry requests an initial value, allocate a
                         * descriptor for it.
                         */
-
                        obj_desc = acpi_ut_create_internal_object (init_val->type);
                        if (!obj_desc) {
                                status = AE_NO_MEMORY;
@@ -116,28 +122,18 @@ acpi_ns_root_initialize (void)
                        case ACPI_TYPE_INTEGER:
 
                                obj_desc->integer.value =
-                                               (ACPI_INTEGER) STRTOUL (init_val->val, NULL, 10);
+                                               (acpi_integer) STRTOUL (init_val->val, NULL, 10);
                                break;
 
 
                        case ACPI_TYPE_STRING:
 
-                               obj_desc->string.length = STRLEN (init_val->val);
-
                                /*
-                                * Allocate a buffer for the string.  All
-                                * String.Pointers must be allocated buffers!
-                                * (makes deletion simpler)
+                                * Build an object around the static string
                                 */
-                               obj_desc->string.pointer = acpi_ut_allocate (
-                                                  (obj_desc->string.length + 1));
-                               if (!obj_desc->string.pointer) {
-                                       acpi_ut_remove_reference (obj_desc);
-                                       status = AE_NO_MEMORY;
-                                       goto unlock_and_exit;
-                               }
-
-                               STRCPY (obj_desc->string.pointer, init_val->val);
+                               obj_desc->string.length = STRLEN (init_val->val);
+                               obj_desc->string.pointer = init_val->val;
+                               obj_desc->common.flags |= AOPOBJ_STATIC_POINTER;
                                break;
 
 
@@ -157,11 +153,11 @@ acpi_ns_root_initialize (void)
                                        if (ACPI_FAILURE (status)) {
                                                goto unlock_and_exit;
                                        }
+
                                        /*
                                         * We just created the mutex for the
                                         * global lock, save it
                                         */
-
                                        acpi_gbl_global_lock_semaphore = obj_desc->mutex.semaphore;
                                }
 
@@ -195,7 +191,7 @@ acpi_ns_root_initialize (void)
 
 unlock_and_exit:
        acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -222,31 +218,36 @@ unlock_and_exit:
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_lookup (
-       ACPI_GENERIC_STATE      *scope_info,
+       acpi_generic_state      *scope_info,
        NATIVE_CHAR             *pathname,
-       ACPI_OBJECT_TYPE8       type,
-       OPERATING_MODE          interpreter_mode,
+       acpi_object_type8       type,
+       operating_mode          interpreter_mode,
        u32                     flags,
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_NAMESPACE_NODE     **return_node)
+       acpi_walk_state         *walk_state,
+       acpi_namespace_node     **return_node)
 {
-       ACPI_STATUS             status;
-       ACPI_NAMESPACE_NODE     *prefix_node;
-       ACPI_NAMESPACE_NODE     *current_node = NULL;
-       ACPI_NAMESPACE_NODE     *scope_to_push = NULL;
-       ACPI_NAMESPACE_NODE     *this_node = NULL;
+       acpi_status             status;
+       acpi_namespace_node     *prefix_node;
+       acpi_namespace_node     *current_node = NULL;
+       acpi_namespace_node     *scope_to_push = NULL;
+       acpi_namespace_node     *this_node = NULL;
        u32                     num_segments;
-       ACPI_NAME               simple_name;
+       acpi_name               simple_name;
        u8                      null_name_path = FALSE;
-       ACPI_OBJECT_TYPE8       type_to_check_for;
-       ACPI_OBJECT_TYPE8       this_search_type;
+       acpi_object_type8       type_to_check_for;
+       acpi_object_type8       this_search_type;
        u32                     local_flags = flags & ~NS_ERROR_IF_FOUND;
 
+       DEBUG_EXEC              (u32 i;)
+
+
+       FUNCTION_TRACE ("Ns_lookup");
+
 
        if (!return_node) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
 
@@ -263,9 +264,11 @@ acpi_ns_lookup (
         * Get the prefix scope.
         * A null scope means use the root scope
         */
-
        if ((!scope_info) ||
                (!scope_info->scope.node)) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Null scope prefix, using root node (%p)\n",
+                       acpi_gbl_root_node));
+
                prefix_node = acpi_gbl_root_node;
        }
        else {
@@ -280,7 +283,6 @@ acpi_ns_lookup (
         * but the Bank_field_defn may also check for a Field definition as well
         * as an Operation_region.
         */
-
        if (INTERNAL_TYPE_FIELD_DEFN == type) {
                /* Def_field_defn defines fields in a Region */
 
@@ -309,6 +311,8 @@ acpi_ns_lookup (
                num_segments = 0;
                this_node = acpi_gbl_root_node;
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+                       "Null Pathname (Zero segments),  Flags=%x\n", flags));
        }
 
        else {
@@ -330,7 +334,6 @@ acpi_ns_lookup (
                 *  - A Multi_name_prefix_op, followed by a byte indicating the
                 *    number of segments and the segments themselves.
                 */
-
                if (*pathname == AML_ROOT_PREFIX) {
                        /* Pathname is fully qualified, look in root name table */
 
@@ -340,6 +343,9 @@ acpi_ns_lookup (
 
                        pathname++;
 
+                       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching from root [%p]\n",
+                               current_node));
+
                        /* Direct reference to root, "\" */
 
                        if (!(*pathname)) {
@@ -353,11 +359,13 @@ acpi_ns_lookup (
 
                        current_node = prefix_node;
 
+                       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching relative to pfx scope [%p]\n",
+                               prefix_node));
+
                        /*
                         * Handle up-prefix (carat).  More than one prefix
                         * is supported
                         */
-
                        while (*pathname == AML_PARENT_PREFIX) {
                                /* Point to segment part or next Parent_prefix */
 
@@ -371,7 +379,7 @@ acpi_ns_lookup (
 
                                        REPORT_ERROR (
                                                ("Too many parent prefixes (^) - reached root\n"));
-                                       return (AE_NOT_FOUND);
+                                       return_ACPI_STATUS (AE_NOT_FOUND);
                                }
 
                                current_node = this_node;
@@ -383,7 +391,6 @@ acpi_ns_lookup (
                 * Examine the name prefix opcode, if any,
                 * to determine the number of segments
                 */
-
                if (*pathname == AML_DUAL_NAME_PREFIX) {
                        num_segments = 2;
 
@@ -391,6 +398,8 @@ acpi_ns_lookup (
 
                        pathname++;
 
+                       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+                               "Dual Pathname (2 segments, Flags=%X)\n", flags));
                }
 
                else if (*pathname == AML_MULTI_NAME_PREFIX_OP) {
@@ -400,6 +409,9 @@ acpi_ns_lookup (
 
                        pathname++;
 
+                       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+                               "Multi Pathname (%d Segments, Flags=%X) \n",
+                               num_segments, flags));
                }
 
                else {
@@ -409,8 +421,23 @@ acpi_ns_lookup (
                         */
                        num_segments = 1;
 
+                       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+                               "Simple Pathname (1 segment, Flags=%X)\n", flags));
                }
 
+#ifdef ACPI_DEBUG
+
+               /* TBD: [Restructure] Make this a procedure */
+
+               /* Debug only: print the entire name that we are about to lookup */
+
+               ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "["));
+
+               for (i = 0; i < num_segments; i++) {
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_NAMES, "%4.4s/", &pathname[i * 4]));
+               }
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_NAMES, "]\n"));
+#endif
        }
 
 
@@ -418,8 +445,6 @@ acpi_ns_lookup (
         * Search namespace for each segment of the name.
         * Loop through and verify/add each name segment.
         */
-
-
        while (num_segments-- && current_node) {
                /*
                 * Search for the current name segment under the current
@@ -448,9 +473,12 @@ acpi_ns_lookup (
                        if (status == AE_NOT_FOUND) {
                                /* Name not found in ACPI namespace  */
 
+                               ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+                                       "Name [%4.4s] not found in scope %X\n",
+                                       &simple_name, current_node));
                        }
 
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
 
 
@@ -487,7 +515,6 @@ acpi_ns_lookup (
                 * specific type, but the type of found object is known, use that type
                 * to see if it opens a scope.
                 */
-
                if ((0 == num_segments) && (ACPI_TYPE_ANY == type)) {
                        type = this_node->type;
                }
@@ -498,7 +525,8 @@ acpi_ns_lookup (
                         * More segments or the type implies enclosed scope,
                         * and the next scope has not been allocated.
                         */
-
+                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Load mode=%X  This_node=%X\n",
+                               interpreter_mode, this_node));
                }
 
                current_node = this_node;
@@ -512,7 +540,6 @@ acpi_ns_lookup (
        /*
         * Always check if we need to open a new scope
         */
-
 check_for_new_scope_and_exit:
 
        if (!(flags & NS_DONT_OPEN_SCOPE) && (walk_state)) {
@@ -520,7 +547,6 @@ check_for_new_scope_and_exit:
                 * If entry is a type which opens a scope,
                 * push the new scope on the scope stack.
                 */
-
                if (acpi_ns_opens_scope (type_to_check_for)) {
                        /*  8-12-98 ASL Grammar Update supports null Name_path  */
 
@@ -536,13 +562,14 @@ check_for_new_scope_and_exit:
                        status = acpi_ds_scope_stack_push (scope_to_push, type,
                                           walk_state);
                        if (ACPI_FAILURE (status)) {
-                               return (status);
+                               return_ACPI_STATUS (status);
                        }
 
+                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Set global scope to %p\n", scope_to_push));
                }
        }
 
        *return_node = this_node;
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
index 72a9e9472a70095c4cd633acf3ea08c02283c9ff..1600b0e57bfa462c07cbd440d0cf0ea648e4d492 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: nsalloc - Namespace allocation and deletion utilities
- *              $Revision: 50 $
+ *              $Revision: 56 $
  *
  ******************************************************************************/
 
  *
  * FUNCTION:    Acpi_ns_create_node
  *
- * PARAMETERS:
+ * PARAMETERS:  Acpi_name       - Name of the new node
  *
  * RETURN:      None
  *
- * DESCRIPTION:
+ * DESCRIPTION: Create a namespace node
  *
  ******************************************************************************/
 
-ACPI_NAMESPACE_NODE *
+acpi_namespace_node *
 acpi_ns_create_node (
-       u32                     acpi_name)
+       u32                     name)
 {
-       ACPI_NAMESPACE_NODE     *node;
+       acpi_namespace_node     *node;
 
 
-       node = acpi_ut_callocate (sizeof (ACPI_NAMESPACE_NODE));
+       FUNCTION_TRACE ("Ns_create_node");
+
+
+       node = ACPI_MEM_CALLOCATE (sizeof (acpi_namespace_node));
        if (!node) {
-               return (NULL);
+               return_PTR (NULL);
        }
 
-       INCREMENT_NAME_TABLE_METRICS (sizeof (ACPI_NAMESPACE_NODE));
+       ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_allocated++);
 
        node->data_type      = ACPI_DESC_TYPE_NAMED;
-       node->name           = acpi_name;
+       node->name           = name;
        node->reference_count = 1;
 
-       return (node);
+       return_PTR (node);
 }
 
 
@@ -71,21 +74,24 @@ acpi_ns_create_node (
  *
  * FUNCTION:    Acpi_ns_delete_node
  *
- * PARAMETERS:
+ * PARAMETERS:  Node            - Node to be deleted
  *
  * RETURN:      None
  *
- * DESCRIPTION:
+ * DESCRIPTION: Delete a namespace node
  *
  ******************************************************************************/
 
 void
 acpi_ns_delete_node (
-       ACPI_NAMESPACE_NODE     *node)
+       acpi_namespace_node     *node)
 {
-       ACPI_NAMESPACE_NODE     *parent_node;
-       ACPI_NAMESPACE_NODE     *prev_node;
-       ACPI_NAMESPACE_NODE     *next_node;
+       acpi_namespace_node     *parent_node;
+       acpi_namespace_node     *prev_node;
+       acpi_namespace_node     *next_node;
+
+
+       FUNCTION_TRACE_PTR ("Ns_delete_node", node);
 
 
        parent_node = acpi_ns_get_parent_object (node);
@@ -109,20 +115,17 @@ acpi_ns_delete_node (
        }
 
 
-       DECREMENT_NAME_TABLE_METRICS (sizeof (ACPI_NAMESPACE_NODE));
+       ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_freed++);
 
        /*
         * Detach an object if there is one
         */
-
        if (node->object) {
                acpi_ns_detach_object (node);
        }
 
-       acpi_ut_free (node);
-
-
-       return;
+       ACPI_MEM_FREE (node);
+       return_VOID;
 }
 
 
@@ -132,7 +135,7 @@ acpi_ns_delete_node (
  *
  * PARAMETERS:  Walk_state      - Current state of the walk
  *              Parent_node     - The parent of the new Node
- *              Node        - The new Node to install
+ *              Node            - The new Node to install
  *              Type            - ACPI object type of the new Node
  *
  * RETURN:      None
@@ -143,13 +146,16 @@ acpi_ns_delete_node (
 
 void
 acpi_ns_install_node (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_NAMESPACE_NODE     *parent_node,   /* Parent */
-       ACPI_NAMESPACE_NODE     *node,      /* New Child*/
-       ACPI_OBJECT_TYPE8       type)
+       acpi_walk_state         *walk_state,
+       acpi_namespace_node     *parent_node,   /* Parent */
+       acpi_namespace_node     *node,          /* New Child*/
+       acpi_object_type8       type)
 {
        u16                     owner_id = TABLE_ID_DSDT;
-       ACPI_NAMESPACE_NODE     *child_node;
+       acpi_namespace_node     *child_node;
+
+
+       FUNCTION_TRACE ("Ns_install_node");
 
 
        /*
@@ -203,6 +209,8 @@ acpi_ns_install_node (
                 * We will fill in the actual type when the
                 * real definition is found later.
                 */
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "[%4.4s] is a forward reference\n",
+                       &node->name));
        }
 
        /*
@@ -226,6 +234,9 @@ acpi_ns_install_node (
                node->type = (u8) type;
        }
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%4.4s added to %p at %p\n",
+               &node->name, parent_node, node));
+
        /*
         * Increment the reference count(s) of all parents up to
         * the root!
@@ -234,7 +245,7 @@ acpi_ns_install_node (
                node->reference_count++;
        }
 
-       return;
+       return_VOID;
 }
 
 
@@ -253,22 +264,25 @@ acpi_ns_install_node (
 
 void
 acpi_ns_delete_children (
-       ACPI_NAMESPACE_NODE     *parent_node)
+       acpi_namespace_node     *parent_node)
 {
-       ACPI_NAMESPACE_NODE     *child_node;
-       ACPI_NAMESPACE_NODE     *next_node;
+       acpi_namespace_node     *child_node;
+       acpi_namespace_node     *next_node;
        u8                      flags;
 
 
+       FUNCTION_TRACE_PTR ("Ns_delete_children", parent_node);
+
+
        if (!parent_node) {
-               return;
+               return_VOID;
        }
 
        /* If no children, all done! */
 
        child_node = parent_node->child;
        if (!child_node) {
-               return;
+               return_VOID;
        }
 
        /*
@@ -282,20 +296,26 @@ acpi_ns_delete_children (
 
                /* Grandchildren should have all been deleted already */
 
+               if (child_node->child) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Found a grandchild! P=%X C=%X\n",
+                               parent_node, child_node));
+               }
 
                /* Now we can free this child object */
 
-               DECREMENT_NAME_TABLE_METRICS (sizeof (ACPI_NAMESPACE_NODE));
+               ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_freed++);
+
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Object %p, Remaining %X\n",
+                       child_node, acpi_gbl_current_node_count));
 
                /*
                 * Detach an object if there is one
                 */
-
                if (child_node->object) {
                        acpi_ns_detach_object (child_node);
                }
 
-               acpi_ut_free (child_node);
+               ACPI_MEM_FREE (child_node);
 
                /* And move on to the next child in the list */
 
@@ -308,7 +328,7 @@ acpi_ns_delete_children (
 
        parent_node->child = NULL;
 
-       return;
+       return_VOID;
 }
 
 
@@ -316,7 +336,7 @@ acpi_ns_delete_children (
  *
  * FUNCTION:    Acpi_ns_delete_namespace_subtree
  *
- * PARAMETERS:  None.
+ * PARAMETERS:  Parent_node     - Root of the subtree to be deleted
  *
  * RETURN:      None.
  *
@@ -325,17 +345,20 @@ acpi_ns_delete_children (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_delete_namespace_subtree (
-       ACPI_NAMESPACE_NODE     *parent_node)
+       acpi_namespace_node     *parent_node)
 {
-       ACPI_NAMESPACE_NODE     *child_node;
-       ACPI_OPERAND_OBJECT     *obj_desc;
+       acpi_namespace_node     *child_node;
+       acpi_operand_object     *obj_desc;
        u32                     level;
 
 
+       FUNCTION_TRACE ("Ns_delete_namespace_subtree");
+
+
        if (!parent_node) {
-               return (AE_OK);
+               return_ACPI_STATUS (AE_OK);
        }
 
 
@@ -346,13 +369,11 @@ acpi_ns_delete_namespace_subtree (
         * Traverse the tree of objects until we bubble back up
         * to where we started.
         */
-
        while (level > 0) {
                /*
                 * Get the next typed object in this scope.
                 * Null returned if not found
                 */
-
                child_node = acpi_ns_get_next_object (ACPI_TYPE_ANY, parent_node,
                                 child_node);
                if (child_node) {
@@ -360,7 +381,6 @@ acpi_ns_delete_namespace_subtree (
                         * Found an object - delete the object within
                         * the Value field
                         */
-
                        obj_desc = acpi_ns_get_attached_object (child_node);
                        if (obj_desc) {
                                acpi_ns_detach_object (child_node);
@@ -375,7 +395,6 @@ acpi_ns_delete_namespace_subtree (
                                 * There is at least one child of this object,
                                 * visit the object
                                 */
-
                                level++;
                                parent_node   = child_node;
                                child_node    = 0;
@@ -406,7 +425,7 @@ acpi_ns_delete_namespace_subtree (
        }
 
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -415,7 +434,7 @@ acpi_ns_delete_namespace_subtree (
  * FUNCTION:    Acpi_ns_remove_reference
  *
  * PARAMETERS:  Node           - Named object whose reference count is to be
- *                                decremented
+ *                               decremented
  *
  * RETURN:      None.
  *
@@ -427,9 +446,12 @@ acpi_ns_delete_namespace_subtree (
 
 static void
 acpi_ns_remove_reference (
-       ACPI_NAMESPACE_NODE     *node)
+       acpi_namespace_node     *node)
 {
-       ACPI_NAMESPACE_NODE     *next_node;
+       acpi_namespace_node     *next_node;
+
+
+       FUNCTION_ENTRY ();
 
 
        /*
@@ -462,9 +484,9 @@ acpi_ns_remove_reference (
  *
  * FUNCTION:    Acpi_ns_delete_namespace_by_owner
  *
- * PARAMETERS:  None.
+ * PARAMETERS:  Owner_id    - All nodes with this owner will be deleted
  *
- * RETURN:      None.
+ * RETURN:      Status
  *
  * DESCRIPTION: Delete entries within the namespace that are owned by a
  *              specific ID.  Used to delete entire ACPI tables.  All
@@ -472,14 +494,17 @@ acpi_ns_remove_reference (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_delete_namespace_by_owner (
        u16                     owner_id)
 {
-       ACPI_NAMESPACE_NODE     *child_node;
+       acpi_namespace_node     *child_node;
        u32                     level;
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_NAMESPACE_NODE     *parent_node;
+       acpi_operand_object     *obj_desc;
+       acpi_namespace_node     *parent_node;
+
+
+       FUNCTION_TRACE ("Ns_delete_namespace_by_owner");
 
 
        parent_node = acpi_gbl_root_node;
@@ -490,13 +515,11 @@ acpi_ns_delete_namespace_by_owner (
         * Traverse the tree of objects until we bubble back up
         * to where we started.
         */
-
        while (level > 0) {
                /*
                 * Get the next typed object in this scope.
                 * Null returned if not found
                 */
-
                child_node = acpi_ns_get_next_object (ACPI_TYPE_ANY, parent_node,
                                 child_node);
 
@@ -506,7 +529,6 @@ acpi_ns_delete_namespace_by_owner (
                                 * Found an object - delete the object within
                                 * the Value field
                                 */
-
                                obj_desc = acpi_ns_get_attached_object (child_node);
                                if (obj_desc) {
                                        acpi_ns_detach_object (child_node);
@@ -555,7 +577,7 @@ acpi_ns_delete_namespace_by_owner (
        }
 
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
diff --git a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c
new file mode 100644 (file)
index 0000000..daa4dbe
--- /dev/null
@@ -0,0 +1,561 @@
+/******************************************************************************
+ *
+ * Module Name: nsdump - table dumping routines for debug
+ *              $Revision: 99 $
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000, 2001 R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "acpi.h"
+#include "acinterp.h"
+#include "acnamesp.h"
+#include "actables.h"
+
+
+#define _COMPONENT          ACPI_NAMESPACE
+        MODULE_NAME         ("nsdump")
+
+
+#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER)
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ns_dump_pathname
+ *
+ * PARAMETERS:  Handle              - Object
+ *              Msg                 - Prefix message
+ *              Level               - Desired debug level
+ *              Component           - Caller's component ID
+ *
+ * DESCRIPTION: Print an object's full namespace pathname
+ *              Manages allocation/freeing of a pathname buffer
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ns_dump_pathname (
+       acpi_handle             handle,
+       NATIVE_CHAR             *msg,
+       u32                     level,
+       u32                     component)
+{
+       NATIVE_CHAR             *buffer;
+       u32                     length;
+
+
+       FUNCTION_TRACE ("Ns_dump_pathname");
+
+
+       /* Do this only if the requested debug level and component are enabled */
+
+       if (!(acpi_dbg_level & level) || !(acpi_dbg_layer & component)) {
+               return_ACPI_STATUS (AE_OK);
+       }
+
+       buffer = ACPI_MEM_ALLOCATE (PATHNAME_MAX);
+       if (!buffer) {
+               return_ACPI_STATUS (AE_NO_MEMORY);
+       }
+
+       /* Convert handle to a full pathname and print it (with supplied message) */
+
+       length = PATHNAME_MAX;
+       if (ACPI_SUCCESS (acpi_ns_handle_to_pathname (handle, &length, buffer))) {
+               acpi_os_printf ("%s %s (%p)\n", msg, buffer, handle);
+       }
+
+       ACPI_MEM_FREE (buffer);
+
+       return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ns_dump_one_object
+ *
+ * PARAMETERS:  Handle              - Node to be dumped
+ *              Level               - Nesting level of the handle
+ *              Context             - Passed into Walk_namespace
+ *
+ * DESCRIPTION: Dump a single Node
+ *              This procedure is a User_function called by Acpi_ns_walk_namespace.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ns_dump_one_object (
+       acpi_handle             obj_handle,
+       u32                     level,
+       void                    *context,
+       void                    **return_value)
+{
+       ACPI_WALK_INFO          *info = (ACPI_WALK_INFO *) context;
+       acpi_namespace_node     *this_node;
+       u8                      *value;
+       acpi_operand_object     *obj_desc = NULL;
+       acpi_object_type8       obj_type;
+       acpi_object_type8       type;
+       u32                     bytes_to_dump;
+       u32                     downstream_sibling_mask = 0;
+       u32                     level_tmp;
+       u32                     which_bit;
+
+
+       PROC_NAME ("Ns_dump_one_object");
+
+
+       this_node = acpi_ns_convert_handle_to_entry (obj_handle);
+
+       level_tmp   = level;
+       type        = this_node->type;
+       which_bit   = 1;
+
+
+       if (!(acpi_dbg_level & info->debug_level)) {
+               return (AE_OK);
+       }
+
+       if (!obj_handle) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n"));
+               return (AE_OK);
+       }
+
+       /* Check if the owner matches */
+
+       if ((info->owner_id != ACPI_UINT32_MAX) &&
+               (info->owner_id != this_node->owner_id)) {
+               return (AE_OK);
+       }
+
+
+       /* Indent the object according to the level */
+
+       while (level_tmp--) {
+
+               /* Print appropriate characters to form tree structure */
+
+               if (level_tmp) {
+                       if (downstream_sibling_mask & which_bit) {
+                               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "|"));
+                       }
+
+                       else {
+                               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " "));
+                       }
+
+                       which_bit <<= 1;
+               }
+
+               else {
+                       if (acpi_ns_exist_downstream_sibling (this_node + 1)) {
+                               downstream_sibling_mask |= (1 << (level - 1));
+                               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "+"));
+                       }
+
+                       else {
+                               downstream_sibling_mask &= ACPI_UINT32_MAX ^ (1 << (level - 1));
+                               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "+"));
+                       }
+
+                       if (this_node->child == NULL) {
+                               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "-"));
+                       }
+
+                       else if (acpi_ns_exist_downstream_sibling (this_node->child)) {
+                               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "+"));
+                       }
+
+                       else {
+                               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "-"));
+                       }
+               }
+       }
+
+
+       /* Check the integrity of our data */
+
+       if (type > INTERNAL_TYPE_MAX) {
+               type = INTERNAL_TYPE_DEF_ANY;                                /* prints as *ERROR* */
+       }
+
+       if (!acpi_ut_valid_acpi_name (this_node->name)) {
+               REPORT_WARNING (("Invalid ACPI Name %08X\n", this_node->name));
+       }
+
+       /*
+        * Now we can print out the pertinent information
+        */
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " %4.4s %-9s ", &this_node->name, acpi_ut_get_type_name (type)));
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "%p S:%p O:%p",  this_node, this_node->child, this_node->object));
+
+
+       if (!this_node->object) {
+               /* No attached object, we are done */
+
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n"));
+               return (AE_OK);
+       }
+
+       switch (type) {
+
+       case ACPI_TYPE_METHOD:
+
+               /* Name is a Method and its AML offset/length are set */
+
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " M:%p-%X\n",
+                                ((acpi_operand_object  *) this_node->object)->method.pcode,
+                                ((acpi_operand_object  *) this_node->object)->method.pcode_length));
+
+               break;
+
+
+       case ACPI_TYPE_INTEGER:
+
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " N:%X\n",
+                                ((acpi_operand_object  *) this_node->object)->integer.value));
+               break;
+
+
+       case ACPI_TYPE_STRING:
+
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " S:%p-%X\n",
+                                ((acpi_operand_object  *) this_node->object)->string.pointer,
+                                ((acpi_operand_object  *) this_node->object)->string.length));
+               break;
+
+
+       case ACPI_TYPE_BUFFER:
+
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " B:%p-%X\n",
+                                ((acpi_operand_object  *) this_node->object)->buffer.pointer,
+                                ((acpi_operand_object  *) this_node->object)->buffer.length));
+               break;
+
+
+       default:
+
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n"));
+               break;
+       }
+
+       /* If debug turned off, done */
+
+       if (!(acpi_dbg_level & ACPI_LV_VALUES)) {
+               return (AE_OK);
+       }
+
+
+       /* If there is an attached object, display it */
+
+       value = this_node->object;
+
+       /* Dump attached objects */
+
+       while (value) {
+               obj_type = INTERNAL_TYPE_INVALID;
+
+               /* Decode the type of attached object and dump the contents */
+
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "        Attached Object %p: ", value));
+
+               if (acpi_tb_system_table_pointer (value)) {
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(Ptr to AML Code)\n"));
+                       bytes_to_dump = 16;
+               }
+
+               else if (VALID_DESCRIPTOR_TYPE (value, ACPI_DESC_TYPE_NAMED)) {
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(Ptr to Node)\n"));
+                       bytes_to_dump = sizeof (acpi_namespace_node);
+               }
+
+
+               else if (VALID_DESCRIPTOR_TYPE (value, ACPI_DESC_TYPE_INTERNAL)) {
+                       obj_desc = (acpi_operand_object *) value;
+                       obj_type = obj_desc->common.type;
+
+                       if (obj_type > INTERNAL_TYPE_MAX) {
+                               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(Ptr to ACPI Object type %X [UNKNOWN])\n", obj_type));
+                               bytes_to_dump = 32;
+                       }
+
+                       else {
+                               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(Ptr to ACPI Object type %X [%s])\n",
+                                                  obj_type, acpi_ut_get_type_name (obj_type)));
+                               bytes_to_dump = sizeof (acpi_operand_object);
+                       }
+               }
+
+               else {
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(String or Buffer - not descriptor)\n", value));
+                       bytes_to_dump = 16;
+               }
+
+               DUMP_BUFFER (value, bytes_to_dump);
+
+               /* If value is NOT an internal object, we are done */
+
+               if ((acpi_tb_system_table_pointer (value)) ||
+                       (VALID_DESCRIPTOR_TYPE (value, ACPI_DESC_TYPE_NAMED))) {
+                       goto cleanup;
+               }
+
+               /*
+                * Valid object, get the pointer to next level, if any
+                */
+               switch (obj_type) {
+               case ACPI_TYPE_STRING:
+                       value = (u8 *) obj_desc->string.pointer;
+                       break;
+
+               case ACPI_TYPE_BUFFER:
+                       value = (u8 *) obj_desc->buffer.pointer;
+                       break;
+
+               case ACPI_TYPE_BUFFER_FIELD:
+                       value = (u8 *) obj_desc->buffer_field.buffer_obj;
+                       break;
+
+               case ACPI_TYPE_PACKAGE:
+                       value = (u8 *) obj_desc->package.elements;
+                       break;
+
+               case ACPI_TYPE_METHOD:
+                       value = (u8 *) obj_desc->method.pcode;
+                       break;
+
+               case INTERNAL_TYPE_REGION_FIELD:
+                       value = (u8 *) obj_desc->field.region_obj;
+                       break;
+
+               case INTERNAL_TYPE_BANK_FIELD:
+                       value = (u8 *) obj_desc->bank_field.region_obj;
+                       break;
+
+               case INTERNAL_TYPE_INDEX_FIELD:
+                       value = (u8 *) obj_desc->index_field.index_obj;
+                       break;
+
+          default:
+                       goto cleanup;
+               }
+
+               obj_type = INTERNAL_TYPE_INVALID;    /* Terminate loop after next pass */
+       }
+
+cleanup:
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n"));
+       return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ns_dump_objects
+ *
+ * PARAMETERS:  Type                - Object type to be dumped
+ *              Max_depth           - Maximum depth of dump.  Use ACPI_UINT32_MAX
+ *                                    for an effectively unlimited depth.
+ *              Owner_id            - Dump only objects owned by this ID.  Use
+ *                                    ACPI_UINT32_MAX to match all owners.
+ *              Start_handle        - Where in namespace to start/end search
+ *
+ * DESCRIPTION: Dump typed objects within the loaded namespace.
+ *              Uses Acpi_ns_walk_namespace in conjunction with Acpi_ns_dump_one_object.
+ *
+ ******************************************************************************/
+
+void
+acpi_ns_dump_objects (
+       acpi_object_type8       type,
+       u32                     max_depth,
+       u32                     owner_id,
+       acpi_handle             start_handle)
+{
+       ACPI_WALK_INFO          info;
+
+
+       FUNCTION_ENTRY ();
+
+
+       info.debug_level = ACPI_LV_TABLES;
+       info.owner_id = owner_id;
+
+       acpi_ns_walk_namespace (type, start_handle, max_depth, NS_WALK_NO_UNLOCK, acpi_ns_dump_one_object,
+                          (void *) &info, NULL);
+}
+
+
+#ifndef _ACPI_ASL_COMPILER
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ns_dump_one_device
+ *
+ * PARAMETERS:  Handle              - Node to be dumped
+ *              Level               - Nesting level of the handle
+ *              Context             - Passed into Walk_namespace
+ *
+ * DESCRIPTION: Dump a single Node that represents a device
+ *              This procedure is a User_function called by Acpi_ns_walk_namespace.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ns_dump_one_device (
+       acpi_handle             obj_handle,
+       u32                     level,
+       void                    *context,
+       void                    **return_value)
+{
+       acpi_device_info        info;
+       acpi_status             status;
+       u32                     i;
+
+
+       PROC_NAME ("Ns_dump_one_device");
+
+
+       status = acpi_ns_dump_one_object (obj_handle, level, context, return_value);
+
+       status = acpi_get_object_info (obj_handle, &info);
+       if (ACPI_SUCCESS (status)) {
+               for (i = 0; i < level; i++) {
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " "));
+               }
+
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "    HID: %.8X, ADR: %.8X, Status: %x\n",
+                                 info.hardware_id, info.address, info.current_status));
+       }
+
+       return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ns_dump_root_devices
+ *
+ * PARAMETERS:  None
+ *
+ * DESCRIPTION: Dump all objects of type "device"
+ *
+ ******************************************************************************/
+
+void
+acpi_ns_dump_root_devices (void)
+{
+       acpi_handle             sys_bus_handle;
+
+
+       PROC_NAME ("Ns_dump_root_devices");
+
+
+       /* Only dump the table if tracing is enabled */
+
+       if (!(ACPI_LV_TABLES & acpi_dbg_level)) {
+               return;
+       }
+
+       acpi_get_handle (0, NS_SYSTEM_BUS, &sys_bus_handle);
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Display of all devices in the namespace:\n"));
+       acpi_ns_walk_namespace (ACPI_TYPE_DEVICE, sys_bus_handle, ACPI_UINT32_MAX, NS_WALK_NO_UNLOCK,
+                          acpi_ns_dump_one_device, NULL, NULL);
+}
+
+#endif
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ns_dump_tables
+ *
+ * PARAMETERS:  Search_base         - Root of subtree to be dumped, or
+ *                                    NS_ALL to dump the entire namespace
+ *              Max_depth           - Maximum depth of dump.  Use INT_MAX
+ *                                    for an effectively unlimited depth.
+ *
+ * DESCRIPTION: Dump the name space, or a portion of it.
+ *
+ ******************************************************************************/
+
+void
+acpi_ns_dump_tables (
+       acpi_handle             search_base,
+       u32                     max_depth)
+{
+       acpi_handle             search_handle = search_base;
+
+
+       FUNCTION_TRACE ("Ns_dump_tables");
+
+
+       if (!acpi_gbl_root_node) {
+               /*
+                * If the name space has not been initialized,
+                * there is nothing to dump.
+                */
+               ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "name space not initialized!\n"));
+               return_VOID;
+       }
+
+       if (NS_ALL == search_base) {
+               /*  entire namespace    */
+
+               search_handle = acpi_gbl_root_node;
+               ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n"));
+       }
+
+
+       acpi_ns_dump_objects (ACPI_TYPE_ANY, max_depth, ACPI_UINT32_MAX, search_handle);
+       return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ns_dump_entry
+ *
+ * PARAMETERS:  Handle              - Node to be dumped
+ *              Debug_level         - Output level
+ *
+ * DESCRIPTION: Dump a single Node
+ *
+ ******************************************************************************/
+
+void
+acpi_ns_dump_entry (
+       acpi_handle             handle,
+       u32                     debug_level)
+{
+       ACPI_WALK_INFO          info;
+
+
+       FUNCTION_ENTRY ();
+
+
+       info.debug_level = debug_level;
+       info.owner_id = ACPI_UINT32_MAX;
+
+       acpi_ns_dump_one_object (handle, 1, &info, NULL);
+}
+
+#endif
+
index d7ea258537fb6f613bf5c0e41cef6ccc0f46e728..0ae2c71b2dcef0e0eda8e20a30af9057622e387f 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Module Name: nseval - Object evaluation interfaces -- includes control
  *                       method lookup and execution.
- *              $Revision: 91 $
+ *              $Revision: 97 $
  *
  ******************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_evaluate_relative (
-       ACPI_NAMESPACE_NODE     *handle,
+       acpi_namespace_node     *handle,
        NATIVE_CHAR             *pathname,
-       ACPI_OPERAND_OBJECT     **params,
-       ACPI_OPERAND_OBJECT     **return_object)
+       acpi_operand_object     **params,
+       acpi_operand_object     **return_object)
 {
-       ACPI_NAMESPACE_NODE     *prefix_node;
-       ACPI_STATUS             status;
-       ACPI_NAMESPACE_NODE     *node = NULL;
+       acpi_namespace_node     *prefix_node;
+       acpi_status             status;
+       acpi_namespace_node     *node = NULL;
        NATIVE_CHAR             *internal_path = NULL;
-       ACPI_GENERIC_STATE      scope_info;
+       acpi_generic_state      scope_info;
+
+
+       FUNCTION_TRACE ("Ns_evaluate_relative");
 
 
        /*
         * Must have a valid object handle
         */
        if (!handle) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        /* Build an internal name string for the method */
 
        status = acpi_ns_internalize_name (pathname, &internal_path);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Get the prefix handle and Node */
@@ -107,6 +110,8 @@ acpi_ns_evaluate_relative (
        acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 
        if (ACPI_FAILURE (status)) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Object [%s] not found [%s]\n",
+                       pathname, acpi_format_exception (status)));
                goto cleanup;
        }
 
@@ -114,13 +119,18 @@ acpi_ns_evaluate_relative (
         * Now that we have a handle to the object, we can attempt
         * to evaluate it.
         */
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s [%p] Value %p\n",
+               pathname, node, node->object));
 
        status = acpi_ns_evaluate_by_handle (node, params, return_object);
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "*** Completed eval of object %s ***\n",
+               pathname));
+
 cleanup:
 
-       acpi_ut_free (internal_path);
-       return (status);
+       ACPI_MEM_FREE (internal_path);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -144,22 +154,25 @@ cleanup:
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_evaluate_by_name (
        NATIVE_CHAR             *pathname,
-       ACPI_OPERAND_OBJECT     **params,
-       ACPI_OPERAND_OBJECT     **return_object)
+       acpi_operand_object     **params,
+       acpi_operand_object     **return_object)
 {
-       ACPI_STATUS             status;
-       ACPI_NAMESPACE_NODE     *node = NULL;
+       acpi_status             status;
+       acpi_namespace_node     *node = NULL;
        NATIVE_CHAR             *internal_path = NULL;
 
 
+       FUNCTION_TRACE ("Ns_evaluate_by_name");
+
+
        /* Build an internal name string for the method */
 
        status = acpi_ns_internalize_name (pathname, &internal_path);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
@@ -173,6 +186,8 @@ acpi_ns_evaluate_by_name (
        acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 
        if (ACPI_FAILURE (status)) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Object at [%s] was not found, status=%.4X\n",
+                       pathname, status));
                goto cleanup;
        }
 
@@ -180,19 +195,24 @@ acpi_ns_evaluate_by_name (
         * Now that we have a handle to the object, we can attempt
         * to evaluate it.
         */
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s [%p] Value %p\n",
+               pathname, node, node->object));
 
        status = acpi_ns_evaluate_by_handle (node, params, return_object);
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "*** Completed eval of object %s ***\n",
+               pathname));
+
 
 cleanup:
 
        /* Cleanup */
 
        if (internal_path) {
-               acpi_ut_free (internal_path);
+               ACPI_MEM_FREE (internal_path);
        }
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -215,27 +235,30 @@ cleanup:
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_evaluate_by_handle (
-       ACPI_NAMESPACE_NODE     *handle,
-       ACPI_OPERAND_OBJECT     **params,
-       ACPI_OPERAND_OBJECT     **return_object)
+       acpi_namespace_node     *handle,
+       acpi_operand_object     **params,
+       acpi_operand_object     **return_object)
 {
-       ACPI_NAMESPACE_NODE     *node;
-       ACPI_STATUS             status;
-       ACPI_OPERAND_OBJECT     *local_return_object;
+       acpi_namespace_node     *node;
+       acpi_status             status;
+       acpi_operand_object     *local_return_object;
+
+
+       FUNCTION_TRACE ("Ns_evaluate_by_handle");
 
 
        /* Check if namespace has been initialized */
 
        if (!acpi_gbl_root_node) {
-               return (AE_NO_NAMESPACE);
+               return_ACPI_STATUS (AE_NO_NAMESPACE);
        }
 
        /* Parameter Validation */
 
        if (!handle) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        if (return_object) {
@@ -251,7 +274,7 @@ acpi_ns_evaluate_by_handle (
        node = acpi_ns_convert_handle_to_entry (handle);
        if (!node) {
                acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
 
@@ -312,7 +335,7 @@ acpi_ns_evaluate_by_handle (
         * Namespace was unlocked by the handling Acpi_ns* function,
         * so we just return
         */
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -335,25 +358,39 @@ acpi_ns_evaluate_by_handle (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_execute_control_method (
-       ACPI_NAMESPACE_NODE     *method_node,
-       ACPI_OPERAND_OBJECT     **params,
-       ACPI_OPERAND_OBJECT     **return_obj_desc)
+       acpi_namespace_node     *method_node,
+       acpi_operand_object     **params,
+       acpi_operand_object     **return_obj_desc)
 {
-       ACPI_STATUS             status;
-       ACPI_OPERAND_OBJECT     *obj_desc;
+       acpi_status             status;
+       acpi_operand_object     *obj_desc;
+
+
+       FUNCTION_TRACE ("Ns_execute_control_method");
 
 
        /* Verify that there is a method associated with this object */
 
        obj_desc = acpi_ns_get_attached_object (method_node);
        if (!obj_desc) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No attached method object\n"));
+
                acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-               return (AE_ERROR);
+               return_ACPI_STATUS (AE_ERROR);
        }
 
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Control method at Offset %x Length %lx]\n",
+               obj_desc->method.pcode + 1, obj_desc->method.pcode_length - 1));
+
+       DUMP_PATHNAME (method_node, "Ns_execute_control_method: Executing",
+               ACPI_LV_NAMES, _COMPONENT);
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "At offset %8XH\n", obj_desc->method.pcode + 1));
+
+
        /*
         * Unlock the namespace before execution.  This allows namespace access
         * via the external Acpi* interfaces while a method is being executed.
@@ -364,11 +401,18 @@ acpi_ns_execute_control_method (
        acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 
        /*
-        * Execute the method via the interpreter
+        * Execute the method via the interpreter.  The interpreter is locked
+        * here before calling into the AML parser
         */
-       status = acpi_ex_execute_method (method_node, params, return_obj_desc);
+       status = acpi_ex_enter_interpreter ();
+       if (ACPI_FAILURE (status)) {
+               return_ACPI_STATUS (status);
+       }
+
+       status = acpi_psx_execute (method_node, params, return_obj_desc);
+       acpi_ex_exit_interpreter ();
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -386,20 +430,22 @@ acpi_ns_execute_control_method (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_get_object_value (
-       ACPI_NAMESPACE_NODE     *node,
-       ACPI_OPERAND_OBJECT     **return_obj_desc)
+       acpi_namespace_node     *node,
+       acpi_operand_object     **return_obj_desc)
 {
-       ACPI_STATUS             status = AE_OK;
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_OPERAND_OBJECT     *val_desc;
+       acpi_status             status = AE_OK;
+       acpi_operand_object     *obj_desc;
+       acpi_operand_object     *val_desc;
+
+
+       FUNCTION_TRACE ("Ns_get_object_value");
 
 
        /*
         *  We take the value from certain objects directly
         */
-
        if ((node->type == ACPI_TYPE_PROCESSOR) ||
                (node->type == ACPI_TYPE_POWER)) {
                /*
@@ -414,7 +460,6 @@ acpi_ns_get_object_value (
                /*
                 *  Get the attached object
                 */
-
                val_desc = acpi_ns_get_attached_object (node);
                if (!val_desc) {
                        status = AE_NULL_OBJECT;
@@ -427,8 +472,7 @@ acpi_ns_get_object_value (
                 * TBD: [Future] - need a low-level object copy that handles
                 * the reference count automatically.  (Don't want to copy it)
                 */
-
-               MEMCPY (obj_desc, val_desc, sizeof (ACPI_OPERAND_OBJECT));
+               MEMCPY (obj_desc, val_desc, sizeof (acpi_operand_object));
                obj_desc->common.reference_count = 1;
                acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
        }
@@ -468,7 +512,6 @@ acpi_ns_get_object_value (
                 * We must release the namespace lock before entering the
                 * intepreter.
                 */
-
                acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
                status = acpi_ex_enter_interpreter ();
                if (ACPI_SUCCESS (status)) {
@@ -482,16 +525,16 @@ acpi_ns_get_object_value (
         * If Acpi_ex_resolve_to_value() succeeded, the return value was
         * placed in Obj_desc.
         */
-
        if (ACPI_SUCCESS (status)) {
                status = AE_CTRL_RETURN_VALUE;
 
                *return_obj_desc = obj_desc;
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Returning obj %p\n", *return_obj_desc));
        }
 
        /* Namespace is unlocked */
 
-       return (status);
+       return_ACPI_STATUS (status);
 
 
 unlock_and_exit:
@@ -499,5 +542,5 @@ unlock_and_exit:
        /* Unlock the namespace */
 
        acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-       return (status);
+       return_ACPI_STATUS (status);
 }
index fc6bb69371d1c7cd00ff14702709bc75f6592be8..e1dbadda18571b1cb03b429d6f12d07b95ee01b6 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: nsinit - namespace initialization
- *              $Revision: 25 $
+ *              $Revision: 31 $
  *
  *****************************************************************************/
 
@@ -27,6 +27,7 @@
 #include "acpi.h"
 #include "acnamesp.h"
 #include "acdispat.h"
+#include "acinterp.h"
 
 #define _COMPONENT          ACPI_NAMESPACE
         MODULE_NAME         ("nsinit")
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_initialize_objects (
        void)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
        ACPI_INIT_WALK_INFO     info;
 
 
+       FUNCTION_TRACE ("Ns_initialize_objects");
+
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+               "**** Starting initialization of namespace objects ****\n"));
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "Completing Region and Field initialization:"));
+
+
        info.field_count = 0;
        info.field_init = 0;
        info.op_region_count = 0;
@@ -65,8 +74,20 @@ acpi_ns_initialize_objects (
        status = acpi_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
                          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));
+       }
 
-       return (AE_OK);
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
+               "\n%d/%d Regions, %d/%d Fields initialized (%d nodes total)\n",
+               info.op_region_init, info.op_region_count, info.field_init,
+               info.field_count, info.object_count));
+       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+               "%d Control Methods found\n", info.method_count));
+       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+               "%d Op Regions found\n", info.op_region_count));
+
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -76,7 +97,7 @@ acpi_ns_initialize_objects (
  *
  * PARAMETERS:  None
  *
- * RETURN:      ACPI_STATUS
+ * RETURN:      acpi_status
  *
  * DESCRIPTION: Walk the entire namespace and initialize all ACPI devices.
  *              This means running _INI on all present devices.
@@ -86,25 +107,37 @@ acpi_ns_initialize_objects (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_initialize_devices (
        void)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
        ACPI_DEVICE_WALK_INFO   info;
 
 
+       FUNCTION_TRACE ("Ns_initialize_devices");
+
+
        info.device_count = 0;
        info.num_STA = 0;
        info.num_INI = 0;
 
 
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "Executing device _INI methods:"));
+
        status = acpi_ns_walk_namespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
                          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));
+       }
 
 
-       return (status);
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
+               "\n%d Devices found: %d _STA, %d _INI\n",
+               info.device_count, info.num_STA, info.num_INI));
+
+       return_ACPI_STATUS (status);
 }
 
 
@@ -128,18 +161,21 @@ acpi_ns_initialize_devices (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_init_one_object (
-       ACPI_HANDLE             obj_handle,
+       acpi_handle             obj_handle,
        u32                     level,
        void                    *context,
        void                    **return_value)
 {
-       ACPI_OBJECT_TYPE8       type;
-       ACPI_STATUS             status;
+       acpi_object_type8       type;
+       acpi_status             status;
        ACPI_INIT_WALK_INFO     *info = (ACPI_INIT_WALK_INFO *) context;
-       ACPI_NAMESPACE_NODE     *node = (ACPI_NAMESPACE_NODE *) obj_handle;
-       ACPI_OPERAND_OBJECT     *obj_desc;
+       acpi_namespace_node     *node = (acpi_namespace_node *) obj_handle;
+       acpi_operand_object     *obj_desc;
+
+
+       PROC_NAME ("Ns_init_one_object");
 
 
        info->object_count++;
@@ -153,6 +189,20 @@ acpi_ns_init_one_object (
                return (AE_OK);
        }
 
+       if ((type != ACPI_TYPE_REGION) &&
+               (type != ACPI_TYPE_BUFFER_FIELD)) {
+               return (AE_OK);
+       }
+
+
+       /*
+        * Must lock the interpreter before executing AML code
+        */
+       status = acpi_ex_enter_interpreter ();
+       if (ACPI_FAILURE (status)) {
+               return (status);
+       }
+
        switch (type) {
 
        case ACPI_TYPE_REGION:
@@ -164,7 +214,16 @@ acpi_ns_init_one_object (
 
                info->op_region_init++;
                status = acpi_ds_get_region_arguments (obj_desc);
+               if (ACPI_FAILURE (status)) {
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR, "\n"));
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                                       "%s while getting region arguments [%4.4s]\n",
+                                       acpi_format_exception (status), &node->name));
+               }
 
+               if (!(acpi_dbg_level & ACPI_LV_INIT)) {
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "."));
+               }
 
                break;
 
@@ -178,6 +237,15 @@ acpi_ns_init_one_object (
 
                info->field_init++;
                status = acpi_ds_get_buffer_field_arguments (obj_desc);
+               if (ACPI_FAILURE (status)) {
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR, "\n"));
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                                       "%s while getting buffer field arguments [%4.4s]\n",
+                                       acpi_format_exception (status), &node->name));
+               }
+               if (!(acpi_dbg_level & ACPI_LV_INIT)) {
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "."));
+               }
 
 
                break;
@@ -186,10 +254,12 @@ acpi_ns_init_one_object (
                break;
        }
 
+
        /*
         * We ignore errors from above, and always return OK, since
         * we don't want to abort the walk on a single error.
         */
+       acpi_ex_exit_interpreter ();
        return (AE_OK);
 }
 
@@ -200,7 +270,7 @@ acpi_ns_init_one_object (
  *
  * PARAMETERS:  ACPI_WALK_CALLBACK
  *
- * RETURN:      ACPI_STATUS
+ * RETURN:      acpi_status
  *
  * DESCRIPTION: This is called once per device soon after ACPI is enabled
  *              to initialize each device. It determines if the device is
@@ -208,19 +278,25 @@ acpi_ns_init_one_object (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_init_one_device (
-       ACPI_HANDLE             obj_handle,
+       acpi_handle             obj_handle,
        u32                     nesting_level,
        void                    *context,
        void                    **return_value)
 {
-       ACPI_STATUS             status;
-       ACPI_NAMESPACE_NODE    *node;
+       acpi_status             status;
+       acpi_namespace_node    *node;
        u32                     flags;
        ACPI_DEVICE_WALK_INFO  *info = (ACPI_DEVICE_WALK_INFO *) context;
 
 
+       FUNCTION_TRACE ("Ns_init_one_device");
+
+
+       if (!(acpi_dbg_level & ACPI_LV_INIT)) {
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "."));
+       }
 
        info->device_count++;
 
@@ -237,12 +313,12 @@ acpi_ns_init_one_device (
        /*
         * Run _STA to determine if we can run _INI on the device.
         */
-
+       DEBUG_EXEC (acpi_ut_display_init_pathname (node, "_STA [Method]"));
        status = acpi_ut_execute_STA (node, &flags);
        if (ACPI_FAILURE (status)) {
                /* Ignore error and move on to next device */
 
-               return (AE_OK);
+               return_ACPI_STATUS (AE_OK);
        }
 
        info->num_STA++;
@@ -250,13 +326,14 @@ acpi_ns_init_one_device (
        if (!(flags & 0x01)) {
                /* don't look at children of a not present device */
 
-               return(AE_CTRL_DEPTH);
+               return_ACPI_STATUS(AE_CTRL_DEPTH);
        }
 
 
        /*
         * The device is present. Run _INI.
         */
+       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 */
@@ -267,6 +344,14 @@ acpi_ns_init_one_device (
        else if (ACPI_FAILURE (status)) {
                /* Ignore error and move on to next device */
 
+#ifdef ACPI_DEBUG
+               NATIVE_CHAR *scope_name = acpi_ns_get_table_pathname (obj_handle);
+
+               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "%s._INI failed: %s\n",
+                               scope_name, acpi_format_exception (status)));
+
+               ACPI_MEM_FREE (scope_name);
+#endif
        }
 
        else {
@@ -275,5 +360,5 @@ acpi_ns_init_one_device (
                info->num_INI++;
        }
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
index a88ff4bd04c3dd447f8f0619e5cc038b1726b042..d5ed48f6f9705f113e5061489a42f1b7dfca1236 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: nsload - namespace loading/expanding/contracting procedures
- *              $Revision: 41 $
+ *              $Revision: 43 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_load_namespace (
        void)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Acpi_load_name_space");
 
 
        /* There must be at least a DSDT installed */
 
        if (acpi_gbl_DSDT == NULL) {
-               return (AE_NO_ACPI_TABLES);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "DSDT is not in memory\n"));
+               return_ACPI_STATUS (AE_NO_ACPI_TABLES);
        }
 
 
@@ -68,10 +72,9 @@ acpi_ns_load_namespace (
         * Load the namespace.  The DSDT is required,
         * but the SSDT and PSDT tables are optional.
         */
-
        status = acpi_ns_load_table_by_type (ACPI_TABLE_DSDT);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Ignore exceptions from these */
@@ -80,7 +83,12 @@ acpi_ns_load_namespace (
        acpi_ns_load_table_by_type (ACPI_TABLE_PSDT);
 
 
-       return (status);
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
+               "ACPI Namespace successfully loaded at root %p\n",
+               acpi_gbl_root_node));
+
+
+       return_ACPI_STATUS (status);
 }
 
 
@@ -96,15 +104,18 @@ acpi_ns_load_namespace (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_one_complete_parse (
        u32                     pass_number,
-       ACPI_TABLE_DESC         *table_desc)
+       acpi_table_desc         *table_desc)
 {
-       ACPI_PARSE_DOWNWARDS    descending_callback;
-       ACPI_PARSE_UPWARDS      ascending_callback;
-       ACPI_PARSE_OBJECT       *parse_root;
-       ACPI_STATUS             status;
+       acpi_parse_downwards    descending_callback;
+       acpi_parse_upwards      ascending_callback;
+       acpi_parse_object       *parse_root;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Ns_one_complete_parse");
 
 
        switch (pass_number) {
@@ -131,14 +142,16 @@ acpi_ns_one_complete_parse (
 
        parse_root = acpi_ps_alloc_op (AML_SCOPE_OP);
        if (!parse_root) {
-               return (AE_NO_MEMORY);
+               return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
-       ((ACPI_PARSE2_OBJECT *) parse_root)->name = ACPI_ROOT_NAME;
+       ((acpi_parse2_object *) parse_root)->name = ACPI_ROOT_NAME;
 
 
        /* Pass 1:  Parse everything except control method bodies */
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "*PARSE* pass %d parse\n", pass_number));
+
        status = acpi_ps_parse_aml (parse_root, table_desc->aml_pointer,
                         table_desc->aml_length,
                         ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE,
@@ -146,7 +159,7 @@ acpi_ns_one_complete_parse (
                         ascending_callback);
 
        acpi_ps_delete_parse_tree (parse_root);
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -163,12 +176,15 @@ acpi_ns_one_complete_parse (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_parse_table (
-       ACPI_TABLE_DESC         *table_desc,
-       ACPI_NAMESPACE_NODE     *start_node)
+       acpi_table_desc         *table_desc,
+       acpi_namespace_node     *start_node)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Ns_parse_table");
 
 
        /*
@@ -181,10 +197,9 @@ acpi_ns_parse_table (
         * to service the entire parse.  The second pass of the parse then
         * performs another complete parse of the AML..
         */
-
        status = acpi_ns_one_complete_parse (1, table_desc);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
 
@@ -197,13 +212,12 @@ acpi_ns_parse_table (
         * overhead of this is compensated for by the fact that the
         * parse objects are all cached.
         */
-
        status = acpi_ns_one_complete_parse (2, table_desc);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -220,21 +234,28 @@ acpi_ns_parse_table (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_load_table (
-       ACPI_TABLE_DESC         *table_desc,
-       ACPI_NAMESPACE_NODE     *node)
+       acpi_table_desc         *table_desc,
+       acpi_namespace_node     *node)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Ns_load_table");
 
 
        if (!table_desc->aml_pointer) {
-               return (AE_BAD_PARAMETER);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null AML pointer\n"));
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AML block at %p\n", table_desc->aml_pointer));
+
 
        if (!table_desc->aml_length) {
-               return (AE_BAD_PARAMETER);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Zero-length AML block\n"));
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
 
@@ -247,13 +268,14 @@ acpi_ns_load_table (
         * to another control method, we can't continue parsing
         * because we don't know how many arguments to parse next!
         */
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Loading table into namespace ****\n"));
 
        acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
        status = acpi_ns_parse_table (table_desc, node->child);
        acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /*
@@ -262,10 +284,15 @@ acpi_ns_load_table (
         * just-in-time parsing, we delete the control method
         * parse trees.
         */
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+               "**** Begin Table Method Parsing and Object Initialization ****\n"));
 
        status = acpi_ds_initialize_objects (table_desc, node);
 
-       return (status);
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+               "**** Completed Table Method Parsing and Object Initialization ****\n"));
+
+       return_ACPI_STATUS (status);
 }
 
 
@@ -283,13 +310,16 @@ acpi_ns_load_table (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_load_table_by_type (
-       ACPI_TABLE_TYPE         table_type)
+       acpi_table_type         table_type)
 {
        u32                     i;
-       ACPI_STATUS             status = AE_OK;
-       ACPI_TABLE_DESC         *table_desc;
+       acpi_status             status = AE_OK;
+       acpi_table_desc         *table_desc;
+
+
+       FUNCTION_TRACE ("Ns_load_table_by_type");
 
 
        acpi_ut_acquire_mutex (ACPI_MTX_TABLES);
@@ -299,11 +329,12 @@ acpi_ns_load_table_by_type (
         * Table types supported are:
         * DSDT (one), SSDT/PSDT (multiple)
         */
-
        switch (table_type) {
 
        case ACPI_TABLE_DSDT:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading DSDT\n"));
+
                table_desc = &acpi_gbl_acpi_tables[ACPI_TABLE_DSDT];
 
                /* If table already loaded into namespace, just return */
@@ -326,17 +357,18 @@ acpi_ns_load_table_by_type (
 
        case ACPI_TABLE_SSDT:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading %d SSDTs\n",
+                       acpi_gbl_acpi_tables[ACPI_TABLE_SSDT].count));
+
                /*
                 * Traverse list of SSDT tables
                 */
-
                table_desc = &acpi_gbl_acpi_tables[ACPI_TABLE_SSDT];
                for (i = 0; i < acpi_gbl_acpi_tables[ACPI_TABLE_SSDT].count; i++) {
                        /*
                         * Only attempt to load table if it is not
                         * already loaded!
                         */
-
                        if (!table_desc->loaded_into_namespace) {
                                status = acpi_ns_load_table (table_desc, acpi_gbl_root_node);
                                if (ACPI_FAILURE (status)) {
@@ -353,10 +385,12 @@ acpi_ns_load_table_by_type (
 
        case ACPI_TABLE_PSDT:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading %d PSDTs\n",
+                       acpi_gbl_acpi_tables[ACPI_TABLE_PSDT].count));
+
                /*
                 * Traverse list of PSDT tables
                 */
-
                table_desc = &acpi_gbl_acpi_tables[ACPI_TABLE_PSDT];
 
                for (i = 0; i < acpi_gbl_acpi_tables[ACPI_TABLE_PSDT].count; i++) {
@@ -387,7 +421,7 @@ unlock_and_exit:
 
        acpi_ut_release_mutex (ACPI_MTX_TABLES);
 
-       return (status);
+       return_ACPI_STATUS (status);
 
 }
 
@@ -408,18 +442,21 @@ unlock_and_exit:
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_delete_subtree (
-       ACPI_HANDLE             start_handle)
+       acpi_handle             start_handle)
 {
-       ACPI_STATUS             status;
-       ACPI_HANDLE             child_handle;
-       ACPI_HANDLE             parent_handle;
-       ACPI_HANDLE             next_child_handle;
-       ACPI_HANDLE             dummy;
+       acpi_status             status;
+       acpi_handle             child_handle;
+       acpi_handle             parent_handle;
+       acpi_handle             next_child_handle;
+       acpi_handle             dummy;
        u32                     level;
 
 
+       FUNCTION_TRACE ("Ns_delete_subtree");
+
+
        parent_handle = start_handle;
        child_handle = 0;
        level        = 1;
@@ -428,7 +465,6 @@ acpi_ns_delete_subtree (
         * Traverse the tree of objects until we bubble back up
         * to where we started.
         */
-
        while (level > 0) {
                /* Attempt to get the next object in this scope */
 
@@ -449,7 +485,6 @@ acpi_ns_delete_subtree (
                                 * There is at least one child of this object,
                                 * visit the object
                                 */
-
                                level++;
                                parent_handle = child_handle;
                                child_handle = 0;
@@ -476,7 +511,7 @@ acpi_ns_delete_subtree (
 
        acpi_ns_delete_node (child_handle);
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -494,21 +529,24 @@ acpi_ns_delete_subtree (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_unload_namespace (
-       ACPI_HANDLE             handle)
+       acpi_handle             handle)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Ns_unload_name_space");
 
 
        /* Parameter validation */
 
        if (!acpi_gbl_root_node) {
-               return (AE_NO_NAMESPACE);
+               return_ACPI_STATUS (AE_NO_NAMESPACE);
        }
 
        if (!handle) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
 
@@ -516,7 +554,7 @@ acpi_ns_unload_namespace (
 
        status = acpi_ns_delete_subtree (handle);
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
index 2a77e3bed25ca48706de2656394d12ceb879c9d9..f57d0bc77f7a4e3a5f51b0dd3c408a5c884f00ae 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: nsnames - Name manipulation and search
- *              $Revision: 59 $
+ *              $Revision: 63 $
  *
  ******************************************************************************/
 
 
 NATIVE_CHAR *
 acpi_ns_get_table_pathname (
-       ACPI_NAMESPACE_NODE     *node)
+       acpi_namespace_node     *node)
 {
        NATIVE_CHAR             *name_buffer;
        u32                     size;
-       ACPI_NAME               name;
-       ACPI_NAMESPACE_NODE     *child_node;
-       ACPI_NAMESPACE_NODE     *parent_node;
+       acpi_name               name;
+       acpi_namespace_node     *child_node;
+       acpi_namespace_node     *parent_node;
+
+
+       FUNCTION_TRACE_PTR ("Ns_get_table_pathname", node);
 
 
        if (!acpi_gbl_root_node || !node) {
@@ -64,7 +67,7 @@ acpi_ns_get_table_pathname (
                 * If the name space has not been initialized,
                 * this function should not have been called.
                 */
-               return (NULL);
+               return_PTR (NULL);
        }
 
        child_node = node->child;
@@ -84,10 +87,10 @@ acpi_ns_get_table_pathname (
 
        /* Allocate a buffer to be returned to caller */
 
-       name_buffer = acpi_ut_callocate (size + 1);
+       name_buffer = ACPI_MEM_CALLOCATE (size + 1);
        if (!name_buffer) {
                REPORT_ERROR (("Ns_get_table_pathname: allocation failure\n"));
-               return (NULL);
+               return_PTR (NULL);
        }
 
 
@@ -107,8 +110,11 @@ acpi_ns_get_table_pathname (
 
        name_buffer[--size] = AML_ROOT_PREFIX;
 
+       if (size != 0) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad pointer returned; size=%X\n", size));
+       }
 
-       return (name_buffer);
+       return_PTR (name_buffer);
 }
 
 
@@ -126,10 +132,14 @@ acpi_ns_get_table_pathname (
 
 u32
 acpi_ns_get_pathname_length (
-       ACPI_NAMESPACE_NODE     *node)
+       acpi_namespace_node     *node)
 {
        u32                     size;
-       ACPI_NAMESPACE_NODE     *next_node;
+       acpi_namespace_node     *next_node;
+
+
+       FUNCTION_ENTRY ();
+
 
        /*
         * Compute length of pathname as 5 * number of name segments.
@@ -168,32 +178,34 @@ acpi_ns_get_pathname_length (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_handle_to_pathname (
-       ACPI_HANDLE             target_handle,
+       acpi_handle             target_handle,
        u32                     *buf_size,
        NATIVE_CHAR             *user_buffer)
 {
-       ACPI_STATUS             status = AE_OK;
-       ACPI_NAMESPACE_NODE     *node;
+       acpi_status             status = AE_OK;
+       acpi_namespace_node     *node;
        u32                     path_length;
        u32                     user_buf_size;
-       ACPI_NAME               name;
+       acpi_name               name;
        u32                     size;
 
 
+       FUNCTION_TRACE_PTR ("Ns_handle_to_pathname", target_handle);
+
+
        if (!acpi_gbl_root_node) {
                /*
                 * If the name space has not been initialized,
                 * this function should not have been called.
                 */
-
-               return (AE_NO_NAMESPACE);
+               return_ACPI_STATUS (AE_NO_NAMESPACE);
        }
 
        node = acpi_ns_convert_handle_to_entry (target_handle);
        if (!node) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
 
@@ -239,11 +251,12 @@ acpi_ns_handle_to_pathname (
         * Overlay the "." preceding the first segment with
         * the root name "\"
         */
-
        user_buffer[size] = '\\';
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Len=%X, %s \n", path_length, user_buffer));
+
 exit:
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
index eb5ba8bd3261a696e1f81cf9da6ec726d377943a..4477220fc687ec32ecb41fc204c2489b7628b3ed 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Module Name: nsobject - Utilities for objects attached to namespace
  *                         table entries
- *              $Revision: 55 $
+ *              $Revision: 65 $
  *
  ******************************************************************************/
 
  *
  * FUNCTION:    Acpi_ns_attach_object
  *
- * PARAMETERS:  Node            - Parent Node
+ * PARAMETERS:  Node                - Parent Node
  *              Object              - Object to be attached
  *              Type                - Type of object, or ACPI_TYPE_ANY if not
- *                                      known
+ *                                    known
  *
  * DESCRIPTION: Record the given object as the value associated with the
- *              name whose ACPI_HANDLE is passed.  If Object is NULL
+ *              name whose acpi_handle is passed.  If Object is NULL
  *              and Type is ACPI_TYPE_ANY, set the name as having no value.
  *
  * MUTEX:       Assumes namespace is locked
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_attach_object (
-       ACPI_NAMESPACE_NODE     *node,
-       ACPI_OPERAND_OBJECT     *object,
-       ACPI_OBJECT_TYPE8       type)
+       acpi_namespace_node     *node,
+       acpi_operand_object     *object,
+       acpi_object_type8       type)
 {
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_OPERAND_OBJECT     *previous_obj_desc;
-       ACPI_OBJECT_TYPE8      obj_type = ACPI_TYPE_ANY;
+       acpi_operand_object     *obj_desc;
+       acpi_operand_object     *previous_obj_desc;
+       acpi_object_type8       obj_type = ACPI_TYPE_ANY;
        u8                      flags;
        u16                     opcode;
 
 
+       FUNCTION_TRACE ("Ns_attach_object");
+
+
        /*
         * Parameter validation
         */
-
        if (!acpi_gbl_root_node) {
                /* Name space not initialized  */
 
                REPORT_ERROR (("Ns_attach_object: Namespace not initialized\n"));
-               return (AE_NO_NAMESPACE);
+               return_ACPI_STATUS (AE_NO_NAMESPACE);
        }
 
        if (!node) {
                /* Invalid handle */
 
                REPORT_ERROR (("Ns_attach_object: Null Named_obj handle\n"));
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        if (!object && (ACPI_TYPE_ANY != type)) {
                /* Null object */
 
                REPORT_ERROR (("Ns_attach_object: Null object, but type not ACPI_TYPE_ANY\n"));
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        if (!VALID_DESCRIPTOR_TYPE (node, ACPI_DESC_TYPE_NAMED)) {
                /* Not a name handle */
 
                REPORT_ERROR (("Ns_attach_object: Invalid handle\n"));
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        /* Check if this object is already attached */
 
        if (node->object == object) {
-               return (AE_OK);
+               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj %p already installed in Name_obj %p\n",
+                       object, node));
+
+               return_ACPI_STATUS (AE_OK);
        }
 
 
@@ -119,25 +124,22 @@ acpi_ns_attach_object (
        }
 
        /*
-        * If the object is an Node with an attached object,
+        * If the source object is a namespace Node with an attached object,
         * we will use that (attached) object
         */
-
        else if (VALID_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_NAMED) &&
-                       ((ACPI_NAMESPACE_NODE *) object)->object) {
+                       ((acpi_namespace_node *) object)->object) {
                /*
                 * Value passed is a name handle and that name has a
                 * non-null value.  Use that name's value and type.
                 */
-
-               obj_desc = ((ACPI_NAMESPACE_NODE *) object)->object;
-               obj_type = ((ACPI_NAMESPACE_NODE *) object)->type;
+               obj_desc = ((acpi_namespace_node *) object)->object;
+               obj_type = ((acpi_namespace_node *) object)->type;
 
                /*
                 * Copy appropriate flags
                 */
-
-               if (((ACPI_NAMESPACE_NODE *) object)->flags & ANOBJ_AML_ATTACHMENT) {
+               if (((acpi_namespace_node *) object)->flags & ANOBJ_AML_ATTACHMENT) {
                        flags |= ANOBJ_AML_ATTACHMENT;
                }
        }
@@ -147,10 +149,8 @@ acpi_ns_attach_object (
         * Otherwise, we will use the parameter object, but we must type
         * it first
         */
-
        else {
-               obj_desc = (ACPI_OPERAND_OBJECT *) object;
-
+               obj_desc = (acpi_operand_object *) object;
 
                /* If a valid type (non-ANY) was given, just use it */
 
@@ -158,13 +158,9 @@ acpi_ns_attach_object (
                        obj_type = type;
                }
 
-
                /*
                 * Type is TYPE_Any, we must try to determinte the
-                * actual type of the object
-                */
-
-               /*
+                * actual type of the object.
                 * Check if value points into the AML code
                 */
                else if (acpi_tb_system_table_pointer (object)) {
@@ -172,14 +168,12 @@ acpi_ns_attach_object (
                         * Object points into the AML stream.
                         * Set a flag bit in the Node to indicate this
                         */
-
                        flags |= ANOBJ_AML_ATTACHMENT;
 
                        /*
                         * The next byte (perhaps the next two bytes)
                         * will be the AML opcode
                         */
-
                        MOVE_UNALIGNED16_TO_16 (&opcode, object);
 
                        /* Check for a recognized Opcode */
@@ -193,15 +187,18 @@ acpi_ns_attach_object (
                                         * Op_prefix is unrecognized unless part
                                         * of Revision_op
                                         */
-
                                        break;
                                }
 
-                               /* Else fall through to set type as Number */
+                               /* case AML_REVISION_OP: fall through and set the type to Integer */
 
-
-                       case AML_ZERO_OP: case AML_ONES_OP: case AML_ONE_OP:
-                       case AML_BYTE_OP: case AML_WORD_OP: case AML_DWORD_OP:
+                       case AML_ZERO_OP:
+                       case AML_ONES_OP:
+                       case AML_ONE_OP:
+                       case AML_BYTE_OP:
+                       case AML_WORD_OP:
+                       case AML_DWORD_OP:
+                       case AML_QWORD_OP:
 
                                obj_type = ACPI_TYPE_INTEGER;
                                break;
@@ -233,7 +230,11 @@ acpi_ns_attach_object (
 
                        default:
 
-                               return (AE_TYPE);
+                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                                       "AML Opcode/Type [%x] not supported in attach\n",
+                                       (u8) opcode));
+
+                               return_ACPI_STATUS (AE_TYPE);
                                break;
                        }
                }
@@ -243,18 +244,39 @@ acpi_ns_attach_object (
                         * Cannot figure out the type -- set to Def_any which
                         * will print as an error in the name table dump
                         */
+                       if (acpi_dbg_level > 0) {
+                               DUMP_PATHNAME (node,
+                                       "Ns_attach_object confused: setting bogus type for ",
+                                       ACPI_LV_INFO, _COMPONENT);
+
+                               if (acpi_tb_system_table_pointer (object)) {
+                                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+                                               "AML-stream code %02x\n", *(u8 *) object));
+                               }
+
+                               else if (VALID_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_NAMED)) {
+                                       DUMP_PATHNAME (object, "name ", ACPI_LV_INFO, _COMPONENT);
+                               }
 
+                               else {
+                                       DUMP_PATHNAME (object, "object ", ACPI_LV_INFO, _COMPONENT);
+                                       DUMP_STACK_ENTRY (object);
+                               }
+                       }
 
                        obj_type = INTERNAL_TYPE_DEF_ANY;
                }
        }
 
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Installing %p into Node %p [%4.4s]\n",
+               obj_desc, node, &node->name));
+
+
        /*
         * Must increment the new value's reference count
         * (if it is an internal object)
         */
-
        acpi_ut_add_reference (obj_desc);
 
        /* Save the existing object (if any) for deletion later */
@@ -271,7 +293,6 @@ acpi_ns_attach_object (
        /*
         * Delete an existing attached object.
         */
-
        if (previous_obj_desc) {
                /* One for the attach to the Node */
 
@@ -282,7 +303,7 @@ acpi_ns_attach_object (
                acpi_ut_remove_reference (previous_obj_desc);
        }
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -302,14 +323,17 @@ acpi_ns_attach_object (
 
 void
 acpi_ns_detach_object (
-       ACPI_NAMESPACE_NODE     *node)
+       acpi_namespace_node     *node)
 {
-       ACPI_OPERAND_OBJECT     *obj_desc;
+       acpi_operand_object     *obj_desc;
+
+
+       FUNCTION_TRACE ("Ns_detach_object");
 
 
        obj_desc = node->object;
        if (!obj_desc) {
-               return;
+               return_VOID;
        }
 
        /* Clear the entry in all cases */
@@ -318,18 +342,20 @@ acpi_ns_detach_object (
 
        /* Found a valid value */
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Object=%p Value=%p Name %4.4s\n",
+               node, obj_desc, &node->name));
+
        /*
-        * Not every value is an object allocated via Acpi_ut_callocate,
+        * Not every value is an object allocated via ACPI_MEM_CALLOCATE,
         * - must check
         */
-
        if (!acpi_tb_system_table_pointer (obj_desc)) {
                /* Attempt to delete the object (and all subobjects) */
 
                acpi_ut_remove_reference (obj_desc);
        }
 
-       return;
+       return_VOID;
 }
 
 
@@ -346,16 +372,19 @@ acpi_ns_detach_object (
 
 void *
 acpi_ns_get_attached_object (
-       ACPI_NAMESPACE_NODE     *node)
+       acpi_namespace_node     *node)
 {
+       FUNCTION_TRACE_PTR ("Ns_get_attached_object", node);
+
 
        if (!node) {
                /* handle invalid */
 
-               return (NULL);
+               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Null Node ptr\n"));
+               return_PTR (NULL);
        }
 
-       return (node->object);
+       return_PTR (node->object);
 }
 
 
index d8fe2c10bc5fc178679626be82f58447d920186a..6e27e1df5feeb9731cafee3478f693833206c79e 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: nssearch - Namespace search
- *              $Revision: 70 $
+ *              $Revision: 74 $
  *
  ******************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_search_node (
        u32                     target_name,
-       ACPI_NAMESPACE_NODE     *node,
-       ACPI_OBJECT_TYPE8       type,
-       ACPI_NAMESPACE_NODE     **return_node)
+       acpi_namespace_node     *node,
+       acpi_object_type8       type,
+       acpi_namespace_node     **return_node)
 {
-       ACPI_NAMESPACE_NODE     *next_node;
+       acpi_namespace_node     *next_node;
+
+
+       FUNCTION_TRACE ("Ns_search_node");
+
+
+#ifdef ACPI_DEBUG
+       if (ACPI_LV_NAMES & acpi_dbg_level) {
+               NATIVE_CHAR         *scope_name;
+
+               scope_name = acpi_ns_get_table_pathname (node);
+               if (scope_name) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching %s [%p] For %4.4s (type %X)\n",
+                               scope_name, node, &target_name, type));
+
+                       ACPI_MEM_FREE (scope_name);
+               }
+       }
+#endif
 
 
        /*
         * Search for name in this table, which is to say that we must search
         * for the name among the children of this object
         */
-
        next_node = node->child;
        while (next_node) {
                /* Check for match against the name */
@@ -87,7 +104,6 @@ acpi_ns_search_node (
                         * The Def_field_defn and Bank_field_defn cases are actually looking up
                         * the Region in which the field will be defined
                         */
-
                        if ((INTERNAL_TYPE_FIELD_DEFN == type) ||
                                (INTERNAL_TYPE_BANK_FIELD_DEFN == type)) {
                                type = ACPI_TYPE_REGION;
@@ -99,7 +115,6 @@ acpi_ns_search_node (
                         * looked up.  For any other value of Type, if the type stored in
                         * the entry is Any (i.e. unknown), save the actual type.
                         */
-
                        if (type != INTERNAL_TYPE_SCOPE &&
                                type != INTERNAL_TYPE_DEF_ANY &&
                                type != INTERNAL_TYPE_INDEX_FIELD_DEFN &&
@@ -107,8 +122,12 @@ acpi_ns_search_node (
                                next_node->type = (u8) type;
                        }
 
+                       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+                               "Name %4.4s (actual type %X) found at %p\n",
+                               &target_name, next_node->type, next_node));
+
                        *return_node = next_node;
-                       return (AE_OK);
+                       return_ACPI_STATUS (AE_OK);
                }
 
 
@@ -130,7 +149,10 @@ acpi_ns_search_node (
 
        /* Searched entire table, not found */
 
-       return (AE_NOT_FOUND);
+       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Name %4.4s (type %X) not found at %p\n",
+               &target_name, type, next_node));
+
+       return_ACPI_STATUS (AE_NOT_FOUND);
 }
 
 
@@ -159,15 +181,18 @@ acpi_ns_search_node (
  *
  ******************************************************************************/
 
-static ACPI_STATUS
+static acpi_status
 acpi_ns_search_parent_tree (
        u32                     target_name,
-       ACPI_NAMESPACE_NODE     *node,
-       ACPI_OBJECT_TYPE8       type,
-       ACPI_NAMESPACE_NODE     **return_node)
+       acpi_namespace_node     *node,
+       acpi_object_type8       type,
+       acpi_namespace_node     **return_node)
 {
-       ACPI_STATUS             status;
-       ACPI_NAMESPACE_NODE     *parent_node;
+       acpi_status             status;
+       acpi_namespace_node     *parent_node;
+
+
+       FUNCTION_TRACE ("Ns_search_parent_tree");
 
 
        parent_node = acpi_ns_get_parent_object (node);
@@ -178,14 +203,24 @@ acpi_ns_search_parent_tree (
         */
        if ((acpi_ns_local (type)) ||
                (!parent_node)) {
+               if (!parent_node) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] has no parent\n",
+                               &target_name));
+               }
 
+               if (acpi_ns_local (type)) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] type %X is local(no search)\n",
+                               &target_name, type));
+               }
 
-               return (AE_NOT_FOUND);
+               return_ACPI_STATUS (AE_NOT_FOUND);
        }
 
 
        /* Search the parent tree */
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching parent for %4.4s\n", &target_name));
+
        /*
         * Search parents until found the target or we have backed up to
         * the root
@@ -198,21 +233,20 @@ acpi_ns_search_parent_tree (
                                   ACPI_TYPE_ANY, return_node);
 
                if (ACPI_SUCCESS (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
 
                /*
                 * Not found here, go up another level
                 * (until we reach the root)
                 */
-
                parent_node = acpi_ns_get_parent_object (parent_node);
        }
 
 
        /* Not found in parent tree */
 
-       return (AE_NOT_FOUND);
+       return_ACPI_STATUS (AE_NOT_FOUND);
 }
 
 
@@ -241,33 +275,42 @@ acpi_ns_search_parent_tree (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_search_and_enter (
        u32                     target_name,
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_NAMESPACE_NODE     *node,
-       OPERATING_MODE          interpreter_mode,
-       ACPI_OBJECT_TYPE8       type,
+       acpi_walk_state         *walk_state,
+       acpi_namespace_node     *node,
+       operating_mode          interpreter_mode,
+       acpi_object_type8       type,
        u32                     flags,
-       ACPI_NAMESPACE_NODE     **return_node)
+       acpi_namespace_node     **return_node)
 {
-       ACPI_STATUS             status;
-       ACPI_NAMESPACE_NODE     *new_node;
+       acpi_status             status;
+       acpi_namespace_node     *new_node;
+
+
+       FUNCTION_TRACE ("Ns_search_and_enter");
 
 
        /* Parameter validation */
 
        if (!node || !target_name || !return_node) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null param-  Table %p Name %p Return %p\n",
+                       node, target_name, return_node));
+
                REPORT_ERROR (("Ns_search_and_enter: bad (null) parameter\n"));
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
 
        /* Name must consist of printable characters */
 
        if (!acpi_ut_valid_acpi_name (target_name)) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "*** Bad character in name: %08lx *** \n",
+                       target_name));
+
                REPORT_ERROR (("Ns_search_and_enter: Bad character in ACPI Name\n"));
-               return (AE_BAD_CHARACTER);
+               return_ACPI_STATUS (AE_BAD_CHARACTER);
        }
 
 
@@ -289,7 +332,7 @@ acpi_ns_search_and_enter (
                 * Either found it or there was an error
                 * -- finished either way
                 */
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
 
@@ -302,18 +345,16 @@ acpi_ns_search_and_enter (
         * the search when namespace references are being resolved
         * (load pass 2) and during the execution phase.
         */
-
        if ((interpreter_mode != IMODE_LOAD_PASS1) &&
                (flags & NS_SEARCH_PARENT)) {
                /*
                 * Not found in table - search parent tree according
                 * to ACPI specification
                 */
-
                status = acpi_ns_search_parent_tree (target_name, node,
                                 type, return_node);
                if (ACPI_SUCCESS (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
        }
 
@@ -322,7 +363,10 @@ acpi_ns_search_and_enter (
         * In execute mode, just search, never add names.  Exit now.
         */
        if (interpreter_mode == IMODE_EXECUTE) {
-               return (AE_NOT_FOUND);
+               ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%4.4s Not found in %p [Not adding]\n",
+                       &target_name, node));
+
+               return_ACPI_STATUS (AE_NOT_FOUND);
        }
 
 
@@ -330,7 +374,7 @@ acpi_ns_search_and_enter (
 
        new_node = acpi_ns_create_node (target_name);
        if (!new_node) {
-               return (AE_NO_MEMORY);
+               return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
        /* Install the new object into the parent's list of children */
@@ -338,6 +382,6 @@ acpi_ns_search_and_enter (
        acpi_ns_install_node (walk_state, node, new_node, type);
        *return_node = new_node;
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
index 67b2ee3ffda1277c63198596c78fb33ffa90bad0..d7f27bda97c19e9d44caaf4c3bb35074b6748d4e 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Module Name: nsutils - Utilities for accessing ACPI namespace, accessing
  *                        parents and siblings and Scope manipulation
- *              $Revision: 83 $
+ *              $Revision: 89 $
  *
  *****************************************************************************/
 
@@ -87,17 +87,19 @@ acpi_ns_valid_path_separator (
  *
  ******************************************************************************/
 
-ACPI_OBJECT_TYPE8
+acpi_object_type8
 acpi_ns_get_type (
-       ACPI_NAMESPACE_NODE     *node)
+       acpi_namespace_node     *node)
 {
+       FUNCTION_TRACE ("Ns_get_type");
+
 
        if (!node) {
                REPORT_WARNING (("Ns_get_type: Null Node ptr"));
-               return (ACPI_TYPE_ANY);
+               return_VALUE (ACPI_TYPE_ANY);
        }
 
-       return (node->type);
+       return_VALUE (node->type);
 }
 
 
@@ -114,17 +116,19 @@ acpi_ns_get_type (
 
 u32
 acpi_ns_local (
-       ACPI_OBJECT_TYPE8       type)
+       acpi_object_type8       type)
 {
+       FUNCTION_TRACE ("Ns_local");
+
 
        if (!acpi_ut_valid_object_type (type)) {
                /* Type code out of range  */
 
                REPORT_WARNING (("Ns_local: Invalid Object Type\n"));
-               return (NSP_NORMAL);
+               return_VALUE (NSP_NORMAL);
        }
 
-       return ((u32) acpi_gbl_ns_properties[type] & NSP_LOCAL);
+       return_VALUE ((u32) acpi_gbl_ns_properties[type] & NSP_LOCAL);
 }
 
 
@@ -142,7 +146,7 @@ acpi_ns_local (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_get_internal_name_length (
        ACPI_NAMESTRING_INFO    *info)
 {
@@ -150,6 +154,9 @@ acpi_ns_get_internal_name_length (
        u32                     i;
 
 
+       FUNCTION_ENTRY ();
+
+
        next_external_char = info->external_name;
        info->num_carats = 0;
        info->num_segments = 0;
@@ -173,7 +180,6 @@ acpi_ns_get_internal_name_length (
                /*
                 * Handle Carat prefixes
                 */
-
                while (*next_external_char == '^') {
                        info->num_carats++;
                        next_external_char++;
@@ -217,7 +223,7 @@ acpi_ns_get_internal_name_length (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_build_internal_name (
        ACPI_NAMESTRING_INFO    *info)
 {
@@ -228,6 +234,9 @@ acpi_ns_build_internal_name (
        u32                     i;
 
 
+       FUNCTION_TRACE ("Ns_build_internal_name");
+
+
        /* Setup the correct prefixes, counts, and pointers */
 
        if (info->fully_qualified) {
@@ -299,7 +308,7 @@ acpi_ns_build_internal_name (
 
                if (!acpi_ns_valid_path_separator (*external_name) &&
                        (*external_name != 0)) {
-                       return (AE_BAD_PARAMETER);
+                       return_ACPI_STATUS (AE_BAD_PARAMETER);
                }
 
                /* Move on the next segment */
@@ -313,8 +322,16 @@ acpi_ns_build_internal_name (
 
        *result = 0;
 
+       if (info->fully_qualified) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "returning [%p] (abs) \"\\%s\"\n",
+                       internal_name, &internal_name[0]));
+       }
+       else {
+               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "returning [%p] (rel) \"%s\"\n",
+                       internal_name, &internal_name[2]));
+       }
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -333,20 +350,23 @@ acpi_ns_build_internal_name (
  *
  *******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_internalize_name (
        NATIVE_CHAR             *external_name,
        NATIVE_CHAR             **converted_name)
 {
        NATIVE_CHAR             *internal_name;
        ACPI_NAMESTRING_INFO    info;
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Ns_internalize_name");
 
 
        if ((!external_name)     ||
                (*external_name == 0) ||
                (!converted_name)) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
 
@@ -357,9 +377,9 @@ acpi_ns_internalize_name (
 
        /* We need a segment to store the internal  name */
 
-       internal_name = acpi_ut_callocate (info.length);
+       internal_name = ACPI_MEM_CALLOCATE (info.length);
        if (!internal_name) {
-               return (AE_NO_MEMORY);
+               return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
        /* Build the name */
@@ -367,12 +387,12 @@ acpi_ns_internalize_name (
        info.internal_name = internal_name;
        status = acpi_ns_build_internal_name (&info);
        if (ACPI_FAILURE (status)) {
-               acpi_ut_free (internal_name);
-               return (status);
+               ACPI_MEM_FREE (internal_name);
+               return_ACPI_STATUS (status);
        }
 
        *converted_name = internal_name;
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -391,7 +411,7 @@ acpi_ns_internalize_name (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_externalize_name (
        u32                     internal_name_length,
        char                    *internal_name,
@@ -405,11 +425,14 @@ acpi_ns_externalize_name (
        u32                     j = 0;
 
 
+       FUNCTION_TRACE ("Ns_externalize_name");
+
+
        if (!internal_name_length   ||
                !internal_name          ||
                !converted_name_length  ||
                !converted_name) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
 
@@ -489,16 +512,16 @@ acpi_ns_externalize_name (
         */
        if (*converted_name_length > internal_name_length) {
                REPORT_ERROR (("Ns_externalize_name: Invalid internal name\n"));
-               return (AE_BAD_PATHNAME);
+               return_ACPI_STATUS (AE_BAD_PATHNAME);
        }
 
        /*
         * Build Converted_name...
         */
 
-       (*converted_name) = acpi_ut_callocate (*converted_name_length);
+       (*converted_name) = ACPI_MEM_CALLOCATE (*converted_name_length);
        if (!(*converted_name)) {
-               return (AE_NO_MEMORY);
+               return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
        j = 0;
@@ -520,7 +543,7 @@ acpi_ns_externalize_name (
                }
        }
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -536,11 +559,14 @@ acpi_ns_externalize_name (
  *
  ******************************************************************************/
 
-ACPI_NAMESPACE_NODE *
+acpi_namespace_node *
 acpi_ns_convert_handle_to_entry (
-       ACPI_HANDLE             handle)
+       acpi_handle             handle)
 {
 
+       FUNCTION_ENTRY ();
+
+
        /*
         * Simple implementation for now;
         * TBD: [Future] Real integer handles allow for more verification
@@ -561,7 +587,7 @@ acpi_ns_convert_handle_to_entry (
                return (NULL);
        }
 
-       return ((ACPI_NAMESPACE_NODE *) handle);
+       return ((acpi_namespace_node *) handle);
 }
 
 
@@ -571,15 +597,15 @@ acpi_ns_convert_handle_to_entry (
  *
  * PARAMETERS:  Node          - Node to be converted to a Handle
  *
- * RETURN:      An USER ACPI_HANDLE
+ * RETURN:      An USER acpi_handle
  *
  * DESCRIPTION: Convert a real Node to a namespace handle
  *
  ******************************************************************************/
 
-ACPI_HANDLE
+acpi_handle
 acpi_ns_convert_entry_to_handle (
-       ACPI_NAMESPACE_NODE         *node)
+       acpi_namespace_node         *node)
 {
 
 
@@ -588,7 +614,7 @@ acpi_ns_convert_entry_to_handle (
         * TBD: [Future] Real integer handles allow for more verification
         * and keep all pointers within this subsystem!
         */
-       return ((ACPI_HANDLE) node);
+       return ((acpi_handle) node);
 
 
 /* ---------------------------------------------------
@@ -604,7 +630,7 @@ acpi_ns_convert_entry_to_handle (
        }
 
 
-       return ((ACPI_HANDLE) Node);
+       return ((acpi_handle) Node);
 ------------------------------------------------------*/
 }
 
@@ -624,8 +650,11 @@ acpi_ns_convert_entry_to_handle (
 void
 acpi_ns_terminate (void)
 {
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_NAMESPACE_NODE     *this_node;
+       acpi_operand_object     *obj_desc;
+       acpi_namespace_node     *this_node;
+
+
+       FUNCTION_TRACE ("Ns_terminate");
 
 
        this_node = acpi_gbl_root_node;
@@ -647,12 +676,16 @@ acpi_ns_terminate (void)
        }
 
        acpi_ns_delete_children (this_node);
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace freed\n"));
+
 
        /*
         * 2) Now we can delete the ACPI tables
         */
        acpi_tb_delete_acpi_tables ();
-       return;
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ACPI Tables freed\n"));
+
+       return_VOID;
 }
 
 
@@ -669,17 +702,19 @@ acpi_ns_terminate (void)
 
 u32
 acpi_ns_opens_scope (
-       ACPI_OBJECT_TYPE8       type)
+       acpi_object_type8       type)
 {
+       FUNCTION_TRACE_U32 ("Ns_opens_scope", type);
+
 
        if (!acpi_ut_valid_object_type (type)) {
                /* type code out of range  */
 
                REPORT_WARNING (("Ns_opens_scope: Invalid Object Type\n"));
-               return (NSP_NORMAL);
+               return_VALUE (NSP_NORMAL);
        }
 
-       return (((u32) acpi_gbl_ns_properties[type]) & NSP_NEWSCOPE);
+       return_VALUE (((u32) acpi_gbl_ns_properties[type]) & NSP_NEWSCOPE);
 }
 
 
@@ -703,25 +738,28 @@ acpi_ns_opens_scope (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_get_node (
        NATIVE_CHAR             *pathname,
-       ACPI_NAMESPACE_NODE     *start_node,
-       ACPI_NAMESPACE_NODE     **return_node)
+       acpi_namespace_node     *start_node,
+       acpi_namespace_node     **return_node)
 {
-       ACPI_GENERIC_STATE      scope_info;
-       ACPI_STATUS             status;
+       acpi_generic_state      scope_info;
+       acpi_status             status;
        NATIVE_CHAR             *internal_path = NULL;
 
 
+       FUNCTION_TRACE_PTR ("Ns_get_node", pathname);
+
+
        /* Ensure that the namespace has been initialized */
 
        if (!acpi_gbl_root_node) {
-               return (AE_NO_NAMESPACE);
+               return_ACPI_STATUS (AE_NO_NAMESPACE);
        }
 
        if (!pathname) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
 
@@ -729,7 +767,7 @@ acpi_ns_get_node (
 
        status = acpi_ns_internalize_name (pathname, &internal_path);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
 
@@ -746,14 +784,18 @@ acpi_ns_get_node (
                         NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
                         NULL, return_node);
 
+       if (ACPI_FAILURE (status)) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s, %s\n",
+                               internal_path, acpi_format_exception (status)));
+       }
 
 
        acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 
        /* Cleanup */
 
-       acpi_ut_free (internal_path);
-       return (status);
+       ACPI_MEM_FREE (internal_path);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -771,11 +813,14 @@ acpi_ns_get_node (
  *
  ******************************************************************************/
 
-ACPI_NAME
+acpi_name
 acpi_ns_find_parent_name (
-       ACPI_NAMESPACE_NODE     *child_node)
+       acpi_namespace_node     *child_node)
 {
-       ACPI_NAMESPACE_NODE     *parent_node;
+       acpi_namespace_node     *parent_node;
+
+
+       FUNCTION_TRACE ("Ns_find_parent_name");
 
 
        if (child_node) {
@@ -783,17 +828,59 @@ acpi_ns_find_parent_name (
 
                parent_node = acpi_ns_get_parent_object (child_node);
                if (parent_node) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Parent of %p [%4.4s] is %p [%4.4s]\n",
+                               child_node, &child_node->name, parent_node, &parent_node->name));
+
                        if (parent_node->name) {
-                               return (parent_node->name);
+                               return_VALUE (parent_node->name);
                        }
                }
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "unable to find parent of %p (%4.4s)\n",
+                       child_node, &child_node->name));
        }
 
-       return (ACPI_UNKNOWN_NAME);
+       return_VALUE (ACPI_UNKNOWN_NAME);
 }
 
 
+#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER)
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ns_exist_downstream_sibling
+ *
+ * PARAMETERS:  *Node          - pointer to first Node to examine
+ *
+ * RETURN:      TRUE if sibling is found, FALSE otherwise
+ *
+ * DESCRIPTION: Searches remainder of scope being processed to determine
+ *              whether there is a downstream sibling to the current
+ *              object.  This function is used to determine what type of
+ *              line drawing character to use when displaying namespace
+ *              trees.
+ *
+ ******************************************************************************/
+
+u8
+acpi_ns_exist_downstream_sibling (
+       acpi_namespace_node     *node)
+{
+
+       if (!node) {
+               return (FALSE);
+       }
+
+       if (node->name) {
+               return (TRUE);
+       }
+
+       return (FALSE);
+}
+
+#endif /* ACPI_DEBUG */
+
+
 /*******************************************************************************
  *
  * FUNCTION:    Acpi_ns_get_parent_object
@@ -807,12 +894,15 @@ acpi_ns_find_parent_name (
  ******************************************************************************/
 
 
-ACPI_NAMESPACE_NODE *
+acpi_namespace_node *
 acpi_ns_get_parent_object (
-       ACPI_NAMESPACE_NODE     *node)
+       acpi_namespace_node     *node)
 {
 
 
+       FUNCTION_ENTRY ();
+
+
        if (!node) {
                return (NULL);
        }
@@ -848,9 +938,9 @@ acpi_ns_get_parent_object (
  ******************************************************************************/
 
 
-ACPI_NAMESPACE_NODE *
+acpi_namespace_node *
 acpi_ns_get_next_valid_object (
-       ACPI_NAMESPACE_NODE     *node)
+       acpi_namespace_node     *node)
 {
 
        /* If we are at the end of this peer list, return NULL */
index 786b08a5e61e41a55686ea25a4ce0738906f0502..a4313f2f023b0e3130b5dd39541d9a09a31de7d8 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
- * Module Name: nswalk - Functions for walking the APCI namespace
- *              $Revision: 22 $
+ * Module Name: nswalk - Functions for walking the ACPI namespace
+ *              $Revision: 24 $
  *
  *****************************************************************************/
 
@@ -43,7 +43,7 @@
  *              Last_child          - Previous child that was found.
  *                                    The NEXT child will be returned
  *
- * RETURN:      ACPI_NAMESPACE_NODE - Pointer to the NEXT child or NULL if
+ * RETURN:      acpi_namespace_node - Pointer to the NEXT child or NULL if
  *                                      none is found.
  *
  * DESCRIPTION: Return the next peer object within the namespace.  If Handle
  *
  ****************************************************************************/
 
-ACPI_NAMESPACE_NODE *
+acpi_namespace_node *
 acpi_ns_get_next_object (
-       ACPI_OBJECT_TYPE8       type,
-       ACPI_NAMESPACE_NODE     *parent_node,
-       ACPI_NAMESPACE_NODE     *child_node)
+       acpi_object_type8       type,
+       acpi_namespace_node     *parent_node,
+       acpi_namespace_node     *child_node)
 {
-       ACPI_NAMESPACE_NODE     *next_node = NULL;
+       acpi_namespace_node     *next_node = NULL;
 
 
-       if (!child_node) {
+       FUNCTION_ENTRY ();
+
 
+       if (!child_node) {
                /* It's really the parent's _scope_ that we want */
 
                if (parent_node->child) {
@@ -111,7 +113,7 @@ acpi_ns_get_next_object (
  *
  * FUNCTION:    Acpi_ns_walk_namespace
  *
- * PARAMETERS:  Type                - ACPI_OBJECT_TYPE to search for
+ * PARAMETERS:  Type                - acpi_object_type to search for
  *              Start_node          - Handle in namespace where search begins
  *              Max_depth           - Depth to which search is to reach
  *              Unlock_before_callback- Whether to unlock the NS before invoking
@@ -137,23 +139,26 @@ acpi_ns_get_next_object (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_walk_namespace (
-       ACPI_OBJECT_TYPE8       type,
-       ACPI_HANDLE             start_node,
+       acpi_object_type8       type,
+       acpi_handle             start_node,
        u32                     max_depth,
        u8                      unlock_before_callback,
        ACPI_WALK_CALLBACK      user_function,
        void                    *context,
        void                    **return_value)
 {
-       ACPI_STATUS             status;
-       ACPI_NAMESPACE_NODE     *child_node;
-       ACPI_NAMESPACE_NODE     *parent_node;
-       ACPI_OBJECT_TYPE8        child_type;
+       acpi_status             status;
+       acpi_namespace_node     *child_node;
+       acpi_namespace_node     *parent_node;
+       acpi_object_type8        child_type;
        u32                     level;
 
 
+       FUNCTION_TRACE ("Ns_walk_namespace");
+
+
        /* Special case for the namespace Root Node */
 
        if (start_node == ACPI_ROOT_OBJECT) {
@@ -173,13 +178,11 @@ acpi_ns_walk_namespace (
         * started. When Level is zero, the loop is done because we have
         * bubbled up to (and passed) the original parent handle (Start_entry)
         */
-
        while (level > 0) {
                /*
                 * Get the next typed object in this scope.  Null returned
                 * if not found
                 */
-
                status = AE_OK;
                child_node = acpi_ns_get_next_object (ACPI_TYPE_ANY,
                                 parent_node,
@@ -190,7 +193,6 @@ acpi_ns_walk_namespace (
                         * Found an object, Get the type if we are not
                         * searching for ANY
                         */
-
                        if (type != ACPI_TYPE_ANY) {
                                child_type = child_node->type;
                        }
@@ -200,7 +202,6 @@ acpi_ns_walk_namespace (
                                 * Found a matching object, invoke the user
                                 * callback function
                                 */
-
                                if (unlock_before_callback) {
                                        acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
                                }
@@ -215,17 +216,22 @@ acpi_ns_walk_namespace (
                                switch (status) {
                                case AE_OK:
                                case AE_CTRL_DEPTH:
+
                                        /* Just keep going */
                                        break;
 
                                case AE_CTRL_TERMINATE:
+
                                        /* Exit now, with OK status */
-                                       return (AE_OK);
+
+                                       return_ACPI_STATUS (AE_OK);
                                        break;
 
                                default:
+
                                        /* All others are valid exceptions */
-                                       return (status);
+
+                                       return_ACPI_STATUS (status);
                                        break;
                                }
                        }
@@ -238,7 +244,6 @@ acpi_ns_walk_namespace (
                         * or if the user function has specified that the
                         * maximum depth has been reached.
                         */
-
                        if ((level < max_depth) && (status != AE_CTRL_DEPTH)) {
                                if (acpi_ns_get_next_object (ACPI_TYPE_ANY,
                                                 child_node, 0)) {
@@ -266,7 +271,8 @@ acpi_ns_walk_namespace (
        }
 
        /* Complete walk, not terminated by user function */
-       return (AE_OK);
+
+       return_ACPI_STATUS (AE_OK);
 }
 
 
index 0f2aa45b34f7a388cf5ebe15edb273b8870e7f2a..e489509e0d486edac8aca5094fc16d010f059e09 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Module Name: nsxfname - Public interfaces to the ACPI subsystem
  *                         ACPI Namespace oriented interfaces
- *              $Revision: 79 $
+ *              $Revision: 80 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_get_handle (
-       ACPI_HANDLE             parent,
-       ACPI_STRING             pathname,
-       ACPI_HANDLE             *ret_handle)
+       acpi_handle             parent,
+       acpi_string             pathname,
+       acpi_handle             *ret_handle)
 {
-       ACPI_STATUS             status;
-       ACPI_NAMESPACE_NODE     *node = NULL;
-       ACPI_NAMESPACE_NODE     *prefix_node = NULL;
+       acpi_status             status;
+       acpi_namespace_node     *node = NULL;
+       acpi_namespace_node     *prefix_node = NULL;
+
+
+       FUNCTION_ENTRY ();
 
 
        /* Ensure that ACPI has been initialized */
@@ -117,7 +120,7 @@ acpi_get_handle (
 
 /****************************************************************************
  *
- * FUNCTION:    Acpi_get_pathname
+ * FUNCTION:    Acpi_get_name
  *
  * PARAMETERS:  Handle          - Handle to be converted to a pathname
  *              Name_type       - Full pathname or single segment
@@ -131,14 +134,14 @@ acpi_get_handle (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_get_name (
-       ACPI_HANDLE             handle,
+       acpi_handle             handle,
        u32                     name_type,
-       ACPI_BUFFER             *ret_path_ptr)
+       acpi_buffer             *ret_path_ptr)
 {
-       ACPI_STATUS             status;
-       ACPI_NAMESPACE_NODE     *node;
+       acpi_status             status;
+       acpi_namespace_node     *node;
 
 
        /* Ensure that ACPI has been initialized */
@@ -173,7 +176,6 @@ acpi_get_name (
         * Wants the single segment ACPI name.
         * Validate handle and convert to an Node
         */
-
        acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
        node = acpi_ns_convert_handle_to_entry (handle);
        if (!node) {
@@ -219,17 +221,17 @@ unlock_and_exit:
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_get_object_info (
-       ACPI_HANDLE             handle,
-       ACPI_DEVICE_INFO        *info)
+       acpi_handle             handle,
+       acpi_device_info        *info)
 {
        ACPI_DEVICE_ID          hid;
        ACPI_DEVICE_ID          uid;
-       ACPI_STATUS             status;
+       acpi_status             status;
        u32                     device_status = 0;
-       ACPI_INTEGER            address = 0;
-       ACPI_NAMESPACE_NODE     *node;
+       acpi_integer            address = 0;
+       acpi_namespace_node     *node;
 
 
        /* Ensure that ACPI has been initialized */
@@ -273,7 +275,6 @@ acpi_get_object_info (
         * not be present.  The Info->Valid bits are used
         * to indicate which methods ran successfully.
         */
-
        info->valid = 0;
 
        /* Execute the _HID method and save the result */
@@ -298,7 +299,6 @@ acpi_get_object_info (
         * Execute the _STA method and save the result
         * _STA is not always present
         */
-
        status = acpi_ut_execute_STA (node, &device_status);
        if (ACPI_SUCCESS (status)) {
                info->current_status = device_status;
@@ -309,7 +309,6 @@ acpi_get_object_info (
         * Execute the _ADR method and save result if successful
         * _ADR is not always present
         */
-
        status = acpi_ut_evaluate_numeric_object (METHOD_NAME__ADR,
                          node, &address);
 
index 95d7a6292ac2367e23c513bdaa09d3672d0bdfb8..8dd6fad0c9552af2b6d95ae08e3040f2bab55eb4 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Module Name: nsxfobj - Public interfaces to the ACPI subsystem
  *                         ACPI Object oriented interfaces
- *              $Revision: 86 $
+ *              $Revision: 90 $
  *
  ******************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_evaluate_object (
-       ACPI_HANDLE             handle,
-       ACPI_STRING             pathname,
-       ACPI_OBJECT_LIST        *param_objects,
-       ACPI_BUFFER             *return_buffer)
+       acpi_handle             handle,
+       acpi_string             pathname,
+       acpi_object_list        *param_objects,
+       acpi_buffer             *return_buffer)
 {
-       ACPI_STATUS             status;
-       ACPI_OPERAND_OBJECT     **param_ptr = NULL;
-       ACPI_OPERAND_OBJECT     *return_obj = NULL;
-       ACPI_OPERAND_OBJECT     *object_ptr = NULL;
+       acpi_status             status;
+       acpi_operand_object     **param_ptr = NULL;
+       acpi_operand_object     *return_obj = NULL;
        u32                     buffer_space_needed;
        u32                     user_buffer_length;
-       u32                     count;
        u32                     i;
-       u32                     param_length;
-       u32                     object_length;
+
+
+       FUNCTION_TRACE ("Acpi_evaluate_object");
 
 
        /* Ensure that ACPI has been initialized */
 
        ACPI_IS_INITIALIZATION_COMPLETE (status);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /*
@@ -88,50 +87,31 @@ acpi_evaluate_object (
         * (which must be a control method), the external objects
         * must be converted to internal objects
         */
-
        if (param_objects && param_objects->count) {
                /*
                 * Allocate a new parameter block for the internal objects
                 * Add 1 to count to allow for null terminated internal list
                 */
-
-               count           = param_objects->count;
-               param_length    = (count + 1) * sizeof (void *);
-               object_length   = count * sizeof (ACPI_OPERAND_OBJECT);
-
-               param_ptr = acpi_ut_callocate (param_length + /* Parameter List part */
-                                 object_length); /* Actual objects */
+               param_ptr = ACPI_MEM_CALLOCATE ((param_objects->count + 1) * sizeof (void *));
                if (!param_ptr) {
-                       return (AE_NO_MEMORY);
+                       return_ACPI_STATUS (AE_NO_MEMORY);
                }
 
-               object_ptr = (ACPI_OPERAND_OBJECT *) ((u8 *) param_ptr +
-                                 param_length);
-
-               /*
-                * Init the param array of pointers and NULL terminate
-                * the list
-                */
-
-               for (i = 0; i < count; i++) {
-                       param_ptr[i] = &object_ptr[i];
-                       acpi_ut_init_static_object (&object_ptr[i]);
-               }
-               param_ptr[count] = NULL;
 
                /*
                 * Convert each external object in the list to an
                 * internal object
                 */
-               for (i = 0; i < count; i++) {
+               for (i = 0; i < param_objects->count; i++) {
                        status = acpi_ut_copy_eobject_to_iobject (&param_objects->pointer[i],
-                                        param_ptr[i]);
+                                        &param_ptr[i]);
 
                        if (ACPI_FAILURE (status)) {
                                acpi_ut_delete_internal_object_list (param_ptr);
-                               return (status);
+                               return_ACPI_STATUS (status);
                        }
                }
+               param_ptr[param_objects->count] = NULL;
        }
 
 
@@ -141,7 +121,6 @@ acpi_evaluate_object (
         * 2) No handle, not fully qualified pathname (error)
         * 3) Valid handle
         */
-
        if ((pathname) &&
                (acpi_ns_valid_root_prefix (pathname[0]))) {
                /*
@@ -156,8 +135,13 @@ acpi_evaluate_object (
                 * is specified.  Since we've already handled fully
                 * qualified names above, this is an error
                 */
+               if (!pathname) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Both Handle and Pathname are NULL\n"));
+               }
 
-
+               else {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Handle is NULL and Pathname is relative\n"));
+               }
 
                status = AE_BAD_PARAMETER;
        }
@@ -168,7 +152,6 @@ acpi_evaluate_object (
                 * pathname it is relative.  The handle will be validated
                 * in the lower procedures
                 */
-
                if (!pathname) {
                        /*
                         * The null pathname case means the handle is for
@@ -225,13 +208,15 @@ acpi_evaluate_object (
                                         * Check if there is enough room in the
                                         * caller's buffer
                                         */
-
                                        if (user_buffer_length < buffer_space_needed) {
                                                /*
                                                 * Caller's buffer is too small, can't
                                                 * give him partial results fail the call
                                                 * but return the buffer size needed
                                                 */
+                                               ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+                                                       "Needed buffer size %X, received %X\n",
+                                                       buffer_space_needed, user_buffer_length));
 
                                                return_buffer->length = buffer_space_needed;
                                                status = AE_BUFFER_OVERFLOW;
@@ -264,14 +249,13 @@ acpi_evaluate_object (
        /*
         * Free the input parameter list (if we created one),
         */
-
        if (param_ptr) {
                /* Free the allocated parameter block */
 
                acpi_ut_delete_internal_object_list (param_ptr);
        }
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -293,17 +277,17 @@ acpi_evaluate_object (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_get_next_object (
-       ACPI_OBJECT_TYPE        type,
-       ACPI_HANDLE             parent,
-       ACPI_HANDLE             child,
-       ACPI_HANDLE             *ret_handle)
+       acpi_object_type        type,
+       acpi_handle             parent,
+       acpi_handle             child,
+       acpi_handle             *ret_handle)
 {
-       ACPI_STATUS             status = AE_OK;
-       ACPI_NAMESPACE_NODE     *node;
-       ACPI_NAMESPACE_NODE     *parent_node = NULL;
-       ACPI_NAMESPACE_NODE     *child_node = NULL;
+       acpi_status             status = AE_OK;
+       acpi_namespace_node     *node;
+       acpi_namespace_node     *parent_node = NULL;
+       acpi_namespace_node     *child_node = NULL;
 
 
        /* Ensure that ACPI has been initialized */
@@ -348,7 +332,7 @@ acpi_get_next_object (
 
        /* Internal function does the real work */
 
-       node = acpi_ns_get_next_object ((ACPI_OBJECT_TYPE8) type,
+       node = acpi_ns_get_next_object ((acpi_object_type8) type,
                           parent_node, child_node);
        if (!node) {
                status = AE_NOT_FOUND;
@@ -380,13 +364,13 @@ unlock_and_exit:
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_get_type (
-       ACPI_HANDLE             handle,
-       ACPI_OBJECT_TYPE        *ret_type)
+       acpi_handle             handle,
+       acpi_object_type        *ret_type)
 {
-       ACPI_NAMESPACE_NODE     *node;
-       ACPI_STATUS             status;
+       acpi_namespace_node     *node;
+       acpi_status             status;
 
 
        /* Ensure that ACPI has been initialized */
@@ -443,13 +427,13 @@ acpi_get_type (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_get_parent (
-       ACPI_HANDLE             handle,
-       ACPI_HANDLE             *ret_handle)
+       acpi_handle             handle,
+       acpi_handle             *ret_handle)
 {
-       ACPI_NAMESPACE_NODE     *node;
-       ACPI_STATUS             status = AE_OK;
+       acpi_namespace_node     *node;
+       acpi_status             status = AE_OK;
 
 
        /* Ensure that ACPI has been initialized */
@@ -504,7 +488,7 @@ unlock_and_exit:
  *
  * FUNCTION:    Acpi_walk_namespace
  *
- * PARAMETERS:  Type                - ACPI_OBJECT_TYPE to search for
+ * PARAMETERS:  Type                - acpi_object_type to search for
  *              Start_object        - Handle in namespace where search begins
  *              Max_depth           - Depth to which search is to reach
  *              User_function       - Called when an object of "Type" is found
@@ -530,23 +514,26 @@ unlock_and_exit:
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_walk_namespace (
-       ACPI_OBJECT_TYPE        type,
-       ACPI_HANDLE             start_object,
+       acpi_object_type        type,
+       acpi_handle             start_object,
        u32                     max_depth,
        ACPI_WALK_CALLBACK      user_function,
        void                    *context,
        void                    **return_value)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Acpi_walk_namespace");
 
 
        /* Ensure that ACPI has been initialized */
 
        ACPI_IS_INITIALIZATION_COMPLETE (status);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Parameter validation */
@@ -554,7 +541,7 @@ acpi_walk_namespace (
        if ((type > ACPI_TYPE_MAX)  ||
                (!max_depth)            ||
                (!user_function)) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        /*
@@ -563,9 +550,8 @@ acpi_walk_namespace (
         * to the user function - since this function
         * must be allowed to make Acpi calls itself.
         */
-
        acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-       status = acpi_ns_walk_namespace ((ACPI_OBJECT_TYPE8) type,
+       status = acpi_ns_walk_namespace ((acpi_object_type8) type,
                           start_object, max_depth,
                           NS_WALK_UNLOCK,
                           user_function, context,
@@ -573,7 +559,7 @@ acpi_walk_namespace (
 
        acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -591,15 +577,15 @@ acpi_walk_namespace (
  *
  ******************************************************************************/
 
-static ACPI_STATUS
+static acpi_status
 acpi_ns_get_device_callback (
-       ACPI_HANDLE             obj_handle,
+       acpi_handle             obj_handle,
        u32                     nesting_level,
        void                    *context,
        void                    **return_value)
 {
-       ACPI_STATUS             status;
-       ACPI_NAMESPACE_NODE     *node;
+       acpi_status             status;
+       acpi_namespace_node     *node;
        u32                     flags;
        ACPI_DEVICE_ID          device_id;
        ACPI_GET_DEVICES_INFO   *info;
@@ -676,28 +662,31 @@ acpi_ns_get_device_callback (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_get_devices (
        NATIVE_CHAR             *HID,
        ACPI_WALK_CALLBACK      user_function,
        void                    *context,
        void                    **return_value)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
        ACPI_GET_DEVICES_INFO   info;
 
 
+       FUNCTION_TRACE ("Acpi_get_devices");
+
+
        /* Ensure that ACPI has been initialized */
 
        ACPI_IS_INITIALIZATION_COMPLETE (status);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Parameter validation */
 
        if (!user_function) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        /*
@@ -714,7 +703,6 @@ acpi_get_devices (
         * to the user function - since this function
         * must be allowed to make Acpi calls itself.
         */
-
        acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
        status = acpi_ns_walk_namespace (ACPI_TYPE_DEVICE,
                           ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
@@ -724,5 +712,5 @@ acpi_get_devices (
 
        acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
index fd3580f6b3d4f4d2a46dca306628b2f4ad797265..d9ccc1e85196ae05d28c5961be764e730c0031b9 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  * 
  * Module Name: os.c - Linux OSL functions
- *             $Revision: 28 $
+ *             $Revision: 46 $
  *
  *****************************************************************************/
 
 #include <acpi.h>
 #include "driver.h"
 
+#ifdef CONFIG_ACPI_EFI
+#include <asm/efi.h>
+#endif
+
+#ifdef _IA64
+#include <asm/hw_irq.h>
+#endif 
+
 #define _COMPONENT     ACPI_OS_SERVICES
        MODULE_NAME     ("os")
 
@@ -80,19 +88,20 @@ static void *acpi_irq_context = NULL;
  *                                Functions
  *****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_os_initialize(void)
 {
        return AE_OK;
 }
 
-ACPI_STATUS
+acpi_status
 acpi_os_terminate(void)
 {
        if (acpi_irq_handler) {
                acpi_os_remove_interrupt_handler(acpi_irq_irq,
                                                 acpi_irq_handler);
        }
+
        return AE_OK;
 }
 
@@ -104,6 +113,7 @@ acpi_os_printf(const NATIVE_CHAR *fmt,...)
        va_start(args, fmt);
        size = acpi_os_vprintf(fmt, args);
        va_end(args);
+
        return size;
 }
 
@@ -138,6 +148,7 @@ acpi_os_callocate(u32 size)
        void *ptr = acpi_os_allocate(size);
        if (ptr)
                memset(ptr, 0, size);
+
        return ptr;
 }
 
@@ -147,7 +158,31 @@ acpi_os_free(void *ptr)
        kfree(ptr);
 }
 
-ACPI_STATUS
+
+acpi_status
+acpi_os_get_root_pointer(u32 flags, ACPI_PHYSICAL_ADDRESS *phys_addr)
+{
+#ifndef CONFIG_ACPI_EFI
+       if (ACPI_FAILURE(acpi_find_root_pointer(flags, phys_addr))) {
+               printk(KERN_ERR "ACPI: System description tables not found\n");
+               return AE_ERROR;
+       }
+#else /*CONFIG_ACPI_EFI*/
+       if (efi.acpi20)
+               *phys_addr = (ACPI_PHYSICAL_ADDRESS) efi.acpi20;
+       else if (efi.acpi)
+               *phys_addr = (ACPI_PHYSICAL_ADDRESS) efi.acpi;
+       else {
+               printk(KERN_ERR "ACPI: System description tables not found\n");
+               *phys_addr = NULL;
+               return AE_ERROR;
+       }
+#endif /*CONFIG_ACPI_EFI*/
+
+       return AE_OK;
+}
+
+acpi_status
 acpi_os_map_memory(ACPI_PHYSICAL_ADDRESS phys, u32 size, void **virt)
 {
        if (phys > ULONG_MAX) {
@@ -181,7 +216,7 @@ acpi_os_unmap_memory(void *virt, u32 size)
                iounmap(virt);
 }
 
-ACPI_STATUS
+acpi_status
 acpi_os_get_physical_address(void *virt, ACPI_PHYSICAL_ADDRESS *phys)
 {
        if(!phys || !virt)
@@ -198,9 +233,12 @@ acpi_irq(int irq, void *dev_id, struct pt_regs *regs)
        (*acpi_irq_handler)(acpi_irq_context);
 }
 
-ACPI_STATUS
+acpi_status
 acpi_os_install_interrupt_handler(u32 irq, OSD_HANDLER handler, void *context)
 {
+#ifdef _IA64
+       irq = isa_irq_to_vector(irq);
+#endif /*_IA64*/
        acpi_irq_irq = irq;
        acpi_irq_handler = handler;
        acpi_irq_context = context;
@@ -212,13 +250,17 @@ acpi_os_install_interrupt_handler(u32 irq, OSD_HANDLER handler, void *context)
                printk(KERN_ERR "ACPI: SCI (IRQ%d) allocation failed\n", irq);
                return AE_ERROR;
        }
+
        return AE_OK;
 }
 
-ACPI_STATUS
+acpi_status
 acpi_os_remove_interrupt_handler(u32 irq, OSD_HANDLER handler)
 {
        if (acpi_irq_handler) {
+#ifdef _IA64
+               irq = isa_irq_to_vector(irq);
+#endif /*_IA64*/
                free_irq(irq, acpi_irq);
                acpi_irq_handler = NULL;
        }
@@ -238,203 +280,298 @@ acpi_os_sleep(u32 sec, u32 ms)
 }
 
 void
-acpi_os_sleep_usec(u32 us)
+acpi_os_stall(u32 us)
 {
-       udelay(us);
+       if (us > 10000) {
+               mdelay(us / 1000);
+       }
+       else {
+               udelay(us);
+       }
 }
 
-u8
-acpi_os_in8(ACPI_IO_ADDRESS port)
+acpi_status
+acpi_os_read_port(
+       ACPI_IO_ADDRESS port,
+       void            *value,
+       u32             width)
 {
-       return inb(port);
-}
+       u32 dummy;
 
-u16
-acpi_os_in16(ACPI_IO_ADDRESS port)
-{
-       return inw(port);
-}
+       if (!value)
+               value = &dummy;
 
-u32
-acpi_os_in32(ACPI_IO_ADDRESS port)
-{
-       return inl(port);
-}
-
-void
-acpi_os_out8(ACPI_IO_ADDRESS port, u8 val)
-{
-       outb(val, port);
-}
+       switch (width)
+       {
+       case 8:
+               *(u8*)  value = inb(port);
+               break;
+       case 16:
+               *(u16*) value = inw(port);
+               break;
+       case 32:
+               *(u32*) value = inl(port);
+               break;
+       default:
+               BUG();
+       }
 
-void
-acpi_os_out16(ACPI_IO_ADDRESS port, u16 val)
-{
-       outw(val, port);
+       return AE_OK;
 }
 
-void
-acpi_os_out32(ACPI_IO_ADDRESS port, u32 val)
+acpi_status
+acpi_os_write_port(
+       ACPI_IO_ADDRESS port,
+       u32             value,
+       u32             width)
 {
-       outl(val, port);
-}
+       switch (width)
+       {
+       case 8:
+               outb(value, port);
+               break;
+       case 16:
+               outw(value, port);
+               break;
+       case 32:
+               outl(value, port);
+               break;
+       default:
+               BUG();
+       }
 
-UINT8
-acpi_os_mem_in8 (ACPI_PHYSICAL_ADDRESS phys_addr)
-{
-       return (*(u8*) (u32) phys_addr);
+       return AE_OK;
 }
 
-UINT16
-acpi_os_mem_in16 (ACPI_PHYSICAL_ADDRESS phys_addr)
+acpi_status
+acpi_os_read_memory(
+       ACPI_PHYSICAL_ADDRESS   phys_addr,
+       void                    *value,
+       u32                     width)
 {
-       return (*(u16*) (u32) phys_addr);
-}
+       u32 dummy;
 
-UINT32
-acpi_os_mem_in32 (ACPI_PHYSICAL_ADDRESS phys_addr)
-{
-       return (*(u32*) (u32) phys_addr);
-}
+       if (!value)
+               value = &dummy;
 
-void
-acpi_os_mem_out8 (ACPI_PHYSICAL_ADDRESS phys_addr, UINT8 value)
-{
-       *(u8*) phys_to_virt(phys_addr) = value;
-}
+       switch (width)
+       {
+       case 8:
+               *(u8*) value = *(u8*) phys_to_virt(phys_addr);
+               break;
+       case 16:
+               *(u16*) value = *(u16*) phys_to_virt(phys_addr);
+               break;
+       case 32:
+               *(u32*) value = *(u32*) phys_to_virt(phys_addr);
+               break;
+       default:
+               BUG();
+       }
 
-void
-acpi_os_mem_out16 (ACPI_PHYSICAL_ADDRESS phys_addr, UINT16 value)
-{
-       *(u16*) phys_to_virt(phys_addr) = value;
+       return AE_OK;
 }
 
-void
-acpi_os_mem_out32 (ACPI_PHYSICAL_ADDRESS phys_addr, UINT32 value)
+acpi_status
+acpi_os_write_memory(
+       ACPI_PHYSICAL_ADDRESS   phys_addr,
+       u32                     value,
+       u32                     width)
 {
-       *(u32*) phys_to_virt(phys_addr) = value;
-}
+       switch (width)
+       {
+       case 8:
+               *(u8*) phys_to_virt(phys_addr) = value;
+               break;
+       case 16:
+               *(u16*) phys_to_virt(phys_addr) = value;
+               break;
+       case 32:
+               *(u32*) phys_to_virt(phys_addr) = value;
+               break;
+       default:
+               BUG();
+       }
 
-ACPI_STATUS
-acpi_os_read_pci_cfg_byte(
-       u32 bus,
-       u32 func,
-       u32 addr,
-       u8 * val)
-{
-       int devfn = PCI_DEVFN((func >> 16) & 0xffff, func & 0xffff);
-       struct pci_dev *dev = pci_find_slot(bus & 0xffff, devfn);
-       if (!val || !dev || pci_read_config_byte(dev, addr, val))
-               return AE_ERROR;
        return AE_OK;
 }
 
-ACPI_STATUS
-acpi_os_read_pci_cfg_word(
-       u32 bus,
-       u32 func,
-       u32 addr,
-       u16 * val)
-{
-       int devfn = PCI_DEVFN((func >> 16) & 0xffff, func & 0xffff);
-       struct pci_dev *dev = pci_find_slot(bus & 0xffff, devfn);
-       if (!val || !dev || pci_read_config_word(dev, addr, val))
-               return AE_ERROR;
-       return AE_OK;
-}
 
-ACPI_STATUS
-acpi_os_read_pci_cfg_dword(
-       u32 bus,
-       u32 func,
-       u32 addr,
-       u32 * val)
+#ifdef CONFIG_ACPI_PCI
+
+/* Architecture-dependent low-level PCI configuration access functions. */
+extern int (*pci_config_read)(int seg, int bus, int dev, int fn, int reg, int len, u32 *val);
+extern int (*pci_config_write)(int seg, int bus, int dev, int fn, int reg, int len, u32 val);
+
+acpi_status
+acpi_os_read_pci_configuration (
+       acpi_pci_id             *pci_id,
+       u32                     reg,
+       void                    *value,
+       u32                     width)
 {
-       int devfn = PCI_DEVFN((func >> 16) & 0xffff, func & 0xffff);
-       struct pci_dev *dev = pci_find_slot(bus & 0xffff, devfn);
-       if (!val || !dev || pci_read_config_dword(dev, addr, val))
+       int                     result = 0;
+       if (!value)
                return AE_ERROR;
-       return AE_OK;
+
+       switch (width)
+       {
+       case 8:
+               result = pci_config_read(pci_id->segment, pci_id->bus, 
+                       pci_id->device, pci_id->function, reg, 1, value);
+               break;
+       case 16:
+               result = pci_config_read(pci_id->segment, pci_id->bus, 
+                       pci_id->device, pci_id->function, reg, 2, value);
+               break;
+       case 32:
+               result = pci_config_read(pci_id->segment, pci_id->bus, 
+                       pci_id->device, pci_id->function, reg, 4, value);
+               break;
+       default:
+               BUG();
+       }
+
+       return (result ? AE_ERROR : AE_OK);
 }
 
-ACPI_STATUS
-acpi_os_write_pci_cfg_byte(
-       u32 bus,
-       u32 func,
-       u32 addr,
-       u8 val)
+acpi_status
+acpi_os_write_pci_configuration (
+       acpi_pci_id             *pci_id,
+       u32                     reg,
+       NATIVE_UINT             value,
+       u32                     width)
 {
-       int devfn = PCI_DEVFN((func >> 16) & 0xffff, func & 0xffff);
-       struct pci_dev *dev = pci_find_slot(bus & 0xffff, devfn);
-       if (!dev || pci_write_config_byte(dev, addr, val))
-               return AE_ERROR;
-       return AE_OK;
+       int                     result = 0;
+
+       switch (width)
+       {
+       case 8:
+               result = pci_config_write(pci_id->segment, pci_id->bus, 
+                       pci_id->device, pci_id->function, reg, 1, value);
+               break;
+       case 16:
+               result = pci_config_write(pci_id->segment, pci_id->bus, 
+                       pci_id->device, pci_id->function, reg, 2, value);
+               break;
+       case 32:
+               result = pci_config_write(pci_id->segment, pci_id->bus, 
+                       pci_id->device, pci_id->function, reg, 4, value);
+               break;
+       default:
+               BUG();
+       }
+
+       return (result ? AE_ERROR : AE_OK);
 }
 
-ACPI_STATUS
-acpi_os_write_pci_cfg_word(
-       u32 bus,
-       u32 func,
-       u32 addr,
-       u16 val)
+#else /*CONFIG_ACPI_PCI*/
+
+acpi_status
+acpi_os_read_pci_configuration (
+       acpi_pci_id     *pci_id,
+       u32             reg,
+       void            *value,
+       u32             width)
 {
-       int devfn = PCI_DEVFN((func >> 16) & 0xffff, func & 0xffff);
-       struct pci_dev *dev = pci_find_slot(bus & 0xffff, devfn);
-       if (!dev || pci_write_config_word(dev, addr, val))
+       int devfn = PCI_DEVFN(pci_id->device, pci_id->function);
+       struct pci_dev *dev = pci_find_slot(pci_id->bus, devfn);
+
+       if (!value || !dev)
                return AE_ERROR;
+
+       switch (width)
+       {
+       case 8:
+               if (pci_read_config_byte(dev, reg, (u8*) value))
+                       return AE_ERROR;
+               break;
+       case 16:
+               if (pci_read_config_word(dev, reg, (u16*) value))
+                       return AE_ERROR;
+               break;
+       case 32:
+               if (pci_read_config_dword(dev, reg, (u32*) value))
+                       return AE_ERROR;
+               break;
+       default:
+               BUG();
+       }
+
        return AE_OK;
 }
 
-ACPI_STATUS
-acpi_os_write_pci_cfg_dword(
-       u32 bus,
-       u32 func,
-       u32 addr,
-       u32 val)
+acpi_status
+acpi_os_write_pci_configuration (
+       acpi_pci_id     *pci_id,
+       u32             reg,
+       u32             value,
+       u32             width)
 {
-       int devfn = PCI_DEVFN((func >> 16) & 0xffff, func & 0xffff);
-       struct pci_dev *dev = pci_find_slot(bus & 0xffff, devfn);
-       if (!dev || pci_write_config_dword(dev, addr, val))
+       int devfn = PCI_DEVFN(pci_id->device, pci_id->function);
+       struct pci_dev *dev = pci_find_slot(pci_id->bus, devfn);
+
+       if (!dev)
                return AE_ERROR;
+
+       switch (width)
+       {
+       case 8:
+               if (pci_write_config_byte(dev, reg, value))
+                       return AE_ERROR;
+               break;
+       case 16:
+               if (pci_write_config_word(dev, reg, value))
+                       return AE_ERROR;
+               break;
+       case 32:
+               if (pci_write_config_dword(dev, reg, value))
+                       return AE_ERROR;
+               break;
+       default:
+               BUG();
+       }
+
        return AE_OK;
 }
 
-ACPI_STATUS
+#endif /*CONFIG_ACPI_PCI*/
+
+
+acpi_status
 acpi_os_load_module (
        char *module_name)
 {
-       FUNCTION_TRACE("acpi_os_load_module");
+       PROC_NAME("acpi_os_load_module");
 
        if (!module_name)
-               return_ACPI_STATUS(AE_BAD_PARAMETER);
+               return AE_BAD_PARAMETER;
 
        if (0 > request_module(module_name)) {
-               DEBUG_PRINT(ACPI_WARN, ("Unable to load module [%s].\n", module_name));
-               return_ACPI_STATUS(AE_ERROR);
+               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Unable to load module [%s].\n", module_name));
+               return AE_ERROR;
        }
 
-       return_ACPI_STATUS(AE_OK);
+       return AE_OK;
 }
 
-ACPI_STATUS
+acpi_status
 acpi_os_unload_module (
        char *module_name)
 {
-       FUNCTION_TRACE("acpi_os_unload_module");
-
        if (!module_name)
-               return_ACPI_STATUS(AE_BAD_PARAMETER);
+               return AE_BAD_PARAMETER;
 
        /* TODO: How on Linux? */
        /* this is done automatically for all modules with
        use_count = 0, I think. see: MOD_INC_USE_COUNT -ASG */
 
-       return_ACPI_STATUS(AE_OK);
+       return AE_OK;
 }
 
 
 /*
- * See acpi_os_queue_for_execution(), too
+ * See acpi_os_queue_for_execution()
  */
 static int
 acpi_os_queue_exec (
@@ -442,21 +579,21 @@ acpi_os_queue_exec (
 {
        ACPI_OS_DPC             *dpc = (ACPI_OS_DPC*)context;
 
-       FUNCTION_TRACE("acpi_os_queue_exec");
+       PROC_NAME("acpi_os_queue_exec");
 
        daemonize();
        strcpy(current->comm, "kacpidpc");
     
        if (!dpc || !dpc->function)
-               return_ACPI_STATUS(AE_BAD_PARAMETER);
+               return AE_BAD_PARAMETER;
 
-       DEBUG_PRINT(ACPI_INFO, ("Executing function [%p(%p)].\n", dpc->function, dpc->context));
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Executing function [%p(%p)].\n", dpc->function, dpc->context));
 
        dpc->function(dpc->context);
 
-       acpi_os_free(dpc);
+       kfree(dpc);
 
-       return_VALUE(1);
+       return 1;
 }
 
 static void
@@ -466,52 +603,39 @@ acpi_os_schedule_exec (
        ACPI_OS_DPC             *dpc = NULL;
        int                     thread_pid = -1;
 
-       FUNCTION_TRACE("acpi_os_schedule_exec");
+       PROC_NAME("acpi_os_schedule_exec");
 
        dpc = (ACPI_OS_DPC*)context;
        if (!dpc) {
-               DEBUG_PRINT(ACPI_ERROR, ("Invalid (NULL) context.\n"));
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid (NULL) context.\n"));
                return;
        }
 
-       DEBUG_PRINT(ACPI_INFO, ("Creating new thread to run function [%p(%p)].\n", dpc->function, dpc->context));
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Creating new thread to run function [%p(%p)].\n", dpc->function, dpc->context));
 
        thread_pid = kernel_thread(acpi_os_queue_exec, dpc, 
                (CLONE_FS | CLONE_FILES | SIGCHLD));
        if (thread_pid < 0) {
-               DEBUG_PRINT(ACPI_ERROR, ("Call to kernel_thread() failed.\n"));
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Call to kernel_thread() failed.\n"));
                acpi_os_free(dpc);
        }
-
-       return_VOID;
 }
 
-ACPI_STATUS
+acpi_status
 acpi_os_queue_for_execution(
        u32                     priority,
        OSD_EXECUTION_CALLBACK  function,
        void                    *context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        ACPI_OS_DPC             *dpc = NULL;
 
-       FUNCTION_TRACE("acpi_os_queue_for_execution");
+       PROC_NAME("acpi_os_queue_for_execution");
 
-       DEBUG_PRINT(ACPI_INFO, ("Scheduling function [%p(%p)] for deferred execution.\n", function, context));
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Scheduling function [%p(%p)] for deferred execution.\n", function, context));
 
        if (!function)
-               return_ACPI_STATUS(AE_BAD_PARAMETER);
-
-       /*
-        * Allocate/initialize DPC structure.  Note that this memory will be
-        * freed by the callee.
-        */
-       dpc = acpi_os_callocate(sizeof(ACPI_OS_DPC));
-       if (!dpc) 
-               return AE_NO_MEMORY;
-
-       dpc->function = function;
-       dpc->context = context;
+               return AE_BAD_PARAMETER;
 
        /*
         * Queue via DPC:
@@ -528,48 +652,70 @@ acpi_os_queue_for_execution(
        {
                static struct tq_struct task;
 
+               /*
+                * Allocate/initialize DPC structure.  Note that this memory will be
+                * freed by the callee.
+                */
+               dpc = kmalloc(sizeof(ACPI_OS_DPC), GFP_ATOMIC);
+               if (!dpc) 
+                       return AE_NO_MEMORY;
+
+               dpc->function = function;
+               dpc->context = context;
+
                memset(&task, 0, sizeof(struct tq_struct));
 
                task.routine = acpi_os_schedule_exec;
                task.data = (void*)dpc;
 
                if (schedule_task(&task) < 0) {
-                       DEBUG_PRINT(ACPI_ERROR, ("Call to schedule_task() failed.\n"));
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Call to schedule_task() failed.\n"));
                        status = AE_ERROR;
                }
        }
        break;
 
        default:
+               /*
+                * Allocate/initialize DPC structure.  Note that this memory will be
+                * freed by the callee.
+                */
+               dpc = kmalloc(sizeof(ACPI_OS_DPC), GFP_KERNEL);
+               if (!dpc) 
+                       return AE_NO_MEMORY;
+
+               dpc->function = function;
+               dpc->context = context;
+
                acpi_os_schedule_exec(dpc);
                break;
        }
 
-       return_ACPI_STATUS(status);
+       return status;
 }
 
 
-ACPI_STATUS
+acpi_status
 acpi_os_create_semaphore(
        u32             max_units,
        u32             initial_units,
-       ACPI_HANDLE     *handle)
+       acpi_handle     *handle)
 {
-    struct semaphore       *sem = NULL;
+       struct semaphore        *sem = NULL;
 
-    FUNCTION_TRACE("acpi_os_create_semaphore");
+       PROC_NAME("acpi_os_create_semaphore");
 
-    sem = acpi_os_callocate(sizeof(struct semaphore));
-    if (!sem)
-       return_ACPI_STATUS(AE_NO_MEMORY);
+       sem = acpi_os_callocate(sizeof(struct semaphore));
+       if (!sem)
+               return AE_NO_MEMORY;
 
-    sema_init(sem, initial_units);
+       sema_init(sem, initial_units);
 
-    *handle = (ACPI_HANDLE*)sem;
+       *handle = (acpi_handle*)sem;
 
-    DEBUG_PRINT(ACPI_INFO, ("Creating semaphore[%p|%d].\n", *handle, initial_units));
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Creating semaphore[%p|%d].\n", *handle, initial_units));
 
-    return_ACPI_STATUS(AE_OK);
+       return AE_OK;
 }
 
 
@@ -580,22 +726,22 @@ acpi_os_create_semaphore(
  * we at least check for blocked threads and signal/cancel them?
  */
 
-ACPI_STATUS
+acpi_status
 acpi_os_delete_semaphore(
-       ACPI_HANDLE handle)
+       acpi_handle     handle)
 {
-    struct semaphore       *sem = (struct semaphore*)handle;
+       struct semaphore *sem = (struct semaphore*) handle;
 
-    FUNCTION_TRACE("acpi_os_delete_semaphore");
+       PROC_NAME("acpi_os_delete_semaphore");
 
-    if (!sem) 
-       return AE_BAD_PARAMETER;
+       if (!sem) 
+               return AE_BAD_PARAMETER;
 
-    DEBUG_PRINT(ACPI_INFO, ("Deleting semaphore[%p].\n", handle));
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Deleting semaphore[%p].\n", handle));
 
-    acpi_os_free(sem); sem =  NULL;
+       acpi_os_free(sem); sem =  NULL;
 
-    return_ACPI_STATUS(AE_OK);
+       return AE_OK;
 }
 
 
@@ -608,25 +754,25 @@ acpi_os_delete_semaphore(
  *
  * TODO: Support for units > 1?
  */
-ACPI_STATUS
+acpi_status
 acpi_os_wait_semaphore(
-       ACPI_HANDLE     handle,
+       acpi_handle             handle,
        u32                     units,
        u32                     timeout)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        struct semaphore        *sem = (struct semaphore*)handle;
        int                     ret = 0;
 
-       FUNCTION_TRACE("acpi_os_wait_semaphore");
+       PROC_NAME("acpi_os_wait_semaphore");
 
        if (!sem || (units < 1)) 
-               return_ACPI_STATUS(AE_BAD_PARAMETER);
+               return AE_BAD_PARAMETER;
 
        if (units > 1)
-               return_ACPI_STATUS(AE_SUPPORT);
+               return AE_SUPPORT;
 
-       DEBUG_PRINT(ACPI_INFO, ("Waiting for semaphore[%p|%d|%d]\n", handle, units, timeout));
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Waiting for semaphore[%p|%d|%d]\n", handle, units, timeout));
 
        switch (timeout)
        {
@@ -638,8 +784,7 @@ acpi_os_wait_semaphore(
                 * (a.k.a. 'would block').
                 */
                case 0:
-               ret = down_trylock(sem);
-               if (ret < 0)
+               if(down_trylock(sem))
                        status = AE_TIME;
                break;
 
@@ -670,69 +815,48 @@ acpi_os_wait_semaphore(
                                ret = down_trylock(sem);
                        }
        
-                       if (ret < 0)
+                       if (ret != 0)
                         status = AE_TIME;
                        }
                break;
        }
 
        if (ACPI_FAILURE(status)) {
-               DEBUG_PRINT(ACPI_INFO, ("Failed to acquire semaphore[%p|%d|%d]\n", handle, units, timeout));
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Failed to acquire semaphore[%p|%d|%d]\n", handle, units, timeout));
        }
        else {
-               DEBUG_PRINT(ACPI_INFO, ("Acquired semaphore[%p|%d|%d]\n", handle, units, timeout));
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Acquired semaphore[%p|%d|%d]\n", handle, units, timeout));
        }
 
-       return_ACPI_STATUS(status);
+       return status;
 }
 
 
 /*
  * TODO: Support for units > 1?
  */
-ACPI_STATUS
+acpi_status
 acpi_os_signal_semaphore(
-    ACPI_HANDLE            handle, 
+    acpi_handle            handle, 
     u32                    units)
 {
        struct semaphore *sem = (struct semaphore *) handle;
 
-       FUNCTION_TRACE("acpi_os_signal_semaphore");
+       PROC_NAME("acpi_os_signal_semaphore");
 
        if (!sem || (units < 1)) 
-               return_ACPI_STATUS(AE_BAD_PARAMETER);
+               return AE_BAD_PARAMETER;
 
        if (units > 1)
-               return_ACPI_STATUS(AE_SUPPORT);
+               return AE_SUPPORT;
 
-       DEBUG_PRINT(ACPI_INFO, ("Signaling semaphore[%p|%d]\n", handle, units));
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Signaling semaphore[%p|%d]\n", handle, units));
 
        up(sem);
 
-       return_ACPI_STATUS(AE_OK);
-}
-
-ACPI_STATUS
-acpi_os_breakpoint(NATIVE_CHAR *msg)
-{
-       acpi_os_printf("breakpoint: %s", msg);
        return AE_OK;
 }
 
-
-void
-acpi_os_dbg_trap(char *msg)
-
-{
-       acpi_os_printf("trap: %s", msg);
-}
-
-void
-acpi_os_dbg_assert(void *failure, void *file, u32 line, NATIVE_CHAR *msg)
-{
-       acpi_os_printf("assert: %s", msg);
-}
-
 u32
 acpi_os_get_line(NATIVE_CHAR *buffer)
 {
@@ -774,7 +898,37 @@ acpi_os_get_thread_id (void)
        if (!in_interrupt())
                return current->pid;
 
-       /*acpi_os_printf("acpi_os_get_thread_id called from interrupt level!\n");*/
-
        return 0;
 }
+
+acpi_status
+acpi_os_signal (
+    u32                function,
+    void       *info)
+{
+       switch (function)
+       {
+       case ACPI_SIGNAL_FATAL:
+               printk(KERN_ERR "ACPI: Fatal opcode executed\n");
+               break;
+       case ACPI_SIGNAL_BREAKPOINT:
+               {
+                       char *bp_info = (char*) info;
+
+                       printk(KERN_ERR "ACPI breakpoint: %s\n", bp_info);
+               }
+       default:
+               break;
+       }
+
+       return AE_OK;
+}
+
+acpi_status
+acpi_os_breakpoint(NATIVE_CHAR *msg)
+{
+       acpi_os_printf("breakpoint: %s", msg);
+       
+       return AE_OK;
+}
+
index 52e3c124f8c3b00e81fa6ca121eb5f9f2f604984..bb313e7a316711e58e797be52f0cb361cf2de5d3 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  *
  * Module Name: ac.c
- *   $Revision: 19 $
+ *   $Revision: 22 $
  *
  *****************************************************************************/
 
@@ -51,6 +51,36 @@ void
 ac_print (
        AC_CONTEXT              *ac_adapter)
 {
+#ifdef ACPI_DEBUG
+
+       acpi_buffer             buffer;
+
+       PROC_NAME("ac_print");
+
+       if (!ac_adapter) {
+               return;
+       }
+
+       buffer.length = 256;
+       buffer.pointer = acpi_os_callocate(buffer.length);
+       if (!buffer.pointer) {
+               return;
+       }
+
+       /*
+        * Get the full pathname for this ACPI object.
+        */
+       acpi_get_name(ac_adapter->acpi_handle, ACPI_FULL_PATHNAME, &buffer);
+
+       /*
+        * Print out basic adapter information.
+        */
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| AC Adapter[%02x]:[%p] %s\n", ac_adapter->device_handle, ac_adapter->acpi_handle, buffer.pointer));
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
+
+       acpi_os_free(buffer.pointer);
+#endif /*ACPI_DEBUG*/
 
        return;
 }
@@ -68,18 +98,23 @@ ac_print (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 ac_add_device(
        BM_HANDLE               device_handle,
        void                    **context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_DEVICE               *device = NULL;
        AC_CONTEXT              *ac_adapter = NULL;
-       ACPI_DEVICE_INFO        info;
+       acpi_device_info        info;
+
+       FUNCTION_TRACE("ac_add_device");
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Adding ac_adapter device [%02x].\n", device_handle));
 
        if (!context || *context) {
-               return(AE_BAD_PARAMETER);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid (NULL) context."));
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /*
@@ -87,7 +122,7 @@ ac_add_device(
         */
        status = bm_get_device_info(device_handle, &device);
        if (ACPI_FAILURE(status)) {
-               return(status);
+               return_ACPI_STATUS(status);
        }
 
        /*
@@ -95,7 +130,7 @@ ac_add_device(
         */
        ac_adapter = acpi_os_callocate(sizeof(AC_CONTEXT));
        if (!ac_adapter) {
-               return(AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        ac_adapter->device_handle = device->handle;
@@ -106,6 +141,7 @@ ac_add_device(
         */
        status = acpi_get_object_info(ac_adapter->acpi_handle, &info);
        if (ACPI_FAILURE(status)) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unable to get object info for ac_adapter device."));
                goto end;
        }
 
@@ -125,6 +161,7 @@ ac_add_device(
         * -----
         */
        if (!(info.valid & ACPI_VALID_STA)) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Must have valid _STA.\n"));
                status = AE_ERROR;
                goto end;
        }
@@ -143,7 +180,7 @@ end:
                acpi_os_free(ac_adapter);
        }
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -159,26 +196,30 @@ end:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 ac_remove_device (
        void                    **context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        AC_CONTEXT              *ac_adapter = NULL;
 
+       FUNCTION_TRACE("ac_remove_device");
+
        if (!context || !*context) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        ac_adapter = (AC_CONTEXT*)*context;
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing ac_adapter device [%02x].\n", ac_adapter->device_handle));
+
        ac_osl_remove_device(ac_adapter);
 
        acpi_os_free(ac_adapter);
 
        *context = NULL;
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -198,13 +239,15 @@ ac_remove_device (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 ac_initialize (void)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_DEVICE_ID            criteria;
        BM_DRIVER               driver;
 
+       FUNCTION_TRACE("ac_initialize");
+
        MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
        MEMSET(&driver, 0, sizeof(BM_DRIVER));
 
@@ -218,7 +261,7 @@ ac_initialize (void)
 
        status = bm_register_driver(&criteria, &driver);
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -234,13 +277,15 @@ ac_initialize (void)
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 ac_terminate (void)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_DEVICE_ID            criteria;
        BM_DRIVER               driver;
 
+       FUNCTION_TRACE("ac_terminate");
+
        MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
        MEMSET(&driver, 0, sizeof(BM_DRIVER));
 
@@ -254,7 +299,7 @@ ac_terminate (void)
 
        status = bm_unregister_driver(&criteria, &driver);
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -269,16 +314,18 @@ ac_terminate (void)
  * DESCRIPTION:
  *
  ****************************************************************************/
-ACPI_STATUS
+acpi_status
 ac_notify (
        BM_NOTIFY               notify_type,
        BM_HANDLE               device_handle,
        void                    **context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+       FUNCTION_TRACE("ac_notify");
 
        if (!context) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        switch (notify_type) {
@@ -292,6 +339,7 @@ ac_notify (
                break;
 
        case AC_NOTIFY_STATUS_CHANGE:
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Status change event detected.\n"));
                status = ac_osl_generate_event(notify_type,
                        ((AC_CONTEXT*)*context));
                break;
@@ -301,7 +349,7 @@ ac_notify (
                break;
        }
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -317,18 +365,20 @@ ac_notify (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 ac_request (
        BM_REQUEST              *request,
        void                    *context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+       FUNCTION_TRACE("ac_request");
 
        /*
         * Must have a valid request structure and context.
         */
        if (!request || !context) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /*
@@ -344,5 +394,5 @@ ac_request (
 
        request->status = status;
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
index fa4da0d0935e187a2cb54c13dced2b538e570781..e0fd29200715883ddde067de7a74e9d5acbcc926 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  *
  * Module Name: ac_osl.c
- *   $Revision: 7 $
+ *   $Revision: 9 $
  *
  *****************************************************************************/
 
@@ -62,7 +62,7 @@ ac_osl_proc_read_status (
        int                     *eof,
        void                    *context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        AC_CONTEXT              *ac_adapter = NULL;
        char                    *p = page;
        int                     len;
@@ -86,11 +86,11 @@ ac_osl_proc_read_status (
        }
 
        if (ac_adapter->is_online) {
-               p += sprintf(p, "Status:                  %s\n", 
+               p += sprintf(p, "Status:                  %s\n",
                        AC_ON_LINE);
        }
        else {
-               p += sprintf(p, "Status:                  %s\n", 
+               p += sprintf(p, "Status:                  %s\n",
                        AC_OFF_LINE);
        }
 
@@ -112,7 +112,7 @@ end:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 ac_osl_add_device(
        AC_CONTEXT              *ac_adapter)
 {
@@ -129,7 +129,7 @@ ac_osl_add_device(
                return(AE_ERROR);
        }
 
-       create_proc_read_entry(AC_PROC_STATUS, S_IFREG | S_IRUGO, 
+       create_proc_read_entry(AC_PROC_STATUS, S_IFREG | S_IRUGO,
                proc_entry, ac_osl_proc_read_status, (void*)ac_adapter);
 
        return(AE_OK);
@@ -142,7 +142,7 @@ ac_osl_add_device(
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 ac_osl_remove_device (
        AC_CONTEXT              *ac_adapter)
 {
@@ -168,12 +168,12 @@ ac_osl_remove_device (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 ac_osl_generate_event (
        u32                     event,
        AC_CONTEXT              *ac_adapter)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
 
        if (!ac_adapter) {
                return(AE_BAD_PARAMETER);
@@ -182,7 +182,7 @@ ac_osl_generate_event (
        switch (event) {
 
        case AC_NOTIFY_STATUS_CHANGE:
-               status = bm_osl_generate_event(ac_adapter->device_handle, 
+               status = bm_osl_generate_event(ac_adapter->device_handle,
                        AC_PROC_ROOT, ac_adapter->uid, event, 0);
                break;
 
@@ -207,10 +207,10 @@ ac_osl_generate_event (
  *
  ****************************************************************************/
 
-static int __init 
+static int __init
 ac_osl_init (void)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
 
        ac_proc_root = proc_mkdir(AC_PROC_ROOT, bm_proc_root);
        if (!ac_proc_root) {
@@ -240,7 +240,7 @@ ac_osl_init (void)
  *
  ****************************************************************************/
 
-static void __exit 
+static void __exit
 ac_osl_cleanup (void)
 {
        ac_terminate();
index 9b389d36e43f8009c517c968fb6b7baed7f270f6..4d6a879cba77f9fd40862ce96fc383e8a7d005db 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  *
  * Module Name: bt.c
- *   $Revision: 24 $
+ *   $Revision: 27 $
  *
  *****************************************************************************/
 
@@ -51,6 +51,37 @@ void
 bt_print (
        BT_CONTEXT              *battery)
 {
+#ifdef ACPI_DEBUG
+       acpi_buffer             buffer;
+
+       PROC_NAME("bt_print");
+
+       if (!battery) {
+               return;
+       }
+
+       buffer.length = 256;
+       buffer.pointer = acpi_os_callocate(buffer.length);
+       if (!buffer.pointer) {
+               return;
+       }
+
+       /*
+        * Get the full pathname for this ACPI object.
+        */
+       acpi_get_name(battery->acpi_handle, ACPI_FULL_PATHNAME, &buffer);
+
+       /*
+        * Print out basic battery information.
+        */
+
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| Battery[%02x]:[%p] %s\n", battery->device_handle, battery->acpi_handle, buffer.pointer));
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "|   uid[%s] is_present[%d] power_units[%s]\n", battery->uid, battery->is_present, battery->power_units));
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
+
+       acpi_os_free(buffer.pointer);
+#endif /*ACPI_DEBUG*/
 
        return;
 }
@@ -70,20 +101,22 @@ bt_print (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bt_get_info (
        BT_CONTEXT              *battery,
        BT_BATTERY_INFO         **battery_info)
 {
-       ACPI_STATUS             status = AE_OK;
-       ACPI_BUFFER             bif_buffer, package_format, package_data;
-       ACPI_OBJECT             *package = NULL;
+       acpi_status             status = AE_OK;
+       acpi_buffer             bif_buffer, package_format, package_data;
+       acpi_object             *package = NULL;
+
+       FUNCTION_TRACE("bt_get_info");
 
        if (!battery || !battery_info || *battery_info) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       MEMSET(&bif_buffer, 0, sizeof(ACPI_BUFFER));
+       MEMSET(&bif_buffer, 0, sizeof(acpi_buffer));
 
        /*
         * Evalute _BIF:
@@ -93,7 +126,7 @@ bt_get_info (
        status = bm_evaluate_object(battery->acpi_handle, "_BIF", NULL,
                &bif_buffer);
        if (ACPI_FAILURE(status)) {
-               return(status);
+               return_ACPI_STATUS(status);
        }
 
        /*
@@ -106,7 +139,7 @@ bt_get_info (
         * bif_buffer size).
         */
        status = bm_cast_buffer(&bif_buffer, (void**)&package,
-               sizeof(ACPI_OBJECT));
+               sizeof(acpi_object));
        if (ACPI_FAILURE(status)) {
                goto end;
        }
@@ -114,7 +147,7 @@ bt_get_info (
        package_format.length = sizeof("NNNNNNNNNSSSS");
        package_format.pointer = "NNNNNNNNNSSSS";
 
-       MEMSET(&package_data, 0, sizeof(ACPI_BUFFER));
+       MEMSET(&package_data, 0, sizeof(acpi_buffer));
 
        status = bm_extract_package_data(package, &package_format,
                &package_data);
@@ -127,7 +160,7 @@ bt_get_info (
 
        package_data.pointer = acpi_os_callocate(package_data.length);
        if (!package_data.pointer) {
-               return(AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        status = bm_extract_package_data(package, &package_format,
@@ -142,7 +175,7 @@ bt_get_info (
 end:
        acpi_os_free(bif_buffer.pointer);
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -158,20 +191,22 @@ end:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bt_get_status (
        BT_CONTEXT              *battery,
        BT_BATTERY_STATUS       **battery_status)
 {
-       ACPI_STATUS             status = AE_OK;
-       ACPI_BUFFER             bst_buffer, package_format, package_data;
-       ACPI_OBJECT             *package = NULL;
+       acpi_status             status = AE_OK;
+       acpi_buffer             bst_buffer, package_format, package_data;
+       acpi_object             *package = NULL;
+
+       FUNCTION_TRACE("bt_get_status");
 
        if (!battery || !battery_status || *battery_status) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       MEMSET(&bst_buffer, 0, sizeof(ACPI_BUFFER));
+       MEMSET(&bst_buffer, 0, sizeof(acpi_buffer));
 
        /*
         * Evalute _BST:
@@ -181,7 +216,7 @@ bt_get_status (
        status = bm_evaluate_object(battery->acpi_handle, "_BST",
                NULL, &bst_buffer);
        if (ACPI_FAILURE(status)) {
-               return(status);
+               return_ACPI_STATUS(status);
        }
 
        /*
@@ -194,7 +229,7 @@ bt_get_status (
         * size).
         */
        status = bm_cast_buffer(&bst_buffer, (void**)&package,
-               sizeof(ACPI_OBJECT));
+               sizeof(acpi_object));
        if (ACPI_FAILURE(status)) {
                goto end;
        }
@@ -202,7 +237,7 @@ bt_get_status (
        package_format.length = sizeof("NNNN");
        package_format.pointer = "NNNN";
 
-       MEMSET(&package_data, 0, sizeof(ACPI_BUFFER));
+       MEMSET(&package_data, 0, sizeof(acpi_buffer));
 
        status = bm_extract_package_data(package, &package_format,
                &package_data);
@@ -215,7 +250,7 @@ bt_get_status (
 
        package_data.pointer = acpi_os_callocate(package_data.length);
        if (!package_data.pointer) {
-               return(AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        status = bm_extract_package_data(package, &package_format,
@@ -230,7 +265,7 @@ bt_get_status (
 end:
        acpi_os_free(bst_buffer.pointer);
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -246,17 +281,19 @@ end:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bt_check_device (
        BT_CONTEXT              *battery)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_DEVICE_STATUS        battery_status = BM_STATUS_UNKNOWN;
        u32                     was_present = FALSE;
        BT_BATTERY_INFO         *battery_info = NULL;
 
+       FUNCTION_TRACE("bt_check_device");
+
        if (!battery) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        was_present = battery->is_present;
@@ -268,13 +305,16 @@ bt_check_device (
         */
        status = bm_get_device_status(battery->device_handle, &battery_status);
        if (ACPI_FAILURE(status)) {
-               return(status);
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Unable to get battery status.\n"));
+               return_ACPI_STATUS(status);
        }
 
        if (battery_status & BM_STATUS_BATTERY_PRESENT) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Battery socket occupied.\n"));
                battery->is_present = TRUE;
        }
        else {
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Battery socket not occupied.\n"));
                battery->is_present = FALSE;
        }
 
@@ -284,6 +324,8 @@ bt_check_device (
         */
        if (!was_present && battery->is_present) {
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Battery insertion detected.\n"));
+
                /*
                 * Units of Power?
                 * ---------------
@@ -303,10 +345,11 @@ bt_check_device (
         * --------------------
         */
        else if (was_present && !battery->is_present) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Battery removal detected.\n"));
                battery->power_units = BT_POWER_UNITS_DEFAULT;
        }
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -322,17 +365,21 @@ bt_check_device (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bt_add_device (
        BM_HANDLE               device_handle,
        void                    **context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_DEVICE               *device = NULL;
        BT_CONTEXT              *battery = NULL;
 
+       FUNCTION_TRACE("bt_add_device");
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Adding battery device [%02x].\n", device_handle));
+
        if (!context || *context) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /*
@@ -340,7 +387,7 @@ bt_add_device (
         */
        status = bm_get_device_info(device_handle, &device);
        if (ACPI_FAILURE(status)) {
-               return(status);
+               return_ACPI_STATUS(status);
        }
 
        /*
@@ -348,7 +395,7 @@ bt_add_device (
         */
        battery = acpi_os_callocate(sizeof(BT_CONTEXT));
        if (!battery) {
-               return(AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        battery->device_handle = device->handle;
@@ -380,7 +427,7 @@ end:
                acpi_os_free(battery);
        }
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -396,26 +443,30 @@ end:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bt_remove_device (
        void                    **context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BT_CONTEXT              *battery = NULL;
 
+       FUNCTION_TRACE("bt_remove_device");
+
        if (!context || !*context) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        battery = (BT_CONTEXT*)*context;
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing battery device [%02x].\n", battery->device_handle));
+
        bt_osl_remove_device(battery);
 
        acpi_os_free(battery);
 
        *context = NULL;
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -435,13 +486,15 @@ bt_remove_device (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bt_initialize (void)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_DEVICE_ID            criteria;
        BM_DRIVER               driver;
 
+       FUNCTION_TRACE("bt_initialize");
+
        MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
        MEMSET(&driver, 0, sizeof(BM_DRIVER));
 
@@ -455,7 +508,7 @@ bt_initialize (void)
 
        status = bm_register_driver(&criteria, &driver);
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -471,13 +524,15 @@ bt_initialize (void)
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bt_terminate (void)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_DEVICE_ID            criteria;
        BM_DRIVER               driver;
 
+       FUNCTION_TRACE("bt_terminate");
+
        MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
        MEMSET(&driver, 0, sizeof(BM_DRIVER));
 
@@ -491,7 +546,7 @@ bt_terminate (void)
 
        status = bm_unregister_driver(&criteria, &driver);
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -507,16 +562,18 @@ bt_terminate (void)
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bt_notify (
        BM_NOTIFY               notify_type,
        BM_HANDLE               device_handle,
        void                    **context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+       FUNCTION_TRACE("bt_notify");
 
        if (!context) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        switch (notify_type) {
@@ -530,11 +587,13 @@ bt_notify (
                break;
 
        case BT_NOTIFY_STATUS_CHANGE:
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Status change (_BST) event detected.\n"));
                status = bt_osl_generate_event(notify_type,
                        ((BT_CONTEXT*)*context));
                break;
 
        case BT_NOTIFY_INFORMATION_CHANGE:
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Information change (_BIF) event detected.\n"));
                status = bt_check_device((BT_CONTEXT*)*context);
                if (ACPI_SUCCESS(status)) {
                        status = bt_osl_generate_event(notify_type,
@@ -547,7 +606,7 @@ bt_notify (
                break;
        }
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -563,18 +622,20 @@ bt_notify (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bt_request (
        BM_REQUEST              *request,
        void                    *context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+       FUNCTION_TRACE("bt_request");
 
        /*
         * Must have a valid request structure and context.
         */
        if (!request || !context)
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
 
        /*
         * Handle request:
@@ -589,5 +650,5 @@ bt_request (
 
        request->status = status;
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
index 5384ba4a3dc27062a81ffae05857828ceb315124..1f7b6d4202941dee0e6468765ee75d05280a33f3 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: bt_osl.c
- *   $Revision: 18 $
+ *   $Revision: 22 $
  *
  *****************************************************************************/
 
@@ -56,18 +56,18 @@ static struct proc_dir_entry        *bt_proc_root = NULL;
 
 
 /****************************************************************************
- * 
+ *
  * FUNCTION:   bt_osl_proc_read_info
  *
  ****************************************************************************/
 
 static int
 bt_osl_proc_read_info (
-       char                    *page, 
-       char                    **start, 
-       off_t                   off, 
-       int                     count, 
-       int                     *eof, 
+       char                    *page,
+       char                    **start,
+       off_t                   off,
+       int                     count,
+       int                     *eof,
        void                    *context)
 {
        BT_CONTEXT              *battery = NULL;
@@ -106,17 +106,17 @@ bt_osl_proc_read_info (
                p += sprintf(p, "Design Capacity:         unknown\n");
        }
        else {
-               p += sprintf(p, "Design Capacity:         %d %sh\n", 
-                        battery_info->design_capacity, 
+               p += sprintf(p, "Design Capacity:         %d %sh\n",
+                        battery_info->design_capacity,
                         battery->power_units);
        }
        
        if (battery_info->last_full_capacity == BT_UNKNOWN) {
                p += sprintf(p, "Last Full Capacity:      unknown\n");
-       } 
+       }
        else {
-               p += sprintf(p, "Last Full Capacity:      %d %sh\n", 
-                        battery_info->last_full_capacity, 
+               p += sprintf(p, "Last Full Capacity:      %d %sh\n",
+                        battery_info->last_full_capacity,
                         battery->power_units);
        }
 
@@ -134,29 +134,29 @@ bt_osl_proc_read_info (
                p += sprintf(p, "Design Voltage:          unknown\n");
        }
        else {
-               p += sprintf(p, "Design Voltage:          %d mV\n", 
+               p += sprintf(p, "Design Voltage:          %d mV\n",
                         battery_info->design_voltage);
        }
        
        p += sprintf(p, "Design Capacity Warning: %d %sh\n",
-               battery_info->design_capacity_warning, 
+               battery_info->design_capacity_warning,
                battery->power_units);
        p += sprintf(p, "Design Capacity Low:     %d %sh\n",
-               battery_info->design_capacity_low, 
+               battery_info->design_capacity_low,
                battery->power_units);
        p += sprintf(p, "Capacity Granularity 1:  %d %sh\n",
-               battery_info->battery_capacity_granularity_1, 
+               battery_info->battery_capacity_granularity_1,
                battery->power_units);
        p += sprintf(p, "Capacity Granularity 2:  %d %sh\n",
-               battery_info->battery_capacity_granularity_2, 
+               battery_info->battery_capacity_granularity_2,
                battery->power_units);
-       p += sprintf(p, "Model Number:            %s\n", 
+       p += sprintf(p, "Model Number:            %s\n",
                battery_info->model_number);
-       p += sprintf(p, "Serial Number:           %s\n", 
+       p += sprintf(p, "Serial Number:           %s\n",
                battery_info->serial_number);
-       p += sprintf(p, "Battery Type:            %s\n", 
+       p += sprintf(p, "Battery Type:            %s\n",
                battery_info->battery_type);
-       p += sprintf(p, "OEM Info:                %s\n", 
+       p += sprintf(p, "OEM Info:                %s\n",
                battery_info->oem_info);
        
 end:
@@ -174,18 +174,18 @@ end:
 
 
 /****************************************************************************
- * 
+ *
  * FUNCTION:   bt_osl_proc_read_status
  *
  ****************************************************************************/
 
 static int
 bt_osl_proc_read_status (
-       char                    *page, 
-       char                    **start, 
-       off_t                   off, 
-       int                     count, 
-       int                     *eof, 
+       char                    *page,
+       char                    **start,
+       off_t                   off,
+       int                     count,
+       int                     *eof,
        void                    *context)
 {
        BT_CONTEXT              *battery = NULL;
@@ -226,7 +226,7 @@ bt_osl_proc_read_status (
         */
 
        if (!battery_status->state) {
-               p += sprintf(p, "State:                   ok\n"); 
+               p += sprintf(p, "State:                   ok\n");
        }
        else {
                if (battery_status->state & 0x1)
@@ -242,7 +242,7 @@ bt_osl_proc_read_status (
        }
        else {
                p += sprintf(p, "Present Rate:            %d %s\n",
-                       battery_status->present_rate, 
+                       battery_status->present_rate,
                        battery->power_units);
        }
 
@@ -251,7 +251,7 @@ bt_osl_proc_read_status (
        }
        else {
                p += sprintf(p, "Remaining Capacity:      %d %sh\n",
-                       battery_status->remaining_capacity, 
+                       battery_status->remaining_capacity,
                        battery->power_units);
        }
 
@@ -283,7 +283,7 @@ end:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bt_osl_add_device(
        BT_CONTEXT              *battery)
 {
@@ -305,10 +305,10 @@ bt_osl_add_device(
                return(AE_ERROR);
        }
 
-       create_proc_read_entry(BT_PROC_STATUS, S_IFREG | S_IRUGO, 
+       create_proc_read_entry(BT_PROC_STATUS, S_IFREG | S_IRUGO,
                proc_entry, bt_osl_proc_read_status, (void*)battery);
 
-       create_proc_read_entry(BT_PROC_INFO, S_IFREG | S_IRUGO, 
+       create_proc_read_entry(BT_PROC_INFO, S_IFREG | S_IRUGO,
                proc_entry, bt_osl_proc_read_info, (void*)battery);
 
        return(AE_OK);
@@ -321,7 +321,7 @@ bt_osl_add_device(
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bt_osl_remove_device (
        BT_CONTEXT              *battery)
 {
@@ -350,12 +350,12 @@ bt_osl_remove_device (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bt_osl_generate_event (
        u32                     event,
        BT_CONTEXT              *battery)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
 
        if (!battery) {
                return(AE_BAD_PARAMETER);
@@ -365,7 +365,7 @@ bt_osl_generate_event (
 
        case BT_NOTIFY_STATUS_CHANGE:
        case BT_NOTIFY_INFORMATION_CHANGE:
-               status = bm_osl_generate_event(battery->device_handle, 
+               status = bm_osl_generate_event(battery->device_handle,
                        BT_PROC_ROOT, battery->uid, event, 0);
                break;
 
@@ -390,10 +390,14 @@ bt_osl_generate_event (
  *
  ****************************************************************************/
 
-static int __init 
+static int __init
 bt_osl_init (void)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+       /* abort if no busmgr */
+       if (!bm_proc_root)
+               return -ENODEV;
 
        bt_proc_root = proc_mkdir(BT_PROC_ROOT, bm_proc_root);
        if (!bt_proc_root) {
@@ -422,7 +426,7 @@ bt_osl_init (void)
  *
  ****************************************************************************/
 
-static void __exit 
+static void __exit
 bt_osl_cleanup (void)
 {
        bt_terminate();
index 2f1bd3f9b0e1a2596dddb43eba39c633bfc9865f..0a1daa4841b697dcc140357549a05d75dbc56ee0 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: bm.c
- *   $Revision: 42 $
+ *   $Revision: 47 $
  *
  *****************************************************************************/
 
@@ -38,7 +38,7 @@
  *                                  Globals
  ****************************************************************************/
 
-extern FADT_DESCRIPTOR_REV2    acpi_fadt;
+extern fadt_descriptor_rev2    acpi_fadt;
 /* TBD: Make dynamically sizeable. */
 BM_NODE_LIST                   node_list;
 
@@ -48,24 +48,24 @@ BM_NODE_LIST                        node_list;
  ****************************************************************************/
 
 /*****************************************************************************
- * 
+ *
  * FUNCTION:    bm_print_object
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
 void
 bm_print_object (
-       ACPI_HANDLE             acpi_handle)
+       acpi_handle             handle)
 {
-       ACPI_BUFFER             buffer;
-       ACPI_HANDLE             parent;
-       ACPI_OBJECT_TYPE        type;
+       acpi_buffer             buffer;
+       acpi_handle             parent;
+       acpi_object_type        type;
 
        buffer.length = 256;
        buffer.pointer = acpi_os_callocate(buffer.length);
@@ -73,22 +73,22 @@ bm_print_object (
                return;
        }
 
-       acpi_get_name(acpi_handle, ACPI_FULL_PATHNAME, &buffer);
-       acpi_get_parent(acpi_handle, &parent);
-       acpi_get_type(acpi_handle, &type);
+       acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
+       acpi_get_parent(handle, &parent);
+       acpi_get_type(handle, &type);
 
        /*
         * TBD: Hack to get around scope identification problem.
         */
        if (type == ACPI_TYPE_ANY) {
-               if (ACPI_SUCCESS(acpi_get_next_object(ACPI_TYPE_ANY, 
-                       acpi_handle, 0, NULL))) {
+               if (ACPI_SUCCESS(acpi_get_next_object(ACPI_TYPE_ANY,
+                       handle, 0, NULL))) {
                        type = INTERNAL_TYPE_SCOPE;
                }
        }
-    
+
        switch (type)
-       {
+        {
        case INTERNAL_TYPE_SCOPE:
                acpi_os_printf("SCOPE: ");
                break;
@@ -142,7 +142,7 @@ bm_print_object (
                break;
        }
 
-       acpi_os_printf("Object[%p][%s] parent[%p].\n", acpi_handle, (char*)buffer.pointer, parent);
+       acpi_os_printf("Object[%p][%s] parent[%p].\n", handle, (char*)buffer.pointer, parent);
 
        acpi_os_free(buffer.pointer);
 }
@@ -152,11 +152,11 @@ bm_print_object (
  *
  * FUNCTION:    bm_print_node
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
@@ -166,10 +166,12 @@ bm_print_node (
        u32                     flags)
 {
 #ifdef ACPI_DEBUG
-       ACPI_BUFFER             buffer;
+       acpi_buffer             buffer;
        BM_DEVICE               *device = NULL;
        char                    *type_string = NULL;
 
+       PROC_NAME("bm_print_node");
+
        if (!node) {
                return;
        }
@@ -194,7 +196,7 @@ bm_print_node (
        case BM_TYPE_SYSTEM:
                type_string = " System";
                break;
-       case BM_TYPE_SCOPE: 
+       case BM_TYPE_SCOPE:
                type_string = "  Scope";
                break;
        case BM_TYPE_PROCESSOR:
@@ -218,27 +220,27 @@ bm_print_node (
        }
 
        if (!(flags & BM_PRINT_GROUP)) {
-               DEBUG_PRINT_RAW(ACPI_INFO, ("+-------------------------------------------------------------------------------\n"));
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+-------------------------------------------------------------------------------\n"));
        }
 
-       DEBUG_PRINT_RAW(ACPI_INFO, ("| %s[%02x]:[%p] flags[%02x] hid[%s] %s\n", type_string, device->handle, device->acpi_handle, device->flags, (device->id.hid[0] ? device->id.hid : "       "), buffer.pointer));
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| %s[%02x]:[%p] flags[%02x] hid[%s] %s\n", type_string, device->handle, device->acpi_handle, device->flags, (device->id.hid[0] ? device->id.hid : "       "), buffer.pointer));
 
        if (flags & BM_PRINT_IDENTIFICATION) {
-               DEBUG_PRINT_RAW(ACPI_INFO, ("|   identification: uid[%s] adr[%08x]\n", device->id.uid, device->id.adr));
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "|   identification: uid[%s] adr[%08x]\n", device->id.uid, device->id.adr));
        }
 
        if (flags & BM_PRINT_LINKAGE) {
-               DEBUG_PRINT_RAW(ACPI_INFO, ("|   linkage: this[%p] parent[%p] next[%p]\n", node, node->parent, node->next));
-               DEBUG_PRINT_RAW(ACPI_INFO, ("|     scope.head[%p] scope.tail[%p]\n", node->scope.head, node->scope.tail));
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "|   linkage: this[%p] parent[%p] next[%p]\n", node, node->parent, node->next));
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "|     scope.head[%p] scope.tail[%p]\n", node->scope.head, node->scope.tail));
        }
 
        if (flags & BM_PRINT_POWER) {
-               DEBUG_PRINT_RAW(ACPI_INFO, ("|   power: state[D%d] flags[%08x]\n", device->power.state, device->power.flags));
-               DEBUG_PRINT_RAW(ACPI_INFO, ("|     S0[%02x] S1[%02x] S2[%02x] S3[%02x] S4[%02x] S5[%02x]\n", device->power.dx_supported[0], device->power.dx_supported[1], device->power.dx_supported[2], device->power.dx_supported[3], device->power.dx_supported[4], device->power.dx_supported[5]));
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "|   power: state[D%d] flags[%08x]\n", device->power.state, device->power.flags));
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "|     S0[%02x] S1[%02x] S2[%02x] S3[%02x] S4[%02x] S5[%02x]\n", device->power.dx_supported[0], device->power.dx_supported[1], device->power.dx_supported[2], device->power.dx_supported[3], device->power.dx_supported[4], device->power.dx_supported[5]));
        }
 
        if (!(flags & BM_PRINT_GROUP)) {
-               DEBUG_PRINT_RAW(ACPI_INFO, ("+-------------------------------------------------------------------------------\n"));
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+-------------------------------------------------------------------------------\n"));
        }
 
        acpi_os_free(buffer.pointer);
@@ -252,11 +254,11 @@ bm_print_node (
  *
  * FUNCTION:    bm_print_hierarchy
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
@@ -268,13 +270,13 @@ bm_print_hierarchy (void)
 
        FUNCTION_TRACE("bm_print_hierarchy");
 
-       DEBUG_PRINT_RAW(ACPI_INFO, ("+------------------------------------------------------------\n"));
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
 
        for (i = 0; i < node_list.count; i++) {
                bm_print_node(node_list.nodes[i], BM_PRINT_GROUP | BM_PRINT_PRESENT);
        }
 
-       DEBUG_PRINT_RAW(ACPI_INFO, ("+------------------------------------------------------------\n"));
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
 #endif /*ACPI_DEBUG*/
 
        return_VOID;
@@ -285,19 +287,19 @@ bm_print_hierarchy (void)
  *
  * FUNCTION:    bm_get_status
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_get_status (
        BM_DEVICE               *device)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status           status = AE_OK;
 
        if (!device) {
                return AE_BAD_PARAMETER;
@@ -319,7 +321,7 @@ bm_get_status (
         * Evaluate _STA:
         * --------------
         */
-       status = bm_evaluate_simple_integer(device->acpi_handle, "_STA", 
+       status = bm_evaluate_simple_integer(device->acpi_handle, "_STA",
                &(device->status));
 
        return status;
@@ -330,20 +332,20 @@ bm_get_status (
  *
  * FUNCTION:    bm_get_identification
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_get_identification (
        BM_DEVICE               *device)
 {
-       ACPI_STATUS             status = AE_OK;
-       ACPI_DEVICE_INFO        info;
+       acpi_status             status = AE_OK;
+       acpi_device_info        info;
 
        if (!device) {
                return AE_BAD_PARAMETER;
@@ -368,12 +370,12 @@ bm_get_identification (
        }
 
        if (info.valid & ACPI_VALID_UID) {
-               MEMCPY((void*)device->id.uid, (void*)info.unique_id, 
+               MEMCPY((void*)device->id.uid, (void*)info.unique_id,
                        sizeof(BM_DEVICE_UID));
        }
 
        if (info.valid & ACPI_VALID_HID) {
-               MEMCPY((void*)device->id.hid, (void*)info.hardware_id, 
+               MEMCPY((void*)device->id.hid, (void*)info.hardware_id,
                        sizeof(BM_DEVICE_HID));
        }
 
@@ -389,19 +391,19 @@ bm_get_identification (
  *
  * FUNCTION:    bm_get_flags
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_get_flags (
        BM_DEVICE               *device)
 {
-       ACPI_HANDLE             acpi_handle = NULL;
+       acpi_handle             acpi_handle = NULL;
 
        if (!device) {
                return AE_BAD_PARAMETER;
@@ -416,7 +418,7 @@ bm_get_flags (
                /*
                 * Presence of _DCK indicates a docking station.
                 */
-               if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, 
+               if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle,
                        "_DCK", &acpi_handle))) {
                        device->flags |= BM_FLAGS_DOCKING_STATION;
                }
@@ -425,7 +427,7 @@ bm_get_flags (
                 * Presence of _EJD and/or _EJx indicates 'ejectable'.
                 * TBD: _EJx...
                 */
-               if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, 
+               if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle,
                        "_EJD", &acpi_handle))) {
                        device->flags |= BM_FLAGS_EJECTABLE;
                }
@@ -433,9 +435,9 @@ bm_get_flags (
                /*
                 * Presence of _PR0 or _PS0 indicates 'power manageable'.
                 */
-               if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, 
+               if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle,
                        "_PR0", &acpi_handle)) ||
-                       ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, 
+                       ACPI_SUCCESS(acpi_get_handle(device->acpi_handle,
                        "_PS0", &acpi_handle))) {
                        device->flags |= BM_FLAGS_POWER_CONTROL;
                }
@@ -443,7 +445,7 @@ bm_get_flags (
                /*
                 * Presence of _CRS indicates 'configurable'.
                 */
-               if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, 
+               if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle,
                        "_CRS", &acpi_handle))) {
                        device->flags |= BM_FLAGS_CONFIGURABLE;
                }
@@ -456,9 +458,9 @@ bm_get_flags (
                /*
                 * Presence of _HID or _ADR indicates 'identifiable'.
                 */
-               if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, 
+               if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle,
                        "_HID", &acpi_handle)) ||
-                  ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, 
+                  ACPI_SUCCESS(acpi_get_handle(device->acpi_handle,
                   "_ADR", &acpi_handle))) {
                        device->flags |= BM_FLAGS_IDENTIFIABLE;
                }
@@ -466,7 +468,7 @@ bm_get_flags (
                /*
                 * Presence of _STA indicates 'dynamic status'.
                 */
-               if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, 
+               if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle,
                        "_STA", &acpi_handle))) {
                        device->flags |= BM_FLAGS_DYNAMIC_STATUS;
                }
@@ -482,22 +484,22 @@ bm_get_flags (
  *
  * FUNCTION:    bm_add_namespace_device
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_add_namespace_device (
-       ACPI_HANDLE             acpi_handle,
-       ACPI_OBJECT_TYPE        acpi_type,
+       acpi_handle             acpi_handle,
+       acpi_object_type        acpi_type,
        BM_NODE                 *parent,
        BM_NODE                 **child)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_NODE                 *node = NULL;
        BM_DEVICE               *device = NULL;
 
@@ -533,7 +535,7 @@ bm_add_namespace_device (
        /*
         * Device Type:
         * ------------
-        */ 
+        */
        switch (acpi_type) {
        case INTERNAL_TYPE_SCOPE:
                device->id.type = BM_TYPE_SCOPE;
@@ -586,7 +588,7 @@ bm_add_namespace_device (
                /*
                 * Power Management:
                 * -----------------
-                * If this node doesn't provide direct power control  
+                * If this node doesn't provide direct power control
                 * then we inherit PM capabilities from its parent.
                 *
                 * TBD: Inherit!
@@ -641,21 +643,21 @@ end:
  *
  * PARAMETERS:  <none>
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_enumerate_namespace (void)
 {
-       ACPI_STATUS             status = AE_OK;
-       ACPI_HANDLE             parent_handle = ACPI_ROOT_OBJECT;
-       ACPI_HANDLE             child_handle = NULL;
+       acpi_status             status = AE_OK;
+       acpi_handle             parent_handle = ACPI_ROOT_OBJECT;
+       acpi_handle             child_handle = NULL;
        BM_NODE                 *parent = NULL;
        BM_NODE                 *child = NULL;
-       ACPI_OBJECT_TYPE        acpi_type = 0;
+       acpi_object_type        acpi_type = 0;
        u32                     level = 1;
 
        FUNCTION_TRACE("bm_enumerate_namespace");
@@ -676,8 +678,8 @@ bm_enumerate_namespace (void)
                status = acpi_get_next_object(ACPI_TYPE_ANY, parent_handle, child_handle, &child_handle);
                if (ACPI_SUCCESS(status)) {
                        /*
-                        * TBD: This is a hack to get around the problem 
-                        *       identifying scope objects.  Scopes 
+                        * TBD: This is a hack to get around the problem
+                        *       identifying scope objects.  Scopes
                         *       somehow need to be uniquely identified.
                         */
                        status = acpi_get_type(child_handle, &acpi_type);
@@ -725,7 +727,7 @@ bm_enumerate_namespace (void)
                else {
                        level--;
                        child_handle = parent_handle;
-                       acpi_get_parent(parent_handle, 
+                       acpi_get_parent(parent_handle,
                                &parent_handle);
 
                        if (parent) {
@@ -745,21 +747,21 @@ bm_enumerate_namespace (void)
  *
  * FUNCTION:    bm_add_fixed_feature_device
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_add_fixed_feature_device (
        BM_NODE                 *parent,
        BM_DEVICE_TYPE          device_type,
        char                    *device_hid)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_NODE                 *node = NULL;
 
        FUNCTION_TRACE("bm_add_fixed_feature_device");
@@ -787,7 +789,7 @@ bm_add_fixed_feature_device (
        node->device.acpi_handle = ACPI_ROOT_OBJECT;
        node->device.id.type = BM_TYPE_FIXED_BUTTON;
        if (device_hid) {
-               MEMCPY((void*)node->device.id.hid, device_hid, 
+               MEMCPY((void*)node->device.id.hid, device_hid,
                        sizeof(node->device.id.hid));
        }
        node->device.flags = BM_FLAGS_FIXED_FEATURE;
@@ -833,13 +835,13 @@ bm_add_fixed_feature_device (
  *
  * PARAMETERS:  <none>
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_enumerate_fixed_features (void)
 {
        FUNCTION_TRACE("bm_enumerate_fixed_features");
@@ -887,20 +889,20 @@ bm_enumerate_fixed_features (void)
  *
  * FUNCTION:    bm_get_handle
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_get_handle (
-       ACPI_HANDLE             acpi_handle,
+       acpi_handle             acpi_handle,
        BM_HANDLE               *device_handle)
 {
-       ACPI_STATUS             status = AE_NOT_FOUND;
+       acpi_status             status = AE_NOT_FOUND;
        u32                     i = 0;
 
        FUNCTION_TRACE("bm_get_handle");
@@ -917,7 +919,7 @@ bm_get_handle (
        for (i=0; i<node_list.count; i++) {
 
                if (!node_list.nodes[i]) {
-                       DEBUG_PRINT(ACPI_ERROR, ("Invalid (NULL) node entry [%02x] detected.\n", device_handle));
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid (NULL) node entry [%02x] detected.\n", device_handle));
                        status = AE_NULL_ENTRY;
                        break;
                }
@@ -937,21 +939,21 @@ bm_get_handle (
  *
  * FUNCTION:    bm_get_node
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_get_node (
        BM_HANDLE               device_handle,
-       ACPI_HANDLE             acpi_handle,
+       acpi_handle             acpi_handle,
        BM_NODE                 **node)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
 
        FUNCTION_TRACE("bm_get_node");
 
@@ -977,7 +979,7 @@ bm_get_node (
         * Valid device handle?
         */
        if (device_handle > BM_HANDLES_MAX) {
-               DEBUG_PRINT(ACPI_ERROR, ("Invalid node handle [%02x] detected.\n", device_handle));
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid node handle [%02x] detected.\n", device_handle));
                return_ACPI_STATUS(AE_ERROR);
        }
 
@@ -987,7 +989,7 @@ bm_get_node (
         * Valid node?
         */
        if (!(*node)) {
-               DEBUG_PRINT(ACPI_ERROR, ("Invalid (NULL) node entry [%02x] detected.\n", device_handle));
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid (NULL) node entry [%02x] detected.\n", device_handle));
                return_ACPI_STATUS(AE_NULL_ENTRY);
        }
 
@@ -1007,14 +1009,14 @@ bm_get_node (
  *
  * RETURN:      Exception code.
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_initialize (void)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        u32                     start = 0;
        u32                     stop = 0;
        u32                     elapsed = 0;
@@ -1028,7 +1030,7 @@ bm_initialize (void)
                return_ACPI_STATUS(status);
        }
 
-       DEBUG_PRINT(ACPI_INFO, ("Building device hierarchy.\n"));
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Building device hierarchy.\n"));
 
        /*
         * Enumerate ACPI fixed-feature devices.
@@ -1049,7 +1051,7 @@ bm_initialize (void)
        acpi_get_timer(&stop);
        acpi_get_timer_duration(start, stop, &elapsed);
 
-       DEBUG_PRINT(ACPI_INFO, ("Building device hierarchy took [%d] microseconds.\n", elapsed));
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Building device hierarchy took [%d] microseconds.\n", elapsed));
 
        /*
         * Display hierarchy.
@@ -1059,23 +1061,23 @@ bm_initialize (void)
        /*
         * Register for all standard and device-specific notifications.
         */
-       DEBUG_PRINT(ACPI_INFO, ("Registering for all device notifications.\n"));
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Registering for all device notifications.\n"));
 
-       status = acpi_install_notify_handler(ACPI_ROOT_OBJECT, 
+       status = acpi_install_notify_handler(ACPI_ROOT_OBJECT,
                ACPI_SYSTEM_NOTIFY, &bm_notify, NULL);
        if (ACPI_FAILURE(status)) {
-               DEBUG_PRINT(ACPI_ERROR, ("Unable to register for standard notifications.\n"));
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unable to register for standard notifications.\n"));
                return_ACPI_STATUS(status);
        }
 
-       status = acpi_install_notify_handler(ACPI_ROOT_OBJECT, 
+       status = acpi_install_notify_handler(ACPI_ROOT_OBJECT,
                ACPI_DEVICE_NOTIFY, &bm_notify, NULL);
        if (ACPI_FAILURE(status)) {
-               DEBUG_PRINT(ACPI_ERROR, ("Unable to register for device-specific notifications.\n"));
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unable to register for device-specific notifications.\n"));
                return_ACPI_STATUS(status);
        }
 
-       DEBUG_PRINT(ACPI_INFO, ("ACPI Bus Manager enabled.\n"));
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ACPI Bus Manager enabled.\n"));
 
        /*
         * Initialize built-in power resource driver.
@@ -1094,14 +1096,14 @@ bm_initialize (void)
  *
  * RETURN:      Exception code.
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_terminate (void)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        u32                     i = 0;
 
        FUNCTION_TRACE("bm_terminate");
@@ -1114,31 +1116,31 @@ bm_terminate (void)
        /*
         * Unregister for all notifications.
         */
-       DEBUG_PRINT(ACPI_INFO, ("Unregistering for device notifications.\n"));
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Unregistering for device notifications.\n"));
 
-       status = acpi_remove_notify_handler(ACPI_ROOT_OBJECT, 
+       status = acpi_remove_notify_handler(ACPI_ROOT_OBJECT,
                ACPI_SYSTEM_NOTIFY, &bm_notify);
        if (ACPI_FAILURE(status)) {
-               DEBUG_PRINT(ACPI_ERROR, ("Unable to un-register for standard notifications.\n"));
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unable to un-register for standard notifications.\n"));
        }
 
-       status = acpi_remove_notify_handler(ACPI_ROOT_OBJECT, 
+       status = acpi_remove_notify_handler(ACPI_ROOT_OBJECT,
                ACPI_DEVICE_NOTIFY, &bm_notify);
        if (ACPI_FAILURE(status)) {
-               DEBUG_PRINT(ACPI_ERROR, ("Unable to un-register for device-specific notifications.\n"));
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unable to un-register for device-specific notifications.\n"));
        }
 
        /*
         * Parse through the device array, freeing all entries.
         */
-       DEBUG_PRINT(ACPI_INFO, ("Removing device hierarchy.\n"));
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing device hierarchy.\n"));
        for (i = 0; i < node_list.count; i++) {
                if (node_list.nodes[i]) {
                        acpi_os_free(node_list.nodes[i]);
                }
        }
 
-       DEBUG_PRINT(ACPI_INFO, ("ACPI Bus Manager disabled.\n"));
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ACPI Bus Manager disabled.\n"));
 
        return_ACPI_STATUS(AE_OK);
 }
index f4bb94b578d2c2fb1e028fb7a67be7b33093a253..5e851fdea104802a6d71bcc65752c78b57a78a1a 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  *
  * Module Name: bm_osl.c
- *   $Revision: 11 $
+ *   $Revision: 16 $
  *
  *****************************************************************************/
 
@@ -30,6 +30,7 @@
 #include <linux/types.h>
 #include <linux/proc_fs.h>
 #include <linux/spinlock.h>
+#include <linux/poll.h>
 #include <asm/uaccess.h>
 #include <acpi.h>
 #include "bm.h"
@@ -111,7 +112,7 @@ static int event_is_open = 0;
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_osl_generate_event (
        BM_HANDLE               device_handle,
        char                    *device_type,
@@ -133,12 +134,12 @@ bm_osl_generate_event (
        if (!event)
                goto alloc_error;
 
-       event->device_type = acpi_os_callocate(strlen(device_type) 
+       event->device_type = acpi_os_callocate(strlen(device_type)
                + sizeof(char));
        if (!event->device_type)
                goto alloc_error;
 
-       event->device_instance = acpi_os_callocate(strlen(device_instance) 
+       event->device_instance = acpi_os_callocate(strlen(device_instance)
                + sizeof(char));
        if (!event->device_instance)
                goto alloc_error;
@@ -207,71 +208,98 @@ static int bm_osl_close_event(struct inode *inode, struct file *file)
  *
  * FUNCTION:   bm_osl_read_event
  *
- * DESCRIPTION: Handles reads to the 'event' file by blocking user-mode 
+ * DESCRIPTION: Handles reads to the 'event' file by blocking user-mode
  *              threads until data (an event) is generated.
  *
  ****************************************************************************/
 static ssize_t
 bm_osl_read_event(
-       struct file             *file, 
-       char                    *buf, 
-       size_t                  count, 
+       struct file             *file,
+       char                    *buf,
+       size_t                  count,
        loff_t                  *ppos)
 {
-       char                    str[BM_MAX_STRING_LENGTH];
-       int                     size;
        BM_OSL_EVENT            *event = NULL;
        unsigned long           flags = 0;
+       static char             str[BM_MAX_STRING_LENGTH];
+       static int              chars_remaining = 0;
+       static char             *ptr;
 
-       DECLARE_WAITQUEUE(wait, current);
+       if (!chars_remaining) {
+               DECLARE_WAITQUEUE(wait, current);
 
-       if (count < BM_MAX_STRING_LENGTH) {
-               return 0;
-       }
+               if (list_empty(&bm_event_list)) {
 
-       if (list_empty(&bm_event_list)) {
+                       if (file->f_flags & O_NONBLOCK)
+                               return -EAGAIN;
 
-               set_current_state(TASK_INTERRUPTIBLE);
-               add_wait_queue(&bm_event_wait_queue, &wait);
+                       set_current_state(TASK_INTERRUPTIBLE);
+                       add_wait_queue(&bm_event_wait_queue, &wait);
 
-               if (list_empty(&bm_event_list)) {
-                       schedule();
-               }
+                       if (list_empty(&bm_event_list)) {
+                               schedule();
+                       }
 
-               remove_wait_queue(&bm_event_wait_queue, &wait);
-               set_current_state(TASK_RUNNING);
+                       remove_wait_queue(&bm_event_wait_queue, &wait);
+                       set_current_state(TASK_RUNNING);
 
-               if (signal_pending(current)) {
-                       return -ERESTARTSYS;
+                       if (signal_pending(current)) {
+                               return -ERESTARTSYS;
+                       }
                }
-       }
 
-       spin_lock_irqsave(&bm_osl_event_lock, flags);
-       event = list_entry(bm_event_list.next, BM_OSL_EVENT, list);
-       list_del(&event->list);
-       spin_unlock_irqrestore(&bm_osl_event_lock, flags);
+               spin_lock_irqsave(&bm_osl_event_lock, flags);
+               event = list_entry(bm_event_list.next, BM_OSL_EVENT, list);
+               list_del(&event->list);
+               spin_unlock_irqrestore(&bm_osl_event_lock, flags);
 
-       /* BUG: buffer overrun? */
-       size = sprintf(str, "%s %s %08x %08x\n",
-               event->device_type, event->device_instance,
-               event->event_type, event->event_data);
-       
-       acpi_os_free(event->device_type);
-       acpi_os_free(event->device_instance);
-       acpi_os_free(event);
+               chars_remaining = sprintf(str, "%s %s %08x %08x\n",
+                       event->device_type, event->device_instance,
+                       event->event_type, event->event_data);
+               ptr = str;
+
+               acpi_os_free(event->device_type);
+               acpi_os_free(event->device_instance);
+               acpi_os_free(event);
+       }
 
-       if (copy_to_user(buf, str, size))
+       if (chars_remaining < count)
+               count = chars_remaining;
+       
+       if (copy_to_user(buf, ptr, count))
                return -EFAULT;
 
-       *ppos += size;
+       *ppos += count;
+       chars_remaining -= count;
+       ptr += count;
 
-       return size;
+       return count;
+}
+
+/****************************************************************************
+ *
+ * FUNCTION:   bm_osl_poll_event
+ *
+ * DESCRIPTION: Handles poll() of the 'event' file by blocking user-mode 
+ *              threads until data (an event) is generated.
+ *
+ ****************************************************************************/
+static unsigned int
+bm_osl_poll_event(
+       struct file             *file, 
+       poll_table              *wait)
+{
+       poll_wait(file, &bm_event_wait_queue, wait);
+       if (!list_empty(&bm_event_list))
+               return POLLIN | POLLRDNORM;
+       return 0;
 }
 
 struct file_operations proc_event_operations = {
        open:           bm_osl_open_event,
        read:           bm_osl_read_event,
        release:        bm_osl_close_event,
+       poll:           bm_osl_poll_event,      
 };
 
 /****************************************************************************
@@ -283,7 +311,11 @@ struct file_operations proc_event_operations = {
 int
 bm_osl_init(void)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+       status = acpi_subsystem_status();
+       if (ACPI_FAILURE(status))
+               return -ENODEV;
 
 #ifdef ACPI_DEBUG
        save_dbg_layer = acpi_dbg_layer;
index 829e4e39831ba466b22eb633640bf1badef38eb8..51e88efc00c4f52744ee45423c0ac665aca469c9 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  *
  * Module Name: bmdriver.c
- *   $Revision: 17 $
+ *   $Revision: 21 $
  *
  *****************************************************************************/
 
  *
  * FUNCTION:    bm_get_device_power_state
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_get_device_power_state (
        BM_HANDLE               device_handle,
        BM_POWER_STATE          *state)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_NODE                 *node = NULL;
 
        FUNCTION_TRACE("bm_get_device_power_state");
@@ -89,20 +89,20 @@ bm_get_device_power_state (
  *
  * FUNCTION:    bm_set_device_power_state
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_set_device_power_state (
        BM_HANDLE               device_handle,
        BM_POWER_STATE          state)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status           status = AE_OK;
        BM_NODE                 *node = NULL;
 
        FUNCTION_TRACE("bm_set_device_power_state");
@@ -131,28 +131,28 @@ bm_set_device_power_state (
  *
  * FUNCTION:    bm_get_device_status
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *    device_handle is really an index number into the array of BM_DEVICE
  *                  structures in info_list.  This data item is passed to
  *                  the registered program's "notify" callback.  It is used
  *                  to retrieve the specific BM_DEVICE structure instance
- *                  associated with the callback.  
+ *                  associated with the callback.
  *    device_status is a pointer that receives the result of processing
  *                  the device's associated ACPI _STA.
  *
  * RETURN:
- *    The ACPI_STATUS value indicates success AE_OK or failure of the function
+ *    The acpi_status value indicates success AE_OK or failure of the function
  *
  * DESCRIPTION: Evaluates the device's ACPI _STA, if it is present.
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_get_device_status (
        BM_HANDLE               device_handle,
        BM_DEVICE_STATUS        *device_status)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status           status = AE_OK;
        BM_NODE                 *node = NULL;
 
        FUNCTION_TRACE("bm_get_device_status");
@@ -195,7 +195,7 @@ bm_get_device_status (
         * Evaluate _STA:
         * --------------
         */
-       status = bm_evaluate_simple_integer(node->device.acpi_handle, "_STA", 
+       status = bm_evaluate_simple_integer(node->device.acpi_handle, "_STA",
                &(node->device.status));
        if (ACPI_SUCCESS(status)) {
                *device_status = node->device.status;
@@ -216,7 +216,7 @@ bm_get_device_status (
  *                  this device's information.
  *
  * RETURN:
- *    The ACPI_STATUS value indicates success AE_OK or failure of the function
+ *    The acpi_status value indicates success AE_OK or failure of the function
  *
  * DESCRIPTION:
  *    Using the device_handle this function retrieves this device's
@@ -224,12 +224,12 @@ bm_get_device_status (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_get_device_info (
        BM_HANDLE               device_handle,
        BM_DEVICE               **device)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status           status = AE_OK;
        BM_NODE                 *node = NULL;
 
        FUNCTION_TRACE("bm_get_device_info");
@@ -260,7 +260,7 @@ bm_get_device_info (
  *    context       A pointer to a BM_DRIVER_CONTEXT structure instance.
  *
  * RETURN:
- *    The ACPI_STATUS value indicates success AE_OK or failure of the function
+ *    The acpi_status value indicates success AE_OK or failure of the function
  *
  * DESCRIPTION:
  *    Using the device_handle this function retrieves this device's
@@ -268,12 +268,12 @@ bm_get_device_info (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_get_device_context (
        BM_HANDLE               device_handle,
        BM_DRIVER_CONTEXT       *context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status           status = AE_OK;
        BM_NODE                 *node = NULL;
 
        FUNCTION_TRACE("bm_get_device_context");
@@ -306,20 +306,20 @@ bm_get_device_context (
  *
  * FUNCTION:    bm_register_driver
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_register_driver (
        BM_DEVICE_ID            *criteria,
        BM_DRIVER               *driver)
 {
-       ACPI_STATUS             status = AE_NOT_FOUND;
+       acpi_status           status = AE_NOT_FOUND;
        BM_HANDLE_LIST          device_list;
        BM_NODE                 *node = NULL;
        BM_DEVICE               *device = NULL;
@@ -347,7 +347,7 @@ bm_register_driver (
        /*
         * Install driver:
         * ----------------
-        * For each match, record the driver information and execute the 
+        * For each match, record the driver information and execute the
         * driver's Notify() funciton (if present) to notify the driver
         * of the device's presence.
         */
@@ -361,19 +361,19 @@ bm_register_driver (
 
                device = &(node->device);
 
-               /* 
-                * Make sure another driver hasn't already registered for 
-                * this device. 
+               /*
+                * Make sure another driver hasn't already registered for
+                * this device.
                 */
                if (BM_IS_DRIVER_CONTROL(device)) {
-                       DEBUG_PRINT(ACPI_INFO, ("Another driver has already registered for device [%02x].\n", device->handle));
+                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Another driver has already registered for device [%02x].\n", device->handle));
                        continue;
                }
 
-               DEBUG_PRINT(ACPI_INFO, ("Registering driver for device [%02x].\n", device->handle));
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Registering driver for device [%02x].\n", device->handle));
 
                /* Notify driver of new device. */
-               status = driver->notify(BM_NOTIFY_DEVICE_ADDED, 
+               status = driver->notify(BM_NOTIFY_DEVICE_ADDED,
                        node->device.handle, &(node->driver.context));
                if (ACPI_SUCCESS(status)) {
                        node->driver.notify = driver->notify;
@@ -390,20 +390,20 @@ bm_register_driver (
  *
  * FUNCTION:    bm_unregister_driver
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_unregister_driver (
        BM_DEVICE_ID            *criteria,
        BM_DRIVER               *driver)
 {
-       ACPI_STATUS             status = AE_NOT_FOUND;
+       acpi_status           status = AE_NOT_FOUND;
        BM_HANDLE_LIST          device_list;
        BM_NODE                 *node = NULL;
        BM_DEVICE               *device = NULL;
@@ -444,18 +444,18 @@ bm_unregister_driver (
 
                device = &(node->device);
 
-               /* 
-                * Make sure driver has really registered for this device. 
+               /*
+                * Make sure driver has really registered for this device.
                 */
                if (!BM_IS_DRIVER_CONTROL(device)) {
-                       DEBUG_PRINT(ACPI_INFO, ("Driver hasn't registered for device [%02x].\n", device->handle));
+                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Driver hasn't registered for device [%02x].\n", device->handle));
                        continue;
                }
 
-               DEBUG_PRINT(ACPI_INFO, ("Unregistering driver for device [%02x].\n", device->handle));
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Unregistering driver for device [%02x].\n", device->handle));
 
                /* Notify driver of device removal. */
-               status = node->driver.notify(BM_NOTIFY_DEVICE_REMOVED, 
+               status = node->driver.notify(BM_NOTIFY_DEVICE_REMOVED,
                        node->device.handle, &(node->driver.context));
                if (ACPI_SUCCESS(status)) {
                        node->driver.notify = NULL;
index a303bc2466cc751bb196fb5cb27bc82a6227458a..db67f7305ed6a268ced26333025bebe6ef030b14 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  *
  * Module Name: bmnotify.c
- *   $Revision: 17 $
+ *   $Revision: 21 $
  *
  *****************************************************************************/
 
  *
  * FUNCTION:    bm_generate_notify
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_generate_notify (
        BM_NODE                 *node,
        u32                     notify_type)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_DEVICE               *device = NULL;
 
        FUNCTION_TRACE("bm_generate_notify");
@@ -64,14 +64,14 @@ bm_generate_notify (
 
        device = &(node->device);
 
-       DEBUG_PRINT(ACPI_INFO, ("Sending notify [%02x] to device [%02x].\n", notify_type, node->device.handle));
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Sending notify [%02x] to device [%02x].\n", notify_type, node->device.handle));
 
        if (!BM_IS_DRIVER_CONTROL(device)) {
-               DEBUG_PRINT(ACPI_INFO, ("No driver installed for device [%02x].\n", device->handle));
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "No driver installed for device [%02x].\n", device->handle));
                return_ACPI_STATUS(AE_NOT_EXIST);
        }
 
-       status = node->driver.notify(notify_type, node->device.handle, 
+       status = node->driver.notify(notify_type, node->device.handle,
                &(node->driver.context));
 
        return_ACPI_STATUS(status);
@@ -82,20 +82,20 @@ bm_generate_notify (
  *
  * FUNCTION:    bm_device_check
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_device_check (
        BM_NODE                 *node,
        u32                     *status_change)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_DEVICE               *device = NULL;
        BM_DEVICE_STATUS        old_status = BM_STATUS_UNKNOWN;
 
@@ -145,7 +145,7 @@ bm_device_check (
         * Device Insertion?
         * -----------------
         */
-       if ((device->status & BM_STATUS_PRESENT) && 
+       if ((device->status & BM_STATUS_PRESENT) &&
                !(old_status & BM_STATUS_PRESENT)) {
                /* TBD: Make sure driver is loaded, and if not, load. */
                status = bm_generate_notify(node, BM_NOTIFY_DEVICE_ADDED);
@@ -155,7 +155,7 @@ bm_device_check (
         * Device Removal?
         * ---------------
         */
-       else if (!(device->status & BM_STATUS_PRESENT) && 
+       else if (!(device->status & BM_STATUS_PRESENT) &&
                (old_status & BM_STATUS_PRESENT)) {
                /* TBD: Unload driver if last device instance. */
                status = bm_generate_notify(node, BM_NOTIFY_DEVICE_REMOVED);
@@ -169,19 +169,19 @@ bm_device_check (
  *
  * FUNCTION:    bm_bus_check
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_bus_check (
        BM_NODE                 *parent_node)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        u32                     status_change = FALSE;
 
        FUNCTION_TRACE("bm_bus_check");
@@ -218,21 +218,21 @@ bm_bus_check (
  *
  * FUNCTION:    bm_notify
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
 void
 bm_notify (
-       ACPI_HANDLE             acpi_handle,
+       acpi_handle             acpi_handle,
        u32                     notify_value,
        void                    *context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_NODE                 *node = NULL;
 
        FUNCTION_TRACE("bm_notify");
@@ -242,14 +242,14 @@ bm_notify (
         */
        status = bm_get_node(0, acpi_handle, &node);
        if (ACPI_FAILURE(status)) {
-               DEBUG_PRINT(ACPI_INFO, ("Recieved notify [%02x] for unknown device [%p].\n", notify_value, acpi_handle));
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Recieved notify [%02x] for unknown device [%p].\n", notify_value, acpi_handle));
                return_VOID;
        }
 
        /*
         * Device-Specific or Standard?
         * ----------------------------
-        * Device-specific notifies are forwarded to the control module's 
+        * Device-specific notifies are forwarded to the control module's
         * notify() function for processing.  Standard notifies are handled
         * internally.
         */
@@ -260,48 +260,48 @@ bm_notify (
                switch (notify_value) {
 
                case BM_NOTIFY_BUS_CHECK:
-                       DEBUG_PRINT(ACPI_INFO, ("Received BUS CHECK notification for device [%02x].\n", node->device.handle));
+                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Received BUS CHECK notification for device [%02x].\n", node->device.handle));
                        status = bm_bus_check(node);
                        break;
 
                case BM_NOTIFY_DEVICE_CHECK:
-                       DEBUG_PRINT(ACPI_INFO, ("Received DEVICE CHECK notification for device [%02x].\n", node->device.handle));
+                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Received DEVICE CHECK notification for device [%02x].\n", node->device.handle));
                        status = bm_device_check(node, NULL);
                        break;
 
                case BM_NOTIFY_DEVICE_WAKE:
-                       DEBUG_PRINT(ACPI_INFO, ("Received DEVICE WAKE notification for device [%02x].\n", node->device.handle));
+                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Received DEVICE WAKE notification for device [%02x].\n", node->device.handle));
                        /* TBD */
                        break;
 
                case BM_NOTIFY_EJECT_REQUEST:
-                       DEBUG_PRINT(ACPI_INFO, ("Received EJECT REQUEST notification for device [%02x].\n", node->device.handle));
+                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Received EJECT REQUEST notification for device [%02x].\n", node->device.handle));
                        /* TBD */
                        break;
 
                case BM_NOTIFY_DEVICE_CHECK_LIGHT:
-                       DEBUG_PRINT(ACPI_INFO, ("Received DEVICE CHECK LIGHT notification for device [%02x].\n", node->device.handle));
+                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Received DEVICE CHECK LIGHT notification for device [%02x].\n", node->device.handle));
                        /* TBD: Exactly what does the 'light' mean? */
                        status = bm_device_check(node, NULL);
                        break;
 
                case BM_NOTIFY_FREQUENCY_MISMATCH:
-                       DEBUG_PRINT(ACPI_INFO, ("Received FREQUENCY MISMATCH notification for device [%02x].\n", node->device.handle));
+                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Received FREQUENCY MISMATCH notification for device [%02x].\n", node->device.handle));
                        /* TBD */
                        break;
 
                case BM_NOTIFY_BUS_MODE_MISMATCH:
-                       DEBUG_PRINT(ACPI_INFO, ("Received BUS MODE MISMATCH notification for device [%02x].\n", node->device.handle));
+                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Received BUS MODE MISMATCH notification for device [%02x].\n", node->device.handle));
                        /* TBD */
                        break;
 
                case BM_NOTIFY_POWER_FAULT:
-                       DEBUG_PRINT(ACPI_INFO, ("Received POWER FAULT notification.\n"));
+                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Received POWER FAULT notification.\n"));
                        /* TBD */
                        break;
 
                default:
-                       DEBUG_PRINT(ACPI_INFO, ("Received unknown/unsupported notification.\n"));
+                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Received unknown/unsupported notification.\n"));
                        break;
                }
        }
index 0695f09124c718db3639ffd6dff3311f616fda5e..386662ab46a76db1168a2047ea0d4ab05c29add1 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  *
  * Module Name: bmpm.c
- *   $Revision: 10 $
+ *   $Revision: 14 $
  *
  *****************************************************************************/
 
  *
  * FUNCTION:    bm_get_inferred_power_state
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_get_inferred_power_state (
        BM_DEVICE               *device)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_HANDLE_LIST          pr_list;
        BM_POWER_STATE          list_state = ACPI_STATE_UNKNOWN;
        char                    object_name[5] = {'_','P','R','0','\0'};
@@ -72,18 +72,18 @@ bm_get_inferred_power_state (
        /*
         * Calculate Power State:
         * ----------------------
-        * Try to infer the devices's power state by checking the state of 
+        * Try to infer the devices's power state by checking the state of
         * the devices's power resources.  We start by evaluating _PR0
         * (resource requirements at D0) and work through _PR1 and _PR2.
-        * We know the current devices power state when all resources (for 
-        * a give Dx state) are ON.  If no power resources are on then the 
+        * We know the current devices power state when all resources (for
+        * a give Dx state) are ON.  If no power resources are on then the
         * device is assumed to be off (D3).
         */
        for (i=ACPI_STATE_D0; i<ACPI_STATE_D3; i++) {
 
                object_name[3] = '0' + i;
 
-               status = bm_evaluate_reference_list(device->acpi_handle, 
+               status = bm_evaluate_reference_list(device->acpi_handle,
                        object_name, &pr_list);
 
                if (ACPI_SUCCESS(status)) {
@@ -112,19 +112,19 @@ bm_get_inferred_power_state (
  *
  * FUNCTION:    bm_get_power_state
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_get_power_state (
        BM_NODE                 *node)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_DEVICE               *device = NULL;
 
        FUNCTION_TRACE("bm_get_power_state");
@@ -140,7 +140,7 @@ bm_get_power_state (
        /*
         * Power Control?
         * --------------
-        * If this device isn't directly power manageable (e.g. doesn't 
+        * If this device isn't directly power manageable (e.g. doesn't
         * include _PR0/_PS0) then there's nothing to do (state is static).
         */
        if (!BM_IS_POWER_CONTROL(device)) {
@@ -163,7 +163,7 @@ bm_get_power_state (
         * dependencies).
         */
        if (BM_IS_POWER_STATE(device)) {
-               status = bm_evaluate_simple_integer(device->acpi_handle, 
+               status = bm_evaluate_simple_integer(device->acpi_handle,
                        "_PSC", &(device->power.state));
        }
        else {
@@ -171,10 +171,10 @@ bm_get_power_state (
        }
 
        if (ACPI_SUCCESS(status)) {
-               DEBUG_PRINT(ACPI_INFO, ("Device [%02x] is at power state [D%d].\n", device->handle, device->power.state));
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Device [%02x] is at power state [D%d].\n", device->handle, device->power.state));
        }
        else {
-               DEBUG_PRINT(ACPI_INFO, ("Error getting power state for device [%02x]\n", device->handle));
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Error getting power state for device [%02x]\n", device->handle));
        }
 
        return_ACPI_STATUS(status);
@@ -185,20 +185,20 @@ bm_get_power_state (
  *
  * FUNCTION:    bm_set_power_state
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_set_power_state (
        BM_NODE                 *node,
        BM_POWER_STATE          state)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_DEVICE               *device = NULL;
        BM_DEVICE               *parent_device = NULL;
        BM_HANDLE_LIST          current_list;
@@ -220,7 +220,7 @@ bm_set_power_state (
        /*
         * Power Control?
         * --------------
-        * If this device isn't directly power manageable (e.g. doesn't 
+        * If this device isn't directly power manageable (e.g. doesn't
         * include _PR0/_PS0) then return an error (can't set state).
         */
        if (!BM_IS_POWER_CONTROL(device)) {
@@ -242,31 +242,31 @@ bm_set_power_state (
         * Can't be in a higher power state (lower Dx value) than parent.
         */
        if (state < parent_device->power.state) {
-               DEBUG_PRINT(ACPI_WARN, ("Cannot set device [%02x] to a higher-powered state than parent_device.\n", device->handle));
+               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Cannot set device [%02x] to a higher-powered state than parent_device.\n", device->handle));
                return_ACPI_STATUS(AE_ERROR);
        }
 
        /*
         * Get Resources:
         * --------------
-        * Get the power resources associated with the device's current 
+        * Get the power resources associated with the device's current
         * and target power states.
         */
        if (device->power.state != ACPI_STATE_UNKNOWN) {
                object_name[3] = '0' + device->power.state;
-               bm_evaluate_reference_list(device->acpi_handle, 
+               bm_evaluate_reference_list(device->acpi_handle,
                        object_name, &current_list);
        }
 
        object_name[3] = '0' + state;
-       bm_evaluate_reference_list(device->acpi_handle, object_name, 
+       bm_evaluate_reference_list(device->acpi_handle, object_name,
                &target_list);
 
        /*
         * Transition Resources:
         * ---------------------
-        * Transition all power resources referenced by this device to 
-        * the correct power state (taking into consideration sequencing 
+        * Transition all power resources referenced by this device to
+        * the correct power state (taking into consideration sequencing
         * and dependencies to other devices).
         */
        if (current_list.count || target_list.count) {
@@ -279,7 +279,7 @@ bm_set_power_state (
        /*
         * Execute _PSx:
         * -------------
-        * Execute the _PSx method corresponding to the target Dx state, 
+        * Execute the _PSx method corresponding to the target Dx state,
         * if it exists.
         */
        object_name[2] = 'S';
@@ -287,7 +287,7 @@ bm_set_power_state (
        bm_evaluate_object(device->acpi_handle, object_name, NULL, NULL);
 
        if (ACPI_SUCCESS(status)) {
-               DEBUG_PRINT(ACPI_INFO, ("Device [%02x] is now at [D%d].\n", device->handle, state));
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Device [%02x] is now at [D%d].\n", device->handle, state));
                device->power.state = state;
        }
 
@@ -299,22 +299,22 @@ bm_set_power_state (
  *
  * FUNCTION:    bm_get_pm_capabilities
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_get_pm_capabilities (
        BM_NODE                 *node)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_DEVICE               *device = NULL;
        BM_DEVICE               *parent_device = NULL;
-       ACPI_HANDLE             acpi_handle = NULL;
+       acpi_handle             acpi_handle = NULL;
        BM_POWER_STATE          dx_supported = ACPI_STATE_UNKNOWN;
        char                    object_name[5] = {'_','S','0','D','\0'};
        u32                     i = 0;
@@ -332,17 +332,17 @@ bm_get_pm_capabilities (
         * Power Management Flags:
         * -----------------------
         */
-       if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_PSC", 
+       if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_PSC",
                &acpi_handle))) {
                device->power.flags |= BM_FLAGS_POWER_STATE;
        }
 
-       if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_IRC", 
+       if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_IRC",
                &acpi_handle))) {
                device->power.flags |= BM_FLAGS_INRUSH_CURRENT;
        }
 
-       if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_PRW", 
+       if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_PRW",
                &acpi_handle))) {
                device->power.flags |= BM_FLAGS_WAKE_CAPABLE;
        }
@@ -362,22 +362,22 @@ bm_get_pm_capabilities (
         * Figure out which Dx states are supported by this device for the
         * S0 (working) state.  Note that D0 and D3 are required (assumed).
         */
-       device->power.dx_supported[ACPI_STATE_S0] = BM_FLAGS_D0_SUPPORT | 
+       device->power.dx_supported[ACPI_STATE_S0] = BM_FLAGS_D0_SUPPORT |
                BM_FLAGS_D3_SUPPORT;
 
-       if ((ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_PR1", 
-               &acpi_handle))) || 
-               (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_PS1", 
+       if ((ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_PR1",
+               &acpi_handle))) ||
+               (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_PS1",
                &acpi_handle)))) {
-               device->power.dx_supported[ACPI_STATE_S0] |= 
+               device->power.dx_supported[ACPI_STATE_S0] |=
                        BM_FLAGS_D1_SUPPORT;
        }
 
-       if ((ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_PR2", 
-               &acpi_handle))) || 
-               (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_PS2", 
+       if ((ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_PR2",
+               &acpi_handle))) ||
+               (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_PS2",
                &acpi_handle)))) {
-               device->power.dx_supported[ACPI_STATE_S0] |= 
+               device->power.dx_supported[ACPI_STATE_S0] |=
                        BM_FLAGS_D2_SUPPORT;
        }
 
@@ -395,30 +395,30 @@ bm_get_pm_capabilities (
                device->power.dx_supported[i] = BM_FLAGS_D3_SUPPORT;
 
                /*
-                * Evalute _SxD:
+                * Evalute _Sx_d:
                 * -------------
-                * Which returns the highest (power) Dx state supported in 
-                * this system (Sx) state.  We convert this value to a bit 
+                * Which returns the highest (power) Dx state supported in
+                * this system (Sx) state.  We convert this value to a bit
                 * mask of supported states (conceptually simpler).
                 */
-               status = bm_evaluate_simple_integer(device->acpi_handle, 
+               status = bm_evaluate_simple_integer(device->acpi_handle,
                        object_name, &dx_supported);
                if (ACPI_SUCCESS(status)) {
                        switch (dx_supported) {
                        case 0:
-                               device->power.dx_supported[i] |= 
+                               device->power.dx_supported[i] |=
                                        BM_FLAGS_D0_SUPPORT;
                                /* fall through */
                        case 1:
-                               device->power.dx_supported[i] |= 
+                               device->power.dx_supported[i] |=
                                        BM_FLAGS_D1_SUPPORT;
                                /* fall through */
                        case 2:
-                               device->power.dx_supported[i] |= 
+                               device->power.dx_supported[i] |=
                                        BM_FLAGS_D2_SUPPORT;
                                /* fall through */
                        case 3:
-                               device->power.dx_supported[i] |= 
+                               device->power.dx_supported[i] |=
                                        BM_FLAGS_D3_SUPPORT;
                                break;
                        }
@@ -426,12 +426,12 @@ bm_get_pm_capabilities (
                        /*
                         * Validate:
                         * ---------
-                        * Mask of any states that _Sx_d falsely advertises 
-                        * (e.g.claims D1 support but neither _PR2 or _PS2 
-                        * exist).  In other words, S1-S5 can't offer a Dx 
+                        * Mask of any states that _Sx_d falsely advertises
+                        * (e.g.claims D1 support but neither _PR2 or _PS2
+                        * exist).  In other words, S1-S5 can't offer a Dx
                         * state that isn't supported by S0.
                         */
-                       device->power.dx_supported[i] &= 
+                       device->power.dx_supported[i] &=
                                device->power.dx_supported[ACPI_STATE_S0];
                }
 
index d5346120f9555ec1288718b111cfff153fe9a3ba..427dcc23193fdce516600133a043aa77b9a26797 100644 (file)
@@ -1,7 +1,7 @@
 /****************************************************************************
  *
  * Module Name: bmpower.c - Driver for ACPI Power Resource 'devices'
- *   $Revision: 14 $
+ *   $Revision: 19 $
  *
  ****************************************************************************/
 
@@ -25,7 +25,7 @@
 
 /*
  * TBD: 1. Sequencing of power resource list transitions.
- *     2. Global serialization of power resource transtions (see ACPI 
+ *     2. Global serialization of power resource transtions (see ACPI
  *         spec section 7.1.2/7.1.3).
  *      3. Better error handling.
  */
  *                             Function Prototypes
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_pr_notify (
        BM_NOTIFY               notify_type,
        BM_HANDLE               device_handle,
        void                    **context);
        
-ACPI_STATUS
+acpi_status
 bm_pr_request (
        BM_REQUEST              *request,
        void                    *context);
@@ -64,19 +64,21 @@ bm_pr_request (
  *
  * FUNCTION:    bm_pr_print
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_pr_print (
        BM_POWER_RESOURCE       *pr)
 {
-       ACPI_BUFFER             buffer;
+       acpi_buffer             buffer;
+
+       PROC_NAME("bm_pr_print");
 
        if (!pr) {
                return(AE_BAD_PARAMETER);
@@ -92,11 +94,11 @@ bm_pr_print (
 
        acpi_os_printf("Power Resource: found\n");
 
-       DEBUG_PRINT_RAW(ACPI_INFO, ("+------------------------------------------------------------\n"));
-       DEBUG_PRINT_RAW(ACPI_INFO, ("| PowerResource[%02x]:[%p] %s\n", pr->device_handle, pr->acpi_handle, buffer.pointer));
-       DEBUG_PRINT_RAW(ACPI_INFO, ("|   system_level[S%d] resource_order[%d]\n", pr->system_level, pr->resource_order));
-       DEBUG_PRINT_RAW(ACPI_INFO, ("|   state[D%d] reference_count[%d]\n", pr->state, pr->reference_count));
-       DEBUG_PRINT_RAW(ACPI_INFO, ("+------------------------------------------------------------\n"));
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| Power_resource[%02x]:[%p] %s\n", pr->device_handle, pr->acpi_handle, buffer.pointer));
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "|   system_level[S%d] resource_order[%d]\n", pr->system_level, pr->resource_order));
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "|   state[D%d] reference_count[%d]\n", pr->state, pr->reference_count));
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
 
        acpi_os_free(buffer.pointer);
 
@@ -108,19 +110,19 @@ bm_pr_print (
  *
  * FUNCTION:    bm_pr_get_state
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_pr_get_state (
        BM_POWER_RESOURCE       *pr)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_DEVICE_STATUS        device_status = BM_STATUS_UNKNOWN;
 
        FUNCTION_TRACE("bm_pr_get_state");
@@ -131,7 +133,7 @@ bm_pr_get_state (
 
        pr->state = ACPI_STATE_UNKNOWN;
 
-       /* 
+       /*
         * Evaluate _STA:
         * --------------
         * Evalute _STA to determine whether the power resource is ON or OFF.
@@ -140,21 +142,21 @@ bm_pr_get_state (
         */
        status = bm_get_device_status(pr->device_handle, &device_status);
        if (ACPI_FAILURE(status)) {
-               DEBUG_PRINT(ACPI_ERROR, ("Error reading status for power resource [%02x].\n", pr->device_handle));
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Error reading status for power resource [%02x].\n", pr->device_handle));
                return_ACPI_STATUS(status);
        }
 
        /*
-        * Mask off all bits but the first as some systems return non-standard 
+        * Mask off all bits but the first as some systems return non-standard
         * values (e.g. 0x51).
         */
        switch (device_status & 0x01) {
        case 0:
-               DEBUG_PRINT(ACPI_INFO, ("Power resource [%02x] is OFF.\n", pr->device_handle));
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Power resource [%02x] is OFF.\n", pr->device_handle));
                pr->state = ACPI_STATE_D3;
                break;
        case 1:
-               DEBUG_PRINT(ACPI_INFO, ("Power resource [%02x] is ON.\n", pr->device_handle));
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Power resource [%02x] is ON.\n", pr->device_handle));
                pr->state = ACPI_STATE_D0;
                break;
        }
@@ -167,20 +169,20 @@ bm_pr_get_state (
  *
  * FUNCTION:    bm_pr_set_state
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_pr_set_state (
        BM_POWER_RESOURCE       *pr,
        BM_POWER_STATE          target_state)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
 
        FUNCTION_TRACE("bm_pr_set_state");
 
@@ -194,19 +196,19 @@ bm_pr_set_state (
        }
 
        if (target_state == pr->state) {
-               DEBUG_PRINT(ACPI_INFO, ("Power resource [%02x] already at target power state [D%d].\n", pr->device_handle, pr->state));
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Power resource [%02x] already at target power state [D%d].\n", pr->device_handle, pr->state));
                return_ACPI_STATUS(AE_OK);
        }
 
        switch (target_state) {
 
        case ACPI_STATE_D0:
-               DEBUG_PRINT(ACPI_INFO, ("Turning power resource [%02x] ON.\n", pr->device_handle));
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Turning power resource [%02x] ON.\n", pr->device_handle));
                status = bm_evaluate_object(pr->acpi_handle, "_ON", NULL, NULL);
                break;
 
        case ACPI_STATE_D3:
-               DEBUG_PRINT(ACPI_INFO, ("Turning power resource [%02x] OFF.\n", pr->device_handle));
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Turning power resource [%02x] OFF.\n", pr->device_handle));
                status = bm_evaluate_object(pr->acpi_handle, "_OFF", NULL, NULL);
                break;
 
@@ -228,20 +230,20 @@ bm_pr_set_state (
  *
  * FUNCTION:    bm_pr_list_get_state
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_pr_list_get_state (
        BM_HANDLE_LIST          *pr_list,
        BM_POWER_STATE          *power_state)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_POWER_RESOURCE       *pr = NULL;
        u32                     i = 0;
 
@@ -263,7 +265,7 @@ bm_pr_list_get_state (
         * -----------------------------
         * The current state of a list of power resources is ON if all
         * power resources are currently in the ON state.  In other words,
-        * if any power resource in the list is OFF then the collection 
+        * if any power resource in the list is OFF then the collection
         * isn't fully ON.
         */
        for (i = 0; i < pr_list->count; i++) {
@@ -271,7 +273,7 @@ bm_pr_list_get_state (
                status = bm_get_device_context(pr_list->handles[i],
                        (BM_DRIVER_CONTEXT*)(&pr));
                if (ACPI_FAILURE(status)) {
-                       DEBUG_PRINT(ACPI_WARN, ("Invalid reference to power resource [%02x].\n", pr_list->handles[i]));
+                       ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Invalid reference to power resource [%02x].\n", pr_list->handles[i]));
                        (*power_state) = ACPI_STATE_UNKNOWN;
                        break;
                }
@@ -296,20 +298,20 @@ bm_pr_list_get_state (
  *
  * FUNCTION:    bm_pr_list_transition
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_pr_list_transition (
        BM_HANDLE_LIST          *current_list,
        BM_HANDLE_LIST          *target_list)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_POWER_RESOURCE       *pr = NULL;
        u32                     i = 0;
 
@@ -322,16 +324,16 @@ bm_pr_list_transition (
        /*
         * Reference Target:
         * -----------------
-        * Reference all resources for the target power state first (so 
-        * the device doesn't get turned off while transitioning).  Power 
+        * Reference all resources for the target power state first (so
+        * the device doesn't get turned off while transitioning).  Power
         * resources that aren't on (new reference count of 1) are turned on.
         */
        for (i = 0; i < target_list->count; i++) {
 
-               status = bm_get_device_context(target_list->handles[i], 
+               status = bm_get_device_context(target_list->handles[i],
                        (BM_DRIVER_CONTEXT*)(&pr));
                if (ACPI_FAILURE(status)) {
-                       DEBUG_PRINT(ACPI_WARN, ("Invalid reference to power resource [%02x].\n", target_list->handles[i]));
+                       ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Invalid reference to power resource [%02x].\n", target_list->handles[i]));
                        continue;
                }
 
@@ -340,7 +342,7 @@ bm_pr_list_transition (
                        status = bm_pr_set_state(pr, ACPI_STATE_D0);
                        if (ACPI_FAILURE(status)) {
                                /* TBD: How do we handle this? */
-                               DEBUG_PRINT(ACPI_WARN, ("Unable to change power state for power resource [%02x].\n", target_list->handles[i]));
+                               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Unable to change power state for power resource [%02x].\n", target_list->handles[i]));
                        }
                }
        }
@@ -349,15 +351,15 @@ bm_pr_list_transition (
         * Dereference Current:
         * --------------------
         * Dereference all resources for the current power state.  Power
-        * resources no longer referenced (new reference count of 0) are 
+        * resources no longer referenced (new reference count of 0) are
         * turned off.
         */
        for (i = 0; i < current_list->count; i++) {
 
-               status = bm_get_device_context(current_list->handles[i], 
+               status = bm_get_device_context(current_list->handles[i],
                        (BM_DRIVER_CONTEXT*)(&pr));
                if (ACPI_FAILURE(status)) {
-                       DEBUG_PRINT(ACPI_WARN, ("Invalid reference to power resource [%02x].\n", target_list->handles[i]));
+                       ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Invalid reference to power resource [%02x].\n", target_list->handles[i]));
                        continue;
                }
 
@@ -366,7 +368,7 @@ bm_pr_list_transition (
                        status = bm_pr_set_state(pr, ACPI_STATE_D3);
                        if (ACPI_FAILURE(status)) {
                                /* TBD: How do we handle this? */
-                               DEBUG_PRINT(ACPI_ERROR, ("Unable to change power state for power resource [%02x].\n", current_list->handles[i]));
+                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unable to change power state for power resource [%02x].\n", current_list->handles[i]));
                        }
                }
        }
@@ -379,34 +381,34 @@ bm_pr_list_transition (
  *
  * FUNCTION:    bm_pr_add_device
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_pr_add_device (
        BM_HANDLE               device_handle,
        void                    **context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_POWER_RESOURCE       *pr = NULL;
        BM_DEVICE               *device = NULL;
-       ACPI_BUFFER             buffer;
-       ACPI_OBJECT             acpi_object;
+       acpi_buffer             buffer;
+       acpi_object             acpi_object;
 
        FUNCTION_TRACE("bm_pr_add_device");
 
-       DEBUG_PRINT(ACPI_INFO, ("Adding power resource [%02x].\n", device_handle));
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Adding power resource [%02x].\n", device_handle));
 
        if (!context || *context) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       buffer.length = sizeof(ACPI_OBJECT);
+       buffer.length = sizeof(acpi_object);
        buffer.pointer = &acpi_object;
 
        /*
@@ -428,7 +430,7 @@ bm_pr_add_device (
        pr->device_handle = device->handle;
        pr->acpi_handle = device->acpi_handle;
 
-       /* 
+       /*
         * Get information on this power resource.
         */
        status = acpi_evaluate_object(pr->acpi_handle, NULL, NULL, &buffer);
@@ -463,19 +465,19 @@ end:
  *
  * FUNCTION:    bm_pr_remove_device
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_pr_remove_device (
        void                    **context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_POWER_RESOURCE       *pr = NULL;
 
        FUNCTION_TRACE("bm_pr_remove_device");
@@ -486,7 +488,7 @@ bm_pr_remove_device (
 
        pr = (BM_POWER_RESOURCE*)*context;
 
-       DEBUG_PRINT(ACPI_INFO, ("Removing power resource [%02x].\n", pr->device_handle));
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing power resource [%02x].\n", pr->device_handle));
 
        acpi_os_free(pr);
 
@@ -506,14 +508,14 @@ bm_pr_remove_device (
  *
  * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_pr_initialize (void)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_DEVICE_ID            criteria;
        BM_DRIVER               driver;
 
@@ -537,18 +539,18 @@ bm_pr_initialize (void)
  *
  * FUNCTION:    bm_pr_terminate
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
  * RETURN:     
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_pr_terminate (void)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_DEVICE_ID            criteria;
        BM_DRIVER               driver;
 
@@ -572,21 +574,21 @@ bm_pr_terminate (void)
  *
  * FUNCTION:    bm_pr_notify
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
  * RETURN:     
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_pr_notify (
        BM_NOTIFY               notify_type,
        BM_HANDLE               device_handle,
        void                    **context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
 
        FUNCTION_TRACE("bm_pr_notify");
 
@@ -613,20 +615,20 @@ bm_pr_notify (
  *
  * FUNCTION:    bm_pr_request
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_pr_request (
        BM_REQUEST              *request,
        void                    *context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_POWER_RESOURCE       *pr = NULL;
 
        FUNCTION_TRACE("bm_pr_request");
@@ -660,4 +662,3 @@ bm_pr_request (
 }
 
 
-
index 13f9e583b64659d8ec9a79d5f6bb6698155fdbae..a9ecb33d92f0ca8bbbe676671d1f3635e3d7266e 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: bmrequest.c
- *   $Revision: 12 $
+ *   $Revision: 16 $
  *
  *****************************************************************************/
 
  *
  * FUNCTION:    bm_generate_request
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_generate_request (
        BM_NODE                 *node,
        BM_REQUEST              *request)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_DEVICE               *device = NULL;
 
        FUNCTION_TRACE("bm_generate_request");
@@ -64,7 +64,7 @@ bm_generate_request (
        device = &(node->device);
 
        if (!BM_IS_DRIVER_CONTROL(device)) {
-               DEBUG_PRINT(ACPI_WARN, ("No driver installed for device [%02x].\n", device->handle));
+               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No driver installed for device [%02x].\n", device->handle));
                return_ACPI_STATUS(AE_NOT_EXIST);
        }
 
@@ -78,19 +78,19 @@ bm_generate_request (
  *
  * FUNCTION:    bm_request
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_request (
        BM_REQUEST              *request)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_NODE                 *node = NULL;
        BM_DEVICE               *device = NULL;
 
@@ -103,7 +103,7 @@ bm_request (
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       DEBUG_PRINT(ACPI_INFO, ("Received request for device [%02x] command [%02x].\n", request->handle, request->command));
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Received request for device [%02x] command [%02x].\n", request->handle, request->command));
 
        /*
         * Resolve the node.
@@ -137,15 +137,15 @@ bm_request (
                if (ACPI_FAILURE(status)) {
                        break;
                }
-               status = bm_copy_to_buffer(&(request->buffer), 
+               status = bm_copy_to_buffer(&(request->buffer),
                        &(device->power.state), sizeof(BM_POWER_STATE));
                break;
 
        case BM_COMMAND_SET_POWER_STATE:
-       {
+        {
                BM_POWER_STATE *power_state = NULL;
 
-               status = bm_cast_buffer(&(request->buffer), 
+               status = bm_cast_buffer(&(request->buffer),
                        (void**)&power_state, sizeof(BM_POWER_STATE));
                if (ACPI_FAILURE(status)) {
                        break;
index d98c00030cd2423977e098f4533b8f52acc175fc..17c552e73f403e452b81afb2eec9df858ffc43aa 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: bmsearch.c
- *   $Revision: 13 $
+ *   $Revision: 16 $
  *
  *****************************************************************************/
 
  *
  * FUNCTION:    bm_compare
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_compare (
        BM_DEVICE               *device,
        BM_DEVICE_ID            *criteria)
@@ -57,7 +57,7 @@ bm_compare (
                return AE_BAD_PARAMETER;
        }
 
-       /* 
+       /*
         * Present?
         * --------
         * We're only going to match on devices that are present.
@@ -67,22 +67,22 @@ bm_compare (
                return AE_NOT_FOUND;
        }
 
-       /* 
+       /*
         * Type?
         */
        if (criteria->type && (criteria->type != device->id.type)) {
                return AE_NOT_FOUND;
        }
 
-       /* 
+       /*
         * HID?
         */
-       if ((criteria->hid[0]) && (0 != STRNCMP(criteria->hid, 
+       if ((criteria->hid[0]) && (0 != STRNCMP(criteria->hid,
                device->id.hid, sizeof(BM_DEVICE_HID)))) {
                return AE_NOT_FOUND;
        }
 
-       /* 
+       /*
         * ADR?
         */
        if ((criteria->adr) && (criteria->adr != device->id.adr)) {
@@ -97,24 +97,24 @@ bm_compare (
  *
  * FUNCTION:    bm_search
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
  * RETURN:      AE_BAD_PARAMETER- invalid input parameter
  *              AE_NOT_EXIST    - start_device_handle doesn't exist
  *              AE_NOT_FOUND    - no matches to Search_info.criteria found
  *              AE_OK           - success
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_search(
        BM_HANDLE               device_handle,
        BM_DEVICE_ID            *criteria,
        BM_HANDLE_LIST          *results)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_NODE                 *node = NULL;
 
        FUNCTION_TRACE("bm_search");
@@ -149,7 +149,7 @@ bm_search(
                if (node->scope.head) {
                        status = bm_compare(&(node->device), criteria);
                        if (ACPI_SUCCESS(status)) {
-                               results->handles[results->count++] = 
+                               results->handles[results->count++] =
                                        node->device.handle;
                        }
                        node = node->scope.head;
@@ -163,16 +163,16 @@ bm_search(
                else {
                        status = bm_compare(&(node->device), criteria);
                        if (ACPI_SUCCESS(status)) {
-                               results->handles[results->count++] = 
+                               results->handles[results->count++] =
                                        node->device.handle;
                        }
 
                        /*
                         * Locate Next Device:
                         * -------------------
-                        * The next node is either a peer at this level 
-                        * (node->next is valid), or we work are way back 
-                        * up the tree until we either find a non-parsed 
+                        * The next node is either a peer at this level
+                        * (node->next is valid), or we work are way back
+                        * up the tree until we either find a non-parsed
                         * peer or hit the top (node->parent is NULL).
                         */
                        while (!node->next && node->parent) {
index c2cb1e346967230314b71d8e3dcc5a420c6b802a..b35644b24fecc83fccb4fb68ed4506c989378e3b 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  *
  * Module Name: bmutils.c
- *   $Revision: 28 $
+ *   $Revision: 38 $
  *
  *****************************************************************************/
 
  *
  * FUNCTION:    bm_print_eval_error
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
 void
 bm_print_eval_error (
        u32                     debug_level,
-       ACPI_HANDLE             acpi_handle,
-       ACPI_STRING             pathname,
-       ACPI_STATUS             status)
+       acpi_handle             handle,
+       acpi_string             pathname,
+       acpi_status             status)
 {
-       ACPI_BUFFER             buffer;
-       ACPI_STRING             status_string = NULL;
+       acpi_buffer             buffer;
+       acpi_status             local_status;
+
+       PROC_NAME("bm_print_eval_error");
 
        buffer.length = 256;
        buffer.pointer = acpi_os_callocate(buffer.length);
@@ -71,19 +73,20 @@ bm_print_eval_error (
                return;
        }
 
-       status_string = acpi_ut_format_exception(status);
-
-       status = acpi_get_name(acpi_handle, ACPI_FULL_PATHNAME, &buffer);
-       if (ACPI_FAILURE(status)) {
-               DEBUG_PRINT(debug_level, ("Evaluate object [%p], %s\n", acpi_handle, status_string));
+       local_status = acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
+       if (ACPI_FAILURE(local_status)) {
+               ACPI_DEBUG_PRINT((ACPI_DEBUG_LEVEL(debug_level), "Evaluate object [%p], %s\n", handle,
+                       acpi_format_exception(status)));
                return;
        }
 
        if (pathname) {
-               DEBUG_PRINT(ACPI_INFO, ("Evaluate object [%s.%s], %s\n", buffer.pointer, pathname, status_string));
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Evaluate object [%s.%s], %s\n", buffer.pointer, pathname,
+                       acpi_format_exception(status)));
        }
        else {
-               DEBUG_PRINT(ACPI_INFO, ("Evaluate object [%s], %s\n", buffer.pointer, status_string));
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Evaluate object [%s], %s\n", buffer.pointer,
+                       acpi_format_exception(status)));
        }
 
        acpi_os_free(buffer.pointer);
@@ -94,17 +97,17 @@ bm_print_eval_error (
  *
  * FUNCTION:    bm_copy_to_buffer
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_copy_to_buffer (
-       ACPI_BUFFER             *buffer,
+       acpi_buffer             *buffer,
        void                    *data,
        u32                     length)
 {
@@ -130,17 +133,17 @@ bm_copy_to_buffer (
  *
  * FUNCTION:    bm_cast_buffer
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_cast_buffer (
-       ACPI_BUFFER             *buffer,
+       acpi_buffer             *buffer,
        void                    **pointer,
        u32                     length)
 {
@@ -164,11 +167,11 @@ bm_cast_buffer (
  *
  * FUNCTION:    bm_extract_package_data
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
@@ -178,18 +181,18 @@ bm_cast_buffer (
  *       (e.g. toshiba _BIF)
  */
 
-ACPI_STATUS
+acpi_status
 bm_extract_package_data (
-       ACPI_OBJECT             *package,
-       ACPI_BUFFER             *package_format,
-       ACPI_BUFFER             *buffer)
+       acpi_object             *package,
+       acpi_buffer             *package_format,
+       acpi_buffer             *buffer)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        u8                      *head = NULL;
        u8                      *tail = NULL;
        u8                      **pointer = NULL;
        u32                     tail_offset = 0;
-       ACPI_OBJECT             *element = NULL;
+       acpi_object             *element = NULL;
        u32                     size_required = 0;
        char*                   format = NULL;
        u32                     format_count = 0;
@@ -199,7 +202,7 @@ bm_extract_package_data (
 
        if (!package || (package->type != ACPI_TYPE_PACKAGE) ||
                (package->package.count == 0) || !package_format ||
-               (package_format->length < 1) || 
+               (package_format->length < 1) ||
                (!package_format->pointer) || !buffer) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
@@ -207,7 +210,7 @@ bm_extract_package_data (
        format_count = package_format->length - 1;
 
        if (format_count > package->package.count) {
-               DEBUG_PRINT(ACPI_WARN, ("Format specifies more objects [%d] than exist in package [%d].", format_count, package->package.count));
+               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Format specifies more objects [%d] than exist in package [%d].", format_count, package->package.count));
                return_ACPI_STATUS(AE_BAD_DATA);
        }
 
@@ -224,16 +227,16 @@ bm_extract_package_data (
                case ACPI_TYPE_INTEGER:
                        switch (format[i]) {
                        case 'N':
-                               size_required += sizeof(ACPI_INTEGER);
-                               tail_offset += sizeof(ACPI_INTEGER);
+                               size_required += sizeof(acpi_integer);
+                               tail_offset += sizeof(acpi_integer);
                                break;
                        case 'S':
-                               size_required += sizeof(u8*) + 
-                                       sizeof(ACPI_INTEGER) + 1;
-                               tail_offset += sizeof(ACPI_INTEGER);
+                               size_required += sizeof(u8*) +
+                                       sizeof(acpi_integer) + 1;
+                               tail_offset += sizeof(acpi_integer);
                                break;
                        default:
-                               DEBUG_PRINT(ACPI_WARN, ("Invalid package element [%d]: got number, expecing [%c].\n", i, format[i]));
+                               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Invalid package element [%d]: got number, expecing [%c].\n", i, format[i]));
                                return_ACPI_STATUS(AE_BAD_DATA);
                                break;
                        }
@@ -243,17 +246,17 @@ bm_extract_package_data (
                case ACPI_TYPE_BUFFER:
                        switch (format[i]) {
                        case 'S':
-                               size_required += sizeof(u8*) + 
+                               size_required += sizeof(u8*) +
                                        element->string.length + 1;
                                tail_offset += sizeof(u8*);
                                break;
                        case 'B':
-                               size_required += sizeof(u8*) + 
+                               size_required += sizeof(u8*) +
                                        element->buffer.length;
                                tail_offset += sizeof(u8*);
                                break;
                        default:
-                               DEBUG_PRINT(ACPI_WARN, ("Invalid package element [%d] got string/buffer, expecing [%c].\n", i, format[i]));
+                               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Invalid package element [%d] got string/buffer, expecing [%c].\n", i, format[i]));
                                return_ACPI_STATUS(AE_BAD_DATA);
                                break;
                        }
@@ -293,17 +296,17 @@ bm_extract_package_data (
                case ACPI_TYPE_INTEGER:
                        switch (format[i]) {
                        case 'N':
-                               *((ACPI_INTEGER*)head) = 
+                               *((acpi_integer*)head) =
                                        element->integer.value;
-                               head += sizeof(ACPI_INTEGER);
+                               head += sizeof(acpi_integer);
                                break;
                        case 'S':
                                pointer = (u8**)head;
                                *pointer = tail;
-                               *((ACPI_INTEGER*)tail) = 
+                               *((acpi_integer*)tail) =
                                        element->integer.value;
-                               head += sizeof(ACPI_INTEGER*);
-                               tail += sizeof(ACPI_INTEGER);
+                               head += sizeof(acpi_integer*);
+                               tail += sizeof(acpi_integer);
                                /* NULL terminate string */
                                *tail = 0;
                                tail++;
@@ -320,7 +323,7 @@ bm_extract_package_data (
                        case 'S':
                                pointer = (u8**)head;
                                *pointer = tail;
-                               memcpy(tail, element->string.pointer, 
+                               memcpy(tail, element->string.pointer,
                                        element->string.length);
                                head += sizeof(u8*);
                                tail += element->string.length;
@@ -331,7 +334,7 @@ bm_extract_package_data (
                        case 'B':
                                pointer = (u8**)head;
                                *pointer = tail;
-                               memcpy(tail, element->buffer.pointer, 
+                               memcpy(tail, element->buffer.pointer,
                                        element->buffer.length);
                                head += sizeof(u8*);
                                tail += element->buffer.length;
@@ -358,26 +361,26 @@ bm_extract_package_data (
  *
  * FUNCTION:    bm_evaluate_object
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
  * RETURN:      AE_OK
- *              AE_BUFFER_OVERFLOW  Evaluated object returned data, but 
+ *              AE_BUFFER_OVERFLOW  Evaluated object returned data, but
  *                                  caller did not provide buffer.
  *
  * DESCRIPTION: Helper for acpi_evaluate_object that handles buffer
- *              allocation.  Note that the caller is responsible for 
+ *              allocation.  Note that the caller is responsible for
  *              freeing buffer->pointer!
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_evaluate_object (
-       ACPI_HANDLE             acpi_handle,
-       ACPI_STRING             pathname,
-       ACPI_OBJECT_LIST        *arguments,
-       ACPI_BUFFER             *buffer)
+       acpi_handle             handle,
+       acpi_string             pathname,
+       acpi_object_list        *arguments,
+       acpi_buffer             *buffer)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
 
        FUNCTION_TRACE("bm_evaluate_object");
 
@@ -389,11 +392,11 @@ bm_evaluate_object (
        /*
         * Evalute Object:
         * ---------------
-        * The first attempt is just to get the size of the object data 
-        * (that is unless there's no return data, e.g. _INI); the second 
+        * The first attempt is just to get the size of the object data
+        * (that is unless there's no return data, e.g. _INI); the second
         * gets the data.
         */
-       status = acpi_evaluate_object(acpi_handle, pathname, arguments, buffer);
+       status = acpi_evaluate_object(handle, pathname, arguments, buffer);
        if (ACPI_SUCCESS(status)) {
                return_ACPI_STATUS(status);
        }
@@ -406,17 +409,17 @@ bm_evaluate_object (
                }
 
                /* Re-evaluate -- this time it should work */
-               status = acpi_evaluate_object(acpi_handle, pathname, 
+               status = acpi_evaluate_object(handle, pathname,
                        arguments, buffer);
        }
 
        if (ACPI_FAILURE(status)) {
                if (status != AE_NOT_FOUND) {
-                       DEBUG_EVAL_ERROR(ACPI_WARN, acpi_handle, pathname, 
+                       DEBUG_EVAL_ERROR(ACPI_LV_WARN, handle, pathname,
                                status);
                }
                if (buffer && buffer->pointer) {
-                       acpi_os_free(buffer->pointer); 
+                       acpi_os_free(buffer->pointer);
                        buffer->pointer = NULL;
                        buffer->length = 0;
                }
@@ -430,23 +433,23 @@ bm_evaluate_object (
  *
  * FUNCTION:    bm_evaluate_simple_integer
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bm_evaluate_simple_integer (
-       ACPI_HANDLE             acpi_handle,
-       ACPI_STRING             pathname,
+       acpi_handle             handle,
+       acpi_string             pathname,
        u32                     *data)
 {
-       ACPI_STATUS             status = AE_OK;
-       ACPI_OBJECT             *element = NULL;
-       ACPI_BUFFER             buffer;
+       acpi_status             status = AE_OK;
+       acpi_object             *element = NULL;
+       acpi_buffer             buffer;
 
        FUNCTION_TRACE("bm_evaluate_simple_integer");
 
@@ -454,14 +457,16 @@ bm_evaluate_simple_integer (
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       MEMSET(&buffer, 0, sizeof(ACPI_BUFFER));
+       MEMSET(&buffer, 0, sizeof(acpi_buffer));
 
        /*
         * Evaluate Object:
         * ----------------
         */
-       status = bm_evaluate_object(acpi_handle, pathname, NULL, &buffer);
+       status = bm_evaluate_object(handle, pathname, NULL, &buffer);
        if (ACPI_FAILURE(status)) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "failed to evaluate object (%s)\n",
+                       acpi_format_exception(status)));
                goto end;
        }
 
@@ -469,16 +474,16 @@ bm_evaluate_simple_integer (
         * Validate Data:
         * --------------
         */
-       status = bm_cast_buffer(&buffer, (void**)&element, 
-               sizeof(ACPI_OBJECT));
+       status = bm_cast_buffer(&buffer, (void**)&element,
+               sizeof(acpi_object));
        if (ACPI_FAILURE(status)) {
-               DEBUG_EVAL_ERROR(ACPI_WARN, acpi_handle, pathname, status);
+               DEBUG_EVAL_ERROR(ACPI_LV_WARN, handle, pathname, status);
                goto end;
        }
 
        if (element->type != ACPI_TYPE_INTEGER) {
                status = AE_BAD_DATA;
-               DEBUG_EVAL_ERROR(ACPI_WARN, acpi_handle, pathname, status);
+               DEBUG_EVAL_ERROR(ACPI_LV_WARN, handle, pathname, status);
                goto end;
        }
 
@@ -495,25 +500,25 @@ end:
  *
  * FUNCTION:    bm_evaluate_reference_list
  *
- * PARAMETERS:  
+ * PARAMETERS:
  *
- * RETURN:      
+ * RETURN:
  *
- * DESCRIPTION: 
+ * DESCRIPTION:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status  
 bm_evaluate_reference_list (
-       ACPI_HANDLE             acpi_handle,
-       ACPI_STRING             pathname,
+       acpi_handle             handle,
+       acpi_string             pathname,
        BM_HANDLE_LIST          *reference_list)
 {
-       ACPI_STATUS             status = AE_OK;
-       ACPI_OBJECT             *package = NULL;
-       ACPI_OBJECT             *element = NULL;
-       ACPI_HANDLE             reference_handle = NULL;
-       ACPI_BUFFER             buffer;
+       acpi_status             status = AE_OK;
+       acpi_object             *package = NULL;
+       acpi_object             *element = NULL;
+       acpi_handle             reference_handle = NULL;
+       acpi_buffer             buffer;
        u32                     i = 0;
 
        FUNCTION_TRACE("bm_evaluate_reference_list");
@@ -522,13 +527,13 @@ bm_evaluate_reference_list (
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       MEMSET(&buffer, 0, sizeof(ACPI_BUFFER));
+       MEMSET(&buffer, 0, sizeof(acpi_buffer));
 
        /*
         * Evaluate Object:
         * ----------------
         */
-       status = bm_evaluate_object(acpi_handle, pathname, NULL, &buffer);
+       status = bm_evaluate_object(handle, pathname, NULL, &buffer);
        if (ACPI_FAILURE(status)) {
                goto end;
        }
@@ -537,16 +542,16 @@ bm_evaluate_reference_list (
         * Validate Package:
         * -----------------
         */
-       status = bm_cast_buffer(&buffer, (void**)&package, 
-               sizeof(ACPI_OBJECT));
+       status = bm_cast_buffer(&buffer, (void**)&package,
+               sizeof(acpi_object));
        if (ACPI_FAILURE(status)) {
-               DEBUG_EVAL_ERROR(ACPI_WARN, acpi_handle, pathname, status);
+               DEBUG_EVAL_ERROR(ACPI_LV_WARN, handle, pathname, status);
                goto end;
        }
 
        if (package->type != ACPI_TYPE_PACKAGE) {
                status = AE_BAD_DATA;
-               DEBUG_EVAL_ERROR(ACPI_WARN, acpi_handle, pathname, status);
+               DEBUG_EVAL_ERROR(ACPI_LV_WARN, handle, pathname, status);
                goto end;
        }
 
@@ -564,37 +569,37 @@ bm_evaluate_reference_list (
 
                if (!element || (element->type != ACPI_TYPE_STRING)) {
                        status = AE_BAD_DATA;
-                       DEBUG_PRINT(ACPI_WARN, ("Invalid element in package (not a device reference).\n"));
-                       DEBUG_EVAL_ERROR(ACPI_WARN, acpi_handle, pathname, status);
+                       ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Invalid element in package (not a device reference).\n"));
+                       DEBUG_EVAL_ERROR (ACPI_LV_WARN, handle, pathname, status);
                        break;
                }
 
                /*
                 * Resolve reference string (e.g. "\_PR_.CPU_") to an
-                * ACPI_HANDLE.
+                * acpi_handle.
                 */
-               status = acpi_get_handle(acpi_handle, 
+               status = acpi_get_handle(handle,
                        element->string.pointer, &reference_handle);
                if (ACPI_FAILURE(status)) {
                        status = AE_BAD_DATA;
-                       DEBUG_PRINT(ACPI_WARN, ("Unable to resolve device reference [%s].\n", element->string.pointer));
-                       DEBUG_EVAL_ERROR(ACPI_WARN, acpi_handle, pathname, status);
+                       ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Unable to resolve device reference [%s].\n", element->string.pointer));
+                       DEBUG_EVAL_ERROR (ACPI_LV_WARN, handle, pathname, status);
                        break;
                }
 
                /*
-                * Resolve ACPI_HANDLE to BM_HANDLE.
+                * Resolve acpi_handle to BM_HANDLE.
                 */
-               status = bm_get_handle(reference_handle, 
+               status = bm_get_handle(reference_handle,
                        &(reference_list->handles[i]));
                if (ACPI_FAILURE(status)) {
                        status = AE_BAD_DATA;
-                       DEBUG_PRINT(ACPI_WARN, ("Unable to resolve device reference for [%p].\n", reference_handle));
-                       DEBUG_EVAL_ERROR(ACPI_WARN, acpi_handle, pathname, status);
+                       ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Unable to resolve device reference for [%p].\n", reference_handle));
+                       DEBUG_EVAL_ERROR (ACPI_LV_WARN, handle, pathname, status);
                        break;
                }
 
-               DEBUG_PRINT(ACPI_INFO, ("Resolved reference [%s]->[%p]->[%02x]\n", element->string.pointer, reference_handle, reference_list->handles[i]));
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Resolved reference [%s]->[%p]->[%02x]\n", element->string.pointer, reference_handle, reference_list->handles[i]));
 
                (reference_list->count)++;
        }
index 0f34861818b9a087711482a2858c92467d58b620..3bf96706e601956959dad8be4804c3efc94c6d27 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  *
  * Module Name: bn.c
- *   $Revision: 22 $
+ *   $Revision: 25 $
  *
  *****************************************************************************/
 
@@ -52,6 +52,52 @@ void
 bn_print (
        BN_CONTEXT              *button)
 {
+#ifdef ACPI_DEBUG
+       acpi_buffer             buffer;
+
+       PROC_NAME("bn_print");
+
+       if (!button) {
+               return;
+       }
+
+       buffer.length = 256;
+       buffer.pointer = acpi_os_callocate(buffer.length);
+       if (!buffer.pointer) {
+               return;
+       }
+
+       /*
+        * Get the full pathname for this ACPI object.
+        */
+       acpi_get_name(button->acpi_handle, ACPI_FULL_PATHNAME, &buffer);
+
+       /*
+        * Print out basic button information.
+        */
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
+
+       switch (button->type) {
+
+       case BN_TYPE_POWER_BUTTON:
+       case BN_TYPE_POWER_BUTTON_FIXED:
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| Power_button[%02x]:[%p] %s\n", button->device_handle, button->acpi_handle, buffer.pointer));
+               break;
+
+       case BN_TYPE_SLEEP_BUTTON:
+       case BN_TYPE_SLEEP_BUTTON_FIXED:
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| Sleep_button[%02x]:[%p] %s\n", button->device_handle, button->acpi_handle, buffer.pointer));
+               break;
+
+       case BN_TYPE_LID_SWITCH:
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| Lid_switch[%02x]:[%p] %s\n", button->device_handle, button->acpi_handle, buffer.pointer));
+               break;
+       }
+
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
+
+       acpi_os_free(buffer.pointer);
+#endif /*ACPI_DEBUG*/
 
        return;
 }
@@ -69,17 +115,22 @@ bn_print (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bn_add_device(
        BM_HANDLE               device_handle,
        void                    **context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_DEVICE               *device = NULL;
        BN_CONTEXT              *button = NULL;
 
+       FUNCTION_TRACE("bn_add_device");
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Adding button device [%02x].\n", device_handle));
+
        if (!context || *context) {
-               return(AE_BAD_PARAMETER);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid context.\n"));
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /*
@@ -87,7 +138,7 @@ bn_add_device(
         */
        status = bm_get_device_info( device_handle, &device );
        if (ACPI_FAILURE(status)) {
-               return(status);
+               return_ACPI_STATUS(status);
        }
 
        /*
@@ -95,7 +146,7 @@ bn_add_device(
         */
        button = acpi_os_callocate(sizeof(BN_CONTEXT));
        if (!button) {
-               return(AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        button->device_handle = device->handle;
@@ -169,7 +220,7 @@ end:
                acpi_os_free(button);
        }
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -185,19 +236,23 @@ end:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bn_remove_device(
        void                    **context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BN_CONTEXT              *button = NULL;
 
+       FUNCTION_TRACE("bn_remove_device");
+
        if (!context || !*context) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        button = (BN_CONTEXT*)*context;
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing button device [%02x].\n", button->device_handle));
+
        /*
         * Unregister for fixed-feature events.
         */
@@ -218,7 +273,7 @@ bn_remove_device(
 
        *context = NULL;
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -239,12 +294,14 @@ bn_remove_device(
 
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bn_initialize (void)
 {
        BM_DEVICE_ID            criteria;
        BM_DRIVER               driver;
 
+       FUNCTION_TRACE("bn_initialize");
+
        MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
        MEMSET(&driver, 0, sizeof(BM_DRIVER));
 
@@ -269,7 +326,7 @@ bn_initialize (void)
        MEMCPY(criteria.hid, BN_HID_LID_SWITCH, sizeof(BN_HID_LID_SWITCH));
        bm_register_driver(&criteria, &driver);
 
-       return(AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
 
@@ -285,13 +342,15 @@ bn_initialize (void)
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bn_terminate (void)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_DEVICE_ID            criteria;
        BM_DRIVER               driver;
 
+       FUNCTION_TRACE("bn_terminate");
+
        MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
        MEMSET(&driver, 0, sizeof(BM_DRIVER));
 
@@ -316,7 +375,7 @@ bn_terminate (void)
        MEMCPY(criteria.hid, BN_HID_LID_SWITCH, sizeof(BN_HID_LID_SWITCH));
        status = bm_unregister_driver(&criteria, &driver);
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -332,20 +391,24 @@ bn_terminate (void)
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bn_notify_fixed (
        void                    *context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+       FUNCTION_TRACE("bn_notify_fixed");
 
        if (!context) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Status change event detected.\n"));
+
        status = bn_osl_generate_event(BN_NOTIFY_STATUS_CHANGE,
                ((BN_CONTEXT*)context));
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -361,16 +424,18 @@ bn_notify_fixed (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bn_notify (
        BM_NOTIFY               notify_type,
        BM_HANDLE               device_handle,
        void                    **context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+       FUNCTION_TRACE("bn_notify");
 
        if (!context) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        switch (notify_type) {
@@ -383,6 +448,7 @@ bn_notify (
                break;
                
        case BN_NOTIFY_STATUS_CHANGE:
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Status change event detected.\n"));
                status = bn_osl_generate_event(BN_NOTIFY_STATUS_CHANGE,
                        ((BN_CONTEXT*)*context));
                break;
@@ -392,7 +458,7 @@ bn_notify (
                break;
        }
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -408,18 +474,20 @@ bn_notify (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bn_request (
        BM_REQUEST              *request,
        void                    *context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+       FUNCTION_TRACE("bn_request");
 
        /*
         * Must have a valid request structure and context.
         */
        if (!request || !context) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /*
@@ -435,5 +503,5 @@ bn_request (
 
        request->status = status;
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
index d7eab2a05a54b7fb9c8c8a525d234f55439cbba8..0328875b9c39bdf43b5926fc814e4bda36226b77 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: bn_osl.c
- *   $Revision: 10 $
+ *   $Revision: 14 $
  *
  *****************************************************************************/
 
@@ -53,11 +53,11 @@ static struct proc_dir_entry        *bn_proc_root = NULL;
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bn_osl_add_device(
        BN_CONTEXT              *button)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
 
        if (!button) {
                return(AE_BAD_PARAMETER);
@@ -99,7 +99,7 @@ bn_osl_add_device(
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bn_osl_remove_device (
        BN_CONTEXT              *button)
 {
@@ -134,12 +134,12 @@ bn_osl_remove_device (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bn_osl_generate_event (
        u32                     event,
        BN_CONTEXT              *button)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
 
        if (!button) {
                return(AE_BAD_PARAMETER);
@@ -196,10 +196,14 @@ bn_osl_generate_event (
  *
  ****************************************************************************/
 
-static int __init 
+static int __init
 bn_osl_init (void)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+       /* abort if no busmgr */
+       if (!bm_proc_root)
+               return -ENODEV;
 
        bn_proc_root = proc_mkdir(BN_PROC_ROOT, bm_proc_root);
        if (!bn_proc_root) {
@@ -228,7 +232,7 @@ bn_osl_init (void)
  *
  ****************************************************************************/
 
-static void __exit 
+static void __exit
 bn_osl_cleanup (void)
 {
        bn_terminate();
index c71d52ddb819cbb1abd39a4eab44f6ab027dc82b..17e475e6e6f553dc0dedfd9b25e2a9636a35b0ec 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  *
  * Module Name: ec_osl.c
- *   $Revision: 6 $
+ *   $Revision: 10 $
  *
  *****************************************************************************/
 
@@ -56,6 +56,8 @@ static u32                    save_dbg_layer;
 static u32                     save_dbg_level;
 #endif /*ACPI_DEBUG*/
 
+extern struct proc_dir_entry   *bm_proc_root;
+
 
 /****************************************************************************
  *
@@ -69,10 +71,14 @@ static u32                  save_dbg_level;
  *
  ****************************************************************************/
 
-static int __init 
+static int __init
 ec_osl_init (void)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+       /* abort if no busmgr */
+       if (!bm_proc_root)
+               return -ENODEV;
 
 #ifdef ACPI_DEBUG
        save_dbg_layer = acpi_dbg_layer;
@@ -99,7 +105,7 @@ ec_osl_init (void)
  *
  ****************************************************************************/
 
-static void __exit 
+static void __exit
 ec_osl_cleanup(void)
 {
        ec_terminate();
index 998b5f34a3e2bb7bc70e24ef9b53a673f756c5ac..451dafd9b806905d614241071c93ff5c1646d667 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  *
  * Module Name: ecgpe.c
- *   $Revision: 26 $
+ *   $Revision: 28 $
  *
  *****************************************************************************/
 
@@ -52,8 +52,11 @@ ec_query_handler (
        const char              hex[] = {'0','1','2','3','4','5','6','7','8',
                                        '9','A','B','C','D','E','F'};
 
+       FUNCTION_TRACE("ec_query_handler");
+
        if (!ec) {
-               return;
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid (NULL) context.\n"));
+               return_VOID;
        }
 
        /*
@@ -65,9 +68,11 @@ ec_query_handler (
        object_name[2] = hex[((ec->query_data >> 4) & 0x0F)];
        object_name[3] = hex[(ec->query_data & 0x0F)];
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Evaluating [%s] for ec [%02x].\n", object_name, ec->device_handle));
+
        bm_evaluate_object(ec->acpi_handle, object_name, NULL, NULL);
 
-       return;
+       return_VOID;
 }
 
 
@@ -87,12 +92,15 @@ void
 ec_gpe_handler (
        void                    *context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        EC_CONTEXT              *ec = (EC_CONTEXT*)context;
        EC_STATUS               ec_status = 0;
 
+       FUNCTION_TRACE("ec_gpe_handler");
+
        if (!ec) {
-               return;
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid (NULL) context.\n"));
+               return_VOID;
        }
 
        /* TBD: synchronize w/ transaction (ectransx). */
@@ -103,11 +111,13 @@ ec_gpe_handler (
         * Check the EC_SCI bit to see if this is an EC_SCI event.  If not (e.g.
         * OBF/IBE) just return, as we already poll to detect these events.
         */
-       ec_status = acpi_os_in8(ec->status_port);
+       acpi_os_read_port(ec->status_port, &ec_status, 8);
        if (!(ec_status & EC_FLAG_SCI)) {
-               return;
+               return_VOID;
        }
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "EC_SCI event detected on ec [%02x] - running query.\n", ec->device_handle));
+
        /*
         * Run Query:
         * ----------
@@ -118,13 +128,15 @@ ec_gpe_handler (
        status = ec_io_write(ec, ec->command_port, EC_COMMAND_QUERY,
                EC_EVENT_OUTPUT_BUFFER_FULL);
        if (ACPI_FAILURE(status)) {
-               return;
+               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Unable to send 'query command' to EC.\n"));
+               return_VOID;
        }
 
        status = ec_io_read(ec, ec->data_port, &(ec->query_data),
                EC_EVENT_NONE);
        if (ACPI_FAILURE(status)) {
-               return;
+               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Error reading query data.\n"));
+               return_VOID;
        }
 
        /* TBD: un-synchronize w/ transaction (ectransx). */
@@ -134,7 +146,8 @@ ec_gpe_handler (
         * ----------------
         */
        if (!ec->query_data) {
-               return;
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Spurious EC SCI detected.\n"));
+               return_VOID;
        }
 
        /*
@@ -145,10 +158,11 @@ ec_gpe_handler (
        status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE,
                ec_query_handler, ec);
        if (ACPI_FAILURE(status)) {
-               return;
+               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Unable to defer _Qxx method evaluation.\n"));
+               return_VOID;
        }
 
-       return;
+       return_VOID;
 }
 
 
@@ -164,14 +178,16 @@ ec_gpe_handler (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 ec_install_gpe_handler (
        EC_CONTEXT              *ec)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+       FUNCTION_TRACE("ec_install_gpe_handler");
 
        if (!ec) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /*
@@ -183,7 +199,7 @@ ec_install_gpe_handler (
        status = bm_evaluate_simple_integer(ec->acpi_handle,
                "_GPE", &(ec->gpe_bit));
        if (ACPI_FAILURE(status)) {
-               return(status);
+               return_ACPI_STATUS(status);
        }
 
        /*
@@ -194,11 +210,12 @@ ec_install_gpe_handler (
        status = acpi_install_gpe_handler(ec->gpe_bit, ACPI_EVENT_EDGE_TRIGGERED,
                &ec_gpe_handler, ec);
        if (ACPI_FAILURE(status)) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "acpi_install_gpe_handler() failed for GPE bit [%02x] with status [%08x].\n", ec->gpe_bit, status));
                ec->gpe_bit = EC_GPE_UNKNOWN;
-               return(status);
+               return_ACPI_STATUS(status);
        }
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -214,17 +231,19 @@ ec_install_gpe_handler (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 ec_remove_gpe_handler (
        EC_CONTEXT              *ec)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+       FUNCTION_TRACE("ec_remove_gpe_handler");
 
        if (!ec) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        status = acpi_remove_gpe_handler(ec->gpe_bit, &ec_gpe_handler);
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
index 720e140df915712b820b6a6ba46353ac1ad65785..2b9aaf6176208c282595e7e20ae9eff209c4872b 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  *
  * Module Name: ecmain.c
- *   $Revision: 26 $
+ *   $Revision: 28 $
  *
  *****************************************************************************/
 
@@ -51,6 +51,11 @@ void
 ec_print (
        EC_CONTEXT              *ec)
 {
+#ifdef ACPI_DEBUG
+       acpi_buffer             buffer;
+#endif /*ACPI_DEBUG*/
+
+       PROC_NAME("ec_print");
 
        if (!ec) {
                return;
@@ -58,6 +63,28 @@ ec_print (
 
        acpi_os_printf("EC: found, GPE %d\n", ec->gpe_bit);
 
+#ifdef ACPI_DEBUG
+       buffer.length = 256;
+       buffer.pointer = acpi_os_callocate(buffer.length);
+       if (!buffer.pointer) {
+               return;
+       }
+
+       /*
+        * Get the full pathname for this ACPI object.
+        */
+       acpi_get_name(ec->acpi_handle, ACPI_FULL_PATHNAME, &buffer);
+
+       /*
+        * Print out basic thermal zone information.
+        */
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| Embedded_controller[%02x]:[%p] %s\n", ec->device_handle, ec->acpi_handle, buffer.pointer));
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "|   gpe_bit[%02x] status/command_port[%02x] data_port[%02x]\n", ec->gpe_bit, ec->status_port, ec->data_port));
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
+
+       acpi_os_free(buffer.pointer);
+#endif /*ACPI_DEBUG*/
 
        return;
 }
@@ -76,16 +103,18 @@ ec_print (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 ec_get_port_values(
        EC_CONTEXT              *ec)
 {
-       ACPI_STATUS             status = AE_OK;
-       ACPI_BUFFER             buffer;
-       ACPI_RESOURCE           *resource = NULL;
+       acpi_status             status = AE_OK;
+       acpi_buffer             buffer;
+       acpi_resource           *resource = NULL;
+
+       FUNCTION_TRACE("ec_get_port_values");
 
        if (!ec) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        buffer.length = 0;
@@ -93,12 +122,12 @@ ec_get_port_values(
 
        status = acpi_get_current_resources(ec->acpi_handle, &buffer);
        if (status != AE_BUFFER_OVERFLOW) {
-               return(status);
+               return_ACPI_STATUS(status);
        }
 
        buffer.pointer = acpi_os_callocate(buffer.length);
        if (!buffer.pointer) {
-               return(AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        status = acpi_get_current_resources(ec->acpi_handle, &buffer);
@@ -106,7 +135,7 @@ ec_get_port_values(
                goto end;
        }
 
-       resource = (ACPI_RESOURCE *) buffer.pointer;
+       resource = (acpi_resource *) buffer.pointer;
        ec->data_port = resource->data.io.min_base_address;
 
        resource = NEXT_RESOURCE(resource);
@@ -116,7 +145,7 @@ ec_get_port_values(
 end:
        acpi_os_free(buffer.pointer);
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -132,19 +161,23 @@ end:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 ec_add_device(
        BM_HANDLE               device_handle,
        void                    **context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_DEVICE               *device = NULL;
        EC_CONTEXT              *ec = NULL;
        u8                      gpe_handler = FALSE;
        u8                      space_handler = FALSE;
 
+       FUNCTION_TRACE("ec_add_device");
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Adding EC device [%02x].\n", device_handle));
+
        if (!context || *context) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /*
@@ -152,7 +185,7 @@ ec_add_device(
         */
        status = bm_get_device_info(device_handle, &device);
        if (ACPI_FAILURE(status)) {
-               return(status);
+               return_ACPI_STATUS(status);
        }
 
        /*
@@ -160,7 +193,7 @@ ec_add_device(
         */
        ec = acpi_os_callocate(sizeof(EC_CONTEXT));
        if (!ec) {
-               return(AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        ec->device_handle = device->handle;
@@ -183,6 +216,7 @@ ec_add_device(
                ec->use_global_lock = 0;
        }
        else if (ACPI_FAILURE(status)) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "EC _GLK failed\n"));
                goto end;
        }
 
@@ -243,7 +277,7 @@ end:
                acpi_os_free(ec);
        }
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -259,19 +293,23 @@ end:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 ec_remove_device(
        void                    **context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        EC_CONTEXT              *ec = NULL;
 
+       FUNCTION_TRACE("ec_remove_device");
+
        if (!context || !*context) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        ec = (EC_CONTEXT*)*context;
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing EC device [%02x].\n", ec->device_handle));
+
        ec_remove_space_handler(ec);
 
        ec_remove_gpe_handler(ec);
@@ -284,7 +322,7 @@ ec_remove_device(
 
        *context = NULL;
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -304,13 +342,15 @@ ec_remove_device(
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 ec_initialize (void)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_DEVICE_ID            criteria;
        BM_DRIVER               driver;
 
+       FUNCTION_TRACE("ec_initialize");
+
        MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
        MEMSET(&driver, 0, sizeof(BM_DRIVER));
 
@@ -324,7 +364,7 @@ ec_initialize (void)
 
        status = bm_register_driver(&criteria, &driver);
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -340,13 +380,15 @@ ec_initialize (void)
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 ec_terminate(void)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_DEVICE_ID            criteria;
        BM_DRIVER               driver;
 
+       FUNCTION_TRACE("ec_terminate");
+
        MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
        MEMSET(&driver, 0, sizeof(BM_DRIVER));
 
@@ -360,7 +402,7 @@ ec_terminate(void)
 
        status = bm_unregister_driver(&criteria, &driver);
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -376,13 +418,15 @@ ec_terminate(void)
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 ec_notify (
        BM_NOTIFY               notify,
        BM_HANDLE               device_handle,
        void                    **context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+       FUNCTION_TRACE("ec_notify");
 
        switch (notify) {
 
@@ -399,7 +443,7 @@ ec_notify (
                break;
        }
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -415,20 +459,22 @@ ec_notify (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 ec_request (
        BM_REQUEST              *request,
        void                    *context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        EC_REQUEST              *ec_request = NULL;
        EC_CONTEXT              *ec = NULL;
 
+       FUNCTION_TRACE("ec_request");
+
        /*
         * Must have a valid request structure and context.
         */
        if (!request || !context)
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
 
        /*
         * buffer must contain a valid EC_REQUEST structure.
@@ -436,7 +482,7 @@ ec_request (
        status = bm_cast_buffer(&(request->buffer), (void**)&ec_request,
                sizeof(EC_REQUEST));
        if (ACPI_FAILURE(status))
-               return(status);
+               return_ACPI_STATUS(status);
 
        /*
         * context contains information specific to this EC.
@@ -448,5 +494,5 @@ ec_request (
         */
        status = ec_transaction(ec, ec_request);
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
index fec9d02ecece9ff4ea517269a3e202e2a01c1673..fa8a741f11246f4af7bfdee1bb03c9cd5eeceffa 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  *
  * Module Name: ecspace.c
- *   $Revision: 20 $
+ *   $Revision: 22 $
  *
  *****************************************************************************/
 
@@ -43,9 +43,9 @@
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 ec_space_setup (
-       ACPI_HANDLE             region_handle,
+       acpi_handle             region_handle,
        u32                     function,
        void                    *handler_context,
        void                    **return_context)
@@ -66,7 +66,7 @@ ec_space_setup (
  *
  * PARAMETERS:  function            - Read or Write operation
  *              address             - Where in the space to read or write
- *              bit_width           - Field width in bits (8, 16, or 32)
+ *              bit_width           - Field width in bits (should be 8)
  *              value               - Pointer to in or out value
  *              context             - context pointer
  *
@@ -77,7 +77,7 @@ ec_space_setup (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 ec_space_handler (
        u32                     function,
        ACPI_PHYSICAL_ADDRESS   address,
@@ -86,12 +86,14 @@ ec_space_handler (
        void                    *handler_context,
        void                    *region_context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        EC_CONTEXT              *ec = NULL;
        EC_REQUEST              ec_request;
 
+       FUNCTION_TRACE("ec_space_handler");
+
        if (address > 0xFF || bit_width != 8 || !value || !handler_context) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        ec = (EC_CONTEXT*)handler_context;
@@ -111,7 +113,8 @@ ec_space_handler (
                break;
 
        default:
-               return(AE_BAD_PARAMETER);
+               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Received request with invalid function [%p].\n", function));
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
                break;
        }
 
@@ -123,7 +126,7 @@ ec_space_handler (
                (*value) = (u32)ec_request.data;
        }
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -139,20 +142,22 @@ ec_space_handler (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 ec_install_space_handler (
        EC_CONTEXT              *ec)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+       FUNCTION_TRACE("ec_install_space_handler");
 
        if (!ec) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        status = acpi_install_address_space_handler (ec->acpi_handle,
                ACPI_ADR_SPACE_EC, &ec_space_handler, &ec_space_setup, ec);
        
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -168,18 +173,20 @@ ec_install_space_handler (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 ec_remove_space_handler (
        EC_CONTEXT              *ec)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+       FUNCTION_TRACE("ec_remove_space_handler");
 
        if (!ec) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        status = acpi_remove_address_space_handler(ec->acpi_handle,
                ACPI_ADR_SPACE_EC, &ec_space_handler);
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
index 7f74428c23812a35257ffc7e00f10d77ab8858b8..6968ece2f30714d164d6ebca60603dc8d4bd35a4 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  *
  * Module Name: ectransx.c
- *   $Revision: 21 $
+ *   $Revision: 24 $
  *
  *****************************************************************************/
 
@@ -43,7 +43,7 @@
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 ec_io_wait (
        EC_CONTEXT              *ec,
        EC_EVENT                wait_event)
@@ -66,21 +66,21 @@ ec_io_wait (
 
        case EC_EVENT_OUTPUT_BUFFER_FULL:
                do {
-                       ec_status = acpi_os_in8(ec->status_port);
+                       acpi_os_read_port(ec->status_port, &ec_status, 8);
                        if (ec_status & EC_FLAG_OUTPUT_BUFFER) {
                                return(AE_OK);
                        }
-                       acpi_os_sleep_usec(10);
+                       acpi_os_stall(10);
                } while (--i>0);
                break;
 
        case EC_EVENT_INPUT_BUFFER_EMPTY:
                do {
-                       ec_status = acpi_os_in8(ec->status_port);
+                       acpi_os_read_port(ec->status_port, &ec_status, 8);
                        if (!(ec_status & EC_FLAG_INPUT_BUFFER)) {
                                return(AE_OK);
                        }
-                       acpi_os_sleep_usec(10);
+                       acpi_os_stall(10);
                } while (--i>0);
                break;
        }
@@ -101,20 +101,20 @@ ec_io_wait (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 ec_io_read (
        EC_CONTEXT              *ec,
        ACPI_IO_ADDRESS         io_port,
        u8                      *data,
        EC_EVENT                wait_event)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
 
        if (!ec || !data) {
                return(AE_BAD_PARAMETER);
        }
 
-       *data = acpi_os_in8(io_port);
+       acpi_os_read_port(io_port, (u32*) data, 8);
 
        if (wait_event) {
                status = ec_io_wait(ec, wait_event);
@@ -136,20 +136,20 @@ ec_io_read (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 ec_io_write (
        EC_CONTEXT              *ec,
        ACPI_IO_ADDRESS         io_port,
        u8                      data,
        EC_EVENT                wait_event)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
 
        if (!ec) {
                return(AE_BAD_PARAMETER);
        }
 
-       acpi_os_out8(io_port, data);
+       acpi_os_write_port(io_port, data, 8);
 
        if (wait_event) {
                status = ec_io_wait(ec, wait_event);
@@ -171,35 +171,40 @@ ec_io_write (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 ec_read (
        EC_CONTEXT              *ec,
        u8                      address,
        u8                      *data)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+       FUNCTION_TRACE("ec_read");
 
        if (!ec || !data) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        if (ec->use_global_lock) {
                status = acpi_acquire_global_lock();
                if (ACPI_FAILURE(status)) {
-                       return(status);
+                       ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Could not acquire Global Lock\n"));
+                       return_ACPI_STATUS(status);
                }
        }
 
        status = ec_io_write(ec, ec->command_port, EC_COMMAND_READ,
                EC_EVENT_INPUT_BUFFER_EMPTY);
        if (ACPI_FAILURE(status)) {
-               return(status);
+               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Unable to send 'read command' to EC.\n"));
+               return_ACPI_STATUS(status);
        }
 
        status = ec_io_write(ec, ec->data_port, address,
                EC_EVENT_OUTPUT_BUFFER_FULL);
        if (ACPI_FAILURE(status)) {
-               return(status);
+               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Unable to send 'read address' to EC.\n"));
+               return_ACPI_STATUS(status);
        }
 
        status = ec_io_read(ec, ec->data_port, data, EC_EVENT_NONE);
@@ -208,7 +213,9 @@ ec_read (
                acpi_release_global_lock();
        }
 
-       return(status);
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Read data [%02x] from address [%02x] on ec [%02x].\n", (*data), address, ec->device_handle));
+
+       return_ACPI_STATUS(status);
 }
 
 
@@ -224,47 +231,55 @@ ec_read (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 ec_write (
        EC_CONTEXT              *ec,
        u8                      address,
        u8                      data)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+       FUNCTION_TRACE("ec_write");
 
        if (!ec)
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
 
        if (ec->use_global_lock) {
                status = acpi_acquire_global_lock();
                if (ACPI_FAILURE(status)) {
-                       return(status);
+                       ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Could not acquire Global Lock\n"));
+                       return_ACPI_STATUS(status);
                }
        }
 
        status = ec_io_write(ec, ec->command_port, EC_COMMAND_WRITE,
                EC_EVENT_INPUT_BUFFER_EMPTY);
        if (ACPI_FAILURE(status)) {
-               return(status);
+               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Unable to send 'write command' to EC.\n"));
+               return_ACPI_STATUS(status);
        }
 
        status = ec_io_write(ec, ec->data_port, address,
                EC_EVENT_INPUT_BUFFER_EMPTY);
        if (ACPI_FAILURE(status)) {
-               return(status);
+               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Unable to send 'write address' to EC.\n"));
+               return_ACPI_STATUS(status);
        }
 
        status = ec_io_write(ec, ec->data_port, data,
                EC_EVENT_INPUT_BUFFER_EMPTY);
        if (ACPI_FAILURE(status)) {
-               return(status);
+               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Unable to send 'write data' to EC.\n"));
+               return_ACPI_STATUS(status);
        }
 
        if (ec->use_global_lock) {
                acpi_release_global_lock();
        }
 
-       return(status);
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Wrote data [%02x] to address [%02x] on ec [%02x].\n", data, address, ec->device_handle));
+
+       return_ACPI_STATUS(status);
 }
 
 
@@ -280,15 +295,17 @@ ec_write (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 ec_transaction (
        EC_CONTEXT              *ec,
        EC_REQUEST              *request)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+       FUNCTION_TRACE("ec_transaction");
 
        if (!ec || !request) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /*
@@ -296,7 +313,7 @@ ec_transaction (
         */
        status = acpi_os_wait_semaphore(ec->mutex, 1, EC_DEFAULT_TIMEOUT);
        if (ACPI_FAILURE(status)) {
-               return(status);
+               return_ACPI_STATUS(status);
        }
 
        /*
@@ -322,5 +339,5 @@ ec_transaction (
         */
        acpi_os_signal_semaphore(ec->mutex, 1);
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
index f9b1681288884893635b9ef99d8ba8643d2f2831..5bbbf01a729799c2432d635641f2b36a1f44d789 100644 (file)
@@ -56,7 +56,7 @@
 typedef struct
 {
        BM_HANDLE               device_handle;
-       ACPI_HANDLE             acpi_handle;
+       acpi_handle             acpi_handle;
        char                    uid[9];
        u32                     is_online;
 } AC_CONTEXT;
@@ -66,34 +66,34 @@ typedef struct
  *                              Function Prototypes
  *****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 ac_initialize (void);
 
-ACPI_STATUS
+acpi_status
 ac_terminate (void);
 
-ACPI_STATUS
+acpi_status
 ac_notify (
        u32                     notify_type,
        u32                     device,
        void                    **context);
 
-ACPI_STATUS
+acpi_status
 ac_request(
        BM_REQUEST              *request_info,
        void                    *context);
 
 /* AC Adapter Driver OSL */
 
-ACPI_STATUS
+acpi_status
 ac_osl_add_device (
        AC_CONTEXT              *ac_adapter);
 
-ACPI_STATUS
+acpi_status
 ac_osl_remove_device (
        AC_CONTEXT              *ac_adapter);
 
-ACPI_STATUS
+acpi_status
 ac_osl_generate_event (
        u32                     event,
        AC_CONTEXT              *ac_adapter);
index 27417cf8e895592af5d9126e9e4edcc4bdc84af2..def59aa26a32448c8fb8c42313b6846f14ffac8e 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  *
  * Module name: bm.h
- *   $Revision: 39 $
+ *   $Revision: 41 $
  *
  *****************************************************************************/
 
@@ -80,7 +80,7 @@ typedef u32                   BM_NOTIFY;
 
 /*
  * These are a higher-level abstraction of ACPI notifications, intended
- * for consumption by driver modules to facilitate PnP.
+ * for consumption by driver modules to facilitate Pn_p.
  */
 #define BM_NOTIFY_UNKNOWN      ((BM_NOTIFY) 0x00)
 #define BM_NOTIFY_DEVICE_ADDED ((BM_NOTIFY) 0x01)
@@ -98,7 +98,6 @@ typedef u32                   BM_HANDLE;
 #define BM_HANDLES_MAX         100
 
 
-
 /*
  * BM_HANDLE_LIST:
  * ---------------
@@ -301,7 +300,7 @@ typedef struct
 typedef struct
 {
        BM_HANDLE               handle;
-       ACPI_HANDLE             acpi_handle;
+       acpi_handle             acpi_handle;
        BM_DEVICE_FLAGS         flags;
        BM_DEVICE_STATUS        status;
        BM_DEVICE_ID            id;
@@ -328,10 +327,10 @@ typedef struct
  */
 typedef struct
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
        BM_COMMAND              command;
        BM_HANDLE               handle;
-       ACPI_BUFFER             buffer;
+       acpi_buffer             buffer;
 } BM_REQUEST;
 
 
@@ -345,14 +344,14 @@ typedef void *                    BM_DRIVER_CONTEXT;
 
 /* Notification Callback Function */
 typedef
-ACPI_STATUS (*BM_DRIVER_NOTIFY) (
+acpi_status (*BM_DRIVER_NOTIFY) (
        BM_NOTIFY               notify_type,
        BM_HANDLE               device_handle,
        BM_DRIVER_CONTEXT       *context);
 
 /* Request Callback Function */
 typedef
-ACPI_STATUS (*BM_DRIVER_REQUEST) (
+acpi_status (*BM_DRIVER_REQUEST) (
        BM_REQUEST              *request,
        BM_DRIVER_CONTEXT       context);
 
@@ -428,30 +427,30 @@ typedef struct
 
 /* bm.c */
 
-ACPI_STATUS
+acpi_status
 bm_initialize (void);
 
-ACPI_STATUS
+acpi_status
 bm_terminate (void);
 
-ACPI_STATUS
+acpi_status
 bm_get_status (
        BM_DEVICE               *device);
 
-ACPI_STATUS
+acpi_status
 bm_get_handle (
-       ACPI_HANDLE             acpi_handle,
+       acpi_handle             acpi_handle,
        BM_HANDLE               *device_handle);
 
-ACPI_STATUS
+acpi_status
 bm_get_node (
        BM_HANDLE               device_handle,
-       ACPI_HANDLE             acpi_handle,
+       acpi_handle             acpi_handle,
        BM_NODE                 **node);
 
 /* bmsearch.c */
 
-ACPI_STATUS
+acpi_status
 bm_search(
        BM_HANDLE               device_handle,
        BM_DEVICE_ID            *criteria,
@@ -461,118 +460,118 @@ bm_search(
 
 void
 bm_notify (
-       ACPI_HANDLE             acpi_handle,
+       acpi_handle             acpi_handle,
        u32                     notify_value,
        void                    *context);
 
 /* bm_request.c */
 
-ACPI_STATUS
+acpi_status
 bm_request (
        BM_REQUEST              *request_info);
 
 /* bmdriver.c */
 
-ACPI_STATUS
+acpi_status
 bm_get_device_power_state (
        BM_HANDLE               device_handle,
        BM_POWER_STATE          *state);
 
-ACPI_STATUS
+acpi_status
 bm_set_device_power_state (
        BM_HANDLE               device_handle,
        BM_POWER_STATE          state);
 
-ACPI_STATUS
+acpi_status
 bm_get_device_status (
        BM_HANDLE               device_handle,
        BM_DEVICE_STATUS        *device_status);
 
-ACPI_STATUS
+acpi_status
 bm_get_device_info (
        BM_HANDLE               device_handle,
        BM_DEVICE               **device_info);
 
-ACPI_STATUS
+acpi_status
 bm_get_device_context (
        BM_HANDLE               device_handle,
        BM_DRIVER_CONTEXT       *context);
 
-ACPI_STATUS
+acpi_status
 bm_register_driver (
        BM_DEVICE_ID            *criteria,
        BM_DRIVER               *driver);
 
-ACPI_STATUS
+acpi_status
 bm_unregister_driver (
        BM_DEVICE_ID            *criteria,
        BM_DRIVER               *driver);
 
 /* bmpm.c */
 
-ACPI_STATUS
+acpi_status
 bm_get_pm_capabilities (
        BM_NODE                 *node);
 
-ACPI_STATUS
+acpi_status
 bm_get_power_state (
        BM_NODE                 *node);
 
-ACPI_STATUS
+acpi_status
 bm_set_power_state (
        BM_NODE                 *node,
        BM_POWER_STATE          target_state);
 
 /* bmpower.c */
 
-ACPI_STATUS
+acpi_status
 bm_pr_initialize (void);
 
-ACPI_STATUS
+acpi_status
 bm_pr_terminate (void);
        
 /* bmutils.c */
 
-ACPI_STATUS
+acpi_status
 bm_cast_buffer (
-       ACPI_BUFFER             *buffer,
+       acpi_buffer             *buffer,
        void                    **pointer,
        u32                     length);
 
-ACPI_STATUS
+acpi_status
 bm_copy_to_buffer (
-       ACPI_BUFFER             *buffer,
+       acpi_buffer             *buffer,
        void                    *data,
        u32                     length);
 
-ACPI_STATUS
+acpi_status
 bm_extract_package_data (
-       ACPI_OBJECT             *package,
-       ACPI_BUFFER             *format,
-       ACPI_BUFFER             *buffer);
+       acpi_object             *package,
+       acpi_buffer             *format,
+       acpi_buffer             *buffer);
 
-ACPI_STATUS
+acpi_status
 bm_evaluate_object (
-       ACPI_HANDLE             acpi_handle,
-       ACPI_STRING             pathname,
-       ACPI_OBJECT_LIST        *arguments,
-       ACPI_BUFFER             *buffer);
+       acpi_handle             acpi_handle,
+       acpi_string             pathname,
+       acpi_object_list        *arguments,
+       acpi_buffer             *buffer);
 
-ACPI_STATUS
+acpi_status
 bm_evaluate_simple_integer (
-       ACPI_HANDLE             acpi_handle,
-       ACPI_STRING             pathname,
+       acpi_handle             acpi_handle,
+       acpi_string             pathname,
        u32                     *data);
 
-ACPI_STATUS
+acpi_status
 bm_evaluate_reference_list (
-       ACPI_HANDLE             acpi_handle,
-       ACPI_STRING             pathname,
+       acpi_handle             acpi_handle,
+       acpi_string             pathname,
        BM_HANDLE_LIST          *reference_list);
 
 /* ACPI Bus Driver OSL */
 
-ACPI_STATUS
+acpi_status
 bm_osl_generate_event (
        BM_HANDLE               device_handle,
        char                    *device_type,
index c61524d4d8a8d7ad44649e54aec43190eeb9337b..993477682b0435d3b470ac8d0a37fc743f103716 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  *
  * Module name: bmpower.h
- *   $Revision: 1 $
+ *   $Revision: 9 $
  *
  *****************************************************************************/
 
@@ -41,7 +41,7 @@
 typedef struct
 {
        BM_HANDLE           device_handle;
-       ACPI_HANDLE         acpi_handle;
+       acpi_handle         acpi_handle;
        BM_POWER_STATE      system_level;
        u32                 resource_order;
        BM_POWER_STATE      state;
@@ -55,18 +55,18 @@ typedef struct
 
 /* bmpower.c */
 
-ACPI_STATUS
+acpi_status
 bm_pr_initialize (void);
 
-ACPI_STATUS
+acpi_status
 bm_pr_terminate (void);
 
-ACPI_STATUS
+acpi_status
 bm_pr_list_get_state (
        BM_HANDLE_LIST          *resource_list,
        BM_POWER_STATE          *power_state);
 
-ACPI_STATUS
+acpi_status
 bm_pr_list_transition (
        BM_HANDLE_LIST          *current_list,
        BM_HANDLE_LIST          *target_list);
index aaaf6cd7c3bdcb6b173240425508e7148d22bf4c..b2831af8f11545aece9b7eb56a37ec4fa64ac1e7 100644 (file)
@@ -73,7 +73,7 @@
 typedef struct
 {
        BM_HANDLE               device_handle;
-       ACPI_HANDLE             acpi_handle;
+       acpi_handle             acpi_handle;
        u32                     type;
 } BN_CONTEXT;
 
@@ -82,38 +82,38 @@ typedef struct
  *                              Function Prototypes
  *****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 bn_initialize (void);
 
-ACPI_STATUS
+acpi_status
 bn_terminate (void);
 
-ACPI_STATUS
+acpi_status
 bn_notify_fixed (
        void                    *context);
 
-ACPI_STATUS
+acpi_status
 bn_notify (
        u32                     notify_type,
        u32                     device,
        void                    **context);
 
-ACPI_STATUS
+acpi_status
 bn_request(
        BM_REQUEST              *request_info,
        void                    *context);
 
 /* Button OSL */
 
-ACPI_STATUS
+acpi_status
 bn_osl_add_device (
        BN_CONTEXT              *button);
 
-ACPI_STATUS
+acpi_status
 bn_osl_remove_device (
        BN_CONTEXT              *button);
 
-ACPI_STATUS
+acpi_status
 bn_osl_generate_event (
        u32                     event,
        BN_CONTEXT              *button);
index 8ed7fca9d89f0f814f64122a733fea0eccb2a276..19cee5ae96f09f2fc9f21f571b492d40b64cbdb4 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: bt.h
- *   $Revision: 13 $
+ *   $Revision: 16 $
  *
  *****************************************************************************/
 
 
 
 /*****************************************************************************
- *                            Types & Other Defines
+ *                Types & Other Defines
  *****************************************************************************/
 
 /*! [Begin] no source code translation */
 
 #define BT_UNKNOWN             0xFFFFFFFF
-#define BT_POWER_UNITS_DEFAULT "?"
-#define BT_POWER_UNITS_WATTS   "mW"
+#define BT_POWER_UNITS_DEFAULT  "?"
+#define BT_POWER_UNITS_WATTS    "mW"
 #define BT_POWER_UNITS_AMPS    "mA"
 
-/*! [End] no source code translation */
+/*! [End] no source code translation !*/
 
 /*
  * Battery Notifications:
@@ -57,7 +57,7 @@
  * Hardware IDs:
  * -------------
  */
-#define BT_HID_CM_BATTERY      "PNP0C0A"
+#define BT_HID_CM_BATTERY   "PNP0C0A"
 
 
 /*
  */
 typedef struct
 {
-       u32                     power_unit;
-       u32                     design_capacity;
-       u32                     last_full_capacity;
-       u32                     battery_technology;
-       u32                     design_voltage;
-       u32                     design_capacity_warning;
-       u32                     design_capacity_low;
-       u32                     battery_capacity_granularity_1;
-       u32                     battery_capacity_granularity_2;
-       ACPI_STRING             model_number;
-       ACPI_STRING             serial_number;
-       ACPI_STRING             battery_type;
-       ACPI_STRING             oem_info;
+       u32             power_unit;
+       u32             design_capacity;
+       u32             last_full_capacity;
+       u32             battery_technology;
+       u32             design_voltage;
+       u32             design_capacity_warning;
+       u32             design_capacity_low;
+       u32             battery_capacity_granularity_1;
+       u32             battery_capacity_granularity_2;
+       acpi_string     model_number;
+       acpi_string     serial_number;
+       acpi_string     battery_type;
+       acpi_string     oem_info;
+
 } BT_BATTERY_INFO;
 
 
@@ -88,10 +89,11 @@ typedef struct
  */
 typedef struct
 {
-       u32                     state;
-       u32                     present_rate;
-       u32                     remaining_capacity;
-       u32                     present_voltage;
+       u32         state;
+       u32         present_rate;
+       u32         remaining_capacity;
+       u32         present_voltage;
+
 } BT_BATTERY_STATUS;
 
 
@@ -101,61 +103,62 @@ typedef struct
  */
 typedef struct
 {
-       BM_HANDLE               device_handle;
-       ACPI_HANDLE             acpi_handle;
-       char                    uid[9];
-       ACPI_STRING             power_units;
-       BOOLEAN                 is_present;
+       BM_HANDLE       device_handle;
+       acpi_handle     acpi_handle;
+       char            uid[9];
+       acpi_string     power_units;
+       u8              is_present;
+
 } BT_CONTEXT;
 
 
 /*****************************************************************************
- *                              Function Prototypes
+ *              Function Prototypes
  *****************************************************************************/
 
 /* bt.c */
 
-ACPI_STATUS
+acpi_status
 bt_initialize (void);
 
-ACPI_STATUS
+acpi_status
 bt_terminate (void);
 
-ACPI_STATUS
+acpi_status
 bt_notify (
-       u32                     notify_type,
-       u32                     device,
-       void                    **context);
+       u32         notify_type,
+       u32         device,
+       void        **context);
 
-ACPI_STATUS
+acpi_status
 bt_request(
-       BM_REQUEST              *request_info,
-       void                    *context);
+       BM_REQUEST  *request_info,
+       void        *context);
 
-ACPI_STATUS
+acpi_status
 bt_get_status (
-       BT_CONTEXT              *battery,
-       BT_BATTERY_STATUS       **battery_status);
+       BT_CONTEXT                      *battery,
+       BT_BATTERY_STATUS   **battery_status);
 
-ACPI_STATUS
+acpi_status
 bt_get_info (
-       BT_CONTEXT              *battery,
-       BT_BATTERY_INFO         **battery_info);
+       BT_CONTEXT      *battery,
+       BT_BATTERY_INFO **battery_info);
 
 /* Battery OSL */
 
-ACPI_STATUS
+acpi_status
 bt_osl_add_device (
-       BT_CONTEXT              *battery);
+       BT_CONTEXT      *battery);
 
-ACPI_STATUS
+acpi_status
 bt_osl_remove_device (
-       BT_CONTEXT              *battery);
+       BT_CONTEXT      *battery);
 
-ACPI_STATUS
+acpi_status
 bt_osl_generate_event (
-       u32                     event,
-       BT_CONTEXT              *battery);
+       u32         event,
+       BT_CONTEXT      *battery);
 
 
-#endif /* __BT_H__ */
+#endif  /* __BT_H__ */
index 4456fcc2467e46969a5da8947b6e1e367e007631..f153e25afe65fb609cccda6b3cc9f5b0d124d05f 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  *
  * Module Name: ec.h
- *   $Revision: 15 $
+ *   $Revision: 19 $
  *
  *****************************************************************************/
 
@@ -76,7 +76,7 @@ typedef u8                    EC_COMMAND;
  *  +--------------- <Reserved>
  *
  */
-typedef u                    EC_STATUS;
+typedef u32                    EC_STATUS;
 
 #define EC_FLAG_OUTPUT_BUFFER  ((EC_STATUS) 0x01)
 #define EC_FLAG_INPUT_BUFFER   ((EC_STATUS) 0x02)
@@ -88,7 +88,7 @@ typedef u8                    EC_STATUS;
  * EC_EVENT:
  * ---------
  */
-typedef u                    EC_EVENT;
+typedef u32                    EC_EVENT;
 
 #define EC_EVENT_UNKNOWN       ((EC_EVENT) 0x00)
 #define EC_EVENT_NONE          ((EC_EVENT) 0x00)
@@ -123,14 +123,14 @@ typedef struct
 typedef struct
 {
        BM_HANDLE               device_handle;
-       ACPI_HANDLE             acpi_handle;
+       acpi_handle             acpi_handle;
        u32                     gpe_bit;
        u32                     status_port;
        u32                     command_port;
        u32                     data_port;
        u32                     use_global_lock;
        u8                      query_data;
-       ACPI_HANDLE             mutex;
+       acpi_handle             mutex;
 } EC_CONTEXT;
 
 
@@ -140,38 +140,38 @@ typedef struct
 
 /* ec.c */
 
-ACPI_STATUS
+acpi_status
 ec_initialize(void);
 
-ACPI_STATUS
+acpi_status
 ec_terminate(void);
 
-ACPI_STATUS
+acpi_status
 ec_notify (
        u32                     notify_type,
        u32                     device,
        void                    **context);
 
-ACPI_STATUS
+acpi_status
 ec_request(
        BM_REQUEST              *request_info,
        void                    *context);
 
 /* ectransx.c */
 
-ACPI_STATUS
+acpi_status
 ec_transaction (
        EC_CONTEXT              *ec,
        EC_REQUEST              *ec_request);
 
-ACPI_STATUS
+acpi_status
 ec_io_read (
        EC_CONTEXT              *ec,
        u32                     io_port,
        u8                      *data,
        EC_EVENT                wait_event);
 
-ACPI_STATUS
+acpi_status
 ec_io_write (
        EC_CONTEXT              *ec,
        u32                     io_port,
@@ -180,21 +180,21 @@ ec_io_write (
 
 /* ecgpe.c */
 
-ACPI_STATUS
+acpi_status
 ec_install_gpe_handler (
        EC_CONTEXT              *ec);
 
-ACPI_STATUS
+acpi_status
 ec_remove_gpe_handler (
        EC_CONTEXT              *ec);
 
 /* ecspace.c */
 
-ACPI_STATUS
+acpi_status
 ec_install_space_handler (
        EC_CONTEXT              *ec);
 
-ACPI_STATUS
+acpi_status
 ec_remove_space_handler (
        EC_CONTEXT              *ec);
 
index 1fd6d57405edd3537458f8a705bfc4f6ff7dd341..897df2b722522b2aab0cb14e171c451f017fab8a 100644 (file)
@@ -171,7 +171,7 @@ typedef struct
 typedef struct
 {
        BM_HANDLE               device_handle;
-       ACPI_HANDLE             acpi_handle;
+       acpi_handle             acpi_handle;
        u32                     uid;
        PR_PBLOCK               pblk;
        PR_POWER                power;
@@ -185,19 +185,19 @@ typedef struct
 
 /* processor.c */
 
-ACPI_STATUS
+acpi_status
 pr_initialize(void);
 
-ACPI_STATUS
+acpi_status
 pr_terminate(void);
 
-ACPI_STATUS
+acpi_status
 pr_notify (
        BM_NOTIFY               notify_type,
        BM_HANDLE               device_handle,
        void                    **context);
 
-ACPI_STATUS
+acpi_status
 pr_request(
        BM_REQUEST              *request,
        void                    *context);
@@ -207,56 +207,56 @@ pr_request(
 void
 pr_power_idle (void);
 
-ACPI_STATUS
+acpi_status
 pr_power_add_device (
        PR_CONTEXT              *processor);
 
-ACPI_STATUS
+acpi_status
 pr_power_remove_device (
        PR_CONTEXT              *processor);
 
-ACPI_STATUS
+acpi_status
 pr_power_initialize (void);
 
-ACPI_STATUS
+acpi_status
 pr_power_terminate (void);
 
 /* prperf.c */
 
-ACPI_STATUS
+acpi_status
 pr_perf_get_state (
        PR_CONTEXT              *processor,
        u32                     *state);
 
-ACPI_STATUS
+acpi_status
 pr_perf_set_state (
        PR_CONTEXT              *processor,
        u32                     state);
 
-ACPI_STATUS
+acpi_status
 pr_perf_set_limit (
        PR_CONTEXT              *processor,
        u32                     limit);
 
-ACPI_STATUS
+acpi_status
 pr_perf_add_device (
        PR_CONTEXT              *processor);
 
-ACPI_STATUS
+acpi_status
 pr_perf_remove_device (
        PR_CONTEXT              *processor);
 
 /* Processor Driver OSL */
 
-ACPI_STATUS
+acpi_status
 pr_osl_add_device (
        PR_CONTEXT              *processor);
 
-ACPI_STATUS
+acpi_status
 pr_osl_remove_device (
        PR_CONTEXT              *processor);
 
-ACPI_STATUS
+acpi_status
 pr_osl_generate_event (
        u32                     event,
        PR_CONTEXT              *processor);
index ccaa5a480af7f800781376703872702a9ae16b0f..f2acefdfbb7f6b53374073cf959c809a3f51c14c 100644 (file)
@@ -46,7 +46,7 @@
 typedef struct
 {
        BM_HANDLE               device_handle;
-       ACPI_HANDLE             acpi_handle;
+       acpi_handle             acpi_handle;
        u8                      states[SM_MAX_SYSTEM_STATES];
 } SM_CONTEXT;
 
@@ -55,34 +55,34 @@ typedef struct
  *                              Function Prototypes
  *****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 sm_initialize (void);
 
-ACPI_STATUS
+acpi_status
 sm_terminate (void);
 
-ACPI_STATUS
+acpi_status
 sm_notify (
        u32                     notify_type,
        u32                     device,
        void                    **context);
 
-ACPI_STATUS
+acpi_status
 sm_request(
        BM_REQUEST              *request_info,
        void                    *context);
 
 /* System Driver OSL */
 
-ACPI_STATUS
+acpi_status
 sm_osl_add_device (
        SM_CONTEXT              *system);
 
-ACPI_STATUS
+acpi_status
 sm_osl_remove_device (
        SM_CONTEXT              *system);
 
-ACPI_STATUS
+acpi_status
 sm_osl_generate_event (
        u32                     event,
        SM_CONTEXT              *system);
index 6f086090aa2dce2628e3e2cb0c2ee9596c7aff33..ccf2c4153fcd2e68f97038ba8a465ed16cde0860 100644 (file)
@@ -203,7 +203,7 @@ typedef struct {
  */
 typedef struct {
        BM_HANDLE               device_handle;
-       ACPI_HANDLE             acpi_handle;
+       acpi_handle             acpi_handle;
        char                    uid[9];
        TZ_POLICY               policy;
 } TZ_CONTEXT;
@@ -215,29 +215,29 @@ typedef struct {
 
 /* thermal_zone.c */
 
-ACPI_STATUS
+acpi_status
 tz_initialize (void);
 
-ACPI_STATUS
+acpi_status
 tz_terminate (void);
 
-ACPI_STATUS
+acpi_status
 tz_notify (
        BM_NOTIFY               notify_type,
        BM_HANDLE               device_handle,
        BM_DRIVER_CONTEXT       *context);
 
-ACPI_STATUS
+acpi_status
 tz_request (
        BM_REQUEST              *request,
        BM_DRIVER_CONTEXT       context);
 
-ACPI_STATUS
+acpi_status
 tz_get_temperature (
        TZ_CONTEXT              *thermal_zone,
        u32                     *temperature);
 
-ACPI_STATUS
+acpi_status
 tz_get_thresholds (
        TZ_CONTEXT              *thermal_zone,
        TZ_THRESHOLD_LIST       *threshold_list);
@@ -248,11 +248,11 @@ tz_print (
 
 /* tzpolicy.c */
 
-ACPI_STATUS
+acpi_status
 tz_policy_add_device (
        TZ_CONTEXT              *thermal_zone);
 
-ACPI_STATUS
+acpi_status
 tz_policy_remove_device (
        TZ_CONTEXT              *thermal_zone);
 
@@ -262,15 +262,15 @@ tz_policy_check (
 
 /* Thermal Zone Driver OSL */
 
-ACPI_STATUS
+acpi_status
 tz_osl_add_device (
        TZ_CONTEXT              *thermal_zone);
 
-ACPI_STATUS
+acpi_status
 tz_osl_remove_device (
        TZ_CONTEXT              *thermal_zone);
 
-ACPI_STATUS
+acpi_status
 tz_osl_generate_event (
        u32                     event,
        TZ_CONTEXT              *thermal_zone);
index 4c4b208fde9db6adc683e8bd6a356ada7bb5cae8..01e7513173a480e3cc2f68dc8b4039bd85ad287c 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  *
  * Module Name: pr.c
- *   $Revision: 30 $
+ *   $Revision: 32 $
  *
  *****************************************************************************/
 
@@ -37,7 +37,7 @@
  *                                  Globals
  ****************************************************************************/
 
-extern FADT_DESCRIPTOR_REV2    acpi_fadt;
+extern fadt_descriptor_rev2    acpi_fadt;
 
 
 /****************************************************************************
@@ -60,6 +60,33 @@ void
 pr_print (
        PR_CONTEXT              *processor)
 {
+#ifdef ACPI_DEBUG
+       acpi_buffer             buffer;
+
+       PROC_NAME("pr_print");
+
+       buffer.length = 256;
+       buffer.pointer = acpi_os_callocate(buffer.length);
+       if (!buffer.pointer) {
+               return;
+       }
+
+       /*
+        * Get the full pathname for this ACPI object.
+        */
+       acpi_get_name(processor->acpi_handle, ACPI_FULL_PATHNAME, &buffer);
+
+       /*
+        * Print out basic processor information.
+        */
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| Processor[%02x]:[%p] uid[%02x] %s\n", processor->device_handle, processor->acpi_handle, processor->uid, buffer.pointer));
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "|   power: %cC0 %cC1 %cC2[%d] %cC3[%d]\n", (processor->power.state[0].is_valid?'+':'-'), (processor->power.state[1].is_valid?'+':'-'), (processor->power.state[2].is_valid?'+':'-'), processor->power.state[2].latency, (processor->power.state[3].is_valid?'+':'-'), processor->power.state[3].latency));
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "|   performance: states[%d]\n", processor->performance.state_count));
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
+
+       acpi_os_free(buffer.pointer);
+#endif /* ACPI_DEBUG */
 
        return;
 }
@@ -77,26 +104,28 @@ pr_print (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 pr_add_device(
        BM_HANDLE               device_handle,
        void                    **context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        PR_CONTEXT              *processor = NULL;
        BM_DEVICE               *device = NULL;
-       ACPI_BUFFER             buffer;
-       ACPI_OBJECT             acpi_object;
+       acpi_buffer             buffer;
+       acpi_object             acpi_object;
        static u32              processor_count = 0;
 
 
+       FUNCTION_TRACE("pr_add_device");
+
        if (!context || *context) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        status = bm_get_device_info(device_handle, &device);
        if (ACPI_FAILURE(status)) {
-               return(status);
+               return_ACPI_STATUS(status);
        }
 
        processor = acpi_os_callocate(sizeof(PR_CONTEXT));
@@ -111,9 +140,9 @@ pr_add_device(
         * Processor Block:
         * ----------------
         */
-       MEMSET(&acpi_object, 0, sizeof(ACPI_OBJECT));
+       MEMSET(&acpi_object, 0, sizeof(acpi_object));
 
-       buffer.length = sizeof(ACPI_OBJECT);
+       buffer.length = sizeof(acpi_object);
        buffer.pointer = &acpi_object;
 
        status = acpi_evaluate_object(processor->acpi_handle, NULL, NULL, &buffer);
@@ -162,7 +191,7 @@ end:
                acpi_os_free(processor);
        }
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -178,19 +207,23 @@ end:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 pr_remove_device (
        void                    **context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        PR_CONTEXT              *processor= NULL;
 
+       FUNCTION_TRACE("pr_remove_device");
+
        if (!context || !*context) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        processor = (PR_CONTEXT*)(*context);
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing processor device [%02x].\n", processor->device_handle));
+
        pr_osl_remove_device(processor);
 
        pr_perf_remove_device(processor);
@@ -199,7 +232,7 @@ pr_remove_device (
 
        acpi_os_free(processor);
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -219,13 +252,15 @@ pr_remove_device (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 pr_initialize (void)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_DEVICE_ID            criteria;
        BM_DRIVER               driver;
 
+       FUNCTION_TRACE("pr_initialize");
+
        MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
        MEMSET(&driver, 0, sizeof(BM_DRIVER));
 
@@ -234,7 +269,7 @@ pr_initialize (void)
         */
        status = pr_power_initialize();
        if (ACPI_FAILURE(status)) {
-               return(status);
+               return_ACPI_STATUS(status);
        }
 
        /*
@@ -247,7 +282,7 @@ pr_initialize (void)
 
        status = bm_register_driver(&criteria, &driver);
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -263,13 +298,15 @@ pr_initialize (void)
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 pr_terminate (void)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_DEVICE_ID            criteria;
        BM_DRIVER               driver;
 
+       FUNCTION_TRACE("pr_terminate");
+
        MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
        MEMSET(&driver, 0, sizeof(BM_DRIVER));
 
@@ -278,7 +315,7 @@ pr_terminate (void)
         */
        status = pr_power_terminate();
        if (ACPI_FAILURE(status)) {
-               return(status);
+               return_ACPI_STATUS(status);
        }
 
        /*
@@ -291,7 +328,7 @@ pr_terminate (void)
 
        status = bm_unregister_driver(&criteria, &driver);
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -307,15 +344,17 @@ pr_terminate (void)
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 pr_notify (
        BM_NOTIFY               notify_type,
        BM_HANDLE               device_handle,
        void                    **context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        PR_CONTEXT              *processor = NULL;
 
+       FUNCTION_TRACE("pr_notify");
+
        processor = (PR_CONTEXT*)*context;
 
        switch (notify_type) {
@@ -329,6 +368,7 @@ pr_notify (
                break;
 
        case PR_NOTIFY_PERF_STATES:
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Performance states change event detected on processor [%02x].\n", device_handle));
                /* TBD: Streamline (this is simple but overkill). */
                status = pr_perf_remove_device(processor);
                if (ACPI_SUCCESS(status)) {
@@ -341,6 +381,7 @@ pr_notify (
                break;
 
        case PR_NOTIFY_POWER_STATES:
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Power states change event detected on processor [%02x].\n", device_handle));
                /* TBD: Streamline (this is simple but overkill). */
                status = pr_power_remove_device(processor);
                if (ACPI_SUCCESS(status)) {
@@ -357,7 +398,7 @@ pr_notify (
                break;
        }
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -373,19 +414,21 @@ pr_notify (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 pr_request (
        BM_REQUEST              *request,
        void                    *context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        PR_CONTEXT              *processor = NULL;
 
+       FUNCTION_TRACE("pr_request");
+
        /*
         * Must have a valid request structure and context.
         */
        if (!request || !context) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        processor = (PR_CONTEXT*)context;
@@ -450,5 +493,5 @@ pr_request (
 
        request->status = status;
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
index 1f143b6e487b880812c49a1be7168ca2ef58d369..9689d3cf0653c64d697a643488b1448896cdb729 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: pr_osl.c
- *   $Revision: 14 $
+ *   $Revision: 18 $
  *
  *****************************************************************************/
 
@@ -29,6 +29,7 @@
 #include <linux/init.h>
 #include <linux/types.h>
 #include <linux/proc_fs.h>
+#include <linux/pci.h>
 #include <acpi.h>
 #include <bm.h>
 #include "pr.h"
@@ -45,21 +46,22 @@ MODULE_LICENSE("GPL");
 
 extern struct proc_dir_entry   *bm_proc_root;
 static struct proc_dir_entry   *pr_proc_root = NULL;
+extern unsigned short          acpi_piix4_bmisx;
 
 
 /****************************************************************************
- * 
+ *
  * FUNCTION:   pr_osl_proc_read_status
  *
  ****************************************************************************/
 
 static int
 pr_osl_proc_read_status (
-       char                    *page, 
-       char                    **start, 
-       off_t                   off, 
-       int                     count, 
-       int                     *eof, 
+       char                    *page,
+       char                    **start,
+       off_t                   off,
+       int                     count,
+       int                     *eof,
        void                    *context)
 {
        PR_CONTEXT              *processor = NULL;
@@ -72,10 +74,10 @@ pr_osl_proc_read_status (
 
        processor = (PR_CONTEXT*)context;
 
-       p += sprintf(p, "Bus Mastering Activity:  %08x\n", 
+       p += sprintf(p, "Bus Mastering Activity:  %08x\n",
                processor->power.bm_activity);
 
-       p += sprintf(p, "C-State Utilization:     C1[%d] C2[%d] C3[%d]\n", 
+       p += sprintf(p, "C-State Utilization:     C1[%d] C2[%d] C3[%d]\n",
                processor->power.state[PR_C1].utilization,
                processor->power.state[PR_C2].utilization,
                processor->power.state[PR_C3].utilization);
@@ -93,18 +95,18 @@ end:
 
 
 /****************************************************************************
- * 
+ *
  * FUNCTION:   pr_osl_proc_read_info
  *
  ****************************************************************************/
 
 static int
 pr_osl_proc_read_info (
-       char                    *page, 
-       char                    **start, 
-       off_t                   off, 
-       int                     count, 
-       int                     *eof, 
+       char                    *page,
+       char                    **start,
+       off_t                   off,
+       int                     count,
+       int                     *eof,
        void                    *context)
 {
        PR_CONTEXT              *processor = NULL;
@@ -137,7 +139,7 @@ end:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 pr_osl_add_device(
        PR_CONTEXT              *processor)
 {
@@ -160,6 +162,9 @@ pr_osl_add_device(
                printk(", throttling states: %d", processor->performance.state_count);
        }
 
+       if (acpi_piix4_bmisx)
+               printk(", PIIX workaround active");
+
        printk("\n");
 
        sprintf(processor_uid, "%d", processor->uid);
@@ -169,10 +174,10 @@ pr_osl_add_device(
                return(AE_ERROR);
        }
 
-       create_proc_read_entry(PR_PROC_STATUS, S_IFREG | S_IRUGO, 
+       create_proc_read_entry(PR_PROC_STATUS, S_IFREG | S_IRUGO,
                proc_entry, pr_osl_proc_read_status, (void*)processor);
 
-       create_proc_read_entry(PR_PROC_INFO, S_IFREG | S_IRUGO, 
+       create_proc_read_entry(PR_PROC_INFO, S_IFREG | S_IRUGO,
                proc_entry, pr_osl_proc_read_info, (void*)processor);
 
        return(AE_OK);
@@ -185,7 +190,7 @@ pr_osl_add_device(
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 pr_osl_remove_device (
        PR_CONTEXT              *processor)
 {
@@ -214,12 +219,12 @@ pr_osl_remove_device (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 pr_osl_generate_event (
        u32                     event,
        PR_CONTEXT              *processor)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        char                    processor_uid[16];
 
        if (!processor) {
@@ -231,7 +236,7 @@ pr_osl_generate_event (
        case PR_NOTIFY_PERF_STATES:
        case PR_NOTIFY_POWER_STATES:
                sprintf(processor_uid, "%d", processor->uid);
-               status = bm_osl_generate_event(processor->device_handle, 
+               status = bm_osl_generate_event(processor->device_handle,
                        PR_PROC_ROOT, processor_uid, event, 0);
                break;
 
@@ -244,6 +249,34 @@ pr_osl_generate_event (
 }
 
 
+/****************************************************************************
+ *                              Errata Handling
+ ****************************************************************************/
+
+void acpi_pr_errata (void)
+{
+       struct pci_dev          *dev = NULL;
+
+       while ((dev = pci_find_subsys(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, 
+               PCI_ANY_ID, PCI_ANY_ID, dev))) {
+               switch (dev->device) {
+               case PCI_DEVICE_ID_INTEL_82801BA_8:     /* PIIX4U4 */
+               case PCI_DEVICE_ID_INTEL_82801BA_9:     /* PIIX4U3 */
+               case PCI_DEVICE_ID_INTEL_82451NX:       /* PIIX4NX */
+               case PCI_DEVICE_ID_INTEL_82372FB_1:     /* PIIX4U2 */
+               case PCI_DEVICE_ID_INTEL_82801AA_1:     /* PIIX4U */
+               case PCI_DEVICE_ID_INTEL_82443MX_1:     /* PIIX4E2 */
+               case PCI_DEVICE_ID_INTEL_82801AB_1:     /* PIIX4E */
+               case PCI_DEVICE_ID_INTEL_82371AB:       /* PIIX4 */
+                       acpi_piix4_bmisx = pci_resource_start(dev, 4);
+                       return;
+               }
+       }
+
+       return;
+}
+
+
 /****************************************************************************
  *
  * FUNCTION:   pr_osl_init
@@ -256,10 +289,16 @@ pr_osl_generate_event (
  *
  ****************************************************************************/
 
-static int __init 
+static int __init
 pr_osl_init (void)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+       /* abort if no busmgr */
+       if (!bm_proc_root)
+               return -ENODEV;
+
+       acpi_pr_errata();
 
        pr_proc_root = proc_mkdir(PR_PROC_ROOT, bm_proc_root);
        if (!pr_proc_root) {
@@ -289,7 +328,7 @@ pr_osl_init (void)
  *
  ****************************************************************************/
 
-static void __exit 
+static void __exit
 pr_osl_cleanup (void)
 {
        pr_terminate();
index 43a407e7e105997484bbea01cf5b02366f1fe9ba..6a4efbb0383cba99c8336427b8ac2190b023eba1 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  *
  * Module Name: prperf.c
- *              $Revision: 16 $
+ *              $Revision: 19 $
  *
  *****************************************************************************/
 
@@ -41,7 +41,7 @@
  *                                  Globals
  ****************************************************************************/
 
-extern FADT_DESCRIPTOR_REV2    acpi_fadt;
+extern fadt_descriptor_rev2    acpi_fadt;
 const u32                      POWER_OF_2[] = {1,2,4,8,16,32,64,128,256,512};
 
 
@@ -57,19 +57,21 @@ const u32                   POWER_OF_2[] = {1,2,4,8,16,32,64,128,256,512};
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 pr_perf_get_frequency (
        PR_CONTEXT              *processor,
        u32                     *frequency) {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+       FUNCTION_TRACE("pr_perf_get_frequency");
 
        if (!processor || !frequency) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /* TBD: Generic method to calculate processor frequency. */
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -87,7 +89,7 @@ pr_perf_get_frequency (
 
 /* TBD:        Include support for _real_ performance states (not just throttling). */
 
-ACPI_STATUS
+acpi_status
 pr_perf_get_state (
        PR_CONTEXT              *processor,
        u32                     *state)
@@ -96,16 +98,18 @@ pr_perf_get_state (
        u32                     duty_mask = 0;
        u32                     duty_cycle = 0;
 
+       FUNCTION_TRACE("pr_perf_get_state");
+
        if (!processor || !state) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        if (processor->performance.state_count == 1) {
                *state = 0;
-               return(AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
-       pblk_value = acpi_os_in32(processor->pblk.address);
+       acpi_os_read_port(processor->pblk.address, &pblk_value, 32);
 
        /*
         * Throttling Enabled?
@@ -133,7 +137,9 @@ pr_perf_get_state (
                *state = 0;
        }
 
-       return(AE_OK);
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Processor [%02x] is at performance state [%d%%].\n", processor->device_handle, processor->performance.state[*state].performance));
+
+       return_ACPI_STATUS(AE_OK);
 }
 
 
@@ -153,7 +159,7 @@ pr_perf_get_state (
 
 /* TBD: Includes support for _real_ performance states (not just throttling). */
 
-ACPI_STATUS
+acpi_status
 pr_perf_set_state (
        PR_CONTEXT              *processor,
        u32                     state)
@@ -163,16 +169,18 @@ pr_perf_set_state (
        u32                     duty_cycle = 0;
        u32                     i = 0;
 
+       FUNCTION_TRACE ("pr_perf_set_state");
+
        if (!processor) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        if (state > (processor->performance.state_count - 1)) {
-               return(AE_BAD_DATA);
+               return_ACPI_STATUS(AE_BAD_DATA);
        }
 
        if (processor->performance.state_count == 1) {
-               return(AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /*
@@ -200,10 +208,10 @@ pr_perf_set_state (
         * Got to turn it off before you can change the duty_cycle value.
         * Throttling is disabled by writing a 0 to bit 4.
         */
-       pblk_value = acpi_os_in32(processor->pblk.address);
+       acpi_os_read_port(processor->pblk.address, &pblk_value, 32);
        if (pblk_value & 0x00000010) {
                pblk_value &= 0xFFFFFFEF;
-               acpi_os_out32(processor->pblk.address, pblk_value);
+               acpi_os_write_port(processor->pblk.address, pblk_value, 32);
        }
 
        /*
@@ -213,7 +221,7 @@ pr_perf_set_state (
         */
        pblk_value &= duty_mask;
        pblk_value |= duty_cycle;
-       acpi_os_out32(processor->pblk.address, pblk_value);
+       acpi_os_write_port(processor->pblk.address, pblk_value, 32);
 
        /*
         * Enable Throttling:
@@ -222,10 +230,12 @@ pr_perf_set_state (
         */
        if (state) {
                pblk_value |= 0x00000010;
-               acpi_os_out32(processor->pblk.address, pblk_value);
+               acpi_os_write_port(processor->pblk.address, pblk_value, 32);
        }
 
-       return(AE_OK);
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Processor [%02x] set to performance state [%d%%].\n", processor->device_handle, processor->performance.state[state].performance));
+
+       return_ACPI_STATUS(AE_OK);
 }
 
 
@@ -241,16 +251,18 @@ pr_perf_set_state (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 pr_perf_set_limit (
        PR_CONTEXT              *processor,
        u32                     limit)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        PR_PERFORMANCE          *performance = NULL;
 
+       FUNCTION_TRACE ("pr_perf_set_limit");
+
        if (!processor) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        performance = &(processor->performance);
@@ -285,7 +297,7 @@ pr_perf_set_limit (
                break;
 
        default:
-               return(AE_BAD_DATA);
+               return_ACPI_STATUS(AE_BAD_DATA);
                break;
        }
 
@@ -293,7 +305,9 @@ pr_perf_set_limit (
                performance->thermal_limit = limit;
        }
 
-       return(status);
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Processor [%02x] thermal performance limit set to [%d%%].\n", processor->device_handle, processor->performance.state[performance->active_state].performance));
+
+       return_ACPI_STATUS(status);
 }
 
 
@@ -317,17 +331,19 @@ pr_perf_set_limit (
 
 /* TBD: Support duty_cycle values that span bit 4. */
 
-ACPI_STATUS
+acpi_status
 pr_perf_add_device (
        PR_CONTEXT              *processor)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        u32                     i = 0;
        u32                     performance_step = 0;
        u32                     percentage = 0;
 
+       FUNCTION_TRACE("pr_perf_add_device");
+
        if (!processor) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /*
@@ -390,7 +406,7 @@ pr_perf_add_device (
        status = pr_perf_get_state(processor,
                &(processor->performance.active_state));
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -406,18 +422,20 @@ pr_perf_add_device (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 pr_perf_remove_device (
        PR_CONTEXT              *processor)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+       FUNCTION_TRACE("pr_perf_remove_device");
 
        if (!processor) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        MEMSET(&(processor->performance), 0, sizeof(PR_PERFORMANCE));
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
index 33202ae55dc267b668064a33eab85b340887c0a5..184024d6e398e9acb9dba225c14a238090b41e47 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  *
  * Module Name: prpower.c
- *   $Revision: 25 $
+ *   $Revision: 30 $
  *
  *****************************************************************************/
 
@@ -27,6 +27,7 @@
 /* TBD: Linux specific */
 #include <linux/sched.h>
 #include <linux/pm.h>
+#include <asm/io.h>
 
 #include <acpi.h>
 #include <bm.h>
  *                                  Globals
  ****************************************************************************/
 
-extern FADT_DESCRIPTOR_REV2    acpi_fadt;
+extern fadt_descriptor_rev2    acpi_fadt;
 static u32                     last_idle_jiffies = 0;
 static PR_CONTEXT              *processor_list[NR_CPUS];
 static void                    (*pr_pm_idle_save)(void) = NULL;
+static u8                      bm_control = 0;
+
+
+/* Used for PIIX4 errata handling. */
+unsigned short                 acpi_piix4_bmisx = 0;
 
 
 /****************************************************************************
@@ -67,7 +73,11 @@ pr_power_activate_state (
        PR_CONTEXT              *processor,
        u32                     next_state)
 {
+
+       PROC_NAME("pr_power_activate_state");
+
        if (!processor) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid (NULL) context.\n"));
                return;
        }
 
@@ -124,6 +134,8 @@ pr_power_idle (void)
        u32                     start_ticks, end_ticks, time_elapsed;
        PR_CONTEXT              *processor = NULL;
 
+       PROC_NAME("pr_power_idle");
+
        processor = processor_list[smp_processor_id()];
 
        if (!processor || processor->power.active_state == PR_C0) {
@@ -132,21 +144,6 @@ pr_power_idle (void)
 
        next_state = processor->power.active_state;
 
-       /*
-        * Log BM Activity:
-        * ----------------
-        * Read BM_STS and record its value for later use by C3 policy.
-        * Note that we save the BM_STS values for the last 32 call to
-        * this function (cycles).  Also note that we must clear BM_STS
-        * if set (sticky).
-        */
-       processor->power.bm_activity <<= 1;
-       if (acpi_hw_register_bit_access(ACPI_READ, ACPI_MTX_DO_NOT_LOCK, BM_STS)) {
-               processor->power.bm_activity |= 1;
-               acpi_hw_register_bit_access(ACPI_WRITE, ACPI_MTX_DO_NOT_LOCK,
-                       BM_STS, 1);
-       }
-
        /*
         * Check OS Idleness:
         * ------------------
@@ -165,6 +162,37 @@ pr_power_idle (void)
                }
        }
 
+       disable();
+
+       /*
+        * Log BM Activity:
+        * ----------------
+        * Read BM_STS and record its value for later use by C3 policy.
+        * (Note that we save the BM_STS values for the last 32 cycles).
+        */
+       if (bm_control) {
+               processor->power.bm_activity <<= 1;
+               if (acpi_hw_register_bit_access(ACPI_READ, ACPI_MTX_DO_NOT_LOCK, BM_STS)) {
+                       processor->power.bm_activity |= 1;
+                       acpi_hw_register_bit_access(ACPI_WRITE, ACPI_MTX_DO_NOT_LOCK,
+                               BM_STS, 1);
+               }
+               else if (acpi_piix4_bmisx) {
+                       /*
+                        * PIIX4 Errata:
+                        * -------------
+                        * This code is a workaround for errata #18 "C3 Power State/
+                        * BMIDE and Type-F DMA Livelock" from the July '01 PIIX4
+                        * specification update.  Note that BM_STS doesn't always
+                        * reflect the true state of bus mastering activity; forcing
+                        * us to manually check the BMIDEA bit of each IDE channel.
+                        */
+                       if ((inb_p(acpi_piix4_bmisx + 0x02) & 0x01) ||
+                               (inb_p(acpi_piix4_bmisx + 0x0A) & 0x01))
+                               processor->power.bm_activity |= 1;
+               }
+       }
+
        c_state = &(processor->power.state[processor->power.active_state]);
 
        c_state->utilization++;
@@ -177,21 +205,17 @@ pr_power_idle (void)
        switch (processor->power.active_state) {
 
        case PR_C1:
-               /* See how long we're asleep for */
-               acpi_get_timer(&start_ticks);
                /* Invoke C1 */
                enable(); halt();
-               /* Compute time elapsed */
-               acpi_get_timer(&end_ticks);
+               /* no C1 time measurement, so just enter some number of times */
+               time_elapsed = 0xFFFFFFFF;
                break;
 
        case PR_C2:
-               /* Interrupts must be disabled during C2 transitions */
-               disable();
                /* See how long we're asleep for */
                acpi_get_timer(&start_ticks);
                /* Invoke C2 */
-               acpi_os_in8(processor->power.p_lvl2);
+               acpi_os_read_port(processor->power.p_lvl2, NULL, 8);
                /* Dummy op - must do something useless after P_LVL2 read */
                acpi_hw_register_bit_access(ACPI_READ, ACPI_MTX_DO_NOT_LOCK,
                        BM_STS);
@@ -199,18 +223,17 @@ pr_power_idle (void)
                acpi_get_timer(&end_ticks);
                /* Re-enable interrupts */
                enable();
+               acpi_get_timer_duration(start_ticks, end_ticks, &time_elapsed);
                break;
 
        case PR_C3:
-               /* Interrupts must be disabled during C3 transitions */
-               disable();
                /* Disable bus master arbitration */
                acpi_hw_register_bit_access(ACPI_WRITE, ACPI_MTX_DO_NOT_LOCK,
                        ARB_DIS, 1);
                /* See how long we're asleep for */
                acpi_get_timer(&start_ticks);
-               /* Invoke C2 */
-               acpi_os_in8(processor->power.p_lvl3);
+               /* Invoke C3 */
+               acpi_os_read_port(processor->power.p_lvl3, NULL, 8);
                /* Dummy op - must do something useless after P_LVL3 read */
                acpi_hw_register_bit_access(ACPI_READ, ACPI_MTX_DO_NOT_LOCK,
                        BM_STS);
@@ -221,25 +244,20 @@ pr_power_idle (void)
                        ARB_DIS, 0);
                /* Re-enable interrupts */
                enable();
+               acpi_get_timer_duration(start_ticks, end_ticks, &time_elapsed);
                break;
 
        default:
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Attempt to use unsupported power state C%d.\n", processor->power.active_state));
+               enable();
                break;
        }
 
-       /*
-        * Compute the amount of time asleep (in the Cx state).
-        *
-        * TBD: Convert time_threshold to PM timer ticks initially to
-        *      avoid having to do the math (acpi_get_timer_duration).
-        */
-       acpi_get_timer_duration(start_ticks, end_ticks, &time_elapsed);
-
        /*
         * Promotion?
         * ----------
         * Track the number of successful sleeps (time asleep is greater
-        * than time_threshold) and promote when count_threashold is
+        * than time_threshold) and promote when count_threshold is
         * reached.
         */
        if ((c_state->promotion.target_state) &&        
@@ -256,7 +274,7 @@ pr_power_idle (void)
                         * by this state's promotion policy, prevents
                         * promotions from occuring.
                         */
-                       if (!(processor->power.bm_activity &
+                       if (bm_control && !(processor->power.bm_activity &
                                c_state->promotion.bm_threshold)) {
                                next_state = c_state->promotion.target_state;
                        }
@@ -287,8 +305,8 @@ pr_power_idle (void)
                 * state's promotion policy, causes an immediate demotion
                 * to occur.
                 */
-               if (processor->power.bm_activity &
-                       c_state->demotion.bm_threshold) {
+               if (bm_control && (processor->power.bm_activity &
+                       c_state->demotion.bm_threshold)) {
                        next_state = c_state->demotion.target_state;
                }
        }
@@ -335,12 +353,14 @@ pr_power_idle (void)
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 pr_power_set_default_policy (
        PR_CONTEXT                 *processor)
 {
+       FUNCTION_TRACE("pr_power_set_default_policy");
+
        if (!processor) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /*
@@ -367,7 +387,7 @@ pr_power_set_default_policy (
        else {
                processor->power.active_state =
                        processor->power.default_state = PR_C0;
-               return(AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /*
@@ -382,7 +402,7 @@ pr_power_set_default_policy (
                 * of transition).  Demote from C2 to C1 anytime we're
                 * asleep in C2 for less than this time.
                 */
-               processor->power.state[PR_C1].promotion.count_threshold = 1;
+               processor->power.state[PR_C1].promotion.count_threshold = 10;
                processor->power.state[PR_C1].promotion.time_threshold =
                        2 * processor->power.state[PR_C2].latency;
                processor->power.state[PR_C1].promotion.target_state = PR_C2;
@@ -423,7 +443,7 @@ pr_power_set_default_policy (
                        PR_C2;
        }
 
-       return(AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
 /*****************************************************************************
@@ -444,12 +464,14 @@ pr_power_set_default_policy (
  *         by different CPUs results in lowest common denominator).
  */
 
-ACPI_STATUS
+acpi_status
 pr_power_add_device (
        PR_CONTEXT                 *processor)
 {
+       FUNCTION_TRACE("pr_power_add_device");
+
        if (!processor) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /*
@@ -517,11 +539,8 @@ pr_power_add_device (
 #ifdef CONFIG_SMP
        if (smp_num_cpus == 1) {
 #endif /*CONFIG_SMP*/
-               if ((acpi_fadt.plvl3_lat <= PR_MAX_C3_LATENCY) &&
-                       (acpi_fadt.V1_pm2_cnt_blk && acpi_fadt.pm2_cnt_len)) {
-                       /* TBD: Resolve issue with C3 and HDD corruption. */
-                       processor->power.state[PR_C3].is_valid = FALSE;
-                       /* processor->power.state[PR_C3].is_valid = TRUE;*/
+               if ((acpi_fadt.plvl3_lat <= PR_MAX_C3_LATENCY) && bm_control) {
+                       processor->power.state[PR_C3].is_valid = TRUE;
                        processor->power.p_lvl3 = processor->pblk.address + 5;
                }
 #ifdef CONFIG_SMP
@@ -546,7 +565,7 @@ pr_power_add_device (
         */
        processor_list[processor->uid] = processor;
 
-       return(AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
 
@@ -562,21 +581,23 @@ pr_power_add_device (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 pr_power_remove_device (
        PR_CONTEXT              *processor)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+       FUNCTION_TRACE("pr_power_remove_device");
 
        if (!processor) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        MEMSET(&(processor->power), 0, sizeof(PR_POWER));
 
        processor_list[processor->uid] = NULL;
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -592,16 +613,24 @@ pr_power_remove_device (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 pr_power_initialize (void)
 {
        u32                     i = 0;
 
+       FUNCTION_TRACE("pr_power_initialize");
+
        /* TBD: Linux-specific. */
        for (i=0; i<NR_CPUS; i++) {
                processor_list[i] = NULL;
        }
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Max CPUs[%d], this CPU[%d].\n", NR_CPUS, smp_processor_id()));
+
+       /* only use C3 if we can control busmastering */
+       if (acpi_fadt.V1_pm2_cnt_blk && acpi_fadt.pm2_cnt_len)
+               bm_control = 1;
+
        /*
         * Install idle handler.
         *
@@ -610,7 +639,7 @@ pr_power_initialize (void)
        pr_pm_idle_save = pm_idle;
        pm_idle = pr_power_idle;
 
-       return(AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
 
@@ -626,9 +655,11 @@ pr_power_initialize (void)
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 pr_power_terminate (void)
 {
+       FUNCTION_TRACE("pr_power_terminate");
+
        /*
         * Remove idle handler.
         *
@@ -636,5 +667,5 @@ pr_power_terminate (void)
         */
        pm_idle = pr_pm_idle_save;
 
-       return(AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
index 003f7127329b588e42dfa2f0434deed4de183c62..e305234c67163b942fa23d3cd08030c95f59757d 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  *
  * Module Name: sm.c
- *   $Revision: 16 $
+ *   $Revision: 19 $
  *
  *****************************************************************************/
 
@@ -51,6 +51,32 @@ void
 sm_print (
        SM_CONTEXT              *system)
 {
+#ifdef ACPI_DEBUG
+       acpi_buffer             buffer;
+
+       PROC_NAME("sm_print");
+
+       buffer.length = 256;
+       buffer.pointer = acpi_os_callocate(buffer.length);
+       if (!buffer.pointer) {
+               return;
+       }
+
+       /*
+        * Get the full pathname for this ACPI object.
+        */
+       acpi_get_name(system->acpi_handle, ACPI_FULL_PATHNAME, &buffer);
+
+       /*
+        * Print out basic system information.
+        */
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| System[%02x]:[%p] %s\n", system->device_handle, system->acpi_handle, buffer.pointer));
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "|   states: %cS0 %cS1 %cS2 %cS3 %cS4 %cS5\n", (system->states[0]?'+':'-'), (system->states[1]?'+':'-'), (system->states[2]?'+':'-'), (system->states[3]?'+':'-'), (system->states[4]?'+':'-'), (system->states[5]?'+':'-')));
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
+
+       acpi_os_free(buffer.pointer);
+#endif /*ACPI_DEBUG*/
 
        return;
 }
@@ -68,19 +94,24 @@ sm_print (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 sm_add_device(
        BM_HANDLE               device_handle,
        void                    **context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_DEVICE               *device = NULL;
        SM_CONTEXT              *system = NULL;
        u8                      i, type_a, type_b;
 
 
+       FUNCTION_TRACE("sm_add_device");
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Adding system device [%02x].\n", device_handle));
+
        if (!context || *context) {
-               return(AE_BAD_PARAMETER);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid (NULL) context."));
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /*
@@ -88,7 +119,7 @@ sm_add_device(
         */
        system = acpi_os_callocate(sizeof(SM_CONTEXT));
        if (!system) {
-               return(AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        /*
@@ -130,7 +161,7 @@ end:
                acpi_os_free(system);
        }
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -146,26 +177,30 @@ end:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 sm_remove_device (
        void                    **context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        SM_CONTEXT              *system = NULL;
 
+       FUNCTION_TRACE("sm_remove_device");
+
        if (!context || !*context) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        system = (SM_CONTEXT*)*context;
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing system device [%02x].\n", system->device_handle));
+
        status = sm_osl_remove_device(system);
 
        acpi_os_free(system);
 
        *context = NULL;
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -185,13 +220,15 @@ sm_remove_device (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 sm_initialize (void)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_DEVICE_ID            criteria;
        BM_DRIVER               driver;
 
+       FUNCTION_TRACE("sm_initialize");
+
        MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
        MEMSET(&driver, 0, sizeof(BM_DRIVER));
 
@@ -205,7 +242,7 @@ sm_initialize (void)
 
        status = bm_register_driver(&criteria, &driver);
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -221,13 +258,15 @@ sm_initialize (void)
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 sm_terminate (void)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_DEVICE_ID            criteria;
        BM_DRIVER               driver;
 
+       FUNCTION_TRACE("sm_terminate");
+
        MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
        MEMSET(&driver, 0, sizeof(BM_DRIVER));
 
@@ -241,7 +280,7 @@ sm_terminate (void)
 
        status = bm_unregister_driver(&criteria, &driver);
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -256,16 +295,18 @@ sm_terminate (void)
  * DESCRIPTION:
  *
  ****************************************************************************/
-ACPI_STATUS
+acpi_status
 sm_notify (
        BM_NOTIFY               notify_type,
        BM_HANDLE               device_handle,
        void                    **context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+       FUNCTION_TRACE("sm_notify");
 
        if (!context) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        switch (notify_type) {
@@ -283,7 +324,7 @@ sm_notify (
                break;
        }
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -299,18 +340,20 @@ sm_notify (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 sm_request (
        BM_REQUEST              *request,
        void                    *context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+       FUNCTION_TRACE("sm_request");
 
        /*
         * Must have a valid request structure and context.
         */
        if (!request || !context) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /*
@@ -326,5 +369,5 @@ sm_request (
 
        request->status = status;
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
index d8dd7988eee00888f9a860a2229975aec8f16494..6a6a601d331875e9a71d1c018064ed20d1040468 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: sm_osl.c
- *   $Revision: 10 $
+ *   $Revision: 16 $
  *
  *****************************************************************************/
 
 #include <linux/proc_fs.h>
 #include <linux/pm.h>
 #include <asm/uaccess.h>
+#include <linux/acpi.h>
+#include <asm/io.h>
+#include <linux/mc146818rtc.h>
+#include <linux/delay.h>
 
 #include <acpi.h>
 #include "sm.h"
@@ -54,6 +58,92 @@ static struct file_operations proc_dsdt_operations = {
        read:           sm_osl_read_dsdt,
 };
 
+static acpi_status sm_osl_suspend(u32 state);
+
+struct proc_dir_entry *bm_proc_sleep;
+struct proc_dir_entry *bm_proc_alarm;
+struct proc_dir_entry *bm_proc_gpe;
+
+static int
+sm_osl_proc_read_sleep (
+        char                    *page,
+        char                    **start,
+        off_t                   off,
+        int                     count,
+        int                     *eof,
+        void                    *context)
+{
+       SM_CONTEXT    *system = (SM_CONTEXT*) context;
+       char          *str = page;
+       int           len;
+       int           i;
+
+       if (!system)
+               goto end;
+
+       if (off != 0)
+               goto end;
+
+       for (i = 0; i <= ACPI_S5; i++) {
+               if (system->states[i])
+                       str += sprintf(str,"S%d ", i);
+       }
+
+       str += sprintf(str, "\n");
+
+end:
+
+       len = (str - page);
+       if (len < (off + count))
+               *eof = 1;
+
+       *start = page + off;
+       len -= off;
+
+       if (len > count)
+               len = count;
+
+       if (len < 0)
+               len = 0;
+
+       return (len);
+}
+
+int sm_osl_proc_write_sleep (struct file *file,
+                            const char *buffer,
+                            unsigned long count,
+                            void *data)
+{
+       SM_CONTEXT    *system = (SM_CONTEXT*) data;
+       char          str[10];
+       char          *strend;
+       unsigned long value;
+       
+       if (count > (sizeof(str) - 1))
+               return -EINVAL;
+       
+       if (copy_from_user(str,buffer,count))
+               return -EFAULT;
+       
+       str[count] = '\0';
+       
+       value = simple_strtoul(str,&strend,0);
+       if (str == strend)
+               return -EINVAL;
+       
+       if (value == 0 || value >= ACPI_S5)
+               return -EINVAL;
+       
+       /*
+        * make sure that the sleep state is supported
+        */
+       if (system->states[value] != TRUE)
+               return -EINVAL;
+       
+       sm_osl_suspend(value);
+       
+       return (count);
+}
 
 
 /****************************************************************************
@@ -71,19 +161,19 @@ sm_osl_proc_read_info (
        int                     *eof,
        void                    *context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        SM_CONTEXT              *system = NULL;
        char                    *p = page;
        int                     len;
-       ACPI_SYSTEM_INFO        system_info;
-       ACPI_BUFFER             buffer;
+       acpi_system_info        system_info;
+       acpi_buffer             buffer;
        u32                     i = 0;
 
        if (!context) {
                goto end;
        }
 
-       system = (SM_CONTEXT*)context;
+       system = (SM_CONTEXT*) context;
 
        /* don't get status more than once for a single proc read */
        if (off != 0) {
@@ -101,7 +191,7 @@ sm_osl_proc_read_info (
                p += sprintf(p, "ACPI-CA Version:         unknown\n");
        }
        else {
-               p += sprintf(p, "ACPI-CA Version:         %x\n", 
+               p += sprintf(p, "ACPI-CA Version:         %x\n",
                        system_info.acpi_ca_version);
        }
 
@@ -132,12 +222,12 @@ end:
 
 static ssize_t
 sm_osl_read_dsdt(
-       struct file             *file, 
-       char                    *buf, 
-       size_t                  count, 
+       struct file             *file,
+       char                    *buf,
+       size_t                  count,
        loff_t                  *ppos)
 {
-       ACPI_BUFFER             acpi_buf;
+       acpi_buffer             acpi_buf;
        void                    *data;
        size_t                  size = 0;
 
@@ -179,6 +269,459 @@ sm_osl_read_dsdt(
        return size;
 }
 
+static int
+sm_osl_proc_read_alarm (
+       char                    *page,
+       char                    **start,
+       off_t                   off,
+       int                     count,
+       int                     *eof,
+       void                    *context)
+{
+       char *str = page;
+       int len;
+       u32 sec,min,hr;
+       u32 day,mo,yr;
+
+       if (off != 0) goto out;
+
+       spin_lock(&rtc_lock);
+       sec = CMOS_READ(RTC_SECONDS_ALARM);
+       min = CMOS_READ(RTC_MINUTES_ALARM);
+       hr = CMOS_READ(RTC_HOURS_ALARM);
+
+#if 0
+       /* if I ever get an FACP with proper values, maybe I'll enable this code */
+       if (acpi_gbl_FADT->day_alrm)
+               day = CMOS_READ(acpi_gbl_FADT->day_alrm);
+       else
+               day =  CMOS_READ(RTC_DAY_OF_MONTH);
+       if (acpi_gbl_FADT->mon_alrm)
+               mo = CMOS_READ(acpi_gbl_FADT->mon_alrm);
+       else
+               mo = CMOS_READ(RTC_MONTH);;
+       if (acpi_gbl_FADT->century)
+               yr = CMOS_READ(acpi_gbl_FADT->century) * 100 + CMOS_READ(RTC_YEAR);
+       else
+               yr = CMOS_READ(RTC_YEAR);
+#else
+       day = CMOS_READ(RTC_DAY_OF_MONTH);
+       mo = CMOS_READ(RTC_MONTH);
+       yr = CMOS_READ(RTC_YEAR);
+#endif
+       spin_unlock(&rtc_lock);
+
+       BCD_TO_BIN(sec);
+       BCD_TO_BIN(min);
+       BCD_TO_BIN(hr);
+       BCD_TO_BIN(day);
+       BCD_TO_BIN(mo);
+       BCD_TO_BIN(yr);
+
+       str += sprintf(str,"%4.4u-",yr);
+
+       str += (mo > 12) ?
+               sprintf(str,"**-") :
+               sprintf(str,"%2.2u-",mo);
+
+       str += (day > 31) ?
+               sprintf(str,"** ") :
+               sprintf(str,"%2.2u ",day);
+
+       str += (hr > 23) ?
+               sprintf(str,"**:") :
+               sprintf(str,"%2.2u:",hr);
+
+       str += (min > 59) ?
+               sprintf(str,"**:") :
+               sprintf(str,"%2.2u:",min);
+
+       str += (sec > 59) ?
+               sprintf(str,"**\n") :
+               sprintf(str,"%2.2u\n",sec);
+
+ out:
+       len = str - page;
+
+       if (len < count) *eof = 1;
+       else if (len > count) len = count;
+
+       if (len < 0) len = 0;
+
+       *start = page;
+
+       return len;
+}
+
+static int get_date_field(char **str, u32 *value)
+{
+       char *next,*strend;
+       int error = -EINVAL;
+
+       /* try to find delimeter, only to insert null;
+        *  the end of string won't have one, but is still valid
+        */
+       next = strpbrk(*str,"- :");
+       if (next) *next++ = '\0';
+
+       *value = simple_strtoul(*str,&strend,10);
+
+       /* signal success if we got a good digit */
+       if (strend != *str) error = 0;
+
+       if (next) *str = next;
+       return error;
+}
+
+
+
+int sm_osl_proc_write_alarm (
+       struct file *file,
+       const char *buffer,
+       unsigned long count,
+       void *data)
+{
+       char buf[30];
+       char *str = buf;
+       u32 sec,min,hr;
+       u32 day,mo,yr;
+       int adjust = 0;
+       unsigned char rtc_control;
+       int error = -EINVAL;
+
+       if (count > sizeof(buf) - 1) return -EINVAL;
+       
+       if (copy_from_user(str,buffer,count)) return -EFAULT;
+
+       str[count] = '\0';
+       /* check for time adjustment */
+       if (str[0] == '+') {
+               str++;
+               adjust = 1;
+       }
+
+       if ((error = get_date_field(&str,&yr)))  goto out;
+       if ((error = get_date_field(&str,&mo)))  goto out;
+       if ((error = get_date_field(&str,&day))) goto out;
+       if ((error = get_date_field(&str,&hr)))  goto out;
+       if ((error = get_date_field(&str,&min))) goto out;
+       if ((error = get_date_field(&str,&sec))) goto out;
+
+
+       if (sec > 59) {
+               min += 1;
+               sec -= 60;
+       }
+       if (min > 59) {
+               hr += 1;
+               min -= 60;
+       } 
+       if (hr > 23) {
+               day += 1;
+               hr -= 24;
+       }
+       if (day > 31) { 
+               mo += 1;
+               day -= 31;
+       }
+       if (mo > 12) {
+               yr += 1;
+               mo -= 12;
+       }
+
+       spin_lock_irq(&rtc_lock);
+       rtc_control = CMOS_READ(RTC_CONTROL);
+       if (!(rtc_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
+               BIN_TO_BCD(yr);
+               BIN_TO_BCD(mo);
+               BIN_TO_BCD(day);
+               BIN_TO_BCD(hr);
+               BIN_TO_BCD(min);
+               BIN_TO_BCD(sec);
+       }
+
+       if (adjust) {
+               yr  += CMOS_READ(RTC_YEAR);
+               mo  += CMOS_READ(RTC_MONTH);
+               day += CMOS_READ(RTC_DAY_OF_MONTH);
+               hr  += CMOS_READ(RTC_HOURS);
+               min += CMOS_READ(RTC_MINUTES);
+               sec += CMOS_READ(RTC_SECONDS);
+       }
+       spin_unlock_irq(&rtc_lock);
+
+       if (!(rtc_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
+               BCD_TO_BIN(yr);
+               BCD_TO_BIN(mo);
+               BCD_TO_BIN(day);
+               BCD_TO_BIN(hr);
+               BCD_TO_BIN(min);
+               BCD_TO_BIN(sec);
+       }
+
+       if (sec > 59) {
+               min++;
+               sec -= 60;
+       }
+       if (min > 59) {
+               hr++;
+               min -= 60;
+       }
+       if (hr > 23) {
+               day++;
+               hr -= 24;
+       }
+       if (day > 31) {
+               mo++;
+               day -= 31;
+       }
+       if (mo > 12) {
+               yr++;
+               mo -= 12;
+       }
+       if (!(rtc_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
+               BIN_TO_BCD(yr);
+               BIN_TO_BCD(mo);
+               BIN_TO_BCD(day);
+               BIN_TO_BCD(hr);
+               BIN_TO_BCD(min);
+               BIN_TO_BCD(sec);
+       }
+
+       spin_lock_irq(&rtc_lock);
+       /* write the fields the rtc knows about */
+       CMOS_WRITE(hr,RTC_HOURS_ALARM);
+       CMOS_WRITE(min,RTC_MINUTES_ALARM);
+       CMOS_WRITE(sec,RTC_SECONDS_ALARM);
+
+       /* If the system supports an enhanced alarm, it will have non-zero
+        * offsets into the CMOS RAM here.
+        * Which for some reason are pointing to the RTC area of memory.
+        */
+#if 0
+       if (acpi_gbl_FADT->day_alrm) CMOS_WRITE(day,acpi_gbl_FADT->day_alrm);
+       if (acpi_gbl_FADT->mon_alrm) CMOS_WRITE(mo,acpi_gbl_FADT->mon_alrm);
+       if (acpi_gbl_FADT->century)  CMOS_WRITE(yr / 100,acpi_gbl_FADT->century);
+#endif
+       /* enable the rtc alarm interrupt */
+       if (!(rtc_control & RTC_AIE)) {
+               rtc_control |= RTC_AIE;
+               CMOS_WRITE(rtc_control,RTC_CONTROL);
+               CMOS_READ(RTC_INTR_FLAGS);
+       }
+
+       /* unlock the lock on the rtc now that we're done with it */
+       spin_unlock_irq(&rtc_lock);
+
+       acpi_hw_register_bit_access(ACPI_WRITE,ACPI_MTX_LOCK, RTC_EN, 1);
+
+       file->f_pos += count;
+
+       error = 0;
+ out:
+       return error ? error : count;
+}
+
+static int 
+sm_osl_proc_read_gpe(
+       char                    *page,
+       char                    **start,
+       off_t                   off,
+       int                     count,
+       int                     *eof,
+       void                    *context)
+{
+       char *str = page;
+       int size;
+       int length;
+       int i;
+       u32 addr,data;
+       
+       if (off) goto out;
+
+       if (acpi_gbl_FADT->V1_gpe0blk) {
+               length = acpi_gbl_FADT->gpe0blk_len / 2;
+
+               str += sprintf(str,"GPE0: ");
+
+               for (i = length; i > 0; i--) {
+                       addr = GPE0_EN_BLOCK | (i - 1);
+                       data = acpi_hw_register_read(ACPI_MTX_LOCK,addr);
+                       str += sprintf(str,"%2.2x ",data);
+               }
+               str += sprintf(str,"\n");
+
+               str += sprintf(str,"Status: ");
+               for (i = length; i > 0; i--) {
+                       addr = GPE0_STS_BLOCK | (i - 1);
+                       data = acpi_hw_register_read(ACPI_MTX_LOCK,addr);
+                       str += sprintf(str,"%2.2x ",data);
+               }
+               str += sprintf(str,"\n");
+       }
+
+       if (acpi_gbl_FADT->V1_gpe1_blk) {
+               length = acpi_gbl_FADT->gpe1_blk_len / 2;
+
+
+               str += sprintf(str,"GPE1: ");
+               for (i = length; i > 0; i--) {
+                       addr = GPE1_EN_BLOCK | (i - 1);
+                       data = acpi_hw_register_read(ACPI_MTX_LOCK,addr);
+                       str += sprintf(str,"%2.2x",data);
+               }
+               str += sprintf(str,"\n");
+
+               str += sprintf(str,"Status: ");
+               for (i = length; i > 0; i--) {
+                       addr = GPE1_STS_BLOCK | (i - 1);
+                       data = acpi_hw_register_read(ACPI_MTX_LOCK,addr);
+                       str += sprintf(str,"%2.2x",data);
+               }
+               str += sprintf(str,"\n");
+       }
+ out:
+       size = str - page;
+       if (size < count) *eof = 1;
+       else if (size > count) size = count;
+
+       if (size < 0) size = 0;
+       *start = page;
+
+       return size;
+}
+
+static int
+sm_osl_proc_write_gpe (
+       struct file *file,
+       const char *buffer,
+       unsigned long count,
+       void *data)
+{
+       char buf[256];
+       char *str = buf;
+       char *next;
+       int error = -EINVAL;
+       u32 addr,value = 0;
+
+       if (count > sizeof(buf) + 1) return -EINVAL;
+       
+       if (copy_from_user(str,buffer,count)) return -EFAULT;
+
+       str[count] = '\0';
+
+       /* set addr to which block to refer to */
+       if (!strncmp(str,"GPE0 ",5))      addr = GPE0_EN_BLOCK;
+       else if (!strncmp(str,"GPE1 ",5)) addr = GPE1_EN_BLOCK;
+       else goto out;
+
+       str += 5;
+
+       /* set low order bits to index of bit to set */
+       addr |= simple_strtoul(str,&next,0);
+       if (next == str) goto out;
+
+       if (next) {
+               str = ++next;
+               value = simple_strtoul(str,&next,0);
+               if (next == str) value = 1;
+       }
+
+       value = acpi_hw_register_bit_access(ACPI_WRITE,ACPI_MTX_LOCK,addr,(value ? 1 : 0));
+
+       error = 0;
+ out:
+       return error ? error : count;
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION:    sm_osl_suspend
+ *
+ * PARAMETERS:  %state: Sleep state to enter. Assumed that caller has filtered
+ *              out bogus values, so it's one of S1, S2, S3 or S4
+ *
+ * RETURN:      ACPI_STATUS, whether or not we successfully entered and
+ *              exited sleep.
+ *
+ * DESCRIPTION:
+ * This function is the meat of the sleep routine, as far as the ACPI-CA is
+ * concerned.
+ *
+ * See Chapter 9 of the ACPI 2.0 spec for details concerning the methodology here.
+ *
+ * It will do the following things:
+ * - Call arch-specific routines to save the processor and kernel state
+ * - Call acpi_enter_sleep_state to actually go to sleep
+ * ....
+ * When we wake back up, we will:
+ * - Restore the processor and kernel state
+ * - Return to the user
+ *
+ * By having this routine in here, it hides it from every part of the CA,
+ * so it can remain OS-independent. The only function that calls this is
+ * sm_proc_write_sleep, which gets the sleep state to enter from the user.
+ *
+ ****************************************************************************/
+static acpi_status
+sm_osl_suspend(u32 state)
+{
+       acpi_status status = AE_ERROR;
+       unsigned long wakeup_address;
+
+       /* get out if state is invalid */
+       if (state < ACPI_S1 || state > ACPI_S5) 
+               goto acpi_sleep_done;
+
+       /* make sure we don't get any suprises */
+       disable();
+
+       /* TODO: save device state and suspend them */
+       
+       /* save the processor state to memory if going into S2 or S3;
+        * save it to disk if going into S4.
+        * Also, set the FWV if going into an STR state
+        */
+       if (state == ACPI_S2 || state == ACPI_S3) {
+#ifdef DONT_USE_UNTIL_LOWLEVEL_CODE_EXISTS
+               wakeup_address = acpi_save_state_mem((unsigned long)&&acpi_sleep_done);
+
+               if (!wakeup_address) goto acpi_sleep_done;
+
+               acpi_set_firmware_waking_vector(
+                       (ACPI_PHYSICAL_ADDRESS)wakeup_address);
+#endif
+       } else if (state == ACPI_S4)
+#ifdef DONT_USE_UNTIL_LOWLEVEL_CODE_EXISTS
+               if (acpi_save_state_disk((unsigned long)&&acpi_sleep_done)) 
+                       goto acpi_sleep_done;
+#endif
+
+       /* set status, since acpi_enter_sleep_state won't return unless something
+        * goes wrong, or it's just S1.
+        */
+       status = AE_OK;
+
+       mdelay(10);
+       status = acpi_enter_sleep_state(state);
+
+ acpi_sleep_done:
+
+       /* pause for a bit to allow devices to come back on */
+       mdelay(10);
+
+       /* make sure that the firmware waking vector is reset */
+       acpi_set_firmware_waking_vector((ACPI_PHYSICAL_ADDRESS)0);
+
+       acpi_leave_sleep_state(state);
+
+       /* TODO: resume devices and restore their state */
+
+       enable();
+       return status;
+}
+
 
 /****************************************************************************
  *
@@ -189,10 +732,8 @@ sm_osl_read_dsdt(
 void
 sm_osl_power_down (void)
 {
-       ACPI_STATUS             status = AE_OK;
-
        /* Power down the system (S5 = soft off). */
-       status = acpi_enter_sleep_state(ACPI_STATE_S5);
+       sm_osl_suspend(ACPI_S5);
 }
 
 
@@ -202,7 +743,7 @@ sm_osl_power_down (void)
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 sm_osl_add_device(
        SM_CONTEXT              *system)
 {
@@ -223,13 +764,42 @@ sm_osl_add_device(
 
        if (system->states[ACPI_STATE_S5]) {
                sm_pm_power_off = pm_power_off;
-               pm_power_off = sm_osl_power_down; 
+               pm_power_off = sm_osl_power_down;
        }
 
-       create_proc_read_entry(SM_PROC_INFO, S_IRUGO, 
+       create_proc_read_entry(SM_PROC_INFO, S_IRUGO,
                sm_proc_root, sm_osl_proc_read_info, (void*)system);
 
-       /* 
+       bm_proc_sleep = create_proc_read_entry("sleep", S_IFREG | S_IRUGO | S_IWUSR,
+                                           sm_proc_root, sm_osl_proc_read_sleep, (void*)system);
+       if (bm_proc_sleep)
+               bm_proc_sleep->write_proc = sm_osl_proc_write_sleep;
+
+       bm_proc_alarm = create_proc_read_entry("alarm", S_IFREG | S_IRUGO | S_IWUSR,
+                                              sm_proc_root,sm_osl_proc_read_alarm, NULL);
+       if (bm_proc_alarm)
+               bm_proc_alarm->write_proc = sm_osl_proc_write_alarm;
+
+       bm_proc_gpe = create_proc_read_entry("gpe", S_IFREG | S_IRUGO | S_IWUSR,
+                                            sm_proc_root,sm_osl_proc_read_gpe,NULL);
+       if (bm_proc_gpe)
+               bm_proc_gpe->write_proc = sm_osl_proc_write_gpe;
+       
+       /*
+        * Get a wakeup address for use when we come back from sleep.
+        * At least on IA-32, this needs to be in low memory.
+        * When sleep is supported on other arch's, then we may want
+        * to move this out to another place, but GFP_LOW should suffice
+        * for now.
+        */
+#if 0
+       if (system->states[ACPI_S3] || system->states[ACPI_S4]) {
+               acpi_wakeup_address = (unsigned long)virt_to_phys(get_free_page(GFP_LOWMEM));
+               printk(KERN_INFO "ACPI: Have wakeup address 0x%8.8x\n",acpi_wakeup_address);
+       }
+#endif
+
+       /*
         * This returns more than a page, so we need to use our own file ops,
         * not proc's generic ones
         */
@@ -248,7 +818,7 @@ sm_osl_add_device(
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 sm_osl_remove_device (
        SM_CONTEXT              *system)
 {
@@ -269,12 +839,12 @@ sm_osl_remove_device (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 sm_osl_generate_event (
        u32                     event,
        SM_CONTEXT              *system)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
 
        if (!system) {
                return(AE_BAD_PARAMETER);
@@ -303,10 +873,14 @@ sm_osl_generate_event (
  *
  ****************************************************************************/
 
-static int __init 
+static int __init
 sm_osl_init (void)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+       /* abort if no busmgr */
+       if (!bm_proc_root)
+               return -ENODEV;
 
        sm_proc_root = bm_proc_root;
        if (!sm_proc_root) {
@@ -332,7 +906,7 @@ sm_osl_init (void)
  *
  ****************************************************************************/
 
-static void __exit 
+static void __exit
 sm_osl_cleanup (void)
 {
        sm_terminate();
index ad0d3a158014a764813447e6f43ee02a9d6ab387..cb0d5def09fd2c6cd5a68df658ce928866701ee4 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  *
  * Module Name: tz.c
- *   $Revision: 38 $
+ *   $Revision: 40 $
  *
  *****************************************************************************/
 
@@ -58,6 +58,69 @@ void
 tz_print (
        TZ_CONTEXT              *thermal_zone)
 {
+#ifdef ACPI_DEBUG
+       acpi_buffer             buffer;
+       u32                     i,j = 0;
+       TZ_THRESHOLD            *threshold = NULL;
+
+       PROC_NAME("tz_print");
+
+       if (!thermal_zone) {
+               return;
+       }
+
+       buffer.length = 256;
+       buffer.pointer = acpi_os_callocate(buffer.length);
+       if (!buffer.pointer) {
+               return;
+       }
+
+       /*
+        * Get the full pathname for this ACPI object.
+        */
+       acpi_get_name(thermal_zone->acpi_handle, ACPI_FULL_PATHNAME, &buffer);
+
+       /*
+        * Print out basic thermal zone information.
+        */
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| Thermal_zone[%02x]:[%p] %s\n", thermal_zone->device_handle, thermal_zone->acpi_handle, buffer.pointer));
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "|   temperature[%d] state[%08x]\n", thermal_zone->policy.temperature, thermal_zone->policy.state));
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "|   cooling_mode[%08x] polling_freq[%d]\n", thermal_zone->policy.cooling_mode, thermal_zone->policy.polling_freq));
+
+       for (i=0; i<thermal_zone->policy.threshold_list.count; i++) {
+
+               threshold = &(thermal_zone->policy.threshold_list.thresholds[i]);
+
+               switch (threshold->type) {
+               case TZ_THRESHOLD_CRITICAL:
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "|   critical[%d]\n", threshold->temperature));
+                       break;
+               case TZ_THRESHOLD_PASSIVE:
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "|   passive[%d]: tc1[%d] tc2[%d] tsp[%d]\n", threshold->temperature, thermal_zone->policy.passive.tc1, thermal_zone->policy.passive.tc2, thermal_zone->policy.passive.tsp));
+                       break;
+               case TZ_THRESHOLD_ACTIVE:
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "|   active[%d]: index[%d]\n", threshold->temperature, threshold->index));
+                       break;
+               default:
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "|   unknown[%d]\n", threshold->temperature));
+                       break;
+               }
+
+               if (threshold->cooling_devices.count > 0) {
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "|     cooling_devices"));
+                       for (j=0; (j<threshold->cooling_devices.count && j<10); j++) {
+                               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "[%02x]", threshold->cooling_devices.handles[j]));
+                       }
+                       
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\n"));
+               }
+       }
+
+       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
+
+       acpi_os_free(buffer.pointer);
+#endif /*ACPI_DEBUG*/
 
        return;
 }
@@ -75,15 +138,17 @@ tz_print (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 tz_get_temperature (
        TZ_CONTEXT              *thermal_zone,
        u32                     *temperature)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+       FUNCTION_TRACE("tz_get_temperature");
 
        if (!thermal_zone || !temperature) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /*
@@ -92,7 +157,7 @@ tz_get_temperature (
        status = bm_evaluate_simple_integer(thermal_zone->acpi_handle,
                "_TMP", temperature);
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -108,29 +173,31 @@ tz_get_temperature (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 tz_set_cooling_preference (
        TZ_CONTEXT              *thermal_zone,
        TZ_COOLING_MODE         cooling_mode)
 {
-       ACPI_STATUS             status = AE_OK;
-       ACPI_OBJECT_LIST        arg_list;
-       ACPI_OBJECT             arg0;
+       acpi_status             status = AE_OK;
+       acpi_object_list        arg_list;
+       acpi_object             arg0;
+
+       FUNCTION_TRACE("tz_set_cooling_preference");
 
        if (!thermal_zone || ((cooling_mode != TZ_COOLING_MODE_ACTIVE) &&
                (cooling_mode != TZ_COOLING_MODE_PASSIVE))) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /*
         * Build the argument list, which simply consists of the current
         * cooling preference.
         */
-       MEMSET(&arg_list, 0, sizeof(ACPI_OBJECT));
+       MEMSET(&arg_list, 0, sizeof(acpi_object));
        arg_list.count = 1;
        arg_list.pointer = &arg0;
 
-       MEMSET(&arg0, 0, sizeof(ACPI_OBJECT));
+       MEMSET(&arg0, 0, sizeof(acpi_object));
        arg0.type = ACPI_TYPE_INTEGER;
        arg0.integer.value = cooling_mode;
 
@@ -140,7 +207,7 @@ tz_set_cooling_preference (
        status = acpi_evaluate_object(thermal_zone->acpi_handle, "_SCP",
                &arg_list, NULL);
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -156,15 +223,17 @@ tz_set_cooling_preference (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 tz_get_single_threshold (
        TZ_CONTEXT              *thermal_zone,
        TZ_THRESHOLD            *threshold)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+       FUNCTION_TRACE("tz_get_single_threshold");
 
        if (!thermal_zone || !threshold) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        switch (threshold->type) {
@@ -229,7 +298,7 @@ tz_get_single_threshold (
                break;
        }
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -240,7 +309,7 @@ tz_get_single_threshold (
  * PARAMETERS:  thermal_zone          - Identifies the thermal zone to parse.
  *              buffer      - Output buffer.
  *
- * RETURN:      ACPI_STATUS result code.
+ * RETURN:      acpi_status result code.
  *
  * DESCRIPTION: Builds a TZ_THRESHOLD_LIST structure containing information
  *              on all thresholds for a given thermal zone.
@@ -250,21 +319,23 @@ tz_get_single_threshold (
  *              This simplifies parsing of thresholds by allowing a maximum
  *              threshold list size to be computed (and enforced) -- which
  *              allows all thresholds to be parsed in a single pass (since
- *              memory must be contiguous when returned in the ACPI_BUFFER).
+ *              memory must be contiguous when returned in the acpi_buffer).
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 tz_get_thresholds (
        TZ_CONTEXT              *thermal_zone,
        TZ_THRESHOLD_LIST       *threshold_list)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        TZ_THRESHOLD            *threshold = NULL;
        u32                     i = 0;
 
+       FUNCTION_TRACE("tz_get_thresholds");
+
        if (!thermal_zone || !threshold_list) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        threshold_list->count = 0;
@@ -282,7 +353,7 @@ tz_get_thresholds (
                (threshold_list->count)++;
        }
        else {
-               return(status);
+               return_ACPI_STATUS(status);
        }
 
 
@@ -323,7 +394,7 @@ tz_get_thresholds (
                }
        }
 
-       return(AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
 
@@ -339,19 +410,24 @@ tz_get_thresholds (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 tz_add_device (
        BM_HANDLE               device_handle,
        void                    **context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        TZ_CONTEXT              *thermal_zone = NULL;
        BM_DEVICE               *device = NULL;
-       ACPI_HANDLE             tmp_handle = NULL;
+       acpi_handle             tmp_handle = NULL;
        static u32              zone_count = 0;
 
+       FUNCTION_TRACE("tz_add_device");
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Adding thermal zone [%02x].\n", device_handle));
+
        if (!context || *context) {
-               return(AE_BAD_PARAMETER);
+               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Invalid context for device [%02x].\n", device_handle));
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /*
@@ -359,7 +435,7 @@ tz_add_device (
         */
        status = bm_get_device_info(device_handle, &device);
        if (ACPI_FAILURE(status)) {
-               return(status);
+               return_ACPI_STATUS(status);
        }
 
        /*
@@ -410,7 +486,7 @@ end:
                acpi_os_free(thermal_zone);
        }
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -426,19 +502,23 @@ end:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 tz_remove_device (
        void                    **context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        TZ_CONTEXT              *thermal_zone = NULL;
 
+       FUNCTION_TRACE("tz_remove_device");
+
        if (!context || !*context) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        thermal_zone = (TZ_CONTEXT*)(*context);
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing thermal zone [%02x].\n", thermal_zone->device_handle));
+
        status = tz_osl_remove_device(thermal_zone);
 
        /*
@@ -448,12 +528,12 @@ tz_remove_device (
         */
        status = tz_policy_remove_device(thermal_zone);
        if (ACPI_FAILURE(status)) {
-               return(status);
+               return_ACPI_STATUS(status);
        }
 
        acpi_os_free(thermal_zone);
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -473,13 +553,15 @@ tz_remove_device (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 tz_initialize (void)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_DEVICE_ID            criteria;
        BM_DRIVER               driver;
 
+       FUNCTION_TRACE("tz_initialize");
+
        MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
        MEMSET(&driver, 0, sizeof(BM_DRIVER));
 
@@ -493,7 +575,7 @@ tz_initialize (void)
 
        status = bm_register_driver(&criteria, &driver);
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -509,13 +591,15 @@ tz_initialize (void)
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 tz_terminate (void)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        BM_DEVICE_ID            criteria;
        BM_DRIVER               driver;
 
+       FUNCTION_TRACE("tz_terminate");
+
        MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
        MEMSET(&driver, 0, sizeof(BM_DRIVER));
 
@@ -529,7 +613,7 @@ tz_terminate (void)
 
        status = bm_unregister_driver(&criteria, &driver);
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -544,17 +628,19 @@ tz_terminate (void)
  * DESCRIPTION:
  *
  ****************************************************************************/
-ACPI_STATUS
+acpi_status
 tz_notify (
        BM_NOTIFY               notify_type,
        BM_HANDLE               device_handle,
        void                    **context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        TZ_CONTEXT              *thermal_zone = NULL;
 
+       FUNCTION_TRACE("tz_notify");
+
        if (!context) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        thermal_zone = (TZ_CONTEXT*)*context;
@@ -570,6 +656,7 @@ tz_notify (
                break;
 
        case TZ_NOTIFY_TEMPERATURE_CHANGE:
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Temperature (_TMP) change event detected.\n"));
                /* -------------------------------------------- */
                /* TBD: Remove when policy moves to user-mode. */
                tz_policy_check(*context);
@@ -583,6 +670,7 @@ tz_notify (
                break;
 
        case TZ_NOTIFY_THRESHOLD_CHANGE:
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Threshold (_SCP) change event detected.\n"));
                /* -------------------------------------------- */
                /* TBD: Remove when policy moves to user-mode. */
                status = tz_policy_remove_device(thermal_zone);
@@ -594,6 +682,7 @@ tz_notify (
                break;
 
        case TZ_NOTIFY_DEVICE_LISTS_CHANGE:
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Device lists (_ALx, _PSL, _TZD) change event detected.\n"));
                /* -------------------------------------------- */
                /* TBD: Remove when policy moves to user-mode. */
                status = tz_policy_remove_device(thermal_zone);
@@ -609,7 +698,7 @@ tz_notify (
                break;
        }
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -625,19 +714,21 @@ tz_notify (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 tz_request (
        BM_REQUEST              *request,
        void                    *context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        TZ_CONTEXT              *thermal_zone = NULL;
 
+       FUNCTION_TRACE("tz_request");
+
        /*
         * Must have a valid request structure and context.
         */
        if (!request || !context) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        thermal_zone = (TZ_CONTEXT*)context;
@@ -655,5 +746,5 @@ tz_request (
 
        request->status = status;
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
index 6ed5835c89336c096f5d9075f83a230f35b9f216..88c7cdf4100a4958452de7a51394315ff0c8b8df 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: tz_osl.c
- *   $Revision: 18 $
+ *   $Revision: 21 $
  *
  *****************************************************************************/
 
@@ -51,18 +51,18 @@ static struct proc_dir_entry        *tz_proc_root = NULL;
 
 
 /****************************************************************************
- * 
+ *
  * FUNCTION:   tz_osl_proc_read_info
  *
  ****************************************************************************/
 
 static int
 tz_osl_proc_read_info (
-       char                    *page, 
-       char                    **start, 
-       off_t                   off, 
-       int                     count, 
-       int                     *eof, 
+       char                    *page,
+       char                    **start,
+       off_t                   off,
+       int                     count,
+       int                     *eof,
        void                    *context)
 {
        TZ_CONTEXT              *thermal_zone = NULL;
@@ -90,18 +90,18 @@ end:
 
 
 /****************************************************************************
- * 
+ *
  * FUNCTION:   tz_osl_proc_read_status
  *
  ****************************************************************************/
 
 static int
 tz_osl_proc_read_status (
-       char                    *page, 
-       char                    **start, 
-       off_t                   off, 
-       int                     count, 
-       int                     *eof, 
+       char                    *page,
+       char                    **start,
+       off_t                   off,
+       int                     count,
+       int                     *eof,
        void                    *context)
 {
        TZ_CONTEXT              *thermal_zone = NULL;
@@ -114,7 +114,7 @@ tz_osl_proc_read_status (
 
        thermal_zone = (TZ_CONTEXT*)context;
 
-       p += sprintf(p, "Temperature:             %d (1/10th degrees Kelvin)\n", 
+       p += sprintf(p, "Temperature:             %d (1/10th degrees Kelvin)\n",
                thermal_zone->policy.temperature);
 
        p += sprintf(p, "State:                   ");
@@ -173,7 +173,7 @@ end:
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 tz_osl_add_device(
        TZ_CONTEXT              *thermal_zone)
 {
@@ -190,10 +190,10 @@ tz_osl_add_device(
                return(AE_ERROR);
        }
 
-       create_proc_read_entry(TZ_PROC_STATUS, S_IFREG | S_IRUGO, 
+       create_proc_read_entry(TZ_PROC_STATUS, S_IFREG | S_IRUGO,
                proc_entry, tz_osl_proc_read_status, (void*)thermal_zone);
 
-       create_proc_read_entry(TZ_PROC_INFO, S_IFREG | S_IRUGO, 
+       create_proc_read_entry(TZ_PROC_INFO, S_IFREG | S_IRUGO,
                proc_entry, tz_osl_proc_read_info, (void*)thermal_zone);
 
        return(AE_OK);
@@ -206,7 +206,7 @@ tz_osl_add_device(
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 tz_osl_remove_device (
        TZ_CONTEXT              *thermal_zone)
 {
@@ -235,12 +235,12 @@ tz_osl_remove_device (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 tz_osl_generate_event (
        u32                     event,
        TZ_CONTEXT              *thermal_zone)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
 
        if (!thermal_zone) {
                return(AE_BAD_PARAMETER);
@@ -249,14 +249,14 @@ tz_osl_generate_event (
        switch (event) {
 
        case TZ_NOTIFY_TEMPERATURE_CHANGE:
-               status = bm_osl_generate_event(thermal_zone->device_handle, 
-                       TZ_PROC_ROOT, thermal_zone->uid, event, 
+               status = bm_osl_generate_event(thermal_zone->device_handle,
+                       TZ_PROC_ROOT, thermal_zone->uid, event,
                        thermal_zone->policy.temperature);
                break;
 
        case TZ_NOTIFY_THRESHOLD_CHANGE:
        case TZ_NOTIFY_DEVICE_LISTS_CHANGE:
-               status = bm_osl_generate_event(thermal_zone->device_handle, 
+               status = bm_osl_generate_event(thermal_zone->device_handle,
                        TZ_PROC_ROOT, thermal_zone->uid, event, 0);
                break;
 
@@ -281,10 +281,14 @@ tz_osl_generate_event (
  *
  ****************************************************************************/
 
-static int __init 
+static int __init
 tz_osl_init (void)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+       /* abort if no busmgr */
+       if (!bm_proc_root)
+               return -ENODEV;
 
        tz_proc_root = proc_mkdir(TZ_PROC_ROOT, bm_proc_root);
        if (!tz_proc_root) {
@@ -314,7 +318,7 @@ tz_osl_init (void)
  *
  ****************************************************************************/
 
-static void __exit 
+static void __exit
 tz_osl_cleanup (void)
 {
        tz_terminate();
index f47c9600c5e148b2ada9311dda04c5ab42f5620a..54b56a120f786dd683e4aed070a4b27bdcf2eea5 100644 (file)
@@ -1,7 +1,7 @@
 /****************************************************************************
  *
  * Module Name: tzpolicy.c -
- *   $Revision: 27 $
+ *   $Revision: 28 $
  *
  ****************************************************************************/
 
@@ -59,12 +59,12 @@ tz_policy_run (
  *                              Internal Functions
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 set_performance_limit (
        BM_HANDLE               device_handle,
        u32                     flag)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
        BM_REQUEST              request;
 
        request.status = AE_OK;
@@ -96,20 +96,23 @@ set_performance_limit (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 tz_policy_critical(
        TZ_CONTEXT              *tz)
 {
+       FUNCTION_TRACE("tz_policy_critical");
+
        if (!tz || !tz->policy.critical.threshold) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        if (tz->policy.temperature >=
                tz->policy.critical.threshold->temperature) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Critical threshold reached - shutting down system.\n"));
                /* TBD: Need method for calling 'halt' - OSL function? */
        }
 
-       return(AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
 
@@ -125,7 +128,7 @@ tz_policy_critical(
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 tz_policy_passive(
        TZ_CONTEXT              *tz)
 {
@@ -134,8 +137,10 @@ tz_policy_passive(
        s32                     trend = 0;
        u32                     i = 0;
 
+       FUNCTION_TRACE("tz_policy_passive");
+
        if (!tz || !tz->policy.passive.threshold) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        passive = &(tz->policy.passive);
@@ -153,6 +158,11 @@ tz_policy_passive(
                        passive->tc2 *
                        (tz->policy.temperature - passive->threshold->temperature);
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "trend[%d] = TC1[%d]*(temp[%d]-last[%d]) + TC2[%d]*(temp[%d]-passive[%d])\n",
+                       trend, passive->tc1, tz->policy.temperature,
+                       last_temperature, passive->tc2, tz->policy.temperature,
+                       passive->threshold->temperature));
+
                last_temperature = tz->policy.temperature;
 
                /*
@@ -183,7 +193,7 @@ tz_policy_passive(
                }
        }
 
-       return(AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
 
@@ -199,16 +209,18 @@ tz_policy_passive(
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 tz_policy_active(
        TZ_CONTEXT              *tz)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        TZ_THRESHOLD            *active = NULL;
        u32                     i,j = 0;
 
+       FUNCTION_TRACE("tz_policy_active");
+
        if (!tz || !tz->policy.active.threshold) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        for (i = 0; i < TZ_MAX_ACTIVE_THRESHOLDS; i++) {
@@ -234,8 +246,10 @@ tz_policy_active(
                                        ACPI_STATE_D0);
 
                                if (ACPI_SUCCESS(status)) {
+                                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Cooling device [%02x] now ON.\n", active->cooling_devices.handles[j]));
                                }
                                else {
+                                       ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Unable to turn ON cooling device [%02x].\n", active->cooling_devices.handles[j]));
                                }
                        }
 
@@ -259,8 +273,10 @@ tz_policy_active(
                                        ACPI_STATE_D3);
 
                                if (ACPI_SUCCESS(status)) {
+                                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Cooling device [%02x] now OFF.\n", active->cooling_devices.handles[j]));
                                }
                                else {
+                                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Unable to turn OFF cooling device [%02x].\n", active->cooling_devices.handles[j]));
                                }
                        }
 
@@ -268,7 +284,7 @@ tz_policy_active(
                }
        }
 
-       return(AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
 
@@ -290,7 +306,7 @@ void
 tz_policy_check (
        void                    *context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        TZ_CONTEXT              *tz = NULL;
        u32                     previous_temperature = 0;
        u32                     previous_state = 0;
@@ -298,8 +314,11 @@ tz_policy_check (
        u32                     i = 0;
        u32                     sleep_time = 0;
 
+       FUNCTION_TRACE("tz_policy_check");
+
        if (!context) {
-               return;
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid (NULL) context.\n"));
+               return_VOID;
        }
 
        tz = (TZ_CONTEXT*)context;
@@ -317,7 +336,7 @@ tz_policy_check (
         */
        status = tz_get_temperature(tz, &(tz->policy.temperature));
        if (ACPI_FAILURE(status)) {
-               return;
+               return_VOID;
        }
 
        /*
@@ -391,6 +410,10 @@ tz_policy_check (
                sleep_time = WAIT_FOREVER;
        }
 
+#ifdef ACPI_DEBUG
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Thermal_zone[%02x]: temperature[%d] state[%08x]\n", tz->device_handle, tz->policy.temperature, tz->policy.state));
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Scheduling next poll in [%d]ms.\n", sleep_time));
+#endif /*ACPI_DEBUG*/
 
        /*
         * Schedule Next Poll:
@@ -415,7 +438,7 @@ tz_policy_check (
                }
        }
 
-       return;
+       return_VOID;
 }
 
 
@@ -435,10 +458,13 @@ void
 tz_policy_run (
        unsigned long           data)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+       FUNCTION_TRACE("tz_policy_run");
 
        if (!data) {
-               return;
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid (NULL) context.\n"));
+               return_VOID;
        }
 
        /*
@@ -449,9 +475,10 @@ tz_policy_run (
        status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE,
                tz_policy_check, (void*)data);
        if (ACPI_FAILURE(status)) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Error invoking thermal policy.\n"));
        }
 
-       return;
+       return_VOID;
 }
 
 
@@ -467,18 +494,22 @@ tz_policy_run (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 tz_policy_add_device (
        TZ_CONTEXT              *tz)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        TZ_THRESHOLD            *threshold = NULL;
        u32                     i,j = 0;
 
+       FUNCTION_TRACE("tz_policy_add_device");
+
        if (!tz) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Adding policy for thermal zone [%02x].\n", tz->device_handle));
+
        /*
         * Temperature:
         * ------------
@@ -487,7 +518,7 @@ tz_policy_add_device (
         */
        status = tz_get_temperature(tz, &(tz->policy.temperature));
        if (ACPI_FAILURE(status)) {
-               return(status);
+               return_ACPI_STATUS(status);
        }
 
        /*
@@ -511,7 +542,7 @@ tz_policy_add_device (
         */
        status = tz_get_thresholds(tz, &(tz->policy.threshold_list));
        if (ACPI_FAILURE(status)) {
-               return(status);
+               return_ACPI_STATUS(status);
        }
 
        /*
@@ -575,7 +606,7 @@ tz_policy_add_device (
        }
 
        if (ACPI_FAILURE(status)) {
-               return(status);
+               return_ACPI_STATUS(status);
        }
 
        /*
@@ -592,7 +623,7 @@ tz_policy_add_device (
         */
        tz_policy_check(tz);
 
-       return(status);
+       return_ACPI_STATUS(status);
 }
 
 
@@ -608,16 +639,20 @@ tz_policy_add_device (
  *
  ****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 tz_policy_remove_device(
        TZ_CONTEXT              *tz)
 {
        u32                     i = 0;
 
+       FUNCTION_TRACE("tz_remove_device");
+
        if (!tz) {
-               return(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing policy for thermal zone [%02x].\n", tz->device_handle));
+
        /*
         * Delete the thermal zone policy timer entry, if exists.
         */
@@ -636,5 +671,5 @@ tz_policy_remove_device(
                }
        }
 
-       return(AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
index 23443842a8fadbc8b485cebc2ceee41b455d2342..0b2511d9b7dc7570404230c4539b546b6c0653a9 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: psargs - Parse AML opcode arguments
- *              $Revision: 47 $
+ *              $Revision: 51 $
  *
  *****************************************************************************/
 
 
 u32
 acpi_ps_get_next_package_length (
-       ACPI_PARSE_STATE        *parser_state)
+       acpi_parse_state        *parser_state)
 {
        u32                     encoded_length;
        u32                     length = 0;
 
 
+       FUNCTION_TRACE ("Ps_get_next_package_length");
+
+
        encoded_length = (u32) GET8 (parser_state->aml);
        parser_state->aml++;
 
@@ -92,7 +95,7 @@ acpi_ps_get_next_package_length (
                break;
        }
 
-       return (length);
+       return_VALUE (length);
 }
 
 
@@ -111,15 +114,18 @@ acpi_ps_get_next_package_length (
 
 u8 *
 acpi_ps_get_next_package_end (
-       ACPI_PARSE_STATE        *parser_state)
+       acpi_parse_state        *parser_state)
 {
        u8                      *start = parser_state->aml;
        NATIVE_UINT             length;
 
 
+       FUNCTION_TRACE ("Ps_get_next_package_end");
+
+
        length = (NATIVE_UINT) acpi_ps_get_next_package_length (parser_state);
 
-       return (start + length); /* end of package */
+       return_PTR (start + length); /* end of package */
 }
 
 
@@ -140,13 +146,16 @@ acpi_ps_get_next_package_end (
 
 NATIVE_CHAR *
 acpi_ps_get_next_namestring (
-       ACPI_PARSE_STATE        *parser_state)
+       acpi_parse_state        *parser_state)
 {
        u8                       *start = parser_state->aml;
        u8                       *end = parser_state->aml;
        u32                     length;
 
 
+       FUNCTION_TRACE ("Ps_get_next_namestring");
+
+
        /* Handle multiple prefix characters */
 
        while (acpi_ps_is_prefix_char (GET8 (end))) {
@@ -197,7 +206,7 @@ acpi_ps_get_next_namestring (
 
        parser_state->aml = (u8*) end;
 
-       return ((NATIVE_CHAR *) start);
+       return_PTR ((NATIVE_CHAR *) start);
 }
 
 
@@ -227,15 +236,18 @@ acpi_ps_get_next_namestring (
 
 void
 acpi_ps_get_next_namepath (
-       ACPI_PARSE_STATE        *parser_state,
-       ACPI_PARSE_OBJECT       *arg,
+       acpi_parse_state        *parser_state,
+       acpi_parse_object       *arg,
        u32                     *arg_count,
        u8                      method_call)
 {
        NATIVE_CHAR             *path;
-       ACPI_PARSE_OBJECT       *name_op;
-       ACPI_PARSE_OBJECT       *op;
-       ACPI_PARSE_OBJECT       *count;
+       acpi_parse_object       *name_op;
+       acpi_parse_object       *op;
+       acpi_parse_object       *count;
+
+
+       FUNCTION_TRACE ("Ps_get_next_namepath");
 
 
        path = acpi_ps_get_next_namestring (parser_state);
@@ -244,7 +256,7 @@ acpi_ps_get_next_namepath (
 
                acpi_ps_init_op (arg, AML_INT_NAMEPATH_OP);
                arg->value.name = path;
-               return;
+               return_VOID;
        }
 
 
@@ -252,7 +264,6 @@ acpi_ps_get_next_namepath (
                /*
                 * Lookup the name in the parsed namespace
                 */
-
                op = NULL;
                if (method_call) {
                        op = acpi_ps_find (acpi_ps_get_parent_scope (parser_state),
@@ -267,7 +278,6 @@ acpi_ps_get_next_namepath (
                                 * associated with this method, and 2) Change the NAMEPATH
                                 * object into a METHODCALL object.
                                 */
-
                                count = acpi_ps_get_arg (op, 0);
                                if (count && count->opcode == AML_BYTE_OP) {
                                        name_op = acpi_ps_alloc_op (AML_INT_NAMEPATH_OP);
@@ -280,15 +290,15 @@ acpi_ps_get_next_namepath (
 
                                                /* Point METHODCALL/NAME to the METHOD Node */
 
-                                               name_op->node = (ACPI_NAMESPACE_NODE *) op;
+                                               name_op->node = (acpi_namespace_node *) op;
                                                acpi_ps_append_arg (arg, name_op);
 
-                                               *arg_count = count->value.integer &
+                                               *arg_count = (u32) count->value.integer &
                                                                 METHOD_FLAGS_ARG_COUNT;
                                        }
                                }
 
-                               return;
+                               return_VOID;
                        }
 
                        /*
@@ -299,18 +309,16 @@ acpi_ps_get_next_namepath (
                }
        }
 
-
        /*
         * Either we didn't find the object in the namespace, or the object is
         * something other than a control method.  Just initialize the Op with the
         * pathname
         */
-
        acpi_ps_init_op (arg, AML_INT_NAMEPATH_OP);
        arg->value.name = path;
 
 
-       return;
+       return_VOID;
 }
 
 
@@ -319,17 +327,20 @@ acpi_ps_get_next_namepath (
 
 void
 acpi_ps_get_next_namepath (
-       ACPI_PARSE_STATE        *parser_state,
-       ACPI_PARSE_OBJECT       *arg,
+       acpi_parse_state        *parser_state,
+       acpi_parse_object       *arg,
        u32                     *arg_count,
        u8                      method_call)
 {
        NATIVE_CHAR             *path;
-       ACPI_PARSE_OBJECT       *name_op;
-       ACPI_STATUS             status;
-       ACPI_NAMESPACE_NODE     *method_node = NULL;
-       ACPI_NAMESPACE_NODE     *node;
-       ACPI_GENERIC_STATE      scope_info;
+       acpi_parse_object       *name_op;
+       acpi_status             status;
+       acpi_namespace_node     *method_node = NULL;
+       acpi_namespace_node     *node;
+       acpi_generic_state      scope_info;
+
+
+       FUNCTION_TRACE ("Ps_get_next_namepath");
 
 
        path = acpi_ps_get_next_namestring (parser_state);
@@ -338,7 +349,7 @@ acpi_ps_get_next_namepath (
 
                acpi_ps_init_op (arg, AML_INT_NAMEPATH_OP);
                arg->value.name = path;
-               return;
+               return_VOID;
        }
 
 
@@ -358,13 +369,15 @@ acpi_ps_get_next_namepath (
                 * parent tree, but don't open a new scope -- we just want to lookup the
                 * object  (MUST BE mode EXECUTE to perform upsearch)
                 */
-
                status = acpi_ns_lookup (&scope_info, path, ACPI_TYPE_ANY, IMODE_EXECUTE,
                                 NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE, NULL,
                                 &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 */
@@ -378,14 +391,14 @@ acpi_ps_get_next_namepath (
                                        name_op->node = method_node;
                                        acpi_ps_append_arg (arg, name_op);
 
-                                       if (!(ACPI_OPERAND_OBJECT  *) method_node->object) {
-                                               return;
+                                       if (!(acpi_operand_object  *) method_node->object) {
+                                               return_VOID;
                                        }
 
-                                       *arg_count = ((ACPI_OPERAND_OBJECT *) method_node->object)->method.param_count;
+                                       *arg_count = ((acpi_operand_object *) method_node->object)->method.param_count;
                                }
 
-                               return;
+                               return_VOID;
                        }
 
                        /*
@@ -401,12 +414,11 @@ acpi_ps_get_next_namepath (
         * something other than a control method.  Just initialize the Op with the
         * pathname.
         */
-
        acpi_ps_init_op (arg, AML_INT_NAMEPATH_OP);
        arg->value.name = path;
 
 
-       return;
+       return_VOID;
 }
 
 #endif
@@ -427,11 +439,13 @@ acpi_ps_get_next_namepath (
 
 void
 acpi_ps_get_next_simple_arg (
-       ACPI_PARSE_STATE        *parser_state,
+       acpi_parse_state        *parser_state,
        u32                     arg_type,
-       ACPI_PARSE_OBJECT       *arg)
+       acpi_parse_object       *arg)
 {
 
+       FUNCTION_TRACE_U32 ("Ps_get_next_simple_arg", arg_type);
+
 
        switch (arg_type) {
 
@@ -465,6 +479,17 @@ acpi_ps_get_next_simple_arg (
                break;
 
 
+       case ARGP_QWORDDATA:
+
+               acpi_ps_init_op (arg, AML_QWORD_OP);
+
+               /* Get 8 bytes from the AML stream */
+
+               MOVE_UNALIGNED64_TO_64 (&arg->value.integer, parser_state->aml);
+               parser_state->aml += 8;
+               break;
+
+
        case ARGP_CHARLIST:
 
                acpi_ps_init_op (arg, AML_STRING_OP);
@@ -485,7 +510,7 @@ acpi_ps_get_next_simple_arg (
                break;
        }
 
-       return;
+       return_VOID;
 }
 
 
@@ -501,17 +526,20 @@ acpi_ps_get_next_simple_arg (
  *
  ******************************************************************************/
 
-ACPI_PARSE_OBJECT *
+acpi_parse_object *
 acpi_ps_get_next_field (
-       ACPI_PARSE_STATE        *parser_state)
+       acpi_parse_state        *parser_state)
 {
        u32                     aml_offset = parser_state->aml -
                         parser_state->aml_start;
-       ACPI_PARSE_OBJECT       *field;
+       acpi_parse_object       *field;
        u16                     opcode;
        u32                     name;
 
 
+       FUNCTION_TRACE ("Ps_get_next_field");
+
+
        /* determine field type */
 
        switch (GET8 (parser_state->aml)) {
@@ -579,7 +607,7 @@ acpi_ps_get_next_field (
                }
        }
 
-       return (field);
+       return_PTR (field);
 }
 
 
@@ -599,18 +627,21 @@ acpi_ps_get_next_field (
  *
  ******************************************************************************/
 
-ACPI_PARSE_OBJECT *
+acpi_parse_object *
 acpi_ps_get_next_arg (
-       ACPI_PARSE_STATE        *parser_state,
+       acpi_parse_state        *parser_state,
        u32                     arg_type,
        u32                     *arg_count)
 {
-       ACPI_PARSE_OBJECT       *arg = NULL;
-       ACPI_PARSE_OBJECT       *prev = NULL;
-       ACPI_PARSE_OBJECT       *field;
+       acpi_parse_object       *arg = NULL;
+       acpi_parse_object       *prev = NULL;
+       acpi_parse_object       *field;
        u32                     subop;
 
 
+       FUNCTION_TRACE_PTR ("Ps_get_next_arg", parser_state);
+
+
        switch (arg_type) {
        case ARGP_BYTEDATA:
        case ARGP_WORDDATA:
@@ -675,7 +706,7 @@ acpi_ps_get_next_arg (
                                /* fill in bytelist data */
 
                                arg->value.size = (parser_state->pkg_end - parser_state->aml);
-                               ((ACPI_PARSE2_OBJECT *) arg)->data = parser_state->aml;
+                               ((acpi_parse2_object *) arg)->data = parser_state->aml;
                        }
 
                        /* skip to End of byte data */
@@ -729,5 +760,5 @@ acpi_ps_get_next_arg (
                break;
        }
 
-       return (arg);
+       return_PTR (arg);
 }
diff --git a/drivers/acpi/parser/psfind.c b/drivers/acpi/parser/psfind.c
deleted file mode 100644 (file)
index 9611f34..0000000
+++ /dev/null
@@ -1,313 +0,0 @@
-
-/******************************************************************************
- *
- * Module Name: psfind - Parse tree search routine
- *              $Revision: 24 $
- *
- *****************************************************************************/
-
-/*
- *  Copyright (C) 2000, 2001 R. Byron Moore
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-#include "acpi.h"
-#include "acparser.h"
-#include "amlcode.h"
-
-#define _COMPONENT          ACPI_PARSER
-        MODULE_NAME         ("psfind")
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_ps_get_parent
- *
- * PARAMETERS:  Op              - Get the parent of this Op
- *
- * RETURN:      The Parent op.
- *
- * DESCRIPTION: Get op's parent
- *
- ******************************************************************************/
-
-static ACPI_PARSE_OBJECT*
-acpi_ps_get_parent (
-       ACPI_PARSE_OBJECT       *op)
-{
-       ACPI_PARSE_OBJECT       *parent = op;
-
-
-       /* Traverse the tree upward (to root if necessary) */
-
-       while (parent) {
-               switch (parent->opcode) {
-               case AML_SCOPE_OP:
-               case AML_PACKAGE_OP:
-               case AML_METHOD_OP:
-               case AML_DEVICE_OP:
-               case AML_POWER_RES_OP:
-               case AML_THERMAL_ZONE_OP:
-
-                       return (parent->parent);
-               }
-
-               parent = parent->parent;
-       }
-
-       return (parent);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_ps_find_name
- *
- * PARAMETERS:  Scope           - Scope to search
- *              Name            - ACPI name to search for
- *              Opcode          - Opcode to search for
- *
- * RETURN:      Op containing the name
- *
- * DESCRIPTION: Find name segment from a list of acpi_ops.  Searches a single
- *              scope, no more.
- *
- ******************************************************************************/
-
-static ACPI_PARSE_OBJECT *
-acpi_ps_find_name (
-       ACPI_PARSE_OBJECT       *scope,
-       u32                     name,
-       u32                     opcode)
-{
-       ACPI_PARSE_OBJECT       *op;
-       ACPI_PARSE_OBJECT       *field;
-
-
-       /* search scope level for matching name segment */
-
-       op = acpi_ps_get_child (scope);
-
-       while (op) {
-
-               if (acpi_ps_is_field_op (op->opcode)) {
-                       /* Field, search named fields */
-
-                       field = acpi_ps_get_child (op);
-                       while (field) {
-                               if (acpi_ps_is_named_op (field->opcode) &&
-                                  acpi_ps_get_name (field) == name &&
-                                  (!opcode || field->opcode == opcode)) {
-                                       return (field);
-                               }
-
-                               field = field->next;
-                       }
-               }
-
-               else if (acpi_ps_is_create_field_op (op->opcode)) {
-                       if (op->opcode == AML_CREATE_FIELD_OP) {
-                               field = acpi_ps_get_arg (op, 3);
-                       }
-
-                       else {
-                               /* Create_xXXField, check name */
-
-                               field = acpi_ps_get_arg (op, 2);
-                       }
-
-                       if ((field) &&
-                               (field->value.string) &&
-                               (!STRNCMP (field->value.string, (char *) &name, ACPI_NAME_SIZE))) {
-                               return (op);
-                       }
-               }
-
-               else if ((acpi_ps_is_named_op (op->opcode)) &&
-                                (acpi_ps_get_name (op) == name) &&
-                                (!opcode || op->opcode == opcode || opcode == AML_SCOPE_OP)) {
-                       break;
-               }
-
-               op = op->next;
-       }
-
-       return (op);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_ps_find
- *
- * PARAMETERS:  Scope           - Where to begin the search
- *              Path            - ACPI Path to the named object
- *              Opcode          - Opcode associated with the object
- *              Create          - if TRUE, create the object if not found.
- *
- * RETURN:      Op if found, NULL otherwise.
- *
- * DESCRIPTION: Find object within scope
- *
- ******************************************************************************/
-
-ACPI_PARSE_OBJECT*
-acpi_ps_find (
-       ACPI_PARSE_OBJECT       *scope,
-       NATIVE_CHAR             *path,
-       u16                     opcode,
-       u32                     create)
-{
-       u32                     seg_count;
-       u32                     name;
-       u32                     name_op;
-       ACPI_PARSE_OBJECT       *op = NULL;
-       u8                      unprefixed = TRUE;
-
-
-       if (!scope || !path) {
-               return (NULL);
-       }
-
-
-       acpi_gbl_ps_find_count++;
-
-
-       /* Handle all prefixes in the name path */
-
-       while (acpi_ps_is_prefix_char (GET8 (path))) {
-               switch (GET8 (path)) {
-
-               case '\\':
-
-                       /* Could just use a global for "root scope" here */
-
-                       while (scope->parent) {
-                               scope = scope->parent;
-                       }
-
-                       /* get first object within the scope */
-                       /* TBD: [Investigate] OR - set next in root scope to point to the same value as arg */
-
-                       /* Scope = Scope->Value.Arg; */
-
-                       break;
-
-
-               case '^':
-
-                       /* Go up to the next valid scoping Op (method, scope, etc.) */
-
-                       if (acpi_ps_get_parent (scope)) {
-                               scope = acpi_ps_get_parent (scope);
-                       }
-
-                       break;
-               }
-
-               unprefixed = FALSE;
-               path++;
-       }
-
-       /* get name segment count */
-
-       switch (GET8 (path)) {
-       case '\0':
-               seg_count = 0;
-
-               /* Null name case */
-
-               if (unprefixed) {
-                       op = NULL;
-               }
-               else {
-                       op = scope;
-               }
-
-
-               return (op);
-               break;
-
-       case AML_DUAL_NAME_PREFIX:
-               seg_count = 2;
-               path++;
-               break;
-
-       case AML_MULTI_NAME_PREFIX_OP:
-               seg_count = GET8 (path + 1);
-               path += 2;
-               break;
-
-       default:
-               seg_count = 1;
-               break;
-       }
-
-       /* match each name segment */
-
-       while (scope && seg_count) {
-               MOVE_UNALIGNED32_TO_32 (&name, path);
-               path += 4;
-               seg_count --;
-
-               if (seg_count) {
-                       name_op = 0;
-               }
-               else {
-                       name_op = opcode;
-               }
-
-               op = acpi_ps_find_name (scope, name, name_op);
-
-               if (!op) {
-                       if (create) {
-                               /* Create a new Scope level */
-
-                               if (seg_count) {
-                                       op = acpi_ps_alloc_op (AML_SCOPE_OP);
-                               }
-                               else {
-                                       op = acpi_ps_alloc_op (opcode);
-                               }
-
-                               if (op) {
-                                       acpi_ps_set_name (op, name);
-                                       acpi_ps_append_arg (scope, op);
-
-                               }
-                       }
-
-                       else if (unprefixed) {
-                               /* Search higher scopes for unprefixed name */
-
-                               while (!op && scope->parent) {
-                                       scope = scope->parent;
-                                       op = acpi_ps_find_name (scope, name, opcode);
-
-                               }
-                       }
-
-               }
-
-               unprefixed = FALSE;
-               scope = op;
-       }
-
-       return (op);
-}
-
-
index a8630ada549b443366308615bb10a7d82bfb76c5..9766ff689f419b8e08387259740b1d048e1ae52e 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: psopcode - Parser opcode information table
- *              $Revision: 32 $
+ *              $Revision: 41 $
  *
  *****************************************************************************/
 
  ******************************************************************************/
 
 
-/*
- * Flags byte: 0-4 (5 bits) = Opcode Type
- *             5   (1 bit)  = Has arguments flag
- *             6-7 (2 bits) = Reserved
- */
-#define AML_NO_ARGS         0
-#define AML_HAS_ARGS        ACPI_OP_ARGS_MASK
-
 /*
  * All AML opcodes and the parse-time arguments for each.  Used by the AML parser  Each list is compressed
  * into a 32-bit number and stored in the master opcode table at the end of this file.
 #define ARGI_STATICSTRING_OP            ARGI_INVALID_OPCODE
 
 
+/*
+ * Summary of opcode types/flags
+ */
+
+/******************************************************************************
+
+ Opcodes that have associated namespace objects
+
+       AML_SCOPE_OP
+       AML_DEVICE_OP
+       AML_THERMAL_ZONE_OP
+       AML_METHOD_OP
+       AML_POWER_RES_OP
+       AML_PROCESSOR_OP
+       AML_FIELD_OP
+       AML_INDEX_FIELD_OP
+       AML_BANK_FIELD_OP
+       AML_NAME_OP
+       AML_ALIAS_OP
+       AML_MUTEX_OP
+       AML_EVENT_OP
+       AML_REGION_OP
+       AML_CREATE_FIELD_OP
+       AML_CREATE_BIT_FIELD_OP
+       AML_CREATE_BYTE_FIELD_OP
+       AML_CREATE_WORD_FIELD_OP
+       AML_CREATE_DWORD_FIELD_OP
+       AML_CREATE_QWORD_FIELD_OP
+       AML_INT_NAMEDFIELD_OP
+       AML_INT_METHODCALL_OP
+       AML_INT_NAMEPATH_OP
+
+  Opcodes that are "namespace" opcodes
+
+       AML_SCOPE_OP
+       AML_DEVICE_OP
+       AML_THERMAL_ZONE_OP
+       AML_METHOD_OP
+       AML_POWER_RES_OP
+       AML_PROCESSOR_OP
+       AML_FIELD_OP
+       AML_INDEX_FIELD_OP
+       AML_BANK_FIELD_OP
+       AML_NAME_OP
+       AML_ALIAS_OP
+       AML_MUTEX_OP
+       AML_EVENT_OP
+       AML_REGION_OP
+       AML_INT_NAMEDFIELD_OP
+
+  Opcodes that have an associated namespace node
+
+       AML_SCOPE_OP
+       AML_DEVICE_OP
+       AML_THERMAL_ZONE_OP
+       AML_METHOD_OP
+       AML_POWER_RES_OP
+       AML_PROCESSOR_OP
+       AML_NAME_OP
+       AML_ALIAS_OP
+       AML_MUTEX_OP
+       AML_EVENT_OP
+       AML_REGION_OP
+       AML_CREATE_FIELD_OP
+       AML_CREATE_BIT_FIELD_OP
+       AML_CREATE_BYTE_FIELD_OP
+       AML_CREATE_WORD_FIELD_OP
+       AML_CREATE_DWORD_FIELD_OP
+       AML_CREATE_QWORD_FIELD_OP
+       AML_INT_NAMEDFIELD_OP
+       AML_INT_METHODCALL_OP
+       AML_INT_NAMEPATH_OP
+
+  Opcodes that define named ACPI objects
+
+       AML_SCOPE_OP
+       AML_DEVICE_OP
+       AML_THERMAL_ZONE_OP
+       AML_METHOD_OP
+       AML_POWER_RES_OP
+       AML_PROCESSOR_OP
+       AML_NAME_OP
+       AML_ALIAS_OP
+       AML_MUTEX_OP
+       AML_EVENT_OP
+       AML_REGION_OP
+       AML_INT_NAMEDFIELD_OP
+
+       Opcodes that contain executable AML as part of the definition that
+       must be deferred until needed
+
+       AML_METHOD_OP
+       AML_VAR_PACKAGE_OP
+       AML_CREATE_FIELD_OP
+       AML_CREATE_BIT_FIELD_OP
+       AML_CREATE_BYTE_FIELD_OP
+       AML_CREATE_WORD_FIELD_OP
+       AML_CREATE_DWORD_FIELD_OP
+       AML_CREATE_QWORD_FIELD_OP
+       AML_REGION_OP
+
+  Field opcodes
+
+       AML_CREATE_FIELD_OP
+       AML_FIELD_OP
+       AML_INDEX_FIELD_OP
+       AML_BANK_FIELD_OP
+
+  Field "Create" opcodes
+
+       AML_CREATE_FIELD_OP
+       AML_CREATE_BIT_FIELD_OP
+       AML_CREATE_BYTE_FIELD_OP
+       AML_CREATE_WORD_FIELD_OP
+       AML_CREATE_DWORD_FIELD_OP
+       AML_CREATE_QWORD_FIELD_OP
+
+******************************************************************************/
+
+
 /*
  * Master Opcode information table.  A summary of everything we know about each opcode, all in one place.
  */
 
 
-static ACPI_OPCODE_INFO    aml_op_info[] =
+static const acpi_opcode_info    aml_op_info[] =
 {
-/* Index          Opcode                                   Type                   Class                 Has Arguments?   Name                 Parser Args               Interpreter Args */
-
-/*  00 */   /* AML_ZERO_OP */    OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT|        AML_NO_ARGS,  "Zero",               ARGP_ZERO_OP,              ARGI_ZERO_OP),
-/*  01 */   /* AML_ONE_OP */      OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT|        AML_NO_ARGS,  "One",                ARGP_ONE_OP,               ARGI_ONE_OP),
-/*  02 */   /* AML_ALIAS_OP */  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Alias",              ARGP_ALIAS_OP,             ARGI_ALIAS_OP),
-/*  03 */   /* AML_NAME_OP */    OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Name",               ARGP_NAME_OP,              ARGI_NAME_OP),
-/*  04 */   /* AML_BYTE_OP */    OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL|         AML_NO_ARGS,  "Byte_const",         ARGP_BYTE_OP,              ARGI_BYTE_OP),
-/*  05 */   /* AML_WORD_OP */    OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL|         AML_NO_ARGS,  "Word_const",         ARGP_WORD_OP,              ARGI_WORD_OP),
-/*  06 */   /* AML_DWORD_OP */  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL|         AML_NO_ARGS,  "Dword_const",        ARGP_DWORD_OP,             ARGI_DWORD_OP),
-/*  07 */   /* AML_STRING_OP */           OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL|         AML_NO_ARGS,  "String",             ARGP_STRING_OP,            ARGI_STRING_OP),
-/*  08 */   /* AML_SCOPE_OP */  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Scope",              ARGP_SCOPE_OP,             ARGI_SCOPE_OP),
-/*  09 */   /* AML_BUFFER_OP */           OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DATA_TERM|       AML_HAS_ARGS, "Buffer",             ARGP_BUFFER_OP,            ARGI_BUFFER_OP),
-/*  0A */   /* AML_PACKAGE_OP */         OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DATA_TERM|       AML_HAS_ARGS, "Package",            ARGP_PACKAGE_OP,           ARGI_PACKAGE_OP),
-/*  0B */   /* AML_METHOD_OP */           OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Method",             ARGP_METHOD_OP,            ARGI_METHOD_OP),
-/*  0C */   /* AML_LOCAL0 */      OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE|  AML_NO_ARGS,  "Local0",             ARGP_LOCAL0,               ARGI_LOCAL0),
-/*  0D */   /* AML_LOCAL1 */      OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE|  AML_NO_ARGS,  "Local1",             ARGP_LOCAL1,               ARGI_LOCAL1),
-/*  0E */   /* AML_LOCAL2 */      OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE|  AML_NO_ARGS,  "Local2",             ARGP_LOCAL2,               ARGI_LOCAL2),
-/*  0F */   /* AML_LOCAL3 */      OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE|  AML_NO_ARGS,  "Local3",             ARGP_LOCAL3,               ARGI_LOCAL3),
-/*  10 */   /* AML_LOCAL4 */      OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE|  AML_NO_ARGS,  "Local4",             ARGP_LOCAL4,               ARGI_LOCAL4),
-/*  11 */   /* AML_LOCAL5 */      OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE|  AML_NO_ARGS,  "Local5",             ARGP_LOCAL5,               ARGI_LOCAL5),
-/*  12 */   /* AML_LOCAL6 */      OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE|  AML_NO_ARGS,  "Local6",             ARGP_LOCAL6,               ARGI_LOCAL6),
-/*  13 */   /* AML_LOCAL7 */      OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE|  AML_NO_ARGS,  "Local7",             ARGP_LOCAL7,               ARGI_LOCAL7),
-/*  14 */   /* AML_ARG0 */       OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS,  "Arg0",               ARGP_ARG0,                 ARGI_ARG0),
-/*  15 */   /* AML_ARG1 */       OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS,  "Arg1",               ARGP_ARG1,                 ARGI_ARG1),
-/*  16 */   /* AML_ARG2 */       OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS,  "Arg2",               ARGP_ARG2,                 ARGI_ARG2),
-/*  17 */   /* AML_ARG3 */       OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS,  "Arg3",               ARGP_ARG3,                 ARGI_ARG3),
-/*  18 */   /* AML_ARG4 */       OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS,  "Arg4",               ARGP_ARG4,                 ARGI_ARG4),
-/*  19 */   /* AML_ARG5 */       OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS,  "Arg5",               ARGP_ARG5,                 ARGI_ARG5),
-/*  1_a */  /* AML_ARG6 */       OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS,  "Arg6",               ARGP_ARG6,                 ARGI_ARG6),
-/*  1_b */  /* AML_STORE_OP */  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "Store",              ARGP_STORE_OP,             ARGI_STORE_OP),
-/*  1_c */  /* AML_REF_OF_OP */           OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2|        AML_HAS_ARGS, "Ref_of",             ARGP_REF_OF_OP,            ARGI_REF_OF_OP),
-/*  1_d */  /* AML_ADD_OP */      OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "Add",                ARGP_ADD_OP,               ARGI_ADD_OP),
-/*  1_e */  /* AML_CONCAT_OP */           OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "Concatenate",        ARGP_CONCAT_OP,            ARGI_CONCAT_OP),
-/*  1_f */  /* AML_SUBTRACT_OP */       OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "Subtract",           ARGP_SUBTRACT_OP,          ARGI_SUBTRACT_OP),
-/*  20 */   /* AML_INCREMENT_OP */        OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2|        AML_HAS_ARGS, "Increment",          ARGP_INCREMENT_OP,         ARGI_INCREMENT_OP),
-/*  21 */   /* AML_DECREMENT_OP */        OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2|        AML_HAS_ARGS, "Decrement",          ARGP_DECREMENT_OP,         ARGI_DECREMENT_OP),
-/*  22 */   /* AML_MULTIPLY_OP */       OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "Multiply",           ARGP_MULTIPLY_OP,          ARGI_MULTIPLY_OP),
-/*  23 */   /* AML_DIVIDE_OP */           OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "Divide",             ARGP_DIVIDE_OP,            ARGI_DIVIDE_OP),
-/*  24 */   /* AML_SHIFT_LEFT_OP */      OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "Shift_left",         ARGP_SHIFT_LEFT_OP,        ARGI_SHIFT_LEFT_OP),
-/*  25 */   /* AML_SHIFT_RIGHT_OP */    OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "Shift_right",        ARGP_SHIFT_RIGHT_OP,       ARGI_SHIFT_RIGHT_OP),
-/*  26 */   /* AML_BIT_AND_OP */         OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "And",                ARGP_BIT_AND_OP,           ARGI_BIT_AND_OP),
-/*  27 */   /* AML_BIT_NAND_OP */       OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "NAnd",               ARGP_BIT_NAND_OP,          ARGI_BIT_NAND_OP),
-/*  28 */   /* AML_BIT_OR_OP */           OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "Or",                 ARGP_BIT_OR_OP,            ARGI_BIT_OR_OP),
-/*  29 */   /* AML_BIT_NOR_OP */         OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "NOr",                ARGP_BIT_NOR_OP,           ARGI_BIT_NOR_OP),
-/*  2_a */  /* AML_BIT_XOR_OP */         OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "XOr",                ARGP_BIT_XOR_OP,           ARGI_BIT_XOR_OP),
-/*  2_b */  /* AML_BIT_NOT_OP */         OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "Not",                ARGP_BIT_NOT_OP,           ARGI_BIT_NOT_OP),
-/*  2_c */  /* AML_FIND_SET_LEFT_BIT_OP */  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "Find_set_left_bit",  ARGP_FIND_SET_LEFT_BIT_OP, ARGI_FIND_SET_LEFT_BIT_OP),
-/*  2_d */  /* AML_FIND_SET_RIGHT_BIT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "Find_set_right_bit", ARGP_FIND_SET_RIGHT_BIT_OP,ARGI_FIND_SET_RIGHT_BIT_OP),
-/*  2_e */  /* AML_DEREF_OF_OP */       OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2|        AML_HAS_ARGS, "Deref_of",           ARGP_DEREF_OF_OP,          ARGI_DEREF_OF_OP),
-/*  2_f */  /* AML_NOTIFY_OP */           OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC1|         AML_HAS_ARGS, "Notify",             ARGP_NOTIFY_OP,            ARGI_NOTIFY_OP),
-/*  30 */   /* AML_SIZE_OF_OP */         OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2|        AML_HAS_ARGS, "Size_of",            ARGP_SIZE_OF_OP,           ARGI_SIZE_OF_OP),
-/*  31 */   /* AML_INDEX_OP */  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_INDEX|           AML_HAS_ARGS, "Index",              ARGP_INDEX_OP,             ARGI_INDEX_OP),
-/*  32 */   /* AML_MATCH_OP */  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MATCH|           AML_HAS_ARGS, "Match",              ARGP_MATCH_OP,             ARGI_MATCH_OP),
-/*  33 */   /* AML_CREATE_DWORD_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD|    AML_HAS_ARGS, "Create_dWord_field", ARGP_CREATE_DWORD_FIELD_OP,ARGI_CREATE_DWORD_FIELD_OP),
-/*  34 */   /* AML_CREATE_WORD_FIELD_OP */  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD|    AML_HAS_ARGS, "Create_word_field",  ARGP_CREATE_WORD_FIELD_OP, ARGI_CREATE_WORD_FIELD_OP),
-/*  35 */   /* AML_CREATE_BYTE_FIELD_OP */  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD|    AML_HAS_ARGS, "Create_byte_field",  ARGP_CREATE_BYTE_FIELD_OP, ARGI_CREATE_BYTE_FIELD_OP),
-/*  36 */   /* AML_CREATE_BIT_FIELD_OP */   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD|    AML_HAS_ARGS, "Create_bit_field",   ARGP_CREATE_BIT_FIELD_OP,  ARGI_CREATE_BIT_FIELD_OP),
-/*  37 */   /* AML_TYPE_OP */    OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2|        AML_HAS_ARGS, "Object_type",        ARGP_TYPE_OP,              ARGI_TYPE_OP),
-/*  38 */   /* AML_LAND_OP */    OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2|         AML_HAS_ARGS, "LAnd",               ARGP_LAND_OP,              ARGI_LAND_OP),
-/*  39 */   /* AML_LOR_OP */      OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2|         AML_HAS_ARGS, "LOr",                ARGP_LOR_OP,               ARGI_LOR_OP),
-/*  3_a */  /* AML_LNOT_OP */    OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2|        AML_HAS_ARGS, "LNot",               ARGP_LNOT_OP,              ARGI_LNOT_OP),
-/*  3_b */  /* AML_LEQUAL_OP */           OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2|         AML_HAS_ARGS, "LEqual",             ARGP_LEQUAL_OP,            ARGI_LEQUAL_OP),
-/*  3_c */  /* AML_LGREATER_OP */       OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2|         AML_HAS_ARGS, "LGreater",           ARGP_LGREATER_OP,          ARGI_LGREATER_OP),
-/*  3_d */  /* AML_LLESS_OP */  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2|         AML_HAS_ARGS, "LLess",              ARGP_LLESS_OP,             ARGI_LLESS_OP),
-/*  3_e */  /* AML_IF_OP */     OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL|         AML_HAS_ARGS, "If",                 ARGP_IF_OP,                ARGI_IF_OP),
-/*  3_f */  /* AML_ELSE_OP */    OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL|         AML_HAS_ARGS, "Else",               ARGP_ELSE_OP,              ARGI_ELSE_OP),
-/*  40 */   /* AML_WHILE_OP */  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL|         AML_HAS_ARGS, "While",              ARGP_WHILE_OP,             ARGI_WHILE_OP),
-/*  41 */   /* AML_NOOP_OP   */           OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL|         AML_NO_ARGS,  "Noop",               ARGP_NOOP_OP,              ARGI_NOOP_OP),
-/*  42 */   /* AML_RETURN_OP */           OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL|         AML_HAS_ARGS, "Return",             ARGP_RETURN_OP,            ARGI_RETURN_OP),
-/*  43 */   /* AML_BREAK_OP */  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL|         AML_NO_ARGS,  "Break",              ARGP_BREAK_OP,             ARGI_BREAK_OP),
-/*  44 */   /* AML_BREAK_POINT_OP */    OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL|         AML_NO_ARGS,  "Break_point",        ARGP_BREAK_POINT_OP,       ARGI_BREAK_POINT_OP),
-/*  45 */   /* AML_ONES_OP */    OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT|        AML_NO_ARGS,  "Ones",               ARGP_ONES_OP,              ARGI_ONES_OP),
+/* Index           Name                 Parser Args               Interpreter Args              Flags */
+
+/* 00 */ ACPI_OP ("Zero",               ARGP_ZERO_OP,              ARGI_ZERO_OP,               ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT|        AML_NO_ARGS ),
+/* 01 */ ACPI_OP ("One",                ARGP_ONE_OP,               ARGI_ONE_OP,                ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT|        AML_NO_ARGS ),
+/* 02 */ ACPI_OP ("Alias",              ARGP_ALIAS_OP,             ARGI_ALIAS_OP,              ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS|AML_NSOBJECT|AML_NSOPCODE|AML_NSNODE|AML_NAMED),
+/* 03 */ ACPI_OP ("Name",               ARGP_NAME_OP,              ARGI_NAME_OP,               ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS|AML_NSOBJECT|AML_NSOPCODE|AML_NSNODE|AML_NAMED),
+/* 04 */ ACPI_OP ("Byte_const",         ARGP_BYTE_OP,              ARGI_BYTE_OP,               ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL|         AML_NO_ARGS ),
+/* 05 */ ACPI_OP ("Word_const",         ARGP_WORD_OP,              ARGI_WORD_OP,               ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL|         AML_NO_ARGS ),
+/* 06 */ ACPI_OP ("Dword_const",        ARGP_DWORD_OP,             ARGI_DWORD_OP,              ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL|         AML_NO_ARGS ),
+/* 07 */ ACPI_OP ("String",             ARGP_STRING_OP,            ARGI_STRING_OP,             ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL|         AML_NO_ARGS ),
+/* 08 */ ACPI_OP ("Scope",              ARGP_SCOPE_OP,             ARGI_SCOPE_OP,              ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS|AML_NSOBJECT|AML_NSOPCODE|AML_NSNODE|AML_NAMED),
+/* 09 */ ACPI_OP ("Buffer",             ARGP_BUFFER_OP,            ARGI_BUFFER_OP,             ACPI_OP_TYPE_OPCODE | OPTYPE_DATA_TERM|       AML_HAS_ARGS),
+/* 0A */ ACPI_OP ("Package",            ARGP_PACKAGE_OP,           ARGI_PACKAGE_OP,            ACPI_OP_TYPE_OPCODE | OPTYPE_DATA_TERM|       AML_HAS_ARGS),
+/* 0B */ ACPI_OP ("Method",             ARGP_METHOD_OP,            ARGI_METHOD_OP,             ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS|AML_NSOBJECT|AML_NSOPCODE|AML_NSNODE|AML_NAMED|AML_DEFER),
+/* 0C */ ACPI_OP ("Local0",             ARGP_LOCAL0,               ARGI_LOCAL0,                ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE|  AML_NO_ARGS ),
+/* 0D */ ACPI_OP ("Local1",             ARGP_LOCAL1,               ARGI_LOCAL1,                ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE|  AML_NO_ARGS ),
+/* 0E */ ACPI_OP ("Local2",             ARGP_LOCAL2,               ARGI_LOCAL2,                ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE|  AML_NO_ARGS ),
+/* 0F */ ACPI_OP ("Local3",             ARGP_LOCAL3,               ARGI_LOCAL3,                ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE|  AML_NO_ARGS ),
+/* 10 */ ACPI_OP ("Local4",             ARGP_LOCAL4,               ARGI_LOCAL4,                ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE|  AML_NO_ARGS ),
+/* 11 */ ACPI_OP ("Local5",             ARGP_LOCAL5,               ARGI_LOCAL5,                ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE|  AML_NO_ARGS ),
+/* 12 */ ACPI_OP ("Local6",             ARGP_LOCAL6,               ARGI_LOCAL6,                ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE|  AML_NO_ARGS ),
+/* 13 */ ACPI_OP ("Local7",             ARGP_LOCAL7,               ARGI_LOCAL7,                ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE|  AML_NO_ARGS ),
+/* 14 */ ACPI_OP ("Arg0",               ARGP_ARG0,                 ARGI_ARG0,                  ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS ),
+/* 15 */ ACPI_OP ("Arg1",               ARGP_ARG1,                 ARGI_ARG1,                  ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS ),
+/* 16 */ ACPI_OP ("Arg2",               ARGP_ARG2,                 ARGI_ARG2,                  ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS ),
+/* 17 */ ACPI_OP ("Arg3",               ARGP_ARG3,                 ARGI_ARG3,                  ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS ),
+/* 18 */ ACPI_OP ("Arg4",               ARGP_ARG4,                 ARGI_ARG4,                  ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS ),
+/* 19 */ ACPI_OP ("Arg5",               ARGP_ARG5,                 ARGI_ARG5,                  ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS ),
+/* 1_a */ ACPI_OP ("Arg6",              ARGP_ARG6,                 ARGI_ARG6,                  ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS ),
+/* 1_b */ ACPI_OP ("Store",             ARGP_STORE_OP,             ARGI_STORE_OP,              ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS),
+/* 1_c */ ACPI_OP ("Ref_of",            ARGP_REF_OF_OP,            ARGI_REF_OF_OP,             ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2|        AML_HAS_ARGS),
+/* 1_d */ ACPI_OP ("Add",               ARGP_ADD_OP,               ARGI_ADD_OP,                ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS),
+/* 1_e */ ACPI_OP ("Concatenate",       ARGP_CONCAT_OP,            ARGI_CONCAT_OP,             ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS),
+/* 1_f */ ACPI_OP ("Subtract",          ARGP_SUBTRACT_OP,          ARGI_SUBTRACT_OP,           ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS),
+/* 20 */ ACPI_OP ("Increment",          ARGP_INCREMENT_OP,         ARGI_INCREMENT_OP,          ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2|        AML_HAS_ARGS),
+/* 21 */ ACPI_OP ("Decrement",          ARGP_DECREMENT_OP,         ARGI_DECREMENT_OP,          ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2|        AML_HAS_ARGS),
+/* 22 */ ACPI_OP ("Multiply",           ARGP_MULTIPLY_OP,          ARGI_MULTIPLY_OP,           ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS),
+/* 23 */ ACPI_OP ("Divide",             ARGP_DIVIDE_OP,            ARGI_DIVIDE_OP,             ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS),
+/* 24 */ ACPI_OP ("Shift_left",         ARGP_SHIFT_LEFT_OP,        ARGI_SHIFT_LEFT_OP,         ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS),
+/* 25 */ ACPI_OP ("Shift_right",        ARGP_SHIFT_RIGHT_OP,       ARGI_SHIFT_RIGHT_OP,        ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS),
+/* 26 */ ACPI_OP ("And",                ARGP_BIT_AND_OP,           ARGI_BIT_AND_OP,            ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS),
+/* 27 */ ACPI_OP ("NAnd",               ARGP_BIT_NAND_OP,          ARGI_BIT_NAND_OP,           ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS),
+/* 28 */ ACPI_OP ("Or",                 ARGP_BIT_OR_OP,            ARGI_BIT_OR_OP,             ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS),
+/* 29 */ ACPI_OP ("NOr",                ARGP_BIT_NOR_OP,           ARGI_BIT_NOR_OP,            ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS),
+/* 2_a */ ACPI_OP ("XOr",               ARGP_BIT_XOR_OP,           ARGI_BIT_XOR_OP,            ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS),
+/* 2_b */ ACPI_OP ("Not",               ARGP_BIT_NOT_OP,           ARGI_BIT_NOT_OP,            ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS),
+/* 2_c */ ACPI_OP ("Find_set_left_bit", ARGP_FIND_SET_LEFT_BIT_OP, ARGI_FIND_SET_LEFT_BIT_OP,  ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS),
+/* 2_d */ ACPI_OP ("Find_set_right_bit", ARGP_FIND_SET_RIGHT_BIT_OP,ARGI_FIND_SET_RIGHT_BIT_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|     AML_HAS_ARGS),
+/* 2_e */ ACPI_OP ("Deref_of",          ARGP_DEREF_OF_OP,          ARGI_DEREF_OF_OP,           ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2|        AML_HAS_ARGS),
+/* 2_f */ ACPI_OP ("Notify",            ARGP_NOTIFY_OP,            ARGI_NOTIFY_OP,             ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC1|         AML_HAS_ARGS),
+/* 30 */ ACPI_OP ("Size_of",            ARGP_SIZE_OF_OP,           ARGI_SIZE_OF_OP,            ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2|        AML_HAS_ARGS),
+/* 31 */ ACPI_OP ("Index",              ARGP_INDEX_OP,             ARGI_INDEX_OP,              ACPI_OP_TYPE_OPCODE | OPTYPE_TRIADIC|         AML_HAS_ARGS),
+/* 32 */ ACPI_OP ("Match",              ARGP_MATCH_OP,             ARGI_MATCH_OP,              ACPI_OP_TYPE_OPCODE | OPTYPE_HEXADIC|         AML_HAS_ARGS),
+/* 33 */ ACPI_OP ("Create_dWord_field", ARGP_CREATE_DWORD_FIELD_OP,ARGI_CREATE_DWORD_FIELD_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD|    AML_HAS_ARGS|AML_NSOBJECT|AML_NSNODE|AML_DEFER|AML_CREATE),
+/* 34 */ ACPI_OP ("Create_word_field",  ARGP_CREATE_WORD_FIELD_OP, ARGI_CREATE_WORD_FIELD_OP,  ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD|    AML_HAS_ARGS|AML_NSOBJECT|AML_NSNODE|AML_DEFER|AML_CREATE),
+/* 35 */ ACPI_OP ("Create_byte_field",  ARGP_CREATE_BYTE_FIELD_OP, ARGI_CREATE_BYTE_FIELD_OP,  ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD|    AML_HAS_ARGS|AML_NSOBJECT|AML_NSNODE|AML_DEFER|AML_CREATE),
+/* 36 */ ACPI_OP ("Create_bit_field",   ARGP_CREATE_BIT_FIELD_OP,  ARGI_CREATE_BIT_FIELD_OP,   ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD|    AML_HAS_ARGS|AML_NSOBJECT|AML_NSNODE|AML_DEFER|AML_CREATE),
+/* 37 */ ACPI_OP ("Object_type",        ARGP_TYPE_OP,              ARGI_TYPE_OP,               ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2|        AML_HAS_ARGS),
+/* 38 */ ACPI_OP ("LAnd",               ARGP_LAND_OP,              ARGI_LAND_OP,               ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2|         AML_HAS_ARGS),
+/* 39 */ ACPI_OP ("LOr",                ARGP_LOR_OP,               ARGI_LOR_OP,                ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2|         AML_HAS_ARGS),
+/* 3_a */ ACPI_OP ("LNot",              ARGP_LNOT_OP,              ARGI_LNOT_OP,               ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2|        AML_HAS_ARGS),
+/* 3_b */ ACPI_OP ("LEqual",            ARGP_LEQUAL_OP,            ARGI_LEQUAL_OP,             ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2|         AML_HAS_ARGS),
+/* 3_c */ ACPI_OP ("LGreater",          ARGP_LGREATER_OP,          ARGI_LGREATER_OP,           ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2|         AML_HAS_ARGS),
+/* 3_d */ ACPI_OP ("LLess",             ARGP_LLESS_OP,             ARGI_LLESS_OP,              ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2|         AML_HAS_ARGS),
+/* 3_e */ ACPI_OP ("If",                ARGP_IF_OP,                ARGI_IF_OP,                 ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL|         AML_HAS_ARGS),
+/* 3_f */ ACPI_OP ("Else",              ARGP_ELSE_OP,              ARGI_ELSE_OP,               ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL|         AML_HAS_ARGS),
+/* 40 */ ACPI_OP ("While",              ARGP_WHILE_OP,             ARGI_WHILE_OP,              ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL|         AML_HAS_ARGS),
+/* 41 */ ACPI_OP ("Noop",               ARGP_NOOP_OP,              ARGI_NOOP_OP,               ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL|         AML_NO_ARGS ),
+/* 42 */ ACPI_OP ("Return",             ARGP_RETURN_OP,            ARGI_RETURN_OP,             ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL|         AML_HAS_ARGS),
+/* 43 */ ACPI_OP ("Break",              ARGP_BREAK_OP,             ARGI_BREAK_OP,              ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL|         AML_NO_ARGS ),
+/* 44 */ ACPI_OP ("Break_point",        ARGP_BREAK_POINT_OP,       ARGI_BREAK_POINT_OP,        ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL|         AML_NO_ARGS ),
+/* 45 */ ACPI_OP ("Ones",               ARGP_ONES_OP,              ARGI_ONES_OP,               ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT|        AML_NO_ARGS ),
 
 /* Prefixed opcodes (Two-byte opcodes with a prefix op) */
 
-/*  46 */   /* AML_MUTEX_OP */  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Mutex",              ARGP_MUTEX_OP,             ARGI_MUTEX_OP),
-/*  47 */   /* AML_EVENT_OP */  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_NO_ARGS,  "Event",              ARGP_EVENT_OP,             ARGI_EVENT_OP),
-/*  48 */   /* AML_COND_REF_OF_OP */    OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "Cond_ref_of",        ARGP_COND_REF_OF_OP,       ARGI_COND_REF_OF_OP),
-/*  49 */   /* AML_CREATE_FIELD_OP */     OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD|    AML_HAS_ARGS, "Create_field",       ARGP_CREATE_FIELD_OP,      ARGI_CREATE_FIELD_OP),
-/*  4_a */  /* AML_LOAD_OP */    OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_RECONFIGURATION| AML_HAS_ARGS, "Load",               ARGP_LOAD_OP,              ARGI_LOAD_OP),
-/*  4_b */  /* AML_STALL_OP */  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1|        AML_HAS_ARGS, "Stall",              ARGP_STALL_OP,             ARGI_STALL_OP),
-/*  4_c */  /* AML_SLEEP_OP */  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1|        AML_HAS_ARGS, "Sleep",              ARGP_SLEEP_OP,             ARGI_SLEEP_OP),
-/*  4_d */  /* AML_ACQUIRE_OP */         OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_s|       AML_HAS_ARGS, "Acquire",            ARGP_ACQUIRE_OP,           ARGI_ACQUIRE_OP),
-/*  4_e */  /* AML_SIGNAL_OP */           OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1|        AML_HAS_ARGS, "Signal",             ARGP_SIGNAL_OP,            ARGI_SIGNAL_OP),
-/*  4_f */  /* AML_WAIT_OP */    OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_s|       AML_HAS_ARGS, "Wait",               ARGP_WAIT_OP,              ARGI_WAIT_OP),
-/*  50 */   /* AML_RESET_OP */  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1|        AML_HAS_ARGS, "Reset",              ARGP_RESET_OP,             ARGI_RESET_OP),
-/*  51 */   /* AML_RELEASE_OP */         OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1|        AML_HAS_ARGS, "Release",            ARGP_RELEASE_OP,           ARGI_RELEASE_OP),
-/*  52 */   /* AML_FROM_BCD_OP */       OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "From_bCD",           ARGP_FROM_BCD_OP,          ARGI_FROM_BCD_OP),
-/*  53 */   /* AML_TO_BCD_OP */           OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "To_bCD",             ARGP_TO_BCD_OP,            ARGI_TO_BCD_OP),
-/*  54 */   /* AML_UNLOAD_OP */           OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_RECONFIGURATION| AML_HAS_ARGS, "Unload",             ARGP_UNLOAD_OP,            ARGI_UNLOAD_OP),
-/*  55 */   /* AML_REVISION_OP */       OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT|        AML_NO_ARGS,  "Revision",           ARGP_REVISION_OP,          ARGI_REVISION_OP),
-/*  56 */   /* AML_DEBUG_OP */  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT|        AML_NO_ARGS,  "Debug",              ARGP_DEBUG_OP,             ARGI_DEBUG_OP),
-/*  57 */   /* AML_FATAL_OP */  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_FATAL|           AML_HAS_ARGS, "Fatal",              ARGP_FATAL_OP,             ARGI_FATAL_OP),
-/*  58 */   /* AML_REGION_OP */           OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Op_region",          ARGP_REGION_OP,            ARGI_REGION_OP),
-/*  59 */   /* AML_FIELD_OP */  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Field",              ARGP_FIELD_OP,             ARGI_FIELD_OP),
-/*  5_a */  /* AML_DEVICE_OP */           OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Device",             ARGP_DEVICE_OP,            ARGI_DEVICE_OP),
-/*  5_b */  /* AML_PROCESSOR_OP */        OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Processor",          ARGP_PROCESSOR_OP,         ARGI_PROCESSOR_OP),
-/*  5_c */  /* AML_POWER_RES_OP */        OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Power_resource",     ARGP_POWER_RES_OP,         ARGI_POWER_RES_OP),
-/*  5_d */  /* AML_THERMAL_ZONE_OP */     OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Thermal_zone",       ARGP_THERMAL_ZONE_OP,      ARGI_THERMAL_ZONE_OP),
-/*  5_e */  /* AML_INDEX_FIELD_OP */    OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Index_field",        ARGP_INDEX_FIELD_OP,       ARGI_INDEX_FIELD_OP),
-/*  5_f */  /* AML_BANK_FIELD_OP */      OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS, "Bank_field",         ARGP_BANK_FIELD_OP,        ARGI_BANK_FIELD_OP),
+/* 46 */ ACPI_OP ("Mutex",              ARGP_MUTEX_OP,             ARGI_MUTEX_OP,              ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS|AML_NSOBJECT|AML_NSOPCODE|AML_NSNODE|AML_NAMED),
+/* 47 */ ACPI_OP ("Event",              ARGP_EVENT_OP,             ARGI_EVENT_OP,              ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_NO_ARGS |AML_NSOBJECT|AML_NSOPCODE|AML_NSNODE|AML_NAMED ),
+/* 48 */ ACPI_OP ("Cond_ref_of",        ARGP_COND_REF_OF_OP,       ARGI_COND_REF_OF_OP,        ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS),
+/* 49 */ ACPI_OP ("Create_field",       ARGP_CREATE_FIELD_OP,      ARGI_CREATE_FIELD_OP,       ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD|    AML_HAS_ARGS|AML_NSOBJECT|AML_NSNODE|AML_DEFER|AML_FIELD|AML_CREATE),
+/* 4_a */ ACPI_OP ("Load",              ARGP_LOAD_OP,              ARGI_LOAD_OP,               ACPI_OP_TYPE_OPCODE | OPTYPE_RECONFIGURATION| AML_HAS_ARGS),
+/* 4_b */ ACPI_OP ("Stall",             ARGP_STALL_OP,             ARGI_STALL_OP,              ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1|        AML_HAS_ARGS),
+/* 4_c */ ACPI_OP ("Sleep",             ARGP_SLEEP_OP,             ARGI_SLEEP_OP,              ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1|        AML_HAS_ARGS),
+/* 4_d */ ACPI_OP ("Acquire",           ARGP_ACQUIRE_OP,           ARGI_ACQUIRE_OP,            ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_s|       AML_HAS_ARGS),
+/* 4_e */ ACPI_OP ("Signal",            ARGP_SIGNAL_OP,            ARGI_SIGNAL_OP,             ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1|        AML_HAS_ARGS),
+/* 4_f */ ACPI_OP ("Wait",              ARGP_WAIT_OP,              ARGI_WAIT_OP,               ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_s|       AML_HAS_ARGS),
+/* 50 */ ACPI_OP ("Reset",              ARGP_RESET_OP,             ARGI_RESET_OP,              ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1|        AML_HAS_ARGS),
+/* 51 */ ACPI_OP ("Release",            ARGP_RELEASE_OP,           ARGI_RELEASE_OP,            ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1|        AML_HAS_ARGS),
+/* 52 */ ACPI_OP ("From_bCD",           ARGP_FROM_BCD_OP,          ARGI_FROM_BCD_OP,           ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS),
+/* 53 */ ACPI_OP ("To_bCD",             ARGP_TO_BCD_OP,            ARGI_TO_BCD_OP,             ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS),
+/* 54 */ ACPI_OP ("Unload",             ARGP_UNLOAD_OP,            ARGI_UNLOAD_OP,             ACPI_OP_TYPE_OPCODE | OPTYPE_RECONFIGURATION| AML_HAS_ARGS),
+/* 55 */ ACPI_OP ("Revision",           ARGP_REVISION_OP,          ARGI_REVISION_OP,           ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT|        AML_NO_ARGS ),
+/* 56 */ ACPI_OP ("Debug",              ARGP_DEBUG_OP,             ARGI_DEBUG_OP,              ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT|        AML_NO_ARGS ),
+/* 57 */ ACPI_OP ("Fatal",              ARGP_FATAL_OP,             ARGI_FATAL_OP,              ACPI_OP_TYPE_OPCODE | OPTYPE_TRIADIC|         AML_HAS_ARGS),
+/* 58 */ ACPI_OP ("Op_region",          ARGP_REGION_OP,            ARGI_REGION_OP,             ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS|AML_NSOBJECT|AML_NSOPCODE|AML_NSNODE|AML_NAMED|AML_DEFER),
+/* 59 */ ACPI_OP ("Field",              ARGP_FIELD_OP,             ARGI_FIELD_OP,              ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS|AML_NSOBJECT|AML_NSOPCODE|AML_FIELD),
+/* 5_a */ ACPI_OP ("Device",            ARGP_DEVICE_OP,            ARGI_DEVICE_OP,             ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS|AML_NSOBJECT|AML_NSOPCODE|AML_NSNODE|AML_NAMED),
+/* 5_b */ ACPI_OP ("Processor",         ARGP_PROCESSOR_OP,         ARGI_PROCESSOR_OP,          ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS|AML_NSOBJECT|AML_NSOPCODE|AML_NSNODE|AML_NAMED),
+/* 5_c */ ACPI_OP ("Power_resource",    ARGP_POWER_RES_OP,         ARGI_POWER_RES_OP,          ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS|AML_NSOBJECT|AML_NSOPCODE|AML_NSNODE|AML_NAMED),
+/* 5_d */ ACPI_OP ("Thermal_zone",      ARGP_THERMAL_ZONE_OP,      ARGI_THERMAL_ZONE_OP,       ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS|AML_NSOBJECT|AML_NSOPCODE|AML_NSNODE|AML_NAMED),
+/* 5_e */ ACPI_OP ("Index_field",       ARGP_INDEX_FIELD_OP,       ARGI_INDEX_FIELD_OP,        ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS|AML_NSOBJECT|AML_NSOPCODE|AML_FIELD),
+/* 5_f */ ACPI_OP ("Bank_field",        ARGP_BANK_FIELD_OP,        ARGI_BANK_FIELD_OP,         ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT|    AML_HAS_ARGS|AML_NSOBJECT|AML_NSOPCODE|AML_FIELD),
 
 /* Internal opcodes that map to invalid AML opcodes */
 
-/*  60 */   /* AML_LNOTEQUAL_OP */        OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS|           AML_HAS_ARGS, "LNot_equal",         ARGP_LNOTEQUAL_OP,         ARGI_LNOTEQUAL_OP),
-/*  61 */   /* AML_LLESSEQUAL_OP */      OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS|           AML_HAS_ARGS, "LLess_equal",        ARGP_LLESSEQUAL_OP,        ARGI_LLESSEQUAL_OP),
-/*  62 */   /* AML_LGREATEREQUAL_OP */   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS|           AML_HAS_ARGS, "LGreater_equal",     ARGP_LGREATEREQUAL_OP,     ARGI_LGREATEREQUAL_OP),
-/*  63 */   /* AML_INT_NAMEPATH_OP */     OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL|         AML_NO_ARGS,  "Name_path",          ARGP_NAMEPATH_OP,          ARGI_NAMEPATH_OP),
-/*  64 */   /* AML_INT_METHODCALL_OP */         OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_CALL|     AML_HAS_ARGS, "Method_call",        ARGP_METHODCALL_OP,        ARGI_METHODCALL_OP),
-/*  65 */   /* AML_INT_BYTELIST_OP */     OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL|         AML_NO_ARGS,  "Byte_list",          ARGP_BYTELIST_OP,          ARGI_BYTELIST_OP),
-/*  66 */   /* AML_INT_RESERVEDFIELD_OP */  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS|           AML_NO_ARGS,  "Reserved_field",     ARGP_RESERVEDFIELD_OP,     ARGI_RESERVEDFIELD_OP),
-/*  67 */   /* AML_INT_NAMEDFIELD_OP */         OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS|           AML_NO_ARGS,  "Named_field",        ARGP_NAMEDFIELD_OP,        ARGI_NAMEDFIELD_OP),
-/*  68 */   /* AML_INT_ACCESSFIELD_OP */       OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS|           AML_NO_ARGS,  "Access_field",       ARGP_ACCESSFIELD_OP,       ARGI_ACCESSFIELD_OP),
-/*  69 */   /* AML_INT_STATICSTRING_OP */   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS|           AML_NO_ARGS,  "Static_string",      ARGP_STATICSTRING_OP,      ARGI_STATICSTRING_OP),
-/*  6_a */  /* AML_INT_RETURN_VALUE_OP */   OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_RETURN|          AML_HAS_ARGS, "[Return Value]",     ARG_NONE,                  ARG_NONE),
-/*  6_b */  /* UNKNOWN OPCODES */       OP_INFO_ENTRY (ACPI_OP_TYPE_UNKNOWN | OPTYPE_BOGUS|          AML_HAS_ARGS, "UNKNOWN_OP!",        ARG_NONE,                  ARG_NONE),
-/*  6_c */  /* ASCII CHARACTERS */        OP_INFO_ENTRY (ACPI_OP_TYPE_ASCII  | OPTYPE_BOGUS|           AML_HAS_ARGS, "ASCII_ONLY!",        ARG_NONE,                  ARG_NONE),
-/*  6_d */  /* PREFIX CHARACTERS */      OP_INFO_ENTRY (ACPI_OP_TYPE_PREFIX | OPTYPE_BOGUS|           AML_HAS_ARGS, "PREFIX_ONLY!",       ARG_NONE,                  ARG_NONE),
+/* 60 */ ACPI_OP ("LNot_equal",         ARGP_LNOTEQUAL_OP,         ARGI_LNOTEQUAL_OP,          ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS|           AML_HAS_ARGS),
+/* 61 */ ACPI_OP ("LLess_equal",        ARGP_LLESSEQUAL_OP,        ARGI_LLESSEQUAL_OP,         ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS|           AML_HAS_ARGS),
+/* 62 */ ACPI_OP ("LGreater_equal",     ARGP_LGREATEREQUAL_OP,     ARGI_LGREATEREQUAL_OP,      ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS|           AML_HAS_ARGS),
+/* 63 */ ACPI_OP ("[Name_path]",        ARGP_NAMEPATH_OP,          ARGI_NAMEPATH_OP,           ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL|         AML_NO_ARGS|AML_NSOBJECT|AML_NSNODE ),
+/* 64 */ ACPI_OP ("[Method_call]",      ARGP_METHODCALL_OP,        ARGI_METHODCALL_OP,         ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_CALL|     AML_HAS_ARGS|AML_NSOBJECT|AML_NSNODE),
+/* 65 */ ACPI_OP ("[Byte_list]",        ARGP_BYTELIST_OP,          ARGI_BYTELIST_OP,           ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL|         AML_NO_ARGS ),
+/* 66 */ ACPI_OP ("[Reserved_field]",   ARGP_RESERVEDFIELD_OP,     ARGI_RESERVEDFIELD_OP,      ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS|           AML_NO_ARGS ),
+/* 67 */ ACPI_OP ("[Named_field]",      ARGP_NAMEDFIELD_OP,        ARGI_NAMEDFIELD_OP,         ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS|           AML_NO_ARGS|AML_NSOBJECT|AML_NSOPCODE|AML_NSNODE|AML_NAMED ),
+/* 68 */ ACPI_OP ("[Access_field]",     ARGP_ACCESSFIELD_OP,       ARGI_ACCESSFIELD_OP,        ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS|           AML_NO_ARGS ),
+/* 69 */ ACPI_OP ("[Static_string",     ARGP_STATICSTRING_OP,      ARGI_STATICSTRING_OP,       ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS|           AML_NO_ARGS ),
+/* 6_a */ ACPI_OP ("[Return Value]",    ARG_NONE,                  ARG_NONE,                   ACPI_OP_TYPE_OPCODE | OPTYPE_RETURN|          AML_HAS_ARGS),
+/* 6_b */ ACPI_OP ("UNKNOWN_OP!",       ARG_NONE,                  ARG_NONE,                   ACPI_OP_TYPE_UNKNOWN | OPTYPE_BOGUS|          AML_HAS_ARGS),
+/* 6_c */ ACPI_OP ("ASCII_ONLY!",       ARG_NONE,                  ARG_NONE,                   ACPI_OP_TYPE_ASCII  | OPTYPE_BOGUS|           AML_HAS_ARGS),
+/* 6_d */ ACPI_OP ("PREFIX_ONLY!",      ARG_NONE,                  ARG_NONE,                   ACPI_OP_TYPE_PREFIX | OPTYPE_BOGUS|           AML_HAS_ARGS),
 
 
 /* ACPI 2.0 (new) opcodes */
 
-/*  6_e */  /* AML_QWORD_OP */  OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL|         AML_NO_ARGS,  "Qword_const",        ARGP_QWORD_OP,             ARGI_QWORD_OP),
-/*  6_f */  /* AML_VAR_PACKAGE_OP */    OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DATA_TERM|       AML_HAS_ARGS, "Var_package",        ARGP_VAR_PACKAGE_OP,       ARGI_VAR_PACKAGE_OP),
-/*  70 */   /* AML_CONCAT_RES_OP */      OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "Concat_res",         ARGP_CONCAT_RES_OP,        ARGI_CONCAT_RES_OP),
-/*  71 */   /* AML_MOD_OP */      OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS, "Mod",                ARGP_MOD_OP,               ARGI_MOD_OP),
-/*  72 */   /* AML_CREATE_QWORD_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD|    AML_HAS_ARGS, "Create_qWord_field", ARGP_CREATE_QWORD_FIELD_OP,ARGI_CREATE_QWORD_FIELD_OP),
-/*  73 */   /* AML_TO_BUFFER_OP */        OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "To_buffer",          ARGP_TO_BUFFER_OP,         ARGI_TO_BUFFER_OP),
-/*  74 */   /* AML_TO_DEC_STR_OP */      OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "To_dec_string",      ARGP_TO_DEC_STR_OP,        ARGI_TO_DEC_STR_OP),
-/*  75 */   /* AML_TO_HEX_STR_OP */      OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "To_hex_string",      ARGP_TO_HEX_STR_OP,        ARGI_TO_HEX_STR_OP),
-/*  76 */   /* AML_TO_INTEGER_OP */      OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "To_integer",         ARGP_TO_INTEGER_OP,        ARGI_TO_INTEGER_OP),
-/*  77 */   /* AML_TO_STRING_OP */        OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "To_string",          ARGP_TO_STRING_OP,         ARGI_TO_STRING_OP),
-/*  78 */   /* AML_COPY_OP */    OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "Copy_object",        ARGP_COPY_OP,              ARGI_COPY_OP),
-/*  79 */   /* AML_MID_OP */      OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "Mid",                ARGP_MID_OP,               ARGI_MID_OP),
-/*  7_a */  /* AML_CONTINUE_OP */       OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL|         AML_NO_ARGS,  "Continue",           ARGP_CONTINUE_OP,          ARGI_CONTINUE_OP),
-/*  7_b */  /* AML_LOAD_TABLE_OP */      OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "Load_table",         ARGP_LOAD_TABLE_OP,        ARGI_LOAD_TABLE_OP),
-/*  7_c */  /* AML_DATA_REGION_OP */    OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS, "Data_op_region",     ARGP_DATA_REGION_OP,       ARGI_DATA_REGION_OP),
+/* 6_e */ ACPI_OP ("Qword_const",       ARGP_QWORD_OP,             ARGI_QWORD_OP,              ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL|         AML_NO_ARGS ),
+/* 6_f */ ACPI_OP ("Var_package",       ARGP_VAR_PACKAGE_OP,       ARGI_VAR_PACKAGE_OP,        ACPI_OP_TYPE_OPCODE | OPTYPE_DATA_TERM|       AML_HAS_ARGS|AML_DEFER),
+/* 70 */ ACPI_OP ("Concat_res",         ARGP_CONCAT_RES_OP,        ARGI_CONCAT_RES_OP,         ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS),
+/* 71 */ ACPI_OP ("Mod",                ARGP_MOD_OP,               ARGI_MOD_OP,                ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS),
+/* 72 */ ACPI_OP ("Create_qWord_field", ARGP_CREATE_QWORD_FIELD_OP,ARGI_CREATE_QWORD_FIELD_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD|    AML_HAS_ARGS|AML_NSOBJECT|AML_NSNODE|AML_DEFER|AML_CREATE),
+/* 73 */ ACPI_OP ("To_buffer",          ARGP_TO_BUFFER_OP,         ARGI_TO_BUFFER_OP,          ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS),
+/* 74 */ ACPI_OP ("To_decimal_string",  ARGP_TO_DEC_STR_OP,        ARGI_TO_DEC_STR_OP,         ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS),
+/* 75 */ ACPI_OP ("To_hex_string",      ARGP_TO_HEX_STR_OP,        ARGI_TO_HEX_STR_OP,         ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS),
+/* 76 */ ACPI_OP ("To_integer",         ARGP_TO_INTEGER_OP,        ARGI_TO_INTEGER_OP,         ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS),
+/* 77 */ ACPI_OP ("To_string",          ARGP_TO_STRING_OP,         ARGI_TO_STRING_OP,          ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r|       AML_HAS_ARGS),
+/* 78 */ ACPI_OP ("Copy_object",        ARGP_COPY_OP,              ARGI_COPY_OP,               ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS),
+/* 79 */ ACPI_OP ("Mid",                ARGP_MID_OP,               ARGI_MID_OP,                ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS),
+/* 7_a */ ACPI_OP ("Continue",          ARGP_CONTINUE_OP,          ARGI_CONTINUE_OP,           ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL|         AML_NO_ARGS ),
+/* 7_b */ ACPI_OP ("Load_table",        ARGP_LOAD_TABLE_OP,        ARGI_LOAD_TABLE_OP,         ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS),
+/* 7_c */ ACPI_OP ("Data_op_region",    ARGP_DATA_REGION_OP,       ARGI_DATA_REGION_OP,        ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r|      AML_HAS_ARGS),
 
 };
 
@@ -480,7 +592,7 @@ static ACPI_OPCODE_INFO    aml_op_info[] =
  * index into the table above
  */
 
-static u8 aml_short_op_info_index[256] =
+static const u8 aml_short_op_info_index[256] =
 {
 /*              0     1     2     3     4     5     6     7  */
 /*              8     9     A     B     C     D     E     F  */
@@ -519,7 +631,7 @@ static u8 aml_short_op_info_index[256] =
 };
 
 
-static u8 aml_long_op_info_index[NUM_EXTENDED_OPCODE] =
+static const u8 aml_long_op_info_index[NUM_EXTENDED_OPCODE] =
 {
 /*              0     1     2     3     4     5     6     7  */
 /*              8     9     A     B     C     D     E     F  */
@@ -558,11 +670,11 @@ static u8 aml_long_op_info_index[NUM_EXTENDED_OPCODE] =
  *
  ******************************************************************************/
 
-ACPI_OPCODE_INFO *
+const acpi_opcode_info *
 acpi_ps_get_opcode_info (
        u16                     opcode)
 {
-       ACPI_OPCODE_INFO        *op_info;
+       const acpi_opcode_info  *op_info;
        u8                      upper_opcode;
        u8                      lower_opcode;
 
@@ -603,16 +715,9 @@ acpi_ps_get_opcode_info (
                break;
 
 
-       case AML_LNOT_OP:
-
-               /* This case is for the bogus opcodes LNOTEQUAL, LLESSEQUAL, LGREATEREQUAL */
-               /* TBD: [Investigate] remove this case? */
-
-               break;
-
-
        default:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown extended opcode=%X\n", opcode));
                break;
        }
 
@@ -640,14 +745,18 @@ NATIVE_CHAR *
 acpi_ps_get_opcode_name (
        u16                     opcode)
 {
-       ACPI_OPCODE_INFO             *op;
+       const acpi_opcode_info  *op;
 
 
        op = acpi_ps_get_opcode_info (opcode);
 
        /* Always guaranteed to return a valid pointer */
 
+#ifdef ACPI_DEBUG
+       return (op->name);
+#else
        return ("AE_NOT_CONFIGURED");
+#endif
 }
 
 
index 44b4e454554e97697cb9ce7a50d623f142f39ef4..31c431d03187d4b3750fcd87527d8caa36c2d033 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: psparse - Parser top level AML parse routines
- *              $Revision: 85 $
+ *              $Revision: 96 $
  *
  *****************************************************************************/
 
@@ -51,13 +51,13 @@ extern u32                  acpi_gbl_scope_depth;
 
 /*******************************************************************************
  *
- * FUNCTION:    Acpi_ps_peek_opcode
+ * FUNCTION:    Acpi_ps_get_opcode_size
  *
- * PARAMETERS:  None
+ * PARAMETERS:  Opcode          - An AML opcode
  *
- * RETURN:      Status
+ * RETURN:      Size of the opcode, in bytes (1 or 2)
  *
- * DESCRIPTION: Get next AML opcode (without incrementing AML pointer)
+ * DESCRIPTION: Get the size of the current opcode.
  *
  ******************************************************************************/
 
@@ -92,7 +92,7 @@ acpi_ps_get_opcode_size (
 
 u16
 acpi_ps_peek_opcode (
-       ACPI_PARSE_STATE        *parser_state)
+       acpi_parse_state        *parser_state)
 {
        u8                      *aml;
        u16                     opcode;
@@ -118,7 +118,6 @@ acpi_ps_peek_opcode (
         *
         *     extended Opcode, !=, <=, or >=
         */
-
        if (opcode == AML_EXTOP) {
                /* Extended opcode */
 
@@ -145,17 +144,20 @@ acpi_ps_peek_opcode (
  *
  ******************************************************************************/
 
-ACPI_PARSE_STATE *
+acpi_parse_state *
 acpi_ps_create_state (
        u8                      *aml,
        u32                     aml_size)
 {
-       ACPI_PARSE_STATE        *parser_state;
+       acpi_parse_state        *parser_state;
+
 
+       FUNCTION_TRACE ("Ps_create_state");
 
-       parser_state = acpi_ut_callocate (sizeof (ACPI_PARSE_STATE));
+
+       parser_state = ACPI_MEM_CALLOCATE (sizeof (acpi_parse_state));
        if (!parser_state) {
-               return (NULL);
+               return_PTR (NULL);
        }
 
        parser_state->aml      = aml;
@@ -164,7 +166,7 @@ acpi_ps_create_state (
        parser_state->aml_start = aml;
 
 
-       return (parser_state);
+       return_PTR (parser_state);
 }
 
 
@@ -188,19 +190,21 @@ acpi_ps_create_state (
 
 #ifdef PARSER_ONLY
 
-ACPI_STATUS
+acpi_status
 acpi_ps_find_object (
        u16                     opcode,
-       ACPI_PARSE_OBJECT       *op,
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       **out_op)
+       acpi_parse_object       *op,
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       **out_op)
 {
        NATIVE_CHAR             *path;
+       const acpi_opcode_info  *op_info;
 
 
        /* We are only interested in opcodes that have an associated name */
 
-       if (!acpi_ps_is_named_op (opcode)) {
+       op_info = acpi_ps_get_opcode_info (opcode);
+       if (!(op_info->flags & AML_NAMED)) {
                *out_op = op;
                return (AE_OK);
        }
@@ -237,16 +241,19 @@ acpi_ps_find_object (
 
 static u8
 acpi_ps_complete_this_op (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *op)
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *op)
 {
 #ifndef PARSER_ONLY
-       ACPI_PARSE_OBJECT       *prev;
-       ACPI_PARSE_OBJECT       *next;
-       ACPI_OPCODE_INFO        *op_info;
-       ACPI_OPCODE_INFO        *parent_info;
+       acpi_parse_object       *prev;
+       acpi_parse_object       *next;
+       const acpi_opcode_info  *op_info;
+       const acpi_opcode_info  *parent_info;
        u32                     opcode_class;
-       ACPI_PARSE_OBJECT       *replacement_op = NULL;
+       acpi_parse_object       *replacement_op = NULL;
+
+
+       FUNCTION_TRACE_PTR ("Ps_complete_this_op", op);
 
 
        op_info     = acpi_ps_get_opcode_info (op->opcode);
@@ -269,7 +276,6 @@ acpi_ps_complete_this_op (
                         * 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);
 
                        switch (ACPI_GET_OP_CLASS (parent_info)) {
@@ -282,7 +288,6 @@ acpi_ps_complete_this_op (
                                 * These opcodes contain Term_arg operands. The current
                                 * op must be replace by a placeholder return op
                                 */
-
                                if ((op->parent->opcode == AML_REGION_OP)               ||
                                        (op->parent->opcode == AML_CREATE_FIELD_OP)         ||
                                        (op->parent->opcode == AML_CREATE_BIT_FIELD_OP)     ||
@@ -292,7 +297,7 @@ acpi_ps_complete_this_op (
                                        (op->parent->opcode == AML_CREATE_QWORD_FIELD_OP)) {
                                        replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP);
                                        if (!replacement_op) {
-                                               return (FALSE);
+                                               return_VALUE (FALSE);
                                        }
                                }
 
@@ -301,7 +306,7 @@ acpi_ps_complete_this_op (
                        default:
                                replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP);
                                if (!replacement_op) {
-                                       return (FALSE);
+                                       return_VALUE (FALSE);
                                }
                        }
 
@@ -351,10 +356,10 @@ acpi_ps_complete_this_op (
 
                acpi_ps_delete_parse_tree (op);
 
-               return (TRUE);
+               return_VALUE (TRUE);
        }
 
-       return (FALSE);
+       return_VALUE (FALSE);
 
 #else
        return (FALSE);
@@ -374,18 +379,21 @@ acpi_ps_complete_this_op (
  *
  ******************************************************************************/
 
-static ACPI_STATUS
+static acpi_status
 acpi_ps_next_parse_state (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *op,
-       ACPI_STATUS             callback_status)
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *op,
+       acpi_status             callback_status)
 {
-       ACPI_PARSE_STATE        *parser_state = walk_state->parser_state;
-       ACPI_STATUS             status = AE_CTRL_PENDING;
+       acpi_parse_state        *parser_state = walk_state->parser_state;
+       acpi_status             status = AE_CTRL_PENDING;
        u8                      *start;
        u32                     package_length;
 
 
+       FUNCTION_TRACE_PTR ("Ps_next_parse_state", op);
+
+
        switch (callback_status) {
        case AE_CTRL_TERMINATE:
 
@@ -393,7 +401,6 @@ acpi_ps_next_parse_state (
                 * A control method was terminated via a RETURN statement.
                 * The walk of this method is complete.
                 */
-
                parser_state->aml = parser_state->aml_end;
                status = AE_CTRL_TERMINATE;
                break;
@@ -401,13 +408,11 @@ acpi_ps_next_parse_state (
 
        case AE_CTRL_PENDING:
 
-                       /*
-                        * Predicate of a WHILE was true and the loop just completed an
-                        * execution.  Go back to the start of the loop and reevaluate the
-                        * predicate.
-                        */
-/*            Walk_state->Control_state->Common.State =
-                                       CONTROL_PREDICATE_EXECUTING;*/
+               /*
+                * Predicate of a WHILE was true and the loop just completed an
+                * execution.  Go back to the start of the loop and reevaluate the
+                * predicate.
+                */
 
                /* TBD: How to handle a break within a while. */
                /* This code attempts it */
@@ -417,13 +422,13 @@ acpi_ps_next_parse_state (
 
 
        case AE_CTRL_TRUE:
-                       /*
-                        * Predicate of an IF was true, and we are at the matching ELSE.
-                        * Just close out this package
-                        *
-                        * Note: Parser_state->Aml is modified by the package length procedure
-                        * TBD: [Investigate] perhaps it shouldn't, too much trouble
-                        */
+               /*
+                * Predicate of an IF was true, and we are at the matching ELSE.
+                * Just close out this package
+                *
+                * Note: Parser_state->Aml is modified by the package length procedure
+                * TBD: [Investigate] perhaps it shouldn't, too much trouble
+                */
                start = parser_state->aml;
                package_length = acpi_ps_get_next_package_length (parser_state);
                parser_state->aml = start + package_length;
@@ -439,7 +444,6 @@ acpi_ps_next_parse_state (
                 * this branch of the tree) and continue execution at the parent
                 * level.
                 */
-
                parser_state->aml = parser_state->scope->parse_scope.pkg_end;
 
                /* In the case of a BREAK, just force a predicate (if any) to FALSE */
@@ -473,8 +477,7 @@ acpi_ps_next_parse_state (
                break;
        }
 
-
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -491,24 +494,27 @@ acpi_ps_next_parse_state (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ps_parse_loop (
-       ACPI_WALK_STATE         *walk_state)
+       acpi_walk_state         *walk_state)
 {
-       ACPI_STATUS             status = AE_OK;
-       ACPI_PARSE_OBJECT       *op = NULL;     /* current op */
-       ACPI_OPCODE_INFO        *op_info;
-       ACPI_PARSE_OBJECT       *arg = NULL;
-       ACPI_PARSE2_OBJECT      *deferred_op;
+       acpi_status             status = AE_OK;
+       acpi_parse_object       *op = NULL;     /* current op */
+       const acpi_opcode_info  *op_info;
+       acpi_parse_object       *arg = NULL;
+       acpi_parse2_object      *deferred_op;
        u32                     arg_count;      /* push for fixed or var args */
        u32                     arg_types = 0;
        u32                     aml_offset;
        u16                     opcode;
-       ACPI_PARSE_OBJECT       pre_op;
-       ACPI_PARSE_STATE        *parser_state;
+       acpi_parse_object       pre_op;
+       acpi_parse_state        *parser_state;
        u8                      *aml_op_start;
 
 
+       FUNCTION_TRACE_PTR ("Ps_parse_loop", walk_state);
+
+
        parser_state = walk_state->parser_state;
 
 #ifndef PARSER_ONLY
@@ -531,17 +537,25 @@ acpi_ps_parse_loop (
                                 * A predicate was just completed, get the value of the
                                 * predicate and branch based on that value
                                 */
-
                                status = acpi_ds_get_predicate_value (walk_state, NULL, TRUE);
                                if (ACPI_FAILURE (status) &&
                                        ((status & AE_CODE_MASK) != AE_CODE_CONTROL)) {
-                                       return (status);
+                                       if (status == AE_AML_NO_RETURN_VALUE) {
+                                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                                                       "Invoked method did not return a value, %s\n",
+                                                       acpi_format_exception (status)));
+
+                                       }
+                                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Get_predicate Failed, %s\n",
+                                               acpi_format_exception (status)));
+                                       return_ACPI_STATUS (status);
                                }
 
                                status = acpi_ps_next_parse_state (walk_state, op, status);
                        }
 
                        acpi_ps_pop_scope (parser_state, &op, &arg_types, &arg_count);
+                       ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", op));
                }
 
                else if (walk_state->prev_op) {
@@ -570,7 +584,6 @@ acpi_ps_parse_loop (
                         * 2) A name string
                         * 3) An unknown/invalid opcode
                         */
-
                        op_info = acpi_ps_get_opcode_info (opcode);
                        switch (ACPI_GET_OP_TYPE (op_info)) {
                        case ACPI_OP_TYPE_OPCODE:
@@ -587,7 +600,6 @@ acpi_ps_parse_loop (
                                 * Starts with a valid prefix or ASCII char, this is a name
                                 * string.  Convert the bare name string to a namepath.
                                 */
-
                                opcode = AML_INT_NAMEPATH_OP;
                                arg_types = ARGP_NAMESTRING;
                                break;
@@ -596,6 +608,12 @@ acpi_ps_parse_loop (
 
                                /* The opcode is unrecognized.  Just skip unknown opcodes */
 
+                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                                       "Found unknown opcode %lX at AML offset %X, ignoring\n",
+                                       opcode, aml_offset));
+
+                               DUMP_BUFFER (parser_state->aml, 128);
+
                                /* Assume one-byte bad opcode */
 
                                parser_state->aml++;
@@ -605,7 +623,7 @@ acpi_ps_parse_loop (
 
                        /* Create Op structure and append to parent's argument list */
 
-                       if (acpi_ps_is_named_op (opcode)) {
+                       if (op_info->flags & AML_NAMED) {
                                pre_op.value.arg = NULL;
                                pre_op.opcode = opcode;
 
@@ -647,24 +665,22 @@ acpi_ps_parse_loop (
 
 
                                if (op->opcode == AML_REGION_OP) {
-                                       deferred_op = acpi_ps_to_extended_op (op);
-                                       if (deferred_op) {
-                                               /*
-                                                * Defer final parsing of an Operation_region body,
-                                                * because we don't have enough info in the first pass
-                                                * to parse it correctly (i.e., there may be method
-                                                * calls within the Term_arg elements of the body.
-                                                *
-                                                * However, we must continue parsing because
-                                                * the opregion is not a standalone package --
-                                                * we don't know where the end is at this point.
-                                                *
-                                                * (Length is unknown until parse of the body complete)
-                                                */
-
-                                               deferred_op->data   = aml_op_start;
-                                               deferred_op->length = 0;
-                                       }
+                                       deferred_op = (acpi_parse2_object *) op;
+
+                                       /*
+                                        * Defer final parsing of an Operation_region body,
+                                        * because we don't have enough info in the first pass
+                                        * to parse it correctly (i.e., there may be method
+                                        * calls within the Term_arg elements of the body.
+                                        *
+                                        * However, we must continue parsing because
+                                        * the opregion is not a standalone package --
+                                        * we don't know where the end is at this point.
+                                        *
+                                        * (Length is unknown until parse of the body complete)
+                                        */
+                                       deferred_op->data   = aml_op_start;
+                                       deferred_op->length = 0;
                                }
                        }
 
@@ -672,23 +688,19 @@ acpi_ps_parse_loop (
                        else {
                                /* Not a named opcode, just allocate Op and append to parent */
 
+                               op_info = acpi_ps_get_opcode_info (opcode);
                                op = acpi_ps_alloc_op (opcode);
                                if (!op) {
-                                       return (AE_NO_MEMORY);
+                                       return_ACPI_STATUS (AE_NO_MEMORY);
                                }
 
 
-                               if ((op->opcode == AML_CREATE_FIELD_OP)        ||
-                                       (op->opcode == AML_CREATE_BIT_FIELD_OP)    ||
-                                       (op->opcode == AML_CREATE_BYTE_FIELD_OP)   ||
-                                       (op->opcode == AML_CREATE_WORD_FIELD_OP)   ||
-                                       (op->opcode == AML_CREATE_DWORD_FIELD_OP)  ||
-                                       (op->opcode == AML_CREATE_QWORD_FIELD_OP)) {
+                               if (op_info->flags & AML_CREATE) {
                                        /*
                                         * Backup to beginning of Create_xXXfield declaration
                                         * Body_length is unknown until we parse the body
                                         */
-                                       deferred_op = (ACPI_PARSE2_OBJECT *) op;
+                                       deferred_op = (acpi_parse2_object *) op;
 
                                        deferred_op->data   = aml_op_start;
                                        deferred_op->length = 0;
@@ -716,6 +728,11 @@ acpi_ps_parse_loop (
 
                        op->aml_offset = aml_offset;
 
+                       if (op_info) {
+                               ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+                                       "Op=%p Opcode=%4.4lX Aml %p Oft=%5.5lX\n",
+                                        op, op->opcode, parser_state->aml, op->aml_offset));
+                       }
                }
 
 
@@ -731,6 +748,7 @@ acpi_ps_parse_loop (
                        case AML_BYTE_OP:       /* AML_BYTEDATA_ARG */
                        case AML_WORD_OP:       /* AML_WORDDATA_ARG */
                        case AML_DWORD_OP:      /* AML_DWORDATA_ARG */
+                       case AML_QWORD_OP:      /* AML_QWORDATA_ARG */
                        case AML_STRING_OP:     /* AML_ASCIICHARLIST_ARG */
 
                                /* fill in constant or string argument directly */
@@ -767,26 +785,24 @@ acpi_ps_parse_loop (
                                /* For a method, save the length and address of the body */
 
                                if (op->opcode == AML_METHOD_OP) {
-                                       deferred_op = acpi_ps_to_extended_op (op);
-                                       if (deferred_op) {
-                                               /*
-                                                * Skip parsing of control method or opregion body,
-                                                * because we don't have enough info in the first pass
-                                                * to parse them correctly.
-                                                */
-
-                                               deferred_op->data   = parser_state->aml;
-                                               deferred_op->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
-                                                * package (We don't know where the end is).
-                                                */
-                                               parser_state->aml   = parser_state->pkg_end;
-                                               arg_count           = 0;
-                                       }
+                                       deferred_op = (acpi_parse2_object *) op;
+
+                                       /*
+                                        * Skip parsing of control method or opregion body,
+                                        * because we don't have enough info in the first pass
+                                        * to parse them correctly.
+                                        */
+                                       deferred_op->data   = parser_state->aml;
+                                       deferred_op->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
+                                        * package (We don't know where the end is).
+                                        */
+                                       parser_state->aml   = parser_state->pkg_end;
+                                       arg_count           = 0;
                                }
 
                                break;
@@ -800,42 +816,36 @@ acpi_ps_parse_loop (
                if (!arg_count) {
                        /* completed Op, prepare for next */
 
-                       if (acpi_ps_is_named_op (op->opcode)) {
+                       op_info = acpi_ps_get_opcode_info (op->opcode);
+                       if (op_info->flags & AML_NAMED) {
                                if (acpi_gbl_depth) {
                                        acpi_gbl_depth--;
                                }
 
                                if (op->opcode == AML_REGION_OP) {
-                                       deferred_op = acpi_ps_to_extended_op (op);
-                                       if (deferred_op) {
-                                               /*
-                                                * Skip parsing of control method or opregion body,
-                                                * because we don't have enough info in the first pass
-                                                * to parse them correctly.
-                                                *
-                                                * Completed parsing an Op_region declaration, we now
-                                                * know the length.
-                                                */
-
-                                               deferred_op->length = (u32) (parser_state->aml -
-                                                                  deferred_op->data);
-                                       }
+                                       deferred_op = (acpi_parse2_object *) op;
+
+                                       /*
+                                        * Skip parsing of control method or opregion body,
+                                        * because we don't have enough info in the first pass
+                                        * to parse them correctly.
+                                        *
+                                        * Completed parsing an Op_region declaration, we now
+                                        * know the length.
+                                        */
+                                       deferred_op->length = (u32) (parser_state->aml -
+                                                          deferred_op->data);
                                }
                        }
 
-                       if ((op->opcode == AML_CREATE_FIELD_OP)         ||
-                               (op->opcode == AML_CREATE_BIT_FIELD_OP)     ||
-                               (op->opcode == AML_CREATE_BYTE_FIELD_OP)    ||
-                               (op->opcode == AML_CREATE_WORD_FIELD_OP)    ||
-                               (op->opcode == AML_CREATE_DWORD_FIELD_OP)   ||
-                               (op->opcode == AML_CREATE_QWORD_FIELD_OP)) {
+                       if (op_info->flags & AML_CREATE) {
                                /*
                                 * Backup to beginning of Create_xXXfield declaration (1 for
                                 * Opcode)
                                 *
                                 * Body_length is unknown until we parse the body
                                 */
-                               deferred_op = (ACPI_PARSE2_OBJECT *) op;
+                               deferred_op = (acpi_parse2_object *) op;
                                deferred_op->length = (u32) (parser_state->aml -
                                                  deferred_op->data);
                        }
@@ -878,7 +888,7 @@ close_this_op:
                                 */
                                walk_state->prev_op = op;
                                walk_state->prev_arg_types = arg_types;
-                               return (status);
+                               return_ACPI_STATUS (status);
                                break;
 
 
@@ -908,7 +918,7 @@ close_this_op:
                                        acpi_ps_pop_scope (parser_state, &op, &arg_types, &arg_count);
                                } while (op);
 
-                               return (status);
+                               return_ACPI_STATUS (status);
                                break;
 
 
@@ -924,15 +934,15 @@ close_this_op:
                                 * TEMP:
                                 */
 
-                               return (status);
+                               return_ACPI_STATUS (status);
                                break;
                        }
 
-
                        /* This scope complete? */
 
                        if (acpi_ps_has_completed_scope (parser_state)) {
                                acpi_ps_pop_scope (parser_state, &op, &arg_types, &arg_count);
+                               ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", op));
                        }
 
                        else {
@@ -960,7 +970,7 @@ close_this_op:
         * of open scopes (such as when several AML blocks are closed with
         * sequential closing braces).  We want to terminate each one cleanly.
         */
-
+       ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Package complete at Op %p\n", op));
        do {
                if (op) {
                        if (walk_state->ascending_callback != NULL) {
@@ -984,12 +994,12 @@ close_this_op:
 
                                        } while (op);
 
-                                       return (status);
+                                       return_ACPI_STATUS (status);
                                }
 
                                else if (ACPI_FAILURE (status)) {
                                        acpi_ps_complete_this_op (walk_state, op);
-                                       return (status);
+                                       return_ACPI_STATUS (status);
                                }
                        }
 
@@ -1000,7 +1010,7 @@ close_this_op:
 
        } while (op);
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -1013,39 +1023,45 @@ close_this_op:
  *              Aml             - Pointer to the raw AML code to parse
  *              Aml_size        - Length of the AML to parse
  *
+ *
  * RETURN:      Status
  *
  * DESCRIPTION: Parse raw AML and return a tree of ops
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ps_parse_aml (
-       ACPI_PARSE_OBJECT       *start_scope,
+       acpi_parse_object       *start_scope,
        u8                      *aml,
        u32                     aml_size,
        u32                     parse_flags,
-       ACPI_NAMESPACE_NODE     *method_node,
-       ACPI_OPERAND_OBJECT     **params,
-       ACPI_OPERAND_OBJECT     **caller_return_desc,
-       ACPI_PARSE_DOWNWARDS    descending_callback,
-       ACPI_PARSE_UPWARDS      ascending_callback)
+       acpi_namespace_node     *method_node,
+       acpi_operand_object     **params,
+       acpi_operand_object     **caller_return_desc,
+       acpi_parse_downwards    descending_callback,
+       acpi_parse_upwards      ascending_callback)
 {
-       ACPI_STATUS             status;
-       ACPI_PARSE_STATE        *parser_state;
-       ACPI_WALK_STATE         *walk_state;
-       ACPI_WALK_LIST          walk_list;
-       ACPI_NAMESPACE_NODE     *node = NULL;
-       ACPI_WALK_LIST          *prev_walk_list = acpi_gbl_current_walk_list;
-       ACPI_OPERAND_OBJECT     *return_desc;
-       ACPI_OPERAND_OBJECT     *mth_desc = NULL;
+       acpi_status             status;
+       acpi_parse_state        *parser_state;
+       acpi_walk_state         *walk_state;
+       acpi_walk_list          walk_list;
+       acpi_walk_list          *prev_walk_list = acpi_gbl_current_walk_list;
+       acpi_operand_object     *return_desc;
+       acpi_operand_object     *mth_desc = NULL;
+
+
+       FUNCTION_TRACE ("Ps_parse_aml");
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Entered with Scope=%p Aml=%p size=%lX\n",
+               start_scope, aml, aml_size));
 
 
        /* Create and initialize a new parser state */
 
        parser_state = acpi_ps_create_state (aml, aml_size);
        if (!parser_state) {
-               return (AE_NO_MEMORY);
+               return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
        acpi_ps_init_scope (parser_state, start_scope);
@@ -1086,7 +1102,7 @@ acpi_ps_parse_aml (
 
                status = acpi_ds_scope_stack_push (method_node, ACPI_TYPE_METHOD, walk_state);
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
 
                /* Init arguments if this is a control method */
@@ -1098,14 +1114,12 @@ acpi_ps_parse_aml (
        else {
                /* Setup the current scope */
 
-               node = parser_state->start_op->node;
-               parser_state->start_node = node;
-
-               if (node) {
+               parser_state->start_node = parser_state->start_op->node;
+               if (parser_state->start_node) {
                        /* Push start scope on scope stack and make it current  */
 
-                       status = acpi_ds_scope_stack_push (node, node->type,
-                                          walk_state);
+                       status = acpi_ds_scope_stack_push (parser_state->start_node,
+                                         parser_state->start_node->type, walk_state);
                        if (ACPI_FAILURE (status)) {
                                goto cleanup;
                        }
@@ -1113,32 +1127,32 @@ acpi_ps_parse_aml (
                }
        }
 
-
-       status = AE_OK;
-
        /*
         * Execute the walk loop as long as there is a valid Walk State.  This
         * handles nested control method invocations without recursion.
         */
+       ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "State=%p\n", walk_state));
 
+       status = AE_OK;
        while (walk_state) {
                if (ACPI_SUCCESS (status)) {
                        status = acpi_ps_parse_loop (walk_state);
                }
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+                       "Completed one call to walk loop, State=%p\n", walk_state));
+
                if (status == AE_CTRL_TRANSFER) {
                        /*
                         * A method call was detected.
                         * Transfer control to the called control method
                         */
-
                        status = acpi_ds_call_control_method (&walk_list, walk_state, NULL);
 
                        /*
                         * If the transfer to the new method method call worked, a new walk
                         * state was created -- get it
                         */
-
                        walk_state = acpi_ds_get_current_walk_state (&walk_list);
                        continue;
                }
@@ -1149,13 +1163,15 @@ acpi_ps_parse_aml (
 
                /* We are done with this walk, move on to the parent if any */
 
-
                walk_state = acpi_ds_pop_walk_state (&walk_list);
 
                /* Extract return value before we delete Walk_state */
 
                return_desc = walk_state->return_desc;
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Return_value=%p, State=%p\n",
+                       walk_state->return_desc, walk_state));
+
                /* Reset the current scope to the beginning of scope stack */
 
                acpi_ds_scope_stack_clear (walk_state);
@@ -1164,18 +1180,17 @@ acpi_ps_parse_aml (
                 * If we just returned from the execution of a control method,
                 * 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);
                }
 
-                /* Delete this walk state and all linked control states */
+               /* Delete this walk state and all linked control states */
 
                acpi_ps_cleanup_scope (walk_state->parser_state);
-               acpi_ut_free (walk_state->parser_state);
+               ACPI_MEM_FREE (walk_state->parser_state);
                acpi_ds_delete_walk_state (walk_state);
 
-          /* Check if we have restarted a preempted walk */
+               /* Check if we have restarted a preempted walk */
 
                walk_state = acpi_ds_get_current_walk_state (&walk_list);
                if (walk_state &&
@@ -1186,7 +1201,6 @@ acpi_ps_parse_aml (
                         * If the method returned value is not used by the parent,
                         * The object is deleted
                         */
-
                        acpi_ds_restart_control_method (walk_state, return_desc);
                        walk_state->walk_type |= WALK_METHOD_RESTART;
                }
@@ -1195,7 +1209,6 @@ acpi_ps_parse_aml (
                 * Just completed a 1st-level method, save the final internal return
                 * value (if any)
                 */
-
                else if (caller_return_desc) {
                        *caller_return_desc = return_desc; /* NULL if no return value */
                }
@@ -1210,9 +1223,9 @@ acpi_ps_parse_aml (
 
        /* Normal exit */
 
-       acpi_ex_release_all_mutexes ((ACPI_OPERAND_OBJECT *) &walk_list.acquired_mutex_list);
+       acpi_ex_release_all_mutexes ((acpi_operand_object *) &walk_list.acquired_mutex_list);
        acpi_gbl_current_walk_list = prev_walk_list;
-       return (status);
+       return_ACPI_STATUS (status);
 
 
 cleanup:
@@ -1221,12 +1234,12 @@ cleanup:
 
        acpi_ds_delete_walk_state (walk_state);
        acpi_ps_cleanup_scope (parser_state);
-       acpi_ut_free (parser_state);
+       ACPI_MEM_FREE (parser_state);
 
-       acpi_ex_release_all_mutexes ((ACPI_OPERAND_OBJECT *)&walk_list.acquired_mutex_list);
+       acpi_ex_release_all_mutexes ((acpi_operand_object *)&walk_list.acquired_mutex_list);
        acpi_gbl_current_walk_list = prev_walk_list;
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
index eb03398ae48aa1966d5ce8ebc5355909406787ce..e1a264fab5223806c4293c523fa3110e78da76a1 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: psscope - Parser scope stack management routines
- *              $Revision: 27 $
+ *              $Revision: 29 $
  *
  *****************************************************************************/
 
@@ -43,9 +43,9 @@
  *
  ******************************************************************************/
 
-ACPI_PARSE_OBJECT *
+acpi_parse_object *
 acpi_ps_get_parent_scope (
-       ACPI_PARSE_STATE        *parser_state)
+       acpi_parse_state        *parser_state)
 {
        return (parser_state->scope->parse_scope.op);
 }
@@ -67,7 +67,7 @@ acpi_ps_get_parent_scope (
 
 u8
 acpi_ps_has_completed_scope (
-       ACPI_PARSE_STATE        *parser_state)
+       acpi_parse_state        *parser_state)
 {
        return ((u8) ((parser_state->aml >= parser_state->scope->parse_scope.arg_end ||
                           !parser_state->scope->parse_scope.arg_count)));
@@ -87,17 +87,20 @@ acpi_ps_has_completed_scope (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ps_init_scope (
-       ACPI_PARSE_STATE        *parser_state,
-       ACPI_PARSE_OBJECT       *root_op)
+       acpi_parse_state        *parser_state,
+       acpi_parse_object       *root_op)
 {
-       ACPI_GENERIC_STATE      *scope;
+       acpi_generic_state      *scope;
+
+
+       FUNCTION_TRACE_PTR ("Ps_init_scope", root_op);
 
 
        scope = acpi_ut_create_generic_state ();
        if (!scope) {
-               return (AE_NO_MEMORY);
+               return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
        scope->parse_scope.op       = root_op;
@@ -108,7 +111,7 @@ acpi_ps_init_scope (
        parser_state->scope         = scope;
        parser_state->start_op      = root_op;
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -127,14 +130,17 @@ acpi_ps_init_scope (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ps_push_scope (
-       ACPI_PARSE_STATE        *parser_state,
-       ACPI_PARSE_OBJECT       *op,
+       acpi_parse_state        *parser_state,
+       acpi_parse_object       *op,
        u32                     remaining_args,
        u32                     arg_count)
 {
-       ACPI_GENERIC_STATE      *scope;
+       acpi_generic_state      *scope;
+
+
+       FUNCTION_TRACE_PTR ("Ps_push_scope", op);
 
 
        scope = acpi_ut_create_generic_state ();
@@ -165,7 +171,7 @@ acpi_ps_push_scope (
                scope->parse_scope.arg_end = ACPI_MAX_AML;
        }
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -187,12 +193,15 @@ acpi_ps_push_scope (
 
 void
 acpi_ps_pop_scope (
-       ACPI_PARSE_STATE        *parser_state,
-       ACPI_PARSE_OBJECT       **op,
+       acpi_parse_state        *parser_state,
+       acpi_parse_object       **op,
        u32                     *arg_list,
        u32                     *arg_count)
 {
-       ACPI_GENERIC_STATE      *scope = parser_state->scope;
+       acpi_generic_state      *scope = parser_state->scope;
+
+
+       FUNCTION_TRACE ("Ps_pop_scope");
 
 
        /*
@@ -201,7 +210,6 @@ acpi_ps_pop_scope (
        if (scope->common.next) {
                scope = acpi_ut_pop_generic_state (&parser_state->scope);
 
-
                /* return to parsing previous op */
 
                *op                     = scope->parse_scope.op;
@@ -223,7 +231,8 @@ acpi_ps_pop_scope (
        }
 
 
-       return;
+       ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped Op %p Args %X\n", *op, *arg_count));
+       return_VOID;
 }
 
 
@@ -242,9 +251,11 @@ acpi_ps_pop_scope (
 
 void
 acpi_ps_cleanup_scope (
-       ACPI_PARSE_STATE        *parser_state)
+       acpi_parse_state        *parser_state)
 {
-       ACPI_GENERIC_STATE      *scope;
+       acpi_generic_state      *scope;
+
+       FUNCTION_TRACE_PTR ("Ps_cleanup_scope", parser_state);
 
 
        if (!parser_state) {
@@ -259,6 +270,6 @@ acpi_ps_cleanup_scope (
                acpi_ut_delete_generic_state (scope);
        }
 
-       return;
+       return_VOID;
 }
 
index b90fe4d0aec0529370de556a31342416ba8e9981..92a7cd21a653f4a13b8d2c7b971fa97ec4f21815 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: pstree - Parser op tree manipulation/traversal/search
- *              $Revision: 30 $
+ *              $Revision: 32 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_PARSE_OBJECT *
+acpi_parse_object *
 acpi_ps_get_arg (
-       ACPI_PARSE_OBJECT       *op,
+       acpi_parse_object       *op,
        u32                     argn)
 {
-       ACPI_PARSE_OBJECT       *arg = NULL;
-       ACPI_OPCODE_INFO        *op_info;
+       acpi_parse_object       *arg = NULL;
+       const acpi_opcode_info  *op_info;
+
+
+       FUNCTION_ENTRY ();
 
 
        /* Get the info structure for this opcode */
@@ -98,11 +101,14 @@ acpi_ps_get_arg (
 
 void
 acpi_ps_append_arg (
-       ACPI_PARSE_OBJECT       *op,
-       ACPI_PARSE_OBJECT       *arg)
+       acpi_parse_object       *op,
+       acpi_parse_object       *arg)
 {
-       ACPI_PARSE_OBJECT       *prev_arg;
-       ACPI_OPCODE_INFO        *op_info;
+       acpi_parse_object       *prev_arg;
+       const acpi_opcode_info  *op_info;
+
+
+       FUNCTION_ENTRY ();
 
 
        if (!op) {
@@ -167,11 +173,14 @@ acpi_ps_append_arg (
  *
  ******************************************************************************/
 
-ACPI_PARSE_OBJECT *
+acpi_parse_object *
 acpi_ps_get_child (
-       ACPI_PARSE_OBJECT       *op)
+       acpi_parse_object       *op)
 {
-       ACPI_PARSE_OBJECT       *child = NULL;
+       acpi_parse_object       *child = NULL;
+
+
+       FUNCTION_ENTRY ();
 
 
        switch (op->opcode) {
@@ -229,14 +238,17 @@ acpi_ps_get_child (
  *
  ******************************************************************************/
 
-ACPI_PARSE_OBJECT *
+acpi_parse_object *
 acpi_ps_get_depth_next (
-       ACPI_PARSE_OBJECT       *origin,
-       ACPI_PARSE_OBJECT       *op)
+       acpi_parse_object       *origin,
+       acpi_parse_object       *op)
 {
-       ACPI_PARSE_OBJECT       *next = NULL;
-       ACPI_PARSE_OBJECT       *parent;
-       ACPI_PARSE_OBJECT       *arg;
+       acpi_parse_object       *next = NULL;
+       acpi_parse_object       *parent;
+       acpi_parse_object       *arg;
+
+
+       FUNCTION_ENTRY ();
 
 
        if (!op) {
index 6611c7c7733c7b71cee50f9c86ba9eed0b9d9738..d30af713b50ba5ec12137cdd587af8c45a715833 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: psutils - Parser miscellaneous utilities (Parser only)
- *              $Revision: 37 $
+ *              $Revision: 43 $
  *
  *****************************************************************************/
 
 
 void
 acpi_ps_init_op (
-       ACPI_PARSE_OBJECT       *op,
+       acpi_parse_object       *op,
        u16                     opcode)
 {
-       ACPI_OPCODE_INFO        *aml_op;
+       const acpi_opcode_info  *aml_op;
+
+
+       FUNCTION_ENTRY ();
 
 
        op->data_type = ACPI_DESC_TYPE_PARSER;
@@ -85,105 +88,57 @@ acpi_ps_init_op (
  *
  ******************************************************************************/
 
-ACPI_PARSE_OBJECT*
+acpi_parse_object*
 acpi_ps_alloc_op (
        u16                     opcode)
 {
-       ACPI_PARSE_OBJECT       *op = NULL;
+       acpi_parse_object       *op = NULL;
        u32                     size;
        u8                      flags;
+       const acpi_opcode_info  *op_info;
 
 
-       PROC_NAME ("Ps_alloc_op");
+       FUNCTION_ENTRY ();
 
 
+       op_info = acpi_ps_get_opcode_info (opcode);
+
        /* Allocate the minimum required size object */
 
-       if (acpi_ps_is_deferred_op (opcode)) {
-               size = sizeof (ACPI_PARSE2_OBJECT);
+       if (op_info->flags & AML_DEFER) {
+               size = sizeof (acpi_parse2_object);
                flags = PARSEOP_DEFERRED;
        }
 
-       else if (acpi_ps_is_named_op (opcode)) {
-               size = sizeof (ACPI_PARSE2_OBJECT);
+       else if (op_info->flags & AML_NAMED) {
+               size = sizeof (acpi_parse2_object);
                flags = PARSEOP_NAMED;
        }
 
-       else if (acpi_ps_is_bytelist_op (opcode)) {
-               size = sizeof (ACPI_PARSE2_OBJECT);
+       else if (opcode == AML_INT_BYTELIST_OP) {
+               size = sizeof (acpi_parse2_object);
                flags = PARSEOP_BYTELIST;
        }
 
        else {
-               size = sizeof (ACPI_PARSE_OBJECT);
+               size = sizeof (acpi_parse_object);
                flags = PARSEOP_GENERIC;
        }
 
 
-       if (size == sizeof (ACPI_PARSE_OBJECT)) {
+       if (size == sizeof (acpi_parse_object)) {
                /*
-                * The generic op is by far the most common (16 to 1), and therefore
-                * the op cache is implemented with this type.
-                *
-                * Check if there is an Op already available in the cache
+                * The generic op is by far the most common (16 to 1)
                 */
-
-               acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
-               acpi_gbl_parse_cache_requests++;
-               if (acpi_gbl_parse_cache) {
-                       /* Extract an op from the front of the cache list */
-
-                       acpi_gbl_parse_cache_depth--;
-                       acpi_gbl_parse_cache_hits++;
-
-                       op = acpi_gbl_parse_cache;
-                       acpi_gbl_parse_cache = op->next;
-
-
-                       /* Clear the previously used Op */
-
-                       MEMSET (op, 0, sizeof (ACPI_PARSE_OBJECT));
-
-               }
-               acpi_ut_release_mutex (ACPI_MTX_CACHES);
+               op = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_PSNODE);
        }
 
        else {
-               /*
-                * The generic op is by far the most common (16 to 1), and therefore
-                * the op cache is implemented with this type.
-                *
-                * Check if there is an Op already available in the cache
-                */
-
-               acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
-               acpi_gbl_ext_parse_cache_requests++;
-               if (acpi_gbl_ext_parse_cache) {
-                       /* Extract an op from the front of the cache list */
-
-                       acpi_gbl_ext_parse_cache_depth--;
-                       acpi_gbl_ext_parse_cache_hits++;
-
-                       op = (ACPI_PARSE_OBJECT *) acpi_gbl_ext_parse_cache;
-                       acpi_gbl_ext_parse_cache = (ACPI_PARSE2_OBJECT *) op->next;
-
-
-                       /* Clear the previously used Op */
-
-                       MEMSET (op, 0, sizeof (ACPI_PARSE2_OBJECT));
-
-               }
-               acpi_ut_release_mutex (ACPI_MTX_CACHES);
-       }
-
-
-       /* Allocate a new Op if necessary */
-
-       if (!op) {
-               op = acpi_ut_callocate (size);
+               op = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_PSNODE_EXT);
        }
 
        /* Initialize the Op */
+
        if (op) {
                acpi_ps_init_op (op, opcode);
                op->flags = flags;
@@ -208,62 +163,22 @@ acpi_ps_alloc_op (
 
 void
 acpi_ps_free_op (
-       ACPI_PARSE_OBJECT       *op)
+       acpi_parse_object       *op)
 {
        PROC_NAME ("Ps_free_op");
 
 
+       if (op->opcode == AML_INT_RETURN_VALUE_OP) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Free retval op: %p\n", op));
+       }
 
        if (op->flags == PARSEOP_GENERIC) {
-               /* Is the cache full? */
-
-               if (acpi_gbl_parse_cache_depth < MAX_PARSE_CACHE_DEPTH) {
-                       /* Put a GENERIC_OP back into the cache */
-
-                       /* Clear the previously used Op */
-
-                       MEMSET (op, 0, sizeof (ACPI_PARSE_OBJECT));
-                       op->flags = PARSEOP_IN_CACHE;
-
-                       acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
-                       acpi_gbl_parse_cache_depth++;
-
-                       op->next = acpi_gbl_parse_cache;
-                       acpi_gbl_parse_cache = op;
-
-                       acpi_ut_release_mutex (ACPI_MTX_CACHES);
-                       return;
-               }
+               acpi_ut_release_to_cache (ACPI_MEM_LIST_PSNODE, op);
        }
 
        else {
-               /* Is the cache full? */
-
-               if (acpi_gbl_ext_parse_cache_depth < MAX_EXTPARSE_CACHE_DEPTH) {
-                       /* Put a GENERIC_OP back into the cache */
-
-                       /* Clear the previously used Op */
-
-                       MEMSET (op, 0, sizeof (ACPI_PARSE2_OBJECT));
-                       op->flags = PARSEOP_IN_CACHE;
-
-                       acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
-                       acpi_gbl_ext_parse_cache_depth++;
-
-                       op->next = (ACPI_PARSE_OBJECT *) acpi_gbl_ext_parse_cache;
-                       acpi_gbl_ext_parse_cache = (ACPI_PARSE2_OBJECT *) op;
-
-                       acpi_ut_release_mutex (ACPI_MTX_CACHES);
-                       return;
-               }
+               acpi_ut_release_to_cache (ACPI_MEM_LIST_PSNODE_EXT, op);
        }
-
-
-       /*
-        * Not a GENERIC OP, or the cache is full, just free the Op
-        */
-
-       acpi_ut_free (op);
 }
 
 
@@ -283,32 +198,12 @@ void
 acpi_ps_delete_parse_cache (
        void)
 {
-       ACPI_PARSE_OBJECT       *next;
-
-
-       /* Traverse the global cache list */
-
-       while (acpi_gbl_parse_cache) {
-               /* Delete one cached state object */
-
-               next = acpi_gbl_parse_cache->next;
-               acpi_ut_free (acpi_gbl_parse_cache);
-               acpi_gbl_parse_cache = next;
-               acpi_gbl_parse_cache_depth--;
-       }
-
-       /* Traverse the global cache list */
+       FUNCTION_TRACE ("Ps_delete_parse_cache");
 
-       while (acpi_gbl_ext_parse_cache) {
-               /* Delete one cached state object */
 
-               next = acpi_gbl_ext_parse_cache->next;
-               acpi_ut_free (acpi_gbl_ext_parse_cache);
-               acpi_gbl_ext_parse_cache = (ACPI_PARSE2_OBJECT *) next;
-               acpi_gbl_ext_parse_cache_depth--;
-       }
-
-       return;
+       acpi_ut_delete_generic_cache (ACPI_MEM_LIST_PSNODE);
+       acpi_ut_delete_generic_cache (ACPI_MEM_LIST_PSNODE_EXT);
+       return_VOID;
 }
 
 
@@ -316,11 +211,7 @@ acpi_ps_delete_parse_cache (
  *
  * FUNCTION:    Utility functions
  *
- * DESCRIPTION: Low level functions
- *
- * TBD: [Restructure]
- * 1) Some of these functions should be macros
- * 2) Some can be simplified
+ * DESCRIPTION: Low level character and object functions
  *
  ******************************************************************************/
 
@@ -328,8 +219,6 @@ acpi_ps_delete_parse_cache (
 /*
  * Is "c" a namestring lead character?
  */
-
-
 u8
 acpi_ps_is_leading_char (
        u32                     c)
@@ -349,201 +238,24 @@ acpi_ps_is_prefix_char (
 }
 
 
-u8
-acpi_ps_is_namespace_object_op (
-       u16                     opcode)
-{
-       return ((u8)
-                  (opcode == AML_SCOPE_OP              ||
-                       opcode == AML_DEVICE_OP             ||
-                       opcode == AML_THERMAL_ZONE_OP       ||
-                       opcode == AML_METHOD_OP             ||
-                       opcode == AML_POWER_RES_OP          ||
-                       opcode == AML_PROCESSOR_OP          ||
-                       opcode == AML_FIELD_OP              ||
-                       opcode == AML_INDEX_FIELD_OP        ||
-                       opcode == AML_BANK_FIELD_OP         ||
-                       opcode == AML_INT_NAMEDFIELD_OP     ||
-                       opcode == AML_NAME_OP               ||
-                       opcode == AML_ALIAS_OP              ||
-                       opcode == AML_MUTEX_OP              ||
-                       opcode == AML_EVENT_OP              ||
-                       opcode == AML_REGION_OP             ||
-                       opcode == AML_CREATE_FIELD_OP       ||
-                       opcode == AML_CREATE_BIT_FIELD_OP   ||
-                       opcode == AML_CREATE_BYTE_FIELD_OP  ||
-                       opcode == AML_CREATE_WORD_FIELD_OP  ||
-                       opcode == AML_CREATE_DWORD_FIELD_OP ||
-                       opcode == AML_CREATE_QWORD_FIELD_OP ||
-                       opcode == AML_INT_METHODCALL_OP     ||
-                       opcode == AML_INT_NAMEPATH_OP));
-}
-
-u8
-acpi_ps_is_namespace_op (
-       u16                     opcode)
-{
-       return ((u8)
-                  (opcode == AML_SCOPE_OP          ||
-                       opcode == AML_DEVICE_OP         ||
-                       opcode == AML_THERMAL_ZONE_OP   ||
-                       opcode == AML_METHOD_OP         ||
-                       opcode == AML_POWER_RES_OP      ||
-                       opcode == AML_PROCESSOR_OP      ||
-                       opcode == AML_FIELD_OP          ||
-                       opcode == AML_INDEX_FIELD_OP    ||
-                       opcode == AML_BANK_FIELD_OP     ||
-                       opcode == AML_NAME_OP           ||
-                       opcode == AML_ALIAS_OP          ||
-                       opcode == AML_MUTEX_OP          ||
-                       opcode == AML_EVENT_OP          ||
-                       opcode == AML_REGION_OP         ||
-                       opcode == AML_INT_NAMEDFIELD_OP));
-}
-
-
-/*
- * Is opcode for a named object Op?
- * (Includes all named object opcodes)
- *
- * TBD: [Restructure] Need a better way than this brute force approach!
- */
-u8
-acpi_ps_is_node_op (
-       u16                     opcode)
-{
-       return ((u8)
-                  (opcode == AML_SCOPE_OP              ||
-                       opcode == AML_DEVICE_OP             ||
-                       opcode == AML_THERMAL_ZONE_OP       ||
-                       opcode == AML_METHOD_OP             ||
-                       opcode == AML_POWER_RES_OP          ||
-                       opcode == AML_PROCESSOR_OP          ||
-                       opcode == AML_INT_NAMEDFIELD_OP     ||
-                       opcode == AML_NAME_OP               ||
-                       opcode == AML_ALIAS_OP              ||
-                       opcode == AML_MUTEX_OP              ||
-                       opcode == AML_EVENT_OP              ||
-                       opcode == AML_REGION_OP             ||
-
-
-                       opcode == AML_CREATE_FIELD_OP       ||
-                       opcode == AML_CREATE_BIT_FIELD_OP   ||
-                       opcode == AML_CREATE_BYTE_FIELD_OP  ||
-                       opcode == AML_CREATE_WORD_FIELD_OP  ||
-                       opcode == AML_CREATE_DWORD_FIELD_OP ||
-                       opcode == AML_CREATE_QWORD_FIELD_OP ||
-                       opcode == AML_INT_METHODCALL_OP     ||
-                       opcode == AML_INT_NAMEPATH_OP));
-}
-
-
-/*
- * Is opcode for a named Op?
- */
-u8
-acpi_ps_is_named_op (
-       u16                     opcode)
-{
-       return ((u8)
-                  (opcode == AML_SCOPE_OP          ||
-                       opcode == AML_DEVICE_OP         ||
-                       opcode == AML_THERMAL_ZONE_OP   ||
-                       opcode == AML_METHOD_OP         ||
-                       opcode == AML_POWER_RES_OP      ||
-                       opcode == AML_PROCESSOR_OP      ||
-                       opcode == AML_NAME_OP           ||
-                       opcode == AML_ALIAS_OP          ||
-                       opcode == AML_MUTEX_OP          ||
-                       opcode == AML_EVENT_OP          ||
-                       opcode == AML_REGION_OP         ||
-                       opcode == AML_INT_NAMEDFIELD_OP));
-}
-
-
-u8
-acpi_ps_is_deferred_op (
-       u16                     opcode)
-{
-       return ((u8)
-                  (opcode == AML_METHOD_OP                 ||
-                       opcode == AML_CREATE_FIELD_OP           ||
-                       opcode == AML_CREATE_BIT_FIELD_OP       ||
-                       opcode == AML_CREATE_BYTE_FIELD_OP      ||
-                       opcode == AML_CREATE_WORD_FIELD_OP      ||
-                       opcode == AML_CREATE_DWORD_FIELD_OP     ||
-                       opcode == AML_CREATE_QWORD_FIELD_OP     ||
-                       opcode == AML_REGION_OP));
-}
-
-
-/*
- * Is opcode for a bytelist?
- */
-u8
-acpi_ps_is_bytelist_op (
-       u16                     opcode)
-{
-       return ((u8) (opcode == AML_INT_BYTELIST_OP));
-}
-
-
 /*
- * Is opcode for a Field, Index_field, or Bank_field
- */
-u8
-acpi_ps_is_field_op (
-       u16                     opcode)
-{
-       return ((u8)
-                         (opcode == AML_CREATE_FIELD_OP
-                       || opcode == AML_FIELD_OP
-                       || opcode == AML_INDEX_FIELD_OP
-                       || opcode == AML_BANK_FIELD_OP));
-}
-
-
-/*
- * Is field creation op
+ * Get op's name (4-byte name segment) or 0 if unnamed
  */
-u8
-acpi_ps_is_create_field_op (
-       u16                     opcode)
+u32
+acpi_ps_get_name (
+       acpi_parse_object       *op)
 {
-       return ((u8)
-                  (opcode == AML_CREATE_FIELD_OP           ||
-                       opcode == AML_CREATE_BIT_FIELD_OP       ||
-                       opcode == AML_CREATE_BYTE_FIELD_OP      ||
-                       opcode == AML_CREATE_WORD_FIELD_OP      ||
-                       opcode == AML_CREATE_DWORD_FIELD_OP     ||
-                       opcode == AML_CREATE_QWORD_FIELD_OP));
-}
 
 
-/*
- * Cast an acpi_op to an acpi_extended_op if possible
- */
+       /* The "generic" object has no name associated with it */
 
-/* TBD: This is very inefficient, fix */
-ACPI_PARSE2_OBJECT *
-acpi_ps_to_extended_op (
-       ACPI_PARSE_OBJECT       *op)
-{
-       return ((acpi_ps_is_deferred_op (op->opcode) || acpi_ps_is_named_op (op->opcode) || acpi_ps_is_bytelist_op (op->opcode))
-                       ? ( (ACPI_PARSE2_OBJECT *) op) : NULL);
-}
+       if (op->flags & PARSEOP_GENERIC) {
+               return (0);
+       }
 
+       /* Only the "Extended" parse objects have a name */
 
-/*
- * Get op's name (4-byte name segment) or 0 if unnamed
- */
-u32
-acpi_ps_get_name (
-       ACPI_PARSE_OBJECT       *op)
-{
-       ACPI_PARSE2_OBJECT      *named = acpi_ps_to_extended_op (op);
-
-       return (named ? named->name : 0);
+       return (((acpi_parse2_object *) op)->name);
 }
 
 
@@ -552,13 +264,16 @@ acpi_ps_get_name (
  */
 void
 acpi_ps_set_name (
-       ACPI_PARSE_OBJECT       *op,
+       acpi_parse_object       *op,
        u32                     name)
 {
-       ACPI_PARSE2_OBJECT      *named = acpi_ps_to_extended_op (op);
 
-       if (named) {
-               named->name = name;
+       /* The "generic" object has no name associated with it */
+
+       if (op->flags & PARSEOP_GENERIC) {
+               return;
        }
+
+       ((acpi_parse2_object *) op)->name = name;
 }
 
index 40d089fd7cb1e4e50171b3463548d082ee32934f..0557f36c8efc92bb432f63d3235a6237a7b00f06 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: pswalk - Parser routines to walk parsed op tree(s)
- *              $Revision: 55 $
+ *              $Revision: 56 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ps_get_next_walk_op (
-       ACPI_WALK_STATE         *walk_state,
-       ACPI_PARSE_OBJECT       *op,
-       ACPI_PARSE_UPWARDS      ascending_callback)
+       acpi_walk_state         *walk_state,
+       acpi_parse_object       *op,
+       acpi_parse_upwards      ascending_callback)
 {
-       ACPI_PARSE_OBJECT       *next;
-       ACPI_PARSE_OBJECT       *parent;
-       ACPI_PARSE_OBJECT       *grand_parent;
-       ACPI_STATUS             status;
+       acpi_parse_object       *next;
+       acpi_parse_object       *parent;
+       acpi_parse_object       *grand_parent;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE_PTR ("Ps_get_next_walk_op", op);
 
 
        /* Check for a argument only if we are descending in the tree */
@@ -74,7 +77,7 @@ acpi_ps_get_next_walk_op (
                        walk_state->next_op     = next;
                        walk_state->next_op_info = NEXT_OP_DOWNWARD;
 
-                       return (AE_OK);
+                       return_ACPI_STATUS (AE_OK);
                }
 
 
@@ -82,7 +85,6 @@ 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;
 
@@ -97,14 +99,13 @@ acpi_ps_get_next_walk_op (
                        walk_state->prev_op     = op;
                        walk_state->next_op     = NULL;
 
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
 
                /*
                 * Check for a sibling to the current op.  A sibling means
                 * we are still going "downward" in the tree.
                 */
-
                if (next) {
                        /* There is a sibling, it will be next */
 
@@ -114,10 +115,9 @@ acpi_ps_get_next_walk_op (
 
                        /* Continue downward */
 
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
 
-
                /*
                 * Drop into the loop below because we are moving upwards in
                 * the tree
@@ -129,7 +129,6 @@ acpi_ps_get_next_walk_op (
                 * We are resuming a walk, and we were (are) going upward in the tree.
                 * So, we want to drop into the parent loop below.
                 */
-
                parent = op;
        }
 
@@ -156,7 +155,7 @@ acpi_ps_get_next_walk_op (
                        walk_state->prev_op     = parent;
                        walk_state->next_op     = NULL;
 
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
 
                /*
@@ -170,7 +169,7 @@ acpi_ps_get_next_walk_op (
                        walk_state->next_op     = next;
                        walk_state->next_op_info = NEXT_OP_DOWNWARD;
 
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
 
                /* No siblings, no errors, just move up one more level in the tree */
@@ -186,7 +185,7 @@ acpi_ps_get_next_walk_op (
 
        walk_state->next_op     = NULL;
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -205,10 +204,10 @@ acpi_ps_get_next_walk_op (
  *
  ******************************************************************************/
 
-static ACPI_STATUS
+static acpi_status
 acpi_ps_delete_completed_op (
-       ACPI_WALK_STATE         *state,
-       ACPI_PARSE_OBJECT       *op)
+       acpi_walk_state         *state,
+       acpi_parse_object       *op)
 {
 
        acpi_ps_free_op (op);
@@ -230,14 +229,17 @@ acpi_ps_delete_completed_op (
 
 void
 acpi_ps_delete_parse_tree (
-       ACPI_PARSE_OBJECT       *subtree_root)
+       acpi_parse_object       *subtree_root)
 {
-       ACPI_WALK_STATE         *walk_state;
-       ACPI_WALK_LIST          walk_list;
+       acpi_walk_state         *walk_state;
+       acpi_walk_list          walk_list;
+
+
+       FUNCTION_TRACE_PTR ("Ps_delete_parse_tree", subtree_root);
 
 
        if (!subtree_root) {
-               return;
+               return_VOID;
        }
 
        /* Create and initialize a new walk list */
@@ -248,7 +250,7 @@ acpi_ps_delete_parse_tree (
 
        walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT, NULL, NULL, &walk_list);
        if (!walk_state) {
-               return;
+               return_VOID;
        }
 
        walk_state->parser_state        = NULL;
@@ -274,10 +276,10 @@ acpi_ps_delete_parse_tree (
 
        /* We are done with this walk */
 
-       acpi_ex_release_all_mutexes ((ACPI_OPERAND_OBJECT *) &walk_list.acquired_mutex_list);
+       acpi_ex_release_all_mutexes ((acpi_operand_object *) &walk_list.acquired_mutex_list);
        acpi_ds_delete_walk_state (walk_state);
 
-       return;
+       return_VOID;
 }
 
 
index 59e9b6344da884135f68de2d55f918fcb1f7c9da..165b898fb0e9afbacdc7f5f88bb69d100e9897e9 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: psxface - Parser external interfaces
- *              $Revision: 44 $
+ *              $Revision: 47 $
  *
  *****************************************************************************/
 
@@ -36,7 +36,7 @@
         MODULE_NAME         ("psxface")
 
 
-/*****************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    Acpi_psx_execute
  *
  *
  * DESCRIPTION: Execute a control method
  *
- ****************************************************************************/
+ ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_psx_execute (
-       ACPI_NAMESPACE_NODE     *method_node,
-       ACPI_OPERAND_OBJECT     **params,
-       ACPI_OPERAND_OBJECT     **return_obj_desc)
+       acpi_namespace_node     *method_node,
+       acpi_operand_object     **params,
+       acpi_operand_object     **return_obj_desc)
 {
-       ACPI_STATUS             status;
-       ACPI_OPERAND_OBJECT     *obj_desc;
+       acpi_status             status;
+       acpi_operand_object     *obj_desc;
        u32                     i;
-       ACPI_PARSE_OBJECT       *op;
+       acpi_parse_object       *op;
+
+
+       FUNCTION_TRACE ("Psx_execute");
 
 
        /* Validate the Node and get the attached object */
 
        if (!method_node) {
-               return (AE_NULL_ENTRY);
+               return_ACPI_STATUS (AE_NULL_ENTRY);
        }
 
        obj_desc = acpi_ns_get_attached_object (method_node);
        if (!obj_desc) {
-               return (AE_NULL_OBJECT);
+               return_ACPI_STATUS (AE_NULL_OBJECT);
        }
 
        /* Init for new method, wait on concurrency semaphore */
 
        status = acpi_ds_begin_method_execution (method_node, obj_desc, NULL);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        if (params) {
@@ -89,7 +92,6 @@ acpi_psx_execute (
                 * The caller "owns" the parameters, so give each one an extra
                 * reference
                 */
-
                for (i = 0; params[i]; i++) {
                        acpi_ut_add_reference (params[i]);
                }
@@ -99,12 +101,15 @@ acpi_psx_execute (
         * Perform the first pass parse of the method to enter any
         * named objects that it creates into the namespace
         */
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+               "**** Begin Method Execution **** Entry=%p obj=%p\n",
+               method_node, obj_desc));
 
        /* Create and init a Root Node */
 
        op = acpi_ps_alloc_op (AML_SCOPE_OP);
        if (!op) {
-               return (AE_NO_MEMORY);
+               return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
        status = acpi_ps_parse_aml (op, obj_desc->method.pcode,
@@ -118,7 +123,7 @@ acpi_psx_execute (
 
        op = acpi_ps_alloc_op (AML_SCOPE_OP);
        if (!op) {
-               return (AE_NO_MEMORY);
+               return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
 
@@ -147,17 +152,19 @@ acpi_psx_execute (
 
 
        /*
-        * Normal exit is with Status == AE_RETURN_VALUE when a Return_op has been
-        * executed, or with Status == AE_PENDING at end of AML block (end of
-        * Method code)
+        * If the method has returned an object, signal this to the caller with
+        * a control exception code
         */
-
        if (*return_obj_desc) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Method returned Obj_desc=%X\n",
+                       *return_obj_desc));
+               DUMP_STACK_ENTRY (*return_obj_desc);
+
                status = AE_CTRL_RETURN_VALUE;
        }
 
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
index b342eb0f31c9a29854633172f5a72a529e8e0a1b..f57b3c13ac9e17fd75d2b2c33f5369e5cd21b830 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: rsaddr - Address resource descriptors (16/32/64)
- *              $Revision: 18 $
+ *              $Revision: 19 $
  *
  ******************************************************************************/
 
@@ -53,7 +53,7 @@
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_address16_resource (
        u8                      *byte_stream_buffer,
        u32                     *bytes_consumed,
@@ -61,14 +61,16 @@ acpi_rs_address16_resource (
        u32                     *structure_size)
 {
        u8                      *buffer = byte_stream_buffer;
-       ACPI_RESOURCE           *output_struct = (ACPI_RESOURCE *) *output_buffer;
+       acpi_resource           *output_struct = (acpi_resource *) *output_buffer;
        NATIVE_CHAR             *temp_ptr;
-       u32                     struct_size = SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS16);
+       u32                     struct_size = SIZEOF_RESOURCE (acpi_resource_address16);
        u32                     index;
        u16                     temp16;
        u8                      temp8;
 
 
+       FUNCTION_TRACE ("Rs_address16_resource");
+
        /*
         * Point past the Descriptor to get the number of bytes consumed
         */
@@ -86,7 +88,7 @@ acpi_rs_address16_resource (
 
        /* Values 0-2 are valid */
        if (temp8 > 2) {
-               return (AE_AML_INVALID_RESOURCE_TYPE);
+               return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
        }
 
        output_struct->data.address16.resource_type = temp8 & 0x03;
@@ -249,7 +251,7 @@ acpi_rs_address16_resource (
         * Return the final size of the structure
         */
        *structure_size = struct_size;
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -270,9 +272,9 @@ acpi_rs_address16_resource (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_address16_stream (
-       ACPI_RESOURCE           *linked_list,
+       acpi_resource           *linked_list,
        u8                      **output_buffer,
        u32                     *bytes_consumed)
 {
@@ -283,6 +285,9 @@ acpi_rs_address16_stream (
        u32                     actual_bytes;
 
 
+       FUNCTION_TRACE ("Rs_address16_stream");
+
+
        /*
         * The descriptor field is static
         */
@@ -410,7 +415,7 @@ acpi_rs_address16_stream (
         */
        actual_bytes -= 3;
        MOVE_UNALIGNED16_TO_16 (length_field, &actual_bytes);
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -436,7 +441,7 @@ acpi_rs_address16_stream (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_address32_resource (
        u8                      *byte_stream_buffer,
        u32                     *bytes_consumed,
@@ -444,7 +449,7 @@ acpi_rs_address32_resource (
        u32                     *structure_size)
 {
        u8                      *buffer;
-       ACPI_RESOURCE           *output_struct;
+       acpi_resource           *output_struct;
        u16                     temp16;
        u8                      temp8;
        NATIVE_CHAR             *temp_ptr;
@@ -452,10 +457,13 @@ acpi_rs_address32_resource (
        u32                     index;
 
 
+       FUNCTION_TRACE ("Rs_address32_resource");
+
+
        buffer = byte_stream_buffer;
-       output_struct = (ACPI_RESOURCE *) *output_buffer;
+       output_struct = (acpi_resource *) *output_buffer;
 
-       struct_size = SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS32);
+       struct_size = SIZEOF_RESOURCE (acpi_resource_address32);
 
        /*
         * Point past the Descriptor to get the number of bytes consumed
@@ -475,7 +483,7 @@ acpi_rs_address32_resource (
 
        /* Values 0-2 are valid */
        if(temp8 > 2) {
-               return (AE_AML_INVALID_RESOURCE_TYPE);
+               return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
        }
 
        output_struct->data.address32.resource_type = temp8 & 0x03;
@@ -637,7 +645,7 @@ acpi_rs_address32_resource (
         * Return the final size of the structure
         */
        *structure_size = struct_size;
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -658,9 +666,9 @@ acpi_rs_address32_resource (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_address32_stream (
-       ACPI_RESOURCE           *linked_list,
+       acpi_resource           *linked_list,
        u8                      **output_buffer,
        u32                     *bytes_consumed)
 {
@@ -670,6 +678,9 @@ acpi_rs_address32_stream (
        NATIVE_CHAR             *temp_pointer;
 
 
+       FUNCTION_TRACE ("Rs_address32_stream");
+
+
        buffer = *output_buffer;
 
        /*
@@ -797,7 +808,7 @@ acpi_rs_address32_stream (
         *  minus the header size (3 bytes)
         */
        *length_field = (u16) (*bytes_consumed - 3);
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -823,7 +834,7 @@ acpi_rs_address32_stream (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_address64_resource (
        u8                      *byte_stream_buffer,
        u32                     *bytes_consumed,
@@ -831,7 +842,7 @@ acpi_rs_address64_resource (
        u32                     *structure_size)
 {
        u8                      *buffer;
-       ACPI_RESOURCE           *output_struct;
+       acpi_resource           *output_struct;
        u16                     temp16;
        u8                      temp8;
        NATIVE_CHAR             *temp_ptr;
@@ -839,10 +850,13 @@ acpi_rs_address64_resource (
        u32                     index;
 
 
+       FUNCTION_TRACE ("Rs_address64_resource");
+
+
        buffer = byte_stream_buffer;
-       output_struct = (ACPI_RESOURCE *) *output_buffer;
+       output_struct = (acpi_resource *) *output_buffer;
 
-       struct_size = SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS64);
+       struct_size = SIZEOF_RESOURCE (acpi_resource_address64);
 
        /*
         * Point past the Descriptor to get the number of bytes consumed
@@ -861,7 +875,7 @@ acpi_rs_address64_resource (
 
        /* Values 0-2 are valid */
        if(temp8 > 2) {
-               return (AE_AML_INVALID_RESOURCE_TYPE);
+               return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
        }
 
        output_struct->data.address64.resource_type = temp8 & 0x03;
@@ -1026,7 +1040,7 @@ acpi_rs_address64_resource (
         * Return the final size of the structure
         */
        *structure_size = struct_size;
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -1047,9 +1061,9 @@ acpi_rs_address64_resource (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_address64_stream (
-       ACPI_RESOURCE           *linked_list,
+       acpi_resource           *linked_list,
        u8                      **output_buffer,
        u32                     *bytes_consumed)
 {
@@ -1059,6 +1073,9 @@ acpi_rs_address64_stream (
        NATIVE_CHAR             *temp_pointer;
 
 
+       FUNCTION_TRACE ("Rs_address64_stream");
+
+
        buffer = *output_buffer;
 
        /*
@@ -1185,6 +1202,6 @@ acpi_rs_address64_stream (
         * minus the header size (3 bytes)
         */
        *length_field = (u16) (*bytes_consumed - 3);
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
index 19c1a2271c73d212dd15740e57d755431f1264ba..6d26a512035f13cb68e59757f966eba59467e058 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: rscalc - Calculate stream and list lengths
- *              $Revision: 30 $
+ *              $Revision: 32 $
  *
  ******************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_calculate_byte_stream_length (
-       ACPI_RESOURCE           *linked_list,
+       acpi_resource           *linked_list,
        u32                     *size_needed)
 {
        u32                     byte_stream_size_needed = 0;
        u32                     segment_size;
-       ACPI_RESOURCE_EXT_IRQ   *ex_irq = NULL;
+       acpi_resource_ext_irq   *ex_irq = NULL;
        u8                      done = FALSE;
 
 
+       FUNCTION_TRACE ("Rs_calculate_byte_stream_length");
+
+
        while (!done) {
                /*
                 * Init the variable that will hold the size to add to the total.
@@ -239,7 +242,7 @@ acpi_rs_calculate_byte_stream_length (
                         * If we get here, everything is out of sync,
                         * so exit with an error
                         */
-                       return (AE_AML_INVALID_RESOURCE_TYPE);
+                       return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
                        break;
 
                } /* switch (Linked_list->Id) */
@@ -252,7 +255,7 @@ acpi_rs_calculate_byte_stream_length (
                /*
                 * Point to the next object
                 */
-               linked_list = POINTER_ADD (ACPI_RESOURCE,
+               linked_list = POINTER_ADD (acpi_resource,
                                  linked_list, linked_list->length);
        }
 
@@ -260,7 +263,7 @@ acpi_rs_calculate_byte_stream_length (
         * This is the data the caller needs
         */
        *size_needed = byte_stream_size_needed;
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -282,7 +285,7 @@ acpi_rs_calculate_byte_stream_length (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_calculate_list_length (
        u8                      *byte_stream_buffer,
        u32                     byte_stream_buffer_length,
@@ -302,6 +305,9 @@ acpi_rs_calculate_list_length (
        u8                      additional_bytes;
 
 
+       FUNCTION_TRACE ("Rs_calculate_list_length");
+
+
        while (bytes_parsed < byte_stream_buffer_length) {
                /*
                 * The next byte in the stream is the resource type
@@ -315,7 +321,7 @@ acpi_rs_calculate_list_length (
                         */
                        bytes_consumed = 12;
 
-                       structure_size = SIZEOF_RESOURCE (ACPI_RESOURCE_MEM24);
+                       structure_size = SIZEOF_RESOURCE (acpi_resource_mem24);
                        break;
 
 
@@ -334,7 +340,7 @@ acpi_rs_calculate_list_length (
                         */
                        temp16 = (u16) ROUND_UP_TO_32_bITS (temp16);
 
-                       structure_size = SIZEOF_RESOURCE (ACPI_RESOURCE_VENDOR) +
+                       structure_size = SIZEOF_RESOURCE (acpi_resource_vendor) +
                                           (temp16 * sizeof (u8));
                        break;
 
@@ -346,7 +352,7 @@ acpi_rs_calculate_list_length (
 
                        bytes_consumed = 20;
 
-                       structure_size = SIZEOF_RESOURCE (ACPI_RESOURCE_MEM32);
+                       structure_size = SIZEOF_RESOURCE (acpi_resource_mem32);
                        break;
 
 
@@ -356,7 +362,7 @@ acpi_rs_calculate_list_length (
                         */
                        bytes_consumed = 12;
 
-                       structure_size = SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_MEM32);
+                       structure_size = SIZEOF_RESOURCE (acpi_resource_fixed_mem32);
                        break;
 
 
@@ -393,7 +399,7 @@ acpi_rs_calculate_list_length (
                         */
                        temp8 = (u8) ROUND_UP_TO_64_bITS (temp8);
 
-                       structure_size = SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS64) +
+                       structure_size = SIZEOF_RESOURCE (acpi_resource_address64) +
                                           (temp8 * sizeof (u8));
                        break;
 
@@ -431,7 +437,7 @@ acpi_rs_calculate_list_length (
                         */
                        temp8 = (u8) ROUND_UP_TO_32_bITS (temp8);
 
-                       structure_size = SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS32) +
+                       structure_size = SIZEOF_RESOURCE (acpi_resource_address32) +
                                           (temp8 * sizeof (u8));
                        break;
 
@@ -469,7 +475,7 @@ acpi_rs_calculate_list_length (
                         */
                        temp8 = (u8) ROUND_UP_TO_32_bITS (temp8);
 
-                       structure_size = SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS16) +
+                       structure_size = SIZEOF_RESOURCE (acpi_resource_address16) +
                                           (temp8 * sizeof (u8));
                        break;
 
@@ -522,7 +528,7 @@ acpi_rs_calculate_list_length (
                         */
                        temp8 = (u8) ROUND_UP_TO_32_bITS (temp8);
 
-                       structure_size = SIZEOF_RESOURCE (ACPI_RESOURCE_EXT_IRQ) +
+                       structure_size = SIZEOF_RESOURCE (acpi_resource_ext_irq) +
                                           (additional_bytes * sizeof (u8)) +
                                           (temp8 * sizeof (u8));
                        break;
@@ -562,7 +568,7 @@ acpi_rs_calculate_list_length (
                                temp16 >>= 1;
                        }
 
-                       structure_size = SIZEOF_RESOURCE (ACPI_RESOURCE_IO) +
+                       structure_size = SIZEOF_RESOURCE (acpi_resource_io) +
                                           (number_of_interrupts * sizeof (u32));
                        break;
 
@@ -592,7 +598,7 @@ acpi_rs_calculate_list_length (
                                temp8 >>= 1;
                        }
 
-                       structure_size = SIZEOF_RESOURCE (ACPI_RESOURCE_DMA) +
+                       structure_size = SIZEOF_RESOURCE (acpi_resource_dma) +
                                           (number_of_channels * sizeof (u32));
                        break;
 
@@ -612,7 +618,7 @@ acpi_rs_calculate_list_length (
                                bytes_consumed = 1;
                        }
 
-                       structure_size = SIZEOF_RESOURCE (ACPI_RESOURCE_START_DPF);
+                       structure_size = SIZEOF_RESOURCE (acpi_resource_start_dpf);
                        break;
 
 
@@ -630,7 +636,7 @@ acpi_rs_calculate_list_length (
                         * IO Port Resource
                         */
                        bytes_consumed = 8;
-                       structure_size = SIZEOF_RESOURCE (ACPI_RESOURCE_IO);
+                       structure_size = SIZEOF_RESOURCE (acpi_resource_io);
                        break;
 
 
@@ -639,7 +645,7 @@ acpi_rs_calculate_list_length (
                         * Fixed IO Port Resource
                         */
                        bytes_consumed = 4;
-                       structure_size = SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_IO);
+                       structure_size = SIZEOF_RESOURCE (acpi_resource_fixed_io);
                        break;
 
 
@@ -657,7 +663,7 @@ acpi_rs_calculate_list_length (
                         * Ensure a 32-bit boundary for the structure
                         */
                        temp8 = (u8) ROUND_UP_TO_32_bITS (temp8);
-                       structure_size = SIZEOF_RESOURCE (ACPI_RESOURCE_VENDOR) +
+                       structure_size = SIZEOF_RESOURCE (acpi_resource_vendor) +
                                           (temp8 * sizeof (u8));
                        break;
 
@@ -677,7 +683,7 @@ acpi_rs_calculate_list_length (
                         * If we get here, everything is out of sync,
                         *  so exit with an error
                         */
-                       return (AE_AML_INVALID_RESOURCE_TYPE);
+                       return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
                        break;
                }
 
@@ -699,7 +705,7 @@ acpi_rs_calculate_list_length (
         * This is the data the caller needs
         */
        *size_needed = buffer_size;
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -720,21 +726,24 @@ acpi_rs_calculate_list_length (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_calculate_pci_routing_table_length (
-       ACPI_OPERAND_OBJECT     *package_object,
+       acpi_operand_object     *package_object,
        u32                     *buffer_size_needed)
 {
        u32                     number_of_elements;
        u32                     temp_size_needed = 0;
-       ACPI_OPERAND_OBJECT     **top_object_list;
+       acpi_operand_object     **top_object_list;
        u32                     index;
-       ACPI_OPERAND_OBJECT     *package_element;
-       ACPI_OPERAND_OBJECT     **sub_object_list;
+       acpi_operand_object     *package_element;
+       acpi_operand_object     **sub_object_list;
        u8                      name_found;
        u32                     table_index;
 
 
+       FUNCTION_TRACE ("Rs_calculate_pci_routing_table_length");
+
+
        number_of_elements = package_object->package.count;
 
        /*
@@ -781,7 +790,7 @@ acpi_rs_calculate_pci_routing_table_length (
                        }
                }
 
-               temp_size_needed += (sizeof (PCI_ROUTING_TABLE) - 4);
+               temp_size_needed += (sizeof (pci_routing_table) - 4);
 
                /*
                 * Was a String type found?
@@ -814,7 +823,7 @@ acpi_rs_calculate_pci_routing_table_length (
                temp_size_needed = ROUND_UP_TO_64_bITS (temp_size_needed);
 
                /*
-                * Point to the next ACPI_OPERAND_OBJECT
+                * Point to the next acpi_operand_object
                 */
                top_object_list++;
        }
@@ -823,6 +832,6 @@ acpi_rs_calculate_pci_routing_table_length (
        /*
         * Adding an extra element to the end of the list, essentially a NULL terminator
         */
-       *buffer_size_needed = temp_size_needed + sizeof (PCI_ROUTING_TABLE);
-       return (AE_OK);
+       *buffer_size_needed = temp_size_needed + sizeof (pci_routing_table);
+       return_ACPI_STATUS (AE_OK);
 }
index fb26b6ab65f2e6faed5cb55ac296acaa58008edc..3d2465a5a2ba36f313553dfe93b4cae4f88ba0db 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: rscreate - Create resource lists/tables
- *              $Revision: 33 $
+ *              $Revision: 36 $
  *
  ******************************************************************************/
 
@@ -41,7 +41,7 @@
  *              Output_buffer           - Pointer to the user's buffer
  *              Output_buffer_length    - Pointer to the size of Output_buffer
  *
- * RETURN:      Status  - AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN:      Status  - AE_OK if okay, else a valid acpi_status code
  *              If Output_buffer is not large enough, Output_buffer_length
  *              indicates how large Output_buffer should be, else it
  *              indicates how may u8 elements of Output_buffer are valid.
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_create_resource_list (
-       ACPI_OPERAND_OBJECT     *byte_stream_buffer,
+       acpi_operand_object     *byte_stream_buffer,
        u8                      *output_buffer,
        u32                     *output_buffer_length)
 {
 
-       ACPI_STATUS             status;
+       acpi_status             status;
        u8                      *byte_stream_start;
        u32                     list_size_needed = 0;
        u32                     byte_stream_buffer_length;
 
 
+       FUNCTION_TRACE ("Rs_create_resource_list");
+
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Byte_stream_buffer = %p\n", byte_stream_buffer));
+
        /*
         * Params already validated, so we don't re-validate here
         */
-
        byte_stream_buffer_length = byte_stream_buffer->buffer.length;
        byte_stream_start = byte_stream_buffer->buffer.pointer;
 
@@ -79,18 +83,20 @@ acpi_rs_create_resource_list (
        status = acpi_rs_calculate_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));
+
        /*
         * Exit with the error passed back
         */
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /*
         * If the linked list will fit into the available buffer
         * call to fill in the list
         */
-
        if (list_size_needed <= *output_buffer_length) {
                /*
                 * Zero out the return buffer before proceeding
@@ -104,18 +110,19 @@ acpi_rs_create_resource_list (
                 * Exit with the error passed back
                 */
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Output_buffer = %p\n", output_buffer));
        }
 
        else {
                *output_buffer_length = list_size_needed;
-               return (AE_BUFFER_OVERFLOW);
+               return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
        }
 
        *output_buffer_length = list_size_needed;
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -123,50 +130,54 @@ acpi_rs_create_resource_list (
  *
  * FUNCTION:    Acpi_rs_create_pci_routing_table
  *
- * PARAMETERS:  Package_object          - Pointer to an ACPI_OPERAND_OBJECT
+ * PARAMETERS:  Package_object          - Pointer to an acpi_operand_object
  *                                        package
  *              Output_buffer           - Pointer to the user's buffer
  *              Output_buffer_length    - Size of Output_buffer
  *
- * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code.
+ * RETURN:      Status  AE_OK if okay, else a valid acpi_status code.
  *              If the Output_buffer is too small, the error will be
  *              AE_BUFFER_OVERFLOW and Output_buffer_length will point
  *              to the size buffer needed.
  *
- * DESCRIPTION: Takes the ACPI_OPERAND_OBJECT  package and creates a
+ * DESCRIPTION: Takes the acpi_operand_object  package and creates a
  *              linked list of PCI interrupt descriptions
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_create_pci_routing_table (
-       ACPI_OPERAND_OBJECT     *package_object,
+       acpi_operand_object     *package_object,
        u8                      *output_buffer,
        u32                     *output_buffer_length)
 {
        u8                      *buffer = output_buffer;
-       ACPI_OPERAND_OBJECT     **top_object_list = NULL;
-       ACPI_OPERAND_OBJECT     **sub_object_list = NULL;
-       ACPI_OPERAND_OBJECT     *package_element = NULL;
+       acpi_operand_object     **top_object_list = NULL;
+       acpi_operand_object     **sub_object_list = NULL;
+       acpi_operand_object     *package_element = NULL;
        u32                     buffer_size_needed = 0;
        u32                     number_of_elements = 0;
        u32                     index = 0;
-       PCI_ROUTING_TABLE       *user_prt = NULL;
-       ACPI_NAMESPACE_NODE     *node;
-       ACPI_STATUS             status;
+       pci_routing_table       *user_prt = NULL;
+       acpi_namespace_node     *node;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Rs_create_pci_routing_table");
 
 
        /*
         * Params already validated, so we don't re-validate here
         */
-
        status = acpi_rs_calculate_pci_routing_table_length (package_object,
                         &buffer_size_needed);
 
        if (!ACPI_SUCCESS(status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Buffer_size_needed = %X\n", buffer_size_needed));
+
        /*
         * If the data will fit into the available buffer
         * call to fill in the list
@@ -184,7 +195,7 @@ acpi_rs_create_pci_routing_table (
                 */
                top_object_list     = package_object->package.elements;
                number_of_elements  = package_object->package.count;
-               user_prt            = (PCI_ROUTING_TABLE *) buffer;
+               user_prt            = (pci_routing_table *) buffer;
 
 
                buffer = ROUND_PTR_UP_TO_8 (buffer, u8);
@@ -197,7 +208,7 @@ acpi_rs_create_pci_routing_table (
                         * be zero because we cleared the return buffer earlier
                         */
                        buffer += user_prt->length;
-                       user_prt = (PCI_ROUTING_TABLE *) buffer;
+                       user_prt = (pci_routing_table *) buffer;
 
 
                        /*
@@ -206,7 +217,7 @@ acpi_rs_create_pci_routing_table (
                         * The minus four is to subtract the size of the
                         * u8 Source[4] member because it is added below.
                         */
-                       user_prt->length = (sizeof (PCI_ROUTING_TABLE) -4);
+                       user_prt->length = (sizeof (pci_routing_table) -4);
 
                        /*
                         * Dereference the sub-package
@@ -228,7 +239,9 @@ acpi_rs_create_pci_routing_table (
                        }
 
                        else {
-                               return (AE_BAD_DATA);
+                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n",
+                                       acpi_ut_get_type_name ((*sub_object_list)->common.type)));
+                               return_ACPI_STATUS (AE_BAD_DATA);
                        }
 
                        /*
@@ -241,7 +254,9 @@ acpi_rs_create_pci_routing_table (
                        }
 
                        else {
-                               return (AE_BAD_DATA);
+                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n",
+                                       acpi_ut_get_type_name ((*sub_object_list)->common.type)));
+                               return_ACPI_STATUS (AE_BAD_DATA);
                        }
 
                        /*
@@ -253,14 +268,16 @@ acpi_rs_create_pci_routing_table (
                        case INTERNAL_TYPE_REFERENCE:
 
                                if ((*sub_object_list)->reference.opcode != AML_INT_NAMEPATH_OP) {
-                                       return (AE_BAD_DATA);
+                                  ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need name, found reference op %X\n",
+                                               (*sub_object_list)->reference.opcode));
+                                       return_ACPI_STATUS (AE_BAD_DATA);
                                }
 
                                node = (*sub_object_list)->reference.node;
 
                                /* TBD: use *remaining* length of the buffer! */
 
-                               status = acpi_ns_handle_to_pathname ((ACPI_HANDLE *) node,
+                               status = acpi_ns_handle_to_pathname ((acpi_handle *) node,
                                                 output_buffer_length, user_prt->source);
 
                                user_prt->length += STRLEN (user_prt->source) + 1; /* include null terminator */
@@ -295,7 +312,9 @@ acpi_rs_create_pci_routing_table (
 
                        default:
 
-                          return (AE_BAD_DATA);
+                          ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n",
+                                       acpi_ut_get_type_name ((*sub_object_list)->common.type)));
+                          return_ACPI_STATUS (AE_BAD_DATA);
                           break;
                        }
 
@@ -313,28 +332,31 @@ acpi_rs_create_pci_routing_table (
                        }
 
                        else {
-                               return (AE_BAD_DATA);
+                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n",
+                                       acpi_ut_get_type_name ((*sub_object_list)->common.type)));
+                               return_ACPI_STATUS (AE_BAD_DATA);
                        }
 
                        /*
-                        * Point to the next ACPI_OPERAND_OBJECT
+                        * Point to the next acpi_operand_object
                         */
                        top_object_list++;
                }
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Output_buffer = %p\n", output_buffer));
        }
 
        else {
                *output_buffer_length = buffer_size_needed;
 
-               return (AE_BUFFER_OVERFLOW);
+               return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
        }
 
        /*
         * Report the amount of buffer used
         */
        *output_buffer_length = buffer_size_needed;
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -346,7 +368,7 @@ acpi_rs_create_pci_routing_table (
  *              Output_buffer           - Pointer to the user's buffer
  *              Output_buffer_length    - Size of Output_buffer
  *
- * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code.
+ * RETURN:      Status  AE_OK if okay, else a valid acpi_status code.
  *              If the Output_buffer is too small, the error will be
  *              AE_BUFFER_OVERFLOW and Output_buffer_length will point
  *              to the size buffer needed.
@@ -357,16 +379,21 @@ acpi_rs_create_pci_routing_table (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_create_byte_stream (
-       ACPI_RESOURCE           *linked_list_buffer,
+       acpi_resource           *linked_list_buffer,
        u8                      *output_buffer,
        u32                     *output_buffer_length)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
        u32                     byte_stream_size_needed = 0;
 
 
+       FUNCTION_TRACE ("Rs_create_byte_stream");
+
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Linked_list_buffer = %p\n", linked_list_buffer));
+
        /*
         * Params already validated, so we don't re-validate here
         *
@@ -376,18 +403,20 @@ acpi_rs_create_byte_stream (
        status = acpi_rs_calculate_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)));
+
        /*
         * Exit with the error passed back
         */
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /*
         * If the linked list will fit into the available buffer
         * call to fill in the list
         */
-
        if (byte_stream_size_needed <= *output_buffer_length) {
                /*
                 * Zero out the return buffer before proceeding
@@ -401,16 +430,17 @@ acpi_rs_create_byte_stream (
                 * Exit with the error passed back
                 */
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Output_buffer = %p\n", output_buffer));
        }
 
        else {
                *output_buffer_length = byte_stream_size_needed;
-               return (AE_BUFFER_OVERFLOW);
+               return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
        }
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
index 7ed01a071cc7cb05e311dd48b8449c15db91d50c..5a90b55f0c6bd543621c9dc8dbe11e3b461d428f 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: rsdump - Functions to display the resource structures.
- *              $Revision: 20 $
+ *              $Revision: 23 $
  *
  ******************************************************************************/
 
@@ -31,6 +31,8 @@
         MODULE_NAME         ("rsdump")
 
 
+#ifdef ACPI_DEBUG
+
 /*******************************************************************************
  *
  * FUNCTION:    Acpi_rs_dump_irq
 
 void
 acpi_rs_dump_irq (
-       ACPI_RESOURCE_DATA      *data)
+       acpi_resource_data      *data)
 {
-       ACPI_RESOURCE_IRQ       *irq_data = (ACPI_RESOURCE_IRQ *) data;
+       acpi_resource_irq       *irq_data = (acpi_resource_irq *) data;
        u8                      index = 0;
 
 
+       FUNCTION_ENTRY ();
+
+
        acpi_os_printf ("IRQ Resource\n");
 
        acpi_os_printf ("  %s Triggered\n",
@@ -87,12 +92,15 @@ acpi_rs_dump_irq (
 
 void
 acpi_rs_dump_dma (
-       ACPI_RESOURCE_DATA      *data)
+       acpi_resource_data      *data)
 {
-       ACPI_RESOURCE_DMA       *dma_data = (ACPI_RESOURCE_DMA *) data;
+       acpi_resource_dma       *dma_data = (acpi_resource_dma *) data;
        u8                      index = 0;
 
 
+       FUNCTION_ENTRY ();
+
+
        acpi_os_printf ("DMA Resource\n");
 
        switch (dma_data->type) {
@@ -164,13 +172,15 @@ acpi_rs_dump_dma (
 
 void
 acpi_rs_dump_start_dependent_functions (
-       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_os_printf ("Start Dependent Functions Resource\n");
+       FUNCTION_ENTRY ();
+
 
+       acpi_os_printf ("Start Dependent Functions Resource\n");
 
        switch (sdf_data->compatibility_priority) {
        case GOOD_CONFIGURATION:
@@ -227,9 +237,12 @@ acpi_rs_dump_start_dependent_functions (
 
 void
 acpi_rs_dump_io (
-       ACPI_RESOURCE_DATA      *data)
+       acpi_resource_data      *data)
 {
-       ACPI_RESOURCE_IO        *io_data = (ACPI_RESOURCE_IO *) data;
+       acpi_resource_io        *io_data = (acpi_resource_io *) data;
+
+
+       FUNCTION_ENTRY ();
 
 
        acpi_os_printf ("Io Resource\n");
@@ -267,9 +280,12 @@ acpi_rs_dump_io (
 
 void
 acpi_rs_dump_fixed_io (
-       ACPI_RESOURCE_DATA      *data)
+       acpi_resource_data      *data)
 {
-       ACPI_RESOURCE_FIXED_IO  *fixed_io_data = (ACPI_RESOURCE_FIXED_IO *) data;
+       acpi_resource_fixed_io  *fixed_io_data = (acpi_resource_fixed_io *) data;
+
+
+       FUNCTION_ENTRY ();
 
 
        acpi_os_printf ("Fixed Io Resource\n");
@@ -297,12 +313,15 @@ acpi_rs_dump_fixed_io (
 
 void
 acpi_rs_dump_vendor_specific (
-       ACPI_RESOURCE_DATA      *data)
+       acpi_resource_data      *data)
 {
-       ACPI_RESOURCE_VENDOR    *vendor_data = (ACPI_RESOURCE_VENDOR *) data;
+       acpi_resource_vendor    *vendor_data = (acpi_resource_vendor *) data;
        u16                     index = 0;
 
 
+       FUNCTION_ENTRY ();
+
+
        acpi_os_printf ("Vendor Specific Resource\n");
 
        acpi_os_printf ("  Length: %08X\n", vendor_data->length);
@@ -330,9 +349,12 @@ acpi_rs_dump_vendor_specific (
 
 void
 acpi_rs_dump_memory24 (
-       ACPI_RESOURCE_DATA      *data)
+       acpi_resource_data      *data)
 {
-       ACPI_RESOURCE_MEM24     *memory24_data = (ACPI_RESOURCE_MEM24 *) data;
+       acpi_resource_mem24     *memory24_data = (acpi_resource_mem24 *) data;
+
+
+       FUNCTION_ENTRY ();
 
 
        acpi_os_printf ("24-Bit Memory Range Resource\n");
@@ -372,9 +394,12 @@ acpi_rs_dump_memory24 (
 
 void
 acpi_rs_dump_memory32 (
-       ACPI_RESOURCE_DATA      *data)
+       acpi_resource_data      *data)
 {
-       ACPI_RESOURCE_MEM32     *memory32_data = (ACPI_RESOURCE_MEM32 *) data;
+       acpi_resource_mem32     *memory32_data = (acpi_resource_mem32 *) data;
+
+
+       FUNCTION_ENTRY ();
 
 
        acpi_os_printf ("32-Bit Memory Range Resource\n");
@@ -414,9 +439,12 @@ acpi_rs_dump_memory32 (
 
 void
 acpi_rs_dump_fixed_memory32 (
-       ACPI_RESOURCE_DATA          *data)
+       acpi_resource_data          *data)
 {
-       ACPI_RESOURCE_FIXED_MEM32   *fixed_memory32_data = (ACPI_RESOURCE_FIXED_MEM32 *) data;
+       acpi_resource_fixed_mem32   *fixed_memory32_data = (acpi_resource_fixed_mem32 *) data;
+
+
+       FUNCTION_ENTRY ();
 
 
        acpi_os_printf ("32-Bit Fixed Location Memory Range Resource\n");
@@ -450,9 +478,12 @@ acpi_rs_dump_fixed_memory32 (
 
 void
 acpi_rs_dump_address16 (
-       ACPI_RESOURCE_DATA      *data)
+       acpi_resource_data      *data)
 {
-       ACPI_RESOURCE_ADDRESS16 *address16_data = (ACPI_RESOURCE_ADDRESS16 *) data;
+       acpi_resource_address16 *address16_data = (acpi_resource_address16 *) data;
+
+
+       FUNCTION_ENTRY ();
 
 
        acpi_os_printf ("16-Bit Address Space Resource\n");
@@ -590,9 +621,12 @@ acpi_rs_dump_address16 (
 
 void
 acpi_rs_dump_address32 (
-       ACPI_RESOURCE_DATA      *data)
+       acpi_resource_data      *data)
 {
-       ACPI_RESOURCE_ADDRESS32 *address32_data = (ACPI_RESOURCE_ADDRESS32 *) data;
+       acpi_resource_address32 *address32_data = (acpi_resource_address32 *) data;
+
+
+       FUNCTION_ENTRY ();
 
 
        acpi_os_printf ("32-Bit Address Space Resource\n");
@@ -729,9 +763,12 @@ acpi_rs_dump_address32 (
 
 void
 acpi_rs_dump_address64 (
-       ACPI_RESOURCE_DATA      *data)
+       acpi_resource_data      *data)
 {
-       ACPI_RESOURCE_ADDRESS64 *address64_data = (ACPI_RESOURCE_ADDRESS64 *) data;
+       acpi_resource_address64 *address64_data = (acpi_resource_address64 *) data;
+
+
+       FUNCTION_ENTRY ();
 
 
        acpi_os_printf ("64-Bit Address Space Resource\n");
@@ -868,12 +905,15 @@ acpi_rs_dump_address64 (
 
 void
 acpi_rs_dump_extended_irq (
-       ACPI_RESOURCE_DATA      *data)
+       acpi_resource_data      *data)
 {
-       ACPI_RESOURCE_EXT_IRQ   *ext_irq_data = (ACPI_RESOURCE_EXT_IRQ *) data;
+       acpi_resource_ext_irq   *ext_irq_data = (acpi_resource_ext_irq *) data;
        u8                      index = 0;
 
 
+       FUNCTION_ENTRY ();
+
+
        acpi_os_printf ("Extended IRQ Resource\n");
 
        acpi_os_printf ("  Resource %s\n",
@@ -926,13 +966,16 @@ acpi_rs_dump_extended_irq (
 
 void
 acpi_rs_dump_resource_list (
-       ACPI_RESOURCE       *resource)
+       acpi_resource       *resource)
 {
        u8                  count = 0;
        u8                  done = FALSE;
 
 
-       if (acpi_dbg_level & TRACE_RESOURCES && _COMPONENT & acpi_dbg_layer) {
+       FUNCTION_ENTRY ();
+
+
+       if (acpi_dbg_level & ACPI_LV_RESOURCES && _COMPONENT & acpi_dbg_layer) {
                while (!done) {
                        acpi_os_printf ("Resource structure %x.\n", count++);
 
@@ -1006,7 +1049,7 @@ acpi_rs_dump_resource_list (
 
                        }
 
-                       resource = POINTER_ADD (ACPI_RESOURCE, resource, resource->length);
+                       resource = POINTER_ADD (acpi_resource, resource, resource->length);
                }
        }
 
@@ -1032,11 +1075,14 @@ acpi_rs_dump_irq_list (
        u8                  *buffer = route_table;
        u8                  count = 0;
        u8                  done = FALSE;
-       PCI_ROUTING_TABLE   *prt_element;
+       pci_routing_table   *prt_element;
+
 
+       FUNCTION_ENTRY ();
 
-       if (acpi_dbg_level & TRACE_RESOURCES && _COMPONENT & acpi_dbg_layer) {
-               prt_element = (PCI_ROUTING_TABLE *) buffer;
+
+       if (acpi_dbg_level & ACPI_LV_RESOURCES && _COMPONENT & acpi_dbg_layer) {
+               prt_element = (pci_routing_table *) buffer;
 
                while (!done) {
                        acpi_os_printf ("PCI IRQ Routing Table structure %X.\n", count++);
@@ -1053,7 +1099,7 @@ acpi_rs_dump_irq_list (
 
                        buffer += prt_element->length;
 
-                       prt_element = (PCI_ROUTING_TABLE *) buffer;
+                       prt_element = (pci_routing_table *) buffer;
 
                        if(0 == prt_element->length) {
                                done = TRUE;
@@ -1064,3 +1110,5 @@ acpi_rs_dump_irq_list (
        return;
 }
 
+#endif
+
index 86cd5670a3d8e798c3e95b5110ceca38a872ebaf..aaa10629268ba84ec0328a524cab78523f5873c6 100644 (file)
@@ -53,7 +53,7 @@
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_io_resource (
        u8                      *byte_stream_buffer,
        u32                     *bytes_consumed,
@@ -61,10 +61,13 @@ acpi_rs_io_resource (
        u32                     *structure_size)
 {
        u8                      *buffer = byte_stream_buffer;
-       ACPI_RESOURCE           *output_struct = (ACPI_RESOURCE *) *output_buffer;
+       acpi_resource           *output_struct = (acpi_resource *) *output_buffer;
        u16                     temp16 = 0;
        u8                      temp8 = 0;
-       u32                     struct_size = SIZEOF_RESOURCE (ACPI_RESOURCE_IO);
+       u32                     struct_size = SIZEOF_RESOURCE (acpi_resource_io);
+
+
+       FUNCTION_TRACE ("Rs_io_resource");
 
 
        /*
@@ -123,7 +126,7 @@ acpi_rs_io_resource (
         * Return the final size of the structure
         */
        *structure_size = struct_size;
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -149,7 +152,7 @@ acpi_rs_io_resource (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_fixed_io_resource (
        u8                      *byte_stream_buffer,
        u32                     *bytes_consumed,
@@ -157,10 +160,13 @@ acpi_rs_fixed_io_resource (
        u32                     *structure_size)
 {
        u8                      *buffer = byte_stream_buffer;
-       ACPI_RESOURCE           *output_struct = (ACPI_RESOURCE *) *output_buffer;
+       acpi_resource           *output_struct = (acpi_resource *) *output_buffer;
        u16                     temp16 = 0;
        u8                      temp8 = 0;
-       u32                     struct_size = SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_IO);
+       u32                     struct_size = SIZEOF_RESOURCE (acpi_resource_fixed_io);
+
+
+       FUNCTION_TRACE ("Rs_fixed_io_resource");
 
 
        /*
@@ -195,7 +201,7 @@ acpi_rs_fixed_io_resource (
         * Return the final size of the structure
         */
        *structure_size = struct_size;
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -216,9 +222,9 @@ acpi_rs_fixed_io_resource (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_io_stream (
-       ACPI_RESOURCE           *linked_list,
+       acpi_resource           *linked_list,
        u8                      **output_buffer,
        u32                     *bytes_consumed)
 {
@@ -227,6 +233,9 @@ acpi_rs_io_stream (
        u8                      temp8 = 0;
 
 
+       FUNCTION_TRACE ("Rs_io_stream");
+
+
        /*
         * The descriptor field is static
         */
@@ -277,7 +286,7 @@ acpi_rs_io_stream (
         * Return the number of bytes consumed in this operation
         */
        *bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -298,9 +307,9 @@ acpi_rs_io_stream (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_fixed_io_stream (
-       ACPI_RESOURCE           *linked_list,
+       acpi_resource           *linked_list,
        u8                      **output_buffer,
        u32                     *bytes_consumed)
 {
@@ -309,6 +318,9 @@ acpi_rs_fixed_io_stream (
        u8                      temp8 = 0;
 
 
+       FUNCTION_TRACE ("Rs_fixed_io_stream");
+
+
        /*
         * The descriptor field is static
         */
@@ -336,7 +348,7 @@ acpi_rs_fixed_io_stream (
         * Return the number of bytes consumed in this operation
         */
        *bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -362,7 +374,7 @@ acpi_rs_fixed_io_stream (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_dma_resource (
        u8                      *byte_stream_buffer,
        u32                     *bytes_consumed,
@@ -370,11 +382,14 @@ acpi_rs_dma_resource (
        u32                     *structure_size)
 {
        u8                      *buffer = byte_stream_buffer;
-       ACPI_RESOURCE           *output_struct = (ACPI_RESOURCE *) *output_buffer;
+       acpi_resource           *output_struct = (acpi_resource *) *output_buffer;
        u8                      temp8 = 0;
        u8                      index;
        u8                      i;
-       u32                     struct_size = SIZEOF_RESOURCE (ACPI_RESOURCE_DMA);
+       u32                     struct_size = SIZEOF_RESOURCE (acpi_resource_dma);
+
+
+       FUNCTION_TRACE ("Rs_dma_resource");
 
 
        /*
@@ -417,7 +432,7 @@ acpi_rs_dma_resource (
        output_struct->data.dma.transfer = temp8 & 0x03;
 
        if (0x03 == output_struct->data.dma.transfer) {
-               return (AE_BAD_DATA);
+               return_ACPI_STATUS (AE_BAD_DATA);
        }
 
        /*
@@ -439,7 +454,7 @@ acpi_rs_dma_resource (
         * Return the final size of the structure
         */
        *structure_size = struct_size;
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -460,9 +475,9 @@ acpi_rs_dma_resource (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_dma_stream (
-       ACPI_RESOURCE           *linked_list,
+       acpi_resource           *linked_list,
        u8                      **output_buffer,
        u32                     *bytes_consumed)
 {
@@ -472,6 +487,9 @@ acpi_rs_dma_stream (
        u8                      index;
 
 
+       FUNCTION_TRACE ("Rs_dma_stream");
+
+
        /*
         * The descriptor field is static
         */
@@ -506,6 +524,6 @@ acpi_rs_dma_stream (
         * Return the number of bytes consumed in this operation
         */
        *bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
index d2e1282b5b73eb09f48534b775c3bb16c36152c3..a6d1ab107a9c394cba8121888809734c07ad2764 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: rsirq - IRQ resource descriptors
- *              $Revision: 17 $
+ *              $Revision: 18 $
  *
  ******************************************************************************/
 
@@ -53,7 +53,7 @@
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_irq_resource (
        u8                      *byte_stream_buffer,
        u32                     *bytes_consumed,
@@ -61,12 +61,15 @@ acpi_rs_irq_resource (
        u32                     *structure_size)
 {
        u8                      *buffer = byte_stream_buffer;
-       ACPI_RESOURCE           *output_struct = (ACPI_RESOURCE *) *output_buffer;
+       acpi_resource           *output_struct = (acpi_resource *) *output_buffer;
        u16                     temp16 = 0;
        u8                      temp8 = 0;
        u8                      index;
        u8                      i;
-       u32                     struct_size = SIZEOF_RESOURCE (ACPI_RESOURCE_IRQ);
+       u32                     struct_size = SIZEOF_RESOURCE (acpi_resource_irq);
+
+
+       FUNCTION_TRACE ("Rs_irq_resource");
 
 
        /*
@@ -127,7 +130,7 @@ acpi_rs_irq_resource (
                                 * are allowed (ACPI spec v1.0b ection 6.4.2.1),
                                 * so an error will occur if we reach this point
                                 */
-                               return (AE_BAD_DATA);
+                               return_ACPI_STATUS (AE_BAD_DATA);
                        }
                }
 
@@ -156,7 +159,7 @@ acpi_rs_irq_resource (
         * Return the final size of the structure
         */
        *structure_size = struct_size;
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -177,9 +180,9 @@ acpi_rs_irq_resource (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_irq_stream (
-       ACPI_RESOURCE           *linked_list,
+       acpi_resource           *linked_list,
        u8                      **output_buffer,
        u32                     *bytes_consumed)
 {
@@ -190,6 +193,9 @@ acpi_rs_irq_stream (
        u8                      IRQinfo_byte_needed;
 
 
+       FUNCTION_TRACE ("Rs_irq_stream");
+
+
        /*
         * The descriptor field is set based upon whether a third byte is
         * needed to contain the IRQ Information.
@@ -247,7 +253,7 @@ acpi_rs_irq_stream (
         * Return the number of bytes consumed in this operation
         */
        *bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -273,7 +279,7 @@ acpi_rs_irq_stream (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_extended_irq_resource (
        u8                      *byte_stream_buffer,
        u32                     *bytes_consumed,
@@ -281,12 +287,15 @@ acpi_rs_extended_irq_resource (
        u32                     *structure_size)
 {
        u8                      *buffer = byte_stream_buffer;
-       ACPI_RESOURCE           *output_struct = (ACPI_RESOURCE *) *output_buffer;
+       acpi_resource           *output_struct = (acpi_resource *) *output_buffer;
        u16                     temp16 = 0;
        u8                      temp8 = 0;
        NATIVE_CHAR             *temp_ptr;
        u8                      index;
-       u32                     struct_size = SIZEOF_RESOURCE (ACPI_RESOURCE_EXT_IRQ);
+       u32                     struct_size = SIZEOF_RESOURCE (acpi_resource_ext_irq);
+
+
+       FUNCTION_TRACE ("Rs_extended_irq_resource");
 
 
        /*
@@ -326,7 +335,7 @@ acpi_rs_extended_irq_resource (
                         * are allowed (ACPI spec v1.0b ection 6.4.2.1),
                         * so an error will occur if we reach this point
                         */
-                       return (AE_BAD_DATA);
+                       return_ACPI_STATUS (AE_BAD_DATA);
                }
        }
 
@@ -434,7 +443,7 @@ acpi_rs_extended_irq_resource (
         * Return the final size of the structure
         */
        *structure_size = struct_size;
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -455,9 +464,9 @@ acpi_rs_extended_irq_resource (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_extended_irq_stream (
-       ACPI_RESOURCE           *linked_list,
+       acpi_resource           *linked_list,
        u8                      **output_buffer,
        u32                     *bytes_consumed)
 {
@@ -468,6 +477,9 @@ acpi_rs_extended_irq_stream (
        NATIVE_CHAR             *temp_pointer = NULL;
 
 
+       FUNCTION_TRACE ("Rs_extended_irq_stream");
+
+
        /*
         * The descriptor field is static
         */
@@ -544,6 +556,6 @@ acpi_rs_extended_irq_stream (
         * minus the header size (3 bytes)
         */
        *length_field = (u16) (*bytes_consumed - 3);
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
index efd9f3caf9ef10b02fd2a0f747321e8763ea9f27..a6ad460fd38e0e2413ef1240a37272e0277dcd23 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: rslist - Linked list utilities
- *              $Revision: 17 $
+ *              $Revision: 19 $
  *
  ******************************************************************************/
 
@@ -49,6 +49,9 @@ acpi_rs_get_resource_type (
        u8                      resource_start_byte)
 {
 
+       FUNCTION_ENTRY ();
+
+
        /*
         * Determine if this is a small or large resource
         */
@@ -91,13 +94,13 @@ acpi_rs_get_resource_type (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_byte_stream_to_list (
        u8                      *byte_stream_buffer,
        u32                     byte_stream_buffer_length,
        u8                      **output_buffer)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
        u32                     bytes_parsed = 0;
        u8                      resource_type = 0;
        u32                     bytes_consumed = 0;
@@ -106,6 +109,9 @@ acpi_rs_byte_stream_to_list (
        u8                      end_tag_processed = FALSE;
 
 
+       FUNCTION_TRACE ("Rs_byte_stream_to_list");
+
+
        while (bytes_parsed < byte_stream_buffer_length &&
                        FALSE == end_tag_processed) {
                /*
@@ -269,7 +275,7 @@ acpi_rs_byte_stream_to_list (
 
 
                if (!ACPI_SUCCESS(status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
 
                /*
@@ -293,10 +299,10 @@ acpi_rs_byte_stream_to_list (
         * Check the reason for exiting the while loop
         */
        if (TRUE != end_tag_processed) {
-               return (AE_AML_ERROR);
+               return_ACPI_STATUS (AE_AML_ERROR);
        }
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -321,18 +327,21 @@ acpi_rs_byte_stream_to_list (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_list_to_byte_stream (
-       ACPI_RESOURCE           *linked_list,
+       acpi_resource           *linked_list,
        u32                     byte_stream_size_needed,
        u8                      **output_buffer)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
        u8                      *buffer = *output_buffer;
        u32                     bytes_consumed = 0;
        u8                      done = FALSE;
 
 
+       FUNCTION_TRACE ("Rs_list_to_byte_stream");
+
+
        while (!done) {
                switch (linked_list->id) {
                case ACPI_RSTYPE_IRQ:
@@ -465,7 +474,7 @@ acpi_rs_list_to_byte_stream (
 
 
                if (!ACPI_SUCCESS(status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
 
                /*
@@ -476,10 +485,10 @@ acpi_rs_list_to_byte_stream (
                /*
                 * Point to the next object
                 */
-               linked_list = POINTER_ADD (ACPI_RESOURCE,
+               linked_list = POINTER_ADD (acpi_resource,
                                  linked_list, linked_list->length);
        }
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
index 648a00db97e74ff0d2247ad342845d7a205aaaa8..af181a52727d617b4966d104c03d335647af96c5 100644 (file)
@@ -53,7 +53,7 @@
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_memory24_resource (
        u8                      *byte_stream_buffer,
        u32                     *bytes_consumed,
@@ -61,10 +61,13 @@ acpi_rs_memory24_resource (
        u32                     *structure_size)
 {
        u8                      *buffer = byte_stream_buffer;
-       ACPI_RESOURCE           *output_struct = (ACPI_RESOURCE *) *output_buffer;
+       acpi_resource           *output_struct = (acpi_resource *) *output_buffer;
        u16                     temp16 = 0;
        u8                      temp8 = 0;
-       u32                     struct_size = SIZEOF_RESOURCE (ACPI_RESOURCE_MEM24);
+       u32                     struct_size = SIZEOF_RESOURCE (acpi_resource_mem24);
+
+
+       FUNCTION_TRACE ("Rs_memory24_resource");
 
 
        /*
@@ -120,7 +123,7 @@ acpi_rs_memory24_resource (
         * Return the final size of the structure
         */
        *structure_size = struct_size;
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -141,9 +144,9 @@ acpi_rs_memory24_resource (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_memory24_stream (
-       ACPI_RESOURCE           *linked_list,
+       acpi_resource           *linked_list,
        u8                      **output_buffer,
        u32                     *bytes_consumed)
 {
@@ -152,6 +155,9 @@ acpi_rs_memory24_stream (
        u8                      temp8 = 0;
 
 
+       FUNCTION_TRACE ("Rs_memory24_stream");
+
+
        /*
         * The descriptor field is static
         */
@@ -200,7 +206,7 @@ acpi_rs_memory24_stream (
         * Return the number of bytes consumed in this operation
         */
        *bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -226,7 +232,7 @@ acpi_rs_memory24_stream (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_memory32_range_resource (
        u8                      *byte_stream_buffer,
        u32                     *bytes_consumed,
@@ -234,10 +240,13 @@ acpi_rs_memory32_range_resource (
        u32                     *structure_size)
 {
        u8                      *buffer = byte_stream_buffer;
-       ACPI_RESOURCE           *output_struct = (ACPI_RESOURCE *) *output_buffer;
+       acpi_resource           *output_struct = (acpi_resource *) *output_buffer;
        u16                     temp16 = 0;
        u8                      temp8 = 0;
-       u32                     struct_size = SIZEOF_RESOURCE (ACPI_RESOURCE_MEM32);
+       u32                     struct_size = SIZEOF_RESOURCE (acpi_resource_mem32);
+
+
+       FUNCTION_TRACE ("Rs_memory32_range_resource");
 
 
        /*
@@ -303,7 +312,7 @@ acpi_rs_memory32_range_resource (
         * Return the final size of the structure
         */
        *structure_size = struct_size;
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -329,7 +338,7 @@ acpi_rs_memory32_range_resource (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_fixed_memory32_resource (
        u8                      *byte_stream_buffer,
        u32                     *bytes_consumed,
@@ -337,10 +346,13 @@ acpi_rs_fixed_memory32_resource (
        u32                     *structure_size)
 {
        u8                      *buffer = byte_stream_buffer;
-       ACPI_RESOURCE           *output_struct = (ACPI_RESOURCE *) *output_buffer;
+       acpi_resource           *output_struct = (acpi_resource *) *output_buffer;
        u16                     temp16 = 0;
        u8                      temp8 = 0;
-       u32                     struct_size = SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_MEM32);
+       u32                     struct_size = SIZEOF_RESOURCE (acpi_resource_fixed_mem32);
+
+
+       FUNCTION_TRACE ("Rs_fixed_memory32_resource");
 
 
        /*
@@ -383,7 +395,7 @@ acpi_rs_fixed_memory32_resource (
         * Return the final size of the structure
         */
        *structure_size = struct_size;
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -404,9 +416,9 @@ acpi_rs_fixed_memory32_resource (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_memory32_range_stream (
-       ACPI_RESOURCE           *linked_list,
+       acpi_resource           *linked_list,
        u8                      **output_buffer,
        u32                     *bytes_consumed)
 {
@@ -415,6 +427,9 @@ acpi_rs_memory32_range_stream (
        u8                      temp8 = 0;
 
 
+       FUNCTION_TRACE ("Rs_memory32_range_stream");
+
+
        /*
         * The descriptor field is static
         */
@@ -464,7 +479,7 @@ acpi_rs_memory32_range_stream (
         * Return the number of bytes consumed in this operation
         */
        *bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -485,9 +500,9 @@ acpi_rs_memory32_range_stream (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_fixed_memory32_stream (
-       ACPI_RESOURCE           *linked_list,
+       acpi_resource           *linked_list,
        u8                      **output_buffer,
        u32                     *bytes_consumed)
 {
@@ -496,6 +511,9 @@ acpi_rs_fixed_memory32_stream (
        u8                      temp8 = 0;
 
 
+       FUNCTION_TRACE ("Rs_fixed_memory32_stream");
+
+
        /*
         * The descriptor field is static
         */
@@ -535,6 +553,6 @@ acpi_rs_fixed_memory32_stream (
         * Return the number of bytes consumed in this operation
         */
        *bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
index 30a80f58ef042f69b986a1e7ae5dc66b08812974..d15457604f89313b12b071b14a866effeafe19ae 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: rsmisc - Miscellaneous resource descriptors
- *              $Revision: 15 $
+ *              $Revision: 16 $
  *
  ******************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_end_tag_resource (
        u8                      *byte_stream_buffer,
        u32                     *bytes_consumed,
        u8                      **output_buffer,
        u32                     *structure_size)
 {
-       ACPI_RESOURCE           *output_struct = (ACPI_RESOURCE *) *output_buffer;
+       acpi_resource           *output_struct = (acpi_resource *) *output_buffer;
        u32                     struct_size = ACPI_RESOURCE_LENGTH;
 
 
+       FUNCTION_TRACE ("Rs_end_tag_resource");
+
+
        /*
         * The number of bytes consumed is static
         */
@@ -83,7 +86,7 @@ acpi_rs_end_tag_resource (
         * Return the final size of the structure
         */
        *structure_size = struct_size;
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -104,9 +107,9 @@ acpi_rs_end_tag_resource (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_end_tag_stream (
-       ACPI_RESOURCE           *linked_list,
+       acpi_resource           *linked_list,
        u8                      **output_buffer,
        u32                     *bytes_consumed)
 {
@@ -114,6 +117,9 @@ acpi_rs_end_tag_stream (
        u8                      temp8 = 0;
 
 
+       FUNCTION_TRACE ("Rs_end_tag_stream");
+
+
        /*
         * The descriptor field is static
         */
@@ -133,7 +139,7 @@ acpi_rs_end_tag_stream (
         * Return the number of bytes consumed in this operation
         */
        *bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -159,7 +165,7 @@ acpi_rs_end_tag_stream (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_vendor_resource (
        u8                      *byte_stream_buffer,
        u32                     *bytes_consumed,
@@ -167,11 +173,14 @@ acpi_rs_vendor_resource (
        u32                     *structure_size)
 {
        u8                      *buffer = byte_stream_buffer;
-       ACPI_RESOURCE           *output_struct = (ACPI_RESOURCE *) *output_buffer;
+       acpi_resource           *output_struct = (acpi_resource *) *output_buffer;
        u16                     temp16 = 0;
        u8                      temp8 = 0;
        u8                      index;
-       u32                     struct_size = SIZEOF_RESOURCE (ACPI_RESOURCE_VENDOR);
+       u32                     struct_size = SIZEOF_RESOURCE (acpi_resource_vendor);
+
+
+       FUNCTION_TRACE ("Rs_vendor_resource");
 
 
        /*
@@ -239,7 +248,7 @@ acpi_rs_vendor_resource (
         * Return the final size of the structure
         */
        *structure_size = struct_size;
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -260,9 +269,9 @@ acpi_rs_vendor_resource (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_vendor_stream (
-       ACPI_RESOURCE           *linked_list,
+       acpi_resource           *linked_list,
        u8                      **output_buffer,
        u32                     *bytes_consumed)
 {
@@ -272,6 +281,9 @@ acpi_rs_vendor_stream (
        u8                      index;
 
 
+       FUNCTION_TRACE ("Rs_vendor_stream");
+
+
        /*
         * Dereference the length to find if this is a large or small item.
         */
@@ -315,7 +327,7 @@ acpi_rs_vendor_stream (
         * Return the number of bytes consumed in this operation
         */
        *bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -341,7 +353,7 @@ acpi_rs_vendor_stream (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_start_dependent_functions_resource (
        u8                      *byte_stream_buffer,
        u32                     *bytes_consumed,
@@ -349,9 +361,12 @@ acpi_rs_start_dependent_functions_resource (
        u32                     *structure_size)
 {
        u8                      *buffer = byte_stream_buffer;
-       ACPI_RESOURCE          *output_struct = (ACPI_RESOURCE *) *output_buffer;
+       acpi_resource          *output_struct = (acpi_resource *) *output_buffer;
        u8                      temp8 = 0;
-       u32                     struct_size = SIZEOF_RESOURCE (ACPI_RESOURCE_START_DPF);
+       u32                     struct_size = SIZEOF_RESOURCE (acpi_resource_start_dpf);
+
+
+       FUNCTION_TRACE ("Rs_start_dependent_functions_resource");
 
 
        /*
@@ -376,7 +391,7 @@ acpi_rs_start_dependent_functions_resource (
                output_struct->data.start_dpf.compatibility_priority = temp8 & 0x03;
 
                if (3 == output_struct->data.start_dpf.compatibility_priority) {
-                       return (AE_AML_ERROR);
+                       return_ACPI_STATUS (AE_AML_ERROR);
                }
 
                /*
@@ -385,7 +400,7 @@ acpi_rs_start_dependent_functions_resource (
                output_struct->data.start_dpf.performance_robustness = (temp8 >> 2) & 0x03;
 
                if (3 == output_struct->data.start_dpf.performance_robustness) {
-                       return (AE_AML_ERROR);
+                       return_ACPI_STATUS (AE_AML_ERROR);
                }
        }
 
@@ -406,7 +421,7 @@ acpi_rs_start_dependent_functions_resource (
         * Return the final size of the structure
         */
        *structure_size = struct_size;
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -432,17 +447,20 @@ acpi_rs_start_dependent_functions_resource (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_end_dependent_functions_resource (
        u8                      *byte_stream_buffer,
        u32                     *bytes_consumed,
        u8                      **output_buffer,
        u32                     *structure_size)
 {
-       ACPI_RESOURCE           *output_struct = (ACPI_RESOURCE *) *output_buffer;
+       acpi_resource           *output_struct = (acpi_resource *) *output_buffer;
        u32                     struct_size = ACPI_RESOURCE_LENGTH;
 
 
+       FUNCTION_TRACE ("Rs_end_dependent_functions_resource");
+
+
        /*
         * The number of bytes consumed is static
         */
@@ -462,7 +480,7 @@ acpi_rs_end_dependent_functions_resource (
         * Return the final size of the structure
         */
        *structure_size = struct_size;
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -483,9 +501,9 @@ acpi_rs_end_dependent_functions_resource (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_start_dependent_functions_stream (
-       ACPI_RESOURCE           *linked_list,
+       acpi_resource           *linked_list,
        u8                      **output_buffer,
        u32                     *bytes_consumed)
 {
@@ -493,6 +511,9 @@ acpi_rs_start_dependent_functions_stream (
        u8                      temp8 = 0;
 
 
+       FUNCTION_TRACE ("Rs_start_dependent_functions_stream");
+
+
        /*
         * The descriptor field is set based upon whether a byte is needed
         * to contain Priority data.
@@ -524,7 +545,7 @@ acpi_rs_start_dependent_functions_stream (
         * Return the number of bytes consumed in this operation
         */
        *bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -545,9 +566,9 @@ acpi_rs_start_dependent_functions_stream (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_end_dependent_functions_stream (
-       ACPI_RESOURCE           *linked_list,
+       acpi_resource           *linked_list,
        u8                      **output_buffer,
        u32                     *bytes_consumed
        )
@@ -555,6 +576,9 @@ acpi_rs_end_dependent_functions_stream (
        u8                      *buffer = *output_buffer;
 
 
+       FUNCTION_TRACE ("Rs_end_dependent_functions_stream");
+
+
        /*
         * The descriptor field is static
         */
@@ -565,6 +589,6 @@ acpi_rs_end_dependent_functions_stream (
         * Return the number of bytes consumed in this operation
         */
        *bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
index efb662ff86bb65e667fd40cc8dbee35bc52dea89..a828bfbef4d3bb749018dbe971186c991f83361d 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: rsutils - Utilities for the resource manager
- *              $Revision: 19 $
+ *              $Revision: 22 $
  *
  ******************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_get_prt_method_data (
-       ACPI_HANDLE             handle,
-       ACPI_BUFFER             *ret_buffer)
+       acpi_handle             handle,
+       acpi_buffer             *ret_buffer)
 {
-       ACPI_OPERAND_OBJECT     *ret_obj;
-       ACPI_STATUS             status;
+       acpi_operand_object     *ret_obj;
+       acpi_status             status;
        u32                     buffer_space_needed;
 
 
+       FUNCTION_TRACE ("Rs_get_prt_method_data");
+
+
        /* already validated params, so we won't repeat here */
 
        buffer_space_needed = ret_buffer->length;
@@ -70,13 +73,14 @@ acpi_rs_get_prt_method_data (
         */
        status = acpi_ns_evaluate_relative (handle, "_PRT", NULL, &ret_obj);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        if (!ret_obj) {
                /* Return object is required */
 
-               return (AE_TYPE);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _PRT\n"));
+               return_ACPI_STATUS (AE_TYPE);
        }
 
 
@@ -111,7 +115,7 @@ acpi_rs_get_prt_method_data (
 cleanup:
 
        acpi_ut_remove_reference (ret_obj);
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -133,16 +137,19 @@ cleanup:
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_get_crs_method_data (
-       ACPI_HANDLE             handle,
-       ACPI_BUFFER             *ret_buffer)
+       acpi_handle             handle,
+       acpi_buffer             *ret_buffer)
 {
-       ACPI_OPERAND_OBJECT     *ret_obj;
-       ACPI_STATUS             status;
+       acpi_operand_object     *ret_obj;
+       acpi_status             status;
        u32                     buffer_space_needed = ret_buffer->length;
 
 
+       FUNCTION_TRACE ("Rs_get_crs_method_data");
+
+
        /* already validated params, so we won't repeat here */
 
        /*
@@ -150,13 +157,14 @@ acpi_rs_get_crs_method_data (
         */
        status = acpi_ns_evaluate_relative (handle, "_CRS", NULL, &ret_obj);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        if (!ret_obj) {
                /* Return object is required */
 
-               return (AE_TYPE);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _CRS\n"));
+               return_ACPI_STATUS (AE_TYPE);
        }
 
        /*
@@ -191,7 +199,7 @@ acpi_rs_get_crs_method_data (
 cleanup:
 
        acpi_ut_remove_reference (ret_obj);
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -213,16 +221,19 @@ cleanup:
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_get_prs_method_data (
-       ACPI_HANDLE             handle,
-       ACPI_BUFFER             *ret_buffer)
+       acpi_handle             handle,
+       acpi_buffer             *ret_buffer)
 {
-       ACPI_OPERAND_OBJECT     *ret_obj;
-       ACPI_STATUS             status;
+       acpi_operand_object     *ret_obj;
+       acpi_status             status;
        u32                     buffer_space_needed = ret_buffer->length;
 
 
+       FUNCTION_TRACE ("Rs_get_prs_method_data");
+
+
        /* already validated params, so we won't repeat here */
 
        /*
@@ -230,13 +241,14 @@ acpi_rs_get_prs_method_data (
         */
        status = acpi_ns_evaluate_relative (handle, "_PRS", NULL, &ret_obj);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        if (!ret_obj) {
                /* Return object is required */
 
-               return (AE_TYPE);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _PRS\n"));
+               return_ACPI_STATUS (AE_TYPE);
        }
 
        /*
@@ -270,7 +282,7 @@ acpi_rs_get_prs_method_data (
 cleanup:
 
        acpi_ut_remove_reference (ret_obj);
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -292,18 +304,20 @@ cleanup:
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_set_srs_method_data (
-       ACPI_HANDLE             handle,
-       ACPI_BUFFER             *in_buffer)
+       acpi_handle             handle,
+       acpi_buffer             *in_buffer)
 {
-       ACPI_OPERAND_OBJECT     *params[2];
-       ACPI_OPERAND_OBJECT     param_obj;
-       ACPI_STATUS             status;
+       acpi_operand_object     *params[2];
+       acpi_status             status;
        u8                      *byte_stream = NULL;
        u32                     buffer_size_needed = 0;
 
 
+       FUNCTION_TRACE ("Rs_set_srs_method_data");
+
+
        /* already validated params, so we won't repeat here */
 
        /*
@@ -323,15 +337,15 @@ acpi_rs_set_srs_method_data (
         * if not, exit with the error
         */
        if (AE_BUFFER_OVERFLOW != status) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /*
         * Allocate the buffer needed
         */
-       byte_stream = acpi_ut_callocate(buffer_size_needed);
+       byte_stream = ACPI_MEM_CALLOCATE (buffer_size_needed);
        if (NULL == byte_stream) {
-               return (AE_NO_MEMORY);
+               return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
        /*
@@ -346,32 +360,31 @@ acpi_rs_set_srs_method_data (
        /*
         * Init the param object
         */
-       acpi_ut_init_static_object (&param_obj);
-
-       /*
-        * Method requires one parameter.  Set it up
-        */
-       params [0] = &param_obj;
+       params[0] = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
+       if (!params[0]) {
+               status = AE_NO_MEMORY;
+               goto cleanup;
+       }
        params [1] = NULL;
 
        /*
         *  Set up the parameter object
         */
-       param_obj.common.type   = ACPI_TYPE_BUFFER;
-       param_obj.buffer.length = buffer_size_needed;
-       param_obj.buffer.pointer = byte_stream;
+       params[0]->buffer.length  = buffer_size_needed;
+       params[0]->buffer.pointer = byte_stream;
 
        /*
         * Execute the method, no return value
         */
        status = acpi_ns_evaluate_relative (handle, "_SRS", params, NULL);
+       acpi_ut_remove_reference (params[0]);
 
        /*
         * Clean up and return the status from Acpi_ns_evaluate_relative
         */
 cleanup:
 
-       acpi_ut_free (byte_stream);
-       return (status);
+       ACPI_MEM_FREE (byte_stream);
+       return_ACPI_STATUS (status);
 }
 
index 25ac46f7d2dab5d751a4a96dba749c0f0444811a..961d0e2cb7036af0866e00acc0f83895e72c065f 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: rsxface - Public interfaces to the resource manager
- *              $Revision: 13 $
+ *              $Revision: 14 $
  *
  ******************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_get_irq_routing_table (
-       ACPI_HANDLE             device_handle,
-       ACPI_BUFFER             *ret_buffer)
+       acpi_handle             device_handle,
+       acpi_buffer             *ret_buffer)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Acpi_get_irq_routing_table ");
 
 
        /* Ensure that ACPI has been initialized */
 
        ACPI_IS_INITIALIZATION_COMPLETE (status);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /*
@@ -80,11 +83,11 @@ acpi_get_irq_routing_table (
        if ((!device_handle)        ||
                (!ret_buffer)           ||
                ((!ret_buffer->pointer) && (ret_buffer->length))) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        status = acpi_rs_get_prt_method_data (device_handle, ret_buffer);
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -112,19 +115,22 @@ acpi_get_irq_routing_table (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_get_current_resources (
-       ACPI_HANDLE             device_handle,
-       ACPI_BUFFER             *ret_buffer)
+       acpi_handle             device_handle,
+       acpi_buffer             *ret_buffer)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Acpi_get_current_resources");
 
 
        /* Ensure that ACPI has been initialized */
 
        ACPI_IS_INITIALIZATION_COMPLETE (status);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /*
@@ -136,11 +142,11 @@ acpi_get_current_resources (
        if ((!device_handle)        ||
                (!ret_buffer)           ||
                ((ret_buffer->length) && (!ret_buffer->pointer))) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        status = acpi_rs_get_crs_method_data (device_handle, ret_buffer);
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -165,19 +171,22 @@ acpi_get_current_resources (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_get_possible_resources (
-       ACPI_HANDLE             device_handle,
-       ACPI_BUFFER             *ret_buffer)
+       acpi_handle             device_handle,
+       acpi_buffer             *ret_buffer)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Acpi_get_possible_resources");
 
 
        /* Ensure that ACPI has been initialized */
 
        ACPI_IS_INITIALIZATION_COMPLETE (status);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /*
@@ -189,11 +198,11 @@ acpi_get_possible_resources (
        if ((!device_handle)        ||
                (!ret_buffer)           ||
                ((ret_buffer->length) && (!ret_buffer->pointer))) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        status = acpi_rs_get_prs_method_data (device_handle, ret_buffer);
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -215,19 +224,22 @@ acpi_get_possible_resources (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_set_current_resources (
-       ACPI_HANDLE             device_handle,
-       ACPI_BUFFER             *in_buffer)
+       acpi_handle             device_handle,
+       acpi_buffer             *in_buffer)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Acpi_set_current_resources");
 
 
        /* Ensure that ACPI has been initialized */
 
        ACPI_IS_INITIALIZATION_COMPLETE (status);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /*
@@ -237,9 +249,9 @@ acpi_set_current_resources (
                (!in_buffer)          ||
                (!in_buffer->pointer) ||
                (!in_buffer->length)) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        status = acpi_rs_set_srs_method_data (device_handle, in_buffer);
-       return (status);
+       return_ACPI_STATUS (status);
 }
index 2b9b6e882c57832820f3b806d49a5b3961e2c68f..ff33ea17c7de6e01990e862ea9d709139a66c958 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: tbconvrt - ACPI Table conversion utilities
- *              $Revision: 23 $
+ *              $Revision: 27 $
  *
  *****************************************************************************/
 
  *
  * RETURN:
  *
- * DESCRIPTION:
+ * DESCRIPTION: Calculate the number of tables
  *
  ******************************************************************************/
 
 u32
 acpi_tb_get_table_count (
        RSDP_DESCRIPTOR         *RSDP,
-       ACPI_TABLE_HEADER       *RSDT)
+       acpi_table_header       *RSDT)
 {
        u32                     pointer_size;
 
 
+       FUNCTION_ENTRY ();
+
+
 #ifndef _IA64
 
        if (RSDP->revision < 2) {
@@ -72,8 +75,7 @@ acpi_tb_get_table_count (
         * pointers contained within the RSDT/XSDT.  The size of the pointers
         * is architecture-dependent.
         */
-
-       return ((RSDT->length - sizeof (ACPI_TABLE_HEADER)) / pointer_size);
+       return ((RSDT->length - sizeof (acpi_table_header)) / pointer_size);
 }
 
 
@@ -85,18 +87,21 @@ acpi_tb_get_table_count (
  *
  * RETURN:
  *
- * DESCRIPTION:
+ * DESCRIPTION: Convert an RSDT to an XSDT (internal common format)
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_tb_convert_to_xsdt (
-       ACPI_TABLE_DESC         *table_info,
+       acpi_table_desc         *table_info,
        u32                     *number_of_tables)
 {
        u32                     table_size;
        u32                     i;
-       XSDT_DESCRIPTOR         *new_table;
+       xsdt_descriptor         *new_table;
+
+
+       FUNCTION_ENTRY ();
 
 
        *number_of_tables = acpi_tb_get_table_count (acpi_gbl_RSDP, table_info->pointer);
@@ -104,19 +109,19 @@ acpi_tb_convert_to_xsdt (
 
        /* Compute size of the converted XSDT */
 
-       table_size = (*number_of_tables * sizeof (UINT64)) + sizeof (ACPI_TABLE_HEADER);
+       table_size = (*number_of_tables * sizeof (UINT64)) + sizeof (acpi_table_header);
 
 
        /* Allocate an XSDT */
 
-       new_table = acpi_ut_callocate (table_size);
+       new_table = ACPI_MEM_CALLOCATE (table_size);
        if (!new_table) {
                return (AE_NO_MEMORY);
        }
 
        /* Copy the header and set the length */
 
-       MEMCPY (new_table, table_info->pointer, sizeof (ACPI_TABLE_HEADER));
+       MEMCPY (new_table, table_info->pointer, sizeof (acpi_table_header));
        new_table->header.length = table_size;
 
        /* Copy the table pointers */
@@ -133,7 +138,7 @@ acpi_tb_convert_to_xsdt (
                }
                else {
                        new_table->table_offset_entry[i] =
-                               ((XSDT_DESCRIPTOR *) table_info->pointer)->table_offset_entry[i];
+                               ((xsdt_descriptor *) table_info->pointer)->table_offset_entry[i];
                }
        }
 
@@ -145,8 +150,8 @@ acpi_tb_convert_to_xsdt (
 
        /* Point the table descriptor to the new table */
 
-       table_info->pointer     = (ACPI_TABLE_HEADER *) new_table;
-       table_info->base_pointer = (ACPI_TABLE_HEADER *) new_table;
+       table_info->pointer     = (acpi_table_header *) new_table;
+       table_info->base_pointer = (acpi_table_header *) new_table;
        table_info->length      = table_size;
        table_info->allocation  = ACPI_MEM_ALLOCATED;
 
@@ -172,31 +177,34 @@ acpi_tb_convert_to_xsdt (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_tb_convert_table_fadt (void)
 {
 
 #ifdef _IA64
-       FADT_DESCRIPTOR_REV071 *FADT71;
+       fadt_descriptor_rev071 *FADT71;
        u8                      pm1_address_space;
        u8                      pm2_address_space;
        u8                      pm_timer_address_space;
        u8                      gpe0address_space;
        u8                      gpe1_address_space;
 #else
-       FADT_DESCRIPTOR_REV1   *FADT1;
+       fadt_descriptor_rev1   *FADT1;
 #endif
 
-       FADT_DESCRIPTOR_REV2   *FADT2;
-       ACPI_TABLE_DESC        *table_desc;
+       fadt_descriptor_rev2   *FADT2;
+       acpi_table_desc        *table_desc;
+
+
+       FUNCTION_TRACE ("Tb_convert_table_fadt");
 
 
        /* Acpi_gbl_FADT is valid */
        /* Allocate and zero the 2.0 buffer */
 
-       FADT2 = acpi_ut_callocate (sizeof (FADT_DESCRIPTOR_REV2));
+       FADT2 = ACPI_MEM_CALLOCATE (sizeof (fadt_descriptor_rev2));
        if (FADT2 == NULL) {
-               return (AE_NO_MEMORY);
+               return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
 
@@ -206,7 +214,7 @@ acpi_tb_convert_table_fadt (void)
        if (acpi_gbl_FADT->header.revision >= FADT2_REVISION_ID) {
                /* We have an ACPI 2.0 FADT but we must copy it to our local buffer */
 
-               *FADT2 = *((FADT_DESCRIPTOR_REV2*) acpi_gbl_FADT);
+               *FADT2 = *((fadt_descriptor_rev2*) acpi_gbl_FADT);
 
        }
 
@@ -220,7 +228,7 @@ acpi_tb_convert_table_fadt (void)
 
                /* The BIOS stored FADT should agree with Revision 0.71 */
 
-               FADT71 = (FADT_DESCRIPTOR_REV071 *) acpi_gbl_FADT;
+               FADT71 = (fadt_descriptor_rev071 *) acpi_gbl_FADT;
 
                /* Copy the table header*/
 
@@ -371,7 +379,7 @@ acpi_tb_convert_table_fadt (void)
 
                /* The BIOS stored FADT should agree with Revision 1.0 */
 
-               FADT1 = (FADT_DESCRIPTOR_REV1*) acpi_gbl_FADT;
+               FADT1 = (fadt_descriptor_rev1*) acpi_gbl_FADT;
 
                /*
                 * Copy the table header and the common part of the tables
@@ -379,8 +387,7 @@ acpi_tb_convert_table_fadt (void)
                 * entire 1.0 table can be copied first, then expand some
                 * fields to 64 bits.
                 */
-
-               MEMCPY (FADT2, FADT1, sizeof (FADT_DESCRIPTOR_REV1));
+               MEMCPY (FADT2, FADT1, sizeof (fadt_descriptor_rev1));
 
 
                /* Convert table pointers to 64-bit fields */
@@ -460,16 +467,21 @@ 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->length = sizeof (fadt_descriptor_rev2);
 
 
        /* Dump the entire FADT */
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
+               "Hex dump of common internal FADT, size %ld (%lX)\n",
+               acpi_gbl_FADT->header.length, acpi_gbl_FADT->header.length));
+       DUMP_BUFFER ((u8 *) (acpi_gbl_FADT), acpi_gbl_FADT->header.length);
 
-       return (AE_OK);
+
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -485,26 +497,29 @@ acpi_tb_convert_table_fadt (void)
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_tb_build_common_facs (
-       ACPI_TABLE_DESC         *table_info)
+       acpi_table_desc         *table_info)
 {
-       ACPI_COMMON_FACS        *common_facs;
+       acpi_common_facs        *common_facs;
 
 #ifdef _IA64
-       FACS_DESCRIPTOR_REV071  *FACS71;
+       facs_descriptor_rev071  *FACS71;
 #else
-       FACS_DESCRIPTOR_REV1    *FACS1;
+       facs_descriptor_rev1    *FACS1;
 #endif
 
-       FACS_DESCRIPTOR_REV2    *FACS2;
+       facs_descriptor_rev2    *FACS2;
+
+
+       FUNCTION_TRACE ("Tb_build_common_facs");
 
 
        /* Allocate a common FACS */
 
-       common_facs = acpi_ut_callocate (sizeof (ACPI_COMMON_FACS));
+       common_facs = ACPI_MEM_CALLOCATE (sizeof (acpi_common_facs));
        if (!common_facs) {
-               return (AE_NO_MEMORY);
+               return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
 
@@ -514,7 +529,7 @@ acpi_tb_build_common_facs (
 #ifdef _IA64
                /* 0.71 FACS */
 
-               FACS71 = (FACS_DESCRIPTOR_REV071 *) acpi_gbl_FACS;
+               FACS71 = (facs_descriptor_rev071 *) acpi_gbl_FACS;
 
                common_facs->global_lock = (u32 *) &(FACS71->global_lock);
                common_facs->firmware_waking_vector = &FACS71->firmware_waking_vector;
@@ -522,7 +537,7 @@ acpi_tb_build_common_facs (
 #else
                /* ACPI 1.0 FACS */
 
-               FACS1 = (FACS_DESCRIPTOR_REV1 *) acpi_gbl_FACS;
+               FACS1 = (facs_descriptor_rev1 *) acpi_gbl_FACS;
 
                common_facs->global_lock = &(FACS1->global_lock);
                common_facs->firmware_waking_vector = (UINT64 *) &FACS1->firmware_waking_vector;
@@ -534,7 +549,7 @@ acpi_tb_build_common_facs (
        else {
                /* ACPI 2.0 FACS */
 
-               FACS2 = (FACS_DESCRIPTOR_REV2 *) acpi_gbl_FACS;
+               FACS2 = (facs_descriptor_rev2 *) acpi_gbl_FACS;
 
                common_facs->global_lock = &(FACS2->global_lock);
                common_facs->firmware_waking_vector = &FACS2->Xfirmware_waking_vector;
@@ -547,7 +562,7 @@ acpi_tb_build_common_facs (
 
        acpi_gbl_FACS = common_facs;
 
-       return  (AE_OK);
+       return_ACPI_STATUS  (AE_OK);
 }
 
 
index 6beb1a99c4073190d0e9b5a33108fd94a954ef06..b9e0e659aefb934fe988550e8689b37b8b2d3596 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: tbget - ACPI Table get* routines
- *              $Revision: 48 $
+ *              $Revision: 55 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_tb_get_table_ptr (
-       ACPI_TABLE_TYPE         table_type,
+       acpi_table_type         table_type,
        u32                     instance,
-       ACPI_TABLE_HEADER       **table_ptr_loc)
+       acpi_table_header       **table_ptr_loc)
 {
-       ACPI_TABLE_DESC         *table_desc;
+       acpi_table_desc         *table_desc;
        u32                     i;
 
 
+       FUNCTION_TRACE ("Tb_get_table_ptr");
+
+
        if (!acpi_gbl_DSDT) {
-               return (AE_NO_ACPI_TABLES);
+               return_ACPI_STATUS (AE_NO_ACPI_TABLES);
        }
 
        if (table_type > ACPI_TABLE_MAX) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
 
@@ -79,7 +82,7 @@ acpi_tb_get_table_ptr (
                 * Will be null if no table is present
                 */
                *table_ptr_loc = acpi_gbl_acpi_tables[table_type].pointer;
-               return (AE_OK);
+               return_ACPI_STATUS (AE_OK);
        }
 
 
@@ -87,7 +90,7 @@ acpi_tb_get_table_ptr (
         * Check for instance out of range
         */
        if (instance > acpi_gbl_acpi_tables[table_type].count) {
-               return (AE_NOT_EXIST);
+               return_ACPI_STATUS (AE_NOT_EXIST);
        }
 
        /* Walk the list to get the desired table
@@ -106,7 +109,7 @@ acpi_tb_get_table_ptr (
 
        *table_ptr_loc = table_desc->pointer;
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -125,21 +128,24 @@ acpi_tb_get_table_ptr (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_tb_get_table (
        ACPI_PHYSICAL_ADDRESS   physical_address,
-       ACPI_TABLE_HEADER       *buffer_ptr,
-       ACPI_TABLE_DESC         *table_info)
+       acpi_table_header       *buffer_ptr,
+       acpi_table_desc         *table_info)
 {
-       ACPI_TABLE_HEADER       *table_header = NULL;
-       ACPI_TABLE_HEADER       *full_table = NULL;
+       acpi_table_header       *table_header = NULL;
+       acpi_table_header       *full_table = NULL;
        u32                     size;
        u8                      allocation;
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+
+       FUNCTION_TRACE ("Tb_get_table");
 
 
        if (!table_info) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
 
@@ -147,20 +153,19 @@ acpi_tb_get_table (
                /*
                 * Getting data from a buffer, not BIOS tables
                 */
-
                table_header = buffer_ptr;
                status = acpi_tb_validate_table_header (table_header);
                if (ACPI_FAILURE (status)) {
                        /* Table failed verification, map all errors to BAD_DATA */
 
-                       return (AE_BAD_DATA);
+                       return_ACPI_STATUS (AE_BAD_DATA);
                }
 
                /* Allocate buffer for the entire table */
 
-               full_table = acpi_ut_allocate (table_header->length);
+               full_table = ACPI_MEM_ALLOCATE (table_header->length);
                if (!full_table) {
-                       return (AE_NO_MEMORY);
+                       return_ACPI_STATUS (AE_NO_MEMORY);
                }
 
                /* Copy the entire table (including header) to the local buffer */
@@ -183,7 +188,7 @@ acpi_tb_get_table (
 
                status = acpi_tb_map_acpi_table (physical_address, &size, &full_table);
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
 
                /* Save allocation type */
@@ -199,7 +204,7 @@ acpi_tb_get_table (
        table_info->allocation  = allocation;
        table_info->base_pointer = full_table;
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -217,14 +222,19 @@ acpi_tb_get_table (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_tb_get_all_tables (
        u32                     number_of_tables,
-       ACPI_TABLE_HEADER       *table_ptr)
+       acpi_table_header       *table_ptr)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        u32                     index;
-       ACPI_TABLE_DESC         table_info;
+       acpi_table_desc         table_info;
+
+
+       FUNCTION_TRACE ("Tb_get_all_tables");
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Number of tables: %d\n", number_of_tables));
 
 
        /*
@@ -232,11 +242,10 @@ acpi_tb_get_all_tables (
         * This will NOT include the FACS and DSDT - we must get
         * them after the loop
         */
-
        for (index = 0; index < number_of_tables; index++) {
                /* Clear the Table_info each time */
 
-               MEMSET (&table_info, 0, sizeof (ACPI_TABLE_DESC));
+               MEMSET (&table_info, 0, sizeof (acpi_table_desc));
 
                /* Get the table via the XSDT */
 
@@ -253,7 +262,7 @@ acpi_tb_get_all_tables (
                /* However, abort on serious errors */
 
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
 
                /* Recognize and install the table */
@@ -265,7 +274,6 @@ acpi_tb_get_all_tables (
                         * 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);
                }
        }
@@ -277,7 +285,7 @@ acpi_tb_get_all_tables (
         */
        status = acpi_tb_convert_table_fadt ();
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
 
@@ -290,57 +298,60 @@ acpi_tb_get_all_tables (
         *
         */
 
-
        /*
         * Get the FACS (must have the FADT first, from loop above)
         * Acpi_tb_get_table_facs will fail if FADT pointer is not valid
         */
-
        status = acpi_tb_get_table_facs (table_ptr, &table_info);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
-
        /* Install the FACS */
 
        status = acpi_tb_install_table (table_ptr, &table_info);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /*
         * Create the common FACS pointer table
         * (Contains pointers to the original table)
         */
-
        status = acpi_tb_build_common_facs (&table_info);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
 
        /*
         * Get the DSDT (We know that the FADT is valid now)
         */
-
        status = acpi_tb_get_table ((ACPI_PHYSICAL_ADDRESS) ACPI_GET_ADDRESS (acpi_gbl_FADT->Xdsdt),
                          table_ptr, &table_info);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Install the DSDT */
 
        status = acpi_tb_install_table (table_ptr, &table_info);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Dump the DSDT Header */
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Hex dump of DSDT Header:\n"));
+       DUMP_BUFFER ((u8 *) acpi_gbl_DSDT, sizeof (acpi_table_header));
+
        /* Dump the entire DSDT */
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
+               "Hex dump of DSDT (After header), size %d (%x)\n",
+               acpi_gbl_DSDT->length, acpi_gbl_DSDT->length));
+       DUMP_BUFFER ((u8 *) (acpi_gbl_DSDT + 1), acpi_gbl_DSDT->length);
+
        /*
         * Initialize the capabilities flags.
         * Assumes that platform supports ACPI_MODE since we have tables!
@@ -352,7 +363,7 @@ acpi_tb_get_all_tables (
 
        acpi_tb_delete_acpi_table (ACPI_TABLE_RSDP);
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -368,22 +379,25 @@ acpi_tb_get_all_tables (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_tb_verify_rsdp (
        ACPI_PHYSICAL_ADDRESS   rsdp_physical_address)
 {
-       ACPI_TABLE_DESC         table_info;
-       ACPI_STATUS             status;
+       acpi_table_desc         table_info;
+       acpi_status             status;
        u8                      *table_ptr;
 
 
+       FUNCTION_TRACE ("Tb_verify_rsdp");
+
+
        /*
         * Obtain access to the RSDP structure
         */
        status = acpi_os_map_memory (rsdp_physical_address, sizeof (RSDP_DESCRIPTOR),
                          (void **) &table_ptr);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /*
@@ -407,7 +421,7 @@ acpi_tb_verify_rsdp (
 
        /* The RSDP supplied is OK */
 
-       table_info.pointer     = (ACPI_TABLE_HEADER *) table_ptr;
+       table_info.pointer     = (acpi_table_header *) table_ptr;
        table_info.length      = sizeof (RSDP_DESCRIPTOR);
        table_info.allocation  = ACPI_MEM_MAPPED;
        table_info.base_pointer = table_ptr;
@@ -423,14 +437,14 @@ acpi_tb_verify_rsdp (
        /* Save the RSDP in a global for easy access */
 
        acpi_gbl_RSDP = (RSDP_DESCRIPTOR *) table_info.pointer;
-       return (status);
+       return_ACPI_STATUS (status);
 
 
        /* Error exit */
 cleanup:
 
        acpi_os_unmap_memory (table_ptr, sizeof (RSDP_DESCRIPTOR));
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -453,6 +467,9 @@ acpi_tb_get_rsdt_address (void)
        ACPI_PHYSICAL_ADDRESS   physical_address;
 
 
+       FUNCTION_ENTRY ();
+
+
        /*
         * For RSDP revision 0 or 1, we use the RSDT.
         * For RSDP revision 2 (and above), we use the XSDT
@@ -471,7 +488,6 @@ acpi_tb_get_rsdt_address (void)
                                   ACPI_GET_ADDRESS (acpi_gbl_RSDP->xsdt_physical_address);
        }
 
-
        return (physical_address);
 }
 
@@ -488,13 +504,16 @@ acpi_tb_get_rsdt_address (void)
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_tb_validate_rsdt (
-       ACPI_TABLE_HEADER       *table_ptr)
+       acpi_table_header       *table_ptr)
 {
        u32                     no_match;
 
 
+       PROC_NAME ("Tb_validate_rsdt");
+
+
        /*
         * For RSDP revision 0 or 1, we use the RSDT.
         * For RSDP revision 2 (and above), we use the XSDT
@@ -514,6 +533,12 @@ acpi_tb_validate_rsdt (
 
                REPORT_ERROR (("Invalid signature where RSDP indicates RSDT/XSDT should be located\n"));
 
+               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));
+
                return (AE_BAD_SIGNATURE);
        }
 
@@ -535,14 +560,17 @@ acpi_tb_validate_rsdt (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_tb_get_table_pointer (
        ACPI_PHYSICAL_ADDRESS   physical_address,
        u32                     flags,
        u32                     *size,
-       ACPI_TABLE_HEADER       **table_ptr)
+       acpi_table_header       **table_ptr)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_ENTRY ();
 
 
        if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) {
@@ -552,7 +580,7 @@ acpi_tb_get_table_pointer (
 
        else {
                *size = 0;
-               *table_ptr = (ACPI_TABLE_HEADER *) (ACPI_TBLPTR) physical_address;
+               *table_ptr = (acpi_table_header *) (ACPI_TBLPTR) physical_address;
 
                status = AE_OK;
        }
@@ -573,18 +601,25 @@ acpi_tb_get_table_pointer (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_tb_get_table_rsdt (
        u32                     *number_of_tables)
 {
-       ACPI_TABLE_DESC         table_info;
-       ACPI_STATUS             status;
+       acpi_table_desc         table_info;
+       acpi_status             status;
        ACPI_PHYSICAL_ADDRESS   physical_address;
 
 
+       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.8lX%8.8lX \n",
+               acpi_gbl_RSDP, HIDWORD(acpi_gbl_RSDP->rsdt_physical_address),
+               LODWORD(acpi_gbl_RSDP->rsdt_physical_address)));
 
 
        physical_address = acpi_tb_get_rsdt_address ();
@@ -594,7 +629,9 @@ acpi_tb_get_table_rsdt (
 
        status = acpi_tb_get_table (physical_address, NULL, &table_info);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not get the RSDT, %s\n",
+                       acpi_format_exception (status)));
+               return_ACPI_STATUS (status);
        }
 
 
@@ -602,7 +639,7 @@ acpi_tb_get_table_rsdt (
 
        status = acpi_tb_validate_rsdt (table_info.pointer);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
 
@@ -617,19 +654,21 @@ acpi_tb_get_table_rsdt (
 
        status = acpi_tb_convert_to_xsdt (&table_info, number_of_tables);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Save the table pointers and allocation info */
 
        status = acpi_tb_init_table_descriptor (ACPI_TABLE_XSDT, &table_info);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
-       acpi_gbl_XSDT = (XSDT_DESCRIPTOR *) table_info.pointer;
+       acpi_gbl_XSDT = (xsdt_descriptor *) table_info.pointer;
 
-       return (status);
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "XSDT located at %p\n", acpi_gbl_XSDT));
+
+       return_ACPI_STATUS (status);
 }
 
 
@@ -650,21 +689,24 @@ acpi_tb_get_table_rsdt (
  *
  *****************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_tb_get_table_facs (
-       ACPI_TABLE_HEADER       *buffer_ptr,
-       ACPI_TABLE_DESC         *table_info)
+       acpi_table_header       *buffer_ptr,
+       acpi_table_desc         *table_info)
 {
-       ACPI_TABLE_HEADER       *table_ptr = NULL;
+       acpi_table_header       *table_ptr = NULL;
        u32                     size;
        u8                      allocation;
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+
+       FUNCTION_TRACE ("Tb_get_table_facs");
 
 
        /* Must have a valid FADT pointer */
 
        if (!acpi_gbl_FADT) {
-               return (AE_NO_ACPI_TABLES);
+               return_ACPI_STATUS (AE_NO_ACPI_TABLES);
        }
 
        size = sizeof (FACS_DESCRIPTOR);
@@ -673,9 +715,9 @@ acpi_tb_get_table_facs (
                 * Getting table from a file -- allocate a buffer and
                 * read the table.
                 */
-               table_ptr = acpi_ut_allocate (size);
+               table_ptr = ACPI_MEM_ALLOCATE (size);
                if(!table_ptr) {
-                       return (AE_NO_MEMORY);
+                       return_ACPI_STATUS (AE_NO_MEMORY);
                }
 
                MEMCPY (table_ptr, buffer_ptr, size);
@@ -691,7 +733,7 @@ acpi_tb_get_table_facs (
                status = acpi_tb_map_acpi_table ((ACPI_PHYSICAL_ADDRESS) ACPI_GET_ADDRESS (acpi_gbl_FADT->Xfirmware_ctrl),
                                   &size, &table_ptr);
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
 
                /* Save allocation type */
@@ -707,6 +749,6 @@ acpi_tb_get_table_facs (
        table_info->allocation  = allocation;
        table_info->base_pointer = table_ptr;
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
index 950bd03d75c1cbfe73f4a89cbfddb344b0d242db..13e7641188cdd4041eedfa57f47ec27f77b41f96 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: tbinstal - ACPI table installation and removal
- *              $Revision: 39 $
+ *              $Revision: 42 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_tb_install_table (
-       ACPI_TABLE_HEADER       *table_ptr,
-       ACPI_TABLE_DESC         *table_info)
+       acpi_table_header       *table_ptr,
+       acpi_table_desc         *table_info)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+       FUNCTION_TRACE ("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);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Lock tables while installing */
@@ -74,8 +75,11 @@ acpi_tb_install_table (
 
        status = acpi_tb_init_table_descriptor (table_info->type, table_info);
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s located at %p\n",
+               acpi_gbl_acpi_table_data[table_info->type].name, table_info->pointer));
+
        acpi_ut_release_mutex (ACPI_MTX_TABLES);
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -100,29 +104,31 @@ acpi_tb_install_table (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_tb_recognize_table (
-       ACPI_TABLE_HEADER       *table_ptr,
-       ACPI_TABLE_DESC         *table_info)
+       acpi_table_header       *table_ptr,
+       acpi_table_desc         *table_info)
 {
-       ACPI_TABLE_HEADER       *table_header;
-       ACPI_STATUS             status;
-       ACPI_TABLE_TYPE         table_type = 0;
+       acpi_table_header       *table_header;
+       acpi_status             status;
+       acpi_table_type         table_type = 0;
        u32                     i;
 
 
+       FUNCTION_TRACE ("Tb_recognize_table");
+
+
        /* Ensure that we have a valid table pointer */
 
-       table_header = (ACPI_TABLE_HEADER *) table_info->pointer;
+       table_header = (acpi_table_header *) table_info->pointer;
        if (!table_header) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        /*
         * Search for a signature match among the known table types
         * Start at index one -> Skip the RSDP
         */
-
        status = AE_SUPPORT;
        for (i = 1; i < NUM_ACPI_TABLES; i++) {
                if (!STRNCMP (table_header->signature,
@@ -132,10 +138,11 @@ acpi_tb_recognize_table (
                         * Found a signature match, get the pertinent info from the
                         * Table_data structure
                         */
-
                        table_type      = i;
                        status          = acpi_gbl_acpi_table_data[i].status;
 
+                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Found %4.4s\n",
+                               acpi_gbl_acpi_table_data[i].signature));
                        break;
                }
        }
@@ -150,7 +157,6 @@ acpi_tb_recognize_table (
         * Validate checksum for _most_ tables,
         * even the ones whose signature we don't recognize
         */
-
        if (table_type != ACPI_TABLE_FACS) {
                /* But don't abort if the checksum is wrong */
                /* TBD: [Future] make this a configuration option? */
@@ -162,9 +168,13 @@ acpi_tb_recognize_table (
         * An AE_SUPPORT means that the table was not recognized.
         * We basically ignore this;  just print a debug message
         */
+       if (status == AE_SUPPORT) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+                       "Unsupported table %s (Type %X) was found and discarded\n",
+                       acpi_gbl_acpi_table_data[table_type].name, table_type));
+       }
 
-
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -181,19 +191,20 @@ acpi_tb_recognize_table (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_tb_init_table_descriptor (
-       ACPI_TABLE_TYPE         table_type,
-       ACPI_TABLE_DESC         *table_info)
+       acpi_table_type         table_type,
+       acpi_table_desc         *table_info)
 {
-       ACPI_TABLE_DESC         *list_head;
-       ACPI_TABLE_DESC         *table_desc;
+       acpi_table_desc         *list_head;
+       acpi_table_desc         *table_desc;
+
 
+       FUNCTION_TRACE_U32 ("Tb_init_table_descriptor", table_type);
 
        /*
         * Install the table into the global data structure
         */
-
        list_head   = &acpi_gbl_acpi_tables[table_type];
        table_desc  = list_head;
 
@@ -203,15 +214,13 @@ acpi_tb_init_table_descriptor (
         * includes most ACPI tables such as the DSDT.  2) Multiple instances of
         * the table are allowed.  This includes SSDT and PSDTs.
         */
-
        if (IS_SINGLE_TABLE (acpi_gbl_acpi_table_data[table_type].flags)) {
                /*
                 * Only one table allowed, and a table has alread been installed
                 *  at this location, so return an error.
                 */
-
                if (list_head->pointer) {
-                       return (AE_EXIST);
+                       return_ACPI_STATUS (AE_EXIST);
                }
 
                table_desc->count = 1;
@@ -223,11 +232,10 @@ acpi_tb_init_table_descriptor (
                 * Multiple tables allowed for this table type, we must link
                 * the new table in to the list of tables of this type.
                 */
-
                if (list_head->pointer) {
-                       table_desc = acpi_ut_callocate (sizeof (ACPI_TABLE_DESC));
+                       table_desc = ACPI_MEM_CALLOCATE (sizeof (acpi_table_desc));
                        if (!table_desc) {
-                               return (AE_NO_MEMORY);
+                               return_ACPI_STATUS (AE_NO_MEMORY);
                        }
 
                        list_head->count++;
@@ -260,7 +268,7 @@ acpi_tb_init_table_descriptor (
        table_desc->allocation          = table_info->allocation;
        table_desc->aml_pointer         = (u8 *) (table_desc->pointer + 1),
        table_desc->aml_length          = (u32) (table_desc->length -
-                        (u32) sizeof (ACPI_TABLE_HEADER));
+                        (u32) sizeof (acpi_table_header));
        table_desc->table_id            = acpi_ut_allocate_owner_id (OWNER_TYPE_TABLE);
        table_desc->loaded_into_namespace = FALSE;
 
@@ -268,7 +276,6 @@ acpi_tb_init_table_descriptor (
         * Set the appropriate global pointer (if there is one) to point to the
         * newly installed table
         */
-
        if (acpi_gbl_acpi_table_data[table_type].global_ptr) {
                *(acpi_gbl_acpi_table_data[table_type].global_ptr) = table_info->pointer;
        }
@@ -279,7 +286,7 @@ acpi_tb_init_table_descriptor (
        table_info->table_id        = table_desc->table_id;
        table_info->installed_desc  = table_desc;
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -298,14 +305,13 @@ acpi_tb_init_table_descriptor (
 void
 acpi_tb_delete_acpi_tables (void)
 {
-       ACPI_TABLE_TYPE             type;
+       acpi_table_type             type;
 
 
        /*
         * Free memory allocated for ACPI tables
         * Memory can either be mapped or allocated
         */
-
        for (type = 0; type < NUM_ACPI_TABLES; type++) {
                acpi_tb_delete_acpi_table (type);
        }
@@ -328,11 +334,13 @@ acpi_tb_delete_acpi_tables (void)
 
 void
 acpi_tb_delete_acpi_table (
-       ACPI_TABLE_TYPE             type)
+       acpi_table_type             type)
 {
+       FUNCTION_TRACE_U32 ("Tb_delete_acpi_table", type);
+
 
        if (type > ACPI_TABLE_MAX) {
-               return;
+               return_VOID;
        }
 
 
@@ -374,7 +382,7 @@ acpi_tb_delete_acpi_table (
 
        acpi_ut_release_mutex (ACPI_MTX_TABLES);
 
-       return;
+       return_VOID;
 }
 
 
@@ -393,13 +401,16 @@ acpi_tb_delete_acpi_table (
 
 void
 acpi_tb_free_acpi_tables_of_type (
-       ACPI_TABLE_DESC         *list_head)
+       acpi_table_desc         *list_head)
 {
-       ACPI_TABLE_DESC         *table_desc;
+       acpi_table_desc         *table_desc;
        u32                     count;
        u32                     i;
 
 
+       FUNCTION_TRACE_PTR ("Tb_free_acpi_tables_of_type", list_head);
+
+
        /* Get the head of the list */
 
        table_desc  = list_head;
@@ -409,12 +420,11 @@ acpi_tb_free_acpi_tables_of_type (
         * Walk the entire list, deleting both the allocated tables
         * and the table descriptors
         */
-
        for (i = 0; i < count; i++) {
                table_desc = acpi_tb_uninstall_table (table_desc);
        }
 
-       return;
+       return_VOID;
 }
 
 
@@ -433,7 +443,7 @@ acpi_tb_free_acpi_tables_of_type (
 
 void
 acpi_tb_delete_single_table (
-       ACPI_TABLE_DESC         *table_desc)
+       acpi_table_desc         *table_desc)
 {
 
        if (!table_desc) {
@@ -451,7 +461,7 @@ acpi_tb_delete_single_table (
 
                case ACPI_MEM_ALLOCATED:
 
-                       acpi_ut_free (table_desc->base_pointer);
+                       ACPI_MEM_FREE (table_desc->base_pointer);
                        break;
 
 
@@ -478,15 +488,18 @@ acpi_tb_delete_single_table (
  *
  ******************************************************************************/
 
-ACPI_TABLE_DESC *
+acpi_table_desc *
 acpi_tb_uninstall_table (
-       ACPI_TABLE_DESC         *table_desc)
+       acpi_table_desc         *table_desc)
 {
-       ACPI_TABLE_DESC         *next_desc;
+       acpi_table_desc         *next_desc;
+
+
+       FUNCTION_TRACE_PTR ("Tb_delete_single_table", table_desc);
 
 
        if (!table_desc) {
-               return (NULL);
+               return_PTR (NULL);
        }
 
 
@@ -524,11 +537,11 @@ acpi_tb_uninstall_table (
                /* Free the table descriptor */
 
                next_desc = table_desc->next;
-               acpi_ut_free (table_desc);
+               ACPI_MEM_FREE (table_desc);
        }
 
 
-       return (next_desc);
+       return_PTR (next_desc);
 }
 
 
index 02e9fcc129e227f124d9e590cff31165c3155294..c669a129ecd812dd18c61f79d5a66ee3838894a5 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: tbutils - Table manipulation utilities
- *              $Revision: 38 $
+ *              $Revision: 40 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_tb_handle_to_object (
        u16                     table_id,
-       ACPI_TABLE_DESC         **table_desc)
+       acpi_table_desc         **table_desc)
 {
        u32                     i;
-       ACPI_TABLE_DESC         *list_head;
+       acpi_table_desc         *list_head;
+
+
+       PROC_NAME ("Tb_handle_to_object");
 
 
        for (i = 0; i < ACPI_TABLE_MAX; i++) {
@@ -69,6 +72,7 @@ acpi_tb_handle_to_object (
        }
 
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Table_id=%X does not exist\n", table_id));
        return (AE_BAD_PARAMETER);
 }
 
@@ -90,8 +94,8 @@ acpi_tb_system_table_pointer (
        void                    *where)
 {
        u32                     i;
-       ACPI_TABLE_DESC         *table_desc;
-       ACPI_TABLE_HEADER       *table;
+       acpi_table_desc         *table_desc;
+       acpi_table_header       *table;
 
 
        /* No function trace, called too often! */
@@ -168,11 +172,11 @@ acpi_tb_system_table_pointer (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_tb_validate_table_header (
-       ACPI_TABLE_HEADER       *table_header)
+       acpi_table_header       *table_header)
 {
-       ACPI_NAME               signature;
+       acpi_name               signature;
 
 
        PROC_NAME ("Tb_validate_table_header");
@@ -180,7 +184,9 @@ acpi_tb_validate_table_header (
 
        /* Verify that this is a valid address */
 
-       if (!acpi_os_readable (table_header, sizeof (ACPI_TABLE_HEADER))) {
+       if (!acpi_os_readable (table_header, sizeof (acpi_table_header))) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                       "Cannot read table header at %p\n", table_header));
                return (AE_BAD_ADDRESS);
        }
 
@@ -189,15 +195,25 @@ acpi_tb_validate_table_header (
 
        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 [%X] has invalid characters\n",
+                       table_header, &signature));
+
                REPORT_WARNING (("Invalid table signature %4.4s found\n", &signature));
+               DUMP_BUFFER (table_header, sizeof (acpi_table_header));
                return (AE_BAD_SIGNATURE);
        }
 
 
        /* Validate the table length */
 
-       if (table_header->length < sizeof (ACPI_TABLE_HEADER)) {
+       if (table_header->length < sizeof (acpi_table_header)) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                       "Invalid length in table header %p name %4.4s\n",
+                       table_header, &signature));
+
                REPORT_WARNING (("Invalid table header length found\n"));
+               DUMP_BUFFER (table_header, sizeof (acpi_table_header));
                return (AE_BAD_HEADER);
        }
 
@@ -221,15 +237,18 @@ acpi_tb_validate_table_header (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_tb_map_acpi_table (
        ACPI_PHYSICAL_ADDRESS   physical_address,
        u32                     *size,
-       ACPI_TABLE_HEADER       **logical_address)
+       acpi_table_header       **logical_address)
 {
-       ACPI_TABLE_HEADER       *table;
+       acpi_table_header       *table;
        u32                     table_size = *size;
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+
+       PROC_NAME ("Tb_map_acpi_table");
 
 
        /* If size is zero, look at the table header to get the actual size */
@@ -237,7 +256,7 @@ acpi_tb_map_acpi_table (
        if ((*size) == 0) {
                /* Get the table header so we can extract the table length */
 
-               status = acpi_os_map_memory (physical_address, sizeof (ACPI_TABLE_HEADER),
+               status = acpi_os_map_memory (physical_address, sizeof (acpi_table_header),
                                  (void **) &table);
                if (ACPI_FAILURE (status)) {
                        return (status);
@@ -251,12 +270,11 @@ acpi_tb_map_acpi_table (
                 * Validate the header and delete the mapping.
                 * We will create a mapping for the full table below.
                 */
-
                status = acpi_tb_validate_table_header (table);
 
                /* Always unmap the memory for the header */
 
-               acpi_os_unmap_memory (table, sizeof (ACPI_TABLE_HEADER));
+               acpi_os_unmap_memory (table, sizeof (acpi_table_header));
 
                /* Exit if header invalid */
 
@@ -273,6 +291,10 @@ acpi_tb_map_acpi_table (
                return (status);
        }
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+               "Mapped memory for ACPI table, length=%d(%X) at %p\n",
+               table_size, table_size, table));
+
        *size = table_size;
        *logical_address = table;
 
@@ -293,12 +315,15 @@ acpi_tb_map_acpi_table (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_tb_verify_table_checksum (
-       ACPI_TABLE_HEADER       *table_header)
+       acpi_table_header       *table_header)
 {
        u8                      checksum;
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+
+       FUNCTION_TRACE ("Tb_verify_table_checksum");
 
 
        /* Compute the checksum on the table */
@@ -315,7 +340,7 @@ acpi_tb_verify_table_checksum (
        }
 
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
index 580472f2d5fca38bc32b5e46e46811633dcb3013..82f774223603e3148991adec6edfd95eaa3bf48e 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Module Name: tbxface - Public interfaces to the ACPI subsystem
  *                         ACPI table oriented interfaces
- *              $Revision: 39 $
+ *              $Revision: 43 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
-acpi_load_tables (
-       ACPI_PHYSICAL_ADDRESS   rsdp_physical_address)
+acpi_status
+acpi_load_tables (void)
 {
-       ACPI_STATUS             status;
+       ACPI_PHYSICAL_ADDRESS   rsdp_physical_address;
+       acpi_status             status;
        u32                     number_of_tables = 0;
 
 
+       FUNCTION_TRACE ("Acpi_load_tables");
+
+
        /* Ensure that ACPI has been initialized */
 
        ACPI_IS_INITIALIZATION_COMPLETE (status);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
+       }
+
+
+       /* Get the RSDP */
+
+       status = acpi_os_get_root_pointer (ACPI_LOGICAL_ADDRESSING,
+                         &rsdp_physical_address);
+       if (ACPI_FAILURE (status)) {
+               REPORT_ERROR (("Acpi_load_tables: Could not get RSDP, %s\n",
+                                 acpi_format_exception (status)));
+               goto error_exit;
        }
 
        /* Map and validate the RSDP */
@@ -68,7 +82,7 @@ acpi_load_tables (
        status = acpi_tb_verify_rsdp (rsdp_physical_address);
        if (ACPI_FAILURE (status)) {
                REPORT_ERROR (("Acpi_load_tables: RSDP Failed validation: %s\n",
-                                 acpi_ut_format_exception (status)));
+                                 acpi_format_exception (status)));
                goto error_exit;
        }
 
@@ -77,7 +91,7 @@ acpi_load_tables (
        status = acpi_tb_get_table_rsdt (&number_of_tables);
        if (ACPI_FAILURE (status)) {
                REPORT_ERROR (("Acpi_load_tables: Could not load RSDT: %s\n",
-                                 acpi_ut_format_exception (status)));
+                                 acpi_format_exception (status)));
                goto error_exit;
        }
 
@@ -86,28 +100,30 @@ acpi_load_tables (
        status = acpi_tb_get_all_tables (number_of_tables, NULL);
        if (ACPI_FAILURE (status)) {
                REPORT_ERROR (("Acpi_load_tables: Error getting required tables (DSDT/FADT/FACS): %s\n",
-                                 acpi_ut_format_exception (status)));
+                                 acpi_format_exception (status)));
                goto error_exit;
        }
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_OK, "ACPI Tables successfully loaded\n"));
+
 
        /* Load the namespace from the tables */
 
        status = acpi_ns_load_namespace ();
        if (ACPI_FAILURE (status)) {
                REPORT_ERROR (("Acpi_load_tables: Could not load namespace: %s\n",
-                                 acpi_ut_format_exception (status)));
+                                 acpi_format_exception (status)));
                goto error_exit;
        }
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 
 
 error_exit:
        REPORT_ERROR (("Acpi_load_tables: Could not load tables: %s\n",
-                         acpi_ut_format_exception (status)));
+                         acpi_format_exception (status)));
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -127,30 +143,33 @@ error_exit:
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_load_table (
-       ACPI_TABLE_HEADER       *table_ptr)
+       acpi_table_header       *table_ptr)
 {
-       ACPI_STATUS             status;
-       ACPI_TABLE_DESC         table_info;
+       acpi_status             status;
+       acpi_table_desc         table_info;
+
+
+       FUNCTION_TRACE ("Acpi_load_table");
 
 
        /* Ensure that ACPI has been initialized */
 
        ACPI_IS_INITIALIZATION_COMPLETE (status);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        if (!table_ptr) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        /* Copy the table to a local buffer */
 
        status = acpi_tb_get_table (0, table_ptr, &table_info);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Install the new table into the local data structures */
@@ -160,7 +179,7 @@ acpi_load_table (
                /* Free table allocated by Acpi_tb_get_table */
 
                acpi_tb_delete_single_table (&table_info);
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
 
@@ -169,11 +188,11 @@ acpi_load_table (
                /* Uninstall table and free the buffer */
 
                acpi_tb_uninstall_table (table_info.installed_desc);
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -189,25 +208,28 @@ acpi_load_table (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_unload_table (
-       ACPI_TABLE_TYPE         table_type)
+       acpi_table_type         table_type)
 {
-       ACPI_TABLE_DESC         *list_head;
-       ACPI_STATUS             status;
+       acpi_table_desc         *list_head;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Acpi_unload_table");
 
 
        /* Ensure that ACPI has been initialized */
 
        ACPI_IS_INITIALIZATION_COMPLETE (status);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Parameter validation */
 
        if (table_type > ACPI_TABLE_MAX) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
 
@@ -229,7 +251,7 @@ acpi_unload_table (
 
        } while (list_head != &acpi_gbl_acpi_tables[table_type]);
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -241,11 +263,11 @@ acpi_unload_table (
  *              Instance        - the non zero instance of the table, allows
  *                                support for multiple tables of the same type
  *                                see Acpi_gbl_Acpi_table_flag
- *              Out_table_header - pointer to the ACPI_TABLE_HEADER if successful
+ *              Out_table_header - pointer to the acpi_table_header if successful
  *
  * DESCRIPTION: This function is called to get an ACPI table header.  The caller
  *              supplies an pointer to a data area sufficient to contain an ACPI
- *              ACPI_TABLE_HEADER structure.
+ *              acpi_table_header structure.
  *
  *              The header contains a length field that can be used to determine
  *              the size of the buffer needed to contain the entire table.  This
@@ -254,27 +276,30 @@ acpi_unload_table (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_get_table_header (
-       ACPI_TABLE_TYPE         table_type,
+       acpi_table_type         table_type,
        u32                     instance,
-       ACPI_TABLE_HEADER       *out_table_header)
+       acpi_table_header       *out_table_header)
 {
-       ACPI_TABLE_HEADER       *tbl_ptr;
-       ACPI_STATUS             status;
+       acpi_table_header       *tbl_ptr;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Acpi_get_table_header");
 
 
        /* Ensure that ACPI has been initialized */
 
        ACPI_IS_INITIALIZATION_COMPLETE (status);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        if ((instance == 0)                 ||
                (table_type == ACPI_TABLE_RSDP) ||
                (!out_table_header)) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        /* Check the table type and instance */
@@ -282,7 +307,7 @@ acpi_get_table_header (
        if ((table_type > ACPI_TABLE_MAX)   ||
                (IS_SINGLE_TABLE (acpi_gbl_acpi_table_data[table_type].flags) &&
                 instance > 1)) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
 
@@ -290,23 +315,23 @@ acpi_get_table_header (
 
        status = acpi_tb_get_table_ptr (table_type, instance, &tbl_ptr);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /*
         * The function will return a NULL pointer if the table is not loaded
         */
        if (tbl_ptr == NULL) {
-               return (AE_NOT_EXIST);
+               return_ACPI_STATUS (AE_NOT_EXIST);
        }
 
        /*
         * Copy the header to the caller's buffer
         */
        MEMCPY ((void *) out_table_header, (void *) tbl_ptr,
-                        sizeof (ACPI_TABLE_HEADER));
+                        sizeof (acpi_table_header));
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -333,22 +358,25 @@ acpi_get_table_header (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_get_table (
-       ACPI_TABLE_TYPE         table_type,
+       acpi_table_type         table_type,
        u32                     instance,
-       ACPI_BUFFER             *ret_buffer)
+       acpi_buffer             *ret_buffer)
 {
-       ACPI_TABLE_HEADER       *tbl_ptr;
-       ACPI_STATUS             status;
+       acpi_table_header       *tbl_ptr;
+       acpi_status             status;
        u32                     ret_buf_len;
 
 
+       FUNCTION_TRACE ("Acpi_get_table");
+
+
        /* Ensure that ACPI has been initialized */
 
        ACPI_IS_INITIALIZATION_COMPLETE (status);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /*
@@ -357,7 +385,7 @@ acpi_get_table (
        if ((instance == 0)                 ||
                (!ret_buffer)                   ||
                ((!ret_buffer->pointer) && (ret_buffer->length))) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
        /* Check the table type and instance */
@@ -365,7 +393,7 @@ acpi_get_table (
        if ((table_type > ACPI_TABLE_MAX)   ||
                (IS_SINGLE_TABLE (acpi_gbl_acpi_table_data[table_type].flags) &&
                 instance > 1)) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
 
@@ -373,7 +401,7 @@ acpi_get_table (
 
        status = acpi_tb_get_table_ptr (table_type, instance, &tbl_ptr);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /*
@@ -381,7 +409,7 @@ acpi_get_table (
         * table is not loaded.
         */
        if (tbl_ptr == NULL) {
-               return (AE_NOT_EXIST);
+               return_ACPI_STATUS (AE_NOT_EXIST);
        }
 
        /*
@@ -402,14 +430,14 @@ acpi_get_table (
         */
        if (ret_buffer->length < ret_buf_len) {
                ret_buffer->length = ret_buf_len;
-               return (AE_BUFFER_OVERFLOW);
+               return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
        }
 
        ret_buffer->length = ret_buf_len;
 
        MEMCPY ((void *) ret_buffer->pointer, (void *) tbl_ptr, ret_buf_len);
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
index ceafa1ca89f356dc92988ef39d1c1c7198534ae6..021f622468fc966a5937ed38a25f4cd59a227a72 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: tbxfroot - Find the root ACPI table (RSDT)
- *              $Revision: 39 $
+ *              $Revision: 49 $
  *
  *****************************************************************************/
 
@@ -40,6 +40,7 @@
  * FUNCTION:    Acpi_find_root_pointer
  *
  * PARAMETERS:  **Rsdp_physical_address     - Where to place the RSDP address
+ *              Flags                       - Logical/Physical addressing
  *
  * RETURN:      Status, Physical address of the RSDP
  *
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_find_root_pointer (
+       u32                     flags,
        ACPI_PHYSICAL_ADDRESS   *rsdp_physical_address)
 {
-       ACPI_TABLE_DESC         table_info;
-       ACPI_STATUS             status;
+       acpi_table_desc         table_info;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Acpi_find_root_pointer");
 
 
        /* Get the RSDP */
 
-       status = acpi_tb_find_rsdp (&table_info, ACPI_LOGICAL_ADDRESSING);
+       status = acpi_tb_find_rsdp (&table_info, flags);
        if (ACPI_FAILURE (status)) {
-               return (AE_NO_ACPI_TABLES);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "RSDP structure not found\n"));
+               return_ACPI_STATUS (AE_NO_ACPI_TABLES);
        }
 
        *rsdp_physical_address = table_info.physical_address;
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -90,6 +96,9 @@ acpi_tb_scan_memory_for_rsdp (
        u8                      *mem_rover;
 
 
+       FUNCTION_TRACE ("Tb_scan_memory_for_rsdp");
+
+
        /* Search from given start addr for the requested length  */
 
        for (offset = 0, mem_rover = start_address;
@@ -103,13 +112,17 @@ acpi_tb_scan_memory_for_rsdp (
                        acpi_tb_checksum (mem_rover, RSDP_CHECKSUM_LENGTH) == 0) {
                        /* If so, we have found the RSDP */
 
-                       return (mem_rover);
+                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+                               "RSDP located at physical address %p\n",mem_rover));
+                       return_PTR (mem_rover);
                }
        }
 
        /* Searched entire block, no RSDP was found */
 
-       return (NULL);
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,"Searched entire block, no RSDP was found.\n"));
+
+       return_PTR (NULL);
 }
 
 
@@ -132,15 +145,18 @@ acpi_tb_scan_memory_for_rsdp (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_tb_find_rsdp (
-       ACPI_TABLE_DESC         *table_info,
+       acpi_table_desc         *table_info,
        u32                     flags)
 {
        u8                      *table_ptr;
        u8                      *mem_rover;
        UINT64                  phys_addr;
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+
+       FUNCTION_TRACE ("Tb_find_rsdp");
 
 
        /*
@@ -153,7 +169,7 @@ acpi_tb_find_rsdp (
                status = acpi_os_map_memory (LO_RSDP_WINDOW_BASE, LO_RSDP_WINDOW_SIZE,
                                  (void **) &table_ptr);
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
 
                mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, LO_RSDP_WINDOW_SIZE);
@@ -167,7 +183,7 @@ acpi_tb_find_rsdp (
 
                        table_info->physical_address = phys_addr;
 
-                       return (AE_OK);
+                       return_ACPI_STATUS (AE_OK);
                }
 
                /*
@@ -176,7 +192,7 @@ acpi_tb_find_rsdp (
                status = acpi_os_map_memory (HI_RSDP_WINDOW_BASE, HI_RSDP_WINDOW_SIZE,
                                  (void **) &table_ptr);
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
 
                mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, HI_RSDP_WINDOW_SIZE);
@@ -190,7 +206,7 @@ acpi_tb_find_rsdp (
 
                        table_info->physical_address = phys_addr;
 
-                       return (AE_OK);
+                       return_ACPI_STATUS (AE_OK);
                }
        }
 
@@ -208,7 +224,7 @@ acpi_tb_find_rsdp (
                        /* Found it, return the physical address */
 
                        table_info->physical_address = (ACPI_TBLPTR) mem_rover;
-                       return (AE_OK);
+                       return_ACPI_STATUS (AE_OK);
                }
 
                /*
@@ -220,14 +236,14 @@ acpi_tb_find_rsdp (
                        /* Found it, return the physical address */
 
                        table_info->physical_address = (ACPI_TBLPTR) mem_rover;
-                       return (AE_OK);
+                       return_ACPI_STATUS (AE_OK);
                }
        }
 
 
        /* RSDP signature was not found */
 
-       return (AE_NOT_FOUND);
+       return_ACPI_STATUS (AE_NOT_FOUND);
 }
 
 
@@ -253,18 +269,17 @@ acpi_tb_find_rsdp (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_get_firmware_table (
-       ACPI_STRING             signature,
+       acpi_string             signature,
        u32                     instance,
        u32                     flags,
-       ACPI_TABLE_HEADER       **table_pointer)
+       acpi_table_header       **table_pointer)
 {
        ACPI_PHYSICAL_ADDRESS   physical_address;
-       ACPI_TABLE_DESC         table_info;
-       ACPI_TABLE_HEADER       *rsdt_ptr;
-       ACPI_TABLE_HEADER       *table_ptr;
-       ACPI_STATUS             status;
+       acpi_table_header       *rsdt_ptr;
+       acpi_table_header       *table_ptr;
+       acpi_status             status;
        u32                     rsdt_size;
        u32                     table_size;
        u32                     table_count;
@@ -272,29 +287,37 @@ acpi_get_firmware_table (
        u32                     j;
 
 
+       FUNCTION_TRACE ("Acpi_get_firmware_table");
+
+
        /*
         * Ensure that at least the table manager is initialized.  We don't
         * require that the entire ACPI subsystem is up for this interface
         */
 
-
        /*
         *  If we have a buffer, we must have a length too
         */
        if ((instance == 0)                 ||
                (!signature)                    ||
                (!table_pointer)) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
-       /* Get the RSDP by scanning low memory */
+       /* Get the RSDP */
 
-       status = acpi_tb_find_rsdp (&table_info, flags);
+       status = acpi_os_get_root_pointer (flags, &physical_address);
        if (ACPI_FAILURE (status)) {
-               return (AE_NO_ACPI_TABLES);
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "RSDP  not found\n"));
+               return_ACPI_STATUS (AE_NO_ACPI_TABLES);
        }
 
-       acpi_gbl_RSDP = (RSDP_DESCRIPTOR *) table_info.pointer;
+       acpi_gbl_RSDP = (RSDP_DESCRIPTOR *) (ACPI_TBLPTR) physical_address;
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+               "RSDP located at %p, RSDT physical=%8.8lX%8.8lX \n",
+               acpi_gbl_RSDP, HIDWORD(acpi_gbl_RSDP->rsdt_physical_address),
+               LODWORD(acpi_gbl_RSDP->rsdt_physical_address)));
 
 
        /* Get the RSDT and validate it */
@@ -302,7 +325,7 @@ acpi_get_firmware_table (
        physical_address = acpi_tb_get_rsdt_address ();
        status = acpi_tb_get_table_pointer (physical_address, flags, &rsdt_size, &rsdt_ptr);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        status = acpi_tb_validate_rsdt (rsdt_ptr);
@@ -328,7 +351,7 @@ acpi_get_firmware_table (
                }
                else {
                        physical_address = (ACPI_PHYSICAL_ADDRESS)
-                               ACPI_GET_ADDRESS (((XSDT_DESCRIPTOR *) rsdt_ptr)->table_offset_entry[i]);
+                               ACPI_GET_ADDRESS (((xsdt_descriptor *) rsdt_ptr)->table_offset_entry[i]);
                }
 
                /* Get addressibility if necessary */
@@ -368,7 +391,7 @@ cleanup:
        if (rsdt_size) {
                acpi_os_unmap_memory (rsdt_ptr, rsdt_size);
        }
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
index 9614a255c791441be0ff38513b675aace7034eb0..82ef5fe63b07c2264c60bbcdd2bab546cf0b4b74 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
- * Module Name: utalloc - local memory allocation routines
- *              $Revision: 90 $
+ * Module Name: utalloc - local cache and memory allocation routines
+ *              $Revision: 100 $
  *
  *****************************************************************************/
 
         MODULE_NAME         ("utalloc")
 
 
+/******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_release_to_cache
+ *
+ * PARAMETERS:  List_id             - Memory list/cache ID
+ *              Object              - The object to be released
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Release an object to the specified cache.  If cache is full,
+ *              the object is deleted.
+ *
+ ******************************************************************************/
+
+void
+acpi_ut_release_to_cache (
+       u32                     list_id,
+       void                    *object)
+{
+       ACPI_MEMORY_LIST        *cache_info;
+
+
+       FUNCTION_ENTRY ();
+
+
+       /* If walk cache is full, just free this wallkstate object */
+
+       cache_info = &acpi_gbl_memory_lists[list_id];
+       if (cache_info->cache_depth >= cache_info->max_cache_depth) {
+               ACPI_MEM_FREE (object);
+               ACPI_MEM_TRACKING (cache_info->total_freed++);
+       }
+
+       /* Otherwise put this object back into the cache */
+
+       else {
+               acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
+
+               /* Mark the object as cached */
+
+               MEMSET (object, 0xCA, cache_info->object_size);
+
+               /* Put the object at the head of the cache list */
+
+               * (char **) (((char *) object) + cache_info->link_offset) = cache_info->list_head;
+               cache_info->list_head = object;
+               cache_info->cache_depth++;
+
+               acpi_ut_release_mutex (ACPI_MTX_CACHES);
+       }
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_acquire_from_cache
+ *
+ * PARAMETERS:  List_id             - Memory list ID
+ *
+ * RETURN:      A requested object.  NULL if the object could not be
+ *              allocated.
+ *
+ * DESCRIPTION: Get an object from the specified cache.  If cache is empty,
+ *              the object is allocated.
+ *
+ ******************************************************************************/
+
+void *
+acpi_ut_acquire_from_cache (
+       u32                     list_id)
+{
+       ACPI_MEMORY_LIST        *cache_info;
+       void                    *object;
+
+
+       PROC_NAME ("Ut_acquire_from_cache");
+
+
+       cache_info = &acpi_gbl_memory_lists[list_id];
+       acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
+       ACPI_MEM_TRACKING (cache_info->cache_requests++);
+
+       /* Check the cache first */
+
+       if (cache_info->list_head) {
+               /* There is an object available, use it */
+
+               object = cache_info->list_head;
+               cache_info->list_head = * (char **) (((char *) object) + cache_info->link_offset);
+
+               ACPI_MEM_TRACKING (cache_info->cache_hits++);
+               cache_info->cache_depth--;
+
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Object %p from %s\n",
+                       object, acpi_gbl_memory_lists[list_id].list_name));
+#endif
+
+               acpi_ut_release_mutex (ACPI_MTX_CACHES);
+
+               /* Clear (zero) the previously used Object */
+
+               MEMSET (object, 0, cache_info->object_size);
+       }
+
+       else {
+               /* The cache is empty, create a new object */
+
+               /* Avoid deadlock with ACPI_MEM_CALLOCATE */
+
+               acpi_ut_release_mutex (ACPI_MTX_CACHES);
+
+               object = ACPI_MEM_CALLOCATE (cache_info->object_size);
+               ACPI_MEM_TRACKING (cache_info->total_allocated++);
+       }
+
+       return (object);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_delete_generic_cache
+ *
+ * PARAMETERS:  List_id         - Memory list ID
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Free all objects within the requested cache.
+ *
+ ******************************************************************************/
+
+void
+acpi_ut_delete_generic_cache (
+       u32                     list_id)
+{
+       ACPI_MEMORY_LIST        *cache_info;
+       char                    *next;
+
+
+       FUNCTION_ENTRY ();
+
+
+       cache_info = &acpi_gbl_memory_lists[list_id];
+       while (cache_info->list_head) {
+               /* Delete one cached state object */
+
+               next = * (char **) (((char *) cache_info->list_head) + cache_info->link_offset);
+               ACPI_MEM_FREE (cache_info->list_head);
+
+               cache_info->list_head = next;
+               cache_info->cache_depth--;
+       }
+}
+
+
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+
+
+/*
+ * These procedures are used for tracking memory leaks in the subsystem, and
+ * they get compiled out when the ACPI_DBG_TRACK_ALLOCATIONS is not set.
+ *
+ * Each memory allocation is tracked via a doubly linked list.  Each
+ * element contains the caller's component, module name, function name, and
+ * line number.  Acpi_ut_allocate and Acpi_ut_callocate call
+ * Acpi_ut_add_element_to_alloc_list to add an element to the list; deletion
+ * occurs in the body of Acpi_ut_free.
+ */
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_search_alloc_list
+ *
+ * PARAMETERS:  Address             - Address of allocated memory
+ *
+ * RETURN:      A list element if found; NULL otherwise.
+ *
+ * DESCRIPTION: Searches for an element in the global allocation tracking list.
+ *
+ ******************************************************************************/
+
+ACPI_DEBUG_MEM_BLOCK *
+acpi_ut_search_alloc_list (
+       u32                     list_id,
+       void                    *address)
+{
+       ACPI_DEBUG_MEM_BLOCK    *element;
+
+
+       FUNCTION_ENTRY ();
+
+
+       if (list_id > ACPI_MEM_LIST_MAX) {
+               return (NULL);
+       }
+
+       element = acpi_gbl_memory_lists[list_id].list_head;
+
+       /* Search for the address. */
+
+       while (element) {
+               if (element == address) {
+                       return (element);
+               }
+
+               element = element->next;
+       }
+
+       return (NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_add_element_to_alloc_list
+ *
+ * PARAMETERS:  Address             - Address of allocated memory
+ *              Size                - Size of the allocation
+ *              Alloc_type          - MEM_MALLOC or MEM_CALLOC
+ *              Component           - Component type of caller
+ *              Module              - Source file name of caller
+ *              Line                - Line number of caller
+ *
+ * RETURN:      None.
+ *
+ * DESCRIPTION: Inserts an element into the global allocation tracking list.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ut_add_element_to_alloc_list (
+       u32                     list_id,
+       ACPI_DEBUG_MEM_BLOCK    *address,
+       u32                     size,
+       u8                      alloc_type,
+       u32                     component,
+       NATIVE_CHAR             *module,
+       u32                     line)
+{
+       ACPI_MEMORY_LIST        *mem_list;
+       ACPI_DEBUG_MEM_BLOCK    *element;
+       acpi_status             status = AE_OK;
+
+
+       FUNCTION_TRACE_PTR ("Ut_add_element_to_alloc_list", address);
+
+
+       if (list_id > ACPI_MEM_LIST_MAX) {
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
+       }
+
+       mem_list = &acpi_gbl_memory_lists[list_id];
+       acpi_ut_acquire_mutex (ACPI_MTX_MEMORY);
+
+       /*
+        * Search list for this address to make sure it is not already on the list.
+        * This will catch several kinds of problems.
+        */
+
+       element = acpi_ut_search_alloc_list (list_id, address);
+       if (element) {
+               REPORT_ERROR (("Ut_add_element_to_alloc_list: Address already present in list! (%p)\n",
+                       address));
+
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Element %p Address %p\n", element, address));
+
+               goto unlock_and_exit;
+       }
+
+       /* Fill in the instance data. */
+
+       address->size      = size;
+       address->alloc_type = alloc_type;
+       address->component = component;
+       address->line      = line;
+
+       STRNCPY (address->module, module, MAX_MODULE_NAME);
+
+       /* Insert at list head */
+
+       if (mem_list->list_head) {
+               ((ACPI_DEBUG_MEM_BLOCK *)(mem_list->list_head))->previous = address;
+       }
+
+       address->next = mem_list->list_head;
+       address->previous = NULL;
+
+       mem_list->list_head = address;
+
+
+unlock_and_exit:
+       acpi_ut_release_mutex (ACPI_MTX_MEMORY);
+       return_ACPI_STATUS (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_delete_element_from_alloc_list
+ *
+ * PARAMETERS:  Address             - Address of allocated memory
+ *              Component           - Component type of caller
+ *              Module              - Source file name of caller
+ *              Line                - Line number of caller
+ *
+ * RETURN:
+ *
+ * DESCRIPTION: Deletes an element from the global allocation tracking list.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ut_delete_element_from_alloc_list (
+       u32                     list_id,
+       ACPI_DEBUG_MEM_BLOCK    *address,
+       u32                     component,
+       NATIVE_CHAR             *module,
+       u32                     line)
+{
+       ACPI_MEMORY_LIST        *mem_list;
+
+
+       FUNCTION_TRACE ("Ut_delete_element_from_alloc_list");
+
+
+       if (list_id > ACPI_MEM_LIST_MAX) {
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
+       }
+
+       mem_list = &acpi_gbl_memory_lists[list_id];
+       if (NULL == mem_list->list_head) {
+               /* No allocations! */
+
+               _REPORT_ERROR (module, line, component,
+                               ("Ut_delete_element_from_alloc_list: Empty allocation list, nothing to free!\n"));
+
+               return_ACPI_STATUS (AE_OK);
+       }
+
+
+       acpi_ut_acquire_mutex (ACPI_MTX_MEMORY);
+
+       /* Unlink */
+
+       if (address->previous) {
+               (address->previous)->next = address->next;
+       }
+       else {
+               mem_list->list_head = address->next;
+       }
+
+       if (address->next) {
+               (address->next)->previous = address->previous;
+       }
+
+
+       /* Mark the segment as deleted */
+
+       MEMSET (&address->user_space, 0xEA, address->size);
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing size %X\n", address->size));
+
+       acpi_ut_release_mutex (ACPI_MTX_MEMORY);
+       return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_dump_allocation_info
+ *
+ * PARAMETERS:
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Print some info about the outstanding allocations.
+ *
+ ******************************************************************************/
+
+void
+acpi_ut_dump_allocation_info (
+       void)
+{
+/*
+       ACPI_MEMORY_LIST        *Mem_list;
+*/
+
+       FUNCTION_TRACE ("Ut_dump_allocation_info");
+
+/*
+       ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
+                         ("%30s: %4d (%3d Kb)\n", "Current allocations",
+                         Mem_list->Current_count,
+                         ROUND_UP_TO_1_k (Mem_list->Current_size)));
+
+       ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
+                         ("%30s: %4d (%3d Kb)\n", "Max concurrent allocations",
+                         Mem_list->Max_concurrent_count,
+                         ROUND_UP_TO_1_k (Mem_list->Max_concurrent_size)));
+
+
+       ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
+                         ("%30s: %4d (%3d Kb)\n", "Total (all) internal objects",
+                         Running_object_count,
+                         ROUND_UP_TO_1_k (Running_object_size)));
+
+       ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
+                         ("%30s: %4d (%3d Kb)\n", "Total (all) allocations",
+                         Running_alloc_count,
+                         ROUND_UP_TO_1_k (Running_alloc_size)));
+
+
+       ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
+                         ("%30s: %4d (%3d Kb)\n", "Current Nodes",
+                         Acpi_gbl_Current_node_count,
+                         ROUND_UP_TO_1_k (Acpi_gbl_Current_node_size)));
+
+       ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
+                         ("%30s: %4d (%3d Kb)\n", "Max Nodes",
+                         Acpi_gbl_Max_concurrent_node_count,
+                         ROUND_UP_TO_1_k ((Acpi_gbl_Max_concurrent_node_count * sizeof (acpi_namespace_node)))));
+*/
+       return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_dump_current_allocations
+ *
+ * PARAMETERS:  Component           - Component(s) to dump info for.
+ *              Module              - Module to dump info for.  NULL means all.
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Print a list of all outstanding allocations.
+ *
+ ******************************************************************************/
+
+void
+acpi_ut_dump_current_allocations (
+       u32                     component,
+       NATIVE_CHAR             *module)
+{
+       ACPI_DEBUG_MEM_BLOCK    *element;
+       u32                     i;
+
+
+       FUNCTION_TRACE ("Ut_dump_current_allocations");
+
+
+       element = acpi_gbl_memory_lists[0].list_head;
+       if (element == NULL) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
+                               "No outstanding allocations.\n"));
+               return_VOID;
+       }
+
+
+       /*
+        * Walk the allocation list.
+        */
+       acpi_ut_acquire_mutex (ACPI_MTX_MEMORY);
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
+               "Outstanding allocations:\n"));
+
+       for (i = 1; ; i++)  /* Just a counter */ {
+               if ((element->component & component) &&
+                       ((module == NULL) || (0 == STRCMP (module, element->module)))) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
+                                        "%p Len %04lX %9.9s-%ld",
+                                        &element->user_space, element->size, element->module,
+                                        element->line));
+
+                       /* Most of the elements will be internal objects. */
+
+                       switch (((acpi_operand_object  *)
+                               (&element->user_space))->common.data_type) {
+                       case ACPI_DESC_TYPE_INTERNAL:
+                               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ALLOCATIONS,
+                                               " Obj_type %s",
+                                               acpi_ut_get_type_name (((acpi_operand_object *)(&element->user_space))->common.type)));
+                               break;
+
+                       case ACPI_DESC_TYPE_PARSER:
+                               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ALLOCATIONS,
+                                               " Parse_obj Opcode %04X",
+                                               ((acpi_parse_object *)(&element->user_space))->opcode));
+                               break;
+
+                       case ACPI_DESC_TYPE_NAMED:
+                               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ALLOCATIONS,
+                                               " Node %4.4s",
+                                               &((acpi_namespace_node *)(&element->user_space))->name));
+                               break;
+
+                       case ACPI_DESC_TYPE_STATE:
+                               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ALLOCATIONS,
+                                               " State_obj"));
+                               break;
+                       }
+
+                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ALLOCATIONS, "\n"));
+               }
+
+               if (element->next == NULL) {
+                       break;
+               }
+
+               element = element->next;
+       }
+
+       acpi_ut_release_mutex (ACPI_MTX_MEMORY);
+
+       ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
+               "Total number of unfreed allocations = %d(%X)\n", i,i));
+
+
+       return_VOID;
+
+}
+
+
 /*******************************************************************************
  *
- * FUNCTION:    _Ut_allocate
+ * FUNCTION:    Acpi_ut_allocate
  *
  * PARAMETERS:  Size                - Size of the allocation
  *              Component           - Component type of caller
  ******************************************************************************/
 
 void *
-_ut_allocate (
+acpi_ut_allocate (
        u32                     size,
        u32                     component,
        NATIVE_CHAR             *module,
        u32                     line)
 {
-       void                    *address = NULL;
+       ACPI_DEBUG_MEM_BLOCK    *address;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE_U32 ("Ut_allocate", size);
 
 
        /* Check for an inadvertent size of zero bytes */
@@ -67,24 +597,35 @@ _ut_allocate (
                size = 1;
        }
 
-       address = acpi_os_allocate (size);
+       address = acpi_os_allocate (size + sizeof (ACPI_DEBUG_MEM_BLOCK));
        if (!address) {
                /* Report allocation error */
 
                _REPORT_ERROR (module, line, component,
                                ("Ut_allocate: Could not allocate size %X\n", size));
 
-               return (NULL);
+               return_PTR (NULL);
+       }
+
+       status = acpi_ut_add_element_to_alloc_list (ACPI_MEM_LIST_GLOBAL, address, size,
+                         MEM_MALLOC, component, module, line);
+       if (ACPI_FAILURE (status)) {
+               acpi_os_free (address);
+               return_PTR (NULL);
        }
 
+       acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].total_allocated++;
+       acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].current_total_size += size;
 
-       return (address);
+       ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p Size %X\n", address, size));
+
+       return_PTR ((void *) &address->user_space);
 }
 
 
 /*******************************************************************************
  *
- * FUNCTION:    _Ut_callocate
+ * FUNCTION:    Acpi_ut_callocate
  *
  * PARAMETERS:  Size                - Size of the allocation
  *              Component           - Component type of caller
@@ -98,13 +639,17 @@ _ut_allocate (
  ******************************************************************************/
 
 void *
-_ut_callocate (
+acpi_ut_callocate (
        u32                     size,
        u32                     component,
        NATIVE_CHAR             *module,
        u32                     line)
 {
-       void                    *address = NULL;
+       ACPI_DEBUG_MEM_BLOCK    *address;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE_U32 ("Ut_callocate", size);
 
 
        /* Check for an inadvertent size of zero bytes */
@@ -112,27 +657,37 @@ _ut_callocate (
        if (!size) {
                _REPORT_ERROR (module, line, component,
                                ("Ut_callocate: Attempt to allocate zero bytes\n"));
-               return (NULL);
+               return_PTR (NULL);
        }
 
 
-       address = acpi_os_callocate (size);
+       address = acpi_os_callocate (size + sizeof (ACPI_DEBUG_MEM_BLOCK));
        if (!address) {
                /* Report allocation error */
 
                _REPORT_ERROR (module, line, component,
                                ("Ut_callocate: Could not allocate size %X\n", size));
-               return (NULL);
+               return_PTR (NULL);
+       }
+
+       status = acpi_ut_add_element_to_alloc_list (ACPI_MEM_LIST_GLOBAL, address, size,
+                          MEM_CALLOC, component, module, line);
+       if (ACPI_FAILURE (status)) {
+               acpi_os_free (address);
+               return_PTR (NULL);
        }
 
+       acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].total_allocated++;
+       acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].current_total_size += size;
 
-       return (address);
+       ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p Size %X\n", address, size));
+       return_PTR ((void *) &address->user_space);
 }
 
 
 /*******************************************************************************
  *
- * FUNCTION:    _Ut_free
+ * FUNCTION:    Acpi_ut_free
  *
  * PARAMETERS:  Address             - Address of the memory to deallocate
  *              Component           - Component type of caller
@@ -146,24 +701,39 @@ _ut_callocate (
  ******************************************************************************/
 
 void
-_ut_free (
+acpi_ut_free (
        void                    *address,
        u32                     component,
        NATIVE_CHAR             *module,
        u32                     line)
 {
+       ACPI_DEBUG_MEM_BLOCK    *debug_block;
+
+
+       FUNCTION_TRACE_PTR ("Ut_free", address);
+
 
        if (NULL == address) {
                _REPORT_ERROR (module, line, component,
-                       ("_Ut_free: Trying to delete a NULL address\n"));
+                       ("Acpi_ut_free: Trying to delete a NULL address\n"));
 
-               return;
+               return_VOID;
        }
 
+       debug_block = (ACPI_DEBUG_MEM_BLOCK *)
+                         (((char *) address) - sizeof (ACPI_DEBUG_MEM_HEADER));
+
+       acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].total_freed++;
+       acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].current_total_size -= debug_block->size;
+
+       acpi_ut_delete_element_from_alloc_list (ACPI_MEM_LIST_GLOBAL, debug_block,
+                       component, module, line);
+       acpi_os_free (debug_block);
 
-       acpi_os_free (address);
+       ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p freed\n", address));
 
-       return;
+       return_VOID;
 }
 
+#endif  /* #ifdef ACPI_DBG_TRACK_ALLOCATIONS */
 
index a504035f3b78bbe8963a4b3b133715dd7e7d1b8e..85f0541456bac3bc6d754f6e26c9916c0165e95b 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: utcopy - Internal to external object translation utilities
- *              $Revision: 74 $
+ *              $Revision: 82 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-static ACPI_STATUS
+static acpi_status
 acpi_ut_copy_isimple_to_esimple (
-       ACPI_OPERAND_OBJECT     *internal_object,
-       ACPI_OBJECT             *external_object,
+       acpi_operand_object     *internal_object,
+       acpi_object             *external_object,
        u8                      *data_space,
        u32                     *buffer_space_used)
 {
        u32                     length = 0;
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+
+       FUNCTION_TRACE ("Ut_copy_isimple_to_esimple");
 
 
        /*
         * Check for NULL object case (could be an uninitialized
         * package element
         */
-
        if (!internal_object) {
                *buffer_space_used = 0;
-               return (AE_OK);
+               return_ACPI_STATUS (AE_OK);
        }
 
        /* Always clear the external object */
 
-       MEMSET (external_object, 0, sizeof (ACPI_OBJECT));
+       MEMSET (external_object, 0, sizeof (acpi_object));
 
        /*
         * In general, the external object will be the same type as
         * the internal object
         */
-
        external_object->type = internal_object->common.type;
 
        /* However, only a limited number of external types are supported */
@@ -116,7 +117,6 @@ acpi_ut_copy_isimple_to_esimple (
                /*
                 * This is an object reference.  Attempt to dereference it.
                 */
-
                switch (internal_object->reference.opcode) {
                case AML_ZERO_OP:
                        external_object->type = ACPI_TYPE_INTEGER;
@@ -133,6 +133,11 @@ acpi_ut_copy_isimple_to_esimple (
                        external_object->integer.value = ACPI_INTEGER_MAX;
                        break;
 
+               case AML_REVISION_OP:
+                       external_object->type = ACPI_TYPE_INTEGER;
+                       external_object->integer.value = ACPI_CA_VERSION;
+                       break;
+
                case AML_INT_NAMEPATH_OP:
                        /*
                         * This is a named reference, get the string.  We already know that
@@ -141,7 +146,7 @@ acpi_ut_copy_isimple_to_esimple (
                        length = MAX_STRING_LENGTH;
                        external_object->type = ACPI_TYPE_STRING;
                        external_object->string.pointer = (NATIVE_CHAR *) 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,
                                         &length, (char *) data_space);
 
                        /* Converted (external) string length is returned from above */
@@ -183,14 +188,14 @@ acpi_ut_copy_isimple_to_esimple (
                /*
                 * There is no corresponding external object type
                 */
-               return (AE_SUPPORT);
+               return_ACPI_STATUS (AE_SUPPORT);
                break;
        }
 
 
        *buffer_space_used = (u32) ROUND_UP_TO_NATIVE_WORD (length);
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -206,32 +211,33 @@ acpi_ut_copy_isimple_to_esimple (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ut_copy_ielement_to_eelement (
        u8                      object_type,
-       ACPI_OPERAND_OBJECT     *source_object,
-       ACPI_GENERIC_STATE      *state,
+       acpi_operand_object     *source_object,
+       acpi_generic_state      *state,
        void                    *context)
 {
-       ACPI_STATUS             status = AE_OK;
-       ACPI_PKG_INFO           *info = (ACPI_PKG_INFO *) context;
+       acpi_status             status = AE_OK;
+       acpi_pkg_info           *info = (acpi_pkg_info *) context;
        u32                     object_space;
        u32                     this_index;
-       ACPI_OBJECT             *target_object;
+       acpi_object             *target_object;
 
 
-       this_index      = state->pkg.index;
-       target_object   = (ACPI_OBJECT *)
-                          &((ACPI_OBJECT *)(state->pkg.dest_object))->package.elements[this_index];
+       FUNCTION_ENTRY ();
 
 
+       this_index   = state->pkg.index;
+       target_object = (acpi_object *)
+                         &((acpi_object *)(state->pkg.dest_object))->package.elements[this_index];
+
        switch (object_type) {
        case ACPI_COPY_TYPE_SIMPLE:
 
                /*
                 * This is a simple or null object -- get the size
                 */
-
                status = acpi_ut_copy_isimple_to_esimple (source_object,
                                  target_object, info->free_space, &object_space);
                if (ACPI_FAILURE (status)) {
@@ -247,7 +253,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_object *) info->free_space;
 
                /*
                 * Pass the new package object back to the package walk routine
@@ -259,7 +265,7 @@ acpi_ut_copy_ielement_to_eelement (
                 * update the buffer length counter
                 */
                object_space = (u32) ROUND_UP_TO_NATIVE_WORD (
-                                  target_object->package.count * sizeof (ACPI_OBJECT));
+                                  target_object->package.count * sizeof (acpi_object));
                break;
 
        default:
@@ -293,21 +299,24 @@ acpi_ut_copy_ielement_to_eelement (
  *
  ******************************************************************************/
 
-static ACPI_STATUS
+static acpi_status
 acpi_ut_copy_ipackage_to_epackage (
-       ACPI_OPERAND_OBJECT     *internal_object,
+       acpi_operand_object     *internal_object,
        u8                      *buffer,
        u32                     *space_used)
 {
-       ACPI_OBJECT             *external_object;
-       ACPI_STATUS             status;
-       ACPI_PKG_INFO           info;
+       acpi_object             *external_object;
+       acpi_status             status;
+       acpi_pkg_info           info;
+
+
+       FUNCTION_TRACE ("Ut_copy_ipackage_to_epackage");
 
 
        /*
         * First package at head of the buffer
         */
-       external_object = (ACPI_OBJECT *) buffer;
+       external_object = (acpi_object *) buffer;
 
        /*
         * Free space begins right after the first package
@@ -315,21 +324,20 @@ acpi_ut_copy_ipackage_to_epackage (
        info.length      = 0;
        info.object_space = 0;
        info.num_packages = 1;
-       info.free_space  = buffer + ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT));
+       info.free_space  = buffer + ROUND_UP_TO_NATIVE_WORD (sizeof (acpi_object));
 
 
        external_object->type              = internal_object->common.type;
        external_object->package.count     = internal_object->package.count;
-       external_object->package.elements  = (ACPI_OBJECT *) info.free_space;
+       external_object->package.elements  = (acpi_object *) info.free_space;
 
 
        /*
         * Build an array of ACPI_OBJECTS in the buffer
         * and move the free space past it
         */
-
        info.free_space += external_object->package.count *
-                         ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT));
+                         ROUND_UP_TO_NATIVE_WORD (sizeof (acpi_object));
 
 
        status = acpi_ut_walk_package_tree (internal_object, external_object,
@@ -337,7 +345,7 @@ acpi_ut_copy_ipackage_to_epackage (
 
        *space_used = info.length;
 
-       return (status);
+       return_ACPI_STATUS (status);
 
 }
 
@@ -355,12 +363,15 @@ acpi_ut_copy_ipackage_to_epackage (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ut_copy_iobject_to_eobject (
-       ACPI_OPERAND_OBJECT     *internal_object,
-       ACPI_BUFFER             *ret_buffer)
+       acpi_operand_object     *internal_object,
+       acpi_buffer             *ret_buffer)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Ut_copy_iobject_to_eobject");
 
 
        if (IS_THIS_OBJECT_TYPE (internal_object, ACPI_TYPE_PACKAGE)) {
@@ -377,18 +388,18 @@ acpi_ut_copy_iobject_to_eobject (
                 * Build a simple object (no nested objects)
                 */
                status = acpi_ut_copy_isimple_to_esimple (internal_object,
-                                 (ACPI_OBJECT *) ret_buffer->pointer,
+                                 (acpi_object *) ret_buffer->pointer,
                                  ((u8 *) ret_buffer->pointer +
-                                 ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT))),
+                                 ROUND_UP_TO_NATIVE_WORD (sizeof (acpi_object))),
                                  &ret_buffer->length);
                /*
                 * build simple does not include the object size in the length
                 * so we add it in here
                 */
-               ret_buffer->length += sizeof (ACPI_OBJECT);
+               ret_buffer->length += sizeof (acpi_object);
        }
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -408,46 +419,83 @@ acpi_ut_copy_iobject_to_eobject (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ut_copy_esimple_to_isimple (
-       ACPI_OBJECT             *external_object,
-       ACPI_OPERAND_OBJECT     *internal_object)
+       acpi_object             *external_object,
+       acpi_operand_object     **ret_internal_object)
 {
+       acpi_operand_object     *internal_object;
+
 
+       FUNCTION_TRACE ("Ut_copy_esimple_to_isimple");
 
-       internal_object->common.type = (u8) external_object->type;
 
+       /*
+        * Simple types supported are: String, Buffer, Integer
+        */
        switch (external_object->type) {
+       case ACPI_TYPE_STRING:
+       case ACPI_TYPE_BUFFER:
+       case ACPI_TYPE_INTEGER:
+
+               internal_object = acpi_ut_create_internal_object ((u8) external_object->type);
+               if (!internal_object) {
+                       return_ACPI_STATUS (AE_NO_MEMORY);
+               }
+               break;
+
+       default:
+               /*
+                * Whatever other type -- it is not supported
+                */
+               return_ACPI_STATUS (AE_SUPPORT);
+               break;
+       }
+
+
+       switch (external_object->type) {
+
+       /* Must COPY string and buffer contents */
 
        case ACPI_TYPE_STRING:
 
+               internal_object->string.pointer = ACPI_MEM_CALLOCATE (external_object->string.length + 1);
+               if (!internal_object->string.pointer) {
+                       return_ACPI_STATUS (AE_NO_MEMORY);
+               }
+
+               MEMCPY (internal_object->string.pointer,
+                               external_object->string.pointer,
+                               external_object->string.length);
+
                internal_object->string.length = external_object->string.length;
-               internal_object->string.pointer = external_object->string.pointer;
                break;
 
 
        case ACPI_TYPE_BUFFER:
 
+               internal_object->buffer.pointer = ACPI_MEM_CALLOCATE (external_object->buffer.length);
+               if (!internal_object->buffer.pointer) {
+                       return_ACPI_STATUS (AE_NO_MEMORY);
+               }
+
+               MEMCPY (internal_object->buffer.pointer,
+                               external_object->buffer.pointer,
+                               external_object->buffer.length);
+
                internal_object->buffer.length = external_object->buffer.length;
-               internal_object->buffer.pointer = external_object->buffer.pointer;
                break;
 
 
        case ACPI_TYPE_INTEGER:
-               /*
-                * Number is included in the object itself
-                */
-               internal_object->integer.value  = external_object->integer.value;
-               break;
 
-
-       default:
-               return (AE_CTRL_RETURN_VALUE);
+               internal_object->integer.value  = external_object->integer.value;
                break;
        }
 
 
-       return (AE_OK);
+       *ret_internal_object = internal_object;
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -474,43 +522,45 @@ acpi_ut_copy_esimple_to_isimple (
  *
  ******************************************************************************/
 
-static ACPI_STATUS
+static acpi_status
 acpi_ut_copy_epackage_to_ipackage (
-       ACPI_OPERAND_OBJECT     *internal_object,
+       acpi_operand_object     *internal_object,
        u8                      *buffer,
        u32                     *space_used)
 {
        u8                      *free_space;
-       ACPI_OBJECT             *external_object;
+       acpi_object             *external_object;
        u32                     length = 0;
        u32                     this_index;
        u32                     object_space = 0;
-       ACPI_OPERAND_OBJECT     *this_internal_obj;
-       ACPI_OBJECT             *this_external_obj;
+       acpi_operand_object     *this_internal_obj;
+       acpi_object             *this_external_obj;
+
+
+       FUNCTION_TRACE ("Ut_copy_epackage_to_ipackage");
 
 
        /*
         * First package at head of the buffer
         */
-       external_object = (ACPI_OBJECT *)buffer;
+       external_object = (acpi_object *)buffer;
 
        /*
         * Free space begins right after the first package
         */
-       free_space = buffer + sizeof(ACPI_OBJECT);
+       free_space = buffer + sizeof(acpi_object);
 
 
        external_object->type              = internal_object->common.type;
        external_object->package.count     = internal_object->package.count;
-       external_object->package.elements  = (ACPI_OBJECT *)free_space;
+       external_object->package.elements  = (acpi_object *)free_space;
 
 
        /*
         * Build an array of ACPI_OBJECTS in the buffer
         * and move the free space past it
         */
-
-       free_space += external_object->package.count * sizeof(ACPI_OBJECT);
+       free_space += external_object->package.count * sizeof(acpi_object);
 
 
        /* Call Walk_package */
@@ -533,12 +583,15 @@ acpi_ut_copy_epackage_to_ipackage (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ut_copy_eobject_to_iobject (
-       ACPI_OBJECT             *external_object,
-       ACPI_OPERAND_OBJECT     *internal_object)
+       acpi_object             *external_object,
+       acpi_operand_object     **internal_object)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Ut_copy_eobject_to_iobject");
 
 
        if (external_object->type == ACPI_TYPE_PACKAGE) {
@@ -555,7 +608,10 @@ acpi_ut_copy_eobject_to_iobject (
                                 Ret_buffer->Pointer,
                                 &Ret_buffer->Length);
 */
-               return (AE_NOT_IMPLEMENTED);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                       "Packages as parameters not implemented!\n"));
+
+               return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
        }
 
        else {
@@ -563,13 +619,9 @@ acpi_ut_copy_eobject_to_iobject (
                 * Build a simple object (no nested objects)
                 */
                status = acpi_ut_copy_esimple_to_isimple (external_object, internal_object);
-               /*
-                * build simple does not include the object size in the length
-                * so we add it in here
-                */
        }
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -585,21 +637,24 @@ acpi_ut_copy_eobject_to_iobject (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ut_copy_ielement_to_ielement (
        u8                      object_type,
-       ACPI_OPERAND_OBJECT     *source_object,
-       ACPI_GENERIC_STATE      *state,
+       acpi_operand_object     *source_object,
+       acpi_generic_state      *state,
        void                    *context)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
        u32                     this_index;
-       ACPI_OPERAND_OBJECT     **this_target_ptr;
-       ACPI_OPERAND_OBJECT     *target_object;
+       acpi_operand_object     **this_target_ptr;
+       acpi_operand_object     *target_object;
+
+
+       FUNCTION_ENTRY ();
 
 
        this_index    = state->pkg.index;
-       this_target_ptr = (ACPI_OPERAND_OBJECT **)
+       this_target_ptr = (acpi_operand_object **)
                           &state->pkg.dest_object->package.elements[this_index];
 
        switch (object_type) {
@@ -614,7 +669,7 @@ acpi_ut_copy_ielement_to_ielement (
                }
 
                status = acpi_ex_store_object_to_object (source_object, target_object,
-                                 (ACPI_WALK_STATE *) context);
+                                 (acpi_walk_state *) context);
                if (ACPI_FAILURE (status)) {
                        return (status);
                }
@@ -671,13 +726,16 @@ acpi_ut_copy_ielement_to_ielement (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ut_copy_ipackage_to_ipackage (
-       ACPI_OPERAND_OBJECT     *source_obj,
-       ACPI_OPERAND_OBJECT     *dest_obj,
-       ACPI_WALK_STATE         *walk_state)
+       acpi_operand_object     *source_obj,
+       acpi_operand_object     *dest_obj,
+       acpi_walk_state         *walk_state)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+
+       FUNCTION_TRACE ("Ut_copy_ipackage_to_ipackage");
 
 
        dest_obj->common.type   = source_obj->common.type;
@@ -687,21 +745,20 @@ acpi_ut_copy_ipackage_to_ipackage (
        /*
         * Create the object array and walk the source package tree
         */
-
-       dest_obj->package.elements = acpi_ut_callocate ((source_obj->package.count + 1) *
+       dest_obj->package.elements = ACPI_MEM_CALLOCATE ((source_obj->package.count + 1) *
                         sizeof (void *));
        dest_obj->package.next_element = dest_obj->package.elements;
 
        if (!dest_obj->package.elements) {
                REPORT_ERROR (
                        ("Aml_build_copy_internal_package_object: Package allocation failure\n"));
-               return (AE_NO_MEMORY);
+               return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
 
        status = acpi_ut_walk_package_tree (source_obj, dest_obj,
                         acpi_ut_copy_ielement_to_ielement, walk_state);
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
index 31698741e5652c5634b2cbf7565adb8df91de04c..f0954d129d50e452186ad0654b66e4c602764b5d 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: utdebug - Debug print routines
- *              $Revision: 72 $
+ *              $Revision: 87 $
  *
  *****************************************************************************/
 
         MODULE_NAME         ("utdebug")
 
 
-u32             prev_thread_id = 0xFFFFFFFF;
+u32             acpi_gbl_prev_thread_id = 0xFFFFFFFF;
+char            *acpi_gbl_fn_entry_str = "----Entry";
+char            *acpi_gbl_fn_exit_str = "----Exit-";
+
+
+#ifdef ACPI_DEBUG
+
 
 /*****************************************************************************
  *
- * FUNCTION:    Get/Set debug level
+ * FUNCTION:    Acpi_ut_init_stack_ptr_trace
  *
- * DESCRIPTION: Get or set value of the debug flag
+ * PARAMETERS:  None
  *
- *              These are used to allow user's to get/set the debug level
+ * RETURN:      None
+ *
+ * DESCRIPTION: Save the current stack pointer
  *
  ****************************************************************************/
 
-
-u32
-get_debug_level (void)
-{
-
-       return (acpi_dbg_level);
-}
-
 void
-set_debug_level (
-       u32                     new_debug_level)
+acpi_ut_init_stack_ptr_trace (
+       void)
 {
+       u32                 current_sp;
+
 
-       acpi_dbg_level = new_debug_level;
+       acpi_gbl_entry_stack_pointer = (u32) &current_sp;
 }
 
 
 /*****************************************************************************
  *
- * FUNCTION:    Function_trace
+ * FUNCTION:    Acpi_ut_track_stack_ptr
  *
- * PARAMETERS:  Module_name         - Caller's module name (for error output)
- *              Line_number         - Caller's line number (for error output)
- *              Component_id        - Caller's component ID (for error output)
- *              Function_name       - Name of Caller's function
+ * PARAMETERS:  None
  *
  * RETURN:      None
  *
- * DESCRIPTION: Function entry trace.  Prints only if TRACE_FUNCTIONS bit is
- *              set in Debug_level
+ * DESCRIPTION: Save the current stack pointer
  *
  ****************************************************************************/
 
 void
-function_trace (
-       NATIVE_CHAR             *module_name,
-       u32                     line_number,
-       u32                     component_id,
-       NATIVE_CHAR             *function_name)
+acpi_ut_track_stack_ptr (
+       void)
 {
+       u32                 current_sp;
 
-       acpi_gbl_nesting_level++;
+       current_sp = (u32) &current_sp;
 
-       debug_print (module_name, line_number, component_id,
-                        TRACE_FUNCTIONS,
-                        " %2.2ld Entered Function: %s\n",
-                        acpi_gbl_nesting_level, function_name);
+       if (current_sp < acpi_gbl_lowest_stack_pointer) {
+               acpi_gbl_lowest_stack_pointer = current_sp;
+       }
+
+       if (acpi_gbl_nesting_level > acpi_gbl_deepest_nesting) {
+               acpi_gbl_deepest_nesting = acpi_gbl_nesting_level;
+
+               if (acpi_gbl_deepest_nesting == 34) {
+                       acpi_os_printf ("hit deepest nesting\n");
+               }
+       }
 }
 
 
 /*****************************************************************************
  *
- * FUNCTION:    Function_trace_ptr
+ * FUNCTION:    Acpi_ut_debug_print
  *
- * PARAMETERS:  Module_name         - Caller's module name (for error output)
+ * PARAMETERS:  Debug_level         - Requested debug print level
+ *              Proc_name           - Caller's procedure name
+ *              Module_name         - Caller's module name (for error output)
  *              Line_number         - Caller's line number (for error output)
  *              Component_id        - Caller's component ID (for error output)
- *              Function_name       - Name of Caller's function
- *              Pointer             - Pointer to display
+ *
+ *              Format              - Printf format field
+ *              ...                 - Optional printf arguments
  *
  * RETURN:      None
  *
- * DESCRIPTION: Function entry trace.  Prints only if TRACE_FUNCTIONS bit is
- *              set in Debug_level
+ * DESCRIPTION: Print error message with prefix consisting of the module name,
+ *              line number, and component ID.
  *
  ****************************************************************************/
 
 void
-function_trace_ptr (
-       NATIVE_CHAR             *module_name,
+acpi_ut_debug_print (
+       u32                     requested_debug_level,
        u32                     line_number,
-       u32                     component_id,
-       NATIVE_CHAR             *function_name,
-       void                    *pointer)
+       ACPI_DEBUG_PRINT_INFO   *dbg_info,
+       char                    *format,
+       ...)
 {
+       u32                     thread_id;
+       va_list                 args;
 
-       acpi_gbl_nesting_level++;
-       debug_print (module_name, line_number, component_id, TRACE_FUNCTIONS,
-                        " %2.2ld Entered Function: %s, %p\n",
-                        acpi_gbl_nesting_level, function_name, pointer);
+
+       /*
+        * Stay silent if the debug level or component ID is disabled
+        */
+       if (!(requested_debug_level & acpi_dbg_level) ||
+               !(dbg_info->component_id & acpi_dbg_layer)) {
+               return;
+       }
+
+
+       /*
+        * Thread tracking and context switch notification
+        */
+       thread_id = acpi_os_get_thread_id ();
+
+       if (thread_id != acpi_gbl_prev_thread_id) {
+               if (ACPI_LV_THREADS & acpi_dbg_level) {
+                       acpi_os_printf ("\n**** Context Switch from TID %X to TID %X ****\n\n",
+                               acpi_gbl_prev_thread_id, thread_id);
+               }
+
+               acpi_gbl_prev_thread_id = thread_id;
+       }
+
+       /*
+        * 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);
+
+       if (ACPI_LV_THREADS & acpi_dbg_level) {
+               acpi_os_printf ("[%04X] ", thread_id, acpi_gbl_nesting_level, dbg_info->proc_name);
+       }
+
+       acpi_os_printf ("[%02d] %-22.22s: ", acpi_gbl_nesting_level, dbg_info->proc_name);
+
+
+       va_start (args, format);
+       acpi_os_vprintf (format, args);
 }
 
 
 /*****************************************************************************
  *
- * FUNCTION:    Function_trace_str
+ * FUNCTION:    Acpi_ut_debug_print_raw
  *
- * PARAMETERS:  Module_name         - Caller's module name (for error output)
- *              Line_number         - Caller's line number (for error output)
- *              Component_id        - Caller's component ID (for error output)
- *              Function_name       - Name of Caller's function
- *              String              - Additional string to display
+ * PARAMETERS:  Requested_debug_level - Requested debug print level
+ *              Line_number         - Caller's line number
+ *              Dbg_info            - Contains:
+ *                  Proc_name           - Caller's procedure name
+ *                  Module_name         - Caller's module name
+ *                  Component_id        - Caller's component ID
+ *              Format              - Printf format field
+ *              ...                 - Optional printf arguments
  *
  * RETURN:      None
  *
- * DESCRIPTION: Function entry trace.  Prints only if TRACE_FUNCTIONS bit is
- *              set in Debug_level
+ * DESCRIPTION: Print message with no headers.  Has same interface as
+ *              Debug_print so that the same macros can be used.
  *
  ****************************************************************************/
 
 void
-function_trace_str (
-       NATIVE_CHAR             *module_name,
+acpi_ut_debug_print_raw (
+       u32                     requested_debug_level,
        u32                     line_number,
-       u32                     component_id,
-       NATIVE_CHAR             *function_name,
-       NATIVE_CHAR             *string)
+       ACPI_DEBUG_PRINT_INFO   *dbg_info,
+       char                    *format,
+       ...)
 {
+       va_list                 args;
 
-       acpi_gbl_nesting_level++;
-       debug_print (module_name, line_number, component_id, TRACE_FUNCTIONS,
-                        " %2.2ld Entered Function: %s, %s\n",
-                        acpi_gbl_nesting_level, function_name, string);
+
+       if (!(requested_debug_level & acpi_dbg_level) ||
+               !(dbg_info->component_id & acpi_dbg_layer)) {
+               return;
+       }
+
+       va_start (args, format);
+
+       acpi_os_vprintf (format, args);
 }
 
 
 /*****************************************************************************
  *
- * FUNCTION:    Function_trace_u32
+ * FUNCTION:    Acpi_ut_trace
  *
- * PARAMETERS:  Module_name         - Caller's module name (for error output)
- *              Line_number         - Caller's line number (for error output)
- *              Component_id        - Caller's component ID (for error output)
- *              Function_name       - Name of Caller's function
- *              Integer             - Integer to display
+ * PARAMETERS:  Line_number         - Caller's line number
+ *              Dbg_info            - Contains:
+ *                  Proc_name           - Caller's procedure name
+ *                  Module_name         - Caller's module name
+ *                  Component_id        - Caller's component ID
  *
  * RETURN:      None
  *
@@ -176,153 +228,142 @@ function_trace_str (
  ****************************************************************************/
 
 void
-function_trace_u32 (
-       NATIVE_CHAR             *module_name,
+acpi_ut_trace (
        u32                     line_number,
-       u32                     component_id,
-       NATIVE_CHAR             *function_name,
-       u32                     integer)
+       ACPI_DEBUG_PRINT_INFO   *dbg_info)
 {
 
        acpi_gbl_nesting_level++;
-       debug_print (module_name, line_number, component_id, TRACE_FUNCTIONS,
-                        " %2.2ld Entered Function: %s, %lX\n",
-                        acpi_gbl_nesting_level, function_name, integer);
+       acpi_ut_track_stack_ptr ();
+
+       acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
+                       "%s\n", acpi_gbl_fn_entry_str);
 }
 
 
 /*****************************************************************************
  *
- * FUNCTION:    Function_exit
+ * FUNCTION:    Acpi_ut_trace_ptr
  *
- * PARAMETERS:  Module_name         - Caller's module name (for error output)
- *              Line_number         - Caller's line number (for error output)
- *              Component_id        - Caller's component ID (for error output)
- *              Function_name       - Name of Caller's function
+ * PARAMETERS:  Line_number         - Caller's line number
+ *              Dbg_info            - Contains:
+ *                  Proc_name           - Caller's procedure name
+ *                  Module_name         - Caller's module name
+ *                  Component_id        - Caller's component ID
+ *              Pointer             - Pointer to display
  *
  * RETURN:      None
  *
- * DESCRIPTION: Function exit trace.  Prints only if TRACE_FUNCTIONS bit is
+ * DESCRIPTION: Function entry trace.  Prints only if TRACE_FUNCTIONS bit is
  *              set in Debug_level
  *
  ****************************************************************************/
 
 void
-function_exit (
-       NATIVE_CHAR             *module_name,
+acpi_ut_trace_ptr (
        u32                     line_number,
-       u32                     component_id,
-       NATIVE_CHAR             *function_name)
+       ACPI_DEBUG_PRINT_INFO   *dbg_info,
+       void                    *pointer)
 {
+       acpi_gbl_nesting_level++;
+       acpi_ut_track_stack_ptr ();
 
-       debug_print (module_name, line_number, component_id, TRACE_FUNCTIONS,
-                        " %2.2ld Exiting Function: %s\n",
-                        acpi_gbl_nesting_level, function_name);
-
-       acpi_gbl_nesting_level--;
+       acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
+                       "%s %p\n", acpi_gbl_fn_entry_str, pointer);
 }
 
 
 /*****************************************************************************
  *
- * FUNCTION:    Function_status_exit
+ * FUNCTION:    Acpi_ut_trace_str
  *
- * PARAMETERS:  Module_name         - Caller's module name (for error output)
- *              Line_number         - Caller's line number (for error output)
- *              Component_id        - Caller's component ID (for error output)
- *              Function_name       - Name of Caller's function
- *              Status              - Exit status code
+ * PARAMETERS:  Line_number         - Caller's line number
+ *              Dbg_info            - Contains:
+ *                  Proc_name           - Caller's procedure name
+ *                  Module_name         - Caller's module name
+ *                  Component_id        - Caller's component ID
+ *              String              - Additional string to display
  *
  * RETURN:      None
  *
- * DESCRIPTION: Function exit trace.  Prints only if TRACE_FUNCTIONS bit is
- *              set in Debug_level. Prints exit status also.
+ * DESCRIPTION: Function entry trace.  Prints only if TRACE_FUNCTIONS bit is
+ *              set in Debug_level
  *
  ****************************************************************************/
 
 void
-function_status_exit (
-       NATIVE_CHAR             *module_name,
+acpi_ut_trace_str (
        u32                     line_number,
-       u32                     component_id,
-       NATIVE_CHAR             *function_name,
-       ACPI_STATUS             status)
+       ACPI_DEBUG_PRINT_INFO   *dbg_info,
+       NATIVE_CHAR             *string)
 {
 
-       debug_print (module_name, line_number, component_id,
-               TRACE_FUNCTIONS,
-               " %2.2ld Exiting Function: %s, %s\n",
-               acpi_gbl_nesting_level,
-               function_name,
-               acpi_ut_format_exception (status));
+       acpi_gbl_nesting_level++;
+       acpi_ut_track_stack_ptr ();
 
-       acpi_gbl_nesting_level--;
+       acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
+                       "%s %s\n", acpi_gbl_fn_entry_str, string);
 }
 
 
 /*****************************************************************************
  *
- * FUNCTION:    Function_value_exit
+ * FUNCTION:    Acpi_ut_trace_u32
  *
- * PARAMETERS:  Module_name         - Caller's module name (for error output)
- *              Line_number         - Caller's line number (for error output)
- *              Component_id        - Caller's component ID (for error output)
- *              Function_name       - Name of Caller's function
- *              Value               - Value to be printed with exit msg
+ * PARAMETERS:  Line_number         - Caller's line number
+ *              Dbg_info            - Contains:
+ *                  Proc_name           - Caller's procedure name
+ *                  Module_name         - Caller's module name
+ *                  Component_id        - Caller's component ID
+ *              Integer             - Integer to display
  *
  * RETURN:      None
  *
- * DESCRIPTION: Function exit trace.  Prints only if TRACE_FUNCTIONS bit is
- *              set in Debug_level. Prints exit value also.
+ * DESCRIPTION: Function entry trace.  Prints only if TRACE_FUNCTIONS bit is
+ *              set in Debug_level
  *
  ****************************************************************************/
 
 void
-function_value_exit (
-       NATIVE_CHAR             *module_name,
+acpi_ut_trace_u32 (
        u32                     line_number,
-       u32                     component_id,
-       NATIVE_CHAR             *function_name,
-       ACPI_INTEGER            value)
+       ACPI_DEBUG_PRINT_INFO   *dbg_info,
+       u32                     integer)
 {
 
-       debug_print (module_name, line_number, component_id, TRACE_FUNCTIONS,
-                        " %2.2ld Exiting Function: %s, %X\n",
-                        acpi_gbl_nesting_level, function_name, value);
+       acpi_gbl_nesting_level++;
+       acpi_ut_track_stack_ptr ();
 
-       acpi_gbl_nesting_level--;
+       acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
+                       "%s %08X\n", acpi_gbl_fn_entry_str, integer);
 }
 
 
 /*****************************************************************************
  *
- * FUNCTION:    Function_ptr_exit
+ * FUNCTION:    Acpi_ut_exit
  *
- * PARAMETERS:  Module_name         - Caller's module name (for error output)
- *              Line_number         - Caller's line number (for error output)
- *              Component_id        - Caller's component ID (for error output)
- *              Function_name       - Name of Caller's function
- *              Value               - Value to be printed with exit msg
+ * PARAMETERS:  Line_number         - Caller's line number
+ *              Dbg_info            - Contains:
+ *                  Proc_name           - Caller's procedure name
+ *                  Module_name         - Caller's module name
+ *                  Component_id        - Caller's component ID
  *
  * RETURN:      None
  *
  * DESCRIPTION: Function exit trace.  Prints only if TRACE_FUNCTIONS bit is
- *              set in Debug_level. Prints exit value also.
+ *              set in Debug_level
  *
  ****************************************************************************/
 
 void
-function_ptr_exit (
-       NATIVE_CHAR             *module_name,
+acpi_ut_exit (
        u32                     line_number,
-       u32                     component_id,
-       NATIVE_CHAR             *function_name,
-       u8                      *ptr)
+       ACPI_DEBUG_PRINT_INFO   *dbg_info)
 {
 
-       debug_print (module_name, line_number, component_id, TRACE_FUNCTIONS,
-                        " %2.2ld Exiting Function: %s, %p\n",
-                        acpi_gbl_nesting_level, function_name, ptr);
+       acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
+                       "%s\n", acpi_gbl_fn_exit_str);
 
        acpi_gbl_nesting_level--;
 }
@@ -330,137 +371,109 @@ function_ptr_exit (
 
 /*****************************************************************************
  *
- * FUNCTION:    Debug_print
+ * FUNCTION:    Acpi_ut_status_exit
  *
- * PARAMETERS:  Module_name         - Caller's module name (for error output)
- *              Line_number         - Caller's line number (for error output)
- *              Component_id        - Caller's component ID (for error output)
- *              Print_level         - Requested debug print level
- *              Format              - Printf format field
- *              ...                 - Optional printf arguments
+ * PARAMETERS:  Line_number         - Caller's line number
+ *              Dbg_info            - Contains:
+ *                  Proc_name           - Caller's procedure name
+ *                  Module_name         - Caller's module name
+ *                  Component_id        - Caller's component ID
+ *              Status              - Exit status code
  *
  * RETURN:      None
  *
- * DESCRIPTION: Print error message with prefix consisting of the module name,
- *              line number, and component ID.
+ * DESCRIPTION: Function exit trace.  Prints only if TRACE_FUNCTIONS bit is
+ *              set in Debug_level. Prints exit status also.
  *
  ****************************************************************************/
 
 void
-debug_print (
-       NATIVE_CHAR             *module_name,
+acpi_ut_status_exit (
        u32                     line_number,
-       u32                     component_id,
-       u32                     print_level,
-       NATIVE_CHAR             *format,
-       ...)
+       ACPI_DEBUG_PRINT_INFO   *dbg_info,
+       acpi_status             status)
 {
-       va_list                 args;
-       u32                     thread_id;
-
-
-       thread_id = acpi_os_get_thread_id ();
-
-
-       /* Both the level and the component must be enabled */
-
-       if ((print_level & acpi_dbg_level) &&
-               (component_id & acpi_dbg_layer)) {
-               va_start (args, format);
 
-               if (thread_id != prev_thread_id) {
-                       if (TRACE_THREADS & acpi_dbg_level) {
-                               acpi_os_printf ("\n**** Context Switch from TID %X to TID %X ****\n\n",
-                                       prev_thread_id, thread_id);
-                       }
-
-                       prev_thread_id = thread_id;
-               }
-
-               if (TRACE_THREADS & acpi_dbg_level) {
-                       acpi_os_printf ("%8s-%04d[%04X]: ", module_name, line_number, thread_id);
-               }
-               else {
-                       acpi_os_printf ("%8s-%04d: ", module_name, line_number);
-               }
-
-               acpi_os_vprintf (format, args);
+       if (ACPI_SUCCESS (status)) {
+               acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
+                               "%s %s\n", acpi_gbl_fn_exit_str,
+                               acpi_format_exception (status));
+       }
+       else {
+               acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
+                               "%s ****Exception****: %s\n", acpi_gbl_fn_exit_str,
+                               acpi_format_exception (status));
        }
+
+       acpi_gbl_nesting_level--;
 }
 
 
 /*****************************************************************************
  *
- * FUNCTION:    Debug_print_prefix
+ * FUNCTION:    Acpi_ut_value_exit
  *
- * PARAMETERS:  Module_name         - Caller's module name (for error output)
- *              Line_number         - Caller's line number (for error output)
- *              Component_id        - Caller's component ID (for error output)
+ * PARAMETERS:  Line_number         - Caller's line number
+ *              Dbg_info            - Contains:
+ *                  Proc_name           - Caller's procedure name
+ *                  Module_name         - Caller's module name
+ *                  Component_id        - Caller's component ID
+ *              Value               - Value to be printed with exit msg
  *
  * RETURN:      None
  *
- * DESCRIPTION: Print the prefix part of an error message, consisting of the
- *              module name, and line number
+ * DESCRIPTION: Function exit trace.  Prints only if TRACE_FUNCTIONS bit is
+ *              set in Debug_level. Prints exit value also.
  *
  ****************************************************************************/
 
 void
-debug_print_prefix (
-       NATIVE_CHAR             *module_name,
-       u32                     line_number)
+acpi_ut_value_exit (
+       u32                     line_number,
+       ACPI_DEBUG_PRINT_INFO   *dbg_info,
+       acpi_integer            value)
 {
-       u32                     thread_id;
 
+       acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
+                       "%s %08X\n", acpi_gbl_fn_exit_str, value);
 
-       thread_id = acpi_os_get_thread_id ();
-
-       if (thread_id != prev_thread_id) {
-               if (TRACE_THREADS & acpi_dbg_level) {
-                       acpi_os_printf ("\n**** Context Switch from TID %X to TID %X ****\n\n",
-                               prev_thread_id, thread_id);
-               }
-
-               prev_thread_id = thread_id;
-       }
-
-       if (TRACE_THREADS & acpi_dbg_level) {
-               acpi_os_printf ("%8s-%04d[%04X]: ", module_name, line_number, thread_id);
-       }
-       else {
-               acpi_os_printf ("%8s-%04d: ", module_name, line_number);
-       }
-
+       acpi_gbl_nesting_level--;
 }
 
 
 /*****************************************************************************
  *
- * FUNCTION:    Debug_print_raw
+ * FUNCTION:    Acpi_ut_ptr_exit
  *
- * PARAMETERS:  Format              - Printf format field
- *              ...                 - Optional printf arguments
+ * PARAMETERS:  Line_number         - Caller's line number
+ *              Dbg_info            - Contains:
+ *                  Proc_name           - Caller's procedure name
+ *                  Module_name         - Caller's module name
+ *                  Component_id        - Caller's component ID
+ *              Value               - Value to be printed with exit msg
  *
  * RETURN:      None
  *
- * DESCRIPTION: Print error message -- without module/line indentifiers
+ * DESCRIPTION: Function exit trace.  Prints only if TRACE_FUNCTIONS bit is
+ *              set in Debug_level. Prints exit value also.
  *
  ****************************************************************************/
 
 void
-debug_print_raw (
-       NATIVE_CHAR             *format,
-       ...)
+acpi_ut_ptr_exit (
+       u32                     line_number,
+       ACPI_DEBUG_PRINT_INFO   *dbg_info,
+       u8                      *ptr)
 {
-       va_list                 args;
-
 
-       va_start (args, format);
+       acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
+                       "%s %p\n", acpi_gbl_fn_exit_str, ptr);
 
-       acpi_os_vprintf (format, args);
-
-       va_end (args);
+       acpi_gbl_nesting_level--;
 }
 
+#endif
+
 
 /*****************************************************************************
  *
@@ -468,6 +481,7 @@ debug_print_raw (
  *
  * PARAMETERS:  Buffer              - Buffer to dump
  *              Count               - Amount to dump, in bytes
+ *              Display             - BYTE, WORD, DWORD, or QWORD display
  *              Component_iD        - Caller's component ID
  *
  * RETURN:      None
@@ -491,7 +505,7 @@ acpi_ut_dump_buffer (
 
        /* Only dump the buffer if tracing is enabled */
 
-       if (!((TRACE_TABLES & acpi_dbg_level) &&
+       if (!((ACPI_LV_TABLES & acpi_dbg_level) &&
                (component_id & acpi_dbg_layer))) {
                return;
        }
@@ -591,4 +605,3 @@ acpi_ut_dump_buffer (
        return;
 }
 
-
index 884daf3b5fcd855bdb62b4edf2d2cd4991ae390a..4a16da91db3cc16b645225dfc44f58bfd5a9006d 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: utdelete - object deletion and reference count utilities
- *              $Revision: 71 $
+ *              $Revision: 76 $
  *
  ******************************************************************************/
 
 
 void
 acpi_ut_delete_internal_obj (
-       ACPI_OPERAND_OBJECT     *object)
+       acpi_operand_object     *object)
 {
        void                    *obj_pointer = NULL;
-       ACPI_OPERAND_OBJECT     *handler_desc;
+       acpi_operand_object     *handler_desc;
+
+
+       FUNCTION_TRACE_PTR ("Ut_delete_internal_obj", object);
 
 
        if (!object) {
-               return;
+               return_VOID;
        }
 
        /*
         * Must delete or free any pointers within the object that are not
         * actual ACPI objects (for example, a raw buffer pointer).
         */
-
        switch (object->common.type) {
 
        case ACPI_TYPE_STRING:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** String %p, ptr %p\n",
+                       object, object->string.pointer));
+
                /* Free the actual string buffer */
 
-               obj_pointer = object->string.pointer;
+               if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) {
+                       obj_pointer = object->string.pointer;
+               }
                break;
 
 
        case ACPI_TYPE_BUFFER:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Buffer %p, ptr %p\n",
+                       object, object->buffer.pointer));
+
                /* Free the actual buffer */
 
                obj_pointer = object->buffer.pointer;
@@ -84,6 +94,9 @@ acpi_ut_delete_internal_obj (
 
        case ACPI_TYPE_PACKAGE:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, " **** Package of count %X\n",
+                       object->package.count));
+
                /*
                 * Elements of the package are not handled here, they are deleted
                 * separately
@@ -97,6 +110,9 @@ acpi_ut_delete_internal_obj (
 
        case ACPI_TYPE_MUTEX:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "***** Mutex %p, Semaphore %p\n",
+                       object, object->mutex.semaphore));
+
                acpi_ex_unlink_mutex (object);
                acpi_os_delete_semaphore (object->mutex.semaphore);
                break;
@@ -104,6 +120,9 @@ acpi_ut_delete_internal_obj (
 
        case ACPI_TYPE_EVENT:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "***** Event %p, Semaphore %p\n",
+                       object, object->event.semaphore));
+
                acpi_os_delete_semaphore (object->event.semaphore);
                object->event.semaphore = NULL;
                break;
@@ -111,6 +130,8 @@ acpi_ut_delete_internal_obj (
 
        case ACPI_TYPE_METHOD:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "***** Method %p\n", object));
+
                /* Delete the method semaphore if it exists */
 
                if (object->method.semaphore) {
@@ -123,6 +144,8 @@ acpi_ut_delete_internal_obj (
 
        case ACPI_TYPE_REGION:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "***** Region %p\n", object));
+
                if (object->region.extra) {
                        /*
                         * Free the Region_context if and only if the handler is one of the
@@ -144,6 +167,8 @@ acpi_ut_delete_internal_obj (
 
        case ACPI_TYPE_BUFFER_FIELD:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "***** Buffer Field %p\n", object));
+
                if (object->buffer_field.extra) {
                        acpi_ut_delete_object_desc (object->buffer_field.extra);
                }
@@ -159,19 +184,28 @@ acpi_ut_delete_internal_obj (
         */
        if (obj_pointer) {
                if (!acpi_tb_system_table_pointer (obj_pointer)) {
-                       acpi_ut_free (obj_pointer);
+                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Deleting Obj Ptr %p \n", obj_pointer));
+
+                       ACPI_MEM_FREE (obj_pointer);
                }
        }
 
 
        /* Only delete the object if it was dynamically allocated */
 
+       if (object->common.flags & AOPOBJ_STATIC_ALLOCATION) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Object %p [%s] static allocation, no delete\n",
+                       object, acpi_ut_get_type_name (object->common.type)));
+       }
 
        if (!(object->common.flags & AOPOBJ_STATIC_ALLOCATION)) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Deleting object %p [%s]\n",
+                       object, acpi_ut_get_type_name (object->common.type)));
+
                acpi_ut_delete_object_desc (object);
        }
 
-       return;
+       return_VOID;
 }
 
 
@@ -188,39 +222,27 @@ acpi_ut_delete_internal_obj (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ut_delete_internal_object_list (
-       ACPI_OPERAND_OBJECT     **obj_list)
+       acpi_operand_object     **obj_list)
 {
-       ACPI_OPERAND_OBJECT     **internal_obj;
-
+       acpi_operand_object     **internal_obj;
 
-       /* Walk the null-terminated internal list */
 
-       for (internal_obj = obj_list; *internal_obj; internal_obj++) {
-               /*
-                * Check for a package
-                * Simple objects are simply stored in the array and do not
-                * need to be deleted separately.
-                */
+       FUNCTION_TRACE ("Ut_delete_internal_object_list");
 
-               if (IS_THIS_OBJECT_TYPE ((*internal_obj), ACPI_TYPE_PACKAGE)) {
-                       /* Delete the package */
 
-                       /*
-                        * TBD: [Investigate] This might not be the right thing to do,
-                        * depending on how the internal package object was allocated!!!
-                        */
-                       acpi_ut_delete_internal_obj (*internal_obj);
-               }
+       /* Walk the null-terminated internal list */
 
+       for (internal_obj = obj_list; *internal_obj; internal_obj++) {
+               acpi_ut_remove_reference (*internal_obj);
        }
 
        /* Free the combined parameter pointer list and object array */
 
-       acpi_ut_free (obj_list);
+       ACPI_MEM_FREE (obj_list);
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -239,7 +261,7 @@ acpi_ut_delete_internal_object_list (
 
 static void
 acpi_ut_update_ref_count (
-       ACPI_OPERAND_OBJECT     *object,
+       acpi_operand_object     *object,
        u32                     action)
 {
        u16                     count;
@@ -259,7 +281,6 @@ acpi_ut_update_ref_count (
        /*
         * Reference count action (increment, decrement, or force delete)
         */
-
        switch (action) {
 
        case REF_INCREMENT:
@@ -267,20 +288,31 @@ acpi_ut_update_ref_count (
                new_count++;
                object->common.reference_count = new_count;
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Obj %p Refs=%X, [Incremented]\n",
+                       object, new_count));
                break;
 
 
        case REF_DECREMENT:
 
                if (count < 1) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Obj %p Refs=%X, can't decrement! (Set to 0)\n",
+                               object, new_count));
+
                        new_count = 0;
                }
 
                else {
                        new_count--;
 
+                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Obj %p Refs=%X, [Decremented]\n",
+                               object, new_count));
                }
 
+               if (object->common.type == ACPI_TYPE_METHOD) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Method Obj %p Refs=%X, [Decremented]\n",
+                               object, new_count));
+               }
 
                object->common.reference_count = new_count;
                if (new_count == 0) {
@@ -292,6 +324,9 @@ acpi_ut_update_ref_count (
 
        case REF_FORCE_DELETE:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Obj %p Refs=%X, Force delete! (Set to 0)\n",
+                       object, count));
+
                new_count = 0;
                object->common.reference_count = new_count;
                acpi_ut_delete_internal_obj (object);
@@ -300,6 +335,7 @@ acpi_ut_update_ref_count (
 
        default:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown action (%X)\n", action));
                break;
        }
 
@@ -308,7 +344,12 @@ acpi_ut_update_ref_count (
         * Sanity check the reference count, for debug purposes only.
         * (A deleted object will have a huge reference count)
         */
+       if (count > MAX_REFERENCE_COUNT) {
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                       "**** AE_ERROR **** Invalid Reference Count (%X) in object %p\n\n",
+                       count, object));
+       }
 
        return;
 }
@@ -336,36 +377,40 @@ acpi_ut_update_ref_count (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ut_update_object_reference (
-       ACPI_OPERAND_OBJECT     *object,
+       acpi_operand_object     *object,
        u16                     action)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
        u32                     i;
-       ACPI_OPERAND_OBJECT     *next;
-       ACPI_OPERAND_OBJECT     *new;
-       ACPI_GENERIC_STATE       *state_list = NULL;
-       ACPI_GENERIC_STATE       *state;
+       acpi_operand_object     *next;
+       acpi_operand_object     *new;
+       acpi_generic_state       *state_list = NULL;
+       acpi_generic_state       *state;
+
+
+       FUNCTION_TRACE_PTR ("Ut_update_object_reference", object);
 
 
        /* Ignore a null object ptr */
 
        if (!object) {
-               return (AE_OK);
+               return_ACPI_STATUS (AE_OK);
        }
 
 
        /*
         * Make sure that this isn't a namespace handle or an AML pointer
         */
-
        if (VALID_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_NAMED)) {
-               return (AE_OK);
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Object %p is NS handle\n", object));
+               return_ACPI_STATUS (AE_OK);
        }
 
        if (acpi_tb_system_table_pointer (object)) {
-               return (AE_OK);
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Object %p is Pcode Ptr\n", object));
+               return_ACPI_STATUS (AE_OK);
        }
 
 
@@ -387,7 +432,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 (status);
+                               return_ACPI_STATUS (status);
                        }
 
                        acpi_ut_update_ref_count (object->device.sys_handler, action);
@@ -421,11 +466,10 @@ acpi_ut_update_object_reference (
                                 * Note: There can be null elements within the package,
                                 * these are simply ignored
                                 */
-
                                status = acpi_ut_create_update_state_and_push (
                                                 object->package.elements[i], action, &state_list);
                                if (ACPI_FAILURE (status)) {
-                                       return (status);
+                                       return_ACPI_STATUS (status);
                                }
                        }
                        break;
@@ -437,7 +481,7 @@ acpi_ut_update_object_reference (
                                         object->buffer_field.buffer_obj, action, &state_list);
 
                        if (ACPI_FAILURE (status)) {
-                               return (status);
+                               return_ACPI_STATUS (status);
                        }
                        break;
 
@@ -447,7 +491,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 (status);
+                               return_ACPI_STATUS (status);
                        }
                   break;
 
@@ -457,13 +501,13 @@ acpi_ut_update_object_reference (
                        status = acpi_ut_create_update_state_and_push (
                                         object->bank_field.bank_register_obj, action, &state_list);
                        if (ACPI_FAILURE (status)) {
-                               return (status);
+                               return_ACPI_STATUS (status);
                        }
 
                        status = acpi_ut_create_update_state_and_push (
                                         object->bank_field.region_obj, action, &state_list);
                        if (ACPI_FAILURE (status)) {
-                               return (status);
+                               return_ACPI_STATUS (status);
                        }
                        break;
 
@@ -473,13 +517,13 @@ 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 (status);
+                               return_ACPI_STATUS (status);
                        }
 
                        status = acpi_ut_create_update_state_and_push (
                                         object->index_field.data_obj, action, &state_list);
                        if (ACPI_FAILURE (status)) {
-                               return (status);
+                               return_ACPI_STATUS (status);
                        }
                        break;
 
@@ -495,7 +539,7 @@ acpi_ut_update_object_reference (
                                                   Action, &State_list);
                        if (ACPI_FAILURE (Status))
                        {
-                               return (Status);
+                               return_ACPI_STATUS (Status);
                        }
 */
                        break;
@@ -512,7 +556,6 @@ acpi_ut_update_object_reference (
                 * happen after we update the sub-objects in case this causes the
                 * main object to be deleted.
                 */
-
                acpi_ut_update_ref_count (object, action);
 
 
@@ -522,7 +565,7 @@ acpi_ut_update_object_reference (
        }
 
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -541,25 +584,25 @@ acpi_ut_update_object_reference (
 
 void
 acpi_ut_add_reference (
-       ACPI_OPERAND_OBJECT     *object)
+       acpi_operand_object     *object)
 {
 
+       FUNCTION_TRACE_PTR ("Ut_add_reference", object);
+
 
        /*
         * Ensure that we have a valid object
         */
-
        if (!acpi_ut_valid_internal_object (object)) {
-               return;
+               return_VOID;
        }
 
        /*
         * We have a valid ACPI internal object, now increment the reference count
         */
-
        acpi_ut_update_object_reference (object, REF_INCREMENT);
 
-       return;
+       return_VOID;
 }
 
 
@@ -577,26 +620,29 @@ acpi_ut_add_reference (
 
 void
 acpi_ut_remove_reference (
-       ACPI_OPERAND_OBJECT     *object)
+       acpi_operand_object     *object)
 {
 
+       FUNCTION_TRACE_PTR ("Ut_remove_reference", object);
+
 
        /*
         * Ensure that we have a valid object
         */
-
        if (!acpi_ut_valid_internal_object (object)) {
-               return;
+               return_VOID;
        }
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Obj %p Refs=%X\n",
+                       object, object->common.reference_count));
+
        /*
         * Decrement the reference count, and only actually delete the object
         * if the reference count becomes 0.  (Must also decrement the ref count
         * of all subobjects!)
         */
-
        acpi_ut_update_object_reference (object, REF_DECREMENT);
-       return;
+       return_VOID;
 }
 
 
index 00a1e6948570ace54c81c424e0ed08c816c43c7f..5abdf006287ea4e41fe393a9bb6905ddae9eb6b4 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: uteval - Object evaluation
- *              $Revision: 27 $
+ *              $Revision: 30 $
  *
  *****************************************************************************/
 
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ut_evaluate_numeric_object (
        NATIVE_CHAR             *object_name,
-       ACPI_NAMESPACE_NODE     *device_node,
-       ACPI_INTEGER            *address)
+       acpi_namespace_node     *device_node,
+       acpi_integer            *address)
 {
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_STATUS             status;
+       acpi_operand_object     *obj_desc;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Ut_evaluate_numeric_object");
 
 
        /* Execute the method */
 
        status = acpi_ns_evaluate_relative (device_node, object_name, NULL, &obj_desc);
        if (ACPI_FAILURE (status)) {
+               if (status == AE_NOT_FOUND) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s on %4.4s was not found\n",
+                               object_name, &device_node->name));
+               }
+               else {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s on %4.4s failed with status %s\n",
+                               object_name, &device_node->name,
+                               acpi_format_exception (status)));
+               }
 
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
 
        /* Did we get a return object? */
 
        if (!obj_desc) {
-               return (AE_TYPE);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from %s\n",
+                       object_name));
+               return_ACPI_STATUS (AE_TYPE);
        }
 
        /* Is the return object of the correct type? */
 
        if (obj_desc->common.type != ACPI_TYPE_INTEGER) {
                status = AE_TYPE;
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                       "Type returned from %s was not a number: %X \n",
+                       object_name, obj_desc->common.type));
        }
        else {
                /*
@@ -92,7 +109,7 @@ acpi_ut_evaluate_numeric_object (
 
        acpi_ut_remove_reference (obj_desc);
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -112,13 +129,16 @@ acpi_ut_evaluate_numeric_object (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ut_execute_HID (
-       ACPI_NAMESPACE_NODE     *device_node,
+       acpi_namespace_node     *device_node,
        ACPI_DEVICE_ID          *hid)
 {
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_STATUS             status;
+       acpi_operand_object     *obj_desc;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Ut_execute_HID");
 
 
        /* Execute the method */
@@ -126,15 +146,24 @@ acpi_ut_execute_HID (
        status = acpi_ns_evaluate_relative (device_node,
                         METHOD_NAME__HID, NULL, &obj_desc);
        if (ACPI_FAILURE (status)) {
+               if (status == AE_NOT_FOUND) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "_HID on %4.4s was not found\n",
+                               &device_node->name));
+               }
 
+               else {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_HID on %4.4s failed %s\n",
+                               &device_node->name, acpi_format_exception (status)));
+               }
 
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Did we get a return object? */
 
        if (!obj_desc) {
-               return (AE_TYPE);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _HID\n"));
+               return_ACPI_STATUS (AE_TYPE);
        }
 
        /*
@@ -144,6 +173,9 @@ acpi_ut_execute_HID (
        if ((obj_desc->common.type != ACPI_TYPE_INTEGER) &&
                (obj_desc->common.type != ACPI_TYPE_STRING)) {
                status = AE_TYPE;
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                       "Type returned from _HID not a number or string: %s(%X) \n",
+                       acpi_ut_get_type_name (obj_desc->common.type), obj_desc->common.type));
        }
 
        else {
@@ -165,7 +197,7 @@ acpi_ut_execute_HID (
 
        acpi_ut_remove_reference (obj_desc);
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -185,13 +217,13 @@ acpi_ut_execute_HID (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ut_execute_UID (
-       ACPI_NAMESPACE_NODE     *device_node,
+       acpi_namespace_node     *device_node,
        ACPI_DEVICE_ID          *uid)
 {
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_STATUS             status;
+       acpi_operand_object     *obj_desc;
+       acpi_status             status;
 
 
        PROC_NAME ("Ut_execute_UID");
@@ -202,7 +234,16 @@ acpi_ut_execute_UID (
        status = acpi_ns_evaluate_relative (device_node,
                         METHOD_NAME__UID, NULL, &obj_desc);
        if (ACPI_FAILURE (status)) {
+               if (status == AE_NOT_FOUND) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "_UID on %4.4s was not found\n",
+                               &device_node->name));
+               }
 
+               else {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                               "_UID on %4.4s failed %s\n",
+                               &device_node->name, acpi_format_exception (status)));
+               }
 
                return (status);
        }
@@ -210,6 +251,7 @@ acpi_ut_execute_UID (
        /* Did we get a return object? */
 
        if (!obj_desc) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _UID\n"));
                return (AE_TYPE);
        }
 
@@ -220,6 +262,9 @@ acpi_ut_execute_UID (
        if ((obj_desc->common.type != ACPI_TYPE_INTEGER) &&
                (obj_desc->common.type != ACPI_TYPE_STRING)) {
                status = AE_TYPE;
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                       "Type returned from _UID was not a number or string: %X \n",
+                       obj_desc->common.type));
        }
 
        else {
@@ -261,13 +306,16 @@ acpi_ut_execute_UID (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ut_execute_STA (
-       ACPI_NAMESPACE_NODE     *device_node,
+       acpi_namespace_node     *device_node,
        u32                     *flags)
 {
-       ACPI_OPERAND_OBJECT     *obj_desc;
-       ACPI_STATUS             status;
+       acpi_operand_object     *obj_desc;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Ut_execute_STA");
 
 
        /* Execute the method */
@@ -275,22 +323,35 @@ acpi_ut_execute_STA (
        status = acpi_ns_evaluate_relative (device_node,
                         METHOD_NAME__STA, NULL, &obj_desc);
        if (AE_NOT_FOUND == status) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+                       "_STA on %4.4s was not found, assuming present.\n",
+                       &device_node->name));
+
                *flags = 0x0F;
                status = AE_OK;
        }
 
+       else if (ACPI_FAILURE (status)) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_STA on %4.4s failed %s\n",
+                       &device_node->name,
+                       acpi_format_exception (status)));
+       }
 
        else /* success */ {
                /* Did we get a return object? */
 
                if (!obj_desc) {
-                       return (AE_TYPE);
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _STA\n"));
+                       return_ACPI_STATUS (AE_TYPE);
                }
 
                /* Is the return object of the correct type? */
 
                if (obj_desc->common.type != ACPI_TYPE_INTEGER) {
                        status = AE_TYPE;
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                               "Type returned from _STA was not a number: %X \n",
+                               obj_desc->common.type));
                }
 
                else {
@@ -304,5 +365,5 @@ acpi_ut_execute_STA (
                acpi_ut_remove_reference (obj_desc);
        }
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
index adf8d6bc6f557d53634aed63056c298336ccd31a..18c9b2ea57f0f5769d2690013e2cd22218af7f54 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: utglobal - Global variables for the ACPI subsystem
- *              $Revision: 123 $
+ *              $Revision: 131 $
  *
  *****************************************************************************/
 
         MODULE_NAME         ("utglobal")
 
 
+/******************************************************************************
+ *
+ * FUNCTION:    Acpi_format_exception
+ *
+ * PARAMETERS:  Status       - The acpi_status code to be formatted
+ *
+ * RETURN:      A string containing the exception  text
+ *
+ * DESCRIPTION: This function translates an ACPI exception into an ASCII string.
+ *
+ ******************************************************************************/
+
+const char *
+acpi_format_exception (
+       acpi_status             status)
+{
+       const char              *exception = "UNKNOWN_STATUS_CODE";
+       acpi_status             sub_status;
+
+
+       sub_status = (status & ~AE_CODE_MASK);
+
+
+       switch (status & AE_CODE_MASK) {
+       case AE_CODE_ENVIRONMENTAL:
+
+               if (sub_status <= AE_CODE_ENV_MAX) {
+                       exception = acpi_gbl_exception_names_env [sub_status];
+               }
+               break;
+
+       case AE_CODE_PROGRAMMER:
+
+               if (sub_status <= AE_CODE_PGM_MAX) {
+                       exception = acpi_gbl_exception_names_pgm [sub_status -1];
+               }
+               break;
+
+       case AE_CODE_ACPI_TABLES:
+
+               if (sub_status <= AE_CODE_TBL_MAX) {
+                       exception = acpi_gbl_exception_names_tbl [sub_status -1];
+               }
+               break;
+
+       case AE_CODE_AML:
+
+               if (sub_status <= AE_CODE_AML_MAX) {
+                       exception = acpi_gbl_exception_names_aml [sub_status -1];
+               }
+               break;
+
+       case AE_CODE_CONTROL:
+
+               if (sub_status <= AE_CODE_CTRL_MAX) {
+                       exception = acpi_gbl_exception_names_ctrl [sub_status -1];
+               }
+               break;
+
+       default:
+               break;
+       }
+
+
+       return ((const char *) exception);
+}
+
+
 /******************************************************************************
  *
  * Static global variable initialization.
 
 /* Debug switch - level and trace mask */
 
+#ifdef ACPI_DEBUG
+u32                         acpi_dbg_level = DEBUG_DEFAULT;
+#else
 u32                         acpi_dbg_level = NORMAL_DEFAULT;
+#endif
 
 /* Debug switch - layer (component) mask */
 
@@ -68,10 +140,14 @@ u32                         acpi_gbl_system_flags = 0;
 u32                         acpi_gbl_startup_flags = 0;
 
 /* System starts unitialized! */
+
 u8                          acpi_gbl_shutdown = TRUE;
 
+const u8                    acpi_gbl_decode_to8bit [8] = {1,2,4,8,16,32,64,128};
 
-u8                          acpi_gbl_decode_to8bit [8] = {1,2,4,8,16,32,64,128};
+const NATIVE_CHAR           *acpi_gbl_db_sleep_states[ACPI_NUM_SLEEP_STATES] = {
+                         "\\_S0_","\\_S1_","\\_S2_","\\_S3_",
+                         "\\_S4_","\\_S5_","\\_S4_b"};
 
 
 /******************************************************************************
@@ -92,7 +168,7 @@ u8                          acpi_gbl_decode_to8bit [8] = {1,2,4,8,16,32,64,128};
  *    during the initialization sequence.
  */
 
-PREDEFINED_NAMES            acpi_gbl_pre_defined_names[] =
+const predefined_names      acpi_gbl_pre_defined_names[] =
 { {"_GPE",    INTERNAL_TYPE_DEF_ANY},
        {"_PR_",    INTERNAL_TYPE_DEF_ANY},
        {"_SB_",    ACPI_TYPE_DEVICE},
@@ -109,10 +185,10 @@ PREDEFINED_NAMES            acpi_gbl_pre_defined_names[] =
  * Properties of the ACPI Object Types, both internal and external.
  *
  * Elements of Acpi_ns_properties are bit significant
- * and the table is indexed by values of ACPI_OBJECT_TYPE
+ * and the table is indexed by values of acpi_object_type
  */
 
-u8                          acpi_gbl_ns_properties[] =
+const u8                    acpi_gbl_ns_properties[] =
 {
        NSP_NORMAL,                 /* 00 Any              */
        NSP_NORMAL,                 /* 01 Number           */
@@ -155,10 +231,33 @@ u8                          acpi_gbl_ns_properties[] =
 
 /* Hex to ASCII conversion table */
 
-NATIVE_CHAR                 acpi_gbl_hex_to_ascii[] =
+const NATIVE_CHAR           acpi_gbl_hex_to_ascii[] =
                          {'0','1','2','3','4','5','6','7',
                          '8','9','A','B','C','D','E','F'};
 
+/*****************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_hex_to_ascii_char
+ *
+ * PARAMETERS:  Integer             - Contains the hex digit
+ *              Position            - bit position of the digit within the
+ *                                    integer
+ *
+ * RETURN:      Ascii character
+ *
+ * DESCRIPTION: Convert a hex digit to an ascii character
+ *
+ ****************************************************************************/
+
+u8
+acpi_ut_hex_to_ascii_char (
+       acpi_integer            integer,
+       u32                     position)
+{
+
+       return (acpi_gbl_hex_to_ascii[(integer >> position) & 0xF]);
+}
+
 
 /******************************************************************************
  *
@@ -171,7 +270,7 @@ NATIVE_CHAR                 acpi_gbl_hex_to_ascii[] =
  ******************************************************************************/
 
 
-ACPI_TABLE_DESC             acpi_gbl_acpi_tables[NUM_ACPI_TABLES];
+acpi_table_desc             acpi_gbl_acpi_tables[NUM_ACPI_TABLES];
 
 
 ACPI_TABLE_SUPPORT          acpi_gbl_acpi_table_data[NUM_ACPI_TABLES] =
@@ -188,107 +287,238 @@ ACPI_TABLE_SUPPORT          acpi_gbl_acpi_table_data[NUM_ACPI_TABLES] =
 };
 
 
+#ifdef ACPI_DEBUG
+
+/*
+ * Strings and procedures used for debug only
+ *
+ */
+
+
 /*****************************************************************************
  *
- * FUNCTION:    Acpi_ut_valid_object_type
+ * FUNCTION:    Acpi_ut_get_mutex_name
  *
  * PARAMETERS:  None.
  *
- * RETURN:      TRUE if valid object type
+ * RETURN:      Status
  *
- * DESCRIPTION: Validate an object type
+ * DESCRIPTION: Translate a mutex ID into a name string (Debug only)
  *
  ****************************************************************************/
 
-u8
-acpi_ut_valid_object_type (
-       u32                     type)
+NATIVE_CHAR *
+acpi_ut_get_mutex_name (
+       u32                     mutex_id)
 {
 
-       if (type > ACPI_TYPE_MAX)
+       if (mutex_id > MAX_MTX)
        {
-               if ((type < INTERNAL_TYPE_BEGIN) ||
-                       (type > INTERNAL_TYPE_MAX))
-               {
-                       return (FALSE);
-               }
+               return ("Invalid Mutex ID");
        }
 
-       return (TRUE);
+       return (acpi_gbl_mutex_names[mutex_id]);
 }
 
 
+/*
+ * Elements of Acpi_gbl_Ns_type_names below must match
+ * one-to-one with values of acpi_object_type
+ *
+ * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; when
+ * stored in a table it really means that we have thus far seen no evidence to
+ * indicatewhat type is actually going to be stored for this entry.
+ */
+
+static const NATIVE_CHAR    acpi_gbl_bad_type[] = "UNDEFINED";
+#define TYPE_NAME_LENGTH    9                           /* Maximum length of each string */
+
+static const NATIVE_CHAR    *acpi_gbl_ns_type_names[] = /* printable names of ACPI types */
+{
+       /* 00 */ "Untyped",
+       /* 01 */ "Integer",
+       /* 02 */ "String",
+       /* 03 */ "Buffer",
+       /* 04 */ "Package",
+       /* 05 */ "Field_unit",
+       /* 06 */ "Device",
+       /* 07 */ "Event",
+       /* 08 */ "Method",
+       /* 09 */ "Mutex",
+       /* 10 */ "Region",
+       /* 11 */ "Power",
+       /* 12 */ "Processor",
+       /* 13 */ "Thermal",
+       /* 14 */ "Buff_field",
+       /* 15 */ "Ddb_handle",
+       /* 16 */ "Debug_obj",
+       /* 17 */ "Regn_field",
+       /* 18 */ "Bank_field",
+       /* 19 */ "Indx_field",
+       /* 20 */ "Reference",
+       /* 21 */ "Alias",
+       /* 22 */ "Notify",
+       /* 23 */ "Addr_hndlr",
+       /* 24 */ "Rsrc_desc",
+       /* 25 */ "Rsrc_field",
+       /* 26 */ "Rgn_fld_dfn",
+       /* 27 */ "Bnk_fld_dfn",
+       /* 28 */ "Idx_fld_dfn",
+       /* 29 */ "If",
+       /* 30 */ "Else",
+       /* 31 */ "While",
+       /* 32 */ "Scope",
+       /* 33 */ "Def_any",
+       /* 34 */ "Extra",
+       /* 35 */ "Invalid"
+};
+
+
 /*****************************************************************************
  *
- * FUNCTION:    Acpi_ut_format_exception
+ * FUNCTION:    Acpi_ut_get_type_name
  *
- * PARAMETERS:  Status              - Acpi status to be formatted
+ * PARAMETERS:  None.
  *
- * RETURN:      Formatted status string
+ * RETURN:      Status
  *
- * DESCRIPTION: Convert an ACPI exception to a string
+ * DESCRIPTION: Translate a Type ID into a name string (Debug only)
  *
  ****************************************************************************/
 
 NATIVE_CHAR *
-acpi_ut_format_exception (
-       ACPI_STATUS             status)
+acpi_ut_get_type_name (
+       u32                     type)
 {
-       NATIVE_CHAR             *exception = "UNKNOWN_STATUS";
-       ACPI_STATUS             sub_status;
 
+       if (type > INTERNAL_TYPE_INVALID)
+       {
+               return ((NATIVE_CHAR *) acpi_gbl_bad_type);
+       }
 
-       sub_status = (status & ~AE_CODE_MASK);
+       return ((NATIVE_CHAR *) acpi_gbl_ns_type_names[type]);
+}
 
 
-       switch (status & AE_CODE_MASK)
+/* Region type decoding */
+
+const NATIVE_CHAR *acpi_gbl_region_types[NUM_REGION_TYPES] =
+{
+       "System_memory",
+       "System_iO",
+       "PCIConfig",
+       "Embedded_control",
+       "SMBus",
+       "CMOS",
+       "PCIBar_target",
+};
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_get_region_name
+ *
+ * PARAMETERS:  None.
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Translate a Space ID into a name string (Debug only)
+ *
+ ****************************************************************************/
+
+NATIVE_CHAR *
+acpi_ut_get_region_name (
+       u8                      space_id)
+{
+
+       if (space_id >= USER_REGION_BEGIN)
        {
-       case AE_CODE_ENVIRONMENTAL:
+               return ("User_defined_region");
+       }
 
-               if (sub_status <= AE_CODE_ENV_MAX)
-               {
-                       exception = acpi_gbl_exception_names_env [sub_status];
-               }
-               break;
+       else if (space_id >= NUM_REGION_TYPES)
+       {
+               return ("Invalid_space_iD");
+       }
 
-       case AE_CODE_PROGRAMMER:
+       return ((NATIVE_CHAR *) acpi_gbl_region_types[space_id]);
+}
 
-               if (sub_status <= AE_CODE_PGM_MAX)
-               {
-                       exception = acpi_gbl_exception_names_pgm [sub_status -1];
-               }
-               break;
 
-       case AE_CODE_ACPI_TABLES:
+/* Data used in keeping track of fields */
 
-               if (sub_status <= AE_CODE_TBL_MAX)
-               {
-                       exception = acpi_gbl_exception_names_tbl [sub_status -1];
-               }
-               break;
+const NATIVE_CHAR *acpi_gbl_FEnames[NUM_FIELD_NAMES] =
+{
+       "skip",
+       "?access?"
+};              /* FE = Field Element */
 
-       case AE_CODE_AML:
 
-               if (sub_status <= AE_CODE_AML_MAX)
-               {
-                       exception = acpi_gbl_exception_names_aml [sub_status -1];
-               }
-               break;
+const NATIVE_CHAR *acpi_gbl_match_ops[NUM_MATCH_OPS] =
+{
+       "Error",
+       "MTR",
+       "MEQ",
+       "MLE",
+       "MLT",
+       "MGE",
+       "MGT"
+};
 
-       case AE_CODE_CONTROL:
 
-               if (sub_status <= AE_CODE_CTRL_MAX)
+/* Access type decoding */
+
+const NATIVE_CHAR *acpi_gbl_access_types[NUM_ACCESS_TYPES] =
+{
+       "Any_acc",
+       "Byte_acc",
+       "Word_acc",
+       "DWord_acc",
+       "Block_acc",
+       "SMBSend_recv_acc",
+       "SMBQuick_acc"
+};
+
+
+/* Update rule decoding */
+
+const NATIVE_CHAR *acpi_gbl_update_rules[NUM_UPDATE_RULES] =
+{
+       "Preserve",
+       "Write_as_ones",
+       "Write_as_zeros"
+};
+
+#endif
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_valid_object_type
+ *
+ * PARAMETERS:  None.
+ *
+ * RETURN:      TRUE if valid object type
+ *
+ * DESCRIPTION: Validate an object type
+ *
+ ****************************************************************************/
+
+u8
+acpi_ut_valid_object_type (
+       u32                     type)
+{
+
+       if (type > ACPI_TYPE_MAX)
+       {
+               if ((type < INTERNAL_TYPE_BEGIN) ||
+                       (type > INTERNAL_TYPE_MAX))
                {
-                       exception = acpi_gbl_exception_names_ctrl [sub_status -1];
+                       return (FALSE);
                }
-               break;
-
-       default:
-               break;
        }
 
-
-       return (exception);
+       return (TRUE);
 }
 
 
@@ -302,11 +532,14 @@ acpi_ut_format_exception (
  *
  ***************************************************************************/
 
-ACPI_OWNER_ID
+acpi_owner_id
 acpi_ut_allocate_owner_id (
        u32                     id_type)
 {
-       ACPI_OWNER_ID           owner_id = 0xFFFF;
+       acpi_owner_id           owner_id = 0xFFFF;
+
+
+       FUNCTION_TRACE ("Ut_allocate_owner_id");
 
 
        acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
@@ -340,7 +573,7 @@ acpi_ut_allocate_owner_id (
 
        acpi_ut_release_mutex (ACPI_MTX_CACHES);
 
-       return (owner_id);
+       return_VALUE (owner_id);
 }
 
 
@@ -362,6 +595,39 @@ acpi_ut_init_globals (
        u32                     i;
 
 
+       FUNCTION_TRACE ("Ut_init_globals");
+
+       /* Memory allocation and cache lists */
+
+       MEMSET (acpi_gbl_memory_lists, 0, sizeof (ACPI_MEMORY_LIST) * ACPI_NUM_MEM_LISTS);
+
+       acpi_gbl_memory_lists[ACPI_MEM_LIST_STATE].link_offset      = (u16) (NATIVE_UINT) &(((acpi_generic_state *) NULL)->common.next);
+       acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE].link_offset     = (u16) (NATIVE_UINT) &(((acpi_parse_object *) NULL)->next);
+       acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE_EXT].link_offset = (u16) (NATIVE_UINT) &(((acpi_parse2_object *) NULL)->next);
+       acpi_gbl_memory_lists[ACPI_MEM_LIST_OPERAND].link_offset    = (u16) (NATIVE_UINT) &(((acpi_operand_object *) NULL)->cache.next);
+       acpi_gbl_memory_lists[ACPI_MEM_LIST_WALK].link_offset       = (u16) (NATIVE_UINT) &(((acpi_walk_state *) NULL)->next);
+
+       acpi_gbl_memory_lists[ACPI_MEM_LIST_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_OPERAND].object_size    = sizeof (acpi_operand_object);
+       acpi_gbl_memory_lists[ACPI_MEM_LIST_WALK].object_size       = sizeof (acpi_walk_state);
+
+       acpi_gbl_memory_lists[ACPI_MEM_LIST_STATE].max_cache_depth  = MAX_STATE_CACHE_DEPTH;
+       acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE].max_cache_depth = MAX_PARSE_CACHE_DEPTH;
+       acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE_EXT].max_cache_depth = MAX_EXTPARSE_CACHE_DEPTH;
+       acpi_gbl_memory_lists[ACPI_MEM_LIST_OPERAND].max_cache_depth = MAX_OBJECT_CACHE_DEPTH;
+       acpi_gbl_memory_lists[ACPI_MEM_LIST_WALK].max_cache_depth   = MAX_WALK_CACHE_DEPTH;
+
+       ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].list_name    = "Global Memory Allocation");
+       ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].list_name    = "Namespace Nodes");
+       ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_STATE].list_name     = "State Object Cache");
+       ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE].list_name    = "Parse Node Cache");
+       ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE_EXT].list_name = "Extended Parse Node Cache");
+       ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_OPERAND].list_name   = "Operand Object Cache");
+       ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_WALK].list_name      = "Tree Walk Node Cache");
+
        /* ACPI table structure */
 
        for (i = 0; i < NUM_ACPI_TABLES; i++)
@@ -405,7 +671,6 @@ acpi_ut_init_globals (
        acpi_gbl_FADT                       = NULL;
        acpi_gbl_DSDT                       = NULL;
 
-
        /* Global Lock support */
 
        acpi_gbl_global_lock_acquired       = FALSE;
@@ -426,33 +691,6 @@ acpi_ut_init_globals (
        acpi_gbl_next_method_owner_id       = FIRST_METHOD_ID;
        acpi_gbl_debugger_configuration     = DEBUGGER_THREADING;
 
-       /* Cache of small "state" objects */
-
-       acpi_gbl_generic_state_cache        = NULL;
-       acpi_gbl_generic_state_cache_depth  = 0;
-       acpi_gbl_state_cache_requests       = 0;
-       acpi_gbl_state_cache_hits           = 0;
-
-       acpi_gbl_parse_cache                = NULL;
-       acpi_gbl_parse_cache_depth          = 0;
-       acpi_gbl_parse_cache_requests       = 0;
-       acpi_gbl_parse_cache_hits           = 0;
-
-       acpi_gbl_ext_parse_cache            = NULL;
-       acpi_gbl_ext_parse_cache_depth      = 0;
-       acpi_gbl_ext_parse_cache_requests   = 0;
-       acpi_gbl_ext_parse_cache_hits       = 0;
-
-       acpi_gbl_object_cache               = NULL;
-       acpi_gbl_object_cache_depth         = 0;
-       acpi_gbl_object_cache_requests      = 0;
-       acpi_gbl_object_cache_hits          = 0;
-
-       acpi_gbl_walk_state_cache           = NULL;
-       acpi_gbl_walk_state_cache_depth     = 0;
-       acpi_gbl_walk_state_cache_requests  = 0;
-       acpi_gbl_walk_state_cache_hits      = 0;
-
        /* Hardware oriented */
 
        acpi_gbl_gpe0enable_register_save   = NULL;
@@ -473,11 +711,12 @@ acpi_ut_init_globals (
        acpi_gbl_root_node_struct.object    = NULL;
        acpi_gbl_root_node_struct.flags     = ANOBJ_END_OF_PEER_LIST;
 
-       /* Memory allocation metrics - compiled out in non-debug mode. */
 
-       INITIALIZE_ALLOCATION_METRICS();
+#ifdef ACPI_DEBUG
+       acpi_gbl_lowest_stack_pointer       = ACPI_UINT32_MAX;
+#endif
 
-       return;
+       return_VOID;
 }
 
 
index eed3c38cb346158f2282d8231e4eee1b7179113b..00de18cee35fe3226d20bb91f752bc6e55d2d815 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: utinit - Common ACPI subsystem initialization
- *              $Revision: 96 $
+ *              $Revision: 101 $
  *
  *****************************************************************************/
 
@@ -38,6 +38,7 @@
 #define ACPI_OFFSET(d,o)    ((u32) &(((d *)0)->o))
 #define ACPI_FADT_OFFSET(o) ACPI_OFFSET (FADT_DESCRIPTOR, o)
 
+
 /*******************************************************************************
  *
  * FUNCTION:    Acpi_ut_fadt_register_error
@@ -53,7 +54,7 @@
  *
  ******************************************************************************/
 
-static ACPI_STATUS
+static acpi_status
 acpi_ut_fadt_register_error (
        NATIVE_CHAR             *register_name,
        u32                     value,
@@ -81,18 +82,17 @@ acpi_ut_fadt_register_error (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ut_validate_fadt (
        void)
 {
-       ACPI_STATUS                 status = AE_OK;
+       acpi_status                 status = AE_OK;
 
 
        /*
         * Verify Fixed ACPI Description Table fields,
         * but don't abort on any problems, just display error
         */
-
        if (acpi_gbl_FADT->pm1_evt_len < 4) {
                status = acpi_ut_fadt_register_error ("PM1_EVT_LEN",
                                  (u32) acpi_gbl_FADT->pm1_evt_len,
@@ -134,7 +134,6 @@ acpi_ut_validate_fadt (
 
        /* length of GPE blocks must be a multiple of 2 */
 
-
        if (ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xgpe0blk.address) &&
                (acpi_gbl_FADT->gpe0blk_len & 1)) {
                status = acpi_ut_fadt_register_error ("(x)GPE0_BLK_LEN",
@@ -169,19 +168,21 @@ void
 acpi_ut_terminate (void)
 {
 
+       FUNCTION_TRACE ("Ut_terminate");
+
 
        /* Free global tables, etc. */
 
        if (acpi_gbl_gpe0enable_register_save) {
-               acpi_ut_free (acpi_gbl_gpe0enable_register_save);
+               ACPI_MEM_FREE (acpi_gbl_gpe0enable_register_save);
        }
 
        if (acpi_gbl_gpe1_enable_register_save) {
-               acpi_ut_free (acpi_gbl_gpe1_enable_register_save);
+               ACPI_MEM_FREE (acpi_gbl_gpe1_enable_register_save);
        }
 
 
-       return;
+       return_VOID;
 }
 
 
@@ -198,19 +199,24 @@ acpi_ut_terminate (void)
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ut_subsystem_shutdown (void)
 {
 
+       FUNCTION_TRACE ("Ut_subsystem_shutdown");
+
        /* Just exit if subsystem is already shutdown */
 
        if (acpi_gbl_shutdown) {
-               return (AE_OK);
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "ACPI Subsystem is already terminated\n"));
+               return_ACPI_STATUS (AE_OK);
        }
 
        /* Subsystem appears active, go ahead and shut it down */
 
        acpi_gbl_shutdown = TRUE;
+       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Shutting down ACPI Subsystem...\n"));
+
 
        /* Close the Namespace */
 
@@ -237,11 +243,12 @@ acpi_ut_subsystem_shutdown (void)
        acpi_ps_delete_parse_cache ();
 
        /* Debug only - display leftover memory allocation, if any */
-#ifdef ENABLE_DEBUGGER
+
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
        acpi_ut_dump_current_allocations (ACPI_UINT32_MAX, NULL);
 #endif
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
index a2be7df9e64bfe772a64d58968b50f41d829dcd9..4d1ea760ebdc1cc44eda3b98f1b7e5841f941a70 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: utmisc - common utility procedures
- *              $Revision: 42 $
+ *              $Revision: 50 $
  *
  ******************************************************************************/
 
@@ -60,6 +60,9 @@ acpi_ut_valid_acpi_name (
        u32                     i;
 
 
+       FUNCTION_ENTRY ();
+
+
        for (i = 0; i < ACPI_NAME_SIZE; i++) {
                if (!((name_ptr[i] == '_') ||
                          (name_ptr[i] >= 'A' && name_ptr[i] <= 'Z') ||
@@ -68,7 +71,6 @@ acpi_ut_valid_acpi_name (
                }
        }
 
-
        return (TRUE);
 }
 
@@ -90,11 +92,14 @@ acpi_ut_valid_acpi_character (
        NATIVE_CHAR             character)
 {
 
+       FUNCTION_ENTRY ();
+
        return ((u8)   ((character == '_') ||
                           (character >= 'A' && character <= 'Z') ||
                           (character >= '0' && character <= '9')));
 }
 
+
 /*******************************************************************************
  *
  * FUNCTION:    Acpi_ut_strupr
@@ -114,6 +119,9 @@ acpi_ut_strupr (
        NATIVE_CHAR             *string;
 
 
+       FUNCTION_ENTRY ();
+
+
        /* Walk entire string, uppercasing the letters */
 
        for (string = src_string; *string; ) {
@@ -137,12 +145,15 @@ acpi_ut_strupr (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ut_mutex_initialize (
        void)
 {
        u32                     i;
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Ut_mutex_initialize");
 
 
        /*
@@ -151,11 +162,11 @@ acpi_ut_mutex_initialize (
        for (i = 0; i < NUM_MTX; i++) {
                status = acpi_ut_create_mutex (i);
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
        }
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -178,6 +189,9 @@ acpi_ut_mutex_terminate (
        u32                     i;
 
 
+       FUNCTION_TRACE ("Ut_mutex_terminate");
+
+
        /*
         * Delete each predefined mutex object
         */
@@ -185,7 +199,7 @@ acpi_ut_mutex_terminate (
                acpi_ut_delete_mutex (i);
        }
 
-       return;
+       return_VOID;
 }
 
 
@@ -201,15 +215,18 @@ acpi_ut_mutex_terminate (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ut_create_mutex (
        ACPI_MUTEX_HANDLE       mutex_id)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+
+       FUNCTION_TRACE_U32 ("Ut_create_mutex", mutex_id);
 
 
        if (mutex_id > MAX_MTX) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
 
@@ -220,7 +237,7 @@ acpi_ut_create_mutex (
                acpi_gbl_acpi_mutex_info[mutex_id].use_count = 0;
        }
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -236,15 +253,18 @@ acpi_ut_create_mutex (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ut_delete_mutex (
        ACPI_MUTEX_HANDLE       mutex_id)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE_U32 ("Ut_delete_mutex", mutex_id);
 
 
        if (mutex_id > MAX_MTX) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
 
@@ -253,7 +273,7 @@ acpi_ut_delete_mutex (
        acpi_gbl_acpi_mutex_info[mutex_id].mutex = NULL;
        acpi_gbl_acpi_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED;
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -269,11 +289,11 @@ acpi_ut_delete_mutex (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ut_acquire_mutex (
        ACPI_MUTEX_HANDLE       mutex_id)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
        u32                     i;
        u32                     this_thread_id;
 
@@ -297,22 +317,43 @@ acpi_ut_acquire_mutex (
        for (i = mutex_id; i < MAX_MTX; i++) {
                if (acpi_gbl_acpi_mutex_info[i].owner_id == this_thread_id) {
                        if (i == mutex_id) {
+                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                                               "Mutex [%s] already acquired by this thread [%X]\n",
+                                               acpi_ut_get_mutex_name (mutex_id), this_thread_id));
+
                                return (AE_ALREADY_ACQUIRED);
                        }
 
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                                       "Invalid acquire order: Thread %X owns [%s], wants [%s]\n",
+                                       this_thread_id, acpi_ut_get_mutex_name (i),
+                                       acpi_ut_get_mutex_name (mutex_id)));
+
                        return (AE_ACQUIRE_DEADLOCK);
                }
        }
 
 
+       ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX,
+                        "Thread %X attempting to acquire Mutex [%s]\n",
+                        this_thread_id, acpi_ut_get_mutex_name (mutex_id)));
+
        status = acpi_os_wait_semaphore (acpi_gbl_acpi_mutex_info[mutex_id].mutex,
                           1, WAIT_FOREVER);
 
        if (ACPI_SUCCESS (status)) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X acquired Mutex [%s]\n",
+                                this_thread_id, acpi_ut_get_mutex_name (mutex_id)));
+
                acpi_gbl_acpi_mutex_info[mutex_id].use_count++;
                acpi_gbl_acpi_mutex_info[mutex_id].owner_id = this_thread_id;
        }
 
+       else {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Thread %X could not acquire Mutex [%s] %s\n",
+                                this_thread_id, acpi_ut_get_mutex_name (mutex_id),
+                                acpi_format_exception (status)));
+       }
 
        return (status);
 }
@@ -330,11 +371,11 @@ acpi_ut_acquire_mutex (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ut_release_mutex (
        ACPI_MUTEX_HANDLE       mutex_id)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
        u32                     i;
        u32                     this_thread_id;
 
@@ -343,6 +384,10 @@ acpi_ut_release_mutex (
 
 
        this_thread_id = acpi_os_get_thread_id ();
+       ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX,
+               "Thread %X releasing Mutex [%s]\n", this_thread_id,
+               acpi_ut_get_mutex_name (mutex_id)));
+
        if (mutex_id > MAX_MTX) {
                return (AE_BAD_PARAMETER);
        }
@@ -352,6 +397,10 @@ acpi_ut_release_mutex (
         * Mutex must be acquired in order to release it!
         */
        if (acpi_gbl_acpi_mutex_info[mutex_id].owner_id == ACPI_MUTEX_NOT_ACQUIRED) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                               "Mutex [%s] is not acquired, cannot release\n",
+                               acpi_ut_get_mutex_name (mutex_id)));
+
                return (AE_NOT_ACQUIRED);
        }
 
@@ -368,6 +417,10 @@ acpi_ut_release_mutex (
                                continue;
                        }
 
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                                       "Invalid release order: owns [%s], releasing [%s]\n",
+                                       acpi_ut_get_mutex_name (i), acpi_ut_get_mutex_name (mutex_id)));
+
                        return (AE_RELEASE_DEADLOCK);
                }
        }
@@ -379,6 +432,15 @@ acpi_ut_release_mutex (
 
        status = acpi_os_signal_semaphore (acpi_gbl_acpi_mutex_info[mutex_id].mutex, 1);
 
+       if (ACPI_FAILURE (status)) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Thread %X could not release Mutex [%s] %s\n",
+                                this_thread_id, acpi_ut_get_mutex_name (mutex_id),
+                                acpi_format_exception (status)));
+       }
+       else {
+               ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X released Mutex [%s]\n",
+                                this_thread_id, acpi_ut_get_mutex_name (mutex_id)));
+       }
 
        return (status);
 }
@@ -398,13 +460,16 @@ acpi_ut_release_mutex (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ut_create_update_state_and_push (
-       ACPI_OPERAND_OBJECT     *object,
+       acpi_operand_object     *object,
        u16                     action,
-       ACPI_GENERIC_STATE      **state_list)
+       acpi_generic_state      **state_list)
 {
-       ACPI_GENERIC_STATE       *state;
+       acpi_generic_state       *state;
+
+
+       FUNCTION_ENTRY ();
 
 
        /* Ignore null objects; these are expected */
@@ -438,14 +503,17 @@ acpi_ut_create_update_state_and_push (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ut_create_pkg_state_and_push (
        void                    *internal_object,
        void                    *external_object,
        u16                     index,
-       ACPI_GENERIC_STATE      **state_list)
+       acpi_generic_state      **state_list)
 {
-       ACPI_GENERIC_STATE       *state;
+       acpi_generic_state       *state;
+
+
+       FUNCTION_ENTRY ();
 
 
        state = acpi_ut_create_pkg_state (internal_object, external_object, index);
@@ -474,15 +542,18 @@ acpi_ut_create_pkg_state_and_push (
 
 void
 acpi_ut_push_generic_state (
-       ACPI_GENERIC_STATE      **list_head,
-       ACPI_GENERIC_STATE      *state)
+       acpi_generic_state      **list_head,
+       acpi_generic_state      *state)
 {
+       FUNCTION_TRACE ("Ut_push_generic_state");
+
+
        /* Push the state object onto the front of the list (stack) */
 
        state->common.next = *list_head;
        *list_head = state;
 
-       return;
+       return_VOID;
 }
 
 
@@ -498,11 +569,14 @@ acpi_ut_push_generic_state (
  *
  ******************************************************************************/
 
-ACPI_GENERIC_STATE *
+acpi_generic_state *
 acpi_ut_pop_generic_state (
-       ACPI_GENERIC_STATE      **list_head)
+       acpi_generic_state      **list_head)
 {
-       ACPI_GENERIC_STATE      *state;
+       acpi_generic_state      *state;
+
+
+       FUNCTION_TRACE ("Ut_pop_generic_state");
 
 
        /* Remove the state object at the head of the list (stack) */
@@ -514,7 +588,7 @@ acpi_ut_pop_generic_state (
                *list_head = state->common.next;
        }
 
-       return (state);
+       return_PTR (state);
 }
 
 
@@ -531,47 +605,20 @@ acpi_ut_pop_generic_state (
  *
  ******************************************************************************/
 
-ACPI_GENERIC_STATE *
+acpi_generic_state *
 acpi_ut_create_generic_state (void)
 {
-       ACPI_GENERIC_STATE      *state;
-
-
-       acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
-
-       acpi_gbl_state_cache_requests++;
+       acpi_generic_state      *state;
 
-       /* Check the cache first */
 
-       if (acpi_gbl_generic_state_cache) {
-               /* There is an object available, use it */
+       FUNCTION_ENTRY ();
 
-               state = acpi_gbl_generic_state_cache;
-               acpi_gbl_generic_state_cache = state->common.next;
-               state->common.next = NULL;
 
-               acpi_gbl_state_cache_hits++;
-               acpi_gbl_generic_state_cache_depth--;
-
-               acpi_ut_release_mutex (ACPI_MTX_CACHES);
-
-       }
-
-       else {
-               /* The cache is empty, create a new object */
-
-               acpi_ut_release_mutex (ACPI_MTX_CACHES);
-
-               state = acpi_ut_callocate (sizeof (ACPI_GENERIC_STATE));
-       }
+       state = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_STATE);
 
        /* Initialize */
 
        if (state) {
-               /* Always zero out the object before init */
-
-               MEMSET (state, 0, sizeof (ACPI_GENERIC_STATE));
-
                state->common.data_type = ACPI_DESC_TYPE_STATE;
        }
 
@@ -595,12 +642,15 @@ acpi_ut_create_generic_state (void)
  *
  ******************************************************************************/
 
-ACPI_GENERIC_STATE *
+acpi_generic_state *
 acpi_ut_create_update_state (
-       ACPI_OPERAND_OBJECT     *object,
+       acpi_operand_object     *object,
        u16                     action)
 {
-       ACPI_GENERIC_STATE      *state;
+       acpi_generic_state      *state;
+
+
+       FUNCTION_TRACE_PTR ("Ut_create_update_state", object);
 
 
        /* Create the generic state object */
@@ -615,7 +665,7 @@ acpi_ut_create_update_state (
        state->update.object = object;
        state->update.value  = action;
 
-       return (state);
+       return_PTR (state);
 }
 
 
@@ -635,13 +685,16 @@ acpi_ut_create_update_state (
  *
  ******************************************************************************/
 
-ACPI_GENERIC_STATE *
+acpi_generic_state *
 acpi_ut_create_pkg_state (
        void                    *internal_object,
        void                    *external_object,
        u16                     index)
 {
-       ACPI_GENERIC_STATE      *state;
+       acpi_generic_state      *state;
+
+
+       FUNCTION_TRACE_PTR ("Ut_create_pkg_state", internal_object);
 
 
        /* Create the generic state object */
@@ -653,12 +706,12 @@ acpi_ut_create_pkg_state (
 
        /* Init fields specific to the update struct */
 
-       state->pkg.source_object = (ACPI_OPERAND_OBJECT *) internal_object;
+       state->pkg.source_object = (acpi_operand_object *) internal_object;
        state->pkg.dest_object  = external_object;
        state->pkg.index        = index;
        state->pkg.num_packages = 1;
 
-       return (state);
+       return_PTR (state);
 }
 
 
@@ -675,11 +728,14 @@ acpi_ut_create_pkg_state (
  *
  ******************************************************************************/
 
-ACPI_GENERIC_STATE *
+acpi_generic_state *
 acpi_ut_create_control_state (
        void)
 {
-       ACPI_GENERIC_STATE      *state;
+       acpi_generic_state      *state;
+
+
+       FUNCTION_TRACE ("Ut_create_control_state");
 
 
        /* Create the generic state object */
@@ -694,7 +750,7 @@ acpi_ut_create_control_state (
 
        state->common.state = CONTROL_CONDITIONAL_EXECUTING;
 
-       return (state);
+       return_PTR (state);
 }
 
 
@@ -713,35 +769,13 @@ acpi_ut_create_control_state (
 
 void
 acpi_ut_delete_generic_state (
-       ACPI_GENERIC_STATE      *state)
+       acpi_generic_state      *state)
 {
+       FUNCTION_TRACE ("Ut_delete_generic_state");
 
-       /* If cache is full, just free this state object */
 
-       if (acpi_gbl_generic_state_cache_depth >= MAX_STATE_CACHE_DEPTH) {
-               acpi_ut_free (state);
-       }
-
-       /* Otherwise put this object back into the cache */
-
-       else {
-               acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
-
-               /* Clear the state */
-
-               MEMSET (state, 0, sizeof (ACPI_GENERIC_STATE));
-               state->common.data_type = ACPI_DESC_TYPE_STATE;
-
-               /* Put the object at the head of the global cache list */
-
-               state->common.next = acpi_gbl_generic_state_cache;
-               acpi_gbl_generic_state_cache = state;
-               acpi_gbl_generic_state_cache_depth++;
-
-
-               acpi_ut_release_mutex (ACPI_MTX_CACHES);
-       }
-       return;
+       acpi_ut_release_to_cache (ACPI_MEM_LIST_STATE, state);
+       return_VOID;
 }
 
 
@@ -762,21 +796,11 @@ void
 acpi_ut_delete_generic_state_cache (
        void)
 {
-       ACPI_GENERIC_STATE      *next;
-
-
-       /* Traverse the global cache list */
+       FUNCTION_TRACE ("Ut_delete_generic_state_cache");
 
-       while (acpi_gbl_generic_state_cache) {
-               /* Delete one cached state object */
 
-               next = acpi_gbl_generic_state_cache->common.next;
-               acpi_ut_free (acpi_gbl_generic_state_cache);
-               acpi_gbl_generic_state_cache = next;
-               acpi_gbl_generic_state_cache_depth--;
-       }
-
-       return;
+       acpi_ut_delete_generic_cache (ACPI_MEM_LIST_STATE);
+       return_VOID;
 }
 
 
@@ -792,19 +816,22 @@ acpi_ut_delete_generic_state_cache (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ut_resolve_package_references (
-       ACPI_OPERAND_OBJECT     *obj_desc)
+       acpi_operand_object     *obj_desc)
 {
        u32                     count;
-       ACPI_OPERAND_OBJECT     *sub_object;
+       acpi_operand_object     *sub_object;
+
+
+       FUNCTION_TRACE ("Ut_resolve_package_references");
 
 
        if (obj_desc->common.type != ACPI_TYPE_PACKAGE) {
                /* The object must be a package */
 
                REPORT_ERROR (("Must resolve Package Refs on a Package\n"));
-               return(AE_ERROR);
+               return_ACPI_STATUS(AE_ERROR);
        }
 
        /*
@@ -831,9 +858,48 @@ acpi_ut_resolve_package_references (
                }
        }
 
-       return(AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
+#ifdef ACPI_DEBUG
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ut_display_init_pathname
+ *
+ * PARAMETERS:  Obj_handle          - Handle whose pathname will be displayed
+ *              Path                - Additional path string to be appended
+ *
+ * RETURN:      acpi_status
+ *
+ * DESCRIPTION: Display full pathnbame of an object, DEBUG ONLY
+ *
+ ******************************************************************************/
+
+void
+acpi_ut_display_init_pathname (
+       acpi_handle             obj_handle,
+       char                    *path)
+{
+       acpi_status             status;
+       u32                     length = 128;
+       char                    buffer[128];
+
+
+       PROC_NAME ("Ut_display_init_pathname");
+
+
+       status = acpi_ns_handle_to_pathname (obj_handle, &length, buffer);
+       if (ACPI_SUCCESS (status)) {
+               if (path) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "%s.%s\n", buffer, path));
+               }
+               else {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "%s\n", buffer));
+               }
+       }
+}
+#endif
 
 /*******************************************************************************
  *
@@ -847,28 +913,31 @@ acpi_ut_resolve_package_references (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ut_walk_package_tree (
-       ACPI_OPERAND_OBJECT     *source_object,
+       acpi_operand_object     *source_object,
        void                    *target_object,
        ACPI_PKG_CALLBACK       walk_callback,
        void                    *context)
 {
-       ACPI_STATUS             status = AE_OK;
-       ACPI_GENERIC_STATE      *state_list = NULL;
-       ACPI_GENERIC_STATE      *state;
+       acpi_status             status = AE_OK;
+       acpi_generic_state      *state_list = NULL;
+       acpi_generic_state      *state;
        u32                     this_index;
-       ACPI_OPERAND_OBJECT     *this_source_obj;
+       acpi_operand_object     *this_source_obj;
+
+
+       FUNCTION_TRACE ("Ut_walk_package_tree");
 
 
        state = acpi_ut_create_pkg_state (source_object, target_object, 0);
        if (!state) {
-               return (AE_NO_MEMORY);
+               return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
        while (state) {
                this_index    = state->pkg.index;
-               this_source_obj = (ACPI_OPERAND_OBJECT *)
+               this_source_obj = (acpi_operand_object *)
                                  state->pkg.source_object->package.elements[this_index];
 
                /*
@@ -890,7 +959,7 @@ acpi_ut_walk_package_tree (
                        if (ACPI_FAILURE (status)) {
                                /* TBD: must delete package created up to this point */
 
-                               return (status);
+                               return_ACPI_STATUS (status);
                        }
 
                        state->pkg.index++;
@@ -914,7 +983,7 @@ acpi_ut_walk_package_tree (
                                         * package just add the length of the package objects
                                         * and exit
                                         */
-                                       return (AE_OK);
+                                       return_ACPI_STATUS (AE_OK);
                                }
 
                                /*
@@ -933,7 +1002,7 @@ acpi_ut_walk_package_tree (
                        if (ACPI_FAILURE (status)) {
                                /* TBD: must delete package created up to this point */
 
-                               return (status);
+                               return_ACPI_STATUS (status);
                        }
 
 
@@ -950,7 +1019,7 @@ acpi_ut_walk_package_tree (
                        if (!state) {
                                /* TBD: must delete package created up to this point */
 
-                               return (AE_NO_MEMORY);
+                               return_ACPI_STATUS (AE_NO_MEMORY);
                        }
                }
        }
@@ -958,13 +1027,12 @@ acpi_ut_walk_package_tree (
        /* We should never get here */
 
        return (AE_AML_INTERNAL);
-
 }
 
 
 /*******************************************************************************
  *
- * FUNCTION:    _Report_error
+ * FUNCTION:    Acpi_ut_report_error
  *
  * PARAMETERS:  Module_name         - Caller's module name (for error output)
  *              Line_number         - Caller's line number (for error output)
@@ -978,7 +1046,7 @@ acpi_ut_walk_package_tree (
  ******************************************************************************/
 
 void
-_report_error (
+acpi_ut_report_error (
        NATIVE_CHAR             *module_name,
        u32                     line_number,
        u32                     component_id)
@@ -991,7 +1059,7 @@ _report_error (
 
 /*******************************************************************************
  *
- * FUNCTION:    _Report_warning
+ * FUNCTION:    Acpi_ut_report_warning
  *
  * PARAMETERS:  Module_name         - Caller's module name (for error output)
  *              Line_number         - Caller's line number (for error output)
@@ -1005,7 +1073,7 @@ _report_error (
  ******************************************************************************/
 
 void
-_report_warning (
+acpi_ut_report_warning (
        NATIVE_CHAR             *module_name,
        u32                     line_number,
        u32                     component_id)
@@ -1017,7 +1085,7 @@ _report_warning (
 
 /*******************************************************************************
  *
- * FUNCTION:    _Report_info
+ * FUNCTION:    Acpi_ut_report_info
  *
  * PARAMETERS:  Module_name         - Caller's module name (for error output)
  *              Line_number         - Caller's line number (for error output)
@@ -1031,7 +1099,7 @@ _report_warning (
  ******************************************************************************/
 
 void
-_report_info (
+acpi_ut_report_info (
        NATIVE_CHAR             *module_name,
        u32                     line_number,
        u32                     component_id)
index 70d4ddfe9ca92012739497f8f751692f9422cbc4..c413eb8228b36942be104624cdffbbf6ef63ae33 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: utobject - ACPI object create/delete/size/cache routines
- *              $Revision: 46 $
+ *              $Revision: 55 $
  *
  *****************************************************************************/
 
@@ -37,7 +37,7 @@
 
 /*******************************************************************************
  *
- * FUNCTION:    _Ut_create_internal_object
+ * FUNCTION:    Acpi_ut_create_internal_object_dbg
  *
  * PARAMETERS:  Address             - Address of the memory to deallocate
  *              Component           - Component type of caller
  *
  ******************************************************************************/
 
-ACPI_OPERAND_OBJECT  *
-_ut_create_internal_object (
+acpi_operand_object  *
+acpi_ut_create_internal_object_dbg (
        NATIVE_CHAR             *module_name,
        u32                     line_number,
        u32                     component_id,
-       ACPI_OBJECT_TYPE8       type)
+       acpi_object_type8       type)
 {
-       ACPI_OPERAND_OBJECT     *object;
+       acpi_operand_object     *object;
+
+
+       FUNCTION_TRACE_STR ("Ut_create_internal_object_dbg", acpi_ut_get_type_name (type));
 
 
        /* Allocate the raw object descriptor */
 
-       object = _ut_allocate_object_desc (module_name, line_number, component_id);
+       object = acpi_ut_allocate_object_desc_dbg (module_name, line_number, component_id);
        if (!object) {
                /* Allocation failure */
 
-               return (NULL);
+               return_PTR (NULL);
        }
 
        /* Save the object type in the object descriptor */
@@ -86,8 +89,7 @@ _ut_create_internal_object (
 
        /* Any per-type initialization should go here */
 
-
-       return (object);
+       return_PTR (object);
 }
 
 
@@ -97,7 +99,7 @@ _ut_create_internal_object (
  *
  * PARAMETERS:  Operand             - Object to be validated
  *
- * RETURN:      Validate a pointer to be an ACPI_OPERAND_OBJECT
+ * RETURN:      Validate a pointer to be an acpi_operand_object
  *
  ******************************************************************************/
 
@@ -112,12 +114,15 @@ acpi_ut_valid_internal_object (
        /* Check for a null pointer */
 
        if (!object) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+                       "**** Null Object Ptr\n"));
                return (FALSE);
        }
 
        /* Check for a pointer within one of the ACPI tables */
 
        if (acpi_tb_system_table_pointer (object)) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Object %p is a Pcode Ptr\n", object));
                return (FALSE);
        }
 
@@ -126,14 +131,26 @@ acpi_ut_valid_internal_object (
        if (!VALID_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_INTERNAL)) {
                /* Not an ACPI internal object, do some further checking */
 
+               if (VALID_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_NAMED)) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+                               "**** Obj %p is a named obj, not ACPI obj\n", object));
+               }
 
+               else if (VALID_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_PARSER)) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+                               "**** Obj %p is a parser obj, not ACPI obj\n", object));
+               }
 
+               else {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+                               "**** Obj %p is of unknown type\n", object));
+               }
 
                return (FALSE);
        }
 
 
-       /* The object appears to be a valid ACPI_OPERAND_OBJECT  */
+       /* The object appears to be a valid acpi_operand_object  */
 
        return (TRUE);
 }
@@ -141,7 +158,7 @@ acpi_ut_valid_internal_object (
 
 /*******************************************************************************
  *
- * FUNCTION:    _Ut_allocate_object_desc
+ * FUNCTION:    Acpi_ut_allocate_object_desc_dbg
  *
  * PARAMETERS:  Module_name         - Caller's module name (for error output)
  *              Line_number         - Caller's line number (for error output)
@@ -156,61 +173,34 @@ acpi_ut_valid_internal_object (
  ******************************************************************************/
 
 void *
-_ut_allocate_object_desc (
+acpi_ut_allocate_object_desc_dbg (
        NATIVE_CHAR             *module_name,
        u32                     line_number,
        u32                     component_id)
 {
-       ACPI_OPERAND_OBJECT     *object;
-
-
-       acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
-
-       acpi_gbl_object_cache_requests++;
+       acpi_operand_object     *object;
 
-       /* Check the cache first */
 
-       if (acpi_gbl_object_cache) {
-               /* There is an object available, use it */
+       FUNCTION_TRACE ("Ut_allocate_object_desc_dbg");
 
-               object = acpi_gbl_object_cache;
-               acpi_gbl_object_cache = object->cache.next;
-               object->cache.next = NULL;
 
-               acpi_gbl_object_cache_hits++;
-               acpi_gbl_object_cache_depth--;
+       object = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_OPERAND);
+       if (!object) {
+               _REPORT_ERROR (module_name, line_number, component_id,
+                                 ("Could not allocate an object descriptor\n"));
 
-               acpi_ut_release_mutex (ACPI_MTX_CACHES);
+               return_PTR (NULL);
        }
 
-       else {
-               /* The cache is empty, create a new object */
-
-               acpi_ut_release_mutex (ACPI_MTX_CACHES);
-
-               /* Attempt to allocate new descriptor */
-
-               object = _ut_callocate (sizeof (ACPI_OPERAND_OBJECT), component_id,
-                                 module_name, line_number);
-               if (!object) {
-                       /* Allocation failed */
-
-                       _REPORT_ERROR (module_name, line_number, component_id,
-                                         ("Could not allocate an object descriptor\n"));
-
-                       return (NULL);
-               }
-
-               /* Memory allocation metrics - compiled out in non debug mode. */
-
-               INCREMENT_OBJECT_METRICS (sizeof (ACPI_OPERAND_OBJECT));
-       }
 
        /* Mark the descriptor type */
 
        object->common.data_type = ACPI_DESC_TYPE_INTERNAL;
 
-       return (object);
+       ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p Size %X\n",
+                       object, sizeof (acpi_operand_object)));
+
+       return_PTR (object);
 }
 
 
@@ -228,52 +218,22 @@ _ut_allocate_object_desc (
 
 void
 acpi_ut_delete_object_desc (
-       ACPI_OPERAND_OBJECT     *object)
+       acpi_operand_object     *object)
 {
+       FUNCTION_TRACE_PTR ("Ut_delete_object_desc", object);
 
 
-       /* Make sure that the object isn't already in the cache */
-
-       if (object->common.data_type == (ACPI_DESC_TYPE_INTERNAL | ACPI_CACHED_OBJECT)) {
-               return;
-       }
-
-       /* Object must be an ACPI_OPERAND_OBJECT  */
+       /* Object must be an acpi_operand_object  */
 
        if (object->common.data_type != ACPI_DESC_TYPE_INTERNAL) {
-               return;
-       }
-
-
-       /* If cache is full, just free this object */
-
-       if (acpi_gbl_object_cache_depth >= MAX_OBJECT_CACHE_DEPTH) {
-               /*
-                * Memory allocation metrics.  Call the macro here since we only
-                * care about dynamically allocated objects.
-                */
-               DECREMENT_OBJECT_METRICS (sizeof (ACPI_OPERAND_OBJECT));
-
-               acpi_ut_free (object);
-               return;
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                       "Obj %p is not an ACPI object\n", object));
+               return_VOID;
        }
 
-       acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
-
-       /* Clear the entire object.  This is important! */
-
-       MEMSET (object, 0, sizeof (ACPI_OPERAND_OBJECT));
-       object->common.data_type = ACPI_DESC_TYPE_INTERNAL | ACPI_CACHED_OBJECT;
-
-       /* Put the object at the head of the global cache list */
+       acpi_ut_release_to_cache (ACPI_MEM_LIST_OPERAND, object);
 
-       object->cache.next = acpi_gbl_object_cache;
-       acpi_gbl_object_cache = object;
-       acpi_gbl_object_cache_depth++;
-
-
-       acpi_ut_release_mutex (ACPI_MTX_CACHES);
-       return;
+       return_VOID;
 }
 
 
@@ -294,77 +254,11 @@ void
 acpi_ut_delete_object_cache (
        void)
 {
-       ACPI_OPERAND_OBJECT     *next;
-
-
-       /* Traverse the global cache list */
-
-       while (acpi_gbl_object_cache) {
-               /* Delete one cached state object */
-
-               next = acpi_gbl_object_cache->cache.next;
-               acpi_gbl_object_cache->cache.next = NULL;
-
-               /*
-                * Memory allocation metrics.  Call the macro here since we only
-                * care about dynamically allocated objects.
-                */
-               DECREMENT_OBJECT_METRICS (sizeof (ACPI_OPERAND_OBJECT));
-
-               acpi_ut_free (acpi_gbl_object_cache);
-               acpi_gbl_object_cache = next;
-               acpi_gbl_object_cache_depth--;
-       }
-
-       return;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    Acpi_ut_init_static_object
- *
- * PARAMETERS:  Obj_desc            - Pointer to a "static" object - on stack
- *                                    or in the data segment.
- *
- * RETURN:      None.
- *
- * DESCRIPTION: Initialize a static object.  Sets flags to disallow dynamic
- *              deletion of the object.
- *
- ******************************************************************************/
-
-void
-acpi_ut_init_static_object (
-       ACPI_OPERAND_OBJECT     *obj_desc)
-{
-
-
-       if (!obj_desc) {
-               return;
-       }
-
-
-       /*
-        * Clear the entire descriptor
-        */
-       MEMSET ((void *) obj_desc, 0, sizeof (ACPI_OPERAND_OBJECT));
-
-
-       /*
-        * Initialize the header fields
-        * 1) This is an ACPI_OPERAND_OBJECT  descriptor
-        * 2) The size is the full object (worst case)
-        * 3) The flags field indicates static allocation
-        * 4) Reference count starts at one (not really necessary since the
-        *    object can't be deleted, but keeps everything sane)
-        */
+       FUNCTION_TRACE ("Ut_delete_object_cache");
 
-       obj_desc->common.data_type      = ACPI_DESC_TYPE_INTERNAL;
-       obj_desc->common.flags          = AOPOBJ_STATIC_ALLOCATION;
-       obj_desc->common.reference_count = 1;
 
-       return;
+       acpi_ut_delete_generic_cache (ACPI_MEM_LIST_OPERAND);
+       return_VOID;
 }
 
 
@@ -385,32 +279,35 @@ acpi_ut_init_static_object (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ut_get_simple_object_size (
-       ACPI_OPERAND_OBJECT     *internal_object,
+       acpi_operand_object     *internal_object,
        u32                     *obj_length)
 {
        u32                     length;
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+
+       FUNCTION_TRACE_PTR ("Ut_get_simple_object_size", internal_object);
 
 
        /* Handle a null object (Could be a uninitialized package element -- which is legal) */
 
        if (!internal_object) {
                *obj_length = 0;
-               return (AE_OK);
+               return_ACPI_STATUS (AE_OK);
        }
 
 
        /* Start with the length of the Acpi object */
 
-       length = sizeof (ACPI_OBJECT);
+       length = sizeof (acpi_object);
 
        if (VALID_DESCRIPTOR_TYPE (internal_object, ACPI_DESC_TYPE_NAMED)) {
                /* Object is a named object (reference), just return the length */
 
                *obj_length = (u32) ROUND_UP_TO_NATIVE_WORD (length);
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
 
@@ -452,6 +349,9 @@ acpi_ut_get_simple_object_size (
                 * this means an object reference
                 */
                if (internal_object->reference.opcode != AML_INT_NAMEPATH_OP) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                               "Unsupported Reference opcode=%X in object %p\n",
+                               internal_object->reference.opcode, internal_object));
                        status = AE_TYPE;
                }
 
@@ -467,6 +367,8 @@ acpi_ut_get_simple_object_size (
 
        default:
 
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported type=%X in object %p\n",
+                       internal_object->common.type, internal_object));
                status = AE_TYPE;
                break;
        }
@@ -480,7 +382,7 @@ acpi_ut_get_simple_object_size (
         */
        *obj_length = (u32) ROUND_UP_TO_NATIVE_WORD (length);
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -496,15 +398,15 @@ acpi_ut_get_simple_object_size (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ut_get_element_length (
        u8                      object_type,
-       ACPI_OPERAND_OBJECT     *source_object,
-       ACPI_GENERIC_STATE      *state,
+       acpi_operand_object     *source_object,
+       acpi_generic_state      *state,
        void                    *context)
 {
-       ACPI_STATUS             status = AE_OK;
-       ACPI_PKG_INFO           *info = (ACPI_PKG_INFO *) context;
+       acpi_status             status = AE_OK;
+       acpi_pkg_info           *info = (acpi_pkg_info *) context;
        u32                     object_space;
 
 
@@ -557,13 +459,16 @@ acpi_ut_get_element_length (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ut_get_package_object_size (
-       ACPI_OPERAND_OBJECT     *internal_object,
+       acpi_operand_object     *internal_object,
        u32                     *obj_length)
 {
-       ACPI_STATUS             status;
-       ACPI_PKG_INFO           info;
+       acpi_status             status;
+       acpi_pkg_info           info;
+
+
+       FUNCTION_TRACE_PTR ("Ut_get_package_object_size", internal_object);
 
 
        info.length      = 0;
@@ -578,13 +483,13 @@ acpi_ut_get_package_object_size (
         * just add the length of the package objects themselves.
         * Round up to the next machine word.
         */
-       info.length += ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)) *
+       info.length += ROUND_UP_TO_NATIVE_WORD (sizeof (acpi_object)) *
                          info.num_packages;
 
        /* Return the total package length */
 
        *obj_length = info.length;
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -602,12 +507,15 @@ acpi_ut_get_package_object_size (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ut_get_object_size(
-       ACPI_OPERAND_OBJECT     *internal_object,
+       acpi_operand_object     *internal_object,
        u32                     *obj_length)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_ENTRY ();
 
 
        if ((VALID_DESCRIPTOR_TYPE (internal_object, ACPI_DESC_TYPE_INTERNAL)) &&
index 55e73644e9dfebf253b687340c5e5b6cb418a84c..fb7cead9561445fc9cd445733899890f9806d112 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: utxface - External interfaces for "global" ACPI functions
- *              $Revision: 72 $
+ *              $Revision: 80 $
  *
  *****************************************************************************/
 
@@ -31,6 +31,7 @@
 #include "acinterp.h"
 #include "amlcode.h"
 #include "acdebug.h"
+#include "acexcep.h"
 
 
 #define _COMPONENT          ACPI_UTILITIES
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_initialize_subsystem (
        void)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+       FUNCTION_TRACE ("Acpi_initialize_subsystem");
+
+
+       DEBUG_EXEC(acpi_ut_init_stack_ptr_trace ());
 
 
        /* Initialize all globals used by the subsystem */
@@ -66,8 +72,8 @@ acpi_initialize_subsystem (
        status = acpi_os_initialize ();
        if (ACPI_FAILURE (status)) {
                REPORT_ERROR (("OSD failed to initialize, %s\n",
-                       acpi_ut_format_exception (status)));
-               return (status);
+                       acpi_format_exception (status)));
+               return_ACPI_STATUS (status);
        }
 
        /* Create the default mutex objects */
@@ -75,8 +81,8 @@ acpi_initialize_subsystem (
        status = acpi_ut_mutex_initialize ();
        if (ACPI_FAILURE (status)) {
                REPORT_ERROR (("Global mutex creation failure, %s\n",
-                       acpi_ut_format_exception (status)));
-               return (status);
+                       acpi_format_exception (status)));
+               return_ACPI_STATUS (status);
        }
 
        /*
@@ -87,8 +93,8 @@ acpi_initialize_subsystem (
        status = acpi_ns_root_initialize ();
        if (ACPI_FAILURE (status)) {
                REPORT_ERROR (("Namespace initialization failure, %s\n",
-                       acpi_ut_format_exception (status)));
-               return (status);
+                       acpi_format_exception (status)));
+               return_ACPI_STATUS (status);
        }
 
 
@@ -96,7 +102,7 @@ acpi_initialize_subsystem (
 
        DEBUGGER_EXEC (acpi_db_initialize ());
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -113,18 +119,21 @@ acpi_initialize_subsystem (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_enable_subsystem (
        u32                     flags)
 {
-       ACPI_STATUS             status = AE_OK;
+       acpi_status             status = AE_OK;
+
+
+       FUNCTION_TRACE ("Acpi_enable_subsystem");
 
 
        /* Sanity check the FADT for valid values */
 
        status = acpi_ut_validate_fadt ();
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /*
@@ -132,33 +141,37 @@ acpi_enable_subsystem (
         * installed unless other handlers have already been
         * installed via the Install_address_space_handler interface
         */
-
        if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Installing default address space handlers\n"));
+
                status = acpi_ev_install_default_address_space_handlers ();
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
        }
 
        /*
         * We must initialize the hardware before we can enable ACPI.
         */
-
        if (!(flags & ACPI_NO_HARDWARE_INIT)) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI hardware\n"));
+
                status = acpi_hw_initialize ();
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
        }
 
        /*
         * Enable ACPI on this platform
         */
-
        if (!(flags & ACPI_NO_ACPI_ENABLE)) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Going into ACPI mode\n"));
+
                status = acpi_enable ();
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Acpi_enable failed.\n"));
+                       return_ACPI_STATUS (status);
                }
        }
 
@@ -168,11 +181,12 @@ acpi_enable_subsystem (
         * ANY control methods SAFELY.  Any control method can require ACPI hardware
         * support, so the hardware MUST be initialized before execution!
         */
-
        if (!(flags & ACPI_NO_EVENT_INIT)) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI events\n"));
+
                status = acpi_ev_initialize ();
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
        }
 
@@ -181,11 +195,12 @@ acpi_enable_subsystem (
         * Initialize all device objects in the namespace
         * This runs the _STA and _INI methods.
         */
-
        if (!(flags & ACPI_NO_DEVICE_INIT)) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI Devices\n"));
+
                status = acpi_ns_initialize_devices ();
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
        }
 
@@ -195,16 +210,18 @@ acpi_enable_subsystem (
         * runs the executable AML that is part of the declaration of Op_regions
         * and Fields.
         */
-
        if (!(flags & ACPI_NO_OBJECT_INIT)) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI Objects\n"));
+
                status = acpi_ns_initialize_objects ();
                if (ACPI_FAILURE (status)) {
-                       return (status);
+                       return_ACPI_STATUS (status);
                }
        }
 
+       acpi_gbl_startup_flags |= ACPI_INITIALIZED_OK;
 
-       return (status);
+       return_ACPI_STATUS (status);
 }
 
 
@@ -220,17 +237,20 @@ acpi_enable_subsystem (
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_terminate (void)
 {
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Acpi_terminate");
 
 
        /* Ensure that ACPI has been initialized */
 
        ACPI_IS_INITIALIZATION_COMPLETE (status);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /* Terminate the AML Debugger if present */
@@ -255,7 +275,33 @@ acpi_terminate (void)
 
        acpi_os_terminate ();
 
-       return (AE_OK);
+       return_ACPI_STATUS (AE_OK);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION:    Acpi_subsystem_status
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Status of the ACPI subsystem
+ *
+ * DESCRIPTION: Other drivers that use the ACPI subsystem should call this
+ *              before making any other calls, to ensure the subsystem initial-
+ *              ized successfully.
+ *
+ ****************************************************************************/
+
+acpi_status
+acpi_subsystem_status (void)
+{
+       if (acpi_gbl_startup_flags & ACPI_INITIALIZED_OK) {
+               return (AE_OK);
+       }
+       else {
+               return (AE_ERROR);
+       }
 }
 
 
@@ -278,20 +324,23 @@ acpi_terminate (void)
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_get_system_info (
-       ACPI_BUFFER             *out_buffer)
+       acpi_buffer             *out_buffer)
 {
-       ACPI_SYSTEM_INFO        *info_ptr;
+       acpi_system_info        *info_ptr;
        u32                     i;
-       ACPI_STATUS             status;
+       acpi_status             status;
+
+
+       FUNCTION_TRACE ("Acpi_get_system_info");
 
 
        /* Ensure that ACPI has been initialized */
 
        ACPI_IS_INITIALIZATION_COMPLETE (status);
        if (ACPI_FAILURE (status)) {
-               return (status);
+               return_ACPI_STATUS (status);
        }
 
        /*
@@ -299,24 +348,24 @@ acpi_get_system_info (
         */
        if ((!out_buffer)         ||
                (!out_buffer->pointer)) {
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
-       if (out_buffer->length < sizeof (ACPI_SYSTEM_INFO)) {
+       if (out_buffer->length < sizeof (acpi_system_info)) {
                /*
                 *  Caller's buffer is too small
                 */
-               out_buffer->length = sizeof (ACPI_SYSTEM_INFO);
+               out_buffer->length = sizeof (acpi_system_info);
 
-               return (AE_BUFFER_OVERFLOW);
+               return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
        }
 
 
        /*
         *  Set return length and get data
         */
-       out_buffer->length = sizeof (ACPI_SYSTEM_INFO);
-       info_ptr = (ACPI_SYSTEM_INFO *) out_buffer->pointer;
+       out_buffer->length = sizeof (acpi_system_info);
+       info_ptr = (acpi_system_info *) out_buffer->pointer;
 
        info_ptr->acpi_ca_version   = ACPI_CA_VERSION;
 
@@ -352,125 +401,7 @@ acpi_get_system_info (
                info_ptr->table_info[i].count = acpi_gbl_acpi_tables[i].count;
        }
 
-       return (AE_OK);
-}
-
-
-/******************************************************************************
- *
- * FUNCTION:    Acpi_format_exception
- *
- * PARAMETERS:  Out_buffer      - a pointer to a buffer to receive the
- *                                exception name
- *
- * RETURN:      Status          - the status of the call
- *
- * DESCRIPTION: This function translates an ACPI exception into an ASCII string.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-acpi_format_exception (
-       ACPI_STATUS             exception,
-       ACPI_BUFFER             *out_buffer)
-{
-       u32                     length;
-       NATIVE_CHAR             *formatted_exception;
-
-
-       /*
-        *  Must have a valid buffer
-        */
-       if ((!out_buffer)         ||
-               (!out_buffer->pointer)) {
-               return (AE_BAD_PARAMETER);
-       }
-
-
-       /* Convert the exception code (Handles bad exception codes) */
-
-       formatted_exception = acpi_ut_format_exception (exception);
-
-       /*
-        * Get length of string and check if it will fit in caller's buffer
-        */
-
-       length = STRLEN (formatted_exception);
-       if (out_buffer->length < length) {
-               out_buffer->length = length;
-               return (AE_BUFFER_OVERFLOW);
-       }
-
-
-       /* Copy the string, all done */
-
-       STRCPY (out_buffer->pointer, formatted_exception);
-
-       return (AE_OK);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION:    Acpi_allocate
- *
- * PARAMETERS:  Size                - Size of the allocation
- *
- * RETURN:      Address of the allocated memory on success, NULL on failure.
- *
- * DESCRIPTION: The subsystem's equivalent of malloc.
- *              External front-end to the Ut* memory manager
- *
- ****************************************************************************/
-
-void *
-acpi_allocate (
-       u32                     size)
-{
-
-       return (acpi_ut_allocate (size));
+       return_ACPI_STATUS (AE_OK);
 }
 
 
-/*****************************************************************************
- *
- * FUNCTION:    Acpi_callocate
- *
- * PARAMETERS:  Size                - Size of the allocation
- *
- * RETURN:      Address of the allocated memory on success, NULL on failure.
- *
- * DESCRIPTION: The subsystem's equivalent of calloc.
- *              External front-end to the Ut* memory manager
- *
- ****************************************************************************/
-
-void *
-acpi_callocate (
-       u32                     size)
-{
-
-       return (acpi_ut_callocate (size));
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION:    Acpi_free
- *
- * PARAMETERS:  Address             - Address of the memory to deallocate
- *
- * RETURN:      None
- *
- * DESCRIPTION: Frees the memory at Address
- *              External front-end to the Ut* memory manager
- *
- ****************************************************************************/
-
-void
-acpi_free (
-       void                    *address)
-{
-
-       acpi_ut_free (address);
-}
index 5304c6536f6d7e18a9673da3c4ee53406b0c2973..3e93450f1131d11f8e889a766ee4d33006adfa0e 100644 (file)
@@ -1928,6 +1928,8 @@ static int __init firestream_init_one (struct pci_dev *pci_dev,
 
  err_out_free_atm_dev:
        atm_dev_deregister(atm_dev);
+ err_out_free_fs_dev:
+       kfree(fs_dev);
  err_out:
        return -ENODEV;
 }
index 4bf4286168b2efaed0bd6d228b19fc0bb95ee27c..5597c0b307e5a0dfee6456c426d14153873a5005 100644 (file)
@@ -417,12 +417,13 @@ static int initrd_release(struct inode *inode,struct file *file)
 {
        extern void free_initrd_mem(unsigned long, unsigned long);
 
+       lock_kernel();
        if (!--initrd_users) {
                free_initrd_mem(initrd_start, initrd_end);
                initrd_start = 0;
-               inode->i_bdev->bd_cache_openers--;
-               blkdev_put(inode->i_bdev, BDEV_FILE);
        }
+       unlock_kernel();
+       blkdev_put(inode->i_bdev, BDEV_FILE);
        return 0;
 }
 
@@ -457,7 +458,6 @@ static int rd_open(struct inode * inode, struct file * filp)
        if (rd_bdev[unit] == NULL) {
                rd_bdev[unit] = bdget(kdev_t_to_nr(inode->i_rdev));
                rd_bdev[unit]->bd_openers++;
-               rd_bdev[unit]->bd_cache_openers++;
                rd_bdev[unit]->bd_inode->i_mapping->a_ops = &ramdisk_aops;
        }
 
@@ -487,11 +487,8 @@ static void __exit rd_cleanup (void)
        for (i = 0 ; i < NUM_RAMDISKS; i++) {
                struct block_device *bdev = rd_bdev[i];
                rd_bdev[i] = NULL;
-               if (bdev) {
-                       bdev->bd_cache_openers--;
-                       truncate_inode_pages(bdev->bd_inode->i_mapping, 0);
+               if (bdev)
                        blkdev_put(bdev, BDEV_FILE);
-               }
                destroy_buffers(MKDEV(MAJOR_NR, i));
        }
 
index abacfcfabcce8043556d80da2a01c447a88f4ef3..eb8401374151e54c6d4f66ee1041903bff92ad24 100644 (file)
@@ -208,7 +208,7 @@ if [ "$CONFIG_AGP" != "n" ]; then
    bool '  Intel 440LX/BX/GX and I815/I840/I850 support' CONFIG_AGP_INTEL
    bool '  Intel I810/I815 (on-board) support' CONFIG_AGP_I810
    bool '  VIA chipset support' CONFIG_AGP_VIA
-   bool '  AMD Irongate and 761 support' CONFIG_AGP_AMD
+   bool '  AMD Irongate, 761, and 762 support' CONFIG_AGP_AMD
    bool '  Generic SiS support' CONFIG_AGP_SIS
    bool '  ALI chipset support' CONFIG_AGP_ALI
    bool '  Serverworks LE/HE support' CONFIG_AGP_SWORKS
index c667fb759d23ac8167a206fb5f77786557dcfd72..61e66d736a71c00b609dca207f8994083233c73d 100644 (file)
@@ -202,6 +202,9 @@ struct agp_bridge_data {
 #ifndef PCI_DEVICE_ID_AMD_IRONGATE_0
 #define PCI_DEVICE_ID_AMD_IRONGATE_0    0x7006
 #endif
+#ifndef PCI_DEVICE_ID_AMD_761_0
+#define PCI_DEVICE_ID_AMD_761_0         0x700e
+#endif
 #ifndef PCI_DEVICE_ID_AMD_762_0
 #define PCI_DEVICE_ID_AMD_762_0                0x700C
 #endif
index 077a109478f04209708d79631dbeacd27cf91356..641395c8b00725888491296de6a5e0ebece812df 100644 (file)
@@ -388,8 +388,8 @@ int agp_unbind_memory(agp_memory * curr)
  * Driver routines - start
  * Currently this module supports the following chipsets:
  * i810, i815, 440lx, 440bx, 440gx, i840, i850, via vp3, via mvp3,
- * via kx133, via kt133, amd irongate, amd 761, ALi M1541, and generic
- * support for the SiS chipsets.
+ * via kx133, via kt133, amd irongate, amd 761, amd 762, ALi M1541,
+ * and generic support for the SiS chipsets.
  */
 
 /* Generic Agp routines - Start */
@@ -2931,9 +2931,15 @@ static struct {
                "AMD",
                "Irongate",
                amd_irongate_setup },
+       { PCI_DEVICE_ID_AMD_761_0,
+               PCI_VENDOR_ID_AMD,
+               AMD_761,
+               "AMD",
+               "761",
+               amd_irongate_setup },
        { PCI_DEVICE_ID_AMD_762_0,
                PCI_VENDOR_ID_AMD,
-               AMD_IRONGATE,
+               AMD_762,
                "AMD",
                "AMD 760MP",
                amd_irongate_setup },
index bbdf1d70983fd918df22abf3d7cd97d403faf391..9f23df75a314d938690889dfc9cc4c8c655a6769 100644 (file)
@@ -315,7 +315,6 @@ static void __init probedisk(int major, int minor,int device)
                if (gd!=NULL) {
                        for (j=1+(minor<<gd->minor_shift);j<((minor+1)<<gd->minor_shift);j++) 
                                gd->part[j].nr_sects=0;                                 
-                       put_gendisk(gd);
                }
         }
        raid[device].disk[i].device = MKDEV(major,minor);
index f21fda755a5f8474cc1934578477c27f35592032..78f3174a5f305529d8f14a78f5a007b576917524 100644 (file)
@@ -321,7 +321,6 @@ static void __init probedisk(int major, int minor,int device)
                                if (gd!=NULL) {
                                        for (j=1+(minor<<gd->minor_shift);j<((minor+1)<<gd->minor_shift);j++) 
                                                gd->part[j].nr_sects=0;                                 
-                                       put_gendisk(gd);
                                }
                        }
                        raid[device].disk[i].device = MKDEV(major,minor);
index 1b0d8a5d99a82511fb5704f80df1d7508149c21c..c01376a249059cbd892068fac77db4831116134d 100644 (file)
@@ -945,9 +945,9 @@ static struct pci_driver toshoboe_pci_driver = {
 };
 
 int __init
-toshoboe_init (void) {
-  pci_module_init(&toshoboe_pci_driver);
-  return 0;
+toshoboe_init (void)
+{
+  return pci_module_init(&toshoboe_pci_driver);
 }
 
 void
index e5c8ec12021901a538ae9f42d726a156c9c3e4aa..b2392d1a8f4033587ef63f8e7869b00ca364d83f 100644 (file)
@@ -3602,7 +3602,12 @@ static struct pci_driver maestro_pci_driver = {
 
 int __init init_maestro(void)
 {
-       pci_module_init(&maestro_pci_driver);
+       int rc;
+
+       rc = pci_module_init(&maestro_pci_driver);
+       if (rc < 0)
+               return rc;
+
        if (register_reboot_notifier(&maestro_nb))
                printk(KERN_WARNING "maestro: reboot notifier registration failed; may not reboot properly.\n");
 #ifdef MODULE
index f46987e78c266f839c81b18e826f644f888d2d11..d3d75bed75635444cde8e729e1e2d0654cefe675 100644 (file)
 #include <linux/module.h>
 #include "CDCEther.h"
 
-static const char *version = __FILE__ ": v0.98.4 4 July 2001 Brad Hards and another";
+static const char *version = __FILE__ ": v0.98.5 22 Sep 2001 Brad Hards and another";
 
-// We will attempt to probe anything that is in the
-// communication device class...
-// We will sort through them later.
+/* We need to be selective about what we try to match on, to avoiding loading for a CDC
+ * ACM (ISDN or PSTN) modem */
 static struct usb_device_id CDCEther_ids[] = {
-       { USB_DEVICE_INFO(2, 0, 0) },
-       { }
+        { match_flags: (USB_DEVICE_ID_MATCH_INT_CLASS | USB_DEVICE_ID_MATCH_INT_SUBCLASS),
+          bInterfaceClass: USB_CLASS_COMM, bInterfaceSubClass: 6},
+        { } /* Terminating null entry */
 };
 
+/* 
+ * module parameter that provides an alternate upper limit on the 
+ * number of multicast filters we use, with a default to use all
+ * the filters available to us. Note that the actual number used
+ * is the lesser of this parameter and the number returned in the
+ * descriptor for the particular device. See Table 41 of the CDC
+ * spec for more info on the descriptor limit.
+ */
+static int multicast_filter_limit = 32767;
+
+
 //////////////////////////////////////////////////////////////////////////////
 // Callback routines from USB device /////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////////
@@ -409,32 +420,83 @@ static int CDCEther_ioctl( struct net_device *net, struct ifreq *rq, int cmd )
        }
 }
 
+static void CDC_SetEthernetPacketFilter (ether_dev_t *ether_dev)
+{
+       usb_control_msg(ether_dev->usb,
+                       usb_sndctrlpipe(ether_dev->usb, 0),
+                       SET_ETHERNET_PACKET_FILTER, /* request */
+                       USB_TYPE_CLASS | USB_DIR_OUT | USB_RECIP_INTERFACE, /* request type */
+                       cpu_to_le16(ether_dev->mode_flags), /* value */
+                       cpu_to_le16((u16)ether_dev->comm_interface), /* index */
+                       NULL,
+                       0, /* size */
+                       HZ); /* timeout */
+}      
+
+
 static void CDCEther_set_multicast( struct net_device *net )
 {
        ether_dev_t *ether_dev = net->priv;
+       int i;
+       __u8 *buff;
+       
 
        // Tell the kernel to stop sending us frames while we get this
        // all set up.
        netif_stop_queue(net);
 
-       // Do what we are told.
-       if (net->flags & IFF_PROMISC) {
-               // TODO - Turn on promiscuous mode
-               info( "%s: Promiscuous mode enabled", net->name);
-       } else if (net->flags & IFF_ALLMULTI){
-               // TODO - Here we need to tell the device to block ALL multicast traffic.
-               info("%s: set allmulti", net->name);
-       } else if (net->mc_count > ether_dev->wNumberMCFilters) {
-               // TODO - Here we need to set multicast filters, but
-               // There are more than our limit...  Hmm...
-               info("%s: set too many MC filters", net->name);
-       } else {
-               // TODO - Here we are supposed to set SOME of the multicast filters.
-               // I must learn how to do this...
-               //info("%s: set Rx mode", net->name);
+      /* Note: do not reorder, GCC is clever about common statements. */
+        if (net->flags & IFF_PROMISC) {
+                /* Unconditionally log net taps. */
+                info( "%s: Promiscuous mode enabled", net->name);
+               ether_dev->mode_flags = MODE_FLAG_PROMISCUOUS |
+                       MODE_FLAG_ALL_MULTICAST |
+                       MODE_FLAG_DIRECTED |
+                       MODE_FLAG_BROADCAST |
+                       MODE_FLAG_MULTICAST;
+        } else if (net->mc_count > ether_dev->wNumberMCFilters) {
+                /* Too many to filter perfectly -- accept all multicasts. */
+               info("%s: set too many MC filters, using allmulti", net->name);
+               ether_dev->mode_flags = MODE_FLAG_ALL_MULTICAST |
+                       MODE_FLAG_DIRECTED |
+                       MODE_FLAG_BROADCAST |
+                       MODE_FLAG_MULTICAST;
+       } else if (net->flags & IFF_ALLMULTI) {
+                /* Filter in software */
+               info("%s: using allmulti", net->name);
+               ether_dev->mode_flags = MODE_FLAG_ALL_MULTICAST |
+                       MODE_FLAG_DIRECTED |
+                       MODE_FLAG_BROADCAST |
+                       MODE_FLAG_MULTICAST;
+        } else {
+               /* do multicast filtering in hardware */
+                struct dev_mc_list *mclist;
+               info("%s: set multicast filters", net->name);
+               ether_dev->mode_flags = MODE_FLAG_ALL_MULTICAST |
+                       MODE_FLAG_DIRECTED |
+                       MODE_FLAG_BROADCAST |
+                       MODE_FLAG_MULTICAST;
+               buff = kmalloc(6 * net->mc_count, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
+                for (i = 0, mclist = net->mc_list;
+                    mclist && i < net->mc_count;
+                     i++, mclist = mclist->next) {
+                       memcpy(&mclist->dmi_addr, &buff[i * 6], 6);
+               }
+               usb_control_msg(ether_dev->usb,
+                               usb_sndctrlpipe(ether_dev->usb, 0),
+                               SET_ETHERNET_MULTICAST_FILTER, /* request */
+                               USB_TYPE_CLASS | USB_DIR_OUT | USB_RECIP_INTERFACE, /* request type */
+                               cpu_to_le16(net->mc_count), /* value */
+                               cpu_to_le16((u16)ether_dev->comm_interface), /* index */
+                               buff,
+                               (6* net->mc_count), /* size */
+                               HZ); /* timeout */
+               kfree(buff);
        }
-
-       // Tell the kernel to start giving frames to us again.
+       CDC_SetEthernetPacketFilter(ether_dev);
+       
+        // Tell the kernel to start giving frames to us again.
        netif_wake_queue(net);
 }
 
@@ -545,6 +607,9 @@ static int parse_ethernet_functional_descriptor( int *bFunctionLength,
        ether_dev->bmEthernetStatistics = data[1] + (data[2] << 8) + (data[3] << 16) + (data[4] << 24);
        ether_dev->wMaxSegmentSize = data[5] + (data[6] << 8);
        ether_dev->wNumberMCFilters = (data[7] + (data[8] << 8)) & 0x00007FFF;
+       if (ether_dev->wNumberMCFilters > multicast_filter_limit) {
+               ether_dev->wNumberMCFilters = multicast_filter_limit;
+               }       
        ether_dev->bNumberPowerFilters = data[9];
        
        // We've seen one of these now.
@@ -1273,6 +1338,9 @@ MODULE_AUTHOR("Brad Hards and another");
 MODULE_DESCRIPTION("USB CDC Ethernet driver");
 MODULE_LICENSE("GPL");
 
+MODULE_PARM (multicast_filter_limit, "i");
+MODULE_PARM_DESC (multicast_filter_limit, "CDCEther maximum number of filtered multicast addresses");
+
 MODULE_DEVICE_TABLE (usb, CDCEther_ids);
 
 //////////////////////////////////////////////////////////////////////////////
index 632ab496fdd1bfb7e63b2ea2c634d4d5abd03d6a..068a0147b635988301724cbcc23b7f9f10b345f1 100644 (file)
 #define        CDC_ETHER_REQ_SET_REG   PIPERIDER_REQ_SET_REGS
 #define        ALIGN(x)                x __attribute__((aligned(L1_CACHE_BYTES)))
 
+#define MODE_FLAG_PROMISCUOUS   (1<<0)
+#define MODE_FLAG_ALL_MULTICAST (1<<1)
+#define MODE_FLAG_DIRECTED      (1<<2)
+#define MODE_FLAG_BROADCAST     (1<<3)
+#define MODE_FLAG_MULTICAST     (1<<4)
+
+#define SET_ETHERNET_MULTICAST_FILTER    0x40
+#define SET_ETHERNET_PACKET_FILTER       0x43
+
 typedef struct _ether_dev_t {
        struct usb_device       *usb;
        struct net_device       *net;
@@ -70,6 +79,7 @@ typedef struct _ether_dev_t {
        __u8                    iMACAddress;
        __u32                   bmEthernetStatistics;
        __u16                   wMaxSegmentSize;
+       __u16                   mode_flags;
        __u16                   wNumberMCFilters;
        __u8                    bNumberPowerFilters;
        int                     intr_interval;
index 2ff7a9d288febc6b606b9cf51432d1207e18e64b..23b4f532e518f1021ab0199f5d5616172cd2d006 100644 (file)
@@ -71,6 +71,7 @@ comment 'USB Controllers'
    comment 'USB Network adaptors'
    dep_tristate '  USB ADMtek Pegasus-based ethernet device support (EXPERIMENTAL)' CONFIG_USB_PEGASUS $CONFIG_USB $CONFIG_NET $CONFIG_EXPERIMENTAL
    dep_tristate '  USB CATC NetMate-based Ethernet driver (EXPERIMENTAL)' CONFIG_USB_CATC $CONFIG_USB $CONFIG_NET $CONFIG_EXPERIMENTAL
+   dep_tristate '  USB CDC Ethernet class (USB cable modem) support (EXPERIMENTAL)' CONFIG_USB_CDCETHER $CONFIG_USB $CONFIG_NET $CONFIG_EXPERIMENTAL
    dep_tristate '  USB KLSI KL5USB101-based ethernet device support (EXPERIMENTAL)' CONFIG_USB_KAWETH $CONFIG_USB $CONFIG_NET $CONFIG_EXPERIMENTAL
    dep_tristate '  USB-to-USB Networking (NetChip, Prolific, ...) (EXPERIMENTAL)' CONFIG_USB_USBNET $CONFIG_USB $CONFIG_NET $CONFIG_EXPERIMENTAL
 
index 7a2cfcb0d377db49ee153d4bd9c405952227960a..d8ac33f885454c57a2ebad180fcb7f2d2c4f35b3 100644 (file)
@@ -70,6 +70,7 @@ obj-$(CONFIG_USB_SE401)               += se401.o
 obj-$(CONFIG_USB_PEGASUS)      += pegasus.o
 obj-$(CONFIG_USB_CATC)         += catc.o
 obj-$(CONFIG_USB_KAWETH)        += kaweth.o
+obj-$(CONFIG_USB_CDCETHER)     += CDCEther.o
 obj-$(CONFIG_USB_RIO500)       += rio500.o
 obj-$(CONFIG_USB_DSBR)         += dsbr100.o
 obj-$(CONFIG_USB_MICROTEK)     += microtek.o
index 0ef220eb1986002d7b68456ba5b0025e41e731e2..b1455e1848945652ef438263d80b2d1bacba65ae 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * acm.c  Version 0.19
+ * acm.c  Version 0.20
  *
  * Copyright (c) 1999 Armin Fuerst     <fuerst@in.tum.de>
  * Copyright (c) 1999 Pavel Machek     <pavel@suse.cz>
@@ -22,6 +22,7 @@
  *     v0.17 - added new style probing
  *     v0.18 - fixed new style probing for devices with more configurations
  *     v0.19 - fixed CLOCAL handling (thanks to Richard Shih-Ping Chan)
+ *      v0.20 - switched to probing on interface (rather than device) class
  */
 
 /*
@@ -59,7 +60,7 @@
 /*
  * Version Information
  */
-#define DRIVER_VERSION "v0.18"
+#define DRIVER_VERSION "v0.20"
 #define DRIVER_AUTHOR "Armin Fuerst, Pavel Machek, Johannes Erdfelt, Vojtech Pavlik"
 #define DRIVER_DESC "USB Abstract Control Model driver for USB modems and ISDN adapters"
 
@@ -647,7 +648,8 @@ static void acm_disconnect(struct usb_device *dev, void *ptr)
  */
 
 static struct usb_device_id acm_ids[] = {
-       { USB_DEVICE_INFO(2, 0, 0) },
+       {match_flags: (USB_DEVICE_ID_MATCH_INT_CLASS | USB_DEVICE_ID_MATCH_INT_SUBCLASS),
+       bInterfaceClass: USB_CLASS_COMM, bInterfaceSubClass: 2},
        { }
 };
 
index b2d374ec457bfba543621f59d85c1c72a722d3ef..871666e8d236fb4492c454d92810c74675989685 100644 (file)
@@ -397,20 +397,6 @@ static DECLARE_FSTYPE(bd_type, "bdev", bd_read_super, FS_NOMOUNT);
 
 static struct vfsmount *bd_mnt;
 
-static int get_inode(struct block_device *bdev)
-{
-       if (!bdev->bd_inode) {
-               struct inode *inode = new_inode(bd_mnt->mnt_sb);
-               if (!inode)
-                       return -ENOMEM;
-               inode->i_rdev = to_kdev_t(bdev->bd_dev);
-               inode->i_bdev = bdev;
-               inode->i_data.a_ops = &def_blk_aops;
-               bdev->bd_inode = inode;
-       }
-       return 0;
-}
-
 /*
  * bdev cache handling - shamelessly stolen from inode.c
  * We use smaller hashtable, though.
@@ -502,40 +488,50 @@ struct block_device *bdget(dev_t dev)
        if (bdev)
                return bdev;
        new_bdev = alloc_bdev();
-       if (!new_bdev)
-               return NULL;
-       atomic_set(&new_bdev->bd_count,1);
-       new_bdev->bd_dev = dev;
-       new_bdev->bd_op = NULL;
-       new_bdev->bd_inode = NULL;
-       spin_lock(&bdev_lock);
-       bdev = bdfind(dev, head);
-       if (!bdev) {
-               list_add(&new_bdev->bd_hash, head);
-               spin_unlock(&bdev_lock);
-               return new_bdev;
+       if (new_bdev) {
+               struct inode *inode = new_inode(bd_mnt->mnt_sb);
+               if (inode) {
+                       atomic_set(&new_bdev->bd_count,1);
+                       new_bdev->bd_dev = dev;
+                       new_bdev->bd_op = NULL;
+                       new_bdev->bd_inode = inode;
+                       inode->i_rdev = to_kdev_t(dev);
+                       inode->i_bdev = new_bdev;
+                       inode->i_data.a_ops = &def_blk_aops;
+                       spin_lock(&bdev_lock);
+                       bdev = bdfind(dev, head);
+                       if (!bdev) {
+                               list_add(&new_bdev->bd_hash, head);
+                               spin_unlock(&bdev_lock);
+                               return new_bdev;
+                       }
+                       spin_unlock(&bdev_lock);
+                       iput(new_bdev->bd_inode);
+               }
+               destroy_bdev(new_bdev);
        }
-       spin_unlock(&bdev_lock);
-       destroy_bdev(new_bdev);
        return bdev;
 }
 
+static inline void __bd_forget(struct inode *inode)
+{
+       list_del_init(&inode->i_devices);
+       inode->i_bdev = NULL;
+       inode->i_mapping = &inode->i_data;
+}
+
 void bdput(struct block_device *bdev)
 {
        if (atomic_dec_and_lock(&bdev->bd_count, &bdev_lock)) {
                struct list_head *p;
                if (bdev->bd_openers)
                        BUG();
-               if (bdev->bd_cache_openers)
-                       BUG();
                list_del(&bdev->bd_hash);
                while ( (p = bdev->bd_inodes.next) != &bdev->bd_inodes ) {
-                       struct inode *inode;
-                       inode = list_entry(p, struct inode, i_devices);
-                       list_del_init(p);
-                       inode->i_bdev = NULL;
+                       __bd_forget(list_entry(p, struct inode, i_devices));
                }
                spin_unlock(&bdev_lock);
+               iput(bdev->bd_inode);
                destroy_bdev(bdev);
        }
 }
@@ -556,6 +552,7 @@ int bd_acquire(struct inode *inode)
        spin_lock(&bdev_lock);
        if (!inode->i_bdev) {
                inode->i_bdev = bdev;
+               inode->i_mapping = bdev->bd_inode->i_mapping;
                list_add(&inode->i_devices, &bdev->bd_inodes);
        } else if (inode->i_bdev != bdev)
                BUG();
@@ -568,10 +565,8 @@ int bd_acquire(struct inode *inode)
 void bd_forget(struct inode *inode)
 {
        spin_lock(&bdev_lock);
-       if (inode->i_bdev) {
-               list_del_init(&inode->i_devices);
-               inode->i_bdev = NULL;
-       }
+       if (inode->i_bdev)
+               __bd_forget(inode);
        spin_unlock(&bdev_lock);
 }
 
@@ -711,11 +706,6 @@ int blkdev_get(struct block_device *bdev, mode_t mode, unsigned flags, int kind)
        kdev_t rdev = to_kdev_t(bdev->bd_dev); /* this should become bdev */
        down(&bdev->bd_sem);
 
-       if (get_inode(bdev)) {
-               up(&bdev->bd_sem);
-               return -ENOMEM;
-       }
-
        lock_kernel();
        if (!bdev->bd_op)
                bdev->bd_op = get_blkfops(MAJOR(rdev));
@@ -738,12 +728,8 @@ int blkdev_get(struct block_device *bdev, mode_t mode, unsigned flags, int kind)
                        ret = bdev->bd_op->open(bdev->bd_inode, &fake_file);
                if (!ret) {
                        bdev->bd_openers++;
-               } else if (!bdev->bd_openers) {
-                       struct inode *bd_inode = bdev->bd_inode;
+               } else if (!bdev->bd_openers)
                        bdev->bd_op = NULL;
-                       bdev->bd_inode = NULL;
-                       iput(bd_inode);
-               }
        }
        unlock_kernel();
        up(&bdev->bd_sem);
@@ -769,10 +755,6 @@ int blkdev_open(struct inode * inode, struct file * filp)
        bdev = inode->i_bdev;
        down(&bdev->bd_sem);
 
-       ret = get_inode(bdev);
-       if (ret)
-               goto out;
-
        ret = -ENXIO;
        lock_kernel();
        if (!bdev->bd_op)
@@ -781,20 +763,12 @@ int blkdev_open(struct inode * inode, struct file * filp)
                ret = 0;
                if (bdev->bd_op->open)
                        ret = bdev->bd_op->open(inode,filp);
-               if (!ret) {
+               if (!ret)
                        bdev->bd_openers++;
-                       bdev->bd_cache_openers++;
-                       inode->i_mapping = bdev->bd_inode->i_mapping;
-                       inode->i_mapping_overload++;
-               } else if (!bdev->bd_openers) {
-                       struct inode *bd_inode = bdev->bd_inode;
+               else if (!bdev->bd_openers)
                        bdev->bd_op = NULL;
-                       bdev->bd_inode = NULL;
-                       iput(bd_inode);
-               }
        }       
        unlock_kernel();
-out:
        up(&bdev->bd_sem);
        if (ret)
                bdput(bdev);
@@ -809,92 +783,46 @@ int blkdev_put(struct block_device *bdev, int kind)
 
        down(&bdev->bd_sem);
        lock_kernel();
-       if (kind == BDEV_FILE)
-               __block_fsync(bd_inode);
-       else if (kind == BDEV_FS)
-               fsync_no_super(rdev);
-       /* only filesystems uses buffer cache for the metadata these days */
-       if (kind == BDEV_FS)
-               invalidate_buffers(rdev);
-       if (bdev->bd_op->release)
-               ret = bdev->bd_op->release(bd_inode, NULL);
-       if (!--bdev->bd_openers) {
-               bdev->bd_op = NULL;
-               bdev->bd_inode = NULL;
-               iput(bd_inode);
-       }
-       unlock_kernel();
-       up(&bdev->bd_sem);
-       bdput(bdev);
-       return ret;
-}
-
-int blkdev_close(struct inode * inode, struct file * filp)
-{
-       struct block_device *bdev = inode->i_bdev;
-       int ret = 0;
-       struct inode * bd_inode = bdev->bd_inode;
-
-       down(&bdev->bd_sem);
-       lock_kernel();
-       /* cache coherency protocol */
-       if (!--bdev->bd_cache_openers) {
+       if (kind == BDEV_FILE) {
                struct super_block * sb;
 
-               /* flush the pagecache to disk */
                __block_fsync(bd_inode);
-               /* drop the pagecache, uptodate info is on disk by now */
-               truncate_inode_pages(inode->i_mapping, 0);
 
-               /* if the fs was mounted ro just throw away most of its caches */
-               sb = get_super(inode->i_rdev);
+               /* Janitorianism: this shit must go away */
+               sb = get_super(bd_inode->i_rdev);
                if (sb) {
                        if (sb->s_flags & MS_RDONLY) {
-                               /*
-                                * This call is not destructive in terms of
-                                * dirty cache, so it is safe to run it
-                                * even if the fs gets mounted read write
-                                * under us.
-                                */
-                               invalidate_device(inode->i_rdev, 0);
+                               shrink_dcache_sb(sb);
+                               invalidate_inodes(sb);
+                               invalidate_buffers(bd_inode->i_rdev);
                        }
-
-                       /*
-                        * Now only if an underlying fs is mounted ro we'll
-                        * try to refill its pinned buffer cache from disk.
-                        * The fs cannot go away under us because we hold
-                        * the read semaphore of the superblock, but
-                        * we must also serialize against ->remount_fs and
-                        * ->read_super callbacks to avoid MS_RDONLY to go
-                        * away under us.
-                        */
                        lock_super(sb);
                        if (sb->s_flags & MS_RDONLY)
-                               /* now refill the obsolete pinned buffers from disk */
-                               update_buffers(inode->i_rdev);
+                               update_buffers(bd_inode->i_rdev);
                        unlock_super(sb);
-
                        drop_super(sb);
                }
+       } else if (kind == BDEV_FS)
+               fsync_no_super(rdev);
+       if (!--bdev->bd_openers) {
+               truncate_inode_pages(bd_inode->i_mapping, 0);
+               invalidate_buffers(rdev);
        }
-       if (!--inode->i_mapping_overload)
-               inode->i_mapping = &inode->i_data;
-
-       /* release the device driver */
        if (bdev->bd_op->release)
-               ret = bdev->bd_op->release(inode, NULL);
-       if (!--bdev->bd_openers) {
+               ret = bdev->bd_op->release(bd_inode, NULL);
+       if (!bdev->bd_openers)
                bdev->bd_op = NULL;
-               bdev->bd_inode = NULL;
-               iput(bd_inode);
-       }
        unlock_kernel();
        up(&bdev->bd_sem);
        bdput(bdev);
-
        return ret;
 }
 
+int blkdev_close(struct inode * inode, struct file * filp)
+{
+       return blkdev_put(inode->i_bdev, BDEV_FILE);
+}
+
 static int blkdev_ioctl(struct inode *inode, struct file *file, unsigned cmd,
                        unsigned long arg)
 {
index 592851be615d5505190b95b43a240a20b974618f..5d5372f007abdf3b93d04448ea28b0928023e39f 100644 (file)
@@ -142,7 +142,7 @@ nlmclnt_proc(struct inode *inode, int cmd, struct file_lock *fl)
 
        /* If we're cleaning up locks because the process is exiting,
         * perform the RPC call asynchronously. */
-       if ((cmd == F_SETLK || cmd == F_SETLKW)
+       if ((IS_SETLK(cmd) || IS_SETLKW(cmd))
            && fl->fl_type == F_UNLCK
            && (current->flags & PF_EXITING)) {
                sigfillset(&current->blocked);  /* Mask all signals */
@@ -166,17 +166,16 @@ nlmclnt_proc(struct inode *inode, int cmd, struct file_lock *fl)
        /* Set up the argument struct */
        nlmclnt_setlockargs(call, fl);
 
-       if (cmd == F_GETLK) {
+       if (IS_SETLK(cmd) || IS_SETLKW(cmd)) {
+               if (fl->fl_type != F_UNLCK) {
+                       call->a_args.block = IS_SETLKW(cmd) ? 1 : 0;
+                       status = nlmclnt_lock(call, fl);
+               } else
+                       status = nlmclnt_unlock(call, fl);
+       } else if (IS_GETLK(cmd))
                status = nlmclnt_test(call, fl);
-       } else if ((cmd == F_SETLK || cmd == F_SETLKW)
-                  && fl->fl_type == F_UNLCK) {
-               status = nlmclnt_unlock(call, fl);
-       } else if (cmd == F_SETLK || cmd == F_SETLKW) {
-               call->a_args.block = (cmd == F_SETLKW)? 1 : 0;
-               status = nlmclnt_lock(call, fl);
-       } else {
+       else
                status = -EINVAL;
-       }
 
        if (status < 0 && (call->a_flags & RPC_TASK_ASYNC))
                kfree(call);
index 7581a557d21171b05891cb707b0156397ab01392..e1e917e396a8b7e2809607c2d186c476dabab733 100644 (file)
@@ -91,6 +91,7 @@ nlm_decode_fh(u32 *p, struct nfs_fh *f)
                return NULL;
        }
        f->size = NFS2_FHSIZE;
+       memset(f->data, 0, sizeof(f->data));
        memcpy(f->data, p, NFS2_FHSIZE);
        return p + XDR_QUADLEN(NFS2_FHSIZE);
 }
index b3a81a2eddba919ec204250abba9ef76896ec82a..6cc49cdd1973fb767133dfb7205ce7016ff1ba4d 100644 (file)
@@ -257,7 +257,7 @@ static int assign_type(struct file_lock *fl, int type)
 static int flock_to_posix_lock(struct file *filp, struct file_lock *fl,
                               struct flock *l)
 {
-       loff_t start;
+       off_t start, end;
 
        switch (l->l_whence) {
        case 0: /*SEEK_SET*/
@@ -270,17 +270,16 @@ static int flock_to_posix_lock(struct file *filp, struct file_lock *fl,
                start = filp->f_dentry->d_inode->i_size;
                break;
        default:
-               return (0);
+               return -EINVAL;
        }
 
        if (((start += l->l_start) < 0) || (l->l_len < 0))
-               return (0);
-       fl->fl_end = start + l->l_len - 1;
-       if (l->l_len > 0 && fl->fl_end < 0)
-               return (0);
-       if (fl->fl_end > OFFT_OFFSET_MAX)
-               return 0;
+               return -EINVAL;
+       end = start + l->l_len - 1;
+       if (l->l_len > 0 && end < 0)
+               return -EOVERFLOW;
        fl->fl_start = start;   /* we record the absolute position */
+       fl->fl_end = end;
        if (l->l_len == 0)
                fl->fl_end = OFFSET_MAX;
        
@@ -292,7 +291,7 @@ static int flock_to_posix_lock(struct file *filp, struct file_lock *fl,
        fl->fl_insert = NULL;
        fl->fl_remove = NULL;
 
-       return (assign_type(fl, l->l_type) == 0);
+       return assign_type(fl, l->l_type);
 }
 
 #if BITS_PER_LONG == 32
@@ -312,14 +311,14 @@ static int flock64_to_posix_lock(struct file *filp, struct file_lock *fl,
                start = filp->f_dentry->d_inode->i_size;
                break;
        default:
-               return (0);
+               return -EINVAL;
        }
 
        if (((start += l->l_start) < 0) || (l->l_len < 0))
-               return (0);
+               return -EINVAL;
        fl->fl_end = start + l->l_len - 1;
        if (l->l_len > 0 && fl->fl_end < 0)
-               return (0);
+               return -EOVERFLOW;
        fl->fl_start = start;   /* we record the absolute position */
        if (l->l_len == 0)
                fl->fl_end = OFFSET_MAX;
@@ -339,10 +338,10 @@ static int flock64_to_posix_lock(struct file *filp, struct file_lock *fl,
                fl->fl_type = l->l_type;
                break;
        default:
-               return (0);
+               return -EINVAL;
        }
 
-       return (1);
+       return (0);
 }
 #endif
 
@@ -1370,8 +1369,8 @@ int fcntl_getlk(unsigned int fd, struct flock *l)
        if (!filp)
                goto out;
 
-       error = -EINVAL;
-       if (!flock_to_posix_lock(filp, &file_lock, &flock))
+       error = flock_to_posix_lock(filp, &file_lock, &flock);
+       if (error)
                goto out_putf;
 
        if (filp->f_op && filp->f_op->lock) {
@@ -1460,8 +1459,8 @@ int fcntl_setlk(unsigned int fd, unsigned int cmd, struct flock *l)
                }
        }
 
-       error = -EINVAL;
-       if (!flock_to_posix_lock(filp, file_lock, &flock))
+       error = flock_to_posix_lock(filp, file_lock, &flock);
+       if (error)
                goto out_putf;
        
        error = -EBADF;
@@ -1535,8 +1534,8 @@ int fcntl_getlk64(unsigned int fd, struct flock64 *l)
        if (!filp)
                goto out;
 
-       error = -EINVAL;
-       if (!flock64_to_posix_lock(filp, &file_lock, &flock))
+       error = flock64_to_posix_lock(filp, &file_lock, &flock);
+       if (error)
                goto out_putf;
 
        if (filp->f_op && filp->f_op->lock) {
@@ -1613,8 +1612,8 @@ int fcntl_setlk64(unsigned int fd, unsigned int cmd, struct flock64 *l)
                }
        }
 
-       error = -EINVAL;
-       if (!flock64_to_posix_lock(filp, file_lock, &flock))
+       error = flock64_to_posix_lock(filp, file_lock, &flock);
+       if (error)
                goto out_putf;
        
        error = -EBADF;
index 9cadce66cbf5c1a98b71e56fe62c5b01455b2d62..b4fe313492ff8a57b85ed7340e2850fe45cb8a9e 100644 (file)
@@ -264,7 +264,7 @@ nfs_lock(struct file *filp, int cmd, struct file_lock *fl)
 
        /* Fake OK code if mounted without NLM support */
        if (NFS_SERVER(inode)->flags & NFS_MOUNT_NONLM) {
-               if (cmd == F_GETLK)
+               if (IS_GETLK(cmd))
                        status = LOCK_USE_CLNT;
                goto out_ok;
        }
@@ -304,7 +304,7 @@ nfs_lock(struct file *filp, int cmd, struct file_lock *fl)
         * This makes locking act as a cache coherency point.
         */
  out_ok:
-       if ((cmd == F_SETLK || cmd == F_SETLKW) && fl->fl_type != F_UNLCK) {
+       if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->fl_type != F_UNLCK) {
                filemap_fdatasync(inode->i_mapping);
                down(&inode->i_sem);
                nfs_wb_all(inode);      /* we may have slept */
index 8049f5e1c1b4a3c409acd50673d936fba26e75cb..2bb8bce033ae3b26dec428a64555699d0496d48e 100644 (file)
@@ -746,6 +746,8 @@ reiserfs_panic(s, "journal-539: flush_commit_list: BAD count(%d) > orig_commit_l
   }
   atomic_set(&(jl->j_commit_flushing), 0) ;
   wake_up(&(jl->j_commit_wait)) ;
+  
+  s->s_dirt = 1 ;
   return 0 ;
 }
 
@@ -2378,7 +2380,6 @@ int flush_old_commits(struct super_block *p_s_sb, int immediate) {
   int count = 0;
   int start ; 
   time_t now ; 
-  int keep_dirty = 0 ;
   struct reiserfs_transaction_handle th ; 
 
   start =  SB_JOURNAL_LIST_INDEX(p_s_sb) ;
@@ -2388,10 +2389,6 @@ int flush_old_commits(struct super_block *p_s_sb, int immediate) {
   if (SB_JOURNAL_LIST_INDEX(p_s_sb) < 0) {
     return 0  ;
   }
-  if (!strcmp(current->comm, "kupdate")) {
-    immediate = 0 ;
-    keep_dirty = 1 ;
-  }
   /* starting with oldest, loop until we get to the start */
   i = (SB_JOURNAL_LIST_INDEX(p_s_sb) + 1) % JOURNAL_LIST_COUNT ;
   while(i != start) {
@@ -2416,7 +2413,6 @@ int flush_old_commits(struct super_block *p_s_sb, int immediate) {
     reiserfs_prepare_for_journal(p_s_sb, SB_BUFFER_WITH_SB(p_s_sb), 1) ;
     journal_mark_dirty(&th, p_s_sb, SB_BUFFER_WITH_SB(p_s_sb)) ;
     do_journal_end(&th, p_s_sb,1, COMMIT_NOW) ;
-    keep_dirty = 0 ;
   } else if (immediate) { /* belongs above, but I wanted this to be very explicit as a special case.  If they say to 
                              flush, we must be sure old transactions hit the disk too. */
     journal_join(&th, p_s_sb, 1) ;
@@ -2424,8 +2420,8 @@ int flush_old_commits(struct super_block *p_s_sb, int immediate) {
     journal_mark_dirty(&th, p_s_sb, SB_BUFFER_WITH_SB(p_s_sb)) ;
     do_journal_end(&th, p_s_sb,1, COMMIT_NOW | WAIT) ;
   }
-  keep_dirty |= reiserfs_journal_kupdate(p_s_sb) ;
-  return keep_dirty ;
+  reiserfs_journal_kupdate(p_s_sb) ;
+  return 0 ;
 }
 
 /*
index e5c3d786b862994f81231ef9244ce791239454a9..216200305f3e98f28df6b5168e3fdcaa6fe1668a 100644 (file)
 #include <linux/wait.h>
 #endif /* __KERNEL__ */
 
-typedef int acpi_sstate_t;
-
 /*
  * Device states
  */
-enum
-{
+typedef enum {
        ACPI_D0, /* fully-on */
        ACPI_D1, /* partial-on */
        ACPI_D2, /* partial-on */
        ACPI_D3, /* fully-off */
-};
+} acpi_dstate_t;
 
-typedef int acpi_dstate_t;
+typedef enum {
+       ACPI_S0, /* working state */
+       ACPI_S1, /* power-on suspend */
+       ACPI_S2, /* suspend to ram, with devices */
+       ACPI_S3, /* suspend to ram */
+       ACPI_S4, /* suspend to disk */
+       ACPI_S5, /* soft-off */
+} acpi_sstate_t;
 
 /* RSDP location */
 #define ACPI_BIOS_ROM_BASE (0x0e0000)
@@ -160,4 +164,17 @@ enum
 
 #define ACPI_SLP_TYP_DISABLED  (~0UL)
 
+#ifdef __KERNEL__
+
+/* routines for saving/restoring kernel state */
+FASTCALL(extern unsigned long acpi_save_state_mem(unsigned long return_point));
+FASTCALL(extern int acpi_save_state_disk(unsigned long return_point));
+extern void acpi_restore_state(void);
+
+extern unsigned long acpi_wakeup_address;
+
+#endif /* __KERNEL__ */
+
+int acpi_init(void);
+
 #endif /* _LINUX_ACPI_H */
index e29bba62328936dbeca8932add20a41ba6c38cd8..eadb9e6ae0563d7ca344f9c6e844ede473a3d25d 100644 (file)
@@ -59,6 +59,7 @@ enum chipset_type {
        AMD_GENERIC,
        AMD_IRONGATE,
        AMD_761,
+       AMD_762,
        ALI_M1541,
        ALI_M1621,
        ALI_M1631,
index bdcf78b74c3bae2e21d1b928868e1c487309463e..704fb76b6334c0bbe475a090cdd73908c0023510 100644 (file)
 #define DN_ATTRIB      0x00000020      /* File changed attibutes */
 #define DN_MULTISHOT   0x80000000      /* Don't remove notifier */
 
+#ifdef __KERNEL__
+
+#if BITS_PER_LONG == 32
+#define IS_GETLK32(cmd)                ((cmd) == F_GETLK)
+#define IS_SETLK32(cmd)                ((cmd) == F_SETLK)
+#define IS_SETLKW32(cmd)       ((cmd) == F_SETLKW)
+#define IS_GETLK64(cmd)                ((cmd) == F_GETLK64)
+#define IS_SETLK64(cmd)                ((cmd) == F_SETLK64)
+#define IS_SETLKW64(cmd)       ((cmd) == F_SETLKW64)
+#else
+#define IS_GETLK32(cmd)                (0)
+#define IS_SETLK32(cmd)                (0)
+#define IS_SETLKW32(cmd)       (0)
+#define IS_GETLK64(cmd)                ((cmd) == F_GETLK)
+#define IS_SETLK64(cmd)                ((cmd) == F_SETLK)
+#define IS_SETLKW64(cmd)       ((cmd) == F_SETLKW)
+#endif /* BITS_PER_LONG == 32 */
+
+#define IS_GETLK(cmd)  (IS_GETLK32(cmd)  || IS_GETLK64(cmd))
+#define IS_SETLK(cmd)  (IS_SETLK32(cmd)  || IS_SETLK64(cmd))
+#define IS_SETLKW(cmd) (IS_SETLKW32(cmd) || IS_SETLKW64(cmd))
+
+#endif /* __KERNEL__ */
+
 #endif
index 9eca17f8ee1be2d6f002f96c0679631fc9f76189..1600704891a622f45de6fef5daefe21513a790ff 100644 (file)
@@ -412,7 +412,6 @@ struct block_device {
        struct inode *          bd_inode;
        dev_t                   bd_dev;  /* not a kdev_t - it's a search key */
        int                     bd_openers;
-       int                     bd_cache_openers;
        const struct block_device_operations *bd_op;
        struct semaphore        bd_sem; /* open/close mutex */
        struct list_head        bd_inodes;
@@ -450,7 +449,6 @@ struct inode {
        struct file_lock        *i_flock;
        struct address_space    *i_mapping;
        struct address_space    i_data;
-       int                     i_mapping_overload;
        struct dquot            *i_dquot[MAXQUOTAS];
        /* These three should probably be a union */
        struct list_head        i_devices;
index 1c3f6b3e2f92c03e3cd03a0a45a4a7d49db3dd84..d762d2aca1c4e44d1d520d2838a2e235b20f05ad 100644 (file)
@@ -521,17 +521,15 @@ static void refill_inactive(int nr_pages)
 
                page = list_entry(entry, struct page, lru);
                entry = entry->prev;
-               if (PageTestandClearReferenced(page))
+               if (PageTestandClearReferenced(page)) {
+                       list_del(&page->lru);
+                       list_add(&page->lru, &active_list);
                        continue;
+               }
 
                del_page_from_active_list(page);
                add_page_to_inactive_list(page);
        }
-
-       /* move active list to between "entry" and "entry->next" */
-       __list_del(active_list.prev, active_list.next);
-       __list_add(&active_list, entry, entry->next);
-
        spin_unlock(&pagemap_lru_lock);
 }