/* SPDX-License-Identifier: GPL-2.01*2* fixmap.h: compile-time virtual memory allocation3*4* Copyright (C) 1998 Ingo Molnar5*6* Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 19997*/89#ifndef _ASM_FIXMAP_H10#define _ASM_FIXMAP_H1112#include <linux/kernel.h>13#include <linux/threads.h>14#include <asm/page.h>1516/*17* Here we define all the compile-time 'special' virtual18* addresses. The point is to have a constant address at19* compile time, but to set the physical address only20* in the boot process. We allocate these special addresses21* from the end of P3 backwards.22* Also this lets us do fail-safe vmalloc(), we23* can guarantee that these special addresses and24* vmalloc()-ed addresses never overlap.25*26* these 'compile-time allocated' memory buffers are27* fixed-size 4k pages. (or larger if used with an increment28* highger than 1) use fixmap_set(idx,phys) to associate29* physical memory with fixmap indices.30*31* TLB entries of such buffers will not be flushed across32* task switches.33*/3435/*36* on UP currently we will have no trace of the fixmap mechanizm,37* no page table allocations, etc. This might change in the38* future, say framebuffers for the console driver(s) could be39* fix-mapped?40*/41enum fixed_addresses {42/*43* The FIX_CMAP entries are used by kmap_coherent() to get virtual44* addresses which are of a known color, and so their values are45* important. __fix_to_virt(FIX_CMAP_END - n) must give an address46* which is the same color as a page (n<<PAGE_SHIFT).47*/48#define FIX_N_COLOURS 849FIX_CMAP_BEGIN,50FIX_CMAP_END = FIX_CMAP_BEGIN + (FIX_N_COLOURS * NR_CPUS) - 1,5152#ifdef CONFIG_IOREMAP_FIXED53/*54* FIX_IOREMAP entries are useful for mapping physical address55* space before ioremap() is useable, e.g. really early in boot56* before kmalloc() is working.57*/58#define FIX_N_IOREMAPS 3259FIX_IOREMAP_BEGIN,60FIX_IOREMAP_END = FIX_IOREMAP_BEGIN + FIX_N_IOREMAPS - 1,61#endif6263__end_of_fixed_addresses64};6566extern void __set_fixmap(enum fixed_addresses idx,67unsigned long phys, pgprot_t flags);68extern void __clear_fixmap(enum fixed_addresses idx, pgprot_t flags);6970/*71* used by vmalloc.c.72*73* Leave one empty page between vmalloc'ed areas and74* the start of the fixmap, and leave one page empty75* at the top of mem..76*/77#define FIXADDR_TOP (P4SEG - PAGE_SIZE)78#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)79#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)8081#define FIXMAP_PAGE_NOCACHE PAGE_KERNEL_NOCACHE8283#include <asm-generic/fixmap.h>8485#endif868788