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