diff options
-rw-r--r-- | arch/arm64/include/asm/acpi.h | 5 | ||||
-rw-r--r-- | arch/arm64/kernel/acpi.c | 29 |
2 files changed, 34 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h index 406485ed110a..5aa892a12a0d 100644 --- a/arch/arm64/include/asm/acpi.h +++ b/arch/arm64/include/asm/acpi.h | |||
@@ -92,4 +92,9 @@ static inline const char *acpi_get_enable_method(int cpu) | |||
92 | { | 92 | { |
93 | return acpi_psci_present() ? "psci" : NULL; | 93 | return acpi_psci_present() ? "psci" : NULL; |
94 | } | 94 | } |
95 | |||
96 | #ifdef CONFIG_ACPI_APEI | ||
97 | pgprot_t arch_apei_get_mem_attribute(phys_addr_t addr); | ||
98 | #endif | ||
99 | |||
95 | #endif /*_ASM_ACPI_H*/ | 100 | #endif /*_ASM_ACPI_H*/ |
diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c index 19de7537e7d3..137d537ddceb 100644 --- a/arch/arm64/kernel/acpi.c +++ b/arch/arm64/kernel/acpi.c | |||
@@ -29,6 +29,11 @@ | |||
29 | #include <asm/cpu_ops.h> | 29 | #include <asm/cpu_ops.h> |
30 | #include <asm/smp_plat.h> | 30 | #include <asm/smp_plat.h> |
31 | 31 | ||
32 | #ifdef CONFIG_ACPI_APEI | ||
33 | # include <linux/efi.h> | ||
34 | # include <asm/pgtable.h> | ||
35 | #endif | ||
36 | |||
32 | int acpi_noirq = 1; /* skip ACPI IRQ initialization */ | 37 | int acpi_noirq = 1; /* skip ACPI IRQ initialization */ |
33 | int acpi_disabled = 1; | 38 | int acpi_disabled = 1; |
34 | EXPORT_SYMBOL(acpi_disabled); | 39 | EXPORT_SYMBOL(acpi_disabled); |
@@ -230,3 +235,27 @@ void __init acpi_gic_init(void) | |||
230 | 235 | ||
231 | early_acpi_os_unmap_memory((char *)table, tbl_size); | 236 | early_acpi_os_unmap_memory((char *)table, tbl_size); |
232 | } | 237 | } |
238 | |||
239 | #ifdef CONFIG_ACPI_APEI | ||
240 | pgprot_t arch_apei_get_mem_attribute(phys_addr_t addr) | ||
241 | { | ||
242 | /* | ||
243 | * According to "Table 8 Map: EFI memory types to AArch64 memory | ||
244 | * types" of UEFI 2.5 section 2.3.6.1, each EFI memory type is | ||
245 | * mapped to a corresponding MAIR attribute encoding. | ||
246 | * The EFI memory attribute advises all possible capabilities | ||
247 | * of a memory region. We use the most efficient capability. | ||
248 | */ | ||
249 | |||
250 | u64 attr; | ||
251 | |||
252 | attr = efi_mem_attributes(addr); | ||
253 | if (attr & EFI_MEMORY_WB) | ||
254 | return PAGE_KERNEL; | ||
255 | if (attr & EFI_MEMORY_WT) | ||
256 | return __pgprot(PROT_NORMAL_WT); | ||
257 | if (attr & EFI_MEMORY_WC) | ||
258 | return __pgprot(PROT_NORMAL_NC); | ||
259 | return __pgprot(PROT_DEVICE_nGnRnE); | ||
260 | } | ||
261 | #endif | ||