15d571944SMatt Jacob /* $FreeBSD$ */ 2098ca2bdSWarner Losh /*- 3*718cf2ccSPedro F. Giffuni * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 4*718cf2ccSPedro F. Giffuni * 5e5265237SMatt Jacob * Copyright (c) 1997-2006 by Matthew Jacob 6e5265237SMatt Jacob * All rights reserved. 75d571944SMatt Jacob * 85d571944SMatt Jacob * Redistribution and use in source and binary forms, with or without 95d571944SMatt Jacob * modification, are permitted provided that the following conditions 105d571944SMatt Jacob * are met: 115d571944SMatt Jacob * 1. Redistributions of source code must retain the above copyright 12e5265237SMatt Jacob * notice immediately at the beginning of the file, without modification, 13e5265237SMatt Jacob * this list of conditions, and the following disclaimer. 14e5265237SMatt Jacob * 2. The name of the author may not be used to endorse or promote products 15e5265237SMatt Jacob * derived from this software without specific prior written permission. 165d571944SMatt Jacob * 17e5265237SMatt Jacob * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18e5265237SMatt Jacob * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19e5265237SMatt Jacob * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20e5265237SMatt Jacob * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 21e5265237SMatt Jacob * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22e5265237SMatt Jacob * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23e5265237SMatt Jacob * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24e5265237SMatt Jacob * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25e5265237SMatt Jacob * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26e5265237SMatt Jacob * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27e5265237SMatt Jacob * SUCH DAMAGE. 285d571944SMatt Jacob */ 29e48b2487SMatt Jacob 305d571944SMatt Jacob /* 315d571944SMatt Jacob * ioctl definitions for Qlogic FC/SCSI HBA driver 325d571944SMatt Jacob */ 335d571944SMatt Jacob #define ISP_IOC (021) /* 'Ctrl-Q' */ 345d571944SMatt Jacob 355d571944SMatt Jacob /* 365d571944SMatt Jacob * This ioctl sets/retrieves the debugging level for this hba instance. 375d571944SMatt Jacob * Note that this is not a simple integer level- see ispvar.h for definitions. 385d571944SMatt Jacob * 395d571944SMatt Jacob * The arguments is a pointer to an integer with the new debugging level. 405d571944SMatt Jacob * The old value is written into this argument. 415d571944SMatt Jacob */ 425d571944SMatt Jacob 43f553351eSMatt Jacob #define ISP_SDBLEV _IOWR(ISP_IOC, 1, int) 445d571944SMatt Jacob 455d571944SMatt Jacob /* 465d571944SMatt Jacob * This ioctl resets the HBA. Use with caution. 475d571944SMatt Jacob */ 48f553351eSMatt Jacob #define ISP_RESETHBA _IO(ISP_IOC, 2) 495d571944SMatt Jacob 505d571944SMatt Jacob /* 519cd7268eSMatt Jacob * This ioctl performs a fibre channel rescan. 525d571944SMatt Jacob */ 53f553351eSMatt Jacob #define ISP_RESCAN _IO(ISP_IOC, 3) 545d571944SMatt Jacob 555d571944SMatt Jacob /* 56f553351eSMatt Jacob * This ioctl performs a reset and then will set the adapter to the 57f553351eSMatt Jacob * role that was passed in (the old role will be returned). It almost 58f553351eSMatt Jacob * goes w/o saying: use with caution. 592df76c16SMatt Jacob * 602df76c16SMatt Jacob * Channel selector stored in bits 8..32 as input to driver. 615d571944SMatt Jacob */ 62f553351eSMatt Jacob #define ISP_SETROLE _IOWR(ISP_IOC, 4, int) 63f553351eSMatt Jacob 64f553351eSMatt Jacob #define ISP_ROLE_NONE 0x0 654e8a2b48SMatt Jacob #define ISP_ROLE_TARGET 0x1 664e8a2b48SMatt Jacob #define ISP_ROLE_INITIATOR 0x2 67f553351eSMatt Jacob #define ISP_ROLE_BOTH (ISP_ROLE_TARGET|ISP_ROLE_INITIATOR) 685d571944SMatt Jacob 695d571944SMatt Jacob /* 70f553351eSMatt Jacob * Get the current adapter role 712df76c16SMatt Jacob * Channel selector passed in first argument. 725d571944SMatt Jacob */ 731484f178SMatt Jacob #define ISP_GETROLE _IOR(ISP_IOC, 5, int) 742903b272SMatt Jacob 752903b272SMatt Jacob /* 762903b272SMatt Jacob * Get/Clear Stats 772903b272SMatt Jacob */ 782903b272SMatt Jacob #define ISP_STATS_VERSION 0 792903b272SMatt Jacob typedef struct { 801dae40ebSMatt Jacob uint8_t isp_stat_version; 811dae40ebSMatt Jacob uint8_t isp_type; /* (ro) reflects chip type */ 821dae40ebSMatt Jacob uint8_t isp_revision; /* (ro) reflects chip version */ 831dae40ebSMatt Jacob uint8_t unused1; 841dae40ebSMatt Jacob uint32_t unused2; 852903b272SMatt Jacob /* 862903b272SMatt Jacob * Statistics Counters 872903b272SMatt Jacob */ 882903b272SMatt Jacob #define ISP_NSTATS 16 892903b272SMatt Jacob #define ISP_INTCNT 0 902903b272SMatt Jacob #define ISP_INTBOGUS 1 912903b272SMatt Jacob #define ISP_INTMBOXC 2 922903b272SMatt Jacob #define ISP_INGOASYNC 3 932903b272SMatt Jacob #define ISP_RSLTCCMPLT 4 942903b272SMatt Jacob #define ISP_FPHCCMCPLT 5 952903b272SMatt Jacob #define ISP_RSCCHIWAT 6 962903b272SMatt Jacob #define ISP_FPCCHIWAT 7 971dae40ebSMatt Jacob uint64_t isp_stats[ISP_NSTATS]; 982903b272SMatt Jacob } isp_stats_t; 992903b272SMatt Jacob 1002903b272SMatt Jacob #define ISP_GET_STATS _IOR(ISP_IOC, 6, isp_stats_t) 1012903b272SMatt Jacob #define ISP_CLR_STATS _IO(ISP_IOC, 7) 102b8941882SMatt Jacob 103b8941882SMatt Jacob /* 104f553351eSMatt Jacob * Initiate a LIP 105f553351eSMatt Jacob */ 106f553351eSMatt Jacob #define ISP_FC_LIP _IO(ISP_IOC, 8) 107f553351eSMatt Jacob 108f553351eSMatt Jacob /* 109f553351eSMatt Jacob * Return the Port Database structure for the named device, or ENODEV if none. 110f553351eSMatt Jacob * Caller fills in virtual loopid (0..255), aka 'target'. The driver returns 111f553351eSMatt Jacob * ENODEV (if nothing valid there) or the actual loopid (for local loop devices 112f553351eSMatt Jacob * only), 24 bit Port ID and Node and Port WWNs. 113f553351eSMatt Jacob */ 114f553351eSMatt Jacob struct isp_fc_device { 1152df76c16SMatt Jacob uint32_t loopid; /* 0..255,2047 */ 1162df76c16SMatt Jacob uint32_t 1172df76c16SMatt Jacob chan : 6, 1184e8a2b48SMatt Jacob role : 2, 1194e8a2b48SMatt Jacob portid : 24; /* 24 bit Port ID */ 1201dae40ebSMatt Jacob uint64_t node_wwn; 1211dae40ebSMatt Jacob uint64_t port_wwn; 122f553351eSMatt Jacob }; 123f553351eSMatt Jacob #define ISP_FC_GETDINFO _IOWR(ISP_IOC, 9, struct isp_fc_device) 124f553351eSMatt Jacob 125f553351eSMatt Jacob /* 126b8941882SMatt Jacob * Get F/W crash dump 127b8941882SMatt Jacob */ 128d134aa0bSMatt Jacob #define ISP_GET_FW_CRASH_DUMP _IO(ISP_IOC, 10) 129b8941882SMatt Jacob #define ISP_FORCE_CRASH_DUMP _IO(ISP_IOC, 11) 13081ac5536SMatt Jacob 13181ac5536SMatt Jacob /* 13281ac5536SMatt Jacob * Get information about this Host Adapter, including current connection 13381ac5536SMatt Jacob * topology and capabilities. 13481ac5536SMatt Jacob */ 13581ac5536SMatt Jacob struct isp_hba_device { 1361dae40ebSMatt Jacob uint32_t 13781ac5536SMatt Jacob : 8, 13881ac5536SMatt Jacob fc_speed : 4, /* Gbps */ 1392df76c16SMatt Jacob : 1, 14081ac5536SMatt Jacob fc_topology : 3, 1412df76c16SMatt Jacob fc_channel : 8, 1422df76c16SMatt Jacob fc_loopid : 16; 1431dae40ebSMatt Jacob uint8_t fc_fw_major; 1441dae40ebSMatt Jacob uint8_t fc_fw_minor; 1451dae40ebSMatt Jacob uint8_t fc_fw_micro; 1462df76c16SMatt Jacob uint8_t fc_nchannels; /* number of supported channels */ 1472df76c16SMatt Jacob uint16_t fc_nports; /* number of supported ports */ 1481dae40ebSMatt Jacob uint64_t nvram_node_wwn; 1491dae40ebSMatt Jacob uint64_t nvram_port_wwn; 1501dae40ebSMatt Jacob uint64_t active_node_wwn; 1511dae40ebSMatt Jacob uint64_t active_port_wwn; 15281ac5536SMatt Jacob }; 15381ac5536SMatt Jacob 15481ac5536SMatt Jacob #define ISP_TOPO_UNKNOWN 0 /* connection topology unknown */ 15581ac5536SMatt Jacob #define ISP_TOPO_FCAL 1 /* private or PL_DA */ 15681ac5536SMatt Jacob #define ISP_TOPO_LPORT 2 /* public loop */ 15781ac5536SMatt Jacob #define ISP_TOPO_NPORT 3 /* N-port */ 15881ac5536SMatt Jacob #define ISP_TOPO_FPORT 4 /* F-port */ 15981ac5536SMatt Jacob 1602df76c16SMatt Jacob /* don't use 12 any more */ 1612df76c16SMatt Jacob #define ISP_FC_GETHINFO _IOWR(ISP_IOC, 13, struct isp_hba_device) 1628e62a8acSMatt Jacob 1638e62a8acSMatt Jacob /* 1648e62a8acSMatt Jacob * Various Reset Goodies 1658e62a8acSMatt Jacob */ 1668e62a8acSMatt Jacob struct isp_fc_tsk_mgmt { 1672df76c16SMatt Jacob uint32_t loopid; /* 0..255/2048 */ 1682df76c16SMatt Jacob uint16_t lun; 1692df76c16SMatt Jacob uint16_t chan; 1708e62a8acSMatt Jacob enum { 171f0f536d1SMatt Jacob IPT_CLEAR_ACA, 172f0f536d1SMatt Jacob IPT_TARGET_RESET, 173f0f536d1SMatt Jacob IPT_LUN_RESET, 174f0f536d1SMatt Jacob IPT_CLEAR_TASK_SET, 175f0f536d1SMatt Jacob IPT_ABORT_TASK_SET 1768e62a8acSMatt Jacob } action; 1778e62a8acSMatt Jacob }; 1782df76c16SMatt Jacob /* don't use 97 any more */ 1792df76c16SMatt Jacob #define ISP_TSK_MGMT _IOWR(ISP_IOC, 98, struct isp_fc_tsk_mgmt) 1802df76c16SMatt Jacob 1812df76c16SMatt Jacob /* 1822df76c16SMatt Jacob * Just gimme a list of WWPNs that are logged into us. 1832df76c16SMatt Jacob */ 1842df76c16SMatt Jacob typedef struct { 1852df76c16SMatt Jacob uint16_t count; 1862df76c16SMatt Jacob uint16_t channel; 1872df76c16SMatt Jacob struct wwnpair { 1882df76c16SMatt Jacob uint64_t wwnn; 1892df76c16SMatt Jacob uint64_t wwpn; 1902df76c16SMatt Jacob } wwns[1]; 1912df76c16SMatt Jacob } isp_dlist_t; 1922df76c16SMatt Jacob #define ISP_FC_GETDLIST _IO(ISP_IOC, 14) 193