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