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