Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 55816
b: refs/heads/master
c: 4d2acd9
h: refs/heads/master
v: v3
  • Loading branch information
Len Brown committed May 10, 2007
1 parent 8860432 commit abd1220
Show file tree
Hide file tree
Showing 74 changed files with 434 additions and 12,044 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f697b677620d04d8c77841745727de85f7e948b1
refs/heads/master: 4d2acd9ea539e0f59178b126f6750ccc41eefcdd
8 changes: 2 additions & 6 deletions trunk/drivers/acpi/events/evmisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,11 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
notify_info->notify.value = (u16) notify_value;
notify_info->notify.handler_obj = handler_obj;

acpi_ex_exit_interpreter();
acpi_ex_relinquish_interpreter();

acpi_ev_notify_dispatch(notify_info);

status = acpi_ex_enter_interpreter();
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}

acpi_ex_reacquire_interpreter();
}

if (!handler_obj) {
Expand Down
15 changes: 4 additions & 11 deletions trunk/drivers/acpi/events/evregion.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
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;
Expand Down Expand Up @@ -345,18 +344,15 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
* 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,
&region_context);

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

Expand Down Expand Up @@ -409,7 +405,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
* 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 */
Expand All @@ -430,10 +426,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
* 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);
Expand Down
6 changes: 2 additions & 4 deletions trunk/drivers/acpi/events/evxface.c
Original file line number Diff line number Diff line change
Expand Up @@ -768,11 +768,9 @@ acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle)
return (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();

Expand Down
5 changes: 1 addition & 4 deletions trunk/drivers/acpi/executer/excreate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 7 additions & 23 deletions trunk/drivers/acpi/executer/exsystem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -79,7 +78,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout)

/* We must wait, so unlock the interpreter */

acpi_ex_exit_interpreter();
acpi_ex_relinquish_interpreter();

status = acpi_os_wait_semaphore(semaphore, 1, timeout);

Expand All @@ -89,13 +88,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout)

/* 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);
Expand All @@ -119,7 +112,6 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout)
acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout)
{
acpi_status status;
acpi_status status2;

ACPI_FUNCTION_TRACE(ex_system_wait_mutex);

Expand All @@ -132,7 +124,7 @@ acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout)

/* We must wait, so unlock the interpreter */

acpi_ex_exit_interpreter();
acpi_ex_relinquish_interpreter();

status = acpi_os_acquire_mutex(mutex, timeout);

Expand All @@ -142,13 +134,7 @@ acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout)

/* 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);
Expand Down Expand Up @@ -209,20 +195,18 @@ acpi_status acpi_ex_system_do_stall(u32 how_long)

acpi_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);
}

/*******************************************************************************
Expand Down
104 changes: 84 additions & 20 deletions trunk/drivers/acpi/executer/exutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,46 +76,71 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base);
*
* PARAMETERS: None
*
* RETURN: Status
* RETURN: None
*
* DESCRIPTION: Enter the interpreter execution region. Failure to enter
* the interpreter region is a fatal system error
* DESCRIPTION: Enter the interpreter execution region. Failure to enter
* the interpreter region is a fatal system error. Used in
* conjunction with exit_interpreter.
*
******************************************************************************/

acpi_status acpi_ex_enter_interpreter(void)
void acpi_ex_enter_interpreter(void)
{
acpi_status status;

ACPI_FUNCTION_TRACE(ex_enter_interpreter);

status = acpi_ut_acquire_mutex(ACPI_MTX_INTERPRETER);
if (ACPI_FAILURE(status)) {
ACPI_ERROR((AE_INFO, "Could not acquire interpreter mutex"));
ACPI_ERROR((AE_INFO,
"Could not acquire AML Interpreter mutex"));
}

return_ACPI_STATUS(status);
return_VOID;
}

