xref: /linux/arch/s390/include/asm/setup.h (revision 87c9c16317882dd6dbbc07e349bc3223e14f3244)
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 unsigned int zlib_dfltcc_support;
82 #define ZLIB_DFLTCC_DISABLED		0
83 #define ZLIB_DFLTCC_FULL		1
84 #define ZLIB_DFLTCC_DEFLATE_ONLY	2
85 #define ZLIB_DFLTCC_INFLATE_ONLY	3
86 #define ZLIB_DFLTCC_FULL_DEBUG		4
87 
88 extern int noexec_disabled;
89 extern unsigned long ident_map_size;
90 extern unsigned long vmalloc_size;
91 
92 /* The Write Back bit position in the physaddr is given by the SLPC PCI */
93 extern unsigned long mio_wb_bit_mask;
94 
95 #define MACHINE_IS_VM		(S390_lowcore.machine_flags & MACHINE_FLAG_VM)
96 #define MACHINE_IS_KVM		(S390_lowcore.machine_flags & MACHINE_FLAG_KVM)
97 #define MACHINE_IS_LPAR		(S390_lowcore.machine_flags & MACHINE_FLAG_LPAR)
98 
99 #define MACHINE_HAS_DIAG9C	(S390_lowcore.machine_flags & MACHINE_FLAG_DIAG9C)
100 #define MACHINE_HAS_ESOP	(S390_lowcore.machine_flags & MACHINE_FLAG_ESOP)
101 #define MACHINE_HAS_IDTE	(S390_lowcore.machine_flags & MACHINE_FLAG_IDTE)
102 #define MACHINE_HAS_EDAT1	(S390_lowcore.machine_flags & MACHINE_FLAG_EDAT1)
103 #define MACHINE_HAS_EDAT2	(S390_lowcore.machine_flags & MACHINE_FLAG_EDAT2)
104 #define MACHINE_HAS_TOPOLOGY	(S390_lowcore.machine_flags & MACHINE_FLAG_TOPOLOGY)
105 #define MACHINE_HAS_TE		(S390_lowcore.machine_flags & MACHINE_FLAG_TE)
106 #define MACHINE_HAS_TLB_LC	(S390_lowcore.machine_flags & MACHINE_FLAG_TLB_LC)
107 #define MACHINE_HAS_VX		(S390_lowcore.machine_flags & MACHINE_FLAG_VX)
108 #define MACHINE_HAS_TLB_GUEST	(S390_lowcore.machine_flags & MACHINE_FLAG_TLB_GUEST)
109 #define MACHINE_HAS_NX		(S390_lowcore.machine_flags & MACHINE_FLAG_NX)
110 #define MACHINE_HAS_GS		(S390_lowcore.machine_flags & MACHINE_FLAG_GS)
111 #define MACHINE_HAS_SCC		(S390_lowcore.machine_flags & MACHINE_FLAG_SCC)
112 
113 /*
114  * Console mode. Override with conmode=
115  */
116 extern unsigned int console_mode;
117 extern unsigned int console_devno;
118 extern unsigned int console_irq;
119 
120 #define CONSOLE_IS_UNDEFINED	(console_mode == 0)
121 #define CONSOLE_IS_SCLP		(console_mode == 1)
122 #define CONSOLE_IS_3215		(console_mode == 2)
123 #define CONSOLE_IS_3270		(console_mode == 3)
124 #define CONSOLE_IS_VT220	(console_mode == 4)
125 #define CONSOLE_IS_HVC		(console_mode == 5)
126 #define SET_CONSOLE_SCLP	do { console_mode = 1; } while (0)
127 #define SET_CONSOLE_3215	do { console_mode = 2; } while (0)
128 #define SET_CONSOLE_3270	do { console_mode = 3; } while (0)
129 #define SET_CONSOLE_VT220	do { console_mode = 4; } while (0)
130 #define SET_CONSOLE_HVC		do { console_mode = 5; } while (0)
131 
132 #ifdef CONFIG_PFAULT
133 extern int pfault_init(void);
134 extern void pfault_fini(void);
135 #else /* CONFIG_PFAULT */
136 #define pfault_init()		({-1;})
137 #define pfault_fini()		do { } while (0)
138 #endif /* CONFIG_PFAULT */
139 
140 #ifdef CONFIG_VMCP
141 void vmcp_cma_reserve(void);
142 #else
143 static inline void vmcp_cma_reserve(void) { }
144 #endif
145 
146 void report_user_fault(struct pt_regs *regs, long signr, int is_mm_fault);
147 
148 void cmma_init(void);
149 void cmma_init_nodat(void);
150 
151 extern void (*_machine_restart)(char *command);
152 extern void (*_machine_halt)(void);
153 extern void (*_machine_power_off)(void);
154 
155 extern unsigned long __kaslr_offset;
156 static inline unsigned long kaslr_offset(void)
157 {
158 	return __kaslr_offset;
159 }
160 
161 static inline u32 gen_lpswe(unsigned long addr)
162 {
163 	BUILD_BUG_ON(addr > 0xfff);
164 	return 0xb2b20000 | addr;
165 }
166 
167 #else /* __ASSEMBLY__ */
168 
169 #define IPL_DEVICE	(IPL_DEVICE_OFFSET)
170 #define INITRD_START	(INITRD_START_OFFSET)
171 #define INITRD_SIZE	(INITRD_SIZE_OFFSET)
172 #define OLDMEM_BASE	(OLDMEM_BASE_OFFSET)
173 #define OLDMEM_SIZE	(OLDMEM_SIZE_OFFSET)
174 #define COMMAND_LINE	(COMMAND_LINE_OFFSET)
175 
176 #endif /* __ASSEMBLY__ */
177 #endif /* _ASM_S390_SETUP_H */
178