xref: /openbmc/linux/arch/s390/include/asm/ipl.h (revision 5f1207fbe74450eb887155ba432bfc079312b0fe)
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>
15*5f1207fbSMartin Schwidefsky #include <uapi/asm/ipl.h>
16*5f1207fbSMartin Schwidefsky 
17*5f1207fbSMartin Schwidefsky struct ipl_parameter_block {
18*5f1207fbSMartin Schwidefsky 	struct ipl_pl_hdr hdr;
19*5f1207fbSMartin Schwidefsky 	union {
20*5f1207fbSMartin Schwidefsky 		struct ipl_pb_hdr pb0_hdr;
21*5f1207fbSMartin Schwidefsky 		struct ipl_pb0_common common;
22*5f1207fbSMartin Schwidefsky 		struct ipl_pb0_fcp fcp;
23*5f1207fbSMartin Schwidefsky 		struct ipl_pb0_ccw ccw;
24*5f1207fbSMartin Schwidefsky 		char raw[PAGE_SIZE - sizeof(struct ipl_pl_hdr)];
25*5f1207fbSMartin Schwidefsky 	};
26*5f1207fbSMartin Schwidefsky } __packed __aligned(PAGE_SIZE);
27c6557e7fSMartin Schwidefsky 
28978fa72eSHeiko Carstens #define NSS_NAME_SIZE 8
29978fa72eSHeiko Carstens 
30*5f1207fbSMartin Schwidefsky #define IPL_BP_FCP_LEN (sizeof(struct ipl_pl_hdr) + \
31*5f1207fbSMartin Schwidefsky 			      sizeof(struct ipl_pb0_fcp))
32*5f1207fbSMartin Schwidefsky #define IPL_BP0_FCP_LEN (sizeof(struct ipl_pb0_fcp))
33*5f1207fbSMartin Schwidefsky #define IPL_BP_CCW_LEN (sizeof(struct ipl_pl_hdr) + \
34*5f1207fbSMartin Schwidefsky 			      sizeof(struct ipl_pb0_ccw))
35*5f1207fbSMartin Schwidefsky #define IPL_BP0_CCW_LEN (sizeof(struct ipl_pb0_ccw))
36c6557e7fSMartin Schwidefsky 
37c6557e7fSMartin Schwidefsky #define IPL_MAX_SUPPORTED_VERSION (0)
38c6557e7fSMartin Schwidefsky 
39*5f1207fbSMartin Schwidefsky #define DIAG308_VMPARM_SIZE (64)
40*5f1207fbSMartin Schwidefsky #define DIAG308_SCPDATA_OFFSET offsetof(struct ipl_parameter_block, \
41*5f1207fbSMartin Schwidefsky 					fcp.scp_data)
42*5f1207fbSMartin Schwidefsky #define DIAG308_SCPDATA_SIZE (PAGE_SIZE - DIAG308_SCPDATA_OFFSET)
43c6557e7fSMartin Schwidefsky 
441a2c5840SMartin Schwidefsky struct save_area;
451a2c5840SMartin Schwidefsky struct save_area * __init save_area_alloc(bool is_boot_cpu);
461a2c5840SMartin Schwidefsky struct save_area * __init save_area_boot_cpu(void);
471a2c5840SMartin Schwidefsky void __init save_area_add_regs(struct save_area *, void *regs);
481a2c5840SMartin Schwidefsky void __init save_area_add_vxrs(struct save_area *, __vector128 *vxrs);
4958952942SMichael Holzheu 
50d485235bSVasily Gorbik extern void s390_reset_system(void);
5149698745SVasily Gorbik extern size_t ipl_block_get_ascii_vmparm(char *dest, size_t size,
5249698745SVasily Gorbik 					 const struct ipl_parameter_block *ipb);
53c6557e7fSMartin Schwidefsky 
54c6557e7fSMartin Schwidefsky enum ipl_type {
55c6557e7fSMartin Schwidefsky 	IPL_TYPE_UNKNOWN	= 1,
56c6557e7fSMartin Schwidefsky 	IPL_TYPE_CCW		= 2,
57c6557e7fSMartin Schwidefsky 	IPL_TYPE_FCP		= 4,
58c6557e7fSMartin Schwidefsky 	IPL_TYPE_FCP_DUMP	= 8,
59c6557e7fSMartin Schwidefsky 	IPL_TYPE_NSS		= 16,
60c6557e7fSMartin Schwidefsky };
61c6557e7fSMartin Schwidefsky 
62c6557e7fSMartin Schwidefsky struct ipl_info
63c6557e7fSMartin Schwidefsky {
64c6557e7fSMartin Schwidefsky 	enum ipl_type type;
65c6557e7fSMartin Schwidefsky 	union {
66c6557e7fSMartin Schwidefsky 		struct {
67c6557e7fSMartin Schwidefsky 			struct ccw_dev_id dev_id;
68c6557e7fSMartin Schwidefsky 		} ccw;
69c6557e7fSMartin Schwidefsky 		struct {
70c6557e7fSMartin Schwidefsky 			struct ccw_dev_id dev_id;
71c6557e7fSMartin Schwidefsky 			u64 wwpn;
72c6557e7fSMartin Schwidefsky 			u64 lun;
73c6557e7fSMartin Schwidefsky 		} fcp;
74c6557e7fSMartin Schwidefsky 		struct {
75c6557e7fSMartin Schwidefsky 			char name[NSS_NAME_SIZE + 1];
76c6557e7fSMartin Schwidefsky 		} nss;
77c6557e7fSMartin Schwidefsky 	} data;
78c6557e7fSMartin Schwidefsky };
79c6557e7fSMartin Schwidefsky 
80c6557e7fSMartin Schwidefsky extern struct ipl_info ipl_info;
81c6557e7fSMartin Schwidefsky extern void setup_ipl(void);
823b967847SVasily Gorbik extern void set_os_info_reipl_block(void);
83c6557e7fSMartin Schwidefsky 
84c6557e7fSMartin Schwidefsky /*
85c6557e7fSMartin Schwidefsky  * DIAG 308 support
86c6557e7fSMartin Schwidefsky  */
87c6557e7fSMartin Schwidefsky enum diag308_subcode  {
88c6557e7fSMartin Schwidefsky 	DIAG308_REL_HSA = 2,
890599eeadSHeiko Carstens 	DIAG308_LOAD_CLEAR = 3,
900599eeadSHeiko Carstens 	DIAG308_LOAD_NORMAL_DUMP = 4,
91c6557e7fSMartin Schwidefsky 	DIAG308_SET = 5,
92c6557e7fSMartin Schwidefsky 	DIAG308_STORE = 6,
93c6557e7fSMartin Schwidefsky };
94c6557e7fSMartin Schwidefsky 
95c6557e7fSMartin Schwidefsky enum diag308_rc {
96c6557e7fSMartin Schwidefsky 	DIAG308_RC_OK		= 0x0001,
97c6557e7fSMartin Schwidefsky 	DIAG308_RC_NOCONFIG	= 0x0102,
98c6557e7fSMartin Schwidefsky };
99c6557e7fSMartin Schwidefsky 
100c6557e7fSMartin Schwidefsky extern int diag308(unsigned long subcode, void *addr);
1019dc7356eSMichael Holzheu extern void diag308_reset(void);
1021a36a39eSMartin Schwidefsky extern void store_status(void (*fn)(void *), void *data);
1033ab121abSMichael Holzheu extern void lgr_info_log(void);
104c6557e7fSMartin Schwidefsky 
105c6557e7fSMartin Schwidefsky #endif /* _ASM_S390_IPL_H */
106