ACPICA 20050617-0624 from Bob Moore <robert.moore@intel.com>

ACPICA 20050617:

Moved the object cache operations into the OS interface
layer (OSL) to allow the host OS to handle these operations
if desired (for example, the Linux OSL will invoke the
slab allocator).  This support is optional; the compile
time define ACPI_USE_LOCAL_CACHE may be used to utilize
the original cache code in the ACPI CA core.  The new OSL
interfaces are shown below.  See utalloc.c for an example
implementation, and acpiosxf.h for the exact interface
definitions.  Thanks to Alexey Starikovskiy.
	acpi_os_create_cache
	acpi_os_delete_cache
	acpi_os_purge_cache
	acpi_os_acquire_object
	acpi_os_release_object

Modified the interfaces to acpi_os_acquire_lock and
acpi_os_release_lock to return and restore a flags
parameter.  This fits better with many OS lock models.
Note: the current execution state (interrupt handler
or not) is no longer passed to these interfaces.  If
necessary, the OSL must determine this state by itself, a
simple and fast operation.  Thanks to Alexey Starikovskiy.

Fixed a problem in the ACPI table handling where a valid
XSDT was assumed present if the revision of the RSDP
was 2 or greater.  According to the ACPI specification,
the XSDT is optional in all cases, and the table manager
therefore now checks for both an RSDP >=2 and a valid
XSDT pointer.  Otherwise, the RSDT pointer is used.
Some ACPI 2.0 compliant BIOSs contain only the RSDT.

Fixed an interpreter problem with the Mid() operator in the
case of an input string where the resulting output string
is of zero length.  It now correctly returns a valid,
null terminated string object instead of a string object
with a null pointer.

Fixed a problem with the control method argument handling
to allow a store to an Arg object that already contains an
object of type Device.  The Device object is now correctly
overwritten.  Previously, an error was returned.

ACPICA 20050624:

Modified the new OSL cache interfaces to use ACPI_CACHE_T
as the type for the host-defined cache object.  This allows
the OSL implementation to define and type this object in
any manner desired, simplifying the OSL implementation.
For example, ACPI_CACHE_T is defined as kmem_cache_t for
Linux, and should be defined in the OS-specific header
file for other operating systems as required.

Changed the interface to AcpiOsAcquireObject to directly
return the requested object as the function return (instead
of ACPI_STATUS.) This change was made for performance
reasons, since this is the purpose of the interface in the
first place.  acpi_os_acquire_object is now similar to the
acpi_os_allocate interface.  Thanks to Alexey Starikovskiy.

Modified the initialization sequence in
acpi_initialize_subsystem to call the OSL interface
acpi_osl_initialize first, before any local initialization.
This change was required because the global initialization
now calls OSL interfaces.

Restructured the code base to split some files because
of size and/or because the code logically belonged in a
separate file.  New files are listed below.

  utilities/utcache.c	/* Local cache interfaces */
  utilities/utmutex.c	/* Local mutex support */
  utilities/utstate.c	/* State object support */
  parser/psloop.c	/* Main AML parse loop */

Signed-off-by: Len Brown <len.brown@intel.com>
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h
index 6babcb1..dd9b70c 100644
--- a/include/acpi/acconfig.h
+++ b/include/acpi/acconfig.h
@@ -64,7 +64,7 @@
 
 /* Version string */
 
-#define ACPI_CA_VERSION                 0x20050526
+#define ACPI_CA_VERSION                 0x20050624
 
 /*
  * OS name, used for the _OS object.  The _OS object is essentially obsolete,
@@ -78,11 +78,10 @@
 
 /* Maximum objects in the various object caches */
 
-#define ACPI_MAX_STATE_CACHE_DEPTH      64          /* State objects */
+#define ACPI_MAX_STATE_CACHE_DEPTH      96          /* State objects */
 #define ACPI_MAX_PARSE_CACHE_DEPTH      96          /* Parse tree objects */
