aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm64/include/asm/acenv.h18
-rw-r--r--arch/arm64/include/asm/acpi.h45
-rw-r--r--arch/arm64/kernel/Makefile1
-rw-r--r--arch/arm64/kernel/acpi.c101
-rw-r--r--arch/arm64/kernel/setup.c5
5 files changed, 170 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/acenv.h b/arch/arm64/include/asm/acenv.h
new file mode 100644
index 000000000000..b49166fde7ea
--- /dev/null
+++ b/arch/arm64/include/asm/acenv.h
@@ -0,0 +1,18 @@
1/*
2 * ARM64 specific ACPICA environments and implementation
3 *
4 * Copyright (C) 2014, Linaro Ltd.
5 * Author: Hanjun Guo <hanjun.guo@linaro.org>
6 * Author: Graeme Gregory <graeme.gregory@linaro.org>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef _ASM_ACENV_H
14#define _ASM_ACENV_H
15
16/* It is required unconditionally by ACPI core, update it when needed. */
17
18#endif /* _ASM_ACENV_H */
diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
new file mode 100644
index 000000000000..8b837ab59988
--- /dev/null
+++ b/arch/arm64/include/asm/acpi.h
@@ -0,0 +1,45 @@
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
15/* Basic configuration for ACPI */
16#ifdef CONFIG_ACPI
17#define acpi_strict 1 /* No out-of-spec workarounds on ARM64 */
18extern int acpi_disabled;
19extern int acpi_noirq;
20extern int acpi_pci_disabled;
21
22static inline void disable_acpi(void)
23{
24 acpi_disabled = 1;
25 acpi_pci_disabled = 1;
26 acpi_noirq = 1;
27}
28
29/*
30 * It's used from ACPI core in kdump to boot UP system with SMP kernel,
31 * with this check the ACPI core will not override the CPU index
32 * obtained from GICC with 0 and not print some error message as well.
33 * Since MADT must provide at least one GICC structure for GIC
34 * initialization, CPU will be always available in MADT on ARM64.
35 */
36static inline bool acpi_has_cpu_in_madt(void)
37{
38 return true;
39}
40
41static inline void arch_fix_phys_package_id(int num, u32 slot) { }
42
43#endif /* CONFIG_ACPI */
44
45#endif /*_ASM_ACPI_H*/
diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile
index 5ee07eee80c2..fdc7877f2a3c 100644
--- a/arch/arm64/kernel/Makefile
+++ b/arch/arm64/kernel/Makefile
@@ -35,6 +35,7 @@ arm64-obj-$(CONFIG_KGDB) += kgdb.o
35arm64-obj-$(CONFIG_EFI) += efi.o efi-stub.o efi-entry.o 35arm64-obj-$(CONFIG_EFI) += efi.o efi-stub.o efi-entry.o
36arm64-obj-$(CONFIG_PCI) += pci.o 36arm64-obj-$(CONFIG_PCI) += pci.o
37arm64-obj-$(CONFIG_ARMV8_DEPRECATED) += armv8_deprecated.o 37arm64-obj-$(CONFIG_ARMV8_DEPRECATED) += armv8_deprecated.o
38arm64-obj-$(CONFIG_ACPI) += acpi.o
38 39
39obj-y += $(arm64-obj-y) vdso/ 40obj-y += $(arm64-obj-y) vdso/
40obj-m += $(arm64-obj-m) 41obj-m += $(arm64-obj-m)
diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
new file mode 100644
index 000000000000..7abac24d5584
--- /dev/null
+++ b/arch/arm64/kernel/acpi.c
@@ -0,0 +1,101 @@
1/*
2 * ARM64 Specific Low-Level ACPI Boot Support
3 *
4 * Copyright (C) 2013-2014, Linaro Ltd.
5 * Author: Al Stone <al.stone@linaro.org>
6 * Author: Graeme Gregory <graeme.gregory@linaro.org>
7 * Author: Hanjun Guo <hanjun.guo@linaro.org>
8 * Author: Tomasz Nowicki <tomasz.nowicki@linaro.org>
9 * Author: Naresh Bhat <naresh.bhat@linaro.org>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#define pr_fmt(fmt) "ACPI: " fmt
17
18#include <linux/acpi.h>
19#include <linux/bootmem.h>
20#include <linux/cpumask.h>
21#include <linux/init.h>
22#include <linux/irq.h>
23#include <linux/irqdomain.h>
24#include <linux/memblock.h>
25#include <linux/smp.h>
26
27int acpi_noirq; /* skip ACPI IRQ initialization */
28int acpi_disabled;
29EXPORT_SYMBOL(acpi_disabled);
30
31int acpi_pci_disabled; /* skip ACPI PCI scan and IRQ initialization */
32EXPORT_SYMBOL(acpi_pci_disabled);
33
34/*
35 * __acpi_map_table() will be called before page_init(), so early_ioremap()
36 * or early_memremap() should be called here to for ACPI table mapping.
37 */
38char *__init __acpi_map_table(unsigned long phys, unsigned long size)
39{
40 if (!size)
41 return NULL;
42
43 return early_memremap(phys, size);
44}
45
46void __init __acpi_unmap_table(char *map, unsigned long size)
47{
48 if (!map || !size)
49 return;
50
51 early_memunmap(map, size);
52}
53
54static int __init acpi_parse_fadt(struct acpi_table_header *table)
55{
56 struct acpi_table_fadt *fadt = (struct acpi_table_fadt *)table;
57
58 /*
59 * Revision in table header is the FADT Major revision, and there
60 * is a minor revision of FADT which was introduced by ACPI 5.1,
61 * we only deal with ACPI 5.1 or newer revision to get GIC and SMP
62 * boot protocol configuration data, or we will disable ACPI.
63 */
64 if (table->revision > 5 ||
65 (table->revision == 5 && fadt->minor_revision >= 1))
66 return 0;
67
68 pr_warn("Unsupported FADT revision %d.%d, should be 5.1+, will disable ACPI\n",
69 table->revision, fadt->minor_revision);
70 disable_acpi();
71
72 return -EINVAL;
73}
74
75/*
76 * acpi_boot_table_init() called from setup_arch(), always.
77 * 1. find RSDP and get its address, and then find XSDT
78 * 2. extract all tables and checksums them all
79 * 3. check ACPI FADT revision
80 *
81 * We can parse ACPI boot-time tables such as MADT after
82 * this function is called.
83 */
84void __init acpi_boot_table_init(void)
85{
86 /* If acpi_disabled, bail out */
87 if (acpi_disabled)
88 return;
89
90 /* Initialize the ACPI boot-time table parser. */
91 if (acpi_table_init()) {
92 disable_acpi();
93 return;
94 }
95
96 if (acpi_table_parse(ACPI_SIG_FADT, acpi_parse_fadt)) {
97 /* disable ACPI if no FADT is found */
98 disable_acpi();
99 pr_err("Can't find FADT\n");
100 }
101}
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index e8420f635bd4..4f1a014ace39 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -17,6 +17,7 @@
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */ 18 */
19 19
20#include <linux/acpi.h>
20#include <linux/export.h> 21#include <linux/export.h>
21#include <linux/kernel.h> 22#include <linux/kernel.h>
22#include <linux/stddef.h> 23#include <linux/stddef.h>
@@ -46,6 +47,7 @@
46#include <linux/efi.h> 47#include <linux/efi.h>
47#include <linux/personality.h> 48#include <linux/personality.h>
48 49
50#include <asm/acpi.h>
49#include <asm/fixmap.h> 51#include <asm/fixmap.h>
50#include <asm/cpu.h> 52#include <asm/cpu.h>
51#include <asm/cputype.h> 53#include <asm/cputype.h>
@@ -380,6 +382,9 @@ void __init setup_arch(char **cmdline_p)
380 efi_init(); 382 efi_init();
381 arm64_memblock_init(); 383 arm64_memblock_init();
382 384
385 /* Parse the ACPI tables for possible boot-time configuration */
386 acpi_boot_table_init();
387
383 paging_init(); 388 paging_init();
384 request_standard_resources(); 389 request_standard_resources();
385 390