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