1 /* 2 * S/390 boot structures 3 * 4 * Copyright 2024 IBM Corp. 5 * Author(s): Jared Rossi <jrossi@linux.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 S390X_QIPL_H 13 #define S390X_QIPL_H 14 15 /* Boot Menu flags */ 16 #define QIPL_FLAG_BM_OPTS_CMD 0x80 17 #define QIPL_FLAG_BM_OPTS_ZIPL 0x40 18 19 #define QIPL_ADDRESS 0xcc 20 #define LOADPARM_LEN 8 21 #define NO_LOADPARM "\0\0\0\0\0\0\0\0" 22 23 /* 24 * The QEMU IPL Parameters will be stored at absolute address 25 * 204 (0xcc) which means it is 32-bit word aligned but not 26 * double-word aligned. Placement of 64-bit data fields in this 27 * area must account for their alignment needs. 28 * The total size of the struct must never exceed 28 bytes. 29 */ 30 struct QemuIplParameters { 31 uint8_t qipl_flags; 32 uint8_t index; 33 uint8_t reserved1[2]; 34 uint64_t reserved2; 35 uint32_t boot_menu_timeout; 36 uint8_t reserved3[2]; 37 uint16_t chain_len; 38 uint64_t next_iplb; 39 } QEMU_PACKED; 40 typedef struct QemuIplParameters QemuIplParameters; 41 42 struct IPLBlockPVComp { 43 uint64_t tweak_pref; 44 uint64_t addr; 45 uint64_t size; 46 } QEMU_PACKED; 47 typedef struct IPLBlockPVComp IPLBlockPVComp; 48 49 struct IPLBlockPV { 50 uint8_t reserved18[87]; /* 0x18 */ 51 uint8_t version; /* 0x6f */ 52 uint32_t reserved70; /* 0x70 */ 53 uint32_t num_comp; /* 0x74 */ 54 uint64_t pv_header_addr; /* 0x78 */ 55 uint64_t pv_header_len; /* 0x80 */ 56 struct IPLBlockPVComp components[0]; 57 } QEMU_PACKED; 58 typedef struct IPLBlockPV IPLBlockPV; 59 60 struct IplBlockCcw { 61 uint8_t reserved0[85]; 62 uint8_t ssid; 63 uint16_t devno; 64 uint8_t vm_flags; 65 uint8_t reserved3[3]; 66 uint32_t vm_parm_len; 67 uint8_t nss_name[8]; 68 uint8_t vm_parm[64]; 69 uint8_t reserved4[8]; 70 } QEMU_PACKED; 71 typedef struct IplBlockCcw IplBlockCcw; 72 73 struct IplBlockFcp { 74 uint8_t reserved1[305 - 1]; 75 uint8_t opt; 76 uint8_t reserved2[3]; 77 uint16_t reserved3; 78 uint16_t devno; 79 uint8_t reserved4[4]; 80 uint64_t wwpn; 81 uint64_t lun; 82 uint32_t bootprog; 83 uint8_t reserved5[12]; 84 uint64_t br_lba; 85 uint32_t scp_data_len; 86 uint8_t reserved6[260]; 87 uint8_t scp_data[0]; 88 } QEMU_PACKED; 89 typedef struct IplBlockFcp IplBlockFcp; 90 91 struct IplBlockQemuScsi { 92 uint32_t lun; 93 uint16_t target; 94 uint16_t channel; 95 uint8_t reserved0[77]; 96 uint8_t ssid; 97 uint16_t devno; 98 } QEMU_PACKED; 99 typedef struct IplBlockQemuScsi IplBlockQemuScsi; 100 101 union IplParameterBlock { 102 struct { 103 uint32_t len; 104 uint8_t reserved0[3]; 105 uint8_t version; 106 uint32_t blk0_len; 107 uint8_t pbt; 108 uint8_t flags; 109 uint16_t reserved01; 110 uint8_t loadparm[LOADPARM_LEN]; 111 union { 112 IplBlockCcw ccw; 113 IplBlockFcp fcp; 114 IPLBlockPV pv; 115 IplBlockQemuScsi scsi; 116 }; 117 } QEMU_PACKED; 118 struct { 119 uint8_t reserved1[110]; 120 uint16_t devno; 121 uint8_t reserved2[88]; 122 uint8_t reserved_ext[4096 - 200]; 123 } QEMU_PACKED; 124 } QEMU_PACKED; 125 typedef union IplParameterBlock IplParameterBlock; 126 127 #endif 128