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