Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * s390 (re)ipl support
0004  *
0005  * Copyright IBM Corp. 2007
0006  */
0007 
0008 #ifndef _ASM_S390_IPL_H
0009 #define _ASM_S390_IPL_H
0010 
0011 #include <asm/lowcore.h>
0012 #include <asm/types.h>
0013 #include <asm/cio.h>
0014 #include <asm/setup.h>
0015 #include <asm/page.h>
0016 #include <uapi/asm/ipl.h>
0017 
0018 struct ipl_parameter_block {
0019     struct ipl_pl_hdr hdr;
0020     union {
0021         struct ipl_pb_hdr pb0_hdr;
0022         struct ipl_pb0_common common;
0023         struct ipl_pb0_fcp fcp;
0024         struct ipl_pb0_ccw ccw;
0025         struct ipl_pb0_nvme nvme;
0026         char raw[PAGE_SIZE - sizeof(struct ipl_pl_hdr)];
0027     };
0028 } __packed __aligned(PAGE_SIZE);
0029 
0030 #define NSS_NAME_SIZE 8
0031 
0032 #define IPL_BP_FCP_LEN (sizeof(struct ipl_pl_hdr) + \
0033                   sizeof(struct ipl_pb0_fcp))
0034 #define IPL_BP0_FCP_LEN (sizeof(struct ipl_pb0_fcp))
0035 
0036 #define IPL_BP_NVME_LEN (sizeof(struct ipl_pl_hdr) + \
0037                   sizeof(struct ipl_pb0_nvme))
0038 #define IPL_BP0_NVME_LEN (sizeof(struct ipl_pb0_nvme))
0039 
0040 #define IPL_BP_CCW_LEN (sizeof(struct ipl_pl_hdr) + \
0041                   sizeof(struct ipl_pb0_ccw))
0042 #define IPL_BP0_CCW_LEN (sizeof(struct ipl_pb0_ccw))
0043 
0044 #define IPL_MAX_SUPPORTED_VERSION (0)
0045 
0046 #define IPL_RB_CERT_UNKNOWN ((unsigned short)-1)
0047 
0048 #define DIAG308_VMPARM_SIZE (64)
0049 #define DIAG308_SCPDATA_OFFSET offsetof(struct ipl_parameter_block, \
0050                     fcp.scp_data)
0051 #define DIAG308_SCPDATA_SIZE (PAGE_SIZE - DIAG308_SCPDATA_OFFSET)
0052 
0053 struct save_area;
0054 struct save_area * __init save_area_alloc(bool is_boot_cpu);
0055 struct save_area * __init save_area_boot_cpu(void);
0056 void __init save_area_add_regs(struct save_area *, void *regs);
0057 void __init save_area_add_vxrs(struct save_area *, __vector128 *vxrs);
0058 
0059 extern void s390_reset_system(void);
0060 extern size_t ipl_block_get_ascii_vmparm(char *dest, size_t size,
0061                      const struct ipl_parameter_block *ipb);
0062 
0063 enum ipl_type {
0064     IPL_TYPE_UNKNOWN    = 1,
0065     IPL_TYPE_CCW        = 2,
0066     IPL_TYPE_FCP        = 4,
0067     IPL_TYPE_FCP_DUMP   = 8,
0068     IPL_TYPE_NSS        = 16,
0069     IPL_TYPE_NVME       = 32,
0070     IPL_TYPE_NVME_DUMP  = 64,
0071 };
0072 
0073 struct ipl_info
0074 {
0075     enum ipl_type type;
0076     union {
0077         struct {
0078             struct ccw_dev_id dev_id;
0079         } ccw;
0080         struct {
0081             struct ccw_dev_id dev_id;
0082             u64 wwpn;
0083             u64 lun;
0084         } fcp;
0085         struct {
0086             u32 fid;
0087             u32 nsid;
0088         } nvme;
0089         struct {
0090             char name[NSS_NAME_SIZE + 1];
0091         } nss;
0092     } data;
0093 };
0094 
0095 extern struct ipl_info ipl_info;
0096 extern void setup_ipl(void);
0097 extern void set_os_info_reipl_block(void);
0098 
0099 static inline bool is_ipl_type_dump(void)
0100 {
0101     return (ipl_info.type == IPL_TYPE_FCP_DUMP) ||
0102         (ipl_info.type == IPL_TYPE_NVME_DUMP);
0103 }
0104 
0105 struct ipl_report {
0106     struct ipl_parameter_block *ipib;
0107     struct list_head components;
0108     struct list_head certificates;
0109     size_t size;
0110 };
0111 
0112 struct ipl_report_component {
0113     struct list_head list;
0114     struct ipl_rb_component_entry entry;
0115 };
0116 
0117 struct ipl_report_certificate {
0118     struct list_head list;
0119     struct ipl_rb_certificate_entry entry;
0120     void *key;
0121 };
0122 
0123 struct kexec_buf;
0124 struct ipl_report *ipl_report_init(struct ipl_parameter_block *ipib);
0125 void *ipl_report_finish(struct ipl_report *report);
0126 int ipl_report_free(struct ipl_report *report);
0127 int ipl_report_add_component(struct ipl_report *report, struct kexec_buf *kbuf,
0128                  unsigned char flags, unsigned short cert);
0129 int ipl_report_add_certificate(struct ipl_report *report, void *key,
0130                    unsigned long addr, unsigned long len);
0131 
0132 /*
0133  * DIAG 308 support
0134  */
0135 enum diag308_subcode  {
0136     DIAG308_CLEAR_RESET = 0,
0137     DIAG308_LOAD_NORMAL_RESET = 1,
0138     DIAG308_REL_HSA = 2,
0139     DIAG308_LOAD_CLEAR = 3,
0140     DIAG308_LOAD_NORMAL_DUMP = 4,
0141     DIAG308_SET = 5,
0142     DIAG308_STORE = 6,
0143     DIAG308_LOAD_NORMAL = 7,
0144 };
0145 
0146 enum diag308_subcode_flags {
0147     DIAG308_FLAG_EI = 1UL << 16,
0148 };
0149 
0150 enum diag308_rc {
0151     DIAG308_RC_OK       = 0x0001,
0152     DIAG308_RC_NOCONFIG = 0x0102,
0153 };
0154 
0155 extern int diag308(unsigned long subcode, void *addr);
0156 extern void store_status(void (*fn)(void *), void *data);
0157 extern void lgr_info_log(void);
0158 
0159 #endif /* _ASM_S390_IPL_H */