David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame] | 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> |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame^] | 11 | #include <linux/pgtable.h> |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame] | 12 | #include <asm/page.h> |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame] | 13 | |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame^] | 14 | #ifdef CONFIG_MMU |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame] | 15 | /* |
| 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. |
| 19 | * |
| 20 | * These 'compile-time allocated' memory buffers are page-sized. Use |
| 21 | * set_fixmap(idx,phys) to associate physical memory with fixmap indices. |
| 22 | */ |
| 23 | enum fixed_addresses { |
| 24 | FIX_HOLE, |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame] | 25 | FIX_PTE, |
| 26 | FIX_PMD, |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame^] | 27 | FIX_TEXT_POKE1, |
| 28 | FIX_TEXT_POKE0, |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame] | 29 | FIX_EARLYCON_MEM_BASE, |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame^] | 30 | |
| 31 | __end_of_permanent_fixed_addresses, |
| 32 | /* |
| 33 | * Temporary boot-time mappings, used by early_ioremap(), |
| 34 | * before ioremap() is functional. |
| 35 | */ |
| 36 | #define NR_FIX_BTMAPS (SZ_256K / PAGE_SIZE) |
| 37 | #define FIX_BTMAPS_SLOTS 7 |
| 38 | #define TOTAL_FIX_BTMAPS (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS) |
| 39 | |
| 40 | FIX_BTMAP_END = __end_of_permanent_fixed_addresses, |
| 41 | FIX_BTMAP_BEGIN = FIX_BTMAP_END + TOTAL_FIX_BTMAPS - 1, |
| 42 | |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame] | 43 | __end_of_fixed_addresses |
| 44 | }; |
| 45 | |
| 46 | #define FIXMAP_PAGE_IO PAGE_KERNEL |
| 47 | |
| 48 | #define __early_set_fixmap __set_fixmap |
| 49 | |
| 50 | #define __late_set_fixmap __set_fixmap |
| 51 | #define __late_clear_fixmap(idx) __set_fixmap((idx), 0, FIXMAP_PAGE_CLEAR) |
| 52 | |
| 53 | extern void __set_fixmap(enum fixed_addresses idx, |
| 54 | phys_addr_t phys, pgprot_t prot); |
| 55 | |
| 56 | #include <asm-generic/fixmap.h> |
| 57 | |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame^] | 58 | #endif /* CONFIG_MMU */ |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame] | 59 | #endif /* _ASM_RISCV_FIXMAP_H */ |