contents of the acpica branch
Subsystems (3)
The following patches are on the "acpica" branch of the ACPI git tree.
To test, apply this e-mail series, or git pull from here:
git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git acpica
thanks,
-Len
PATCH 1/65 ACPICA: Update function header
From: Robert Moore <[email protected]>
--- drivers/acpi/events/evrgnini.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/acpi/events/evrgnini.c +3 -0
@@ -432,6 +432,9 @@ acpi_ev_default_region_setup(acpi_handle* a PCI address in the scope of the definition. This address is * required to perform an access to PCI config space. * +* MUTEX: Interpreter should be unlocked, because we may run the _REG +* method for this region. +* ******************************************************************************/ acpi_status
Signature · 1 line
1.4.4.1
PATCH 2/65 ACPICA: Handle mis-matched package length
From: Robert Moore <[email protected]>
Implement support within the AML interpreter for package objects that contain a mismatch between the AML length and package element count. In this case, the lesser of the two is used. Some BIOS code apparently modifies the package length on the fly, and this change supports this. Provides compatibility with the MS AML interpreter.
--- drivers/acpi/dispatcher/dsobject.c | 27 +++++++++++++++++++-------- 1 files changed, 19 insertions(+), 8 deletions(-)
drivers/acpi/dispatcher/dsobject.c +19 -8
@@ -318,9 +318,7 @@ acpi_ds_build_internal_package_obj(struc obj_desc->package.node = parent->common.node; } - obj_desc->package.count = package_length; - -/* Count the number of items in the package list */ +/* Count the *actual* number of items in the package list */ arg = op->common.value.arg; arg = arg->common.next;
@@ -329,11 +327,24 @@ acpi_ds_build_internal_package_obj(struc }/* -* The package length (number of elements) will be the greater -* of the specified length and the length of the initializer list +* The number of elements in the package will be the lesser of the +* specified element count and the length of the initializer list. +* +* Even though the ASL compilers do not allow this to happen (for the +* fixed length package opcode), some BIOS code modifies the AML on the +* fly to adjust the package length, and this code compensates for that. +* This also provides compatibility with other AML interpreters. */ -if (package_list_length > package_length) { - obj_desc->package.count = package_list_length; + obj_desc->package.count = package_length; + +if (package_list_length != package_length) { +ACPI_DEBUG_PRINT ((ACPI_DB_INFO , +"Package length mismatch, using lesser of %X(Length Arg) and %X(AML Length)\n" , + package_length, package_list_length)); + +if (package_list_length < package_length) { + obj_desc->package.count = package_list_length; + } }/*
@@ -356,7 +367,7 @@ acpi_ds_build_internal_package_obj(struc*/ arg = op->common.value.arg; arg = arg->common.next; -for (i =0 ; arg; i++) { +for (i =0 ; i < obj_desc->package.count; i++) {if (arg->common.aml_opcode ==AML_INT_RETURN_VALUE_OP ) {/* Object (package or buffer) is already built */
Signature · 1 line
1.4.4.1
PATCH 3/65 ACPICA: Handle case NumElements > Package length
From: Robert Moore <[email protected]>
Additional update for NumElements fix. Must handle case where NumElements > Package list length, pad package with null elements.
--- drivers/acpi/dispatcher/dsobject.c | 87 +++++++++++++++++------------------- 1 files changed, 41 insertions(+), 46 deletions(-)
drivers/acpi/dispatcher/dsobject.c +41 -46
@@ -260,7 +260,7 @@ acpi_ds_build_internal_buffer_obj(struct } obj_desc->buffer.flags |=AOPOBJ_DATA_VALID ; - op->common.node = (struct acpi_namespace_node *)obj_desc; + op->common.node = ACPI_CAST_PTR(struct acpi_namespace_node, obj_desc);return_ACPI_STATUS (AE_OK ); }
@@ -270,7 +270,8 @@ acpi_ds_build_internal_buffer_obj(struct* * PARAMETERS: walk_state - Current walk state * Op - Parser object to be translated -* package_length - Number of elements in the package +* element_count - Number of elements in the package - this is +* the num_elements argument to Package() * obj_desc_ptr - Where the ACPI internal object is returned * * RETURN: Status
@@ -278,18 +279,29 @@ acpi_ds_build_internal_buffer_obj(struct* DESCRIPTION: Translate a parser Op package object to the equivalent * namespace object * +* NOTE: The number of elements in the package will be always be the num_elements +* count, regardless of the number of elements in the package list. If +* num_elements is smaller, only that many package list elements are used. +* if num_elements is larger, the Package object is padded out with +* objects of type Uninitialized (as per ACPI spec.) +* +* Even though the ASL compilers do not allow num_elements to be smaller +* than the Package list length (for the fixed length package opcode), some +* BIOS code modifies the AML on the fly to adjust the num_elements, and +* this code compensates for that. This also provides compatibility with +* other AML interpreters. +* ******************************************************************************/ acpi_status acpi_ds_build_internal_package_obj (struct acpi_walk_state *walk_state,union acpi_parse_object *op, -u32 package_length, +u32 element_count,union acpi_operand_object **obj_desc_ptr) {union acpi_parse_object *arg;union acpi_parse_object *parent;union acpi_operand_object *obj_desc =NULL ; -u32 package_list_length;acpi_status status =AE_OK ;acpi_native_uint i;
@@ -318,43 +330,13 @@ acpi_ds_build_internal_package_obj(struc obj_desc->package.node = parent->common.node; } -/* Count the *actual* number of items in the package list */ - - arg = op->common.value.arg; - arg = arg->common.next; -for (package_list_length =0 ; arg; package_list_length++) { - arg = arg->common.next; - } - -/* -* The number of elements in the package will be the lesser of the -* specified element count and the length of the initializer list. -* -* Even though the ASL compilers do not allow this to happen (for the -* fixed length package opcode), some BIOS code modifies the AML on the -* fly to adjust the package length, and this code compensates for that. -* This also provides compatibility with other AML interpreters. -*/ - obj_desc->package.count = package_length; - -if (package_list_length != package_length) { -ACPI_DEBUG_PRINT ((ACPI_DB_INFO , -"Package length mismatch, using lesser of %X(Length Arg) and %X(AML Length)\n" , - package_length, package_list_length)); - -if (package_list_length < package_length) { - obj_desc->package.count = package_list_length; - } - } -/* -* Allocate the pointer array (array of pointers to the -* individual objects). Add an extra pointer slot so -* that the list is always null terminated. +* Allocate the element array (array of pointers to the individual +* objects) based on the num_elements parameter. Add an extra pointer slot +* so that the list is always null terminated. */ obj_desc->package.elements =ACPI_ALLOCATE_ZEROED (((acpi_size ) - obj_desc->package. - count + + element_count +1 ) *sizeof (void *));if (!obj_desc->package.elements) {
@@ -362,15 +344,20 @@ acpi_ds_build_internal_package_obj(strucreturn_ACPI_STATUS (AE_NO_MEMORY ); } + obj_desc->package.count = element_count; +/* -* Initialize all elements of the package +* Initialize the elements of the package, up to the num_elements count. +* Package is automatically padded with uninitialized (NULL) elements +* if num_elements is greater than the package list length. Likewise, +* Package is truncated if num_elements is less than the list length. */ arg = op->common.value.arg; arg = arg->common.next; -for (i =0 ; i < obj_desc->package.count; i++) { +for (i =0 ; arg && (i < element_count); i++) {if (arg->common.aml_opcode ==AML_INT_RETURN_VALUE_OP ) { -/* Object (package or buffer) is already built */ +/* This package element is already built, just get it */ obj_desc->package.elements[i] = ACPI_CAST_PTR(union acpi_operand_object,
@@ -384,8 +371,14 @@ acpi_ds_build_internal_package_obj(struc arg = arg->common.next; } +if (!arg) { +ACPI_DEBUG_PRINT ((ACPI_DB_INFO , +"Package List length larger than NumElements count (%X), truncated\n" , + element_count)); + } + obj_desc->package.flags |=AOPOBJ_DATA_VALID ; - op->common.node = (struct acpi_namespace_node *)obj_desc; + op->common.node = ACPI_CAST_PTR(struct acpi_namespace_node, obj_desc);return_ACPI_STATUS (status); }
@@ -499,8 +492,9 @@ acpi_ds_init_object_from_op(struct acpi_/* * Defer evaluation of Buffer term_arg operand */ - obj_desc->buffer.node = (struct acpi_namespace_node *) - walk_state->operands[0 ]; + obj_desc->buffer.node = + ACPI_CAST_PTR(struct acpi_namespace_node, + walk_state->operands[0 ]); obj_desc->buffer.aml_start = op->named.data; obj_desc->buffer.aml_length = op->named.length;break ;
@@ -510,8 +504,9 @@ acpi_ds_init_object_from_op(struct acpi_/* * Defer evaluation of Package term_arg operand */ - obj_desc->package.node = (struct acpi_namespace_node *) - walk_state->operands[0 ]; + obj_desc->package.node = + ACPI_CAST_PTR(struct acpi_namespace_node, + walk_state->operands[0 ]); obj_desc->package.aml_start = op->named.data; obj_desc->package.aml_length = op->named.length;break ;
Signature · 1 line
1.4.4.1
PATCH 4/65 ACPICA: Delete recursive feature of ACPI Global Lock
From: Robert Moore <[email protected]>
Completed a new design and implementation for
the ACPI Global Lock support. On the OS side, the global lock is now treated as a standard AML mutex. Previously, multiple OS threads could acquire the global lock simultaneously, but this could cause the BIOS to be starved by the lock in cases such as the Embedded Controller driver, where there is a tight coupling between the OS and the BIOS.
--- drivers/acpi/events/evmisc.c | 113 +++++++++++++++++++------------------ drivers/acpi/executer/exmutex.c | 84 ++++++++++++++++------------ drivers/acpi/executer/exsystem.c | 78 +------------------------- drivers/acpi/namespace/nsaccess.c | 36 +++++------- drivers/acpi/utilities/utdelete.c | 14 +++-- drivers/acpi/utilities/utglobal.c | 2 +- include/acpi/acglobal.h | 2 +- include/acpi/acinterp.h | 6 -- include/acpi/aclocal.h | 1 - 9 files changed, 135 insertions(+), 201 deletions(-)
drivers/acpi/events/evmisc.c +59 -54
@@ -298,19 +298,13 @@ static void ACPI_SYSTEM_XFACE acpi_ev_gl {acpi_status status; -/* Signal threads that are waiting for the lock */ +/* Signal the thread that is waiting for the lock */ -if (acpi_gbl_global_lock_thread_count) { +/* Send a unit to the semaphore */ -/* Send sufficient units to the semaphore */ - - status = -acpi_os_signal_semaphore (acpi_gbl_global_lock_semaphore, - acpi_gbl_global_lock_thread_count); -if (ACPI_FAILURE (status)) { -ACPI_ERROR ((AE_INFO , -"Could not signal Global Lock semaphore" )); - } + status =acpi_os_signal_semaphore (acpi_gbl_global_lock_semaphore,1 ); +if (ACPI_FAILURE (status)) { +ACPI_ERROR ((AE_INFO ,"Could not signal Global Lock semaphore" )); } }
@@ -334,7 +328,8 @@ static u32 acpi_ev_global_lock_handler(vacpi_status status;/* -* Attempt to get the lock +* Attempt to get the lock. +* * If we don't get it now, it will be marked pending and we will * take another interrupt when it becomes free. */
@@ -342,6 +337,7 @@ static u32 acpi_ev_global_lock_handler(vif (acquired) {/* Got the lock, now wake all threads waiting for it */ + acpi_gbl_global_lock_acquired = TRUE;acpi_ev_global_lock_thread (context); }
@@ -400,6 +396,16 @@ acpi_status acpi_ev_init_global_lock_han* * DESCRIPTION: Attempt to gain ownership of the Global Lock. * +* MUTEX: Interpreter must be locked +* +* Note: The original implementation allowed multiple threads to "acquire" the +* Global Lock, and the OS would hold the lock until the last thread had +* released it. However, this could potentially starve the BIOS out of the +* lock, especially in the case where there is a tight handshake between the +* Embedded Controller driver and the BIOS. Therefore, this implementation +* allows only one thread to acquire the HW Global Lock at a time, and makes +* the global lock appear as a standard mutex on the OS side. +* *****************************************************************************/ acpi_status acpi_ev_acquire_global_lock (u16 timeout)
@@ -409,27 +415,25 @@ acpi_status acpi_ev_acquire_global_lock(ACPI_FUNCTION_TRACE (ev_acquire_global_lock); -#ifndef ACPI_APPLICATION -/* Make sure that we actually have a global lock */ - -if (!acpi_gbl_global_lock_present) { -return_ACPI_STATUS (AE_NO_GLOBAL_LOCK ); +/* +* Only one thread can acquire the GL at a time, the global_lock_mutex +* enforces this. This interface releases the interpreter if we must wait. +*/ + status =acpi_ex_system_wait_mutex (acpi_gbl_global_lock_mutex, timeout); +if (ACPI_FAILURE (status)) { +return_ACPI_STATUS (status); } -#endif - -/* One more thread wants the global lock */ - - acpi_gbl_global_lock_thread_count++;/* -* If we (OS side vs. BIOS side) have the hardware lock already, -* we are done +* Make sure that a global lock actually exists. If not, just treat +* the lock as a standard mutex. */ -if (acpi_gbl_global_lock_acquired) { +if (!acpi_gbl_global_lock_present) { + acpi_gbl_global_lock_acquired = TRUE;return_ACPI_STATUS (AE_OK ); } -/* We must acquire the actual hardware lock */ +/* Attempt to acquire the actual hardware lock */ ACPI_ACQUIRE_GLOBAL_LOCK (acpi_gbl_common_fACS.global_lock, acquired);if (acquired) {
@@ -437,25 +441,24 @@ acpi_status acpi_ev_acquire_global_lock(/* We got the lock */ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC , -"Acquired the HW Global Lock\n" )); +"Acquired hardware Global Lock\n" )); acpi_gbl_global_lock_acquired = TRUE;return_ACPI_STATUS (AE_OK ); }/* -* Did not get the lock. The pending bit was set above, and we must now +* 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_EXEC ,"Waiting for the HW Global Lock\n" )); +ACPI_DEBUG_PRINT ((ACPI_DB_EXEC ,"Waiting for hardware Global Lock\n" ));/* -* Acquire the global lock semaphore first. -* Since this wait will block, we must release the interpreter +* Wait for handshake with the global lock interrupt handler. +* This interface releases the interpreter if we must wait. */ - status = -acpi_ex_system_wait_semaphore (acpi_gbl_global_lock_semaphore, - timeout); + status =acpi_ex_system_wait_semaphore (acpi_gbl_global_lock_semaphore, +ACPI_WAIT_FOREVER );return_ACPI_STATUS (status); }
@@ -478,38 +481,40 @@ acpi_status acpi_ev_release_global_lock(ACPI_FUNCTION_TRACE (ev_release_global_lock); -if (!acpi_gbl_global_lock_thread_count) { +/* Lock must be acquired */ + +if (!acpi_gbl_global_lock_acquired) {ACPI_WARNING ((AE_INFO , -"Cannot release HW Global Lock, it has not been acquired" )); +"Cannot release the ACPI Global Lock, it has not been acquired" ));return_ACPI_STATUS (AE_NOT_ACQUIRED ); } -/* One fewer thread has the global lock */ +if (acpi_gbl_global_lock_present) { - acpi_gbl_global_lock_thread_count--; -if (acpi_gbl_global_lock_thread_count) { +/* Allow any thread to release the lock */ -/* There are still some threads holding the lock, cannot release */ +ACPI_RELEASE_GLOBAL_LOCK (acpi_gbl_common_fACS.global_lock, + pending); -return_ACPI_STATUS (AE_OK ); +/* +* If the pending bit was set, we must write GBL_RLS to the control +* register +*/ +if (pending) { + status = +acpi_set_register (ACPI_BITREG_GLOBAL_LOCK_RELEASE , +1 ,ACPI_MTX_LOCK ); + } + +ACPI_DEBUG_PRINT ((ACPI_DB_EXEC , +"Released hardware Global Lock\n" )); } -/* -* No more threads holding lock, we can do the actual hardware -* release -*/ -ACPI_RELEASE_GLOBAL_LOCK (acpi_gbl_common_fACS.global_lock, pending); acpi_gbl_global_lock_acquired = FALSE; -/* -* If the pending bit was set, we must write GBL_RLS to the control -* register -*/ -if (pending) { - status =acpi_set_register (ACPI_BITREG_GLOBAL_LOCK_RELEASE , -1 ,ACPI_MTX_LOCK ); - } +/* Release the local GL mutex */ +acpi_os_release_mutex (acpi_gbl_global_lock_mutex);return_ACPI_STATUS (status); }
drivers/acpi/executer/exmutex.c +48 -36
169 lines not on this page · raw message
drivers/acpi/executer/exsystem.c +1 -77
90 lines not on this page · raw message
drivers/acpi/namespace/nsaccess.c +16 -20
@@ -195,31 +195,27 @@ acpi_status acpi_ns_root_initialize(void obj_desc->mutex.sync_level = (u8) (ACPI_TO_INTEGER (val) -1 ); -if (ACPI_STRCMP (init_val->name,"_GL_" ) ==0 ) { - -/* Create a counting semaphore for the global lock */ +/* Create a mutex */ + + status = +acpi_os_create_mutex (&obj_desc->mutex. + os_mutex); +if (ACPI_FAILURE (status)) { +acpi_ut_remove_reference (obj_desc); + goto unlock_and_exit; + } - status = -acpi_os_create_semaphore - (ACPI_NO_UNIT_LIMIT ,1 , - &acpi_gbl_global_lock_semaphore); -if (ACPI_FAILURE (status)) { -acpi_ut_remove_reference - (obj_desc); - goto unlock_and_exit; - } +/* Special case for ACPI Global Lock */ -/* Mark this mutex as very special */ +if (ACPI_STRCMP (init_val->name,"_GL_" ) ==0 ) { + acpi_gbl_global_lock_mutex = + obj_desc->mutex.os_mutex; - obj_desc->mutex.os_mutex = -ACPI_GLOBAL_LOCK ; - }else { -/* Create a mutex */ +/* Create additional counting semaphore for global lock */ status = -acpi_os_create_mutex (&obj_desc-> - mutex. - os_mutex); +acpi_os_create_semaphore (1 ,1 , + &acpi_gbl_global_lock_semaphore);if (ACPI_FAILURE (status)) {acpi_ut_remove_reference (obj_desc);
drivers/acpi/utilities/utdelete.c +9 -5
@@ -158,16 +158,20 @@ static void acpi_ut_delete_internal_obj("***** Mutex %p, OS Mutex %p\n" , object, object->mutex.os_mutex)); -if (object->mutex.os_mutex !=ACPI_GLOBAL_LOCK ) { -acpi_ex_unlink_mutex (object); -acpi_os_delete_mutex (object->mutex.os_mutex); - }else { -/* Global Lock "mutex" is actually a counting semaphore */ +if (object->mutex.os_mutex == acpi_gbl_global_lock_mutex) { + +/* Global Lock has extra semaphore */ (void )acpi_os_delete_semaphore (acpi_gbl_global_lock_semaphore); acpi_gbl_global_lock_semaphore =NULL ; + +acpi_os_delete_mutex (object->mutex.os_mutex); + acpi_gbl_global_lock_mutex =NULL ; + }else { +acpi_ex_unlink_mutex (object); +acpi_os_delete_mutex (object->mutex.os_mutex); }break ;
drivers/acpi/utilities/utglobal.c +1 -1
@@ -795,8 +795,8 @@ void acpi_ut_init_globals(void)/* Global Lock support */ acpi_gbl_global_lock_semaphore =NULL ; + acpi_gbl_global_lock_mutex =NULL ; acpi_gbl_global_lock_acquired = FALSE; - acpi_gbl_global_lock_thread_count =0 ; acpi_gbl_global_lock_handle =0 ;/* Miscellaneous variables */
include/acpi/acglobal.h +1 -1
@@ -197,6 +197,7 @@ ACPI_EXTERN struct acpi_mutex_info acpi_/* * Global lock semaphore works in conjunction with the actual HW global lock */ +ACPI_EXTERN acpi_mutex acpi_gbl_global_lock_mutex; ACPI_EXTERN acpi_semaphore acpi_gbl_global_lock_semaphore;/*
@@ -240,7 +241,6 @@ ACPI_EXTERN struct acpi_walk_state *acpi/* 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; ACPI_EXTERN u32 acpi_gbl_ns_lookup_count;
include/acpi/acinterp.h +0 -6
@@ -277,12 +277,6 @@ acpi_status acpi_ex_system_do_suspend(acacpi_status acpi_ex_system_do_stall (u32 time); -acpi_status -acpi_ex_system_acquire_mutex (union acpi_operand_object *time, -union acpi_operand_object *obj_desc); - -acpi_status acpi_ex_system_release_mutex (union acpi_operand_object *obj_desc); -acpi_status acpi_ex_system_signal_event (union acpi_operand_object *obj_desc); acpi_status
include/acpi/aclocal.h +0 -1
@@ -51,7 +51,6 @@#define ACPI_SERIALIZED 0xFFtypedef u32 acpi_mutex_handle ; -#define ACPI_GLOBAL_LOCK (acpi_semaphore) (-1)/* Total number of aml opcodes defined */
Signature · 1 line
1.4.4.1
PATCH 5/65 ACPICA: Release global lock from interrupt handler
From: Robert Moore <[email protected]>
The ACPI Global Lock interrupt handler no longer queues the execution of a separate thread to signal the global lock semaphore. Instead, the semaphore is signaled directly from the interrupt handler.
--- drivers/acpi/events/evmisc.c | 51 +++++++++++++---------------------------- 1 files changed, 16 insertions(+), 35 deletions(-)
drivers/acpi/events/evmisc.c +16 -35
@@ -67,8 +67,6 @@ static const char *acpi_notify_value_nam static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context); -static void ACPI_SYSTEM_XFACE acpi_ev_global_lock_thread(void *context); -static u32 acpi_ev_global_lock_handler (void *context);/*******************************************************************************
@@ -282,43 +280,19 @@ static void ACPI_SYSTEM_XFACE acpi_ev_no/******************************************************************************* * -* FUNCTION: acpi_ev_global_lock_thread -* -* PARAMETERS: Context - From thread interface, not used -* -* RETURN: None -* -* DESCRIPTION: Invoked by SCI interrupt handler upon acquisition of the -* Global Lock. Simply signal all threads that are waiting -* for the lock. -* -******************************************************************************/ - -static void ACPI_SYSTEM_XFACE acpi_ev_global_lock_thread(void *context) -{ -acpi_status status; - -/* Signal the thread that is waiting for the lock */ - -/* Send a unit to the semaphore */ - - status =acpi_os_signal_semaphore (acpi_gbl_global_lock_semaphore,1 ); -if (ACPI_FAILURE (status)) { -ACPI_ERROR ((AE_INFO ,"Could not signal Global Lock semaphore" )); - } -} - -/******************************************************************************* -* * FUNCTION: acpi_ev_global_lock_handler * * PARAMETERS: Context - From thread interface, not used * -* RETURN: ACPI_INTERRUPT_HANDLED or ACPI_INTERRUPT_NOT_HANDLED +* RETURN: ACPI_INTERRUPT_HANDLED * * DESCRIPTION: Invoked directly from the SCI handler when a global lock -* release interrupt occurs. Grab the global lock and queue -* the global lock thread for execution +* release interrupt occurs. Attempt to acquire the global lock, +* if successful, signal the thread waiting for the lock. +* +* NOTE: Assumes that the semaphore can be signaled from interrupt level. If +* this is not possible for some reason, a separate thread will have to be +* scheduled to do this. * ******************************************************************************/
@@ -339,7 +313,14 @@ static u32 acpi_ev_global_lock_handler(v/* Got the lock, now wake all threads waiting for it */ acpi_gbl_global_lock_acquired = TRUE; -acpi_ev_global_lock_thread (context); +/* Send a unit to the semaphore */ + + status = +acpi_os_signal_semaphore (acpi_gbl_global_lock_semaphore,1 ); +if (ACPI_FAILURE (status)) { +ACPI_ERROR ((AE_INFO , +"Could not signal Global Lock semaphore" )); + } }return (ACPI_INTERRUPT_HANDLED );
@@ -481,7 +462,7 @@ acpi_status acpi_ev_release_global_lock(ACPI_FUNCTION_TRACE (ev_release_global_lock); -/* Lock must be acquired */ +/* Lock must be already acquired */ if (!acpi_gbl_global_lock_acquired) { ACPI_WARNING((AE_INFO,
Signature · 1 line
1.4.4.1
PATCH 6/65 ACPICA: Cast acpi_thread_id to UINT32 for debug output only
From: Robert Moore <[email protected]>
--- drivers/acpi/utilities/utdebug.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/acpi/utilities/utdebug.c +3 -3
@@ -47,7 +47,7 @@ ACPI_MODULE_NAME("utdebug")#ifdef ACPI_DEBUG_OUTPUT -static acpi_thread_id acpi_gbl_prev_thread_id; +static acpi_thread_id acpi_gbl_prev_thread_id =0 ;static char *acpi_gbl_fn_entry_str ="----Entry" ;static char *acpi_gbl_fn_exit_str ="----Exit-" ;
@@ -181,7 +181,7 @@ acpi_ut_debug_print(u32 requested_debug_if (ACPI_LV_THREADS & acpi_dbg_level) {acpi_os_printf ("\n**** Context Switch from TID %X to TID %X ****\n\n" , - (u32 ) acpi_gbl_prev_thread_id, (u32 ) thread_id); + (unsigned )acpi_gbl_prev_thread_id, (unsigned )thread_id); } acpi_gbl_prev_thread_id = thread_id;
@@ -194,7 +194,7 @@ acpi_ut_debug_print(u32 requested_debug_acpi_os_printf ("%8s-%04ld " , module_name, line_number);if (ACPI_LV_THREADS & acpi_dbg_level) { -acpi_os_printf ("[%04lX] " , thread_id); +acpi_os_printf ("[%04X] " , (unsigned )thread_id); } acpi_os_printf("[%02ld] %-22.22s: ",
Signature · 1 line
1.4.4.1
PATCH 7/65 ACPICA: fix for object premature deletion
From: Robert Moore <[email protected]>
Fix for object premature deletion after CopyObject on Operation Region (BZ 350)
--- drivers/acpi/utilities/utcopy.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
drivers/acpi/utilities/utcopy.c +9 -0
@@ -719,6 +719,15 @@ acpi_ut_copy_simple_object(union acpi_opacpi_ut_add_reference (source_desc->reference.object);break ; +case ACPI_TYPE_REGION : +/* +* We copied the Region Handler, so we now must add a reference +*/ +if (dest_desc->region.handler) { +acpi_ut_add_reference (dest_desc->region.handler); + } +break ; +default :/* Nothing to do for other simple objects */ break ;
Signature · 1 line
1.4.4.1
PATCH 8/65 ACPICA: Temporary fix for BankValue parameter
From: Robert Moore <[email protected]>
Temporary fix for BankValue parameter of a Bank Field to support all constant values, including Zero and One. Must eventually be converted to a full TermArg evaluation.
--- drivers/acpi/dispatcher/dsfield.c | 30 ++++++++++++++++++++++++++++-- 1 files changed, 28 insertions(+), 2 deletions(-)
drivers/acpi/dispatcher/dsfield.c +28 -2
@@ -133,7 +133,8 @@ acpi_ds_create_buffer_field(union acpi_p } } -/* We could put the returned object (Node) on the object stack for later, +/* +* We could put the returned object (Node) on the object stack for later, * but for now, we will put it in the "op" object that the parser uses, * so we can get it again at the end of this scope */
@@ -514,8 +515,33 @@ acpi_ds_create_bank_field(union acpi_par/* Third arg is the bank_value */ +/* TBD: This arg is a term_arg, not a constant, and must be evaluated */ + arg = arg->common.next; - info.bank_value = (u32 ) arg->common.value.integer; + +/* Currently, only the following constants are supported */ + +switch (arg->common.aml_opcode) { +case AML_ZERO_OP : + info.bank_value =0 ; +break ; + +case AML_ONE_OP : + info.bank_value =1 ; +break ; + +case AML_BYTE_OP : +case AML_WORD_OP : +case AML_DWORD_OP : +case AML_QWORD_OP : + info.bank_value = (u32 ) arg->common.value.integer; +break ; + +default : + info.bank_value =0 ; +ACPI_ERROR ((AE_INFO , +"Non-constant BankValue for BankField is not implemented" )); + }/* Fourth arg is the field flags */
Signature · 1 line
1.4.4.1
PATCH 9/65 ACPICA: Update version to 20060721
From: Robert Moore <[email protected]>
--- include/acpi/acconfig.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/acpi/acconfig.h +1 -1
@@ -63,7 +63,7 @@/* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20060707 +#define ACPI_CA_VERSION 0x20060721/* * OS name, used for the _OS object. The _OS object is essentially obsolete,
Signature · 1 line
1.4.4.1
PATCH 10/65 ACPICA: Update debug output
From: Robert Moore <[email protected]>
--- drivers/acpi/events/evgpe.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/acpi/events/evgpe.c +1 -1
@@ -570,7 +570,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asif (ACPI_FAILURE (status)) {ACPI_EXCEPTION ((AE_INFO , status, -"While evaluating GPE method [%4.4s]" , +"while evaluating GPE method [%4.4s]" ,acpi_ut_get_node_name (local_gpe_event_info.dispatch. method_node)));
Signature · 1 line
1.4.4.1
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 12/65 ACPICA: misc fixes for new Table Manager:
From: Robert Moore <[email protected]>
--- drivers/acpi/tables/tbinstal.c | 35 +-- drivers/acpi/tables/tbutils.c | 544 ++++++++++++++++++++++++-------------- drivers/acpi/tables/tbxface.c | 58 +++-- drivers/acpi/utilities/utmisc.c | 8 +- include/acpi/acconfig.h | 2 +- include/acpi/aclocal.h | 21 +- include/acpi/actables.h | 6 +- include/acpi/actbl.h | 12 +- 8 files changed, 420 insertions(+), 266 deletions(-)
drivers/acpi/tables/tbinstal.c +11 -24
@@ -61,7 +61,7 @@ ACPI_MODULE_NAME("tbinstal")*****************************************************************************/ acpi_status acpi_tb_verify_table (struct acpi_table_desc *table_desc) { -u8 checksum; +acpi_status status;ACPI_FUNCTION_TRACE (tb_verify_table);
@@ -84,17 +84,9 @@ acpi_status acpi_tb_verify_table(struct/* Always calculate checksum, ignore bad checksum if requested */ - checksum =acpi_tb_checksum (ACPI_CAST_PTR (void, table_desc->pointer), - table_desc->length); - -#if (ACPI_CHECKSUM_ABORT ) - -if (checksum) { -return_ACPI_STATUS (AE_BAD_CHECKSUM ); - } -#endif - -return_ACPI_STATUS (AE_OK ); + status = +acpi_tb_verify_checksum (table_desc->pointer, table_desc->length); +return_ACPI_STATUS (status); }/*******************************************************************************
@@ -188,7 +180,7 @@ acpi_status acpi_tb_resize_root_table_li/* allow_resize flag is a parameter to acpi_initialize_tables */ -if (!(acpi_gbl_root_table_list.flags &ACPI_TABLE_FLAGS_ALLOW_RESIZE )) { +if (!(acpi_gbl_root_table_list.flags &ACPI_ROOT_ALLOW_RESIZE )) {ACPI_ERROR ((AE_INFO ,"Resize of Root Table Array is not allowed" ));return_ACPI_STATUS (AE_SUPPORT );
@@ -212,18 +204,14 @@ acpi_status acpi_tb_resize_root_table_li acpi_gbl_root_table_list.size * sizeof(struct acpi_table_desc)); -if (acpi_gbl_root_table_list.flags &ACPI_TABLE_ORIGIN_MASK == -ACPI_TABLE_ORIGIN_ALLOCATED ) { +if (acpi_gbl_root_table_list.flags &ACPI_ROOT_ORIGIN_ALLOCATED ) {ACPI_FREE (acpi_gbl_root_table_list.tables); } } acpi_gbl_root_table_list.tables = tables; acpi_gbl_root_table_list.size +=ACPI_ROOT_TABLE_SIZE_INCREMENT ; - acpi_gbl_root_table_list.flags = (u8) (ACPI_TABLE_ORIGIN_ALLOCATED | - (acpi_gbl_root_table_list. - flags & - ~ACPI_TABLE_ORIGIN_MASK )); + acpi_gbl_root_table_list.flags |= (u8 )ACPI_ROOT_ORIGIN_ALLOCATED ;return_ACPI_STATUS (AE_OK ); }
@@ -348,8 +336,7 @@ void acpi_tb_terminate(void)* Delete the root table array if allocated locally. Array cannot be * mapped, so we don't need to check for that flag. */ -if ((acpi_gbl_root_table_list.flags &ACPI_TABLE_ORIGIN_MASK ) == -ACPI_TABLE_ORIGIN_ALLOCATED ) { +if (acpi_gbl_root_table_list.flags &ACPI_ROOT_ORIGIN_ALLOCATED ) {ACPI_FREE (acpi_gbl_root_table_list.tables); }
@@ -497,7 +484,7 @@ u8 acpi_tb_is_table_loaded(acpi_native_uif (table_index < acpi_gbl_root_table_list.count) { is_loaded = (u8) (acpi_gbl_root_table_list.tables[table_index]. - flags &ACPI_TABLE_FLAGS_LOADED ); + flags &ACPI_TABLE_IS_LOADED ); } (void )acpi_ut_release_mutex (ACPI_MTX_TABLES );
@@ -524,10 +511,10 @@ void acpi_tb_set_table_loaded_flag(acpi_if (table_index < acpi_gbl_root_table_list.count) {if (is_loaded) { acpi_gbl_root_table_list.tables[table_index].flags |= -ACPI_TABLE_FLAGS_LOADED ; +ACPI_TABLE_IS_LOADED ; }else { acpi_gbl_root_table_list.tables[table_index].flags &= - ~ACPI_TABLE_FLAGS_LOADED ; + ~ACPI_TABLE_IS_LOADED ; } }
drivers/acpi/tables/tbutils.c +343 -201
725 lines not on this page · raw message
drivers/acpi/tables/tbxface.c +35 -23
128 lines not on this page · raw message
drivers/acpi/utilities/utmisc.c +6 -2
@@ -996,9 +996,13 @@ acpi_ut_info(char *module_name, u32 line {va_list args; -acpi_os_printf ("ACPI (%s-%04d): " , module_name, line_number); +/* +* Removed module_name, line_number, and acpica version, not needed +* for info output +*/ +acpi_os_printf ("ACPI: " );va_start (args, format);acpi_os_vprintf (format, args); -acpi_os_printf (" [%X]\n" ,ACPI_CA_VERSION ); +acpi_os_printf ("\n" ); }
include/acpi/acconfig.h +1 -1
@@ -63,7 +63,7 @@/* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20060823 +#define ACPI_CA_VERSION 0x20060828/* * OS name, used for the _OS object. The _OS object is essentially obsolete,
include/acpi/aclocal.h +14 -7
@@ -227,6 +227,16 @@ struct acpi_table_desc {u8 flags; }; +/* Flags for above */ + +#define ACPI_TABLE_ORIGIN_UNKNOWN (0) +#define ACPI_TABLE_ORIGIN_MAPPED (1) +#define ACPI_TABLE_ORIGIN_ALLOCATED (2) +#define ACPI_TABLE_ORIGIN_MASK (3) +#define ACPI_TABLE_IS_LOADED (4) + +/* One internal RSDT for table management */ +struct acpi_internal_rsdt {struct acpi_table_desc *tables;u32 count;
@@ -234,14 +244,11 @@ struct acpi_internal_rsdt {u8 flags; }; -/* Flags for both structs above */ +/* Flags for above */ -#define ACPI_TABLE_ORIGIN_UNKNOWN (0) -#define ACPI_TABLE_ORIGIN_MAPPED (1) -#define ACPI_TABLE_ORIGIN_ALLOCATED (2) -#define ACPI_TABLE_ORIGIN_MASK (3) -#define ACPI_TABLE_FLAGS_LOADED (4) -#define ACPI_TABLE_FLAGS_ALLOW_RESIZE (8) +#define ACPI_ROOT_ORIGIN_UNKNOWN (0)/* ~ORIGIN_ALLOCATED */ +#define ACPI_ROOT_ORIGIN_ALLOCATED (1) +#define ACPI_ROOT_ALLOW_RESIZE (2)/* Predefined (fixed) table indexes */
include/acpi/actables.h +4 -2
@@ -94,9 +94,11 @@ acpi_tb_print_table_header(acpi_physicalu8 acpi_tb_checksum (u8 * buffer,acpi_native_uint length); -void acpi_tb_convert_fadt (struct acpi_table_fadt *fadt); +acpi_status +acpi_tb_verify_checksum (struct acpi_table_header *table,u32 length); -acpi_status acpi_tb_parse_root_table (struct acpi_table_rsdp *rsdp,u8 flags); +acpi_status +acpi_tb_parse_root_table (acpi_physical_address rsdp_address,u8 flags);void *acpi_tb_map (acpi_physical_address address,u32 length,u32 flags);
include/acpi/actbl.h +6 -6
@@ -199,8 +199,8 @@ struct acpi_table_fadt {u32 pm1b_control_block;/* Port address of Power Mgt 1b Control Reg Blk */ u32 pm2_control_block;/* Port address of Power Mgt 2 Control Reg Blk */ u32 pm_timer_block;/* Port address of Power Mgt Timer Ctrl Reg Blk */ -u32 gpe0_block;/* Port addr of General Purpose acpi_event 0 Reg Blk */ -u32 gpe1_block;/* Port addr of General Purpose acpi_event 1 Reg Blk */ +u32 gpe0_block;/* Port addr of General Purpose Event 0 Reg Blk */ +u32 gpe1_block;/* Port addr of General Purpose Event 1 Reg Blk */ u8 pm1_event_length;/* Byte Length of ports at pm1_x_evt_blk */ u8 pm1_control_length;/* Byte Length of ports at pm1_x_cnt_blk */ u8 pm2_control_length;/* Byte Length of ports at pm2_cnt_blk */
@@ -226,14 +226,14 @@ struct acpi_table_fadt {u8 reserved4[3 ];/* These three bytes must be zero */ u64 Xfacs;/* 64-bit physical address of FACS */ u64 Xdsdt;/* 64-bit physical address of DSDT */ -struct acpi_generic_address xpm1a_event_block;/* Extended Power Mgt 1a acpi_event Reg Blk address */ -struct acpi_generic_address xpm1b_event_block;/* Extended Power Mgt 1b acpi_event Reg Blk address */ +struct acpi_generic_address xpm1a_event_block;/* Extended Power Mgt 1a Event Reg Blk address */ +struct acpi_generic_address xpm1b_event_block;/* Extended Power Mgt 1b Event Reg Blk address */ struct acpi_generic_address xpm1a_control_block;/* Extended Power Mgt 1a Control Reg Blk address */ struct acpi_generic_address xpm1b_control_block;/* Extended Power Mgt 1b Control Reg Blk address */ struct acpi_generic_address xpm2_control_block;/* Extended Power Mgt 2 Control Reg Blk address */ struct acpi_generic_address xpm_timer_block;/* Extended Power Mgt Timer Ctrl Reg Blk address */ -struct acpi_generic_address xgpe0_block;/* Extended General Purpose acpi_event 0 Reg Blk address */ -struct acpi_generic_address xgpe1_block;/* Extended General Purpose acpi_event 1 Reg Blk address */ +struct acpi_generic_address xgpe0_block;/* Extended General Purpose Event 0 Reg Blk address */ +struct acpi_generic_address xgpe1_block;/* Extended General Purpose Event 1 Reg Blk address */ };/* FADT flags */
Signature · 1 line
1.4.4.1
PATCH 13/65 ACPICA: Update comments for individual table fields
From: Robert Moore <[email protected]>
comments only
--- include/acpi/actbl.h | 64 +++++++++++++++++++++++++------------------------- 1 files changed, 32 insertions(+), 32 deletions(-)
include/acpi/actbl.h +32 -32
@@ -56,7 +56,7 @@#define ACPI_SIG_RSDT "RSDT"/* Root System Description Table */ #define ACPI_SIG_XSDT "XSDT"/* Extended System Description Table */ #define ACPI_SIG_SSDT "SSDT"/* Secondary System Description Table */ -#define ACPI_RSDP_NAME "RSDP" +#define ACPI_RSDP_NAME "RSDP"/* Short name for RSDP, not signature */ /* * All tables and structures must be byte-packed to match the ACPI
@@ -185,55 +185,55 @@ struct acpi_table_fadt {struct acpi_table_header header;/* Common ACPI table header */ u32 facs;/* 32-bit physical address of FACS */ u32 dsdt;/* 32-bit physical address of DSDT */ -u8 model;/* System Interrupt Model (ACPI 1.0) not used in ACPI 2.0+ */ +u8 model;/* System Interrupt Model (ACPI 1.0) - not used in ACPI 2.0+ */ u8 preferred_profile;/* Conveys preferred power management profile to OSPM. */ u16 sci_interrupt;/* System vector of SCI interrupt */ -u32 smi_command;/* Port address of SMI command port */ +u32 smi_command;/* 32-bit Port address of SMI command port */ u8 acpi_enable;/* Value to write to smi_cmd to enable ACPI */ u8 acpi_disable;/* Value to write to smi_cmd to disable ACPI */ u8 S4bios_request;/* Value to write to SMI CMD to enter S4BIOS state */ u8 pstate_control;/* Processor performance state control */ -u32 pm1a_event_block;/* Port address of Power Mgt 1a Event Reg Blk */ -u32 pm1b_event_block;/* Port address of Power Mgt 1b Event Reg Blk */ -u32 pm1a_control_block;/* Port address of Power Mgt 1a Control Reg Blk */ -u32 pm1b_control_block;/* Port address of Power Mgt 1b Control Reg Blk */ -u32 pm2_control_block;/* Port address of Power Mgt 2 Control Reg Blk */ -u32 pm_timer_block;/* Port address of Power Mgt Timer Ctrl Reg Blk */ -u32 gpe0_block;/* Port addr of General Purpose Event 0 Reg Blk */ -u32 gpe1_block;/* Port addr of General Purpose Event 1 Reg Blk */ -u8 pm1_event_length;/* Byte Length of ports at pm1_x_evt_blk */ -u8 pm1_control_length;/* Byte Length of ports at pm1_x_cnt_blk */ -u8 pm2_control_length;/* Byte Length of ports at pm2_cnt_blk */ -u8 pm_timer_length;/* Byte Length of ports at pm_tmr_blk */ -u8 gpe0_block_length;/* Byte Length of ports at gpe0_blk */ -u8 gpe1_block_length;/* Byte Length of ports at gpe1_blk */ -u8 gpe1_base;/* Offset in gpe model where gpe1 events start */ -u8 cst_control;/* Support for the _CST object and C States change notification. */ +u32 pm1a_event_block;/* 32-bit Port address of Power Mgt 1a Event Reg Blk */ +u32 pm1b_event_block;/* 32-bit Port address of Power Mgt 1b Event Reg Blk */ +u32 pm1a_control_block;/* 32-bit Port address of Power Mgt 1a Control Reg Blk */ +u32 pm1b_control_block;/* 32-bit Port address of Power Mgt 1b Control Reg Blk */ +u32 pm2_control_block;/* 32-bit Port address of Power Mgt 2 Control Reg Blk */ +u32 pm_timer_block;/* 32-bit Port address of Power Mgt Timer Ctrl Reg Blk */ +u32 gpe0_block;/* 32-bit Port address of General Purpose Event 0 Reg Blk */ +u32 gpe1_block;/* 32-bit Port address of General Purpose Event 1 Reg Blk */ +u8 pm1_event_length;/* Byte Length of ports at pm1x_event_block */ +u8 pm1_control_length;/* Byte Length of ports at pm1x_control_block */ +u8 pm2_control_length;/* Byte Length of ports at pm2_control_block */ +u8 pm_timer_length;/* Byte Length of ports at pm_timer_block */ +u8 gpe0_block_length;/* Byte Length of ports at gpe0_block */ +u8 gpe1_block_length;/* Byte Length of ports at gpe1_block */ +u8 gpe1_base;/* Offset in GPE number space where GPE1 events start */ +u8 cst_control;/* Support for the _CST object and C States change notification */ u16 C2latency;/* Worst case HW latency to enter/exit C2 state */ u16 C3latency;/* Worst case HW latency to enter/exit C3 state */ u16 flush_size;/* Processor's memory cache line width, in bytes */ u16 flush_stride;/* Number of flush strides that need to be read */ -u8 duty_offset;/* Processor's duty cycle index in processor's P_CNT reg */ -u8 duty_width;/* Processor's duty cycle value bit width in P_CNT register. */ +u8 duty_offset;/* Processor duty cycle index in processor's P_CNT reg */ +u8 duty_width;/* Processor duty cycle value bit width in P_CNT register. */ u8 day_alarm;/* Index to day-of-month alarm in RTC CMOS RAM */ u8 month_alarm;/* Index to month-of-year alarm in RTC CMOS RAM */ u8 century;/* Index to century in RTC CMOS RAM */ u16 boot_flags;/* IA-PC Boot Architecture Flags. See Table 5-10 for description */ u8 reserved;/* Reserved, must be zero */ -u32 flags;/* Miscellaneous flag bits */ -struct acpi_generic_address reset_register;/* Reset register address in GAS format */ +u32 flags;/* Miscellaneous flag bits (see below for individual flags) */ +struct acpi_generic_address reset_register;/* 64-bit address of the Reset register */ u8 reset_value;/* Value to write to the reset_register port to reset the system */ -u8 reserved4[3 ];/* These three bytes must be zero */ +u8 reserved4[3 ];/* Reserved, must be zero */ u64 Xfacs;/* 64-bit physical address of FACS */ u64 Xdsdt;/* 64-bit physical address of DSDT */ -struct acpi_generic_address xpm1a_event_block;/* Extended Power Mgt 1a Event Reg Blk address */ -struct acpi_generic_address xpm1b_event_block;/* Extended Power Mgt 1b Event Reg Blk address */ -struct acpi_generic_address xpm1a_control_block;/* Extended Power Mgt 1a Control Reg Blk address */ -struct acpi_generic_address xpm1b_control_block;/* Extended Power Mgt 1b Control Reg Blk address */ -struct acpi_generic_address xpm2_control_block;/* Extended Power Mgt 2 Control Reg Blk address */ -struct acpi_generic_address xpm_timer_block;/* Extended Power Mgt Timer Ctrl Reg Blk address */ -struct acpi_generic_address xgpe0_block;/* Extended General Purpose Event 0 Reg Blk address */ -struct acpi_generic_address xgpe1_block;/* Extended General Purpose Event 1 Reg Blk address */ +struct acpi_generic_address xpm1a_event_block;/* 64-bit Extended Power Mgt 1a Event Reg Blk address */ +struct acpi_generic_address xpm1b_event_block;/* 64-bit Extended Power Mgt 1b Event Reg Blk address */ +struct acpi_generic_address xpm1a_control_block;/* 64-bit Extended Power Mgt 1a Control Reg Blk address */ +struct acpi_generic_address xpm1b_control_block;/* 64-bit Extended Power Mgt 1b Control Reg Blk address */ +struct acpi_generic_address xpm2_control_block;/* 64-bit Extended Power Mgt 2 Control Reg Blk address */ +struct acpi_generic_address xpm_timer_block;/* 64-bit Extended Power Mgt Timer Ctrl Reg Blk address */ +struct acpi_generic_address xgpe0_block;/* 64-bit Extended General Purpose Event 0 Reg Blk address */ +struct acpi_generic_address xgpe1_block;/* 64-bit Extended General Purpose Event 1 Reg Blk address */ };/* FADT flags */
Signature · 1 line
1.4.4.1
PATCH 14/65 ACPICA: Fix for FADT conversion in 64-bit mode
From: Robert Moore <[email protected]>
--- drivers/acpi/tables/tbutils.c | 21 ++++++++++++++------- 1 files changed, 14 insertions(+), 7 deletions(-)
drivers/acpi/tables/tbutils.c +14 -7
@@ -131,6 +131,8 @@ acpi_tb_print_table_header(acpi_physical ((struct acpi_table_rsdp *)header)->revision, ((struct acpi_table_rsdp *)header)->oem_id)); }else { +/* Standard ACPI table with full common header */ + ACPI_INFO((AE_INFO, "%4.4s @ 0x%p/0x%04X (v%3.3d %6.6s %8.8s 0x%08X %4.4s 0x%08X)", header->signature, ACPI_CAST_PTR(void, address),
@@ -160,7 +162,7 @@ acpi_tb_init_generic_address(struct acpi u8 bit_width, u64 address) { -ACPI_STORE_ADDRESS (new_gas_struct->address, address); +ACPI_MOVE_64_TO_64 (&new_gas_struct->address, &address); new_gas_struct->space_id =ACPI_ADR_SPACE_SYSTEM_IO ; new_gas_struct->bit_width = bit_width; new_gas_struct->bit_offset =0 ;
@@ -284,13 +286,15 @@ static void acpi_tb_convert_fadt(void) ACPI_ADD_PTR(struct acpi_generic_address, &acpi_gbl_FADT, fadt_conversion_table[i].target); +/* Expand only if the X target is null */ +if (!target->address) {acpi_tb_init_generic_address (target, *ACPI_ADD_PTR (u8, &acpi_gbl_FADT, fadt_conversion_table [i].length), - *ACPI_ADD_PTR (u64, + *ACPI_ADD_PTR (u32, &acpi_gbl_FADT, fadt_conversion_table [i].source));
@@ -301,6 +305,10 @@ static void acpi_tb_convert_fadt(void)* Calculate separate GAS structs for the PM1 Enable registers. * These addresses do not appear (directly) in the FADT, so it is * useful to calculate them once, here. +* +* The PM event blocks are split into two register blocks, first is the +* PM Status Register block, followed immediately by the PM Enable Register +* block. Each is of length (pm1_event_length/2) */ pm1_register_length = (u8 )ACPI_DIV_2 (acpi_gbl_FADT.pm1_event_length);
@@ -308,17 +316,16 @@ static void acpi_tb_convert_fadt(void)acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable, pm1_register_length, - (u64) (acpi_gbl_FADT.xpm1a_event_block. - address + pm1_register_length)); + (acpi_gbl_FADT.xpm1a_event_block.address + + pm1_register_length));/* PM1B is optional; leave null if not present */ if (acpi_gbl_FADT.xpm1b_event_block.address) {acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable, pm1_register_length, - (u64) (acpi_gbl_FADT. - xpm1b_event_block.address + - pm1_register_length)); + (acpi_gbl_FADT.xpm1b_event_block. + address + pm1_register_length)); }/* Global FADT is the new common V2.0 FADT */
Signature · 1 line
1.4.4.1
PATCH 15/65 ACPICA: Lint changes
From: Robert Moore <[email protected]>
Lint changes
Move RSDT/XSDT pointer extraction to separate function Warning on 32-bit platforms if XSDT pointers use more than 32 bits.
--- drivers/acpi/tables/tbutils.c | 121 ++++++++++++++++++++++++++++------------- drivers/acpi/tables/tbxface.c | 4 +- 2 files changed, 84 insertions(+), 41 deletions(-)
drivers/acpi/tables/tbutils.c +82 -39
@@ -60,6 +60,10 @@ static void inline acpi_tb_init_generic_address(struct acpi_generic_address *new_gas_struct, u8 bit_width, u64 address); +static acpi_physical_address +acpi_tb_get_root_table_entry (u8 * table_entry, +acpi_native_uint table_entry_size); +/* Table used for conversion of FADT to common format */ typedef struct acpi_fadt_conversion {
@@ -126,10 +130,14 @@ acpi_tb_print_table_header(acpi_physicalACPI_INFO ((AE_INFO ,"RSDP @ 0x%p/0x%04X (v%3.3d %6.6s)" ,ACPI_CAST_PTR (void, address), - (((struct acpi_table_rsdp *)header)->revision >0 ) ? - ((struct acpi_table_rsdp *)header)->length :20 , - ((struct acpi_table_rsdp *)header)->revision, - ((struct acpi_table_rsdp *)header)->oem_id)); + (ACPI_CAST_PTR(struct acpi_table_rsdp, header)-> + revision > + 0) ? ACPI_CAST_PTR(struct acpi_table_rsdp, + header)->length :20 , + ACPI_CAST_PTR(struct acpi_table_rsdp, + header)->revision, + ACPI_CAST_PTR(struct acpi_table_rsdp, + header)->oem_id)); }else {/* Standard ACPI table with full common header */
@@ -278,8 +286,8 @@ static void acpi_tb_convert_fadt(void) }/* -* Expand the V1.0 addresses to the "X" generic address structs, -* as necessary. +* Expand the 32-bit V1.0 addresses to the 64-bit "X" generic address +* structures as necessary. */ for (i =0 ; i <ACPI_FADT_CONVERSION_ENTRIES ; i++) { target =
@@ -294,10 +302,11 @@ static void acpi_tb_convert_fadt(void) &acpi_gbl_FADT, fadt_conversion_table [i].length), - *ACPI_ADD_PTR (u32, - &acpi_gbl_FADT, - fadt_conversion_table - [i].source)); + (u64) *ACPI_ADD_PTR (u32, + &acpi_gbl_FADT, + fadt_conversion_table + [i]. + source)); } }
@@ -444,7 +453,7 @@ static void acpi_tb_parse_fadt(acpi_nati/* Copy the entire FADT locally */ -ACPI_MEMSET (&acpi_gbl_FADT,sizeof (struct acpi_table_fadt ),0 ); +ACPI_MEMSET (&acpi_gbl_FADT,0 ,sizeof (struct acpi_table_fadt ));ACPI_MEMCPY (&acpi_gbl_FADT, table,ACPI_MIN (length,sizeof (struct acpi_table_fadt )));
@@ -465,6 +474,61 @@ static void acpi_tb_parse_fadt(acpi_nati/******************************************************************************* * +* FUNCTION: acpi_tb_get_root_table_entry +* +* PARAMETERS: table_entry - Pointer to the RSDT/XSDT table entry +* table_entry_size - sizeof 32 or 64 (RSDT or XSDT) +* +* RETURN: Physical address extracted from the root table +* +* DESCRIPTION: Get one root table entry. Handles 32-bit and 64-bit cases on +* both 32-bit and 64-bit platforms +* +* NOTE: acpi_physical_address is 32-bit on 32-bit platforms, 64-bit on +* 64-bit platforms. +* +******************************************************************************/ + +static acpi_physical_address +acpi_tb_get_root_table_entry (u8 * table_entry, +acpi_native_uint table_entry_size) +{ +u64 address64; + +/* +* Get the table physical address (32-bit for RSDT, 64-bit for XSDT): +* Note: Addresses are 32-bit aligned (not 64) in both RSDT and XSDT +*/ +if (table_entry_size ==sizeof (u32)) { +/* +* 32-bit platform, RSDT: Return 32-bit table entry +* 64-bit platform, RSDT: Expand 32-bit to 64-bit and return +*/ +return ((acpi_physical_address) + (*ACPI_CAST_PTR (u32, table_entry))); + }else { +/* +* 32-bit platform, XSDT: Truncate 64-bit to 32-bit and return +* 64-bit platform, XSDT: Move (unaligned) 64-bit to local, return 64-bit +*/ +ACPI_MOVE_64_TO_64 (&address64, table_entry); + +#if ACPI_MACHINE_WIDTH ==32 +if (address64 >ACPI_UINT32_MAX ) { + +/* Will truncate 64-bit address to 32 bits */ + +ACPI_WARNING ((AE_INFO , +"64-bit Physical Address in XSDT is too large (%8.8X%8.8X), truncating" , +ACPI_FORMAT_UINT64 (address64))); + } +#endif +return ((acpi_physical_address) (address64)); + } +} + +/******************************************************************************* +* * FUNCTION: acpi_tb_parse_root_table * * PARAMETERS: Rsdp - Pointer to the RSDP
@@ -567,8 +631,8 @@ acpi_tb_parse_root_table(acpi_physical_a/* Calculate the number of tables described in the root table */ table_count = - (table->length - -sizeof (struct acpi_table_header )) / table_entry_size; + (u32) ((table->length - +sizeof (struct acpi_table_header )) / table_entry_size);/* * First two entries in the table array are reserved for the DSDT and FACS,
@@ -599,32 +663,11 @@ acpi_tb_parse_root_table(acpi_physical_a } } -/* -* Get the table physical address (32-bit for RSDT, 64-bit for XSDT) -*/ -if ((table_entry_size ==sizeof (u32)) || - (sizeof (acpi_physical_address) ==sizeof (u32))) { -/* -* 32-bit platform, RSDT: Move 32-bit to 32-bit -* 32-bit platform, XSDT: Truncate 64-bit to 32-bit -* 64-bit platform, RSDT: Expand 32-bit to 64-bit -* -* Note: Addresses are 32-bit aligned in both RSDT and XSDT -*/ - acpi_gbl_root_table_list. - tables[acpi_gbl_root_table_list.count].address = - (acpi_physical_address) (*ACPI_CAST_PTR - (u32, table_entry)); - }else { -/* -* 64-bit platform, XSDT: Move 64-bit to 64-bit -* -* Note: 64-bit addresses are only 32-bit aligned in the XSDT -*/ -ACPI_MOVE_64_TO_64 (&acpi_gbl_root_table_list. - tables[acpi_gbl_root_table_list. - count].address, table_entry); - } +/* Get the table physical address (32-bit for RSDT, 64-bit for XSDT) */ + + acpi_gbl_root_table_list.tables[acpi_gbl_root_table_list.count]. + address = +acpi_tb_get_root_table_entry (table_entry, table_entry_size); table_entry += table_entry_size; acpi_gbl_root_table_list.count++;
drivers/acpi/tables/tbxface.c +2 -2
@@ -102,9 +102,9 @@ acpi_initialize_tables(struct acpi_table }else {/* Root Table Array has been statically allocated by the host */ -ACPI_MEMSET (initial_table_array, +ACPI_MEMSET (initial_table_array,0 , initial_table_count * -sizeof (struct acpi_table_desc ),0 ); +sizeof (struct acpi_table_desc )); acpi_gbl_root_table_list.tables = initial_table_array; acpi_gbl_root_table_list.size = initial_table_count;
Signature · 1 line
1.4.4.1
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 17/65 ACPICA: Add support for DMAR table
From: Robert Moore <[email protected]>
Implement support for ACPI DMAR table (DMA Remapping Table) in header files and disassembler.
--- include/acpi/acdisasm.h | 14 +++++++-- include/acpi/actbl1.h | 73 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 3 deletions(-)
include/acpi/acdisasm.h +11 -3
@@ -97,9 +97,10 @@ typedef const struct acpi_dmtable_info {#define ACPI_DMT_CHKSUM 20#define ACPI_DMT_SPACEID 21#define ACPI_DMT_GAS 22 -#define ACPI_DMT_MADT 23 -#define ACPI_DMT_SRAT 24 -#define ACPI_DMT_EXIT 25 +#define ACPI_DMT_DMAR 23 +#define ACPI_DMT_MADT 24 +#define ACPI_DMT_SRAT 25 +#define ACPI_DMT_EXIT 26typedef void (*ACPI_TABLE_HANDLER ) (struct acpi_table_header * table);
@@ -147,6 +148,11 @@ extern struct acpi_dmtable_info acpi_dm_extern struct acpi_dmtable_info acpi_dm_table_info_cpep[];extern struct acpi_dmtable_info acpi_dm_table_info_cpep0[];extern struct acpi_dmtable_info acpi_dm_table_info_dbgp[]; +extern struct acpi_dmtable_info acpi_dm_table_info_dmar[]; +extern struct acpi_dmtable_info acpi_dm_table_info_dmar_hdr[]; +extern struct acpi_dmtable_info acpi_dm_table_info_dmar_scope[]; +extern struct acpi_dmtable_info acpi_dm_table_info_dmar0[]; +extern struct acpi_dmtable_info acpi_dm_table_info_dmar1[];extern struct acpi_dmtable_info acpi_dm_table_info_ecdt[];extern struct acpi_dmtable_info acpi_dm_table_info_facs[];extern struct acpi_dmtable_info acpi_dm_table_info_fadt1[];
@@ -201,6 +207,8 @@ void acpi_dm_dump_asf(struct acpi_table_void acpi_dm_dump_cpep (struct acpi_table_header *table); +void acpi_dm_dump_dmar (struct acpi_table_header *table); +void acpi_dm_dump_fadt (struct acpi_table_header *table);void acpi_dm_dump_srat (struct acpi_table_header *table);
include/acpi/actbl1.h +73 -0
85 lines not on this page · raw message
Signature · 1 line
1.4.4.1
PATCH 18/65 ACPICA: Add acpi_gpe_count global to track the number of GPE events
From: Robert Moore <[email protected]>
--- drivers/acpi/events/evgpe.c | 2 ++ drivers/acpi/utilities/utglobal.c | 2 ++ include/acpi/acglobal.h | 4 ++++ 3 files changed, 8 insertions(+), 0 deletions(-)
drivers/acpi/events/evgpe.c +2 -0
@@ -618,6 +618,8 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_eveACPI_FUNCTION_TRACE (ev_gpe_dispatch); + acpi_gpe_count++; +/* * If edge-triggered, clear the GPE status bit now. Note that * level-triggered events are cleared after the GPE is serviced.
drivers/acpi/utilities/utglobal.c +2 -0
@@ -720,6 +720,7 @@ void acpi_ut_init_globals(void)/* GPE support */ + acpi_gpe_count =0 ; acpi_gbl_gpe_xrupt_list_head =NULL ; acpi_gbl_gpe_fadt_blocks[0 ] =NULL ; acpi_gbl_gpe_fadt_blocks[1 ] =NULL ;
@@ -779,3 +780,4 @@ void acpi_ut_init_globals(void) ACPI_EXPORT_SYMBOL(acpi_dbg_level) ACPI_EXPORT_SYMBOL(acpi_dbg_layer) +ACPI_EXPORT_SYMBOL(acpi_gpe_count)
include/acpi/acglobal.h +4 -0
@@ -80,6 +80,10 @@ extern u32 acpi_dbg_layer;extern u32 acpi_gbl_nesting_level; +/* Event counters */ + +ACPI_EXTERN u32 acpi_gpe_count; +/* Support for dynamic control method tracing mechanism */ ACPI_EXTERN u32 acpi_gbl_original_dbg_level;
Signature · 1 line
1.4.4.1
PATCH 19/65 ACPICA: Disable all wake GPEs after first one recieved
From: Robert Moore <[email protected]>
Change for GPE support: when a wake GPE is received, now all wake GPEs are immediately disabled to prevent the waking GPE from firing again, and to prevent other wake GPEs from interrupting the wake process.
--- drivers/acpi/events/evgpe.c | 78 +++++++++--------------------------------- include/acpi/acglobal.h | 68 ++++++++++++++++++------------------- include/acpi/actypes.h | 6 +--- 3 files changed, 51 insertions(+), 101 deletions(-)
drivers/acpi/events/evgpe.c +17 -61
@@ -635,20 +635,23 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_eve } } -/* Save current system state */ - -if (acpi_gbl_system_awake_and_running) { -ACPI_SET_BIT (gpe_event_info->flags,ACPI_GPE_SYSTEM_RUNNING ); - }else { -ACPI_CLEAR_BIT (gpe_event_info->flags,ACPI_GPE_SYSTEM_RUNNING ); +if (!acpi_gbl_system_awake_and_running) { +/* +* We just woke up because of a wake GPE. Disable any further GPEs +* until we are fully up and running (Only wake GPEs should be enabled +* at this time, but we just brute-force disable them all.) +* 1) We must disable this particular wake GPE so it won't fire again +* 2) We want to disable all wake GPEs, since we are now awake +*/ + (void )acpi_hw_disable_all_gpes (); }/* -* Dispatch the GPE to either an installed handler, or the control -* method associated with this GPE (_Lxx or _Exx). -* If a handler exists, we invoke it and do not attempt to run the method. -* If there is neither a handler nor a method, we disable the level to -* prevent further events from coming in here. +* Dispatch the GPE to either an installed handler, or the control method +* associated with this GPE (_Lxx or _Exx). If a handler exists, we invoke +* it and do not attempt to run the method. If there is neither a handler +* nor a method, we disable this GPE to prevent further such pointless +* events from firing. */ switch (gpe_event_info->flags &ACPI_GPE_DISPATCH_MASK ) {case ACPI_GPE_DISPATCH_HANDLER :
@@ -679,8 +682,8 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_evecase ACPI_GPE_DISPATCH_METHOD :/* -* Disable GPE, so it doesn't keep firing before the method has a -* chance to run. +* Disable the GPE, so it doesn't keep firing before the method has a +* chance to run (it runs asynchronously with interrupts enabled). */ status =acpi_ev_disable_gpe (gpe_event_info);if (ACPI_FAILURE (status)) {
@@ -713,7 +716,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_eve gpe_number));/* -* Disable the GPE. The GPE will remain disabled until the ACPI +* Disable the GPE. The GPE will remain disabled until the ACPI * Core Subsystem is restarted, or a handler is installed. */ status =acpi_ev_disable_gpe (gpe_event_info);
@@ -728,50 +731,3 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_evereturn_UINT32 (ACPI_INTERRUPT_HANDLED ); } - -#ifdef ACPI_GPE_NOTIFY_CHECK -/******************************************************************************* -* TBD: NOT USED, PROTOTYPE ONLY AND WILL PROBABLY BE REMOVED -* -* FUNCTION: acpi_ev_check_for_wake_only_gpe -* -* PARAMETERS: gpe_event_info - info for this GPE -* -* RETURN: Status -* -* DESCRIPTION: Determine if a a GPE is "wake-only". -* -* Called from Notify() code in interpreter when a "DeviceWake" -* Notify comes in. -* -******************************************************************************/ - -acpi_status -acpi_ev_check_for_wake_only_gpe (struct acpi_gpe_event_info *gpe_event_info) -{ -acpi_status status; - -ACPI_FUNCTION_TRACE (ev_check_for_wake_only_gpe); - -if ((gpe_event_info) &&/* Only >0 for _Lxx/_Exx */ - ((gpe_event_info->flags &ACPI_GPE_SYSTEM_MASK ) ==ACPI_GPE_SYSTEM_RUNNING )) {/* System state at GPE time */ -/* This must be a wake-only GPE, disable it */ - - status =acpi_ev_disable_gpe (gpe_event_info); - -/* Set GPE to wake-only. Do not change wake disabled/enabled status */ - -acpi_ev_set_gpe_type (gpe_event_info,ACPI_GPE_TYPE_WAKE ); - -ACPI_INFO ((AE_INFO , -"GPE %p was updated from wake/run to wake-only" , - gpe_event_info)); - -/* This was a wake-only GPE */ - -return_ACPI_STATUS (AE_WAKE_ONLY_GPE ); - } - -return_ACPI_STATUS (AE_OK ); -} -#endif
include/acpi/acglobal.h +33 -35
86 lines not on this page · raw message
include/acpi/actypes.h +1 -5
@@ -592,7 +592,7 @@ typedef u32 acpi_event_status;* | | | +--- Type of dispatch -- to method, handler, or none * | | +--- Enabled for runtime? * | +--- Enabled for wake? -* +--- System state when GPE ocurred (running/waking) +* +--- Unused */ #define ACPI_GPE_XRUPT_TYPE_MASK (u8) 0x01#define ACPI_GPE_LEVEL_TRIGGERED (u8) 0x01
@@ -618,10 +618,6 @@ typedef u32 acpi_event_status;#define ACPI_GPE_ENABLE_MASK (u8) 0x60/* Both run/wake */ -#define ACPI_GPE_SYSTEM_MASK (u8) 0x80 -#define ACPI_GPE_SYSTEM_RUNNING (u8) 0x80 -#define ACPI_GPE_SYSTEM_WAKING (u8) 0x00 -/* * Flags for GPE and Lock interfaces */
Signature · 1 line
1.4.4.1
PATCH 20/65 ACPICA: Fix unalignment in acpi_ut_repair_name
From: Robert Moore <[email protected]>
Update interface to acpi_ut_repair_name() to avoid alignment issues on IA64
--- drivers/acpi/namespace/nsdump.c | 2 +- drivers/acpi/namespace/nssearch.c | 3 ++- drivers/acpi/utilities/utglobal.c | 2 +- drivers/acpi/utilities/utmisc.c | 11 +++++------ include/acpi/acutils.h | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-)
drivers/acpi/namespace/nsdump.c +1 -1
@@ -205,7 +205,7 @@ acpi_ns_dump_one_object(acpi_handle obj_if (!acpi_ut_valid_acpi_name (this_node->name.integer)) { this_node->name.integer = -acpi_ut_repair_name (this_node->name.integer); +acpi_ut_repair_name (this_node->name.ascii);ACPI_WARNING ((AE_INFO ,"Invalid ACPI Name %08X" , this_node->name.integer));
drivers/acpi/namespace/nssearch.c +2 -1
@@ -321,7 +321,8 @@ acpi_ns_search_and_enter(u32 target_name* even though there are a few bad names. */ if (!acpi_ut_valid_acpi_name (target_name)) { - target_name =acpi_ut_repair_name (target_name); + target_name = +acpi_ut_repair_name (ACPI_CAST_PTR (char, &target_name));/* Report warning only if in strict mode or debug mode */
drivers/acpi/utilities/utglobal.c +1 -1
@@ -566,7 +566,7 @@ char *acpi_ut_get_node_name(void *object/* Name must be a valid ACPI name */ if (!acpi_ut_valid_acpi_name (node->name.integer)) { - node->name.integer =acpi_ut_repair_name (node->name.integer); + node->name.integer =acpi_ut_repair_name (node->name.ascii); }/* Return the name */
drivers/acpi/utilities/utmisc.c +5 -6
@@ -582,26 +582,25 @@ u8 acpi_ut_valid_acpi_name(u32 name)* ******************************************************************************/ -acpi_name acpi_ut_repair_name (acpi_name name) +acpi_name acpi_ut_repair_name (char *name) { -char *name_ptr =ACPI_CAST_PTR (char, &name); -char new_name[ACPI_NAME_SIZE ];acpi_native_uint i; +char new_name[ACPI_NAME_SIZE ];for (i =0 ; i <ACPI_NAME_SIZE ; i++) { - new_name[i] = name_ptr[i]; + new_name[i] = name[i];/* * Replace a bad character with something printable, yet technically * still invalid. This prevents any collisions with existing "good" * names in the namespace. */ -if (!acpi_ut_valid_acpi_char (name_ptr[i], i)) { +if (!acpi_ut_valid_acpi_char (name[i], i)) { new_name[i] ='*' ; } } -return (*ACPI_CAST_PTR (u32, new_name)); +return (*(u32 *) new_name); }/*******************************************************************************
include/acpi/acutils.h +1 -1
@@ -470,7 +470,7 @@ void acpi_ut_print_string(char *string,u8 acpi_ut_valid_acpi_name (u32 name); -acpi_name acpi_ut_repair_name (acpi_name name); +acpi_name acpi_ut_repair_name (char *name);u8 acpi_ut_valid_acpi_char (char character,acpi_native_uint position);
Signature · 1 line
1.4.4.1
PATCH 21/65 ACPICA: Store GPE number instead of bitmask
From: Robert Moore <[email protected]>
Update internal GPE data structure to simplify debug, use gpe_number instead of register bitmask.
--- drivers/acpi/events/evgpe.c | 7 ++++--- drivers/acpi/events/evgpeblk.c | 3 ++- drivers/acpi/hardware/hwgpe.c | 13 +++++++++++-- drivers/acpi/utilities/utglobal.c | 2 -- include/acpi/acglobal.h | 1 - include/acpi/aclocal.h | 2 +- 6 files changed, 18 insertions(+), 10 deletions(-)
drivers/acpi/events/evgpe.c +4 -3
@@ -121,7 +121,9 @@ acpi_ev_update_gpe_enable_masks(struct aif (!gpe_register_info) {return_ACPI_STATUS (AE_NOT_EXIST ); } - register_bit = gpe_event_info->register_bit; + register_bit = (u8) + (1 << + (gpe_event_info->gpe_number - gpe_register_info->base_gpe_number));/* 1) Disable case. Simply clear all enable bits */
@@ -458,8 +460,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_x/* Examine one GPE bit */ -if (enabled_status_byte & - acpi_gbl_decode_to8bit[j]) { +if (enabled_status_byte & (1 << j)) {/* * Found an active GPE. Dispatch the event to a handler * or method.
drivers/acpi/events/evgpeblk.c +2 -1
@@ -819,7 +819,8 @@ acpi_ev_create_gpe_info_blocks(struct ac/* Init the event_info for each GPE within this register */ for (j =0 ; j <ACPI_GPE_REGISTER_WIDTH ; j++) { - this_event->register_bit = acpi_gbl_decode_to8bit[j]; + this_event->gpe_number = + (u8) (this_register->base_gpe_number + j); this_event->register_info = this_register; this_event++; }
drivers/acpi/hardware/hwgpe.c +11 -2
@@ -105,14 +105,20 @@ acpi_hw_write_gpe_enable_reg(struct acpiacpi_status acpi_hw_clear_gpe (struct acpi_gpe_event_info * gpe_event_info) {acpi_status status; +u8 register_bit;ACPI_FUNCTION_ENTRY (); + register_bit = (u8) + (1 << + (gpe_event_info->gpe_number - + gpe_event_info->register_info->base_gpe_number)); +/* * Write a one to the appropriate bit in the status register to * clear this GPE. */ - status =acpi_hw_low_level_write (8 , gpe_event_info->register_bit, + status =acpi_hw_low_level_write (8 , register_bit, &gpe_event_info->register_info-> status_address);
@@ -155,7 +161,10 @@ acpi_hw_get_gpe_status(struct acpi_gpe_e/* Get the register bitmask for this GPE */ - register_bit = gpe_event_info->register_bit; + register_bit = (u8) + (1 << + (gpe_event_info->gpe_number - + gpe_event_info->register_info->base_gpe_number));/* GPE currently enabled? (enabled for runtime?) */
drivers/acpi/utilities/utglobal.c +0 -2
@@ -164,8 +164,6 @@ u32 acpi_gbl_startup_flags = 0;u8 acpi_gbl_shutdown = TRUE; -const u8 acpi_gbl_decode_to8bit[8 ] = {1 ,2 ,4 ,8 ,16 ,32 ,64 ,128 }; -const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT ] = {"\\_S0_" ,"\\_S1_" ,
include/acpi/acglobal.h +0 -1
@@ -239,7 +239,6 @@ ACPI_EXTERN u8 acpi_gbl_system_awake_andextern u8 acpi_gbl_shutdown;extern u32 acpi_gbl_startup_flags; -extern const u8 acpi_gbl_decode_to8bit[8 ];extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT ];extern const char *acpi_gbl_highest_dstate_names[4 ];extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES ];
include/acpi/aclocal.h +1 -1
@@ -367,7 +367,7 @@ struct acpi_gpe_event_info {union acpi_gpe_dispatch_info dispatch;/* Either Method or Handler */ struct acpi_gpe_register_info *register_info;/* Backpointer to register info */ u8 flags;/* Misc info about this GPE */ -u8 register_bit;/* This GPE bit within the register */ +u8 gpe_number;/* This GPE */ };/* Information about a GPE register pair, one per each status/enable pair in an array */
Signature · 1 line
1.4.4.1
PATCH 22/65 ACPICA: Split acpi_format_exception into two parts
From: Robert Moore <[email protected]>
Split acpi_format_exception into two parts. New function is acpi_ut_verify_exception and will be used to verify exception codes returned by user.
--- drivers/acpi/utilities/utglobal.c | 118 +++++++++++------------------------- drivers/acpi/utilities/utmisc.c | 73 +++++++++++++++++++++++ include/acpi/acglobal.h | 8 +++ include/acpi/acutils.h | 2 + 4 files changed, 119 insertions(+), 82 deletions(-)
drivers/acpi/utilities/utglobal.c +36 -82
@@ -52,87 +52,6 @@ ACPI_EXPORT_SYMBOL(acpi_gbl_FADT)/******************************************************************************* * -* FUNCTION: acpi_format_exception -* -* PARAMETERS: Status - The acpi_status code to be formatted -* -* RETURN: A string containing the exception text. A valid pointer is -* always returned. -* -* DESCRIPTION: This function translates an ACPI exception into an ASCII string. -* -******************************************************************************/ -const char *acpi_format_exception (acpi_status status) -{ -acpi_status sub_status; -const char *exception =NULL ; - -ACPI_FUNCTION_ENTRY (); - -/* -* Status is composed of two parts, a "type" and an actual code -*/ - 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 ; - } - -if (!exception) { - -/* Exception code was not recognized */ - -ACPI_ERROR ((AE_INFO , -"Unknown exception code: 0x%8.8X" , status)); - - exception ="UNKNOWN_STATUS_CODE" ; - } - - return (ACPI_CAST_PTR(const char, exception)); -} - -/******************************************************************************* -* * Static global variable initialization. * ******************************************************************************/
@@ -182,10 +101,45 @@ const char *acpi_gbl_highest_dstate_name/******************************************************************************* * -* Namespace globals +* FUNCTION: acpi_format_exception +* +* PARAMETERS: Status - The acpi_status code to be formatted +* +* RETURN: A string containing the exception text. A valid pointer is +* always returned. +* +* DESCRIPTION: This function translates an ACPI exception into an ASCII string +* It is here instead of utxface.c so it is always present. * ******************************************************************************/ +const char *acpi_format_exception (acpi_status status) +{ +const char *exception =NULL ; + +ACPI_FUNCTION_ENTRY (); + + exception =acpi_ut_validate_exception (status); +if (!exception) { + +/* Exception code was not recognized */ + +ACPI_ERROR ((AE_INFO , +"Unknown exception code: 0x%8.8X" , status)); + + exception ="UNKNOWN_STATUS_CODE" ; + } + + return (ACPI_CAST_PTR(const char, exception)); +} + +ACPI_EXPORT_SYMBOL (acpi_format_exception) + +/******************************************************************************* +* +* Namespace globals +* +******************************************************************************/ /* * Predefined ACPI Names (Built-in to the Interpreter) *
drivers/acpi/utilities/utmisc.c +73 -0
85 lines not on this page · raw message
include/acpi/acglobal.h +8 -0
@@ -244,6 +244,14 @@ extern const char *acpi_gbl_highest_dstaextern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES ];extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS ]; +/* Exception codes */ + +extern char const *acpi_gbl_exception_names_env[]; +extern char const *acpi_gbl_exception_names_pgm[]; +extern char const *acpi_gbl_exception_names_tbl[]; +extern char const *acpi_gbl_exception_names_aml[]; +extern char const *acpi_gbl_exception_names_ctrl[]; +/***************************************************************************** * * Namespace globals
include/acpi/acutils.h +2 -0
@@ -453,6 +453,8 @@ acpi_ut_short_divide(acpi_integer in_div/* * utmisc */ +const char *acpi_ut_validate_exception (acpi_status status); +u8 acpi_ut_is_aml_table (struct acpi_table_header *table);acpi_status acpi_ut_allocate_owner_id (acpi_owner_id * owner_id);
Signature · 1 line
1.4.4.1
PATCH 23/65 ACPICA: Update version to 20060831
From: Robert Moore <[email protected]>
--- include/acpi/acconfig.h | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
include/acpi/acconfig.h +3 -3
@@ -63,7 +63,7 @@/* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20060828 +#define ACPI_CA_VERSION 0x20060831/* * OS name, used for the _OS object. The _OS object is essentially obsolete,
@@ -158,8 +158,8 @@/* Sizes for ACPI table headers */ -#define ACPI_OEM_ID_SIZE 6 -#define ACPI_OEM_TABLE_ID_SIZE 8 +#define ACPI_OEM_ID_SIZE 6 +#define ACPI_OEM_TABLE_ID_SIZE 8/* Constants used in searching for the RSDP in low memory */
Signature · 1 line
1.4.4.1
PATCH 24/65 ACPICA: Cleanup of FADT verification function.
From: Robert Moore <[email protected]>
Removed offset display, not needed.
--- drivers/acpi/utilities/utinit.c | 65 ++++++++++++++------------------------- 1 files changed, 23 insertions(+), 42 deletions(-)
drivers/acpi/utilities/utinit.c +23 -42
@@ -50,8 +50,7 @@ACPI_MODULE_NAME ("utinit" ) /* Local prototypes */ -static void -acpi_ut_fadt_register_error (char *register_name,u32 value,u8 offset); +static void acpi_ut_fadt_register_error (char *register_name,u32 value);static void acpi_ut_terminate (void );
@@ -61,21 +60,18 @@ static void acpi_ut_terminate(void);* * PARAMETERS: register_name - Pointer to string identifying register * Value - Actual register contents value -* Offset - Byte offset in the FADT * -* RETURN: AE_BAD_VALUE +* RETURN: None * * DESCRIPTION: Display failure message * ******************************************************************************/ -static void -acpi_ut_fadt_register_error (char *register_name,u32 value,u8 offset) +static void acpi_ut_fadt_register_error (char *register_name,u32 value) { -ACPI_WARNING ((AE_INFO , -"Invalid FADT value %s=%X at offset %X in FADT=%p" , - register_name, value, offset, &acpi_gbl_FADT)); +ACPI_WARNING ((AE_INFO ,"Invalid FADT value %s = %X" , + register_name, value)); }/******************************************************************************
@@ -98,69 +94,54 @@ acpi_status acpi_ut_validate_fadt(void)* but don't abort on any problems, just display error */ if (acpi_gbl_FADT.pm1_event_length <4 ) { -acpi_ut_fadt_register_error ("PM1_EVT_LEN" , +acpi_ut_fadt_register_error ("Pm1EventLength" , (u32 ) acpi_gbl_FADT. - pm1_event_length, -ACPI_FADT_OFFSET (pm1_event_length)); + pm1_event_length); + } + +if (acpi_gbl_FADT.pm_timer_length <4 ) { +acpi_ut_fadt_register_error ("PmTimerLength" , + (u32 ) acpi_gbl_FADT. + pm_timer_length); }if (!acpi_gbl_FADT.pm1_control_length) { -acpi_ut_fadt_register_error ("PM1_CNT_LEN" ,0 , -ACPI_FADT_OFFSET - (pm1_control_length)); +acpi_ut_fadt_register_error ("Pm1ControlLength" ,0 ); }if (!acpi_gbl_FADT.xpm1a_event_block.address) { -acpi_ut_fadt_register_error ("X_PM1a_EVT_BLK" ,0 , -ACPI_FADT_OFFSET (xpm1a_event_block. - address)); +acpi_ut_fadt_register_error ("XPm1aEventBlock.Address" ,0 ); }if (!acpi_gbl_FADT.xpm1a_control_block.address) { -acpi_ut_fadt_register_error ("X_PM1a_CNT_BLK" ,0 , -ACPI_FADT_OFFSET - (xpm1a_control_block.address)); +acpi_ut_fadt_register_error ("XPm1aControlBlock.Address" ,0 ); }if (!acpi_gbl_FADT.xpm_timer_block.address) { -acpi_ut_fadt_register_error ("X_PM_TMR_BLK" ,0 , -ACPI_FADT_OFFSET (xpm_timer_block. - address)); +acpi_ut_fadt_register_error ("XPmTimerBlock.Address" ,0 ); }if ((acpi_gbl_FADT.xpm2_control_block.address && !acpi_gbl_FADT.pm2_control_length)) { -acpi_ut_fadt_register_error ("PM2_CNT_LEN" , +acpi_ut_fadt_register_error ("Pm2ControlLength" , (u32 ) acpi_gbl_FADT. - pm2_control_length, -ACPI_FADT_OFFSET - (pm2_control_length)); - } - -if (acpi_gbl_FADT.pm_timer_length <4 ) { -acpi_ut_fadt_register_error ("PM_TM_LEN" , - (u32 ) acpi_gbl_FADT.pm_timer_length, -ACPI_FADT_OFFSET (pm_timer_length)); + pm2_control_length); }/* Length of GPE blocks must be a multiple of 2 */ if (acpi_gbl_FADT.xgpe0_block.address && (acpi_gbl_FADT.gpe0_block_length &1 )) { -acpi_ut_fadt_register_error ("(x)GPE0_BLK_LEN" , +acpi_ut_fadt_register_error ("Gpe0BlockLength" , (u32 ) acpi_gbl_FADT. - gpe0_block_length, -ACPI_FADT_OFFSET - (gpe0_block_length)); + gpe0_block_length); }if (acpi_gbl_FADT.xgpe1_block.address && (acpi_gbl_FADT.gpe1_block_length &1 )) { -acpi_ut_fadt_register_error ("(x)GPE1_BLK_LEN" , +acpi_ut_fadt_register_error ("Gpe1BlockLength" , (u32 ) acpi_gbl_FADT. - gpe1_block_length, -ACPI_FADT_OFFSET - (gpe1_block_length)); + gpe1_block_length); }return (AE_OK );
Signature · 1 line
1.4.4.1
PATCH 25/65 ACPICA: Create tbfadt.c to hold all FADT-related functions
From: Robert Moore <[email protected]>
--- drivers/acpi/tables/Makefile | 2 +- drivers/acpi/tables/tbfadt.c | 380 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 381 insertions(+), 1 deletions(-)
drivers/acpi/tables/Makefile +1 -1
@@ -2,6 +2,6 @@ # Makefile for all Linux ACPI interpreter subdirectories # -obj-y := tbxface.o tbinstal.o tbutils.o tbfind.o +obj-y := tbxface.o tbinstal.o tbutils.o tbfind.o tbfadt.o EXTRA_CFLAGS += $(ACPI_CFLAGS)
drivers/acpi/tables/tbfadt.c new file +380 -0
380 lines not on this page · raw message
Signature · 1 line
1.4.4.1
PATCH 26/65 ACPICA: Re-implement interpreters' "serialized mode"
From: Robert Moore <[email protected]>
Enhanced the implementation of the interpreters' serialized mode (boot with "acpi_serialize" to set acpi_glb_all_methods_serialized flag.)
When this mode is specified, instead of creating a serialization semaphore per control method, the interpreter lock is simply no longer released before a blocking operation during control method execution. This effectively makes the AML Interpreter single-threaded. The overhead of a semaphore per-method is eliminated.
--- drivers/acpi/events/evregion.c | 15 ++---- drivers/acpi/events/evxface.c | 6 +-- drivers/acpi/executer/excreate.c | 5 +-- drivers/acpi/executer/exsystem.c | 30 +++-------- drivers/acpi/executer/exutils.c | 108 +++++++++++++++++++++++++++++------- drivers/acpi/namespace/nseval.c | 11 +--- drivers/acpi/namespace/nsinit.c | 7 +-- drivers/acpi/namespace/nsxfeval.c | 11 ++--- include/acpi/acinterp.h | 6 ++- 9 files changed, 114 insertions(+), 85 deletions(-)
drivers/acpi/events/evregion.c +4 -11
@@ -291,7 +291,6 @@ acpi_ev_address_space_dispatch(union acp u32 bit_width, acpi_integer * value) { acpi_status status; -acpi_status status2;acpi_adr_space_handler handler;acpi_adr_space_setup region_setup;union acpi_operand_object *handler_desc;
@@ -345,7 +344,7 @@ acpi_ev_address_space_dispatch(union acp* setup will potentially execute control methods * (e.g., _REG method for this region) */ -acpi_ex_exit_interpreter (); +acpi_ex_relinquish_interpreter (); status = region_setup(region_obj, ACPI_REGION_ACTIVATE, handler_desc->address_space.context,
@@ -353,10 +352,7 @@ acpi_ev_address_space_dispatch(union acp/* Re-enter the interpreter */ - status2 =acpi_ex_enter_interpreter (); -if (ACPI_FAILURE (status2)) { -return_ACPI_STATUS (status2); - } +acpi_ex_reacquire_interpreter ();/* Check for failure of the Region Setup */
@@ -409,7 +405,7 @@ acpi_ev_address_space_dispatch(union acp* exit the interpreter because the handler *might* block -- we don't * know what it will do, so we can't hold the lock on the intepreter. */ -acpi_ex_exit_interpreter (); +acpi_ex_relinquish_interpreter (); }/* Call the handler */
@@ -430,10 +426,7 @@ acpi_ev_address_space_dispatch(union acp* We just returned from a non-default handler, we must re-enter the * interpreter */ - status2 =acpi_ex_enter_interpreter (); -if (ACPI_FAILURE (status2)) { -return_ACPI_STATUS (status2); - } +acpi_ex_reacquire_interpreter (); }return_ACPI_STATUS (status);
drivers/acpi/events/evxface.c +2 -4
@@ -768,11 +768,9 @@ acpi_status acpi_acquire_global_lock(u16return (AE_BAD_PARAMETER ); } - status =acpi_ex_enter_interpreter (); -if (ACPI_FAILURE (status)) { -return (status); - } +/* Must lock interpreter to prevent race conditions */ +acpi_ex_enter_interpreter (); status =acpi_ev_acquire_global_lock (timeout);acpi_ex_exit_interpreter ();
drivers/acpi/executer/excreate.c +1 -4
@@ -583,10 +583,7 @@ acpi_ex_create_method(u8 * aml_start,* Get the sync_level. If method is serialized, a mutex will be * created for this method when it is parsed. */ -if (acpi_gbl_all_methods_serialized) { - obj_desc->method.sync_level =0 ; - obj_desc->method.method_flags |=AML_METHOD_SERIALIZED ; - }else if (method_flags &AML_METHOD_SERIALIZED ) { +if (method_flags &AML_METHOD_SERIALIZED ) {/* * ACPI 1.0: sync_level = 0 * ACPI 2.0: sync_level = sync_level in method declaration
drivers/acpi/executer/exsystem.c +7 -23
@@ -66,7 +66,6 @@ ACPI_MODULE_NAME("exsystem")acpi_status acpi_ex_system_wait_semaphore (acpi_semaphore semaphore,u16 timeout) {acpi_status status; -acpi_status status2;ACPI_FUNCTION_TRACE (ex_system_wait_semaphore);
@@ -79,7 +78,7 @@ acpi_status acpi_ex_system_wait_semaphor/* We must wait, so unlock the interpreter */ -acpi_ex_exit_interpreter (); +acpi_ex_relinquish_interpreter (); status =acpi_os_wait_semaphore (semaphore,1 , timeout);
@@ -89,13 +88,7 @@ acpi_status acpi_ex_system_wait_semaphor/* Reacquire the interpreter */ - status2 =acpi_ex_enter_interpreter (); -if (ACPI_FAILURE (status2)) { - -/* Report fatal error, could not acquire interpreter */ - -return_ACPI_STATUS (status2); - } +acpi_ex_reacquire_interpreter (); }return_ACPI_STATUS (status);
@@ -119,7 +112,6 @@ acpi_status acpi_ex_system_wait_semaphoracpi_status acpi_ex_system_wait_mutex (acpi_mutex mutex,u16 timeout) {acpi_status status; -acpi_status status2;ACPI_FUNCTION_TRACE (ex_system_wait_mutex);
@@ -132,7 +124,7 @@ acpi_status acpi_ex_system_wait_mutex(ac/* We must wait, so unlock the interpreter */ -acpi_ex_exit_interpreter (); +acpi_ex_relinquish_interpreter (); status =acpi_os_acquire_mutex (mutex, timeout);
@@ -142,13 +134,7 @@ acpi_status acpi_ex_system_wait_mutex(ac/* Reacquire the interpreter */ - status2 =acpi_ex_enter_interpreter (); -if (ACPI_FAILURE (status2)) { - -/* Report fatal error, could not acquire interpreter */ - -return_ACPI_STATUS (status2); - } +acpi_ex_reacquire_interpreter (); }return_ACPI_STATUS (status);
@@ -209,20 +195,18 @@ acpi_status acpi_ex_system_do_stall(u32acpi_status acpi_ex_system_do_suspend (acpi_integer how_long) { -acpi_status status; -ACPI_FUNCTION_ENTRY ();/* Since this thread will sleep, we must release the interpreter */ -acpi_ex_exit_interpreter (); +acpi_ex_relinquish_interpreter ();acpi_os_sleep (how_long);/* And now we must get the interpreter again */ - status =acpi_ex_enter_interpreter (); -return (status); +acpi_ex_reacquire_interpreter (); +return (AE_OK ); }/*******************************************************************************
drivers/acpi/executer/exutils.c +87 -21
148 lines not on this page · raw message
drivers/acpi/namespace/nseval.c +2 -9
@@ -154,11 +154,7 @@ acpi_status acpi_ns_evaluate(struct acpi* Execute the method via the interpreter. The interpreter is locked * here before calling into the AML parser */ - status =acpi_ex_enter_interpreter (); -if (ACPI_FAILURE (status)) { -return_ACPI_STATUS (status); - } - +acpi_ex_enter_interpreter (); status =acpi_ps_execute_method (info);acpi_ex_exit_interpreter (); }else {
@@ -182,10 +178,7 @@ acpi_status acpi_ns_evaluate(struct acpi* resolution, we must lock it because we could access an opregion. * The opregion access code assumes that the interpreter is locked. */ - status =acpi_ex_enter_interpreter (); -if (ACPI_FAILURE (status)) { -return_ACPI_STATUS (status); - } +acpi_ex_enter_interpreter ();/* Function has a strange interface */
drivers/acpi/namespace/nsinit.c +2 -5
@@ -213,7 +213,7 @@ acpi_ns_init_one_object(acpi_handle obj_ u32 level, void *context, void **return_value) { acpi_object_type type; -acpi_status status; +acpi_status status =AE_OK ;struct acpi_init_walk_info *info = (struct acpi_init_walk_info *)context; struct acpi_namespace_node *node =
@@ -267,10 +267,7 @@ acpi_ns_init_one_object(acpi_handle obj_/* * Must lock the interpreter before executing AML code */ - status =acpi_ex_enter_interpreter (); -if (ACPI_FAILURE (status)) { -return (status); - } +acpi_ex_enter_interpreter ();/* * Each of these types can contain executable AML code within the
drivers/acpi/namespace/nsxfeval.c +4 -7
@@ -170,7 +170,6 @@ acpi_evaluate_object(acpi_handle handle, struct acpi_buffer *return_buffer) {acpi_status status; -acpi_status status2;struct acpi_evaluate_info *info;acpi_size buffer_space_needed;u32 i;
@@ -329,14 +328,12 @@ acpi_evaluate_object(acpi_handle handle,* Delete the internal return object. NOTE: Interpreter must be * locked to avoid race condition. */ - status2 =acpi_ex_enter_interpreter (); -if (ACPI_SUCCESS (status2)) { +acpi_ex_enter_interpreter (); -/* Remove one reference on the return object (should delete it) */ +/* Remove one reference on the return object (should delete it) */ -acpi_ut_remove_reference (info->return_object); -acpi_ex_exit_interpreter (); - } +acpi_ut_remove_reference (info->return_object); +acpi_ex_exit_interpreter (); } cleanup:
include/acpi/acinterp.h +5 -1
@@ -445,10 +445,14 @@ acpi_ex_copy_integer_to_buffer_field(uni/* * exutils - interpreter/scanner utilities */ -acpi_status acpi_ex_enter_interpreter (void ); +void acpi_ex_enter_interpreter (void );void acpi_ex_exit_interpreter (void ); +void acpi_ex_reacquire_interpreter (void ); + +void acpi_ex_relinquish_interpreter (void ); +void acpi_ex_truncate_for32bit_table (union acpi_operand_object *obj_desc);u8 acpi_ex_acquire_global_lock (u32 rule);
Signature · 1 line
1.4.4.1
PATCH 27/65 ACPICA: Delete stale FADT functions outside tbfadt.c.
From: Robert Moore <[email protected]>
Moved all FADT-related functions to a new file, tbfadt.c. Eliminated the acpi_hw_initialize function - the FADT registers are now validated when the table is loaded.
--- drivers/acpi/hardware/hwacpi.c | 29 ----- drivers/acpi/tables/tbutils.c | 238 +------------------------------------- drivers/acpi/utilities/utinit.c | 95 --------------- drivers/acpi/utilities/utxface.c | 14 --- include/acpi/achware.h | 2 - include/acpi/actables.h | 9 ++ include/acpi/acutils.h | 2 - 7 files changed, 10 insertions(+), 379 deletions(-)
drivers/acpi/hardware/hwacpi.c +0 -29
@@ -49,34 +49,6 @@ ACPI_MODULE_NAME("hwacpi")/****************************************************************************** * -* FUNCTION: acpi_hw_initialize -* -* PARAMETERS: None -* -* RETURN: Status -* -* DESCRIPTION: Initialize and validate the various ACPI registers defined in -* the FADT. -* -******************************************************************************/ -acpi_status acpi_hw_initialize (void ) -{ -acpi_status status; - -ACPI_FUNCTION_TRACE (hw_initialize); - -/* Sanity check the FADT for valid values */ - - status =acpi_ut_validate_fadt (); -if (ACPI_FAILURE (status)) { -return_ACPI_STATUS (status); - } - -return_ACPI_STATUS (AE_OK ); -} - -/****************************************************************************** -* * FUNCTION: acpi_hw_set_mode * * PARAMETERS: Mode - SYS_MODE_ACPI or SYS_MODE_LEGACY
@@ -86,7 +58,6 @@ acpi_status acpi_hw_initialize(void)* DESCRIPTION: Transitions the system into the requested mode. * ******************************************************************************/ -acpi_status acpi_hw_set_mode (u32 mode) {
drivers/acpi/tables/tbutils.c +1 -237
272 lines not on this page · raw message
drivers/acpi/utilities/utinit.c +0 -95
103 lines not on this page · raw message
drivers/acpi/utilities/utxface.c +0 -14
@@ -127,20 +127,6 @@ acpi_status acpi_enable_subsystem(u32 flACPI_FUNCTION_TRACE (acpi_enable_subsystem); -/* -* We must initialize the hardware before we can enable ACPI. -* The values from the FADT are validated here. -*/ -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_ACPI_STATUS (status); - } - } -/* Enable ACPI mode */ if (!(flags &ACPI_NO_ACPI_ENABLE )) {
include/acpi/achware.h +0 -2
@@ -61,8 +61,6 @@/* * hwacpi - high level functions */ -acpi_status acpi_hw_initialize (void ); -acpi_status acpi_hw_set_mode (u32 mode);u32 acpi_hw_get_mode (void );
include/acpi/actables.h +9 -0
@@ -45,6 +45,11 @@#define __ACTABLES_H__/* +* tbfadt - FADT parse/convert/validate +*/ +void acpi_tb_parse_fadt (acpi_native_uint table_index,u8 flags); + +/* * tbfind - find ACPI table */ acpi_status
@@ -97,6 +102,10 @@ u8 acpi_tb_checksum(u8 * buffer, acpi_naacpi_status acpi_tb_verify_checksum (struct acpi_table_header *table,u32 length); +void +acpi_tb_install_table (acpi_physical_address address, +u8 flags,char *signature,acpi_native_uint table_index); +acpi_status acpi_tb_parse_root_table (acpi_physical_address rsdp_address,u8 flags);
include/acpi/acutils.h +0 -2
@@ -141,8 +141,6 @@ acpi_status acpi_ut_hardware_initialize(void acpi_ut_subsystem_shutdown (void ); -acpi_status acpi_ut_validate_fadt (void ); -/* * utclib - Local implementations of C library functions */
Signature · 1 line
1.4.4.1
PATCH 28/65 ACPICA: Update comments in tbfadt.c
From: Robert Moore <[email protected]>
--- drivers/acpi/tables/tbfadt.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-)
drivers/acpi/tables/tbfadt.c +6 -5
@@ -195,8 +195,8 @@ void acpi_tb_parse_fadt(acpi_native_uint* * DESCRIPTION: Converts all versions of the FADT to a common internal format. * -* NOTE: acpi_gbl_FADT must be of size (struct acpi_table_fadt), and must contain -* a copy of the actual FADT. +* NOTE: acpi_gbl_FADT must be of size (struct acpi_table_fadt), +* and must contain a copy of the actual FADT. * * ACPICA will use the "X" fields of the FADT for all addresses. *
@@ -292,9 +292,10 @@ static void acpi_tb_convert_fadt(void)* * PARAMETERS: None * -* RETURN: Status +* RETURN: None * -* DESCRIPTION: Validate various ACPI registers in the FADT +* DESCRIPTION: Validate various ACPI registers in the FADT. For problems, +* issue a message, but no status is returned. * ******************************************************************************/
@@ -375,6 +376,6 @@ static void acpi_tb_validate_fadt(void)static void acpi_tb_fadt_register_error (char *register_name,u32 value) { -ACPI_WARNING ((AE_INFO ,"Invalid FADT value \"%s\" = %X" , +ACPI_WARNING ((AE_INFO ,"Invalid FADT value in field \"%s\" = %X" , register_name, value)); }
Signature · 1 line
1.4.4.1
PATCH 29/65 ACPICA: add ASF comment
From: Robert Moore <[email protected]>
--- include/acpi/actbl1.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
include/acpi/actbl1.h +2 -0
@@ -97,6 +97,8 @@ struct acpi_subtable_header {* * ASF - Alert Standard Format table (Signature "ASF!") * +* Conforms to the Alert Standard Format Specification V2.0, 23 April 2003 +* ******************************************************************************/ struct acpi_table_asf {
Signature · 1 line
1.4.4.1
PATCH 30/65 ACPICA: re-factor table init routines for benefit of iASL
From: Robert Moore <[email protected]>
Required new table init interface since iASL does not use RSDP/XSDT.
--- drivers/acpi/tables/tbxface.c | 30 +++++++++++++++++++++++++----- include/acpi/actables.h | 2 ++ 2 files changed, 27 insertions(+), 5 deletions(-)
drivers/acpi/tables/tbxface.c +25 -5
@@ -54,6 +54,29 @@ static acpi_status acpi_tb_load_namespac/******************************************************************************* * +* FUNCTION: acpi_allocate_root_table +* +* PARAMETERS: initial_table_count - Size of initial_table_array, in number of +* struct acpi_table_desc structures +* +* RETURN: Status +* +* DESCRIPTION: Allocate a root table array. Used by i_aSL compiler and +* acpi_initialize_tables. +* +******************************************************************************/ + +acpi_status acpi_allocate_root_table (u32 initial_table_count) +{ + + acpi_gbl_root_table_list.size = initial_table_count; + acpi_gbl_root_table_list.flags =ACPI_ROOT_ALLOW_RESIZE ; + +return (acpi_tb_resize_root_table_list ()); +} + +/******************************************************************************* +* * FUNCTION: acpi_initialize_tables * * PARAMETERS: initial_table_array - Pointer to an array of pre-allocated
@@ -79,7 +102,7 @@ static acpi_status acpi_tb_load_namespac******************************************************************************/ acpi_status -acpi_initialize_tables (struct acpi_table_desc *initial_table_array, +acpi_initialize_tables (struct acpi_table_desc * initial_table_array,u32 initial_table_count,u8 allow_resize) {acpi_physical_address rsdp_address;
@@ -92,10 +115,7 @@ acpi_initialize_tables(struct acpi_table* Allocate the table array if requested */ if (!initial_table_array) { - acpi_gbl_root_table_list.size = initial_table_count; - acpi_gbl_root_table_list.flags =ACPI_ROOT_ALLOW_RESIZE ; - - status =acpi_tb_resize_root_table_list (); + status =acpi_allocate_root_table (initial_table_count);if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }
include/acpi/actables.h +2 -0
@@ -44,6 +44,8 @@#ifndef __ACTABLES_H__#define __ACTABLES_H__ +acpi_status acpi_allocate_root_table (u32 initial_table_count); +/* * tbfadt - FADT parse/convert/validate */
Signature · 1 line
1.4.4.1
PATCH 31/65 ACPICA: Allow type ANY to be the target of the Scope operator.
From: Robert Moore <[email protected]>
Useful during disassembly where the target may be in a different table and thus the type is unknown.
--- drivers/acpi/dispatcher/dswload.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/acpi/dispatcher/dswload.c +2 -0
@@ -196,6 +196,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_* one of the opcodes that actually opens a scope */ switch (node->type) { +case ACPI_TYPE_ANY :case ACPI_TYPE_LOCAL_SCOPE :/* Scope */ case ACPI_TYPE_DEVICE :case ACPI_TYPE_POWER :
@@ -669,6 +670,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_* one of the opcodes that actually opens a scope */ switch (node->type) { +case ACPI_TYPE_ANY :case ACPI_TYPE_LOCAL_SCOPE :/* Scope */ case ACPI_TYPE_DEVICE :case ACPI_TYPE_POWER :
Signature · 1 line
1.4.4.1
PATCH 32/65 ACPICA: IsResourceTemplate now returns ACPI_STATUS
From: Robert Moore <[email protected]>
to differentiate the failure modes.
--- include/acpi/acdisasm.h | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
include/acpi/acdisasm.h +3 -1
@@ -140,7 +140,9 @@ extern const char *acpi_gbl_match_ops[];extern struct acpi_dmtable_info acpi_dm_table_info_asf0[];extern struct acpi_dmtable_info acpi_dm_table_info_asf1[]; +extern struct acpi_dmtable_info acpi_dm_table_info_asf1a[];extern struct acpi_dmtable_info acpi_dm_table_info_asf2[]; +extern struct acpi_dmtable_info acpi_dm_table_info_asf2a[];extern struct acpi_dmtable_info acpi_dm_table_info_asf3[];extern struct acpi_dmtable_info acpi_dm_table_info_asf4[];extern struct acpi_dmtable_info acpi_dm_table_info_asf_hdr[];
@@ -322,7 +324,7 @@ acpi_dm_resource_template(struct acpi_opunion acpi_parse_object *op, u8 * byte_data, u32 byte_count); -u8 acpi_dm_is_resource_template (union acpi_parse_object *op); +acpi_status acpi_dm_is_resource_template (union acpi_parse_object *op);void acpi_dm_indent (u32 level);
Signature · 1 line
1.4.4.1
PATCH 33/65 ACPICA: Add declarations for ASF! sub-tables
From: Robert Moore <[email protected]>
--- include/acpi/actbl1.h | 25 ++++++++++++++++++++++--- 1 files changed, 22 insertions(+), 3 deletions(-)
include/acpi/actbl1.h +22 -3
@@ -148,7 +148,21 @@ struct acpi_asf_alert {u8 deassert_mask;u8 alerts;u8 data_length; -u8 array[1 ]; +}; + +struct acpi_asf_alert_data { +u8 address; +u8 command; +u8 mask; +u8 value; +u8 sensor_type; +u8 type; +u8 offset; +u8 source_type; +u8 severity; +u8 sensor_number; +u8 entity; +u8 instance; };/* 2: ASF Remote Control */
@@ -158,7 +172,13 @@ struct acpi_asf_remote {u8 controls;u8 data_length;u16 reserved2; -u8 array[1 ]; +}; + +struct acpi_asf_control_data { +u8 function; +u8 address; +u8 command; +u8 value; };/* 3: ASF RMCP Boot Options */
@@ -180,7 +200,6 @@ struct acpi_asf_address {struct acpi_asf_header header;u8 eprom_address;u8 devices; -u8 smbus_addresses[1 ]; };/*******************************************************************************
Signature · 1 line
1.4.4.1
PATCH 34/65 ACPICA: FADT verification is now table driven.
From: Robert Moore <[email protected]>
Disassembler now verifies an input
--- drivers/acpi/tables/tbfadt.c | 289 ++++++++++++++++++++++------------------- drivers/acpi/tables/tbutils.c | 2 +- include/acpi/actables.h | 4 + 3 files changed, 158 insertions(+), 137 deletions(-)
drivers/acpi/tables/tbfadt.c +153 -136
@@ -49,74 +49,92 @@ ACPI_MODULE_NAME("tbfadt")/* Local prototypes */ static void inline -acpi_tb_init_generic_address (struct acpi_generic_address *new_gas_struct, +acpi_tb_init_generic_address (struct acpi_generic_address *generic_address,u8 bit_width,u64 address); -static void acpi_tb_fadt_register_error (char *register_name,u32 value); +/* Table for conversion of FADT to common internal format and FADT validation */ -static void acpi_tb_convert_fadt (void ); - -static void acpi_tb_validate_fadt (void ); - -/* Table used for conversion of FADT to common format */ - -typedef struct acpi_fadt_conversion { +typedef struct acpi_fadt_info { +char *name;u8 target;u8 source;u8 length; +u8 type; -}acpi_fadt_conversion ; +}acpi_fadt_info ; -static struct acpi_fadt_conversion fadt_conversion_table[] = { - {ACPI_FADT_OFFSET (xpm1a_event_block), +#define ACPI_FADT_REQUIRED 1 +#define ACPI_FADT_SEPARATE_LENGTH 2 + +static struct acpi_fadt_info fadt_info_table[] = { + {"Pm1aEventBlock" ,ACPI_FADT_OFFSET (xpm1a_event_block),ACPI_FADT_OFFSET (pm1a_event_block), -ACPI_FADT_OFFSET (pm1_event_length)}, - {ACPI_FADT_OFFSET (xpm1b_event_block), +ACPI_FADT_OFFSET (pm1_event_length),ACPI_FADT_REQUIRED }, + + {"Pm1bEventBlock" ,ACPI_FADT_OFFSET (xpm1b_event_block),ACPI_FADT_OFFSET (pm1b_event_block), -ACPI_FADT_OFFSET (pm1_event_length)}, - {ACPI_FADT_OFFSET (xpm1a_control_block), +ACPI_FADT_OFFSET (pm1_event_length),0 }, + + {"Pm1aControlBlock" ,ACPI_FADT_OFFSET (xpm1a_control_block),ACPI_FADT_OFFSET (pm1a_control_block), -ACPI_FADT_OFFSET (pm1_control_length)}, - {ACPI_FADT_OFFSET (xpm1b_control_block), +ACPI_FADT_OFFSET (pm1_control_length),ACPI_FADT_REQUIRED }, + + {"Pm1bControlBlock" ,ACPI_FADT_OFFSET (xpm1b_control_block),ACPI_FADT_OFFSET (pm1b_control_block), -ACPI_FADT_OFFSET (pm1_control_length)}, - {ACPI_FADT_OFFSET (xpm2_control_block), +ACPI_FADT_OFFSET (pm1_control_length),0 }, + + {"Pm2ControlBlock" ,ACPI_FADT_OFFSET (xpm2_control_block),ACPI_FADT_OFFSET (pm2_control_block), -ACPI_FADT_OFFSET (pm2_control_length)}, - {ACPI_FADT_OFFSET (xpm_timer_block),ACPI_FADT_OFFSET (pm_timer_block), -ACPI_FADT_OFFSET (pm_timer_length)}, - {ACPI_FADT_OFFSET (xgpe0_block),ACPI_FADT_OFFSET (gpe0_block), -ACPI_FADT_OFFSET (gpe0_block_length)}, - {ACPI_FADT_OFFSET (xgpe1_block),ACPI_FADT_OFFSET (gpe1_block), -ACPI_FADT_OFFSET (gpe1_block_length)} +ACPI_FADT_OFFSET (pm2_control_length),ACPI_FADT_SEPARATE_LENGTH }, + + {"PmTimerBlock" ,ACPI_FADT_OFFSET (xpm_timer_block), +ACPI_FADT_OFFSET (pm_timer_block), +ACPI_FADT_OFFSET (pm_timer_length),ACPI_FADT_REQUIRED }, + + {"Gpe0Block" ,ACPI_FADT_OFFSET (xgpe0_block), +ACPI_FADT_OFFSET (gpe0_block), +ACPI_FADT_OFFSET (gpe0_block_length),ACPI_FADT_SEPARATE_LENGTH }, + + {"Gpe1Block" ,ACPI_FADT_OFFSET (xgpe1_block), +ACPI_FADT_OFFSET (gpe1_block), +ACPI_FADT_OFFSET (gpe1_block_length),ACPI_FADT_SEPARATE_LENGTH } }; -#define ACPI_FADT_CONVERSION_ENTRIES (sizeof (fadt_conversion_table) / sizeof (struct acpi_fadt_conversion)) +#define ACPI_FADT_INFO_ENTRIES (sizeof (fadt_info_table) / sizeof (struct acpi_fadt_info))/******************************************************************************* * * FUNCTION: acpi_tb_init_generic_address * -* PARAMETERS: new_gas_struct - GAS struct to be initialized +* PARAMETERS: generic_address - GAS struct to be initialized * bit_width - Width of this register * Address - Address of the register * * RETURN: None * -* DESCRIPTION: Initialize a GAS structure. +* DESCRIPTION: Initialize a Generic Address Structure (GAS) +* See the ACPI specification for a full description and +* definition of this structure. * ******************************************************************************/ static void inline -acpi_tb_init_generic_address (struct acpi_generic_address *new_gas_struct, +acpi_tb_init_generic_address (struct acpi_generic_address *generic_address,u8 bit_width,u64 address) { -ACPI_MOVE_64_TO_64 (&new_gas_struct->address, &address); - new_gas_struct->space_id =ACPI_ADR_SPACE_SYSTEM_IO ; - new_gas_struct->bit_width = bit_width; - new_gas_struct->bit_offset =0 ; - new_gas_struct->access_width =0 ; +/* +* The 64-bit Address field is non-aligned in the byte packed +* GAS struct. +*/ +ACPI_MOVE_64_TO_64 (&generic_address->address, &address); + +/* All other fields are byte-wide */ + + generic_address->space_id =ACPI_ADR_SPACE_SYSTEM_IO ; + generic_address->bit_width = bit_width; + generic_address->bit_offset =0 ; + generic_address->access_width =0 ; }/*******************************************************************************
@@ -139,8 +157,8 @@ void acpi_tb_parse_fadt(acpi_native_uintstruct acpi_table_header *table;/* -* Special case for the FADT because of multiple versions and the fact -* that it contains pointers to both the DSDT and FACS tables. +* The FADT has multiple versions with different lengths, +* and it contains pointers to both the DSDT and FACS tables. * * Get a local copy of the FADT and convert it to a common format * Map entire FADT, assumed to be smaller than one page.
@@ -160,29 +178,41 @@ void acpi_tb_parse_fadt(acpi_native_uint*/ (void )acpi_tb_verify_checksum (table, length); -/* Copy the entire FADT locally */ +/* +* If the FADT is larger than what we know about, we have a problem. +* Truncate the table, but make some noise. +*/ +if (length >sizeof (struct acpi_table_fadt )) { +ACPI_WARNING ((AE_INFO , +"FADT (revision %u) is too large, truncating length 0x%X to 0x%X" , + table->revision, length, +sizeof (struct acpi_table_fadt ))); + } -ACPI_MEMSET (&acpi_gbl_FADT,0 ,sizeof (struct acpi_table_fadt )); +/* Copy the entire FADT locally. Zero first for tb_convert_fadt */ +ACPI_MEMSET (&acpi_gbl_FADT,0 ,sizeof (struct acpi_table_fadt ));ACPI_MEMCPY (&acpi_gbl_FADT, table,ACPI_MIN (length,sizeof (struct acpi_table_fadt ))); -acpi_os_unmap_memory (table, length); -/* Convert local FADT to the common internal format */ +/* All done with the real FADT, unmap it */ + +acpi_os_unmap_memory (table, length); +/* +* 1) Convert the local copy of the FADT to the common internal format +* 2) Validate some of the important values within the FADT +*/ acpi_tb_convert_fadt (); +acpi_tb_validate_fadt (&acpi_gbl_FADT); -/* Extract the DSDT and FACS tables from the FADT */ +/* Obtain the DSDT and FACS tables via their addresses within the FADT */ acpi_tb_install_table ((acpi_physical_address ) acpi_gbl_FADT.Xdsdt, flags,ACPI_SIG_DSDT ,ACPI_TABLE_INDEX_DSDT );acpi_tb_install_table ((acpi_physical_address ) acpi_gbl_FADT.Xfacs, flags,ACPI_SIG_FACS ,ACPI_TABLE_INDEX_FACS ); - -/* Validate important FADT values */ - -acpi_tb_validate_fadt (); }/*******************************************************************************
@@ -194,6 +224,7 @@ void acpi_tb_parse_fadt(acpi_native_uint* RETURN: None * * DESCRIPTION: Converts all versions of the FADT to a common internal format. +* -> Expand all 32-bit addresses to 64-bit. * * NOTE: acpi_gbl_FADT must be of size (struct acpi_table_fadt), * and must contain a copy of the actual FADT.
@@ -213,13 +244,17 @@ void acpi_tb_parse_fadt(acpi_native_uint* ******************************************************************************/ -static void acpi_tb_convert_fadt (void ) +void acpi_tb_convert_fadt (void ) {u8 pm1_register_length;struct acpi_generic_address *target;acpi_native_uint i; -/* Expand the FACS and DSDT addresses as necessary */ +/* Update the local FADT table header length */ + + acpi_gbl_FADT.header.length =sizeof (struct acpi_table_fadt ); + +/* Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary */ if (!acpi_gbl_FADT.Xfacs) { acpi_gbl_FADT.Xfacs = (u64 ) acpi_gbl_FADT.facs;
@@ -233,10 +268,10 @@ static void acpi_tb_convert_fadt(void)* Expand the 32-bit V1.0 addresses to the 64-bit "X" generic address * structures as necessary. */ -for (i =0 ; i <ACPI_FADT_CONVERSION_ENTRIES ; i++) { +for (i =0 ; i <ACPI_FADT_INFO_ENTRIES ; i++) { target = ACPI_ADD_PTR(struct acpi_generic_address, &acpi_gbl_FADT, - fadt_conversion_table[i].target); + fadt_info_table[i].target);/* Expand only if the X target is null */
@@ -244,11 +279,11 @@ static void acpi_tb_convert_fadt(void)acpi_tb_init_generic_address (target, *ACPI_ADD_PTR (u8, &acpi_gbl_FADT, - fadt_conversion_table + fadt_info_table [i].length), (u64) *ACPI_ADD_PTR (u32, &acpi_gbl_FADT, - fadt_conversion_table + fadt_info_table [i]. source)); }
@@ -265,14 +300,14 @@ static void acpi_tb_convert_fadt(void)*/ pm1_register_length = (u8 )ACPI_DIV_2 (acpi_gbl_FADT.pm1_event_length); -/* PM1A is required */ +/* The PM1A register block is required */ acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable, pm1_register_length, (acpi_gbl_FADT.xpm1a_event_block.address + pm1_register_length)); -/* PM1B is optional; leave null if not present */ +/* The PM1B register block is optional, ignore if not present */ if (acpi_gbl_FADT.xpm1b_event_block.address) { acpi_tb_init_generic_address(&acpi_gbl_xpm1b_enable,
@@ -280,102 +315,84 @@ static void acpi_tb_convert_fadt(void) (acpi_gbl_FADT.xpm1b_event_block. address + pm1_register_length)); } - -/* Global FADT is the new common V2.0 FADT */ - - acpi_gbl_FADT.header.length =sizeof (struct acpi_table_fadt ); }/****************************************************************************** * * FUNCTION: acpi_tb_validate_fadt * -* PARAMETERS: None +* PARAMETERS: Table - Pointer to the FADT to be validated * * RETURN: None * -* DESCRIPTION: Validate various ACPI registers in the FADT. For problems, -* issue a message, but no status is returned. +* DESCRIPTION: Validate various important fields within the FADT. If a problem +* is found, issue a message, but no status is returned. +* Used by both the table manager and the disassembler. +* +* Possible additional checks: +* (acpi_gbl_FADT.pm1_event_length >= 4) +* (acpi_gbl_FADT.pm1_control_length >= 2) +* (acpi_gbl_FADT.pm_timer_length >= 4) +* Gpe block lengths must be multiple of 2 * ******************************************************************************/ -static void acpi_tb_validate_fadt (void ) +void acpi_tb_validate_fadt (struct acpi_table_fadt *table) { +u32 *address32; +struct acpi_generic_address *address64; +u8 length; +acpi_native_uint i; -/* These length fields have a minimum value */ - -if (acpi_gbl_FADT.pm1_event_length <4 ) { -acpi_tb_fadt_register_error ("Pm1EventLength" , - (u32 ) acpi_gbl_FADT. - pm1_event_length); - } - -if (acpi_gbl_FADT.pm_timer_length <4 ) { -acpi_tb_fadt_register_error ("PmTimerLength" , - (u32 ) acpi_gbl_FADT. - pm_timer_length); - } - -/* These length and address fields must be non-zero */ - -if (!acpi_gbl_FADT.pm1_control_length) { -acpi_tb_fadt_register_error ("Pm1ControlLength" ,0 ); - } - -if (!acpi_gbl_FADT.xpm1a_event_block.address) { -acpi_tb_fadt_register_error ("XPm1aEventBlock.Address" ,0 ); - } - -if (!acpi_gbl_FADT.xpm1a_control_block.address) { -acpi_tb_fadt_register_error ("XPm1aControlBlock.Address" ,0 ); - } - -if (!acpi_gbl_FADT.xpm_timer_block.address) { -acpi_tb_fadt_register_error ("XPmTimerBlock.Address" ,0 ); - } - -/* If PM2 block is present, must have non-zero length */ - -if ((acpi_gbl_FADT.xpm2_control_block.address && - !acpi_gbl_FADT.pm2_control_length)) { -acpi_tb_fadt_register_error ("Pm2ControlLength" , - (u32 ) acpi_gbl_FADT. - pm2_control_length); - } - -/* Length of any valid GPE blocks must be a multiple of 2 */ +/* Examine all of the 64-bit extended address fields (X fields) */ + +for (i =0 ; i <ACPI_FADT_INFO_ENTRIES ; i++) { + +/* Generate pointers to the 32-bit and 64-bit addresses and get the length */ + + address64 = + ACPI_ADD_PTR(struct acpi_generic_address, table, + fadt_info_table[i].target); + address32 =ACPI_ADD_PTR (u32, table, fadt_info_table[i].source); + length = *ACPI_ADD_PTR (u8, table, fadt_info_table[i].length); + +if (fadt_info_table[i].type &ACPI_FADT_REQUIRED ) { +/* +* Field is required (Pm1a_event, Pm1a_control, pm_timer). +* Both the address and length must be non-zero. +*/ +if (!address64->address || !length) { +ACPI_ERROR ((AE_INFO , +"Required field \"%s\" has zero address and/or length: %8.8X%8.8X/%X" , + fadt_info_table[i].name, +ACPI_FORMAT_UINT64 (address64-> + address), + length)); + } + }else if (fadt_info_table[i].type &ACPI_FADT_SEPARATE_LENGTH ) { +/* +* Field is optional (PM2Control, GPE0, GPE1) AND has its own +* length field. If present, both the address and length must be valid. +*/ +if ((address64->address && !length) + || (!address64->address && length)) { +ACPI_WARNING ((AE_INFO , +"Optional field \"%s\" has zero address or length: %8.8X%8.8X/%X" , + fadt_info_table[i].name, +ACPI_FORMAT_UINT64 (address64-> + address), + length)); + } + } -if (acpi_gbl_FADT.xgpe0_block.address && - (acpi_gbl_FADT.gpe0_block_length &1 )) { -acpi_tb_fadt_register_error ("Gpe0BlockLength" , - (u32 ) acpi_gbl_FADT. - gpe0_block_length); - } +/* If both 32- and 64-bit addresses are valid (non-zero), they must match */ -if (acpi_gbl_FADT.xgpe1_block.address && - (acpi_gbl_FADT.gpe1_block_length &1 )) { -acpi_tb_fadt_register_error ("Gpe1BlockLength" , - (u32 ) acpi_gbl_FADT. - gpe1_block_length); +if (address64->address && *address32 && + (address64->address != (u64) * address32)) { +ACPI_ERROR ((AE_INFO , +"32/64X address mismatch in \"%s\": [%8.8X] [%8.8X%8.8X], using 64X" , + fadt_info_table[i].name, *address32, +ACPI_FORMAT_UINT64 (address64->address))); + } } } - -/******************************************************************************* -* -* FUNCTION: acpi_tb_fadt_register_error -* -* PARAMETERS: register_name - Pointer to string identifying register -* Value - Actual register contents value -* -* RETURN: None -* -* DESCRIPTION: Display FADT warning message -* -******************************************************************************/ - -static void acpi_tb_fadt_register_error (char *register_name,u32 value) -{ - -ACPI_WARNING ((AE_INFO ,"Invalid FADT value in field \"%s\" = %X" , - register_name, value)); -}
drivers/acpi/tables/tbutils.c +1 -1
@@ -278,7 +278,7 @@ acpi_tb_get_root_table_entry(u8 * table_#if ACPI_MACHINE_WIDTH ==32 if (address64 >ACPI_UINT32_MAX ) { -/* Will truncate 64-bit address to 32 bits */ +/* Will truncate 64-bit address to 32 bits, issue warning */ ACPI_WARNING((AE_INFO, "64-bit Physical Address in XSDT is too large (%8.8X%8.8X), truncating",
include/acpi/actables.h +4 -0
@@ -51,6 +51,10 @@ acpi_status acpi_allocate_root_table(u32*/ void acpi_tb_parse_fadt (acpi_native_uint table_index,u8 flags); +void acpi_tb_convert_fadt (void ); + +void acpi_tb_validate_fadt (struct acpi_table_fadt *table); +/* * tbfind - find ACPI table */
Signature · 1 line
1.4.4.1
PATCH 35/65 ACPICA: Report error if method creates 2 objects with the same name
From: Robert Moore <[email protected]>
Fixed a regression where an error was no
longer emitted if a control method attempts to create 2 objects of the same name. This previously and now returns AE_ALREADY_EXISTS. When this exception occurs, it invokes the mechanism that will dynamically serialize the control method to possible prevent future errors. (BZ 440)
--- drivers/acpi/dispatcher/dswload.c | 15 ++++++++++++--- drivers/acpi/parser/psparse.c | 5 +++++ 2 files changed, 17 insertions(+), 3 deletions(-)
drivers/acpi/dispatcher/dswload.c +12 -3
@@ -547,6 +547,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_acpi_status status;acpi_object_type object_type;char *buffer_ptr; +u32 flags;ACPI_FUNCTION_TRACE (ds_load2_begin_op);
@@ -752,12 +753,20 @@ acpi_ds_load2_begin_op(struct acpi_walk_break ; } -/* Add new entry into namespace */ + flags =ACPI_NS_NO_UPSEARCH ; +if (walk_state->pass_number ==3 ) { + +/* Execution mode, node cannot already exist */ + + flags |=ACPI_NS_ERROR_IF_FOUND ; + } + +/* Add new entry or lookup existing entry */ status =acpi_ns_lookup (walk_state->scope_info, buffer_ptr, - object_type,ACPI_IMODE_LOAD_PASS2 , -ACPI_NS_NO_UPSEARCH , walk_state, &(node)); + object_type,ACPI_IMODE_LOAD_PASS2 , flags, + walk_state, &node);break ; }
drivers/acpi/parser/psparse.c +5 -0
@@ -540,6 +540,11 @@ acpi_status acpi_ps_parse_aml(struct acpif ((status ==AE_ALREADY_EXISTS ) && (!walk_state->method_desc->method.mutex)) { +ACPI_INFO ((AE_INFO , +"Marking method %4.4s as Serialized" , + walk_state->method_node->name. + ascii)); +/* * Method tried to create an object twice. The probable cause is * that the method cannot handle reentrancy.
Signature · 1 line
1.4.4.1
PATCH 36/65 ACPICA: New common routine for creating and verifying a local FADT.
From: Robert Moore <[email protected]>
--- drivers/acpi/tables/tbfadt.c | 71 ++++++++++++++++++++++++++++++------------ include/acpi/actables.h | 4 +-- 2 files changed, 52 insertions(+), 23 deletions(-)
drivers/acpi/tables/tbfadt.c +51 -20
@@ -52,6 +52,10 @@ static void inline acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, u8 bit_width, u64 address); +static void acpi_tb_convert_fadt (void ); + +static void acpi_tb_validate_fadt (void ); +/* Table for conversion of FADT to common internal format and FADT validation */ typedef struct acpi_fadt_info {
@@ -178,13 +182,47 @@ void acpi_tb_parse_fadt(acpi_native_uint*/ (void )acpi_tb_verify_checksum (table, length); +/* Obtain a local copy of the FADT in common ACPI 2.0+ format */ + +acpi_tb_create_local_fadt (table, length); + +/* All done with the real FADT, unmap it */ + +acpi_os_unmap_memory (table, length); + +/* Obtain the DSDT and FACS tables via their addresses within the FADT */ + +acpi_tb_install_table ((acpi_physical_address ) acpi_gbl_FADT.Xdsdt, + flags,ACPI_SIG_DSDT ,ACPI_TABLE_INDEX_DSDT ); + +acpi_tb_install_table ((acpi_physical_address ) acpi_gbl_FADT.Xfacs, + flags,ACPI_SIG_FACS ,ACPI_TABLE_INDEX_FACS ); +} + +/******************************************************************************* +* +* FUNCTION: acpi_tb_create_local_fadt +* +* PARAMETERS: Table - Pointer to BIOS FADT +* Length - Length of the table +* +* RETURN: None +* +* DESCRIPTION: Get a local copy of the FADT and convert it to a common format. +* Performs validation on some important FADT fields. +* +******************************************************************************/ + +void acpi_tb_create_local_fadt (struct acpi_table_header *table,u32 length) +{ +/* -* If the FADT is larger than what we know about, we have a problem. +* Check if the FADT is larger than what we know about (ACPI 2.0 version). * Truncate the table, but make some noise. */ if (length >sizeof (struct acpi_table_fadt )) {ACPI_WARNING ((AE_INFO , -"FADT (revision %u) is too large, truncating length 0x%X to 0x%X" , +"FADT (revision %u) is longer than ACPI 2.0 version, truncating length 0x%X to 0x%X" , table->revision, length,sizeof (struct acpi_table_fadt ))); }
@@ -192,27 +230,16 @@ void acpi_tb_parse_fadt(acpi_native_uint/* Copy the entire FADT locally. Zero first for tb_convert_fadt */ ACPI_MEMSET (&acpi_gbl_FADT,0 ,sizeof (struct acpi_table_fadt )); +ACPI_MEMCPY (&acpi_gbl_FADT, table,ACPI_MIN (length,sizeof (struct acpi_table_fadt ))); -/* All done with the real FADT, unmap it */ - -acpi_os_unmap_memory (table, length); -/* * 1) Convert the local copy of the FADT to the common internal format * 2) Validate some of the important values within the FADT */ acpi_tb_convert_fadt (); -acpi_tb_validate_fadt (&acpi_gbl_FADT); - -/* Obtain the DSDT and FACS tables via their addresses within the FADT */ - -acpi_tb_install_table ((acpi_physical_address ) acpi_gbl_FADT.Xdsdt, - flags,ACPI_SIG_DSDT ,ACPI_TABLE_INDEX_DSDT ); - -acpi_tb_install_table ((acpi_physical_address ) acpi_gbl_FADT.Xfacs, - flags,ACPI_SIG_FACS ,ACPI_TABLE_INDEX_FACS ); +acpi_tb_validate_fadt (); }/*******************************************************************************
@@ -244,7 +271,7 @@ void acpi_tb_parse_fadt(acpi_native_uint* ******************************************************************************/ -void acpi_tb_convert_fadt (void ) +static void acpi_tb_convert_fadt (void ) {u8 pm1_register_length;struct acpi_generic_address *target;
@@ -337,7 +364,7 @@ void acpi_tb_convert_fadt(void)* ******************************************************************************/ -void acpi_tb_validate_fadt (struct acpi_table_fadt *table) +static void acpi_tb_validate_fadt (void ) {u32 *address32;struct acpi_generic_address *address64;
@@ -351,10 +378,14 @@ void acpi_tb_validate_fadt(struct acpi_t/* Generate pointers to the 32-bit and 64-bit addresses and get the length */ address64 = - ACPI_ADD_PTR(struct acpi_generic_address, table, + ACPI_ADD_PTR(struct acpi_generic_address, &acpi_gbl_FADT, fadt_info_table[i].target); - address32 =ACPI_ADD_PTR (u32, table, fadt_info_table[i].source); - length = *ACPI_ADD_PTR (u8, table, fadt_info_table[i].length); + address32 = +ACPI_ADD_PTR (u32, &acpi_gbl_FADT, + fadt_info_table[i].source); + length = + *ACPI_ADD_PTR (u8, &acpi_gbl_FADT, + fadt_info_table[i].length);if (fadt_info_table[i].type &ACPI_FADT_REQUIRED ) {/*
include/acpi/actables.h +1 -3
@@ -51,9 +51,7 @@ acpi_status acpi_allocate_root_table(u32*/ void acpi_tb_parse_fadt (acpi_native_uint table_index,u8 flags); -void acpi_tb_convert_fadt (void ); - -void acpi_tb_validate_fadt (struct acpi_table_fadt *table); +void acpi_tb_create_local_fadt (struct acpi_table_header *table,u32 length);/* * tbfind - find ACPI table
Signature · 1 line
1.4.4.1
PATCH 37/65 ACPICA: Fix memory leak in table load error path
From: Robert Moore <[email protected]>
--- drivers/acpi/executer/exconfig.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/acpi/executer/exconfig.c +1 -1
@@ -413,7 +413,7 @@ acpi_ex_load_op(union acpi_operand_objec*/ status =acpi_tb_add_table (table_ptr, &table_index);if (ACPI_FAILURE (status)) { -return_ACPI_STATUS (status); + goto cleanup; } status =
Signature · 1 line
1.4.4.1
PATCH 38/65 ACPICA: Fix trace output name and whitespace
From: Robert Moore <[email protected]>
--- drivers/acpi/executer/exutils.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
drivers/acpi/executer/exutils.c +1 -3
@@ -88,7 +88,7 @@ void acpi_ex_enter_interpreter(void) {acpi_status status; -ACPI_FUNCTION_TRACE (ex_reacquire_interpreter); +ACPI_FUNCTION_TRACE (ex_enter_interpreter); status =acpi_ut_acquire_mutex (ACPI_MTX_INTERPRETER );if (ACPI_FAILURE (status)) {
@@ -116,7 +116,6 @@ void acpi_ex_enter_interpreter(void)void acpi_ex_reacquire_interpreter (void ) { -ACPI_FUNCTION_TRACE (ex_reacquire_interpreter);/*
@@ -185,7 +184,6 @@ void acpi_ex_exit_interpreter(void)void acpi_ex_relinquish_interpreter (void ) { -ACPI_FUNCTION_TRACE (ex_relinquish_interpreter);/*
Signature · 1 line
1.4.4.1
PATCH 39/65 ACPICA: Update version to 20060912
From: Robert Moore <[email protected]>
--- include/acpi/acconfig.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/acpi/acconfig.h +1 -1
@@ -63,7 +63,7 @@/* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20060831 +#define ACPI_CA_VERSION 0x20060912/* * OS name, used for the _OS object. The _OS object is essentially obsolete,
Signature · 1 line
1.4.4.1
PATCH 40/65 ACPICA: Add full table name to disassembler output
From: Robert Moore <[email protected]>
--- include/acpi/acdisasm.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
include/acpi/acdisasm.h +2 -0
@@ -101,6 +101,7 @@ typedef const struct acpi_dmtable_info {#define ACPI_DMT_MADT 24#define ACPI_DMT_SRAT 25#define ACPI_DMT_EXIT 26 +#define ACPI_DMT_SIG 27typedef void (*ACPI_TABLE_HANDLER ) (struct acpi_table_header * table);
@@ -109,6 +110,7 @@ struct acpi_dmtable_data {char *signature;struct acpi_dmtable_info *table_info;ACPI_TABLE_HANDLER table_handler; +char *name; };struct acpi_op_walk_info {
Signature · 1 line
1.4.4.1
PATCH 41/65 ACPICA: Fix for Global Lock semaphore.
From: Robert Moore <[email protected]>
Fixed a problem with the Global Lock where the lock could appear to be obtained before it is actually obtained, semaphore created with one unit.
--- drivers/acpi/namespace/nsaccess.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/acpi/namespace/nsaccess.c +1 -1
@@ -214,7 +214,7 @@ acpi_status acpi_ns_root_initialize(void/* Create additional counting semaphore for global lock */ status = -acpi_os_create_semaphore (1 ,1 , +acpi_os_create_semaphore (1 ,0 , &acpi_gbl_global_lock_semaphore);if (ACPI_FAILURE (status)) { acpi_ut_remove_reference
Signature · 1 line
1.4.4.1
PATCH 42/65 ACPICA: Remove obsolete Flags parameter.
From: Robert Moore <[email protected]>
Remove flags parameter for acpi_{get,set}_register(). It is no longer necessary now that these functions use a spinlock for mutual exclusion.
--- arch/i386/kernel/cpu/cpufreq/longhaul.c | 9 +++------ drivers/acpi/events/evevent.c | 8 +++----- drivers/acpi/events/evmisc.c | 2 +- drivers/acpi/events/evxfevnt.c | 12 ++++++------ drivers/acpi/hardware/hwacpi.c | 3 +-- drivers/acpi/hardware/hwregs.c | 18 +++++------------- drivers/acpi/hardware/hwsleep.c | 22 ++++++++-------------- drivers/acpi/pci_link.c | 2 +- drivers/acpi/processor_idle.c | 21 +++++++-------------- include/acpi/achware.h | 2 +- include/acpi/acpixf.h | 4 ++-- 11 files changed, 38 insertions(+), 65 deletions(-)
arch/i386/kernel/cpu/cpufreq/longhaul.c +3 -6
@@ -245,8 +245,7 @@ static void longhaul_setstate(unsigned iif (pr->flags.bm_control) {/* Disable bus master arbitration */ -acpi_set_register (ACPI_BITREG_ARB_DISABLE ,1 , -ACPI_MTX_DO_NOT_LOCK ); +acpi_set_register (ACPI_BITREG_ARB_DISABLE ,1 ); }else if (port22_en) {/* Disable AGP and PCI arbiters */ outb (3 ,0x22 );
@@ -279,16 +278,14 @@ static void longhaul_setstate(unsigned i*/ case TYPE_POWERSAVER :/* Don't allow wakeup */ -acpi_set_register (ACPI_BITREG_BUS_MASTER_RLD ,0 , -ACPI_MTX_DO_NOT_LOCK ); +acpi_set_register (ACPI_BITREG_BUS_MASTER_RLD ,0 );do_powersaver (cx->address, clock_ratio_index);break ; }if (pr->flags.bm_control) {/* Enable bus master arbitration */ -acpi_set_register (ACPI_BITREG_ARB_DISABLE ,0 , -ACPI_MTX_DO_NOT_LOCK ); +acpi_set_register (ACPI_BITREG_ARB_DISABLE ,0 ); }else if (port22_en) {/* Enable arbiters */ outb (0 ,0x22 );
drivers/acpi/events/evevent.c +3 -5
@@ -204,8 +204,7 @@ static acpi_status acpi_ev_fixed_event_iif (acpi_gbl_fixed_event_info[i].enable_register_id !=0xFF ) { status =acpi_set_register (acpi_gbl_fixed_event_info[i]. - enable_register_id,0 , -ACPI_MTX_LOCK ); + enable_register_id,0 );if (ACPI_FAILURE (status)) {return (status); }
@@ -291,7 +290,7 @@ static u32 acpi_ev_fixed_event_dispatch(/* Clear the status bit */ (void )acpi_set_register (acpi_gbl_fixed_event_info[event]. - status_register_id,1 ,ACPI_MTX_DO_NOT_LOCK ); + status_register_id,1 );/* * Make sure we've got a handler. If not, report an error.
@@ -299,8 +298,7 @@ static u32 acpi_ev_fixed_event_dispatch(*/ if (NULL == acpi_gbl_fixed_event_handlers[event].handler) { (void )acpi_set_register (acpi_gbl_fixed_event_info[event]. - enable_register_id,0 , -ACPI_MTX_DO_NOT_LOCK ); + enable_register_id,0 ); ACPI_ERROR((AE_INFO, "No installed handler for fixed event [%08X]",
drivers/acpi/events/evmisc.c +1 -1
@@ -495,7 +495,7 @@ acpi_status acpi_ev_release_global_lock(if (pending) { status =acpi_set_register (ACPI_BITREG_GLOBAL_LOCK_RELEASE , -1 ,ACPI_MTX_LOCK ); +1 ); } ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
drivers/acpi/events/evxfevnt.c +6 -6
@@ -157,7 +157,7 @@ acpi_status acpi_enable_event(u32 event,*/ status =acpi_set_register (acpi_gbl_fixed_event_info[event]. - enable_register_id,1 ,ACPI_MTX_LOCK ); + enable_register_id,1 );if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }
@@ -166,7 +166,7 @@ acpi_status acpi_enable_event(u32 event, status =acpi_get_register (acpi_gbl_fixed_event_info[event]. - enable_register_id, &value,ACPI_MTX_LOCK ); + enable_register_id, &value);if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }
@@ -356,14 +356,14 @@ acpi_status acpi_disable_event(u32 event*/ status =acpi_set_register (acpi_gbl_fixed_event_info[event]. - enable_register_id,0 ,ACPI_MTX_LOCK ); + enable_register_id,0 );if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); } status =acpi_get_register (acpi_gbl_fixed_event_info[event]. - enable_register_id, &value,ACPI_MTX_LOCK ); + enable_register_id, &value);if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }
@@ -409,7 +409,7 @@ acpi_status acpi_clear_event(u32 event)*/ status =acpi_set_register (acpi_gbl_fixed_event_info[event]. - status_register_id,1 ,ACPI_MTX_LOCK ); + status_register_id,1 );return_ACPI_STATUS (status); }
@@ -498,7 +498,7 @@ acpi_status acpi_get_event_status(u32 ev status =acpi_get_register (acpi_gbl_fixed_event_info[event]. - status_register_id, event_status,ACPI_MTX_LOCK ); + status_register_id, event_status);return_ACPI_STATUS (status); }
drivers/acpi/hardware/hwacpi.c +1 -2
@@ -171,8 +171,7 @@ u32 acpi_hw_get_mode(void)return_UINT32 (ACPI_SYS_MODE_ACPI ); } - status = -acpi_get_register (ACPI_BITREG_SCI_ENABLE , &value,ACPI_MTX_LOCK ); + status =acpi_get_register (ACPI_BITREG_SCI_ENABLE , &value);if (ACPI_FAILURE (status)) {return_UINT32 (ACPI_SYS_MODE_LEGACY ); }
drivers/acpi/hardware/hwregs.c +5 -13
@@ -54,17 +54,15 @@ ACPI_MODULE_NAME("hwregs")* * FUNCTION: acpi_hw_clear_acpi_status * -* PARAMETERS: Flags - Lock the hardware or not +* PARAMETERS: None * -* RETURN: none +* RETURN: None * * DESCRIPTION: Clears all fixed and general purpose status bits * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED * -* NOTE: TBD: Flags parameter is obsolete, to be removed -* ******************************************************************************/ -acpi_status acpi_hw_clear_acpi_status (u32 flags) +acpi_status acpi_hw_clear_acpi_status (void ) {acpi_status status;acpi_cpu_flags lock_flags =0 ;
@@ -253,18 +251,15 @@ struct acpi_bit_register_info *acpi_hw_g* * PARAMETERS: register_id - ID of ACPI bit_register to access * return_value - Value that was read from the register -* Flags - Lock the hardware or not * * RETURN: Status and the value read from specified Register. Value * returned is normalized to bit0 (is shifted all the way right) * * DESCRIPTION: ACPI bit_register read function. * -* NOTE: TBD: Flags parameter is obsolete, to be removed -* ******************************************************************************/ -acpi_status acpi_get_register (u32 register_id,u32 * return_value,u32 flags) +acpi_status acpi_get_register (u32 register_id,u32 * return_value) {u32 register_value =0 ;struct acpi_bit_register_info *bit_reg_info;
@@ -312,16 +307,13 @@ ACPI_EXPORT_SYMBOL(acpi_get_register)* PARAMETERS: register_id - ID of ACPI bit_register to access * Value - (only used on write) value to write to the * Register, NOT pre-normalized to the bit pos -* Flags - Lock the hardware or not * * RETURN: Status * * DESCRIPTION: ACPI Bit Register write function. * -* NOTE: TBD: Flags parameter is obsolete, to be removed -* ******************************************************************************/ -acpi_status acpi_set_register (u32 register_id,u32 value,u32 flags) +acpi_status acpi_set_register (u32 register_id,u32 value) {u32 register_value =0 ;struct acpi_bit_register_info *bit_reg_info;
drivers/acpi/hardware/hwsleep.c +8 -14
@@ -277,15 +277,14 @@ acpi_status asmlinkage acpi_enter_sleep_/* Clear wake status */ - status = -acpi_set_register (ACPI_BITREG_WAKE_STATUS ,1 ,ACPI_MTX_DO_NOT_LOCK ); + status =acpi_set_register (ACPI_BITREG_WAKE_STATUS ,1 );if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }/* Clear all fixed and general purpose status bits */ - status =acpi_hw_clear_acpi_status (ACPI_MTX_DO_NOT_LOCK ); + status =acpi_hw_clear_acpi_status ();if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }
@@ -398,8 +397,7 @@ acpi_status asmlinkage acpi_enter_sleep_/* Wait until we enter sleep state */ do { - status = acpi_get_register(ACPI_BITREG_WAKE_STATUS, &in_value, - ACPI_MTX_DO_NOT_LOCK); + status = acpi_get_register(ACPI_BITREG_WAKE_STATUS, &in_value); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); }
@@ -432,13 +430,12 @@ acpi_status asmlinkage acpi_enter_sleep_ACPI_FUNCTION_TRACE (acpi_enter_sleep_state_s4bios); - status = -acpi_set_register (ACPI_BITREG_WAKE_STATUS ,1 ,ACPI_MTX_DO_NOT_LOCK ); + status =acpi_set_register (ACPI_BITREG_WAKE_STATUS ,1 );if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); } - status =acpi_hw_clear_acpi_status (ACPI_MTX_DO_NOT_LOCK ); + status =acpi_hw_clear_acpi_status ();if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }
@@ -465,8 +462,7 @@ acpi_status asmlinkage acpi_enter_sleep_ do { acpi_os_stall(1000); - status = acpi_get_register(ACPI_BITREG_WAKE_STATUS, &in_value, - ACPI_MTX_DO_NOT_LOCK); + status = acpi_get_register(ACPI_BITREG_WAKE_STATUS, &in_value); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); }
@@ -599,13 +595,11 @@ acpi_status acpi_leave_sleep_state(u8 sl (void )acpi_set_register (acpi_gbl_fixed_event_info - [ACPI_EVENT_POWER_BUTTON ].enable_register_id,1 , -ACPI_MTX_DO_NOT_LOCK ); + [ACPI_EVENT_POWER_BUTTON ].enable_register_id,1 ); (void )acpi_set_register (acpi_gbl_fixed_event_info - [ACPI_EVENT_POWER_BUTTON ].status_register_id,1 , -ACPI_MTX_DO_NOT_LOCK ); + [ACPI_EVENT_POWER_BUTTON ].status_register_id,1 ); arg.integer.value =ACPI_SST_WORKING ; status =acpi_evaluate_object (NULL ,METHOD_NAME__SST , &arg_list,NULL );
drivers/acpi/pci_link.c +1 -1
@@ -787,7 +787,7 @@ static int irqrouter_resume(struct sys_d/* Make sure SCI is enabled again (Apple firmware bug?) */ -acpi_set_register (ACPI_BITREG_SCI_ENABLE ,1 ,ACPI_MTX_DO_NOT_LOCK ); +acpi_set_register (ACPI_BITREG_SCI_ENABLE ,1 );list_for_each (node, &acpi_link.entries) { link = list_entry(node, struct acpi_pci_link, node);
drivers/acpi/processor_idle.c +7 -14
@@ -187,8 +187,7 @@ acpi_processor_power_activate(struct acpcase ACPI_STATE_C3 :/* Disable bus master reload */ if (new->type !=ACPI_STATE_C3 && pr->flags.bm_check) -acpi_set_register (ACPI_BITREG_BUS_MASTER_RLD ,0 , -ACPI_MTX_DO_NOT_LOCK ); +acpi_set_register (ACPI_BITREG_BUS_MASTER_RLD ,0 );break ; } }
@@ -198,8 +197,7 @@ acpi_processor_power_activate(struct acpcase ACPI_STATE_C3 :/* Enable bus master reload */ if (old->type !=ACPI_STATE_C3 && pr->flags.bm_check) -acpi_set_register (ACPI_BITREG_BUS_MASTER_RLD ,1 , -ACPI_MTX_DO_NOT_LOCK ); +acpi_set_register (ACPI_BITREG_BUS_MASTER_RLD ,1 );break ; }
@@ -287,12 +285,10 @@ static void acpi_processor_idle(void) pr->power.bm_activity <<= diff; -acpi_get_register (ACPI_BITREG_BUS_MASTER_STATUS , - &bm_status,ACPI_MTX_DO_NOT_LOCK ); +acpi_get_register (ACPI_BITREG_BUS_MASTER_STATUS , &bm_status);if (bm_status) { pr->power.bm_activity |=0x1 ; -acpi_set_register (ACPI_BITREG_BUS_MASTER_STATUS , -1 ,ACPI_MTX_DO_NOT_LOCK ); +acpi_set_register (ACPI_BITREG_BUS_MASTER_STATUS ,1 ); }/* * PIIX4 Erratum #18: Note that BM_STS doesn't always reflect
@@ -404,8 +400,7 @@ static void acpi_processor_idle(void)* All CPUs are trying to go to C3 * Disable bus master arbitration */ -acpi_set_register (ACPI_BITREG_ARB_DISABLE ,1 , -ACPI_MTX_DO_NOT_LOCK ); +acpi_set_register (ACPI_BITREG_ARB_DISABLE ,1 ); } }else {/* SMP with no shared cache... Invalidate cache */
@@ -421,8 +416,7 @@ static void acpi_processor_idle(void)if (pr->flags.bm_check) {/* Enable bus master arbitration */ atomic_dec (&c3_cpu_count); -acpi_set_register (ACPI_BITREG_ARB_DISABLE ,0 , -ACPI_MTX_DO_NOT_LOCK ); +acpi_set_register (ACPI_BITREG_ARB_DISABLE ,0 ); }#ifdef CONFIG_GENERIC_TIME
@@ -882,8 +876,7 @@ static void acpi_processor_power_verify_ " for C3 to be enabled on SMP systems\n"));return ; } -acpi_set_register (ACPI_BITREG_BUS_MASTER_RLD , -0 ,ACPI_MTX_DO_NOT_LOCK ); +acpi_set_register (ACPI_BITREG_BUS_MASTER_RLD ,0 ); }/*
include/acpi/achware.h +1 -1
@@ -82,7 +82,7 @@ acpi_hw_low_level_read(u32 width,acpi_status acpi_hw_low_level_write (u32 width,u32 value,struct acpi_generic_address *reg); -acpi_status acpi_hw_clear_acpi_status (u32 flags); +acpi_status acpi_hw_clear_acpi_status (void );/* * hwgpe - GPE support
include/acpi/acpixf.h +2 -2
@@ -306,9 +306,9 @@ acpi_resource_to_address64(struct acpi_r/* * Hardware (ACPI device) interfaces */ -acpi_status acpi_get_register (u32 register_id,u32 * return_value,u32 flags); +acpi_status acpi_get_register (u32 register_id,u32 * return_value); -acpi_status acpi_set_register (u32 register_id,u32 value,u32 flags); +acpi_status acpi_set_register (u32 register_id,u32 value);acpi_status acpi_set_firmware_waking_vector (acpi_physical_address physical_address);
Signature · 1 line
1.4.4.1
PATCH 43/65 ACPICA: Use faster ByIndex interface to get FACS
From: Robert Moore <[email protected]>
--- drivers/acpi/events/evmisc.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/acpi/events/evmisc.c +2 -2
@@ -349,8 +349,8 @@ acpi_status acpi_ev_init_global_lock_hanACPI_FUNCTION_TRACE (ev_init_global_lock_handler); status = -acpi_get_table (ACPI_SIG_FACS ,0 , - (struct acpi_table_header **)&facs); +acpi_get_table_by_index (ACPI_TABLE_INDEX_FACS , + (struct acpi_table_header **)&facs);if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }
Signature · 1 line
1.4.4.1
PATCH 44/65 ACPICA: On AML mutex force-release, set depth to zero (was 1).
From: Robert Moore <[email protected]>
--- drivers/acpi/executer/exmutex.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
drivers/acpi/executer/exmutex.c +7 -1
@@ -329,6 +329,12 @@ acpi_ex_release_mutex(union acpi_operand* * DESCRIPTION: Release all mutexes held by this thread * +* NOTE: This function is called as the thread is exiting the interpreter. +* Mutexes are not released when an individual control method is exited, but +* only when the parent thread actually exits the interpreter. This allows one +* method to acquire a mutex, and a different method to release it, as long as +* this is performed underneath a single parent control method. +* ******************************************************************************/ void acpi_ex_release_all_mutexes (struct acpi_thread_state *thread)
@@ -346,7 +352,7 @@ void acpi_ex_release_all_mutexes(struct obj_desc->mutex.prev =NULL ; obj_desc->mutex.next =NULL ; - obj_desc->mutex.acquisition_depth =1 ; + obj_desc->mutex.acquisition_depth =0 ;/* Release the mutex, special case for Global Lock */
Signature · 1 line
1.4.4.1
PATCH 45/65 ACPICA: Update interpreter error paths to always report the error
From: Robert Moore <[email protected]>
--- drivers/acpi/dispatcher/dswexec.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-)
drivers/acpi/dispatcher/dswexec.c +7 -3
@@ -219,7 +219,7 @@ acpi_ds_exec_begin_op(struct acpi_walk_sif (!op) { status =acpi_ds_load2_begin_op (walk_state, out_op);if (ACPI_FAILURE (status)) { -return_ACPI_STATUS (status); + goto error_exit; } op = *out_op;
@@ -238,7 +238,7 @@ acpi_ds_exec_begin_op(struct acpi_walk_s status =acpi_ds_scope_stack_pop (walk_state);if (ACPI_FAILURE (status)) { -return_ACPI_STATUS (status); + goto error_exit; } } }
@@ -287,7 +287,7 @@ acpi_ds_exec_begin_op(struct acpi_walk_s status =acpi_ds_result_stack_push (walk_state);if (ACPI_FAILURE (status)) { -return_ACPI_STATUS (status); + goto error_exit; } status =acpi_ds_exec_begin_control_op (walk_state, op);
@@ -328,6 +328,10 @@ acpi_ds_exec_begin_op(struct acpi_walk_s/* Nothing to do here during method execution */ return_ACPI_STATUS (status); + + error_exit: + status =acpi_ds_method_error (status, walk_state); +return_ACPI_STATUS (status); }/*****************************************************************************
Signature · 1 line
1.4.4.1
PATCH 46/65 ACPICA: Fix for possible memory leak and fault.
From: Robert Moore <[email protected]>
Fixed a possible memory leak and fault in acpi_ex_resolve_object_to_value() during a read from a buffer or region field. (BZ 458)
--- drivers/acpi/executer/exresolv.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-)
drivers/acpi/executer/exresolv.c +5 -3
@@ -141,7 +141,7 @@ acpi_ex_resolve_object_to_value(union acacpi_status status =AE_OK ;union acpi_operand_object *stack_desc;void *temp_node; -union acpi_operand_object *obj_desc; +union acpi_operand_object *obj_desc =NULL ;u16 opcode;ACPI_FUNCTION_TRACE (ex_resolve_object_to_value);
@@ -299,8 +299,6 @@ acpi_ex_resolve_object_to_value(union ac status =acpi_ds_get_package_arguments (stack_desc);break ; -/* These cases may never happen here, but just in case.. */ -case ACPI_TYPE_BUFFER_FIELD :case ACPI_TYPE_LOCAL_REGION_FIELD :case ACPI_TYPE_LOCAL_BANK_FIELD :
@@ -314,6 +312,10 @@ acpi_ex_resolve_object_to_value(union ac status =acpi_ex_read_data_from_field (walk_state, stack_desc, &obj_desc); + +/* Remove a reference to the original operand, then override */ + +acpi_ut_remove_reference (*stack_ptr); *stack_ptr = (void *)obj_desc;break ;
Signature · 1 line
1.4.4.1
PATCH 47/65 ACPICA: Add new subsystem state bit that is set after SubsystemInitialize is called
From: Robert Moore <[email protected]>
--- drivers/acpi/utilities/utxface.c | 1 + include/acpi/actypes.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletions(-)
drivers/acpi/utilities/utxface.c +1 -0
@@ -67,6 +67,7 @@ acpi_status acpi_initialize_subsystem(voACPI_FUNCTION_TRACE (acpi_initialize_subsystem); + acpi_gbl_startup_flags =ACPI_SUBSYSTEM_INITIALIZE ;ACPI_DEBUG_EXEC (acpi_ut_init_stack_ptr_trace ());/* Initialize the OS-Dependent layer */
include/acpi/actypes.h +2 -1
@@ -412,7 +412,8 @@ typedef u64 acpi_integer;/* * Initialization state */ -#define ACPI_INITIALIZED_OK 0x01 +#define ACPI_SUBSYSTEM_INITIALIZE 0x01 +#define ACPI_INITIALIZED_OK 0x02/* * Power state values
Signature · 1 line
1.4.4.1
PATCH 48/65 ACPICA: Update version to 20060927
From: Robert Moore <[email protected]>
--- include/acpi/acconfig.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/acpi/acconfig.h +1 -1
@@ -63,7 +63,7 @@/* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20060912 +#define ACPI_CA_VERSION 0x20060927/* * OS name, used for the _OS object. The _OS object is essentially obsolete,
Signature · 1 line
1.4.4.1
PATCH 49/65 ACPICA: Restructured module into multiple functions.
From: Robert Moore <[email protected]>
Restructured the AML ParseLoop function, breaking it into several subfunctions in order to reduce CPU stack use and improve maintainability
--- drivers/acpi/parser/psloop.c | 1406 +++++++++++++++++++++++------------------- include/acpi/acexcep.h | 8 +- 2 files changed, 789 insertions(+), 625 deletions(-)
drivers/acpi/parser/psloop.c +783 -623
@@ -42,12 +42,11 @@*/ /* -* Parse the AML and build an operation tree as most interpreters, -* like Perl, do. Parsing is done by hand rather than with a YACC -* generated parser to tightly constrain stack and dynamic memory -* usage. At the same time, parsing is kept flexible and the code -* fairly compact by parsing based on a list of AML opcode -* templates in aml_op_info[] +* Parse the AML and build an operation tree as most interpreters, (such as +* Perl) do. Parsing is done by hand rather than with a YACC generated parser +* to tightly constrain stack and dynamic memory usage. Parsing is kept +* flexible and the code fairly compact by parsing based on a list of AML +* opcode templates in aml_op_info[]. */ #include <acpi/acpi.h>
@@ -60,766 +59,679 @@ ACPI_MODULE_NAME("psloop")static u32 acpi_gbl_depth =0 ; +/* Local prototypes */ + +static acpi_status acpi_ps_get_aml_opcode (struct acpi_walk_state *walk_state); + +static acpi_status +acpi_ps_build_named_op (struct acpi_walk_state *walk_state, +u8 * aml_op_start, +union acpi_parse_object *unnamed_op, +union acpi_parse_object **op); + +static acpi_status +acpi_ps_create_op (struct acpi_walk_state *walk_state, +u8 * aml_op_start,union acpi_parse_object **new_op); + +static acpi_status +acpi_ps_get_arguments (struct acpi_walk_state *walk_state, +u8 * aml_op_start,union acpi_parse_object *op); + +static acpi_status +acpi_ps_complete_op (struct acpi_walk_state *walk_state, +union acpi_parse_object **op,acpi_status status); + +static acpi_status +acpi_ps_complete_final_op (struct acpi_walk_state *walk_state, +union acpi_parse_object *op,acpi_status status); +/******************************************************************************* * -* FUNCTION: acpi_ps_parse_loop +* FUNCTION: acpi_ps_get_aml_opcode * * PARAMETERS: walk_state - Current state * * RETURN: Status * -* DESCRIPTION: Parse AML (pointed to by the current parser state) and return -* a tree of ops. +* DESCRIPTION: Extract the next AML opcode from the input stream. * ******************************************************************************/ -acpi_status acpi_ps_parse_loop (struct acpi_walk_state *walk_state) +static acpi_status acpi_ps_get_aml_opcode (struct acpi_walk_state *walk_state) { -acpi_status status =AE_OK ; -acpi_status status2; -union acpi_parse_object *op =NULL ;/* current op */ -union acpi_parse_object *arg =NULL ; -union acpi_parse_object *pre_op =NULL ; -struct acpi_parse_state *parser_state; -u8 *aml_op_start =NULL ; -ACPI_FUNCTION_TRACE_PTR (ps_parse_loop, walk_state); +ACPI_FUNCTION_TRACE_PTR (ps_get_aml_opcode, walk_state); -if (walk_state->descending_callback ==NULL ) { -return_ACPI_STATUS (AE_BAD_PARAMETER ); - } + walk_state->aml_offset = + (u32 )ACPI_PTR_DIFF (walk_state->parser_state.aml, + walk_state->parser_state.aml_start); + walk_state->opcode =acpi_ps_peek_opcode (&(walk_state->parser_state)); - parser_state = &walk_state->parser_state; - walk_state->arg_types =0 ; +/* +* First cut to determine what we have found: +* 1) A valid AML opcode +* 2) A name string +* 3) An unknown/invalid opcode +*/ + walk_state->op_info =acpi_ps_get_opcode_info (walk_state->opcode); -#if (!defined (ACPI_NO_METHOD_EXECUTION ) && !defined (ACPI_CONSTANT_EVAL_ONLY )) +switch (walk_state->op_info->class) { +case AML_CLASS_ASCII : +case AML_CLASS_PREFIX : +/* +* Starts with a valid prefix or ASCII char, this is a name +* string. Convert the bare name string to a namepath. +*/ + walk_state->opcode =AML_INT_NAMEPATH_OP ; + walk_state->arg_types =ARGP_NAMESTRING ; +break ; -if (walk_state->walk_type &ACPI_WALK_METHOD_RESTART ) { +case AML_CLASS_UNKNOWN : -/* We are restarting a preempted control method */ +/* The opcode is unrecognized. Just skip unknown opcodes */ -if (acpi_ps_has_completed_scope (parser_state)) { -/* -* We must check if a predicate to an IF or WHILE statement -* was just completed -*/ -if ((parser_state->scope->parse_scope.op) && - ((parser_state->scope->parse_scope.op->common. - aml_opcode ==AML_IF_OP ) - || (parser_state->scope->parse_scope.op->common. - aml_opcode ==AML_WHILE_OP )) - && (walk_state->control_state) - && (walk_state->control_state->common.state == -ACPI_CONTROL_PREDICATE_EXECUTING )) { -/* -* A predicate was just completed, get the value of the -* predicate and branch based on that value -*/ - walk_state->op =NULL ; - status = -acpi_ds_get_predicate_value (walk_state, -ACPI_TO_POINTER - (TRUE)); -if (ACPI_FAILURE (status) - && ((status &AE_CODE_MASK ) != -AE_CODE_CONTROL )) { -if (status ==AE_AML_NO_RETURN_VALUE ) { -ACPI_EXCEPTION ((AE_INFO , status, -"Invoked method did not return a value" )); +ACPI_ERROR ((AE_INFO , +"Found unknown opcode %X at AML address %p offset %X, ignoring" , + walk_state->opcode, walk_state->parser_state.aml, + walk_state->aml_offset)); - } -ACPI_EXCEPTION ((AE_INFO , status, -"GetPredicate Failed" )); -return_ACPI_STATUS (status); - } +ACPI_DUMP_BUFFER (walk_state->parser_state.aml,128 ); - status = -acpi_ps_next_parse_state (walk_state, op, - status); - } +/* Assume one-byte bad opcode */ -acpi_ps_pop_scope (parser_state, &op, - &walk_state->arg_types, - &walk_state->arg_count); -ACPI_DEBUG_PRINT ((ACPI_DB_PARSE , -"Popped scope, Op=%p\n" , op)); - }else if (walk_state->prev_op) { + walk_state->parser_state.aml++; +return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE ); -/* We were in the middle of an op */ +default : - op = walk_state->prev_op; - walk_state->arg_types = walk_state->prev_arg_types; - } +/* Found opcode info, this is a normal opcode */ + + walk_state->parser_state.aml += +acpi_ps_get_opcode_size (walk_state->opcode); + walk_state->arg_types = walk_state->op_info->parse_args; +break ; } -#endif -/* Iterative parsing loop, while there is more AML to process: */ +return_ACPI_STATUS (AE_OK ); +} -while ((parser_state->aml < parser_state->aml_end) || (op)) { - aml_op_start = parser_state->aml; -if (!op) { +/******************************************************************************* +* +* FUNCTION: acpi_ps_build_named_op +* +* PARAMETERS: walk_state - Current state +* aml_op_start - Begin of named Op in AML +* unnamed_op - Early Op (not a named Op) +* Op - Returned Op +* +* RETURN: Status +* +* DESCRIPTION: Parse a named Op +* +******************************************************************************/ -/* Get the next opcode from the AML stream */ +static acpi_status +acpi_ps_build_named_op (struct acpi_walk_state *walk_state, +u8 * aml_op_start, +union acpi_parse_object *unnamed_op, +union acpi_parse_object **op) +{ +acpi_status status =AE_OK ; +union acpi_parse_object *arg =NULL ; - walk_state->aml_offset = - (u32 )ACPI_PTR_DIFF (parser_state->aml, - parser_state->aml_start); - walk_state->opcode =acpi_ps_peek_opcode (parser_state); +ACPI_FUNCTION_TRACE_PTR (ps_build_named_op, walk_state); -/* -* First cut to determine what we have found: -* 1) A valid AML opcode -* 2) A name string -* 3) An unknown/invalid opcode -*/ - walk_state->op_info = -acpi_ps_get_opcode_info (walk_state->opcode); -switch (walk_state->op_info->class) { -case AML_CLASS_ASCII : -case AML_CLASS_PREFIX : -/* -* Starts with a valid prefix or ASCII char, this is a name -* string. Convert the bare name string to a namepath. -*/ - walk_state->opcode =AML_INT_NAMEPATH_OP ; - walk_state->arg_types =ARGP_NAMESTRING ; -break ; + unnamed_op->common.value.arg =NULL ; + unnamed_op->common.aml_opcode = walk_state->opcode; -case AML_CLASS_UNKNOWN : +/* +* Get and append arguments until we find the node that contains +* the name (the type ARGP_NAME). +*/ +while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) && + (GET_CURRENT_ARG_TYPE (walk_state->arg_types) !=ARGP_NAME )) { + status = +acpi_ps_get_next_arg (walk_state, + &(walk_state->parser_state), +GET_CURRENT_ARG_TYPE (walk_state-> + arg_types), &arg); +if (ACPI_FAILURE (status)) { +return_ACPI_STATUS (status); + } -/* The opcode is unrecognized. Just skip unknown opcodes */ +acpi_ps_append_arg (unnamed_op, arg); +INCREMENT_ARG_LIST (walk_state->arg_types); + } -ACPI_ERROR ((AE_INFO , -"Found unknown opcode %X at AML address %p offset %X, ignoring" , - walk_state->opcode, - parser_state->aml, - walk_state->aml_offset)); +/* +* Make sure that we found a NAME and didn't run out of arguments +*/ +if (!GET_CURRENT_ARG_TYPE (walk_state->arg_types)) { +return_ACPI_STATUS (AE_AML_NO_OPERAND ); + } -ACPI_DUMP_BUFFER (parser_state->aml,128 ); +/* We know that this arg is a name, move to next arg */ -/* Assume one-byte bad opcode */ +INCREMENT_ARG_LIST (walk_state->arg_types); - parser_state->aml++; -continue ; +/* +* Find the object. This will either insert the object into +* the namespace or simply look it up +*/ + walk_state->op =NULL ; -default : + status = walk_state->descending_callback (walk_state, op); +if (ACPI_FAILURE (status)) { +ACPI_EXCEPTION ((AE_INFO , status,"During name lookup/catalog" )); +return_ACPI_STATUS (status); + } -/* Found opcode info, this is a normal opcode */ +if (!op) { +return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE ); + } - parser_state->aml += -acpi_ps_get_opcode_size (walk_state->opcode); - walk_state->arg_types = - walk_state->op_info->parse_args; -break ; - } + status =acpi_ps_next_parse_state (walk_state, *op, status); +if (ACPI_FAILURE (status)) { +if (status ==AE_CTRL_PENDING ) { +return_ACPI_STATUS (AE_CTRL_PARSE_PENDING ); + } +return_ACPI_STATUS (status); + } -/* Create Op structure and append to parent's argument list */ +acpi_ps_append_arg (*op, unnamed_op->common.value.arg); + acpi_gbl_depth++; -if (walk_state->op_info->flags &AML_NAMED ) { +if ((*op)->common.aml_opcode ==AML_REGION_OP ) { +/* +* Defer final parsing of an operation_region body, because we don't +* have enough info in the first pass 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) +*/ + (*op)->named.data = aml_op_start; + (*op)->named.length =0 ; + } -/* Allocate a new pre_op if necessary */ +return_ACPI_STATUS (AE_OK ); +} -if (!pre_op) { - pre_op = -acpi_ps_alloc_op (walk_state-> - opcode); -if (!pre_op) { - status =AE_NO_MEMORY ; - goto close_this_op; - } - } +/******************************************************************************* +* +* FUNCTION: acpi_ps_create_op +* +* PARAMETERS: walk_state - Current state +* aml_op_start - Op start in AML +* new_op - Returned Op +* +* RETURN: Status +* +* DESCRIPTION: Get Op from AML +* +******************************************************************************/ - pre_op->common.value.arg =NULL ; - pre_op->common.aml_opcode = walk_state->opcode; +static acpi_status +acpi_ps_create_op (struct acpi_walk_state *walk_state, +u8 * aml_op_start,union acpi_parse_object **new_op) +{ +acpi_status status =AE_OK ; +union acpi_parse_object *op; +union acpi_parse_object *named_op =NULL ; -/* -* Get and append arguments until we find the node that contains -* the name (the type ARGP_NAME). -*/ -while (GET_CURRENT_ARG_TYPE - (walk_state->arg_types) - && - (GET_CURRENT_ARG_TYPE - (walk_state->arg_types) !=ARGP_NAME )) { - status = -acpi_ps_get_next_arg (walk_state, - parser_state, -GET_CURRENT_ARG_TYPE - (walk_state-> - arg_types), - &arg); -if (ACPI_FAILURE (status)) { - goto close_this_op; - } +ACPI_FUNCTION_TRACE_PTR (ps_create_op, walk_state); -acpi_ps_append_arg (pre_op, arg); -INCREMENT_ARG_LIST (walk_state-> - arg_types); - } + status =acpi_ps_get_aml_opcode (walk_state); +if (status ==AE_CTRL_PARSE_CONTINUE ) { +return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE ); + } -/* -* Make sure that we found a NAME and didn't run out of -* arguments -*/ -if (!GET_CURRENT_ARG_TYPE - (walk_state->arg_types)) { - status =AE_AML_NO_OPERAND ; - goto close_this_op; - } +/* Create Op structure and append to parent's argument list */ -/* We know that this arg is a name, move to next arg */ + walk_state->op_info =acpi_ps_get_opcode_info (walk_state->opcode); + op =acpi_ps_alloc_op (walk_state->opcode); +if (!op) { +return_ACPI_STATUS (AE_NO_MEMORY ); + } -INCREMENT_ARG_LIST (walk_state->arg_types); +if (walk_state->op_info->flags &AML_NAMED ) { + status = +acpi_ps_build_named_op (walk_state, aml_op_start, op, + &named_op); +acpi_ps_free_op (op); +if (ACPI_FAILURE (status)) { +return_ACPI_STATUS (status); + } -/* -* Find the object. This will either insert the object into -* the namespace or simply look it up -*/ - walk_state->op =NULL ; + *new_op = named_op; +return_ACPI_STATUS (AE_OK ); + } - status = - walk_state->descending_callback (walk_state, - &op); -if (ACPI_FAILURE (status)) { -ACPI_EXCEPTION ((AE_INFO , status, -"During name lookup/catalog" )); - goto close_this_op; - } +/* Not a named opcode, just allocate Op and append to parent */ -if (!op) { -continue ; - } +if (walk_state->op_info->flags &AML_CREATE ) { +/* +* Backup to beginning of create_xXXfield declaration +* body_length is unknown until we parse the body +*/ + op->named.data = aml_op_start; + op->named.length =0 ; + } - status = -acpi_ps_next_parse_state (walk_state, op, - status); -if (status ==AE_CTRL_PENDING ) { - status =AE_OK ; - goto close_this_op; - } +acpi_ps_append_arg (acpi_ps_get_parent_scope + (&(walk_state->parser_state)), op); -if (ACPI_FAILURE (status)) { - goto close_this_op; - } +if (walk_state->descending_callback !=NULL ) { +/* +* Find the object. This will either insert the object into +* the namespace or simply look it up +*/ + walk_state->op = *new_op = op; -acpi_ps_append_arg (op, - pre_op->common.value.arg); - acpi_gbl_depth++; - -if (op->common.aml_opcode ==AML_REGION_OP ) { -/* -* Defer final parsing of an operation_region body, -* because we don't have enough info in the first pass -* 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) -*/ - op->named.data = aml_op_start; - op->named.length =0 ; - } - }else { -/* Not a named opcode, just allocate Op and append to parent */ + status = walk_state->descending_callback (walk_state, &op); + status =acpi_ps_next_parse_state (walk_state, op, status); +if (status ==AE_CTRL_PENDING ) { + status =AE_CTRL_PARSE_PENDING ; + } + } - walk_state->op_info = -acpi_ps_get_opcode_info (walk_state->opcode); - op =acpi_ps_alloc_op (walk_state->opcode); -if (!op) { - status =AE_NO_MEMORY ; - goto close_this_op; - } +return_ACPI_STATUS (status); +} -if (walk_state->op_info->flags &AML_CREATE ) { -/* -* Backup to beginning of create_xXXfield declaration -* body_length is unknown until we parse the body -*/ - op->named.data = aml_op_start; - op->named.length =0 ; - } +/******************************************************************************* +* +* FUNCTION: acpi_ps_get_arguments +* +* PARAMETERS: walk_state - Current state +* aml_op_start - Op start in AML +* Op - Current Op +* +* RETURN: Status +* +* DESCRIPTION: Get arguments for passed Op. +* +******************************************************************************/ -acpi_ps_append_arg (acpi_ps_get_parent_scope - (parser_state), op); +static acpi_status +acpi_ps_get_arguments (struct acpi_walk_state *walk_state, +u8 * aml_op_start,union acpi_parse_object *op) +{ +acpi_status status =AE_OK ; +union acpi_parse_object *arg =NULL ; -if ((walk_state->descending_callback !=NULL )) { -/* -* Find the object. This will either insert the object into -* the namespace or simply look it up -*/ - walk_state->op = op; +ACPI_FUNCTION_TRACE_PTR (ps_get_arguments, walk_state); - status = - walk_state-> -descending_callback (walk_state, - &op); - status = -acpi_ps_next_parse_state (walk_state, - op, - status); -if (status ==AE_CTRL_PENDING ) { - status =AE_OK ; - goto close_this_op; - } +switch (op->common.aml_opcode) { +case AML_BYTE_OP :/* AML_BYTEDATA_ARG */ +case AML_WORD_OP :/* AML_WORDDATA_ARG */ +case AML_DWORD_OP :/* AML_DWORDATA_ARG */ +case AML_QWORD_OP :/* AML_QWORDATA_ARG */ +case AML_STRING_OP :/* AML_ASCIICHARLIST_ARG */ -if (ACPI_FAILURE (status)) { - goto close_this_op; - } - } - } +/* Fill in constant or string argument directly */ - op->common.aml_offset = walk_state->aml_offset; +acpi_ps_get_next_simple_arg (&(walk_state->parser_state), +GET_CURRENT_ARG_TYPE (walk_state-> + arg_types), + op); +break ; -if (walk_state->op_info) { -ACPI_DEBUG_PRINT ((ACPI_DB_PARSE , -"Opcode %4.4X [%s] Op %p Aml %p AmlOffset %5.5X\n" , - (u32 ) op->common.aml_opcode, - walk_state->op_info->name, op, - parser_state->aml, - op->common.aml_offset)); - } +case AML_INT_NAMEPATH_OP :/* AML_NAMESTRING_ARG */ + + status = +acpi_ps_get_next_namepath (walk_state, + &(walk_state->parser_state), op, +1 ); +if (ACPI_FAILURE (status)) { +return_ACPI_STATUS (status); } + walk_state->arg_types =0 ; +break ; + +default :/* -* Start arg_count at zero because we don't know if there are -* any args yet +* Op is not a constant or string, append each argument to the Op */ - walk_state->arg_count =0 ; - -/* Are there any arguments that must be processed? */ - -if (walk_state->arg_types) { - -/* Get arguments */ - -switch (op->common.aml_opcode) { -case AML_BYTE_OP :/* AML_BYTEDATA_ARG */ -case AML_WORD_OP :/* AML_WORDDATA_ARG */ -case AML_DWORD_OP :/* AML_DWORDATA_ARG */ -case AML_QWORD_OP :/* AML_QWORDATA_ARG */ -case AML_STRING_OP :/* AML_ASCIICHARLIST_ARG */ - -/* Fill in constant or string argument directly */ - -acpi_ps_get_next_simple_arg (parser_state, -GET_CURRENT_ARG_TYPE - (walk_state-> - arg_types), op); -break ; - -case AML_INT_NAMEPATH_OP :/* AML_NAMESTRING_ARG */ - - status = -acpi_ps_get_next_namepath (walk_state, - parser_state, op, -1 ); -if (ACPI_FAILURE (status)) { - goto close_this_op; - } - - walk_state->arg_types =0 ; -break ; +while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) + && !walk_state->arg_count) { + walk_state->aml_offset = + (u32 )ACPI_PTR_DIFF (walk_state->parser_state.aml, + walk_state->parser_state. + aml_start); -default : -/* -* Op is not a constant or string, append each argument -* to the Op -*/ -while (GET_CURRENT_ARG_TYPE - (walk_state->arg_types) - && !walk_state->arg_count) { - walk_state->aml_offset = (u32 ) -ACPI_PTR_DIFF (parser_state->aml, - parser_state-> - aml_start); + status = +acpi_ps_get_next_arg (walk_state, + &(walk_state->parser_state), +GET_CURRENT_ARG_TYPE + (walk_state->arg_types), &arg); +if (ACPI_FAILURE (status)) { +return_ACPI_STATUS (status); + } - status = -acpi_ps_get_next_arg (walk_state, - parser_state, -GET_CURRENT_ARG_TYPE - (walk_state-> - arg_types), - &arg); -if (ACPI_FAILURE (status)) { - goto close_this_op; - } +if (arg) { + arg->common.aml_offset = walk_state->aml_offset; +acpi_ps_append_arg (op, arg); + } -if (arg) { - arg->common.aml_offset = - walk_state->aml_offset; -acpi_ps_append_arg (op, arg); - } -INCREMENT_ARG_LIST (walk_state-> - arg_types); - } +INCREMENT_ARG_LIST (walk_state->arg_types); + } -/* Special processing for certain opcodes */ +/* Special processing for certain opcodes */ -/* TBD (remove): Temporary mechanism to disable this code if needed */ +/* TBD (remove): Temporary mechanism to disable this code if needed */ #ifdef ACPI_ENABLE_MODULE_LEVEL_CODE -if ((walk_state->pass_number <= -ACPI_IMODE_LOAD_PASS1 ) - && - ((walk_state-> - parse_flags &ACPI_PARSE_DISASSEMBLE ) == -0 )) { -/* -* We want to skip If/Else/While constructs during Pass1 -* because we want to actually conditionally execute the -* code during Pass2. -* -* Except for disassembly, where we always want to -* walk the If/Else/While packages -*/ -switch (op->common.aml_opcode) { -case AML_IF_OP : -case AML_ELSE_OP : -case AML_WHILE_OP : - -ACPI_DEBUG_PRINT ((ACPI_DB_PARSE , -"Pass1: Skipping an If/Else/While body\n" )); - -/* Skip body of if/else/while in pass 1 */ - - parser_state->aml = - parser_state->pkg_end; - walk_state->arg_count =0 ; -break ; - -default : -break ; - } - } -#endif -switch (op->common.aml_opcode) { -case AML_METHOD_OP : - -/* -* Skip parsing of control method -* because we don't have enough info in the first pass -* to parse it correctly. -* -* Save the length and address of the body -*/ - op->named.data = parser_state->aml; - op->named.length = - (u32) (parser_state->pkg_end - - parser_state->aml); - -/* Skip body of method */ - - parser_state->aml = - parser_state->pkg_end; - walk_state->arg_count =0 ; -break ; - -case AML_BUFFER_OP : -case AML_PACKAGE_OP : -case AML_VAR_PACKAGE_OP : - -if ((op->common.parent) && - (op->common.parent->common. - aml_opcode ==AML_NAME_OP ) - && (walk_state->pass_number <= -ACPI_IMODE_LOAD_PASS2 )) { -/* -* Skip parsing of Buffers and Packages -* because we don't have enough info in the first pass -* to parse them correctly. -*/ - op->named.data = aml_op_start; - op->named.length = - (u32) (parser_state-> - pkg_end - - aml_op_start); - -/* Skip body */ - - parser_state->aml = - parser_state->pkg_end; - walk_state->arg_count =0 ; - } -break ; +if ((walk_state->pass_number <=ACPI_IMODE_LOAD_PASS1 ) && + ((walk_state->parse_flags &ACPI_PARSE_DISASSEMBLE ) ==0 )) { +/* +* We want to skip If/Else/While constructs during Pass1 because we +* want to actually conditionally execute the code during Pass2. +* +* Except for disassembly, where we always want to walk the +* If/Else/While packages +*/ +switch (op->common.aml_opcode) { +case AML_IF_OP : +case AML_ELSE_OP : +case AML_WHILE_OP : -case AML_WHILE_OP : +ACPI_DEBUG_PRINT ((ACPI_DB_PARSE , +"Pass1: Skipping an If/Else/While body\n" )); -if (walk_state->control_state) { - walk_state->control_state-> - control.package_end = - parser_state->pkg_end; - } -break ; +/* Skip body of if/else/while in pass 1 */ -default : + walk_state->parser_state.aml = + walk_state->parser_state.pkg_end; + walk_state->arg_count =0 ; +break ; -/* No action for all other opcodes */ -break ; - } +default :break ; } } +#endif -/* Check for arguments that need to be processed */ - -if (walk_state->arg_count) { +switch (op->common.aml_opcode) { +case AML_METHOD_OP :/* -* There are arguments (complex ones), push Op and -* prepare for argument +* Skip parsing of control method because we don't have enough +* info in the first pass to parse it correctly. +* +* Save the length and address of the body */ - status =acpi_ps_push_scope (parser_state, op, - walk_state->arg_types, - walk_state->arg_count); -if (ACPI_FAILURE (status)) { - goto close_this_op; - } - op =NULL ; -continue ; - } + op->named.data = walk_state->parser_state.aml; + op->named.length = (u32) + (walk_state->parser_state.pkg_end - + walk_state->parser_state.aml); -/* -* All arguments have been processed -- Op is complete, -* prepare for next -*/ - walk_state->op_info = -acpi_ps_get_opcode_info (op->common.aml_opcode); -if (walk_state->op_info->flags &AML_NAMED ) { -if (acpi_gbl_depth) { - acpi_gbl_depth--; - } +/* Skip body of method */ -if (op->common.aml_opcode ==AML_REGION_OP ) { + walk_state->parser_state.aml = + walk_state->parser_state.pkg_end; + walk_state->arg_count =0 ; +break ; + +case AML_BUFFER_OP : +case AML_PACKAGE_OP : +case AML_VAR_PACKAGE_OP : + +if ((op->common.parent) && + (op->common.parent->common.aml_opcode == +AML_NAME_OP ) + && (walk_state->pass_number <= +ACPI_IMODE_LOAD_PASS2 )) {/* -* 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. +* Skip parsing of Buffers and Packages because we don't have +* enough info in the first pass to parse them correctly. */ - op->named.length = - (u32) (parser_state->aml - op->named.data); - } - } + op->named.data = aml_op_start; + op->named.length = (u32) + (walk_state->parser_state.pkg_end - + aml_op_start); -if (walk_state->op_info->flags &AML_CREATE ) { -/* -* Backup to beginning of create_xXXfield declaration (1 for -* Opcode) -* -* body_length is unknown until we parse the body -*/ - op->named.length = - (u32) (parser_state->aml - op->named.data); - } +/* Skip body */ -/* This op complete, notify the dispatcher */ + walk_state->parser_state.aml = + walk_state->parser_state.pkg_end; + walk_state->arg_count =0 ; + } +break ; -if (walk_state->ascending_callback !=NULL ) { - walk_state->op = op; - walk_state->opcode = op->common.aml_opcode; +case AML_WHILE_OP : - status = walk_state->ascending_callback (walk_state); - status = -acpi_ps_next_parse_state (walk_state, op, status); -if (status ==AE_CTRL_PENDING ) { - status =AE_OK ; - goto close_this_op; +if (walk_state->control_state) { + walk_state->control_state->control.package_end = + walk_state->parser_state.pkg_end; } - } - - close_this_op: -/* -* Finished one argument of the containing scope -*/ - parser_state->scope->parse_scope.arg_count--; +break ; -/* Finished with pre_op */ +default : -if (pre_op) { -acpi_ps_free_op (pre_op); - pre_op =NULL ; +/* No action for all other opcodes */ +break ; } -/* Close this Op (will result in parse subtree deletion) */ +break ; + } - status2 =acpi_ps_complete_this_op (walk_state, op); -if (ACPI_FAILURE (status2)) { -return_ACPI_STATUS (status2); - } - op =NULL ; +return_ACPI_STATUS (AE_OK ); +} -switch (status) { -case AE_OK : -break ; +/******************************************************************************* +* +* FUNCTION: acpi_ps_complete_op +* +* PARAMETERS: walk_state - Current state +* Op - Returned Op +* Status - Parse status before complete Op +* +* RETURN: Status +* +* DESCRIPTION: Complete Op +* +******************************************************************************/ -case AE_CTRL_TRANSFER : +static acpi_status +acpi_ps_complete_op (struct acpi_walk_state *walk_state, +union acpi_parse_object **op,acpi_status status) +{ +acpi_status status2; -/* We are about to transfer to a called method. */ +ACPI_FUNCTION_TRACE_PTR (ps_complete_op, walk_state); - walk_state->prev_op = op; - walk_state->prev_arg_types = walk_state->arg_types; -return_ACPI_STATUS (status); +/* +* Finished one argument of the containing scope +*/ + walk_state->parser_state.scope->parse_scope.arg_count--; -case AE_CTRL_END : +/* Close this Op (will result in parse subtree deletion) */ -acpi_ps_pop_scope (parser_state, &op, - &walk_state->arg_types, - &walk_state->arg_count); + status2 =acpi_ps_complete_this_op (walk_state, *op); +if (ACPI_FAILURE (status2)) { +return_ACPI_STATUS (status2); + } -if (op) { - walk_state->op = op; - walk_state->op_info = -acpi_ps_get_opcode_info (op->common. - aml_opcode); - walk_state->opcode = op->common.aml_opcode; + *op =NULL ; - status = - walk_state->ascending_callback (walk_state); - status = -acpi_ps_next_parse_state (walk_state, op, - status); +switch (status) { +case AE_OK : +break ; - status2 = -acpi_ps_complete_this_op (walk_state, op); -if (ACPI_FAILURE (status2)) { -return_ACPI_STATUS (status2); - } - op =NULL ; - } - status =AE_OK ; -break ; +case AE_CTRL_TRANSFER : -case AE_CTRL_BREAK : -case AE_CTRL_CONTINUE : +/* We are about to transfer to a called method */ -/* Pop off scopes until we find the While */ + walk_state->prev_op =NULL ; + walk_state->prev_arg_types = walk_state->arg_types; +return_ACPI_STATUS (status); -while (!op || (op->common.aml_opcode !=AML_WHILE_OP )) { -acpi_ps_pop_scope (parser_state, &op, - &walk_state->arg_types, - &walk_state->arg_count); +case AE_CTRL_END : -if (op->common.aml_opcode !=AML_WHILE_OP ) { - status2 = -acpi_ds_result_stack_pop - (walk_state); -if (ACPI_FAILURE (status2)) { -return_ACPI_STATUS (status2); - } - } - } - -/* Close this iteration of the While loop */ +acpi_ps_pop_scope (&(walk_state->parser_state), op, + &walk_state->arg_types, + &walk_state->arg_count); - walk_state->op = op; +if (*op) { + walk_state->op = *op; walk_state->op_info = -acpi_ps_get_opcode_info (op->common.aml_opcode); - walk_state->opcode = op->common.aml_opcode; +acpi_ps_get_opcode_info ((*op)->common.aml_opcode); + walk_state->opcode = (*op)->common.aml_opcode; status = walk_state->ascending_callback (walk_state); status = -acpi_ps_next_parse_state (walk_state, op, status); +acpi_ps_next_parse_state (walk_state, *op, status); - status2 =acpi_ps_complete_this_op (walk_state, op); + status2 =acpi_ps_complete_this_op (walk_state, *op);if (ACPI_FAILURE (status2)) {return_ACPI_STATUS (status2); } - op =NULL ; - - status =AE_OK ; -break ; + } -case AE_CTRL_TERMINATE : + status =AE_OK ; +break ; - status =AE_OK ; +case AE_CTRL_BREAK : +case AE_CTRL_CONTINUE : -/* Clean up */ -do { -if (op) { - status2 = -acpi_ps_complete_this_op (walk_state, - op); -if (ACPI_FAILURE (status2)) { -return_ACPI_STATUS (status2); - } +/* Pop off scopes until we find the While */ - status2 = -acpi_ds_result_stack_pop - (walk_state); -if (ACPI_FAILURE (status2)) { -return_ACPI_STATUS (status2); - } +while (!(*op) || ((*op)->common.aml_opcode !=AML_WHILE_OP )) { +acpi_ps_pop_scope (&(walk_state->parser_state), op, + &walk_state->arg_types, + &walk_state->arg_count); -acpi_ut_delete_generic_state - (acpi_ut_pop_generic_state - (&walk_state->control_state)); +if ((*op)->common.aml_opcode !=AML_WHILE_OP ) { + status2 =acpi_ds_result_stack_pop (walk_state); +if (ACPI_FAILURE (status2)) { +return_ACPI_STATUS (status2); } + } + } -acpi_ps_pop_scope (parser_state, &op, - &walk_state->arg_types, - &walk_state->arg_count); +/* Close this iteration of the While loop */ - }while (op); + walk_state->op = *op; + walk_state->op_info = +acpi_ps_get_opcode_info ((*op)->common.aml_opcode); + walk_state->opcode = (*op)->common.aml_opcode; -return_ACPI_STATUS (status); + status = walk_state->ascending_callback (walk_state); + status =acpi_ps_next_parse_state (walk_state, *op, status); -default :/* All other non-AE_OK status */ + status2 =acpi_ps_complete_this_op (walk_state, *op); +if (ACPI_FAILURE (status2)) { +return_ACPI_STATUS (status2); + } -do { -if (op) { - status2 = -acpi_ps_complete_this_op (walk_state, - op); -if (ACPI_FAILURE (status2)) { -return_ACPI_STATUS (status2); - } + status =AE_OK ; +break ; + +case AE_CTRL_TERMINATE : + +/* Clean up */ +do { +if (*op) { + status2 = +acpi_ps_complete_this_op (walk_state, *op); +if (ACPI_FAILURE (status2)) { +return_ACPI_STATUS (status2); + } + status2 =acpi_ds_result_stack_pop (walk_state); +if (ACPI_FAILURE (status2)) { +return_ACPI_STATUS (status2); } -acpi_ps_pop_scope (parser_state, &op, - &walk_state->arg_types, - &walk_state->arg_count); +acpi_ut_delete_generic_state + (acpi_ut_pop_generic_state + (&walk_state->control_state)); + } - }while (op); +acpi_ps_pop_scope (&(walk_state->parser_state), op, + &walk_state->arg_types, + &walk_state->arg_count); -/* -* TBD: Cleanup parse ops on error -*/ -#if 0 -if (op ==NULL ) { -acpi_ps_pop_scope (parser_state, &op, - &walk_state->arg_types, - &walk_state->arg_count); + }while (*op); + +return_ACPI_STATUS (AE_OK ); + +default :/* All other non-AE_OK status */ + +do { +if (*op) { + status2 = +acpi_ps_complete_this_op (walk_state, *op); +if (ACPI_FAILURE (status2)) { +return_ACPI_STATUS (status2); + } } -#endif - walk_state->prev_op = op; - walk_state->prev_arg_types = walk_state->arg_types; -return_ACPI_STATUS (status); - } -/* This scope complete? */ +acpi_ps_pop_scope (&(walk_state->parser_state), op, + &walk_state->arg_types, + &walk_state->arg_count); -if (acpi_ps_has_completed_scope (parser_state)) { -acpi_ps_pop_scope (parser_state, &op, + }while (*op); + +#if 0 +/* +* TBD: Cleanup parse ops on error +*/ +if (*op ==NULL ) { +acpi_ps_pop_scope (parser_state, op, &walk_state->arg_types, &walk_state->arg_count); -ACPI_DEBUG_PRINT ((ACPI_DB_PARSE , -"Popped scope, Op=%p\n" , op)); - }else { - op =NULL ; } +#endif + walk_state->prev_op =NULL ; + walk_state->prev_arg_types = walk_state->arg_types; +return_ACPI_STATUS (status); + } - }/* while parser_state->Aml */ +/* This scope complete? */ + +if (acpi_ps_has_completed_scope (&(walk_state->parser_state))) { +acpi_ps_pop_scope (&(walk_state->parser_state), op, + &walk_state->arg_types, + &walk_state->arg_count); +ACPI_DEBUG_PRINT ((ACPI_DB_PARSE ,"Popped scope, Op=%p\n" , *op)); + }else { + *op =NULL ; + } + +return_ACPI_STATUS (AE_OK ); +} + +/******************************************************************************* +* +* FUNCTION: acpi_ps_complete_final_op +* +* PARAMETERS: walk_state - Current state +* Op - Current Op +* Status - Current parse status before complete last +* Op +* +* RETURN: Status +* +* DESCRIPTION: Complete last Op. +* +******************************************************************************/ + +static acpi_status +acpi_ps_complete_final_op (struct acpi_walk_state *walk_state, +union acpi_parse_object *op,acpi_status status) +{ +acpi_status status2; + +ACPI_FUNCTION_TRACE_PTR (ps_complete_final_op, walk_state);/* * Complete the last Op (if not completed), and clear the scope stack. * It is easily possible to end an AML "package" with an unbounded number * of open scopes (such as when several ASL blocks are closed with -* sequential closing braces). We want to terminate each one cleanly. +* sequential closing braces). We want to terminate each one cleanly. */ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE ,"AML package complete at Op %p\n" , op));
@@ -838,8 +750,12 @@ acpi_status acpi_ps_parse_loop(struct acacpi_ps_next_parse_state (walk_state, op, status);if (status ==AE_CTRL_PENDING ) { - status =AE_OK ; - goto close_this_op; + status = +acpi_ps_complete_op (walk_state, &op, +AE_OK ); +if (ACPI_FAILURE (status)) { +return_ACPI_STATUS (status); + } }if (status ==AE_CTRL_TERMINATE ) {
@@ -858,7 +774,9 @@ acpi_status acpi_ps_parse_loop(struct ac } } - acpi_ps_pop_scope(parser_state, + acpi_ps_pop_scope(& + (walk_state-> + parser_state), &op, &walk_state-> arg_types,
@@ -887,10 +805,252 @@ acpi_status acpi_ps_parse_loop(struct ac } } -acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types, +acpi_ps_pop_scope (&(walk_state->parser_state), &op, + &walk_state->arg_types, &walk_state->arg_count); }while (op);return_ACPI_STATUS (status); } + +/******************************************************************************* +* +* FUNCTION: acpi_ps_parse_loop +* +* PARAMETERS: walk_state - Current state +* +* RETURN: Status +* +* DESCRIPTION: Parse AML (pointed to by the current parser state) and return +* a tree of ops. +* +******************************************************************************/ + +acpi_status acpi_ps_parse_loop (struct acpi_walk_state *walk_state) +{ +acpi_status status =AE_OK ; +union acpi_parse_object *op =NULL ;/* current op */ +struct acpi_parse_state *parser_state; +u8 *aml_op_start =NULL ; + +ACPI_FUNCTION_TRACE_PTR (ps_parse_loop, walk_state); + +if (walk_state->descending_callback ==NULL ) { +return_ACPI_STATUS (AE_BAD_PARAMETER ); + } + + parser_state = &walk_state->parser_state; + walk_state->arg_types =0 ; + +#if (!defined (ACPI_NO_METHOD_EXECUTION ) && !defined (ACPI_CONSTANT_EVAL_ONLY )) + +if (walk_state->walk_type &ACPI_WALK_METHOD_RESTART ) { + +/* We are restarting a preempted control method */ + +if (acpi_ps_has_completed_scope (parser_state)) { +/* +* We must check if a predicate to an IF or WHILE statement +* was just completed +*/ +if ((parser_state->scope->parse_scope.op) && + ((parser_state->scope->parse_scope.op->common. + aml_opcode ==AML_IF_OP ) + || (parser_state->scope->parse_scope.op->common. + aml_opcode ==AML_WHILE_OP )) + && (walk_state->control_state) + && (walk_state->control_state->common.state == +ACPI_CONTROL_PREDICATE_EXECUTING )) { +/* +* A predicate was just completed, get the value of the +* predicate and branch based on that value +*/ + walk_state->op =NULL ; + status = +acpi_ds_get_predicate_value (walk_state, +ACPI_TO_POINTER + (TRUE)); +if (ACPI_FAILURE (status) + && ((status &AE_CODE_MASK ) != +AE_CODE_CONTROL )) { +if (status ==AE_AML_NO_RETURN_VALUE ) { +ACPI_EXCEPTION ((AE_INFO , status, +"Invoked method did not return a value" )); + + } + +ACPI_EXCEPTION ((AE_INFO , status, +"GetPredicate Failed" )); +return_ACPI_STATUS (status); + } + + status = +acpi_ps_next_parse_state (walk_state, op, + status); + } + +acpi_ps_pop_scope (parser_state, &op, + &walk_state->arg_types, + &walk_state->arg_count); +ACPI_DEBUG_PRINT ((ACPI_DB_PARSE , +"Popped scope, Op=%p\n" , op)); + }else if (walk_state->prev_op) { + +/* We were in the middle of an op */ + + op = walk_state->prev_op; + walk_state->arg_types = walk_state->prev_arg_types; + } + } +#endif + +/* Iterative parsing loop, while there is more AML to process: */ + +while ((parser_state->aml < parser_state->aml_end) || (op)) { + aml_op_start = parser_state->aml; +if (!op) { + status = +acpi_ps_create_op (walk_state, aml_op_start, &op); +if (ACPI_FAILURE (status)) { +if (status ==AE_CTRL_PARSE_CONTINUE ) { +continue ; + } + +if (status ==AE_CTRL_PARSE_PENDING ) { + status =AE_OK ; + } + + status = +acpi_ps_complete_op (walk_state, &op, + status); +if (ACPI_FAILURE (status)) { +return_ACPI_STATUS (status); + } + +continue ; + } + + op->common.aml_offset = walk_state->aml_offset; + +if (walk_state->op_info) { +ACPI_DEBUG_PRINT ((ACPI_DB_PARSE , +"Opcode %4.4X [%s] Op %p Aml %p AmlOffset %5.5X\n" , + (u32 ) op->common.aml_opcode, + walk_state->op_info->name, op, + parser_state->aml, + op->common.aml_offset)); + } + } + +/* +* Start arg_count at zero because we don't know if there are +* any args yet +*/ + walk_state->arg_count =0 ; + +/* Are there any arguments that must be processed? */ + +if (walk_state->arg_types) { + +/* Get arguments */ + + status = +acpi_ps_get_arguments (walk_state, aml_op_start, op); +if (ACPI_FAILURE (status)) { + status = +acpi_ps_complete_op (walk_state, &op, + status); +if (ACPI_FAILURE (status)) { +return_ACPI_STATUS (status); + } + +continue ; + } + } + +/* Check for arguments that need to be processed */ + +if (walk_state->arg_count) { +/* +* There are arguments (complex ones), push Op and +* prepare for argument +*/ + status =acpi_ps_push_scope (parser_state, op, + walk_state->arg_types, + walk_state->arg_count); +if (ACPI_FAILURE (status)) { + status = +acpi_ps_complete_op (walk_state, &op, + status); +if (ACPI_FAILURE (status)) { +return_ACPI_STATUS (status); + } + +continue ; + } + + op =NULL ; +continue ; + } + +/* +* All arguments have been processed -- Op is complete, +* prepare for next +*/ + walk_state->op_info = +acpi_ps_get_opcode_info (op->common.aml_opcode); +if (walk_state->op_info->flags &AML_NAMED ) { +if (acpi_gbl_depth) { + acpi_gbl_depth--; + } + +if (op->common.aml_opcode ==AML_REGION_OP ) { +/* +* Skip parsing of control method or opregion body, +* because we don't have enough info in the first pass +* to parse them correctly. +* +* Completed parsing an op_region declaration, we now +* know the length. +*/ + op->named.length = + (u32) (parser_state->aml - op->named.data); + } + } + +if (walk_state->op_info->flags &AML_CREATE ) { +/* +* Backup to beginning of create_xXXfield declaration (1 for +* Opcode) +* +* body_length is unknown until we parse the body +*/ + op->named.length = + (u32) (parser_state->aml - op->named.data); + } + +/* This op complete, notify the dispatcher */ + +if (walk_state->ascending_callback !=NULL ) { + walk_state->op = op; + walk_state->opcode = op->common.aml_opcode; + + status = walk_state->ascending_callback (walk_state); + status = +acpi_ps_next_parse_state (walk_state, op, status); +if (status ==AE_CTRL_PENDING ) { + status =AE_OK ; + } + } + + status =acpi_ps_complete_op (walk_state, &op, status); +if (ACPI_FAILURE (status)) { +return_ACPI_STATUS (status); + } + + }/* while parser_state->Aml */ + + status =acpi_ps_complete_final_op (walk_state, op, status); +return_ACPI_STATUS (status); +}
include/acpi/acexcep.h +6 -2
@@ -178,8 +178,10 @@#define AE_CTRL_BREAK (acpi_status) (0x0009 | AE_CODE_CONTROL)#define AE_CTRL_CONTINUE (acpi_status) (0x000A | AE_CODE_CONTROL)#define AE_CTRL_SKIP (acpi_status) (0x000B | AE_CODE_CONTROL) +#define AE_CTRL_PARSE_CONTINUE (acpi_status) (0x000C | AE_CODE_CONTROL) +#define AE_CTRL_PARSE_PENDING (acpi_status) (0x000D | AE_CODE_CONTROL) -#define AE_CODE_CTRL_MAX 0x000B +#define AE_CODE_CTRL_MAX 0x000D#ifdef DEFINE_ACPI_GLOBALS
@@ -291,7 +293,9 @@ char const *acpi_gbl_exception_names_ctr"AE_CTRL_TRANSFER" ,"AE_CTRL_BREAK" ,"AE_CTRL_CONTINUE" , -"AE_CTRL_SKIP" +"AE_CTRL_SKIP" , +"AE_CTRL_PARSE_CONTINUE" , +"AE_CTRL_PARSE_PENDING" };#endif /* ACPI GLOBALS */
Signature · 1 line
1.4.4.1
PATCH 50/65 ACPICA: Eliminate control method 2-pass parse/execute.
From: Robert Moore <[email protected]>
Completed an AML interpreter performance enhancement for control method execution. Previously a 2-pass parse/execution, control methods are now completely parsed and executed in single pass. This improves overall interpreter performance by ~25%, reduces code size, and reduces CPU stack use.
--- drivers/acpi/dispatcher/dsmethod.c | 50 +-------------- drivers/acpi/parser/psloop.c | 2 +- drivers/acpi/parser/psxface.c | 114 ++++++++++++------------------------ 3 files changed, 42 insertions(+), 124 deletions(-)
drivers/acpi/dispatcher/dsmethod.c +4 -46
@@ -327,7 +327,7 @@ acpi_ds_call_control_method(struct acpi_ACPI_FUNCTION_TRACE_PTR (ds_call_control_method, this_walk_state);ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH , -"Execute method %p, currentstate=%p\n" , +"Calling method %p, currentstate=%p\n" , this_walk_state->prev_op, this_walk_state));/*
@@ -351,49 +351,7 @@ acpi_ds_call_control_method(struct acpi_return_ACPI_STATUS (status); } -/* -* 1) Parse the method. All "normal" methods are parsed for each execution. -* Internal methods (_OSI, etc.) do not require parsing. -*/ -if (!(obj_desc->method.method_flags &AML_METHOD_INTERNAL_ONLY )) { - -/* Create a new walk state for the parse */ - - next_walk_state = -acpi_ds_create_walk_state (obj_desc->method.owner_id, op, - obj_desc,NULL ); -if (!next_walk_state) { - status =AE_NO_MEMORY ; - goto cleanup; - } - -/* Create and init a parse tree root */ - - op =acpi_ps_create_scope_op (); -if (!op) { - status =AE_NO_MEMORY ; - goto cleanup; - } - - status =acpi_ds_init_aml_walk (next_walk_state, op, method_node, - obj_desc->method.aml_start, - obj_desc->method.aml_length, -NULL ,1 ); -if (ACPI_FAILURE (status)) { -acpi_ps_delete_parse_tree (op); - goto cleanup; - } - -/* Begin AML parse (deletes next_walk_state) */ - - status =acpi_ps_parse_aml (next_walk_state); -acpi_ps_delete_parse_tree (op); -if (ACPI_FAILURE (status)) { - goto cleanup; - } - } - -/* 2) Begin method execution. Create a new walk state */ +/* Begin method parse/execution. Create a new walk state */ next_walk_state =acpi_ds_create_walk_state (obj_desc->method.owner_id,NULL , obj_desc, thread);
@@ -445,8 +403,8 @@ acpi_ds_call_control_method(struct acpi_ this_walk_state->num_operands =0 ;ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH , -"Starting nested execution, newstate=%p\n" , - next_walk_state)); +"**** Begin nested execution of [%4.4s] **** WalkState=%p\n" , + method_node->name.ascii, next_walk_state));/* Invoke an internal method if necessary */
drivers/acpi/parser/psloop.c +1 -1
@@ -226,7 +226,7 @@ acpi_ps_build_named_op(struct acpi_walk_return_ACPI_STATUS (status); } -if (!op) { +if (!*op) {return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE ); }
drivers/acpi/parser/psxface.c +37 -77
151 lines not on this page · raw message
Signature · 1 line
1.4.4.1
PATCH 51/65 ACPICA: Fix race condition with AcpiWalkNamespace.
From: Robert Moore <[email protected]>
Fixed a problem with a possible race condition between threads executing AcpiWalkNamespace and the AML interpreter. This condition was removed by modifying AcpiWalkNamespace to (by default) ignore all temporary namespace entries created during any concurrent control method execution
--- drivers/acpi/dispatcher/dswload.c | 4 ++-- drivers/acpi/namespace/nsdump.c | 9 ++++++++- drivers/acpi/namespace/nssearch.c | 4 ++++ drivers/acpi/namespace/nswalk.c | 13 ++++++++----- include/acpi/aclocal.h | 2 +- include/acpi/acnamesp.h | 10 +++++++--- 6 files changed, 30 insertions(+), 12 deletions(-)
drivers/acpi/dispatcher/dswload.c +2 -2
@@ -756,9 +756,9 @@ acpi_ds_load2_begin_op(struct acpi_walk_ flags =ACPI_NS_NO_UPSEARCH ;if (walk_state->pass_number ==3 ) { -/* Execution mode, node cannot already exist */ +/* Execution mode, node cannot already exist, node is temporary */ - flags |=ACPI_NS_ERROR_IF_FOUND ; + flags |= (ACPI_NS_ERROR_IF_FOUND |ACPI_NS_TEMPORARY ); }/* Add new entry or lookup existing entry */
drivers/acpi/namespace/nsdump.c +8 -1
@@ -226,6 +226,12 @@ acpi_ns_dump_one_object(acpi_handle obj_ obj_desc =acpi_ns_get_attached_object (this_node); acpi_dbg_level = dbg_level; +/* Temp nodes are those nodes created by a control method */ + +if (this_node->flags &ANOBJ_TEMPORARY ) { +acpi_os_printf ("(T) " ); + } +switch (info->display_type &ACPI_DISPLAY_MASK ) {case ACPI_DISPLAY_SUMMARY :
@@ -623,7 +629,8 @@ acpi_ns_dump_objects(acpi_object_type ty info.display_type = display_type; (void )acpi_ns_walk_namespace (type, start_handle, max_depth, -ACPI_NS_WALK_NO_UNLOCK , +ACPI_NS_WALK_NO_UNLOCK | +ACPI_NS_WALK_TEMP_NODES , acpi_ns_dump_one_object, (void *)&info,NULL ); }
drivers/acpi/namespace/nssearch.c +4 -0
@@ -402,6 +402,10 @@ acpi_ns_search_and_enter(u32 target_name }#endif +if (flags &ACPI_NS_TEMPORARY ) { + new_node->flags |=ANOBJ_TEMPORARY ; + } +/* Install the new object into the parent's list of children */ acpi_ns_install_node (walk_state, node, new_node, type);
drivers/acpi/namespace/nswalk.c +8 -5
@@ -126,7 +126,7 @@ struct acpi_namespace_node *acpi_ns_get_* 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 +* Flags - Whether to unlock the NS before invoking * the callback routine * user_function - Called when an object of "Type" is found * Context - Passed to user function
@@ -153,7 +153,7 @@ acpi_status acpi_ns_walk_namespace(acpi_object_type type, acpi_handle start_node, u32 max_depth, - u8 unlock_before_callback, + u32 flags, acpi_walk_callback user_function, void *context, void **return_value) {
@@ -201,12 +201,15 @@ acpi_ns_walk_namespace(acpi_object_type child_type = child_node->type; } -if (child_type == type) { +if ((child_type == type) && + (!(child_node->flags &ANOBJ_TEMPORARY ) || + (child_node->flags &ANOBJ_TEMPORARY ) + && (flags &ACPI_NS_WALK_TEMP_NODES ))) {/* * Found a matching node, invoke the user * callback function */ -if (unlock_before_callback) { +if (flags &ACPI_NS_WALK_UNLOCK ) { mutex_status =acpi_ut_release_mutex (ACPI_MTX_NAMESPACE );
@@ -219,7 +222,7 @@ acpi_ns_walk_namespace(acpi_object_type status =user_function (child_node, level, context, return_value); -if (unlock_before_callback) { +if (flags &ACPI_NS_WALK_UNLOCK ) { mutex_status =acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE );
include/acpi/aclocal.h +1 -1
@@ -204,7 +204,7 @@ struct acpi_namespace_node {/* Namespace Node flags */ #define ANOBJ_END_OF_PEER_LIST 0x01/* End-of-list, Peer field points to parent */ -#define ANOBJ_RESERVED 0x02/* Available for future use */ +#define ANOBJ_TEMPORARY 0x02/* Node is create by a method and is temporary */ #define ANOBJ_METHOD_ARG 0x04/* Node is a method argument */ #define ANOBJ_METHOD_LOCAL 0x08/* Node is a method local */ #define ANOBJ_SUBTREE_HAS_INI 0x10/* Used to optimize device initialization */
include/acpi/acnamesp.h +7 -3
@@ -65,9 +65,13 @@#define ACPI_NS_ERROR_IF_FOUND 0x08#define ACPI_NS_PREFIX_IS_SCOPE 0x10#define ACPI_NS_EXTERNAL 0x20 +#define ACPI_NS_TEMPORARY 0x40 -#define ACPI_NS_WALK_UNLOCK TRUE -#define ACPI_NS_WALK_NO_UNLOCK FALSE +/* Flags for acpi_ns_walk_namespace */ + +#define ACPI_NS_WALK_NO_UNLOCK 0 +#define ACPI_NS_WALK_UNLOCK 0x01 +#define ACPI_NS_WALK_TEMP_NODES 0x02/* * nsinit - Namespace initialization
@@ -92,7 +96,7 @@ acpi_status acpi_ns_walk_namespace(acpi_object_type type, acpi_handle start_object, u32 max_depth, - u8 unlock_before_callback, + u32 flags, acpi_walk_callback user_function, void *context, void **return_value);
Signature · 1 line
1.4.4.1
PATCH 52/65 ACPICA: _CID support for PCI Root Bridge detection.
From: Robert Moore <[email protected]>
Implemented _CID support for PCI Root Bridge detection. If the _HID does not match the predefined root bridge IDs, the _CID list (if present)
is now obtained and also checked for an ID match
--- drivers/acpi/events/evrgnini.c | 163 ++++++++++++++++++++++++++++++--------- 1 files changed, 125 insertions(+), 38 deletions(-)
drivers/acpi/events/evrgnini.c +125 -38
@@ -48,6 +48,11 @@#define _COMPONENT ACPI_EVENTSACPI_MODULE_NAME ("evrgnini" ) +/* Local prototypes */ +static u8 acpi_ev_match_pci_root_bridge (char *id); + +static u8 acpi_ev_is_pci_root_bridge (struct acpi_namespace_node *node); +/******************************************************************************* * * FUNCTION: acpi_ev_system_memory_region_setup
@@ -62,6 +67,7 @@ ACPI_MODULE_NAME("evrgnini")* DESCRIPTION: Setup a system_memory operation region * ******************************************************************************/ + acpi_status acpi_ev_system_memory_region_setup(acpi_handle handle, u32 function,
@@ -168,9 +174,9 @@ acpi_ev_pci_config_region_setup(acpi_hanunion acpi_operand_object *handler_obj;struct acpi_namespace_node *parent_node;struct acpi_namespace_node *pci_root_node; +struct acpi_namespace_node *pci_device_node;union acpi_operand_object *region_obj = (union acpi_operand_object *)handle; -struct acpi_device_id object_hID;ACPI_FUNCTION_TRACE (ev_pci_config_region_setup);
@@ -215,45 +221,30 @@ acpi_ev_pci_config_region_setup(acpi_han pci_root_node = parent_node;while (pci_root_node != acpi_gbl_root_node) { - status = -acpi_ut_execute_HID (pci_root_node, &object_hID); -if (ACPI_SUCCESS (status)) { -/* -* Got a valid _HID string, check if this is a PCI root. -* New for ACPI 3.0: check for a PCI Express root also. -*/ -if (! - (ACPI_STRNCMP - (object_hID.value,PCI_ROOT_HID_STRING , -sizeof (PCI_ROOT_HID_STRING ))) - || - !(ACPI_STRNCMP - (object_hID.value, -PCI_EXPRESS_ROOT_HID_STRING , -sizeof (PCI_EXPRESS_ROOT_HID_STRING )))) { - -/* Install a handler for this PCI root bridge */ - status = -acpi_install_address_space_handler ((acpi_handle ) pci_root_node,ACPI_ADR_SPACE_PCI_CONFIG ,ACPI_DEFAULT_HANDLER ,NULL ,NULL ); -if (ACPI_FAILURE (status)) { -if (status ==AE_SAME_HANDLER ) { -/* -* It is OK if the handler is already installed on the root -* bridge. Still need to return a context object for the -* new PCI_Config operation region, however. -*/ - status =AE_OK ; - }else { -ACPI_EXCEPTION ((AE_INFO , - status, -"Could not install PciConfig handler for Root Bridge %4.4s" , -acpi_ut_get_node_name - (pci_root_node))); - } +/* Get the _HID/_CID in order to detect a root_bridge */ + +if (acpi_ev_is_pci_root_bridge (pci_root_node)) { + +/* Install a handler for this PCI root bridge */ + + status =acpi_install_address_space_handler ((acpi_handle ) pci_root_node,ACPI_ADR_SPACE_PCI_CONFIG ,ACPI_DEFAULT_HANDLER ,NULL ,NULL ); +if (ACPI_FAILURE (status)) { +if (status ==AE_SAME_HANDLER ) { +/* +* It is OK if the handler is already installed on the root +* bridge. Still need to return a context object for the +* new PCI_Config operation region, however. +*/ + status =AE_OK ; + }else { +ACPI_EXCEPTION ((AE_INFO , status, +"Could not install PciConfig handler for Root Bridge %4.4s" , +acpi_ut_get_node_name + (pci_root_node))); } -break ; } +break ; } pci_root_node =acpi_ns_get_parent_node (pci_root_node);
@@ -282,14 +273,25 @@ acpi_ev_pci_config_region_setup(acpi_han/* * For PCI_Config space access, we need the segment, bus, * device and function numbers. Acquire them here. +* +* Find the parent device object. (This allows the operation region to be +* within a subscope under the device, such as a control method.) */ + pci_device_node = region_obj->region.node; +while (pci_device_node && (pci_device_node->type !=ACPI_TYPE_DEVICE )) { + pci_device_node =acpi_ns_get_parent_node (pci_device_node); + } + +if (!pci_device_node) { +return_ACPI_STATUS (AE_AML_OPERAND_TYPE ); + }/* * Get the PCI device and function numbers from the _ADR object * contained in the parent's scope. */ status = -acpi_ut_evaluate_numeric_object (METHOD_NAME__ADR , parent_node, +acpi_ut_evaluate_numeric_object (METHOD_NAME__ADR , pci_device_node, &pci_value);/*
@@ -329,6 +331,91 @@ acpi_ev_pci_config_region_setup(acpi_han/******************************************************************************* * +* FUNCTION: acpi_ev_match_pci_root_bridge +* +* PARAMETERS: Id - The HID/CID in string format +* +* RETURN: TRUE if the Id is a match for a PCI/PCI-Express Root Bridge +* +* DESCRIPTION: Determine if the input ID is a PCI Root Bridge ID. +* +******************************************************************************/ + +static u8 acpi_ev_match_pci_root_bridge (char *id) +{ + +/* +* Check if this is a PCI root. +* ACPI 3.0+: check for a PCI Express root also. +*/ +if (!(ACPI_STRNCMP (id, +PCI_ROOT_HID_STRING , +sizeof (PCI_ROOT_HID_STRING ))) || + !(ACPI_STRNCMP (id, +PCI_EXPRESS_ROOT_HID_STRING , +sizeof (PCI_EXPRESS_ROOT_HID_STRING )))) { +return (TRUE); + } + +return (FALSE); +} + +/******************************************************************************* +* +* FUNCTION: acpi_ev_is_pci_root_bridge +* +* PARAMETERS: Node - Device node being examined +* +* RETURN: TRUE if device is a PCI/PCI-Express Root Bridge +* +* DESCRIPTION: Determine if the input device represents a PCI Root Bridge by +* examining the _HID and _CID for the device. +* +******************************************************************************/ + +static u8 acpi_ev_is_pci_root_bridge (struct acpi_namespace_node *node) +{ +acpi_status status; +struct acpi_device_id hid; +struct acpi_compatible_id_list *cid; +acpi_native_uint i; + +/* +* Get the _HID and check for a PCI Root Bridge +*/ + status =acpi_ut_execute_HID (node, &hid); +if (ACPI_FAILURE (status)) { +return (FALSE); + } + +if (acpi_ev_match_pci_root_bridge (hid.value)) { +return (TRUE); + } + +/* +* The _HID did not match. +* Get the _CID and check for a PCI Root Bridge +*/ + status =acpi_ut_execute_CID (node, &cid); +if (ACPI_FAILURE (status)) { +return (FALSE); + } + +/* Check all _CIDs in the returned list */ + +for (i =0 ; i < cid->count; i++) { +if (acpi_ev_match_pci_root_bridge (cid->id[i].value)) { +ACPI_FREE (cid); +return (TRUE); + } + } + +ACPI_FREE (cid); +return (FALSE); +} + +/******************************************************************************* +* * FUNCTION: acpi_ev_pci_bar_region_setup * * PARAMETERS: Handle - Region we are interested in
Signature · 1 line
1.4.4.1
PATCH 53/65 ACPICA: Use manifest constants for parse pass number
From: Robert Moore <[email protected]>
--- drivers/acpi/dispatcher/dsmethod.c | 3 ++- drivers/acpi/dispatcher/dsopcode.c | 4 ++-- drivers/acpi/dispatcher/dswload.c | 2 +- drivers/acpi/namespace/nsparse.c | 6 +++--- drivers/acpi/parser/psxface.c | 2 +- include/acpi/aclocal.h | 2 +- 6 files changed, 10 insertions(+), 9 deletions(-)
drivers/acpi/dispatcher/dsmethod.c +2 -1
@@ -382,7 +382,8 @@ acpi_ds_call_control_method(struct acpi_ status =acpi_ds_init_aml_walk (next_walk_state,NULL , method_node, obj_desc->method.aml_start, - obj_desc->method.aml_length, info,3 ); + obj_desc->method.aml_length, info, +ACPI_IMODE_EXECUTE );ACPI_FREE (info);if (ACPI_FAILURE (status)) {
drivers/acpi/dispatcher/dsopcode.c +2 -2
@@ -114,7 +114,7 @@ acpi_ds_execute_arguments(struct acpi_na } status =acpi_ds_init_aml_walk (walk_state, op,NULL , aml_start, - aml_length,NULL ,1 ); + aml_length,NULL ,ACPI_IMODE_LOAD_PASS1 );if (ACPI_FAILURE (status)) {acpi_ds_delete_walk_state (walk_state); goto cleanup;
@@ -157,7 +157,7 @@ acpi_ds_execute_arguments(struct acpi_na/* Execute the opcode and arguments */ status =acpi_ds_init_aml_walk (walk_state, op,NULL , aml_start, - aml_length,NULL ,3 ); + aml_length,NULL ,ACPI_IMODE_EXECUTE );if (ACPI_FAILURE (status)) {acpi_ds_delete_walk_state (walk_state); goto cleanup;
drivers/acpi/dispatcher/dswload.c +1 -1
@@ -754,7 +754,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_ } flags =ACPI_NS_NO_UPSEARCH ; -if (walk_state->pass_number ==3 ) { +if (walk_state->pass_number ==ACPI_IMODE_EXECUTE ) {/* Execution mode, node cannot already exist, node is temporary */
drivers/acpi/namespace/nsparse.c +3 -3
@@ -160,10 +160,10 @@ acpi_ns_parse_table(acpi_native_uint tab* each Parser Op subtree is deleted when it is finished. This saves * a great deal of memory, and allows a small cache of parse objects * to service the entire parse. The second pass of the parse then -* performs another complete parse of the AML.. +* performs another complete parse of the AML. */ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE ,"**** Start pass 1\n" )); - status =acpi_ns_one_complete_parse (1 , table_index); + status =acpi_ns_one_complete_parse (ACPI_IMODE_LOAD_PASS1 , table_index);if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }
@@ -178,7 +178,7 @@ acpi_ns_parse_table(acpi_native_uint tab* parse objects are all cached. */ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE ,"**** Start pass 2\n" )); - status =acpi_ns_one_complete_parse (2 , table_index); + status =acpi_ns_one_complete_parse (ACPI_IMODE_LOAD_PASS2 , table_index);if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status); }
drivers/acpi/parser/psxface.c +1 -1
@@ -260,7 +260,7 @@ acpi_status acpi_ps_execute_method(struc/* Create and initialize a new walk state */ - info->pass_number =3 ; + info->pass_number =ACPI_IMODE_EXECUTE ; walk_state =acpi_ds_create_walk_state (info->obj_desc->method.owner_id,NULL ,NULL ,NULL );
include/acpi/aclocal.h +1 -1
@@ -162,7 +162,7 @@ struct acpi_mutex_info {typedef enum {ACPI_IMODE_LOAD_PASS1 =0x01 ,ACPI_IMODE_LOAD_PASS2 =0x02 , -ACPI_IMODE_EXECUTE =0x0E +ACPI_IMODE_EXECUTE =0x03 }acpi_interpreter_mode ;union acpi_name_union {
Signature · 1 line
1.4.4.1
PATCH 54/65 ACPICA: Update comments
From: Robert Moore <[email protected]>
--- drivers/acpi/namespace/nswalk.c | 46 +++++++++++++++++++++----------------- 1 files changed, 25 insertions(+), 21 deletions(-)
drivers/acpi/namespace/nswalk.c +25 -21
@@ -193,21 +193,28 @@ acpi_ns_walk_namespace(acpi_object_typeacpi_ns_get_next_node (ACPI_TYPE_ANY , parent_node, child_node);if (child_node) { -/* -* Found node, Get the type if we are not -* searching for ANY -*/ + +/* Found node, Get the type if we are not searching for ANY */ +if (type !=ACPI_TYPE_ANY ) { child_type = child_node->type; } +/* +* 1) Type must match +* 2) Permanent namespace nodes are OK +* 3) Ignore temporary nodes unless told otherwise. Typically, +* the temporary nodes can cause a race condition where they can +* be deleted during the execution of the user function. Only the +* debugger namespace dump will examine the temporary nodes. +*/ if ((child_type == type) && (!(child_node->flags &ANOBJ_TEMPORARY ) || (child_node->flags &ANOBJ_TEMPORARY ) && (flags &ACPI_NS_WALK_TEMP_NODES ))) {/* -* Found a matching node, invoke the user -* callback function +* Found a matching node, invoke the user callback function. +* Unlock the namespace if flag is set. */ if (flags &ACPI_NS_WALK_UNLOCK ) { mutex_status =
@@ -219,8 +226,9 @@ acpi_ns_walk_namespace(acpi_object_type } } - status =user_function (child_node, level, - context, return_value); + status = +user_function (child_node, level, context, + return_value);if (flags &ACPI_NS_WALK_UNLOCK ) { mutex_status =
@@ -254,20 +262,17 @@ acpi_ns_walk_namespace(acpi_object_type }/* -* Depth first search: -* Attempt to go down another level in the namespace -* if we are allowed to. Don't go any further if we -* have reached the caller specified maximum depth -* or if the user function has specified that the -* maximum depth has been reached. +* Depth first search: Attempt to go down another level in the +* namespace if we are allowed to. Don't go any further if we have +* reached the caller specified maximum depth 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_node (ACPI_TYPE_ANY , child_node,NULL )) { -/* -* There is at least one child of this -* node, visit the onde -*/ + +/* There is at least one child of this node, visit it */ + level++; parent_node = child_node; child_node =NULL ;
@@ -275,9 +280,8 @@ acpi_ns_walk_namespace(acpi_object_type } }else {/* -* No more children of this node (acpi_ns_get_next_node -* failed), go back upwards in the namespace tree to -* the node's parent. +* No more children of this node (acpi_ns_get_next_node failed), go +* back upwards in the namespace tree to the node's parent. */ level--; child_node = parent_node;
Signature · 1 line
1.4.4.1
PATCH 55/65 ACPICA: Abort downward walk on temporary node detection.
From: Robert Moore <[email protected]>
Enhancement to code that ignores temporary namespace nodes
--- drivers/acpi/namespace/nswalk.c | 26 +++++++++++++++----------- 1 files changed, 15 insertions(+), 11 deletions(-)
drivers/acpi/namespace/nswalk.c +15 -11
@@ -194,24 +194,28 @@ acpi_ns_walk_namespace(acpi_object_type child_node);if (child_node) { -/* Found node, Get the type if we are not searching for ANY */ +/* Found next child, get the type if we are not searching for ANY */ if (type !=ACPI_TYPE_ANY ) { child_type = child_node->type; }/* -* 1) Type must match -* 2) Permanent namespace nodes are OK -* 3) Ignore temporary nodes unless told otherwise. Typically, -* the temporary nodes can cause a race condition where they can -* be deleted during the execution of the user function. Only the -* debugger namespace dump will examine the temporary nodes. +* Ignore all temporary namespace nodes (created during control +* method execution) unless told otherwise. These temporary nodes +* can cause a race condition because they can be deleted during the +* execution of the user function (if the namespace is unlocked before +* invocation of the user function.) Only the debugger namespace dump +* will examine the temporary nodes. */ -if ((child_type == type) && - (!(child_node->flags &ANOBJ_TEMPORARY ) || - (child_node->flags &ANOBJ_TEMPORARY ) - && (flags &ACPI_NS_WALK_TEMP_NODES ))) { +if ((child_node->flags &ANOBJ_TEMPORARY ) && + !(flags &ACPI_NS_WALK_TEMP_NODES )) { + status =AE_CTRL_DEPTH ; + } + +/* Type must match requested type */ + +else if (child_type == type) {/* * Found a matching node, invoke the user callback function. * Unlock the namespace if flag is set.
Signature · 1 line
1.4.4.1
PATCH 56/65 ACPICA: Fixes for parameter validation.
From: Robert Moore <[email protected]>
Extra checks for valid handle/path combinations, BZ 478
--- drivers/acpi/namespace/nsxfname.c | 45 +++++++++++++++++++----------------- 1 files changed, 24 insertions(+), 21 deletions(-)
drivers/acpi/namespace/nsxfname.c +24 -21
@@ -84,38 +84,41 @@ acpi_get_handle(acpi_handle parent,/* Convert a parent handle to a prefix node */ if (parent) { - status =acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE ); -if (ACPI_FAILURE (status)) { -return (status); - } - prefix_node =acpi_ns_map_handle_to_node (parent);if (!prefix_node) { - (void )acpi_ut_release_mutex (ACPI_MTX_NAMESPACE );return (AE_BAD_PARAMETER ); } + } + +/* +* Valid cases are: +* 1) Fully qualified pathname +* 2) Parent + Relative pathname +* +* Error for <null Parent + relative path> +*/ +if (acpi_ns_valid_root_prefix (pathname[0 ])) { - status =acpi_ut_release_mutex (ACPI_MTX_NAMESPACE ); -if (ACPI_FAILURE (status)) { -return (status); +/* Pathname is fully qualified (starts with '\') */ + +/* Special case for root-only, since we can't search for it */ + +if (!ACPI_STRCMP (pathname,ACPI_NS_ROOT_PATH )) { + *ret_handle = +acpi_ns_convert_entry_to_handle (acpi_gbl_root_node); +return (AE_OK ); } - } + }else if (!prefix_node) { -/* Special case for root, since we can't search for it */ +/* Relative path with null prefix is disallowed */ -if (ACPI_STRCMP (pathname,ACPI_NS_ROOT_PATH ) ==0 ) { - *ret_handle = -acpi_ns_convert_entry_to_handle (acpi_gbl_root_node); -return (AE_OK ); +return (AE_BAD_PARAMETER ); } -/* -* Find the Node and convert to a handle -*/ - status =acpi_ns_get_node (prefix_node, pathname,ACPI_NS_NO_UPSEARCH , - &node); +/* Find the Node and convert to a handle */ - *ret_handle =NULL ; + status = +acpi_ns_get_node (prefix_node, pathname,ACPI_NS_NO_UPSEARCH , &node);if (ACPI_SUCCESS (status)) { *ret_handle =acpi_ns_convert_entry_to_handle (node); }
Signature · 1 line
1.4.4.1
PATCH 57/65 ACPICA: Update version to 20061011
From: Robert Moore <[email protected]>
--- include/acpi/acconfig.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/acpi/acconfig.h +1 -1
@@ -63,7 +63,7 @@/* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20060927 +#define ACPI_CA_VERSION 0x20061011/* * OS name, used for the _OS object. The _OS object is essentially obsolete,
Signature · 1 line
1.4.4.1
PATCH 58/65 ACPICA: Update debug output routines for data structure changes
From: Robert Moore <[email protected]>
--- drivers/acpi/executer/exdump.c | 27 +++++---------------------- 1 files changed, 5 insertions(+), 22 deletions(-)
drivers/acpi/executer/exdump.c +5 -22
@@ -59,8 +59,6 @@ static void acpi_ex_out_string(char *titstatic void acpi_ex_out_pointer (char *title,void *value); -static void acpi_ex_out_address (char *title,acpi_physical_address value); -static void acpi_ex_dump_object (union acpi_operand_object *obj_desc,struct acpi_exdump_info *info);
@@ -92,10 +90,11 @@ static struct acpi_exdump_info acpi_ex_d {ACPI_EXD_STRING, 0, NULL} }; -static struct acpi_exdump_info acpi_ex_dump_buffer[4 ] = { +static struct acpi_exdump_info acpi_ex_dump_buffer[5 ] = { {ACPI_EXD_INIT ,ACPI_EXD_TABLE_SIZE (acpi_ex_dump_buffer),NULL }, {ACPI_EXD_UINT32 ,ACPI_EXD_OFFSET (buffer.length),"Length" }, {ACPI_EXD_POINTER ,ACPI_EXD_OFFSET (buffer.pointer),"Pointer" }, + {ACPI_EXD_POINTER ,ACPI_EXD_OFFSET (buffer.node),"Parent Node" }, {ACPI_EXD_BUFFER ,0 ,NULL } };
@@ -165,8 +164,8 @@ static struct acpi_exdump_info acpi_ex_dstatic struct acpi_exdump_info acpi_ex_dump_processor[7 ] = { {ACPI_EXD_INIT ,ACPI_EXD_TABLE_SIZE (acpi_ex_dump_processor),NULL }, - {ACPI_EXD_UINT32 ,ACPI_EXD_OFFSET (processor.proc_id),"Processor ID" }, - {ACPI_EXD_UINT32 ,ACPI_EXD_OFFSET (processor.length),"Length" }, + {ACPI_EXD_UINT8 ,ACPI_EXD_OFFSET (processor.proc_id),"Processor ID" }, + {ACPI_EXD_UINT8 ,ACPI_EXD_OFFSET (processor.length),"Length" }, {ACPI_EXD_ADDRESS ,ACPI_EXD_OFFSET (processor.address),"Address" }, {ACPI_EXD_POINTER ,ACPI_EXD_OFFSET (processor.system_notify),"System Notify" },
@@ -379,18 +378,12 @@ acpi_ex_dump_object(union acpi_operand_obreak ;case ACPI_EXD_POINTER : +case ACPI_EXD_ADDRESS :acpi_ex_out_pointer (name, *ACPI_CAST_PTR(void *, target));break ; -case ACPI_EXD_ADDRESS : - -acpi_ex_out_address (name, - *ACPI_CAST_PTR - (acpi_physical_address, target)); -break ; -case ACPI_EXD_STRING : acpi_ut_print_string(obj_desc->string.pointer,
@@ -834,16 +827,6 @@ static void acpi_ex_out_pointer(char *tiacpi_os_printf ("%20s : %p\n" , title, value); } -static void acpi_ex_out_address (char *title,acpi_physical_address value) -{ - -#if ACPI_MACHINE_WIDTH ==16 -acpi_os_printf ("%20s : %p\n" , title, value); -#else -acpi_os_printf ("%20s : %8.8X%8.8X\n" , title,ACPI_FORMAT_UINT64 (value)); -#endif -} -/******************************************************************************* * * FUNCTION: acpi_ex_dump_namespace_node
Signature · 1 line
1.4.4.1
PATCH 59/65 ACPICA: Miscellaneous table manager updates and optimizations
From: Robert Moore <[email protected]>
--- drivers/acpi/blacklist.c | 12 +++--- drivers/acpi/tables/tbinstal.c | 91 +++++++++++++++++++++++---------------- drivers/acpi/tables/tbutils.c | 46 -------------------- drivers/acpi/tables/tbxface.c | 39 ++++++++++++----- include/acpi/acpixf.h | 2 +- include/acpi/actables.h | 8 +--- 6 files changed, 90 insertions(+), 108 deletions(-)
drivers/acpi/blacklist.c +6 -6
@@ -103,7 +103,7 @@ int __init acpi_blacklisted(void) {int i =0 ;int blacklisted =0 ; -struct acpi_table_header *table_header; +struct acpi_table_header table_header;while (acpi_blacklist[i].oem_id[0 ] !='\0' ) {if (acpi_get_table_header (acpi_blacklist[i].table,0 , &table_header)) {
@@ -111,13 +111,13 @@ int __init acpi_blacklisted(void)continue ; } -if (strncmp (acpi_blacklist[i].oem_id, table_header->oem_id,6 )) { +if (strncmp (acpi_blacklist[i].oem_id, table_header.oem_id,6 )) { i++;continue ; }if (strncmp - (acpi_blacklist[i].oem_table_id, table_header->oem_table_id, + (acpi_blacklist[i].oem_table_id, table_header.oem_table_id,8 )) { i++;continue ;
@@ -126,14 +126,14 @@ int __init acpi_blacklisted(void)if ((acpi_blacklist[i].oem_revision_predicate == all_versions) || (acpi_blacklist[i].oem_revision_predicate == less_than_or_equal - && table_header->oem_revision <= + && table_header.oem_revision <= acpi_blacklist[i].oem_revision) || (acpi_blacklist[i].oem_revision_predicate == greater_than_or_equal - && table_header->oem_revision >= + && table_header.oem_revision >= acpi_blacklist[i].oem_revision) || (acpi_blacklist[i].oem_revision_predicate == equal - && table_header->oem_revision == + && table_header.oem_revision == acpi_blacklist[i].oem_revision)) { printk(KERN_ERR PREFIX
drivers/acpi/tables/tbinstal.c +54 -37
168 lines not on this page · raw message
drivers/acpi/tables/tbutils.c +0 -46
49 lines not on this page · raw message
drivers/acpi/tables/tbxface.c +27 -12
@@ -212,8 +212,7 @@ ACPI_EXPORT_SYMBOL(acpi_reallocate_root_* * PARAMETERS: Signature - ACPI signature of needed table * Instance - Which instance (for SSDTs) -* out_table_header - Where the pointer to the table header -* is returned +* out_table_header - The pointer to the table header to fill * * RETURN: Status and pointer to mapped table header *
@@ -226,10 +225,11 @@ ACPI_EXPORT_SYMBOL(acpi_reallocate_root_acpi_status acpi_get_table_header (char *signature,acpi_native_uint instance, -struct acpi_table_header **out_table_header) +struct acpi_table_header *out_table_header) {acpi_native_uint i;acpi_native_uint j; +struct acpi_table_header *header;/* Parameter validation */
@@ -251,16 +251,31 @@ acpi_get_table_header(char *signature,continue ; } - *out_table_header = -acpi_tb_map (acpi_gbl_root_table_list.tables[i].address, - (u32 )sizeof (struct acpi_table_header ), - acpi_gbl_root_table_list.tables[i]. - flags &ACPI_TABLE_ORIGIN_MASK ); - -if (!(*out_table_header)) { -return (AE_NO_MEMORY ); +if (!acpi_gbl_root_table_list.tables[i].pointer) { +if ((acpi_gbl_root_table_list.tables[i]. + flags &ACPI_TABLE_ORIGIN_MASK ) == +ACPI_TABLE_ORIGIN_MAPPED ) { + header = +acpi_os_map_memory (acpi_gbl_root_table_list. + tables[i].address, +sizeof (struct +acpi_table_header )); +if (!header) { +return AE_NO_MEMORY ; + } +ACPI_MEMCPY (out_table_header, header, +sizeof (struct acpi_table_header )); +acpi_os_unmap_memory (header, +sizeof (struct +acpi_table_header )); + }else { +return AE_NOT_FOUND ; + } + }else { +ACPI_MEMCPY (out_table_header, + acpi_gbl_root_table_list.tables[i].pointer, +sizeof (struct acpi_table_header )); } -return (AE_OK ); }
include/acpi/acpixf.h +1 -1
@@ -105,7 +105,7 @@ acpi_status acpi_load_tables(void);acpi_status acpi_get_table_header (acpi_string signature,acpi_native_uint instance, -struct acpi_table_header **out_table_header); +struct acpi_table_header *out_table_header); acpi_status acpi_get_table(acpi_string signature,
include/acpi/actables.h +2 -6
@@ -69,7 +69,7 @@ acpi_status acpi_tb_resize_root_table_liacpi_status acpi_tb_verify_table (struct acpi_table_desc *table_desc);acpi_status -acpi_tb_add_table (struct acpi_table_header *table, +acpi_tb_add_table (struct acpi_table_desc *table_desc,acpi_native_uint * table_index); acpi_status
@@ -77,7 +77,7 @@ acpi_tb_store_table(acpi_physical_addresstruct acpi_table_header *table, u32 length, u8 flags, acpi_native_uint * table_index); -void acpi_tb_delete_table (acpi_native_uint table_index); +void acpi_tb_delete_table (struct acpi_table_desc *table_desc);void acpi_tb_terminate (void );
@@ -113,8 +113,4 @@ acpi_tb_install_table(acpi_physical_addracpi_status acpi_tb_parse_root_table (acpi_physical_address rsdp_address,u8 flags); -void *acpi_tb_map (acpi_physical_address address,u32 length,u32 flags); - -void acpi_tb_unmap (void *pointer,u32 length,u32 flags); -#endif /* __ACTABLES_H__ */
Signature · 1 line
1.4.4.1
PATCH 60/65 ACPICA: Fixes for load() operator.
From: Robert Moore <[email protected]>
Optimized the Load operator in the case where the source operand is an operation region. Simply map the operation region memory, instead of performing a bytewise read.
--- drivers/acpi/executer/exconfig.c | 159 +++++++++----------------------------- drivers/acpi/executer/exresop.c | 10 +-- include/acpi/acopcode.h | 2 +- include/acpi/amlcode.h | 2 +- 4 files changed, 42 insertions(+), 131 deletions(-)
drivers/acpi/executer/exconfig.c +36 -123
@@ -119,7 +119,7 @@ acpi_ex_add_table(acpi_native_uint table* * RETURN: Status * -* DESCRIPTION: Load an ACPI table +* DESCRIPTION: Load an ACPI table from the RSDT/XSDT * ******************************************************************************/
@@ -138,21 +138,7 @@ acpi_ex_load_table_op(struct acpi_walk_sACPI_FUNCTION_TRACE (ex_load_table_op); -#if 0 -/* -* Make sure that the signature does not match one of the tables that -* is already loaded. -*/ - status =acpi_tb_match_signature (operand[0 ]->string.pointer,NULL ); -if (status ==AE_OK ) { - -/* Signature matched -- don't allow override */ - -return_ACPI_STATUS (AE_ALREADY_EXISTS ); - } -#endif - -/* Find the ACPI table */ +/* Find the ACPI table in the RSDT/XSDT */ status = acpi_tb_find_table(operand[0]->string.pointer, operand[1]->string.pointer,
@@ -256,7 +242,7 @@ acpi_ex_load_table_op(struct acpi_walk_s* * FUNCTION: acpi_ex_load_op * -* PARAMETERS: obj_desc - Region or Field where the table will be +* PARAMETERS: obj_desc - Region or Buffer/Field where the table will be * obtained * Target - Where a handle to the table will be stored * walk_state - Current state
@@ -265,6 +251,12 @@ acpi_ex_load_table_op(struct acpi_walk_s* * DESCRIPTION: Load an ACPI table from a field or operation region * +* NOTE: Region Fields (Field, bank_field, index_fields) are resolved to buffer +* objects before this code is reached. +* +* If source is an operation region, it must refer to system_memory, as +* per the ACPI specification. +* ******************************************************************************/ acpi_status
@@ -272,23 +264,27 @@ acpi_ex_load_op(union acpi_operand_objecunion acpi_operand_object *target, struct acpi_walk_state *walk_state) { - acpi_status status; union acpi_operand_object *ddb_handle; -union acpi_operand_object *buffer_desc =NULL ; -struct acpi_table_header *table_ptr =NULL ; +struct acpi_table_desc table_desc;acpi_native_uint table_index; -acpi_physical_address address; -struct acpi_table_header table_header; -acpi_integer temp; -u32 i; +acpi_status status;ACPI_FUNCTION_TRACE (ex_load_op); -/* Object can be either an op_region or a Field */ +ACPI_MEMSET (&table_desc,0 ,sizeof (struct acpi_table_desc )); + table_desc.flags =ACPI_TABLE_ORIGIN_ALLOCATED ; + +/* Source Object can be either an op_region or a Buffer/Field */ switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {case ACPI_TYPE_REGION : +/* Region must be system_memory (from ACPI spec) */ + +if (obj_desc->region.space_id !=ACPI_ADR_SPACE_SYSTEM_MEMORY ) { +return_ACPI_STATUS (AE_AML_OPERAND_TYPE ); + } +ACPI_DEBUG_PRINT ((ACPI_DB_EXEC ,"Load from Region %p %s\n" , obj_desc,acpi_ut_get_object_type_name (obj_desc)));
@@ -304,114 +300,35 @@ acpi_ex_load_op(union acpi_operand_objec } } -/* Get the base physical address of the region */ - - address = obj_desc->region.address; - -/* Get part of the table header to get the table length */ - - table_header.length =0 ; -for (i =0 ; i <8 ; i++) { - status = -acpi_ev_address_space_dispatch (obj_desc,ACPI_READ , - (acpi_physical_address) - (i + address),8 , - &temp); -if (ACPI_FAILURE (status)) { -return_ACPI_STATUS (status); - } - -/* Get the one valid byte of the returned 64-bit value */ - -ACPI_CAST_PTR (u8, &table_header)[i] = (u8 ) temp; - } - -/* Sanity check the table length */ - -if (table_header.length <sizeof (struct acpi_table_header )) { -return_ACPI_STATUS (AE_BAD_HEADER ); - } - -/* Allocate a buffer for the entire table */ - - table_ptr =ACPI_ALLOCATE (table_header.length); -if (!table_ptr) { -return_ACPI_STATUS (AE_NO_MEMORY ); - } - -/* Get the entire table from the op region */ - -for (i =0 ; i < table_header.length; i++) { - status = -acpi_ev_address_space_dispatch (obj_desc,ACPI_READ , - (acpi_physical_address) - (i + address),8 , - &temp); -if (ACPI_FAILURE (status)) { - goto cleanup; - } - -/* Get the one valid byte of the returned 64-bit value */ - -ACPI_CAST_PTR (u8, table_ptr)[i] = (u8 ) temp; - } + table_desc.address = obj_desc->region.address; + table_desc.length = obj_desc->region.length; + table_desc.flags =ACPI_TABLE_ORIGIN_MAPPED ;break ; -case ACPI_TYPE_LOCAL_REGION_FIELD : -case ACPI_TYPE_LOCAL_BANK_FIELD : -case ACPI_TYPE_LOCAL_INDEX_FIELD : +case ACPI_TYPE_BUFFER :/* Buffer or resolved region_field */ -ACPI_DEBUG_PRINT ((ACPI_DB_EXEC ,"Load from Field %p %s\n" , - obj_desc, -acpi_ut_get_object_type_name (obj_desc))); +/* Simply extract the buffer from the buffer object */ -/* -* The length of the field must be at least as large as the table. -* Read the entire field and thus the entire table. Buffer is -* allocated during the read. -*/ - status = -acpi_ex_read_data_from_field (walk_state, obj_desc, - &buffer_desc); -if (ACPI_FAILURE (status)) { -return_ACPI_STATUS (status); - } - - table_ptr = ACPI_CAST_PTR(struct acpi_table_header, - buffer_desc->buffer.pointer); - -/* All done with the buffer_desc, delete it */ - - buffer_desc->buffer.pointer =NULL ; -acpi_ut_remove_reference (buffer_desc); +ACPI_DEBUG_PRINT ((ACPI_DB_EXEC , +"Load from Buffer or Field %p %s\n" , obj_desc, +acpi_ut_get_object_type_name (obj_desc))); -/* Sanity check the table length */ + table_desc.pointer = ACPI_CAST_PTR(struct acpi_table_header, + obj_desc->buffer.pointer); + table_desc.length = table_desc.pointer->length; + table_desc.flags =ACPI_TABLE_ORIGIN_ALLOCATED ; -if (table_ptr->length <sizeof (struct acpi_table_header )) { - status =AE_BAD_HEADER ; - goto cleanup; - } + obj_desc->buffer.pointer =NULL ;break ;default :return_ACPI_STATUS (AE_AML_OPERAND_TYPE ); } -/* The table must be either an SSDT or a PSDT */ - -if ((!ACPI_COMPARE_NAME (table_ptr->signature,ACPI_SIG_PSDT )) && - (!ACPI_COMPARE_NAME (table_ptr->signature,ACPI_SIG_SSDT ))) { -ACPI_ERROR ((AE_INFO , -"Table has invalid signature [%4.4s], must be SSDT or PSDT" , - table_ptr->signature)); - status =AE_BAD_SIGNATURE ; - goto cleanup; - } -/* * Install the new table into the local data structures */ - status =acpi_tb_add_table (table_ptr, &table_index); + status =acpi_tb_add_table (&table_desc, &table_index);if (ACPI_FAILURE (status)) { goto cleanup; }
@@ -436,13 +353,9 @@ acpi_ex_load_op(union acpi_operand_objecreturn_ACPI_STATUS (status); } -ACPI_INFO ((AE_INFO , -"Dynamic SSDT Load - OemId [%6.6s] OemTableId [%8.8s]" , - table_ptr->oem_id, table_ptr->oem_table_id)); - cleanup:if (ACPI_FAILURE (status)) { -ACPI_FREE (table_ptr); +acpi_tb_delete_table (&table_desc); }return_ACPI_STATUS (status); }
drivers/acpi/executer/exresop.c +4 -6
@@ -611,22 +611,20 @@ acpi_ex_resolve_operands(u16 opcode, } goto next_operand; -case ARGI_REGION_OR_FIELD : +case ARGI_REGION_OR_BUFFER :/* Used by Load() only */ -/* Need an operand of type REGION or a FIELD in a region */ +/* Need an operand of type REGION or a BUFFER (which could be a resolved region field) */ switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { +case ACPI_TYPE_BUFFER :case ACPI_TYPE_REGION : -case ACPI_TYPE_LOCAL_REGION_FIELD : -case ACPI_TYPE_LOCAL_BANK_FIELD : -case ACPI_TYPE_LOCAL_INDEX_FIELD :/* Valid operand */ break ;default :ACPI_ERROR ((AE_INFO , -"Needed [Region/RegionField], found [%s] %p" , +"Needed [Region/Buffer], found [%s] %p" ,acpi_ut_get_object_type_name (obj_desc), obj_desc));
include/acpi/acopcode.h +1 -1
@@ -257,7 +257,7 @@#define ARGI_LLESSEQUAL_OP ARGI_INVALID_OPCODE#define ARGI_LNOT_OP ARGI_LIST1 (ARGI_INTEGER)#define ARGI_LNOTEQUAL_OP ARGI_INVALID_OPCODE -#define ARGI_LOAD_OP ARGI_LIST2 (ARGI_REGION_OR_FIELD,ARGI_TARGETREF) +#define ARGI_LOAD_OP ARGI_LIST2 (ARGI_REGION_OR_BUFFER,ARGI_TARGETREF)#define ARGI_LOAD_TABLE_OP ARGI_LIST6 (ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_ANYTYPE)#define ARGI_LOCAL0 ARG_NONE#define ARGI_LOCAL1 ARG_NONE
include/acpi/amlcode.h +1 -1
@@ -273,7 +273,7 @@#define ARGI_DATAOBJECT 0x12/* Buffer, String, package or reference to a Node - Used only by size_of operator */ #define ARGI_COMPLEXOBJ 0x13/* Buffer, String, or package (Used by INDEX op only) */ #define ARGI_REF_OR_STRING 0x14/* Reference or String (Used by DEREFOF op only) */ -#define ARGI_REGION_OR_FIELD 0x15/* Used by LOAD op only */ +#define ARGI_REGION_OR_BUFFER 0x15/* Used by LOAD op only */ #define ARGI_DATAREFOBJ 0x16/* Note: types above can expand to 0x1F maximum */
Signature · 1 line
1.4.4.1
PATCH 61/65 ACPICA: Ensure that all structures in acobject.h are aligned, via #pragma.
From: Robert Moore <[email protected]>
Thus, even if the default compiler setting is non-aligned, the header is compiled
correctly.
--- include/acpi/acobject.h | 17 +++++++++++++++-- include/acpi/actypes.h | 4 ++++ 2 files changed, 19 insertions(+), 2 deletions(-)
include/acpi/acobject.h +15 -2
@@ -52,7 +52,15 @@* 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 it to be cached and reused. +* +* Note: The object is optimized to be aligned and will not work if it is +* byte-packed. */ +#if ACPI_MACHINE_WIDTH ==64 +#pragma pack(8) +#else +#pragma pack(4) +#endif /******************************************************************************* *
@@ -101,7 +109,8 @@ struct acpi_object_common { ACPI_OBJECT_COMMON_HEADER};struct acpi_object_integer { - ACPI_OBJECT_COMMON_HEADER acpi_integer value; + ACPI_OBJECT_COMMON_HEADER u8 fill[3]; /* Prevent warning on some compilers */ +acpi_integer value; };/*
@@ -203,7 +212,9 @@ struct acpi_object_power_resource { };struct acpi_object_processor { - ACPI_OBJECT_COMMON_HEADER u8 proc_id; +ACPI_OBJECT_COMMON_HEADER +/* The next two fields take advantage of the 3-byte space before NOTIFY_INFO */ + u8 proc_id;u8 length; ACPI_COMMON_NOTIFY_INFO acpi_io_address address; };
@@ -406,4 +417,6 @@ union acpi_descriptor { union acpi_parse_object op; }; +#pragma pack() +#endif /* _ACOBJECT_H */
include/acpi/actypes.h +4 -0
@@ -156,6 +156,7 @@ typedef u64 acpi_physical_address;#define ACPI_MAX_PTR ACPI_UINT64_MAX#define ACPI_SIZE_MAX ACPI_UINT64_MAX +#define ACPI_NATIVE_BOUNDARY 8#define ACPI_USE_NATIVE_DIVIDE /* Has native 64-bit integer support */ /*
@@ -196,6 +197,8 @@ typedef u32 acpi_physical_address;#define ACPI_MAX_PTR ACPI_UINT32_MAX#define ACPI_SIZE_MAX ACPI_UINT32_MAX +#define ACPI_NATIVE_BOUNDARY 4 +/******************************************************************************* * * Types specific to 16-bit targets
@@ -222,6 +225,7 @@ typedef char *acpi_physical_address;#define ACPI_MAX_PTR ACPI_UINT16_MAX#define ACPI_SIZE_MAX ACPI_UINT16_MAX +#define ACPI_NATIVE_BOUNDARY 2#define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */ /* 64-bit integers cannot be supported */
Signature · 1 line
1.4.4.1
PATCH 62/65 ACPICA: Add ACPI_MAX macro
From: Robert Moore <[email protected]>
--- include/acpi/acmacros.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
include/acpi/acmacros.h +1 -0
@@ -55,6 +55,7 @@#define ACPI_SET_BIT (target,bit) ((target) |= (bit))#define ACPI_CLEAR_BIT (target,bit) ((target) &= ~(bit))#define ACPI_MIN (a,b) (((a)<(b))?(a):(b)) +#define ACPI_MAX (a,b) (((a)>(b))?(a):(b))/* Size calculation */
Signature · 1 line
1.4.4.1
PATCH 63/65 ACPICA: Fail AcpiEnable if ACPI tables not loaded.
From: Robert Moore <[email protected]>
AcpiEnable will now fail if all of the required ACPI tables are not loaded (FADT, FACS, DSDT). BZ 477
--- drivers/acpi/events/evxfevnt.c | 8 ++++++++ drivers/acpi/tables/tbutils.c | 23 +++++++++++++++++++++++ include/acpi/actables.h | 2 ++ 3 files changed, 33 insertions(+), 0 deletions(-)
drivers/acpi/events/evxfevnt.c +8 -0
@@ -65,6 +65,14 @@ acpi_status acpi_enable(void)ACPI_FUNCTION_TRACE (acpi_enable); +/* ACPI tables must be present */ + +if (!acpi_tb_tables_loaded ()) { +return_ACPI_STATUS (AE_NO_ACPI_TABLES ); + } + +/* Check current mode */ +if (acpi_hw_get_mode () ==ACPI_SYS_MODE_ACPI ) {ACPI_DEBUG_PRINT ((ACPI_DB_INIT ,"System is already in ACPI mode\n" ));
drivers/acpi/tables/tbutils.c +23 -0
@@ -54,6 +54,29 @@ acpi_tb_get_root_table_entry(u8 * table_/******************************************************************************* * +* FUNCTION: acpi_tb_tables_loaded +* +* PARAMETERS: None +* +* RETURN: TRUE if required ACPI tables are loaded +* +* DESCRIPTION: Determine if the minimum required ACPI tables are present +* (FADT, FACS, DSDT) +* +******************************************************************************/ + +u8 acpi_tb_tables_loaded (void ) +{ + +if (acpi_gbl_root_table_list.count >=3 ) { +return (TRUE); + } + +return (FALSE); +} + +/******************************************************************************* +* * FUNCTION: acpi_tb_print_table_header * * PARAMETERS: Address - Table physical address
include/acpi/actables.h +2 -0
@@ -97,6 +97,8 @@ void acpi_tb_set_table_loaded_flag(acpi_/* * tbutils - table manager utilities */ +u8 acpi_tb_tables_loaded (void ); +void acpi_tb_print_table_header (acpi_physical_address address,struct acpi_table_header *header);
Signature · 1 line
1.4.4.1
PATCH 64/65 ACPICA: Add include of actables.h
From: Robert Moore <[email protected]>
--- drivers/acpi/events/evxfevnt.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/acpi/events/evxfevnt.c +1 -0
@@ -44,6 +44,7 @@#include <acpi/acpi.h> #include <acpi/acevents.h> #include <acpi/acnamesp.h> +#include <acpi/actables.h> #define _COMPONENT ACPI_EVENTSACPI_MODULE_NAME ("evxfevnt" )
Signature · 1 line
1.4.4.1
PATCH 65/65 ACPICA: version update
From: Robert Moore <[email protected]>
--- include/acpi/acconfig.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/acpi/acconfig.h +1 -1
@@ -63,7 +63,7 @@/* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20061011 +#define ACPI_CA_VERSION 0x20061109/* * OS name, used for the _OS object. The _OS object is essentially obsolete,
Signature · 1 line
1.4.4.1
Quoted 2 lines · Len Brown
The following patches are on the "acpica" branch of the ACPI git tree.
#11 seems to be missing, or is it just me who hasn't received it?
Rafael
Signature · 2 lines
You never change things by fighting the existing reality. R. Buckminster Fuller
Quoted 5 lines · Rafael J. Wysocki
Quoted 2 lines · Len Brown
The following patches are on the "acpica" branch of the ACPI git tree.
#11 seems to be missing, or is it just me who hasn't received it?
I think it is missing.
Moreover, the one available at
seems to suffer from a mismerge in acpi_status acpi_reallocate_root_table().
Greetings,
Rafael
Signature · 2 lines
You never change things by fighting the existing reality. R. Buckminster Fuller
Quoted 8 lines · Rafael J. Wysocki
Quoted 5 lines · Rafael J. Wysocki
Quoted 2 lines · Len Brown
The following patches are on the "acpica" branch of the ACPI git tree.
#11 seems to be missing, or is it just me who hasn't received it?
I think it is missing.
Yep, it got filtered by vger.kernel.org due to size. Here's a copy:
http://ftp.kernel.org/pub/linux/kernel/people/lenb/acpi/patches/test/acpica/
0011-ACPICA-Implement-simplified-Table-Manager.txt
While we're trying hard to break up the ACPICA updates into individual patches, with a single well contained logical change per each, in that case we did not succeed.
Quoted 5 lines
Moreover, the one available at
seems to suffer from a mismerge in
acpi_statusacpi_reallocate_root_table().
I don't see a mis-merge there.
Note that the unused acpi_load_table got deleted,
and acpi_reallocate_root_table got added in that place in the file. Diff isn't very smart about displaying this case --
or did I mis-understand what you are referring to?
note that the acpica branch will be re-checked in to fix some minor issues.
so if you pulled it and you pull it again and get conflicts, throw away the previous version. This is the price we pay for being required to supply "clean" history to upsteam.
thanks,
-Len