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