4 * Copyright 2015 IBM Corp.
5 * Author(s): Alexander Yarygin <yarygin@linux.vnet.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
15 #define LOADPARM_LEN 8
18 uint8_t reserved0
[85];
27 } __attribute__ ((packed
));
28 typedef struct IplBlockCcw IplBlockCcw
;
31 uint8_t reserved1
[305 - 1];
40 uint8_t reserved5
[12];
42 uint32_t scp_data_len
;
43 uint8_t reserved6
[260];
45 } __attribute__ ((packed
));
46 typedef struct IplBlockFcp IplBlockFcp
;
48 struct IplBlockQemuScsi
{
52 uint8_t reserved0
[77];
55 } __attribute__ ((packed
));
56 typedef struct IplBlockQemuScsi IplBlockQemuScsi
;
58 struct IplParameterBlock
{
66 uint8_t loadparm
[LOADPARM_LEN
];
70 IplBlockQemuScsi scsi
;
72 } __attribute__ ((packed
));
73 typedef struct IplParameterBlock IplParameterBlock
;
75 extern IplParameterBlock iplb
__attribute__((__aligned__(PAGE_SIZE
)));
77 #define QIPL_ADDRESS 0xcc
80 #define QIPL_FLAG_BM_OPTS_CMD 0x80
81 #define QIPL_FLAG_BM_OPTS_ZIPL 0x40
84 * This definition must be kept in sync with the definition
87 struct QemuIplParameters
{
90 uint64_t netboot_start_addr
;
91 uint32_t boot_menu_timeout
;
92 uint8_t reserved2
[12];
93 } __attribute__ ((packed
));
94 typedef struct QemuIplParameters QemuIplParameters
;
96 extern QemuIplParameters qipl
;
98 #define S390_IPL_TYPE_FCP 0x00
99 #define S390_IPL_TYPE_CCW 0x02
100 #define S390_IPL_TYPE_QEMU_SCSI 0xff
102 static inline bool manage_iplb(IplParameterBlock
*iplb
, bool store
)
104 register unsigned long addr
asm("0") = (unsigned long) iplb
;
105 register unsigned long rc
asm("1") = 0;
106 unsigned long subcode
= store
? 6 : 5;
108 asm volatile ("diag %0,%2,0x308\n"
109 : "+d" (addr
), "+d" (rc
)
116 static inline bool store_iplb(IplParameterBlock
*iplb
)
118 return manage_iplb(iplb
, true);
121 static inline bool set_iplb(IplParameterBlock
*iplb
)
123 return manage_iplb(iplb
, false);