1*5597088cSDongdong Hao /* SPDX-License-Identifier: GPL-2.0 */ 2*5597088cSDongdong Hao /* 3*5597088cSDongdong Hao * Copyright (C) 2026 LeapIO Tech Inc. 4*5597088cSDongdong Hao * 5*5597088cSDongdong Hao * LeapRAID storage and RAID controller driver. 6*5597088cSDongdong Hao */ 7*5597088cSDongdong Hao #ifndef LEAPRAID_H 8*5597088cSDongdong Hao #define LEAPRAID_H 9*5597088cSDongdong Hao 10*5597088cSDongdong Hao /* Doorbell register definitions. */ 11*5597088cSDongdong Hao #define LEAPRAID_DB_RESET 0x00000000 12*5597088cSDongdong Hao #define LEAPRAID_DB_READY 0x10000000 13*5597088cSDongdong Hao #define LEAPRAID_DB_OPERATIONAL 0x20000000 14*5597088cSDongdong Hao #define LEAPRAID_DB_FAULT 0x40000000 15*5597088cSDongdong Hao 16*5597088cSDongdong Hao #define LEAPRAID_DB_MASK 0xF0000000 17*5597088cSDongdong Hao 18*5597088cSDongdong Hao #define LEAPRAID_DB_OVER_TEMPERATURE 0x2810 19*5597088cSDongdong Hao 20*5597088cSDongdong Hao #define LEAPRAID_DB_USED 0x08000000 21*5597088cSDongdong Hao #define LEAPRAID_DB_DATA_MASK 0x0000FFFF 22*5597088cSDongdong Hao #define LEAPRAID_DB_FUNC_SHIFT 24 23*5597088cSDongdong Hao #define LEAPRAID_DB_ADD_DWORDS_SHIFT 16 24*5597088cSDongdong Hao 25*5597088cSDongdong Hao /* Maximum number of retries waiting for doorbell to become ready. */ 26*5597088cSDongdong Hao #define LEAPRAID_DB_RETRY_COUNT_MAX 10 27*5597088cSDongdong Hao /* Maximum number of retries waiting for doorbell to become operational. */ 28*5597088cSDongdong Hao #define LEAPRAID_DB_WAIT_OP_SHORT 10 29*5597088cSDongdong Hao #define LEAPRAID_DB_WAIT_OP_LONG 200 30*5597088cSDongdong Hao 31*5597088cSDongdong Hao /* Maximum number of retries waiting for host to end recovery. */ 32*5597088cSDongdong Hao #define LEAPRAID_WAIT_SHOST_RECOVERY 400 33*5597088cSDongdong Hao 34*5597088cSDongdong Hao /* Diagnostic register definitions. */ 35*5597088cSDongdong Hao #define LEAPRAID_DIAG_WRITE_ENABLE 0x00000080 36*5597088cSDongdong Hao #define LEAPRAID_DIAG_RESET 0x00000004 37*5597088cSDongdong Hao 38*5597088cSDongdong Hao /* Interrupt status register definitions. */ 39*5597088cSDongdong Hao #define LEAPRAID_HOST2ADAPTER_DB_STATUS 0x80000000 40*5597088cSDongdong Hao #define LEAPRAID_ADAPTER2HOST_DB_STATUS 0x00000001 41*5597088cSDongdong Hao 42*5597088cSDongdong Hao /* The number of debug register. */ 43*5597088cSDongdong Hao #define LEAPRAID_DEBUGLOG_SZ_MAX 16 44*5597088cSDongdong Hao 45*5597088cSDongdong Hao /* Reply post host register definitions. */ 46*5597088cSDongdong Hao #define REP_POST_HOST_IDX_REG_CNT 16 47*5597088cSDongdong Hao #define LEAPRAID_RPHI_MSIX_IDX_SHIFT 24 48*5597088cSDongdong Hao 49*5597088cSDongdong Hao /* Virtual PHY flags. */ 50*5597088cSDongdong Hao #define LEAPRAID_SAS_PHYINFO_VPHY 0x00001000 51*5597088cSDongdong Hao 52*5597088cSDongdong Hao /* Linux driver init firmware. */ 53*5597088cSDongdong Hao #define LEAPRAID_WHOINIT_LINUX_DRIVER 0x04 54*5597088cSDongdong Hao 55*5597088cSDongdong Hao /* Reply descriptor post queue array mode. */ 56*5597088cSDongdong Hao #define LEAPRAID_ADAPTER_INIT_MSGFLG_RDPQ_ARRAY_MODE 0x01 57*5597088cSDongdong Hao 58*5597088cSDongdong Hao /* Request description flags. */ 59*5597088cSDongdong Hao #define LEAPRAID_REQ_DESC_FLG_SCSI_IO 0x00 60*5597088cSDongdong Hao #define LEAPRAID_REQ_DESC_FLG_HPR 0x06 61*5597088cSDongdong Hao #define LEAPRAID_REQ_DESC_FLG_DFLT_TYPE 0x08 62*5597088cSDongdong Hao 63*5597088cSDongdong Hao /* Reply description flags. */ 64*5597088cSDongdong Hao #define LEAPRAID_RPY_DESC_FLG_TYPE_MASK 0x0F 65*5597088cSDongdong Hao #define LEAPRAID_RPY_DESC_FLG_SCSI_IO_SUCCESS 0x00 66*5597088cSDongdong Hao #define LEAPRAID_RPY_DESC_FLG_ADDRESS_REPLY 0x01 67*5597088cSDongdong Hao #define LEAPRAID_RPY_DESC_FLG_FP_SCSI_IO_SUCCESS 0x06 68*5597088cSDongdong Hao #define LEAPRAID_RPY_DESC_FLG_UNUSED 0x0F 69*5597088cSDongdong Hao 70*5597088cSDongdong Hao /* Request and reply messages share the same set of function codes. 71*5597088cSDongdong Hao * 72*5597088cSDongdong Hao * Note: SCSIIO (SCSI I/O) represents SCSI I/O operations and is used 73*5597088cSDongdong Hao * consistently throughout the driver for all SCSI command handling. 74*5597088cSDongdong Hao */ 75*5597088cSDongdong Hao #define LEAPRAID_FUNC_SCSIIO 0x00 76*5597088cSDongdong Hao #define LEAPRAID_FUNC_SCSI_TMF 0x01 77*5597088cSDongdong Hao #define LEAPRAID_FUNC_ADAPTER_INIT 0x02 78*5597088cSDongdong Hao #define LEAPRAID_FUNC_GET_ADAPTER_FEATURES 0x03 79*5597088cSDongdong Hao #define LEAPRAID_FUNC_CONFIG_OP 0x04 80*5597088cSDongdong Hao #define LEAPRAID_FUNC_SCAN_DEV 0x06 81*5597088cSDongdong Hao #define LEAPRAID_FUNC_EVENT_NOTIFY 0x07 82*5597088cSDongdong Hao #define LEAPRAID_FUNC_FW_DOWNLOAD 0x09 83*5597088cSDongdong Hao #define LEAPRAID_FUNC_FW_UPLOAD 0x12 84*5597088cSDongdong Hao #define LEAPRAID_FUNC_SCSIIO_RAID_PASSTHROUGH 0x16 85*5597088cSDongdong Hao #define LEAPRAID_FUNC_SCSI_ENC_PROCESSOR 0x18 86*5597088cSDongdong Hao #define LEAPRAID_FUNC_SMP_PASSTHROUGH 0x1A 87*5597088cSDongdong Hao #define LEAPRAID_FUNC_SAS_IO_UNIT_CTRL 0x1B 88*5597088cSDongdong Hao #define LEAPRAID_FUNC_SCSIIO_SATA_PASSTHROUGH 0x1C 89*5597088cSDongdong Hao #define LEAPRAID_FUNC_ADAPTER_UNIT_RESET 0x40 90*5597088cSDongdong Hao #define LEAPRAID_FUNC_HANDSHAKE 0x42 91*5597088cSDongdong Hao #define LEAPRAID_FUNC_LOGBUF_INIT 0x57 92*5597088cSDongdong Hao 93*5597088cSDongdong Hao /* Adapter status values. */ 94*5597088cSDongdong Hao #define LEAPRAID_ADAPTER_STATUS_MASK 0x7FFF 95*5597088cSDongdong Hao #define LEAPRAID_ADAPTER_STATUS_SUCCESS 0x0000 96*5597088cSDongdong Hao #define LEAPRAID_ADAPTER_STATUS_BUSY 0x0002 97*5597088cSDongdong Hao #define LEAPRAID_ADAPTER_STATUS_INTERNAL_ERROR 0x0004 98*5597088cSDongdong Hao #define LEAPRAID_ADAPTER_STATUS_INSUFFICIENT_RESOURCES 0x0006 99*5597088cSDongdong Hao #define LEAPRAID_ADAPTER_STATUS_CONFIG_INVALID_ACTION 0x0020 100*5597088cSDongdong Hao #define LEAPRAID_ADAPTER_STATUS_CONFIG_INVALID_TYPE 0x0021 101*5597088cSDongdong Hao #define LEAPRAID_ADAPTER_STATUS_CONFIG_INVALID_PAGE 0x0022 102*5597088cSDongdong Hao #define LEAPRAID_ADAPTER_STATUS_CONFIG_INVALID_DATA 0x0023 103*5597088cSDongdong Hao #define LEAPRAID_ADAPTER_STATUS_CONFIG_NO_DEFAULTS 0x0024 104*5597088cSDongdong Hao #define LEAPRAID_ADAPTER_STATUS_CONFIG_CANT_COMMIT 0x0025 105*5597088cSDongdong Hao #define LEAPRAID_ADAPTER_STATUS_SCSI_RECOVERED_ERROR 0x0040 106*5597088cSDongdong Hao #define LEAPRAID_ADAPTER_STATUS_SCSI_DEVICE_NOT_THERE 0x0043 107*5597088cSDongdong Hao #define LEAPRAID_ADAPTER_STATUS_SCSI_DATA_OVERRUN 0x0044 108*5597088cSDongdong Hao #define LEAPRAID_ADAPTER_STATUS_SCSI_DATA_UNDERRUN 0x0045 109*5597088cSDongdong Hao #define LEAPRAID_ADAPTER_STATUS_SCSI_IO_DATA_ERROR 0x0046 110*5597088cSDongdong Hao #define LEAPRAID_ADAPTER_STATUS_SCSI_PROTOCOL_ERROR 0x0047 111*5597088cSDongdong Hao #define LEAPRAID_ADAPTER_STATUS_SCSI_TASK_TERMINATED 0x0048 112*5597088cSDongdong Hao #define LEAPRAID_ADAPTER_STATUS_SCSI_RESIDUAL_MISMATCH 0x0049 113*5597088cSDongdong Hao #define LEAPRAID_ADAPTER_STATUS_SCSI_TASK_MGMT_FAILED 0x004A 114*5597088cSDongdong Hao #define LEAPRAID_ADAPTER_STATUS_SCSI_ADAPTER_TERMINATED 0x004B 115*5597088cSDongdong Hao #define LEAPRAID_ADAPTER_STATUS_SCSI_EXT_TERMINATED 0x004C 116*5597088cSDongdong Hao 117*5597088cSDongdong Hao /* SGE flags. */ 118*5597088cSDongdong Hao #define LEAPRAID_SGE_FLG_LAST_ONE 0x80 119*5597088cSDongdong Hao #define LEAPRAID_SGE_FLG_EOB 0x40 120*5597088cSDongdong Hao #define LEAPRAID_SGE_FLG_EOL 0x01 121*5597088cSDongdong Hao #define LEAPRAID_SGE_FLG_SHIFT 24 122*5597088cSDongdong Hao #define LEAPRAID_SGE_FLG_SIMPLE_ONE 0x10 123*5597088cSDongdong Hao #define LEAPRAID_SGE_FLG_SYSTEM_ADDR 0x00 124*5597088cSDongdong Hao #define LEAPRAID_SGE_FLG_H2C 0x04 125*5597088cSDongdong Hao #define LEAPRAID_SGE_FLG_32 0x00 126*5597088cSDongdong Hao #define LEAPRAID_SGE_FLG_64 0x02 127*5597088cSDongdong Hao 128*5597088cSDongdong Hao #define LEAPRAID_IEEE_SGE_FLG_EOL 0x40 129*5597088cSDongdong Hao #define LEAPRAID_IEEE_SGE_FLG_SIMPLE_ONE 0x00 130*5597088cSDongdong Hao #define LEAPRAID_IEEE_SGE_FLG_CHAIN_ONE 0x80 131*5597088cSDongdong Hao #define LEAPRAID_IEEE_SGE_FLG_SYSTEM_ADDR 0x00 132*5597088cSDongdong Hao 133*5597088cSDongdong Hao #define LEAPRAID_SGE_NO_DATA_ADDR -1 134*5597088cSDongdong Hao #define LEAPRAID_SGE_OFFSET_SIZE 4 135*5597088cSDongdong Hao 136*5597088cSDongdong Hao /* The type of page. */ 137*5597088cSDongdong Hao #define LEAPRAID_CFG_PT_IO_UNIT 0x00 138*5597088cSDongdong Hao #define LEAPRAID_CFG_PT_ADAPTER 0x01 139*5597088cSDongdong Hao #define LEAPRAID_CFG_PT_BIOS 0x02 140*5597088cSDongdong Hao #define LEAPRAID_CFG_PT_RAID_VOLUME 0x08 141*5597088cSDongdong Hao #define LEAPRAID_CFG_PT_MANUFACTURING 0x09 142*5597088cSDongdong Hao #define LEAPRAID_CFG_PT_RAID_PHYSDISK 0x0A 143*5597088cSDongdong Hao #define LEAPRAID_CFG_PT_EXTENDED 0x0F 144*5597088cSDongdong Hao 145*5597088cSDongdong Hao /* The type of extended page. */ 146*5597088cSDongdong Hao #define LEAPRAID_CFG_EXTPT_SAS_IO_UNIT 0x10 147*5597088cSDongdong Hao #define LEAPRAID_CFG_EXTPT_SAS_EXP 0x11 148*5597088cSDongdong Hao #define LEAPRAID_CFG_EXTPT_SAS_DEV 0x12 149*5597088cSDongdong Hao #define LEAPRAID_CFG_EXTPT_SAS_PHY 0x13 150*5597088cSDongdong Hao #define LEAPRAID_CFG_EXTPT_ENC 0x15 151*5597088cSDongdong Hao #define LEAPRAID_CFG_EXTPT_RAID_CONFIG 0x16 152*5597088cSDongdong Hao 153*5597088cSDongdong Hao /* Config page address. */ 154*5597088cSDongdong Hao #define LEAPRAID_SAS_CFG_PGAD_GET_NEXT_LOOP 0x00000000 155*5597088cSDongdong Hao #define LEAPRAID_SAS_ENC_CFG_PGAD_HDL 0x10000000 156*5597088cSDongdong Hao #define LEAPRAID_SAS_DEV_CFG_PGAD_HDL 0x20000000 157*5597088cSDongdong Hao #define LEAPRAID_SAS_EXP_CFG_PGAD_HDL_PHY_NUM 0x10000000 158*5597088cSDongdong Hao #define LEAPRAID_SAS_EXP_CFD_PGAD_HDL 0x20000000 159*5597088cSDongdong Hao #define LEAPRAID_SAS_EXP_CFG_PGAD_PHYNUM_SHIFT 16 160*5597088cSDongdong Hao #define LEAPRAID_RAID_VOL_CFG_PGAD_HDL 0x10000000 161*5597088cSDongdong Hao #define LEAPRAID_SAS_PHY_CFG_PGAD_PHY_NUMBER 0x00000000 162*5597088cSDongdong Hao #define LEAPRAID_PHYSDISK_CFG_PGAD_PHYSDISKNUM 0x10000000 163*5597088cSDongdong Hao 164*5597088cSDongdong Hao /* Config page operations. */ 165*5597088cSDongdong Hao #define LEAPRAID_CFG_ACT_PAGE_HEADER 0x00 166*5597088cSDongdong Hao #define LEAPRAID_CFG_ACT_PAGE_READ_CUR 0x01 167*5597088cSDongdong Hao #define LEAPRAID_CFG_ACT_PAGE_WRITE_CUR 0x02 168*5597088cSDongdong Hao 169*5597088cSDongdong Hao /* BIOS page number. */ 170*5597088cSDongdong Hao #define LEAPRAID_CFG_PAGE_NUM_BIOS2 0x2 171*5597088cSDongdong Hao #define LEAPRAID_CFG_PAGE_NUM_BIOS3 0x3 172*5597088cSDongdong Hao 173*5597088cSDongdong Hao /* Manufacturing page number. */ 174*5597088cSDongdong Hao #define LEAPRAID_CFG_PAGE_NUM_MANU0 0x0 175*5597088cSDongdong Hao 176*5597088cSDongdong Hao /* SAS device page number. */ 177*5597088cSDongdong Hao #define LEAPRAID_CFG_PAGE_NUM_DEV0 0x0 178*5597088cSDongdong Hao 179*5597088cSDongdong Hao /* SAS device page 0 flags. */ 180*5597088cSDongdong Hao #define LEAPRAID_SAS_DEV_P0_FLG_ENC_LEVEL_VALID 0x0002 181*5597088cSDongdong Hao #define LEAPRAID_SAS_DEV_P0_FLG_DEV_PRESENT 0x0001 182*5597088cSDongdong Hao #define LEAPRAID_SAS_DEV_P0_CON_NAME_LEN 4 183*5597088cSDongdong Hao 184*5597088cSDongdong Hao /* SAS I/O unit page number. */ 185*5597088cSDongdong Hao #define LEAPRAID_CFG_PAGE_NUM_IOUNIT0 0x0 186*5597088cSDongdong Hao #define LEAPRAID_CFG_PAGE_NUM_IOUNIT1 0x1 187*5597088cSDongdong Hao 188*5597088cSDongdong Hao /* SAS expander page number. */ 189*5597088cSDongdong Hao #define LEAPRAID_CFG_PAGE_NUM_EXP0 0x0 190*5597088cSDongdong Hao #define LEAPRAID_CFG_PAGE_NUM_EXP1 0x1 191*5597088cSDongdong Hao 192*5597088cSDongdong Hao /* SAS enclosure page number. */ 193*5597088cSDongdong Hao #define LEAPRAID_CFG_PAGE_NUM_ENC0 0x0 194*5597088cSDongdong Hao 195*5597088cSDongdong Hao /* SAS PHY page number. */ 196*5597088cSDongdong Hao #define LEAPRAID_CFG_PAGE_NUM_PHY0 0x0 197*5597088cSDongdong Hao 198*5597088cSDongdong Hao /* RAID volume page number. */ 199*5597088cSDongdong Hao #define LEAPRAID_CFG_PAGE_NUM_VOL0 0x0 200*5597088cSDongdong Hao #define LEAPRAID_CFG_PAGE_NUM_VOL1 0x1 201*5597088cSDongdong Hao 202*5597088cSDongdong Hao /* Physical disk page number. */ 203*5597088cSDongdong Hao #define LEAPRAID_CFG_PAGE_NUM_PD0 0x0 204*5597088cSDongdong Hao 205*5597088cSDongdong Hao #define LEAPRAID_CFG_UNIT_SIZE 4 206*5597088cSDongdong Hao 207*5597088cSDongdong Hao /* Raid volume type and state. */ 208*5597088cSDongdong Hao #define LEAPRAID_VOL_STATE_ONLINE 0x03 209*5597088cSDongdong Hao #define LEAPRAID_VOL_STATE_DEGRADED 0x04 210*5597088cSDongdong Hao #define LEAPRAID_VOL_STATE_OPTIMAL 0x05 211*5597088cSDongdong Hao #define LEAPRAID_VOL_TYPE_RAID0 0x00 212*5597088cSDongdong Hao #define LEAPRAID_VOL_TYPE_RAID1E 0x01 213*5597088cSDongdong Hao #define LEAPRAID_VOL_TYPE_RAID1 0x02 214*5597088cSDongdong Hao #define LEAPRAID_VOL_TYPE_RAID10 0x05 215*5597088cSDongdong Hao #define LEAPRAID_VOL_TYPE_UNKNOWN 0xFF 216*5597088cSDongdong Hao 217*5597088cSDongdong Hao /* Raid volume element flags. */ 218*5597088cSDongdong Hao #define LEAPRAID_RAIDCFG_P0_EFLG_MASK_ELEMENT_TYPE 0x000F 219*5597088cSDongdong Hao #define LEAPRAID_RAIDCFG_P0_EFLG_VOL_PHYS_DISK_ELEMENT 0x0001 220*5597088cSDongdong Hao #define LEAPRAID_RAIDCFG_P0_EFLG_HOT_SPARE_ELEMENT 0x0002 221*5597088cSDongdong Hao #define LEAPRAID_RAIDCFG_P0_EFLG_OCE_ELEMENT 0x0003 222*5597088cSDongdong Hao 223*5597088cSDongdong Hao /* SAS negotiated link rates. */ 224*5597088cSDongdong Hao #define LEAPRAID_SAS_NEG_LINK_RATE_MASK_PHYSICAL 0x0F 225*5597088cSDongdong Hao #define LEAPRAID_SAS_NEG_LINK_RATE_UNKNOWN_LINK_RATE 0x00 226*5597088cSDongdong Hao #define LEAPRAID_SAS_NEG_LINK_RATE_PHY_DISABLED 0x01 227*5597088cSDongdong Hao #define LEAPRAID_SAS_NEG_LINK_RATE_NEGOTIATION_FAILED 0x02 228*5597088cSDongdong Hao #define LEAPRAID_SAS_NEG_LINK_RATE_SATA_OOB_COMPLETE 0x03 229*5597088cSDongdong Hao #define LEAPRAID_SAS_NEG_LINK_RATE_PORT_SELECTOR 0x04 230*5597088cSDongdong Hao #define LEAPRAID_SAS_NEG_LINK_RATE_SMP_RESETTING 0x05 231*5597088cSDongdong Hao #define LEAPRAID_SAS_NEG_LINK_RATE_SHIFT 4 232*5597088cSDongdong Hao 233*5597088cSDongdong Hao #define LEAPRAID_SAS_NEG_LINK_RATE_1_5 0x08 234*5597088cSDongdong Hao #define LEAPRAID_SAS_NEG_LINK_RATE_3_0 0x09 235*5597088cSDongdong Hao #define LEAPRAID_SAS_NEG_LINK_RATE_6_0 0x0A 236*5597088cSDongdong Hao #define LEAPRAID_SAS_NEG_LINK_RATE_12_0 0x0B 237*5597088cSDongdong Hao 238*5597088cSDongdong Hao #define LEAPRAID_SAS_PRATE_MIN_RATE_MASK 0x0F 239*5597088cSDongdong Hao #define LEAPRAID_SAS_HWRATE_MIN_RATE_MASK 0x0F 240*5597088cSDongdong Hao 241*5597088cSDongdong Hao /* 242*5597088cSDongdong Hao * Control flags for a SCSI I/O Request. 243*5597088cSDongdong Hao */ 244*5597088cSDongdong Hao #define LEAPRAID_SCSIIO_CTRL_CDB_32BYTE 4 245*5597088cSDongdong Hao #define LEAPRAID_SCSIIO_CTRL_CDB_LEN_SHIFT 26 246*5597088cSDongdong Hao #define LEAPRAID_SCSIIO_CTRL_NODATATRANSFER 0x00000000 247*5597088cSDongdong Hao #define LEAPRAID_SCSIIO_CTRL_WRITE 0x01000000 248*5597088cSDongdong Hao #define LEAPRAID_SCSIIO_CTRL_READ 0x02000000 249*5597088cSDongdong Hao #define LEAPRAID_SCSIIO_CTRL_BIDIRECTIONAL 0x03000000 250*5597088cSDongdong Hao #define LEAPRAID_SCSIIO_CTRL_SIMPLEQ 0x00000000 251*5597088cSDongdong Hao #define LEAPRAID_SCSIIO_CTRL_ORDEREDQ 0x00000200 252*5597088cSDongdong Hao #define LEAPRAID_SCSIIO_CTRL_CMDPRI 0x00000800 253*5597088cSDongdong Hao 254*5597088cSDongdong Hao /* SCSI state and status. */ 255*5597088cSDongdong Hao #define LEAPRAID_SCSI_STATUS_BUSY 0x08 256*5597088cSDongdong Hao #define LEAPRAID_SCSI_STATUS_RESERVATION_CONFLICT 0x18 257*5597088cSDongdong Hao #define LEAPRAID_SCSI_STATUS_TASK_SET_FULL 0x28 258*5597088cSDongdong Hao 259*5597088cSDongdong Hao #define LEAPRAID_SCSI_STATE_RESPONSE_INFO_VALID 0x10 260*5597088cSDongdong Hao #define LEAPRAID_SCSI_STATE_TERMINATED 0x08 261*5597088cSDongdong Hao #define LEAPRAID_SCSI_STATE_NO_SCSI_STATUS 0x04 262*5597088cSDongdong Hao #define LEAPRAID_SCSI_STATE_AUTOSENSE_FAILED 0x02 263*5597088cSDongdong Hao #define LEAPRAID_SCSI_STATE_AUTOSENSE_VALID 0x01 264*5597088cSDongdong Hao 265*5597088cSDongdong Hao /* SCSI task management defines. */ 266*5597088cSDongdong Hao #define LEAPRAID_TM_TASKTYPE_ABORT_TASK 0x01 267*5597088cSDongdong Hao #define LEAPRAID_TM_TASKTYPE_ABRT_TASK_SET 0x02 268*5597088cSDongdong Hao #define LEAPRAID_TM_TASKTYPE_TARGET_RESET 0x03 269*5597088cSDongdong Hao #define LEAPRAID_TM_TASKTYPE_LOGICAL_UNIT_RESET 0x05 270*5597088cSDongdong Hao #define LEAPRAID_TM_TASKTYPE_CLEAR_TASK_SET 0x06 271*5597088cSDongdong Hao #define LEAPRAID_TM_TASKTYPE_QUERY_TASK 0x07 272*5597088cSDongdong Hao #define LEAPRAID_TM_TASKTYPE_CLEAR_ACA 0x08 273*5597088cSDongdong Hao #define LEAPRAID_TM_TASKTYPE_QUERY_TASK_SET 0x09 274*5597088cSDongdong Hao #define LEAPRAID_TM_TASKTYPE_QUERY_ASYNC_EVENT 0x0A 275*5597088cSDongdong Hao 276*5597088cSDongdong Hao #define LEAPRAID_TM_MSGFLAGS_LINK_RESET 0x00 277*5597088cSDongdong Hao #define LEAPRAID_TM_RSP_INVALID_FRAME 0x02 278*5597088cSDongdong Hao 279*5597088cSDongdong Hao /* SCSI enclosure processor request defines. */ 280*5597088cSDongdong Hao #define LEAPRAID_SEP_REQ_ACT_WRITE_STATUS 0x00 281*5597088cSDongdong Hao #define LEAPRAID_SEP_REQ_FLG_DEVHDL_ADDRESS 0x00 282*5597088cSDongdong Hao #define LEAPRAID_SEP_REQ_FLG_ENCLOSURE_SLOT_ADDRESS 0x01 283*5597088cSDongdong Hao #define LEAPRAID_SEP_REQ_SLOTSTATUS_PREDICTED_FAULT 0x00000040 284*5597088cSDongdong Hao 285*5597088cSDongdong Hao /* The capabilities of the adapter. */ 286*5597088cSDongdong Hao #define LEAPRAID_ADAPTER_FEATURES_CAP_ATOMIC_REQ 0x00080000 287*5597088cSDongdong Hao #define LEAPRAID_ADAPTER_FEATURES_CAP_INTEGRATED_RAID 0x00001000 288*5597088cSDongdong Hao 289*5597088cSDongdong Hao /* Event code definitions for the firmware. */ 290*5597088cSDongdong Hao #define LEAPRAID_EVT_SAS_DEV_STATUS_CHANGE 0x000F 291*5597088cSDongdong Hao #define LEAPRAID_EVT_SAS_TOPO_CHANGE_LIST 0x001C 292*5597088cSDongdong Hao #define LEAPRAID_EVT_SAS_ENCL_DEV_STATUS_CHANGE 0x001D 293*5597088cSDongdong Hao #define LEAPRAID_EVT_IR_CHANGE 0x0020 294*5597088cSDongdong Hao #define LEAPRAID_EVT_TURN_ON_PFA_LED 0xFFFC 295*5597088cSDongdong Hao #define LEAPRAID_EVT_SCAN_DEV_DONE 0xFFFD 296*5597088cSDongdong Hao #define LEAPRAID_EVT_REMOVE_DEAD_DEV 0xFFFF 297*5597088cSDongdong Hao #define LEAPRAID_MAX_EVENT_NUM 128 298*5597088cSDongdong Hao 299*5597088cSDongdong Hao #define LEAPRAID_EVT_SAS_DEV_STAT_RC_INTERNAL_DEV_RESET 0x08 300*5597088cSDongdong Hao #define LEAPRAID_EVT_SAS_DEV_STAT_RC_CMP_INTERNAL_DEV_RESET 0x0E 301*5597088cSDongdong Hao 302*5597088cSDongdong Hao /* RAID configuration change event. */ 303*5597088cSDongdong Hao #define LEAPRAID_EVT_IR_RC_VOLUME_ADD 0x01 304*5597088cSDongdong Hao #define LEAPRAID_EVT_IR_RC_VOLUME_DELETE 0x02 305*5597088cSDongdong Hao #define LEAPRAID_EVT_IR_RC_PD_HIDDEN_TO_ADD 0x03 306*5597088cSDongdong Hao #define LEAPRAID_EVT_IR_RC_PD_UNHIDDEN_TO_DELETE 0x04 307*5597088cSDongdong Hao #define LEAPRAID_EVT_IR_RC_PD_CREATED_TO_HIDE 0x05 308*5597088cSDongdong Hao #define LEAPRAID_EVT_IR_RC_PD_DELETED_TO_EXPOSE 0x06 309*5597088cSDongdong Hao #define LEAPRAID_EVT_IR_RC_VOLUME_HIDE 0x0A 310*5597088cSDongdong Hao #define LEAPRAID_EVT_IR_RC_VOLUME_UNHIDE 0x0B 311*5597088cSDongdong Hao 312*5597088cSDongdong Hao /* SAS topology change event. */ 313*5597088cSDongdong Hao #define LEAPRAID_EVT_SAS_TOPO_ES_NO_EXPANDER 0x00 314*5597088cSDongdong Hao #define LEAPRAID_EVT_SAS_TOPO_ES_ADDED 0x01 315*5597088cSDongdong Hao #define LEAPRAID_EVT_SAS_TOPO_ES_NOT_RESPONDING 0x02 316*5597088cSDongdong Hao #define LEAPRAID_EVT_SAS_TOPO_ES_RESPONDING 0x03 317*5597088cSDongdong Hao 318*5597088cSDongdong Hao #define LEAPRAID_EVT_SAS_TOPO_RC_MASK 0x0F 319*5597088cSDongdong Hao #define LEAPRAID_EVT_SAS_TOPO_RC_TARG_ADDED 0x01 320*5597088cSDongdong Hao #define LEAPRAID_EVT_SAS_TOPO_RC_TARG_NOT_RESPONDING 0x02 321*5597088cSDongdong Hao 322*5597088cSDongdong Hao /* Enclosure device status change event. */ 323*5597088cSDongdong Hao #define LEAPRAID_EVT_SAS_ENCL_RC_ADDED 0x01 324*5597088cSDongdong Hao #define LEAPRAID_EVT_SAS_ENCL_RC_NOT_RESPONDING 0x02 325*5597088cSDongdong Hao 326*5597088cSDongdong Hao /* Device type and identifiers. */ 327*5597088cSDongdong Hao #define LEAPRAID_DEVTYP_SEP 0x00004000 328*5597088cSDongdong Hao #define LEAPRAID_DEVTYP_SSP_TGT 0x00000400 329*5597088cSDongdong Hao #define LEAPRAID_DEVTYP_STP_TGT 0x00000200 330*5597088cSDongdong Hao #define LEAPRAID_DEVTYP_SMP_TGT 0x00000100 331*5597088cSDongdong Hao #define LEAPRAID_DEVTYP_SATA_DEV 0x00000080 332*5597088cSDongdong Hao #define LEAPRAID_DEVTYP_SSP_INIT 0x00000040 333*5597088cSDongdong Hao #define LEAPRAID_DEVTYP_STP_INIT 0x00000020 334*5597088cSDongdong Hao #define LEAPRAID_DEVTYP_SMP_INIT 0x00000010 335*5597088cSDongdong Hao #define LEAPRAID_DEVTYP_SATA_HOST 0x00000008 336*5597088cSDongdong Hao 337*5597088cSDongdong Hao #define LEAPRAID_DEVTYP_MASK_DEV_TYPE 0x00000007 338*5597088cSDongdong Hao #define LEAPRAID_DEVTYP_NO_DEV 0x00000000 339*5597088cSDongdong Hao #define LEAPRAID_DEVTYP_END_DEV 0x00000001 340*5597088cSDongdong Hao #define LEAPRAID_DEVTYP_EDGE_EXPANDER 0x00000002 341*5597088cSDongdong Hao #define LEAPRAID_DEVTYP_FANOUT_EXPANDER 0x00000003 342*5597088cSDongdong Hao 343*5597088cSDongdong Hao /* SAS control operation. */ 344*5597088cSDongdong Hao #define LEAPRAID_SAS_OP_PHY_LINK_RESET 0x06 345*5597088cSDongdong Hao #define LEAPRAID_SAS_OP_PHY_HARD_RESET 0x07 346*5597088cSDongdong Hao #define LEAPRAID_SAS_OP_SET_PARAMETER 0x0F 347*5597088cSDongdong Hao 348*5597088cSDongdong Hao /* Boot device defines */ 349*5597088cSDongdong Hao #define LEAPRAID_BOOTDEV_FORM_MASK 0x0F 350*5597088cSDongdong Hao #define LEAPRAID_BOOTDEV_FORM_NONE 0x00 351*5597088cSDongdong Hao #define LEAPRAID_BOOTDEV_FORM_SAS_WWID 0x05 352*5597088cSDongdong Hao #define LEAPRAID_BOOTDEV_FORM_ENC_SLOT 0x06 353*5597088cSDongdong Hao #define LEAPRAID_BOOTDEV_FORM_DEV_NAME 0x07 354*5597088cSDongdong Hao 355*5597088cSDongdong Hao /** 356*5597088cSDongdong Hao * struct leapraid_reg_base - Register layout of the LeapRAID controller 357*5597088cSDongdong Hao * 358*5597088cSDongdong Hao * @db: Doorbell register used to signal commands or status to firmware. 359*5597088cSDongdong Hao * @ws: Write sequence register for synchronizing doorbell operations. 360*5597088cSDongdong Hao * @host_diag: Diagnostic register used for status or debug reporting. 361*5597088cSDongdong Hao * @r1: Reserved. 362*5597088cSDongdong Hao * @host_int_status: Interrupt status register reporting active interrupts. 363*5597088cSDongdong Hao * @host_int_mask: Interrupt mask register enabling or disabling sources. 364*5597088cSDongdong Hao * @r2: Reserved. 365*5597088cSDongdong Hao * @rep_msg_host_idx: Reply message index for the next available reply slot. 366*5597088cSDongdong Hao * @r3: Reserved. 367*5597088cSDongdong Hao * @debug_log: DebugLog registers for firmware debug and diagnostic output. 368*5597088cSDongdong Hao * @r4: Reserved. 369*5597088cSDongdong Hao * @atomic_req_desc_post: Atomic register for single descriptor posting. 370*5597088cSDongdong Hao * @adapter_log_buf_pos: Adapter log buffer write position. 371*5597088cSDongdong Hao * @host_log_buf_pos: Host log buffer write position. 372*5597088cSDongdong Hao * @r5: Reserved. 373*5597088cSDongdong Hao * @rep_post_reg_idx: Array of reply post index registers, one per queue. 374*5597088cSDongdong Hao * The number of entries is defined by 375*5597088cSDongdong Hao * REP_POST_HOST_IDX_REG_CNT. 376*5597088cSDongdong Hao */ 377*5597088cSDongdong Hao struct leapraid_reg_base { 378*5597088cSDongdong Hao __le32 db; 379*5597088cSDongdong Hao __le32 ws; 380*5597088cSDongdong Hao __le32 host_diag; 381*5597088cSDongdong Hao __le32 r1[9]; 382*5597088cSDongdong Hao __le32 host_int_status; 383*5597088cSDongdong Hao __le32 host_int_mask; 384*5597088cSDongdong Hao __le32 r2[4]; 385*5597088cSDongdong Hao __le32 rep_msg_host_idx; 386*5597088cSDongdong Hao __le32 r3[13]; 387*5597088cSDongdong Hao __le32 debug_log[LEAPRAID_DEBUGLOG_SZ_MAX]; 388*5597088cSDongdong Hao __le32 r4[2]; 389*5597088cSDongdong Hao __le32 atomic_req_desc_post; 390*5597088cSDongdong Hao __le32 adapter_log_buf_pos; 391*5597088cSDongdong Hao __le32 host_log_buf_pos; 392*5597088cSDongdong Hao __le32 r5[142]; 393*5597088cSDongdong Hao struct leapraid_rep_post_reg_idx { 394*5597088cSDongdong Hao __le32 idx; 395*5597088cSDongdong Hao __le32 r1; 396*5597088cSDongdong Hao __le32 r2; 397*5597088cSDongdong Hao __le32 r3; 398*5597088cSDongdong Hao } rep_post_reg_idx[REP_POST_HOST_IDX_REG_CNT]; 399*5597088cSDongdong Hao } __packed; 400*5597088cSDongdong Hao 401*5597088cSDongdong Hao /** 402*5597088cSDongdong Hao * struct leapraid_atomic_req_desc - Atomic request descriptor 403*5597088cSDongdong Hao * 404*5597088cSDongdong Hao * @flg: Descriptor flag indicating the type of request (e.g. SCSI I/O). 405*5597088cSDongdong Hao * @msix_idx: MSI-X vector index used for interrupt routing. 406*5597088cSDongdong Hao * @taskid: Unique task identifier associated with this request. 407*5597088cSDongdong Hao */ 408*5597088cSDongdong Hao struct leapraid_atomic_req_desc { 409*5597088cSDongdong Hao u8 flg; 410*5597088cSDongdong Hao u8 msix_idx; 411*5597088cSDongdong Hao __le16 taskid; 412*5597088cSDongdong Hao }; 413*5597088cSDongdong Hao 414*5597088cSDongdong Hao /** 415*5597088cSDongdong Hao * union leapraid_rep_desc_union - Unified reply descriptor format 416*5597088cSDongdong Hao * 417*5597088cSDongdong Hao * @dflt_rep: Default reply descriptor containing basic completion info. 418*5597088cSDongdong Hao * @dflt_rep.rep_flg: Reply flag indicating reply type or status. 419*5597088cSDongdong Hao * @dflt_rep.msix_idx: MSI-X index for interrupt routing. 420*5597088cSDongdong Hao * @dflt_rep.taskid: Task identifier matching the submitted request. 421*5597088cSDongdong Hao * @r1: Reserved. 422*5597088cSDongdong Hao * 423*5597088cSDongdong Hao * @addr_rep: Address reply descriptor used when firmware returns a 424*5597088cSDongdong Hao * memory address associated with the reply. 425*5597088cSDongdong Hao * @addr_rep.rep_flg: Reply flag indicating reply type or status. 426*5597088cSDongdong Hao * @addr_rep.msix_idx: MSI-X index for interrupt routing. 427*5597088cSDongdong Hao * @addr_rep.taskid: Task identifier matching the submitted request. 428*5597088cSDongdong Hao * @addr_rep.rep_frame_addr: Physical address of the reply frame. 429*5597088cSDongdong Hao * 430*5597088cSDongdong Hao * @words: Raw 64-bit representation of the reply descriptor. 431*5597088cSDongdong Hao * @u: Alternative access using 32-bit low/high words. 432*5597088cSDongdong Hao * @u.low: Lower 32 bits of the descriptor. 433*5597088cSDongdong Hao * @u.high: Upper 32 bits of the descriptor. 434*5597088cSDongdong Hao */ 435*5597088cSDongdong Hao union leapraid_rep_desc_union { 436*5597088cSDongdong Hao struct leapraid_rep_desc { 437*5597088cSDongdong Hao u8 rep_flg; 438*5597088cSDongdong Hao u8 msix_idx; 439*5597088cSDongdong Hao __le16 taskid; 440*5597088cSDongdong Hao u8 r1[4]; 441*5597088cSDongdong Hao } dflt_rep; 442*5597088cSDongdong Hao struct leapraid_add_rep_desc { 443*5597088cSDongdong Hao u8 rep_flg; 444*5597088cSDongdong Hao u8 msix_idx; 445*5597088cSDongdong Hao __le16 taskid; 446*5597088cSDongdong Hao __le32 rep_frame_addr; 447*5597088cSDongdong Hao } addr_rep; 448*5597088cSDongdong Hao __le64 words; 449*5597088cSDongdong Hao struct { 450*5597088cSDongdong Hao u32 low; 451*5597088cSDongdong Hao u32 high; 452*5597088cSDongdong Hao } u; 453*5597088cSDongdong Hao } __packed __aligned(4); 454*5597088cSDongdong Hao 455*5597088cSDongdong Hao /** 456*5597088cSDongdong Hao * struct leapraid_req - Generic request header 457*5597088cSDongdong Hao * 458*5597088cSDongdong Hao * @func_dep1: Function-dependent parameter (low 16 bits). 459*5597088cSDongdong Hao * @r1: Reserved. 460*5597088cSDongdong Hao * @func: Function code identifying the command type. 461*5597088cSDongdong Hao * @r2: Reserved. 462*5597088cSDongdong Hao */ 463*5597088cSDongdong Hao struct leapraid_req { 464*5597088cSDongdong Hao __le16 func_dep1; 465*5597088cSDongdong Hao u8 r1; 466*5597088cSDongdong Hao u8 func; 467*5597088cSDongdong Hao u8 r2[8]; 468*5597088cSDongdong Hao }; 469*5597088cSDongdong Hao 470*5597088cSDongdong Hao /** 471*5597088cSDongdong Hao * struct leapraid_rep - Generic reply header 472*5597088cSDongdong Hao * 473*5597088cSDongdong Hao * @r1: Reserved. 474*5597088cSDongdong Hao * @msg_len: Length of the reply message in bytes. 475*5597088cSDongdong Hao * @function: Function code corresponding to the request. 476*5597088cSDongdong Hao * @r2: Reserved. 477*5597088cSDongdong Hao * @adapter_status: Status code reported by the adapter. 478*5597088cSDongdong Hao * @r3: Reserved. 479*5597088cSDongdong Hao */ 480*5597088cSDongdong Hao struct leapraid_rep { 481*5597088cSDongdong Hao u8 r1[2]; 482*5597088cSDongdong Hao u8 msg_len; 483*5597088cSDongdong Hao u8 function; 484*5597088cSDongdong Hao u8 r2[10]; 485*5597088cSDongdong Hao __le16 adapter_status; 486*5597088cSDongdong Hao u8 r3[4]; 487*5597088cSDongdong Hao }; 488*5597088cSDongdong Hao 489*5597088cSDongdong Hao /** 490*5597088cSDongdong Hao * struct leapraid_sge_simple32 - 32-bit simple scatter-gather entry 491*5597088cSDongdong Hao * 492*5597088cSDongdong Hao * @flg_and_len: Combined field for flags and segment length. 493*5597088cSDongdong Hao * @addr: 32-bit physical address of the data buffer. 494*5597088cSDongdong Hao */ 495*5597088cSDongdong Hao struct leapraid_sge_simple32 { 496*5597088cSDongdong Hao __le32 flg_and_len; 497*5597088cSDongdong Hao __le32 addr; 498*5597088cSDongdong Hao }; 499*5597088cSDongdong Hao 500*5597088cSDongdong Hao /** 501*5597088cSDongdong Hao * struct leapraid_sge_simple64 - 64-bit simple scatter-gather entry 502*5597088cSDongdong Hao * 503*5597088cSDongdong Hao * @flg_and_len: Combined field for flags and segment length. 504*5597088cSDongdong Hao * @addr: 64-bit physical address of the data buffer. 505*5597088cSDongdong Hao */ 506*5597088cSDongdong Hao struct leapraid_sge_simple64 { 507*5597088cSDongdong Hao __le32 flg_and_len; 508*5597088cSDongdong Hao __le64 addr; 509*5597088cSDongdong Hao } __packed __aligned(4); 510*5597088cSDongdong Hao 511*5597088cSDongdong Hao /** 512*5597088cSDongdong Hao * struct leapraid_sge_simple_union - Unified 32/64-bit SGE representation 513*5597088cSDongdong Hao * 514*5597088cSDongdong Hao * @flg_and_len: Combined field for flags and segment length. 515*5597088cSDongdong Hao * @u.addr32: 32-bit address field. 516*5597088cSDongdong Hao * @u.addr64: 64-bit address field. 517*5597088cSDongdong Hao */ 518*5597088cSDongdong Hao struct leapraid_sge_simple_union { 519*5597088cSDongdong Hao __le32 flg_and_len; 520*5597088cSDongdong Hao union { 521*5597088cSDongdong Hao __le32 addr32; 522*5597088cSDongdong Hao __le64 addr64; 523*5597088cSDongdong Hao } __packed __aligned(4) u; 524*5597088cSDongdong Hao } __packed __aligned(4); 525*5597088cSDongdong Hao 526*5597088cSDongdong Hao /** 527*5597088cSDongdong Hao * struct leapraid_sge_chain_union - Chained scatter-gather entry 528*5597088cSDongdong Hao * 529*5597088cSDongdong Hao * @len: Length of the chain descriptor. 530*5597088cSDongdong Hao * @next_chain_offset: Offset to the next SGE chain. 531*5597088cSDongdong Hao * @flg: Flags indicating chain or termination properties. 532*5597088cSDongdong Hao * @u.addr32: 32-bit physical address. 533*5597088cSDongdong Hao * @u.addr64: 64-bit physical address. 534*5597088cSDongdong Hao */ 535*5597088cSDongdong Hao struct leapraid_sge_chain_union { 536*5597088cSDongdong Hao __le16 len; 537*5597088cSDongdong Hao u8 next_chain_offset; 538*5597088cSDongdong Hao u8 flg; 539*5597088cSDongdong Hao union { 540*5597088cSDongdong Hao __le32 addr32; 541*5597088cSDongdong Hao __le64 addr64; 542*5597088cSDongdong Hao } __packed __aligned(4) u; 543*5597088cSDongdong Hao } __packed __aligned(4); 544*5597088cSDongdong Hao 545*5597088cSDongdong Hao /** 546*5597088cSDongdong Hao * struct leapraid_ieee_sge_simple32 - IEEE 32-bit simple SGE format 547*5597088cSDongdong Hao * 548*5597088cSDongdong Hao * @addr: 32-bit physical address of the data buffer. 549*5597088cSDongdong Hao * @flg_and_len: Combined field for flags and data length. 550*5597088cSDongdong Hao */ 551*5597088cSDongdong Hao struct leapraid_ieee_sge_simple32 { 552*5597088cSDongdong Hao __le32 addr; 553*5597088cSDongdong Hao __le32 flg_and_len; 554*5597088cSDongdong Hao }; 555*5597088cSDongdong Hao 556*5597088cSDongdong Hao /** 557*5597088cSDongdong Hao * struct leapraid_ieee_sge_simple64 - IEEE 64-bit simple SGE format 558*5597088cSDongdong Hao * 559*5597088cSDongdong Hao * @addr: 64-bit physical address of the data buffer. 560*5597088cSDongdong Hao * @len: Length of the data segment. 561*5597088cSDongdong Hao * @r1: Reserved. 562*5597088cSDongdong Hao * @flg: Flags indicating transfer properties. 563*5597088cSDongdong Hao */ 564*5597088cSDongdong Hao struct leapraid_ieee_sge_simple64 { 565*5597088cSDongdong Hao __le64 addr; 566*5597088cSDongdong Hao __le32 len; 567*5597088cSDongdong Hao u8 r1[3]; 568*5597088cSDongdong Hao u8 flg; 569*5597088cSDongdong Hao } __packed __aligned(4); 570*5597088cSDongdong Hao 571*5597088cSDongdong Hao /** 572*5597088cSDongdong Hao * union leapraid_ieee_sge_simple_union - Unified IEEE SGE format 573*5597088cSDongdong Hao * 574*5597088cSDongdong Hao * @simple32: IEEE 32-bit simple SGE entry. 575*5597088cSDongdong Hao * @simple64: IEEE 64-bit simple SGE entry. 576*5597088cSDongdong Hao */ 577*5597088cSDongdong Hao union leapraid_ieee_sge_simple_union { 578*5597088cSDongdong Hao struct leapraid_ieee_sge_simple32 simple32; 579*5597088cSDongdong Hao struct leapraid_ieee_sge_simple64 simple64; 580*5597088cSDongdong Hao }; 581*5597088cSDongdong Hao 582*5597088cSDongdong Hao /** 583*5597088cSDongdong Hao * union leapraid_ieee_sge_chain_union - Unified IEEE SGE chain format 584*5597088cSDongdong Hao * 585*5597088cSDongdong Hao * @chain32: IEEE 32-bit chain SGE entry. 586*5597088cSDongdong Hao * @chain64: IEEE 64-bit chain SGE entry. 587*5597088cSDongdong Hao */ 588*5597088cSDongdong Hao union leapraid_ieee_sge_chain_union { 589*5597088cSDongdong Hao struct leapraid_ieee_sge_simple32 chain32; 590*5597088cSDongdong Hao struct leapraid_ieee_sge_simple64 chain64; 591*5597088cSDongdong Hao }; 592*5597088cSDongdong Hao 593*5597088cSDongdong Hao /** 594*5597088cSDongdong Hao * struct leapraid_chain64_ieee_sg - 64-bit IEEE chain SGE descriptor 595*5597088cSDongdong Hao * 596*5597088cSDongdong Hao * @addr: Physical address of the next chain segment. 597*5597088cSDongdong Hao * @len: Length of the current SGE. 598*5597088cSDongdong Hao * @r1: Reserved. 599*5597088cSDongdong Hao * @next_chain_offset: Offset to the next chain element. 600*5597088cSDongdong Hao * @flg: Flags that describe SGE attributes. 601*5597088cSDongdong Hao */ 602*5597088cSDongdong Hao struct leapraid_chain64_ieee_sg { 603*5597088cSDongdong Hao __le64 addr; 604*5597088cSDongdong Hao __le32 len; 605*5597088cSDongdong Hao u8 r1[2]; 606*5597088cSDongdong Hao u8 next_chain_offset; 607*5597088cSDongdong Hao u8 flg; 608*5597088cSDongdong Hao } __packed __aligned(4); 609*5597088cSDongdong Hao 610*5597088cSDongdong Hao /** 611*5597088cSDongdong Hao * union leapraid_ieee_sge_io_union - IEEE-style SGE union for I/O 612*5597088cSDongdong Hao * 613*5597088cSDongdong Hao * @ieee_simple: Simple IEEE SGE descriptor. 614*5597088cSDongdong Hao * @ieee_chain: IEEE chain SGE descriptor. 615*5597088cSDongdong Hao */ 616*5597088cSDongdong Hao union leapraid_ieee_sge_io_union { 617*5597088cSDongdong Hao struct leapraid_ieee_sge_simple64 ieee_simple; 618*5597088cSDongdong Hao struct leapraid_chain64_ieee_sg ieee_chain; 619*5597088cSDongdong Hao }; 620*5597088cSDongdong Hao 621*5597088cSDongdong Hao /** 622*5597088cSDongdong Hao * union leapraid_simple_sge_union - Union of simple SGE descriptors 623*5597088cSDongdong Hao * 624*5597088cSDongdong Hao * @leapraid_simple: LeapRAID simple SGE. 625*5597088cSDongdong Hao * @ieee_simple: IEEE-style simple SGE. 626*5597088cSDongdong Hao */ 627*5597088cSDongdong Hao union leapraid_simple_sge_union { 628*5597088cSDongdong Hao struct leapraid_sge_simple_union leapraid_simple; 629*5597088cSDongdong Hao union leapraid_ieee_sge_simple_union ieee_simple; 630*5597088cSDongdong Hao }; 631*5597088cSDongdong Hao 632*5597088cSDongdong Hao /** 633*5597088cSDongdong Hao * union leapraid_sge_io_union - Combined SGE union for all I/O types 634*5597088cSDongdong Hao * 635*5597088cSDongdong Hao * @leapraid_simple: LeapRAID simple SGE format. 636*5597088cSDongdong Hao * @leapraid_chain: LeapRAID chain SGE format. 637*5597088cSDongdong Hao * @ieee_simple: IEEE simple SGE format. 638*5597088cSDongdong Hao * @ieee_chain: IEEE chain SGE format. 639*5597088cSDongdong Hao */ 640*5597088cSDongdong Hao union leapraid_sge_io_union { 641*5597088cSDongdong Hao struct leapraid_sge_simple_union leapraid_simple; 642*5597088cSDongdong Hao struct leapraid_sge_chain_union leapraid_chain; 643*5597088cSDongdong Hao union leapraid_ieee_sge_simple_union ieee_simple; 644*5597088cSDongdong Hao union leapraid_ieee_sge_chain_union ieee_chain; 645*5597088cSDongdong Hao }; 646*5597088cSDongdong Hao 647*5597088cSDongdong Hao /** 648*5597088cSDongdong Hao * struct leapraid_cfg_pg_header - Standard configuration page header 649*5597088cSDongdong Hao * 650*5597088cSDongdong Hao * @r1: Reserved. 651*5597088cSDongdong Hao * @page_len: Length of the page in 4-byte units. 652*5597088cSDongdong Hao * @page_num: Page number. 653*5597088cSDongdong Hao * @page_type: Page type. 654*5597088cSDongdong Hao */ 655*5597088cSDongdong Hao struct leapraid_cfg_pg_header { 656*5597088cSDongdong Hao u8 r1; 657*5597088cSDongdong Hao u8 page_len; 658*5597088cSDongdong Hao u8 page_num; 659*5597088cSDongdong Hao u8 page_type; 660*5597088cSDongdong Hao }; 661*5597088cSDongdong Hao 662*5597088cSDongdong Hao /** 663*5597088cSDongdong Hao * struct leapraid_cfg_ext_pg_header - Extended configuration page header 664*5597088cSDongdong Hao * 665*5597088cSDongdong Hao * @r1: Reserved. 666*5597088cSDongdong Hao * @r2: Reserved. 667*5597088cSDongdong Hao * @page_num: Page number. 668*5597088cSDongdong Hao * @page_type: Page type. 669*5597088cSDongdong Hao * @ext_page_len: Extended page length. 670*5597088cSDongdong Hao * @ext_page_type: Extended page type. 671*5597088cSDongdong Hao * @r3: Reserved. 672*5597088cSDongdong Hao */ 673*5597088cSDongdong Hao struct leapraid_cfg_ext_pg_header { 674*5597088cSDongdong Hao u8 r1; 675*5597088cSDongdong Hao u8 r2; 676*5597088cSDongdong Hao u8 page_num; 677*5597088cSDongdong Hao u8 page_type; 678*5597088cSDongdong Hao __le16 ext_page_len; 679*5597088cSDongdong Hao u8 ext_page_type; 680*5597088cSDongdong Hao u8 r3; 681*5597088cSDongdong Hao }; 682*5597088cSDongdong Hao 683*5597088cSDongdong Hao /** 684*5597088cSDongdong Hao * struct leapraid_cfg_req - Configuration request message 685*5597088cSDongdong Hao * 686*5597088cSDongdong Hao * @action: Requested action type. 687*5597088cSDongdong Hao * @sgl_flag: SGL flag field. 688*5597088cSDongdong Hao * @chain_offset: Offset to next chain SGE. 689*5597088cSDongdong Hao * @func: Function code. 690*5597088cSDongdong Hao * @ext_page_len: Extended page length. 691*5597088cSDongdong Hao * @ext_page_type: Extended page type. 692*5597088cSDongdong Hao * @msg_flag: Message flags. 693*5597088cSDongdong Hao * @r1: Reserved. 694*5597088cSDongdong Hao * @header: Configuration page header. 695*5597088cSDongdong Hao * @page_addr: Address of the page buffer. 696*5597088cSDongdong Hao * @page_buf_sge: SGE describing the page buffer. 697*5597088cSDongdong Hao */ 698*5597088cSDongdong Hao struct leapraid_cfg_req { 699*5597088cSDongdong Hao u8 action; 700*5597088cSDongdong Hao u8 sgl_flag; 701*5597088cSDongdong Hao u8 chain_offset; 702*5597088cSDongdong Hao u8 func; 703*5597088cSDongdong Hao __le16 ext_page_len; 704*5597088cSDongdong Hao u8 ext_page_type; 705*5597088cSDongdong Hao u8 msg_flag; 706*5597088cSDongdong Hao u8 r1[12]; 707*5597088cSDongdong Hao struct leapraid_cfg_pg_header header; 708*5597088cSDongdong Hao __le32 page_addr; 709*5597088cSDongdong Hao union leapraid_sge_io_union page_buf_sge; 710*5597088cSDongdong Hao }; 711*5597088cSDongdong Hao 712*5597088cSDongdong Hao /** 713*5597088cSDongdong Hao * struct leapraid_cfg_rep - Configuration reply message 714*5597088cSDongdong Hao * 715*5597088cSDongdong Hao * @action: Action type from the request. 716*5597088cSDongdong Hao * @r1: Reserved. 717*5597088cSDongdong Hao * @msg_len: Message length in bytes. 718*5597088cSDongdong Hao * @func: Function code. 719*5597088cSDongdong Hao * @ext_page_len: Extended page length. 720*5597088cSDongdong Hao * @ext_page_type: Extended page type. 721*5597088cSDongdong Hao * @msg_flag: Message flags. 722*5597088cSDongdong Hao * @r2: Reserved. 723*5597088cSDongdong Hao * @adapter_status: Adapter status code. 724*5597088cSDongdong Hao * @r3: Reserved. 725*5597088cSDongdong Hao * @header: Configuration page header. 726*5597088cSDongdong Hao */ 727*5597088cSDongdong Hao struct leapraid_cfg_rep { 728*5597088cSDongdong Hao u8 action; 729*5597088cSDongdong Hao u8 r1; 730*5597088cSDongdong Hao u8 msg_len; 731*5597088cSDongdong Hao u8 func; 732*5597088cSDongdong Hao __le16 ext_page_len; 733*5597088cSDongdong Hao u8 ext_page_type; 734*5597088cSDongdong Hao u8 msg_flag; 735*5597088cSDongdong Hao u8 r2[6]; 736*5597088cSDongdong Hao __le16 adapter_status; 737*5597088cSDongdong Hao u8 r3[4]; 738*5597088cSDongdong Hao struct leapraid_cfg_pg_header header; 739*5597088cSDongdong Hao }; 740*5597088cSDongdong Hao 741*5597088cSDongdong Hao /** 742*5597088cSDongdong Hao * struct leapraid_boot_dev_format_sas_wwid - Boot device identified by wwid 743*5597088cSDongdong Hao * 744*5597088cSDongdong Hao * @sas_addr: SAS address of the device. 745*5597088cSDongdong Hao * @lun: Logical unit number. 746*5597088cSDongdong Hao * @r1: Reserved. 747*5597088cSDongdong Hao */ 748*5597088cSDongdong Hao struct leapraid_boot_dev_format_sas_wwid { 749*5597088cSDongdong Hao __le64 sas_addr; 750*5597088cSDongdong Hao u8 lun[8]; 751*5597088cSDongdong Hao u8 r1[8]; 752*5597088cSDongdong Hao } __packed __aligned(4); 753*5597088cSDongdong Hao 754*5597088cSDongdong Hao /** 755*5597088cSDongdong Hao * struct leapraid_boot_dev_format_enc_slot - identified by enclosure 756*5597088cSDongdong Hao * 757*5597088cSDongdong Hao * @enc_lid: Enclosure logical ID. 758*5597088cSDongdong Hao * @r1: Reserved. 759*5597088cSDongdong Hao * @slot_num: Slot number in the enclosure. 760*5597088cSDongdong Hao * @r2: Reserved. 761*5597088cSDongdong Hao */ 762*5597088cSDongdong Hao struct leapraid_boot_dev_format_enc_slot { 763*5597088cSDongdong Hao __le64 enc_lid; 764*5597088cSDongdong Hao u8 r1[8]; 765*5597088cSDongdong Hao __le16 slot_num; 766*5597088cSDongdong Hao u8 r2[6]; 767*5597088cSDongdong Hao } __packed __aligned(4); 768*5597088cSDongdong Hao 769*5597088cSDongdong Hao /** 770*5597088cSDongdong Hao * struct leapraid_boot_dev_format_dev_name - Boot device by device name 771*5597088cSDongdong Hao * 772*5597088cSDongdong Hao * @dev_name: Device name identifier. 773*5597088cSDongdong Hao * @lun: Logical unit number. 774*5597088cSDongdong Hao * @r1: Reserved. 775*5597088cSDongdong Hao */ 776*5597088cSDongdong Hao struct leapraid_boot_dev_format_dev_name { 777*5597088cSDongdong Hao __le64 dev_name; 778*5597088cSDongdong Hao u8 lun[8]; 779*5597088cSDongdong Hao u8 r1[8]; 780*5597088cSDongdong Hao } __packed __aligned(4); 781*5597088cSDongdong Hao 782*5597088cSDongdong Hao /** 783*5597088cSDongdong Hao * union leapraid_boot_dev_format - Boot device format union 784*5597088cSDongdong Hao * 785*5597088cSDongdong Hao * @sas_wwid: Format using SAS WWID and LUN. 786*5597088cSDongdong Hao * @enc_slot: Format using enclosure slot and ID. 787*5597088cSDongdong Hao * @dev_name: Format using device name and LUN. 788*5597088cSDongdong Hao */ 789*5597088cSDongdong Hao union leapraid_boot_dev_format { 790*5597088cSDongdong Hao struct leapraid_boot_dev_format_sas_wwid sas_wwid; 791*5597088cSDongdong Hao struct leapraid_boot_dev_format_enc_slot enc_slot; 792*5597088cSDongdong Hao struct leapraid_boot_dev_format_dev_name dev_name; 793*5597088cSDongdong Hao }; 794*5597088cSDongdong Hao 795*5597088cSDongdong Hao /** 796*5597088cSDongdong Hao * struct leapraid_manufacturing_p0 - Manufacturing configuration page 0 797*5597088cSDongdong Hao * 798*5597088cSDongdong Hao * @header: Configuration page header. 799*5597088cSDongdong Hao * @chip_name: Chip name as a 16-byte ASCII string. 800*5597088cSDongdong Hao * @chip_revision: Chip revision as an 8-byte ASCII string. 801*5597088cSDongdong Hao * @board_name: Board name as a 16-byte ASCII string. 802*5597088cSDongdong Hao * @board_assembly: Board assembly as a 16-byte ASCII string. 803*5597088cSDongdong Hao * @board_tracer_number: Board tracer number as a 16-byte ASCII string. 804*5597088cSDongdong Hao */ 805*5597088cSDongdong Hao struct leapraid_manufacturing_p0 { 806*5597088cSDongdong Hao struct leapraid_cfg_pg_header header; 807*5597088cSDongdong Hao u8 chip_name[16]; 808*5597088cSDongdong Hao u8 chip_revision[8]; 809*5597088cSDongdong Hao u8 board_name[16]; 810*5597088cSDongdong Hao u8 board_assembly[16]; 811*5597088cSDongdong Hao u8 board_tracer_number[16]; 812*5597088cSDongdong Hao }; 813*5597088cSDongdong Hao 814*5597088cSDongdong Hao /** 815*5597088cSDongdong Hao * struct leapraid_bios_page2 - BIOS configuration page 2 816*5597088cSDongdong Hao * 817*5597088cSDongdong Hao * @header: Configuration page header. 818*5597088cSDongdong Hao * @r1: Reserved. 819*5597088cSDongdong Hao * @requested_boot_dev_form: Format type of the requested boot device. 820*5597088cSDongdong Hao * @r2: Reserved. 821*5597088cSDongdong Hao * @requested_boot_dev: Boot device requested by BIOS or user. 822*5597088cSDongdong Hao * @requested_alt_boot_dev_form: Format of the alternate boot device. 823*5597088cSDongdong Hao * @r3: Reserved. 824*5597088cSDongdong Hao * @requested_alt_boot_dev: Alternate boot device requested. 825*5597088cSDongdong Hao * @current_boot_dev_form: Format type of the active boot device. 826*5597088cSDongdong Hao * @r4: Reserved. 827*5597088cSDongdong Hao * @current_boot_dev: Currently active boot device in use. 828*5597088cSDongdong Hao */ 829*5597088cSDongdong Hao struct leapraid_bios_page2 { 830*5597088cSDongdong Hao struct leapraid_cfg_pg_header header; 831*5597088cSDongdong Hao u8 r1[24]; 832*5597088cSDongdong Hao u8 requested_boot_dev_form; 833*5597088cSDongdong Hao u8 r2[3]; 834*5597088cSDongdong Hao union leapraid_boot_dev_format requested_boot_dev; 835*5597088cSDongdong Hao u8 requested_alt_boot_dev_form; 836*5597088cSDongdong Hao u8 r3[3]; 837*5597088cSDongdong Hao union leapraid_boot_dev_format requested_alt_boot_dev; 838*5597088cSDongdong Hao u8 current_boot_dev_form; 839*5597088cSDongdong Hao u8 r4[3]; 840*5597088cSDongdong Hao union leapraid_boot_dev_format current_boot_dev; 841*5597088cSDongdong Hao }; 842*5597088cSDongdong Hao 843*5597088cSDongdong Hao /** 844*5597088cSDongdong Hao * struct leapraid_bios_page3 - BIOS configuration page 3 845*5597088cSDongdong Hao * 846*5597088cSDongdong Hao * @header: Configuration page header. 847*5597088cSDongdong Hao * @r1: Reserved. 848*5597088cSDongdong Hao * @bios_version: BIOS firmware version number. 849*5597088cSDongdong Hao * @r2: Reserved. 850*5597088cSDongdong Hao */ 851*5597088cSDongdong Hao struct leapraid_bios_page3 { 852*5597088cSDongdong Hao struct leapraid_cfg_pg_header header; 853*5597088cSDongdong Hao u8 r1[4]; 854*5597088cSDongdong Hao __le32 bios_version; 855*5597088cSDongdong Hao u8 r2[84]; 856*5597088cSDongdong Hao }; 857*5597088cSDongdong Hao 858*5597088cSDongdong Hao /** 859*5597088cSDongdong Hao * struct leapraid_raidvol0_phys_disk - Physical disk in RAID volume 860*5597088cSDongdong Hao * 861*5597088cSDongdong Hao * @r1: Reserved. 862*5597088cSDongdong Hao * @phys_disk_num: Physical disk number within the RAID volume. 863*5597088cSDongdong Hao * @r2: Reserved. 864*5597088cSDongdong Hao */ 865*5597088cSDongdong Hao struct leapraid_raidvol0_phys_disk { 866*5597088cSDongdong Hao u8 r1[2]; 867*5597088cSDongdong Hao u8 phys_disk_num; 868*5597088cSDongdong Hao u8 r2; 869*5597088cSDongdong Hao }; 870*5597088cSDongdong Hao 871*5597088cSDongdong Hao /** 872*5597088cSDongdong Hao * struct leapraid_raidvol_p0 - RAID volume configuration page 0 873*5597088cSDongdong Hao * 874*5597088cSDongdong Hao * @header: Configuration page header. 875*5597088cSDongdong Hao * @dev_hdl: Device handle for the RAID volume. 876*5597088cSDongdong Hao * @volume_state: State of the RAID volume. 877*5597088cSDongdong Hao * @volume_type: RAID type. 878*5597088cSDongdong Hao * @r1: Reserved. 879*5597088cSDongdong Hao * @num_phys_disks: Number of physical disks in the volume. 880*5597088cSDongdong Hao * @r2: Reserved. 881*5597088cSDongdong Hao * @phys_disk: Array of physical disks in this volume. 882*5597088cSDongdong Hao */ 883*5597088cSDongdong Hao struct leapraid_raidvol_p0 { 884*5597088cSDongdong Hao struct leapraid_cfg_pg_header header; 885*5597088cSDongdong Hao __le16 dev_hdl; 886*5597088cSDongdong Hao u8 volume_state; 887*5597088cSDongdong Hao u8 volume_type; 888*5597088cSDongdong Hao u8 r1[28]; 889*5597088cSDongdong Hao u8 num_phys_disks; 890*5597088cSDongdong Hao u8 r2[3]; 891*5597088cSDongdong Hao struct leapraid_raidvol0_phys_disk phys_disk[]; 892*5597088cSDongdong Hao }; 893*5597088cSDongdong Hao 894*5597088cSDongdong Hao /** 895*5597088cSDongdong Hao * struct leapraid_raidvol_p1 - RAID volume configuration page 1 896*5597088cSDongdong Hao * 897*5597088cSDongdong Hao * @header: Configuration page header. 898*5597088cSDongdong Hao * @dev_hdl: Device handle of the RAID volume. 899*5597088cSDongdong Hao * @r1: Reserved. 900*5597088cSDongdong Hao * @wwid: World-wide identifier for the volume. 901*5597088cSDongdong Hao * @r2: Reserved. 902*5597088cSDongdong Hao */ 903*5597088cSDongdong Hao struct leapraid_raidvol_p1 { 904*5597088cSDongdong Hao struct leapraid_cfg_pg_header header; 905*5597088cSDongdong Hao __le16 dev_hdl; 906*5597088cSDongdong Hao u8 r1[42]; 907*5597088cSDongdong Hao __le64 wwid; 908*5597088cSDongdong Hao u8 r2[8]; 909*5597088cSDongdong Hao } __packed __aligned(4); 910*5597088cSDongdong Hao 911*5597088cSDongdong Hao /** 912*5597088cSDongdong Hao * struct leapraid_raidpd_p0 - Physical disk configuration page 0 913*5597088cSDongdong Hao * 914*5597088cSDongdong Hao * @header: Configuration page header. 915*5597088cSDongdong Hao * @dev_hdl: Device handle of the physical disk. 916*5597088cSDongdong Hao * @r1: Reserved. 917*5597088cSDongdong Hao * @phys_disk_num: Physical disk number. 918*5597088cSDongdong Hao * @r2: Reserved. 919*5597088cSDongdong Hao */ 920*5597088cSDongdong Hao struct leapraid_raidpd_p0 { 921*5597088cSDongdong Hao struct leapraid_cfg_pg_header header; 922*5597088cSDongdong Hao __le16 dev_hdl; 923*5597088cSDongdong Hao u8 r1; 924*5597088cSDongdong Hao u8 phys_disk_num; 925*5597088cSDongdong Hao u8 r2[112]; 926*5597088cSDongdong Hao }; 927*5597088cSDongdong Hao 928*5597088cSDongdong Hao /** 929*5597088cSDongdong Hao * struct leapraid_sas_io_unit0_phy_info - PHY info for SAS I/O unit 930*5597088cSDongdong Hao * 931*5597088cSDongdong Hao * @port: Port number the PHY belongs to. 932*5597088cSDongdong Hao * @port_flg: Flags describing port status. 933*5597088cSDongdong Hao * @phy_flg: Flags describing PHY status. 934*5597088cSDongdong Hao * @neg_link_rate: Negotiated link rate of the PHY. 935*5597088cSDongdong Hao * @controller_phy_dev_info: Controller PHY device info. 936*5597088cSDongdong Hao * @attached_dev_hdl: Handle of attached device. 937*5597088cSDongdong Hao * @controller_dev_hdl: Handle of the controller device. 938*5597088cSDongdong Hao * @r1: Reserved. 939*5597088cSDongdong Hao */ 940*5597088cSDongdong Hao struct leapraid_sas_io_unit0_phy_info { 941*5597088cSDongdong Hao u8 port; 942*5597088cSDongdong Hao u8 port_flg; 943*5597088cSDongdong Hao u8 phy_flg; 944*5597088cSDongdong Hao u8 neg_link_rate; 945*5597088cSDongdong Hao __le32 controller_phy_dev_info; 946*5597088cSDongdong Hao __le16 attached_dev_hdl; 947*5597088cSDongdong Hao __le16 controller_dev_hdl; 948*5597088cSDongdong Hao u8 r1[8]; 949*5597088cSDongdong Hao }; 950*5597088cSDongdong Hao 951*5597088cSDongdong Hao /** 952*5597088cSDongdong Hao * struct leapraid_sas_io_unit_p0 - SAS I/O unit configuration page 0 953*5597088cSDongdong Hao * 954*5597088cSDongdong Hao * @header: Extended configuration page header. 955*5597088cSDongdong Hao * @r1: Reserved. 956*5597088cSDongdong Hao * @phy_num: Number of PHYs in this unit. 957*5597088cSDongdong Hao * @r2: Reserved. 958*5597088cSDongdong Hao * @phy_info: Array of PHY information. 959*5597088cSDongdong Hao */ 960*5597088cSDongdong Hao struct leapraid_sas_io_unit_p0 { 961*5597088cSDongdong Hao struct leapraid_cfg_ext_pg_header header; 962*5597088cSDongdong Hao u8 r1[4]; 963*5597088cSDongdong Hao u8 phy_num; 964*5597088cSDongdong Hao u8 r2[3]; 965*5597088cSDongdong Hao struct leapraid_sas_io_unit0_phy_info phy_info[]; 966*5597088cSDongdong Hao }; 967*5597088cSDongdong Hao 968*5597088cSDongdong Hao /** 969*5597088cSDongdong Hao * struct leapraid_exp_p0 - SAS expander page 0 970*5597088cSDongdong Hao * 971*5597088cSDongdong Hao * @header: Extended page header. 972*5597088cSDongdong Hao * @physical_port: Physical port number. 973*5597088cSDongdong Hao * @r1: Reserved. 974*5597088cSDongdong Hao * @enc_hdl: Enclosure handle. 975*5597088cSDongdong Hao * @sas_address: SAS address of the expander. 976*5597088cSDongdong Hao * @r2: Reserved. 977*5597088cSDongdong Hao * @dev_hdl: Device handle of this expander. 978*5597088cSDongdong Hao * @parent_dev_hdl: Device handle of parent expander. 979*5597088cSDongdong Hao * @r3: Reserved. 980*5597088cSDongdong Hao * @phy_num: Number of PHYs. 981*5597088cSDongdong Hao * @r4: Reserved. 982*5597088cSDongdong Hao */ 983*5597088cSDongdong Hao struct leapraid_exp_p0 { 984*5597088cSDongdong Hao struct leapraid_cfg_ext_pg_header header; 985*5597088cSDongdong Hao u8 physical_port; 986*5597088cSDongdong Hao u8 r1; 987*5597088cSDongdong Hao __le16 enc_hdl; 988*5597088cSDongdong Hao __le64 sas_address; 989*5597088cSDongdong Hao u8 r2[4]; 990*5597088cSDongdong Hao __le16 dev_hdl; 991*5597088cSDongdong Hao __le16 parent_dev_hdl; 992*5597088cSDongdong Hao u8 r3[4]; 993*5597088cSDongdong Hao u8 phy_num; 994*5597088cSDongdong Hao u8 r4[27]; 995*5597088cSDongdong Hao } __packed __aligned(4); 996*5597088cSDongdong Hao 997*5597088cSDongdong Hao /** 998*5597088cSDongdong Hao * struct leapraid_exp_p1 - SAS expander page 1 999*5597088cSDongdong Hao * 1000*5597088cSDongdong Hao * @header: Extended page header. 1001*5597088cSDongdong Hao * @r1: Reserved. 1002*5597088cSDongdong Hao * @p_link_rate: PHY link rate. 1003*5597088cSDongdong Hao * @hw_link_rate: Hardware supported link rate. 1004*5597088cSDongdong Hao * @attached_dev_hdl: Attached device handle. 1005*5597088cSDongdong Hao * @r2: Reserved. 1006*5597088cSDongdong Hao * @neg_link_rate: Negotiated link rate. 1007*5597088cSDongdong Hao * @r3: Reserved. 1008*5597088cSDongdong Hao */ 1009*5597088cSDongdong Hao struct leapraid_exp_p1 { 1010*5597088cSDongdong Hao struct leapraid_cfg_ext_pg_header header; 1011*5597088cSDongdong Hao u8 r1[8]; 1012*5597088cSDongdong Hao u8 p_link_rate; 1013*5597088cSDongdong Hao u8 hw_link_rate; 1014*5597088cSDongdong Hao __le16 attached_dev_hdl; 1015*5597088cSDongdong Hao u8 r2[11]; 1016*5597088cSDongdong Hao u8 neg_link_rate; 1017*5597088cSDongdong Hao u8 r3[12]; 1018*5597088cSDongdong Hao }; 1019*5597088cSDongdong Hao 1020*5597088cSDongdong Hao /** 1021*5597088cSDongdong Hao * struct leapraid_sas_dev_p0 - SAS device page 0 1022*5597088cSDongdong Hao * 1023*5597088cSDongdong Hao * @header: Extended configuration page header. 1024*5597088cSDongdong Hao * @slot: Slot number. 1025*5597088cSDongdong Hao * @enc_hdl: Enclosure handle. 1026*5597088cSDongdong Hao * @sas_address: SAS address. 1027*5597088cSDongdong Hao * @parent_dev_hdl: Parent device handle. 1028*5597088cSDongdong Hao * @phy_num: Number of PHYs. 1029*5597088cSDongdong Hao * @r1: Reserved. 1030*5597088cSDongdong Hao * @dev_hdl: Device handle. 1031*5597088cSDongdong Hao * @r2: Reserved. 1032*5597088cSDongdong Hao * @dev_info: Device information. 1033*5597088cSDongdong Hao * @flg: Flags. 1034*5597088cSDongdong Hao * @physical_port: Physical port number. 1035*5597088cSDongdong Hao * @max_port_connections: Maximum port connections. 1036*5597088cSDongdong Hao * @dev_name: Device name. 1037*5597088cSDongdong Hao * @port_groups: Number of port groups. 1038*5597088cSDongdong Hao * @r3: Reserved. 1039*5597088cSDongdong Hao * @enc_level: Enclosure level. 1040*5597088cSDongdong Hao * @connector_name: Connector identifier. 1041*5597088cSDongdong Hao * @r4: Reserved. 1042*5597088cSDongdong Hao */ 1043*5597088cSDongdong Hao struct leapraid_sas_dev_p0 { 1044*5597088cSDongdong Hao struct leapraid_cfg_ext_pg_header header; 1045*5597088cSDongdong Hao __le16 slot; 1046*5597088cSDongdong Hao __le16 enc_hdl; 1047*5597088cSDongdong Hao __le64 sas_address; 1048*5597088cSDongdong Hao __le16 parent_dev_hdl; 1049*5597088cSDongdong Hao u8 phy_num; 1050*5597088cSDongdong Hao u8 r1; 1051*5597088cSDongdong Hao __le16 dev_hdl; 1052*5597088cSDongdong Hao u8 r2[2]; 1053*5597088cSDongdong Hao __le32 dev_info; 1054*5597088cSDongdong Hao __le16 flg; 1055*5597088cSDongdong Hao u8 physical_port; 1056*5597088cSDongdong Hao u8 max_port_connections; 1057*5597088cSDongdong Hao __le64 dev_name; 1058*5597088cSDongdong Hao u8 port_groups; 1059*5597088cSDongdong Hao u8 r3[2]; 1060*5597088cSDongdong Hao u8 enc_level; 1061*5597088cSDongdong Hao u8 connector_name[LEAPRAID_SAS_DEV_P0_CON_NAME_LEN]; 1062*5597088cSDongdong Hao u8 r4[4]; 1063*5597088cSDongdong Hao } __packed __aligned(4); 1064*5597088cSDongdong Hao 1065*5597088cSDongdong Hao /** 1066*5597088cSDongdong Hao * struct leapraid_sas_phy_p0 - SAS PHY configuration page 0 1067*5597088cSDongdong Hao * 1068*5597088cSDongdong Hao * @header: Extended configuration page header. 1069*5597088cSDongdong Hao * @r1: Reserved. 1070*5597088cSDongdong Hao * @attached_dev_hdl: Handle of attached device. 1071*5597088cSDongdong Hao * @r2: Reserved. 1072*5597088cSDongdong Hao * @p_link_rate: PHY link rate. 1073*5597088cSDongdong Hao * @hw_link_rate: Hardware supported link rate. 1074*5597088cSDongdong Hao * @r3: Reserved. 1075*5597088cSDongdong Hao * @phy_info: PHY information. 1076*5597088cSDongdong Hao * @neg_link_rate: Negotiated link rate. 1077*5597088cSDongdong Hao * @r4: Reserved. 1078*5597088cSDongdong Hao */ 1079*5597088cSDongdong Hao struct leapraid_sas_phy_p0 { 1080*5597088cSDongdong Hao struct leapraid_cfg_ext_pg_header header; 1081*5597088cSDongdong Hao u8 r1[4]; 1082*5597088cSDongdong Hao __le16 attached_dev_hdl; 1083*5597088cSDongdong Hao u8 r2[6]; 1084*5597088cSDongdong Hao u8 p_link_rate; 1085*5597088cSDongdong Hao u8 hw_link_rate; 1086*5597088cSDongdong Hao u8 r3[2]; 1087*5597088cSDongdong Hao __le32 phy_info; 1088*5597088cSDongdong Hao u8 neg_link_rate; 1089*5597088cSDongdong Hao u8 r4[3]; 1090*5597088cSDongdong Hao }; 1091*5597088cSDongdong Hao 1092*5597088cSDongdong Hao /** 1093*5597088cSDongdong Hao * struct leapraid_enc_p0 - SAS enclosure page 0 1094*5597088cSDongdong Hao * 1095*5597088cSDongdong Hao * @header: Extended configuration page header. 1096*5597088cSDongdong Hao * @r1: Reserved. 1097*5597088cSDongdong Hao * @enc_lid: Enclosure logical ID. 1098*5597088cSDongdong Hao * @r2: Reserved. 1099*5597088cSDongdong Hao * @enc_hdl: Enclosure handle. 1100*5597088cSDongdong Hao * @r3: Reserved. 1101*5597088cSDongdong Hao */ 1102*5597088cSDongdong Hao struct leapraid_enc_p0 { 1103*5597088cSDongdong Hao struct leapraid_cfg_ext_pg_header header; 1104*5597088cSDongdong Hao u8 r1[4]; 1105*5597088cSDongdong Hao __le64 enc_lid; 1106*5597088cSDongdong Hao u8 r2[2]; 1107*5597088cSDongdong Hao __le16 enc_hdl; 1108*5597088cSDongdong Hao u8 r3[15]; 1109*5597088cSDongdong Hao } __packed __aligned(4); 1110*5597088cSDongdong Hao 1111*5597088cSDongdong Hao /** 1112*5597088cSDongdong Hao * struct leapraid_raid_cfg_p0_element - RAID configuration element 1113*5597088cSDongdong Hao * 1114*5597088cSDongdong Hao * @element_flg: Element flags. 1115*5597088cSDongdong Hao * @vol_dev_hdl: Volume device handle. 1116*5597088cSDongdong Hao * @r1: Reserved. 1117*5597088cSDongdong Hao * @phys_disk_dev_hdl: Physical disk device handle. 1118*5597088cSDongdong Hao */ 1119*5597088cSDongdong Hao struct leapraid_raid_cfg_p0_element { 1120*5597088cSDongdong Hao __le16 element_flg; 1121*5597088cSDongdong Hao __le16 vol_dev_hdl; 1122*5597088cSDongdong Hao u8 r1[2]; 1123*5597088cSDongdong Hao __le16 phys_disk_dev_hdl; 1124*5597088cSDongdong Hao }; 1125*5597088cSDongdong Hao 1126*5597088cSDongdong Hao /** 1127*5597088cSDongdong Hao * struct leapraid_raid_cfg_p0 - RAID configuration page 0 1128*5597088cSDongdong Hao * 1129*5597088cSDongdong Hao * @header: Extended configuration page header. 1130*5597088cSDongdong Hao * @r1: Reserved. 1131*5597088cSDongdong Hao * @cfg_num: Configuration number. 1132*5597088cSDongdong Hao * @r2: Reserved. 1133*5597088cSDongdong Hao * @elements_num: Number of RAID elements. 1134*5597088cSDongdong Hao * @r3: Reserved. 1135*5597088cSDongdong Hao * @cfg_element: Array of RAID elements. 1136*5597088cSDongdong Hao */ 1137*5597088cSDongdong Hao struct leapraid_raid_cfg_p0 { 1138*5597088cSDongdong Hao struct leapraid_cfg_ext_pg_header header; 1139*5597088cSDongdong Hao u8 r1[3]; 1140*5597088cSDongdong Hao u8 cfg_num; 1141*5597088cSDongdong Hao u8 r2[32]; 1142*5597088cSDongdong Hao u8 elements_num; 1143*5597088cSDongdong Hao u8 r3[3]; 1144*5597088cSDongdong Hao struct leapraid_raid_cfg_p0_element cfg_element[]; 1145*5597088cSDongdong Hao }; 1146*5597088cSDongdong Hao 1147*5597088cSDongdong Hao /** 1148*5597088cSDongdong Hao * union leapraid_mpi_scsi_io_cdb_union - SCSI I/O CDB or simple SGE 1149*5597088cSDongdong Hao * 1150*5597088cSDongdong Hao * @cdb32: 32-byte SCSI command descriptor block. 1151*5597088cSDongdong Hao * @sge: Simple SGE format. 1152*5597088cSDongdong Hao */ 1153*5597088cSDongdong Hao union leapraid_mpi_scsi_io_cdb_union { 1154*5597088cSDongdong Hao u8 cdb32[32]; 1155*5597088cSDongdong Hao struct leapraid_sge_simple_union sge; 1156*5597088cSDongdong Hao }; 1157*5597088cSDongdong Hao 1158*5597088cSDongdong Hao /** 1159*5597088cSDongdong Hao * struct leapraid_mpi_scsiio_req - MPI SCSI I/O request 1160*5597088cSDongdong Hao * 1161*5597088cSDongdong Hao * @dev_hdl: Device handle for the target. 1162*5597088cSDongdong Hao * @chain_offset: Offset for chained SGE. 1163*5597088cSDongdong Hao * @func: Function code. 1164*5597088cSDongdong Hao * @r1: Reserved. 1165*5597088cSDongdong Hao * @msg_flg: Message flags. 1166*5597088cSDongdong Hao * @r2: Reserved. 1167*5597088cSDongdong Hao * @sense_buffer_low_add: Lower 32-bit address of sense buffer. 1168*5597088cSDongdong Hao * @dma_flag: DMA flags. 1169*5597088cSDongdong Hao * @r3: Reserved. 1170*5597088cSDongdong Hao * @sense_buffer_len: Sense buffer length. 1171*5597088cSDongdong Hao * @r4: Reserved. 1172*5597088cSDongdong Hao * @sgl_offset0..3: SGL offsets. 1173*5597088cSDongdong Hao * @skip_count: Bytes to skip before transfer. 1174*5597088cSDongdong Hao * @data_len: Length of data transfer. 1175*5597088cSDongdong Hao * @bi_dir_data_len: Bi-directional transfer length. 1176*5597088cSDongdong Hao * @io_flg: I/O flags. 1177*5597088cSDongdong Hao * @eedp_flag: End-to-end data protection flags. 1178*5597088cSDongdong Hao * @eedp_block_size: End-to-end data protection block size. 1179*5597088cSDongdong Hao * @r5: Reserved. 1180*5597088cSDongdong Hao * @secondary_ref_tag: Secondary reference tag. 1181*5597088cSDongdong Hao * @secondary_app_tag: Secondary application tag. 1182*5597088cSDongdong Hao * @app_tag_trans_mask: Application tag mask. 1183*5597088cSDongdong Hao * @lun: Logical Unit Number. 1184*5597088cSDongdong Hao * @ctrl: Control flags. 1185*5597088cSDongdong Hao * @cdb: SCSI Command Descriptor Block or simple SGE. 1186*5597088cSDongdong Hao * @sgl: Scatter-gather list. 1187*5597088cSDongdong Hao */ 1188*5597088cSDongdong Hao struct leapraid_mpi_scsiio_req { 1189*5597088cSDongdong Hao __le16 dev_hdl; 1190*5597088cSDongdong Hao u8 chain_offset; 1191*5597088cSDongdong Hao u8 func; 1192*5597088cSDongdong Hao u8 r1[3]; 1193*5597088cSDongdong Hao u8 msg_flg; 1194*5597088cSDongdong Hao u8 r2[4]; 1195*5597088cSDongdong Hao __le32 sense_buffer_low_add; 1196*5597088cSDongdong Hao u8 dma_flag; 1197*5597088cSDongdong Hao u8 r3; 1198*5597088cSDongdong Hao u8 sense_buffer_len; 1199*5597088cSDongdong Hao u8 r4; 1200*5597088cSDongdong Hao u8 sgl_offset0; 1201*5597088cSDongdong Hao u8 sgl_offset1; 1202*5597088cSDongdong Hao u8 sgl_offset2; 1203*5597088cSDongdong Hao u8 sgl_offset3; 1204*5597088cSDongdong Hao __le32 skip_count; 1205*5597088cSDongdong Hao __le32 data_len; 1206*5597088cSDongdong Hao __le32 bi_dir_data_len; 1207*5597088cSDongdong Hao __le16 io_flg; 1208*5597088cSDongdong Hao __le16 eedp_flag; 1209*5597088cSDongdong Hao __le16 eedp_block_size; 1210*5597088cSDongdong Hao u8 r5[2]; 1211*5597088cSDongdong Hao __le32 secondary_ref_tag; 1212*5597088cSDongdong Hao __le16 secondary_app_tag; 1213*5597088cSDongdong Hao __le16 app_tag_trans_mask; 1214*5597088cSDongdong Hao u8 lun[8]; 1215*5597088cSDongdong Hao __le32 ctrl; 1216*5597088cSDongdong Hao union leapraid_mpi_scsi_io_cdb_union cdb; 1217*5597088cSDongdong Hao union leapraid_sge_io_union sgl; 1218*5597088cSDongdong Hao }; 1219*5597088cSDongdong Hao 1220*5597088cSDongdong Hao /** 1221*5597088cSDongdong Hao * union leapraid_scsi_io_cdb_union - SCSI I/O CDB or IEEE simple SGE 1222*5597088cSDongdong Hao * 1223*5597088cSDongdong Hao * @cdb32: 32-byte SCSI CDB. 1224*5597088cSDongdong Hao * @sge: IEEE simple 64-bit SGE. 1225*5597088cSDongdong Hao */ 1226*5597088cSDongdong Hao union leapraid_scsi_io_cdb_union { 1227*5597088cSDongdong Hao u8 cdb32[32]; 1228*5597088cSDongdong Hao struct leapraid_ieee_sge_simple64 sge; 1229*5597088cSDongdong Hao }; 1230*5597088cSDongdong Hao 1231*5597088cSDongdong Hao /** 1232*5597088cSDongdong Hao * struct leapraid_scsiio_req - SCSI I/O request 1233*5597088cSDongdong Hao * 1234*5597088cSDongdong Hao * @dev_hdl: Device handle. 1235*5597088cSDongdong Hao * @chain_offset: Offset for chained SGE. 1236*5597088cSDongdong Hao * @func: Function code. 1237*5597088cSDongdong Hao * @r1: Reserved. 1238*5597088cSDongdong Hao * @msg_flg: Message flags. 1239*5597088cSDongdong Hao * @r2: Reserved. 1240*5597088cSDongdong Hao * @sense_buffer_low_add: Lower 32-bit address of sense buffer. 1241*5597088cSDongdong Hao * @dma_flag: DMA flag. 1242*5597088cSDongdong Hao * @r3: Reserved. 1243*5597088cSDongdong Hao * @sense_buffer_len: Sense buffer length. 1244*5597088cSDongdong Hao * @r4: Reserved. 1245*5597088cSDongdong Hao * @sgl_offset0-3: SGL offsets. 1246*5597088cSDongdong Hao * @skip_count: Bytes to skip before transfer. 1247*5597088cSDongdong Hao * @data_len: Length of data transfer. 1248*5597088cSDongdong Hao * @bi_dir_data_len: Bi-directional transfer length. 1249*5597088cSDongdong Hao * @io_flg: I/O flags. 1250*5597088cSDongdong Hao * @eedp_flag: End-to-end data protection flags. 1251*5597088cSDongdong Hao * @eedp_block_size: End-to-end data protection block size. 1252*5597088cSDongdong Hao * @r5: Reserved. 1253*5597088cSDongdong Hao * @secondary_ref_tag: Secondary reference tag. 1254*5597088cSDongdong Hao * @secondary_app_tag: Secondary application tag. 1255*5597088cSDongdong Hao * @app_tag_trans_mask: Application tag mask. 1256*5597088cSDongdong Hao * @lun: Logical Unit Number. 1257*5597088cSDongdong Hao * @ctrl: Control flags. 1258*5597088cSDongdong Hao * @cdb: SCSI Command Descriptor Block or simple SGE. 1259*5597088cSDongdong Hao * @sgl: Scatter-gather list. 1260*5597088cSDongdong Hao */ 1261*5597088cSDongdong Hao struct leapraid_scsiio_req { 1262*5597088cSDongdong Hao __le16 dev_hdl; 1263*5597088cSDongdong Hao u8 chain_offset; 1264*5597088cSDongdong Hao u8 func; 1265*5597088cSDongdong Hao u8 r1[3]; 1266*5597088cSDongdong Hao u8 msg_flg; 1267*5597088cSDongdong Hao u8 r2[4]; 1268*5597088cSDongdong Hao __le32 sense_buffer_low_add; 1269*5597088cSDongdong Hao u8 dma_flag; 1270*5597088cSDongdong Hao u8 r3; 1271*5597088cSDongdong Hao u8 sense_buffer_len; 1272*5597088cSDongdong Hao u8 r4; 1273*5597088cSDongdong Hao u8 sgl_offset0; 1274*5597088cSDongdong Hao u8 sgl_offset1; 1275*5597088cSDongdong Hao u8 sgl_offset2; 1276*5597088cSDongdong Hao u8 sgl_offset3; 1277*5597088cSDongdong Hao __le32 skip_count; 1278*5597088cSDongdong Hao __le32 data_len; 1279*5597088cSDongdong Hao __le32 bi_dir_data_len; 1280*5597088cSDongdong Hao __le16 io_flg; 1281*5597088cSDongdong Hao __le16 eedp_flag; 1282*5597088cSDongdong Hao __le16 eedp_block_size; 1283*5597088cSDongdong Hao u8 r5[2]; 1284*5597088cSDongdong Hao __le32 secondary_ref_tag; 1285*5597088cSDongdong Hao __le16 secondary_app_tag; 1286*5597088cSDongdong Hao __le16 app_tag_trans_mask; 1287*5597088cSDongdong Hao u8 lun[8]; 1288*5597088cSDongdong Hao __le32 ctrl; 1289*5597088cSDongdong Hao union leapraid_scsi_io_cdb_union cdb; 1290*5597088cSDongdong Hao union leapraid_ieee_sge_io_union sgl; 1291*5597088cSDongdong Hao }; 1292*5597088cSDongdong Hao 1293*5597088cSDongdong Hao /** 1294*5597088cSDongdong Hao * struct leapraid_scsiio_rep - SCSI I/O response 1295*5597088cSDongdong Hao * 1296*5597088cSDongdong Hao * @dev_hdl: Device handle. 1297*5597088cSDongdong Hao * @msg_len: Length of response message. 1298*5597088cSDongdong Hao * @func: Function code. 1299*5597088cSDongdong Hao * @r1: Reserved. 1300*5597088cSDongdong Hao * @msg_flg: Message flags. 1301*5597088cSDongdong Hao * @r2: Reserved. 1302*5597088cSDongdong Hao * @scsi_status: SCSI status. 1303*5597088cSDongdong Hao * @scsi_state: SCSI state. 1304*5597088cSDongdong Hao * @adapter_status: Adapter status. 1305*5597088cSDongdong Hao * @r3: Reserved. 1306*5597088cSDongdong Hao * @transfer_count: Number of bytes transferred. 1307*5597088cSDongdong Hao * @sense_count: Number of sense bytes. 1308*5597088cSDongdong Hao * @resp_info: Additional response info. 1309*5597088cSDongdong Hao * @task_tag: Task identifier. 1310*5597088cSDongdong Hao * @scsi_status_qualifier: SCSI status qualifier. 1311*5597088cSDongdong Hao * @bi_dir_trans_count: Bi-directional transfer count. 1312*5597088cSDongdong Hao * @r4: Reserved. 1313*5597088cSDongdong Hao */ 1314*5597088cSDongdong Hao struct leapraid_scsiio_rep { 1315*5597088cSDongdong Hao __le16 dev_hdl; 1316*5597088cSDongdong Hao u8 msg_len; 1317*5597088cSDongdong Hao u8 func; 1318*5597088cSDongdong Hao u8 r1[3]; 1319*5597088cSDongdong Hao u8 msg_flg; 1320*5597088cSDongdong Hao u8 r2[4]; 1321*5597088cSDongdong Hao u8 scsi_status; 1322*5597088cSDongdong Hao u8 scsi_state; 1323*5597088cSDongdong Hao __le16 adapter_status; 1324*5597088cSDongdong Hao u8 r3[4]; 1325*5597088cSDongdong Hao __le32 transfer_count; 1326*5597088cSDongdong Hao __le32 sense_count; 1327*5597088cSDongdong Hao __le32 resp_info; 1328*5597088cSDongdong Hao __le16 task_tag; 1329*5597088cSDongdong Hao __le16 scsi_status_qualifier; 1330*5597088cSDongdong Hao __le32 bi_dir_trans_count; 1331*5597088cSDongdong Hao __le32 r4[3]; 1332*5597088cSDongdong Hao }; 1333*5597088cSDongdong Hao 1334*5597088cSDongdong Hao /** 1335*5597088cSDongdong Hao * struct leapraid_scsi_tm_req - SCSI Task Management request 1336*5597088cSDongdong Hao * 1337*5597088cSDongdong Hao * @dev_hdl: Device handle. 1338*5597088cSDongdong Hao * @chain_offset: Offset for chained SGE. 1339*5597088cSDongdong Hao * @func: Function code. 1340*5597088cSDongdong Hao * @r1: Reserved. 1341*5597088cSDongdong Hao * @task_type: Task management function type. 1342*5597088cSDongdong Hao * @r2: Reserved. 1343*5597088cSDongdong Hao * @msg_flg: Message flags. 1344*5597088cSDongdong Hao * @r3: Reserved. 1345*5597088cSDongdong Hao * @lun: Logical Unit Number. 1346*5597088cSDongdong Hao * @r4: Reserved. 1347*5597088cSDongdong Hao * @task_mid: Task identifier. 1348*5597088cSDongdong Hao * @r5: Reserved. 1349*5597088cSDongdong Hao */ 1350*5597088cSDongdong Hao struct leapraid_scsi_tm_req { 1351*5597088cSDongdong Hao __le16 dev_hdl; 1352*5597088cSDongdong Hao u8 chain_offset; 1353*5597088cSDongdong Hao u8 func; 1354*5597088cSDongdong Hao u8 r1; 1355*5597088cSDongdong Hao u8 task_type; 1356*5597088cSDongdong Hao u8 r2; 1357*5597088cSDongdong Hao u8 msg_flg; 1358*5597088cSDongdong Hao u8 r3[4]; 1359*5597088cSDongdong Hao u8 lun[8]; 1360*5597088cSDongdong Hao u8 r4[28]; 1361*5597088cSDongdong Hao __le16 task_mid; 1362*5597088cSDongdong Hao u8 r5[2]; 1363*5597088cSDongdong Hao }; 1364*5597088cSDongdong Hao 1365*5597088cSDongdong Hao /** 1366*5597088cSDongdong Hao * struct leapraid_scsi_tm_rep - SCSI Task Management response 1367*5597088cSDongdong Hao * 1368*5597088cSDongdong Hao * @dev_hdl: Device handle. 1369*5597088cSDongdong Hao * @msg_len: Length of response message. 1370*5597088cSDongdong Hao * @func: Function code. 1371*5597088cSDongdong Hao * @resp_code: Response code. 1372*5597088cSDongdong Hao * @task_type: Task management type. 1373*5597088cSDongdong Hao * @r1: Reserved. 1374*5597088cSDongdong Hao * @msg_flag: Message flags. 1375*5597088cSDongdong Hao * @r2: Reserved. 1376*5597088cSDongdong Hao * @adapter_status: Adapter status. 1377*5597088cSDongdong Hao * @r3: Reserved. 1378*5597088cSDongdong Hao * @termination_count: Count of terminated tasks. 1379*5597088cSDongdong Hao * @response_info: Additional response info. 1380*5597088cSDongdong Hao */ 1381*5597088cSDongdong Hao struct leapraid_scsi_tm_rep { 1382*5597088cSDongdong Hao __le16 dev_hdl; 1383*5597088cSDongdong Hao u8 msg_len; 1384*5597088cSDongdong Hao u8 func; 1385*5597088cSDongdong Hao u8 resp_code; 1386*5597088cSDongdong Hao u8 task_type; 1387*5597088cSDongdong Hao u8 r1; 1388*5597088cSDongdong Hao u8 msg_flag; 1389*5597088cSDongdong Hao u8 r2[6]; 1390*5597088cSDongdong Hao __le16 adapter_status; 1391*5597088cSDongdong Hao u8 r3[4]; 1392*5597088cSDongdong Hao __le32 termination_count; 1393*5597088cSDongdong Hao __le32 response_info; 1394*5597088cSDongdong Hao }; 1395*5597088cSDongdong Hao 1396*5597088cSDongdong Hao /** 1397*5597088cSDongdong Hao * struct leapraid_sep_req - SEP (SCSI Enclosure Processor) request 1398*5597088cSDongdong Hao * 1399*5597088cSDongdong Hao * @dev_hdl: Device handle. 1400*5597088cSDongdong Hao * @chain_offset: Offset for chained SGE. 1401*5597088cSDongdong Hao * @func: Function code. 1402*5597088cSDongdong Hao * @act: Action to perform. 1403*5597088cSDongdong Hao * @flg: Flags. 1404*5597088cSDongdong Hao * @r1: Reserved. 1405*5597088cSDongdong Hao * @msg_flag: Message flags. 1406*5597088cSDongdong Hao * @r2: Reserved. 1407*5597088cSDongdong Hao * @slot_status: Slot status. 1408*5597088cSDongdong Hao * @r3: Reserved. 1409*5597088cSDongdong Hao * @slot: Slot number. 1410*5597088cSDongdong Hao * @enc_hdl: Enclosure handle. 1411*5597088cSDongdong Hao */ 1412*5597088cSDongdong Hao struct leapraid_sep_req { 1413*5597088cSDongdong Hao __le16 dev_hdl; 1414*5597088cSDongdong Hao u8 chain_offset; 1415*5597088cSDongdong Hao u8 func; 1416*5597088cSDongdong Hao u8 act; 1417*5597088cSDongdong Hao u8 flg; 1418*5597088cSDongdong Hao u8 r1; 1419*5597088cSDongdong Hao u8 msg_flag; 1420*5597088cSDongdong Hao u8 r2[4]; 1421*5597088cSDongdong Hao __le32 slot_status; 1422*5597088cSDongdong Hao u8 r3[12]; 1423*5597088cSDongdong Hao __le16 slot; 1424*5597088cSDongdong Hao __le16 enc_hdl; 1425*5597088cSDongdong Hao }; 1426*5597088cSDongdong Hao 1427*5597088cSDongdong Hao /** 1428*5597088cSDongdong Hao * struct leapraid_sep_rep - SEP response 1429*5597088cSDongdong Hao * 1430*5597088cSDongdong Hao * @dev_hdl: Device handle. 1431*5597088cSDongdong Hao * @msg_len: Message length. 1432*5597088cSDongdong Hao * @func: Function code. 1433*5597088cSDongdong Hao * @act: Action performed. 1434*5597088cSDongdong Hao * @flg: Flags. 1435*5597088cSDongdong Hao * @msg_flag: Message flags. 1436*5597088cSDongdong Hao * @r1: Reserved. 1437*5597088cSDongdong Hao * @adapter_status: Adapter status. 1438*5597088cSDongdong Hao * @r2: Reserved. 1439*5597088cSDongdong Hao * @slot_status: Slot status. 1440*5597088cSDongdong Hao * @r3: Reserved. 1441*5597088cSDongdong Hao * @slot: Slot number. 1442*5597088cSDongdong Hao * @enc_hdl: Enclosure handle. 1443*5597088cSDongdong Hao */ 1444*5597088cSDongdong Hao struct leapraid_sep_rep { 1445*5597088cSDongdong Hao __le16 dev_hdl; 1446*5597088cSDongdong Hao u8 msg_len; 1447*5597088cSDongdong Hao u8 func; 1448*5597088cSDongdong Hao u8 act; 1449*5597088cSDongdong Hao u8 flg; 1450*5597088cSDongdong Hao u8 r1; 1451*5597088cSDongdong Hao u8 msg_flag; 1452*5597088cSDongdong Hao u8 r2[6]; 1453*5597088cSDongdong Hao __le16 adapter_status; 1454*5597088cSDongdong Hao u8 r3[4]; 1455*5597088cSDongdong Hao __le32 slot_status; 1456*5597088cSDongdong Hao u8 r4[4]; 1457*5597088cSDongdong Hao __le16 slot; 1458*5597088cSDongdong Hao __le16 enc_hdl; 1459*5597088cSDongdong Hao }; 1460*5597088cSDongdong Hao 1461*5597088cSDongdong Hao /** 1462*5597088cSDongdong Hao * struct leapraid_adapter_init_req - Adapter initialization request 1463*5597088cSDongdong Hao * 1464*5597088cSDongdong Hao * @who_init: Initiator of the initialization. 1465*5597088cSDongdong Hao * @r1: Reserved. 1466*5597088cSDongdong Hao * @chain_offset: Chain offset. 1467*5597088cSDongdong Hao * @func: Function code. 1468*5597088cSDongdong Hao * @r2: Reserved. 1469*5597088cSDongdong Hao * @msg_flg: Message flags. 1470*5597088cSDongdong Hao * @r3: Reserved. 1471*5597088cSDongdong Hao * @msg_ver: Message version. 1472*5597088cSDongdong Hao * @header_ver: Header version. 1473*5597088cSDongdong Hao * @host_buf_addr: Host buffer address (non adapter-ref). 1474*5597088cSDongdong Hao * @r4: Reserved. 1475*5597088cSDongdong Hao * @host_buf_size: Host buffer size (non adapter-ref). 1476*5597088cSDongdong Hao * @host_msix_vectors: Number of host MSI-X vectors. 1477*5597088cSDongdong Hao * @r6: Reserved. 1478*5597088cSDongdong Hao * @req_frame_size: Request frame size. 1479*5597088cSDongdong Hao * @rep_desc_qd: Reply descriptor queue depth. 1480*5597088cSDongdong Hao * @rep_msg_qd: Reply message queue depth. 1481*5597088cSDongdong Hao * @sense_buffer_add_high: High 32-bit of sense buffer address. 1482*5597088cSDongdong Hao * @rep_msg_dma_high: High 32-bit of reply message DMA address. 1483*5597088cSDongdong Hao * @task_desc_base_addr: Base address of task descriptors. 1484*5597088cSDongdong Hao * @rep_desc_q_arr_addr: Address of reply descriptor queue array. 1485*5597088cSDongdong Hao * @rep_msg_addr_dma: Reply message DMA address. 1486*5597088cSDongdong Hao * @time_stamp: Timestamp. 1487*5597088cSDongdong Hao */ 1488*5597088cSDongdong Hao struct leapraid_adapter_init_req { 1489*5597088cSDongdong Hao u8 who_init; 1490*5597088cSDongdong Hao u8 r1; 1491*5597088cSDongdong Hao u8 chain_offset; 1492*5597088cSDongdong Hao u8 func; 1493*5597088cSDongdong Hao u8 r2[3]; 1494*5597088cSDongdong Hao u8 msg_flg; 1495*5597088cSDongdong Hao __le32 driver_ver; 1496*5597088cSDongdong Hao __le16 msg_ver; 1497*5597088cSDongdong Hao __le16 header_ver; 1498*5597088cSDongdong Hao __le32 host_buf_addr; 1499*5597088cSDongdong Hao u8 r4[2]; 1500*5597088cSDongdong Hao u8 host_buf_size; 1501*5597088cSDongdong Hao u8 host_msix_vectors; 1502*5597088cSDongdong Hao u8 r6[2]; 1503*5597088cSDongdong Hao __le16 req_frame_size; 1504*5597088cSDongdong Hao __le16 rep_desc_qd; 1505*5597088cSDongdong Hao __le16 rep_msg_qd; 1506*5597088cSDongdong Hao __le32 sense_buffer_add_high; 1507*5597088cSDongdong Hao __le32 rep_msg_dma_high; 1508*5597088cSDongdong Hao __le64 task_desc_base_addr; 1509*5597088cSDongdong Hao __le64 rep_desc_q_arr_addr; 1510*5597088cSDongdong Hao __le64 rep_msg_addr_dma; 1511*5597088cSDongdong Hao __le64 time_stamp; 1512*5597088cSDongdong Hao } __packed __aligned(4); 1513*5597088cSDongdong Hao 1514*5597088cSDongdong Hao /** 1515*5597088cSDongdong Hao * struct leapraid_rep_desc_q_arr - Reply descriptor queue array 1516*5597088cSDongdong Hao * 1517*5597088cSDongdong Hao * @rep_desc_base_addr: Base address of the reply descriptors. 1518*5597088cSDongdong Hao * @r1: Reserved. 1519*5597088cSDongdong Hao */ 1520*5597088cSDongdong Hao struct leapraid_rep_desc_q_arr { 1521*5597088cSDongdong Hao __le64 rep_desc_base_addr; 1522*5597088cSDongdong Hao __le64 r1; 1523*5597088cSDongdong Hao } __packed __aligned(4); 1524*5597088cSDongdong Hao 1525*5597088cSDongdong Hao /** 1526*5597088cSDongdong Hao * struct leapraid_adapter_init_rep - Adapter initialization reply 1527*5597088cSDongdong Hao * 1528*5597088cSDongdong Hao * @who_init: Initiator of the initialization. 1529*5597088cSDongdong Hao * @r1: Reserved. 1530*5597088cSDongdong Hao * @msg_len: Length of reply message. 1531*5597088cSDongdong Hao * @func: Function code. 1532*5597088cSDongdong Hao * @r2: Reserved. 1533*5597088cSDongdong Hao * @msg_flag: Message flags. 1534*5597088cSDongdong Hao * @r3: Reserved. 1535*5597088cSDongdong Hao * @adapter_status: Adapter status. 1536*5597088cSDongdong Hao * @r4: Reserved. 1537*5597088cSDongdong Hao */ 1538*5597088cSDongdong Hao struct leapraid_adapter_init_rep { 1539*5597088cSDongdong Hao u8 who_init; 1540*5597088cSDongdong Hao u8 r1; 1541*5597088cSDongdong Hao u8 msg_len; 1542*5597088cSDongdong Hao u8 func; 1543*5597088cSDongdong Hao u8 r2[3]; 1544*5597088cSDongdong Hao u8 msg_flag; 1545*5597088cSDongdong Hao u8 r3[6]; 1546*5597088cSDongdong Hao __le16 adapter_status; 1547*5597088cSDongdong Hao u8 r4[4]; 1548*5597088cSDongdong Hao }; 1549*5597088cSDongdong Hao 1550*5597088cSDongdong Hao /** 1551*5597088cSDongdong Hao * struct leapraid_adapter_log_req - Adapter log request 1552*5597088cSDongdong Hao * 1553*5597088cSDongdong Hao * @action: Action code. 1554*5597088cSDongdong Hao * @type: Log type. 1555*5597088cSDongdong Hao * @chain_offset: Offset for chained SGE. 1556*5597088cSDongdong Hao * @func: Function code. 1557*5597088cSDongdong Hao * r1: Reserved. 1558*5597088cSDongdong Hao * @msg_flag: Message flags. 1559*5597088cSDongdong Hao * r2: Reserved. 1560*5597088cSDongdong Hao * @mbox: Mailbox for command-specific parameters. 1561*5597088cSDongdong Hao * @sge: Scatter-gather entry for data buffer. 1562*5597088cSDongdong Hao */ 1563*5597088cSDongdong Hao struct leapraid_adapter_log_req { 1564*5597088cSDongdong Hao u8 action; 1565*5597088cSDongdong Hao u8 type; 1566*5597088cSDongdong Hao u8 chain_offset; 1567*5597088cSDongdong Hao u8 func; 1568*5597088cSDongdong Hao u8 r1[3]; 1569*5597088cSDongdong Hao u8 msg_flag; 1570*5597088cSDongdong Hao u8 r2[4]; 1571*5597088cSDongdong Hao union { 1572*5597088cSDongdong Hao u8 b[12]; 1573*5597088cSDongdong Hao __le16 s[6]; 1574*5597088cSDongdong Hao __le32 w[3]; 1575*5597088cSDongdong Hao } mbox; 1576*5597088cSDongdong Hao struct leapraid_sge_simple64 sge; 1577*5597088cSDongdong Hao } __packed __aligned(4); 1578*5597088cSDongdong Hao 1579*5597088cSDongdong Hao /** 1580*5597088cSDongdong Hao * struct leapraid_adapter_log_rep - Adapter log reply 1581*5597088cSDongdong Hao * 1582*5597088cSDongdong Hao * @action: Action code echoed. 1583*5597088cSDongdong Hao * @type: Log type echoed. 1584*5597088cSDongdong Hao * @msg_len: Length of message. 1585*5597088cSDongdong Hao * @func: Function code. 1586*5597088cSDongdong Hao * @r1: Reserved. 1587*5597088cSDongdong Hao * @msg_flag: Message flags. 1588*5597088cSDongdong Hao * @r2: Reserved. 1589*5597088cSDongdong Hao * @adapter_status: Status returned by adapter. 1590*5597088cSDongdong Hao */ 1591*5597088cSDongdong Hao struct leapraid_adapter_log_rep { 1592*5597088cSDongdong Hao u8 action; 1593*5597088cSDongdong Hao u8 type; 1594*5597088cSDongdong Hao u8 msg_len; 1595*5597088cSDongdong Hao u8 func; 1596*5597088cSDongdong Hao u8 r1[3]; 1597*5597088cSDongdong Hao u8 msg_flag; 1598*5597088cSDongdong Hao u8 r2[6]; 1599*5597088cSDongdong Hao __le16 adapter_status; 1600*5597088cSDongdong Hao }; 1601*5597088cSDongdong Hao 1602*5597088cSDongdong Hao /** 1603*5597088cSDongdong Hao * struct leapraid_adapter_features_req - Request adapter features 1604*5597088cSDongdong Hao * 1605*5597088cSDongdong Hao * @r1: Reserved. 1606*5597088cSDongdong Hao * @chain_offset: Offset for chained SGE. 1607*5597088cSDongdong Hao * @func: Function code. 1608*5597088cSDongdong Hao * @r2: Reserved. 1609*5597088cSDongdong Hao * @msg_flag: Message flags. 1610*5597088cSDongdong Hao * @r3: Reserved. 1611*5597088cSDongdong Hao */ 1612*5597088cSDongdong Hao struct leapraid_adapter_features_req { 1613*5597088cSDongdong Hao u8 r1[2]; 1614*5597088cSDongdong Hao u8 chain_offset; 1615*5597088cSDongdong Hao u8 func; 1616*5597088cSDongdong Hao u8 r2[3]; 1617*5597088cSDongdong Hao u8 msg_flag; 1618*5597088cSDongdong Hao u8 r3[4]; 1619*5597088cSDongdong Hao }; 1620*5597088cSDongdong Hao 1621*5597088cSDongdong Hao /** 1622*5597088cSDongdong Hao * struct leapraid_adapter_features_rep - Adapter features reply 1623*5597088cSDongdong Hao * 1624*5597088cSDongdong Hao * @msg_ver: Message version. 1625*5597088cSDongdong Hao * @msg_len: Length of reply message. 1626*5597088cSDongdong Hao * @func: Function code. 1627*5597088cSDongdong Hao * @header_ver: Header version. 1628*5597088cSDongdong Hao * @r1: Reserved. 1629*5597088cSDongdong Hao * @msg_flag: Message flags. 1630*5597088cSDongdong Hao * @r2: Reserved. 1631*5597088cSDongdong Hao * @adapter_status: Adapter status. 1632*5597088cSDongdong Hao * @r3: Reserved. 1633*5597088cSDongdong Hao * @who_init: Who initialized the adapter. 1634*5597088cSDongdong Hao * @r4: Reserved. 1635*5597088cSDongdong Hao * @max_msix_vectors: Max MSI-X vectors supported. 1636*5597088cSDongdong Hao * @req_slot: Number of request slots. 1637*5597088cSDongdong Hao * @r5: Reserved. 1638*5597088cSDongdong Hao * @adapter_caps: Adapter capabilities. 1639*5597088cSDongdong Hao * @fw_version: Firmware version. 1640*5597088cSDongdong Hao * @sas_wide_max_qdepth: Max wide SAS queue depth. 1641*5597088cSDongdong Hao * @sas_narrow_max_qdepth: Max narrow SAS queue depth. 1642*5597088cSDongdong Hao * @r6: Reserved. 1643*5597088cSDongdong Hao * @hp_slot: Number of high-priority slots. 1644*5597088cSDongdong Hao * @r7: Reserved. 1645*5597088cSDongdong Hao * @max_volumes: Maximum supported volumes. 1646*5597088cSDongdong Hao * @max_dev_hdl: Maximum device handle. 1647*5597088cSDongdong Hao * @r8: Reserved. 1648*5597088cSDongdong Hao * @min_dev_hdl: Minimum device handle. 1649*5597088cSDongdong Hao * @r9: Reserved. 1650*5597088cSDongdong Hao */ 1651*5597088cSDongdong Hao struct leapraid_adapter_features_rep { 1652*5597088cSDongdong Hao __le16 msg_ver; 1653*5597088cSDongdong Hao u8 msg_len; 1654*5597088cSDongdong Hao u8 func; 1655*5597088cSDongdong Hao u16 header_ver; 1656*5597088cSDongdong Hao u8 r1; 1657*5597088cSDongdong Hao u8 msg_flag; 1658*5597088cSDongdong Hao u8 r2[6]; 1659*5597088cSDongdong Hao u16 adapter_status; 1660*5597088cSDongdong Hao u8 r3[4]; 1661*5597088cSDongdong Hao u8 sata_max_qdepth; 1662*5597088cSDongdong Hao u8 who_init; 1663*5597088cSDongdong Hao u8 r4; 1664*5597088cSDongdong Hao u8 max_msix_vectors; 1665*5597088cSDongdong Hao __le16 req_slot; 1666*5597088cSDongdong Hao __le16 product_id; 1667*5597088cSDongdong Hao __le32 adapter_caps; 1668*5597088cSDongdong Hao __le32 fw_version; 1669*5597088cSDongdong Hao __le16 sas_wide_max_qdepth; 1670*5597088cSDongdong Hao __le16 sas_narrow_max_qdepth; 1671*5597088cSDongdong Hao u8 r6[10]; 1672*5597088cSDongdong Hao __le16 hp_slot; 1673*5597088cSDongdong Hao u8 r7[3]; 1674*5597088cSDongdong Hao u8 max_volumes; 1675*5597088cSDongdong Hao __le16 max_dev_hdl; 1676*5597088cSDongdong Hao u8 r8[2]; 1677*5597088cSDongdong Hao __le16 min_dev_hdl; 1678*5597088cSDongdong Hao u8 r9[6]; 1679*5597088cSDongdong Hao }; 1680*5597088cSDongdong Hao 1681*5597088cSDongdong Hao /** 1682*5597088cSDongdong Hao * struct leapraid_scan_dev_req - Request to scan devices 1683*5597088cSDongdong Hao * 1684*5597088cSDongdong Hao * @r1: Reserved. 1685*5597088cSDongdong Hao * @chain_offset: Offset for chained SGE. 1686*5597088cSDongdong Hao * @func: Function code. 1687*5597088cSDongdong Hao * @r2: Reserved. 1688*5597088cSDongdong Hao * @msg_flag: Message flags. 1689*5597088cSDongdong Hao * @r3: Reserved. 1690*5597088cSDongdong Hao */ 1691*5597088cSDongdong Hao struct leapraid_scan_dev_req { 1692*5597088cSDongdong Hao u8 r1[2]; 1693*5597088cSDongdong Hao u8 chain_offset; 1694*5597088cSDongdong Hao u8 func; 1695*5597088cSDongdong Hao u8 r2[3]; 1696*5597088cSDongdong Hao u8 msg_flag; 1697*5597088cSDongdong Hao u8 r3[4]; 1698*5597088cSDongdong Hao }; 1699*5597088cSDongdong Hao 1700*5597088cSDongdong Hao /** 1701*5597088cSDongdong Hao * struct leapraid_scan_dev_rep - Scan devices reply 1702*5597088cSDongdong Hao * 1703*5597088cSDongdong Hao * @r1: Reserved. 1704*5597088cSDongdong Hao * @msg_len: Length of message. 1705*5597088cSDongdong Hao * @func: Function code. 1706*5597088cSDongdong Hao * @r2: Reserved. 1707*5597088cSDongdong Hao * @msg_flag: Message flags. 1708*5597088cSDongdong Hao * @r3: Reserved. 1709*5597088cSDongdong Hao * @adapter_status: Adapter status. 1710*5597088cSDongdong Hao * @r4: Reserved. 1711*5597088cSDongdong Hao */ 1712*5597088cSDongdong Hao struct leapraid_scan_dev_rep { 1713*5597088cSDongdong Hao u8 r1[2]; 1714*5597088cSDongdong Hao u8 msg_len; 1715*5597088cSDongdong Hao u8 func; 1716*5597088cSDongdong Hao u8 r2[3]; 1717*5597088cSDongdong Hao u8 msg_flag; 1718*5597088cSDongdong Hao u8 r3[6]; 1719*5597088cSDongdong Hao __le16 adapter_status; 1720*5597088cSDongdong Hao u8 r4[4]; 1721*5597088cSDongdong Hao }; 1722*5597088cSDongdong Hao 1723*5597088cSDongdong Hao /** 1724*5597088cSDongdong Hao * struct leapraid_evt_notify_req - Event notification request 1725*5597088cSDongdong Hao * 1726*5597088cSDongdong Hao * @r1: Reserved. 1727*5597088cSDongdong Hao * @chain_offset: Offset for chained SGE. 1728*5597088cSDongdong Hao * @func: Function code. 1729*5597088cSDongdong Hao * @r2: Reserved. 1730*5597088cSDongdong Hao * @msg_flag: Message flags. 1731*5597088cSDongdong Hao * @r3: Reserved. 1732*5597088cSDongdong Hao * @evt_masks: Event masks to enable notifications. 1733*5597088cSDongdong Hao * @r4: Reserved. 1734*5597088cSDongdong Hao */ 1735*5597088cSDongdong Hao struct leapraid_evt_notify_req { 1736*5597088cSDongdong Hao u8 r1[2]; 1737*5597088cSDongdong Hao u8 chain_offset; 1738*5597088cSDongdong Hao u8 func; 1739*5597088cSDongdong Hao u8 r2[3]; 1740*5597088cSDongdong Hao u8 msg_flag; 1741*5597088cSDongdong Hao u8 r3[12]; 1742*5597088cSDongdong Hao __le32 evt_masks[4]; 1743*5597088cSDongdong Hao u8 r4[8]; 1744*5597088cSDongdong Hao }; 1745*5597088cSDongdong Hao 1746*5597088cSDongdong Hao /** 1747*5597088cSDongdong Hao * struct leapraid_evt_notify_rep - Event notification reply 1748*5597088cSDongdong Hao * 1749*5597088cSDongdong Hao * @evt_data_len: Length of event data. 1750*5597088cSDongdong Hao * @msg_len: Length of message. 1751*5597088cSDongdong Hao * @func: Function code. 1752*5597088cSDongdong Hao * @r1: Reserved. 1753*5597088cSDongdong Hao * @r2: Reserved. 1754*5597088cSDongdong Hao * @msg_flag: Message flags. 1755*5597088cSDongdong Hao * @r3: Reserved. 1756*5597088cSDongdong Hao * @adapter_status: Adapter status. 1757*5597088cSDongdong Hao * @r4: Reserved. 1758*5597088cSDongdong Hao * @evt: Event code. 1759*5597088cSDongdong Hao * @r5: Reserved. 1760*5597088cSDongdong Hao * @evt_data: Event data array. 1761*5597088cSDongdong Hao */ 1762*5597088cSDongdong Hao struct leapraid_evt_notify_rep { 1763*5597088cSDongdong Hao __le16 evt_data_len; 1764*5597088cSDongdong Hao u8 msg_len; 1765*5597088cSDongdong Hao u8 func; 1766*5597088cSDongdong Hao u8 r1[2]; 1767*5597088cSDongdong Hao u8 r2; 1768*5597088cSDongdong Hao u8 msg_flag; 1769*5597088cSDongdong Hao u8 r3[6]; 1770*5597088cSDongdong Hao __le16 adapter_status; 1771*5597088cSDongdong Hao u8 r4[4]; 1772*5597088cSDongdong Hao __le16 evt; 1773*5597088cSDongdong Hao u8 r5[6]; 1774*5597088cSDongdong Hao __le32 evt_data[]; 1775*5597088cSDongdong Hao }; 1776*5597088cSDongdong Hao 1777*5597088cSDongdong Hao /** 1778*5597088cSDongdong Hao * struct leapraid_evt_data_sas_dev_status_change - SAS device status change 1779*5597088cSDongdong Hao * 1780*5597088cSDongdong Hao * @task_tag: Task identifier. 1781*5597088cSDongdong Hao * @reason_code: Reason for status change. 1782*5597088cSDongdong Hao * @physical_port: Physical port number. 1783*5597088cSDongdong Hao * @r1: Reserved. 1784*5597088cSDongdong Hao * @dev_hdl: Device handle. 1785*5597088cSDongdong Hao * @r2: Reserved. 1786*5597088cSDongdong Hao * @sas_address: SAS address of device. 1787*5597088cSDongdong Hao * @lun: Logical unit Number. 1788*5597088cSDongdong Hao */ 1789*5597088cSDongdong Hao struct leapraid_evt_data_sas_dev_status_change { 1790*5597088cSDongdong Hao __le16 task_tag; 1791*5597088cSDongdong Hao u8 reason_code; 1792*5597088cSDongdong Hao u8 physical_port; 1793*5597088cSDongdong Hao u8 r1[2]; 1794*5597088cSDongdong Hao __le16 dev_hdl; 1795*5597088cSDongdong Hao u8 r2[4]; 1796*5597088cSDongdong Hao __le64 sas_address; 1797*5597088cSDongdong Hao u8 lun[8]; 1798*5597088cSDongdong Hao } __packed __aligned(4); 1799*5597088cSDongdong Hao /** 1800*5597088cSDongdong Hao * struct leapraid_evt_data_ir_change - IR (Integrated RAID) change event data 1801*5597088cSDongdong Hao * 1802*5597088cSDongdong Hao * @r1: Reserved. 1803*5597088cSDongdong Hao * @reason_code: Reason for IR change. 1804*5597088cSDongdong Hao * @r2: Reserved. 1805*5597088cSDongdong Hao * @vol_dev_hdl: Volume device handle. 1806*5597088cSDongdong Hao * @phys_disk_dev_hdl: Physical disk device handle. 1807*5597088cSDongdong Hao */ 1808*5597088cSDongdong Hao struct leapraid_evt_data_ir_change { 1809*5597088cSDongdong Hao u8 r1; 1810*5597088cSDongdong Hao u8 reason_code; 1811*5597088cSDongdong Hao u8 r2[2]; 1812*5597088cSDongdong Hao __le16 vol_dev_hdl; 1813*5597088cSDongdong Hao __le16 phys_disk_dev_hdl; 1814*5597088cSDongdong Hao }; 1815*5597088cSDongdong Hao 1816*5597088cSDongdong Hao /** 1817*5597088cSDongdong Hao * struct leapraid_evt_data_sas_disc - SAS discovery event data 1818*5597088cSDongdong Hao * 1819*5597088cSDongdong Hao * @r1: Reserved. 1820*5597088cSDongdong Hao * @reason_code: Reason for discovery event. 1821*5597088cSDongdong Hao * @physical_port: Physical port number where event occurred. 1822*5597088cSDongdong Hao * @r2: Reserved. 1823*5597088cSDongdong Hao */ 1824*5597088cSDongdong Hao struct leapraid_evt_data_sas_disc { 1825*5597088cSDongdong Hao u8 r1; 1826*5597088cSDongdong Hao u8 reason_code; 1827*5597088cSDongdong Hao u8 physical_port; 1828*5597088cSDongdong Hao u8 r2[5]; 1829*5597088cSDongdong Hao }; 1830*5597088cSDongdong Hao 1831*5597088cSDongdong Hao /** 1832*5597088cSDongdong Hao * struct leapraid_evt_sas_topo_phy_entry - SAS topology PHY entry 1833*5597088cSDongdong Hao * 1834*5597088cSDongdong Hao * @attached_dev_hdl: Device handle attached to PHY. 1835*5597088cSDongdong Hao * @link_rate: Current link rate. 1836*5597088cSDongdong Hao * @phy_status: PHY status flags. 1837*5597088cSDongdong Hao */ 1838*5597088cSDongdong Hao struct leapraid_evt_sas_topo_phy_entry { 1839*5597088cSDongdong Hao __le16 attached_dev_hdl; 1840*5597088cSDongdong Hao u8 link_rate; 1841*5597088cSDongdong Hao u8 phy_status; 1842*5597088cSDongdong Hao }; 1843*5597088cSDongdong Hao 1844*5597088cSDongdong Hao /** 1845*5597088cSDongdong Hao * struct leapraid_evt_data_sas_topo_change_list - SAS topology change list 1846*5597088cSDongdong Hao * 1847*5597088cSDongdong Hao * @encl_hdl: Enclosure handle. 1848*5597088cSDongdong Hao * @exp_dev_hdl: Expander device handle. 1849*5597088cSDongdong Hao * @num_phys: Number of PHYs in this entry. 1850*5597088cSDongdong Hao * @r1: Reserved. 1851*5597088cSDongdong Hao * @entry_num: Number of PHY elements. 1852*5597088cSDongdong Hao * @start_phy_num: Start PHY number. 1853*5597088cSDongdong Hao * @exp_status: Expander status. 1854*5597088cSDongdong Hao * @physical_port: Physical port number. 1855*5597088cSDongdong Hao * @phy: Array of SAS PHY entries. 1856*5597088cSDongdong Hao */ 1857*5597088cSDongdong Hao struct leapraid_evt_data_sas_topo_change_list { 1858*5597088cSDongdong Hao __le16 encl_hdl; 1859*5597088cSDongdong Hao __le16 exp_dev_hdl; 1860*5597088cSDongdong Hao u8 num_phys; 1861*5597088cSDongdong Hao u8 r1[3]; 1862*5597088cSDongdong Hao u8 entry_num; 1863*5597088cSDongdong Hao u8 start_phy_num; 1864*5597088cSDongdong Hao u8 exp_status; 1865*5597088cSDongdong Hao u8 physical_port; 1866*5597088cSDongdong Hao struct leapraid_evt_sas_topo_phy_entry phy[]; 1867*5597088cSDongdong Hao }; 1868*5597088cSDongdong Hao 1869*5597088cSDongdong Hao /** 1870*5597088cSDongdong Hao * struct leapraid_evt_data_sas_enc_dev_status_change - 1871*5597088cSDongdong Hao * SAS enclosure device status 1872*5597088cSDongdong Hao * 1873*5597088cSDongdong Hao * @enc_hdl: Enclosure handle. 1874*5597088cSDongdong Hao * @reason_code: Reason code for status change. 1875*5597088cSDongdong Hao * @physical_port: Physical port number. 1876*5597088cSDongdong Hao * @encl_logical_id: Enclosure logical ID. 1877*5597088cSDongdong Hao * @num_slots: Number of slots in enclosure. 1878*5597088cSDongdong Hao * @start_slot: First affected slot. 1879*5597088cSDongdong Hao * @phy_bits: Bitmap of affected PHYs. 1880*5597088cSDongdong Hao */ 1881*5597088cSDongdong Hao struct leapraid_evt_data_sas_enc_dev_status_change { 1882*5597088cSDongdong Hao __le16 enc_hdl; 1883*5597088cSDongdong Hao u8 reason_code; 1884*5597088cSDongdong Hao u8 physical_port; 1885*5597088cSDongdong Hao __le64 encl_logical_id; 1886*5597088cSDongdong Hao __le16 num_slots; 1887*5597088cSDongdong Hao __le16 start_slot; 1888*5597088cSDongdong Hao __le32 phy_bits; 1889*5597088cSDongdong Hao } __packed __aligned(4); 1890*5597088cSDongdong Hao 1891*5597088cSDongdong Hao /** 1892*5597088cSDongdong Hao * struct leapraid_io_unit_ctrl_req - I/O unit control request 1893*5597088cSDongdong Hao * 1894*5597088cSDongdong Hao * @op: Operation code. 1895*5597088cSDongdong Hao * @r1: Reserved. 1896*5597088cSDongdong Hao * @chain_offset: SGE chain offset. 1897*5597088cSDongdong Hao * @func: Function code. 1898*5597088cSDongdong Hao * @dev_hdl: Device handle. 1899*5597088cSDongdong Hao * @adapter_para: Adapter parameter selector. 1900*5597088cSDongdong Hao * @msg_flag: Message flags. 1901*5597088cSDongdong Hao * @r2: Reserved. 1902*5597088cSDongdong Hao * @phy_num: PHY number. 1903*5597088cSDongdong Hao * @r3: Reserved. 1904*5597088cSDongdong Hao * @adapter_para_value: Value for adapter parameter. 1905*5597088cSDongdong Hao * @adapter_para_value2: Optional second parameter value. 1906*5597088cSDongdong Hao * @r4: Reserved. 1907*5597088cSDongdong Hao */ 1908*5597088cSDongdong Hao struct leapraid_io_unit_ctrl_req { 1909*5597088cSDongdong Hao u8 op; 1910*5597088cSDongdong Hao u8 r1; 1911*5597088cSDongdong Hao u8 chain_offset; 1912*5597088cSDongdong Hao u8 func; 1913*5597088cSDongdong Hao __le16 dev_hdl; 1914*5597088cSDongdong Hao u8 adapter_para; 1915*5597088cSDongdong Hao u8 msg_flag; 1916*5597088cSDongdong Hao u8 r2[6]; 1917*5597088cSDongdong Hao u8 phy_num; 1918*5597088cSDongdong Hao u8 r3[17]; 1919*5597088cSDongdong Hao __le32 adapter_para_value; 1920*5597088cSDongdong Hao __le32 adapter_para_value2; 1921*5597088cSDongdong Hao u8 r4[4]; 1922*5597088cSDongdong Hao }; 1923*5597088cSDongdong Hao 1924*5597088cSDongdong Hao /** 1925*5597088cSDongdong Hao * struct leapraid_io_unit_ctrl_rep - I/O unit control reply 1926*5597088cSDongdong Hao * 1927*5597088cSDongdong Hao * @op: Operation code echoed. 1928*5597088cSDongdong Hao * @r1: Reserved. 1929*5597088cSDongdong Hao * @func: Function code. 1930*5597088cSDongdong Hao * @dev_hdl: Device handle. 1931*5597088cSDongdong Hao * @r2: Reserved. 1932*5597088cSDongdong Hao */ 1933*5597088cSDongdong Hao struct leapraid_io_unit_ctrl_rep { 1934*5597088cSDongdong Hao u8 op; 1935*5597088cSDongdong Hao u8 r1[2]; 1936*5597088cSDongdong Hao u8 func; 1937*5597088cSDongdong Hao __le16 dev_hdl; 1938*5597088cSDongdong Hao u8 r2[14]; 1939*5597088cSDongdong Hao }; 1940*5597088cSDongdong Hao 1941*5597088cSDongdong Hao /** 1942*5597088cSDongdong Hao * struct leapraid_raid_act_req - RAID action request 1943*5597088cSDongdong Hao * 1944*5597088cSDongdong Hao * @act: RAID action code. 1945*5597088cSDongdong Hao * @r1: Reserved. 1946*5597088cSDongdong Hao * @func: Function code. 1947*5597088cSDongdong Hao * @r2: Reserved. 1948*5597088cSDongdong Hao * @phys_disk_num: Number of physical disks involved. 1949*5597088cSDongdong Hao * @r3: Reserved. 1950*5597088cSDongdong Hao * @action_data_sge: SGE describing action-specific data. 1951*5597088cSDongdong Hao */ 1952*5597088cSDongdong Hao struct leapraid_raid_act_req { 1953*5597088cSDongdong Hao u8 act; 1954*5597088cSDongdong Hao u8 r1[2]; 1955*5597088cSDongdong Hao u8 func; 1956*5597088cSDongdong Hao u8 r2[2]; 1957*5597088cSDongdong Hao u8 phys_disk_num; 1958*5597088cSDongdong Hao u8 r3[13]; 1959*5597088cSDongdong Hao struct leapraid_sge_simple_union action_data_sge; 1960*5597088cSDongdong Hao }; 1961*5597088cSDongdong Hao 1962*5597088cSDongdong Hao /** 1963*5597088cSDongdong Hao * struct leapraid_raid_act_rep - RAID action reply 1964*5597088cSDongdong Hao * 1965*5597088cSDongdong Hao * @act: RAID action code echoed. 1966*5597088cSDongdong Hao * @r1: Reserved. 1967*5597088cSDongdong Hao * @func: Function code. 1968*5597088cSDongdong Hao * @vol_dev_hdl: Volume device handle. 1969*5597088cSDongdong Hao * @r2: Reserved 1970*5597088cSDongdong Hao * @adapter_status: Status returned by adapter. 1971*5597088cSDongdong Hao * @r3: Reserved. 1972*5597088cSDongdong Hao */ 1973*5597088cSDongdong Hao struct leapraid_raid_act_rep { 1974*5597088cSDongdong Hao u8 act; 1975*5597088cSDongdong Hao u8 r1[2]; 1976*5597088cSDongdong Hao u8 func; 1977*5597088cSDongdong Hao __le16 vol_dev_hdl; 1978*5597088cSDongdong Hao u8 r2[8]; 1979*5597088cSDongdong Hao __le16 adapter_status; 1980*5597088cSDongdong Hao u8 r3[76]; 1981*5597088cSDongdong Hao }; 1982*5597088cSDongdong Hao 1983*5597088cSDongdong Hao /** 1984*5597088cSDongdong Hao * struct leapraid_smp_passthrough_req - SMP passthrough request 1985*5597088cSDongdong Hao * 1986*5597088cSDongdong Hao * @passthrough_flg: Passthrough flags. 1987*5597088cSDongdong Hao * @physical_port: Target PHY port. 1988*5597088cSDongdong Hao * @r1: Reserved. 1989*5597088cSDongdong Hao * @func: Function code. 1990*5597088cSDongdong Hao * @req_data_len: Request data length. 1991*5597088cSDongdong Hao * @r2: Reserved. 1992*5597088cSDongdong Hao * @sas_address: SAS address of target device. 1993*5597088cSDongdong Hao * @r3: Reserved. 1994*5597088cSDongdong Hao * @sgl: Scatter-gather list describing request buffer. 1995*5597088cSDongdong Hao */ 1996*5597088cSDongdong Hao struct leapraid_smp_passthrough_req { 1997*5597088cSDongdong Hao u8 passthrough_flg; 1998*5597088cSDongdong Hao u8 physical_port; 1999*5597088cSDongdong Hao u8 r1; 2000*5597088cSDongdong Hao u8 func; 2001*5597088cSDongdong Hao __le16 req_data_len; 2002*5597088cSDongdong Hao u8 r2[10]; 2003*5597088cSDongdong Hao __le64 sas_address; 2004*5597088cSDongdong Hao u8 r3[8]; 2005*5597088cSDongdong Hao union leapraid_simple_sge_union sgl; 2006*5597088cSDongdong Hao } __packed __aligned(4); 2007*5597088cSDongdong Hao 2008*5597088cSDongdong Hao /** 2009*5597088cSDongdong Hao * struct leapraid_smp_passthrough_rep - SMP passthrough reply 2010*5597088cSDongdong Hao * 2011*5597088cSDongdong Hao * @passthrough_flg: Passthrough flags echoed. 2012*5597088cSDongdong Hao * @physical_port: Target PHY port. 2013*5597088cSDongdong Hao * @r1: Reserved. 2014*5597088cSDongdong Hao * @func: Function code. 2015*5597088cSDongdong Hao * @resp_data_len: Length of response data. 2016*5597088cSDongdong Hao * @r2: Reserved. 2017*5597088cSDongdong Hao * @adapter_status: Adapter status. 2018*5597088cSDongdong Hao * @r3: Reserved. 2019*5597088cSDongdong Hao */ 2020*5597088cSDongdong Hao struct leapraid_smp_passthrough_rep { 2021*5597088cSDongdong Hao u8 passthrough_flg; 2022*5597088cSDongdong Hao u8 physical_port; 2023*5597088cSDongdong Hao u8 r1; 2024*5597088cSDongdong Hao u8 func; 2025*5597088cSDongdong Hao __le16 resp_data_len; 2026*5597088cSDongdong Hao u8 r2[8]; 2027*5597088cSDongdong Hao __le16 adapter_status; 2028*5597088cSDongdong Hao u8 r3[12]; 2029*5597088cSDongdong Hao }; 2030*5597088cSDongdong Hao 2031*5597088cSDongdong Hao /** 2032*5597088cSDongdong Hao * struct leapraid_sas_io_unit_ctrl_req - SAS I/O unit control request 2033*5597088cSDongdong Hao * 2034*5597088cSDongdong Hao * @op: Operation code. 2035*5597088cSDongdong Hao * @r1: Reserved. 2036*5597088cSDongdong Hao * @func: Function code. 2037*5597088cSDongdong Hao * @dev_hdl: Device handle. 2038*5597088cSDongdong Hao * @r2: Reserved. 2039*5597088cSDongdong Hao */ 2040*5597088cSDongdong Hao struct leapraid_sas_io_unit_ctrl_req { 2041*5597088cSDongdong Hao u8 op; 2042*5597088cSDongdong Hao u8 r1[2]; 2043*5597088cSDongdong Hao u8 func; 2044*5597088cSDongdong Hao __le16 dev_hdl; 2045*5597088cSDongdong Hao u8 r2[38]; 2046*5597088cSDongdong Hao }; 2047*5597088cSDongdong Hao 2048*5597088cSDongdong Hao #endif /* LEAPRAID_H */ 2049