10Sstevel@tonic-gate /* 2*782Sadailey * CDDL HEADER START 3*782Sadailey * 4*782Sadailey * The contents of this file are subject to the terms of the 5*782Sadailey * Common Development and Distribution License (the "License"). 6*782Sadailey * You may not use this file except in compliance with the License. 7*782Sadailey * 8*782Sadailey * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*782Sadailey * or http://www.opensolaris.org/os/licensing. 10*782Sadailey * See the License for the specific language governing permissions 11*782Sadailey * and limitations under the License. 12*782Sadailey * 13*782Sadailey * When distributing Covered Code, include this CDDL HEADER in each 14*782Sadailey * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*782Sadailey * If applicable, add the following below this CDDL HEADER, with the 16*782Sadailey * fields enclosed by brackets "[]" replaced with your own identifying 17*782Sadailey * information: Portions Copyright [yyyy] [name of copyright owner] 18*782Sadailey * 19*782Sadailey * CDDL HEADER END 20*782Sadailey */ 21*782Sadailey /* 22*782Sadailey * Copyright 1999 Sun Microsystems, Inc. All rights reserved. 23*782Sadailey * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _SYS_SCSI_ADAPTERS_IFPIO_H 270Sstevel@tonic-gate #define _SYS_SCSI_ADAPTERS_IFPIO_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 300Sstevel@tonic-gate 310Sstevel@tonic-gate /* 320Sstevel@tonic-gate * Include any headers you depend on. 330Sstevel@tonic-gate */ 340Sstevel@tonic-gate 350Sstevel@tonic-gate #ifdef __cplusplus 360Sstevel@tonic-gate extern "C" { 370Sstevel@tonic-gate #endif 380Sstevel@tonic-gate 390Sstevel@tonic-gate #define IFP_IOC ('I' << 8) 400Sstevel@tonic-gate 410Sstevel@tonic-gate /* 420Sstevel@tonic-gate * Get ifp device map ioctl. 430Sstevel@tonic-gate */ 440Sstevel@tonic-gate #define IFPIOCGMAP (IFP_IOC|1) /* Get device map/wwn's */ 450Sstevel@tonic-gate #define IFPIO_ADISC_ELS (IFP_IOC|2) /* Get ADISC info */ 460Sstevel@tonic-gate #define IFPIO_FORCE_LIP (IFP_IOC|3) /* Force a LIP */ 470Sstevel@tonic-gate #define IFPIO_LINKSTATUS (IFP_IOC|4) /* Link Status */ 480Sstevel@tonic-gate #define IFPIO_DIAG_GET_FWREV (IFP_IOC|5) /* SunVTS diag get fw rev */ 490Sstevel@tonic-gate #define IFPIO_DIAG_NOP (IFP_IOC|6) /* SunVTS diag NOOP */ 500Sstevel@tonic-gate #define IFPIO_DIAG_MBOXCMD (IFP_IOC|7) /* SunVTS diag mbox cmds */ 510Sstevel@tonic-gate #define IFPIO_LOOPBACK_FRAME (IFP_IOC|8) /* Diagnostic loopback */ 520Sstevel@tonic-gate #define IFPIO_DIAG_SELFTEST (IFP_IOC|9) /* Diagnostic selftest */ 530Sstevel@tonic-gate #define IFPIO_BOARD_INFO (IFP_IOC|10) /* Get device id and rev's */ 540Sstevel@tonic-gate #define IFPIO_FCODE_DOWNLOAD (IFP_IOC|11) /* Download fcode to flash */ 550Sstevel@tonic-gate 560Sstevel@tonic-gate struct ifp_board_info { 570Sstevel@tonic-gate uint16_t ifpd_major; /* FW major revision */ 580Sstevel@tonic-gate uint16_t ifpd_minor; /* FW minor revision */ 590Sstevel@tonic-gate uint16_t ifpd_subminor; /* FW subminor revision */ 600Sstevel@tonic-gate uint16_t chip_rev; /* chip revision level */ 610Sstevel@tonic-gate uint16_t ctrl_id; /* 2100 or 2200 */ 620Sstevel@tonic-gate }; 630Sstevel@tonic-gate typedef struct ifp_board_info ifp_board_info_t; 640Sstevel@tonic-gate 650Sstevel@tonic-gate struct ifp_diag_fw_rev { 660Sstevel@tonic-gate uint16_t ifpd_major; /* FW major revision */ 670Sstevel@tonic-gate uint16_t ifpd_minor; /* FW minor revision */ 680Sstevel@tonic-gate }; 690Sstevel@tonic-gate typedef struct ifp_diag_fw_rev ifp_diag_fw_rev_t; 700Sstevel@tonic-gate 710Sstevel@tonic-gate struct ifp_lb_frame_cmd { 720Sstevel@tonic-gate uint16_t options; /* diag loop-back options */ 730Sstevel@tonic-gate uint32_t iter_cnt; /* count of loopback ops */ 740Sstevel@tonic-gate uint32_t xfer_cnt; /* transmit/receive xfer len */ 750Sstevel@tonic-gate caddr_t xmit_addr; /* transmit data address */ 760Sstevel@tonic-gate caddr_t recv_addr; /* receive data address */ 770Sstevel@tonic-gate 780Sstevel@tonic-gate uint16_t status; /* completion status */ 790Sstevel@tonic-gate uint16_t crc_cnt; /* crc error count */ 800Sstevel@tonic-gate uint16_t disparity_cnt; /* disparity error count */ 810Sstevel@tonic-gate uint16_t frame_len_err_cnt; /* frame length error count */ 820Sstevel@tonic-gate uint32_t fail_iter_cnt; /* failing iteration count */ 830Sstevel@tonic-gate }; 840Sstevel@tonic-gate typedef struct ifp_lb_frame_cmd ifp_lb_frame_cmd_t; 850Sstevel@tonic-gate 860Sstevel@tonic-gate #if defined(_LP64) 870Sstevel@tonic-gate struct ifp_lb_frame_cmd32 { 880Sstevel@tonic-gate uint16_t options; /* diag loop-back options */ 890Sstevel@tonic-gate uint32_t iter_cnt; /* count of loopback ops */ 900Sstevel@tonic-gate uint32_t xfer_cnt; /* transmit/receive xfer len */ 910Sstevel@tonic-gate caddr32_t xmit_addr; /* transmit data address */ 920Sstevel@tonic-gate caddr32_t recv_addr; /* receive data address */ 930Sstevel@tonic-gate 940Sstevel@tonic-gate uint16_t status; /* completion status */ 950Sstevel@tonic-gate uint16_t crc_cnt; /* crc error count */ 960Sstevel@tonic-gate uint16_t disparity_cnt; /* disparity error count */ 970Sstevel@tonic-gate uint16_t frame_len_err_cnt; /* frame length error count */ 980Sstevel@tonic-gate uint32_t fail_iter_cnt; /* failing iteration count */ 990Sstevel@tonic-gate }; 1000Sstevel@tonic-gate #endif 1010Sstevel@tonic-gate 1020Sstevel@tonic-gate /* defines for options field */ 1030Sstevel@tonic-gate #define LOOP_10BIT 0x0000 /* loopback at 10 bit interface */ 1040Sstevel@tonic-gate #define LOOP_1BIT 0x0001 /* loopback at 1 bit interface */ 1050Sstevel@tonic-gate #define LOOP_EXTERNAL 0x0002 /* loopback on external loop */ 1060Sstevel@tonic-gate #define LOOP_XMIT_OFF 0x0004 /* transmitter powered off */ 1070Sstevel@tonic-gate #define LOOP_XMIT_RAM 0x0010 /* xmit data from system ram */ 1080Sstevel@tonic-gate #define LOOP_RECV_RAM 0x0020 /* receive data to system ram */ 1090Sstevel@tonic-gate #define LOOP_ERR_STOP 0x0080 /* stop test on error */ 1100Sstevel@tonic-gate 1110Sstevel@tonic-gate struct ifp_diag_selftest { 1120Sstevel@tonic-gate uint16_t status; /* completion status */ 1130Sstevel@tonic-gate uint16_t test_num; /* failing test number */ 1140Sstevel@tonic-gate uint16_t fail_addr; /* failure address */ 1150Sstevel@tonic-gate uint16_t fail_data; /* failure data */ 1160Sstevel@tonic-gate }; 1170Sstevel@tonic-gate typedef struct ifp_diag_selftest ifp_diag_selftest_t; 1180Sstevel@tonic-gate 1190Sstevel@tonic-gate /* offset of the fcode from begining of file */ 1200Sstevel@tonic-gate #define FCODE_OFFSET 0x20 1210Sstevel@tonic-gate struct ifp_download { 1220Sstevel@tonic-gate uint32_t dl_fcode_len; /* length of the fcode array */ 1230Sstevel@tonic-gate uint16_t dl_chip_id; /* Chip id for FCODE */ 1240Sstevel@tonic-gate uchar_t dl_fcode[1]; /* the fcode */ 1250Sstevel@tonic-gate }; 1260Sstevel@tonic-gate typedef struct ifp_download ifp_download_t; 1270Sstevel@tonic-gate 1280Sstevel@tonic-gate #define IFP_NUM_ENTRIES_IN_MAP 127 1290Sstevel@tonic-gate #define IFP_DIAG_MAX_MBOX 10 1300Sstevel@tonic-gate 1310Sstevel@tonic-gate struct ifp_al_addr_pair { 1320Sstevel@tonic-gate uchar_t ifp_al_pa; 1330Sstevel@tonic-gate uchar_t ifp_hard_address; 1340Sstevel@tonic-gate uchar_t ifp_inq_dtype; 1350Sstevel@tonic-gate uchar_t ifp_node_wwn[FC_WWN_SIZE]; 1360Sstevel@tonic-gate uchar_t ifp_port_wwn[FC_WWN_SIZE]; 1370Sstevel@tonic-gate }; 1380Sstevel@tonic-gate typedef struct ifp_al_addr_pair ifp_al_addr_pair_t; 1390Sstevel@tonic-gate 1400Sstevel@tonic-gate struct ifp_al_map { 1410Sstevel@tonic-gate short ifp_count; 1420Sstevel@tonic-gate ifp_al_addr_pair_t ifp_addr_pair[IFP_NUM_ENTRIES_IN_MAP]; 1430Sstevel@tonic-gate ifp_al_addr_pair_t ifp_hba_addr; 1440Sstevel@tonic-gate }; 1450Sstevel@tonic-gate typedef struct ifp_al_map ifp_al_map_t; 1460Sstevel@tonic-gate 1470Sstevel@tonic-gate struct adisc_payload { 1480Sstevel@tonic-gate uint_t adisc_hardaddr; 1490Sstevel@tonic-gate uchar_t adisc_portwwn[8]; 1500Sstevel@tonic-gate uchar_t adisc_nodewwn[8]; 1510Sstevel@tonic-gate uint_t adisc_dest; 1520Sstevel@tonic-gate }; 1530Sstevel@tonic-gate 1540Sstevel@tonic-gate struct rls_payload { 1550Sstevel@tonic-gate uint_t rls_portno; 1560Sstevel@tonic-gate uint_t rls_linkfail; 1570Sstevel@tonic-gate uint_t rls_syncfail; 1580Sstevel@tonic-gate uint_t rls_sigfail; 1590Sstevel@tonic-gate uint_t rls_primitiverr; 1600Sstevel@tonic-gate uint_t rls_invalidword; 1610Sstevel@tonic-gate uint_t rls_invalidcrc; 1620Sstevel@tonic-gate }; 1630Sstevel@tonic-gate typedef struct rls_payload rls_payload_t; 1640Sstevel@tonic-gate 1650Sstevel@tonic-gate struct ifp_target_stats { 1660Sstevel@tonic-gate int logouts_recvd; 1670Sstevel@tonic-gate /* 1680Sstevel@tonic-gate * unsolicited LOGOs recvd from 1690Sstevel@tonic-gate * target 1700Sstevel@tonic-gate */ 1710Sstevel@tonic-gate int task_mgmt_failures; 1720Sstevel@tonic-gate int data_ro_mismatches; 1730Sstevel@tonic-gate int dl_len_mismatches; 1740Sstevel@tonic-gate }; 1750Sstevel@tonic-gate typedef struct ifp_target_stats ifp_target_stats_t; 1760Sstevel@tonic-gate 1770Sstevel@tonic-gate struct ifp_stats { 1780Sstevel@tonic-gate int version; /* version of this struct */ 1790Sstevel@tonic-gate int lip_count; /* lips forced by ifp */ 1800Sstevel@tonic-gate int ncmds; /* outstanding commands */ 1810Sstevel@tonic-gate ifp_target_stats_t tstats[IFP_NUM_ENTRIES_IN_MAP]; /* per tgt stats */ 1820Sstevel@tonic-gate }; 1830Sstevel@tonic-gate typedef struct ifp_stats ifp_stats_t; 1840Sstevel@tonic-gate 1850Sstevel@tonic-gate /* XXX temp hack to get sf/socal ioctls used by luxadm to work with ifp */ 1860Sstevel@tonic-gate 1870Sstevel@tonic-gate #if !defined(SFIOCGMAP) 1880Sstevel@tonic-gate #define SFIOCGMAP ((0xda << 8)|1) 1890Sstevel@tonic-gate #endif 1900Sstevel@tonic-gate #if !defined(FCIO_GETMAP) 1910Sstevel@tonic-gate #define FCIO_GETMAP (('F' << 8)|175) 1920Sstevel@tonic-gate struct lilpmap { 1930Sstevel@tonic-gate ushort_t lilp_magic; 1940Sstevel@tonic-gate ushort_t lilp_myalpa; 1950Sstevel@tonic-gate uchar_t lilp_length; 1960Sstevel@tonic-gate uchar_t lilp_list[127]; 1970Sstevel@tonic-gate }; 1980Sstevel@tonic-gate #endif 1990Sstevel@tonic-gate 2000Sstevel@tonic-gate /* 2010Sstevel@tonic-gate * Structure used for diag loopback commands. 2020Sstevel@tonic-gate * This is copied from socalvar.h and must 2030Sstevel@tonic-gate * remain the same as for the socal driver. 2040Sstevel@tonic-gate */ 2050Sstevel@tonic-gate typedef struct flb_hdr { 2060Sstevel@tonic-gate uint_t max_length; 2070Sstevel@tonic-gate uint_t length; 2080Sstevel@tonic-gate } flb_hdr_t; 2090Sstevel@tonic-gate /* This is the max loopback transfer size */ 2100Sstevel@tonic-gate #define MAX_LOOPBACK 65536 2110Sstevel@tonic-gate 2120Sstevel@tonic-gate #if !defined(FCIO_FORCE_LIP) 2130Sstevel@tonic-gate #define FCIO_FORCE_LIP (('F' << 8)|177) 2140Sstevel@tonic-gate #endif 2150Sstevel@tonic-gate #if !defined(FCIO_LINKSTATUS) 2160Sstevel@tonic-gate #define FCIO_LINKSTATUS (('F' << 8)|183) 2170Sstevel@tonic-gate #endif 2180Sstevel@tonic-gate #if !defined(FCIO_FCODE_MCODE_VERSION) 2190Sstevel@tonic-gate #define FCIO_FCODE_MCODE_VERSION (('F' << 8)|202) 2200Sstevel@tonic-gate #endif 2210Sstevel@tonic-gate struct ifp_fm_version { 2220Sstevel@tonic-gate int fcode_ver_len; 2230Sstevel@tonic-gate int mcode_ver_len; 2240Sstevel@tonic-gate int prom_ver_len; 2250Sstevel@tonic-gate caddr_t fcode_ver; 2260Sstevel@tonic-gate caddr_t mcode_ver; 2270Sstevel@tonic-gate caddr_t prom_ver; 2280Sstevel@tonic-gate }; 2290Sstevel@tonic-gate #if defined(_LP64) 2300Sstevel@tonic-gate struct ifp_fm_version32 { 2310Sstevel@tonic-gate int fcode_ver_len; 2320Sstevel@tonic-gate int mcode_ver_len; 2330Sstevel@tonic-gate int prom_ver_len; 2340Sstevel@tonic-gate caddr32_t fcode_ver; 2350Sstevel@tonic-gate caddr32_t mcode_ver; 2360Sstevel@tonic-gate caddr32_t prom_ver; 2370Sstevel@tonic-gate }; 2380Sstevel@tonic-gate #endif 2390Sstevel@tonic-gate 2400Sstevel@tonic-gate /* XXX end temp hack to get sf/socal ioctls used by luxadm to work with ifp */ 2410Sstevel@tonic-gate 2420Sstevel@tonic-gate struct ifp_diag_mbox { 2430Sstevel@tonic-gate ushort_t ifp_in_mbox[8]; /* in regs -- from ISP */ 2440Sstevel@tonic-gate ushort_t ifp_out_mbox[8]; /* out regs -- to ISP */ 2450Sstevel@tonic-gate }; 2460Sstevel@tonic-gate typedef struct ifp_diag_mbox ifp_diag_mbox_t; 2470Sstevel@tonic-gate 2480Sstevel@tonic-gate struct ifp_diag_regs { 2490Sstevel@tonic-gate ushort_t ifpd_mailbox[8]; 2500Sstevel@tonic-gate ushort_t ifpd_hccr; 2510Sstevel@tonic-gate ushort_t ifpd_bus_sema; 2520Sstevel@tonic-gate ushort_t ifpd_isr; 2530Sstevel@tonic-gate ushort_t ifpd_icr; 2540Sstevel@tonic-gate ushort_t ifpd_icsr; 2550Sstevel@tonic-gate ushort_t ifpd_cdma_count; 2560Sstevel@tonic-gate uint_t ifpd_cdma_addr; 2570Sstevel@tonic-gate ushort_t ifpd_cdma_status; 2580Sstevel@tonic-gate ushort_t ifpd_cdma_control; 2590Sstevel@tonic-gate uint_t ifpd_rdma_count; 2600Sstevel@tonic-gate uint_t ifpd_rdma_addr; 2610Sstevel@tonic-gate ushort_t ifpd_rdma_status; 2620Sstevel@tonic-gate ushort_t ifpd_rdma_control; 2630Sstevel@tonic-gate uint_t ifpd_tdma_count; 2640Sstevel@tonic-gate uint_t ifpd_tdma_addr; 2650Sstevel@tonic-gate ushort_t ifpd_tdma_status; 2660Sstevel@tonic-gate ushort_t ifpd_tdma_control; 2670Sstevel@tonic-gate ushort_t ifpd_risc_reg[16]; 2680Sstevel@tonic-gate ushort_t ifpd_risc_psr; 2690Sstevel@tonic-gate ushort_t ifpd_risc_ivr; 2700Sstevel@tonic-gate ushort_t ifpd_risc_pcr; 2710Sstevel@tonic-gate ushort_t ifpd_risc_rar0; 2720Sstevel@tonic-gate ushort_t ifpd_risc_rar1; 2730Sstevel@tonic-gate ushort_t ifpd_risc_lcr; 2740Sstevel@tonic-gate ushort_t ifpd_risc_pc; 2750Sstevel@tonic-gate ushort_t ifpd_risc_mtr; 2760Sstevel@tonic-gate ushort_t ifpd_risc_sp; 2770Sstevel@tonic-gate ushort_t ifpd_request_in; 2780Sstevel@tonic-gate ushort_t ifpd_request_out; 2790Sstevel@tonic-gate ushort_t ifpd_response_in; 2800Sstevel@tonic-gate ushort_t ifpd_response_out; 2810Sstevel@tonic-gate void *ifpd_current_req_ptr; 2820Sstevel@tonic-gate void *ifpd_base_req_ptr; 2830Sstevel@tonic-gate void *ifpd_current_resp_ptr; 2840Sstevel@tonic-gate void *ifpd_base_resp_ptr; 2850Sstevel@tonic-gate }; 2860Sstevel@tonic-gate typedef struct ifp_diag_regs ifp_diag_regs_t; 2870Sstevel@tonic-gate 2880Sstevel@tonic-gate struct ifp_diag_cmd { 2890Sstevel@tonic-gate short ifp_cmds_rev; /* revision */ 2900Sstevel@tonic-gate short ifp_cmds_current_rev; /* rev driver expects */ 2910Sstevel@tonic-gate short ifp_cmds_count; /* number of cmds */ 2920Sstevel@tonic-gate short ifp_cmds_done; /* number of cmds done */ 2930Sstevel@tonic-gate ifp_diag_regs_t ifp_regs; /* reg dump area */ 2940Sstevel@tonic-gate ifp_diag_mbox_t ifp_mbox[IFP_DIAG_MAX_MBOX]; /* mbox values */ 2950Sstevel@tonic-gate }; 2960Sstevel@tonic-gate typedef struct ifp_diag_cmd ifp_diag_cmd_t; 2970Sstevel@tonic-gate 2980Sstevel@tonic-gate #define IFP_DIAG_CMD_REV 0x1 /* diag cmd rev supported */ 2990Sstevel@tonic-gate 3000Sstevel@tonic-gate #ifdef __cplusplus 3010Sstevel@tonic-gate } 3020Sstevel@tonic-gate #endif 3030Sstevel@tonic-gate 3040Sstevel@tonic-gate #endif /* _SYS_SCSI_ADAPTERS_IFPIO_H */ 305