1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */ 2*4882a593Smuzhiyun #ifndef __UM_FIXMAP_H 3*4882a593Smuzhiyun #define __UM_FIXMAP_H 4*4882a593Smuzhiyun 5*4882a593Smuzhiyun #include <asm/processor.h> 6*4882a593Smuzhiyun #include <asm/kmap_types.h> 7*4882a593Smuzhiyun #include <asm/archparam.h> 8*4882a593Smuzhiyun #include <asm/page.h> 9*4882a593Smuzhiyun #include <linux/threads.h> 10*4882a593Smuzhiyun 11*4882a593Smuzhiyun /* 12*4882a593Smuzhiyun * Here we define all the compile-time 'special' virtual 13*4882a593Smuzhiyun * addresses. The point is to have a constant address at 14*4882a593Smuzhiyun * compile time, but to set the physical address only 15*4882a593Smuzhiyun * in the boot process. We allocate these special addresses 16*4882a593Smuzhiyun * from the end of virtual memory (0xfffff000) backwards. 17*4882a593Smuzhiyun * Also this lets us do fail-safe vmalloc(), we 18*4882a593Smuzhiyun * can guarantee that these special addresses and 19*4882a593Smuzhiyun * vmalloc()-ed addresses never overlap. 20*4882a593Smuzhiyun * 21*4882a593Smuzhiyun * these 'compile-time allocated' memory buffers are 22*4882a593Smuzhiyun * fixed-size 4k pages. (or larger if used with an increment 23*4882a593Smuzhiyun * highger than 1) use fixmap_set(idx,phys) to associate 24*4882a593Smuzhiyun * physical memory with fixmap indices. 25*4882a593Smuzhiyun * 26*4882a593Smuzhiyun * TLB entries of such buffers will not be flushed across 27*4882a593Smuzhiyun * task switches. 28*4882a593Smuzhiyun */ 29*4882a593Smuzhiyun 30*4882a593Smuzhiyun /* 31*4882a593Smuzhiyun * on UP currently we will have no trace of the fixmap mechanizm, 32*4882a593Smuzhiyun * no page table allocations, etc. This might change in the 33*4882a593Smuzhiyun * future, say framebuffers for the console driver(s) could be 34*4882a593Smuzhiyun * fix-mapped? 35*4882a593Smuzhiyun */ 36*4882a593Smuzhiyun enum fixed_addresses { 37*4882a593Smuzhiyun __end_of_fixed_addresses 38*4882a593Smuzhiyun }; 39*4882a593Smuzhiyun 40*4882a593Smuzhiyun extern void __set_fixmap (enum fixed_addresses idx, 41*4882a593Smuzhiyun unsigned long phys, pgprot_t flags); 42*4882a593Smuzhiyun 43*4882a593Smuzhiyun /* 44*4882a593Smuzhiyun * used by vmalloc.c. 45*4882a593Smuzhiyun * 46*4882a593Smuzhiyun * Leave one empty page between vmalloc'ed areas and 47*4882a593Smuzhiyun * the start of the fixmap, and leave one page empty 48*4882a593Smuzhiyun * at the top of mem.. 49*4882a593Smuzhiyun */ 50*4882a593Smuzhiyun 51*4882a593Smuzhiyun #define FIXADDR_TOP (TASK_SIZE - 2 * PAGE_SIZE) 52*4882a593Smuzhiyun #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) 53*4882a593Smuzhiyun #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) 54*4882a593Smuzhiyun 55*4882a593Smuzhiyun #include <asm-generic/fixmap.h> 56*4882a593Smuzhiyun 57*4882a593Smuzhiyun #endif 58