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