patch-2.4.10 linux/drivers/acpi/events/evevent.c
Next file: linux/drivers/acpi/events/evmisc.c
Previous file: linux/drivers/acpi/driver.c
Back to the patch index
Back to the overall index
- Lines: 474
- Date:
Sun Sep 23 09:42:32 2001
- Orig file:
v2.4.9/linux/drivers/acpi/events/evevent.c
- Orig date:
Tue Jul 3 17:08:19 2001
diff -u --recursive --new-file v2.4.9/linux/drivers/acpi/events/evevent.c linux/drivers/acpi/events/evevent.c
@@ -2,7 +2,7 @@
*
* Module Name: evevent - Fixed and General Purpose Acpi_event
* handling and dispatch
- * $Revision: 43 $
+ * $Revision: 50 $
*
*****************************************************************************/
@@ -47,24 +47,29 @@
*
******************************************************************************/
-ACPI_STATUS
+acpi_status
acpi_ev_initialize (
void)
{
- ACPI_STATUS status;
+ acpi_status status;
+
+
+ FUNCTION_TRACE ("Ev_initialize");
/* Make sure we have ACPI tables */
if (!acpi_gbl_DSDT) {
- return (AE_NO_ACPI_TABLES);
+ ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No ACPI tables present!\n"));
+ return_ACPI_STATUS (AE_NO_ACPI_TABLES);
}
/* Make sure the BIOS supports ACPI mode */
if (SYS_MODE_LEGACY == acpi_hw_get_mode_capabilities()) {
- return (AE_ERROR);
+ ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "ACPI Mode is not supported!\n"));
+ return_ACPI_STATUS (AE_ERROR);
}
@@ -75,22 +80,24 @@
* 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);
+ ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, "Unable to initialize fixed events.\n"));
+ return_ACPI_STATUS (status);
}
status = acpi_ev_gpe_initialize ();
if (ACPI_FAILURE (status)) {
- return (status);
+ ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, "Unable to initialize general purpose events.\n"));
+ return_ACPI_STATUS (status);
}
/* Install the SCI handler */
status = acpi_ev_install_sci_handler ();
if (ACPI_FAILURE (status)) {
- return (status);
+ ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, "Unable to install System Control Interrupt Handler\n"));
+ return_ACPI_STATUS (status);
}
@@ -98,18 +105,20 @@
status = acpi_ev_init_gpe_control_methods ();
if (ACPI_FAILURE (status)) {
- return (status);
+ ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, "Unable to initialize Gpe control methods\n"));
+ return_ACPI_STATUS (status);
}
/* Install the handler for the Global Lock */
status = acpi_ev_init_global_lock_handler ();
if (ACPI_FAILURE (status)) {
- return (status);
+ ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, "Unable to initialize Global Lock handler\n"));
+ return_ACPI_STATUS (status);
}
- return (status);
+ return_ACPI_STATUS (status);
}
@@ -125,7 +134,7 @@
*
******************************************************************************/
-ACPI_STATUS
+acpi_status
acpi_ev_fixed_event_initialize(void)
{
int i = 0;
@@ -160,20 +169,27 @@
******************************************************************************/
u32
-acpi_ev_fixed_event_detect(void)
+acpi_ev_fixed_event_detect (void)
{
u32 int_status = INTERRUPT_NOT_HANDLED;
u32 status_register;
u32 enable_register;
+
+ PROC_NAME ("Ev_fixed_event_detect");
+
+
/*
* Read the fixed feature status and enable registers, as all the cases
* depend on their values.
*/
-
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);
+ ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
+ "Fixed Acpi_event Block: Enable %08X Status %08X\n",
+ enable_register, status_register));
+
/* power management timer roll over */
@@ -224,7 +240,11 @@
acpi_ev_fixed_event_dispatch (
u32 event)
{
- u32 register_id;
+ u32 register_id;
+
+
+ FUNCTION_ENTRY ();
+
/* Clear the status bit */
@@ -292,7 +312,7 @@
*
******************************************************************************/
-ACPI_STATUS
+acpi_status
acpi_ev_gpe_initialize (void)
{
u32 i;
@@ -303,6 +323,8 @@
u16 gpe1_register_count;
+ FUNCTION_TRACE ("Ev_gpe_initialize");
+
/*
* Set up various GPE counts
*
@@ -319,24 +341,24 @@
* 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_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 (("Zero GPEs are defined in the FADT\n"));
- return (AE_OK);
+ return_ACPI_STATUS (AE_OK);
}
/*
* Allocate the Gpe information block
*/
-
- acpi_gbl_gpe_registers = acpi_ut_callocate (acpi_gbl_gpe_register_count *
- sizeof (ACPI_GPE_REGISTERS));
+ acpi_gbl_gpe_registers = ACPI_MEM_CALLOCATE (acpi_gbl_gpe_register_count *
+ sizeof (ACPI_GPE_REGISTERS));
if (!acpi_gbl_gpe_registers) {
- return (AE_NO_MEMORY);
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Could not allocate the Gpe_registers block\n"));
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
/*
@@ -344,12 +366,12 @@
* There are eight distinct GP events per register.
* Initialization to zeros is sufficient
*/
-
- acpi_gbl_gpe_info = acpi_ut_callocate (MUL_8 (acpi_gbl_gpe_register_count) *
- sizeof (ACPI_GPE_LEVEL_INFO));
+ acpi_gbl_gpe_info = ACPI_MEM_CALLOCATE (MUL_8 (acpi_gbl_gpe_register_count) *
+ sizeof (acpi_gpe_level_info));
if (!acpi_gbl_gpe_info) {
- acpi_ut_free (acpi_gbl_gpe_registers);
- return (AE_NO_MEMORY);
+ ACPI_MEM_FREE (acpi_gbl_gpe_registers);
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not allocate the Gpe_info block\n"));
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Set the Gpe validation table to GPE_INVALID */
@@ -386,8 +408,8 @@
* are cleared by writing a '1', while enable registers are cleared
* by writing a '0'.
*/
- acpi_os_out8 (acpi_gbl_gpe_registers[register_index].enable_addr, 0x00);
- acpi_os_out8 (acpi_gbl_gpe_registers[register_index].status_addr, 0xFF);
+ acpi_os_write_port (acpi_gbl_gpe_registers[register_index].enable_addr, 0x00, 8);
+ acpi_os_write_port (acpi_gbl_gpe_registers[register_index].status_addr, 0xFF, 8);
register_index++;
}
@@ -414,13 +436,17 @@
* are cleared by writing a '1', while enable registers are cleared
* by writing a '0'.
*/
- acpi_os_out8 (acpi_gbl_gpe_registers[register_index].enable_addr, 0x00);
- acpi_os_out8 (acpi_gbl_gpe_registers[register_index].status_addr, 0xFF);
+ acpi_os_write_port (acpi_gbl_gpe_registers[register_index].enable_addr, 0x00, 8);
+ acpi_os_write_port (acpi_gbl_gpe_registers[register_index].status_addr, 0xFF, 8);
register_index++;
}
- return (AE_OK);
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "GPE registers: %X@%p (Blk0) %X@%p (Blk1)\n",
+ gpe0register_count, acpi_gbl_FADT->Xgpe0blk.address, gpe1_register_count,
+ acpi_gbl_FADT->Xgpe1_blk.address));
+
+ return_ACPI_STATUS (AE_OK);
}
@@ -446,9 +472,9 @@
*
******************************************************************************/
-static ACPI_STATUS
+static acpi_status
acpi_ev_save_method_info (
- ACPI_HANDLE obj_handle,
+ acpi_handle obj_handle,
u32 level,
void *obj_desc,
void **return_value)
@@ -463,7 +489,7 @@
/* Extract the name from the object and convert to a string */
- MOVE_UNALIGNED32_TO_32 (name, &((ACPI_NAMESPACE_NODE *) obj_handle)->name);
+ MOVE_UNALIGNED32_TO_32 (name, &((acpi_namespace_node *) obj_handle)->name);
name[ACPI_NAME_SIZE] = 0;
/*
@@ -478,6 +504,9 @@
else {
/* Unknown method type, just ignore it! */
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Unknown GPE method type: %s (name not of form _Lnn or _Enn)\n",
+ name));
return (AE_OK);
}
@@ -487,6 +516,9 @@
if (gpe_number == ACPI_UINT32_MAX) {
/* Conversion failed; invalid method, just ignore it */
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Could not extract GPE number from name: %s (name not of form _Lnn or _Enn)\n",
+ name));
return (AE_OK);
}
@@ -502,7 +534,6 @@
* Now we can add this information to the Gpe_info block
* for use during dispatch of this GPE.
*/
-
acpi_gbl_gpe_info [gpe_number].type = type;
acpi_gbl_gpe_info [gpe_number].method_handle = obj_handle;
@@ -510,9 +541,10 @@
/*
* Enable the GPE (SCIs should be disabled at this point)
*/
-
acpi_hw_enable_gpe (gpe_number);
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Registered GPE method %s as GPE number %X\n",
+ name, gpe_number));
return (AE_OK);
}
@@ -531,17 +563,20 @@
*
******************************************************************************/
-ACPI_STATUS
+acpi_status
acpi_ev_init_gpe_control_methods (void)
{
- ACPI_STATUS status;
+ acpi_status status;
+
+
+ FUNCTION_TRACE ("Ev_init_gpe_control_methods");
/* Get a permanent handle to the _GPE object */
status = acpi_get_handle (NULL, "\\_GPE", &acpi_gbl_gpe_obj_handle);
if (ACPI_FAILURE (status)) {
- return (status);
+ return_ACPI_STATUS (status);
}
/* Traverse the namespace under \_GPE to find all methods there */
@@ -550,7 +585,7 @@
ACPI_UINT32_MAX, acpi_ev_save_method_info,
NULL, NULL);
- return (status);
+ return_ACPI_STATUS (status);
}
@@ -576,23 +611,31 @@
u8 bit_mask;
+ PROC_NAME ("Ev_gpe_detect");
+
+
/*
* Read all of the 8-bit GPE status and enable registers
* in both of the register blocks, saving all of it.
* Find all currently active GP events.
*/
-
for (i = 0; i < acpi_gbl_gpe_register_count; i++) {
- acpi_gbl_gpe_registers[i].status =
- acpi_os_in8 (acpi_gbl_gpe_registers[i].status_addr);
+ acpi_os_read_port (acpi_gbl_gpe_registers[i].status_addr,
+ &acpi_gbl_gpe_registers[i].status, 8);
- acpi_gbl_gpe_registers[i].enable =
- acpi_os_in8 (acpi_gbl_gpe_registers[i].enable_addr);
+ acpi_os_read_port (acpi_gbl_gpe_registers[i].enable_addr,
+ &acpi_gbl_gpe_registers[i].enable, 8);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
+ "GPE block at %X - Enable %08X Status %08X\n",
+ acpi_gbl_gpe_registers[i].enable_addr,
+ acpi_gbl_gpe_registers[i].status,
+ acpi_gbl_gpe_registers[i].enable));
/* First check if there is anything active at all in this register */
enabled_status_byte = (u8) (acpi_gbl_gpe_registers[i].status &
- acpi_gbl_gpe_registers[i].enable);
+ acpi_gbl_gpe_registers[i].enable);
if (!enabled_status_byte) {
/* No active GPEs in this register, move on */
@@ -610,8 +653,8 @@
* Found an active GPE. Dispatch the event to a handler
* or method.
*/
- int_status |=
- acpi_ev_gpe_dispatch (acpi_gbl_gpe_registers[i].gpe_base + j);
+ int_status |= acpi_ev_gpe_dispatch (
+ acpi_gbl_gpe_registers[i].gpe_base + j);
}
}
}
@@ -641,8 +684,10 @@
void *context)
{
u32 gpe_number = (u32) context;
- ACPI_GPE_LEVEL_INFO gpe_info;
+ acpi_gpe_level_info gpe_info;
+
+ FUNCTION_TRACE ("Ev_asynch_execute_gpe_method");
/*
* Take a snapshot of the GPE info for this level
@@ -674,7 +719,7 @@
*/
acpi_hw_enable_gpe (gpe_number);
- return;
+ return_VOID;
}
@@ -701,14 +746,18 @@
acpi_ev_gpe_dispatch (
u32 gpe_number)
{
- ACPI_GPE_LEVEL_INFO gpe_info;
+ acpi_gpe_level_info gpe_info;
+
+
+ FUNCTION_TRACE ("Ev_gpe_dispatch");
/*
* Valid GPE number?
*/
if (acpi_gbl_gpe_valid[gpe_number] == ACPI_GPE_INVALID) {
- return (INTERRUPT_NOT_HANDLED);
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid GPE bit [%X].\n", gpe_number));
+ return_VALUE (INTERRUPT_NOT_HANDLED);
}
/*
@@ -732,16 +781,20 @@
*/
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)?
*/
@@ -756,6 +809,7 @@
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.
*/
@@ -763,10 +817,11 @@
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);
+ return_VALUE (INTERRUPT_HANDLED);
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)