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