xref: /openbmc/linux/arch/riscv/include/asm/fixmap.h (revision d2574c33)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (C) 2019 Western Digital Corporation or its affiliates.
4  */
5 
6 #ifndef _ASM_RISCV_FIXMAP_H
7 #define _ASM_RISCV_FIXMAP_H
8 
9 #include <linux/kernel.h>
10 #include <linux/sizes.h>
11 #include <asm/page.h>
12 #include <asm/pgtable.h>
13 
14 /*
15  * Here we define all the compile-time 'special' virtual addresses.
16  * The point is to have a constant address at compile time, but to
17  * set the physical address only in the boot process.
18  *
19  * These 'compile-time allocated' memory buffers are page-sized. Use
20  * set_fixmap(idx,phys) to associate physical memory with fixmap indices.
21  */
22 enum fixed_addresses {
23 	FIX_HOLE,
24 	FIX_EARLYCON_MEM_BASE,
25 	__end_of_fixed_addresses
26 };
27 
28 #define FIXADDR_SIZE		(__end_of_fixed_addresses * PAGE_SIZE)
29 #define FIXADDR_TOP		(PAGE_OFFSET)
30 #define FIXADDR_START		(FIXADDR_TOP - FIXADDR_SIZE)
31 
32 #define FIXMAP_PAGE_IO		PAGE_KERNEL
33 
34 #define __early_set_fixmap	__set_fixmap
35 
36 #define __late_set_fixmap	__set_fixmap
37 #define __late_clear_fixmap(idx) __set_fixmap((idx), 0, FIXMAP_PAGE_CLEAR)
38 
39 extern void __set_fixmap(enum fixed_addresses idx,
40 			 phys_addr_t phys, pgprot_t prot);
41 
42 #include <asm-generic/fixmap.h>
43 
44 #endif /* _ASM_RISCV_FIXMAP_H */
45