1 /*
2 * Copyright (C) 2015, Shannon Zhao <shannon.zhao@linaro.org>
3 *
4 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; If not, see <http://www.gnu.org/licenses/>.
18 *
19 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 */
21
22 #ifndef _ASM_ARM_ACPI_H
23 #define _ASM_ARM_ACPI_H
24
25 #include <asm/setup.h>
26
27 #define COMPILER_DEPENDENT_INT64 long long
28 #define COMPILER_DEPENDENT_UINT64 unsigned long long
29 #define ACPI_MAP_MEM_ATTR PAGE_HYPERVISOR
30
31 /* Tables marked as reserved in efi table */
32 typedef enum {
33 TBL_FADT,
34 TBL_MADT,
35 TBL_STAO,
36 TBL_XSDT,
37 TBL_RSDP,
38 TBL_EFIT,
39 TBL_MMAP,
40 TBL_MMAX,
41 } EFI_MEM_RES;
42
43 bool acpi_psci_present(void);
44 bool acpi_psci_hvc_present(void);
45 void acpi_smp_init_cpus(void);
46
47 /*
48 * This function returns the offset of a given ACPI/EFI table in the allocated
49 * memory region. Currently, the tables should be created in the same order as
50 * their associated 'index' in the enum EFI_MEM_RES. This means the function
51 * won't return the correct offset until all the tables before a given 'index'
52 * are created.
53 */
54 paddr_t acpi_get_table_offset(struct membank tbl_add[], EFI_MEM_RES index);
55
56 /* Macros for consistency checks of the GICC subtable of MADT */
57 #define ACPI_MADT_GICC_LENGTH \
58 (acpi_gbl_FADT.header.revision < 6 ? 76 : 80)
59
60 #define BAD_MADT_GICC_ENTRY(entry, end) \
61 (!(entry) || (unsigned long)(entry) + sizeof(*(entry)) > (end) || \
62 (entry)->header.length != ACPI_MADT_GICC_LENGTH)
63
64 #ifdef CONFIG_ACPI
65 extern bool acpi_disabled;
66 /* Basic configuration for ACPI */
disable_acpi(void)67 static inline void disable_acpi(void)
68 {
69 acpi_disabled = true;
70 }
71
enable_acpi(void)72 static inline void enable_acpi(void)
73 {
74 acpi_disabled = false;
75 }
76 #else
77 #define disable_acpi()
78 #define enable_acpi()
79 #endif
80
81 #endif /*_ASM_ARM_ACPI_H*/
82