1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_POWERPC_SETUP_H
3 #define _ASM_POWERPC_SETUP_H
4
5 #include <uapi/asm/setup.h>
6
7 #ifndef __ASSEMBLY__
8 extern void ppc_printk_progress(char *s, unsigned short hex);
9
10 extern unsigned int rtas_data;
11 extern unsigned long long memory_limit;
12 extern bool init_mem_is_free;
13 extern unsigned long klimit;
14 extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask);
15
16 struct device_node;
17 extern void note_scsi_host(struct device_node *, void *);
18
19 /* Used in very early kernel initialization. */
20 extern unsigned long reloc_offset(void);
21 extern unsigned long add_reloc_offset(unsigned long);
22 extern void reloc_got2(unsigned long);
23
24 #define PTRRELOC(x) ((typeof(x)) add_reloc_offset((unsigned long)(x)))
25
26 void check_for_initrd(void);
27 void initmem_init(void);
28 void setup_panic(void);
29 #define ARCH_PANIC_TIMEOUT 180
30
31 #ifdef CONFIG_PPC_PSERIES
32 extern void pseries_enable_reloc_on_exc(void);
33 extern void pseries_disable_reloc_on_exc(void);
34 extern void pseries_big_endian_exceptions(void);
35 extern void pseries_little_endian_exceptions(void);
36 #else
pseries_enable_reloc_on_exc(void)37 static inline void pseries_enable_reloc_on_exc(void) {}
pseries_disable_reloc_on_exc(void)38 static inline void pseries_disable_reloc_on_exc(void) {}
pseries_big_endian_exceptions(void)39 static inline void pseries_big_endian_exceptions(void) {}
pseries_little_endian_exceptions(void)40 static inline void pseries_little_endian_exceptions(void) {}
41 #endif /* CONFIG_PPC_PSERIES */
42
43 void rfi_flush_enable(bool enable);
44
45 /* These are bit flags */
46 enum l1d_flush_type {
47 L1D_FLUSH_NONE = 0x1,
48 L1D_FLUSH_FALLBACK = 0x2,
49 L1D_FLUSH_ORI = 0x4,
50 L1D_FLUSH_MTTRIG = 0x8,
51 };
52
53 void setup_rfi_flush(enum l1d_flush_type, bool enable);
54 void do_rfi_flush_fixups(enum l1d_flush_type types);
55 #ifdef CONFIG_PPC_BARRIER_NOSPEC
56 void setup_barrier_nospec(void);
57 #else
setup_barrier_nospec(void)58 static inline void setup_barrier_nospec(void) { };
59 #endif
60 void do_barrier_nospec_fixups(bool enable);
61 extern bool barrier_nospec_enabled;
62
63 #ifdef CONFIG_PPC_BARRIER_NOSPEC
64 void do_barrier_nospec_fixups_range(bool enable, void *start, void *end);
65 #else
do_barrier_nospec_fixups_range(bool enable,void * start,void * end)66 static inline void do_barrier_nospec_fixups_range(bool enable, void *start, void *end) { };
67 #endif
68
69 #ifdef CONFIG_PPC_FSL_BOOK3E
70 void setup_spectre_v2(void);
71 #else
setup_spectre_v2(void)72 static inline void setup_spectre_v2(void) {};
73 #endif
74 void do_btb_flush_fixups(void);
75
76 #endif /* !__ASSEMBLY__ */
77
78 #endif /* _ASM_POWERPC_SETUP_H */
79
80