| .. | .. |
|---|
| 12 | 12 | #include <asm/types.h> |
|---|
| 13 | 13 | #include <asm/cio.h> |
|---|
| 14 | 14 | #include <asm/setup.h> |
|---|
| 15 | +#include <uapi/asm/ipl.h> |
|---|
| 15 | 16 | |
|---|
| 16 | | -#define NSS_NAME_SIZE 8 |
|---|
| 17 | +struct ipl_parameter_block { |
|---|
| 18 | + struct ipl_pl_hdr hdr; |
|---|
| 19 | + union { |
|---|
| 20 | + struct ipl_pb_hdr pb0_hdr; |
|---|
| 21 | + struct ipl_pb0_common common; |
|---|
| 22 | + struct ipl_pb0_fcp fcp; |
|---|
| 23 | + struct ipl_pb0_ccw ccw; |
|---|
| 24 | + struct ipl_pb0_nvme nvme; |
|---|
| 25 | + char raw[PAGE_SIZE - sizeof(struct ipl_pl_hdr)]; |
|---|
| 26 | + }; |
|---|
| 27 | +} __packed __aligned(PAGE_SIZE); |
|---|
| 17 | 28 | |
|---|
| 18 | | -#define IPL_PARM_BLK_FCP_LEN (sizeof(struct ipl_list_hdr) + \ |
|---|
| 19 | | - sizeof(struct ipl_block_fcp)) |
|---|
| 29 | +#define NSS_NAME_SIZE 8 |
|---|
| 20 | 30 | |
|---|
| 21 | | -#define IPL_PARM_BLK0_FCP_LEN (sizeof(struct ipl_block_fcp) + 16) |
|---|
| 31 | +#define IPL_BP_FCP_LEN (sizeof(struct ipl_pl_hdr) + \ |
|---|
| 32 | + sizeof(struct ipl_pb0_fcp)) |
|---|
| 33 | +#define IPL_BP0_FCP_LEN (sizeof(struct ipl_pb0_fcp)) |
|---|
| 22 | 34 | |
|---|
| 23 | | -#define IPL_PARM_BLK_CCW_LEN (sizeof(struct ipl_list_hdr) + \ |
|---|
| 24 | | - sizeof(struct ipl_block_ccw)) |
|---|
| 35 | +#define IPL_BP_NVME_LEN (sizeof(struct ipl_pl_hdr) + \ |
|---|
| 36 | + sizeof(struct ipl_pb0_nvme)) |
|---|
| 37 | +#define IPL_BP0_NVME_LEN (sizeof(struct ipl_pb0_nvme)) |
|---|
| 25 | 38 | |
|---|
| 26 | | -#define IPL_PARM_BLK0_CCW_LEN (sizeof(struct ipl_block_ccw) + 16) |
|---|
| 39 | +#define IPL_BP_CCW_LEN (sizeof(struct ipl_pl_hdr) + \ |
|---|
| 40 | + sizeof(struct ipl_pb0_ccw)) |
|---|
| 41 | +#define IPL_BP0_CCW_LEN (sizeof(struct ipl_pb0_ccw)) |
|---|
| 27 | 42 | |
|---|
| 28 | 43 | #define IPL_MAX_SUPPORTED_VERSION (0) |
|---|
| 29 | 44 | |
|---|
| 30 | | -struct ipl_list_hdr { |
|---|
| 31 | | - u32 len; |
|---|
| 32 | | - u8 reserved1[3]; |
|---|
| 33 | | - u8 version; |
|---|
| 34 | | - u32 blk0_len; |
|---|
| 35 | | - u8 pbt; |
|---|
| 36 | | - u8 flags; |
|---|
| 37 | | - u16 reserved2; |
|---|
| 38 | | - u8 loadparm[8]; |
|---|
| 39 | | -} __attribute__((packed)); |
|---|
| 45 | +#define IPL_RB_CERT_UNKNOWN ((unsigned short)-1) |
|---|
| 40 | 46 | |
|---|
| 41 | | -struct ipl_block_fcp { |
|---|
| 42 | | - u8 reserved1[305-1]; |
|---|
| 43 | | - u8 opt; |
|---|
| 44 | | - u8 reserved2[3]; |
|---|
| 45 | | - u16 reserved3; |
|---|
| 46 | | - u16 devno; |
|---|
| 47 | | - u8 reserved4[4]; |
|---|
| 48 | | - u64 wwpn; |
|---|
| 49 | | - u64 lun; |
|---|
| 50 | | - u32 bootprog; |
|---|
| 51 | | - u8 reserved5[12]; |
|---|
| 52 | | - u64 br_lba; |
|---|
| 53 | | - u32 scp_data_len; |
|---|
| 54 | | - u8 reserved6[260]; |
|---|
| 55 | | - u8 scp_data[]; |
|---|
| 56 | | -} __attribute__((packed)); |
|---|
| 57 | | - |
|---|
| 58 | | -#define DIAG308_VMPARM_SIZE 64 |
|---|
| 59 | | -#define DIAG308_SCPDATA_SIZE (PAGE_SIZE - (sizeof(struct ipl_list_hdr) + \ |
|---|
| 60 | | - offsetof(struct ipl_block_fcp, scp_data))) |
|---|
| 61 | | - |
|---|
| 62 | | -struct ipl_block_ccw { |
|---|
| 63 | | - u8 reserved1[84]; |
|---|
| 64 | | - u16 reserved2 : 13; |
|---|
| 65 | | - u8 ssid : 3; |
|---|
| 66 | | - u16 devno; |
|---|
| 67 | | - u8 vm_flags; |
|---|
| 68 | | - u8 reserved3[3]; |
|---|
| 69 | | - u32 vm_parm_len; |
|---|
| 70 | | - u8 nss_name[8]; |
|---|
| 71 | | - u8 vm_parm[DIAG308_VMPARM_SIZE]; |
|---|
| 72 | | - u8 reserved4[8]; |
|---|
| 73 | | -} __attribute__((packed)); |
|---|
| 74 | | - |
|---|
| 75 | | -struct ipl_parameter_block { |
|---|
| 76 | | - struct ipl_list_hdr hdr; |
|---|
| 77 | | - union { |
|---|
| 78 | | - struct ipl_block_fcp fcp; |
|---|
| 79 | | - struct ipl_block_ccw ccw; |
|---|
| 80 | | - char raw[PAGE_SIZE - sizeof(struct ipl_list_hdr)]; |
|---|
| 81 | | - } ipl_info; |
|---|
| 82 | | -} __packed __aligned(PAGE_SIZE); |
|---|
| 47 | +#define DIAG308_VMPARM_SIZE (64) |
|---|
| 48 | +#define DIAG308_SCPDATA_OFFSET offsetof(struct ipl_parameter_block, \ |
|---|
| 49 | + fcp.scp_data) |
|---|
| 50 | +#define DIAG308_SCPDATA_SIZE (PAGE_SIZE - DIAG308_SCPDATA_OFFSET) |
|---|
| 83 | 51 | |
|---|
| 84 | 52 | struct save_area; |
|---|
| 85 | 53 | struct save_area * __init save_area_alloc(bool is_boot_cpu); |
|---|
| .. | .. |
|---|
| 88 | 56 | void __init save_area_add_vxrs(struct save_area *, __vector128 *vxrs); |
|---|
| 89 | 57 | |
|---|
| 90 | 58 | extern void s390_reset_system(void); |
|---|
| 91 | | -extern void ipl_store_parameters(void); |
|---|
| 92 | | -extern size_t append_ipl_vmparm(char *, size_t); |
|---|
| 93 | | -extern size_t append_ipl_scpdata(char *, size_t); |
|---|
| 59 | +extern size_t ipl_block_get_ascii_vmparm(char *dest, size_t size, |
|---|
| 60 | + const struct ipl_parameter_block *ipb); |
|---|
| 94 | 61 | |
|---|
| 95 | 62 | enum ipl_type { |
|---|
| 96 | 63 | IPL_TYPE_UNKNOWN = 1, |
|---|
| .. | .. |
|---|
| 98 | 65 | IPL_TYPE_FCP = 4, |
|---|
| 99 | 66 | IPL_TYPE_FCP_DUMP = 8, |
|---|
| 100 | 67 | IPL_TYPE_NSS = 16, |
|---|
| 68 | + IPL_TYPE_NVME = 32, |
|---|
| 69 | + IPL_TYPE_NVME_DUMP = 64, |
|---|
| 101 | 70 | }; |
|---|
| 102 | 71 | |
|---|
| 103 | 72 | struct ipl_info |
|---|
| .. | .. |
|---|
| 113 | 82 | u64 lun; |
|---|
| 114 | 83 | } fcp; |
|---|
| 115 | 84 | struct { |
|---|
| 85 | + u32 fid; |
|---|
| 86 | + u32 nsid; |
|---|
| 87 | + } nvme; |
|---|
| 88 | + struct { |
|---|
| 116 | 89 | char name[NSS_NAME_SIZE + 1]; |
|---|
| 117 | 90 | } nss; |
|---|
| 118 | 91 | } data; |
|---|
| .. | .. |
|---|
| 121 | 94 | extern struct ipl_info ipl_info; |
|---|
| 122 | 95 | extern void setup_ipl(void); |
|---|
| 123 | 96 | extern void set_os_info_reipl_block(void); |
|---|
| 97 | + |
|---|
| 98 | +static inline bool is_ipl_type_dump(void) |
|---|
| 99 | +{ |
|---|
| 100 | + return (ipl_info.type == IPL_TYPE_FCP_DUMP) || |
|---|
| 101 | + (ipl_info.type == IPL_TYPE_NVME_DUMP); |
|---|
| 102 | +} |
|---|
| 103 | + |
|---|
| 104 | +struct ipl_report { |
|---|
| 105 | + struct ipl_parameter_block *ipib; |
|---|
| 106 | + struct list_head components; |
|---|
| 107 | + struct list_head certificates; |
|---|
| 108 | + size_t size; |
|---|
| 109 | +}; |
|---|
| 110 | + |
|---|
| 111 | +struct ipl_report_component { |
|---|
| 112 | + struct list_head list; |
|---|
| 113 | + struct ipl_rb_component_entry entry; |
|---|
| 114 | +}; |
|---|
| 115 | + |
|---|
| 116 | +struct ipl_report_certificate { |
|---|
| 117 | + struct list_head list; |
|---|
| 118 | + struct ipl_rb_certificate_entry entry; |
|---|
| 119 | + void *key; |
|---|
| 120 | +}; |
|---|
| 121 | + |
|---|
| 122 | +struct kexec_buf; |
|---|
| 123 | +struct ipl_report *ipl_report_init(struct ipl_parameter_block *ipib); |
|---|
| 124 | +void *ipl_report_finish(struct ipl_report *report); |
|---|
| 125 | +int ipl_report_free(struct ipl_report *report); |
|---|
| 126 | +int ipl_report_add_component(struct ipl_report *report, struct kexec_buf *kbuf, |
|---|
| 127 | + unsigned char flags, unsigned short cert); |
|---|
| 128 | +int ipl_report_add_certificate(struct ipl_report *report, void *key, |
|---|
| 129 | + unsigned long addr, unsigned long len); |
|---|
| 124 | 130 | |
|---|
| 125 | 131 | /* |
|---|
| 126 | 132 | * DIAG 308 support |
|---|
| .. | .. |
|---|
| 131 | 137 | DIAG308_LOAD_NORMAL_DUMP = 4, |
|---|
| 132 | 138 | DIAG308_SET = 5, |
|---|
| 133 | 139 | DIAG308_STORE = 6, |
|---|
| 134 | | -}; |
|---|
| 135 | | - |
|---|
| 136 | | -enum diag308_ipl_type { |
|---|
| 137 | | - DIAG308_IPL_TYPE_FCP = 0, |
|---|
| 138 | | - DIAG308_IPL_TYPE_CCW = 2, |
|---|
| 139 | | -}; |
|---|
| 140 | | - |
|---|
| 141 | | -enum diag308_opt { |
|---|
| 142 | | - DIAG308_IPL_OPT_IPL = 0x10, |
|---|
| 143 | | - DIAG308_IPL_OPT_DUMP = 0x20, |
|---|
| 144 | | -}; |
|---|
| 145 | | - |
|---|
| 146 | | -enum diag308_flags { |
|---|
| 147 | | - DIAG308_FLAGS_LP_VALID = 0x80, |
|---|
| 148 | | -}; |
|---|
| 149 | | - |
|---|
| 150 | | -enum diag308_vm_flags { |
|---|
| 151 | | - DIAG308_VM_FLAGS_NSS_VALID = 0x80, |
|---|
| 152 | | - DIAG308_VM_FLAGS_VP_VALID = 0x40, |
|---|
| 140 | + DIAG308_LOAD_NORMAL = 7, |
|---|
| 153 | 141 | }; |
|---|
| 154 | 142 | |
|---|
| 155 | 143 | enum diag308_rc { |
|---|
| .. | .. |
|---|
| 158 | 146 | }; |
|---|
| 159 | 147 | |
|---|
| 160 | 148 | extern int diag308(unsigned long subcode, void *addr); |
|---|
| 161 | | -extern void diag308_reset(void); |
|---|
| 162 | 149 | extern void store_status(void (*fn)(void *), void *data); |
|---|
| 163 | 150 | extern void lgr_info_log(void); |
|---|
| 164 | 151 | |
|---|