]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/acpi/osl.c
ACPICA: Hardware: Add sleep register hooks
[karo-tx-linux.git] / drivers / acpi / osl.c
index 9a4c6abee63e0e86a6941d19665a409d3931b301..db78d353bab1f94b4d88c8b767b105a1da486d0b 100644 (file)
@@ -42,7 +42,7 @@
 #include <linux/semaphore.h>
 
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/io-64-nonatomic-lo-hi.h>
 
 #include "internal.h"
@@ -76,6 +76,7 @@ static struct workqueue_struct *kacpi_notify_wq;
 static struct workqueue_struct *kacpi_hotplug_wq;
 static bool acpi_os_initialized;
 unsigned int acpi_sci_irq = INVALID_ACPI_IRQ;
+bool acpi_permanent_mmap = false;
 
 /*
  * This list of permanent mappings is for memory that may be accessed from
@@ -306,7 +307,7 @@ static void acpi_unmap(acpi_physical_address pg_off, void __iomem *vaddr)
  * virtual address).  If not found, map it, add it to that list and return a
  * pointer to it.
  *
- * During early init (when acpi_gbl_permanent_mmap has not been set yet) this
+ * During early init (when acpi_permanent_mmap has not been set yet) this
  * routine simply calls __acpi_map_table() to get the job done.
  */
 void __iomem *__ref
@@ -322,7 +323,7 @@ acpi_os_map_iomem(acpi_physical_address phys, acpi_size size)
                return NULL;
        }
 
-       if (!acpi_gbl_permanent_mmap)
+       if (!acpi_permanent_mmap)
                return __acpi_map_table((unsigned long)phys, size);
 
        mutex_lock(&acpi_ioremap_lock);
@@ -392,7 +393,7 @@ static void acpi_os_map_cleanup(struct acpi_ioremap *map)
  * mappings, drop a reference to it and unmap it if there are no more active
  * references to it.
  *
- * During early init (when acpi_gbl_permanent_mmap has not been set yet) this
+ * During early init (when acpi_permanent_mmap has not been set yet) this
  * routine simply calls __acpi_unmap_table() to get the job done.  Since
  * __acpi_unmap_table() is an __init function, the __ref annotation is needed
  * here.
@@ -401,7 +402,7 @@ void __ref acpi_os_unmap_iomem(void __iomem *virt, acpi_size size)
 {
        struct acpi_ioremap *map;
 
-       if (!acpi_gbl_permanent_mmap) {
+       if (!acpi_permanent_mmap) {
                __acpi_unmap_table(virt, size);
                return;
        }
@@ -426,12 +427,6 @@ void __ref acpi_os_unmap_memory(void *virt, acpi_size size)
 }
 EXPORT_SYMBOL_GPL(acpi_os_unmap_memory);
 
-void __init early_acpi_os_unmap_memory(void __iomem *virt, acpi_size size)
-{
-       if (!acpi_gbl_permanent_mmap)
-               __acpi_unmap_table(virt, size);
-}
-
 int acpi_os_map_generic_address(struct acpi_generic_address *gas)
 {
        u64 addr;
@@ -1691,7 +1686,7 @@ acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 pm1a_control,
        if (rc < 0)
                return AE_ERROR;
        else if (rc > 0)
-               return AE_CTRL_SKIP;
+               return AE_CTRL_TERMINATE;
 
        return AE_OK;
 }
@@ -1702,6 +1697,7 @@ void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
        __acpi_os_prepare_sleep = func;
 }
 
+#if (ACPI_REDUCED_HARDWARE)
 acpi_status acpi_os_prepare_extended_sleep(u8 sleep_state, u32 val_a,
                                  u32 val_b)
 {
@@ -1712,13 +1708,35 @@ acpi_status acpi_os_prepare_extended_sleep(u8 sleep_state, u32 val_a,
        if (rc < 0)
                return AE_ERROR;
        else if (rc > 0)
-               return AE_CTRL_SKIP;
+               return AE_CTRL_TERMINATE;
 
        return AE_OK;
 }
+#else
+acpi_status acpi_os_prepare_extended_sleep(u8 sleep_state, u32 val_a,
+                                 u32 val_b)
+{
+       return AE_OK;
+}
+#endif
 
 void acpi_os_set_prepare_extended_sleep(int (*func)(u8 sleep_state,
                               u32 val_a, u32 val_b))
 {
        __acpi_os_prepare_extended_sleep = func;
 }
+
+acpi_status acpi_os_enter_sleep(u8 sleep_state,
+                               u32 reg_a_value, u32 reg_b_value)
+{
+       acpi_status status;
+
+       if (acpi_gbl_reduced_hardware)
+               status = acpi_os_prepare_extended_sleep(sleep_state,
+                                                       reg_a_value,
+                                                       reg_b_value);
+       else
+               status = acpi_os_prepare_sleep(sleep_state,
+                                              reg_a_value, reg_b_value);
+       return status;
+}