18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * S390 version 48c2ecf20Sopenharmony_ci * Copyright IBM Corp. 1999, 2017 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci#ifndef _ASM_S390_SETUP_H 78c2ecf20Sopenharmony_ci#define _ASM_S390_SETUP_H 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#include <linux/bits.h> 108c2ecf20Sopenharmony_ci#include <uapi/asm/setup.h> 118c2ecf20Sopenharmony_ci#include <linux/build_bug.h> 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#define EP_OFFSET 0x10008 148c2ecf20Sopenharmony_ci#define EP_STRING "S390EP" 158c2ecf20Sopenharmony_ci#define PARMAREA 0x10400 168c2ecf20Sopenharmony_ci#define EARLY_SCCB_OFFSET 0x11000 178c2ecf20Sopenharmony_ci#define HEAD_END 0x12000 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci#define EARLY_SCCB_SIZE PAGE_SIZE 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci/* 228c2ecf20Sopenharmony_ci * Machine features detected in early.c 238c2ecf20Sopenharmony_ci */ 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci#define MACHINE_FLAG_VM BIT(0) 268c2ecf20Sopenharmony_ci#define MACHINE_FLAG_KVM BIT(1) 278c2ecf20Sopenharmony_ci#define MACHINE_FLAG_LPAR BIT(2) 288c2ecf20Sopenharmony_ci#define MACHINE_FLAG_DIAG9C BIT(3) 298c2ecf20Sopenharmony_ci#define MACHINE_FLAG_ESOP BIT(4) 308c2ecf20Sopenharmony_ci#define MACHINE_FLAG_IDTE BIT(5) 318c2ecf20Sopenharmony_ci#define MACHINE_FLAG_EDAT1 BIT(7) 328c2ecf20Sopenharmony_ci#define MACHINE_FLAG_EDAT2 BIT(8) 338c2ecf20Sopenharmony_ci#define MACHINE_FLAG_TOPOLOGY BIT(10) 348c2ecf20Sopenharmony_ci#define MACHINE_FLAG_TE BIT(11) 358c2ecf20Sopenharmony_ci#define MACHINE_FLAG_TLB_LC BIT(12) 368c2ecf20Sopenharmony_ci#define MACHINE_FLAG_VX BIT(13) 378c2ecf20Sopenharmony_ci#define MACHINE_FLAG_TLB_GUEST BIT(14) 388c2ecf20Sopenharmony_ci#define MACHINE_FLAG_NX BIT(15) 398c2ecf20Sopenharmony_ci#define MACHINE_FLAG_GS BIT(16) 408c2ecf20Sopenharmony_ci#define MACHINE_FLAG_SCC BIT(17) 418c2ecf20Sopenharmony_ci#define MACHINE_FLAG_PCI_MIO BIT(18) 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci#define LPP_MAGIC BIT(31) 448c2ecf20Sopenharmony_ci#define LPP_PID_MASK _AC(0xffffffff, UL) 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci/* Offsets to entry points in kernel/head.S */ 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci#define STARTUP_NORMAL_OFFSET 0x10000 498c2ecf20Sopenharmony_ci#define STARTUP_KDUMP_OFFSET 0x10010 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci/* Offsets to parameters in kernel/head.S */ 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci#define IPL_DEVICE_OFFSET 0x10400 548c2ecf20Sopenharmony_ci#define INITRD_START_OFFSET 0x10408 558c2ecf20Sopenharmony_ci#define INITRD_SIZE_OFFSET 0x10410 568c2ecf20Sopenharmony_ci#define OLDMEM_BASE_OFFSET 0x10418 578c2ecf20Sopenharmony_ci#define OLDMEM_SIZE_OFFSET 0x10420 588c2ecf20Sopenharmony_ci#define KERNEL_VERSION_OFFSET 0x10428 598c2ecf20Sopenharmony_ci#define COMMAND_LINE_OFFSET 0x10480 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__ 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci#include <asm/lowcore.h> 648c2ecf20Sopenharmony_ci#include <asm/types.h> 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci#define IPL_DEVICE (*(unsigned long *) (IPL_DEVICE_OFFSET)) 678c2ecf20Sopenharmony_ci#define INITRD_START (*(unsigned long *) (INITRD_START_OFFSET)) 688c2ecf20Sopenharmony_ci#define INITRD_SIZE (*(unsigned long *) (INITRD_SIZE_OFFSET)) 698c2ecf20Sopenharmony_ci#define OLDMEM_BASE (*(unsigned long *) (OLDMEM_BASE_OFFSET)) 708c2ecf20Sopenharmony_ci#define OLDMEM_SIZE (*(unsigned long *) (OLDMEM_SIZE_OFFSET)) 718c2ecf20Sopenharmony_ci#define COMMAND_LINE ((char *) (COMMAND_LINE_OFFSET)) 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_cistruct parmarea { 748c2ecf20Sopenharmony_ci unsigned long ipl_device; /* 0x10400 */ 758c2ecf20Sopenharmony_ci unsigned long initrd_start; /* 0x10408 */ 768c2ecf20Sopenharmony_ci unsigned long initrd_size; /* 0x10410 */ 778c2ecf20Sopenharmony_ci unsigned long oldmem_base; /* 0x10418 */ 788c2ecf20Sopenharmony_ci unsigned long oldmem_size; /* 0x10420 */ 798c2ecf20Sopenharmony_ci unsigned long kernel_version; /* 0x10428 */ 808c2ecf20Sopenharmony_ci char pad1[0x10480 - 0x10430]; /* 0x10430 - 0x10480 */ 818c2ecf20Sopenharmony_ci char command_line[ARCH_COMMAND_LINE_SIZE]; /* 0x10480 */ 828c2ecf20Sopenharmony_ci}; 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ciextern unsigned int zlib_dfltcc_support; 858c2ecf20Sopenharmony_ci#define ZLIB_DFLTCC_DISABLED 0 868c2ecf20Sopenharmony_ci#define ZLIB_DFLTCC_FULL 1 878c2ecf20Sopenharmony_ci#define ZLIB_DFLTCC_DEFLATE_ONLY 2 888c2ecf20Sopenharmony_ci#define ZLIB_DFLTCC_INFLATE_ONLY 3 898c2ecf20Sopenharmony_ci#define ZLIB_DFLTCC_FULL_DEBUG 4 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ciextern int noexec_disabled; 928c2ecf20Sopenharmony_ciextern int memory_end_set; 938c2ecf20Sopenharmony_ciextern unsigned long memory_end; 948c2ecf20Sopenharmony_ciextern unsigned long vmalloc_size; 958c2ecf20Sopenharmony_ciextern unsigned long max_physmem_end; 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci/* The Write Back bit position in the physaddr is given by the SLPC PCI */ 988c2ecf20Sopenharmony_ciextern unsigned long mio_wb_bit_mask; 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci#define MACHINE_IS_VM (S390_lowcore.machine_flags & MACHINE_FLAG_VM) 1018c2ecf20Sopenharmony_ci#define MACHINE_IS_KVM (S390_lowcore.machine_flags & MACHINE_FLAG_KVM) 1028c2ecf20Sopenharmony_ci#define MACHINE_IS_LPAR (S390_lowcore.machine_flags & MACHINE_FLAG_LPAR) 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_ci#define MACHINE_HAS_DIAG9C (S390_lowcore.machine_flags & MACHINE_FLAG_DIAG9C) 1058c2ecf20Sopenharmony_ci#define MACHINE_HAS_ESOP (S390_lowcore.machine_flags & MACHINE_FLAG_ESOP) 1068c2ecf20Sopenharmony_ci#define MACHINE_HAS_IDTE (S390_lowcore.machine_flags & MACHINE_FLAG_IDTE) 1078c2ecf20Sopenharmony_ci#define MACHINE_HAS_EDAT1 (S390_lowcore.machine_flags & MACHINE_FLAG_EDAT1) 1088c2ecf20Sopenharmony_ci#define MACHINE_HAS_EDAT2 (S390_lowcore.machine_flags & MACHINE_FLAG_EDAT2) 1098c2ecf20Sopenharmony_ci#define MACHINE_HAS_TOPOLOGY (S390_lowcore.machine_flags & MACHINE_FLAG_TOPOLOGY) 1108c2ecf20Sopenharmony_ci#define MACHINE_HAS_TE (S390_lowcore.machine_flags & MACHINE_FLAG_TE) 1118c2ecf20Sopenharmony_ci#define MACHINE_HAS_TLB_LC (S390_lowcore.machine_flags & MACHINE_FLAG_TLB_LC) 1128c2ecf20Sopenharmony_ci#define MACHINE_HAS_VX (S390_lowcore.machine_flags & MACHINE_FLAG_VX) 1138c2ecf20Sopenharmony_ci#define MACHINE_HAS_TLB_GUEST (S390_lowcore.machine_flags & MACHINE_FLAG_TLB_GUEST) 1148c2ecf20Sopenharmony_ci#define MACHINE_HAS_NX (S390_lowcore.machine_flags & MACHINE_FLAG_NX) 1158c2ecf20Sopenharmony_ci#define MACHINE_HAS_GS (S390_lowcore.machine_flags & MACHINE_FLAG_GS) 1168c2ecf20Sopenharmony_ci#define MACHINE_HAS_SCC (S390_lowcore.machine_flags & MACHINE_FLAG_SCC) 1178c2ecf20Sopenharmony_ci#define MACHINE_HAS_PCI_MIO (S390_lowcore.machine_flags & MACHINE_FLAG_PCI_MIO) 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ci/* 1208c2ecf20Sopenharmony_ci * Console mode. Override with conmode= 1218c2ecf20Sopenharmony_ci */ 1228c2ecf20Sopenharmony_ciextern unsigned int console_mode; 1238c2ecf20Sopenharmony_ciextern unsigned int console_devno; 1248c2ecf20Sopenharmony_ciextern unsigned int console_irq; 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_ci#define CONSOLE_IS_UNDEFINED (console_mode == 0) 1278c2ecf20Sopenharmony_ci#define CONSOLE_IS_SCLP (console_mode == 1) 1288c2ecf20Sopenharmony_ci#define CONSOLE_IS_3215 (console_mode == 2) 1298c2ecf20Sopenharmony_ci#define CONSOLE_IS_3270 (console_mode == 3) 1308c2ecf20Sopenharmony_ci#define CONSOLE_IS_VT220 (console_mode == 4) 1318c2ecf20Sopenharmony_ci#define CONSOLE_IS_HVC (console_mode == 5) 1328c2ecf20Sopenharmony_ci#define SET_CONSOLE_SCLP do { console_mode = 1; } while (0) 1338c2ecf20Sopenharmony_ci#define SET_CONSOLE_3215 do { console_mode = 2; } while (0) 1348c2ecf20Sopenharmony_ci#define SET_CONSOLE_3270 do { console_mode = 3; } while (0) 1358c2ecf20Sopenharmony_ci#define SET_CONSOLE_VT220 do { console_mode = 4; } while (0) 1368c2ecf20Sopenharmony_ci#define SET_CONSOLE_HVC do { console_mode = 5; } while (0) 1378c2ecf20Sopenharmony_ci 1388c2ecf20Sopenharmony_ci#ifdef CONFIG_PFAULT 1398c2ecf20Sopenharmony_ciextern int pfault_init(void); 1408c2ecf20Sopenharmony_ciextern void pfault_fini(void); 1418c2ecf20Sopenharmony_ci#else /* CONFIG_PFAULT */ 1428c2ecf20Sopenharmony_ci#define pfault_init() ({-1;}) 1438c2ecf20Sopenharmony_ci#define pfault_fini() do { } while (0) 1448c2ecf20Sopenharmony_ci#endif /* CONFIG_PFAULT */ 1458c2ecf20Sopenharmony_ci 1468c2ecf20Sopenharmony_ci#ifdef CONFIG_VMCP 1478c2ecf20Sopenharmony_civoid vmcp_cma_reserve(void); 1488c2ecf20Sopenharmony_ci#else 1498c2ecf20Sopenharmony_cistatic inline void vmcp_cma_reserve(void) { } 1508c2ecf20Sopenharmony_ci#endif 1518c2ecf20Sopenharmony_ci 1528c2ecf20Sopenharmony_civoid report_user_fault(struct pt_regs *regs, long signr, int is_mm_fault); 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_civoid cmma_init(void); 1558c2ecf20Sopenharmony_civoid cmma_init_nodat(void); 1568c2ecf20Sopenharmony_ci 1578c2ecf20Sopenharmony_ciextern void (*_machine_restart)(char *command); 1588c2ecf20Sopenharmony_ciextern void (*_machine_halt)(void); 1598c2ecf20Sopenharmony_ciextern void (*_machine_power_off)(void); 1608c2ecf20Sopenharmony_ci 1618c2ecf20Sopenharmony_ciextern unsigned long __kaslr_offset; 1628c2ecf20Sopenharmony_cistatic inline unsigned long kaslr_offset(void) 1638c2ecf20Sopenharmony_ci{ 1648c2ecf20Sopenharmony_ci return __kaslr_offset; 1658c2ecf20Sopenharmony_ci} 1668c2ecf20Sopenharmony_ci 1678c2ecf20Sopenharmony_cistatic inline u32 gen_lpswe(unsigned long addr) 1688c2ecf20Sopenharmony_ci{ 1698c2ecf20Sopenharmony_ci BUILD_BUG_ON(addr > 0xfff); 1708c2ecf20Sopenharmony_ci return 0xb2b20000 | addr; 1718c2ecf20Sopenharmony_ci} 1728c2ecf20Sopenharmony_ci 1738c2ecf20Sopenharmony_ci#else /* __ASSEMBLY__ */ 1748c2ecf20Sopenharmony_ci 1758c2ecf20Sopenharmony_ci#define IPL_DEVICE (IPL_DEVICE_OFFSET) 1768c2ecf20Sopenharmony_ci#define INITRD_START (INITRD_START_OFFSET) 1778c2ecf20Sopenharmony_ci#define INITRD_SIZE (INITRD_SIZE_OFFSET) 1788c2ecf20Sopenharmony_ci#define OLDMEM_BASE (OLDMEM_BASE_OFFSET) 1798c2ecf20Sopenharmony_ci#define OLDMEM_SIZE (OLDMEM_SIZE_OFFSET) 1808c2ecf20Sopenharmony_ci#define COMMAND_LINE (COMMAND_LINE_OFFSET) 1818c2ecf20Sopenharmony_ci 1828c2ecf20Sopenharmony_ci#endif /* __ASSEMBLY__ */ 1838c2ecf20Sopenharmony_ci#endif /* _ASM_S390_SETUP_H */ 184