1bf4b558eSMark Salter /* 2bf4b558eSMark Salter * fixmap.h: compile-time virtual memory allocation 3bf4b558eSMark Salter * 4bf4b558eSMark Salter * This file is subject to the terms and conditions of the GNU General Public 5bf4b558eSMark Salter * License. See the file "COPYING" in the main directory of this archive 6bf4b558eSMark Salter * for more details. 7bf4b558eSMark Salter * 8bf4b558eSMark Salter * Copyright (C) 1998 Ingo Molnar 9bf4b558eSMark Salter * Copyright (C) 2013 Mark Salter <msalter@redhat.com> 10bf4b558eSMark Salter * 115d3c2c35SAlexander Kuleshov * Adapted from arch/x86 version. 12bf4b558eSMark Salter * 13bf4b558eSMark Salter */ 14bf4b558eSMark Salter 15bf4b558eSMark Salter #ifndef _ASM_ARM64_FIXMAP_H 16bf4b558eSMark Salter #define _ASM_ARM64_FIXMAP_H 17bf4b558eSMark Salter 18bf4b558eSMark Salter #ifndef __ASSEMBLY__ 19bf4b558eSMark Salter #include <linux/kernel.h> 20*414c109bSMark Rutland #include <linux/math.h> 21e25781e3SMark Rutland #include <linux/sizes.h> 2261bd93ceSArd Biesheuvel #include <asm/boot.h> 23bf4b558eSMark Salter #include <asm/page.h> 243eca86e7SMark Rutland #include <asm/pgtable-prot.h> 25bf4b558eSMark Salter 26bf4b558eSMark Salter /* 27bf4b558eSMark Salter * Here we define all the compile-time 'special' virtual 28bf4b558eSMark Salter * addresses. The point is to have a constant address at 29bf4b558eSMark Salter * compile time, but to set the physical address only 30bf4b558eSMark Salter * in the boot process. 31bf4b558eSMark Salter * 32489577d7SPingfan Liu * Each enum increment in these 'compile-time allocated' 33489577d7SPingfan Liu * memory buffers is page-sized. Use set_fixmap(idx,phys) 34489577d7SPingfan Liu * to associate physical memory with a fixmap index. 35bf4b558eSMark Salter */ 36bf4b558eSMark Salter enum fixed_addresses { 37dab78b6dSLaura Abbott FIX_HOLE, 3861bd93ceSArd Biesheuvel 3961bd93ceSArd Biesheuvel /* 40*414c109bSMark Rutland * Reserve a virtual window for the FDT that is a page bigger than the 41*414c109bSMark Rutland * maximum supported size. The additional space ensures that any FDT 42*414c109bSMark Rutland * that does not exceed MAX_FDT_SIZE can be mapped regardless of 43*414c109bSMark Rutland * whether it crosses any page boundary. 4461bd93ceSArd Biesheuvel */ 4561bd93ceSArd Biesheuvel FIX_FDT_END, 46*414c109bSMark Rutland FIX_FDT = FIX_FDT_END + DIV_ROUND_UP(MAX_FDT_SIZE, PAGE_SIZE) + 1, 4761bd93ceSArd Biesheuvel 48bf4b558eSMark Salter FIX_EARLYCON_MEM_BASE, 4919fc5775SMark Rutland FIX_TEXT_POKE0, 504f89fa28SJames Morse 514f89fa28SJames Morse #ifdef CONFIG_ACPI_APEI_GHES 524f89fa28SJames Morse /* Used for GHES mapping from assorted contexts */ 534f89fa28SJames Morse FIX_APEI_GHES_IRQ, 54b972d2eaSJames Morse FIX_APEI_GHES_SEA, 55f96935d3SJames Morse #ifdef CONFIG_ARM_SDE_INTERFACE 56f96935d3SJames Morse FIX_APEI_GHES_SDEI_NORMAL, 57f96935d3SJames Morse FIX_APEI_GHES_SDEI_CRITICAL, 58f96935d3SJames Morse #endif 594f89fa28SJames Morse #endif /* CONFIG_ACPI_APEI_GHES */ 604f89fa28SJames Morse 6151a0048bSWill Deacon #ifdef CONFIG_UNMAP_KERNEL_AT_EL0 621c9a8e87SArd Biesheuvel #ifdef CONFIG_RELOCATABLE 631c9a8e87SArd Biesheuvel FIX_ENTRY_TRAMP_TEXT4, /* one extra slot for the data page */ 641c9a8e87SArd Biesheuvel #endif 65a9c406e6SJames Morse FIX_ENTRY_TRAMP_TEXT3, 66a9c406e6SJames Morse FIX_ENTRY_TRAMP_TEXT2, 67a9c406e6SJames Morse FIX_ENTRY_TRAMP_TEXT1, 68a9c406e6SJames Morse #define TRAMP_VALIAS (__fix_to_virt(FIX_ENTRY_TRAMP_TEXT1)) 6951a0048bSWill Deacon #endif /* CONFIG_UNMAP_KERNEL_AT_EL0 */ 70bf4b558eSMark Salter __end_of_permanent_fixed_addresses, 71bf4b558eSMark Salter 72bf4b558eSMark Salter /* 73bf4b558eSMark Salter * Temporary boot-time mappings, used by early_ioremap(), 74bf4b558eSMark Salter * before ioremap() is functional. 75bf4b558eSMark Salter */ 76e25781e3SMark Rutland #define NR_FIX_BTMAPS (SZ_256K / PAGE_SIZE) 77bf4b558eSMark Salter #define FIX_BTMAPS_SLOTS 7 78bf4b558eSMark Salter #define TOTAL_FIX_BTMAPS (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS) 79bf4b558eSMark Salter 80bf4b558eSMark Salter FIX_BTMAP_END = __end_of_permanent_fixed_addresses, 81bf4b558eSMark Salter FIX_BTMAP_BEGIN = FIX_BTMAP_END + TOTAL_FIX_BTMAPS - 1, 82961faac1SMark Rutland 83961faac1SMark Rutland /* 84961faac1SMark Rutland * Used for kernel page table creation, so unmapped memory may be used 85961faac1SMark Rutland * for tables. 86961faac1SMark Rutland */ 87961faac1SMark Rutland FIX_PTE, 88961faac1SMark Rutland FIX_PMD, 89961faac1SMark Rutland FIX_PUD, 90961faac1SMark Rutland FIX_PGD, 91961faac1SMark Rutland 92bf4b558eSMark Salter __end_of_fixed_addresses 93bf4b558eSMark Salter }; 94bf4b558eSMark Salter 95bf4b558eSMark Salter #define FIXADDR_SIZE (__end_of_permanent_fixed_addresses << PAGE_SHIFT) 96bf4b558eSMark Salter #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) 9732f5b699SMark Rutland #define FIXADDR_TOT_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) 9832f5b699SMark Rutland #define FIXADDR_TOT_START (FIXADDR_TOP - FIXADDR_TOT_SIZE) 99bf4b558eSMark Salter 100bf4b558eSMark Salter #define FIXMAP_PAGE_IO __pgprot(PROT_DEVICE_nGnRE) 101bf4b558eSMark Salter 102af86e597SLaura Abbott void __init early_fixmap_init(void); 103b9754776SMark Rutland void __init fixmap_copy(pgd_t *pgdir); 104bf4b558eSMark Salter 105af86e597SLaura Abbott #define __early_set_fixmap __set_fixmap 106af86e597SLaura Abbott 107b2cedba0SMark Salter #define __late_set_fixmap __set_fixmap 108b2cedba0SMark Salter #define __late_clear_fixmap(idx) __set_fixmap((idx), 0, FIXMAP_PAGE_CLEAR) 109b2cedba0SMark Salter 110af86e597SLaura Abbott extern void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t prot); 111bf4b558eSMark Salter 112bf4b558eSMark Salter #include <asm-generic/fixmap.h> 113bf4b558eSMark Salter 114bf4b558eSMark Salter #endif /* !__ASSEMBLY__ */ 115bf4b558eSMark Salter #endif /* _ASM_ARM64_FIXMAP_H */ 116