Pull sem2mutex-ioc4 into release branch
[pandora-kernel.git] / drivers / acpi / utilities / utxface.c
index f06bd5e..308a960 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
@@ -75,8 +75,7 @@ acpi_status acpi_initialize_subsystem(void)
 
        status = acpi_os_initialize();
        if (ACPI_FAILURE(status)) {
-               ACPI_REPORT_ERROR(("OSD failed to initialize, %s\n",
-                                  acpi_format_exception(status)));
+               ACPI_EXCEPTION((AE_INFO, status, "During OSL initialization"));
                return_ACPI_STATUS(status);
        }
 
@@ -88,8 +87,8 @@ acpi_status acpi_initialize_subsystem(void)
 
        status = acpi_ut_mutex_initialize();
        if (ACPI_FAILURE(status)) {
-               ACPI_REPORT_ERROR(("Global mutex creation failure, %s\n",
-                                  acpi_format_exception(status)));
+               ACPI_EXCEPTION((AE_INFO, status,
+                               "During Global Mutex creation"));
                return_ACPI_STATUS(status);
        }
 
@@ -99,15 +98,14 @@ acpi_status acpi_initialize_subsystem(void)
         */
        status = acpi_ns_root_initialize();
        if (ACPI_FAILURE(status)) {
-               ACPI_REPORT_ERROR(("Namespace initialization failure, %s\n",
-                                  acpi_format_exception(status)));
+               ACPI_EXCEPTION((AE_INFO, status,
+                               "During Namespace initialization"));
                return_ACPI_STATUS(status);
        }
 
        /* If configured, initialize the AML debugger */
 
        ACPI_DEBUGGER_EXEC(status = acpi_db_initialize());
-
        return_ACPI_STATUS(status);
 }
 
@@ -154,8 +152,7 @@ acpi_status acpi_enable_subsystem(u32 flags)
 
                status = acpi_enable();
                if (ACPI_FAILURE(status)) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_WARN,
-                                         "acpi_enable failed.\n"));
+                       ACPI_WARNING((AE_INFO, "acpi_enable failed"));
                        return_ACPI_STATUS(status);
                }
        }
@@ -178,10 +175,14 @@ acpi_status acpi_enable_subsystem(u32 flags)
        /*
         * Initialize ACPI Event handling (Fixed and General Purpose)
         *
-        * NOTE: We must have the hardware AND events initialized before we can
-        * execute ANY control methods SAFELY.  Any control method can require
-        * ACPI hardware support, so the hardware MUST be initialized before
-        * execution!
+        * Note1: We must have the hardware and events initialized before we can
+        * execute any control methods safely. Any control method can require
+        * ACPI hardware support, so the hardware must be fully initialized before
+        * any method execution!
+        *
+        * Note2: Fixed events are initialized and enabled here. GPEs are
+        * initialized, but cannot be enabled until after the hardware is
+        * completely initialized (SCI and global_lock activated)
         */
        if (!(flags & ACPI_NO_EVENT_INIT)) {
                ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
@@ -193,8 +194,10 @@ acpi_status acpi_enable_subsystem(u32 flags)
                }
        }
 
-       /* Install the SCI handler and Global Lock handler */
-
+       /*
+        * Install the SCI handler and Global Lock handler. This completes the
+        * hardware initialization.
+        */
        if (!(flags & ACPI_NO_HANDLER_INIT)) {
                ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
                                  "[Init] Installing SCI/GL handlers\n"));
@@ -205,6 +208,24 @@ acpi_status acpi_enable_subsystem(u32 flags)
                }
        }
 
+       /*
+        * Complete the GPE initialization for the GPE blocks defined in the FADT
+        * (GPE block 0 and 1).
+        *
+        * Note1: This is where the _PRW methods are executed for the GPEs. These
+        * methods can only be executed after the SCI and Global Lock handlers are
+        * installed and initialized.
+        *
+        * Note2: Currently, there seems to be no need to run the _REG methods
+        * before execution of the _PRW methods and enabling of the GPEs.
+        */
+       if (!(flags & ACPI_NO_EVENT_INIT)) {
+               status = acpi_ev_install_fadt_gpes();
+               if (ACPI_FAILURE(status)) {
+                       return (status);
+               }
+       }
+
        return_ACPI_STATUS(status);
 }
 
@@ -230,9 +251,9 @@ acpi_status acpi_initialize_objects(u32 flags)
        /*
         * Run all _REG methods
         *
-        * NOTE: Any objects accessed
-        * by the _REG methods will be automatically initialized, even if they
-        * contain executable AML (see call to acpi_ns_initialize_objects below).
+        * Note: Any objects accessed by the _REG methods will be automatically
+        * initialized, even if they contain executable AML (see the call to
+        * acpi_ns_initialize_objects below).
         */
        if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) {
                ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
@@ -245,9 +266,9 @@ acpi_status acpi_initialize_objects(u32 flags)
        }
 
        /*
-        * Initialize the objects that remain uninitialized.  This
-        * runs the executable AML that may be part of the declaration of these
-        * objects: operation_regions, buffer_fields, Buffers, and Packages.
+        * Initialize the objects that remain uninitialized. This runs the
+        * executable AML that may be part of the declaration of these objects:
+        * operation_regions, buffer_fields, Buffers, and Packages.
         */
        if (!(flags & ACPI_NO_OBJECT_INIT)) {
                ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
@@ -260,8 +281,8 @@ acpi_status acpi_initialize_objects(u32 flags)
        }
 
        /*
-        * Initialize all device objects in the namespace
-        * This runs the _STA and _INI methods.
+        * Initialize all device objects in the namespace. This runs the device
+        * _STA and _INI methods.
         */
        if (!(flags & ACPI_NO_DEVICE_INIT)) {
                ACPI_DEBUG_PRINT((ACPI_DB_EXEC,