^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (C) 2019 Western Digital Corporation or its affiliates.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #ifndef _ASM_RISCV_FIXMAP_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #define _ASM_RISCV_FIXMAP_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/sizes.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/pgtable.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <asm/page.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #ifdef CONFIG_MMU
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) * Here we define all the compile-time 'special' virtual addresses.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) * The point is to have a constant address at compile time, but to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) * set the physical address only in the boot process.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * These 'compile-time allocated' memory buffers are page-sized. Use
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) * set_fixmap(idx,phys) to associate physical memory with fixmap indices.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) enum fixed_addresses {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) FIX_HOLE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) FIX_PTE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) FIX_PMD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) FIX_TEXT_POKE1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) FIX_TEXT_POKE0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) FIX_EARLYCON_MEM_BASE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) __end_of_permanent_fixed_addresses,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) * Temporary boot-time mappings, used by early_ioremap(),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) * before ioremap() is functional.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #define NR_FIX_BTMAPS (SZ_256K / PAGE_SIZE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #define FIX_BTMAPS_SLOTS 7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #define TOTAL_FIX_BTMAPS (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) FIX_BTMAP_END = __end_of_permanent_fixed_addresses,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) FIX_BTMAP_BEGIN = FIX_BTMAP_END + TOTAL_FIX_BTMAPS - 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) __end_of_fixed_addresses
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #define FIXMAP_PAGE_IO PAGE_KERNEL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) #define __early_set_fixmap __set_fixmap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #define __late_set_fixmap __set_fixmap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) #define __late_clear_fixmap(idx) __set_fixmap((idx), 0, FIXMAP_PAGE_CLEAR)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) extern void __set_fixmap(enum fixed_addresses idx,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) phys_addr_t phys, pgprot_t prot);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) #include <asm-generic/fixmap.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) #endif /* CONFIG_MMU */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) #endif /* _ASM_RISCV_FIXMAP_H */