xref: /openbmc/linux/arch/s390/include/asm/ipl.h (revision 852a53a0)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * s390 (re)ipl support
4  *
5  * Copyright IBM Corp. 2007
6  */
7 
8 #ifndef _ASM_S390_IPL_H
9 #define _ASM_S390_IPL_H
10 
11 #include <asm/lowcore.h>
12 #include <asm/types.h>
13 #include <asm/cio.h>
14 #include <asm/setup.h>
15 #include <uapi/asm/ipl.h>
16 
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);
28 
29 #define NSS_NAME_SIZE 8
30 
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))
34 
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))
38 
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))
42 
43 #define IPL_MAX_SUPPORTED_VERSION (0)
44 
45 #define IPL_RB_CERT_UNKNOWN ((unsigned short)-1)
46 
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)
51 
52 struct save_area;
53 struct save_area * __init save_area_alloc(bool is_boot_cpu);
54 struct save_area * __init save_area_boot_cpu(void);
55 void __init save_area_add_regs(struct save_area *, void *regs);
56 void __init save_area_add_vxrs(struct save_area *, __vector128 *vxrs);
57 
58 extern void s390_reset_system(void);
59 extern size_t ipl_block_get_ascii_vmparm(char *dest, size_t size,
60 					 const struct ipl_parameter_block *ipb);
61 
62 enum ipl_type {
63 	IPL_TYPE_UNKNOWN	= 1,
64 	IPL_TYPE_CCW		= 2,
65 	IPL_TYPE_FCP		= 4,
66 	IPL_TYPE_FCP_DUMP	= 8,
67 	IPL_TYPE_NSS		= 16,
68 	IPL_TYPE_NVME		= 32,
69 };
70 
71 struct ipl_info
72 {
73 	enum ipl_type type;
74 	union {
75 		struct {
76 			struct ccw_dev_id dev_id;
77 		} ccw;
78 		struct {
79 			struct ccw_dev_id dev_id;
80 			u64 wwpn;
81 			u64 lun;
82 		} fcp;
83 		struct {
84 			u32 fid;
85 			u32 nsid;
86 		} nvme;
87 		struct {
88 			char name[NSS_NAME_SIZE + 1];
89 		} nss;
90 	} data;
91 };
92 
93 extern struct ipl_info ipl_info;
94 extern void setup_ipl(void);
95 extern void set_os_info_reipl_block(void);
96 
97 struct ipl_report {
98 	struct ipl_parameter_block *ipib;
99 	struct list_head components;
100 	struct list_head certificates;
101 	size_t size;
102 };
103 
104 struct ipl_report_component {
105 	struct list_head list;
106 	struct ipl_rb_component_entry entry;
107 };
108 
109 struct ipl_report_certificate {
110 	struct list_head list;
111 	struct ipl_rb_certificate_entry entry;
112 	void *key;
113 };
114 
115 struct kexec_buf;
116 struct ipl_report *ipl_report_init(struct ipl_parameter_block *ipib);
117 void *ipl_report_finish(struct ipl_report *report);
118 int ipl_report_free(struct ipl_report *report);
119 int ipl_report_add_component(struct ipl_report *report, struct kexec_buf *kbuf,
120 			     unsigned char flags, unsigned short cert);
121 int ipl_report_add_certificate(struct ipl_report *report, void *key,
122 			       unsigned long addr, unsigned long len);
123 
124 /*
125  * DIAG 308 support
126  */
127 enum diag308_subcode  {
128 	DIAG308_REL_HSA = 2,
129 	DIAG308_LOAD_CLEAR = 3,
130 	DIAG308_LOAD_NORMAL_DUMP = 4,
131 	DIAG308_SET = 5,
132 	DIAG308_STORE = 6,
133 	DIAG308_LOAD_NORMAL = 7,
134 };
135 
136 enum diag308_rc {
137 	DIAG308_RC_OK		= 0x0001,
138 	DIAG308_RC_NOCONFIG	= 0x0102,
139 };
140 
141 extern int diag308(unsigned long subcode, void *addr);
142 extern void store_status(void (*fn)(void *), void *data);
143 extern void lgr_info_log(void);
144 
145 #endif /* _ASM_S390_IPL_H */
146