| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2013-2014, Linaro Ltd. |
|---|
| 3 | 4 | * Author: Al Stone <al.stone@linaro.org> |
|---|
| 4 | 5 | * Author: Graeme Gregory <graeme.gregory@linaro.org> |
|---|
| 5 | 6 | * 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 | 7 | */ |
|---|
| 11 | 8 | |
|---|
| 12 | 9 | #ifndef _ASM_ACPI_H |
|---|
| .. | .. |
|---|
| 15 | 12 | #include <linux/efi.h> |
|---|
| 16 | 13 | #include <linux/memblock.h> |
|---|
| 17 | 14 | #include <linux/psci.h> |
|---|
| 15 | +#include <linux/stddef.h> |
|---|
| 18 | 16 | |
|---|
| 19 | 17 | #include <asm/cputype.h> |
|---|
| 20 | 18 | #include <asm/io.h> |
|---|
| 19 | +#include <asm/ptrace.h> |
|---|
| 21 | 20 | #include <asm/smp_plat.h> |
|---|
| 22 | 21 | #include <asm/tlbflush.h> |
|---|
| 23 | 22 | |
|---|
| 24 | 23 | /* Macros for consistency checks of the GICC subtable of MADT */ |
|---|
| 25 | | -#define ACPI_MADT_GICC_LENGTH \ |
|---|
| 26 | | - (acpi_gbl_FADT.header.revision < 6 ? 76 : 80) |
|---|
| 24 | + |
|---|
| 25 | +/* |
|---|
| 26 | + * MADT GICC minimum length refers to the MADT GICC structure table length as |
|---|
| 27 | + * defined in the earliest ACPI version supported on arm64, ie ACPI 5.1. |
|---|
| 28 | + * |
|---|
| 29 | + * The efficiency_class member was added to the |
|---|
| 30 | + * struct acpi_madt_generic_interrupt to represent the MADT GICC structure |
|---|
| 31 | + * "Processor Power Efficiency Class" field, added in ACPI 6.0 whose offset |
|---|
| 32 | + * is therefore used to delimit the MADT GICC structure minimum length |
|---|
| 33 | + * appropriately. |
|---|
| 34 | + */ |
|---|
| 35 | +#define ACPI_MADT_GICC_MIN_LENGTH offsetof( \ |
|---|
| 36 | + struct acpi_madt_generic_interrupt, efficiency_class) |
|---|
| 27 | 37 | |
|---|
| 28 | 38 | #define BAD_MADT_GICC_ENTRY(entry, end) \ |
|---|
| 29 | | - (!(entry) || (entry)->header.length != ACPI_MADT_GICC_LENGTH || \ |
|---|
| 30 | | - (unsigned long)(entry) + ACPI_MADT_GICC_LENGTH > (end)) |
|---|
| 39 | + (!(entry) || (entry)->header.length < ACPI_MADT_GICC_MIN_LENGTH || \ |
|---|
| 40 | + (unsigned long)(entry) + (entry)->header.length > (end)) |
|---|
| 41 | + |
|---|
| 42 | +#define ACPI_MADT_GICC_SPE (offsetof(struct acpi_madt_generic_interrupt, \ |
|---|
| 43 | + spe_interrupt) + sizeof(u16)) |
|---|
| 31 | 44 | |
|---|
| 32 | 45 | /* Basic configuration for ACPI */ |
|---|
| 33 | 46 | #ifdef CONFIG_ACPI |
|---|
| 34 | 47 | pgprot_t __acpi_get_mem_attribute(phys_addr_t addr); |
|---|
| 35 | 48 | |
|---|
| 36 | 49 | /* ACPI table mapping after acpi_permanent_mmap is set */ |
|---|
| 37 | | -static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys, |
|---|
| 38 | | - acpi_size size) |
|---|
| 39 | | -{ |
|---|
| 40 | | - /* For normal memory we already have a cacheable mapping. */ |
|---|
| 41 | | - if (memblock_is_map_memory(phys)) |
|---|
| 42 | | - return (void __iomem *)__phys_to_virt(phys); |
|---|
| 43 | | - |
|---|
| 44 | | - /* |
|---|
| 45 | | - * We should still honor the memory's attribute here because |
|---|
| 46 | | - * crash dump kernel possibly excludes some ACPI (reclaim) |
|---|
| 47 | | - * regions from memblock list. |
|---|
| 48 | | - */ |
|---|
| 49 | | - return __ioremap(phys, size, __acpi_get_mem_attribute(phys)); |
|---|
| 50 | | -} |
|---|
| 50 | +void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size); |
|---|
| 51 | 51 | #define acpi_os_ioremap acpi_os_ioremap |
|---|
| 52 | 52 | |
|---|
| 53 | 53 | typedef u64 phys_cpuid_t; |
|---|
| .. | .. |
|---|
| 99 | 99 | |
|---|
| 100 | 100 | static inline void arch_fix_phys_package_id(int num, u32 slot) { } |
|---|
| 101 | 101 | void __init acpi_init_cpus(void); |
|---|
| 102 | | - |
|---|
| 102 | +int apei_claim_sea(struct pt_regs *regs); |
|---|
| 103 | 103 | #else |
|---|
| 104 | 104 | static inline void acpi_init_cpus(void) { } |
|---|
| 105 | +static inline int apei_claim_sea(struct pt_regs *regs) { return -ENOENT; } |
|---|
| 105 | 106 | #endif /* CONFIG_ACPI */ |
|---|
| 106 | 107 | |
|---|
| 107 | 108 | #ifdef CONFIG_ARM64_ACPI_PARKING_PROTOCOL |
|---|