ACPI / ARM64: add BAD_MADT_GICC_ENTRY() macro
[linux-2.6-block.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
652261a7 15#include <linux/mm.h>
d60fc389
TN
16#include <linux/irqchip/arm-gic-acpi.h>
17
020295b4 18#include <asm/cputype.h>
c5a13305 19#include <asm/psci.h>
020295b4 20#include <asm/smp_plat.h>
652261a7 21
b6cfb277
AS
22/* Macros for consistency checks of the GICC subtable of MADT */
23#define ACPI_MADT_GICC_LENGTH \
24 (acpi_gbl_FADT.header.revision < 6 ? 76 : 80)
25
26#define BAD_MADT_GICC_ENTRY(entry, end) \
27 (!(entry) || (unsigned long)(entry) + sizeof(*(entry)) > (end) || \
28 (entry)->header.length != ACPI_MADT_GICC_LENGTH)
29
37655163
AS
30/* Basic configuration for ACPI */
31#ifdef CONFIG_ACPI
652261a7
MS
32/* ACPI table mapping after acpi_gbl_permanent_mmap is set */
33static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
34 acpi_size size)
35{
36 if (!page_is_ram(phys >> PAGE_SHIFT))
37 return ioremap(phys, size);
38
39 return ioremap_cache(phys, size);
40}
41#define acpi_os_ioremap acpi_os_ioremap
42
020295b4
HG
43typedef u64 phys_cpuid_t;
44#define PHYS_CPUID_INVALID INVALID_HWID
45
37655163
AS
46#define acpi_strict 1 /* No out-of-spec workarounds on ARM64 */
47extern int acpi_disabled;
48extern int acpi_noirq;
49extern int acpi_pci_disabled;
50
51static inline void disable_acpi(void)
52{
53 acpi_disabled = 1;
54 acpi_pci_disabled = 1;
55 acpi_noirq = 1;
56}
57
b10d79f7
AS
58static inline void enable_acpi(void)
59{
60 acpi_disabled = 0;
61 acpi_pci_disabled = 0;
62 acpi_noirq = 0;
63}
64
020295b4
HG
65/*
66 * The ACPI processor driver for ACPI core code needs this macro
67 * to find out this cpu was already mapped (mapping from CPU hardware
68 * ID to CPU logical ID) or not.
69 */
70#define cpu_physical_id(cpu) cpu_logical_map(cpu)
71
37655163
AS
72/*
73 * It's used from ACPI core in kdump to boot UP system with SMP kernel,
74 * with this check the ACPI core will not override the CPU index
75 * obtained from GICC with 0 and not print some error message as well.
76 * Since MADT must provide at least one GICC structure for GIC
77 * initialization, CPU will be always available in MADT on ARM64.
78 */
79static inline bool acpi_has_cpu_in_madt(void)
80{
81 return true;
82}
83
84static inline void arch_fix_phys_package_id(int num, u32 slot) { }
fccb9a81 85void __init acpi_init_cpus(void);
37655163 86
7c59a3df 87#else
fccb9a81 88static inline void acpi_init_cpus(void) { }
37655163
AS
89#endif /* CONFIG_ACPI */
90
0f078336
LP
91static inline const char *acpi_get_enable_method(int cpu)
92{
93 return acpi_psci_present() ? "psci" : NULL;
94}
37655163 95#endif /*_ASM_ACPI_H*/