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