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