4 * Copyright 2015 IBM Corp.
5 * Author(s): Zhang Fan <bjfanzh@cn.ibm.com>
7 * This work is licensed under the terms of the GNU GPL, version 2 or (at
8 * your option) any later version. See the COPYING file in the top-level
19 uint8_t reserved0
[85];
29 typedef struct IplBlockCcw IplBlockCcw
;
32 uint8_t reserved1
[305 - 1];
41 uint8_t reserved5
[12];
43 uint32_t scp_data_len
;
44 uint8_t reserved6
[260];
47 typedef struct IplBlockFcp IplBlockFcp
;
49 struct IplBlockQemuScsi
{
53 uint8_t reserved0
[77];
57 typedef struct IplBlockQemuScsi IplBlockQemuScsi
;
59 #define DIAG308_FLAGS_LP_VALID 0x80
61 union IplParameterBlock
{
74 IplBlockQemuScsi scsi
;
78 uint8_t reserved1
[110];
80 uint8_t reserved2
[88];
81 uint8_t reserved_ext
[4096 - 200];
84 typedef union IplParameterBlock IplParameterBlock
;
86 int s390_ipl_set_loadparm(uint8_t *loadparm
);
87 void s390_ipl_update_diag308(IplParameterBlock
*iplb
);
88 void s390_ipl_prepare_cpu(S390CPU
*cpu
);
89 IplParameterBlock
*s390_ipl_get_iplb(void);
92 /* default is a reset not triggered by a CPU e.g. issued by QMP */
93 S390_RESET_EXTERNAL
= 0,
95 S390_RESET_MODIFIED_CLEAR
,
96 S390_RESET_LOAD_NORMAL
,
98 void s390_ipl_reset_request(CPUState
*cs
, enum s390_reset reset_type
);
99 void s390_ipl_get_reset_request(CPUState
**cs
, enum s390_reset
*reset_type
);
100 void s390_ipl_clear_reset_request(void);
102 #define QIPL_ADDRESS 0xcc
104 /* Boot Menu flags */
105 #define QIPL_FLAG_BM_OPTS_CMD 0x80
106 #define QIPL_FLAG_BM_OPTS_ZIPL 0x40
109 * The QEMU IPL Parameters will be stored at absolute address
110 * 204 (0xcc) which means it is 32-bit word aligned but not
111 * double-word aligned.
112 * Placement of data fields in this area must account for
113 * their alignment needs. E.g., netboot_start_address must
114 * have an offset of 4 + n * 8 bytes within the struct in order
115 * to keep it double-word aligned.
116 * The total size of the struct must never exceed 28 bytes.
117 * This definition must be kept in sync with the defininition
118 * in pc-bios/s390-ccw/iplb.h.
120 struct QemuIplParameters
{
122 uint8_t reserved1
[3];
123 uint64_t netboot_start_addr
;
124 uint32_t boot_menu_timeout
;
125 uint8_t reserved2
[12];
127 typedef struct QemuIplParameters QemuIplParameters
;
129 #define TYPE_S390_IPL "s390-ipl"
130 #define S390_IPL(obj) OBJECT_CHECK(S390IPLState, (obj), TYPE_S390_IPL)
132 struct S390IPLState
{
134 DeviceState parent_obj
;
136 uint64_t compat_start_addr
;
137 uint64_t bios_start_addr
;
138 uint64_t compat_bios_start_addr
;
140 IplParameterBlock iplb
;
143 QemuIplParameters qipl
;
144 /* reset related properties don't have to be migrated or reset */
145 enum s390_reset reset_type
;
157 bool iplbext_migration
;
159 typedef struct S390IPLState S390IPLState
;
161 #define S390_IPL_TYPE_FCP 0x00
162 #define S390_IPL_TYPE_CCW 0x02
163 #define S390_IPL_TYPE_QEMU_SCSI 0xff
165 #define S390_IPLB_HEADER_LEN 8
166 #define S390_IPLB_MIN_CCW_LEN 200
167 #define S390_IPLB_MIN_FCP_LEN 384
168 #define S390_IPLB_MIN_QEMU_SCSI_LEN 200
170 static inline bool iplb_valid_len(IplParameterBlock
*iplb
)
172 return be32_to_cpu(iplb
->len
) <= sizeof(IplParameterBlock
);
175 static inline bool iplb_valid_ccw(IplParameterBlock
*iplb
)
177 return be32_to_cpu(iplb
->len
) >= S390_IPLB_MIN_CCW_LEN
&&
178 iplb
->pbt
== S390_IPL_TYPE_CCW
;
181 static inline bool iplb_valid_fcp(IplParameterBlock
*iplb
)
183 return be32_to_cpu(iplb
->len
) >= S390_IPLB_MIN_FCP_LEN
&&
184 iplb
->pbt
== S390_IPL_TYPE_FCP
;