xref: /linux/arch/s390/include/asm/setup.h (revision a3a02a52bcfcbcc4a637d4b68bf1bc391c9fad02)
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 PARMAREA		0x10400
14 
15 #define COMMAND_LINE_SIZE CONFIG_COMMAND_LINE_SIZE
16 /*
17  * Machine features detected in early.c
18  */
19 
20 #define MACHINE_FLAG_VM		BIT(0)
21 #define MACHINE_FLAG_KVM	BIT(1)
22 #define MACHINE_FLAG_LPAR	BIT(2)
23 #define MACHINE_FLAG_DIAG9C	BIT(3)
24 #define MACHINE_FLAG_ESOP	BIT(4)
25 #define MACHINE_FLAG_IDTE	BIT(5)
26 #define MACHINE_FLAG_EDAT1	BIT(7)
27 #define MACHINE_FLAG_EDAT2	BIT(8)
28 #define MACHINE_FLAG_TOPOLOGY	BIT(10)
29 #define MACHINE_FLAG_TE		BIT(11)
30 #define MACHINE_FLAG_TLB_LC	BIT(12)
31 #define MACHINE_FLAG_TLB_GUEST	BIT(14)
32 #define MACHINE_FLAG_NX		BIT(15)
33 #define MACHINE_FLAG_GS		BIT(16)
34 #define MACHINE_FLAG_SCC	BIT(17)
35 #define MACHINE_FLAG_PCI_MIO	BIT(18)
36 #define MACHINE_FLAG_RDP	BIT(19)
37 
38 #define LPP_MAGIC		BIT(31)
39 #define LPP_PID_MASK		_AC(0xffffffff, UL)
40 
41 /* Offsets to entry points in kernel/head.S  */
42 
43 #define STARTUP_NORMAL_OFFSET	0x10000
44 #define STARTUP_KDUMP_OFFSET	0x10010
45 
46 #define LEGACY_COMMAND_LINE_SIZE	896
47 
48 #ifndef __ASSEMBLY__
49 
50 #include <asm/lowcore.h>
51 #include <asm/types.h>
52 
53 struct parmarea {
54 	unsigned long ipl_device;			/* 0x10400 */
55 	unsigned long initrd_start;			/* 0x10408 */
56 	unsigned long initrd_size;			/* 0x10410 */
57 	unsigned long oldmem_base;			/* 0x10418 */
58 	unsigned long oldmem_size;			/* 0x10420 */
59 	unsigned long kernel_version;			/* 0x10428 */
60 	unsigned long max_command_line_size;		/* 0x10430 */
61 	char pad1[0x10480-0x10438];			/* 0x10438 - 0x10480 */
62 	char command_line[COMMAND_LINE_SIZE];		/* 0x10480 */
63 };
64 
65 extern struct parmarea parmarea;
66 
67 extern unsigned int zlib_dfltcc_support;
68 #define ZLIB_DFLTCC_DISABLED		0
69 #define ZLIB_DFLTCC_FULL		1
70 #define ZLIB_DFLTCC_DEFLATE_ONLY	2
71 #define ZLIB_DFLTCC_INFLATE_ONLY	3
72 #define ZLIB_DFLTCC_FULL_DEBUG		4
73 
74 extern unsigned long ident_map_size;
75 extern unsigned long max_mappable;
76 
77 /* The Write Back bit position in the physaddr is given by the SLPC PCI */
78 extern unsigned long mio_wb_bit_mask;
79 
80 #define MACHINE_IS_VM		(get_lowcore()->machine_flags & MACHINE_FLAG_VM)
81 #define MACHINE_IS_KVM		(get_lowcore()->machine_flags & MACHINE_FLAG_KVM)
82 #define MACHINE_IS_LPAR		(get_lowcore()->machine_flags & MACHINE_FLAG_LPAR)
83 
84 #define MACHINE_HAS_DIAG9C	(get_lowcore()->machine_flags & MACHINE_FLAG_DIAG9C)
85 #define MACHINE_HAS_ESOP	(get_lowcore()->machine_flags & MACHINE_FLAG_ESOP)
86 #define MACHINE_HAS_IDTE	(get_lowcore()->machine_flags & MACHINE_FLAG_IDTE)
87 #define MACHINE_HAS_EDAT1	(get_lowcore()->machine_flags & MACHINE_FLAG_EDAT1)
88 #define MACHINE_HAS_EDAT2	(get_lowcore()->machine_flags & MACHINE_FLAG_EDAT2)
89 #define MACHINE_HAS_TOPOLOGY	(get_lowcore()->machine_flags & MACHINE_FLAG_TOPOLOGY)
90 #define MACHINE_HAS_TE		(get_lowcore()->machine_flags & MACHINE_FLAG_TE)
91 #define MACHINE_HAS_TLB_LC	(get_lowcore()->machine_flags & MACHINE_FLAG_TLB_LC)
92 #define MACHINE_HAS_TLB_GUEST	(get_lowcore()->machine_flags & MACHINE_FLAG_TLB_GUEST)
93 #define MACHINE_HAS_NX		(get_lowcore()->machine_flags & MACHINE_FLAG_NX)
94 #define MACHINE_HAS_GS		(get_lowcore()->machine_flags & MACHINE_FLAG_GS)
95 #define MACHINE_HAS_SCC		(get_lowcore()->machine_flags & MACHINE_FLAG_SCC)
96 #define MACHINE_HAS_PCI_MIO	(get_lowcore()->machine_flags & MACHINE_FLAG_PCI_MIO)
97 #define MACHINE_HAS_RDP		(get_lowcore()->machine_flags & MACHINE_FLAG_RDP)
98 
99 /*
100  * Console mode. Override with conmode=
101  */
102 extern unsigned int console_mode;
103 extern unsigned int console_devno;
104 extern unsigned int console_irq;
105 
106 #define CONSOLE_IS_UNDEFINED	(console_mode == 0)
107 #define CONSOLE_IS_SCLP		(console_mode == 1)
108 #define CONSOLE_IS_3215		(console_mode == 2)
109 #define CONSOLE_IS_3270		(console_mode == 3)
110 #define CONSOLE_IS_VT220	(console_mode == 4)
111 #define CONSOLE_IS_HVC		(console_mode == 5)
112 #define SET_CONSOLE_SCLP	do { console_mode = 1; } while (0)
113 #define SET_CONSOLE_3215	do { console_mode = 2; } while (0)
114 #define SET_CONSOLE_3270	do { console_mode = 3; } while (0)
115 #define SET_CONSOLE_VT220	do { console_mode = 4; } while (0)
116 #define SET_CONSOLE_HVC		do { console_mode = 5; } while (0)
117 
118 #ifdef CONFIG_VMCP
119 void vmcp_cma_reserve(void);
120 #else
121 static inline void vmcp_cma_reserve(void) { }
122 #endif
123 
124 void report_user_fault(struct pt_regs *regs, long signr, int is_mm_fault);
125 
126 extern void (*_machine_restart)(char *command);
127 extern void (*_machine_halt)(void);
128 extern void (*_machine_power_off)(void);
129 
130 struct oldmem_data {
131 	unsigned long start;
132 	unsigned long size;
133 };
134 extern struct oldmem_data oldmem_data;
135 
136 static __always_inline u32 gen_lpswe(unsigned long addr)
137 {
138 	BUILD_BUG_ON(addr > 0xfff);
139 	return 0xb2b20000 | addr;
140 }
141 #endif /* __ASSEMBLY__ */
142 #endif /* _ASM_S390_SETUP_H */
143