1 /* 2 * arch/arm64/include/asm/dmi.h 3 * 4 * Copyright (C) 2013 Linaro Limited. 5 * Written by: Yi Li (yi.li@linaro.org) 6 * 7 * based on arch/ia64/include/asm/dmi.h 8 * 9 * This file is subject to the terms and conditions of the GNU General Public 10 * License. See the file "COPYING" in the main directory of this archive 11 * for more details. 12 */ 13 14 #ifndef __ASM_DMI_H 15 #define __ASM_DMI_H 16 17 #include <linux/slab.h> 18 #include <linux/efi.h> 19 20 static inline void __iomem *dmi_remap(u64 phys, u64 size) 21 { 22 void __iomem *p = efi_lookup_mapped_addr(phys); 23 24 /* 25 * If the mapping spans multiple pages, do a minimal check to ensure 26 * that the mapping returned by efi_lookup_mapped_addr() covers the 27 * whole requested range (but ignore potential holes) 28 */ 29 if ((phys & ~PAGE_MASK) + size > PAGE_SIZE 30 && (p + size - 1) != efi_lookup_mapped_addr(phys + size - 1)) 31 return NULL; 32 return p; 33 } 34 35 /* Reuse existing UEFI mappings for DMI */ 36 #define dmi_alloc(l) kzalloc(l, GFP_KERNEL) 37 #define dmi_early_remap(x, l) dmi_remap(x, l) 38 #define dmi_early_unmap(x, l) 39 #define dmi_unmap(x) 40 41 #endif 42