ACPI / init: Switch over platform to the ACPI mode later
[linux-block.git] / drivers / acpi / bus.c
index c412fdb28d34430913fa2080af6e68619050c107..513e7230e3d04bbf8e7fd9ded2cc4300c938c58e 100644 (file)
@@ -470,6 +470,16 @@ static int __init acpi_bus_init_irq(void)
        return 0;
 }
 
+/**
+ * acpi_early_init - Initialize ACPICA and populate the ACPI namespace.
+ *
+ * The ACPI tables are accessible after this, but the handling of events has not
+ * been initialized and the global lock is not available yet, so AML should not
+ * be executed at this point.
+ *
+ * Doing this before switching the EFI runtime services to virtual mode allows
+ * the EfiBootServices memory to be freed slightly earlier on boot.
+ */
 void __init acpi_early_init(void)
 {
        acpi_status status;
@@ -533,26 +543,42 @@ void __init acpi_early_init(void)
                acpi_gbl_FADT.sci_interrupt = acpi_sci_override_gsi;
        }
 #endif
+       return;
+
+ error0:
+       disable_acpi();
+}
+
+/**
+ * acpi_subsystem_init - Finalize the early initialization of ACPI.
+ *
+ * Switch over the platform to the ACPI mode (if possible), initialize the
+ * handling of ACPI events, install the interrupt and global lock handlers.
+ *
+ * Doing this too early is generally unsafe, but at the same time it needs to be
+ * done before all things that really depend on ACPI.  The right spot appears to
+ * be before finalizing the EFI initialization.
+ */
+void __init acpi_subsystem_init(void)
+{
+       acpi_status status;
+
+       if (acpi_disabled)
+               return;
 
        status = acpi_enable_subsystem(~ACPI_NO_ACPI_ENABLE);
        if (ACPI_FAILURE(status)) {
                printk(KERN_ERR PREFIX "Unable to enable ACPI\n");
-               goto error0;
+               disable_acpi();
+       } else {
+               /*
+                * If the system is using ACPI then we can be reasonably
+                * confident that any regulators are managed by the firmware
+                * so tell the regulator core it has everything it needs to
+                * know.
+                */
+               regulator_has_full_constraints();
        }
-
-       /*
-        * If the system is using ACPI then we can be reasonably
-        * confident that any regulators are managed by the firmware
-        * so tell the regulator core it has everything it needs to
-        * know.
-        */
-       regulator_has_full_constraints();
-
-       return;
-
-      error0:
-       disable_acpi();
-       return;
 }
 
 static int __init acpi_bus_init(void)