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