1 /* $FreeBSD$ */ 2 /*- 3 * SPDX-License-Identifier: BSD-2-Clause 4 * 5 * Copyright (c) 1997-2006 by Matthew Jacob 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice immediately at the beginning of the file, without modification, 13 * this list of conditions, and the following disclaimer. 14 * 2. The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 21 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30 /* 31 * ioctl definitions for Qlogic FC/SCSI HBA driver 32 */ 33 #define ISP_IOC (021) /* 'Ctrl-Q' */ 34 35 /* 36 * This ioctl sets/retrieves the debugging level for this hba instance. 37 * Note that this is not a simple integer level- see ispvar.h for definitions. 38 * 39 * The arguments is a pointer to an integer with the new debugging level. 40 * The old value is written into this argument. 41 */ 42 43 #define ISP_SDBLEV _IOWR(ISP_IOC, 1, int) 44 45 /* 46 * This ioctl resets the HBA. Use with caution. 47 */ 48 #define ISP_RESETHBA _IO(ISP_IOC, 2) 49 50 /* 51 * This ioctl performs a fibre channel rescan. 52 */ 53 #define ISP_RESCAN _IO(ISP_IOC, 3) 54 55 /* 56 * This ioctl performs a reset and then will set the adapter to the 57 * role that was passed in (the old role will be returned). It almost 58 * goes w/o saying: use with caution. 59 * 60 * Channel selector stored in bits 8..32 as input to driver. 61 */ 62 #define ISP_SETROLE _IOWR(ISP_IOC, 4, int) 63 64 #define ISP_ROLE_NONE 0x0 65 #define ISP_ROLE_TARGET 0x1 66 #define ISP_ROLE_INITIATOR 0x2 67 #define ISP_ROLE_BOTH (ISP_ROLE_TARGET|ISP_ROLE_INITIATOR) 68 69 /* 70 * Get the current adapter role 71 * Channel selector passed in first argument. 72 */ 73 #define ISP_GETROLE _IOR(ISP_IOC, 5, int) 74 75 /* 76 * Get/Clear Stats 77 */ 78 #define ISP_STATS_VERSION 0 79 typedef struct { 80 uint8_t isp_stat_version; 81 uint8_t isp_type; /* (ro) reflects chip type */ 82 uint8_t isp_revision; /* (ro) reflects chip version */ 83 uint8_t unused1; 84 uint32_t unused2; 85 /* 86 * Statistics Counters 87 */ 88 #define ISP_NSTATS 16 89 #define ISP_INTCNT 0 90 #define ISP_INTBOGUS 1 91 #define ISP_INTMBOXC 2 92 #define ISP_INGOASYNC 3 93 #define ISP_RSLTCCMPLT 4 94 #define ISP_FPHCCMCPLT 5 95 #define ISP_RSCCHIWAT 6 96 #define ISP_FPCCHIWAT 7 97 uint64_t isp_stats[ISP_NSTATS]; 98 } isp_stats_t; 99 100 #define ISP_GET_STATS _IOR(ISP_IOC, 6, isp_stats_t) 101 #define ISP_CLR_STATS _IO(ISP_IOC, 7) 102 103 /* 104 * Initiate a LIP 105 */ 106 #define ISP_FC_LIP _IO(ISP_IOC, 8) 107 108 /* 109 * Return the Port Database structure for the named device, or ENODEV if none. 110 * Caller fills in virtual loopid (0..255), aka 'target'. The driver returns 111 * ENODEV (if nothing valid there) or the actual loopid (for local loop devices 112 * only), 24 bit Port ID and Node and Port WWNs. 113 */ 114 struct isp_fc_device { 115 uint32_t loopid; /* 0..255,2047 */ 116 uint32_t 117 chan : 6, 118 role : 2, 119 portid : 24; /* 24 bit Port ID */ 120 uint64_t node_wwn; 121 uint64_t port_wwn; 122 }; 123 #define ISP_FC_GETDINFO _IOWR(ISP_IOC, 9, struct isp_fc_device) 124 125 /* 126 * Get F/W crash dump 127 */ 128 #define ISP_GET_FW_CRASH_DUMP _IO(ISP_IOC, 10) 129 #define ISP_FORCE_CRASH_DUMP _IO(ISP_IOC, 11) 130 131 /* 132 * Get information about this Host Adapter, including current connection 133 * topology and capabilities. 134 */ 135 struct isp_hba_device { 136 uint32_t 137 : 8, 138 fc_speed : 4, /* Gbps */ 139 : 1, 140 fc_topology : 3, 141 fc_channel : 8, 142 fc_loopid : 16; 143 uint8_t fc_fw_major; 144 uint8_t fc_fw_minor; 145 uint8_t fc_fw_micro; 146 uint8_t fc_nchannels; /* number of supported channels */ 147 uint16_t fc_nports; /* number of supported ports */ 148 uint64_t nvram_node_wwn; 149 uint64_t nvram_port_wwn; 150 uint64_t active_node_wwn; 151 uint64_t active_port_wwn; 152 }; 153 154 #define ISP_TOPO_UNKNOWN 0 /* connection topology unknown */ 155 #define ISP_TOPO_FCAL 1 /* private or PL_DA */ 156 #define ISP_TOPO_LPORT 2 /* public loop */ 157 #define ISP_TOPO_NPORT 3 /* N-port */ 158 #define ISP_TOPO_FPORT 4 /* F-port */ 159 160 /* don't use 12 any more */ 161 #define ISP_FC_GETHINFO _IOWR(ISP_IOC, 13, struct isp_hba_device) 162 163 /* 164 * Various Reset Goodies 165 */ 166 struct isp_fc_tsk_mgmt { 167 uint32_t loopid; /* 0..255/2048 */ 168 uint16_t lun; 169 uint16_t chan; 170 enum { 171 IPT_CLEAR_ACA, 172 IPT_TARGET_RESET, 173 IPT_LUN_RESET, 174 IPT_CLEAR_TASK_SET, 175 IPT_ABORT_TASK_SET 176 } action; 177 }; 178 /* don't use 97 any more */ 179 #define ISP_TSK_MGMT _IOWR(ISP_IOC, 98, struct isp_fc_tsk_mgmt) 180 181 /* 182 * Just gimme a list of WWPNs that are logged into us. 183 */ 184 typedef struct { 185 uint16_t count; 186 uint16_t channel; 187 struct wwnpair { 188 uint64_t wwnn; 189 uint64_t wwpn; 190 } wwns[1]; 191 } isp_dlist_t; 192 #define ISP_FC_GETDLIST _IO(ISP_IOC, 14) 193