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__
8extern void ppc_printk_progress(char *s, unsigned short hex);
9
10extern unsigned long long memory_limit;
11
12struct device_node;
13
14/* Used in very early kernel initialization. */
15extern unsigned long reloc_offset(void);
16extern unsigned long add_reloc_offset(unsigned long);
17extern void reloc_got2(unsigned long);
18
19#define PTRRELOC(x)	((typeof(x)) add_reloc_offset((unsigned long)(x)))
20
21void check_for_initrd(void);
22void mem_topology_setup(void);
23void initmem_init(void);
24void setup_panic(void);
25#define ARCH_PANIC_TIMEOUT 180
26
27#ifdef CONFIG_PPC_PSERIES
28extern bool pseries_reloc_on_exception(void);
29extern bool pseries_enable_reloc_on_exc(void);
30extern void pseries_disable_reloc_on_exc(void);
31extern void pseries_big_endian_exceptions(void);
32void __init pseries_little_endian_exceptions(void);
33#else
34static inline bool pseries_reloc_on_exception(void) { return false; }
35static inline bool pseries_enable_reloc_on_exc(void) { return false; }
36static inline void pseries_disable_reloc_on_exc(void) {}
37static inline void pseries_big_endian_exceptions(void) {}
38static inline void pseries_little_endian_exceptions(void) {}
39#endif /* CONFIG_PPC_PSERIES */
40
41void rfi_flush_enable(bool enable);
42
43/* These are bit flags */
44enum l1d_flush_type {
45	L1D_FLUSH_NONE		= 0x1,
46	L1D_FLUSH_FALLBACK	= 0x2,
47	L1D_FLUSH_ORI		= 0x4,
48	L1D_FLUSH_MTTRIG	= 0x8,
49};
50
51void setup_rfi_flush(enum l1d_flush_type, bool enable);
52void setup_entry_flush(bool enable);
53void setup_uaccess_flush(bool enable);
54void do_rfi_flush_fixups(enum l1d_flush_type types);
55#ifdef CONFIG_PPC_BARRIER_NOSPEC
56void __init setup_barrier_nospec(void);
57#else
58static inline void setup_barrier_nospec(void) { }
59#endif
60void do_uaccess_flush_fixups(enum l1d_flush_type types);
61void do_entry_flush_fixups(enum l1d_flush_type types);
62void do_barrier_nospec_fixups(bool enable);
63extern bool barrier_nospec_enabled;
64
65#ifdef CONFIG_PPC_BARRIER_NOSPEC
66void do_barrier_nospec_fixups_range(bool enable, void *start, void *end);
67#else
68static inline void do_barrier_nospec_fixups_range(bool enable, void *start, void *end) { }
69#endif
70
71#ifdef CONFIG_PPC_E500
72void __init setup_spectre_v2(void);
73#else
74static inline void setup_spectre_v2(void) {}
75#endif
76void __init do_btb_flush_fixups(void);
77
78#ifdef CONFIG_PPC32
79unsigned long __init early_init(unsigned long dt_ptr);
80void __init machine_init(u64 dt_ptr);
81#endif
82void __init early_setup(unsigned long dt_ptr);
83void early_setup_secondary(void);
84
85/* prom_init (OpenFirmware) */
86unsigned long __init prom_init(unsigned long r3, unsigned long r4,
87			       unsigned long pp, unsigned long r6,
88			       unsigned long r7, unsigned long kbase);
89
90extern struct seq_buf ppc_hw_desc;
91
92#endif /* !__ASSEMBLY__ */
93
94#endif	/* _ASM_POWERPC_SETUP_H */
95
96