1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 2c6557e7fSMartin Schwidefsky /* 3c6557e7fSMartin Schwidefsky * s390 (re)ipl support 4c6557e7fSMartin Schwidefsky * 5c6557e7fSMartin Schwidefsky * Copyright IBM Corp. 2007 6c6557e7fSMartin Schwidefsky */ 7c6557e7fSMartin Schwidefsky 8c6557e7fSMartin Schwidefsky #ifndef _ASM_S390_IPL_H 9c6557e7fSMartin Schwidefsky #define _ASM_S390_IPL_H 10c6557e7fSMartin Schwidefsky 1158952942SMichael Holzheu #include <asm/lowcore.h> 12c6557e7fSMartin Schwidefsky #include <asm/types.h> 13c6557e7fSMartin Schwidefsky #include <asm/cio.h> 14c6557e7fSMartin Schwidefsky #include <asm/setup.h> 156040b3f4SAlexander Egorenkov #include <asm/page.h> 165f1207fbSMartin Schwidefsky #include <uapi/asm/ipl.h> 175f1207fbSMartin Schwidefsky 185f1207fbSMartin Schwidefsky struct ipl_parameter_block { 195f1207fbSMartin Schwidefsky struct ipl_pl_hdr hdr; 205f1207fbSMartin Schwidefsky union { 215f1207fbSMartin Schwidefsky struct ipl_pb_hdr pb0_hdr; 225f1207fbSMartin Schwidefsky struct ipl_pb0_common common; 235f1207fbSMartin Schwidefsky struct ipl_pb0_fcp fcp; 245f1207fbSMartin Schwidefsky struct ipl_pb0_ccw ccw; 253737e8eeSJason J. Herne struct ipl_pb0_nvme nvme; 265f1207fbSMartin Schwidefsky char raw[PAGE_SIZE - sizeof(struct ipl_pl_hdr)]; 275f1207fbSMartin Schwidefsky }; 285f1207fbSMartin Schwidefsky } __packed __aligned(PAGE_SIZE); 29c6557e7fSMartin Schwidefsky 30978fa72eSHeiko Carstens #define NSS_NAME_SIZE 8 31978fa72eSHeiko Carstens 325f1207fbSMartin Schwidefsky #define IPL_BP_FCP_LEN (sizeof(struct ipl_pl_hdr) + \ 335f1207fbSMartin Schwidefsky sizeof(struct ipl_pb0_fcp)) 345f1207fbSMartin Schwidefsky #define IPL_BP0_FCP_LEN (sizeof(struct ipl_pb0_fcp)) 353737e8eeSJason J. Herne 363737e8eeSJason J. Herne #define IPL_BP_NVME_LEN (sizeof(struct ipl_pl_hdr) + \ 373737e8eeSJason J. Herne sizeof(struct ipl_pb0_nvme)) 383737e8eeSJason J. Herne #define IPL_BP0_NVME_LEN (sizeof(struct ipl_pb0_nvme)) 393737e8eeSJason J. Herne 405f1207fbSMartin Schwidefsky #define IPL_BP_CCW_LEN (sizeof(struct ipl_pl_hdr) + \ 415f1207fbSMartin Schwidefsky sizeof(struct ipl_pb0_ccw)) 425f1207fbSMartin Schwidefsky #define IPL_BP0_CCW_LEN (sizeof(struct ipl_pb0_ccw)) 43c6557e7fSMartin Schwidefsky 44c6557e7fSMartin Schwidefsky #define IPL_MAX_SUPPORTED_VERSION (0) 45c6557e7fSMartin Schwidefsky 4699feaa71SPhilipp Rudo #define IPL_RB_CERT_UNKNOWN ((unsigned short)-1) 4799feaa71SPhilipp Rudo 485f1207fbSMartin Schwidefsky #define DIAG308_VMPARM_SIZE (64) 495f1207fbSMartin Schwidefsky #define DIAG308_SCPDATA_OFFSET offsetof(struct ipl_parameter_block, \ 505f1207fbSMartin Schwidefsky fcp.scp_data) 515f1207fbSMartin Schwidefsky #define DIAG308_SCPDATA_SIZE (PAGE_SIZE - DIAG308_SCPDATA_OFFSET) 52c6557e7fSMartin Schwidefsky 531a2c5840SMartin Schwidefsky struct save_area; 541a2c5840SMartin Schwidefsky struct save_area * __init save_area_alloc(bool is_boot_cpu); 551a2c5840SMartin Schwidefsky struct save_area * __init save_area_boot_cpu(void); 561a2c5840SMartin Schwidefsky void __init save_area_add_regs(struct save_area *, void *regs); 571a2c5840SMartin Schwidefsky void __init save_area_add_vxrs(struct save_area *, __vector128 *vxrs); 5858952942SMichael Holzheu 59d485235bSVasily Gorbik extern void s390_reset_system(void); 6049698745SVasily Gorbik extern size_t ipl_block_get_ascii_vmparm(char *dest, size_t size, 6149698745SVasily Gorbik const struct ipl_parameter_block *ipb); 62c6557e7fSMartin Schwidefsky 63c6557e7fSMartin Schwidefsky enum ipl_type { 64c6557e7fSMartin Schwidefsky IPL_TYPE_UNKNOWN = 1, 65c6557e7fSMartin Schwidefsky IPL_TYPE_CCW = 2, 66c6557e7fSMartin Schwidefsky IPL_TYPE_FCP = 4, 67c6557e7fSMartin Schwidefsky IPL_TYPE_FCP_DUMP = 8, 68c6557e7fSMartin Schwidefsky IPL_TYPE_NSS = 16, 693737e8eeSJason J. Herne IPL_TYPE_NVME = 32, 70d70e38cbSJason J. Herne IPL_TYPE_NVME_DUMP = 64, 71c6557e7fSMartin Schwidefsky }; 72c6557e7fSMartin Schwidefsky 73c6557e7fSMartin Schwidefsky struct ipl_info 74c6557e7fSMartin Schwidefsky { 75c6557e7fSMartin Schwidefsky enum ipl_type type; 76c6557e7fSMartin Schwidefsky union { 77c6557e7fSMartin Schwidefsky struct { 78c6557e7fSMartin Schwidefsky struct ccw_dev_id dev_id; 79c6557e7fSMartin Schwidefsky } ccw; 80c6557e7fSMartin Schwidefsky struct { 81c6557e7fSMartin Schwidefsky struct ccw_dev_id dev_id; 82c6557e7fSMartin Schwidefsky u64 wwpn; 83c6557e7fSMartin Schwidefsky u64 lun; 84c6557e7fSMartin Schwidefsky } fcp; 85c6557e7fSMartin Schwidefsky struct { 863737e8eeSJason J. Herne u32 fid; 873737e8eeSJason J. Herne u32 nsid; 883737e8eeSJason J. Herne } nvme; 893737e8eeSJason J. Herne struct { 90c6557e7fSMartin Schwidefsky char name[NSS_NAME_SIZE + 1]; 91c6557e7fSMartin Schwidefsky } nss; 92c6557e7fSMartin Schwidefsky } data; 93c6557e7fSMartin Schwidefsky }; 94c6557e7fSMartin Schwidefsky 95c6557e7fSMartin Schwidefsky extern struct ipl_info ipl_info; 96c6557e7fSMartin Schwidefsky extern void setup_ipl(void); 973b967847SVasily Gorbik extern void set_os_info_reipl_block(void); 98c6557e7fSMartin Schwidefsky 99bd37b368SAlexander Egorenkov static inline bool is_ipl_type_dump(void) 100bd37b368SAlexander Egorenkov { 101bd37b368SAlexander Egorenkov return (ipl_info.type == IPL_TYPE_FCP_DUMP) || 102bd37b368SAlexander Egorenkov (ipl_info.type == IPL_TYPE_NVME_DUMP); 103bd37b368SAlexander Egorenkov } 104bd37b368SAlexander Egorenkov 105937347acSMartin Schwidefsky struct ipl_report { 106937347acSMartin Schwidefsky struct ipl_parameter_block *ipib; 107937347acSMartin Schwidefsky struct list_head components; 108937347acSMartin Schwidefsky struct list_head certificates; 109937347acSMartin Schwidefsky size_t size; 110937347acSMartin Schwidefsky }; 111937347acSMartin Schwidefsky 112937347acSMartin Schwidefsky struct ipl_report_component { 113937347acSMartin Schwidefsky struct list_head list; 114937347acSMartin Schwidefsky struct ipl_rb_component_entry entry; 115937347acSMartin Schwidefsky }; 116937347acSMartin Schwidefsky 117937347acSMartin Schwidefsky struct ipl_report_certificate { 118937347acSMartin Schwidefsky struct list_head list; 119937347acSMartin Schwidefsky struct ipl_rb_certificate_entry entry; 120937347acSMartin Schwidefsky void *key; 121937347acSMartin Schwidefsky }; 122937347acSMartin Schwidefsky 123937347acSMartin Schwidefsky struct kexec_buf; 124937347acSMartin Schwidefsky struct ipl_report *ipl_report_init(struct ipl_parameter_block *ipib); 125937347acSMartin Schwidefsky void *ipl_report_finish(struct ipl_report *report); 126937347acSMartin Schwidefsky int ipl_report_free(struct ipl_report *report); 127937347acSMartin Schwidefsky int ipl_report_add_component(struct ipl_report *report, struct kexec_buf *kbuf, 128937347acSMartin Schwidefsky unsigned char flags, unsigned short cert); 129937347acSMartin Schwidefsky int ipl_report_add_certificate(struct ipl_report *report, void *key, 130937347acSMartin Schwidefsky unsigned long addr, unsigned long len); 131937347acSMartin Schwidefsky 132c6557e7fSMartin Schwidefsky /* 133c6557e7fSMartin Schwidefsky * DIAG 308 support 134c6557e7fSMartin Schwidefsky */ 135c6557e7fSMartin Schwidefsky enum diag308_subcode { 136*2ba24343SAlexander Egorenkov DIAG308_CLEAR_RESET = 0, 137*2ba24343SAlexander Egorenkov DIAG308_LOAD_NORMAL_RESET = 1, 138c6557e7fSMartin Schwidefsky DIAG308_REL_HSA = 2, 1390599eeadSHeiko Carstens DIAG308_LOAD_CLEAR = 3, 1400599eeadSHeiko Carstens DIAG308_LOAD_NORMAL_DUMP = 4, 141c6557e7fSMartin Schwidefsky DIAG308_SET = 5, 142c6557e7fSMartin Schwidefsky DIAG308_STORE = 6, 1431a2ae03bSGerald Schaefer DIAG308_LOAD_NORMAL = 7, 144c6557e7fSMartin Schwidefsky }; 145c6557e7fSMartin Schwidefsky 146*2ba24343SAlexander Egorenkov enum diag308_subcode_flags { 147*2ba24343SAlexander Egorenkov DIAG308_FLAG_EI = 1UL << 16, 148*2ba24343SAlexander Egorenkov }; 149*2ba24343SAlexander Egorenkov 150c6557e7fSMartin Schwidefsky enum diag308_rc { 151c6557e7fSMartin Schwidefsky DIAG308_RC_OK = 0x0001, 152c6557e7fSMartin Schwidefsky DIAG308_RC_NOCONFIG = 0x0102, 153c6557e7fSMartin Schwidefsky }; 154c6557e7fSMartin Schwidefsky 155c6557e7fSMartin Schwidefsky extern int diag308(unsigned long subcode, void *addr); 1561a36a39eSMartin Schwidefsky extern void store_status(void (*fn)(void *), void *data); 1573ab121abSMichael Holzheu extern void lgr_info_log(void); 158c6557e7fSMartin Schwidefsky 159c6557e7fSMartin Schwidefsky #endif /* _ASM_S390_IPL_H */ 160