vfio/pci: Add a separate option for IGD OpRegion support
[qemu.git] / pc-bios / s390-ccw / iplb.h
1 /*
2 * QEMU S390 IPL Block
3 *
4 * Copyright 2015 IBM Corp.
5 * Author(s): Alexander Yarygin <yarygin@linux.vnet.ibm.com>
6 *
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
9 * directory.
10 */
11
12 #ifndef IPLB_H
13 #define IPLB_H
14
15 struct IplBlockCcw {
16 uint8_t reserved0[85];
17 uint8_t ssid;
18 uint16_t devno;
19 uint8_t vm_flags;
20 uint8_t reserved3[3];
21 uint32_t vm_parm_len;
22 uint8_t nss_name[8];
23 uint8_t vm_parm[64];
24 uint8_t reserved4[8];
25 } __attribute__ ((packed));
26 typedef struct IplBlockCcw IplBlockCcw;
27
28 struct IplBlockFcp {
29 uint8_t reserved1[305 - 1];
30 uint8_t opt;
31 uint8_t reserved2[3];
32 uint16_t reserved3;
33 uint16_t devno;
34 uint8_t reserved4[4];
35 uint64_t wwpn;
36 uint64_t lun;
37 uint32_t bootprog;
38 uint8_t reserved5[12];
39 uint64_t br_lba;
40 uint32_t scp_data_len;
41 uint8_t reserved6[260];
42 uint8_t scp_data[];
43 } __attribute__ ((packed));
44 typedef struct IplBlockFcp IplBlockFcp;
45
46 struct IplParameterBlock {
47 uint32_t len;
48 uint8_t reserved0[3];
49 uint8_t version;
50 uint32_t blk0_len;
51 uint8_t pbt;
52 uint8_t flags;
53 uint16_t reserved01;
54 uint8_t loadparm[8];
55 union {
56 IplBlockCcw ccw;
57 IplBlockFcp fcp;
58 };
59 } __attribute__ ((packed));
60 typedef struct IplParameterBlock IplParameterBlock;
61
62 extern IplParameterBlock iplb __attribute__((__aligned__(PAGE_SIZE)));
63
64 #define S390_IPL_TYPE_FCP 0x00
65 #define S390_IPL_TYPE_CCW 0x02
66
67 static inline bool store_iplb(IplParameterBlock *iplb)
68 {
69 register unsigned long addr asm("0") = (unsigned long) iplb;
70 register unsigned long rc asm("1") = 0;
71
72 asm volatile ("diag %0,%2,0x308\n"
73 : "+d" (addr), "+d" (rc)
74 : "d" (6)
75 : "memory", "cc");
76 return rc == 0x01;
77 }
78
79 #endif /* IPLB_H */