This is the first part of making ACPI core running on ARM.
PCI is optional on ARM64 but ACPI is dependent on PCI now, so in the first patch we try to make ACPI can be running without PCI.
_PDC is requred for ACPI processor_core.c, but its related code is a little bit x86/ia64 dependent, so I rework _PDC related staff to make it more arch independent, and then introduce the skeleton of _PDC related for ARM64, it should be fully implemented after ACPI spec is ready for processor idle control.
After that, arm-core.c is introduced so we can get ACPI table from UEFI, then we can parsed for SMP initialisation, GIC initialisation and for ACPI drivers.
This patch set is based on: git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git
origin/linux-next branch and plus Al Stone's v2 reduced hardware profile patch.
Hanjun Guo (7): ACPI: Make ACPI core running without PCI on ARM64 ARM64 : Add dummy asm/cpu.h ACPI / processor_core: Rework _PDC related stuff to make it more arch-independent ARM64 / ACPI: Introduce the skeleton of _PDC related for ARM64 ARM64 / ACPI: Introduce arm_core.c and its related head file ARM64 / ACPI: Introduce lowlevel suspend function ARM64 / ACPI: Enable ARM64 in Kconfig
arch/arm64/Kconfig | 2 + arch/arm64/include/asm/acpi.h | 93 +++++++++++++++ arch/arm64/include/asm/cpu.h | 25 ++++ arch/arm64/include/asm/processor.h | 11 ++ arch/arm64/kernel/process.c | 5 + arch/arm64/kernel/setup.c | 8 ++ drivers/acpi/Kconfig | 12 +- drivers/acpi/Makefile | 4 +- drivers/acpi/internal.h | 5 + drivers/acpi/osl.c | 16 +++ drivers/acpi/plat/Makefile | 1 + drivers/acpi/plat/arm-core.c | 226 ++++++++++++++++++++++++++++++++++++ drivers/acpi/processor_core.c | 27 ++--- drivers/acpi/reboot.c | 47 +++++--- drivers/pnp/pnpacpi/rsparser.c | 2 + 15 files changed, 452 insertions(+), 32 deletions(-) create mode 100644 arch/arm64/include/asm/acpi.h create mode 100644 arch/arm64/include/asm/cpu.h create mode 100644 drivers/acpi/plat/Makefile create mode 100644 drivers/acpi/plat/arm-core.c
Not all the ARM64 targets that are using ACPI have PCI, so introduce some stub functions to make ACPI core run without CONFIG_PCI on ARM64.
Since ACPI on X86 and IA64 depends on PCI, it will not break X86 and IA64 with this patch.
Signed-off-by: Graeme Gregory graeme.gregory@linaro.org Signed-off-by: Al Stone al.stone@linaro.org Signed-off-by: Hanjun Guo hanjun.guo@linaro.org --- drivers/acpi/Makefile | 2 +- drivers/acpi/internal.h | 5 +++++ drivers/acpi/osl.c | 16 ++++++++++++++ drivers/acpi/reboot.c | 47 +++++++++++++++++++++++++++++----------- drivers/pnp/pnpacpi/rsparser.c | 2 ++ 5 files changed, 58 insertions(+), 14 deletions(-)
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index 0331f91..d8cebe3 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile @@ -38,7 +38,7 @@ acpi-y += acpi_processor.o acpi-y += processor_core.o acpi-y += ec.o acpi-$(CONFIG_ACPI_DOCK) += dock.o -acpi-y += pci_root.o pci_link.o pci_irq.o +acpi-$(CONFIG_PCI) += pci_root.o pci_link.o pci_irq.o acpi-$(CONFIG_X86_INTEL_LPSS) += acpi_lpss.o acpi-y += acpi_platform.o acpi-y += power.o diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index b125fdb..b1ef8fa 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h @@ -26,8 +26,13 @@ acpi_status acpi_os_initialize1(void); int init_acpi_device_notify(void); int acpi_scan_init(void); +#ifdef CONFIG_PCI void acpi_pci_root_init(void); void acpi_pci_link_init(void); +#else +static inline void acpi_pci_root_init(void) {} +static inline void acpi_pci_link_init(void) {} +#endif /* CONFIG_PCI */ void acpi_processor_init(void); void acpi_platform_init(void); int acpi_sysfs_init(void); diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index c543626..6434045 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -1016,6 +1016,7 @@ acpi_os_write_memory(acpi_physical_address phys_addr, u64 value, u32 width) return AE_OK; }
+#ifdef CONFIG_PCI acpi_status acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, u64 *value, u32 width) @@ -1074,6 +1075,21 @@ acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, u32 reg,
return (result ? AE_ERROR : AE_OK); } +#else +acpi_status +acpi_os_read_pci_configuration(struct acpi_pci_id *pci_id, u32 reg, + u64 *value, u32 width) +{ + return AE_ERROR; +} + +acpi_status +acpi_os_write_pci_configuration(struct acpi_pci_id *pci_id, u32 reg, + u64 value, u32 width) +{ + return AE_ERROR; +} +#endif /* CONFIG_PCI */
static void acpi_os_execute_deferred(struct work_struct *work) { diff --git a/drivers/acpi/reboot.c b/drivers/acpi/reboot.c index a6c77e8b..89a181f 100644 --- a/drivers/acpi/reboot.c +++ b/drivers/acpi/reboot.c @@ -3,12 +3,43 @@ #include <linux/acpi.h> #include <acpi/reboot.h>
+/* + * There are some rare cases in the ARM world with PCI is not one + * of the buses available to us, even though we use ACPI. + */ +#ifdef CONFIG_PCI +static void acpi_reset_with_writing_pci_config(u64 address, u8 reset_value) +{ + struct pci_bus *bus0; + unsigned int devfn; + + /* The reset register can only live on bus 0. */ + bus0 = pci_find_bus(0, 0); + if (!bus0) + return; + + /* Form PCI device/function pair. */ + devfn = PCI_DEVFN((address >> 32) & 0xffff, + (address >> 16) & 0xffff); + pr_debug("Resetting with ACPI PCI RESET_REG.\n"); + /* Write the value that resets us. */ + pci_bus_write_config_byte(bus0, devfn, + (address & 0xffff), reset_value); + + return; +} +#else +static void acpi_reset_with_writing_pci_config(u64 address, u8 reset_value) +{ + pr_warn("Resetting with ACPI PCI RESET_REG failed, PCI is disabled\n"); + return; +} +#endif + void acpi_reboot(void) { struct acpi_generic_address *rr; - struct pci_bus *bus0; u8 reset_value; - unsigned int devfn;
if (acpi_disabled) return; @@ -32,17 +63,7 @@ void acpi_reboot(void) * on a device on bus 0. */ switch (rr->space_id) { case ACPI_ADR_SPACE_PCI_CONFIG: - /* The reset register can only live on bus 0. */ - bus0 = pci_find_bus(0, 0); - if (!bus0) - return; - /* Form PCI device/function pair. */ - devfn = PCI_DEVFN((rr->address >> 32) & 0xffff, - (rr->address >> 16) & 0xffff); - printk(KERN_DEBUG "Resetting with ACPI PCI RESET_REG."); - /* Write the value that resets us. */ - pci_bus_write_config_byte(bus0, devfn, - (rr->address & 0xffff), reset_value); + acpi_reset_with_writing_pci_config(rr->address, reset_value); break;
case ACPI_ADR_SPACE_SYSTEM_MEMORY: diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 167f3d0..5804e77 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c @@ -113,8 +113,10 @@ static int dma_flags(struct pnp_dev *dev, int type, int bus_master,
static void pnpacpi_add_irqresource(struct pnp_dev *dev, struct resource *r) { +#ifdef CONFIG_PCI if (!(r->flags & IORESOURCE_DISABLED)) pcibios_penalize_isa_irq(r->start, 1); +#endif
pnp_add_resource(dev, r); }
ACPI requires a cpu.h, add a dummy one copied from arm. This will need updated or replaced as ACPI based cpu hotplug for armv8 is worked out.
Signed-off-by: Graeme Gregory graeme.gregory@linaro.org Signed-off-by: Hanjun Guo hanjun.guo@linaro.org --- arch/arm64/include/asm/cpu.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 arch/arm64/include/asm/cpu.h
diff --git a/arch/arm64/include/asm/cpu.h b/arch/arm64/include/asm/cpu.h new file mode 100644 index 0000000..dbeb98d --- /dev/null +++ b/arch/arm64/include/asm/cpu.h @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2004-2005 ARM Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#ifndef __ASM_ARM_CPU_H +#define __ASM_ARM_CPU_H + +#include <linux/percpu.h> +#include <linux/cpu.h> +#include <linux/topology.h> + +struct cpuinfo_arm { + struct cpu cpu; + u32 cpuid; +#ifdef CONFIG_SMP + unsigned int loops_per_jiffy; +#endif +}; + +DECLARE_PER_CPU(struct cpuinfo_arm, cpu_data); + +#endif
_PDC related stuff in processor_core.c is little bit X86/IA64 dependent, rework the code to make it more arch-independent.
The return value of acpi_processor_eval_pdc() should be 'acpi_status' but defined as 'int', fix it too.
Signed-off-by: Hanjun Guo hanjun.guo@linaro.org Signed-off-by: Graeme Gregory graeme.gregory@linaro.org --- drivers/acpi/processor_core.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-)
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 34e7b3c..9931435 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c @@ -273,8 +273,19 @@ static void acpi_set_pdc_bits(u32 *buf) buf[0] = ACPI_PDC_REVISION_ID; buf[1] = 1;
+#if defined(CONFIG_X86) || defined(CONFIG_IA64) /* Enable coordination with firmware's _TSD info */ buf[2] = ACPI_PDC_SMP_T_SWCOORD; + if (boot_option_idle_override == IDLE_NOMWAIT) { + /* + * If mwait is disabled for CPU C-states, the C2C3_FFH access + * mode will be disabled in the parameter of _PDC object. + * Of course C1_FFH access mode will also be disabled. + */ + buf[2] &= ~(ACPI_PDC_C_C2C3_FFH | ACPI_PDC_C_C1_FFH); + + } +#endif
/* Twiddle arch-specific bits needed for _PDC */ arch_acpi_set_pdc_bits(buf); @@ -323,25 +334,11 @@ static struct acpi_object_list *acpi_processor_alloc_pdc(void) * _PDC is required for a BIOS-OS handshake for most of the newer * ACPI processor features. */ -static int +static acpi_status acpi_processor_eval_pdc(acpi_handle handle, struct acpi_object_list *pdc_in) { acpi_status status = AE_OK;
- if (boot_option_idle_override == IDLE_NOMWAIT) { - /* - * If mwait is disabled for CPU C-states, the C2C3_FFH access - * mode will be disabled in the parameter of _PDC object. - * Of course C1_FFH access mode will also be disabled. - */ - union acpi_object *obj; - u32 *buffer = NULL; - - obj = pdc_in->pointer; - buffer = (u32 *)(obj->buffer.pointer); - buffer[2] &= ~(ACPI_PDC_C_C2C3_FFH | ACPI_PDC_C_C1_FFH); - - } status = acpi_evaluate_object(handle, "_PDC", pdc_in, NULL);
if (ACPI_FAILURE(status))
The _PDC (Processor Driver Capabilities) object provides OSPM a mechanism to convey to the platform the capabilities supported by OSPM for processor power management.
OSPM evaluates _PDC prior to evaluating any other processor power management objects returning configuration information.
This patch introduces the skeleton of _PDC related file to make ACPI core can be compiled on ARM64.
Signed-off-by: Al Stone al.stone@linaro.org Signed-off-by: Graeme Gregory graeme.gregory@linaro.org Signed-off-by: Hanjun Guo hanjun.guo@linaro.org --- arch/arm64/include/asm/acpi.h | 32 ++++++++++++++++++++++++++++++++ arch/arm64/include/asm/processor.h | 11 +++++++++++ arch/arm64/kernel/process.c | 5 +++++ 3 files changed, 48 insertions(+) create mode 100644 arch/arm64/include/asm/acpi.h
diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h new file mode 100644 index 0000000..c186f5b --- /dev/null +++ b/arch/arm64/include/asm/acpi.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2013, Al Stone al.stone@linaro.org + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ + +#ifndef _ASM_ARM_ACPI_H +#define _ASM_ARM_ACPI_H + +static inline bool arch_has_acpi_pdc(void) +{ + return false; /* always false for now */ +} + +static inline void arch_acpi_set_pdc_bits(u32 *buf) +{ + return; +} + +#endif /*_ASM_ARM_ACPI_H*/ diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h index 45b20cd..73b1d3a 100644 --- a/arch/arm64/include/asm/processor.h +++ b/arch/arm64/include/asm/processor.h @@ -162,6 +162,17 @@ static inline void spin_lock_prefetch(const void *x)
#define HAVE_ARCH_PICK_MMAP_LAYOUT
+#ifdef CONFIG_ACPI +/* + * FIXME: there is no MWAIT on ARM, should be WFI or something else, + * and modify drivers/acpi/processor_core.c too. + */ +enum idle_boot_override { IDLE_NO_OVERRIDE = 0, IDLE_HALT, IDLE_NOMWAIT, + IDLE_POLL, IDLE_FORCE_MWAIT }; + +extern unsigned long boot_option_idle_override; +#endif + #endif
#endif /* __ASM_PROCESSOR_H */ diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index de17c89..2cd4182 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -347,3 +347,8 @@ unsigned long randomize_et_dyn(unsigned long base) { return randomize_base(base); } + +#ifdef CONFIG_ACPI +unsigned long boot_option_idle_override = IDLE_NO_OVERRIDE; +EXPORT_SYMBOL(boot_option_idle_override); +#endif
introduce arm_core.c and its related head file, after this patch, we can get ACPI tables from BIOS on ARM64 now.
Signed-off-by: Al Stone al.stone@linaro.org Signed-off-by: Graeme Gregory graeme.gregory@linaro.org Signed-off-by: Hanjun Guo hanjun.guo@linaro.org --- arch/arm64/include/asm/acpi.h | 57 +++++++++++ arch/arm64/kernel/setup.c | 8 ++ drivers/acpi/Makefile | 2 + drivers/acpi/plat/Makefile | 1 + drivers/acpi/plat/arm-core.c | 219 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 287 insertions(+) create mode 100644 drivers/acpi/plat/Makefile create mode 100644 drivers/acpi/plat/arm-core.c
diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h index c186f5b..e9444e4 100644 --- a/arch/arm64/include/asm/acpi.h +++ b/arch/arm64/include/asm/acpi.h @@ -19,6 +19,43 @@ #ifndef _ASM_ARM_ACPI_H #define _ASM_ARM_ACPI_H
+#include <asm/cacheflush.h> + +#include <linux/init.h> + +#define COMPILER_DEPENDENT_INT64 long long +#define COMPILER_DEPENDENT_UINT64 unsigned long long + +/* + * Calling conventions: + * + * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads) + * ACPI_EXTERNAL_XFACE - External ACPI interfaces + * ACPI_INTERNAL_XFACE - Internal ACPI interfaces + * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces + */ +#define ACPI_SYSTEM_XFACE +#define ACPI_EXTERNAL_XFACE +#define ACPI_INTERNAL_XFACE +#define ACPI_INTERNAL_VAR_XFACE + +/* Asm macros */ +#define ACPI_FLUSH_CPU_CACHE() flush_cache_all() + +/* Basic configuration for ACPI */ +#ifdef CONFIG_ACPI +extern int acpi_disabled; +extern int acpi_noirq; +extern int acpi_pci_disabled; +extern int acpi_strict; + +static inline void disable_acpi(void) +{ + acpi_disabled = 1; + acpi_pci_disabled = 1; + acpi_noirq = 1; +} + static inline bool arch_has_acpi_pdc(void) { return false; /* always false for now */ @@ -29,4 +66,24 @@ static inline void arch_acpi_set_pdc_bits(u32 *buf) return; }
+static inline void acpi_noirq_set(void) { acpi_noirq = 1; } +static inline void acpi_disable_pci(void) +{ + acpi_pci_disabled = 1; + acpi_noirq_set(); +} + +/* FIXME: this function should be moved to topology.h when it's ready */ +void arch_fix_phys_package_id(int num, u32 slot); + +/* temperally define -1 to make acpi core compilerable */ +#define cpu_physical_id(cpu) -1 + +#else /* !CONFIG_ACPI */ +#define acpi_disabled 1 /* ACPI sometimes enabled on ARM */ +#define acpi_noirq 1 /* ACPI sometimes enabled on ARM */ +#define acpi_pci_disabled 1 /* ACPI PCI sometimes enabled on ARM */ +#define acpi_strict 1 /* no ACPI spec workarounds on ARM */ +#endif + #endif /*_ASM_ARM_ACPI_H*/ diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index bd9bbd0..8199360 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -41,6 +41,7 @@ #include <linux/memblock.h> #include <linux/of_fdt.h> #include <linux/of_platform.h> +#include <linux/acpi.h>
#include <asm/cputype.h> #include <asm/elf.h> @@ -225,6 +226,13 @@ void __init setup_arch(char **cmdline_p)
arm64_memblock_init();
+ /* + * Parse the ACPI tables for possible boot-time configuration + */ + acpi_boot_table_init(); + early_acpi_boot_init(); + acpi_boot_init(); + paging_init(); request_standard_resources();
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index d8cebe3..9fbba50 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile @@ -83,3 +83,5 @@ obj-$(CONFIG_ACPI_PROCESSOR_AGGREGATOR) += acpi_pad.o obj-$(CONFIG_ACPI_APEI) += apei/
obj-$(CONFIG_ACPI_EXTLOG) += acpi_extlog.o + +obj-y += plat/ diff --git a/drivers/acpi/plat/Makefile b/drivers/acpi/plat/Makefile new file mode 100644 index 0000000..46bc65e --- /dev/null +++ b/drivers/acpi/plat/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_ARM64) += arm-core.o diff --git a/drivers/acpi/plat/arm-core.c b/drivers/acpi/plat/arm-core.c new file mode 100644 index 0000000..7b8e64a --- /dev/null +++ b/drivers/acpi/plat/arm-core.c @@ -0,0 +1,219 @@ +/* + * ARM/ARM64 Specific Low-Level ACPI Boot Support + * + * Copyright (C) 2001, 2002 Paul Diefenbaugh paul.s.diefenbaugh@intel.com + * Copyright (C) 2001 Jun Nakajima jun.nakajima@intel.com + * Copyright (C) 2013, Al Stone al.stone@linaro.org (ARM version) + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ + +#include <linux/init.h> +#include <linux/acpi.h> +#include <linux/acpi_pmtmr.h> +#include <linux/efi.h> +#include <linux/cpumask.h> +#include <linux/memblock.h> +#include <linux/module.h> +#include <linux/irq.h> +#include <linux/irqdomain.h> +#include <linux/slab.h> +#include <linux/bootmem.h> +#include <linux/ioport.h> +#include <linux/pci.h> + +#include <asm/pgtable.h> +#include <asm/io.h> +#include <asm/smp.h> + +/* + * We never plan to use RSDT on arm/arm64 as its deprecated in spec but this + * variable is still required by the ACPI core + */ +u32 acpi_rsdt_forced; + +int acpi_noirq; /* skip ACPI IRQ initialization */ +int acpi_strict; +int acpi_disabled; +EXPORT_SYMBOL(acpi_disabled); + +int acpi_pci_disabled; /* skip ACPI PCI scan and IRQ initialization */ +EXPORT_SYMBOL(acpi_pci_disabled); + +#define PREFIX "ACPI: " + +/* FIXME: this function should be moved to topology.c when it is ready */ +void arch_fix_phys_package_id(int num, u32 slot) +{ + return; +} +EXPORT_SYMBOL_GPL(arch_fix_phys_package_id); + +/* + * Boot-time Configuration + */ + +enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_PLATFORM; + +static unsigned int gsi_to_irq(unsigned int gsi) +{ + int irq = irq_create_mapping(NULL, gsi); + + return irq; +} + +/* + * __acpi_map_table() will be called before page_init(), so early_ioremap() + * or early_memremap() should be called here. + * + * FIXME: early_io/memremap()/early_iounmap() are not upstream yet on ARM64, + * just wait for Mark Salter's patchset accepted by mainline + */ +char *__init __acpi_map_table(unsigned long phys, unsigned long size) +{ + if (!phys || !size) + return NULL; + + /* + * temporarily use phys_to_virt(), + * should be early_memremap(phys, size) here + */ + return phys_to_virt(phys); +} + +void __init __acpi_unmap_table(char *map, unsigned long size) +{ + if (!map || !size) + return; + + /* should be early_iounmap(map, size); */ + return; +} + +int acpi_gsi_to_irq(u32 gsi, unsigned int *irq) +{ + *irq = gsi_to_irq(gsi); + + return 0; +} +EXPORT_SYMBOL_GPL(acpi_gsi_to_irq); + +/* + * success: return IRQ number (>=0) + * failure: return < 0 + */ +int acpi_register_gsi(struct device *dev, u32 gsi, int trigger, int polarity) +{ + return -1; +} +EXPORT_SYMBOL_GPL(acpi_register_gsi); + +void acpi_unregister_gsi(u32 gsi) +{ +} +EXPORT_SYMBOL_GPL(acpi_unregister_gsi); + +static int __init acpi_parse_fadt(struct acpi_table_header *table) +{ + return 0; +} + +static void __init early_acpi_process_madt(void) +{ + return; +} + +static void __init acpi_process_madt(void) +{ + return; +} + +/* + * acpi_boot_table_init() and acpi_boot_init() + * called from setup_arch(), always. + * 1. checksums all tables + * 2. enumerates lapics + * 3. enumerates io-apics + * + * acpi_table_init() is separated to allow reading SRAT without + * other side effects. + */ +void __init acpi_boot_table_init(void) +{ + /* + * If acpi_disabled, bail out + */ + if (acpi_disabled) + return; + + /* + * Initialize the ACPI boot-time table parser. + */ + if (acpi_table_init()) { + disable_acpi(); + return; + } +} + +int __init early_acpi_boot_init(void) +{ + /* + * If acpi_disabled, bail out + */ + if (acpi_disabled) + return 1; + + /* + * Process the Multiple APIC Description Table (MADT), if present + */ + early_acpi_process_madt(); + + return 0; +} + +int __init acpi_boot_init(void) +{ + /* + * If acpi_disabled, bail out + */ + if (acpi_disabled) + return 1; + + acpi_table_parse(ACPI_SIG_FADT, acpi_parse_fadt); + + /* + * Process the Multiple APIC Description Table (MADT), if present + */ + acpi_process_madt(); + + return 0; +} + +static int __init parse_acpi(char *arg) +{ + if (!arg) + return -EINVAL; + + /* "acpi=off" disables both ACPI table parsing and interpreter */ + if (strcmp(arg, "off") == 0) { + disable_acpi(); + } + /* acpi=strict disables out-of-spec workarounds */ + else if (strcmp(arg, "strict") == 0) { + acpi_strict = 1; + } + return 0; +} +early_param("acpi", parse_acpi);
lowlevel suspend function is needed for ACPI based suspend/resume, introduce ARM related lowlevel function in this patch.
Signed-off-by: Graeme Gregory graeme.gregory@linaro.org Signed-off-by: Hanjun Guo hanjun.guo@linaro.org --- arch/arm64/include/asm/acpi.h | 4 ++++ drivers/acpi/plat/arm-core.c | 7 +++++++ 2 files changed, 11 insertions(+)
diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h index e9444e4..c830adc 100644 --- a/arch/arm64/include/asm/acpi.h +++ b/arch/arm64/include/asm/acpi.h @@ -79,6 +79,10 @@ void arch_fix_phys_package_id(int num, u32 slot); /* temperally define -1 to make acpi core compilerable */ #define cpu_physical_id(cpu) -1
+/* Low-level suspend routine. */ +extern int (*acpi_suspend_lowlevel)(void); +#define acpi_wakeup_address (0) + #else /* !CONFIG_ACPI */ #define acpi_disabled 1 /* ACPI sometimes enabled on ARM */ #define acpi_noirq 1 /* ACPI sometimes enabled on ARM */ diff --git a/drivers/acpi/plat/arm-core.c b/drivers/acpi/plat/arm-core.c index 7b8e64a..2b6df56 100644 --- a/drivers/acpi/plat/arm-core.c +++ b/drivers/acpi/plat/arm-core.c @@ -217,3 +217,10 @@ static int __init parse_acpi(char *arg) return 0; } early_param("acpi", parse_acpi); + +/* + * acpi_suspend_lowlevel() - save kernel state and suspend. + * + * TBD when when ARM/ARM64 starts to support suspend... + */ +int (*acpi_suspend_lowlevel)(void);
Add Kconfigs to build ACPI on ARM64, and make ACPI runable on ARM64.
acpi_idle driver is x86/IA64 dependent now, so make CONFIG_ACPI_PROCESSOR depends on X86 || IA64, and implement it on ARM in the furture.
In order to make arm-core.c can both run on ARM and ARM64, introduce CONFIG_ACPI_ARM to support it.
Signed-off-by: Graeme Gregory graeme.gregory@linaro.org Signed-off-by: Al Stone al.stone@linaro.org Signed-off-by: Hanjun Guo hanjun.guo@linaro.org --- arch/arm64/Kconfig | 2 ++ drivers/acpi/Kconfig | 12 +++++++++--- drivers/acpi/plat/Makefile | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 88c8b6c1..a37795f 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -280,6 +280,8 @@ source "net/Kconfig"
source "drivers/Kconfig"
+source "drivers/acpi/Kconfig" + source "fs/Kconfig"
source "arch/arm64/kvm/Kconfig" diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 53f0f16..f43485e 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -2,13 +2,17 @@ # ACPI Configuration #
+config ACPI_ARM + bool + select ACPI_REDUCED_HARDWARE + menuconfig ACPI bool "ACPI (Advanced Configuration and Power Interface) Support" depends on !IA64_HP_SIM - depends on IA64 || X86 - depends on PCI + depends on ((IA64 || X86) && PCI) || ARM64 select PNP - default y + select ACPI_ARM if (ARM || ARM64) + default y if !(ARM || ARM64) help Advanced Configuration and Power Interface (ACPI) support for Linux requires an ACPI-compliant platform (hardware/firmware), @@ -149,6 +153,7 @@ config ACPI_PROCESSOR tristate "Processor" select THERMAL select CPU_IDLE + depends on X86 || IA64 default y help This driver installs ACPI as the idle handler for Linux and uses @@ -250,6 +255,7 @@ config ACPI_DEBUG config ACPI_PCI_SLOT bool "PCI slot detection driver" depends on SYSFS + depends on PCI default n help This driver creates entries in /sys/bus/pci/slots/ for all PCI diff --git a/drivers/acpi/plat/Makefile b/drivers/acpi/plat/Makefile index 46bc65e..3a61176 100644 --- a/drivers/acpi/plat/Makefile +++ b/drivers/acpi/plat/Makefile @@ -1 +1 @@ -obj-$(CONFIG_ARM64) += arm-core.o +obj-$(CONFIG_ACPI_ARM) += arm-core.o
linaro-kernel@lists.linaro.org