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