/*******************************************************************************
*
* FUNCTION: acpi_ex_exit_interpreter
* FUNCTION: acpi_ex_reacquire_interpreter
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Exit the interpreter execution region
* DESCRIPTION: Reacquire the interpreter execution region from within the
* interpreter code. Failure to enter the interpreter region is a
* fatal system error. Used in conjuction with
* relinquish_interpreter
*
******************************************************************************/

void acpi_ex_reacquire_interpreter(void)
{
ACPI_FUNCTION_TRACE(ex_reacquire_interpreter);

/*
* If the global serialized flag is set, do not release the interpreter,
* since it was not actually released by acpi_ex_relinquish_interpreter.
* This forces the interpreter to be single threaded.
*/
if (!acpi_gbl_all_methods_serialized) {
acpi_ex_enter_interpreter();
}

return_VOID;
}

/*******************************************************************************
*
* FUNCTION: acpi_ex_exit_interpreter
*
* PARAMETERS: None
*
* RETURN: None
*
* Cases where the interpreter is unlocked:
* 1) Completion of the execution of a control method
* 2) Method blocked on a Sleep() AML opcode
* 3) Method blocked on an Acquire() AML opcode
* 4) Method blocked on a Wait() AML opcode
* 5) Method blocked to acquire the global lock
* 6) Method blocked to execute a serialized control method that is
* already executing
* 7) About to invoke a user-installed opregion handler
* DESCRIPTION: Exit the interpreter execution region. This is the top level
* routine used to exit the interpreter when all processing has
* been completed.
*
******************************************************************************/

Expand All @@ -127,7 +152,46 @@ void acpi_ex_exit_interpreter(void)

status = acpi_ut_release_mutex(ACPI_MTX_INTERPRETER);
if (ACPI_FAILURE(status)) {
ACPI_ERROR((AE_INFO, "Could not release interpreter mutex"));
ACPI_ERROR((AE_INFO,
"Could not release AML Interpreter mutex"));
}

return_VOID;
}

/*******************************************************************************
*
* FUNCTION: acpi_ex_relinquish_interpreter
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Exit the interpreter execution region, from within the
* interpreter - before attempting an operation that will possibly
* block the running thread.
*
* Cases where the interpreter is unlocked internally
* 1) Method to be blocked on a Sleep() AML opcode
* 2) Method to be blocked on an Acquire() AML opcode
* 3) Method to be blocked on a Wait() AML opcode
* 4) Method to be blocked to acquire the global lock
* 5) Method to be blocked waiting to execute a serialized control method
* that is currently executing
* 6) About to invoke a user-installed opregion handler
*
******************************************************************************/

void acpi_ex_relinquish_interpreter(void)
{
ACPI_FUNCTION_TRACE(ex_relinquish_interpreter);

/*
* If the global serialized flag is set, do not release the interpreter.
* This forces the interpreter to be single threaded.
*/
if (!acpi_gbl_all_methods_serialized) {
acpi_ex_exit_interpreter();
}

return_VOID;
Expand All @@ -141,8 +205,8 @@ void acpi_ex_exit_interpreter(void)
*
* RETURN: none
*
* DESCRIPTION: Truncate a number to 32-bits if the currently executing method
* belongs to a 32-bit ACPI table.
* DESCRIPTION: Truncate an ACPI Integer to 32 bits if the execution mode is
* 32-bit, as determined by the revision of the DSDT.
*
******************************************************************************/

Expand Down
11 changes: 2 additions & 9 deletions trunk/drivers/acpi/namespace/nseval.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,7 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info)
* 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 {
Expand All @@ -182,10 +178,7 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info)
* 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 */

Expand Down
7 changes: 2 additions & 5 deletions trunk/drivers/acpi/namespace/nsinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ acpi_ns_init_one_object(acpi_handle obj_handle,
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 =
Expand Down Expand Up @@ -268,10 +268,7 @@ acpi_ns_init_one_object(acpi_handle obj_handle,
/*
* 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
Expand Down
Loading

0 comments on commit abd1220

Please sign in to comment.