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