18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef __UM_FIXMAP_H 38c2ecf20Sopenharmony_ci#define __UM_FIXMAP_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#include <asm/processor.h> 68c2ecf20Sopenharmony_ci#include <asm/kmap_types.h> 78c2ecf20Sopenharmony_ci#include <asm/archparam.h> 88c2ecf20Sopenharmony_ci#include <asm/page.h> 98c2ecf20Sopenharmony_ci#include <linux/threads.h> 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci/* 128c2ecf20Sopenharmony_ci * Here we define all the compile-time 'special' virtual 138c2ecf20Sopenharmony_ci * addresses. The point is to have a constant address at 148c2ecf20Sopenharmony_ci * compile time, but to set the physical address only 158c2ecf20Sopenharmony_ci * in the boot process. We allocate these special addresses 168c2ecf20Sopenharmony_ci * from the end of virtual memory (0xfffff000) backwards. 178c2ecf20Sopenharmony_ci * Also this lets us do fail-safe vmalloc(), we 188c2ecf20Sopenharmony_ci * can guarantee that these special addresses and 198c2ecf20Sopenharmony_ci * vmalloc()-ed addresses never overlap. 208c2ecf20Sopenharmony_ci * 218c2ecf20Sopenharmony_ci * these 'compile-time allocated' memory buffers are 228c2ecf20Sopenharmony_ci * fixed-size 4k pages. (or larger if used with an increment 238c2ecf20Sopenharmony_ci * highger than 1) use fixmap_set(idx,phys) to associate 248c2ecf20Sopenharmony_ci * physical memory with fixmap indices. 258c2ecf20Sopenharmony_ci * 268c2ecf20Sopenharmony_ci * TLB entries of such buffers will not be flushed across 278c2ecf20Sopenharmony_ci * task switches. 288c2ecf20Sopenharmony_ci */ 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci/* 318c2ecf20Sopenharmony_ci * on UP currently we will have no trace of the fixmap mechanizm, 328c2ecf20Sopenharmony_ci * no page table allocations, etc. This might change in the 338c2ecf20Sopenharmony_ci * future, say framebuffers for the console driver(s) could be 348c2ecf20Sopenharmony_ci * fix-mapped? 358c2ecf20Sopenharmony_ci */ 368c2ecf20Sopenharmony_cienum fixed_addresses { 378c2ecf20Sopenharmony_ci __end_of_fixed_addresses 388c2ecf20Sopenharmony_ci}; 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ciextern void __set_fixmap (enum fixed_addresses idx, 418c2ecf20Sopenharmony_ci unsigned long phys, pgprot_t flags); 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci/* 448c2ecf20Sopenharmony_ci * used by vmalloc.c. 458c2ecf20Sopenharmony_ci * 468c2ecf20Sopenharmony_ci * Leave one empty page between vmalloc'ed areas and 478c2ecf20Sopenharmony_ci * the start of the fixmap, and leave one page empty 488c2ecf20Sopenharmony_ci * at the top of mem.. 498c2ecf20Sopenharmony_ci */ 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci#define FIXADDR_TOP (TASK_SIZE - 2 * PAGE_SIZE) 528c2ecf20Sopenharmony_ci#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) 538c2ecf20Sopenharmony_ci#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci#include <asm-generic/fixmap.h> 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci#endif 58