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