|
@@ -29,6 +29,11 @@
|
|
|
#include <asm/cpu_ops.h>
|
|
|
#include <asm/smp_plat.h>
|
|
|
|
|
|
+#ifdef CONFIG_ACPI_APEI
|
|
|
+# include <linux/efi.h>
|
|
|
+# include <asm/pgtable.h>
|
|
|
+#endif
|
|
|
+
|
|
|
int acpi_noirq = 1; /* skip ACPI IRQ initialization */
|
|
|
int acpi_disabled = 1;
|
|
|
EXPORT_SYMBOL(acpi_disabled);
|
|
@@ -230,3 +235,27 @@ void __init acpi_gic_init(void)
|
|
|
|
|
|
early_acpi_os_unmap_memory((char *)table, tbl_size);
|
|
|
}
|
|
|
+
|
|
|
+#ifdef CONFIG_ACPI_APEI
|
|
|
+pgprot_t arch_apei_get_mem_attribute(phys_addr_t addr)
|
|
|
+{
|
|
|
+ /*
|
|
|
+ * According to "Table 8 Map: EFI memory types to AArch64 memory
|
|
|
+ * types" of UEFI 2.5 section 2.3.6.1, each EFI memory type is
|
|
|
+ * mapped to a corresponding MAIR attribute encoding.
|
|
|
+ * The EFI memory attribute advises all possible capabilities
|
|
|
+ * of a memory region. We use the most efficient capability.
|
|
|
+ */
|
|
|
+
|
|
|
+ u64 attr;
|
|
|
+
|
|
|
+ attr = efi_mem_attributes(addr);
|
|
|
+ if (attr & EFI_MEMORY_WB)
|
|
|
+ return PAGE_KERNEL;
|
|
|
+ if (attr & EFI_MEMORY_WT)
|
|
|
+ return __pgprot(PROT_NORMAL_WT);
|
|
|
+ if (attr & EFI_MEMORY_WC)
|
|
|
+ return __pgprot(PROT_NORMAL_NC);
|
|
|
+ return __pgprot(PROT_DEVICE_nGnRnE);
|
|
|
+}
|
|
|
+#endif
|