This patch set is the first part of ARM64 ACPI core patches to running ACPI on ARM64, it just handle some compile errors when ACPI is introduced to ARM64 platform and enable ACPI on ARM64 in Kconfig.
Following core patch sets for ACPI based SMP/GIC/Arch Timer initialization to enable ACPI on ARM64 are under interally review and will send out when ACPI 5.1 is released.
patch 1~3 are cleanups for ACPI core; patch 4~13 are arch dependent code for ARM64 ACPI;
This patch set is based on linux-next branch of Rafael's linux-pm tree, and PCI patches for ARM64 from Liviu: Support for creating generic host_bridge from device tree https://lkml.org/lkml/2014/3/14/279
Add support for PCI in AArch64 http://comments.gmane.org/gmane.linux.ports.arm.kernel/309392
Changes since v3: - Introduce three new patches - acpi: arm64 does not have a BIOS add config for BIOS table scan - ACPI: Don't use acpi_lapic in ACPI core code - ARM64 / ACPI: if we chose to boot from acpi then disable FDT - Rebase on the latest linux-next branch of Rafael's tree, and introduce asm/acenv.h for ARM64; - Introduce ARCH_HAS_ACPI_PDC to move all the _PDC related code to a single place and make x86 and ia64 select ARCH_HAS_ACPI_PDC; - Fix some checpatch warning; - Fix broken Signed-off-by chain; - Remove duplicate interface macros for ACPICA pointed out by Mark Rutland and Zheng Lv; - Redefine ACPI_FLUSH_CPU_CACHE(); - Stub out some PCI functions suggested by Arnd and already merged into 3.16
Comments still need to be addressed: - Empty PCI implementation in arch/arm64 which suggested by Arnd; - suspend and sleep on ARM64 platform pointed out by Lorenzo;
Changes since v2: - Make ACPI depend on PCI on ARM64 - rework all the patches and seperate some of the patches into fine-grained, and add some comments and changelog to make it easier for review.
Al Stone (3): ARM64 / ACPI: Introduce arm-core.c and its related head file ARM64 / ACPI: Introduce early_param for "acpi" ARM64 / ACPI: Select ACPI_REDUCED_HARDWARE_ONLY if ACPI is enabled on ARM64
Graeme Gregory (6): acpi: arm64 does not have a BIOS add config for BIOS table scan. ACPI: Don't use acpi_lapic in ACPI core code ARM64 : Add dummy asm/cpu.h ARM64 / ACPI: Introduce lowlevel suspend function ARM64 / ACPI: if we chose to boot from acpi then disable FDT ARM64 / ACPI: Enable ARM64 in Kconfig
Hanjun Guo (4): ACPI / processor: Introduce ARCH_HAS_ACPI_PDC ARM64 / ACPI: Introduce arch_fix_phys_package_id() for cpu topology ARM64 / ACPI: Introduce PCI functions for ACPI on ARM64 ACPI: Make EC debugfs depend on X86 || IA64 in Kconfig
Documentation/kernel-parameters.txt | 3 +- arch/arm64/Kconfig | 3 + arch/arm64/include/asm/acenv.h | 18 +++ arch/arm64/include/asm/acpi.h | 61 +++++++++++ arch/arm64/include/asm/cpu.h | 11 ++ arch/arm64/include/asm/pci.h | 6 + arch/arm64/include/asm/topology.h | 2 + arch/arm64/kernel/pci.c | 28 +++++ arch/arm64/kernel/setup.c | 7 +- arch/arm64/kernel/topology.c | 14 +++ arch/ia64/Kconfig | 2 + arch/ia64/include/asm/acpi.h | 5 + arch/x86/Kconfig | 2 + arch/x86/include/asm/acpi.h | 5 + drivers/acpi/Kconfig | 19 +++- drivers/acpi/Makefile | 3 + drivers/acpi/acpi_processor.c | 2 +- drivers/acpi/internal.h | 5 + drivers/acpi/osl.c | 4 +- drivers/acpi/plat/Makefile | 1 + drivers/acpi/plat/arm-core.c | 138 +++++++++++++++++++++++ drivers/acpi/processor_core.c | 198 --------------------------------- drivers/acpi/processor_pdc.c | 206 +++++++++++++++++++++++++++++++++++ 23 files changed, 539 insertions(+), 204 deletions(-) create mode 100644 arch/arm64/include/asm/acenv.h 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 create mode 100644 drivers/acpi/processor_pdc.c
From: Graeme Gregory graeme.gregory@linaro.org
With the addition of ARM64 that does not have a traditional BIOS to scan, add a config option which is selected on x86 and ia64 to do the traditional BIOS scanning for tables.
Signed-off-by: Graeme Gregory graeme.gregory@linaro.org --- arch/ia64/Kconfig | 1 + arch/x86/Kconfig | 1 + drivers/acpi/Kconfig | 3 +++ drivers/acpi/osl.c | 4 +++- 4 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index 2f3abcf..f82b352 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig @@ -47,6 +47,7 @@ config IA64 select MODULES_USE_ELF_RELA select ARCH_USE_CMPXCHG_LOCKREF select HAVE_ARCH_AUDITSYSCALL + select ACPI_SCAN_BIOS_NOT_EFI default y help The Itanium Processor Family is Intel's 64-bit successor to diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index a8f749e..4865d44 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -131,6 +131,7 @@ config X86 select HAVE_CC_STACKPROTECTOR select GENERIC_CPU_AUTOPROBE select HAVE_ARCH_AUDITSYSCALL + select ACPI_SCAN_BIOS_NOT_EFI
config INSTRUCTION_DECODER def_bool y diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index a34a228..70eaf7a 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -2,6 +2,9 @@ # ACPI Configuration #
+config ACPI_SCAN_BIOS_NOT_EFI + bool + menuconfig ACPI bool "ACPI (Advanced Configuration and Power Interface) Support" depends on !IA64_HP_SIM diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index bad25b0..5ba0b74 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -259,12 +259,14 @@ acpi_physical_address __init acpi_os_get_root_pointer(void) "System description tables not found\n"); return 0; } - } else { + } else if (IS_ENABLED(CONFIG_ACPI_SCAN_BIOS_NOT_EFI)) { acpi_physical_address pa = 0;
acpi_find_root_pointer(&pa); return pa; } + + return 0; }
/* Must be called with 'acpi_ioremap_lock' or RCU read lock held. */
From: Graeme Gregory graeme.gregory@linaro.org
Now ARM64 support is being added to ACPI so architecture specific values can not be used in core ACPI code.
Following on the patch "ACPI / processor: Check if LAPIC is present during initialization" which uses acpi_lapic in acpi_processor.c, on ARM64 platform, GIC is used instead of local APIC, so acpi_lapic is not a suitable value for ARM64.
What is actually important at this point is the SMPness of the system, so introduce acpi_arch_is_smp() to be arch specific and generic.
Signed-off-by: Graeme Gregory graeme.gregory@linaro.org Signed-off-by: Hanjun Guo hanjun.guo@linaro.org --- arch/ia64/include/asm/acpi.h | 5 +++++ arch/x86/include/asm/acpi.h | 5 +++++ drivers/acpi/acpi_processor.c | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/arch/ia64/include/asm/acpi.h b/arch/ia64/include/asm/acpi.h index 75dc59a..2fc0757 100644 --- a/arch/ia64/include/asm/acpi.h +++ b/arch/ia64/include/asm/acpi.h @@ -40,6 +40,11 @@ extern int acpi_lapic; #define acpi_noirq 0 /* ACPI always enabled on IA64 */ #define acpi_pci_disabled 0 /* ACPI PCI always enabled on IA64 */ #define acpi_strict 1 /* no ACPI spec workarounds on IA64 */ + +static inline bool acpi_arch_is_smp(void) +{ + return acpi_lapic; +} #endif #define acpi_processor_cstate_check(x) (x) /* no idle limits on IA64 :) */ static inline void disable_acpi(void) { } diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h index e06225e..939d377 100644 --- a/arch/x86/include/asm/acpi.h +++ b/arch/x86/include/asm/acpi.h @@ -121,6 +121,11 @@ static inline void arch_acpi_set_pdc_bits(u32 *buf) buf[2] &= ~(ACPI_PDC_C_C2C3_FFH); }
+static inline bool acpi_arch_is_smp(void) +{ + return acpi_lapic; +} + #else /* !CONFIG_ACPI */
#define acpi_lapic 0 diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c index 1c08574..8622a0e 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c @@ -268,7 +268,7 @@ static int acpi_processor_get_info(struct acpi_device *device) pr->apic_id = apic_id;
cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id); - if (!cpu0_initialized && !acpi_lapic) { + if (!cpu0_initialized && !acpi_arch_is_smp()) { cpu0_initialized = 1; /* Handle UP system running SMP kernel, with no LAPIC in MADT */ if ((cpu_index == -1) && (num_online_cpus() == 1))
The use of _PDC is deprecated in ACPI 3.0 in favor of _OSC, as ARM platform is supported only in ACPI 5.0 or higher version, _PDC will not be used in ARM platform, so make Make _PDC only for platforms with Intel CPUs.
Introduce ARCH_HAS_ACPI_PDC and move _PDC related code in ACPI processor driver into a single file processor_pdc.c, make x86 and ia64 select ARCH_HAS_ACPI_PDC when ACPI is enabled.
This patch also use pr_* to replace printk to fix the checkpatch warning and factor acpi_processor_alloc_pdc() a little bit to avoid duplicate pr_err() code.
Suggested-by: Robert Richter rric@kernel.org Signed-off-by: Hanjun Guo hanjun.guo@linaro.org --- arch/ia64/Kconfig | 1 + arch/x86/Kconfig | 1 + drivers/acpi/Kconfig | 10 ++ drivers/acpi/Makefile | 1 + drivers/acpi/internal.h | 5 + drivers/acpi/processor_core.c | 198 --------------------------------------- drivers/acpi/processor_pdc.c | 206 +++++++++++++++++++++++++++++++++++++++++ 7 files changed, 224 insertions(+), 198 deletions(-) create mode 100644 drivers/acpi/processor_pdc.c
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index f82b352..cde2626 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig @@ -10,6 +10,7 @@ config IA64 select ARCH_MIGHT_HAVE_PC_SERIO select PCI if (!IA64_HP_SIM) select ACPI if (!IA64_HP_SIM) + select ARCH_HAS_ACPI_PDC if ACPI select PM if (!IA64_HP_SIM) select HAVE_UNSTABLE_SCHED_CLOCK select HAVE_IDE diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 4865d44..d60cec7 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -21,6 +21,7 @@ config X86_64 ### Arch settings config X86 def_bool y + select ARCH_HAS_ACPI_PDC if ACPI select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_MIGHT_HAVE_PC_SERIO diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 70eaf7a..0e6f72d 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -367,6 +367,16 @@ config ACPI_REDUCED_HARDWARE_ONLY
If you are unsure what to do, do not enable this option.
+config ARCH_HAS_ACPI_PDC + bool + help + The _PDC object provides OSPM a mechanism to convey to the platform + the capabilities supported by OSPM for processor power management. + This allows the platform to modify the ACPI namespace objects returning + configuration information for processor power management based on the + level of support provided by OSPM.The use of _PDC is deprecated in + ACPI 3.0 in favor of _OSC. + source "drivers/acpi/apei/Kconfig"
config ACPI_EXTLOG diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index ea55e01..b638e95 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile @@ -36,6 +36,7 @@ acpi-y += scan.o acpi-y += resource.o acpi-y += acpi_processor.o acpi-y += processor_core.o +acpi-$(CONFIG_ARCH_HAS_ACPI_PDC) += processor_pdc.o acpi-y += ec.o acpi-$(CONFIG_ACPI_DOCK) += dock.o acpi-y += pci_root.o pci_link.o pci_irq.o diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index 7de5b60..d7376ee 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h @@ -108,7 +108,12 @@ int acpi_power_transition(struct acpi_device *device, int state); int acpi_device_update_power(struct acpi_device *device, int *state_p);
int acpi_wakeup_device_init(void); + +#ifdef CONFIG_ARCH_HAS_ACPI_PDC void acpi_early_processor_set_pdc(void); +#else +static inline void acpi_early_processor_set_pdc(void) {} +#endif
/* -------------------------------------------------------------------------- Embedded Controller diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 71e2065..00f48d1 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c @@ -4,17 +4,11 @@ * * Alex Chiang achiang@hp.com * - Unified x86/ia64 implementations - * Venkatesh Pallipadi venkatesh.pallipadi@intel.com - * - Added _PDC for platforms with Intel CPUs */ #include <linux/export.h> -#include <linux/dmi.h> -#include <linux/slab.h> #include <linux/acpi.h> #include <acpi/processor.h>
-#include "internal.h" - #define _COMPONENT ACPI_PROCESSOR_COMPONENT ACPI_MODULE_NAME("processor_core");
@@ -208,195 +202,3 @@ int acpi_get_cpuid(acpi_handle handle, int type, u32 acpi_id) return acpi_map_cpuid(apic_id, acpi_id); } EXPORT_SYMBOL_GPL(acpi_get_cpuid); - -static bool __init processor_physically_present(acpi_handle handle) -{ - int cpuid, type; - u32 acpi_id; - acpi_status status; - acpi_object_type acpi_type; - unsigned long long tmp; - union acpi_object object = { 0 }; - struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; - - status = acpi_get_type(handle, &acpi_type); - if (ACPI_FAILURE(status)) - return false; - - switch (acpi_type) { - case ACPI_TYPE_PROCESSOR: - status = acpi_evaluate_object(handle, NULL, NULL, &buffer); - if (ACPI_FAILURE(status)) - return false; - acpi_id = object.processor.proc_id; - break; - case ACPI_TYPE_DEVICE: - status = acpi_evaluate_integer(handle, "_UID", NULL, &tmp); - if (ACPI_FAILURE(status)) - return false; - acpi_id = tmp; - break; - default: - return false; - } - - type = (acpi_type == ACPI_TYPE_DEVICE) ? 1 : 0; - cpuid = acpi_get_cpuid(handle, type, acpi_id); - - if (cpuid == -1) - return false; - - return true; -} - -static void acpi_set_pdc_bits(u32 *buf) -{ - buf[0] = ACPI_PDC_REVISION_ID; - buf[1] = 1; - - /* Enable coordination with firmware's _TSD info */ - buf[2] = ACPI_PDC_SMP_T_SWCOORD; - - /* Twiddle arch-specific bits needed for _PDC */ - arch_acpi_set_pdc_bits(buf); -} - -static struct acpi_object_list *acpi_processor_alloc_pdc(void) -{ - struct acpi_object_list *obj_list; - union acpi_object *obj; - u32 *buf; - - /* allocate and initialize pdc. It will be used later. */ - obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL); - if (!obj_list) { - printk(KERN_ERR "Memory allocation error\n"); - return NULL; - } - - obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL); - if (!obj) { - printk(KERN_ERR "Memory allocation error\n"); - kfree(obj_list); - return NULL; - } - - buf = kmalloc(12, GFP_KERNEL); - if (!buf) { - printk(KERN_ERR "Memory allocation error\n"); - kfree(obj); - kfree(obj_list); - return NULL; - } - - acpi_set_pdc_bits(buf); - - obj->type = ACPI_TYPE_BUFFER; - obj->buffer.length = 12; - obj->buffer.pointer = (u8 *) buf; - obj_list->count = 1; - obj_list->pointer = obj; - - return obj_list; -} - -/* - * _PDC is required for a BIOS-OS handshake for most of the newer - * ACPI processor features. - */ -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)) - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Could not evaluate _PDC, using legacy perf. control.\n")); - - return status; -} - -void acpi_processor_set_pdc(acpi_handle handle) -{ - struct acpi_object_list *obj_list; - - if (arch_has_acpi_pdc() == false) - return; - - obj_list = acpi_processor_alloc_pdc(); - if (!obj_list) - return; - - acpi_processor_eval_pdc(handle, obj_list); - - kfree(obj_list->pointer->buffer.pointer); - kfree(obj_list->pointer); - kfree(obj_list); -} - -static acpi_status __init -early_init_pdc(acpi_handle handle, u32 lvl, void *context, void **rv) -{ - if (processor_physically_present(handle) == false) - return AE_OK; - - acpi_processor_set_pdc(handle); - return AE_OK; -} - -#if defined(CONFIG_X86) || defined(CONFIG_IA64) -static int __init set_no_mwait(const struct dmi_system_id *id) -{ - pr_notice(PREFIX "%s detected - disabling mwait for CPU C-states\n", - id->ident); - boot_option_idle_override = IDLE_NOMWAIT; - return 0; -} - -static struct dmi_system_id processor_idle_dmi_table[] __initdata = { - { - set_no_mwait, "Extensa 5220", { - DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"), - DMI_MATCH(DMI_SYS_VENDOR, "Acer"), - DMI_MATCH(DMI_PRODUCT_VERSION, "0100"), - DMI_MATCH(DMI_BOARD_NAME, "Columbia") }, NULL}, - {}, -}; - -static void __init processor_dmi_check(void) -{ - /* - * Check whether the system is DMI table. If yes, OSPM - * should not use mwait for CPU-states. - */ - dmi_check_system(processor_idle_dmi_table); -} -#else -static inline void processor_dmi_check(void) {} -#endif - -void __init acpi_early_processor_set_pdc(void) -{ - processor_dmi_check(); - - acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, - early_init_pdc, NULL, NULL, NULL); - acpi_get_devices(ACPI_PROCESSOR_DEVICE_HID, early_init_pdc, NULL, NULL); -} diff --git a/drivers/acpi/processor_pdc.c b/drivers/acpi/processor_pdc.c new file mode 100644 index 0000000..e5dd808 --- /dev/null +++ b/drivers/acpi/processor_pdc.c @@ -0,0 +1,206 @@ +/* + * Copyright (C) 2005 Intel Corporation + * Copyright (C) 2009 Hewlett-Packard Development Company, L.P. + * + * Venkatesh Pallipadi venkatesh.pallipadi@intel.com + * - Added _PDC for platforms with Intel CPUs + */ + +#define pr_fmt(fmt) "ACPI: " fmt + +#include <linux/dmi.h> +#include <linux/slab.h> +#include <linux/acpi.h> +#include <acpi/processor.h> + +#include "internal.h" + +#define _COMPONENT ACPI_PROCESSOR_COMPONENT +ACPI_MODULE_NAME("processor_pdc"); + +static bool __init processor_physically_present(acpi_handle handle) +{ + int cpuid, type; + u32 acpi_id; + acpi_status status; + acpi_object_type acpi_type; + unsigned long long tmp; + union acpi_object object = { 0 }; + struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; + + status = acpi_get_type(handle, &acpi_type); + if (ACPI_FAILURE(status)) + return false; + + switch (acpi_type) { + case ACPI_TYPE_PROCESSOR: + status = acpi_evaluate_object(handle, NULL, NULL, &buffer); + if (ACPI_FAILURE(status)) + return false; + acpi_id = object.processor.proc_id; + break; + case ACPI_TYPE_DEVICE: + status = acpi_evaluate_integer(handle, "_UID", NULL, &tmp); + if (ACPI_FAILURE(status)) + return false; + acpi_id = tmp; + break; + default: + return false; + } + + type = (acpi_type == ACPI_TYPE_DEVICE) ? 1 : 0; + cpuid = acpi_get_cpuid(handle, type, acpi_id); + + if (cpuid == -1) + return false; + + return true; +} + +static void acpi_set_pdc_bits(u32 *buf) +{ + buf[0] = ACPI_PDC_REVISION_ID; + buf[1] = 1; + + /* Enable coordination with firmware's _TSD info */ + buf[2] = ACPI_PDC_SMP_T_SWCOORD; + + /* Twiddle arch-specific bits needed for _PDC */ + arch_acpi_set_pdc_bits(buf); +} + +static struct acpi_object_list *acpi_processor_alloc_pdc(void) +{ + struct acpi_object_list *obj_list; + union acpi_object *obj; + u32 *buf; + + /* allocate and initialize pdc. It will be used later. */ + obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL); + if (!obj_list) + goto out; + + obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL); + if (!obj) { + kfree(obj_list); + goto out; + } + + buf = kmalloc(12, GFP_KERNEL); + if (!buf) { + kfree(obj); + kfree(obj_list); + goto out; + } + + acpi_set_pdc_bits(buf); + + obj->type = ACPI_TYPE_BUFFER; + obj->buffer.length = 12; + obj->buffer.pointer = (u8 *) buf; + obj_list->count = 1; + obj_list->pointer = obj; + + return obj_list; +out: + pr_err("Memory allocation error\n"); + return NULL; +} + +/* + * _PDC is required for a BIOS-OS handshake for most of the newer + * ACPI processor features. + */ +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)) + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Could not evaluate _PDC, using legacy perf. control.\n")); + + return status; +} + +void acpi_processor_set_pdc(acpi_handle handle) +{ + struct acpi_object_list *obj_list; + + if (arch_has_acpi_pdc() == false) + return; + + obj_list = acpi_processor_alloc_pdc(); + if (!obj_list) + return; + + acpi_processor_eval_pdc(handle, obj_list); + + kfree(obj_list->pointer->buffer.pointer); + kfree(obj_list->pointer); + kfree(obj_list); +} + +static acpi_status __init +early_init_pdc(acpi_handle handle, u32 lvl, void *context, void **rv) +{ + if (processor_physically_present(handle) == false) + return AE_OK; + + acpi_processor_set_pdc(handle); + return AE_OK; +} + +static int __init set_no_mwait(const struct dmi_system_id *id) +{ + pr_notice("%s detected - disabling mwait for CPU C-states\n", + id->ident); + boot_option_idle_override = IDLE_NOMWAIT; + return 0; +} + +static struct dmi_system_id processor_idle_dmi_table[] __initdata = { + { + set_no_mwait, "Extensa 5220", { + DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"), + DMI_MATCH(DMI_SYS_VENDOR, "Acer"), + DMI_MATCH(DMI_PRODUCT_VERSION, "0100"), + DMI_MATCH(DMI_BOARD_NAME, "Columbia") }, NULL}, + {}, +}; + +static void __init processor_dmi_check(void) +{ + /* + * Check whether the system is DMI table. If yes, OSPM + * should not use mwait for CPU-states. + */ + dmi_check_system(processor_idle_dmi_table); +} + +void __init acpi_early_processor_set_pdc(void) +{ + processor_dmi_check(); + + acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, + early_init_pdc, NULL, NULL, NULL); + acpi_get_devices(ACPI_PROCESSOR_DEVICE_HID, early_init_pdc, NULL, NULL); +}
From: Graeme Gregory graeme.gregory@linaro.org
ACPI core requires a cpu.h, add a dummy one here temporarily. This file will be updated in the future to add definitions for arch_(un)register_cpu which are required for ACPI based physical CPU hotplug when these standards have be ratified by the ASWG.
Reviewed-by: Grant Likely grant.likely@linaro.org Signed-off-by: Graeme Gregory graeme.gregory@linaro.org Signed-off-by: Hanjun Guo hanjun.guo@linaro.org --- arch/arm64/include/asm/cpu.h | 11 +++++++++++ 1 file changed, 11 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..cee7d3f --- /dev/null +++ b/arch/arm64/include/asm/cpu.h @@ -0,0 +1,11 @@ +/* + * Copyright (C) 2013-2014 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_CPU_H +#define __ASM_CPU_H + +#endif
From: Al Stone al.stone@linaro.org
ACPI core need lots extern variables and functions which should be provided by arch dependent code to make itself compilable. so introduce arm-core.c and its related header file here, we need: - asm/acenv.h for arch specific ACPICA environments and implementation; - asm/acpi.h for arch specific variables and functions needed by ACPI driver core; - arm-core.c for ARM64 related ACPI implementation for ACPI driver core;
acpi_boot_table_init() will be called in setup_arch() before paging_init(), so we should use eary_memremap() mechanism here to get the RSDP and all the table pointers. with this patch, we can get ACPI boot-time tables from firmware on ARM64.
Reviewed-by: Grant Likely grant.likely@linaro.org Signed-off-by: Al Stone al.stone@linaro.org Signed-off-by: Graeme Gregory graeme.gregory@linaro.org Signed-off-by: Tomasz Nowicki tomasz.nowicki@linaro.org Signed-off-by: Hanjun Guo hanjun.guo@linaro.org --- arch/arm64/include/asm/acenv.h | 18 +++++++ arch/arm64/include/asm/acpi.h | 49 ++++++++++++++++++ arch/arm64/kernel/setup.c | 4 ++ drivers/acpi/Makefile | 2 + drivers/acpi/plat/Makefile | 1 + drivers/acpi/plat/arm-core.c | 110 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 184 insertions(+) create mode 100644 arch/arm64/include/asm/acenv.h create mode 100644 arch/arm64/include/asm/acpi.h create mode 100644 drivers/acpi/plat/Makefile create mode 100644 drivers/acpi/plat/arm-core.c
diff --git a/arch/arm64/include/asm/acenv.h b/arch/arm64/include/asm/acenv.h new file mode 100644 index 0000000..3899ee6 --- /dev/null +++ b/arch/arm64/include/asm/acenv.h @@ -0,0 +1,18 @@ +/* + * ARM64 specific ACPICA environments and implementation + * + * Copyright (C) 2014, Linaro Ltd. + * Author: Hanjun Guo hanjun.guo@linaro.org + * Author: Graeme Gregory graeme.gregory@linaro.org + * + * 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_ACENV_H +#define _ASM_ACENV_H + +#define ACPI_FLUSH_CPU_CACHE() WARN_ONCE(1, "Not currently supported on ARM64") + +#endif /* _ASM_ACENV_H */ diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h new file mode 100644 index 0000000..3ea6b84 --- /dev/null +++ b/arch/arm64/include/asm/acpi.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2013-2014, Linaro Ltd. + * Author: Al Stone al.stone@linaro.org + * Author: Graeme Gregory graeme.gregory@linaro.org + * Author: Hanjun Guo hanjun.guo@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_ACPI_H +#define _ASM_ACPI_H + +/* 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; +} + +/* + * The ACPI processor driver for ACPI core code needs this macro. + * Temporarily define it to -1 so that the ACPI core can compile, + * but update it when we get the hardware ID from the MADT table. + */ +#define cpu_physical_id(cpu) -1 + +static inline bool acpi_arch_is_smp(void) +{ + return 1; +} + +#endif /* CONFIG_ACPI */ + +#endif /*_ASM_ACPI_H*/ diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index 46d1125..9dedb0b 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -43,6 +43,7 @@ #include <linux/of_fdt.h> #include <linux/of_platform.h> #include <linux/efi.h> +#include <linux/acpi.h>
#include <asm/fixmap.h> #include <asm/cputype.h> @@ -385,6 +386,9 @@ void __init setup_arch(char **cmdline_p) efi_init(); arm64_memblock_init();
+ /* Parse the ACPI tables for possible boot-time configuration */ + acpi_boot_table_init(); + paging_init(); request_standard_resources();
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index b638e95..c50ea88 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile @@ -86,3 +86,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..c6c7e03 --- /dev/null +++ b/drivers/acpi/plat/arm-core.c @@ -0,0 +1,110 @@ +/* + * ARM/ARM64 Specific Low-Level ACPI Boot Support + * + * Copyright (C) 2013-2014, Linaro Ltd. + * Author: Al Stone al.stone@linaro.org + * Author: Graeme Gregory graeme.gregory@linaro.org + * Author: Hanjun Guo hanjun.guo@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. + */ + +#include <linux/init.h> +#include <linux/acpi.h> +#include <linux/cpumask.h> +#include <linux/memblock.h> +#include <linux/module.h> +#include <linux/irq.h> +#include <linux/irqdomain.h> +#include <linux/bootmem.h> +#include <linux/smp.h> + +#include <asm/pgtable.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); + +enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_PLATFORM; + +/* + * __acpi_map_table() will be called before page_init(), so early_ioremap() + * or early_memremap() should be called here. + */ +char *__init __acpi_map_table(unsigned long phys, unsigned long size) +{ + if (!phys || !size) + return NULL; + + return early_memremap(phys, size); +} + +void __init __acpi_unmap_table(char *map, unsigned long size) +{ + if (!map || !size) + return; + + early_iounmap(map, size); +} + +int acpi_gsi_to_irq(u32 gsi, unsigned int *irq) +{ + *irq = -1; + + 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); + +/* + * acpi_boot_table_init() called from setup_arch(), always. + * 1. find RSDP and get its address, and then find XSDT + * 2. extract all tables and checksums them all + * + * We can parse ACPI boot-time tables such as FADT, MADT after + * this function is called. + */ +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; + } +}
On Fri, Jun 27, 2014 at 04:49:28AM +0100, Hanjun Guo wrote:
drivers/acpi/Makefile | 2 + drivers/acpi/plat/Makefile | 1 + drivers/acpi/plat/arm-core.c | 110 ++++++++++++++++++++++++++++++++++++++++
Do you ever plan to add ACPI support for 32-bit ARM? If not, this part could be placed under arch/arm64 (similar to x86).
On 30/06/2014 17:24, Catalin Marinas wrote:
On Fri, Jun 27, 2014 at 04:49:28AM +0100, Hanjun Guo wrote:
drivers/acpi/Makefile | 2 + drivers/acpi/plat/Makefile | 1 + drivers/acpi/plat/arm-core.c | 110 ++++++++++++++++++++++++++++++++++++++++
Do you ever plan to add ACPI support for 32-bit ARM? If not, this part could be placed under arch/arm64 (similar to x86).
Originally the plan was to support both platforms, but it seems people have stopped talking to Linaro about 32bit support now so unless anyone else has some actual info I guess it would be safe to move it into arm64.
Graeme
From: Al Stone al.stone@linaro.org
Introduce two early parameters for "acpi", one is the parameter to disable ACPI on ARM64 and another one is acpi=strict to disable out-of-spec workarounds.
Reviewed-by: Grant Likely grant.likely@linaro.org 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 --- Documentation/kernel-parameters.txt | 3 ++- drivers/acpi/plat/arm-core.c | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 8849049..b7e9fc0 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -165,7 +165,7 @@ multipliers 'Kilo', 'Mega', and 'Giga', equalling 2^10, 2^20, and 2^30 bytes respectively. Such letter suffixes can also be entirely omitted.
- acpi= [HW,ACPI,X86] + acpi= [HW,ACPI,X86,ARM] Advanced Configuration and Power Interface Format: { force | off | strict | noirq | rsdt } force -- enable ACPI if default was off @@ -175,6 +175,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted. strictly ACPI specification compliant. rsdt -- prefer RSDT over (default) XSDT copy_dsdt -- copy DSDT to memory + For ARM64, ONLY "off" and "strict" are available.
See also Documentation/power/runtime_pm.txt, pci=noacpi
diff --git a/drivers/acpi/plat/arm-core.c b/drivers/acpi/plat/arm-core.c index c6c7e03..cf46c25 100644 --- a/drivers/acpi/plat/arm-core.c +++ b/drivers/acpi/plat/arm-core.c @@ -108,3 +108,24 @@ void __init acpi_boot_table_init(void) return; } } + +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; + } else { + /* Core will printk when we return error */ + return -EINVAL; + } + + return 0; +} +early_param("acpi", parse_acpi);
On Friday 27 June 2014 11:49:29 Hanjun Guo wrote:
+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;
} else {
/* Core will printk when we return error */
return -EINVAL;
}
return 0;
+} +early_param("acpi", parse_acpi);
Can you explain in the changelog what happens for the acpi=off case? Does this mean we fall back to using data from the dtb instead, or will it just not work?
If I understand correctly, this option makes sense on PC systems that will still be able to boot using the legacy BIOS services and implicit assumptions about the hardware, but that never works on arm64.
Arnd
On Fri, Jun 27, 2014 at 11:07:48AM +0200, Arnd Bergmann wrote:
On Friday 27 June 2014 11:49:29 Hanjun Guo wrote:
+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;
} else {
/* Core will printk when we return error */
return -EINVAL;
}
return 0;
+} +early_param("acpi", parse_acpi);
Can you explain in the changelog what happens for the acpi=off case? Does this mean we fall back to using data from the dtb instead, or will it just not work?
If I understand correctly, this option makes sense on PC systems that will still be able to boot using the legacy BIOS services and implicit assumptions about the hardware, but that never works on arm64.
Yes the way ACPI has been integrated on ARM64 in these patches if you supply acpi=off it will fall back to DTB if supplied by firmware.
Graeme
From: Graeme Gregory graeme.gregory@linaro.org
acpi_wakeup_address is used on x86 as the address bios jumps into when machine wakes up from suspend. As arm64 does not have such a bios this mechanism will be provided by other means. But the define is still required inside the acpi core.
Introduce a null stub for acpi_suspend_lowlevel as this is also required by core. This will be filled in when standards are defined for arm64 ACPI global power states.
Reviewed-by: Grant Likely grant.likely@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 | 12 ++++++++++++ drivers/acpi/plat/arm-core.c | 7 +++++++ 2 files changed, 19 insertions(+)
diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h index 3ea6b84..a93e8ae 100644 --- a/arch/arm64/include/asm/acpi.h +++ b/arch/arm64/include/asm/acpi.h @@ -39,6 +39,18 @@ static inline void disable_acpi(void) */ #define cpu_physical_id(cpu) -1
+/* + * Low-level suspend routine. + * + * ACPI S-states for ARM64 have to be defined + * and approved before doing anything else, maybe + * we need update the ACPI spec, here just we + * just introduce function and macro needed by + * ACPI core, and revisit them when the spec is ready. + */ +extern int (*acpi_suspend_lowlevel)(void); +#define acpi_wakeup_address (0) + static inline bool acpi_arch_is_smp(void) { return 1; diff --git a/drivers/acpi/plat/arm-core.c b/drivers/acpi/plat/arm-core.c index cf46c25..0155a98 100644 --- a/drivers/acpi/plat/arm-core.c +++ b/drivers/acpi/plat/arm-core.c @@ -129,3 +129,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 ARM/ARM64 starts to support suspend... + */ +int (*acpi_suspend_lowlevel)(void);
On Fri, Jun 27, 2014 at 04:49:30AM +0100, Hanjun Guo wrote:
From: Graeme Gregory graeme.gregory@linaro.org
acpi_wakeup_address is used on x86 as the address bios jumps into when machine wakes up from suspend. As arm64 does not have such a bios this mechanism will be provided by other means. But the define is still required inside the acpi core.
Why not fix the place where it is used rather than defining a dummy pointer?
Introduce a null stub for acpi_suspend_lowlevel as this is also required by core. This will be filled in when standards are defined for arm64 ACPI global power states.
I assume acpi_suspend_lowlevel would be just a dummy definition but it will have some use when the standard allows.
arch_fix_phys_package_id() will be called in ACPI core to use the slot number provided by ACPI to update the physical package id, then we can get the right value in the "physical id" field of /proc/cpuinfo.
Reviewed-by: Grant Likely grant.likely@linaro.org Signed-off-by: Hanjun Guo hanjun.guo@linaro.org --- arch/arm64/include/asm/topology.h | 2 ++ arch/arm64/kernel/topology.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+)
diff --git a/arch/arm64/include/asm/topology.h b/arch/arm64/include/asm/topology.h index 7ebcd31..2b216d4 100644 --- a/arch/arm64/include/asm/topology.h +++ b/arch/arm64/include/asm/topology.h @@ -23,11 +23,13 @@ extern struct cpu_topology cpu_topology[NR_CPUS]; void init_cpu_topology(void); void store_cpu_topology(unsigned int cpuid); const struct cpumask *cpu_coregroup_mask(int cpu); +void arch_fix_phys_package_id(int num, u32 slot);
#else
static inline void init_cpu_topology(void) { } static inline void store_cpu_topology(unsigned int cpuid) { } +static inline void arch_fix_phys_package_id(int num, u32 slot) { }
#endif
diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c index 43514f9..c547885 100644 --- a/arch/arm64/kernel/topology.c +++ b/arch/arm64/kernel/topology.c @@ -281,3 +281,17 @@ void __init init_cpu_topology(void) if (parse_dt_topology()) reset_cpu_topology(); } + +/* + * Use the CPU slot number provided by ACPI to update the physical + * package id when cpuid_topo->cluster_id is not available, then we + * can get the right value in the "physical id" field of /proc/cpuinfo. + */ +void arch_fix_phys_package_id(int num, u32 slot) +{ + struct cpu_topology *cpuid_topo = &cpu_topology[num]; + + if (cpuid_topo->cluster_id == -1) + cpuid_topo->cluster_id = slot; +} +EXPORT_SYMBOL_GPL(arch_fix_phys_package_id);
CONFIG_ACPI depends CONFIG_PCI now, and ACPI provides ACPI based PCI hotplug and PCI host bridge hotplug, introduce some PCI functions to make ACPI core can be compiled, some of the functions should be revisited when implemented on ARM64.
Reviewed-by: Grant Likely grant.likely@linaro.org Originally-by: Graeme Gregory graeme.gregory@linaro.org Signed-off-by: Hanjun Guo hanjun.guo@linaro.org --- arch/arm64/include/asm/pci.h | 6 ++++++ arch/arm64/kernel/pci.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+)
diff --git a/arch/arm64/include/asm/pci.h b/arch/arm64/include/asm/pci.h index d93576f..46501d4 100644 --- a/arch/arm64/include/asm/pci.h +++ b/arch/arm64/include/asm/pci.h @@ -21,6 +21,12 @@ struct pci_host_bridge *find_pci_host_bridge(struct pci_bus *bus); #define pcibios_assign_all_busses() \ (pci_has_flag(PCI_REASSIGN_ALL_BUS))
+static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) +{ + /* no legacy IRQ on arm64 */ + return -ENODEV; +} + /* * PCI address space differs from physical memory address space */ diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c index 9f29c9a..1f7aedd 100644 --- a/arch/arm64/kernel/pci.c +++ b/arch/arm64/kernel/pci.c @@ -17,6 +17,7 @@ #include <linux/of_pci.h> #include <linux/of_platform.h> #include <linux/slab.h> +#include <linux/acpi.h>
#include <asm/pci-bridge.h>
@@ -171,3 +172,30 @@ unsigned long pci_ioremap_io(const struct resource *res, phys_addr_t phys_addr) /* return io_offset */ return start * PAGE_SIZE - res->start; } + +/* + * raw_pci_read - Platform-specific PCI config space access. + * + * Default empty implementation. Replace with an architecture-specific setup + * routine, if necessary. + */ +int raw_pci_read(unsigned int domain, unsigned int bus, + unsigned int devfn, int reg, int len, u32 *val) +{ + return -EINVAL; +} + +int raw_pci_write(unsigned int domain, unsigned int bus, + unsigned int devfn, int reg, int len, u32 val) +{ + return -EINVAL; +} + +#ifdef CONFIG_ACPI +/* Root bridge scanning */ +struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) +{ + /* TODO: Should be revisited when implementing PCI on ACPI */ + return NULL; +} +#endif
Since EC (Embedded controller) needs SCI for the interupt which is not available on ARM64, make the EC debugfs depend on X86 || IA64 only in the Kconfig file.
Reviewed-by: Grant Likely grant.likely@linaro.org Signed-off-by: Hanjun Guo hanjun.guo@linaro.org --- drivers/acpi/Kconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 0e6f72d..7de5e3f 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -69,6 +69,7 @@ config ACPI_PROCFS_POWER
config ACPI_EC_DEBUGFS tristate "EC read/write access through /sys/kernel/debug/ec" + depends on X86 || IA64 default n help Say N to disable Embedded Controller /sys/kernel/debug interface
From: Al Stone al.stone@linaro.org
ACPI reduced hardware mode is disabled by default, but ARM64 can only run properly in ACPI hardware reduced mode, so select ACPI_REDUCED_HARDWARE_ONLY if ACPI is enabled on ARM64.
Reviewed-by: Grant Likely grant.likely@linaro.org Signed-off-by: Al Stone al.stone@linaro.org Signed-off-by: Hanjun Guo hanjun.guo@linaro.org --- arch/arm64/Kconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index db5190a..102384e 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -1,5 +1,6 @@ config ARM64 def_bool y + select ACPI_REDUCED_HARDWARE_ONLY if ACPI select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE select ARCH_USE_CMPXCHG_LOCKREF select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
From: Graeme Gregory graeme.gregory@linaro.org
If the early boot methods of acpi are happy that we have valid ACPI tables and acpi=off has not been passed. Then do not unflat devicetree effectively disabling further hardware probing from DT.
Signed-off-by: Graeme Gregory graeme.gregory@linaro.org --- arch/arm64/kernel/setup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index 9dedb0b..487fd1f 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -394,7 +394,8 @@ void __init setup_arch(char **cmdline_p)
efi_idmap_init();
- unflatten_device_tree(); + if (acpi_disabled) + unflatten_device_tree();
psci_init();
On Friday 27 June 2014 11:49:35 Hanjun Guo wrote:
From: Graeme Gregory graeme.gregory@linaro.org
If the early boot methods of acpi are happy that we have valid ACPI tables and acpi=off has not been passed. Then do not unflat devicetree effectively disabling further hardware probing from DT.
I guess this answers the question I had on patch 4 ;-)
Arnd
From: Graeme Gregory graeme.gregory@linaro.org
Add Kconfigs to build ACPI on ARM64, and make ACPI available on ARM64.
acpi_idle driver is x86/IA64 dependent now, so make CONFIG_ACPI_PROCESSOR depend on X86 || IA64, and implement it on ARM64 in the future.
Reviewed-by: Grant Likely grant.likely@linaro.org 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 | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 102384e..314634f 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -377,6 +377,8 @@ source "drivers/Kconfig"
source "drivers/firmware/Kconfig"
+source "drivers/acpi/Kconfig" + source "fs/Kconfig"
source "arch/arm64/kvm/Kconfig" diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 7de5e3f..33d6dbb 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -8,10 +8,10 @@ config ACPI_SCAN_BIOS_NOT_EFI menuconfig ACPI bool "ACPI (Advanced Configuration and Power Interface) Support" depends on !IA64_HP_SIM - depends on IA64 || X86 + depends on IA64 || X86 || ARM64 depends on PCI select PNP - default y + default y if !ARM64 help Advanced Configuration and Power Interface (ACPI) support for Linux requires an ACPI-compliant platform (hardware/firmware), @@ -161,6 +161,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
On Fri, Jun 27, 2014 at 04:49:36AM +0100, Hanjun Guo wrote:
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 7de5e3f..33d6dbb 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -8,10 +8,10 @@ config ACPI_SCAN_BIOS_NOT_EFI menuconfig ACPI bool "ACPI (Advanced Configuration and Power Interface) Support" depends on !IA64_HP_SIM
- depends on IA64 || X86
- depends on IA64 || X86 || ARM64
I still don't understand what the point of enabling ACPI for arm64 during this series is. Do you get any working arm64 functionality (on hardware or model) without subsequent patches? If it's just for compilation reasons, the best we could do is depending on (ARM64 && COMPILE_TEST) but even though I would not merge this patch until we have most of the arm64 required features in place (some of which are introduced by the upcoming ACPI version).
depends on PCI select PNP
- default y
- default y if !ARM64
For the benefit of single Image, I think you can default to y here.
On 2014-6-30 18:46, Catalin Marinas wrote:
On Fri, Jun 27, 2014 at 04:49:36AM +0100, Hanjun Guo wrote:
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 7de5e3f..33d6dbb 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -8,10 +8,10 @@ config ACPI_SCAN_BIOS_NOT_EFI menuconfig ACPI bool "ACPI (Advanced Configuration and Power Interface) Support" depends on !IA64_HP_SIM
- depends on IA64 || X86
- depends on IA64 || X86 || ARM64
I still don't understand what the point of enabling ACPI for arm64 during this series is. Do you get any working arm64 functionality (on hardware or model) without subsequent patches? If it's just for compilation reasons, the best we could do is depending on (ARM64 && COMPILE_TEST) but even though I would not merge this patch until we have most of the arm64 required features in place (some of which are introduced by the upcoming ACPI version).
it is ok to me to merge all the patches together, but if Rafael is happy with the clean up patches (patch 1~3) for ACPI core, they can be merged first.
depends on PCI select PNP
- default y
- default y if !ARM64
For the benefit of single Image, I think you can default to y here.
It ok to me. if we default to y here, devicetree will not be unflattened in default, is it ok to you? you can refer to "[PATCH 12/13] ARM64 / ACPI: if we chose to boot from acpi then disable FDT".
Thanks Hanjun
depends on PCI select PNP
- default y
- default y if !ARM64
For the benefit of single Image, I think you can default to y here.
It ok to me. if we default to y here, devicetree will not be unflattened in default, is it ok to you? you can refer to "[PATCH 12/13] ARM64 / ACPI: if we chose to boot from acpi then disable FDT".
Ah, sorry I didn't describe it clearly. since there is no shipping board with ACPI tables, so ACPI will disabled in the very early stage and FDT still have chance to be unflattened, so will not break DT booting in this patchset.
Thanks Hanjun
On Tue, Jul 01, 2014 at 09:20:20AM +0100, Hanjun Guo wrote:
depends on PCI select PNP
- default y
- default y if !ARM64
For the benefit of single Image, I think you can default to y here.
It ok to me. if we default to y here, devicetree will not be unflattened in default, is it ok to you? you can refer to "[PATCH 12/13] ARM64 / ACPI: if we chose to boot from acpi then disable FDT".
Ah, sorry I didn't describe it clearly. since there is no shipping board with ACPI tables, so ACPI will disabled in the very early stage and FDT still have chance to be unflattened, so will not break DT booting in this patchset.
That's what I thought. So leaving it as a default y is fine by me. But I would not merge this patch now until we get some useful functionality for arm64.
The x86-related cleanup patches can be merged separately via the corresponding trees (it's up to the ACPI and x86 maintainers).