summaryrefslogtreecommitdiffstats
path: root/drivers/acpi/events
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/events')
-rw-r--r--drivers/acpi/events/Makefile14
-rw-r--r--drivers/acpi/events/evevent.c333
-rw-r--r--drivers/acpi/events/evmisc.c25
-rw-r--r--drivers/acpi/events/evregion.c278
-rw-r--r--drivers/acpi/events/evrgnini.c80
-rw-r--r--drivers/acpi/events/evsci.c55
-rw-r--r--drivers/acpi/events/evxface.c33
-rw-r--r--drivers/acpi/events/evxfevnt.c98
-rw-r--r--drivers/acpi/events/evxfregn.c10
9 files changed, 383 insertions, 543 deletions
diff --git a/drivers/acpi/events/Makefile b/drivers/acpi/events/Makefile
index edd897133..751ef5de8 100644
--- a/drivers/acpi/events/Makefile
+++ b/drivers/acpi/events/Makefile
@@ -2,26 +2,14 @@
# Makefile for all Linux ACPI interpreter subdirectories
#
-SUB_DIRS :=
-MOD_SUB_DIRS := $(SUB_DIRS)
-MOD_IN_SUB_DIRS :=
-ALL_SUB_DIRS := $(SUB_DIRS)
-
O_TARGET := ../$(shell basename `pwd`).o
-O_OBJS :=
-M_OBJS :=
-ACPI_OBJS := $(patsubst %.c,%.o,$(wildcard *.c))
+obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c))
EXTRA_CFLAGS += -I../include
EXTRA_CFLAGS += $(ACPI_CFLAGS)
-# if the interpreter is used, it overrides arch/i386/kernel/acpi.c
-ifeq ($(CONFIG_ACPI_INTERPRETER),y)
- O_OBJS := $(ACPI_OBJS)
-endif
-
include $(TOPDIR)/Rules.make
clean:
diff --git a/drivers/acpi/events/evevent.c b/drivers/acpi/events/evevent.c
index b3e57cd79..d5ce143a8 100644
--- a/drivers/acpi/events/evevent.c
+++ b/drivers/acpi/events/evevent.c
@@ -2,7 +2,7 @@
*
* Module Name: evevent - Fixed and General Purpose Acpi_event
* handling and dispatch
- * $Revision: 13 $
+ * $Revision: 32 $
*
*****************************************************************************/
@@ -34,6 +34,86 @@
MODULE_NAME ("evevent")
+/**************************************************************************
+ *
+ * FUNCTION: Acpi_ev_initialize
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Ensures that the system control interrupt (SCI) is properly
+ * configured, disables SCI event sources, installs the SCI
+ * handler
+ *
+ *************************************************************************/
+
+ACPI_STATUS
+acpi_ev_initialize (
+ void)
+{
+ ACPI_STATUS status;
+
+
+ /* Make sure we've got ACPI tables */
+
+ if (!acpi_gbl_DSDT) {
+ return (AE_NO_ACPI_TABLES);
+ }
+
+
+ /* Make sure the BIOS supports ACPI mode */
+
+ if (SYS_MODE_LEGACY == acpi_hw_get_mode_capabilities()) {
+ return (AE_ERROR);
+ }
+
+
+ acpi_gbl_original_mode = acpi_hw_get_mode();
+
+ /*
+ * Initialize the Fixed and General Purpose Acpi_events prior. This is
+ * done prior to enabling SCIs to prevent interrupts from occuring
+ * before handers are installed.
+ */
+
+ status = acpi_ev_fixed_event_initialize ();
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
+
+ status = acpi_ev_gpe_initialize ();
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
+
+ /* Install the SCI handler */
+
+ status = acpi_ev_install_sci_handler ();
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
+
+
+ /* Install handlers for control method GPE handlers (_Lxx, _Exx) */
+
+ status = acpi_ev_init_gpe_control_methods ();
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
+
+ /* Install the handler for the Global Lock */
+
+ status = acpi_ev_init_global_lock_handler ();
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
+
+
+ return (status);
+}
+
+
/******************************************************************************
*
* FUNCTION: Acpi_ev_fixed_event_initialize
@@ -58,16 +138,11 @@ acpi_ev_fixed_event_initialize(void)
acpi_gbl_fixed_event_handlers[i].context = NULL;
}
- acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_LOCK, ACPI_EVENT_PMTIMER +
- TMR_EN, 0);
- acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_LOCK, ACPI_EVENT_GLOBAL +
- TMR_EN, 0);
- acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_LOCK, ACPI_EVENT_POWER_BUTTON +
- TMR_EN, 0);
- acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_LOCK, ACPI_EVENT_SLEEP_BUTTON +
- TMR_EN, 0);
- acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_LOCK, ACPI_EVENT_RTC +
- TMR_EN, 0);
+ acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, TMR_EN, 0);
+ acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, GBL_EN, 0);
+ acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, PWRBTN_EN, 0);
+ acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, SLPBTN_EN, 0);
+ acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, RTC_EN, 0);
return (AE_OK);
}
@@ -89,25 +164,17 @@ u32
acpi_ev_fixed_event_detect(void)
{
u32 int_status = INTERRUPT_NOT_HANDLED;
- u32 status_register = 0;
- u32 enable_register = 0;
+ u32 status_register;
+ u32 enable_register;
/*
* Read the fixed feature status and enable registers, as all the cases
* depend on their values.
*/
- status_register = (u32) acpi_os_in16 (acpi_gbl_FACP->pm1a_evt_blk);
- if (acpi_gbl_FACP->pm1b_evt_blk) {
- status_register |= (u32) acpi_os_in16 (acpi_gbl_FACP->pm1b_evt_blk);
- }
+ status_register = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, PM1_STS);
+ enable_register = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, PM1_EN);
- enable_register = (u32) acpi_os_in16 (acpi_gbl_FACP->pm1a_evt_blk +
- DIV_2 (acpi_gbl_FACP->pm1_evt_len));
- if (acpi_gbl_FACP->pm1b_evt_blk) {
- enable_register |= (u32) acpi_os_in16 (acpi_gbl_FACP->pm1b_evt_blk +
- DIV_2 (acpi_gbl_FACP->pm1_evt_len));
- }
/* power management timer roll over */
@@ -162,20 +229,53 @@ u32
acpi_ev_fixed_event_dispatch (
u32 event)
{
+ u32 register_id;
+
/* Clear the status bit */
- acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_DO_NOT_LOCK, TMR_STS +
- event, 1);
+ switch (event)
+ {
+ case ACPI_EVENT_PMTIMER:
+ register_id = TMR_STS;
+ break;
+
+ case ACPI_EVENT_GLOBAL:
+ register_id = GBL_STS;
+ break;
+
+ case ACPI_EVENT_POWER_BUTTON:
+ register_id = PWRBTN_STS;
+ break;
+
+ case ACPI_EVENT_SLEEP_BUTTON:
+ register_id = SLPBTN_STS;
+ break;
+
+ case ACPI_EVENT_RTC:
+ register_id = RTC_STS;
+ break;
+
+ default:
+ return 0;
+ break;
+ }
+
+ acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_DO_NOT_LOCK, register_id, 1);
/*
* 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) {
- acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_DO_NOT_LOCK,
- TMR_EN + event, 0);
+ register_id = (PM1_EN | REGISTER_BIT_ID(register_id));
+
+ acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_DO_NOT_LOCK,
+ register_id, 0);
+
+ REPORT_ERROR (
+ ("Ev_gpe_dispatch: No installed handler for fixed event [%08X]\n",
+ event));
- REPORT_ERROR("No installed handler for fixed event.");
return (INTERRUPT_NOT_HANDLED);
}
@@ -210,15 +310,28 @@ acpi_ev_gpe_initialize (void)
/*
- * Setup various GPE counts
+ * Set up various GPE counts
+ *
+ * You may ask,why are the GPE register block lengths divided by 2?
+ * From the ACPI 2.0 Spec, section, 4.7.1.6 General-Purpose Event
+ * Registers, we have,
+ *
+ * "Each register block contains two registers of equal length
+ * GPEx_STS and GPEx_EN (where x is 0 or 1). The length of the
+ * GPE0_STS and GPE0_EN registers is equal to half the GPE0_LEN
+ * The length of the GPE1_STS and GPE1_EN registers is equal to
+ * half the GPE1_LEN. If a generic register block is not supported
+ * then its respective block pointer and block length values in the
+ * FADT table contain zeros. The GPE0_LEN and GPE1_LEN do not need
+ * to be the same size."
*/
- gpe0register_count = (u16) DIV_2 (acpi_gbl_FACP->gpe0blk_len);
- gpe1_register_count = (u16) DIV_2 (acpi_gbl_FACP->gpe1_blk_len);
+ gpe0register_count = (u16) DIV_2 (acpi_gbl_FADT->gpe0blk_len);
+ gpe1_register_count = (u16) DIV_2 (acpi_gbl_FADT->gpe1_blk_len);
acpi_gbl_gpe_register_count = gpe0register_count + gpe1_register_count;
if (!acpi_gbl_gpe_register_count) {
- REPORT_WARNING ("No GPEs defined in the FACP");
+ REPORT_WARNING (("Zero GPEs are defined in the FADT\n"));
return (AE_OK);
}
@@ -262,10 +375,10 @@ acpi_ev_gpe_initialize (void)
for (i = 0; i < gpe0register_count; i++) {
acpi_gbl_gpe_registers[register_index].status_addr =
- (u16) (acpi_gbl_FACP->gpe0blk + i);
+ (u16) (ACPI_GET_ADDRESS (acpi_gbl_FADT->Xgpe0blk.address) + i);
acpi_gbl_gpe_registers[register_index].enable_addr =
- (u16) (acpi_gbl_FACP->gpe0blk + i + gpe0register_count);
+ (u16) (ACPI_GET_ADDRESS (acpi_gbl_FADT->Xgpe0blk.address) + i + gpe0register_count);
acpi_gbl_gpe_registers[register_index].gpe_base = (u8) MUL_8 (i);
@@ -289,13 +402,13 @@ acpi_ev_gpe_initialize (void)
for (i = 0; i < gpe1_register_count; i++) {
acpi_gbl_gpe_registers[register_index].status_addr =
- (u16) (acpi_gbl_FACP->gpe1_blk + i);
+ (u16) (ACPI_GET_ADDRESS (acpi_gbl_FADT->Xgpe1_blk.address) + i);
acpi_gbl_gpe_registers[register_index].enable_addr =
- (u16) (acpi_gbl_FACP->gpe1_blk + i + gpe1_register_count);
+ (u16) (ACPI_GET_ADDRESS (acpi_gbl_FADT->Xgpe1_blk.address) + i + gpe1_register_count);
acpi_gbl_gpe_registers[register_index].gpe_base =
- (u8) (acpi_gbl_FACP->gpe1_base + MUL_8 (i));
+ (u8) (acpi_gbl_FADT->gpe1_base + MUL_8 (i));
for (j = 0; j < 8; j++) {
gpe_number = acpi_gbl_gpe_registers[register_index].gpe_base + j;
@@ -339,7 +452,7 @@ acpi_ev_gpe_initialize (void)
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
acpi_ev_save_method_info (
ACPI_HANDLE obj_handle,
u32 level,
@@ -446,29 +559,6 @@ acpi_ev_init_gpe_control_methods (void)
/******************************************************************************
*
- * FUNCTION: Acpi_ev_gpe_cleanup
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Cleanup in preparation for unload.
- *
- ******************************************************************************/
-
-void
-acpi_ev_gpe_cleanup (void)
-{
-
- acpi_cm_free (acpi_gbl_gpe_registers);
- acpi_cm_free (acpi_gbl_gpe_info);
-
- return;
-}
-
-
-/******************************************************************************
- *
* FUNCTION: Acpi_ev_gpe_detect
*
* PARAMETERS: None
@@ -549,7 +639,7 @@ acpi_ev_gpe_detect (void)
*
******************************************************************************/
-void
+static void
acpi_ev_asynch_execute_gpe_method (
void *context)
{
@@ -557,38 +647,28 @@ acpi_ev_asynch_execute_gpe_method (
ACPI_GPE_LEVEL_INFO gpe_info;
- /* Take a snapshot of the GPE info for this level */
-
+ /*
+ * Take a snapshot of the GPE info for this level
+ */
acpi_cm_acquire_mutex (ACPI_MTX_EVENTS);
gpe_info = acpi_gbl_gpe_info [gpe_number];
acpi_cm_release_mutex (ACPI_MTX_EVENTS);
/*
- * Function Handler (e.g. EC):
- * ---------------------------
- * Execute the installed function handler to handle this event.
- */
- if (gpe_info.handler) {
- gpe_info.handler (gpe_info.context);
- }
-
- /*
* Method Handler (_Lxx, _Exx):
* ----------------------------
- * Acpi_evaluate the _Lxx/_Exx control method that corresponds to this GPE.
+ * Evaluate the _Lxx/_Exx control method that corresponds to this GPE.
*/
- else if (gpe_info.method_handle) {
+ if (gpe_info.method_handle) {
acpi_ns_evaluate_by_handle (gpe_info.method_handle, NULL, NULL);
}
/*
* Level-Triggered?
* ----------------
- * If level-triggered, clear the GPE status bit after execution. Note
- * that edge-triggered events are cleared prior to calling (via DPC)
- * this function.
+ * If level-triggered we clear the GPE status bit after handling the event.
*/
- if (gpe_info.type | ACPI_EVENT_LEVEL_TRIGGERED) {
+ if (gpe_info.type & ACPI_EVENT_LEVEL_TRIGGERED) {
acpi_hw_clear_gpe (gpe_number);
}
@@ -624,11 +704,13 @@ u32
acpi_ev_gpe_dispatch (
u32 gpe_number)
{
+ ACPI_GPE_LEVEL_INFO gpe_info;
/*DEBUG_INCREMENT_EVENT_COUNT (EVENT_GENERAL);*/
- /* Ensure that we have a valid GPE number */
-
+ /*
+ * Valid GPE number?
+ */
if (acpi_gbl_gpe_valid[gpe_number] == ACPI_GPE_INVALID) {
return (INTERRUPT_NOT_HANDLED);
}
@@ -638,48 +720,59 @@ acpi_ev_gpe_dispatch (
*/
acpi_hw_disable_gpe (gpe_number);
- /*
- * Edge-Triggered?
- * ---------------
- * If edge-triggered, clear the GPE status bit now. Note that
- * level-triggered events are cleared after the GPE is serviced
- * (see Acpi_ev_asynch_execute_gpe_method).
- */
- if (acpi_gbl_gpe_info [gpe_number].type | ACPI_EVENT_EDGE_TRIGGERED) {
- acpi_hw_clear_gpe (gpe_number);
- }
+ gpe_info = acpi_gbl_gpe_info [gpe_number];
- /*
- * Queue-up the Handler:
- * ---------------------
- * Queue the handler, which is either an installable function handler
- * (e.g. EC) or a control method (e.g. _Lxx/_Exx) for later execution.
- */
- if (acpi_gbl_gpe_info [gpe_number].handler ||
- acpi_gbl_gpe_info [gpe_number].method_handle)
- {
- if (ACPI_FAILURE (acpi_os_queue_for_execution (OSD_PRIORITY_GPE,
- acpi_ev_asynch_execute_gpe_method,
- (void*)(NATIVE_UINT)gpe_number)))
- {
- /*
- * Shoudn't occur, but if it does report an error. Note that
- * the GPE will remain disabled until the ACPI Core Subsystem
- * is restarted, or the handler is removed/reinstalled.
- */
- REPORT_ERROR ("Unable to queue-up handler for GPE.");
+ /*
+ * Edge-Triggered?
+ * ---------------
+ * If edge-triggered, clear the GPE status bit now. Note that
+ * level-triggered events are cleared after the GPE is serviced.
+ */
+ if (gpe_info.type & ACPI_EVENT_EDGE_TRIGGERED) {
+ acpi_hw_clear_gpe (gpe_number);
}
- }
- /*
- * Non Handled GPEs:
- * -----------------
- * GPEs without handlers are disabled and kept that way until a handler
- * is registered for them.
- */
- else {
- REPORT_ERROR ("No installed handler for GPE.");
- }
+ /*
+ * Function Handler (e.g. EC)?
+ */
+ if (gpe_info.handler) {
+ /* Invoke function handler (at interrupt level). */
+ gpe_info.handler (gpe_info.context);
+
+ /* Level-Triggered? */
+ if (gpe_info.type & ACPI_EVENT_LEVEL_TRIGGERED) {
+ acpi_hw_clear_gpe (gpe_number);
+ }
+
+ /* Enable GPE */
+ acpi_hw_enable_gpe (gpe_number);
+ }
+ /*
+ * Method Handler (e.g. _Exx/_Lxx)?
+ */
+ else if (gpe_info.method_handle) {
+ if (ACPI_FAILURE(acpi_os_queue_for_execution (OSD_PRIORITY_GPE,
+ acpi_ev_asynch_execute_gpe_method, (void*)(NATIVE_UINT)gpe_number)))
+ {
+ /*
+ * Shoudn't occur, but if it does report an error. Note that
+ * the GPE will remain disabled until the ACPI Core Subsystem
+ * is restarted, or the handler is removed/reinstalled.
+ */
+ REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to queue handler for GPE bit [%X]\n", gpe_number));
+ }
+ }
+ /*
+ * No Handler? Report an error and leave the GPE disabled.
+ */
+ else {
+ REPORT_ERROR (("Acpi_ev_gpe_dispatch: No installed handler for GPE [%X]\n", gpe_number));
+
+ /* Level-Triggered? */
+ if (gpe_info.type & ACPI_EVENT_LEVEL_TRIGGERED) {
+ acpi_hw_clear_gpe (gpe_number);
+ }
+ }
return (INTERRUPT_HANDLED);
}
diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c
index 5ca325c46..a52f2dc3d 100644
--- a/drivers/acpi/events/evmisc.c
+++ b/drivers/acpi/events/evmisc.c
@@ -2,7 +2,7 @@
*
* Module Name: evmisc - ACPI device notification handler dispatch
* and ACPI Global Lock support
- * $Revision: 13 $
+ * $Revision: 20 $
*
*****************************************************************************/
@@ -157,7 +157,7 @@ acpi_ev_notify_dispatch (
*
**************************************************************************/
-void
+static void
acpi_ev_global_lock_thread (
void *context)
{
@@ -185,7 +185,7 @@ acpi_ev_global_lock_thread (
*
**************************************************************************/
-u32
+static u32
acpi_ev_global_lock_handler (
void *context)
{
@@ -199,7 +199,7 @@ acpi_ev_global_lock_handler (
* take another interrupt when it becomes free.
*/
- global_lock = &acpi_gbl_FACS->global_lock;
+ global_lock = acpi_gbl_FACS->global_lock;
ACPI_ACQUIRE_GLOBAL_LOCK (global_lock, acquired);
if (acquired) {
/* Got the lock, now wake all threads waiting for it */
@@ -275,9 +275,9 @@ acpi_ev_acquire_global_lock(void)
}
- /* We must acquire the actualy hardware lock */
+ /* We must acquire the actual hardware lock */
- global_lock = &acpi_gbl_FACS->global_lock;
+ global_lock = acpi_gbl_FACS->global_lock;
ACPI_ACQUIRE_GLOBAL_LOCK (global_lock, acquired);
if (acquired) {
/* We got the lock */
@@ -298,11 +298,8 @@ acpi_ev_acquire_global_lock(void)
* Since this wait will block, we must release the interpreter
*/
- acpi_aml_exit_interpreter ();
status = acpi_aml_system_wait_semaphore (acpi_gbl_global_lock_semaphore,
ACPI_UINT32_MAX);
- acpi_aml_enter_interpreter ();
-
return (status);
}
@@ -323,7 +320,8 @@ acpi_ev_release_global_lock (void)
void *global_lock;
- if (!acpi_gbl_FACS) {
+ if (!acpi_gbl_global_lock_thread_count) {
+ REPORT_WARNING(("Releasing a non-acquired Global Lock\n"));
return;
}
@@ -331,7 +329,6 @@ acpi_ev_release_global_lock (void)
acpi_gbl_global_lock_thread_count--;
-
/* Have all threads released the lock? */
if (!acpi_gbl_global_lock_thread_count) {
@@ -340,7 +337,7 @@ acpi_ev_release_global_lock (void)
* release
*/
- global_lock = &acpi_gbl_FACS->global_lock;
+ global_lock = acpi_gbl_FACS->global_lock;
ACPI_RELEASE_GLOBAL_LOCK (global_lock, pending);
acpi_gbl_global_lock_acquired = FALSE;
@@ -349,8 +346,8 @@ acpi_ev_release_global_lock (void)
* register
*/
if (pending) {
- acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_LOCK,
- PM1_CONTROL | GBL_RLS, 1);
+ acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK,
+ GBL_RLS, 1);
}
}
diff --git a/drivers/acpi/events/evregion.c b/drivers/acpi/events/evregion.c
index d544b1bbc..53cae6392 100644
--- a/drivers/acpi/events/evregion.c
+++ b/drivers/acpi/events/evregion.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
- * Module Name: evregion - ACPI Address_space / Op_region handler dispatch
- * $Revision: 76 $
+ * Module Name: evregion - ACPI Address_space (Op_region) handler dispatch
+ * $Revision: 93 $
*
*****************************************************************************/
@@ -34,202 +34,6 @@
MODULE_NAME ("evregion")
-#define PCI_ROOT_HID_STRING "PNP0A03"
-#define PCI_ROOT_HID_VALUE 0x030AD041 /* EISAID("PNP0A03") */
-
-
-/******************************************************************************
- *
- * FUNCTION: Acpi_ev_find_one_pci_root_bus
- *
- * PARAMETERS:
- *
- * RETURN: None
- *
- * DESCRIPTION:
- *
- *****************************************************************************/
-
-ACPI_STATUS
-acpi_ev_find_one_pci_root_bus (
- ACPI_HANDLE obj_handle,
- u32 nesting_level,
- void *context,
- void **return_value)
-{
- ACPI_NAMESPACE_NODE *node;
- ACPI_OPERAND_OBJECT *obj_desc;
- ACPI_STATUS status;
-
-
- node = (ACPI_NAMESPACE_NODE *) obj_handle;
- obj_desc = ((ACPI_NAMESPACE_NODE *) obj_handle)->object;
-
-
- /*
- * We are looking for all valid _HID objects.
- */
-
- if (STRNCMP ((NATIVE_CHAR *) &node->name, METHOD_NAME__HID, ACPI_NAME_SIZE) ||
- (!obj_desc))
- {
- return (AE_OK);
- }
-
-
- /*
- * Found an _HID object.
- * Now we need a HID with the value EISAID("PNP0A03")
- * HID can be either a number or a string.
- */
-
- switch (obj_desc->common.type)
- {
- case ACPI_TYPE_NUMBER:
-
- if (obj_desc->number.value != PCI_ROOT_HID_VALUE) {
- return (AE_OK);
- }
-
- break;
-
- case ACPI_TYPE_STRING:
-
- if (STRNCMP (obj_desc->string.pointer, PCI_ROOT_HID_STRING,
- sizeof (PCI_ROOT_HID_STRING)))
- {
- return (AE_OK);
- }
-
- break;
-
- default:
-
- return (AE_OK);
- }
-
-
- /*
- * We found a valid PCI_ROOT_HID.
- * The parent of the HID entry is the PCI device; Install the default PCI
- * handler for this PCI device.
- */
-
- status = acpi_install_address_space_handler (acpi_ns_get_parent_object (node),
- ADDRESS_SPACE_PCI_CONFIG,
- ACPI_DEFAULT_HANDLER, NULL, NULL);
-
- return (AE_OK);
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: Acpi_ev_find_pci_root_buses
- *
- * PARAMETERS:
- *
- * RETURN: None
- *
- * DESCRIPTION:
- *
- *****************************************************************************/
-
-ACPI_STATUS
-acpi_ev_find_pci_root_buses (
- void)
-{
-
- acpi_ns_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
- FALSE, acpi_ev_find_one_pci_root_bus, NULL, NULL);
-
- return (AE_OK);
-}
-
-/******************************************************************************
- *
- * FUNCTION: Acpi_ev_init_one_device
- *
- * PARAMETERS: The usual "I'm a namespace callback" stuff
- *
- * RETURN: ACPI_STATUS
- *
- * DESCRIPTION: This is called once per device soon after ACPI is enabled
- * to initialize each device. It determines if the device is
- * present, and if so, calls _INI.
- *
- *****************************************************************************/
-
-ACPI_STATUS
-acpi_ev_init_one_device (
- ACPI_HANDLE obj_handle,
- u32 nesting_level,
- void *context,
- void **return_value)
-{
- ACPI_STATUS status;
- ACPI_OPERAND_OBJECT *ret_obj;
-
-
- /*
- * Run _STA to determine if we can run _INI on the device.
- */
- status = acpi_ns_evaluate_relative(obj_handle, "_STA", NULL, &ret_obj);
- if (AE_NOT_FOUND == status) {
- /* No _STA means device is present */
- }
- else if (ACPI_FAILURE (status)) {
- return (status);
- }
- else if (ret_obj) {
- if (ACPI_TYPE_NUMBER != ret_obj->common.type) {
- status = AE_AML_OPERAND_TYPE;
- goto cleanup;
- }
-
- /*
- * if _STA "present" bit not set, we're done.
- */
- if (!(ret_obj->number.value & 1)) {
- goto cleanup;
- }
- }
-
- /*
- * The device is present. Run _INI.
- */
-
- status = acpi_ns_evaluate_relative(obj_handle, "_INI", NULL, NULL);
-
-cleanup:
-
- acpi_cm_remove_reference (ret_obj);
- return (status);
-}
-
-/******************************************************************************
- *
- * FUNCTION: Acpi_ev_init_devices
- *
- * PARAMETERS: None
- *
- * RETURN: ACPI_STATUS
- *
- * DESCRIPTION: This initializes all ACPI devices.
- *
- *****************************************************************************/
-
-ACPI_STATUS
-acpi_ev_init_devices (
- void)
-{
- acpi_ns_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
- FALSE, acpi_ev_init_one_device, NULL, NULL);
-
- return (AE_OK);
-}
-
-
/**************************************************************************
*
* FUNCTION: Acpi_ev_install_default_address_space_handlers
@@ -250,23 +54,45 @@ acpi_ev_install_default_address_space_handlers (
/*
- * NOTE: All address spaces (PCI Config, EC, SMBus) are scope dependent
- * and registration must occur for a specific device. In the case
- * system memory and IO address spaces there is currently no device
- * associated with the address space. For these we use the root.
+ * All address spaces (PCI Config, EC, SMBus) are scope dependent
+ * and registration must occur for a specific device. In the case
+ * system memory and IO address spaces there is currently no device
+ * associated with the address space. For these we use the root.
+ * We install the default PCI config space handler at the root so
+ * that this space is immediately available even though the we have
+ * not enumerated all the PCI Root Buses yet. This is to conform
+ * to the ACPI specification which states that the PCI config
+ * space must be always available -- even though we are nowhere
+ * near ready to find the PCI root buses at this point.
+ *
+ * NOTE: We ignore AE_EXIST because this means that a handler has
+ * already been installed (via Acpi_install_address_space_handler)
*/
status = acpi_install_address_space_handler (acpi_gbl_root_node,
ADDRESS_SPACE_SYSTEM_MEMORY,
ACPI_DEFAULT_HANDLER, NULL, NULL);
- if (ACPI_FAILURE (status)) {
+ if ((ACPI_FAILURE (status)) &&
+ (status != AE_EXIST))
+ {
return (status);
}
status = acpi_install_address_space_handler (acpi_gbl_root_node,
ADDRESS_SPACE_SYSTEM_IO,
ACPI_DEFAULT_HANDLER, NULL, NULL);
- if (ACPI_FAILURE (status)) {
+ if ((ACPI_FAILURE (status)) &&
+ (status != AE_EXIST))
+ {
+ return (status);
+ }
+
+ status = acpi_install_address_space_handler (acpi_gbl_root_node,
+ ADDRESS_SPACE_PCI_CONFIG,
+ ACPI_DEFAULT_HANDLER, NULL, NULL);
+ if ((ACPI_FAILURE (status)) &&
+ (status != AE_EXIST))
+ {
return (status);
}
@@ -275,7 +101,7 @@ acpi_ev_install_default_address_space_handlers (
}
-/* TBD: [Restructure] Move to the methods directory */
+/* TBD: [Restructure] Move elsewhere */
/**************************************************************************
*
@@ -290,7 +116,7 @@ acpi_ev_install_default_address_space_handlers (
*
*************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
acpi_ev_execute_reg_method (
ACPI_OPERAND_OBJECT *region_obj,
u32 function)
@@ -301,7 +127,7 @@ acpi_ev_execute_reg_method (
ACPI_STATUS status;
- if (region_obj->region.REGmethod == NULL) {
+ if (region_obj->region.extra->extra.method_REG == NULL) {
return (AE_OK);
}
@@ -337,7 +163,7 @@ acpi_ev_execute_reg_method (
/*
* Execute the method, no return value
*/
- status = acpi_ns_evaluate_by_handle (region_obj->region.REGmethod, params, NULL);
+ status = acpi_ns_evaluate_by_handle (region_obj->region.extra->extra.method_REG, params, NULL);
return (status);
}
@@ -364,7 +190,7 @@ ACPI_STATUS
acpi_ev_address_space_dispatch (
ACPI_OPERAND_OBJECT *region_obj,
u32 function,
- u32 address,
+ ACPI_PHYSICAL_ADDRESS address,
u32 bit_width,
u32 *value)
{
@@ -381,7 +207,7 @@ acpi_ev_address_space_dispatch (
handler_desc = region_obj->region.addr_handler;
if (!handler_desc) {
- return(AE_EXIST);
+ return(AE_NOT_EXIST);
}
/*
@@ -421,11 +247,13 @@ acpi_ev_address_space_dispatch (
return(status);
}
+ region_obj->region.flags |= AOPOBJ_INITIALIZED;
+
/*
* Save the returned context for use in all accesses to
* this particular region.
*/
- region_obj->region.region_context = region_context;
+ region_obj->region.extra->extra.region_context = region_context;
}
/*
@@ -447,7 +275,7 @@ acpi_ev_address_space_dispatch (
*/
status = handler (function, address, bit_width, value,
handler_desc->addr_handler.context,
- region_obj->region.region_context);
+ region_obj->region.extra->extra.region_context);
if (!(handler_desc->addr_handler.flags & ADDR_HANDLER_DEFAULT_INSTALLED)) {
@@ -462,10 +290,10 @@ acpi_ev_address_space_dispatch (
/******************************************************************************
*
- * FUNCTION: Acpi_ev_disassociate_region_and_handler
+ * FUNCTION: Acpi_ev_disassociate_region_from_handler
*
- * PARAMETERS: Handler_obj - Handler Object
- * Region_obj - Region Object
+ * PARAMETERS: Region_obj - Region Object
+ * Acpi_ns_is_locked - Namespace Region Already Locked?
*
* RETURN: None
*
@@ -476,16 +304,19 @@ acpi_ev_address_space_dispatch (
void
acpi_ev_disassociate_region_from_handler(
- ACPI_OPERAND_OBJECT *region_obj)
+ ACPI_OPERAND_OBJECT *region_obj,
+ u8 acpi_ns_is_locked)
{
ACPI_OPERAND_OBJECT *handler_obj;
ACPI_OPERAND_OBJECT *obj_desc;
ACPI_OPERAND_OBJECT **last_obj_ptr;
ADDRESS_SPACE_SETUP region_setup;
- void *region_context = region_obj->region.region_context;
+ void *region_context;
ACPI_STATUS status;
+ region_context = region_obj->region.extra->extra.region_context;
+
/*
* Get the address handler from the region object
*/
@@ -517,11 +348,19 @@ acpi_ev_disassociate_region_from_handler(
*last_obj_ptr = obj_desc->region.next;
obj_desc->region.next = NULL; /* Must clear field */
+ if (acpi_ns_is_locked) {
+ acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
+ }
+
/*
* Now stop region accesses by executing the _REG method
*/
acpi_ev_execute_reg_method (region_obj, 0);
+ if (acpi_ns_is_locked) {
+ acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE);
+ }
+
/*
* Call the setup handler with the deactivate notification
*/
@@ -534,6 +373,8 @@ acpi_ev_disassociate_region_from_handler(
* Init routine may fail, Just ignore errors
*/
+ region_obj->region.flags &= ~(AOPOBJ_INITIALIZED);
+
/*
* Remove handler reference in the region
*
@@ -572,6 +413,7 @@ acpi_ev_disassociate_region_from_handler(
*
* PARAMETERS: Handler_obj - Handler Object
* Region_obj - Region Object
+ * Acpi_ns_is_locked - Namespace Region Already Locked?
*
* RETURN: None
*
@@ -757,7 +599,7 @@ acpi_ev_addr_handler_helper (
*
* First disconnect region for any previous handler (if any)
*/
- acpi_ev_disassociate_region_from_handler (obj_desc);
+ acpi_ev_disassociate_region_from_handler (obj_desc, FALSE);
/*
* Then connect the region to the new handler
diff --git a/drivers/acpi/events/evrgnini.c b/drivers/acpi/events/evrgnini.c
index cb1b2de5b..92e5f198f 100644
--- a/drivers/acpi/events/evrgnini.c
+++ b/drivers/acpi/events/evrgnini.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
- * Module Name: evrgnini- ACPI Address_space / Op_region init
- * $Revision: 22 $
+ * Module Name: evrgnini- ACPI Address_space (Op_region) init
+ * $Revision: 31 $
*
*****************************************************************************/
@@ -56,12 +56,8 @@ acpi_ev_system_memory_region_setup (
void *handler_context,
void **region_context)
{
- ACPI_OPERAND_OBJECT *region_obj = (ACPI_OPERAND_OBJECT *) handle;
-
if (function == ACPI_REGION_DEACTIVATE) {
- region_obj->region.flags &= ~(AOPOBJ_INITIALIZED);
-
if (*region_context) {
acpi_cm_free (*region_context);
*region_context = NULL;
@@ -77,10 +73,6 @@ acpi_ev_system_memory_region_setup (
return (AE_NO_MEMORY);
}
- /* Init. (Mapping fields are all set to zeros above) */
-
- region_obj->region.flags |= AOPOBJ_INITIALIZED;
-
return (AE_OK);
}
@@ -107,15 +99,11 @@ acpi_ev_io_space_region_setup (
void *handler_context,
void **region_context)
{
- ACPI_OPERAND_OBJECT *region_obj = (ACPI_OPERAND_OBJECT *) handle;
-
if (function == ACPI_REGION_DEACTIVATE) {
*region_context = NULL;
- region_obj->region.flags &= ~(AOPOBJ_INITIALIZED);
}
else {
*region_context = handler_context;
- region_obj->region.flags |= AOPOBJ_INITIALIZED;
}
return (AE_OK);
@@ -135,7 +123,7 @@ acpi_ev_io_space_region_setup (
*
* DESCRIPTION: Do any prep work for region handling
*
- * MUTEX: Assumes namespace is locked
+ * MUTEX: Assumes namespace is not locked
*
****************************************************************************/
@@ -147,12 +135,12 @@ acpi_ev_pci_config_region_setup (
void **region_context)
{
ACPI_STATUS status = AE_OK;
- u32 temp;
+ ACPI_INTEGER temp;
PCI_HANDLER_CONTEXT *pci_context = *region_context;
ACPI_OPERAND_OBJECT *handler_obj;
ACPI_NAMESPACE_NODE *node;
ACPI_OPERAND_OBJECT *region_obj = (ACPI_OPERAND_OBJECT *) handle;
-
+ DEVICE_ID object_hID;
handler_obj = region_obj->region.addr_handler;
@@ -161,12 +149,10 @@ 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.
*/
- return(AE_EXIST);
+ return(AE_NOT_EXIST);
}
if (function == ACPI_REGION_DEACTIVATE) {
- region_obj->region.flags &= ~(AOPOBJ_INITIALIZED);
-
if (pci_context) {
acpi_cm_free (pci_context);
*region_context = NULL;
@@ -197,8 +183,6 @@ acpi_ev_pci_config_region_setup (
node = acpi_ns_get_parent_object (region_obj->region.node);
- acpi_cm_release_mutex (ACPI_MTX_NAMESPACE);
-
/* Acpi_evaluate the _ADR object */
status = acpi_cm_evaluate_numeric_object (METHOD_NAME__ADR, node, &temp);
@@ -210,7 +194,7 @@ acpi_ev_pci_config_region_setup (
/*
* Got it..
*/
- pci_context->dev_func = temp;
+ pci_context->dev_func = (u32) temp;
}
/*
@@ -221,14 +205,43 @@ acpi_ev_pci_config_region_setup (
* This is the device the handler has been registered to handle.
*/
- node = handler_obj->addr_handler.node;
+ /*
+ * If the Addr_handler.Node is still pointing to the root, we need
+ * to scan upward for a PCI Root bridge and re-associate the Op_region
+ * handlers with that device.
+ */
+ if (handler_obj->addr_handler.node == acpi_gbl_root_node) {
+ /*
+ * Node is currently the parent object
+ */
+ while (node != acpi_gbl_root_node) {
+ status = acpi_cm_execute_HID(node, &object_hID);
+
+ if (ACPI_SUCCESS (status)) {
+ if (!(STRNCMP(object_hID.buffer, PCI_ROOT_HID_STRING,
+ sizeof (PCI_ROOT_HID_STRING))))
+ {
+ acpi_install_address_space_handler(node,
+ ADDRESS_SPACE_PCI_CONFIG,
+ ACPI_DEFAULT_HANDLER, NULL, NULL);
+
+ break;
+ }
+ }
+
+ node = acpi_ns_get_parent_object(node);
+ }
+ }
+ else {
+ node = handler_obj->addr_handler.node;
+ }
status = acpi_cm_evaluate_numeric_object (METHOD_NAME__SEG, node, &temp);
if (ACPI_SUCCESS (status)) {
/*
* Got it..
*/
- pci_context->seg = temp;
+ pci_context->seg = (u32) temp;
}
status = acpi_cm_evaluate_numeric_object (METHOD_NAME__BBN, node, &temp);
@@ -236,15 +249,11 @@ acpi_ev_pci_config_region_setup (
/*
* Got it..
*/
- pci_context->bus = temp;
+ pci_context->bus = (u32) temp;
}
*region_context = pci_context;
- acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE);
-
- region_obj->region.flags |= AOPOBJ_INITIALIZED;
-
return (AE_OK);
}
@@ -271,16 +280,11 @@ acpi_ev_default_region_setup (
void *handler_context,
void **region_context)
{
- ACPI_OPERAND_OBJECT *region_obj = (ACPI_OPERAND_OBJECT *) handle;
-
-
if (function == ACPI_REGION_DEACTIVATE) {
*region_context = NULL;
- region_obj->region.flags &= ~(AOPOBJ_INITIALIZED);
}
else {
*region_context = handler_context;
- region_obj->region.flags |= AOPOBJ_INITIALIZED;
}
return (AE_OK);
@@ -315,7 +319,7 @@ acpi_ev_initialize_region (
{
ACPI_OPERAND_OBJECT *handler_obj;
ACPI_OPERAND_OBJECT *obj_desc;
- u32 space_id;
+ ACPI_ADDRESS_SPACE_TYPE space_id;
ACPI_NAMESPACE_NODE *node;
ACPI_STATUS status;
ACPI_NAMESPACE_NODE *method_node;
@@ -332,7 +336,7 @@ acpi_ev_initialize_region (
space_id = region_obj->region.space_id;
region_obj->region.addr_handler = NULL;
- region_obj->region.REGmethod = NULL;
+ region_obj->region.extra->extra.method_REG = NULL;
region_obj->region.flags &= ~(AOPOBJ_INITIALIZED);
/*
@@ -346,7 +350,7 @@ acpi_ev_initialize_region (
* definition. This will be executed when the handler is attached
* or removed
*/
- region_obj->region.REGmethod = method_node;
+ region_obj->region.extra->extra.method_REG = method_node;
}
/*
diff --git a/drivers/acpi/events/evsci.c b/drivers/acpi/events/evsci.c
index ef307998a..02320e93c 100644
--- a/drivers/acpi/events/evsci.c
+++ b/drivers/acpi/events/evsci.c
@@ -2,7 +2,7 @@
*
* Module Name: evsci - System Control Interrupt configuration and
* legacy to ACPI mode state transition functions
- * $Revision: 59 $
+ * $Revision: 67 $
*
******************************************************************************/
@@ -48,7 +48,7 @@
*
* FUNCTION: Acpi_ev_sci_handler
*
- * PARAMETERS: none
+ * PARAMETERS: Context - Calling Context
*
* RETURN: Status code indicates whether interrupt was handled.
*
@@ -58,7 +58,7 @@
*
******************************************************************************/
-u32
+static u32
acpi_ev_sci_handler (void *context)
{
u32 interrupt_handled = INTERRUPT_NOT_HANDLED;
@@ -68,7 +68,7 @@ acpi_ev_sci_handler (void *context)
* Make sure that ACPI is enabled by checking SCI_EN. Note that we are
* required to treat the SCI interrupt as sharable, level, active low.
*/
- if (!acpi_hw_register_access (ACPI_READ, ACPI_MTX_DO_NOT_LOCK, SCI_EN)) {
+ if (!acpi_hw_register_bit_access (ACPI_READ, ACPI_MTX_DO_NOT_LOCK, SCI_EN)) {
/* ACPI is not enabled; this interrupt cannot be for us */
return (INTERRUPT_NOT_HANDLED);
@@ -110,7 +110,7 @@ acpi_ev_install_sci_handler (void)
u32 except = AE_OK;
- except = acpi_os_install_interrupt_handler ((u32) acpi_gbl_FACP->sci_int,
+ except = acpi_os_install_interrupt_handler ((u32) acpi_gbl_FADT->sci_int,
acpi_ev_sci_handler,
NULL);
@@ -163,7 +163,7 @@ acpi_ev_remove_sci_handler (void)
#endif
- acpi_os_remove_interrupt_handler ((u32) acpi_gbl_FACP->sci_int,
+ acpi_os_remove_interrupt_handler ((u32) acpi_gbl_FADT->sci_int,
acpi_ev_sci_handler);
return (AE_OK);
@@ -208,20 +208,11 @@ acpi_ev_restore_acpi_state (void)
if (acpi_gbl_restore_acpi_chipset == TRUE) {
/* Restore the fixed events */
- if (acpi_os_in16 (acpi_gbl_FACP->pm1a_evt_blk + 2) !=
- acpi_gbl_pm1_enable_register_save)
- {
- acpi_os_out16 ((acpi_gbl_FACP->pm1a_evt_blk + 2),
- acpi_gbl_pm1_enable_register_save);
- }
-
- if (acpi_gbl_FACP->pm1b_evt_blk) {
- if (acpi_os_in16 (acpi_gbl_FACP->pm1b_evt_blk + 2) !=
+ if (acpi_hw_register_read (ACPI_MTX_LOCK, PM1_EN) !=
acpi_gbl_pm1_enable_register_save)
- {
- acpi_os_out16 ((acpi_gbl_FACP->pm1b_evt_blk + 2),
- acpi_gbl_pm1_enable_register_save);
- }
+ {
+ acpi_hw_register_write (ACPI_MTX_LOCK, PM1_EN,
+ acpi_gbl_pm1_enable_register_save);
}
@@ -232,26 +223,24 @@ acpi_ev_restore_acpi_state (void)
/* Now restore the GPEs */
- for (index = 0; index < DIV_2 (acpi_gbl_FACP->gpe0blk_len); index++) {
- if (acpi_os_in8 (acpi_gbl_FACP->gpe0blk +
- DIV_2 (acpi_gbl_FACP->gpe0blk_len)) !=
- acpi_gbl_gpe0enable_register_save[index])
+ for (index = 0; index < DIV_2 (acpi_gbl_FADT->gpe0blk_len); index++) {
+ if (acpi_hw_register_read (ACPI_MTX_LOCK, GPE0_EN_BLOCK | index) !=
+ acpi_gbl_gpe0enable_register_save[index])
{
- acpi_os_out8 ((acpi_gbl_FACP->gpe0blk +
- DIV_2 (acpi_gbl_FACP->gpe0blk_len)),
- acpi_gbl_gpe0enable_register_save[index]);
+ acpi_hw_register_write (ACPI_MTX_LOCK, GPE0_EN_BLOCK | index,
+ acpi_gbl_gpe0enable_register_save[index]);
}
}
- if (acpi_gbl_FACP->gpe1_blk && acpi_gbl_FACP->gpe1_blk_len) {
- for (index = 0; index < DIV_2 (acpi_gbl_FACP->gpe1_blk_len); index++) {
- if (acpi_os_in8 (acpi_gbl_FACP->gpe1_blk +
- DIV_2 (acpi_gbl_FACP->gpe1_blk_len)) !=
+ /* GPE 1 present? */
+
+ if (acpi_gbl_FADT->gpe1_blk_len) {
+ for (index = 0; index < DIV_2 (acpi_gbl_FADT->gpe1_blk_len); index++) {
+ if (acpi_hw_register_read (ACPI_MTX_LOCK, GPE1_EN_BLOCK | index) !=
acpi_gbl_gpe1_enable_register_save[index])
{
- acpi_os_out8 ((acpi_gbl_FACP->gpe1_blk +
- DIV_2 (acpi_gbl_FACP->gpe1_blk_len)),
- acpi_gbl_gpe1_enable_register_save[index]);
+ acpi_hw_register_write (ACPI_MTX_LOCK, GPE1_EN_BLOCK | index,
+ acpi_gbl_gpe1_enable_register_save[index]);
}
}
}
diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c
index 761b66151..c3bbad0ff 100644
--- a/drivers/acpi/events/evxface.c
+++ b/drivers/acpi/events/evxface.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evxface - External interfaces for ACPI events
- * $Revision: 88 $
+ * $Revision: 97 $
*
*****************************************************************************/
@@ -81,9 +81,9 @@ acpi_install_fixed_event_handler (
acpi_gbl_fixed_event_handlers[event].handler = handler;
acpi_gbl_fixed_event_handlers[event].context = context;
- if (1 != acpi_hw_register_access (ACPI_WRITE,
- ACPI_MTX_LOCK, event + TMR_EN, 1))
- {
+ status = acpi_enable_event(event, ACPI_EVENT_FIXED);
+
+ if (!ACPI_SUCCESS(status)) {
/* Remove the handler */
acpi_gbl_fixed_event_handlers[event].handler = NULL;
@@ -131,11 +131,12 @@ acpi_remove_fixed_event_handler (
/* Disable the event before removing the handler - just in case... */
- if (0 != acpi_hw_register_access (ACPI_WRITE,
- ACPI_MTX_LOCK, event + TMR_EN, 0))
- {
+ status = acpi_disable_event(event, ACPI_EVENT_FIXED);
+
+ if (!ACPI_SUCCESS(status)) {
status = AE_ERROR;
- goto cleanup;
+ acpi_cm_release_mutex (ACPI_MTX_EVENTS);
+ return (status);
}
/* Remove the handler */
@@ -143,7 +144,6 @@ acpi_remove_fixed_event_handler (
acpi_gbl_fixed_event_handlers[event].handler = NULL;
acpi_gbl_fixed_event_handlers[event].context = NULL;
-cleanup:
acpi_cm_release_mutex (ACPI_MTX_EVENTS);
return (status);
}
@@ -426,14 +426,14 @@ unlock_and_exit:
*
* PARAMETERS: Gpe_number - The GPE number. The numbering scheme is
* bank 0 first, then bank 1.
- * Trigger - Whether this GPE should be treated as an
+ * Type - Whether this GPE should be treated as an
* edge- or level-triggered interrupt.
* Handler - Address of the handler
* Context - Value passed to the handler on each GPE
*
* RETURN: Status
*
- * DESCRIPTION: Install a handler for a General Purpose Acpi_event.
+ * DESCRIPTION: Install a handler for a General Purpose Event.
*
******************************************************************************/
@@ -554,11 +554,9 @@ cleanup:
* DESCRIPTION: Acquire the ACPI Global Lock
*
******************************************************************************/
-
ACPI_STATUS
acpi_acquire_global_lock (
- u32 timeout,
- u32 *out_handle)
+ void)
{
ACPI_STATUS status;
@@ -573,7 +571,6 @@ acpi_acquire_global_lock (
status = acpi_ev_acquire_global_lock ();
acpi_aml_exit_interpreter ();
- *out_handle = 0;
return (status);
}
@@ -592,12 +589,8 @@ acpi_acquire_global_lock (
ACPI_STATUS
acpi_release_global_lock (
- u32 handle)
+ void)
{
-
-
- /* TBD: [Restructure] Validate handle */
-
acpi_ev_release_global_lock ();
return (AE_OK);
}
diff --git a/drivers/acpi/events/evxfevnt.c b/drivers/acpi/events/evxfevnt.c
index aee0ba1ba..5b7652e52 100644
--- a/drivers/acpi/events/evxfevnt.c
+++ b/drivers/acpi/events/evxfevnt.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evxfevnt - External Interfaces, ACPI event disable/enable
- * $Revision: 19 $
+ * $Revision: 26 $
*
*****************************************************************************/
@@ -35,14 +35,6 @@
MODULE_NAME ("evxfevnt")
-ACPI_STATUS
-acpi_ev_find_pci_root_buses (
- void);
-
-ACPI_STATUS
-acpi_ev_init_devices (
- void);
-
/**************************************************************************
*
* FUNCTION: Acpi_enable
@@ -51,9 +43,7 @@ acpi_ev_init_devices (
*
* RETURN: Status
*
- * DESCRIPTION: Ensures that the system control interrupt (SCI) is properly
- * configured, disables SCI event sources, installs the SCI
- * handler, and transfers the system into ACPI mode.
+ * DESCRIPTION: Transfers the system into ACPI mode.
*
*************************************************************************/
@@ -69,52 +59,12 @@ acpi_enable (void)
return (AE_NO_ACPI_TABLES);
}
- /* Init the hardware */
-
- /*
- * With the advent of a 3-pass parser, we need to be
- * prepared to execute on initialized HW before the
- * namespace has completed its load.
- */
-
- status = acpi_cm_hardware_initialize ();
- if (ACPI_FAILURE (status)) {
- return (status);
- }
-
-
/* Make sure the BIOS supports ACPI mode */
if (SYS_MODE_LEGACY == acpi_hw_get_mode_capabilities()) {
return (AE_ERROR);
}
-
- acpi_gbl_original_mode = acpi_hw_get_mode();
-
- /*
- * Initialize the Fixed and General Purpose Acpi_events prior. This is
- * done prior to enabling SCIs to prevent interrupts from occuring
- * before handers are installed.
- */
-
- status = acpi_ev_fixed_event_initialize ();
- if (ACPI_FAILURE (status)) {
- return (status);
- }
-
- status = acpi_ev_gpe_initialize ();
- if (ACPI_FAILURE (status)) {
- return (status);
- }
-
- /* Install the SCI handler */
-
- status = acpi_ev_install_sci_handler ();
- if (ACPI_FAILURE (status)) {
- return (status);
- }
-
/* Transition to ACPI mode */
status = acpi_hw_set_mode (SYS_MODE_ACPI);
@@ -122,32 +72,6 @@ acpi_enable (void)
return (status);
}
- /* Install handlers for control method GPE handlers (_Lxx, _Exx) */
-
- acpi_ev_init_gpe_control_methods ();
-
- status = acpi_ev_init_global_lock_handler ();
-
- /*
- * Perform additional initialization that may cause control methods
- * to be executed
- *
- * It may be wise to move this code to a new interface
- */
-
-
- /*
- * Install PCI config space handler for all PCI root bridges. A PCI root
- * bridge is found by searching for devices containing a HID with the value
- * EISAID("PNP0A03")
- */
-
- acpi_ev_find_pci_root_buses ();
-
- /* Call _INI on all devices */
-
- acpi_ev_init_devices ();
-
return (status);
}
@@ -250,7 +174,12 @@ acpi_enable_event (
* enable register bit)
*/
- acpi_hw_register_access (ACPI_WRITE, TRUE, register_id, 1);
+ acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, register_id, 1);
+
+ if (1 != acpi_hw_register_bit_access(ACPI_READ, ACPI_MTX_LOCK, register_id)) {
+ return (AE_ERROR);
+ }
+
break;
@@ -344,7 +273,12 @@ acpi_disable_event (
* enable register bit)
*/
- acpi_hw_register_access (ACPI_WRITE, TRUE, register_id, 0);
+ acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, register_id, 0);
+
+ if (0 != acpi_hw_register_bit_access(ACPI_READ, ACPI_MTX_LOCK, register_id)) {
+ return (AE_ERROR);
+ }
+
break;
@@ -435,7 +369,7 @@ acpi_clear_event (
* status register bit)
*/
- acpi_hw_register_access (ACPI_WRITE, TRUE, register_id, 1);
+ acpi_hw_register_bit_access (ACPI_WRITE, ACPI_MTX_LOCK, register_id, 1);
break;
@@ -532,7 +466,7 @@ acpi_get_event_status (
/* Get the status of the requested fixed event */
- *event_status = acpi_hw_register_access (ACPI_READ, TRUE, register_id);
+ *event_status = acpi_hw_register_bit_access (ACPI_READ, ACPI_MTX_LOCK, register_id);
break;
diff --git a/drivers/acpi/events/evxfregn.c b/drivers/acpi/events/evxfregn.c
index 61a04be9e..71116cfc8 100644
--- a/drivers/acpi/events/evxfregn.c
+++ b/drivers/acpi/events/evxfregn.c
@@ -2,7 +2,7 @@
*
* Module Name: evxfregn - External Interfaces, ACPI Operation Regions and
* Address Spaces.
- * $Revision: 20 $
+ * $Revision: 26 $
*
*****************************************************************************/
@@ -43,12 +43,12 @@
* PARAMETERS: Device - Handle for the device
* Space_id - The address space ID
* Handler - Address of the handler
+ * Setup - Address of the setup function
* Context - Value passed to the handler on each access
*
* RETURN: Status
*
- * DESCRIPTION: Install a handler for accesses on an address space controlled
- * a specific device.
+ * DESCRIPTION: Install a handler for all Op_regions of a given Space_id.
*
******************************************************************************/
@@ -190,7 +190,7 @@ acpi_install_address_space_handler (
/* Attach the new object to the Node */
- status = acpi_ns_attach_object (device, obj_desc, (u8) type);
+ status = acpi_ns_attach_object (node, obj_desc, (u8) type);
if (ACPI_FAILURE (status)) {
acpi_cm_remove_reference (obj_desc);
goto unlock_and_exit;
@@ -337,7 +337,7 @@ acpi_remove_address_space_handler (
* The region is just inaccessible as indicated to
* the _REG method
*/
- acpi_ev_disassociate_region_from_handler(region_obj);
+ acpi_ev_disassociate_region_from_handler(region_obj, FALSE);
/*
* Walk the list, since we took the first region and it