Merge remote-tracking branch 'ftrace/for-next'
[deliverable/linux.git] / arch / arm64 / include / asm / acpi.h
CommitLineData
37655163
AS
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
e7cd1903 15#include <linux/memblock.h>
bff60792 16#include <linux/psci.h>
d60fc389 17
020295b4
HG
18#include <asm/cputype.h>
19#include <asm/smp_plat.h>
652261a7 20
b6cfb277
AS
21/* Macros for consistency checks of the GICC subtable of MADT */
22#define ACPI_MADT_GICC_LENGTH \
23 (acpi_gbl_FADT.header.revision < 6 ? 76 : 80)
24
25#define BAD_MADT_GICC_ENTRY(entry, end) \
26 (!(entry) || (unsigned long)(entry) + sizeof(*(entry)) > (end) || \
27 (entry)->header.length != ACPI_MADT_GICC_LENGTH)
28
37655163
AS
29/* Basic configuration for ACPI */
30#ifdef CONFIG_ACPI
652261a7
MS
31/* ACPI table mapping after acpi_gbl_permanent_mmap is set */
32static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
33 acpi_size size)
34{
e7cd1903
AT
35 /*
36 * EFI's reserve_regions() call adds memory with the WB attribute
37 * to memblock via early_init_dt_add_memory_arch().
38 */
39 if (!memblock_is_memory(phys))
652261a7
MS
40 return ioremap(phys, size);
41
42 return ioremap_cache(phys, size);
43}
44#define acpi_os_ioremap acpi_os_ioremap
45
020295b4
HG
46typedef u64 phys_cpuid_t;
47#define PHYS_CPUID_INVALID INVALID_HWID
48
37655163
AS
49#define acpi_strict 1 /* No out-of-spec workarounds on ARM64 */
50extern int acpi_disabled;
51extern int acpi_noirq;
52extern int acpi_pci_disabled;
53
54static inline void disable_acpi(void)
55{
56 acpi_disabled = 1;
57 acpi_pci_disabled = 1;
58 acpi_noirq = 1;
59}
60
b10d79f7
AS
61static inline void enable_acpi(void)
62{
63 acpi_disabled = 0;
64 acpi_pci_disabled = 0;
65 acpi_noirq = 0;
66}
67
020295b4
HG
68/*
69 * The ACPI processor driver for ACPI core code needs this macro
70 * to find out this cpu was already mapped (mapping from CPU hardware
71 * ID to CPU logical ID) or not.
72 */
73#define cpu_physical_id(cpu) cpu_logical_map(cpu)
74
37655163
AS
75/*
76 * It's used from ACPI core in kdump to boot UP system with SMP kernel,
77 * with this check the ACPI core will not override the CPU index
78 * obtained from GICC with 0 and not print some error message as well.
79 * Since MADT must provide at least one GICC structure for GIC
80 * initialization, CPU will be always available in MADT on ARM64.
81 */
82static inline bool acpi_has_cpu_in_madt(void)
83{
84 return true;
85}
86
87static inline void arch_fix_phys_package_id(int num, u32 slot) { }
fccb9a81 88void __init acpi_init_cpus(void);
37655163 89
7c59a3df 90#else
fccb9a81 91static inline void acpi_init_cpus(void) { }
37655163
AS
92#endif /* CONFIG_ACPI */
93
5e89c55e
LP
94#ifdef CONFIG_ARM64_ACPI_PARKING_PROTOCOL
95bool acpi_parking_protocol_valid(int cpu);
96void __init
97acpi_set_mailbox_entry(int cpu, struct acpi_madt_generic_interrupt *processor);
98#else
99static inline bool acpi_parking_protocol_valid(int cpu) { return false; }
100static inline void
101acpi_set_mailbox_entry(int cpu, struct acpi_madt_generic_interrupt *processor)
102{}
103#endif
104
0f078336
LP
105static inline const char *acpi_get_enable_method(int cpu)
106{
5e89c55e
LP
107 if (acpi_psci_present())
108 return "psci";
109
110 if (acpi_parking_protocol_valid(cpu))
111 return "parking-protocol";
112
113 return NULL;
0f078336 114}
89e44b51
JZZ
115
116#ifdef CONFIG_ACPI_APEI
117pgprot_t arch_apei_get_mem_attribute(phys_addr_t addr);
118#endif
119
d8b47fca
HG
120#ifdef CONFIG_ACPI_NUMA
121int arm64_acpi_numa_init(void);
122int acpi_numa_get_nid(unsigned int cpu, u64 hwid);
123#else
124static inline int arm64_acpi_numa_init(void) { return -ENOSYS; }
125static inline int acpi_numa_get_nid(unsigned int cpu, u64 hwid) { return NUMA_NO_NODE; }
126#endif /* CONFIG_ACPI_NUMA */
127
38b04a74
JM
128#define ACPI_TABLE_UPGRADE_MAX_PHYS MEMBLOCK_ALLOC_ACCESSIBLE
129
37655163 130#endif /*_ASM_ACPI_H*/
This page took 0.078804 seconds and 5 git commands to generate.