1 /* $FreeBSD: src/sys/dev/isp/isp_ioctl.h,v 1.1.2.4 2002/07/29 04:21:23 mjacob Exp $ */ 2 /* $DragonFly: src/sys/dev/disk/isp/isp_ioctl.h,v 1.2 2003/06/17 04:28:27 dillon Exp $ */ 3 /* 4 * Copyright (c) 2001 by Matthew Jacob 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * Alternatively, this software may be distributed under the terms of the 17 * the GNU Public License ("GPL", Library, Version 2). 18 * 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR 21 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 22 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 23 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 * 31 * Matthew Jacob <mjacob@feral.com) 32 * 33 */ 34 /* 35 * ioctl definitions for Qlogic FC/SCSI HBA driver 36 */ 37 #define ISP_IOC (021) /* 'Ctrl-Q' */ 38 39 /* 40 * This ioctl sets/retrieves the debugging level for this hba instance. 41 * Note that this is not a simple integer level- see ispvar.h for definitions. 42 * 43 * The arguments is a pointer to an integer with the new debugging level. 44 * The old value is written into this argument. 45 */ 46 47 #define ISP_SDBLEV _IOWR(ISP_IOC, 1, int) 48 49 /* 50 * This ioctl resets the HBA. Use with caution. 51 */ 52 #define ISP_RESETHBA _IO(ISP_IOC, 2) 53 54 /* 55 * This ioctl performs a fibre chanel rescan. 56 */ 57 #define ISP_RESCAN _IO(ISP_IOC, 3) 58 59 /* 60 * This ioctl performs a reset and then will set the adapter to the 61 * role that was passed in (the old role will be returned). It almost 62 * goes w/o saying: use with caution. 63 */ 64 #define ISP_SETROLE _IOWR(ISP_IOC, 4, int) 65 66 #define ISP_ROLE_NONE 0x0 67 #define ISP_ROLE_INITIATOR 0x1 68 #define ISP_ROLE_TARGET 0x2 69 #define ISP_ROLE_BOTH (ISP_ROLE_TARGET|ISP_ROLE_INITIATOR) 70 #ifndef ISP_DEFAULT_ROLES 71 #define ISP_DEFAULT_ROLES ISP_ROLE_BOTH 72 #endif 73 74 /* 75 * Get the current adapter role 76 */ 77 #define ISP_GETROLE _IOR(ISP_IOC, 5), int 78 79 /* 80 * Get/Clear Stats 81 */ 82 #define ISP_STATS_VERSION 0 83 typedef struct { 84 u_int8_t isp_stat_version; 85 u_int8_t isp_type; /* (ro) reflects chip type */ 86 u_int8_t isp_revision; /* (ro) reflects chip version */ 87 u_int8_t unused1; 88 u_int32_t unused2; 89 /* 90 * Statistics Counters 91 */ 92 #define ISP_NSTATS 16 93 #define ISP_INTCNT 0 94 #define ISP_INTBOGUS 1 95 #define ISP_INTMBOXC 2 96 #define ISP_INGOASYNC 3 97 #define ISP_RSLTCCMPLT 4 98 #define ISP_FPHCCMCPLT 5 99 #define ISP_RSCCHIWAT 6 100 #define ISP_FPCCHIWAT 7 101 u_int64_t isp_stats[ISP_NSTATS]; 102 } isp_stats_t; 103 104 #define ISP_GET_STATS _IOR(ISP_IOC, 6, isp_stats_t) 105 #define ISP_CLR_STATS _IO(ISP_IOC, 7) 106 107 /* 108 * Initiate a LIP 109 */ 110 #define ISP_FC_LIP _IO(ISP_IOC, 8) 111 112 /* 113 * Return the Port Database structure for the named device, or ENODEV if none. 114 * Caller fills in virtual loopid (0..255), aka 'target'. The driver returns 115 * ENODEV (if nothing valid there) or the actual loopid (for local loop devices 116 * only), 24 bit Port ID and Node and Port WWNs. 117 */ 118 struct isp_fc_device { 119 u_int32_t loopid; /* 0..255 */ 120 u_int32_t portid; /* 24 bit Port ID */ 121 u_int64_t node_wwn; 122 u_int64_t port_wwn; 123 }; 124 #define ISP_FC_GETDINFO _IOWR(ISP_IOC, 9, struct isp_fc_device) 125 126 /* 127 * Get F/W crash dump 128 */ 129 #define ISP_GET_FW_CRASH_DUMP _IO(ISP_IOC, 10) 130 #define ISP_FORCE_CRASH_DUMP _IO(ISP_IOC, 11) 131 132 /* 133 * Get information about this Host Adapter, including current connection 134 * topology and capabilities. 135 */ 136 struct isp_hba_device { 137 u_int32_t 138 : 8, 139 : 4, 140 fc_speed : 4, /* Gbps */ 141 : 2, 142 fc_class2 : 1, 143 fc_ip_supported : 1, 144 fc_scsi_supported : 1, 145 fc_topology : 3, 146 fc_loopid : 8; 147 u_int64_t nvram_node_wwn; 148 u_int64_t nvram_port_wwn; 149 u_int64_t active_node_wwn; 150 u_int64_t active_port_wwn; 151 }; 152 153 #define ISP_TOPO_UNKNOWN 0 /* connection topology unknown */ 154 #define ISP_TOPO_FCAL 1 /* private or PL_DA */ 155 #define ISP_TOPO_LPORT 2 /* public loop */ 156 #define ISP_TOPO_NPORT 3 /* N-port */ 157 #define ISP_TOPO_FPORT 4 /* F-port */ 158 159 #define ISP_FC_GETHINFO _IOR(ISP_IOC, 12, struct isp_hba_device) 160 /* 161 * Set some internal parameters. This doesn't take effect until 162 * the chip is reset. 163 * 164 * Each parameter is generalized to be a name string with an integer value. 165 * 166 * Known parameters are: 167 * 168 * Name Value Range 169 * 170 * "framelength" 512,1024,2048 171 * "exec_throttle" 16..255 172 * "fullduplex" 0,1 173 * "loopid" 0..125 174 */ 175 176 struct isp_fc_param { 177 char param_name[16]; /* null terminated */ 178 u_int32_t parameter; 179 }; 180 181 #define ISP_GET_FC_PARAM _IOWR(ISP_IOC, 98, struct isp_fc_param) 182 #define ISP_SET_FC_PARAM _IOWR(ISP_IOC, 99, struct isp_fc_param) 183