[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
@ -45,18 +45,12 @@
|
||||
#include <acpi/acevents.h>
|
||||
|
||||
#define _COMPONENT ACPI_EVENTS
|
||||
ACPI_MODULE_NAME ("evevent")
|
||||
ACPI_MODULE_NAME("evevent")
|
||||
|
||||
/* Local prototypes */
|
||||
static acpi_status acpi_ev_fixed_event_initialize(void);
|
||||
|
||||
static acpi_status
|
||||
acpi_ev_fixed_event_initialize (
|
||||
void);
|
||||
|
||||
static u32
|
||||
acpi_ev_fixed_event_dispatch (
|
||||
u32 event);
|
||||
|
||||
static u32 acpi_ev_fixed_event_dispatch(u32 event);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -70,21 +64,17 @@ acpi_ev_fixed_event_dispatch (
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ev_initialize_events (
|
||||
void)
|
||||
acpi_status acpi_ev_initialize_events(void)
|
||||
{
|
||||
acpi_status status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("ev_initialize_events");
|
||||
acpi_status status;
|
||||
|
||||
ACPI_FUNCTION_TRACE("ev_initialize_events");
|
||||
|
||||
/* Make sure we have ACPI tables */
|
||||
|
||||
if (!acpi_gbl_DSDT) {
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No ACPI tables present!\n"));
|
||||
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "No ACPI tables present!\n"));
|
||||
return_ACPI_STATUS(AE_NO_ACPI_TABLES);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -92,26 +82,22 @@ acpi_ev_initialize_events (
|
||||
* enabling SCIs to prevent interrupts from occurring before the handlers are
|
||||
* installed.
|
||||
*/
|
||||
status = acpi_ev_fixed_event_initialize ();
|
||||
if (ACPI_FAILURE (status)) {
|
||||
ACPI_REPORT_ERROR ((
|
||||
"Unable to initialize fixed events, %s\n",
|
||||
acpi_format_exception (status)));
|
||||
return_ACPI_STATUS (status);
|
||||
status = acpi_ev_fixed_event_initialize();
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_REPORT_ERROR(("Unable to initialize fixed events, %s\n",
|
||||
acpi_format_exception(status)));
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
status = acpi_ev_gpe_initialize ();
|
||||
if (ACPI_FAILURE (status)) {
|
||||
ACPI_REPORT_ERROR ((
|
||||
"Unable to initialize general purpose events, %s\n",
|
||||
acpi_format_exception (status)));
|
||||
return_ACPI_STATUS (status);
|
||||
status = acpi_ev_gpe_initialize();
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_REPORT_ERROR(("Unable to initialize general purpose events, %s\n", acpi_format_exception(status)));
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (status);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_install_xrupt_handlers
|
||||
@ -124,41 +110,32 @@ acpi_ev_initialize_events (
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ev_install_xrupt_handlers (
|
||||
void)
|
||||
acpi_status acpi_ev_install_xrupt_handlers(void)
|
||||
{
|
||||
acpi_status status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("ev_install_xrupt_handlers");
|
||||
acpi_status status;
|
||||
|
||||
ACPI_FUNCTION_TRACE("ev_install_xrupt_handlers");
|
||||
|
||||
/* Install the SCI handler */
|
||||
|
||||
status = acpi_ev_install_sci_handler ();
|
||||
if (ACPI_FAILURE (status)) {
|
||||
ACPI_REPORT_ERROR ((
|
||||
"Unable to install System Control Interrupt Handler, %s\n",
|
||||
acpi_format_exception (status)));
|
||||
return_ACPI_STATUS (status);
|
||||
status = acpi_ev_install_sci_handler();
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_REPORT_ERROR(("Unable to install System Control Interrupt Handler, %s\n", acpi_format_exception(status)));
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/* Install the handler for the Global Lock */
|
||||
|
||||
status = acpi_ev_init_global_lock_handler ();
|
||||
if (ACPI_FAILURE (status)) {
|
||||
ACPI_REPORT_ERROR ((
|
||||
"Unable to initialize Global Lock handler, %s\n",
|
||||
acpi_format_exception (status)));
|
||||
return_ACPI_STATUS (status);
|
||||
status = acpi_ev_init_global_lock_handler();
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_REPORT_ERROR(("Unable to initialize Global Lock handler, %s\n", acpi_format_exception(status)));
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
acpi_gbl_events_initialized = TRUE;
|
||||
return_ACPI_STATUS (status);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_fixed_event_initialize
|
||||
@ -171,13 +148,10 @@ acpi_ev_install_xrupt_handlers (
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static acpi_status
|
||||
acpi_ev_fixed_event_initialize (
|
||||
void)
|
||||
static acpi_status acpi_ev_fixed_event_initialize(void)
|
||||
{
|
||||
acpi_native_uint i;
|
||||
acpi_status status;
|
||||
|
||||
acpi_native_uint i;
|
||||
acpi_status status;
|
||||
|
||||
/*
|
||||
* Initialize the structure that keeps track of fixed event handlers
|
||||
@ -190,10 +164,11 @@ acpi_ev_fixed_event_initialize (
|
||||
/* Enable the fixed event */
|
||||
|
||||
if (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);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
status =
|
||||
acpi_set_register(acpi_gbl_fixed_event_info[i].
|
||||
enable_register_id, 0,
|
||||
ACPI_MTX_LOCK);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return (status);
|
||||
}
|
||||
}
|
||||
@ -202,7 +177,6 @@ acpi_ev_fixed_event_initialize (
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_fixed_event_detect
|
||||
@ -215,31 +189,27 @@ acpi_ev_fixed_event_initialize (
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
u32
|
||||
acpi_ev_fixed_event_detect (
|
||||
void)
|
||||
u32 acpi_ev_fixed_event_detect(void)
|
||||
{
|
||||
u32 int_status = ACPI_INTERRUPT_NOT_HANDLED;
|
||||
u32 fixed_status;
|
||||
u32 fixed_enable;
|
||||
acpi_native_uint i;
|
||||
|
||||
|
||||
ACPI_FUNCTION_NAME ("ev_fixed_event_detect");
|
||||
u32 int_status = ACPI_INTERRUPT_NOT_HANDLED;
|
||||
u32 fixed_status;
|
||||
u32 fixed_enable;
|
||||
acpi_native_uint i;
|
||||
|
||||
ACPI_FUNCTION_NAME("ev_fixed_event_detect");
|
||||
|
||||
/*
|
||||
* Read the fixed feature status and enable registers, as all the cases
|
||||
* depend on their values. Ignore errors here.
|
||||
*/
|
||||
(void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS,
|
||||
&fixed_status);
|
||||
(void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE,
|
||||
&fixed_enable);
|
||||
(void)acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
|
||||
ACPI_REGISTER_PM1_STATUS, &fixed_status);
|
||||
(void)acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
|
||||
ACPI_REGISTER_PM1_ENABLE, &fixed_enable);
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
|
||||
"Fixed Event Block: Enable %08X Status %08X\n",
|
||||
fixed_enable, fixed_status));
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS,
|
||||
"Fixed Event Block: Enable %08X Status %08X\n",
|
||||
fixed_enable, fixed_status));
|
||||
|
||||
/*
|
||||
* Check for all possible Fixed Events and dispatch those that are active
|
||||
@ -247,18 +217,19 @@ acpi_ev_fixed_event_detect (
|
||||
for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
|
||||
/* Both the status and enable bits must be on for this event */
|
||||
|
||||
if ((fixed_status & acpi_gbl_fixed_event_info[i].status_bit_mask) &&
|
||||
(fixed_enable & acpi_gbl_fixed_event_info[i].enable_bit_mask)) {
|
||||
if ((fixed_status & acpi_gbl_fixed_event_info[i].
|
||||
status_bit_mask)
|
||||
&& (fixed_enable & acpi_gbl_fixed_event_info[i].
|
||||
enable_bit_mask)) {
|
||||
/* Found an active (signalled) event */
|
||||
|
||||
int_status |= acpi_ev_fixed_event_dispatch ((u32) i);
|
||||
int_status |= acpi_ev_fixed_event_dispatch((u32) i);
|
||||
}
|
||||
}
|
||||
|
||||
return (int_status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_fixed_event_dispatch
|
||||
@ -272,39 +243,32 @@ acpi_ev_fixed_event_detect (
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static u32
|
||||
acpi_ev_fixed_event_dispatch (
|
||||
u32 event)
|
||||
static u32 acpi_ev_fixed_event_dispatch(u32 event)
|
||||
{
|
||||
|
||||
|
||||
ACPI_FUNCTION_ENTRY ();
|
||||
|
||||
ACPI_FUNCTION_ENTRY();
|
||||
|
||||
/* Clear the status bit */
|
||||
|
||||
(void) acpi_set_register (acpi_gbl_fixed_event_info[event].status_register_id,
|
||||
1, ACPI_MTX_DO_NOT_LOCK);
|
||||
(void)acpi_set_register(acpi_gbl_fixed_event_info[event].
|
||||
status_register_id, 1, ACPI_MTX_DO_NOT_LOCK);
|
||||
|
||||
/*
|
||||
* Make sure we've got a handler. If not, report an error.
|
||||
* The event is disabled to prevent further interrupts.
|
||||
*/
|
||||
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);
|
||||
(void)acpi_set_register(acpi_gbl_fixed_event_info[event].
|
||||
enable_register_id, 0,
|
||||
ACPI_MTX_DO_NOT_LOCK);
|
||||
|
||||
ACPI_REPORT_ERROR (
|
||||
("No installed handler for fixed event [%08X]\n",
|
||||
event));
|
||||
ACPI_REPORT_ERROR(("No installed handler for fixed event [%08X]\n", event));
|
||||
|
||||
return (ACPI_INTERRUPT_NOT_HANDLED);
|
||||
}
|
||||
|
||||
/* Invoke the Fixed Event handler */
|
||||
|
||||
return ((acpi_gbl_fixed_event_handlers[event].handler)(
|
||||
acpi_gbl_fixed_event_handlers[event].context));
|
||||
return ((acpi_gbl_fixed_event_handlers[event].
|
||||
handler) (acpi_gbl_fixed_event_handlers[event].context));
|
||||
}
|
||||
|
||||
|
||||
|
@ -46,14 +46,10 @@
|
||||
#include <acpi/acnamesp.h>
|
||||
|
||||
#define _COMPONENT ACPI_EVENTS
|
||||
ACPI_MODULE_NAME ("evgpe")
|
||||
ACPI_MODULE_NAME("evgpe")
|
||||
|
||||
/* Local prototypes */
|
||||
|
||||
static void ACPI_SYSTEM_XFACE
|
||||
acpi_ev_asynch_execute_gpe_method (
|
||||
void *context);
|
||||
|
||||
static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -69,15 +65,11 @@ acpi_ev_asynch_execute_gpe_method (
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ev_set_gpe_type (
|
||||
struct acpi_gpe_event_info *gpe_event_info,
|
||||
u8 type)
|
||||
acpi_ev_set_gpe_type(struct acpi_gpe_event_info *gpe_event_info, u8 type)
|
||||
{
|
||||
acpi_status status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("ev_set_gpe_type");
|
||||
acpi_status status;
|
||||
|
||||
ACPI_FUNCTION_TRACE("ev_set_gpe_type");
|
||||
|
||||
/* Validate type and update register enable masks */
|
||||
|
||||
@ -88,21 +80,20 @@ acpi_ev_set_gpe_type (
|
||||
break;
|
||||
|
||||
default:
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
/* Disable the GPE if currently enabled */
|
||||
|
||||
status = acpi_ev_disable_gpe (gpe_event_info);
|
||||
status = acpi_ev_disable_gpe(gpe_event_info);
|
||||
|
||||
/* Type was validated above */
|
||||
|
||||
gpe_event_info->flags &= ~ACPI_GPE_TYPE_MASK; /* Clear type bits */
|
||||
gpe_event_info->flags |= type; /* Insert type */
|
||||
return_ACPI_STATUS (status);
|
||||
gpe_event_info->flags &= ~ACPI_GPE_TYPE_MASK; /* Clear type bits */
|
||||
gpe_event_info->flags |= type; /* Insert type */
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_update_gpe_enable_masks
|
||||
@ -118,57 +109,55 @@ acpi_ev_set_gpe_type (
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ev_update_gpe_enable_masks (
|
||||
struct acpi_gpe_event_info *gpe_event_info,
|
||||
u8 type)
|
||||
acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info,
|
||||
u8 type)
|
||||
{
|
||||
struct acpi_gpe_register_info *gpe_register_info;
|
||||
u8 register_bit;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("ev_update_gpe_enable_masks");
|
||||
struct acpi_gpe_register_info *gpe_register_info;
|
||||
u8 register_bit;
|
||||
|
||||
ACPI_FUNCTION_TRACE("ev_update_gpe_enable_masks");
|
||||
|
||||
gpe_register_info = gpe_event_info->register_info;
|
||||
if (!gpe_register_info) {
|
||||
return_ACPI_STATUS (AE_NOT_EXIST);
|
||||
return_ACPI_STATUS(AE_NOT_EXIST);
|
||||
}
|
||||
register_bit = gpe_event_info->register_bit;
|
||||
|
||||
/* 1) Disable case. Simply clear all enable bits */
|
||||
|
||||
if (type == ACPI_GPE_DISABLE) {
|
||||
ACPI_CLEAR_BIT (gpe_register_info->enable_for_wake, register_bit);
|
||||
ACPI_CLEAR_BIT (gpe_register_info->enable_for_run, register_bit);
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake,
|
||||
register_bit);
|
||||
ACPI_CLEAR_BIT(gpe_register_info->enable_for_run, register_bit);
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
/* 2) Enable case. Set/Clear the appropriate enable bits */
|
||||
|
||||
switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) {
|
||||
case ACPI_GPE_TYPE_WAKE:
|
||||
ACPI_SET_BIT (gpe_register_info->enable_for_wake, register_bit);
|
||||
ACPI_CLEAR_BIT (gpe_register_info->enable_for_run, register_bit);
|
||||
ACPI_SET_BIT(gpe_register_info->enable_for_wake, register_bit);
|
||||
ACPI_CLEAR_BIT(gpe_register_info->enable_for_run, register_bit);
|
||||
break;
|
||||
|
||||
case ACPI_GPE_TYPE_RUNTIME:
|
||||
ACPI_CLEAR_BIT (gpe_register_info->enable_for_wake, register_bit);
|
||||
ACPI_SET_BIT (gpe_register_info->enable_for_run, register_bit);
|
||||
ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake,
|
||||
register_bit);
|
||||
ACPI_SET_BIT(gpe_register_info->enable_for_run, register_bit);
|
||||
break;
|
||||
|
||||
case ACPI_GPE_TYPE_WAKE_RUN:
|
||||
ACPI_SET_BIT (gpe_register_info->enable_for_wake, register_bit);
|
||||
ACPI_SET_BIT (gpe_register_info->enable_for_run, register_bit);
|
||||
ACPI_SET_BIT(gpe_register_info->enable_for_wake, register_bit);
|
||||
ACPI_SET_BIT(gpe_register_info->enable_for_run, register_bit);
|
||||
break;
|
||||
|
||||
default:
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_enable_gpe
|
||||
@ -184,21 +173,19 @@ acpi_ev_update_gpe_enable_masks (
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ev_enable_gpe (
|
||||
struct acpi_gpe_event_info *gpe_event_info,
|
||||
u8 write_to_hardware)
|
||||
acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info,
|
||||
u8 write_to_hardware)
|
||||
{
|
||||
acpi_status status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("ev_enable_gpe");
|
||||
acpi_status status;
|
||||
|
||||
ACPI_FUNCTION_TRACE("ev_enable_gpe");
|
||||
|
||||
/* Make sure HW enable masks are updated */
|
||||
|
||||
status = acpi_ev_update_gpe_enable_masks (gpe_event_info, ACPI_GPE_ENABLE);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
return_ACPI_STATUS (status);
|
||||
status =
|
||||
acpi_ev_update_gpe_enable_masks(gpe_event_info, ACPI_GPE_ENABLE);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/* Mark wake-enabled or HW enable, or both */
|
||||
@ -206,41 +193,40 @@ acpi_ev_enable_gpe (
|
||||
switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) {
|
||||
case ACPI_GPE_TYPE_WAKE:
|
||||
|
||||
ACPI_SET_BIT (gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
|
||||
ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
|
||||
break;
|
||||
|
||||
case ACPI_GPE_TYPE_WAKE_RUN:
|
||||
|
||||
ACPI_SET_BIT (gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
|
||||
ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
|
||||
|
||||
/*lint -fallthrough */
|
||||
|
||||
case ACPI_GPE_TYPE_RUNTIME:
|
||||
|
||||
ACPI_SET_BIT (gpe_event_info->flags, ACPI_GPE_RUN_ENABLED);
|
||||
ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED);
|
||||
|
||||
if (write_to_hardware) {
|
||||
/* Clear the GPE (of stale events), then enable it */
|
||||
|
||||
status = acpi_hw_clear_gpe (gpe_event_info);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
return_ACPI_STATUS (status);
|
||||
status = acpi_hw_clear_gpe(gpe_event_info);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/* Enable the requested runtime GPE */
|
||||
|
||||
status = acpi_hw_write_gpe_enable_reg (gpe_event_info);
|
||||
status = acpi_hw_write_gpe_enable_reg(gpe_event_info);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_disable_gpe
|
||||
@ -253,36 +239,33 @@ acpi_ev_enable_gpe (
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ev_disable_gpe (
|
||||
struct acpi_gpe_event_info *gpe_event_info)
|
||||
acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info)
|
||||
{
|
||||
acpi_status status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("ev_disable_gpe");
|
||||
acpi_status status;
|
||||
|
||||
ACPI_FUNCTION_TRACE("ev_disable_gpe");
|
||||
|
||||
if (!(gpe_event_info->flags & ACPI_GPE_ENABLE_MASK)) {
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
/* Make sure HW enable masks are updated */
|
||||
|
||||
status = acpi_ev_update_gpe_enable_masks (gpe_event_info, ACPI_GPE_DISABLE);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
return_ACPI_STATUS (status);
|
||||
status =
|
||||
acpi_ev_update_gpe_enable_masks(gpe_event_info, ACPI_GPE_DISABLE);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/* Mark wake-disabled or HW disable, or both */
|
||||
|
||||
switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) {
|
||||
case ACPI_GPE_TYPE_WAKE:
|
||||
ACPI_CLEAR_BIT (gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
|
||||
ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
|
||||
break;
|
||||
|
||||
case ACPI_GPE_TYPE_WAKE_RUN:
|
||||
ACPI_CLEAR_BIT (gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
|
||||
ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
|
||||
|
||||
/*lint -fallthrough */
|
||||
|
||||
@ -290,18 +273,17 @@ acpi_ev_disable_gpe (
|
||||
|
||||
/* Disable the requested runtime GPE */
|
||||
|
||||
ACPI_CLEAR_BIT (gpe_event_info->flags, ACPI_GPE_RUN_ENABLED);
|
||||
status = acpi_hw_write_gpe_enable_reg (gpe_event_info);
|
||||
ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED);
|
||||
status = acpi_hw_write_gpe_enable_reg(gpe_event_info);
|
||||
break;
|
||||
|
||||
default:
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_get_gpe_event_info
|
||||
@ -319,18 +301,14 @@ acpi_ev_disable_gpe (
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
struct acpi_gpe_event_info *
|
||||
acpi_ev_get_gpe_event_info (
|
||||
acpi_handle gpe_device,
|
||||
u32 gpe_number)
|
||||
struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
|
||||
u32 gpe_number)
|
||||
{
|
||||
union acpi_operand_object *obj_desc;
|
||||
struct acpi_gpe_block_info *gpe_block;
|
||||
acpi_native_uint i;
|
||||
|
||||
|
||||
ACPI_FUNCTION_ENTRY ();
|
||||
union acpi_operand_object *obj_desc;
|
||||
struct acpi_gpe_block_info *gpe_block;
|
||||
acpi_native_uint i;
|
||||
|
||||
ACPI_FUNCTION_ENTRY();
|
||||
|
||||
/* A NULL gpe_block means use the FADT-defined GPE block(s) */
|
||||
|
||||
@ -340,11 +318,14 @@ acpi_ev_get_gpe_event_info (
|
||||
for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++) {
|
||||
gpe_block = acpi_gbl_gpe_fadt_blocks[i];
|
||||
if (gpe_block) {
|
||||
if ((gpe_number >= gpe_block->block_base_number) &&
|
||||
(gpe_number < gpe_block->block_base_number +
|
||||
(gpe_block->register_count * 8))) {
|
||||
return (&gpe_block->event_info[gpe_number -
|
||||
gpe_block->block_base_number]);
|
||||
if ((gpe_number >= gpe_block->block_base_number)
|
||||
&& (gpe_number <
|
||||
gpe_block->block_base_number +
|
||||
(gpe_block->register_count * 8))) {
|
||||
return (&gpe_block->
|
||||
event_info[gpe_number -
|
||||
gpe_block->
|
||||
block_base_number]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -356,23 +337,25 @@ acpi_ev_get_gpe_event_info (
|
||||
|
||||
/* A Non-NULL gpe_device means this is a GPE Block Device */
|
||||
|
||||
obj_desc = acpi_ns_get_attached_object ((struct acpi_namespace_node *) gpe_device);
|
||||
if (!obj_desc ||
|
||||
!obj_desc->device.gpe_block) {
|
||||
obj_desc =
|
||||
acpi_ns_get_attached_object((struct acpi_namespace_node *)
|
||||
gpe_device);
|
||||
if (!obj_desc || !obj_desc->device.gpe_block) {
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
gpe_block = obj_desc->device.gpe_block;
|
||||
|
||||
if ((gpe_number >= gpe_block->block_base_number) &&
|
||||
(gpe_number < gpe_block->block_base_number + (gpe_block->register_count * 8))) {
|
||||
return (&gpe_block->event_info[gpe_number - gpe_block->block_base_number]);
|
||||
(gpe_number <
|
||||
gpe_block->block_base_number + (gpe_block->register_count * 8))) {
|
||||
return (&gpe_block->
|
||||
event_info[gpe_number - gpe_block->block_base_number]);
|
||||
}
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_gpe_detect
|
||||
@ -387,23 +370,20 @@ acpi_ev_get_gpe_event_info (
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
u32
|
||||
acpi_ev_gpe_detect (
|
||||
struct acpi_gpe_xrupt_info *gpe_xrupt_list)
|
||||
u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
|
||||
{
|
||||
u32 int_status = ACPI_INTERRUPT_NOT_HANDLED;
|
||||
u8 enabled_status_byte;
|
||||
struct acpi_gpe_register_info *gpe_register_info;
|
||||
u32 status_reg;
|
||||
u32 enable_reg;
|
||||
u32 flags;
|
||||
acpi_status status;
|
||||
struct acpi_gpe_block_info *gpe_block;
|
||||
acpi_native_uint i;
|
||||
acpi_native_uint j;
|
||||
u32 int_status = ACPI_INTERRUPT_NOT_HANDLED;
|
||||
u8 enabled_status_byte;
|
||||
struct acpi_gpe_register_info *gpe_register_info;
|
||||
u32 status_reg;
|
||||
u32 enable_reg;
|
||||
u32 flags;
|
||||
acpi_status status;
|
||||
struct acpi_gpe_block_info *gpe_block;
|
||||
acpi_native_uint i;
|
||||
acpi_native_uint j;
|
||||
|
||||
|
||||
ACPI_FUNCTION_NAME ("ev_gpe_detect");
|
||||
ACPI_FUNCTION_NAME("ev_gpe_detect");
|
||||
|
||||
/* Check for the case where there are no GPEs */
|
||||
|
||||
@ -413,7 +393,7 @@ acpi_ev_gpe_detect (
|
||||
|
||||
/* Examine all GPE blocks attached to this interrupt level */
|
||||
|
||||
flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
|
||||
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
|
||||
gpe_block = gpe_xrupt_list->gpe_block_list_head;
|
||||
while (gpe_block) {
|
||||
/*
|
||||
@ -428,23 +408,30 @@ acpi_ev_gpe_detect (
|
||||
|
||||
/* Read the Status Register */
|
||||
|
||||
status = acpi_hw_low_level_read (ACPI_GPE_REGISTER_WIDTH, &status_reg,
|
||||
&gpe_register_info->status_address);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
status =
|
||||
acpi_hw_low_level_read(ACPI_GPE_REGISTER_WIDTH,
|
||||
&status_reg,
|
||||
&gpe_register_info->
|
||||
status_address);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
||||
/* Read the Enable Register */
|
||||
|
||||
status = acpi_hw_low_level_read (ACPI_GPE_REGISTER_WIDTH, &enable_reg,
|
||||
&gpe_register_info->enable_address);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
status =
|
||||
acpi_hw_low_level_read(ACPI_GPE_REGISTER_WIDTH,
|
||||
&enable_reg,
|
||||
&gpe_register_info->
|
||||
enable_address);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
|
||||
"Read GPE Register at GPE%X: Status=%02X, Enable=%02X\n",
|
||||
gpe_register_info->base_gpe_number, status_reg, enable_reg));
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS,
|
||||
"Read GPE Register at GPE%X: Status=%02X, Enable=%02X\n",
|
||||
gpe_register_info->base_gpe_number,
|
||||
status_reg, enable_reg));
|
||||
|
||||
/* Check if there is anything active at all in this register */
|
||||
|
||||
@ -460,14 +447,21 @@ acpi_ev_gpe_detect (
|
||||
for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
|
||||
/* Examine one GPE bit */
|
||||
|
||||
if (enabled_status_byte & acpi_gbl_decode_to8bit[j]) {
|
||||
if (enabled_status_byte &
|
||||
acpi_gbl_decode_to8bit[j]) {
|
||||
/*
|
||||
* Found an active GPE. Dispatch the event to a handler
|
||||
* or method.
|
||||
*/
|
||||
int_status |= acpi_ev_gpe_dispatch (
|
||||
&gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j],
|
||||
(u32) j + gpe_register_info->base_gpe_number);
|
||||
int_status |=
|
||||
acpi_ev_gpe_dispatch(&gpe_block->
|
||||
event_info[(i *
|
||||
ACPI_GPE_REGISTER_WIDTH)
|
||||
+
|
||||
j],
|
||||
(u32) j +
|
||||
gpe_register_info->
|
||||
base_gpe_number);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -475,13 +469,12 @@ acpi_ev_gpe_detect (
|
||||
gpe_block = gpe_block->next;
|
||||
}
|
||||
|
||||
unlock_and_exit:
|
||||
unlock_and_exit:
|
||||
|
||||
acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
|
||||
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
||||
return (int_status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_asynch_execute_gpe_method
|
||||
@ -498,45 +491,41 @@ unlock_and_exit:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static void ACPI_SYSTEM_XFACE
|
||||
acpi_ev_asynch_execute_gpe_method (
|
||||
void *context)
|
||||
static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
|
||||
{
|
||||
struct acpi_gpe_event_info *gpe_event_info = (void *) context;
|
||||
u32 gpe_number = 0;
|
||||
acpi_status status;
|
||||
struct acpi_gpe_event_info local_gpe_event_info;
|
||||
struct acpi_parameter_info info;
|
||||
struct acpi_gpe_event_info *gpe_event_info = (void *)context;
|
||||
u32 gpe_number = 0;
|
||||
acpi_status status;
|
||||
struct acpi_gpe_event_info local_gpe_event_info;
|
||||
struct acpi_parameter_info info;
|
||||
|
||||
ACPI_FUNCTION_TRACE("ev_asynch_execute_gpe_method");
|
||||
|
||||
ACPI_FUNCTION_TRACE ("ev_asynch_execute_gpe_method");
|
||||
|
||||
|
||||
status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
/* Must revalidate the gpe_number/gpe_block */
|
||||
|
||||
if (!acpi_ev_valid_gpe_event (gpe_event_info)) {
|
||||
status = acpi_ut_release_mutex (ACPI_MTX_EVENTS);
|
||||
if (!acpi_ev_valid_gpe_event(gpe_event_info)) {
|
||||
status = acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
/* Set the GPE flags for return to enabled state */
|
||||
|
||||
(void) acpi_ev_enable_gpe (gpe_event_info, FALSE);
|
||||
(void)acpi_ev_enable_gpe(gpe_event_info, FALSE);
|
||||
|
||||
/*
|
||||
* Take a snapshot of the GPE info for this level - we copy the
|
||||
* info to prevent a race condition with remove_handler/remove_block.
|
||||
*/
|
||||
ACPI_MEMCPY (&local_gpe_event_info, gpe_event_info,
|
||||
sizeof (struct acpi_gpe_event_info));
|
||||
ACPI_MEMCPY(&local_gpe_event_info, gpe_event_info,
|
||||
sizeof(struct acpi_gpe_event_info));
|
||||
|
||||
status = acpi_ut_release_mutex (ACPI_MTX_EVENTS);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
status = acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
@ -545,44 +534,40 @@ acpi_ev_asynch_execute_gpe_method (
|
||||
* time to avoid race with ev_gpe_install_handler
|
||||
*/
|
||||
if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) ==
|
||||
ACPI_GPE_DISPATCH_METHOD) {
|
||||
ACPI_GPE_DISPATCH_METHOD) {
|
||||
/*
|
||||
* Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx
|
||||
* control method that corresponds to this GPE
|
||||
*/
|
||||
info.node = local_gpe_event_info.dispatch.method_node;
|
||||
info.parameters = ACPI_CAST_PTR (union acpi_operand_object *, gpe_event_info);
|
||||
info.parameters =
|
||||
ACPI_CAST_PTR(union acpi_operand_object *, gpe_event_info);
|
||||
info.parameter_type = ACPI_PARAM_GPE;
|
||||
|
||||
status = acpi_ns_evaluate_by_handle (&info);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
ACPI_REPORT_ERROR ((
|
||||
"%s while evaluating method [%4.4s] for GPE[%2X]\n",
|
||||
acpi_format_exception (status),
|
||||
acpi_ut_get_node_name (local_gpe_event_info.dispatch.method_node),
|
||||
gpe_number));
|
||||
status = acpi_ns_evaluate_by_handle(&info);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_REPORT_ERROR(("%s while evaluating method [%4.4s] for GPE[%2X]\n", acpi_format_exception(status), acpi_ut_get_node_name(local_gpe_event_info.dispatch.method_node), gpe_number));
|
||||
}
|
||||
}
|
||||
|
||||
if ((local_gpe_event_info.flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
|
||||
ACPI_GPE_LEVEL_TRIGGERED) {
|
||||
ACPI_GPE_LEVEL_TRIGGERED) {
|
||||
/*
|
||||
* GPE is level-triggered, we clear the GPE status bit after
|
||||
* handling the event.
|
||||
*/
|
||||
status = acpi_hw_clear_gpe (&local_gpe_event_info);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
status = acpi_hw_clear_gpe(&local_gpe_event_info);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_VOID;
|
||||
}
|
||||
}
|
||||
|
||||
/* Enable this GPE */
|
||||
|
||||
(void) acpi_hw_write_gpe_enable_reg (&local_gpe_event_info);
|
||||
(void)acpi_hw_write_gpe_enable_reg(&local_gpe_event_info);
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_gpe_dispatch
|
||||
@ -600,38 +585,31 @@ acpi_ev_asynch_execute_gpe_method (
|
||||
******************************************************************************/
|
||||
|
||||
u32
|
||||
acpi_ev_gpe_dispatch (
|
||||
struct acpi_gpe_event_info *gpe_event_info,
|
||||
u32 gpe_number)
|
||||
acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
|
||||
{
|
||||
acpi_status status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("ev_gpe_dispatch");
|
||||
acpi_status status;
|
||||
|
||||
ACPI_FUNCTION_TRACE("ev_gpe_dispatch");
|
||||
|
||||
/*
|
||||
* If edge-triggered, clear the GPE status bit now. Note that
|
||||
* level-triggered events are cleared after the GPE is serviced.
|
||||
*/
|
||||
if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
|
||||
ACPI_GPE_EDGE_TRIGGERED) {
|
||||
status = acpi_hw_clear_gpe (gpe_event_info);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
ACPI_REPORT_ERROR ((
|
||||
"acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n",
|
||||
acpi_format_exception (status), gpe_number));
|
||||
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
|
||||
ACPI_GPE_EDGE_TRIGGERED) {
|
||||
status = acpi_hw_clear_gpe(gpe_event_info);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number));
|
||||
return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
|
||||
}
|
||||
}
|
||||
|
||||
/* 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);
|
||||
ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_SYSTEM_RUNNING);
|
||||
} else {
|
||||
ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_SYSTEM_RUNNING);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -648,19 +626,19 @@ acpi_ev_gpe_dispatch (
|
||||
* Invoke the installed handler (at interrupt level)
|
||||
* Ignore return status for now. TBD: leave GPE disabled on error?
|
||||
*/
|
||||
(void) gpe_event_info->dispatch.handler->address (
|
||||
gpe_event_info->dispatch.handler->context);
|
||||
(void)gpe_event_info->dispatch.handler->address(gpe_event_info->
|
||||
dispatch.
|
||||
handler->
|
||||
context);
|
||||
|
||||
/* It is now safe to clear level-triggered events. */
|
||||
|
||||
if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
|
||||
ACPI_GPE_LEVEL_TRIGGERED) {
|
||||
status = acpi_hw_clear_gpe (gpe_event_info);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
ACPI_REPORT_ERROR ((
|
||||
"acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n",
|
||||
acpi_format_exception (status), gpe_number));
|
||||
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
|
||||
ACPI_GPE_LEVEL_TRIGGERED) {
|
||||
status = acpi_hw_clear_gpe(gpe_event_info);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number));
|
||||
return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -671,24 +649,21 @@ acpi_ev_gpe_dispatch (
|
||||
* Disable GPE, so it doesn't keep firing before the method has a
|
||||
* chance to run.
|
||||
*/
|
||||
status = acpi_ev_disable_gpe (gpe_event_info);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
ACPI_REPORT_ERROR ((
|
||||
"acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n",
|
||||
acpi_format_exception (status), gpe_number));
|
||||
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
|
||||
status = acpi_ev_disable_gpe(gpe_event_info);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", acpi_format_exception(status), gpe_number));
|
||||
return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
|
||||
}
|
||||
|
||||
/*
|
||||
* Execute the method associated with the GPE
|
||||
* NOTE: Level-triggered GPEs are cleared after the method completes.
|
||||
*/
|
||||
status = acpi_os_queue_for_execution (OSD_PRIORITY_GPE,
|
||||
acpi_ev_asynch_execute_gpe_method, gpe_event_info);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
ACPI_REPORT_ERROR ((
|
||||
"acpi_ev_gpe_dispatch: %s, Unable to queue handler for GPE[%2X] - event disabled\n",
|
||||
acpi_format_exception (status), gpe_number));
|
||||
status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE,
|
||||
acpi_ev_asynch_execute_gpe_method,
|
||||
gpe_event_info);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to queue handler for GPE[%2X] - event disabled\n", acpi_format_exception(status), gpe_number));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -696,28 +671,23 @@ acpi_ev_gpe_dispatch (
|
||||
|
||||
/* No handler or method to run! */
|
||||
|
||||
ACPI_REPORT_ERROR ((
|
||||
"acpi_ev_gpe_dispatch: No handler or method for GPE[%2X], disabling event\n",
|
||||
gpe_number));
|
||||
ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: No handler or method for GPE[%2X], disabling event\n", gpe_number));
|
||||
|
||||
/*
|
||||
* 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);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
ACPI_REPORT_ERROR ((
|
||||
"acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n",
|
||||
acpi_format_exception (status), gpe_number));
|
||||
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
|
||||
status = acpi_ev_disable_gpe(gpe_event_info);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", acpi_format_exception(status), gpe_number));
|
||||
return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return_VALUE (ACPI_INTERRUPT_HANDLED);
|
||||
return_VALUE(ACPI_INTERRUPT_HANDLED);
|
||||
}
|
||||
|
||||
|
||||
#ifdef ACPI_GPE_NOTIFY_CHECK
|
||||
/*******************************************************************************
|
||||
* TBD: NOT USED, PROTOTYPE ONLY AND WILL PROBABLY BE REMOVED
|
||||
@ -736,35 +706,29 @@ acpi_ev_gpe_dispatch (
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ev_check_for_wake_only_gpe (
|
||||
struct acpi_gpe_event_info *gpe_event_info)
|
||||
acpi_ev_check_for_wake_only_gpe(struct acpi_gpe_event_info *gpe_event_info)
|
||||
{
|
||||
acpi_status status;
|
||||
acpi_status status;
|
||||
|
||||
ACPI_FUNCTION_TRACE("ev_check_for_wake_only_gpe");
|
||||
|
||||
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 */ {
|
||||
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);
|
||||
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_ev_set_gpe_type(gpe_event_info, ACPI_GPE_TYPE_WAKE);
|
||||
|
||||
ACPI_REPORT_INFO (("GPE %p was updated from wake/run to wake-only\n",
|
||||
gpe_event_info));
|
||||
ACPI_REPORT_INFO(("GPE %p was updated from wake/run to wake-only\n", gpe_event_info));
|
||||
|
||||
/* This was a wake-only GPE */
|
||||
|
||||
return_ACPI_STATUS (AE_WAKE_ONLY_GPE);
|
||||
return_ACPI_STATUS(AE_WAKE_ONLY_GPE);
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -47,12 +47,10 @@
|
||||
#include <acpi/acinterp.h>
|
||||
|
||||
#define _COMPONENT ACPI_EVENTS
|
||||
ACPI_MODULE_NAME ("evmisc")
|
||||
|
||||
ACPI_MODULE_NAME("evmisc")
|
||||
|
||||
#ifdef ACPI_DEBUG_OUTPUT
|
||||
static const char *acpi_notify_value_names[] =
|
||||
{
|
||||
static const char *acpi_notify_value_names[] = {
|
||||
"Bus Check",
|
||||
"Device Check",
|
||||
"Device Wake",
|
||||
@ -66,18 +64,11 @@ static const char *acpi_notify_value_names[] =
|
||||
|
||||
/* Local prototypes */
|
||||
|
||||
static void ACPI_SYSTEM_XFACE
|
||||
acpi_ev_notify_dispatch (
|
||||
void *context);
|
||||
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);
|
||||
static void ACPI_SYSTEM_XFACE acpi_ev_global_lock_thread(void *context);
|
||||
|
||||
static u32 acpi_ev_global_lock_handler(void *context);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -93,9 +84,7 @@ acpi_ev_global_lock_handler (
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
u8
|
||||
acpi_ev_is_notify_object (
|
||||
struct acpi_namespace_node *node)
|
||||
u8 acpi_ev_is_notify_object(struct acpi_namespace_node *node)
|
||||
{
|
||||
switch (node->type) {
|
||||
case ACPI_TYPE_DEVICE:
|
||||
@ -112,7 +101,6 @@ acpi_ev_is_notify_object (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_queue_notify_request
|
||||
@ -128,18 +116,15 @@ acpi_ev_is_notify_object (
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ev_queue_notify_request (
|
||||
struct acpi_namespace_node *node,
|
||||
u32 notify_value)
|
||||
acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
|
||||
u32 notify_value)
|
||||
{
|
||||
union acpi_operand_object *obj_desc;
|
||||
union acpi_operand_object *handler_obj = NULL;
|
||||
union acpi_generic_state *notify_info;
|
||||
acpi_status status = AE_OK;
|
||||
|
||||
|
||||
ACPI_FUNCTION_NAME ("ev_queue_notify_request");
|
||||
union acpi_operand_object *obj_desc;
|
||||
union acpi_operand_object *handler_obj = NULL;
|
||||
union acpi_generic_state *notify_info;
|
||||
acpi_status status = AE_OK;
|
||||
|
||||
ACPI_FUNCTION_NAME("ev_queue_notify_request");
|
||||
|
||||
/*
|
||||
* For value 3 (Ejection Request), some device method may need to be run.
|
||||
@ -148,22 +133,22 @@ acpi_ev_queue_notify_request (
|
||||
* For value 0x80 (Status Change) on the power button or sleep button,
|
||||
* initiate soft-off or sleep operation?
|
||||
*/
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
||||
"Dispatching Notify(%X) on node %p\n", notify_value, node));
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"Dispatching Notify(%X) on node %p\n", notify_value,
|
||||
node));
|
||||
|
||||
if (notify_value <= 7) {
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: %s\n",
|
||||
acpi_notify_value_names[notify_value]));
|
||||
}
|
||||
else {
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
||||
"Notify value: 0x%2.2X **Device Specific**\n",
|
||||
notify_value));
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Notify value: %s\n",
|
||||
acpi_notify_value_names[notify_value]));
|
||||
} else {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"Notify value: 0x%2.2X **Device Specific**\n",
|
||||
notify_value));
|
||||
}
|
||||
|
||||
/* Get the notify object attached to the NS Node */
|
||||
|
||||
obj_desc = acpi_ns_get_attached_object (node);
|
||||
obj_desc = acpi_ns_get_attached_object(node);
|
||||
if (obj_desc) {
|
||||
/* We have the notify object, Get the right handler */
|
||||
|
||||
@ -174,10 +159,11 @@ acpi_ev_queue_notify_request (
|
||||
case ACPI_TYPE_POWER:
|
||||
|
||||
if (notify_value <= ACPI_MAX_SYS_NOTIFY) {
|
||||
handler_obj = obj_desc->common_notify.system_notify;
|
||||
}
|
||||
else {
|
||||
handler_obj = obj_desc->common_notify.device_notify;
|
||||
handler_obj =
|
||||
obj_desc->common_notify.system_notify;
|
||||
} else {
|
||||
handler_obj =
|
||||
obj_desc->common_notify.device_notify;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -189,23 +175,25 @@ acpi_ev_queue_notify_request (
|
||||
|
||||
/* If there is any handler to run, schedule the dispatcher */
|
||||
|
||||
if ((acpi_gbl_system_notify.handler && (notify_value <= ACPI_MAX_SYS_NOTIFY)) ||
|
||||
(acpi_gbl_device_notify.handler && (notify_value > ACPI_MAX_SYS_NOTIFY)) ||
|
||||
handler_obj) {
|
||||
notify_info = acpi_ut_create_generic_state ();
|
||||
if ((acpi_gbl_system_notify.handler
|
||||
&& (notify_value <= ACPI_MAX_SYS_NOTIFY))
|
||||
|| (acpi_gbl_device_notify.handler
|
||||
&& (notify_value > ACPI_MAX_SYS_NOTIFY)) || handler_obj) {
|
||||
notify_info = acpi_ut_create_generic_state();
|
||||
if (!notify_info) {
|
||||
return (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
notify_info->common.data_type = ACPI_DESC_TYPE_STATE_NOTIFY;
|
||||
notify_info->notify.node = node;
|
||||
notify_info->notify.value = (u16) notify_value;
|
||||
notify_info->notify.node = node;
|
||||
notify_info->notify.value = (u16) notify_value;
|
||||
notify_info->notify.handler_obj = handler_obj;
|
||||
|
||||
status = acpi_os_queue_for_execution (OSD_PRIORITY_HIGH,
|
||||
acpi_ev_notify_dispatch, notify_info);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
acpi_ut_delete_generic_state (notify_info);
|
||||
status = acpi_os_queue_for_execution(OSD_PRIORITY_HIGH,
|
||||
acpi_ev_notify_dispatch,
|
||||
notify_info);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
acpi_ut_delete_generic_state(notify_info);
|
||||
}
|
||||
}
|
||||
|
||||
@ -214,15 +202,15 @@ acpi_ev_queue_notify_request (
|
||||
* There is no per-device notify handler for this device.
|
||||
* This may or may not be a problem.
|
||||
*/
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
||||
"No notify handler for Notify(%4.4s, %X) node %p\n",
|
||||
acpi_ut_get_node_name (node), notify_value, node));
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"No notify handler for Notify(%4.4s, %X) node %p\n",
|
||||
acpi_ut_get_node_name(node), notify_value,
|
||||
node));
|
||||
}
|
||||
|
||||
return (status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_notify_dispatch
|
||||
@ -236,18 +224,15 @@ acpi_ev_queue_notify_request (
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static void ACPI_SYSTEM_XFACE
|
||||
acpi_ev_notify_dispatch (
|
||||
void *context)
|
||||
static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context)
|
||||
{
|
||||
union acpi_generic_state *notify_info = (union acpi_generic_state *) context;
|
||||
acpi_notify_handler global_handler = NULL;
|
||||
void *global_context = NULL;
|
||||
union acpi_operand_object *handler_obj;
|
||||
|
||||
|
||||
ACPI_FUNCTION_ENTRY ();
|
||||
union acpi_generic_state *notify_info =
|
||||
(union acpi_generic_state *)context;
|
||||
acpi_notify_handler global_handler = NULL;
|
||||
void *global_context = NULL;
|
||||
union acpi_operand_object *handler_obj;
|
||||
|
||||
ACPI_FUNCTION_ENTRY();
|
||||
|
||||
/*
|
||||
* We will invoke a global notify handler if installed.
|
||||
@ -261,8 +246,7 @@ acpi_ev_notify_dispatch (
|
||||
global_handler = acpi_gbl_system_notify.handler;
|
||||
global_context = acpi_gbl_system_notify.context;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
/* Global driver notification handler */
|
||||
|
||||
if (acpi_gbl_device_notify.handler) {
|
||||
@ -274,25 +258,24 @@ acpi_ev_notify_dispatch (
|
||||
/* Invoke the system handler first, if present */
|
||||
|
||||
if (global_handler) {
|
||||
global_handler (notify_info->notify.node, notify_info->notify.value,
|
||||
global_context);
|
||||
global_handler(notify_info->notify.node,
|
||||
notify_info->notify.value, global_context);
|
||||
}
|
||||
|
||||
/* Now invoke the per-device handler, if present */
|
||||
|
||||
handler_obj = notify_info->notify.handler_obj;
|
||||
if (handler_obj) {
|
||||
handler_obj->notify.handler (notify_info->notify.node,
|
||||
notify_info->notify.value,
|
||||
handler_obj->notify.context);
|
||||
handler_obj->notify.handler(notify_info->notify.node,
|
||||
notify_info->notify.value,
|
||||
handler_obj->notify.context);
|
||||
}
|
||||
|
||||
/* All done with the info object */
|
||||
|
||||
acpi_ut_delete_generic_state (notify_info);
|
||||
acpi_ut_delete_generic_state(notify_info);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_global_lock_thread
|
||||
@ -307,27 +290,24 @@ acpi_ev_notify_dispatch (
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static void ACPI_SYSTEM_XFACE
|
||||
acpi_ev_global_lock_thread (
|
||||
void *context)
|
||||
static void ACPI_SYSTEM_XFACE acpi_ev_global_lock_thread(void *context)
|
||||
{
|
||||
acpi_status status;
|
||||
|
||||
acpi_status status;
|
||||
|
||||
/* Signal threads that are waiting for the lock */
|
||||
|
||||
if (acpi_gbl_global_lock_thread_count) {
|
||||
/* 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_REPORT_ERROR (("Could not signal Global Lock semaphore\n"));
|
||||
status =
|
||||
acpi_os_signal_semaphore(acpi_gbl_global_lock_semaphore,
|
||||
acpi_gbl_global_lock_thread_count);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_REPORT_ERROR(("Could not signal Global Lock semaphore\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_global_lock_handler
|
||||
@ -342,20 +322,17 @@ acpi_ev_global_lock_thread (
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static u32
|
||||
acpi_ev_global_lock_handler (
|
||||
void *context)
|
||||
static u32 acpi_ev_global_lock_handler(void *context)
|
||||
{
|
||||
u8 acquired = FALSE;
|
||||
acpi_status status;
|
||||
|
||||
u8 acquired = FALSE;
|
||||
acpi_status status;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
ACPI_ACQUIRE_GLOBAL_LOCK (acpi_gbl_common_fACS.global_lock, acquired);
|
||||
ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired);
|
||||
if (acquired) {
|
||||
/* Got the lock, now wake all threads waiting for it */
|
||||
|
||||
@ -363,11 +340,11 @@ acpi_ev_global_lock_handler (
|
||||
|
||||
/* Run the Global Lock thread which will signal all waiting threads */
|
||||
|
||||
status = acpi_os_queue_for_execution (OSD_PRIORITY_HIGH,
|
||||
acpi_ev_global_lock_thread, context);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
ACPI_REPORT_ERROR (("Could not queue Global Lock thread, %s\n",
|
||||
acpi_format_exception (status)));
|
||||
status = acpi_os_queue_for_execution(OSD_PRIORITY_HIGH,
|
||||
acpi_ev_global_lock_thread,
|
||||
context);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_REPORT_ERROR(("Could not queue Global Lock thread, %s\n", acpi_format_exception(status)));
|
||||
|
||||
return (ACPI_INTERRUPT_NOT_HANDLED);
|
||||
}
|
||||
@ -376,7 +353,6 @@ acpi_ev_global_lock_handler (
|
||||
return (ACPI_INTERRUPT_HANDLED);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_init_global_lock_handler
|
||||
@ -389,19 +365,16 @@ acpi_ev_global_lock_handler (
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ev_init_global_lock_handler (
|
||||
void)
|
||||
acpi_status acpi_ev_init_global_lock_handler(void)
|
||||
{
|
||||
acpi_status status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("ev_init_global_lock_handler");
|
||||
acpi_status status;
|
||||
|
||||
ACPI_FUNCTION_TRACE("ev_init_global_lock_handler");
|
||||
|
||||
acpi_gbl_global_lock_present = TRUE;
|
||||
status = acpi_install_fixed_event_handler (ACPI_EVENT_GLOBAL,
|
||||
acpi_ev_global_lock_handler, NULL);
|
||||
status = acpi_install_fixed_event_handler(ACPI_EVENT_GLOBAL,
|
||||
acpi_ev_global_lock_handler,
|
||||
NULL);
|
||||
|
||||
/*
|
||||
* If the global lock does not exist on this platform, the attempt
|
||||
@ -411,17 +384,15 @@ acpi_ev_init_global_lock_handler (
|
||||
* with an error.
|
||||
*/
|
||||
if (status == AE_NO_HARDWARE_RESPONSE) {
|
||||
ACPI_REPORT_ERROR ((
|
||||
"No response from Global Lock hardware, disabling lock\n"));
|
||||
ACPI_REPORT_ERROR(("No response from Global Lock hardware, disabling lock\n"));
|
||||
|
||||
acpi_gbl_global_lock_present = FALSE;
|
||||
status = AE_OK;
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (status);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_acquire_global_lock
|
||||
@ -434,22 +405,18 @@ acpi_ev_init_global_lock_handler (
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ev_acquire_global_lock (
|
||||
u16 timeout)
|
||||
acpi_status acpi_ev_acquire_global_lock(u16 timeout)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
u8 acquired = FALSE;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("ev_acquire_global_lock");
|
||||
acpi_status status = AE_OK;
|
||||
u8 acquired = FALSE;
|
||||
|
||||
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);
|
||||
return_ACPI_STATUS(AE_NO_GLOBAL_LOCK);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -462,37 +429,37 @@ acpi_ev_acquire_global_lock (
|
||||
* we are done
|
||||
*/
|
||||
if (acpi_gbl_global_lock_acquired) {
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
/* We must acquire the actual hardware lock */
|
||||
|
||||
ACPI_ACQUIRE_GLOBAL_LOCK (acpi_gbl_common_fACS.global_lock, acquired);
|
||||
ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired);
|
||||
if (acquired) {
|
||||
/* We got the lock */
|
||||
/* We got the lock */
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Acquired the HW Global Lock\n"));
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
||||
"Acquired the HW Global Lock\n"));
|
||||
|
||||
acpi_gbl_global_lock_acquired = TRUE;
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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 the HW Global Lock\n"));
|
||||
|
||||
/*
|
||||
* Acquire the global lock semaphore first.
|
||||
* Since this wait will block, we must release the interpreter
|
||||
*/
|
||||
status = acpi_ex_system_wait_semaphore (acpi_gbl_global_lock_semaphore,
|
||||
timeout);
|
||||
return_ACPI_STATUS (status);
|
||||
status = acpi_ex_system_wait_semaphore(acpi_gbl_global_lock_semaphore,
|
||||
timeout);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_release_global_lock
|
||||
@ -505,21 +472,16 @@ acpi_ev_acquire_global_lock (
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ev_release_global_lock (
|
||||
void)
|
||||
acpi_status acpi_ev_release_global_lock(void)
|
||||
{
|
||||
u8 pending = FALSE;
|
||||
acpi_status status = AE_OK;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("ev_release_global_lock");
|
||||
u8 pending = FALSE;
|
||||
acpi_status status = AE_OK;
|
||||
|
||||
ACPI_FUNCTION_TRACE("ev_release_global_lock");
|
||||
|
||||
if (!acpi_gbl_global_lock_thread_count) {
|
||||
ACPI_REPORT_WARNING((
|
||||
"Cannot release HW Global Lock, it has not been acquired\n"));
|
||||
return_ACPI_STATUS (AE_NOT_ACQUIRED);
|
||||
ACPI_REPORT_WARNING(("Cannot release HW Global Lock, it has not been acquired\n"));
|
||||
return_ACPI_STATUS(AE_NOT_ACQUIRED);
|
||||
}
|
||||
|
||||
/* One fewer thread has the global lock */
|
||||
@ -528,14 +490,14 @@ acpi_ev_release_global_lock (
|
||||
if (acpi_gbl_global_lock_thread_count) {
|
||||
/* There are still some threads holding the lock, cannot release */
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
/*
|
||||
* No more threads holding lock, we can do the actual hardware
|
||||
* release
|
||||
*/
|
||||
ACPI_RELEASE_GLOBAL_LOCK (acpi_gbl_common_fACS.global_lock, pending);
|
||||
ACPI_RELEASE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, pending);
|
||||
acpi_gbl_global_lock_acquired = FALSE;
|
||||
|
||||
/*
|
||||
@ -543,14 +505,13 @@ acpi_ev_release_global_lock (
|
||||
* register
|
||||
*/
|
||||
if (pending) {
|
||||
status = acpi_set_register (ACPI_BITREG_GLOBAL_LOCK_RELEASE,
|
||||
1, ACPI_MTX_LOCK);
|
||||
status = acpi_set_register(ACPI_BITREG_GLOBAL_LOCK_RELEASE,
|
||||
1, ACPI_MTX_LOCK);
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (status);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_terminate
|
||||
@ -563,16 +524,12 @@ acpi_ev_release_global_lock (
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
acpi_ev_terminate (
|
||||
void)
|
||||
void acpi_ev_terminate(void)
|
||||
{
|
||||
acpi_native_uint i;
|
||||
acpi_status status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("ev_terminate");
|
||||
acpi_native_uint i;
|
||||
acpi_status status;
|
||||
|
||||
ACPI_FUNCTION_TRACE("ev_terminate");
|
||||
|
||||
if (acpi_gbl_events_initialized) {
|
||||
/*
|
||||
@ -583,38 +540,39 @@ acpi_ev_terminate (
|
||||
/* Disable all fixed events */
|
||||
|
||||
for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
|
||||
status = acpi_disable_event ((u32) i, 0);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Could not disable fixed event %d\n", (u32) i));
|
||||
status = acpi_disable_event((u32) i, 0);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Could not disable fixed event %d\n",
|
||||
(u32) i));
|
||||
}
|
||||
}
|
||||
|
||||
/* Disable all GPEs in all GPE blocks */
|
||||
|
||||
status = acpi_ev_walk_gpe_list (acpi_hw_disable_gpe_block);
|
||||
status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block);
|
||||
|
||||
/* Remove SCI handler */
|
||||
|
||||
status = acpi_ev_remove_sci_handler ();
|
||||
status = acpi_ev_remove_sci_handler();
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Could not remove SCI handler\n"));
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Could not remove SCI handler\n"));
|
||||
}
|
||||
}
|
||||
|
||||
/* Deallocate all handler objects installed within GPE info structs */
|
||||
|
||||
status = acpi_ev_walk_gpe_list (acpi_ev_delete_gpe_handlers);
|
||||
status = acpi_ev_walk_gpe_list(acpi_ev_delete_gpe_handlers);
|
||||
|
||||
/* Return to original mode if necessary */
|
||||
|
||||
if (acpi_gbl_original_mode == ACPI_SYS_MODE_LEGACY) {
|
||||
status = acpi_disable ();
|
||||
if (ACPI_FAILURE (status)) {
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "acpi_disable failed\n"));
|
||||
status = acpi_disable();
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
|
||||
"acpi_disable failed\n"));
|
||||
}
|
||||
}
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -41,14 +41,12 @@
|
||||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/acevents.h>
|
||||
#include <acpi/acnamesp.h>
|
||||
|
||||
#define _COMPONENT ACPI_EVENTS
|
||||
ACPI_MODULE_NAME ("evrgnini")
|
||||
|
||||
ACPI_MODULE_NAME("evrgnini")
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -64,34 +62,31 @@
|
||||
* DESCRIPTION: Setup a system_memory operation region
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ev_system_memory_region_setup (
|
||||
acpi_handle handle,
|
||||
u32 function,
|
||||
void *handler_context,
|
||||
void **region_context)
|
||||
acpi_ev_system_memory_region_setup(acpi_handle handle,
|
||||
u32 function,
|
||||
void *handler_context, void **region_context)
|
||||
{
|
||||
union acpi_operand_object *region_desc = (union acpi_operand_object *) handle;
|
||||
struct acpi_mem_space_context *local_region_context;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("ev_system_memory_region_setup");
|
||||
union acpi_operand_object *region_desc =
|
||||
(union acpi_operand_object *)handle;
|
||||
struct acpi_mem_space_context *local_region_context;
|
||||
|
||||
ACPI_FUNCTION_TRACE("ev_system_memory_region_setup");
|
||||
|
||||
if (function == ACPI_REGION_DEACTIVATE) {
|
||||
if (*region_context) {
|
||||
ACPI_MEM_FREE (*region_context);
|
||||
ACPI_MEM_FREE(*region_context);
|
||||
*region_context = NULL;
|
||||
}
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
/* Create a new context */
|
||||
|
||||
local_region_context = ACPI_MEM_CALLOCATE (sizeof (struct acpi_mem_space_context));
|
||||
local_region_context =
|
||||
ACPI_MEM_CALLOCATE(sizeof(struct acpi_mem_space_context));
|
||||
if (!(local_region_context)) {
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
/* Save the region length and address for use in the handler */
|
||||
@ -100,10 +95,9 @@ acpi_ev_system_memory_region_setup (
|
||||
local_region_context->address = region_desc->region.address;
|
||||
|
||||
*region_context = local_region_context;
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_io_space_region_setup
|
||||
@ -120,26 +114,21 @@ acpi_ev_system_memory_region_setup (
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ev_io_space_region_setup (
|
||||
acpi_handle handle,
|
||||
u32 function,
|
||||
void *handler_context,
|
||||
void **region_context)
|
||||
acpi_ev_io_space_region_setup(acpi_handle handle,
|
||||
u32 function,
|
||||
void *handler_context, void **region_context)
|
||||
{
|
||||
ACPI_FUNCTION_TRACE ("ev_io_space_region_setup");
|
||||
|
||||
ACPI_FUNCTION_TRACE("ev_io_space_region_setup");
|
||||
|
||||
if (function == ACPI_REGION_DEACTIVATE) {
|
||||
*region_context = NULL;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
*region_context = handler_context;
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_pci_config_region_setup
|
||||
@ -158,24 +147,21 @@ acpi_ev_io_space_region_setup (
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ev_pci_config_region_setup (
|
||||
acpi_handle handle,
|
||||
u32 function,
|
||||
void *handler_context,
|
||||
void **region_context)
|
||||
acpi_ev_pci_config_region_setup(acpi_handle handle,
|
||||
u32 function,
|
||||
void *handler_context, void **region_context)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
acpi_integer pci_value;
|
||||
struct acpi_pci_id *pci_id = *region_context;
|
||||
union acpi_operand_object *handler_obj;
|
||||
struct acpi_namespace_node *parent_node;
|
||||
struct acpi_namespace_node *pci_root_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");
|
||||
acpi_status status = AE_OK;
|
||||
acpi_integer pci_value;
|
||||
struct acpi_pci_id *pci_id = *region_context;
|
||||
union acpi_operand_object *handler_obj;
|
||||
struct acpi_namespace_node *parent_node;
|
||||
struct acpi_namespace_node *pci_root_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");
|
||||
|
||||
handler_obj = region_obj->region.handler;
|
||||
if (!handler_obj) {
|
||||
@ -183,20 +169,21 @@ acpi_ev_pci_config_region_setup (
|
||||
* No installed handler. This shouldn't happen because the dispatch
|
||||
* routine checks before we get here, but we check again just in case.
|
||||
*/
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
|
||||
"Attempting to init a region %p, with no handler\n", region_obj));
|
||||
return_ACPI_STATUS (AE_NOT_EXIST);
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
|
||||
"Attempting to init a region %p, with no handler\n",
|
||||
region_obj));
|
||||
return_ACPI_STATUS(AE_NOT_EXIST);
|
||||
}
|
||||
|
||||
*region_context = NULL;
|
||||
if (function == ACPI_REGION_DEACTIVATE) {
|
||||
if (pci_id) {
|
||||
ACPI_MEM_FREE (pci_id);
|
||||
ACPI_MEM_FREE(pci_id);
|
||||
}
|
||||
return_ACPI_STATUS (status);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
parent_node = acpi_ns_get_parent_node (region_obj->region.node);
|
||||
parent_node = acpi_ns_get_parent_node(region_obj->region.node);
|
||||
|
||||
/*
|
||||
* Get the _SEG and _BBN values from the device upon which the handler
|
||||
@ -216,22 +203,28 @@ acpi_ev_pci_config_region_setup (
|
||||
|
||||
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)) {
|
||||
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))))) {
|
||||
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)) {
|
||||
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
|
||||
@ -239,23 +232,19 @@ acpi_ev_pci_config_region_setup (
|
||||
* new PCI_Config operation region, however.
|
||||
*/
|
||||
status = AE_OK;
|
||||
}
|
||||
else {
|
||||
ACPI_REPORT_ERROR ((
|
||||
"Could not install pci_config handler for Root Bridge %4.4s, %s\n",
|
||||
acpi_ut_get_node_name (pci_root_node), acpi_format_exception (status)));
|
||||
} else {
|
||||
ACPI_REPORT_ERROR(("Could not install pci_config handler for Root Bridge %4.4s, %s\n", acpi_ut_get_node_name(pci_root_node), acpi_format_exception(status)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
pci_root_node = acpi_ns_get_parent_node (pci_root_node);
|
||||
pci_root_node = acpi_ns_get_parent_node(pci_root_node);
|
||||
}
|
||||
|
||||
/* PCI root bridge not found, use namespace root node */
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
pci_root_node = handler_obj->address_space.node;
|
||||
}
|
||||
|
||||
@ -264,14 +253,14 @@ acpi_ev_pci_config_region_setup (
|
||||
* (install_address_space_handler could have initialized it)
|
||||
*/
|
||||
if (region_obj->region.flags & AOPOBJ_SETUP_COMPLETE) {
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
/* Region is still not initialized. Create a new context */
|
||||
|
||||
pci_id = ACPI_MEM_CALLOCATE (sizeof (struct acpi_pci_id));
|
||||
pci_id = ACPI_MEM_CALLOCATE(sizeof(struct acpi_pci_id));
|
||||
if (!pci_id) {
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -283,40 +272,45 @@ acpi_ev_pci_config_region_setup (
|
||||
* 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, &pci_value);
|
||||
status =
|
||||
acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, parent_node,
|
||||
&pci_value);
|
||||
|
||||
/*
|
||||
* The default is zero, and since the allocation above zeroed
|
||||
* the data, just do nothing on failure.
|
||||
*/
|
||||
if (ACPI_SUCCESS (status)) {
|
||||
pci_id->device = ACPI_HIWORD (ACPI_LODWORD (pci_value));
|
||||
pci_id->function = ACPI_LOWORD (ACPI_LODWORD (pci_value));
|
||||
if (ACPI_SUCCESS(status)) {
|
||||
pci_id->device = ACPI_HIWORD(ACPI_LODWORD(pci_value));
|
||||
pci_id->function = ACPI_LOWORD(ACPI_LODWORD(pci_value));
|
||||
}
|
||||
|
||||
/* The PCI segment number comes from the _SEG method */
|
||||
|
||||
status = acpi_ut_evaluate_numeric_object (METHOD_NAME__SEG, pci_root_node, &pci_value);
|
||||
if (ACPI_SUCCESS (status)) {
|
||||
pci_id->segment = ACPI_LOWORD (pci_value);
|
||||
status =
|
||||
acpi_ut_evaluate_numeric_object(METHOD_NAME__SEG, pci_root_node,
|
||||
&pci_value);
|
||||
if (ACPI_SUCCESS(status)) {
|
||||
pci_id->segment = ACPI_LOWORD(pci_value);
|
||||
}
|
||||
|
||||
/* The PCI bus number comes from the _BBN method */
|
||||
|
||||
status = acpi_ut_evaluate_numeric_object (METHOD_NAME__BBN, pci_root_node, &pci_value);
|
||||
if (ACPI_SUCCESS (status)) {
|
||||
pci_id->bus = ACPI_LOWORD (pci_value);
|
||||
status =
|
||||
acpi_ut_evaluate_numeric_object(METHOD_NAME__BBN, pci_root_node,
|
||||
&pci_value);
|
||||
if (ACPI_SUCCESS(status)) {
|
||||
pci_id->bus = ACPI_LOWORD(pci_value);
|
||||
}
|
||||
|
||||
/* Complete this device's pci_id */
|
||||
|
||||
acpi_os_derive_pci_id (pci_root_node, region_obj->region.node, &pci_id);
|
||||
acpi_os_derive_pci_id(pci_root_node, region_obj->region.node, &pci_id);
|
||||
|
||||
*region_context = pci_id;
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_pci_bar_region_setup
|
||||
@ -335,19 +329,15 @@ acpi_ev_pci_config_region_setup (
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ev_pci_bar_region_setup (
|
||||
acpi_handle handle,
|
||||
u32 function,
|
||||
void *handler_context,
|
||||
void **region_context)
|
||||
acpi_ev_pci_bar_region_setup(acpi_handle handle,
|
||||
u32 function,
|
||||
void *handler_context, void **region_context)
|
||||
{
|
||||
ACPI_FUNCTION_TRACE ("ev_pci_bar_region_setup");
|
||||
ACPI_FUNCTION_TRACE("ev_pci_bar_region_setup");
|
||||
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_cmos_region_setup
|
||||
@ -366,19 +356,15 @@ acpi_ev_pci_bar_region_setup (
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ev_cmos_region_setup (
|
||||
acpi_handle handle,
|
||||
u32 function,
|
||||
void *handler_context,
|
||||
void **region_context)
|
||||
acpi_ev_cmos_region_setup(acpi_handle handle,
|
||||
u32 function,
|
||||
void *handler_context, void **region_context)
|
||||
{
|
||||
ACPI_FUNCTION_TRACE ("ev_cmos_region_setup");
|
||||
ACPI_FUNCTION_TRACE("ev_cmos_region_setup");
|
||||
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_default_region_setup
|
||||
@ -395,26 +381,21 @@ acpi_ev_cmos_region_setup (
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ev_default_region_setup (
|
||||
acpi_handle handle,
|
||||
u32 function,
|
||||
void *handler_context,
|
||||
void **region_context)
|
||||
acpi_ev_default_region_setup(acpi_handle handle,
|
||||
u32 function,
|
||||
void *handler_context, void **region_context)
|
||||
{
|
||||
ACPI_FUNCTION_TRACE ("ev_default_region_setup");
|
||||
|
||||
ACPI_FUNCTION_TRACE("ev_default_region_setup");
|
||||
|
||||
if (function == ACPI_REGION_DEACTIVATE) {
|
||||
*region_context = NULL;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
*region_context = handler_context;
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_initialize_region
|
||||
@ -438,37 +419,34 @@ acpi_ev_default_region_setup (
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ev_initialize_region (
|
||||
union acpi_operand_object *region_obj,
|
||||
u8 acpi_ns_locked)
|
||||
acpi_ev_initialize_region(union acpi_operand_object *region_obj,
|
||||
u8 acpi_ns_locked)
|
||||
{
|
||||
union acpi_operand_object *handler_obj;
|
||||
union acpi_operand_object *obj_desc;
|
||||
acpi_adr_space_type space_id;
|
||||
struct acpi_namespace_node *node;
|
||||
acpi_status status;
|
||||
struct acpi_namespace_node *method_node;
|
||||
acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG;
|
||||
union acpi_operand_object *region_obj2;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE_U32 ("ev_initialize_region", acpi_ns_locked);
|
||||
union acpi_operand_object *handler_obj;
|
||||
union acpi_operand_object *obj_desc;
|
||||
acpi_adr_space_type space_id;
|
||||
struct acpi_namespace_node *node;
|
||||
acpi_status status;
|
||||
struct acpi_namespace_node *method_node;
|
||||
acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG;
|
||||
union acpi_operand_object *region_obj2;
|
||||
|
||||
ACPI_FUNCTION_TRACE_U32("ev_initialize_region", acpi_ns_locked);
|
||||
|
||||
if (!region_obj) {
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
if (region_obj->common.flags & AOPOBJ_OBJECT_INITIALIZED) {
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
region_obj2 = acpi_ns_get_secondary_object (region_obj);
|
||||
region_obj2 = acpi_ns_get_secondary_object(region_obj);
|
||||
if (!region_obj2) {
|
||||
return_ACPI_STATUS (AE_NOT_EXIST);
|
||||
return_ACPI_STATUS(AE_NOT_EXIST);
|
||||
}
|
||||
|
||||
node = acpi_ns_get_parent_node (region_obj->region.node);
|
||||
node = acpi_ns_get_parent_node(region_obj->region.node);
|
||||
space_id = region_obj->region.space_id;
|
||||
|
||||
/* Setup defaults */
|
||||
@ -480,9 +458,9 @@ acpi_ev_initialize_region (
|
||||
|
||||
/* Find any "_REG" method associated with this region definition */
|
||||
|
||||
status = acpi_ns_search_node (*reg_name_ptr, node,
|
||||
ACPI_TYPE_METHOD, &method_node);
|
||||
if (ACPI_SUCCESS (status)) {
|
||||
status = acpi_ns_search_node(*reg_name_ptr, node,
|
||||
ACPI_TYPE_METHOD, &method_node);
|
||||
if (ACPI_SUCCESS(status)) {
|
||||
/*
|
||||
* The _REG method is optional and there can be only one per region
|
||||
* definition. This will be executed when the handler is attached
|
||||
@ -499,7 +477,7 @@ acpi_ev_initialize_region (
|
||||
/* Check to see if a handler exists */
|
||||
|
||||
handler_obj = NULL;
|
||||
obj_desc = acpi_ns_get_attached_object (node);
|
||||
obj_desc = acpi_ns_get_attached_object(node);
|
||||
if (obj_desc) {
|
||||
/* Can only be a handler if the object exists */
|
||||
|
||||
@ -527,37 +505,50 @@ acpi_ev_initialize_region (
|
||||
while (handler_obj) {
|
||||
/* Is this handler of the correct type? */
|
||||
|
||||
if (handler_obj->address_space.space_id == space_id) {
|
||||
if (handler_obj->address_space.space_id ==
|
||||
space_id) {
|
||||
/* Found correct handler */
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
|
||||
"Found handler %p for region %p in obj %p\n",
|
||||
handler_obj, region_obj, obj_desc));
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
|
||||
"Found handler %p for region %p in obj %p\n",
|
||||
handler_obj,
|
||||
region_obj,
|
||||
obj_desc));
|
||||
|
||||
status = acpi_ev_attach_region (handler_obj, region_obj,
|
||||
acpi_ns_locked);
|
||||
status =
|
||||
acpi_ev_attach_region(handler_obj,
|
||||
region_obj,
|
||||
acpi_ns_locked);
|
||||
|
||||
/*
|
||||
* Tell all users that this region is usable by running the _REG
|
||||
* method
|
||||
*/
|
||||
if (acpi_ns_locked) {
|
||||
status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
return_ACPI_STATUS (status);
|
||||
status =
|
||||
acpi_ut_release_mutex
|
||||
(ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS
|
||||
(status);
|
||||
}
|
||||
}
|
||||
|
||||
status = acpi_ev_execute_reg_method (region_obj, 1);
|
||||
status =
|
||||
acpi_ev_execute_reg_method
|
||||
(region_obj, 1);
|
||||
|
||||
if (acpi_ns_locked) {
|
||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
return_ACPI_STATUS (status);
|
||||
status =
|
||||
acpi_ut_acquire_mutex
|
||||
(ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS
|
||||
(status);
|
||||
}
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
/* Try next handler in the list */
|
||||
@ -570,15 +561,15 @@ acpi_ev_initialize_region (
|
||||
* This node does not have the handler we need;
|
||||
* Pop up one level
|
||||
*/
|
||||
node = acpi_ns_get_parent_node (node);
|
||||
node = acpi_ns_get_parent_node(node);
|
||||
}
|
||||
|
||||
/* If we get here, there is no handler for this region */
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
|
||||
"No handler for region_type %s(%X) (region_obj %p)\n",
|
||||
acpi_ut_get_region_name (space_id), space_id, region_obj));
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
|
||||
"No handler for region_type %s(%X) (region_obj %p)\n",
|
||||
acpi_ut_get_region_name(space_id), space_id,
|
||||
region_obj));
|
||||
|
||||
return_ACPI_STATUS (AE_NOT_EXIST);
|
||||
return_ACPI_STATUS(AE_NOT_EXIST);
|
||||
}
|
||||
|
||||
|
@ -45,16 +45,11 @@
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/acevents.h>
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_EVENTS
|
||||
ACPI_MODULE_NAME ("evsci")
|
||||
ACPI_MODULE_NAME("evsci")
|
||||
|
||||
/* Local prototypes */
|
||||
|
||||
static u32 ACPI_SYSTEM_XFACE
|
||||
acpi_ev_sci_xrupt_handler (
|
||||
void *context);
|
||||
|
||||
static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -69,17 +64,13 @@ acpi_ev_sci_xrupt_handler (
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static u32 ACPI_SYSTEM_XFACE
|
||||
acpi_ev_sci_xrupt_handler (
|
||||
void *context)
|
||||
static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context)
|
||||
{
|
||||
struct acpi_gpe_xrupt_info *gpe_xrupt_list = context;
|
||||
u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED;
|
||||
|
||||
struct acpi_gpe_xrupt_info *gpe_xrupt_list = context;
|
||||
u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED;
|
||||
|
||||
ACPI_FUNCTION_TRACE("ev_sci_xrupt_handler");
|
||||
|
||||
|
||||
/*
|
||||
* We are guaranteed by the ACPI CA initialization/shutdown code that
|
||||
* if this interrupt handler is installed, ACPI is enabled.
|
||||
@ -89,18 +80,17 @@ acpi_ev_sci_xrupt_handler (
|
||||
* Fixed Events:
|
||||
* Check for and dispatch any Fixed Events that have occurred
|
||||
*/
|
||||
interrupt_handled |= acpi_ev_fixed_event_detect ();
|
||||
interrupt_handled |= acpi_ev_fixed_event_detect();
|
||||
|
||||
/*
|
||||
* General Purpose Events:
|
||||
* Check for and dispatch any GPEs that have occurred
|
||||
*/
|
||||
interrupt_handled |= acpi_ev_gpe_detect (gpe_xrupt_list);
|
||||
interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list);
|
||||
|
||||
return_VALUE (interrupt_handled);
|
||||
return_VALUE(interrupt_handled);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_gpe_xrupt_handler
|
||||
@ -113,17 +103,13 @@ acpi_ev_sci_xrupt_handler (
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
u32 ACPI_SYSTEM_XFACE
|
||||
acpi_ev_gpe_xrupt_handler (
|
||||
void *context)
|
||||
u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context)
|
||||
{
|
||||
struct acpi_gpe_xrupt_info *gpe_xrupt_list = context;
|
||||
u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED;
|
||||
|
||||
struct acpi_gpe_xrupt_info *gpe_xrupt_list = context;
|
||||
u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED;
|
||||
|
||||
ACPI_FUNCTION_TRACE("ev_gpe_xrupt_handler");
|
||||
|
||||
|
||||
/*
|
||||
* We are guaranteed by the ACPI CA initialization/shutdown code that
|
||||
* if this interrupt handler is installed, ACPI is enabled.
|
||||
@ -133,12 +119,11 @@ acpi_ev_gpe_xrupt_handler (
|
||||
* GPEs:
|
||||
* Check for and dispatch any GPEs that have occurred
|
||||
*/
|
||||
interrupt_handled |= acpi_ev_gpe_detect (gpe_xrupt_list);
|
||||
interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list);
|
||||
|
||||
return_VALUE (interrupt_handled);
|
||||
return_VALUE(interrupt_handled);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_install_sci_handler
|
||||
@ -151,22 +136,18 @@ acpi_ev_gpe_xrupt_handler (
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
u32
|
||||
acpi_ev_install_sci_handler (
|
||||
void)
|
||||
u32 acpi_ev_install_sci_handler(void)
|
||||
{
|
||||
u32 status = AE_OK;
|
||||
u32 status = AE_OK;
|
||||
|
||||
ACPI_FUNCTION_TRACE("ev_install_sci_handler");
|
||||
|
||||
ACPI_FUNCTION_TRACE ("ev_install_sci_handler");
|
||||
|
||||
|
||||
status = acpi_os_install_interrupt_handler ((u32) acpi_gbl_FADT->sci_int,
|
||||
acpi_ev_sci_xrupt_handler, acpi_gbl_gpe_xrupt_list_head);
|
||||
return_ACPI_STATUS (status);
|
||||
status = acpi_os_install_interrupt_handler((u32) acpi_gbl_FADT->sci_int,
|
||||
acpi_ev_sci_xrupt_handler,
|
||||
acpi_gbl_gpe_xrupt_list_head);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_remove_sci_handler
|
||||
@ -186,22 +167,16 @@ acpi_ev_install_sci_handler (
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ev_remove_sci_handler (
|
||||
void)
|
||||
acpi_status acpi_ev_remove_sci_handler(void)
|
||||
{
|
||||
acpi_status status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("ev_remove_sci_handler");
|
||||
acpi_status status;
|
||||
|
||||
ACPI_FUNCTION_TRACE("ev_remove_sci_handler");
|
||||
|
||||
/* Just let the OS remove the handler and disable the level */
|
||||
|
||||
status = acpi_os_remove_interrupt_handler ((u32) acpi_gbl_FADT->sci_int,
|
||||
acpi_ev_sci_xrupt_handler);
|
||||
status = acpi_os_remove_interrupt_handler((u32) acpi_gbl_FADT->sci_int,
|
||||
acpi_ev_sci_xrupt_handler);
|
||||
|
||||
return_ACPI_STATUS (status);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
|
@ -49,8 +49,7 @@
|
||||
#include <acpi/acinterp.h>
|
||||
|
||||
#define _COMPONENT ACPI_EVENTS
|
||||
ACPI_MODULE_NAME ("evxface")
|
||||
|
||||
ACPI_MODULE_NAME("evxface")
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -64,21 +63,16 @@
|
||||
* DESCRIPTION: Saves the pointer to the handler function
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifdef ACPI_FUTURE_USAGE
|
||||
acpi_status
|
||||
acpi_install_exception_handler (
|
||||
acpi_exception_handler handler)
|
||||
acpi_status acpi_install_exception_handler(acpi_exception_handler handler)
|
||||
{
|
||||
acpi_status status;
|
||||
acpi_status status;
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_install_exception_handler");
|
||||
|
||||
ACPI_FUNCTION_TRACE ("acpi_install_exception_handler");
|
||||
|
||||
|
||||
status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
return_ACPI_STATUS (status);
|
||||
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/* Don't allow two handlers. */
|
||||
@ -92,12 +86,11 @@ acpi_install_exception_handler (
|
||||
|
||||
acpi_gbl_exception_handler = handler;
|
||||
|
||||
cleanup:
|
||||
(void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
|
||||
return_ACPI_STATUS (status);
|
||||
cleanup:
|
||||
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
#endif /* ACPI_FUTURE_USAGE */
|
||||
|
||||
#endif /* ACPI_FUTURE_USAGE */
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -116,26 +109,22 @@ cleanup:
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_install_fixed_event_handler (
|
||||
u32 event,
|
||||
acpi_event_handler handler,
|
||||
void *context)
|
||||
acpi_install_fixed_event_handler(u32 event,
|
||||
acpi_event_handler handler, void *context)
|
||||
{
|
||||
acpi_status status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("acpi_install_fixed_event_handler");
|
||||
acpi_status status;
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_install_fixed_event_handler");
|
||||
|
||||
/* Parameter validation */
|
||||
|
||||
if (event > ACPI_EVENT_MAX) {
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
return_ACPI_STATUS (status);
|
||||
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/* Don't allow two handlers. */
|
||||
@ -150,29 +139,29 @@ acpi_install_fixed_event_handler (
|
||||
acpi_gbl_fixed_event_handlers[event].handler = handler;
|
||||
acpi_gbl_fixed_event_handlers[event].context = context;
|
||||
|
||||
status = acpi_clear_event (event);
|
||||
status = acpi_clear_event(event);
|
||||
if (ACPI_SUCCESS(status))
|
||||
status = acpi_enable_event (event, 0);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Could not enable fixed event.\n"));
|
||||
status = acpi_enable_event(event, 0);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
|
||||
"Could not enable fixed event.\n"));
|
||||
|
||||
/* Remove the handler */
|
||||
|
||||
acpi_gbl_fixed_event_handlers[event].handler = NULL;
|
||||
acpi_gbl_fixed_event_handlers[event].context = NULL;
|
||||
}
|
||||
else {
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
||||
"Enabled fixed event %X, Handler=%p\n", event, handler));
|
||||
} else {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"Enabled fixed event %X, Handler=%p\n", event,
|
||||
handler));
|
||||
}
|
||||
|
||||
|
||||
cleanup:
|
||||
(void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
|
||||
return_ACPI_STATUS (status);
|
||||
cleanup:
|
||||
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_install_fixed_event_handler);
|
||||
|
||||
EXPORT_SYMBOL(acpi_install_fixed_event_handler);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -188,49 +177,45 @@ EXPORT_SYMBOL(acpi_install_fixed_event_handler);
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_remove_fixed_event_handler (
|
||||
u32 event,
|
||||
acpi_event_handler handler)
|
||||
acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("acpi_remove_fixed_event_handler");
|
||||
acpi_status status = AE_OK;
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_remove_fixed_event_handler");
|
||||
|
||||
/* Parameter validation */
|
||||
|
||||
if (event > ACPI_EVENT_MAX) {
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
return_ACPI_STATUS (status);
|
||||
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/* Disable the event before removing the handler */
|
||||
|
||||
status = acpi_disable_event (event, 0);
|
||||
status = acpi_disable_event(event, 0);
|
||||
|
||||
/* Always Remove the handler */
|
||||
|
||||
acpi_gbl_fixed_event_handlers[event].handler = NULL;
|
||||
acpi_gbl_fixed_event_handlers[event].context = NULL;
|
||||
|
||||
if (ACPI_FAILURE (status)) {
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_WARN,
|
||||
"Could not write to fixed event enable register.\n"));
|
||||
}
|
||||
else {
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Disabled fixed event %X.\n", event));
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
|
||||
"Could not write to fixed event enable register.\n"));
|
||||
} else {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Disabled fixed event %X.\n",
|
||||
event));
|
||||
}
|
||||
|
||||
(void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
|
||||
return_ACPI_STATUS (status);
|
||||
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_remove_fixed_event_handler);
|
||||
|
||||
EXPORT_SYMBOL(acpi_remove_fixed_event_handler);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -251,37 +236,32 @@ EXPORT_SYMBOL(acpi_remove_fixed_event_handler);
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_install_notify_handler (
|
||||
acpi_handle device,
|
||||
u32 handler_type,
|
||||
acpi_notify_handler handler,
|
||||
void *context)
|
||||
acpi_install_notify_handler(acpi_handle device,
|
||||
u32 handler_type,
|
||||
acpi_notify_handler handler, void *context)
|
||||
{
|
||||
union acpi_operand_object *obj_desc;
|
||||
union acpi_operand_object *notify_obj;
|
||||
struct acpi_namespace_node *node;
|
||||
acpi_status status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("acpi_install_notify_handler");
|
||||
union acpi_operand_object *obj_desc;
|
||||
union acpi_operand_object *notify_obj;
|
||||
struct acpi_namespace_node *node;
|
||||
acpi_status status;
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_install_notify_handler");
|
||||
|
||||
/* Parameter validation */
|
||||
|
||||
if ((!device) ||
|
||||
(!handler) ||
|
||||
(handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
if ((!device) ||
|
||||
(!handler) || (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
return_ACPI_STATUS (status);
|
||||
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/* Convert and validate the device handle */
|
||||
|
||||
node = acpi_ns_map_handle_to_node (device);
|
||||
node = acpi_ns_map_handle_to_node(device);
|
||||
if (!node) {
|
||||
status = AE_BAD_PARAMETER;
|
||||
goto unlock_and_exit;
|
||||
@ -297,21 +277,21 @@ acpi_install_notify_handler (
|
||||
/* Make sure the handler is not already installed */
|
||||
|
||||
if (((handler_type & ACPI_SYSTEM_NOTIFY) &&
|
||||
acpi_gbl_system_notify.handler) ||
|
||||
((handler_type & ACPI_DEVICE_NOTIFY) &&
|
||||
acpi_gbl_device_notify.handler)) {
|
||||
acpi_gbl_system_notify.handler) ||
|
||||
((handler_type & ACPI_DEVICE_NOTIFY) &&
|
||||
acpi_gbl_device_notify.handler)) {
|
||||
status = AE_ALREADY_EXISTS;
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
||||
if (handler_type & ACPI_SYSTEM_NOTIFY) {
|
||||
acpi_gbl_system_notify.node = node;
|
||||
acpi_gbl_system_notify.node = node;
|
||||
acpi_gbl_system_notify.handler = handler;
|
||||
acpi_gbl_system_notify.context = context;
|
||||
}
|
||||
|
||||
if (handler_type & ACPI_DEVICE_NOTIFY) {
|
||||
acpi_gbl_device_notify.node = node;
|
||||
acpi_gbl_device_notify.node = node;
|
||||
acpi_gbl_device_notify.handler = handler;
|
||||
acpi_gbl_device_notify.context = context;
|
||||
}
|
||||
@ -327,29 +307,28 @@ acpi_install_notify_handler (
|
||||
else {
|
||||
/* Notifies allowed on this object? */
|
||||
|
||||
if (!acpi_ev_is_notify_object (node)) {
|
||||
if (!acpi_ev_is_notify_object(node)) {
|
||||
status = AE_TYPE;
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
||||
/* Check for an existing internal object */
|
||||
|
||||
obj_desc = acpi_ns_get_attached_object (node);
|
||||
obj_desc = acpi_ns_get_attached_object(node);
|
||||
if (obj_desc) {
|
||||
/* Object exists - make sure there's no handler */
|
||||
|
||||
if (((handler_type & ACPI_SYSTEM_NOTIFY) &&
|
||||
obj_desc->common_notify.system_notify) ||
|
||||
((handler_type & ACPI_DEVICE_NOTIFY) &&
|
||||
obj_desc->common_notify.device_notify)) {
|
||||
obj_desc->common_notify.system_notify) ||
|
||||
((handler_type & ACPI_DEVICE_NOTIFY) &&
|
||||
obj_desc->common_notify.device_notify)) {
|
||||
status = AE_ALREADY_EXISTS;
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
/* Create a new object */
|
||||
|
||||
obj_desc = acpi_ut_create_internal_object (node->type);
|
||||
obj_desc = acpi_ut_create_internal_object(node->type);
|
||||
if (!obj_desc) {
|
||||
status = AE_NO_MEMORY;
|
||||
goto unlock_and_exit;
|
||||
@ -357,25 +336,27 @@ acpi_install_notify_handler (
|
||||
|
||||
/* Attach new object to the Node */
|
||||
|
||||
status = acpi_ns_attach_object (device, obj_desc, node->type);
|
||||
status =
|
||||
acpi_ns_attach_object(device, obj_desc, node->type);
|
||||
|
||||
/* Remove local reference to the object */
|
||||
|
||||
acpi_ut_remove_reference (obj_desc);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
acpi_ut_remove_reference(obj_desc);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
}
|
||||
|
||||
/* Install the handler */
|
||||
|
||||
notify_obj = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_NOTIFY);
|
||||
notify_obj =
|
||||
acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_NOTIFY);
|
||||
if (!notify_obj) {
|
||||
status = AE_NO_MEMORY;
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
||||
notify_obj->notify.node = node;
|
||||
notify_obj->notify.node = node;
|
||||
notify_obj->notify.handler = handler;
|
||||
notify_obj->notify.context = context;
|
||||
|
||||
@ -390,17 +371,16 @@ acpi_install_notify_handler (
|
||||
if (handler_type == ACPI_ALL_NOTIFY) {
|
||||
/* Extra ref if installed in both */
|
||||
|
||||
acpi_ut_add_reference (notify_obj);
|
||||
acpi_ut_add_reference(notify_obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
unlock_and_exit:
|
||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
||||
return_ACPI_STATUS (status);
|
||||
unlock_and_exit:
|
||||
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_install_notify_handler);
|
||||
|
||||
EXPORT_SYMBOL(acpi_install_notify_handler);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -420,36 +400,31 @@ EXPORT_SYMBOL(acpi_install_notify_handler);
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_remove_notify_handler (
|
||||
acpi_handle device,
|
||||
u32 handler_type,
|
||||
acpi_notify_handler handler)
|
||||
acpi_remove_notify_handler(acpi_handle device,
|
||||
u32 handler_type, acpi_notify_handler handler)
|
||||
{
|
||||
union acpi_operand_object *notify_obj;
|
||||
union acpi_operand_object *obj_desc;
|
||||
struct acpi_namespace_node *node;
|
||||
acpi_status status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("acpi_remove_notify_handler");
|
||||
union acpi_operand_object *notify_obj;
|
||||
union acpi_operand_object *obj_desc;
|
||||
struct acpi_namespace_node *node;
|
||||
acpi_status status;
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_remove_notify_handler");
|
||||
|
||||
/* Parameter validation */
|
||||
|
||||
if ((!device) ||
|
||||
(!handler) ||
|
||||
(handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
if ((!device) ||
|
||||
(!handler) || (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
return_ACPI_STATUS (status);
|
||||
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/* Convert and validate the device handle */
|
||||
|
||||
node = acpi_ns_map_handle_to_node (device);
|
||||
node = acpi_ns_map_handle_to_node(device);
|
||||
if (!node) {
|
||||
status = AE_BAD_PARAMETER;
|
||||
goto unlock_and_exit;
|
||||
@ -458,34 +433,34 @@ acpi_remove_notify_handler (
|
||||
/* Root Object */
|
||||
|
||||
if (device == ACPI_ROOT_OBJECT) {
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
||||
"Removing notify handler for ROOT object.\n"));
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"Removing notify handler for ROOT object.\n"));
|
||||
|
||||
if (((handler_type & ACPI_SYSTEM_NOTIFY) &&
|
||||
!acpi_gbl_system_notify.handler) ||
|
||||
((handler_type & ACPI_DEVICE_NOTIFY) &&
|
||||
!acpi_gbl_device_notify.handler)) {
|
||||
!acpi_gbl_system_notify.handler) ||
|
||||
((handler_type & ACPI_DEVICE_NOTIFY) &&
|
||||
!acpi_gbl_device_notify.handler)) {
|
||||
status = AE_NOT_EXIST;
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
||||
/* Make sure all deferred tasks are completed */
|
||||
|
||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
||||
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||
acpi_os_wait_events_complete(NULL);
|
||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
return_ACPI_STATUS (status);
|
||||
}
|
||||
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
if (handler_type & ACPI_SYSTEM_NOTIFY) {
|
||||
acpi_gbl_system_notify.node = NULL;
|
||||
acpi_gbl_system_notify.node = NULL;
|
||||
acpi_gbl_system_notify.handler = NULL;
|
||||
acpi_gbl_system_notify.context = NULL;
|
||||
}
|
||||
|
||||
if (handler_type & ACPI_DEVICE_NOTIFY) {
|
||||
acpi_gbl_device_notify.node = NULL;
|
||||
acpi_gbl_device_notify.node = NULL;
|
||||
acpi_gbl_device_notify.handler = NULL;
|
||||
acpi_gbl_device_notify.context = NULL;
|
||||
}
|
||||
@ -496,14 +471,14 @@ acpi_remove_notify_handler (
|
||||
else {
|
||||
/* Notifies allowed on this object? */
|
||||
|
||||
if (!acpi_ev_is_notify_object (node)) {
|
||||
if (!acpi_ev_is_notify_object(node)) {
|
||||
status = AE_TYPE;
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
||||
/* Check for an existing internal object */
|
||||
|
||||
obj_desc = acpi_ns_get_attached_object (node);
|
||||
obj_desc = acpi_ns_get_attached_object(node);
|
||||
if (!obj_desc) {
|
||||
status = AE_NOT_EXIST;
|
||||
goto unlock_and_exit;
|
||||
@ -514,53 +489,52 @@ acpi_remove_notify_handler (
|
||||
if (handler_type & ACPI_SYSTEM_NOTIFY) {
|
||||
notify_obj = obj_desc->common_notify.system_notify;
|
||||
if ((!notify_obj) ||
|
||||
(notify_obj->notify.handler != handler)) {
|
||||
(notify_obj->notify.handler != handler)) {
|
||||
status = AE_BAD_PARAMETER;
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
/* Make sure all deferred tasks are completed */
|
||||
|
||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
||||
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||
acpi_os_wait_events_complete(NULL);
|
||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
return_ACPI_STATUS (status);
|
||||
}
|
||||
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/* Remove the handler */
|
||||
obj_desc->common_notify.system_notify = NULL;
|
||||
acpi_ut_remove_reference (notify_obj);
|
||||
acpi_ut_remove_reference(notify_obj);
|
||||
}
|
||||
|
||||
if (handler_type & ACPI_DEVICE_NOTIFY) {
|
||||
notify_obj = obj_desc->common_notify.device_notify;
|
||||
if ((!notify_obj) ||
|
||||
(notify_obj->notify.handler != handler)) {
|
||||
(notify_obj->notify.handler != handler)) {
|
||||
status = AE_BAD_PARAMETER;
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
/* Make sure all deferred tasks are completed */
|
||||
|
||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
||||
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||
acpi_os_wait_events_complete(NULL);
|
||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
return_ACPI_STATUS (status);
|
||||
}
|
||||
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/* Remove the handler */
|
||||
obj_desc->common_notify.device_notify = NULL;
|
||||
acpi_ut_remove_reference (notify_obj);
|
||||
acpi_ut_remove_reference(notify_obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
unlock_and_exit:
|
||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
||||
return_ACPI_STATUS (status);
|
||||
unlock_and_exit:
|
||||
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_remove_notify_handler);
|
||||
|
||||
EXPORT_SYMBOL(acpi_remove_notify_handler);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -581,36 +555,31 @@ EXPORT_SYMBOL(acpi_remove_notify_handler);
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_install_gpe_handler (
|
||||
acpi_handle gpe_device,
|
||||
u32 gpe_number,
|
||||
u32 type,
|
||||
acpi_event_handler address,
|
||||
void *context)
|
||||
acpi_install_gpe_handler(acpi_handle gpe_device,
|
||||
u32 gpe_number,
|
||||
u32 type, acpi_event_handler address, void *context)
|
||||
{
|
||||
struct acpi_gpe_event_info *gpe_event_info;
|
||||
struct acpi_handler_info *handler;
|
||||
acpi_status status;
|
||||
u32 flags;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("acpi_install_gpe_handler");
|
||||
struct acpi_gpe_event_info *gpe_event_info;
|
||||
struct acpi_handler_info *handler;
|
||||
acpi_status status;
|
||||
u32 flags;
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_install_gpe_handler");
|
||||
|
||||
/* Parameter validation */
|
||||
|
||||
if ((!address) || (type > ACPI_GPE_XRUPT_TYPE_MASK)) {
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
return_ACPI_STATUS (status);
|
||||
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/* Ensure that we have a valid GPE number */
|
||||
|
||||
gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number);
|
||||
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
||||
if (!gpe_event_info) {
|
||||
status = AE_BAD_PARAMETER;
|
||||
goto unlock_and_exit;
|
||||
@ -618,49 +587,49 @@ acpi_install_gpe_handler (
|
||||
|
||||
/* Make sure that there isn't a handler there already */
|
||||
|
||||
if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_HANDLER) {
|
||||
if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
|
||||
ACPI_GPE_DISPATCH_HANDLER) {
|
||||
status = AE_ALREADY_EXISTS;
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
||||
/* Allocate and init handler object */
|
||||
|
||||
handler = ACPI_MEM_CALLOCATE (sizeof (struct acpi_handler_info));
|
||||
handler = ACPI_MEM_CALLOCATE(sizeof(struct acpi_handler_info));
|
||||
if (!handler) {
|
||||
status = AE_NO_MEMORY;
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
||||
handler->address = address;
|
||||
handler->context = context;
|
||||
handler->address = address;
|
||||
handler->context = context;
|
||||
handler->method_node = gpe_event_info->dispatch.method_node;
|
||||
|
||||
/* Disable the GPE before installing the handler */
|
||||
|
||||
status = acpi_ev_disable_gpe (gpe_event_info);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
status = acpi_ev_disable_gpe(gpe_event_info);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
||||
/* Install the handler */
|
||||
|
||||
flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
|
||||
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
|
||||
gpe_event_info->dispatch.handler = handler;
|
||||
|
||||
/* Setup up dispatch flags to indicate handler (vs. method) */
|
||||
|
||||
gpe_event_info->flags &= ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); /* Clear bits */
|
||||
gpe_event_info->flags &= ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); /* Clear bits */
|
||||
gpe_event_info->flags |= (u8) (type | ACPI_GPE_DISPATCH_HANDLER);
|
||||
|
||||
acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
|
||||
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
||||
|
||||
|
||||
unlock_and_exit:
|
||||
(void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
|
||||
return_ACPI_STATUS (status);
|
||||
unlock_and_exit:
|
||||
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_install_gpe_handler);
|
||||
|
||||
EXPORT_SYMBOL(acpi_install_gpe_handler);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -678,34 +647,30 @@ EXPORT_SYMBOL(acpi_install_gpe_handler);
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_remove_gpe_handler (
|
||||
acpi_handle gpe_device,
|
||||
u32 gpe_number,
|
||||
acpi_event_handler address)
|
||||
acpi_remove_gpe_handler(acpi_handle gpe_device,
|
||||
u32 gpe_number, acpi_event_handler address)
|
||||
{
|
||||
struct acpi_gpe_event_info *gpe_event_info;
|
||||
struct acpi_handler_info *handler;
|
||||
acpi_status status;
|
||||
u32 flags;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("acpi_remove_gpe_handler");
|
||||
struct acpi_gpe_event_info *gpe_event_info;
|
||||
struct acpi_handler_info *handler;
|
||||
acpi_status status;
|
||||
u32 flags;
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_remove_gpe_handler");
|
||||
|
||||
/* Parameter validation */
|
||||
|
||||
if (!address) {
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
return_ACPI_STATUS (status);
|
||||
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/* Ensure that we have a valid GPE number */
|
||||
|
||||
gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number);
|
||||
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
||||
if (!gpe_event_info) {
|
||||
status = AE_BAD_PARAMETER;
|
||||
goto unlock_and_exit;
|
||||
@ -713,7 +678,8 @@ acpi_remove_gpe_handler (
|
||||
|
||||
/* Make sure that a handler is indeed installed */
|
||||
|
||||
if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) != ACPI_GPE_DISPATCH_HANDLER) {
|
||||
if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) !=
|
||||
ACPI_GPE_DISPATCH_HANDLER) {
|
||||
status = AE_NOT_EXIST;
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
@ -727,45 +693,44 @@ acpi_remove_gpe_handler (
|
||||
|
||||
/* Disable the GPE before removing the handler */
|
||||
|
||||
status = acpi_ev_disable_gpe (gpe_event_info);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
status = acpi_ev_disable_gpe(gpe_event_info);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
||||
/* Make sure all deferred tasks are completed */
|
||||
|
||||
(void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
|
||||
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
||||
acpi_os_wait_events_complete(NULL);
|
||||
status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
return_ACPI_STATUS (status);
|
||||
}
|
||||
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/* Remove the handler */
|
||||
|
||||
flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
|
||||
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
|
||||
handler = gpe_event_info->dispatch.handler;
|
||||
|
||||
/* Restore Method node (if any), set dispatch flags */
|
||||
|
||||
gpe_event_info->dispatch.method_node = handler->method_node;
|
||||
gpe_event_info->flags &= ~ACPI_GPE_DISPATCH_MASK; /* Clear bits */
|
||||
gpe_event_info->flags &= ~ACPI_GPE_DISPATCH_MASK; /* Clear bits */
|
||||
if (handler->method_node) {
|
||||
gpe_event_info->flags |= ACPI_GPE_DISPATCH_METHOD;
|
||||
}
|
||||
acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
|
||||
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
||||
|
||||
/* Now we can free the handler object */
|
||||
|
||||
ACPI_MEM_FREE (handler);
|
||||
ACPI_MEM_FREE(handler);
|
||||
|
||||
|
||||
unlock_and_exit:
|
||||
(void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
|
||||
return_ACPI_STATUS (status);
|
||||
unlock_and_exit:
|
||||
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_remove_gpe_handler);
|
||||
|
||||
EXPORT_SYMBOL(acpi_remove_gpe_handler);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -781,35 +746,31 @@ EXPORT_SYMBOL(acpi_remove_gpe_handler);
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_acquire_global_lock (
|
||||
u16 timeout,
|
||||
u32 *handle)
|
||||
acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle)
|
||||
{
|
||||
acpi_status status;
|
||||
|
||||
acpi_status status;
|
||||
|
||||
if (!handle) {
|
||||
return (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
status = acpi_ex_enter_interpreter ();
|
||||
if (ACPI_FAILURE (status)) {
|
||||
status = acpi_ex_enter_interpreter();
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return (status);
|
||||
}
|
||||
|
||||
status = acpi_ev_acquire_global_lock (timeout);
|
||||
acpi_ex_exit_interpreter ();
|
||||
status = acpi_ev_acquire_global_lock(timeout);
|
||||
acpi_ex_exit_interpreter();
|
||||
|
||||
if (ACPI_SUCCESS (status)) {
|
||||
if (ACPI_SUCCESS(status)) {
|
||||
acpi_gbl_global_lock_handle++;
|
||||
*handle = acpi_gbl_global_lock_handle;
|
||||
}
|
||||
|
||||
return (status);
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_acquire_global_lock);
|
||||
|
||||
EXPORT_SYMBOL(acpi_acquire_global_lock);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -823,19 +784,16 @@ EXPORT_SYMBOL(acpi_acquire_global_lock);
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_release_global_lock (
|
||||
u32 handle)
|
||||
acpi_status acpi_release_global_lock(u32 handle)
|
||||
{
|
||||
acpi_status status;
|
||||
|
||||
acpi_status status;
|
||||
|
||||
if (handle != acpi_gbl_global_lock_handle) {
|
||||
return (AE_NOT_ACQUIRED);
|
||||
}
|
||||
|
||||
status = acpi_ev_release_global_lock ();
|
||||
status = acpi_ev_release_global_lock();
|
||||
return (status);
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_release_global_lock);
|
||||
|
||||
EXPORT_SYMBOL(acpi_release_global_lock);
|
||||
|
@ -48,8 +48,7 @@
|
||||
#include <acpi/acnamesp.h>
|
||||
|
||||
#define _COMPONENT ACPI_EVENTS
|
||||
ACPI_MODULE_NAME ("evxfevnt")
|
||||
|
||||
ACPI_MODULE_NAME("evxfevnt")
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -62,44 +61,39 @@
|
||||
* DESCRIPTION: Transfers the system into ACPI mode.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_enable (
|
||||
void)
|
||||
acpi_status acpi_enable(void)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
acpi_status status = AE_OK;
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_enable");
|
||||
|
||||
ACPI_FUNCTION_TRACE ("acpi_enable");
|
||||
|
||||
|
||||
/* Make sure we have the FADT*/
|
||||
/* Make sure we have the FADT */
|
||||
|
||||
if (!acpi_gbl_FADT) {
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No FADT information present!\n"));
|
||||
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
|
||||
"No FADT information present!\n"));
|
||||
return_ACPI_STATUS(AE_NO_ACPI_TABLES);
|
||||
}
|
||||
|
||||
if (acpi_hw_get_mode() == ACPI_SYS_MODE_ACPI) {
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "System is already in ACPI mode\n"));
|
||||
}
|
||||
else {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INIT,
|
||||
"System is already in ACPI mode\n"));
|
||||
} else {
|
||||
/* Transition to ACPI mode */
|
||||
|
||||
status = acpi_hw_set_mode (ACPI_SYS_MODE_ACPI);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
ACPI_REPORT_ERROR (("Could not transition to ACPI mode.\n"));
|
||||
return_ACPI_STATUS (status);
|
||||
status = acpi_hw_set_mode(ACPI_SYS_MODE_ACPI);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_REPORT_ERROR(("Could not transition to ACPI mode.\n"));
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
|
||||
"Transition to ACPI mode successful\n"));
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INIT,
|
||||
"Transition to ACPI mode successful\n"));
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (status);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_disable
|
||||
@ -112,43 +106,38 @@ acpi_enable (
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_disable (
|
||||
void)
|
||||
acpi_status acpi_disable(void)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("acpi_disable");
|
||||
acpi_status status = AE_OK;
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_disable");
|
||||
|
||||
if (!acpi_gbl_FADT) {
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No FADT information present!\n"));
|
||||
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
|
||||
"No FADT information present!\n"));
|
||||
return_ACPI_STATUS(AE_NO_ACPI_TABLES);
|
||||
}
|
||||
|
||||
if (acpi_hw_get_mode() == ACPI_SYS_MODE_LEGACY) {
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
|
||||
"System is already in legacy (non-ACPI) mode\n"));
|
||||
}
|
||||
else {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INIT,
|
||||
"System is already in legacy (non-ACPI) mode\n"));
|
||||
} else {
|
||||
/* Transition to LEGACY mode */
|
||||
|
||||
status = acpi_hw_set_mode (ACPI_SYS_MODE_LEGACY);
|
||||
status = acpi_hw_set_mode(ACPI_SYS_MODE_LEGACY);
|
||||
|
||||
if (ACPI_FAILURE (status)) {
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Could not exit ACPI mode to legacy mode"));
|
||||
return_ACPI_STATUS (status);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Could not exit ACPI mode to legacy mode"));
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI mode disabled\n"));
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INIT, "ACPI mode disabled\n"));
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (status);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_enable_event
|
||||
@ -162,52 +151,50 @@ acpi_disable (
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_enable_event (
|
||||
u32 event,
|
||||
u32 flags)
|
||||
acpi_status acpi_enable_event(u32 event, u32 flags)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
u32 value;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("acpi_enable_event");
|
||||
acpi_status status = AE_OK;
|
||||
u32 value;
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_enable_event");
|
||||
|
||||
/* Decode the Fixed Event */
|
||||
|
||||
if (event > ACPI_EVENT_MAX) {
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
/*
|
||||
* Enable the requested fixed event (by writing a one to the
|
||||
* enable register bit)
|
||||
*/
|
||||
status = acpi_set_register (acpi_gbl_fixed_event_info[event].enable_register_id,
|
||||
1, ACPI_MTX_LOCK);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
return_ACPI_STATUS (status);
|
||||
status =
|
||||
acpi_set_register(acpi_gbl_fixed_event_info[event].
|
||||
enable_register_id, 1, ACPI_MTX_LOCK);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/* Make sure that the hardware responded */
|
||||
|
||||
status = acpi_get_register (acpi_gbl_fixed_event_info[event].enable_register_id,
|
||||
&value, ACPI_MTX_LOCK);
|
||||
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);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
if (value != 1) {
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Could not enable %s event\n", acpi_ut_get_event_name (event)));
|
||||
return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Could not enable %s event\n",
|
||||
acpi_ut_get_event_name(event)));
|
||||
return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (status);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_enable_event);
|
||||
|
||||
EXPORT_SYMBOL(acpi_enable_event);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -223,40 +210,34 @@ EXPORT_SYMBOL(acpi_enable_event);
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_set_gpe_type (
|
||||
acpi_handle gpe_device,
|
||||
u32 gpe_number,
|
||||
u8 type)
|
||||
acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
struct acpi_gpe_event_info *gpe_event_info;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("acpi_set_gpe_type");
|
||||
acpi_status status = AE_OK;
|
||||
struct acpi_gpe_event_info *gpe_event_info;
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_set_gpe_type");
|
||||
|
||||
/* Ensure that we have a valid GPE number */
|
||||
|
||||
gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number);
|
||||
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
||||
if (!gpe_event_info) {
|
||||
status = AE_BAD_PARAMETER;
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
||||
if ((gpe_event_info->flags & ACPI_GPE_TYPE_MASK) == type) {
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
/* Set the new type (will disable GPE if currently enabled) */
|
||||
|
||||
status = acpi_ev_set_gpe_type (gpe_event_info, type);
|
||||
status = acpi_ev_set_gpe_type(gpe_event_info, type);
|
||||
|
||||
unlock_and_exit:
|
||||
return_ACPI_STATUS (status);
|
||||
unlock_and_exit:
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_set_gpe_type);
|
||||
|
||||
EXPORT_SYMBOL(acpi_set_gpe_type);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -273,31 +254,25 @@ EXPORT_SYMBOL(acpi_set_gpe_type);
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_enable_gpe (
|
||||
acpi_handle gpe_device,
|
||||
u32 gpe_number,
|
||||
u32 flags)
|
||||
acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
struct acpi_gpe_event_info *gpe_event_info;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("acpi_enable_gpe");
|
||||
acpi_status status = AE_OK;
|
||||
struct acpi_gpe_event_info *gpe_event_info;
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_enable_gpe");
|
||||
|
||||
/* Use semaphore lock if not executing at interrupt level */
|
||||
|
||||
if (flags & ACPI_NOT_ISR) {
|
||||
status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
return_ACPI_STATUS (status);
|
||||
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
}
|
||||
|
||||
/* Ensure that we have a valid GPE number */
|
||||
|
||||
gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number);
|
||||
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
||||
if (!gpe_event_info) {
|
||||
status = AE_BAD_PARAMETER;
|
||||
goto unlock_and_exit;
|
||||
@ -305,16 +280,16 @@ acpi_enable_gpe (
|
||||
|
||||
/* Perform the enable */
|
||||
|
||||
status = acpi_ev_enable_gpe (gpe_event_info, TRUE);
|
||||
status = acpi_ev_enable_gpe(gpe_event_info, TRUE);
|
||||
|
||||
unlock_and_exit:
|
||||
unlock_and_exit:
|
||||
if (flags & ACPI_NOT_ISR) {
|
||||
(void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
|
||||
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
||||
}
|
||||
return_ACPI_STATUS (status);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_enable_gpe);
|
||||
|
||||
EXPORT_SYMBOL(acpi_enable_gpe);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -331,46 +306,39 @@ EXPORT_SYMBOL(acpi_enable_gpe);
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_disable_gpe (
|
||||
acpi_handle gpe_device,
|
||||
u32 gpe_number,
|
||||
u32 flags)
|
||||
acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
struct acpi_gpe_event_info *gpe_event_info;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("acpi_disable_gpe");
|
||||
acpi_status status = AE_OK;
|
||||
struct acpi_gpe_event_info *gpe_event_info;
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_disable_gpe");
|
||||
|
||||
/* Use semaphore lock if not executing at interrupt level */
|
||||
|
||||
if (flags & ACPI_NOT_ISR) {
|
||||
status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
return_ACPI_STATUS (status);
|
||||
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
}
|
||||
|
||||
/* Ensure that we have a valid GPE number */
|
||||
|
||||
gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number);
|
||||
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
||||
if (!gpe_event_info) {
|
||||
status = AE_BAD_PARAMETER;
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
||||
status = acpi_ev_disable_gpe (gpe_event_info);
|
||||
status = acpi_ev_disable_gpe(gpe_event_info);
|
||||
|
||||
unlock_and_exit:
|
||||
unlock_and_exit:
|
||||
if (flags & ACPI_NOT_ISR) {
|
||||
(void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
|
||||
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
||||
}
|
||||
return_ACPI_STATUS (status);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_disable_event
|
||||
@ -384,50 +352,48 @@ unlock_and_exit:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_disable_event (
|
||||
u32 event,
|
||||
u32 flags)
|
||||
acpi_status acpi_disable_event(u32 event, u32 flags)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
u32 value;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("acpi_disable_event");
|
||||
acpi_status status = AE_OK;
|
||||
u32 value;
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_disable_event");
|
||||
|
||||
/* Decode the Fixed Event */
|
||||
|
||||
if (event > ACPI_EVENT_MAX) {
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
/*
|
||||
* Disable the requested fixed event (by writing a zero to the
|
||||
* enable register bit)
|
||||
*/
|
||||
status = acpi_set_register (acpi_gbl_fixed_event_info[event].enable_register_id,
|
||||
0, ACPI_MTX_LOCK);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
return_ACPI_STATUS (status);
|
||||
status =
|
||||
acpi_set_register(acpi_gbl_fixed_event_info[event].
|
||||
enable_register_id, 0, ACPI_MTX_LOCK);
|
||||
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);
|
||||
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);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
if (value != 0) {
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Could not disable %s events\n", acpi_ut_get_event_name (event)));
|
||||
return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Could not disable %s events\n",
|
||||
acpi_ut_get_event_name(event)));
|
||||
return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (status);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_disable_event);
|
||||
|
||||
EXPORT_SYMBOL(acpi_disable_event);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -441,33 +407,30 @@ EXPORT_SYMBOL(acpi_disable_event);
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_clear_event (
|
||||
u32 event)
|
||||
acpi_status acpi_clear_event(u32 event)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("acpi_clear_event");
|
||||
acpi_status status = AE_OK;
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_clear_event");
|
||||
|
||||
/* Decode the Fixed Event */
|
||||
|
||||
if (event > ACPI_EVENT_MAX) {
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear the requested fixed event (By writing a one to the
|
||||
* status register bit)
|
||||
*/
|
||||
status = acpi_set_register (acpi_gbl_fixed_event_info[event].status_register_id,
|
||||
1, ACPI_MTX_LOCK);
|
||||
status =
|
||||
acpi_set_register(acpi_gbl_fixed_event_info[event].
|
||||
status_register_id, 1, ACPI_MTX_LOCK);
|
||||
|
||||
return_ACPI_STATUS (status);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_clear_event);
|
||||
|
||||
EXPORT_SYMBOL(acpi_clear_event);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -483,46 +446,39 @@ EXPORT_SYMBOL(acpi_clear_event);
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_clear_gpe (
|
||||
acpi_handle gpe_device,
|
||||
u32 gpe_number,
|
||||
u32 flags)
|
||||
acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
struct acpi_gpe_event_info *gpe_event_info;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("acpi_clear_gpe");
|
||||
acpi_status status = AE_OK;
|
||||
struct acpi_gpe_event_info *gpe_event_info;
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_clear_gpe");
|
||||
|
||||
/* Use semaphore lock if not executing at interrupt level */
|
||||
|
||||
if (flags & ACPI_NOT_ISR) {
|
||||
status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
return_ACPI_STATUS (status);
|
||||
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
}
|
||||
|
||||
/* Ensure that we have a valid GPE number */
|
||||
|
||||
gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number);
|
||||
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
||||
if (!gpe_event_info) {
|
||||
status = AE_BAD_PARAMETER;
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
||||
status = acpi_hw_clear_gpe (gpe_event_info);
|
||||
status = acpi_hw_clear_gpe(gpe_event_info);
|
||||
|
||||
unlock_and_exit:
|
||||
unlock_and_exit:
|
||||
if (flags & ACPI_NOT_ISR) {
|
||||
(void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
|
||||
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
||||
}
|
||||
return_ACPI_STATUS (status);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
#ifdef ACPI_FUTURE_USAGE
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -538,36 +494,31 @@ unlock_and_exit:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_get_event_status (
|
||||
u32 event,
|
||||
acpi_event_status *event_status)
|
||||
acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("acpi_get_event_status");
|
||||
acpi_status status = AE_OK;
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_get_event_status");
|
||||
|
||||
if (!event_status) {
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
/* Decode the Fixed Event */
|
||||
|
||||
if (event > ACPI_EVENT_MAX) {
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
/* Get the status of the requested fixed event */
|
||||
|
||||
status = acpi_get_register (acpi_gbl_fixed_event_info[event].status_register_id,
|
||||
event_status, ACPI_MTX_LOCK);
|
||||
status =
|
||||
acpi_get_register(acpi_gbl_fixed_event_info[event].
|
||||
status_register_id, event_status, ACPI_MTX_LOCK);
|
||||
|
||||
return_ACPI_STATUS (status);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_get_gpe_status
|
||||
@ -585,31 +536,26 @@ acpi_get_event_status (
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_get_gpe_status (
|
||||
acpi_handle gpe_device,
|
||||
u32 gpe_number,
|
||||
u32 flags,
|
||||
acpi_event_status *event_status)
|
||||
acpi_get_gpe_status(acpi_handle gpe_device,
|
||||
u32 gpe_number, u32 flags, acpi_event_status * event_status)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
struct acpi_gpe_event_info *gpe_event_info;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("acpi_get_gpe_status");
|
||||
acpi_status status = AE_OK;
|
||||
struct acpi_gpe_event_info *gpe_event_info;
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_get_gpe_status");
|
||||
|
||||
/* Use semaphore lock if not executing at interrupt level */
|
||||
|
||||
if (flags & ACPI_NOT_ISR) {
|
||||
status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
return_ACPI_STATUS (status);
|
||||
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
}
|
||||
|
||||
/* Ensure that we have a valid GPE number */
|
||||
|
||||
gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number);
|
||||
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
||||
if (!gpe_event_info) {
|
||||
status = AE_BAD_PARAMETER;
|
||||
goto unlock_and_exit;
|
||||
@ -617,16 +563,15 @@ acpi_get_gpe_status (
|
||||
|
||||
/* Obtain status on the requested GPE number */
|
||||
|
||||
status = acpi_hw_get_gpe_status (gpe_event_info, event_status);
|
||||
status = acpi_hw_get_gpe_status(gpe_event_info, event_status);
|
||||
|
||||
unlock_and_exit:
|
||||
unlock_and_exit:
|
||||
if (flags & ACPI_NOT_ISR) {
|
||||
(void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
|
||||
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
||||
}
|
||||
return_ACPI_STATUS (status);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
#endif /* ACPI_FUTURE_USAGE */
|
||||
|
||||
#endif /* ACPI_FUTURE_USAGE */
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -644,33 +589,27 @@ unlock_and_exit:
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_install_gpe_block (
|
||||
acpi_handle gpe_device,
|
||||
struct acpi_generic_address *gpe_block_address,
|
||||
u32 register_count,
|
||||
u32 interrupt_number)
|
||||
acpi_install_gpe_block(acpi_handle gpe_device,
|
||||
struct acpi_generic_address *gpe_block_address,
|
||||
u32 register_count, u32 interrupt_number)
|
||||
{
|
||||
acpi_status status;
|
||||
union acpi_operand_object *obj_desc;
|
||||
struct acpi_namespace_node *node;
|
||||
struct acpi_gpe_block_info *gpe_block;
|
||||
acpi_status status;
|
||||
union acpi_operand_object *obj_desc;
|
||||
struct acpi_namespace_node *node;
|
||||
struct acpi_gpe_block_info *gpe_block;
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_install_gpe_block");
|
||||
|
||||
ACPI_FUNCTION_TRACE ("acpi_install_gpe_block");
|
||||
|
||||
|
||||
if ((!gpe_device) ||
|
||||
(!gpe_block_address) ||
|
||||
(!register_count)) {
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
if ((!gpe_device) || (!gpe_block_address) || (!register_count)) {
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return (status);
|
||||
}
|
||||
|
||||
node = acpi_ns_map_handle_to_node (gpe_device);
|
||||
node = acpi_ns_map_handle_to_node(gpe_device);
|
||||
if (!node) {
|
||||
status = AE_BAD_PARAMETER;
|
||||
goto unlock_and_exit;
|
||||
@ -680,31 +619,33 @@ acpi_install_gpe_block (
|
||||
* For user-installed GPE Block Devices, the gpe_block_base_number
|
||||
* is always zero
|
||||
*/
|
||||
status = acpi_ev_create_gpe_block (node, gpe_block_address, register_count,
|
||||
0, interrupt_number, &gpe_block);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
status =
|
||||
acpi_ev_create_gpe_block(node, gpe_block_address, register_count, 0,
|
||||
interrupt_number, &gpe_block);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
||||
/* Get the device_object attached to the node */
|
||||
|
||||
obj_desc = acpi_ns_get_attached_object (node);
|
||||
obj_desc = acpi_ns_get_attached_object(node);
|
||||
if (!obj_desc) {
|
||||
/* No object, create a new one */
|
||||
|
||||
obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_DEVICE);
|
||||
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_DEVICE);
|
||||
if (!obj_desc) {
|
||||
status = AE_NO_MEMORY;
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
||||
status = acpi_ns_attach_object (node, obj_desc, ACPI_TYPE_DEVICE);
|
||||
status =
|
||||
acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_DEVICE);
|
||||
|
||||
/* Remove local reference to the object */
|
||||
|
||||
acpi_ut_remove_reference (obj_desc);
|
||||
acpi_ut_remove_reference(obj_desc);
|
||||
|
||||
if (ACPI_FAILURE (status)) {
|
||||
if (ACPI_FAILURE(status)) {
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
}
|
||||
@ -713,13 +654,12 @@ acpi_install_gpe_block (
|
||||
|
||||
obj_desc->device.gpe_block = gpe_block;
|
||||
|
||||
|
||||
unlock_and_exit:
|
||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
||||
return_ACPI_STATUS (status);
|
||||
unlock_and_exit:
|
||||
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_install_gpe_block);
|
||||
|
||||
EXPORT_SYMBOL(acpi_install_gpe_block);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -733,28 +673,24 @@ EXPORT_SYMBOL(acpi_install_gpe_block);
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_remove_gpe_block (
|
||||
acpi_handle gpe_device)
|
||||
acpi_status acpi_remove_gpe_block(acpi_handle gpe_device)
|
||||
{
|
||||
union acpi_operand_object *obj_desc;
|
||||
acpi_status status;
|
||||
struct acpi_namespace_node *node;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("acpi_remove_gpe_block");
|
||||
union acpi_operand_object *obj_desc;
|
||||
acpi_status status;
|
||||
struct acpi_namespace_node *node;
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_remove_gpe_block");
|
||||
|
||||
if (!gpe_device) {
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return (status);
|
||||
}
|
||||
|
||||
node = acpi_ns_map_handle_to_node (gpe_device);
|
||||
node = acpi_ns_map_handle_to_node(gpe_device);
|
||||
if (!node) {
|
||||
status = AE_BAD_PARAMETER;
|
||||
goto unlock_and_exit;
|
||||
@ -762,22 +698,21 @@ acpi_remove_gpe_block (
|
||||
|
||||
/* Get the device_object attached to the node */
|
||||
|
||||
obj_desc = acpi_ns_get_attached_object (node);
|
||||
if (!obj_desc ||
|
||||
!obj_desc->device.gpe_block) {
|
||||
return_ACPI_STATUS (AE_NULL_OBJECT);
|
||||
obj_desc = acpi_ns_get_attached_object(node);
|
||||
if (!obj_desc || !obj_desc->device.gpe_block) {
|
||||
return_ACPI_STATUS(AE_NULL_OBJECT);
|
||||
}
|
||||
|
||||
/* Delete the GPE block (but not the device_object) */
|
||||
|
||||
status = acpi_ev_delete_gpe_block (obj_desc->device.gpe_block);
|
||||
if (ACPI_SUCCESS (status)) {
|
||||
status = acpi_ev_delete_gpe_block(obj_desc->device.gpe_block);
|
||||
if (ACPI_SUCCESS(status)) {
|
||||
obj_desc->device.gpe_block = NULL;
|
||||
}
|
||||
|
||||
unlock_and_exit:
|
||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
||||
return_ACPI_STATUS (status);
|
||||
unlock_and_exit:
|
||||
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(acpi_remove_gpe_block);
|
||||
|
@ -49,8 +49,7 @@
|
||||
#include <acpi/acevents.h>
|
||||
|
||||
#define _COMPONENT ACPI_EVENTS
|
||||
ACPI_MODULE_NAME ("evxfregn")
|
||||
|
||||
ACPI_MODULE_NAME("evxfregn")
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -67,36 +66,31 @@
|
||||
* DESCRIPTION: Install a handler for all op_regions of a given space_id.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_install_address_space_handler (
|
||||
acpi_handle device,
|
||||
acpi_adr_space_type space_id,
|
||||
acpi_adr_space_handler handler,
|
||||
acpi_adr_space_setup setup,
|
||||
void *context)
|
||||
acpi_install_address_space_handler(acpi_handle device,
|
||||
acpi_adr_space_type space_id,
|
||||
acpi_adr_space_handler handler,
|
||||
acpi_adr_space_setup setup, void *context)
|
||||
{
|
||||
struct acpi_namespace_node *node;
|
||||
acpi_status status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("acpi_install_address_space_handler");
|
||||
struct acpi_namespace_node *node;
|
||||
acpi_status status;
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_install_address_space_handler");
|
||||
|
||||
/* Parameter validation */
|
||||
|
||||
if (!device) {
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
return_ACPI_STATUS (status);
|
||||
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/* Convert and validate the device handle */
|
||||
|
||||
node = acpi_ns_map_handle_to_node (device);
|
||||
node = acpi_ns_map_handle_to_node(device);
|
||||
if (!node) {
|
||||
status = AE_BAD_PARAMETER;
|
||||
goto unlock_and_exit;
|
||||
@ -104,21 +98,23 @@ acpi_install_address_space_handler (
|
||||
|
||||
/* Install the handler for all Regions for this Space ID */
|
||||
|
||||
status = acpi_ev_install_space_handler (node, space_id, handler, setup, context);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
status =
|
||||
acpi_ev_install_space_handler(node, space_id, handler, setup,
|
||||
context);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
||||
/* Run all _REG methods for this address space */
|
||||
|
||||
status = acpi_ev_execute_reg_methods (node, space_id);
|
||||
status = acpi_ev_execute_reg_methods(node, space_id);
|
||||
|
||||
unlock_and_exit:
|
||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
||||
return_ACPI_STATUS (status);
|
||||
unlock_and_exit:
|
||||
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_install_address_space_handler);
|
||||
|
||||
EXPORT_SYMBOL(acpi_install_address_space_handler);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -135,36 +131,33 @@ EXPORT_SYMBOL(acpi_install_address_space_handler);
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_remove_address_space_handler (
|
||||
acpi_handle device,
|
||||
acpi_adr_space_type space_id,
|
||||
acpi_adr_space_handler handler)
|
||||
acpi_remove_address_space_handler(acpi_handle device,
|
||||
acpi_adr_space_type space_id,
|
||||
acpi_adr_space_handler handler)
|
||||
{
|
||||
union acpi_operand_object *obj_desc;
|
||||
union acpi_operand_object *handler_obj;
|
||||
union acpi_operand_object *region_obj;
|
||||
union acpi_operand_object **last_obj_ptr;
|
||||
struct acpi_namespace_node *node;
|
||||
acpi_status status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("acpi_remove_address_space_handler");
|
||||
union acpi_operand_object *obj_desc;
|
||||
union acpi_operand_object *handler_obj;
|
||||
union acpi_operand_object *region_obj;
|
||||
union acpi_operand_object **last_obj_ptr;
|
||||
struct acpi_namespace_node *node;
|
||||
acpi_status status;
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_remove_address_space_handler");
|
||||
|
||||
/* Parameter validation */
|
||||
|
||||
if (!device) {
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
return_ACPI_STATUS (status);
|
||||
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/* Convert and validate the device handle */
|
||||
|
||||
node = acpi_ns_map_handle_to_node (device);
|
||||
node = acpi_ns_map_handle_to_node(device);
|
||||
if (!node) {
|
||||
status = AE_BAD_PARAMETER;
|
||||
goto unlock_and_exit;
|
||||
@ -172,7 +165,7 @@ acpi_remove_address_space_handler (
|
||||
|
||||
/* Make sure the internal object exists */
|
||||
|
||||
obj_desc = acpi_ns_get_attached_object (node);
|
||||
obj_desc = acpi_ns_get_attached_object(node);
|
||||
if (!obj_desc) {
|
||||
status = AE_NOT_EXIST;
|
||||
goto unlock_and_exit;
|
||||
@ -188,10 +181,11 @@ acpi_remove_address_space_handler (
|
||||
if (handler_obj->address_space.space_id == space_id) {
|
||||
/* Matched space_id, first dereference this in the Regions */
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
|
||||
"Removing address handler %p(%p) for region %s on Device %p(%p)\n",
|
||||
handler_obj, handler, acpi_ut_get_region_name (space_id),
|
||||
node, obj_desc));
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
|
||||
"Removing address handler %p(%p) for region %s on Device %p(%p)\n",
|
||||
handler_obj, handler,
|
||||
acpi_ut_get_region_name(space_id),
|
||||
node, obj_desc));
|
||||
|
||||
region_obj = handler_obj->address_space.region_list;
|
||||
|
||||
@ -205,13 +199,14 @@ acpi_remove_address_space_handler (
|
||||
* The region is just inaccessible as indicated to
|
||||
* the _REG method
|
||||
*/
|
||||
acpi_ev_detach_region (region_obj, TRUE);
|
||||
acpi_ev_detach_region(region_obj, TRUE);
|
||||
|
||||
/*
|
||||
* Walk the list: Just grab the head because the
|
||||
* detach_region removed the previous head.
|
||||
*/
|
||||
region_obj = handler_obj->address_space.region_list;
|
||||
region_obj =
|
||||
handler_obj->address_space.region_list;
|
||||
|
||||
}
|
||||
|
||||
@ -221,7 +216,7 @@ acpi_remove_address_space_handler (
|
||||
|
||||
/* Now we can delete the handler object */
|
||||
|
||||
acpi_ut_remove_reference (handler_obj);
|
||||
acpi_ut_remove_reference(handler_obj);
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
||||
@ -233,15 +228,16 @@ acpi_remove_address_space_handler (
|
||||
|
||||
/* The handler does not exist */
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
|
||||
"Unable to remove address handler %p for %s(%X), dev_node %p, obj %p\n",
|
||||
handler, acpi_ut_get_region_name (space_id), space_id, node, obj_desc));
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
|
||||
"Unable to remove address handler %p for %s(%X), dev_node %p, obj %p\n",
|
||||
handler, acpi_ut_get_region_name(space_id), space_id,
|
||||
node, obj_desc));
|
||||
|
||||
status = AE_NOT_EXIST;
|
||||
|
||||
unlock_and_exit:
|
||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
||||
return_ACPI_STATUS (status);
|
||||
unlock_and_exit:
|
||||
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_remove_address_space_handler);
|
||||
|
||||
EXPORT_SYMBOL(acpi_remove_address_space_handler);
|
||||
|
Reference in New Issue
Block a user