Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * S390 version |
Philipp Rudo | 15ceb8c | 2017-06-27 12:44:11 +0200 | [diff] [blame] | 4 | * Copyright IBM Corp. 1999, 2017 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | #ifndef _ASM_S390_SETUP_H |
| 7 | #define _ASM_S390_SETUP_H |
| 8 | |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 9 | #include <linux/const.h> |
David Howells | 9807f75 | 2012-10-09 09:47:31 +0100 | [diff] [blame] | 10 | #include <uapi/asm/setup.h> |
Hendrik Brueckner | a0443fb | 2008-07-14 09:59:09 +0200 | [diff] [blame] | 11 | |
Vasily Gorbik | 627c9b6 | 2018-06-25 13:59:35 +0200 | [diff] [blame] | 12 | #define EP_OFFSET 0x10008 |
| 13 | #define EP_STRING "S390EP" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | #define PARMAREA 0x10400 |
Vasily Gorbik | 514211f | 2018-06-12 16:46:59 +0200 | [diff] [blame] | 15 | #define PARMAREA_END 0x11000 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 17 | /* |
Christian Borntraeger | d7ae65a | 2015-12-15 09:26:30 +0100 | [diff] [blame] | 18 | * Machine features detected in early.c |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 19 | */ |
| 20 | |
| 21 | #define MACHINE_FLAG_VM _BITUL(0) |
Christian Borntraeger | d7ae65a | 2015-12-15 09:26:30 +0100 | [diff] [blame] | 22 | #define MACHINE_FLAG_KVM _BITUL(1) |
| 23 | #define MACHINE_FLAG_LPAR _BITUL(2) |
| 24 | #define MACHINE_FLAG_DIAG9C _BITUL(3) |
| 25 | #define MACHINE_FLAG_ESOP _BITUL(4) |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 26 | #define MACHINE_FLAG_IDTE _BITUL(5) |
Christian Borntraeger | d7ae65a | 2015-12-15 09:26:30 +0100 | [diff] [blame] | 27 | #define MACHINE_FLAG_DIAG44 _BITUL(6) |
| 28 | #define MACHINE_FLAG_EDAT1 _BITUL(7) |
| 29 | #define MACHINE_FLAG_EDAT2 _BITUL(8) |
Christian Borntraeger | d7ae65a | 2015-12-15 09:26:30 +0100 | [diff] [blame] | 30 | #define MACHINE_FLAG_TOPOLOGY _BITUL(10) |
| 31 | #define MACHINE_FLAG_TE _BITUL(11) |
| 32 | #define MACHINE_FLAG_TLB_LC _BITUL(12) |
| 33 | #define MACHINE_FLAG_VX _BITUL(13) |
Martin Schwidefsky | 118bd31 | 2016-07-26 16:53:09 +0200 | [diff] [blame] | 34 | #define MACHINE_FLAG_TLB_GUEST _BITUL(14) |
| 35 | #define MACHINE_FLAG_NX _BITUL(15) |
| 36 | #define MACHINE_FLAG_GS _BITUL(16) |
Martin Schwidefsky | 6e2ef5e | 2016-10-27 12:41:39 +0200 | [diff] [blame] | 37 | #define MACHINE_FLAG_SCC _BITUL(17) |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 38 | |
Christian Borntraeger | e22cf8c | 2015-10-06 18:06:15 +0200 | [diff] [blame] | 39 | #define LPP_MAGIC _BITUL(31) |
Hendrik Brueckner | 544e8dd | 2016-03-08 14:00:23 +0100 | [diff] [blame] | 40 | #define LPP_PID_MASK _AC(0xffffffff, UL) |
Christian Borntraeger | e22cf8c | 2015-10-06 18:06:15 +0200 | [diff] [blame] | 41 | |
Philipp Rudo | 15ceb8c | 2017-06-27 12:44:11 +0200 | [diff] [blame] | 42 | /* Offsets to entry points in kernel/head.S */ |
| 43 | |
| 44 | #define STARTUP_NORMAL_OFFSET 0x10000 |
| 45 | #define STARTUP_KDUMP_OFFSET 0x10010 |
| 46 | |
| 47 | /* Offsets to parameters in kernel/head.S */ |
| 48 | |
| 49 | #define IPL_DEVICE_OFFSET 0x10400 |
| 50 | #define INITRD_START_OFFSET 0x10408 |
| 51 | #define INITRD_SIZE_OFFSET 0x10410 |
| 52 | #define OLDMEM_BASE_OFFSET 0x10418 |
| 53 | #define OLDMEM_SIZE_OFFSET 0x10420 |
| 54 | #define COMMAND_LINE_OFFSET 0x10480 |
| 55 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | #ifndef __ASSEMBLY__ |
| 57 | |
Heiko Carstens | cbb870c | 2010-02-26 22:37:43 +0100 | [diff] [blame] | 58 | #include <asm/lowcore.h> |
| 59 | #include <asm/types.h> |
| 60 | |
Philipp Rudo | 15ceb8c | 2017-06-27 12:44:11 +0200 | [diff] [blame] | 61 | #define IPL_DEVICE (*(unsigned long *) (IPL_DEVICE_OFFSET)) |
| 62 | #define INITRD_START (*(unsigned long *) (INITRD_START_OFFSET)) |
| 63 | #define INITRD_SIZE (*(unsigned long *) (INITRD_SIZE_OFFSET)) |
| 64 | #define OLDMEM_BASE (*(unsigned long *) (OLDMEM_BASE_OFFSET)) |
| 65 | #define OLDMEM_SIZE (*(unsigned long *) (OLDMEM_SIZE_OFFSET)) |
| 66 | #define COMMAND_LINE ((char *) (COMMAND_LINE_OFFSET)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | |
Vasily Gorbik | d58106c | 2017-11-17 18:44:28 +0100 | [diff] [blame] | 68 | extern int noexec_disabled; |
Heiko Carstens | 23d75d9 | 2009-02-19 15:19:01 +0100 | [diff] [blame] | 69 | extern int memory_end_set; |
| 70 | extern unsigned long memory_end; |
Philipp Hachtmann | 50be634 | 2014-01-29 18:16:01 +0100 | [diff] [blame] | 71 | extern unsigned long max_physmem_end; |
Heiko Carstens | 36a2bd4 | 2006-12-04 15:40:38 +0100 | [diff] [blame] | 72 | |
Christian Ehrhardt | 25097bf | 2009-04-14 15:36:16 +0200 | [diff] [blame] | 73 | #define MACHINE_IS_VM (S390_lowcore.machine_flags & MACHINE_FLAG_VM) |
| 74 | #define MACHINE_IS_KVM (S390_lowcore.machine_flags & MACHINE_FLAG_KVM) |
Martin Schwidefsky | 27d7160 | 2010-02-26 22:37:38 +0100 | [diff] [blame] | 75 | #define MACHINE_IS_LPAR (S390_lowcore.machine_flags & MACHINE_FLAG_LPAR) |
| 76 | |
Christian Ehrhardt | 25097bf | 2009-04-14 15:36:16 +0200 | [diff] [blame] | 77 | #define MACHINE_HAS_DIAG9C (S390_lowcore.machine_flags & MACHINE_FLAG_DIAG9C) |
Martin Schwidefsky | abf09be | 2012-11-07 13:17:37 +0100 | [diff] [blame] | 78 | #define MACHINE_HAS_ESOP (S390_lowcore.machine_flags & MACHINE_FLAG_ESOP) |
Christian Ehrhardt | 25097bf | 2009-04-14 15:36:16 +0200 | [diff] [blame] | 79 | #define MACHINE_HAS_IDTE (S390_lowcore.machine_flags & MACHINE_FLAG_IDTE) |
| 80 | #define MACHINE_HAS_DIAG44 (S390_lowcore.machine_flags & MACHINE_FLAG_DIAG44) |
Heiko Carstens | 3c7ef08 | 2012-09-28 15:06:41 +0200 | [diff] [blame] | 81 | #define MACHINE_HAS_EDAT1 (S390_lowcore.machine_flags & MACHINE_FLAG_EDAT1) |
Heiko Carstens | 85e9d0e | 2012-09-27 10:45:06 +0200 | [diff] [blame] | 82 | #define MACHINE_HAS_EDAT2 (S390_lowcore.machine_flags & MACHINE_FLAG_EDAT2) |
Heiko Carstens | 9186d7a | 2010-10-25 16:10:52 +0200 | [diff] [blame] | 83 | #define MACHINE_HAS_TOPOLOGY (S390_lowcore.machine_flags & MACHINE_FLAG_TOPOLOGY) |
Martin Schwidefsky | d35339a | 2012-07-31 11:03:04 +0200 | [diff] [blame] | 84 | #define MACHINE_HAS_TE (S390_lowcore.machine_flags & MACHINE_FLAG_TE) |
Martin Schwidefsky | 1b948d6 | 2014-04-03 13:55:01 +0200 | [diff] [blame] | 85 | #define MACHINE_HAS_TLB_LC (S390_lowcore.machine_flags & MACHINE_FLAG_TLB_LC) |
Martin Schwidefsky | 8070361 | 2014-10-06 17:53:53 +0200 | [diff] [blame] | 86 | #define MACHINE_HAS_VX (S390_lowcore.machine_flags & MACHINE_FLAG_VX) |
Martin Schwidefsky | 118bd31 | 2016-07-26 16:53:09 +0200 | [diff] [blame] | 87 | #define MACHINE_HAS_TLB_GUEST (S390_lowcore.machine_flags & MACHINE_FLAG_TLB_GUEST) |
Martin Schwidefsky | 57d7f93 | 2016-03-22 10:54:24 +0100 | [diff] [blame] | 88 | #define MACHINE_HAS_NX (S390_lowcore.machine_flags & MACHINE_FLAG_NX) |
Martin Schwidefsky | 916cda1 | 2016-01-26 14:10:34 +0100 | [diff] [blame] | 89 | #define MACHINE_HAS_GS (S390_lowcore.machine_flags & MACHINE_FLAG_GS) |
Martin Schwidefsky | 6e2ef5e | 2016-10-27 12:41:39 +0200 | [diff] [blame] | 90 | #define MACHINE_HAS_SCC (S390_lowcore.machine_flags & MACHINE_FLAG_SCC) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 92 | /* |
| 93 | * Console mode. Override with conmode= |
| 94 | */ |
| 95 | extern unsigned int console_mode; |
| 96 | extern unsigned int console_devno; |
| 97 | extern unsigned int console_irq; |
| 98 | |
Heiko Carstens | 2b67fc4 | 2007-02-05 21:16:47 +0100 | [diff] [blame] | 99 | extern char vmhalt_cmd[]; |
| 100 | extern char vmpoff_cmd[]; |
| 101 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 102 | #define CONSOLE_IS_UNDEFINED (console_mode == 0) |
| 103 | #define CONSOLE_IS_SCLP (console_mode == 1) |
| 104 | #define CONSOLE_IS_3215 (console_mode == 2) |
| 105 | #define CONSOLE_IS_3270 (console_mode == 3) |
Peter Oberparleiter | 8f50af4 | 2016-07-07 07:52:38 +0200 | [diff] [blame] | 106 | #define CONSOLE_IS_VT220 (console_mode == 4) |
| 107 | #define CONSOLE_IS_HVC (console_mode == 5) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 108 | #define SET_CONSOLE_SCLP do { console_mode = 1; } while (0) |
| 109 | #define SET_CONSOLE_3215 do { console_mode = 2; } while (0) |
| 110 | #define SET_CONSOLE_3270 do { console_mode = 3; } while (0) |
Peter Oberparleiter | 8f50af4 | 2016-07-07 07:52:38 +0200 | [diff] [blame] | 111 | #define SET_CONSOLE_VT220 do { console_mode = 4; } while (0) |
| 112 | #define SET_CONSOLE_HVC do { console_mode = 5; } while (0) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 113 | |
David Howells | a0616cd | 2012-03-28 18:30:02 +0100 | [diff] [blame] | 114 | #ifdef CONFIG_PFAULT |
| 115 | extern int pfault_init(void); |
| 116 | extern void pfault_fini(void); |
| 117 | #else /* CONFIG_PFAULT */ |
| 118 | #define pfault_init() ({-1;}) |
| 119 | #define pfault_fini() do { } while (0) |
| 120 | #endif /* CONFIG_PFAULT */ |
| 121 | |
Heiko Carstens | 3f42984 | 2017-08-07 15:16:15 +0200 | [diff] [blame] | 122 | #ifdef CONFIG_VMCP |
| 123 | void vmcp_cma_reserve(void); |
| 124 | #else |
| 125 | static inline void vmcp_cma_reserve(void) { } |
| 126 | #endif |
| 127 | |
Heiko Carstens | 5d7ecce | 2016-02-24 14:27:46 +0100 | [diff] [blame] | 128 | void report_user_fault(struct pt_regs *regs, long signr, int is_mm_fault); |
| 129 | |
Martin Schwidefsky | c9b5ad5 | 2016-06-14 12:56:01 +0200 | [diff] [blame] | 130 | void cmma_init(void); |
| 131 | void cmma_init_nodat(void); |
David Howells | a0616cd | 2012-03-28 18:30:02 +0100 | [diff] [blame] | 132 | |
| 133 | extern void (*_machine_restart)(char *command); |
| 134 | extern void (*_machine_halt)(void); |
| 135 | extern void (*_machine_power_off)(void); |
| 136 | |
Heiko Carstens | 0defa3c | 2006-02-11 17:56:03 -0800 | [diff] [blame] | 137 | #else /* __ASSEMBLY__ */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 138 | |
Philipp Rudo | 15ceb8c | 2017-06-27 12:44:11 +0200 | [diff] [blame] | 139 | #define IPL_DEVICE (IPL_DEVICE_OFFSET) |
| 140 | #define INITRD_START (INITRD_START_OFFSET) |
| 141 | #define INITRD_SIZE (INITRD_SIZE_OFFSET) |
| 142 | #define OLDMEM_BASE (OLDMEM_BASE_OFFSET) |
| 143 | #define OLDMEM_SIZE (OLDMEM_SIZE_OFFSET) |
| 144 | #define COMMAND_LINE (COMMAND_LINE_OFFSET) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 145 | |
Heiko Carstens | 0defa3c | 2006-02-11 17:56:03 -0800 | [diff] [blame] | 146 | #endif /* __ASSEMBLY__ */ |
Heiko Carstens | 0defa3c | 2006-02-11 17:56:03 -0800 | [diff] [blame] | 147 | #endif /* _ASM_S390_SETUP_H */ |