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