]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/acpi/events/evevent.c
Pull battery into test branch
[linux-2.6-omap-h63xx.git] / drivers / acpi / events / evevent.c
index 842d1e3fb37b968c66ec45c8a6a5f9485d55df1a..919037d6acff813f341e5ad3ef96675137dad258 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2005, R. Byron Moore
+ * Copyright (C) 2000 - 2006, R. Byron Moore
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -68,12 +68,12 @@ acpi_status acpi_ev_initialize_events(void)
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ev_initialize_events");
+       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"));
+               ACPI_WARNING((AE_INFO, "No ACPI tables present!"));
                return_ACPI_STATUS(AE_NO_ACPI_TABLES);
        }
 
@@ -84,20 +84,63 @@ acpi_status acpi_ev_initialize_events(void)
         */
        status = acpi_ev_fixed_event_initialize();
        if (ACPI_FAILURE(status)) {
-               ACPI_REPORT_ERROR(("Unable to initialize fixed events, %s\n",
-                                  acpi_format_exception(status)));
+               ACPI_EXCEPTION((AE_INFO, status,
+                               "Unable to initialize fixed events"));
                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)));
+               ACPI_EXCEPTION((AE_INFO, status,
+                               "Unable to initialize general purpose events"));
                return_ACPI_STATUS(status);
        }
 
        return_ACPI_STATUS(status);
 }
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ev_install_fadt_gpes
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Completes initialization of the FADT-defined GPE blocks
+ *              (0 and 1). This causes the _PRW methods to be run, so the HW
+ *              must be fully initialized at this point, including global lock
+ *              support.
+ *
+ ******************************************************************************/
+
+acpi_status acpi_ev_install_fadt_gpes(void)
+{
+       acpi_status status;
+
+       ACPI_FUNCTION_TRACE(ev_install_fadt_gpes);
+
+       /* Namespace must be locked */
+
+       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+       if (ACPI_FAILURE(status)) {
+               return (status);
+       }
+
+       /* FADT GPE Block 0 */
+
+       (void)acpi_ev_initialize_gpe_block(acpi_gbl_fadt_gpe_device,
+                                          acpi_gbl_gpe_fadt_blocks[0]);
+
+       /* FADT GPE Block 1 */
+
+       (void)acpi_ev_initialize_gpe_block(acpi_gbl_fadt_gpe_device,
+                                          acpi_gbl_gpe_fadt_blocks[1]);
+
+       (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+       return_ACPI_STATUS(AE_OK);
+}
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_install_xrupt_handlers
@@ -114,13 +157,14 @@ acpi_status acpi_ev_install_xrupt_handlers(void)
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ev_install_xrupt_handlers");
+       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)));
+               ACPI_EXCEPTION((AE_INFO, status,
+                               "Unable to install System Control Interrupt handler"));
                return_ACPI_STATUS(status);
        }
 
@@ -128,7 +172,8 @@ acpi_status acpi_ev_install_xrupt_handlers(void)
 
        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)));
+               ACPI_EXCEPTION((AE_INFO, status,
+                               "Unable to initialize Global Lock handler"));
                return_ACPI_STATUS(status);
        }
 
@@ -196,7 +241,7 @@ u32 acpi_ev_fixed_event_detect(void)
        u32 fixed_enable;
        acpi_native_uint i;
 
-       ACPI_FUNCTION_NAME("ev_fixed_event_detect");
+       ACPI_FUNCTION_NAME(ev_fixed_event_detect);
 
        /*
         * Read the fixed feature status and enable registers, as all the cases
@@ -215,12 +260,14 @@ u32 acpi_ev_fixed_event_detect(void)
         * Check for all possible Fixed Events and dispatch those that are active
         */
        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)) {
+
                        /* Found an active (signalled) event */
 
                        int_status |= acpi_ev_fixed_event_dispatch((u32) i);
@@ -262,7 +309,9 @@ static u32 acpi_ev_fixed_event_dispatch(u32 event)
                                        enable_register_id, 0,
                                        ACPI_MTX_DO_NOT_LOCK);
 
-               ACPI_REPORT_ERROR(("No installed handler for fixed event [%08X]\n", event));
+               ACPI_ERROR((AE_INFO,
+                           "No installed handler for fixed event [%08X]",
+                           event));
 
                return (ACPI_INTERRUPT_NOT_HANDLED);
        }