xref: /linux/arch/loongarch/include/asm/fixmap.h (revision 7a5f1cd22d47f8ca4b760b6334378ae42c1bd24b)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * fixmap.h: compile-time virtual memory allocation
4  *
5  * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
6  */
7 
8 #ifndef _ASM_FIXMAP_H
9 #define _ASM_FIXMAP_H
10 
11 #ifdef CONFIG_HIGHMEM
12 #include <linux/threads.h>
13 #include <asm/kmap_size.h>
14 #endif
15 
16 #define NR_FIX_BTMAPS 64
17 
18 enum fixed_addresses {
19 	FIX_HOLE,
20 #ifdef CONFIG_HIGHMEM
21 	FIX_KMAP_BEGIN,
22 	FIX_KMAP_END = FIX_KMAP_BEGIN + (KM_MAX_IDX * NR_CPUS) - 1,
23 #endif
24 	FIX_EARLYCON_MEM_BASE,
25 	__end_of_fixed_addresses
26 };
27 
28 #define FIXADDR_SIZE	(__end_of_fixed_addresses << PAGE_SHIFT)
29 #define FIXADDR_START	(FIXADDR_TOP - FIXADDR_SIZE)
30 #define FIXMAP_PAGE_IO	PAGE_KERNEL_SUC
31 
32 extern void __set_fixmap(enum fixed_addresses idx,
33 			 phys_addr_t phys, pgprot_t flags);
34 
35 #include <asm-generic/fixmap.h>
36 
37 /*
38  * Called from pagetable_init()
39  */
40 extern void fixrange_init(unsigned long start, unsigned long end, pgd_t *pgd_base);
41 
42 #endif
43