Skip to content

Commit

Permalink
ACPICA 20050617-0624 from Bob Moore <robert.moore@intel.com>
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Robert Moore authored and Len Brown committed Jul 14, 2005
1 parent 88ac00f commit 73459f7
Show file tree
Hide file tree
Showing 56 changed files with 2,624 additions and 2,033 deletions.
15 changes: 2 additions & 13 deletions drivers/acpi/dispatcher/dsmthdat.c
Original file line number Diff line number Diff line change
Expand Up @@ -632,23 +632,12 @@ acpi_ds_store_object_to_local (
* Weird, but true.
*/
if (opcode == AML_ARG_OP) {
/*
* Make sure that the object is the correct type. This may be
* overkill, butit is here because references were NS nodes in
* the past. Now they are operand objects of type Reference.
*/
if (ACPI_GET_DESCRIPTOR_TYPE (current_obj_desc) != ACPI_DESC_TYPE_OPERAND) {
ACPI_REPORT_ERROR ((
"Invalid descriptor type while storing to method arg: [%s]\n",
acpi_ut_get_descriptor_name (current_obj_desc)));
return_ACPI_STATUS (AE_AML_INTERNAL);
}

/*
* If we have a valid reference object that came from ref_of(),
* do the indirect store
*/
if ((current_obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) &&
if ((ACPI_GET_DESCRIPTOR_TYPE (current_obj_desc) == ACPI_DESC_TYPE_OPERAND) &&
(current_obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) &&
(current_obj_desc->reference.opcode == AML_REF_OF_OP)) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Arg (%p) is an obj_ref(Node), storing in node %p\n",
Expand Down
6 changes: 3 additions & 3 deletions drivers/acpi/dispatcher/dswload.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
#include <acpi/acnamesp.h>
#include <acpi/acevents.h>

#ifdef _ACPI_ASL_COMPILER
#ifdef ACPI_ASL_COMPILER
#include <acpi/acdisasm.h>
#endif

Expand Down Expand Up @@ -176,7 +176,7 @@ acpi_ds_load1_begin_op (
*/
status = acpi_ns_lookup (walk_state->scope_info, path, object_type,
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node));
#ifdef _ACPI_ASL_COMPILER
#ifdef ACPI_ASL_COMPILER
if (status == AE_NOT_FOUND) {
/*
* Table disassembly:
Expand Down Expand Up @@ -569,7 +569,7 @@ acpi_ds_load2_begin_op (
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
walk_state, &(node));
if (ACPI_FAILURE (status)) {
#ifdef _ACPI_ASL_COMPILER
#ifdef ACPI_ASL_COMPILER
if (status == AE_NOT_FOUND) {
status = AE_OK;
}
Expand Down
33 changes: 3 additions & 30 deletions drivers/acpi/dispatcher/dswstate.c
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ acpi_ds_create_walk_state (
ACPI_FUNCTION_TRACE ("ds_create_walk_state");


walk_state = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_WALK);
walk_state = ACPI_MEM_CALLOCATE (sizeof (struct acpi_walk_state));
if (!walk_state) {
return_PTR (NULL);
}
Expand All @@ -704,7 +704,7 @@ acpi_ds_create_walk_state (

status = acpi_ds_result_stack_push (walk_state);
if (ACPI_FAILURE (status)) {
acpi_ut_release_to_cache (ACPI_MEM_LIST_WALK, walk_state);
ACPI_MEM_FREE (walk_state);
return_PTR (NULL);
}

Expand Down Expand Up @@ -900,38 +900,11 @@ acpi_ds_delete_walk_state (
acpi_ut_delete_generic_state (state);
}

acpi_ut_release_to_cache (ACPI_MEM_LIST_WALK, walk_state);
ACPI_MEM_FREE (walk_state);
return_VOID;
}


#ifdef ACPI_ENABLE_OBJECT_CACHE
/******************************************************************************
*
* FUNCTION: acpi_ds_delete_walk_state_cache
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Purge the global state object cache. Used during subsystem
* termination.
*
******************************************************************************/

void
acpi_ds_delete_walk_state_cache (
void)
{
ACPI_FUNCTION_TRACE ("ds_delete_walk_state_cache");


acpi_ut_delete_generic_cache (ACPI_MEM_LIST_WALK);
return_VOID;
}
#endif


#ifdef ACPI_OBSOLETE_FUNCTIONS
/*******************************************************************************
*
Expand Down
5 changes: 3 additions & 2 deletions drivers/acpi/events/evgpe.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ acpi_ev_gpe_detect (
struct acpi_gpe_register_info *gpe_register_info;
u32 status_reg;
u32 enable_reg;
u32 flags;
acpi_status status;
struct acpi_gpe_block_info *gpe_block;
acpi_native_uint i;
Expand All @@ -412,7 +413,7 @@ acpi_ev_gpe_detect (

/* Examine all GPE blocks attached to this interrupt level */

acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_ISR);
flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
gpe_block = gpe_xrupt_list->gpe_block_list_head;
while (gpe_block) {
/*
Expand Down Expand Up @@ -476,7 +477,7 @@ acpi_ev_gpe_detect (

unlock_and_exit:

acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_ISR);
acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
return (int_status);
}

Expand Down
27 changes: 15 additions & 12 deletions drivers/acpi/events/evgpeblk.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ acpi_ev_valid_gpe_event (
* FUNCTION: acpi_ev_walk_gpe_list
*
* PARAMETERS: gpe_walk_callback - Routine called for each GPE block
* Flags - ACPI_NOT_ISR or ACPI_ISR
*
* RETURN: Status
*
Expand All @@ -148,18 +147,18 @@ 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)
{
struct acpi_gpe_block_info *gpe_block;
struct acpi_gpe_xrupt_info *gpe_xrupt_info;
acpi_status status = AE_OK;
u32 flags;


ACPI_FUNCTION_TRACE ("ev_walk_gpe_list");


acpi_os_acquire_lock (acpi_gbl_gpe_lock, flags);
flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);

/* Walk the interrupt level descriptor list */

Expand Down Expand Up @@ -500,6 +499,7 @@ acpi_ev_get_gpe_xrupt_block (
struct acpi_gpe_xrupt_info *next_gpe_xrupt;
struct acpi_gpe_xrupt_info *gpe_xrupt;
acpi_status status;
u32 flags;


ACPI_FUNCTION_TRACE ("ev_get_gpe_xrupt_block");
Expand Down Expand Up @@ -527,7 +527,7 @@ acpi_ev_get_gpe_xrupt_block (

/* Install new interrupt descriptor with spin lock */

acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
if (acpi_gbl_gpe_xrupt_list_head) {
next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head;
while (next_gpe_xrupt->next) {
Expand All @@ -540,7 +540,7 @@ acpi_ev_get_gpe_xrupt_block (
else {
acpi_gbl_gpe_xrupt_list_head = gpe_xrupt;
}
acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
acpi_os_release_lock (acpi_gbl_gpe_lock, flags);

/* Install new interrupt handler if not SCI_INT */

Expand Down Expand Up @@ -577,6 +577,7 @@ acpi_ev_delete_gpe_xrupt (
struct acpi_gpe_xrupt_info *gpe_xrupt)
{
acpi_status status;
u32 flags;


ACPI_FUNCTION_TRACE ("ev_delete_gpe_xrupt");
Expand All @@ -599,15 +600,15 @@ acpi_ev_delete_gpe_xrupt (

/* Unlink the interrupt block with lock */

acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
if (gpe_xrupt->previous) {
gpe_xrupt->previous->next = gpe_xrupt->next;
}

if (gpe_xrupt->next) {
gpe_xrupt->next->previous = gpe_xrupt->previous;
}
acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
acpi_os_release_lock (acpi_gbl_gpe_lock, flags);

/* Free the block */

Expand Down Expand Up @@ -637,6 +638,7 @@ acpi_ev_install_gpe_block (
struct acpi_gpe_block_info *next_gpe_block;
struct acpi_gpe_xrupt_info *gpe_xrupt_block;
acpi_status status;
u32 flags;


ACPI_FUNCTION_TRACE ("ev_install_gpe_block");
Expand All @@ -655,7 +657,7 @@ acpi_ev_install_gpe_block (

/* Install the new block at the end of the list with lock */

acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
if (gpe_xrupt_block->gpe_block_list_head) {
next_gpe_block = gpe_xrupt_block->gpe_block_list_head;
while (next_gpe_block->next) {
Expand All @@ -670,7 +672,7 @@ acpi_ev_install_gpe_block (
}

gpe_block->xrupt_block = gpe_xrupt_block;
acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
acpi_os_release_lock (acpi_gbl_gpe_lock, flags);

unlock_and_exit:
status = acpi_ut_release_mutex (ACPI_MTX_EVENTS);
Expand All @@ -695,6 +697,7 @@ acpi_ev_delete_gpe_block (
struct acpi_gpe_block_info *gpe_block)
{
acpi_status status;
u32 flags;


ACPI_FUNCTION_TRACE ("ev_install_gpe_block");
Expand All @@ -720,7 +723,7 @@ acpi_ev_delete_gpe_block (
else {
/* Remove the block on this interrupt with lock */

acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
if (gpe_block->previous) {
gpe_block->previous->next = gpe_block->next;
}
Expand All @@ -731,7 +734,7 @@ acpi_ev_delete_gpe_block (
if (gpe_block->next) {
gpe_block->next->previous = gpe_block->previous;
}
acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
}

/* Free the gpe_block */
Expand Down
4 changes: 2 additions & 2 deletions drivers/acpi/events/evmisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ acpi_ev_terminate (

/* Disable all GPEs in all GPE blocks */

status = acpi_ev_walk_gpe_list (acpi_hw_disable_gpe_block, ACPI_NOT_ISR);
status = acpi_ev_walk_gpe_list (acpi_hw_disable_gpe_block);

/* Remove SCI handler */

Expand All @@ -602,7 +602,7 @@ acpi_ev_terminate (

/* Deallocate all handler objects installed within GPE info structs */

status = acpi_ev_walk_gpe_list (acpi_ev_delete_gpe_handlers, ACPI_NOT_ISR);
status = acpi_ev_walk_gpe_list (acpi_ev_delete_gpe_handlers);

/* Return to original mode if necessary */

Expand Down
10 changes: 6 additions & 4 deletions drivers/acpi/events/evxface.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@ acpi_install_gpe_handler (
struct acpi_gpe_event_info *gpe_event_info;
struct acpi_handler_info *handler;
acpi_status status;
u32 flags;


ACPI_FUNCTION_TRACE ("acpi_install_gpe_handler");
Expand Down Expand Up @@ -643,15 +644,15 @@ acpi_install_gpe_handler (

/* Install the handler */

acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
gpe_event_info->dispatch.handler = handler;

/* Setup up dispatch flags to indicate handler (vs. method) */

gpe_event_info->flags &= ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); /* Clear bits */
gpe_event_info->flags |= (u8) (type | ACPI_GPE_DISPATCH_HANDLER);

acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
acpi_os_release_lock (acpi_gbl_gpe_lock, flags);


unlock_and_exit:
Expand Down Expand Up @@ -685,6 +686,7 @@ acpi_remove_gpe_handler (
struct acpi_gpe_event_info *gpe_event_info;
struct acpi_handler_info *handler;
acpi_status status;
u32 flags;


ACPI_FUNCTION_TRACE ("acpi_remove_gpe_handler");
Expand Down Expand Up @@ -741,7 +743,7 @@ acpi_remove_gpe_handler (

/* Remove the handler */

acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
handler = gpe_event_info->dispatch.handler;

/* Restore Method node (if any), set dispatch flags */
Expand All @@ -751,7 +753,7 @@ acpi_remove_gpe_handler (
if (handler->method_node) {
gpe_event_info->flags |= ACPI_GPE_DISPATCH_METHOD;
}
acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
acpi_os_release_lock (acpi_gbl_gpe_lock, flags);

/* Now we can free the handler object */

Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/executer/exconvrt.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ acpi_ex_convert_to_ascii (

/* hex_length: 2 ascii hex chars per data byte */

hex_length = ACPI_MUL_2 (data_width);
hex_length = (acpi_native_uint) ACPI_MUL_2 (data_width);
for (i = 0, j = (hex_length-1); i < hex_length; i++, j--) {
/* Get one hex digit, most significant digits first */

Expand Down
Loading

0 comments on commit 73459f7

Please sign in to comment.