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