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