162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#ifndef _ASM_POWERPC_SETUP_H
362306a36Sopenharmony_ci#define _ASM_POWERPC_SETUP_H
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#include <uapi/asm/setup.h>
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci#ifndef __ASSEMBLY__
862306a36Sopenharmony_ciextern void ppc_printk_progress(char *s, unsigned short hex);
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ciextern unsigned long long memory_limit;
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_cistruct device_node;
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci/* Used in very early kernel initialization. */
1562306a36Sopenharmony_ciextern unsigned long reloc_offset(void);
1662306a36Sopenharmony_ciextern unsigned long add_reloc_offset(unsigned long);
1762306a36Sopenharmony_ciextern void reloc_got2(unsigned long);
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci#define PTRRELOC(x)	((typeof(x)) add_reloc_offset((unsigned long)(x)))
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_civoid check_for_initrd(void);
2262306a36Sopenharmony_civoid mem_topology_setup(void);
2362306a36Sopenharmony_civoid initmem_init(void);
2462306a36Sopenharmony_civoid setup_panic(void);
2562306a36Sopenharmony_ci#define ARCH_PANIC_TIMEOUT 180
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci#ifdef CONFIG_PPC_PSERIES
2862306a36Sopenharmony_ciextern bool pseries_reloc_on_exception(void);
2962306a36Sopenharmony_ciextern bool pseries_enable_reloc_on_exc(void);
3062306a36Sopenharmony_ciextern void pseries_disable_reloc_on_exc(void);
3162306a36Sopenharmony_ciextern void pseries_big_endian_exceptions(void);
3262306a36Sopenharmony_civoid __init pseries_little_endian_exceptions(void);
3362306a36Sopenharmony_ci#else
3462306a36Sopenharmony_cistatic inline bool pseries_reloc_on_exception(void) { return false; }
3562306a36Sopenharmony_cistatic inline bool pseries_enable_reloc_on_exc(void) { return false; }
3662306a36Sopenharmony_cistatic inline void pseries_disable_reloc_on_exc(void) {}
3762306a36Sopenharmony_cistatic inline void pseries_big_endian_exceptions(void) {}
3862306a36Sopenharmony_cistatic inline void pseries_little_endian_exceptions(void) {}
3962306a36Sopenharmony_ci#endif /* CONFIG_PPC_PSERIES */
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_civoid rfi_flush_enable(bool enable);
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci/* These are bit flags */
4462306a36Sopenharmony_cienum l1d_flush_type {
4562306a36Sopenharmony_ci	L1D_FLUSH_NONE		= 0x1,
4662306a36Sopenharmony_ci	L1D_FLUSH_FALLBACK	= 0x2,
4762306a36Sopenharmony_ci	L1D_FLUSH_ORI		= 0x4,
4862306a36Sopenharmony_ci	L1D_FLUSH_MTTRIG	= 0x8,
4962306a36Sopenharmony_ci};
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_civoid setup_rfi_flush(enum l1d_flush_type, bool enable);
5262306a36Sopenharmony_civoid setup_entry_flush(bool enable);
5362306a36Sopenharmony_civoid setup_uaccess_flush(bool enable);
5462306a36Sopenharmony_civoid do_rfi_flush_fixups(enum l1d_flush_type types);
5562306a36Sopenharmony_ci#ifdef CONFIG_PPC_BARRIER_NOSPEC
5662306a36Sopenharmony_civoid __init setup_barrier_nospec(void);
5762306a36Sopenharmony_ci#else
5862306a36Sopenharmony_cistatic inline void setup_barrier_nospec(void) { }
5962306a36Sopenharmony_ci#endif
6062306a36Sopenharmony_civoid do_uaccess_flush_fixups(enum l1d_flush_type types);
6162306a36Sopenharmony_civoid do_entry_flush_fixups(enum l1d_flush_type types);
6262306a36Sopenharmony_civoid do_barrier_nospec_fixups(bool enable);
6362306a36Sopenharmony_ciextern bool barrier_nospec_enabled;
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci#ifdef CONFIG_PPC_BARRIER_NOSPEC
6662306a36Sopenharmony_civoid do_barrier_nospec_fixups_range(bool enable, void *start, void *end);
6762306a36Sopenharmony_ci#else
6862306a36Sopenharmony_cistatic inline void do_barrier_nospec_fixups_range(bool enable, void *start, void *end) { }
6962306a36Sopenharmony_ci#endif
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ci#ifdef CONFIG_PPC_E500
7262306a36Sopenharmony_civoid __init setup_spectre_v2(void);
7362306a36Sopenharmony_ci#else
7462306a36Sopenharmony_cistatic inline void setup_spectre_v2(void) {}
7562306a36Sopenharmony_ci#endif
7662306a36Sopenharmony_civoid __init do_btb_flush_fixups(void);
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ci#ifdef CONFIG_PPC32
7962306a36Sopenharmony_ciunsigned long __init early_init(unsigned long dt_ptr);
8062306a36Sopenharmony_civoid __init machine_init(u64 dt_ptr);
8162306a36Sopenharmony_ci#endif
8262306a36Sopenharmony_civoid __init early_setup(unsigned long dt_ptr);
8362306a36Sopenharmony_civoid early_setup_secondary(void);
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_ci/* prom_init (OpenFirmware) */
8662306a36Sopenharmony_ciunsigned long __init prom_init(unsigned long r3, unsigned long r4,
8762306a36Sopenharmony_ci			       unsigned long pp, unsigned long r6,
8862306a36Sopenharmony_ci			       unsigned long r7, unsigned long kbase);
8962306a36Sopenharmony_ci
9062306a36Sopenharmony_ciextern struct seq_buf ppc_hw_desc;
9162306a36Sopenharmony_ci
9262306a36Sopenharmony_ci#endif /* !__ASSEMBLY__ */
9362306a36Sopenharmony_ci
9462306a36Sopenharmony_ci#endif	/* _ASM_POWERPC_SETUP_H */
9562306a36Sopenharmony_ci
96