xref: /linux/arch/riscv/include/asm/xip_fixup.h (revision 908fc4c2)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * XIP fixup macros, only useful in assembly.
4  */
5 #ifndef _ASM_RISCV_XIP_FIXUP_H
6 #define _ASM_RISCV_XIP_FIXUP_H
7 
8 #include <linux/pgtable.h>
9 
10 #ifdef CONFIG_XIP_KERNEL
11 .macro XIP_FIXUP_OFFSET reg
12         REG_L t0, _xip_fixup
13         add \reg, \reg, t0
14 .endm
15 .macro XIP_FIXUP_FLASH_OFFSET reg
16 	la t1, __data_loc
17 	REG_L t1, _xip_phys_offset
18 	sub \reg, \reg, t1
19 	add \reg, \reg, t0
20 .endm
21 
22 _xip_fixup: .dword CONFIG_PHYS_RAM_BASE - CONFIG_XIP_PHYS_ADDR - XIP_OFFSET
23 _xip_phys_offset: .dword CONFIG_XIP_PHYS_ADDR + XIP_OFFSET
24 #else
25 .macro XIP_FIXUP_OFFSET reg
26 .endm
27 .macro XIP_FIXUP_FLASH_OFFSET reg
28 .endm
29 #endif /* CONFIG_XIP_KERNEL */
30 
31 #endif
32