blob: d0d3dd531c7fc62fbc15a0be450b5e6ec0dddecc [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Anton Blanchard560285c2012-11-01 14:55:04 +00002#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 int rtas_data;
Anton Blanchard560285c2012-11-01 14:55:04 +000011extern unsigned long long memory_limit;
Anton Blanchard560285c2012-11-01 14:55:04 +000012extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask);
13
Anton Blanchard560285c2012-11-01 14:55:04 +000014struct device_node;
15extern void note_scsi_host(struct device_node *, void *);
16
17/* Used in very early kernel initialization. */
18extern unsigned long reloc_offset(void);
19extern unsigned long add_reloc_offset(unsigned long);
20extern void reloc_got2(unsigned long);
21
22#define PTRRELOC(x) ((typeof(x)) add_reloc_offset((unsigned long)(x)))
23
Robert Jenningsb88c4762013-10-28 09:20:51 -050024void check_for_initrd(void);
Nicholas Piggin9bd9be02018-02-14 01:08:16 +100025void mem_topology_setup(void);
Anton Blanchard10239732014-09-17 22:15:33 +100026void initmem_init(void);
David Gibsonab9dbf72017-12-04 16:27:25 +110027void setup_panic(void);
Jason Baronb71d47c2013-11-25 23:23:11 +000028#define ARCH_PANIC_TIMEOUT 180
Robert Jenningsb88c4762013-10-28 09:20:51 -050029
Benjamin Herrenschmidtd3cbff12016-07-05 15:03:49 +100030#ifdef CONFIG_PPC_PSERIES
Nicholas Piggin7fa95f92020-06-11 18:12:03 +100031extern bool pseries_enable_reloc_on_exc(void);
Benjamin Herrenschmidtd3cbff12016-07-05 15:03:49 +100032extern void pseries_disable_reloc_on_exc(void);
33extern void pseries_big_endian_exceptions(void);
Nick Childe14ff962021-12-16 17:00:27 -050034void __init pseries_little_endian_exceptions(void);
Benjamin Herrenschmidtd3cbff12016-07-05 15:03:49 +100035#else
Nicholas Piggin7fa95f92020-06-11 18:12:03 +100036static inline bool pseries_enable_reloc_on_exc(void) { return false; }
Benjamin Herrenschmidtd3cbff12016-07-05 15:03:49 +100037static inline void pseries_disable_reloc_on_exc(void) {}
38static inline void pseries_big_endian_exceptions(void) {}
39static inline void pseries_little_endian_exceptions(void) {}
40#endif /* CONFIG_PPC_PSERIES */
41
Michael Ellermanaa8a5e02018-01-10 03:07:15 +110042void rfi_flush_enable(bool enable);
43
44/* These are bit flags */
45enum l1d_flush_type {
46 L1D_FLUSH_NONE = 0x1,
47 L1D_FLUSH_FALLBACK = 0x2,
48 L1D_FLUSH_ORI = 0x4,
49 L1D_FLUSH_MTTRIG = 0x8,
50};
51
Michael Ellermanabf110f2018-03-14 19:40:39 -030052void setup_rfi_flush(enum l1d_flush_type, bool enable);
Nicholas Pigginf7964372020-11-17 16:59:12 +110053void setup_entry_flush(bool enable);
54void setup_uaccess_flush(bool enable);
Michael Ellermanaa8a5e02018-01-10 03:07:15 +110055void do_rfi_flush_fixups(enum l1d_flush_type types);
Michael Ellermanaf375ee2018-07-28 09:06:35 +100056#ifdef CONFIG_PPC_BARRIER_NOSPEC
Nick Childd2769602021-12-16 17:00:16 -050057void __init setup_barrier_nospec(void);
Michael Ellermanaf375ee2018-07-28 09:06:35 +100058#else
Chengyang Fan6c6fdbb2021-01-25 17:53:38 +080059static inline void setup_barrier_nospec(void) { }
Michael Ellermanaf375ee2018-07-28 09:06:35 +100060#endif
Nicholas Piggin9a32a7e2020-11-17 16:59:13 +110061void do_uaccess_flush_fixups(enum l1d_flush_type types);
Nicholas Pigginf7964372020-11-17 16:59:12 +110062void do_entry_flush_fixups(enum l1d_flush_type types);
Michal Suchanek2eea7f02018-04-24 14:15:55 +100063void do_barrier_nospec_fixups(bool enable);
Michal Suchanek815069c2018-04-24 14:15:56 +100064extern bool barrier_nospec_enabled;
65
Michael Ellerman179ab1c2018-07-28 09:06:34 +100066#ifdef CONFIG_PPC_BARRIER_NOSPEC
Michal Suchanek815069c2018-04-24 14:15:56 +100067void do_barrier_nospec_fixups_range(bool enable, void *start, void *end);
68#else
Chengyang Fan6c6fdbb2021-01-25 17:53:38 +080069static inline void do_barrier_nospec_fixups_range(bool enable, void *start, void *end) { }
Michal Suchanek815069c2018-04-24 14:15:56 +100070#endif
Michael Ellermanaa8a5e02018-01-10 03:07:15 +110071
Diana Craciunf633a8a2018-12-12 16:03:04 +020072#ifdef CONFIG_PPC_FSL_BOOK3E
Nick Childd2769602021-12-16 17:00:16 -050073void __init setup_spectre_v2(void);
Diana Craciunf633a8a2018-12-12 16:03:04 +020074#else
Chengyang Fan6c6fdbb2021-01-25 17:53:38 +080075static inline void setup_spectre_v2(void) {}
Diana Craciunf633a8a2018-12-12 16:03:04 +020076#endif
Nick Childce0c6be2021-12-16 17:00:17 -050077void __init do_btb_flush_fixups(void);
Diana Craciun76a5eaa2018-12-12 16:03:00 +020078
Anton Blanchard560285c2012-11-01 14:55:04 +000079#endif /* !__ASSEMBLY__ */
80
81#endif /* _ASM_POWERPC_SETUP_H */
82