-#define ACPI_MAX_EXTPARSE_CACHE_DEPTH   64          /* Parse tree objects */
-#define ACPI_MAX_OBJECT_CACHE_DEPTH     64          /* Interpreter operand objects */
-#define ACPI_MAX_WALK_CACHE_DEPTH       4           /* Objects for parse tree walks */
+#define ACPI_MAX_EXTPARSE_CACHE_DEPTH   96          /* Parse tree objects */
+#define ACPI_MAX_OBJECT_CACHE_DEPTH     96          /* Interpreter operand objects */
 
 /*
  * Should the subystem abort the loading of an ACPI table if the
diff --git a/include/acpi/acdebug.h b/include/acpi/acdebug.h
index 8ba372b..f8fa222 100644
--- a/include/acpi/acdebug.h
+++ b/include/acpi/acdebug.h
@@ -114,6 +114,10 @@
 	union acpi_parse_object         *op);
 
 void
+acpi_db_get_bus_info (
+	void);
+
+void
 acpi_db_disassemble_aml (
 	char                            *statements,
 	union acpi_parse_object         *op);
@@ -327,7 +331,7 @@
 	u32                             where);
 
 void
-acpi_db_dump_object (
+acpi_db_dump_external_object (
 	union acpi_object               *obj_desc,
 	u32                             level);
 
diff --git a/include/acpi/acdisasm.h b/include/acpi/acdisasm.h
index dbfa877..fcc2d50 100644
--- a/include/acpi/acdisasm.h
+++ b/include/acpi/acdisasm.h
@@ -90,6 +90,7 @@
 {
 	u32                             level;
 	u32                             bit_offset;
+	struct acpi_walk_state          *walk_state;
 };
 
 typedef
diff --git a/include/acpi/acdispat.h b/include/acpi/acdispat.h
index 8f5f2f7..fde6aa9 100644
--- a/include/acpi/acdispat.h
+++ b/include/acpi/acdispat.h
@@ -450,10 +450,4 @@
 	union acpi_operand_object       **object,
 	struct acpi_walk_state          *walk_state);
 
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-void
-acpi_ds_delete_walk_state_cache (
-	void);
-#endif
-
 #endif /* _ACDISPAT_H_ */
