1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (C) 2019 Western Digital Corporation or its affiliates.
6 #ifndef _ASM_RISCV_FIXMAP_H
7 #define _ASM_RISCV_FIXMAP_H
9 #include <linux/kernel.h>
10 #include <linux/sizes.h>
11 #include <linux/pgtable.h>
16 * Here we define all the compile-time 'special' virtual addresses.
17 * The point is to have a constant address at compile time, but to
18 * set the physical address only in the boot process.
20 * These 'compile-time allocated' memory buffers are page-sized. Use
21 * set_fixmap(idx,phys) to associate physical memory with fixmap indices.
23 enum fixed_addresses {
31 FIX_EARLYCON_MEM_BASE,
33 __end_of_permanent_fixed_addresses,
35 * Temporary boot-time mappings, used by early_ioremap(),
36 * before ioremap() is functional.
38 #define NR_FIX_BTMAPS (SZ_256K / PAGE_SIZE)
39 #define FIX_BTMAPS_SLOTS 7
40 #define TOTAL_FIX_BTMAPS (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS)
42 FIX_BTMAP_END = __end_of_permanent_fixed_addresses,
43 FIX_BTMAP_BEGIN = FIX_BTMAP_END + TOTAL_FIX_BTMAPS - 1,
45 __end_of_fixed_addresses
48 #define __early_set_fixmap __set_fixmap
50 #define __late_set_fixmap __set_fixmap
51 #define __late_clear_fixmap(idx) __set_fixmap((idx), 0, FIXMAP_PAGE_CLEAR)
53 extern void __set_fixmap(enum fixed_addresses idx,
54 phys_addr_t phys, pgprot_t prot);
56 #include <asm-generic/fixmap.h>
58 #endif /* CONFIG_MMU */
59 #endif /* _ASM_RISCV_FIXMAP_H */