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> |
Hanjun Guo | 020295b | 2015-03-24 14:02:47 +0000 | [diff] [blame^] | 16 | #include <asm/cputype.h> |
| 17 | #include <asm/smp_plat.h> |
Mark Salter | 652261a | 2015-03-24 14:02:38 +0000 | [diff] [blame] | 18 | |
Al Stone | 3765516 | 2015-03-24 14:02:37 +0000 | [diff] [blame] | 19 | /* Basic configuration for ACPI */ |
| 20 | #ifdef CONFIG_ACPI |
Mark Salter | 652261a | 2015-03-24 14:02:38 +0000 | [diff] [blame] | 21 | /* ACPI table mapping after acpi_gbl_permanent_mmap is set */ |
| 22 | static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys, |
| 23 | acpi_size size) |
| 24 | { |
| 25 | if (!page_is_ram(phys >> PAGE_SHIFT)) |
| 26 | return ioremap(phys, size); |
| 27 | |
| 28 | return ioremap_cache(phys, size); |
| 29 | } |
| 30 | #define acpi_os_ioremap acpi_os_ioremap |
| 31 | |
Hanjun Guo | 020295b | 2015-03-24 14:02:47 +0000 | [diff] [blame^] | 32 | typedef u64 phys_cpuid_t; |
| 33 | #define PHYS_CPUID_INVALID INVALID_HWID |
| 34 | |
Al Stone | 3765516 | 2015-03-24 14:02:37 +0000 | [diff] [blame] | 35 | #define acpi_strict 1 /* No out-of-spec workarounds on ARM64 */ |
| 36 | extern int acpi_disabled; |
| 37 | extern int acpi_noirq; |
| 38 | extern int acpi_pci_disabled; |
| 39 | |
Graeme Gregory | 7c59a3d | 2015-03-24 14:02:43 +0000 | [diff] [blame] | 40 | /* 1 to indicate PSCI 0.2+ is implemented */ |
| 41 | static inline bool acpi_psci_present(void) |
| 42 | { |
| 43 | return acpi_gbl_FADT.arm_boot_flags & ACPI_FADT_PSCI_COMPLIANT; |
| 44 | } |
| 45 | |
| 46 | /* 1 to indicate HVC must be used instead of SMC as the PSCI conduit */ |
| 47 | static inline bool acpi_psci_use_hvc(void) |
| 48 | { |
| 49 | return acpi_gbl_FADT.arm_boot_flags & ACPI_FADT_PSCI_USE_HVC; |
| 50 | } |
| 51 | |
Al Stone | 3765516 | 2015-03-24 14:02:37 +0000 | [diff] [blame] | 52 | static inline void disable_acpi(void) |
| 53 | { |
| 54 | acpi_disabled = 1; |
| 55 | acpi_pci_disabled = 1; |
| 56 | acpi_noirq = 1; |
| 57 | } |
| 58 | |
Al Stone | b10d79f | 2015-03-24 14:02:41 +0000 | [diff] [blame] | 59 | static inline void enable_acpi(void) |
| 60 | { |
| 61 | acpi_disabled = 0; |
| 62 | acpi_pci_disabled = 0; |
| 63 | acpi_noirq = 0; |
| 64 | } |
| 65 | |
Al Stone | 3765516 | 2015-03-24 14:02:37 +0000 | [diff] [blame] | 66 | /* |
Hanjun Guo | 020295b | 2015-03-24 14:02:47 +0000 | [diff] [blame^] | 67 | * The ACPI processor driver for ACPI core code needs this macro |
| 68 | * to find out this cpu was already mapped (mapping from CPU hardware |
| 69 | * ID to CPU logical ID) or not. |
| 70 | */ |
| 71 | #define cpu_physical_id(cpu) cpu_logical_map(cpu) |
| 72 | |
| 73 | /* |
Al Stone | 3765516 | 2015-03-24 14:02:37 +0000 | [diff] [blame] | 74 | * It's used from ACPI core in kdump to boot UP system with SMP kernel, |
| 75 | * with this check the ACPI core will not override the CPU index |
| 76 | * obtained from GICC with 0 and not print some error message as well. |
| 77 | * Since MADT must provide at least one GICC structure for GIC |
| 78 | * initialization, CPU will be always available in MADT on ARM64. |
| 79 | */ |
| 80 | static inline bool acpi_has_cpu_in_madt(void) |
| 81 | { |
| 82 | return true; |
| 83 | } |
| 84 | |
| 85 | static inline void arch_fix_phys_package_id(int num, u32 slot) { } |
Hanjun Guo | fccb9a8 | 2015-03-24 22:02:45 +0800 | [diff] [blame] | 86 | void __init acpi_init_cpus(void); |
Al Stone | 3765516 | 2015-03-24 14:02:37 +0000 | [diff] [blame] | 87 | |
Graeme Gregory | 7c59a3d | 2015-03-24 14:02:43 +0000 | [diff] [blame] | 88 | #else |
| 89 | static inline bool acpi_psci_present(void) { return false; } |
| 90 | static inline bool acpi_psci_use_hvc(void) { return false; } |
Hanjun Guo | fccb9a8 | 2015-03-24 22:02:45 +0800 | [diff] [blame] | 91 | static inline void acpi_init_cpus(void) { } |
Al Stone | 3765516 | 2015-03-24 14:02:37 +0000 | [diff] [blame] | 92 | #endif /* CONFIG_ACPI */ |
| 93 | |
| 94 | #endif /*_ASM_ACPI_H*/ |