1 2 /* 3 * Copyright (c) 1997-1999 by Sun Microsystems, Inc. 4 * All rights reserved. 5 */ 6 7 #ifndef _SYS_SCSI_ADAPTERS_IFPIO_H 8 #define _SYS_SCSI_ADAPTERS_IFPIO_H 9 10 #pragma ident "%Z%%M% %I% %E% SMI" 11 12 /* 13 * Include any headers you depend on. 14 */ 15 16 #ifdef __cplusplus 17 extern "C" { 18 #endif 19 20 #define IFP_IOC ('I' << 8) 21 22 /* 23 * Get ifp device map ioctl. 24 */ 25 #define IFPIOCGMAP (IFP_IOC|1) /* Get device map/wwn's */ 26 #define IFPIO_ADISC_ELS (IFP_IOC|2) /* Get ADISC info */ 27 #define IFPIO_FORCE_LIP (IFP_IOC|3) /* Force a LIP */ 28 #define IFPIO_LINKSTATUS (IFP_IOC|4) /* Link Status */ 29 #define IFPIO_DIAG_GET_FWREV (IFP_IOC|5) /* SunVTS diag get fw rev */ 30 #define IFPIO_DIAG_NOP (IFP_IOC|6) /* SunVTS diag NOOP */ 31 #define IFPIO_DIAG_MBOXCMD (IFP_IOC|7) /* SunVTS diag mbox cmds */ 32 #define IFPIO_LOOPBACK_FRAME (IFP_IOC|8) /* Diagnostic loopback */ 33 #define IFPIO_DIAG_SELFTEST (IFP_IOC|9) /* Diagnostic selftest */ 34 #define IFPIO_BOARD_INFO (IFP_IOC|10) /* Get device id and rev's */ 35 #define IFPIO_FCODE_DOWNLOAD (IFP_IOC|11) /* Download fcode to flash */ 36 37 struct ifp_board_info { 38 uint16_t ifpd_major; /* FW major revision */ 39 uint16_t ifpd_minor; /* FW minor revision */ 40 uint16_t ifpd_subminor; /* FW subminor revision */ 41 uint16_t chip_rev; /* chip revision level */ 42 uint16_t ctrl_id; /* 2100 or 2200 */ 43 }; 44 typedef struct ifp_board_info ifp_board_info_t; 45 46 struct ifp_diag_fw_rev { 47 uint16_t ifpd_major; /* FW major revision */ 48 uint16_t ifpd_minor; /* FW minor revision */ 49 }; 50 typedef struct ifp_diag_fw_rev ifp_diag_fw_rev_t; 51 52 struct ifp_lb_frame_cmd { 53 uint16_t options; /* diag loop-back options */ 54 uint32_t iter_cnt; /* count of loopback ops */ 55 uint32_t xfer_cnt; /* transmit/receive xfer len */ 56 caddr_t xmit_addr; /* transmit data address */ 57 caddr_t recv_addr; /* receive data address */ 58 59 uint16_t status; /* completion status */ 60 uint16_t crc_cnt; /* crc error count */ 61 uint16_t disparity_cnt; /* disparity error count */ 62 uint16_t frame_len_err_cnt; /* frame length error count */ 63 uint32_t fail_iter_cnt; /* failing iteration count */ 64 }; 65 typedef struct ifp_lb_frame_cmd ifp_lb_frame_cmd_t; 66 67 #if defined(_LP64) 68 struct ifp_lb_frame_cmd32 { 69 uint16_t options; /* diag loop-back options */ 70 uint32_t iter_cnt; /* count of loopback ops */ 71 uint32_t xfer_cnt; /* transmit/receive xfer len */ 72 caddr32_t xmit_addr; /* transmit data address */ 73 caddr32_t recv_addr; /* receive data address */ 74 75 uint16_t status; /* completion status */ 76 uint16_t crc_cnt; /* crc error count */ 77 uint16_t disparity_cnt; /* disparity error count */ 78 uint16_t frame_len_err_cnt; /* frame length error count */ 79 uint32_t fail_iter_cnt; /* failing iteration count */ 80 }; 81 #endif 82 83 /* defines for options field */ 84 #define LOOP_10BIT 0x0000 /* loopback at 10 bit interface */ 85 #define LOOP_1BIT 0x0001 /* loopback at 1 bit interface */ 86 #define LOOP_EXTERNAL 0x0002 /* loopback on external loop */ 87 #define LOOP_XMIT_OFF 0x0004 /* transmitter powered off */ 88 #define LOOP_XMIT_RAM 0x0010 /* xmit data from system ram */ 89 #define LOOP_RECV_RAM 0x0020 /* receive data to system ram */ 90 #define LOOP_ERR_STOP 0x0080 /* stop test on error */ 91 92 struct ifp_diag_selftest { 93 uint16_t status; /* completion status */ 94 uint16_t test_num; /* failing test number */ 95 uint16_t fail_addr; /* failure address */ 96 uint16_t fail_data; /* failure data */ 97 }; 98 typedef struct ifp_diag_selftest ifp_diag_selftest_t; 99 100 /* offset of the fcode from begining of file */ 101 #define FCODE_OFFSET 0x20 102 struct ifp_download { 103 uint32_t dl_fcode_len; /* length of the fcode array */ 104 uint16_t dl_chip_id; /* Chip id for FCODE */ 105 uchar_t dl_fcode[1]; /* the fcode */ 106 }; 107 typedef struct ifp_download ifp_download_t; 108 109 #define IFP_NUM_ENTRIES_IN_MAP 127 110 #define IFP_DIAG_MAX_MBOX 10 111 112 struct ifp_al_addr_pair { 113 uchar_t ifp_al_pa; 114 uchar_t ifp_hard_address; 115 uchar_t ifp_inq_dtype; 116 uchar_t ifp_node_wwn[FC_WWN_SIZE]; 117 uchar_t ifp_port_wwn[FC_WWN_SIZE]; 118 }; 119 typedef struct ifp_al_addr_pair ifp_al_addr_pair_t; 120 121 struct ifp_al_map { 122 short ifp_count; 123 ifp_al_addr_pair_t ifp_addr_pair[IFP_NUM_ENTRIES_IN_MAP]; 124 ifp_al_addr_pair_t ifp_hba_addr; 125 }; 126 typedef struct ifp_al_map ifp_al_map_t; 127 128 struct adisc_payload { 129 uint_t adisc_hardaddr; 130 uchar_t adisc_portwwn[8]; 131 uchar_t adisc_nodewwn[8]; 132 uint_t adisc_dest; 133 }; 134 135 struct rls_payload { 136 uint_t rls_portno; 137 uint_t rls_linkfail; 138 uint_t rls_syncfail; 139 uint_t rls_sigfail; 140 uint_t rls_primitiverr; 141 uint_t rls_invalidword; 142 uint_t rls_invalidcrc; 143 }; 144 typedef struct rls_payload rls_payload_t; 145 146 struct ifp_target_stats { 147 int logouts_recvd; 148 /* 149 * unsolicited LOGOs recvd from 150 * target 151 */ 152 int task_mgmt_failures; 153 int data_ro_mismatches; 154 int dl_len_mismatches; 155 }; 156 typedef struct ifp_target_stats ifp_target_stats_t; 157 158 struct ifp_stats { 159 int version; /* version of this struct */ 160 int lip_count; /* lips forced by ifp */ 161 int ncmds; /* outstanding commands */ 162 ifp_target_stats_t tstats[IFP_NUM_ENTRIES_IN_MAP]; /* per tgt stats */ 163 }; 164 typedef struct ifp_stats ifp_stats_t; 165 166 /* XXX temp hack to get sf/socal ioctls used by luxadm to work with ifp */ 167 168 #if !defined(SFIOCGMAP) 169 #define SFIOCGMAP ((0xda << 8)|1) 170 #endif 171 #if !defined(FCIO_GETMAP) 172 #define FCIO_GETMAP (('F' << 8)|175) 173 struct lilpmap { 174 ushort_t lilp_magic; 175 ushort_t lilp_myalpa; 176 uchar_t lilp_length; 177 uchar_t lilp_list[127]; 178 }; 179 #endif 180 181 /* 182 * Structure used for diag loopback commands. 183 * This is copied from socalvar.h and must 184 * remain the same as for the socal driver. 185 */ 186 typedef struct flb_hdr { 187 uint_t max_length; 188 uint_t length; 189 } flb_hdr_t; 190 /* This is the max loopback transfer size */ 191 #define MAX_LOOPBACK 65536 192 193 #if !defined(FCIO_FORCE_LIP) 194 #define FCIO_FORCE_LIP (('F' << 8)|177) 195 #endif 196 #if !defined(FCIO_LINKSTATUS) 197 #define FCIO_LINKSTATUS (('F' << 8)|183) 198 #endif 199 #if !defined(FCIO_FCODE_MCODE_VERSION) 200 #define FCIO_FCODE_MCODE_VERSION (('F' << 8)|202) 201 #endif 202 struct ifp_fm_version { 203 int fcode_ver_len; 204 int mcode_ver_len; 205 int prom_ver_len; 206 caddr_t fcode_ver; 207 caddr_t mcode_ver; 208 caddr_t prom_ver; 209 }; 210 #if defined(_LP64) 211 struct ifp_fm_version32 { 212 int fcode_ver_len; 213 int mcode_ver_len; 214 int prom_ver_len; 215 caddr32_t fcode_ver; 216 caddr32_t mcode_ver; 217 caddr32_t prom_ver; 218 }; 219 #endif 220 221 /* XXX end temp hack to get sf/socal ioctls used by luxadm to work with ifp */ 222 223 struct ifp_diag_mbox { 224 ushort_t ifp_in_mbox[8]; /* in regs -- from ISP */ 225 ushort_t ifp_out_mbox[8]; /* out regs -- to ISP */ 226 }; 227 typedef struct ifp_diag_mbox ifp_diag_mbox_t; 228 229 struct ifp_diag_regs { 230 ushort_t ifpd_mailbox[8]; 231 ushort_t ifpd_hccr; 232 ushort_t ifpd_bus_sema; 233 ushort_t ifpd_isr; 234 ushort_t ifpd_icr; 235 ushort_t ifpd_icsr; 236 ushort_t ifpd_cdma_count; 237 uint_t ifpd_cdma_addr; 238 ushort_t ifpd_cdma_status; 239 ushort_t ifpd_cdma_control; 240 uint_t ifpd_rdma_count; 241 uint_t ifpd_rdma_addr; 242 ushort_t ifpd_rdma_status; 243 ushort_t ifpd_rdma_control; 244 uint_t ifpd_tdma_count; 245 uint_t ifpd_tdma_addr; 246 ushort_t ifpd_tdma_status; 247 ushort_t ifpd_tdma_control; 248 ushort_t ifpd_risc_reg[16]; 249 ushort_t ifpd_risc_psr; 250 ushort_t ifpd_risc_ivr; 251 ushort_t ifpd_risc_pcr; 252 ushort_t ifpd_risc_rar0; 253 ushort_t ifpd_risc_rar1; 254 ushort_t ifpd_risc_lcr; 255 ushort_t ifpd_risc_pc; 256 ushort_t ifpd_risc_mtr; 257 ushort_t ifpd_risc_sp; 258 ushort_t ifpd_request_in; 259 ushort_t ifpd_request_out; 260 ushort_t ifpd_response_in; 261 ushort_t ifpd_response_out; 262 void *ifpd_current_req_ptr; 263 void *ifpd_base_req_ptr; 264 void *ifpd_current_resp_ptr; 265 void *ifpd_base_resp_ptr; 266 }; 267 typedef struct ifp_diag_regs ifp_diag_regs_t; 268 269 struct ifp_diag_cmd { 270 short ifp_cmds_rev; /* revision */ 271 short ifp_cmds_current_rev; /* rev driver expects */ 272 short ifp_cmds_count; /* number of cmds */ 273 short ifp_cmds_done; /* number of cmds done */ 274 ifp_diag_regs_t ifp_regs; /* reg dump area */ 275 ifp_diag_mbox_t ifp_mbox[IFP_DIAG_MAX_MBOX]; /* mbox values */ 276 }; 277 typedef struct ifp_diag_cmd ifp_diag_cmd_t; 278 279 #define IFP_DIAG_CMD_REV 0x1 /* diag cmd rev supported */ 280 281 #ifdef __cplusplus 282 } 283 #endif 284 285 #endif /* _SYS_SCSI_ADAPTERS_IFPIO_H */ 286