xref: /linux-6.15/arch/s390/include/asm/setup.h (revision 949b73c9)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  *  S390 version
4  *    Copyright IBM Corp. 1999, 2017
5  */
6 #ifndef _ASM_S390_SETUP_H
7 #define _ASM_S390_SETUP_H
8 
9 #include <linux/bits.h>
10 #include <uapi/asm/setup.h>
11 #include <linux/build_bug.h>
12 
13 #define PARMAREA		0x10400
14 
15 #define COMMAND_LINE_SIZE CONFIG_COMMAND_LINE_SIZE
16 /*
17  * Machine features detected in early.c
18  */
19 
20 #define MACHINE_FLAG_VM		BIT(0)
21 #define MACHINE_FLAG_KVM	BIT(1)
22 #define MACHINE_FLAG_LPAR	BIT(2)
23 #define MACHINE_FLAG_DIAG9C	BIT(3)
24 #define MACHINE_FLAG_ESOP	BIT(4)
25 #define MACHINE_FLAG_TE		BIT(11)
26 #define MACHINE_FLAG_TLB_GUEST	BIT(14)
27 #define MACHINE_FLAG_SCC	BIT(17)
28 #define MACHINE_FLAG_PCI_MIO	BIT(18)
29 
30 #define LPP_MAGIC		BIT(31)
31 #define LPP_PID_MASK		_AC(0xffffffff, UL)
32 
33 /* Offsets to entry points in kernel/head.S  */
34 
35 #define STARTUP_NORMAL_OFFSET	0x10000
36 #define STARTUP_KDUMP_OFFSET	0x10010
37 
38 #define LEGACY_COMMAND_LINE_SIZE	896
39 
40 #ifndef __ASSEMBLY__
41 
42 #include <asm/lowcore.h>
43 #include <asm/types.h>
44 
45 struct parmarea {
46 	unsigned long ipl_device;			/* 0x10400 */
47 	unsigned long initrd_start;			/* 0x10408 */
48 	unsigned long initrd_size;			/* 0x10410 */
49 	unsigned long oldmem_base;			/* 0x10418 */
50 	unsigned long oldmem_size;			/* 0x10420 */
51 	unsigned long kernel_version;			/* 0x10428 */
52 	unsigned long max_command_line_size;		/* 0x10430 */
53 	char pad1[0x10480-0x10438];			/* 0x10438 - 0x10480 */
54 	char command_line[COMMAND_LINE_SIZE];		/* 0x10480 */
55 };
56 
57 extern struct parmarea parmarea;
58 
59 extern unsigned int zlib_dfltcc_support;
60 #define ZLIB_DFLTCC_DISABLED		0
61 #define ZLIB_DFLTCC_FULL		1
62 #define ZLIB_DFLTCC_DEFLATE_ONLY	2
63 #define ZLIB_DFLTCC_INFLATE_ONLY	3
64 #define ZLIB_DFLTCC_FULL_DEBUG		4
65 
66 extern unsigned long ident_map_size;
67 extern unsigned long max_mappable;
68 
69 /* The Write Back bit position in the physaddr is given by the SLPC PCI */
70 extern unsigned long mio_wb_bit_mask;
71 
72 #define MACHINE_IS_VM		(get_lowcore()->machine_flags & MACHINE_FLAG_VM)
73 #define MACHINE_IS_KVM		(get_lowcore()->machine_flags & MACHINE_FLAG_KVM)
74 #define MACHINE_IS_LPAR		(get_lowcore()->machine_flags & MACHINE_FLAG_LPAR)
75 
76 #define MACHINE_HAS_DIAG9C	(get_lowcore()->machine_flags & MACHINE_FLAG_DIAG9C)
77 #define MACHINE_HAS_ESOP	(get_lowcore()->machine_flags & MACHINE_FLAG_ESOP)
78 #define MACHINE_HAS_TE		(get_lowcore()->machine_flags & MACHINE_FLAG_TE)
79 #define MACHINE_HAS_TLB_GUEST	(get_lowcore()->machine_flags & MACHINE_FLAG_TLB_GUEST)
80 #define MACHINE_HAS_SCC		(get_lowcore()->machine_flags & MACHINE_FLAG_SCC)
81 #define MACHINE_HAS_PCI_MIO	(get_lowcore()->machine_flags & MACHINE_FLAG_PCI_MIO)
82 
83 /*
84  * Console mode. Override with conmode=
85  */
86 extern unsigned int console_mode;
87 extern unsigned int console_devno;
88 extern unsigned int console_irq;
89 
90 #define CONSOLE_IS_UNDEFINED	(console_mode == 0)
91 #define CONSOLE_IS_SCLP		(console_mode == 1)
92 #define CONSOLE_IS_3215		(console_mode == 2)
93 #define CONSOLE_IS_3270		(console_mode == 3)
94 #define CONSOLE_IS_VT220	(console_mode == 4)
95 #define CONSOLE_IS_HVC		(console_mode == 5)
96 #define SET_CONSOLE_SCLP	do { console_mode = 1; } while (0)
97 #define SET_CONSOLE_3215	do { console_mode = 2; } while (0)
98 #define SET_CONSOLE_3270	do { console_mode = 3; } while (0)
99 #define SET_CONSOLE_VT220	do { console_mode = 4; } while (0)
100 #define SET_CONSOLE_HVC		do { console_mode = 5; } while (0)
101 
102 void register_early_console(void);
103 
104 #ifdef CONFIG_VMCP
105 void vmcp_cma_reserve(void);
106 #else
107 static inline void vmcp_cma_reserve(void) { }
108 #endif
109 
110 void report_user_fault(struct pt_regs *regs, long signr, int is_mm_fault);
111 
112 extern void (*_machine_restart)(char *command);
113 extern void (*_machine_halt)(void);
114 extern void (*_machine_power_off)(void);
115 
116 struct oldmem_data {
117 	unsigned long start;
118 	unsigned long size;
119 };
120 extern struct oldmem_data oldmem_data;
121 
122 static __always_inline u32 gen_lpswe(unsigned long addr)
123 {
124 	BUILD_BUG_ON(addr > 0xfff);
125 	return 0xb2b20000 | addr;
126 }
127 #endif /* __ASSEMBLY__ */
128 #endif /* _ASM_S390_SETUP_H */
129