1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
4  */
5 
6 #ifndef _LOONGARCH_SETUP_H
7 #define _LOONGARCH_SETUP_H
8 
9 #include <linux/types.h>
10 #include <asm/sections.h>
11 #include <uapi/asm/setup.h>
12 
13 #define VECSIZE 0x200
14 
15 extern unsigned long eentry;
16 extern unsigned long tlbrentry;
17 extern char init_command_line[COMMAND_LINE_SIZE];
18 extern void tlb_init(int cpu);
19 extern void cpu_cache_init(void);
20 extern void cache_error_setup(void);
21 extern void per_cpu_trap_init(int cpu);
22 extern void set_handler(unsigned long offset, void *addr, unsigned long len);
23 extern void set_merr_handler(unsigned long offset, void *addr, unsigned long len);
24 
25 #ifdef CONFIG_RELOCATABLE
26 
27 struct rela_la_abs {
28 	long pc;
29 	long symvalue;
30 };
31 
32 extern long __la_abs_begin;
33 extern long __la_abs_end;
34 extern long __rela_dyn_begin;
35 extern long __rela_dyn_end;
36 
37 #ifdef CONFIG_RELR
38 extern long __relr_dyn_begin;
39 extern long __relr_dyn_end;
40 #endif
41 
42 extern unsigned long __init relocate_kernel(void);
43 
44 #endif
45 
kaslr_offset(void)46 static inline unsigned long kaslr_offset(void)
47 {
48 	return (unsigned long)&_text - VMLINUX_LOAD_ADDRESS;
49 }
50 
51 #endif /* __SETUP_H */
52