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>
This commit is contained in:
Robert Moore
2005-06-24 00:00:00 -04:00
committed by Len Brown
parent 88ac00f5a8
commit 73459f73e5
56 changed files with 2631 additions and 2040 deletions

View File

@ -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

View File

@ -113,6 +113,10 @@ void
acpi_db_set_method_call_breakpoint (
union acpi_parse_object *op);
void
acpi_db_get_bus_info (
void);
void
acpi_db_disassemble_aml (
char *statements,
@ -327,7 +331,7 @@ acpi_db_set_output_destination (
u32 where);
void
acpi_db_dump_object (
acpi_db_dump_external_object (
union acpi_object *obj_desc,
u32 level);

View File

@ -90,6 +90,7 @@ struct acpi_op_walk_info
{
u32 level;
u32 bit_offset;
struct acpi_walk_state *walk_state;
};
typedef

View File

@ -450,10 +450,4 @@ acpi_ds_result_pop_from_bottom (
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_ */

View File

@ -122,8 +122,7 @@ acpi_ev_valid_gpe_event (
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 (

View File

@ -151,6 +151,13 @@ ACPI_EXTERN struct acpi_common_facs acpi_gbl_common_fACS;
*/
/* 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 @@ ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[NUM_MUTEX];
*
****************************************************************************/
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
/* 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_memory_list acpi_gbl_memory_lists[ACPI_NUM_MEM_LISTS];
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 acpi_init_handler acpi_gbl_init_handler;
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;

View File

@ -143,15 +143,15 @@ acpi_hw_get_gpe_status (
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 (

View File

@ -953,24 +953,18 @@ struct 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
#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 @@ struct acpi_memory_list
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__ */

View File

@ -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 @@ u16
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 @@ acpi_ps_set_name(
union acpi_parse_object *op,
u32 name);
#ifdef ACPI_ENABLE_OBJECT_CACHE
void
acpi_ps_delete_parse_cache (
void);
#endif
/*
* psdump - display parser tree

View File

@ -139,15 +139,14 @@ void
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 @@ acpi_os_get_physical_address (
#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
*/

View File

@ -162,6 +162,9 @@ struct acpi_walk_info
#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
{

View File

@ -243,6 +243,11 @@ struct acpi_pointer
#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

View File

@ -557,16 +557,6 @@ void
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 @@ acpi_ut_strtoul64 (
#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);
@ -665,23 +639,36 @@ acpi_ut_display_init_pathname (
#endif
/*
* 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 (

View File

@ -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

View File

@ -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
/*

View File

@ -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>