1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */ 2*4882a593Smuzhiyun /* 3*4882a593Smuzhiyun * fixmap.h: compile-time virtual memory allocation 4*4882a593Smuzhiyun * 5*4882a593Smuzhiyun * Copyright (C) 1998 Ingo Molnar 6*4882a593Smuzhiyun * 7*4882a593Smuzhiyun * Copyright 2008 Freescale Semiconductor Inc. 8*4882a593Smuzhiyun * Port to powerpc added by Kumar Gala 9*4882a593Smuzhiyun * 10*4882a593Smuzhiyun * Copyright 2011 Michal Simek <monstr@monstr.eu> 11*4882a593Smuzhiyun * Copyright 2011 PetaLogix Qld Pty Ltd 12*4882a593Smuzhiyun * Port to Microblaze 13*4882a593Smuzhiyun */ 14*4882a593Smuzhiyun 15*4882a593Smuzhiyun #ifndef _ASM_FIXMAP_H 16*4882a593Smuzhiyun #define _ASM_FIXMAP_H 17*4882a593Smuzhiyun 18*4882a593Smuzhiyun #ifndef __ASSEMBLY__ 19*4882a593Smuzhiyun #include <linux/kernel.h> 20*4882a593Smuzhiyun #include <asm/page.h> 21*4882a593Smuzhiyun #ifdef CONFIG_HIGHMEM 22*4882a593Smuzhiyun #include <linux/threads.h> 23*4882a593Smuzhiyun #include <asm/kmap_types.h> 24*4882a593Smuzhiyun #endif 25*4882a593Smuzhiyun 26*4882a593Smuzhiyun #define FIXADDR_TOP ((unsigned long)(-PAGE_SIZE)) 27*4882a593Smuzhiyun 28*4882a593Smuzhiyun /* 29*4882a593Smuzhiyun * Here we define all the compile-time 'special' virtual 30*4882a593Smuzhiyun * addresses. The point is to have a constant address at 31*4882a593Smuzhiyun * compile time, but to set the physical address only 32*4882a593Smuzhiyun * in the boot process. We allocate these special addresses 33*4882a593Smuzhiyun * from the end of virtual memory (0xfffff000) backwards. 34*4882a593Smuzhiyun * Also this lets us do fail-safe vmalloc(), we 35*4882a593Smuzhiyun * can guarantee that these special addresses and 36*4882a593Smuzhiyun * vmalloc()-ed addresses never overlap. 37*4882a593Smuzhiyun * 38*4882a593Smuzhiyun * these 'compile-time allocated' memory buffers are 39*4882a593Smuzhiyun * fixed-size 4k pages. (or larger if used with an increment 40*4882a593Smuzhiyun * highger than 1) use fixmap_set(idx,phys) to associate 41*4882a593Smuzhiyun * physical memory with fixmap indices. 42*4882a593Smuzhiyun * 43*4882a593Smuzhiyun * TLB entries of such buffers will not be flushed across 44*4882a593Smuzhiyun * task switches. 45*4882a593Smuzhiyun */ 46*4882a593Smuzhiyun enum fixed_addresses { 47*4882a593Smuzhiyun FIX_HOLE, 48*4882a593Smuzhiyun #ifdef CONFIG_HIGHMEM 49*4882a593Smuzhiyun FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */ 50*4882a593Smuzhiyun FIX_KMAP_END = FIX_KMAP_BEGIN + (KM_TYPE_NR * num_possible_cpus()) - 1, 51*4882a593Smuzhiyun #endif 52*4882a593Smuzhiyun __end_of_fixed_addresses 53*4882a593Smuzhiyun }; 54*4882a593Smuzhiyun 55*4882a593Smuzhiyun extern void __set_fixmap(enum fixed_addresses idx, 56*4882a593Smuzhiyun phys_addr_t phys, pgprot_t flags); 57*4882a593Smuzhiyun 58*4882a593Smuzhiyun #define __FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) 59*4882a593Smuzhiyun #define FIXADDR_START (FIXADDR_TOP - __FIXADDR_SIZE) 60*4882a593Smuzhiyun 61*4882a593Smuzhiyun #define FIXMAP_PAGE_NOCACHE PAGE_KERNEL_CI 62*4882a593Smuzhiyun 63*4882a593Smuzhiyun #include <asm-generic/fixmap.h> 64*4882a593Smuzhiyun 65*4882a593Smuzhiyun #endif /* !__ASSEMBLY__ */ 66*4882a593Smuzhiyun #endif 67