@@ -18,6 +18,7 @@
#include <linux/acpi.h>
#include <linux/bootmem.h>
#include <linux/cpumask.h>
+#include <linux/cpu_pm.h>
#include <linux/init.h>
#include <linux/irq.h>
#include <linux/irqdomain.h>
@@ -25,6 +26,9 @@
#include <linux/of_fdt.h>
#include <linux/smp.h>
+#include <acpi/processor.h>
+
+#include <asm/cpuidle.h>
#include <asm/cputype.h>
#include <asm/cpu_ops.h>
#include <asm/smp_plat.h>
@@ -211,6 +215,50 @@ void __init acpi_boot_table_init(void)
}
}
+int acpi_processor_ffh_lpi_probe(unsigned int cpu) {
+ return arm_cpuidle_init(cpu);
+}
+
+#define ACPI_FFH_LPI_ARM_FLAGS_CORE_CONTEXT BIT(0)
+#define ACPI_FFH_LPI_ARM_FLAGS_TRACE_CONTEXT BIT(1)
+#define ACPI_FFH_LPI_ARM_FLAGS_GICR_CONTEXT BIT(2)
+#define ACPI_FFH_LPI_ARM_FLAGS_GICD_CONTEXT BIT(3)
+#define ACPI_FFH_LPI_ARM_FLAGS_ALL_CONTEXT \
+ (ACPI_FFH_LPI_ARM_FLAGS_CORE_CONTEXT | \
+ ACPI_FFH_LPI_ARM_FLAGS_TRACE_CONTEXT | \
+ ACPI_FFH_LPI_ARM_FLAGS_GICR_CONTEXT | \
+ ACPI_FFH_LPI_ARM_FLAGS_GICD_CONTEXT)
+
+struct acpi_lpi_state *lpi;
+int acpi_processor_ffh_lpi_enter(struct acpi_lpi_state *lpi, int idx) {
+ int ret = 0;
+ bool save_ctx = lpi->arch_flags & ACPI_FFH_LPI_ARM_FLAGS_ALL_CONTEXT;
+
+ if (!idx) {
+ cpu_do_idle();
+ return idx;
+ }
+
+ /* TODO cpu_pm_{enter,exit} can be done in generic code ? */
+ if (save_ctx)
+ ret = cpu_pm_enter();
+ if (!ret) {
+ /*
+ * Pass idle state index to cpu_suspend which in turn will
+ * call the CPU ops suspend protocol with idle index as a
+ * parameter.
+ */
+ ret = arm_cpuidle_suspend(idx);
+
+ if (save_ctx)
+ cpu_pm_exit();
+ }
+
+ return ret ? -1 : idx;
+}
+
#ifdef CONFIG_ACPI_APEI
pgprot_t arch_apei_get_mem_attribute(phys_addr_t addr) { diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c index fa4ea22ca12e..e06bfee68e1d 100644
@@ -13,6 +13,7 @@