xref: /openbmc/linux/arch/s390/include/asm/ipl.h (revision 99feaa717e558cf4f2ad0faf53acac3cf9cc7438)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2c6557e7fSMartin Schwidefsky /*
3c6557e7fSMartin Schwidefsky  * s390 (re)ipl support
4c6557e7fSMartin Schwidefsky  *
5c6557e7fSMartin Schwidefsky  * Copyright IBM Corp. 2007
6c6557e7fSMartin Schwidefsky  */
7c6557e7fSMartin Schwidefsky 
8c6557e7fSMartin Schwidefsky #ifndef _ASM_S390_IPL_H
9c6557e7fSMartin Schwidefsky #define _ASM_S390_IPL_H
10c6557e7fSMartin Schwidefsky 
1158952942SMichael Holzheu #include <asm/lowcore.h>
12c6557e7fSMartin Schwidefsky #include <asm/types.h>
13c6557e7fSMartin Schwidefsky #include <asm/cio.h>
14c6557e7fSMartin Schwidefsky #include <asm/setup.h>
155f1207fbSMartin Schwidefsky #include <uapi/asm/ipl.h>
165f1207fbSMartin Schwidefsky 
175f1207fbSMartin Schwidefsky struct ipl_parameter_block {
185f1207fbSMartin Schwidefsky 	struct ipl_pl_hdr hdr;
195f1207fbSMartin Schwidefsky 	union {
205f1207fbSMartin Schwidefsky 		struct ipl_pb_hdr pb0_hdr;
215f1207fbSMartin Schwidefsky 		struct ipl_pb0_common common;
225f1207fbSMartin Schwidefsky 		struct ipl_pb0_fcp fcp;
235f1207fbSMartin Schwidefsky 		struct ipl_pb0_ccw ccw;
245f1207fbSMartin Schwidefsky 		char raw[PAGE_SIZE - sizeof(struct ipl_pl_hdr)];
255f1207fbSMartin Schwidefsky 	};
265f1207fbSMartin Schwidefsky } __packed __aligned(PAGE_SIZE);
27c6557e7fSMartin Schwidefsky 
28978fa72eSHeiko Carstens #define NSS_NAME_SIZE 8
29978fa72eSHeiko Carstens 
305f1207fbSMartin Schwidefsky #define IPL_BP_FCP_LEN (sizeof(struct ipl_pl_hdr) + \
315f1207fbSMartin Schwidefsky 			      sizeof(struct ipl_pb0_fcp))
325f1207fbSMartin Schwidefsky #define IPL_BP0_FCP_LEN (sizeof(struct ipl_pb0_fcp))
335f1207fbSMartin Schwidefsky #define IPL_BP_CCW_LEN (sizeof(struct ipl_pl_hdr) + \
345f1207fbSMartin Schwidefsky 			      sizeof(struct ipl_pb0_ccw))
355f1207fbSMartin Schwidefsky #define IPL_BP0_CCW_LEN (sizeof(struct ipl_pb0_ccw))
36c6557e7fSMartin Schwidefsky 
37c6557e7fSMartin Schwidefsky #define IPL_MAX_SUPPORTED_VERSION (0)
38c6557e7fSMartin Schwidefsky 
39*99feaa71SPhilipp Rudo #define IPL_RB_CERT_UNKNOWN ((unsigned short)-1)
40*99feaa71SPhilipp Rudo 
415f1207fbSMartin Schwidefsky #define DIAG308_VMPARM_SIZE (64)
425f1207fbSMartin Schwidefsky #define DIAG308_SCPDATA_OFFSET offsetof(struct ipl_parameter_block, \
435f1207fbSMartin Schwidefsky 					fcp.scp_data)
445f1207fbSMartin Schwidefsky #define DIAG308_SCPDATA_SIZE (PAGE_SIZE - DIAG308_SCPDATA_OFFSET)
45c6557e7fSMartin Schwidefsky 
461a2c5840SMartin Schwidefsky struct save_area;
471a2c5840SMartin Schwidefsky struct save_area * __init save_area_alloc(bool is_boot_cpu);
481a2c5840SMartin Schwidefsky struct save_area * __init save_area_boot_cpu(void);
491a2c5840SMartin Schwidefsky void __init save_area_add_regs(struct save_area *, void *regs);
501a2c5840SMartin Schwidefsky void __init save_area_add_vxrs(struct save_area *, __vector128 *vxrs);
5158952942SMichael Holzheu 
52d485235bSVasily Gorbik extern void s390_reset_system(void);
5349698745SVasily Gorbik extern size_t ipl_block_get_ascii_vmparm(char *dest, size_t size,
5449698745SVasily Gorbik 					 const struct ipl_parameter_block *ipb);
55c6557e7fSMartin Schwidefsky 
56c6557e7fSMartin Schwidefsky enum ipl_type {
57c6557e7fSMartin Schwidefsky 	IPL_TYPE_UNKNOWN	= 1,
58c6557e7fSMartin Schwidefsky 	IPL_TYPE_CCW		= 2,
59c6557e7fSMartin Schwidefsky 	IPL_TYPE_FCP		= 4,
60c6557e7fSMartin Schwidefsky 	IPL_TYPE_FCP_DUMP	= 8,
61c6557e7fSMartin Schwidefsky 	IPL_TYPE_NSS		= 16,
62c6557e7fSMartin Schwidefsky };
63c6557e7fSMartin Schwidefsky 
64c6557e7fSMartin Schwidefsky struct ipl_info
65c6557e7fSMartin Schwidefsky {
66c6557e7fSMartin Schwidefsky 	enum ipl_type type;
67c6557e7fSMartin Schwidefsky 	union {
68c6557e7fSMartin Schwidefsky 		struct {
69c6557e7fSMartin Schwidefsky 			struct ccw_dev_id dev_id;
70c6557e7fSMartin Schwidefsky 		} ccw;
71c6557e7fSMartin Schwidefsky 		struct {
72c6557e7fSMartin Schwidefsky 			struct ccw_dev_id dev_id;
73c6557e7fSMartin Schwidefsky 			u64 wwpn;
74c6557e7fSMartin Schwidefsky 			u64 lun;
75c6557e7fSMartin Schwidefsky 		} fcp;
76c6557e7fSMartin Schwidefsky 		struct {
77c6557e7fSMartin Schwidefsky 			char name[NSS_NAME_SIZE + 1];
78c6557e7fSMartin Schwidefsky 		} nss;
79c6557e7fSMartin Schwidefsky 	} data;
80c6557e7fSMartin Schwidefsky };
81c6557e7fSMartin Schwidefsky 
82c6557e7fSMartin Schwidefsky extern struct ipl_info ipl_info;
83c6557e7fSMartin Schwidefsky extern void setup_ipl(void);
843b967847SVasily Gorbik extern void set_os_info_reipl_block(void);
85c6557e7fSMartin Schwidefsky 
86937347acSMartin Schwidefsky struct ipl_report {
87937347acSMartin Schwidefsky 	struct ipl_parameter_block *ipib;
88937347acSMartin Schwidefsky 	struct list_head components;
89937347acSMartin Schwidefsky 	struct list_head certificates;
90937347acSMartin Schwidefsky 	size_t size;
91937347acSMartin Schwidefsky };
92937347acSMartin Schwidefsky 
93937347acSMartin Schwidefsky struct ipl_report_component {
94937347acSMartin Schwidefsky 	struct list_head list;
95937347acSMartin Schwidefsky 	struct ipl_rb_component_entry entry;
96937347acSMartin Schwidefsky };
97937347acSMartin Schwidefsky 
98937347acSMartin Schwidefsky struct ipl_report_certificate {
99937347acSMartin Schwidefsky 	struct list_head list;
100937347acSMartin Schwidefsky 	struct ipl_rb_certificate_entry entry;
101937347acSMartin Schwidefsky 	void *key;
102937347acSMartin Schwidefsky };
103937347acSMartin Schwidefsky 
104937347acSMartin Schwidefsky struct kexec_buf;
105937347acSMartin Schwidefsky struct ipl_report *ipl_report_init(struct ipl_parameter_block *ipib);
106937347acSMartin Schwidefsky void *ipl_report_finish(struct ipl_report *report);
107937347acSMartin Schwidefsky int ipl_report_free(struct ipl_report *report);
108937347acSMartin Schwidefsky int ipl_report_add_component(struct ipl_report *report, struct kexec_buf *kbuf,
109937347acSMartin Schwidefsky 			     unsigned char flags, unsigned short cert);
110937347acSMartin Schwidefsky int ipl_report_add_certificate(struct ipl_report *report, void *key,
111937347acSMartin Schwidefsky 			       unsigned long addr, unsigned long len);
112937347acSMartin Schwidefsky 
113c6557e7fSMartin Schwidefsky /*
114c6557e7fSMartin Schwidefsky  * DIAG 308 support
115c6557e7fSMartin Schwidefsky  */
116c6557e7fSMartin Schwidefsky enum diag308_subcode  {
117c6557e7fSMartin Schwidefsky 	DIAG308_REL_HSA = 2,
1180599eeadSHeiko Carstens 	DIAG308_LOAD_CLEAR = 3,
1190599eeadSHeiko Carstens 	DIAG308_LOAD_NORMAL_DUMP = 4,
120c6557e7fSMartin Schwidefsky 	DIAG308_SET = 5,
121c6557e7fSMartin Schwidefsky 	DIAG308_STORE = 6,
122c6557e7fSMartin Schwidefsky };
123c6557e7fSMartin Schwidefsky 
124c6557e7fSMartin Schwidefsky enum diag308_rc {
125c6557e7fSMartin Schwidefsky 	DIAG308_RC_OK		= 0x0001,
126c6557e7fSMartin Schwidefsky 	DIAG308_RC_NOCONFIG	= 0x0102,
127c6557e7fSMartin Schwidefsky };
128c6557e7fSMartin Schwidefsky 
129c6557e7fSMartin Schwidefsky extern int diag308(unsigned long subcode, void *addr);
1309dc7356eSMichael Holzheu extern void diag308_reset(void);
1311a36a39eSMartin Schwidefsky extern void store_status(void (*fn)(void *), void *data);
1323ab121abSMichael Holzheu extern void lgr_info_log(void);
133c6557e7fSMartin Schwidefsky 
134c6557e7fSMartin Schwidefsky #endif /* _ASM_S390_IPL_H */
135