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> 20e25781e3SMark Rutland #include <linux/sizes.h> 2161bd93ceSArd Biesheuvel #include <asm/boot.h> 22bf4b558eSMark Salter #include <asm/page.h> 233eca86e7SMark Rutland #include <asm/pgtable-prot.h> 24bf4b558eSMark Salter 25bf4b558eSMark Salter /* 26bf4b558eSMark Salter * Here we define all the compile-time 'special' virtual 27bf4b558eSMark Salter * addresses. The point is to have a constant address at 28bf4b558eSMark Salter * compile time, but to set the physical address only 29bf4b558eSMark Salter * in the boot process. 30bf4b558eSMark Salter * 31bf4b558eSMark Salter * These 'compile-time allocated' memory buffers are 32bf4b558eSMark Salter * page-sized. Use set_fixmap(idx,phys) to associate 33bf4b558eSMark Salter * physical memory with fixmap indices. 34bf4b558eSMark Salter * 35bf4b558eSMark Salter */ 36bf4b558eSMark Salter enum fixed_addresses { 37dab78b6dSLaura Abbott FIX_HOLE, 3861bd93ceSArd Biesheuvel 3961bd93ceSArd Biesheuvel /* 4061bd93ceSArd Biesheuvel * Reserve a virtual window for the FDT that is 2 MB larger than the 4161bd93ceSArd Biesheuvel * maximum supported size, and put it at the top of the fixmap region. 4261bd93ceSArd Biesheuvel * The additional space ensures that any FDT that does not exceed 4361bd93ceSArd Biesheuvel * MAX_FDT_SIZE can be mapped regardless of whether it crosses any 4461bd93ceSArd Biesheuvel * 2 MB alignment boundaries. 4561bd93ceSArd Biesheuvel * 4661bd93ceSArd Biesheuvel * Keep this at the top so it remains 2 MB aligned. 4761bd93ceSArd Biesheuvel */ 4861bd93ceSArd Biesheuvel #define FIX_FDT_SIZE (MAX_FDT_SIZE + SZ_2M) 4961bd93ceSArd Biesheuvel FIX_FDT_END, 5061bd93ceSArd Biesheuvel FIX_FDT = FIX_FDT_END + FIX_FDT_SIZE / PAGE_SIZE - 1, 5161bd93ceSArd Biesheuvel 52bf4b558eSMark Salter FIX_EARLYCON_MEM_BASE, 5319fc5775SMark Rutland FIX_TEXT_POKE0, 544f89fa28SJames Morse 554f89fa28SJames Morse #ifdef CONFIG_ACPI_APEI_GHES 564f89fa28SJames Morse /* Used for GHES mapping from assorted contexts */ 574f89fa28SJames Morse FIX_APEI_GHES_IRQ, 58b972d2eaSJames Morse FIX_APEI_GHES_SEA, 59f96935d3SJames Morse #ifdef CONFIG_ARM_SDE_INTERFACE 60f96935d3SJames Morse FIX_APEI_GHES_SDEI_NORMAL, 61f96935d3SJames Morse FIX_APEI_GHES_SDEI_CRITICAL, 62f96935d3SJames Morse #endif 634f89fa28SJames Morse #endif /* CONFIG_ACPI_APEI_GHES */ 644f89fa28SJames Morse 6551a0048bSWill Deacon #ifdef CONFIG_UNMAP_KERNEL_AT_EL0 666c27c408SWill Deacon FIX_ENTRY_TRAMP_DATA, 6751a0048bSWill Deacon FIX_ENTRY_TRAMP_TEXT, 6851a0048bSWill Deacon #define TRAMP_VALIAS (__fix_to_virt(FIX_ENTRY_TRAMP_TEXT)) 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) 97bf4b558eSMark Salter 98bf4b558eSMark Salter #define FIXMAP_PAGE_IO __pgprot(PROT_DEVICE_nGnRE) 99bf4b558eSMark Salter 100af86e597SLaura Abbott void __init early_fixmap_init(void); 101bf4b558eSMark Salter 102af86e597SLaura Abbott #define __early_set_fixmap __set_fixmap 103af86e597SLaura Abbott 104b2cedba0SMark Salter #define __late_set_fixmap __set_fixmap 105b2cedba0SMark Salter #define __late_clear_fixmap(idx) __set_fixmap((idx), 0, FIXMAP_PAGE_CLEAR) 106b2cedba0SMark Salter 107af86e597SLaura Abbott extern void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t prot); 108bf4b558eSMark Salter 109bf4b558eSMark Salter #include <asm-generic/fixmap.h> 110bf4b558eSMark Salter 111bf4b558eSMark Salter #endif /* !__ASSEMBLY__ */ 112bf4b558eSMark Salter #endif /* _ASM_ARM64_FIXMAP_H */ 113