^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * s390 (re)ipl support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright IBM Corp. 2007
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #ifndef _ASM_S390_IPL_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #define _ASM_S390_IPL_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <asm/lowcore.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <asm/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <asm/cio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <asm/setup.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <uapi/asm/ipl.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) struct ipl_parameter_block {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) struct ipl_pl_hdr hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) struct ipl_pb_hdr pb0_hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) struct ipl_pb0_common common;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) struct ipl_pb0_fcp fcp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) struct ipl_pb0_ccw ccw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) struct ipl_pb0_nvme nvme;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) char raw[PAGE_SIZE - sizeof(struct ipl_pl_hdr)];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) } __packed __aligned(PAGE_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #define NSS_NAME_SIZE 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #define IPL_BP_FCP_LEN (sizeof(struct ipl_pl_hdr) + \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) sizeof(struct ipl_pb0_fcp))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #define IPL_BP0_FCP_LEN (sizeof(struct ipl_pb0_fcp))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #define IPL_BP_NVME_LEN (sizeof(struct ipl_pl_hdr) + \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) sizeof(struct ipl_pb0_nvme))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #define IPL_BP0_NVME_LEN (sizeof(struct ipl_pb0_nvme))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #define IPL_BP_CCW_LEN (sizeof(struct ipl_pl_hdr) + \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) sizeof(struct ipl_pb0_ccw))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #define IPL_BP0_CCW_LEN (sizeof(struct ipl_pb0_ccw))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #define IPL_MAX_SUPPORTED_VERSION (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #define IPL_RB_CERT_UNKNOWN ((unsigned short)-1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) #define DIAG308_VMPARM_SIZE (64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) #define DIAG308_SCPDATA_OFFSET offsetof(struct ipl_parameter_block, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) fcp.scp_data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #define DIAG308_SCPDATA_SIZE (PAGE_SIZE - DIAG308_SCPDATA_OFFSET)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) struct save_area;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) struct save_area * __init save_area_alloc(bool is_boot_cpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) struct save_area * __init save_area_boot_cpu(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) void __init save_area_add_regs(struct save_area *, void *regs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) void __init save_area_add_vxrs(struct save_area *, __vector128 *vxrs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) extern void s390_reset_system(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) extern size_t ipl_block_get_ascii_vmparm(char *dest, size_t size,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) const struct ipl_parameter_block *ipb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) enum ipl_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) IPL_TYPE_UNKNOWN = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) IPL_TYPE_CCW = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) IPL_TYPE_FCP = 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) IPL_TYPE_FCP_DUMP = 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) IPL_TYPE_NSS = 16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) IPL_TYPE_NVME = 32,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) IPL_TYPE_NVME_DUMP = 64,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) struct ipl_info
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) enum ipl_type type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) struct ccw_dev_id dev_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) } ccw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) struct ccw_dev_id dev_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) u64 wwpn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) u64 lun;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) } fcp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) u32 fid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) u32 nsid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) } nvme;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) char name[NSS_NAME_SIZE + 1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) } nss;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) } data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) extern struct ipl_info ipl_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) extern void setup_ipl(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) extern void set_os_info_reipl_block(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) static inline bool is_ipl_type_dump(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) return (ipl_info.type == IPL_TYPE_FCP_DUMP) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) (ipl_info.type == IPL_TYPE_NVME_DUMP);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) struct ipl_report {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) struct ipl_parameter_block *ipib;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) struct list_head components;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) struct list_head certificates;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) size_t size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) struct ipl_report_component {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) struct ipl_rb_component_entry entry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) struct ipl_report_certificate {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) struct ipl_rb_certificate_entry entry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) void *key;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) struct kexec_buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) struct ipl_report *ipl_report_init(struct ipl_parameter_block *ipib);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) void *ipl_report_finish(struct ipl_report *report);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) int ipl_report_free(struct ipl_report *report);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) int ipl_report_add_component(struct ipl_report *report, struct kexec_buf *kbuf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) unsigned char flags, unsigned short cert);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) int ipl_report_add_certificate(struct ipl_report *report, void *key,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) unsigned long addr, unsigned long len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) * DIAG 308 support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) enum diag308_subcode {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) DIAG308_REL_HSA = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) DIAG308_LOAD_CLEAR = 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) DIAG308_LOAD_NORMAL_DUMP = 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) DIAG308_SET = 5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) DIAG308_STORE = 6,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) DIAG308_LOAD_NORMAL = 7,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) enum diag308_rc {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) DIAG308_RC_OK = 0x0001,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) DIAG308_RC_NOCONFIG = 0x0102,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) extern int diag308(unsigned long subcode, void *addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) extern void store_status(void (*fn)(void *), void *data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) extern void lgr_info_log(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) #endif /* _ASM_S390_IPL_H */