xref: /openbmc/linux/arch/s390/include/asm/setup.h (revision 808643ea)
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 EP_OFFSET		0x10008
14 #define EP_STRING		"S390EP"
15 #define PARMAREA		0x10400
16 #define EARLY_SCCB_OFFSET	0x11000
17 #define HEAD_END		0x12000
18 
19 /*
20  * Machine features detected in early.c
21  */
22 
23 #define MACHINE_FLAG_VM		BIT(0)
24 #define MACHINE_FLAG_KVM	BIT(1)
25 #define MACHINE_FLAG_LPAR	BIT(2)
26 #define MACHINE_FLAG_DIAG9C	BIT(3)
27 #define MACHINE_FLAG_ESOP	BIT(4)
28 #define MACHINE_FLAG_IDTE	BIT(5)
29 #define MACHINE_FLAG_EDAT1	BIT(7)
30 #define MACHINE_FLAG_EDAT2	BIT(8)
31 #define MACHINE_FLAG_TOPOLOGY	BIT(10)
32 #define MACHINE_FLAG_TE		BIT(11)
33 #define MACHINE_FLAG_TLB_LC	BIT(12)
34 #define MACHINE_FLAG_VX		BIT(13)
35 #define MACHINE_FLAG_TLB_GUEST	BIT(14)
36 #define MACHINE_FLAG_NX		BIT(15)
37 #define MACHINE_FLAG_GS		BIT(16)
38 #define MACHINE_FLAG_SCC	BIT(17)
39 
40 #define LPP_MAGIC		BIT(31)
41 #define LPP_PID_MASK		_AC(0xffffffff, UL)
42 
43 /* Offsets to entry points in kernel/head.S  */
44 
45 #define STARTUP_NORMAL_OFFSET	0x10000
46 #define STARTUP_KDUMP_OFFSET	0x10010
47 
48 /* Offsets to parameters in kernel/head.S  */
49 
50 #define IPL_DEVICE_OFFSET	0x10400
51 #define INITRD_START_OFFSET	0x10408
52 #define INITRD_SIZE_OFFSET	0x10410
53 #define OLDMEM_BASE_OFFSET	0x10418
54 #define OLDMEM_SIZE_OFFSET	0x10420
55 #define KERNEL_VERSION_OFFSET	0x10428
56 #define COMMAND_LINE_OFFSET	0x10480
57 
58 #ifndef __ASSEMBLY__
59 
60 #include <asm/lowcore.h>
61 #include <asm/types.h>
62 
63 #define IPL_DEVICE	(*(unsigned long *)  (IPL_DEVICE_OFFSET))
64 #define INITRD_START	(*(unsigned long *)  (INITRD_START_OFFSET))
65 #define INITRD_SIZE	(*(unsigned long *)  (INITRD_SIZE_OFFSET))
66 #define OLDMEM_BASE	(*(unsigned long *)  (OLDMEM_BASE_OFFSET))
67 #define OLDMEM_SIZE	(*(unsigned long *)  (OLDMEM_SIZE_OFFSET))
68 #define COMMAND_LINE	((char *)	     (COMMAND_LINE_OFFSET))
69 
70 struct parmarea {
71 	unsigned long ipl_device;			/* 0x10400 */
72 	unsigned long initrd_start;			/* 0x10408 */
73 	unsigned long initrd_size;			/* 0x10410 */
74 	unsigned long oldmem_base;			/* 0x10418 */
75 	unsigned long oldmem_size;			/* 0x10420 */
76 	unsigned long kernel_version;			/* 0x10428 */
77 	char pad1[0x10480 - 0x10430];			/* 0x10430 - 0x10480 */
78 	char command_line[ARCH_COMMAND_LINE_SIZE];	/* 0x10480 */
79 };
80 
81 extern struct parmarea parmarea;
82 
83 extern unsigned int zlib_dfltcc_support;
84 #define ZLIB_DFLTCC_DISABLED		0
85 #define ZLIB_DFLTCC_FULL		1
86 #define ZLIB_DFLTCC_DEFLATE_ONLY	2
87 #define ZLIB_DFLTCC_INFLATE_ONLY	3
88 #define ZLIB_DFLTCC_FULL_DEBUG		4
89 
90 extern int noexec_disabled;
91 extern unsigned long ident_map_size;
92 
93 /* The Write Back bit position in the physaddr is given by the SLPC PCI */
94 extern unsigned long mio_wb_bit_mask;
95 
96 #define MACHINE_IS_VM		(S390_lowcore.machine_flags & MACHINE_FLAG_VM)
97 #define MACHINE_IS_KVM		(S390_lowcore.machine_flags & MACHINE_FLAG_KVM)
98 #define MACHINE_IS_LPAR		(S390_lowcore.machine_flags & MACHINE_FLAG_LPAR)
99 
100 #define MACHINE_HAS_DIAG9C	(S390_lowcore.machine_flags & MACHINE_FLAG_DIAG9C)
101 #define MACHINE_HAS_ESOP	(S390_lowcore.machine_flags & MACHINE_FLAG_ESOP)
102 #define MACHINE_HAS_IDTE	(S390_lowcore.machine_flags & MACHINE_FLAG_IDTE)
103 #define MACHINE_HAS_EDAT1	(S390_lowcore.machine_flags & MACHINE_FLAG_EDAT1)
104 #define MACHINE_HAS_EDAT2	(S390_lowcore.machine_flags & MACHINE_FLAG_EDAT2)
105 #define MACHINE_HAS_TOPOLOGY	(S390_lowcore.machine_flags & MACHINE_FLAG_TOPOLOGY)
106 #define MACHINE_HAS_TE		(S390_lowcore.machine_flags & MACHINE_FLAG_TE)
107 #define MACHINE_HAS_TLB_LC	(S390_lowcore.machine_flags & MACHINE_FLAG_TLB_LC)
108 #define MACHINE_HAS_VX		(S390_lowcore.machine_flags & MACHINE_FLAG_VX)
109 #define MACHINE_HAS_TLB_GUEST	(S390_lowcore.machine_flags & MACHINE_FLAG_TLB_GUEST)
110 #define MACHINE_HAS_NX		(S390_lowcore.machine_flags & MACHINE_FLAG_NX)
111 #define MACHINE_HAS_GS		(S390_lowcore.machine_flags & MACHINE_FLAG_GS)
112 #define MACHINE_HAS_SCC		(S390_lowcore.machine_flags & MACHINE_FLAG_SCC)
113 
114 /*
115  * Console mode. Override with conmode=
116  */
117 extern unsigned int console_mode;
118 extern unsigned int console_devno;
119 extern unsigned int console_irq;
120 
121 #define CONSOLE_IS_UNDEFINED	(console_mode == 0)
122 #define CONSOLE_IS_SCLP		(console_mode == 1)
123 #define CONSOLE_IS_3215		(console_mode == 2)
124 #define CONSOLE_IS_3270		(console_mode == 3)
125 #define CONSOLE_IS_VT220	(console_mode == 4)
126 #define CONSOLE_IS_HVC		(console_mode == 5)
127 #define SET_CONSOLE_SCLP	do { console_mode = 1; } while (0)
128 #define SET_CONSOLE_3215	do { console_mode = 2; } while (0)
129 #define SET_CONSOLE_3270	do { console_mode = 3; } while (0)
130 #define SET_CONSOLE_VT220	do { console_mode = 4; } while (0)
131 #define SET_CONSOLE_HVC		do { console_mode = 5; } while (0)
132 
133 #ifdef CONFIG_PFAULT
134 extern int pfault_init(void);
135 extern void pfault_fini(void);
136 #else /* CONFIG_PFAULT */
137 #define pfault_init()		({-1;})
138 #define pfault_fini()		do { } while (0)
139 #endif /* CONFIG_PFAULT */
140 
141 #ifdef CONFIG_VMCP
142 void vmcp_cma_reserve(void);
143 #else
144 static inline void vmcp_cma_reserve(void) { }
145 #endif
146 
147 void report_user_fault(struct pt_regs *regs, long signr, int is_mm_fault);
148 
149 void cmma_init(void);
150 void cmma_init_nodat(void);
151 
152 extern void (*_machine_restart)(char *command);
153 extern void (*_machine_halt)(void);
154 extern void (*_machine_power_off)(void);
155 
156 extern unsigned long __kaslr_offset;
157 static inline unsigned long kaslr_offset(void)
158 {
159 	return __kaslr_offset;
160 }
161 
162 extern int is_full_image;
163 
164 static inline u32 gen_lpswe(unsigned long addr)
165 {
166 	BUILD_BUG_ON(addr > 0xfff);
167 	return 0xb2b20000 | addr;
168 }
169 
170 #else /* __ASSEMBLY__ */
171 
172 #define IPL_DEVICE	(IPL_DEVICE_OFFSET)
173 #define INITRD_START	(INITRD_START_OFFSET)
174 #define INITRD_SIZE	(INITRD_SIZE_OFFSET)
175 #define OLDMEM_BASE	(OLDMEM_BASE_OFFSET)
176 #define OLDMEM_SIZE	(OLDMEM_SIZE_OFFSET)
177 #define COMMAND_LINE	(COMMAND_LINE_OFFSET)
178 
179 #endif /* __ASSEMBLY__ */
180 #endif /* _ASM_S390_SETUP_H */
181