diff --git a/include/acpi/acevents.h b/include/acpi/acevents.h
index 301c5cc..33ae2ca 100644
--- a/include/acpi/acevents.h
+++ b/include/acpi/acevents.h
@@ -122,8 +122,7 @@
 
 acpi_status
 acpi_ev_walk_gpe_list (
-	ACPI_GPE_CALLBACK       gpe_walk_callback,
-	u32                             flags);
+	ACPI_GPE_CALLBACK       gpe_walk_callback);
 
 acpi_status
 acpi_ev_delete_gpe_handlers (
diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h
index 4946696..8d5a397a 100644
--- a/include/acpi/acglobal.h
+++ b/include/acpi/acglobal.h
@@ -151,6 +151,13 @@
  */
 
 
+/* The root table can be either an RSDT or an XSDT */
+
+ACPI_EXTERN u8                                  acpi_gbl_root_table_type;
+#define     ACPI_TABLE_TYPE_RSDT        'R'
+#define     ACPI_TABLE_TYPE_XSDT        'X'
+
+
 /*
  * Handle both ACPI 1.0 and ACPI 2.0 Integer widths:
  * If we are executing a method that exists in a 32-bit ACPI table,
@@ -180,8 +187,23 @@
  *
  ****************************************************************************/
 
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
 
-ACPI_EXTERN struct acpi_memory_list             acpi_gbl_memory_lists[ACPI_NUM_MEM_LISTS];
+/* Lists for tracking memory allocations */
+
+ACPI_EXTERN struct acpi_memory_list            *acpi_gbl_global_list;
+ACPI_EXTERN struct acpi_memory_list            *acpi_gbl_ns_node_list;
+#endif
+
+/* Object caches */
+
+ACPI_EXTERN acpi_cache_t                       *acpi_gbl_state_cache;
+ACPI_EXTERN acpi_cache_t                       *acpi_gbl_ps_node_cache;
+ACPI_EXTERN acpi_cache_t                       *acpi_gbl_ps_node_ext_cache;
+ACPI_EXTERN acpi_cache_t                       *acpi_gbl_operand_cache;
+
+/* Global handlers */
+
 ACPI_EXTERN struct acpi_object_notify_handler   acpi_gbl_device_notify;
 ACPI_EXTERN struct acpi_object_notify_handler   acpi_gbl_system_notify;
 ACPI_EXTERN acpi_exception_handler              acpi_gbl_exception_handler;
@@ -189,6 +211,8 @@
 ACPI_EXTERN struct acpi_walk_state             *acpi_gbl_breakpoint_walk;
 ACPI_EXTERN acpi_handle                         acpi_gbl_global_lock_semaphore;
 
+/* Misc */
+
 ACPI_EXTERN u32                                 acpi_gbl_global_lock_thread_count;
 ACPI_EXTERN u32                                 acpi_gbl_original_mode;
 ACPI_EXTERN u32                                 acpi_gbl_rsdp_original_location;
diff --git a/include/acpi/achware.h b/include/acpi/achware.h
index 9d63641..cf5de46 100644
--- a/include/acpi/achware.h
+++ b/include/acpi/achware.h
@@ -143,15 +143,15 @@
 
 acpi_status
 acpi_hw_disable_all_gpes (
-	u32                             flags);
+	void);
 
 acpi_status
 acpi_hw_enable_all_runtime_gpes (
-	u32                             flags);
+	void);
 
 acpi_status
 acpi_hw_enable_all_wakeup_gpes (
-	u32                             flags);
+	void);
 
 acpi_status
 acpi_hw_enable_runtime_gpe_block (
diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h
index 52c6a20..58f9ba1 100644
--- a/include/acpi/aclocal.h
+++ b/include/acpi/aclocal.h
@@ -953,24 +953,18 @@
 
 #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
+#define ACPI_MEM_LIST_MAX               1
+#define ACPI_NUM_MEM_LISTS              2
 
 
 struct acpi_memory_list
 {
+	char                                *list_name;
 	void                                *list_head;
-	u16                                 link_offset;
-	u16                                 max_cache_depth;
-	u16                                 cache_depth;
 	u16                                 object_size;
+	u16                                 max_depth;
+	u16                                 current_depth;
+	u16                                 link_offset;
 
 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
 
@@ -979,11 +973,9 @@
 	u32                                 total_allocated;
 	u32                                 total_freed;
 	u32                                 current_total_size;
-	u32                                 cache_requests;
-	u32                                 cache_hits;
-	char                                *list_name;
+	u32                                 requests;
+	u32                                 hits;
 #endif
 };
 
-
 #endif /* __ACLOCAL_H__ */
diff --git a/include/acpi/acparser.h b/include/acpi/acparser.h
index 6982765..ba9548f 100644
--- a/include/acpi/acparser.h
+++ b/include/acpi/acparser.h
@@ -63,6 +63,7 @@
 #define ACPI_PARSE_MODE_MASK            0x0030
 
 #define ACPI_PARSE_DEFERRED_OP          0x0100
+#define ACPI_PARSE_DISASSEMBLE          0x0200
 
 
 /******************************************************************************
@@ -158,6 +159,25 @@
 acpi_ps_peek_opcode (
 	struct acpi_parse_state         *state);
 
+acpi_status
+acpi_ps_complete_this_op (
+	struct acpi_walk_state          *walk_state,
+	union acpi_parse_object         *op);
+
+acpi_status
+acpi_ps_next_parse_state (
+	struct acpi_walk_state          *walk_state,
+	union acpi_parse_object         *op,
+	acpi_status                     callback_status);
+
+
+/*
+ * psloop - main parse loop
+ */
+acpi_status
+acpi_ps_parse_loop (
+	struct acpi_walk_state          *walk_state);
+
 
 /*
  * psscope - Scope stack management routines
@@ -291,12 +311,6 @@
 	union acpi_parse_object         *op,
 	u32                             name);
 
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-void
-acpi_ps_delete_parse_cache (
-	void);
-#endif
-
 
 /*
  * psdump - display parser tree
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index ea489f2..819a53f 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -139,15 +139,14 @@
 acpi_os_delete_lock (
 	acpi_handle                     handle);
 
-void
+unsigned long
 acpi_os_acquire_lock (
-	acpi_handle                     handle,
-	u32                             flags);
+	acpi_handle                     handle);
 
 void
 acpi_os_release_lock (
 	acpi_handle                     handle,
-	u32                             flags);
+	unsigned long                   flags);
 
 
 /*
@@ -180,6 +179,34 @@
 #endif
 
 
+
+/*
+ * Memory/Object Cache
+ */
+acpi_status
+acpi_os_create_cache (
+	char                            *cache_name,
+	u16                             object_size,
+	u16                             max_depth,
+	acpi_cache_t                    **return_cache);
+
+acpi_status
+acpi_os_delete_cache (
+	acpi_cache_t                    *cache);
+
+acpi_status
+acpi_os_purge_cache (
+	acpi_cache_t                    *cache);
+
+void *
+acpi_os_acquire_object (
+	acpi_cache_t                    *cache);
+
+acpi_status
+acpi_os_release_object (
+	acpi_cache_t                    *cache,
+	void                            *object);
+
 /*
  * Interrupt handlers
  */
diff --git a/include/acpi/acstruct.h b/include/acpi/acstruct.h
index 4e92645..a2025a8 100644
--- a/include/acpi/acstruct.h
+++ b/include/acpi/acstruct.h
@@ -162,6 +162,9 @@
 
 #define ACPI_DISPLAY_SUMMARY    0
 #define ACPI_DISPLAY_OBJECTS    1
+#define ACPI_DISPLAY_MASK       1
+
+#define ACPI_DISPLAY_SHORT      2
 
 struct acpi_get_devices_info
 {
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 3a451dc..8cd774a2 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -243,6 +243,11 @@
 #define ACPI_LOGMODE_PHYSPTR            ACPI_LOGICAL_ADDRESSING  | ACPI_PHYSICAL_POINTER
 #define ACPI_LOGMODE_LOGPTR             ACPI_LOGICAL_ADDRESSING  | ACPI_LOGICAL_POINTER
 
+/* Types for the OS interface layer (OSL) */
+
+#ifdef ACPI_USE_LOCAL_CACHE
+#define acpi_cache_t                struct acpi_memory_list
+#endif
 
 /*
  * Useful defines
diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h
index 192d0be..e9c1584d 100644
--- a/include/acpi/acutils.h
+++ b/include/acpi/acutils.h
@@ -557,16 +557,6 @@
 acpi_ut_delete_generic_state (
 	union acpi_generic_state        *state);
 
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-void
-acpi_ut_delete_generic_state_cache (
-	void);
-
-void
-acpi_ut_delete_object_cache (
-	void);
-#endif
-
 
 /*
  * utmath
@@ -622,22 +612,6 @@
 
 #define ACPI_ANY_BASE        0
 
-acpi_status
-acpi_ut_mutex_initialize (
-	void);
-
-void
-acpi_ut_mutex_terminate (
-	void);
-
-acpi_status
-acpi_ut_acquire_mutex (
-	acpi_mutex_handle               mutex_id);
-
-acpi_status
-acpi_ut_release_mutex (
-	acpi_mutex_handle               mutex_id);
-
 u8 *
 acpi_ut_get_resource_end_tag (
 	union acpi_operand_object       *obj_desc);
@@ -666,22 +640,35 @@
 
 
 /*
+ * utmutex - mutex support
+ */
+acpi_status
+acpi_ut_mutex_initialize (
+	void);
+
+void
+acpi_ut_mutex_terminate (
+	void);
+
+acpi_status
+acpi_ut_acquire_mutex (
+	acpi_mutex_handle               mutex_id);
+
+acpi_status
+acpi_ut_release_mutex (
+	acpi_mutex_handle               mutex_id);
+
+
+/*
  * utalloc - memory allocation and object caching
  */
-void *
-acpi_ut_acquire_from_cache (
-	u32                             list_id);
+acpi_status
+acpi_ut_create_caches (
+	void);
 
-void
-acpi_ut_release_to_cache (
-	u32                             list_id,
-	void                            *object);
-
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-void
-acpi_ut_delete_generic_cache (
-	u32                             list_id);
-#endif
+acpi_status
+acpi_ut_delete_caches (
+	void);
 
 acpi_status
 acpi_ut_validate_buffer (
diff --git a/include/acpi/amlcode.h b/include/acpi/amlcode.h
index 55e97ed..50a0889 100644
--- a/include/acpi/amlcode.h
+++ b/include/acpi/amlcode.h
@@ -69,7 +69,7 @@
 #define AML_MULTI_NAME_PREFIX_OP    (u16) 0x2f
 #define AML_NAME_CHAR_SUBSEQ        (u16) 0x30
 #define AML_NAME_CHAR_FIRST         (u16) 0x41
-#define AML_OP_PREFIX               (u16) 0x5b
+#define AML_EXTENDED_OP_PREFIX      (u16) 0x5b
 #define AML_ROOT_PREFIX             (u16) 0x5c
 #define AML_PARENT_PREFIX           (u16) 0x5e
 #define AML_LOCAL_OP                (u16) 0x60
@@ -146,7 +146,7 @@
 
 /* prefixed opcodes */
 
-#define AML_EXTOP                   (u16) 0x005b     /* prefix for 2-byte opcodes */
+#define AML_EXTENDED_OPCODE         (u16) 0x5b00     /* prefix for 2-byte opcodes */
 
 #define AML_MUTEX_OP                (u16) 0x5b01
 #define AML_EVENT_OP                (u16) 0x5b02
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index adf969e..aa63202e 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -49,35 +49,38 @@
  * Configuration for ACPI tools and utilities
  */
 
-#ifdef _ACPI_DUMP_APP
+#ifdef ACPI_LIBRARY
+#define ACPI_USE_LOCAL_CACHE
+#endif
+
+#ifdef ACPI_DUMP_APP
 #ifndef MSDOS
 #define ACPI_DEBUG_OUTPUT
 #endif
 #define ACPI_APPLICATION
 #define ACPI_DISASSEMBLER
 #define ACPI_NO_METHOD_EXECUTION
-#define ACPI_USE_SYSTEM_CLIBRARY
-#define ACPI_ENABLE_OBJECT_CACHE
 #endif
 
-#ifdef _ACPI_EXEC_APP
+#ifdef ACPI_EXEC_APP
 #undef DEBUGGER_THREADING
 #define DEBUGGER_THREADING      DEBUGGER_SINGLE_THREADED
 #define ACPI_DEBUG_OUTPUT
 #define ACPI_APPLICATION
 #define ACPI_DEBUGGER
 #define ACPI_DISASSEMBLER
-#define ACPI_USE_SYSTEM_CLIBRARY
-#define ACPI_ENABLE_OBJECT_CACHE
 #endif
 
-#ifdef _ACPI_ASL_COMPILER
+#ifdef ACPI_ASL_COMPILER
 #define ACPI_DEBUG_OUTPUT
 #define ACPI_APPLICATION
 #define ACPI_DISASSEMBLER
 #define ACPI_CONSTANT_EVAL_ONLY
+#endif
+
+#ifdef ACPI_APPLICATION
 #define ACPI_USE_SYSTEM_CLIBRARY
-#define ACPI_ENABLE_OBJECT_CACHE
+#define ACPI_USE_LOCAL_CACHE
 #endif
 
 /*
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index a3de0db..4fbc0fd 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -62,6 +62,17 @@
 
 #define ACPI_MACHINE_WIDTH  BITS_PER_LONG
 
+/* Type(s) for the OSL */
+
+#ifdef ACPI_USE_LOCAL_CACHE
+#define acpi_cache_t	struct acpi_memory_list
+#else
+#include <linux/slab.h>
+#define acpi_cache_t	kmem_cache_t
+#endif
+
+
+
 #else /* !__KERNEL__ */
 
 #include <stdarg.h>