ARM64 / ACPI: Introduce PCI stub functions for ACPI
[deliverable/linux.git] / arch / arm64 / kernel / acpi.c
CommitLineData
37655163
AS
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}
This page took 0.052173 seconds and 5 git commands to generate.