Al Stone | 3765516 | 2015-03-24 14:02:37 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013-2014, Linaro Ltd. |
| 3 | * Author: Al Stone <al.stone@linaro.org> |
| 4 | * Author: Graeme Gregory <graeme.gregory@linaro.org> |
| 5 | * Author: Hanjun Guo <hanjun.guo@linaro.org> |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License version 2 as |
| 9 | * published by the Free Software Foundation; |
| 10 | */ |
| 11 | |
| 12 | #ifndef _ASM_ACPI_H |
| 13 | #define _ASM_ACPI_H |
| 14 | |
Mark Salter | 652261a | 2015-03-24 14:02:38 +0000 | [diff] [blame] | 15 | #include <linux/mm.h> |
Tomasz Nowicki | d60fc38 | 2015-03-24 14:02:49 +0000 | [diff] [blame] | 16 | #include <linux/irqchip/arm-gic-acpi.h> |
| 17 | |
Hanjun Guo | 020295b | 2015-03-24 14:02:47 +0000 | [diff] [blame] | 18 | #include <asm/cputype.h> |
Mark Rutland | c5a1330 | 2015-04-30 14:22:04 +0100 | [diff] [blame^] | 19 | #include <asm/psci.h> |
Hanjun Guo | 020295b | 2015-03-24 14:02:47 +0000 | [diff] [blame] | 20 | #include <asm/smp_plat.h> |
Mark Salter | 652261a | 2015-03-24 14:02:38 +0000 | [diff] [blame] | 21 | |
Al Stone | 3765516 | 2015-03-24 14:02:37 +0000 | [diff] [blame] | 22 | /* Basic configuration for ACPI */ |
| 23 | #ifdef CONFIG_ACPI |
Mark Salter | 652261a | 2015-03-24 14:02:38 +0000 | [diff] [blame] | 24 | /* ACPI table mapping after acpi_gbl_permanent_mmap is set */ |
| 25 | static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys, |
| 26 | acpi_size size) |
| 27 | { |
| 28 | if (!page_is_ram(phys >> PAGE_SHIFT)) |
| 29 | return ioremap(phys, size); |
| 30 | |
| 31 | return ioremap_cache(phys, size); |
| 32 | } |
| 33 | #define acpi_os_ioremap acpi_os_ioremap |
| 34 | |
Hanjun Guo | 020295b | 2015-03-24 14:02:47 +0000 | [diff] [blame] | 35 | typedef u64 phys_cpuid_t; |
| 36 | #define PHYS_CPUID_INVALID INVALID_HWID |
| 37 | |
Al Stone | 3765516 | 2015-03-24 14:02:37 +0000 | [diff] [blame] | 38 | #define acpi_strict 1 /* No out-of-spec workarounds on ARM64 */ |
| 39 | extern int acpi_disabled; |
| 40 | extern int acpi_noirq; |
| 41 | extern int acpi_pci_disabled; |
| 42 | |
| 43 | static inline void disable_acpi(void) |
| 44 | { |
| 45 | acpi_disabled = 1; |
| 46 | acpi_pci_disabled = 1; |
| 47 | acpi_noirq = 1; |
| 48 | } |
| 49 | |
Al Stone | b10d79f | 2015-03-24 14:02:41 +0000 | [diff] [blame] | 50 | static inline void enable_acpi(void) |
| 51 | { |
| 52 | acpi_disabled = 0; |
| 53 | acpi_pci_disabled = 0; |
| 54 | acpi_noirq = 0; |
| 55 | } |
| 56 | |
Al Stone | 3765516 | 2015-03-24 14:02:37 +0000 | [diff] [blame] | 57 | /* |
Hanjun Guo | 020295b | 2015-03-24 14:02:47 +0000 | [diff] [blame] | 58 | * The ACPI processor driver for ACPI core code needs this macro |
| 59 | * to find out this cpu was already mapped (mapping from CPU hardware |
| 60 | * ID to CPU logical ID) or not. |
| 61 | */ |
| 62 | #define cpu_physical_id(cpu) cpu_logical_map(cpu) |
| 63 | |
| 64 | /* |
Al Stone | 3765516 | 2015-03-24 14:02:37 +0000 | [diff] [blame] | 65 | * It's used from ACPI core in kdump to boot UP system with SMP kernel, |
| 66 | * with this check the ACPI core will not override the CPU index |
| 67 | * obtained from GICC with 0 and not print some error message as well. |
| 68 | * Since MADT must provide at least one GICC structure for GIC |
| 69 | * initialization, CPU will be always available in MADT on ARM64. |
| 70 | */ |
| 71 | static inline bool acpi_has_cpu_in_madt(void) |
| 72 | { |
| 73 | return true; |
| 74 | } |
| 75 | |
| 76 | static inline void arch_fix_phys_package_id(int num, u32 slot) { } |
Hanjun Guo | fccb9a8 | 2015-03-24 22:02:45 +0800 | [diff] [blame] | 77 | void __init acpi_init_cpus(void); |
Al Stone | 3765516 | 2015-03-24 14:02:37 +0000 | [diff] [blame] | 78 | |
Graeme Gregory | 7c59a3d | 2015-03-24 14:02:43 +0000 | [diff] [blame] | 79 | #else |
Hanjun Guo | fccb9a8 | 2015-03-24 22:02:45 +0800 | [diff] [blame] | 80 | static inline void acpi_init_cpus(void) { } |
Al Stone | 3765516 | 2015-03-24 14:02:37 +0000 | [diff] [blame] | 81 | #endif /* CONFIG_ACPI */ |
| 82 | |
Lorenzo Pieralisi | 0f07833 | 2015-05-13 14:12:47 +0100 | [diff] [blame] | 83 | static inline const char *acpi_get_enable_method(int cpu) |
| 84 | { |
| 85 | return acpi_psci_present() ? "psci" : NULL; |
| 86 | } |
Al Stone | 3765516 | 2015-03-24 14:02:37 +0000 | [diff] [blame] | 87 | #endif /*_ASM_ACPI_H*/ |