15d571944SMatt Jacob /* $FreeBSD$ */ 25d571944SMatt Jacob /* 35d571944SMatt Jacob * Copyright (c) 2001 by Matthew Jacob 45d571944SMatt Jacob * 55d571944SMatt Jacob * Redistribution and use in source and binary forms, with or without 65d571944SMatt Jacob * modification, are permitted provided that the following conditions 75d571944SMatt Jacob * are met: 85d571944SMatt Jacob * 95d571944SMatt Jacob * 1. Redistributions of source code must retain the above copyright 105d571944SMatt Jacob * notice, this list of conditions and the following disclaimer. 115d571944SMatt Jacob * 2. Redistributions in binary form must reproduce the above copyright 125d571944SMatt Jacob * notice, this list of conditions and the following disclaimer in the 135d571944SMatt Jacob * documentation and/or other materials provided with the distribution. 145d571944SMatt Jacob * 155d571944SMatt Jacob * Alternatively, this software may be distributed under the terms of the 165d571944SMatt Jacob * the GNU Public License ("GPL", Library, Version 2). 175d571944SMatt Jacob * 185d571944SMatt Jacob * 195d571944SMatt Jacob * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR 205d571944SMatt Jacob * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 215d571944SMatt Jacob * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 225d571944SMatt Jacob * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 235d571944SMatt Jacob * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 245d571944SMatt Jacob * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 255d571944SMatt Jacob * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 265d571944SMatt Jacob * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 275d571944SMatt Jacob * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 285d571944SMatt Jacob * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 295d571944SMatt Jacob * 305d571944SMatt Jacob * Matthew Jacob <mjacob@feral.com) 315d571944SMatt Jacob * 325d571944SMatt Jacob */ 335d571944SMatt Jacob /* 345d571944SMatt Jacob * ioctl definitions for Qlogic FC/SCSI HBA driver 355d571944SMatt Jacob */ 365d571944SMatt Jacob #define ISP_IOC (021) /* 'Ctrl-Q' */ 375d571944SMatt Jacob 385d571944SMatt Jacob /* 395d571944SMatt Jacob * This ioctl sets/retrieves the debugging level for this hba instance. 405d571944SMatt Jacob * Note that this is not a simple integer level- see ispvar.h for definitions. 415d571944SMatt Jacob * 425d571944SMatt Jacob * The arguments is a pointer to an integer with the new debugging level. 435d571944SMatt Jacob * The old value is written into this argument. 445d571944SMatt Jacob */ 455d571944SMatt Jacob 46f553351eSMatt Jacob #define ISP_SDBLEV _IOWR(ISP_IOC, 1, int) 475d571944SMatt Jacob 485d571944SMatt Jacob /* 495d571944SMatt Jacob * This ioctl resets the HBA. Use with caution. 505d571944SMatt Jacob */ 51f553351eSMatt Jacob #define ISP_RESETHBA _IO(ISP_IOC, 2) 525d571944SMatt Jacob 535d571944SMatt Jacob /* 545d571944SMatt Jacob * This ioctl performs a fibre chanel rescan. 555d571944SMatt Jacob */ 56f553351eSMatt Jacob #define ISP_RESCAN _IO(ISP_IOC, 3) 575d571944SMatt Jacob 585d571944SMatt Jacob /* 59f553351eSMatt Jacob * This ioctl performs a reset and then will set the adapter to the 60f553351eSMatt Jacob * role that was passed in (the old role will be returned). It almost 61f553351eSMatt Jacob * goes w/o saying: use with caution. 625d571944SMatt Jacob */ 63f553351eSMatt Jacob #define ISP_SETROLE _IOWR(ISP_IOC, 4, int) 64f553351eSMatt Jacob 65f553351eSMatt Jacob #define ISP_ROLE_NONE 0x0 66f553351eSMatt Jacob #define ISP_ROLE_INITIATOR 0x1 67f553351eSMatt Jacob #define ISP_ROLE_TARGET 0x2 68f553351eSMatt Jacob #define ISP_ROLE_BOTH (ISP_ROLE_TARGET|ISP_ROLE_INITIATOR) 69f553351eSMatt Jacob #ifndef ISP_DEFAULT_ROLES 70f553351eSMatt Jacob #define ISP_DEFAULT_ROLES ISP_ROLE_BOTH 71f553351eSMatt Jacob #endif 725d571944SMatt Jacob 735d571944SMatt Jacob /* 74f553351eSMatt Jacob * Get the current adapter role 755d571944SMatt Jacob */ 76f553351eSMatt Jacob #define ISP_GETROLE _IOR(ISP_IOC, 5), int 772903b272SMatt Jacob 782903b272SMatt Jacob /* 792903b272SMatt Jacob * Get/Clear Stats 802903b272SMatt Jacob */ 812903b272SMatt Jacob #define ISP_STATS_VERSION 0 822903b272SMatt Jacob typedef struct { 8375c1e828SMatt Jacob u_int8_t isp_stat_version; 8475c1e828SMatt Jacob u_int8_t isp_type; /* (ro) reflects chip type */ 8575c1e828SMatt Jacob u_int8_t isp_revision; /* (ro) reflects chip version */ 8675c1e828SMatt Jacob u_int8_t unused1; 8775c1e828SMatt Jacob u_int32_t unused2; 882903b272SMatt Jacob /* 892903b272SMatt Jacob * Statistics Counters 902903b272SMatt Jacob */ 912903b272SMatt Jacob #define ISP_NSTATS 16 922903b272SMatt Jacob #define ISP_INTCNT 0 932903b272SMatt Jacob #define ISP_INTBOGUS 1 942903b272SMatt Jacob #define ISP_INTMBOXC 2 952903b272SMatt Jacob #define ISP_INGOASYNC 3 962903b272SMatt Jacob #define ISP_RSLTCCMPLT 4 972903b272SMatt Jacob #define ISP_FPHCCMCPLT 5 982903b272SMatt Jacob #define ISP_RSCCHIWAT 6 992903b272SMatt Jacob #define ISP_FPCCHIWAT 7 10075c1e828SMatt Jacob u_int64_t isp_stats[ISP_NSTATS]; 1012903b272SMatt Jacob } isp_stats_t; 1022903b272SMatt Jacob 1032903b272SMatt Jacob #define ISP_GET_STATS _IOR(ISP_IOC, 6, isp_stats_t) 1042903b272SMatt Jacob #define ISP_CLR_STATS _IO(ISP_IOC, 7) 105b8941882SMatt Jacob 106b8941882SMatt Jacob /* 107f553351eSMatt Jacob * Initiate a LIP 108f553351eSMatt Jacob */ 109f553351eSMatt Jacob #define ISP_FC_LIP _IO(ISP_IOC, 8) 110f553351eSMatt Jacob 111f553351eSMatt Jacob /* 112f553351eSMatt Jacob * Return the Port Database structure for the named device, or ENODEV if none. 113f553351eSMatt Jacob * Caller fills in virtual loopid (0..255), aka 'target'. The driver returns 114f553351eSMatt Jacob * ENODEV (if nothing valid there) or the actual loopid (for local loop devices 115f553351eSMatt Jacob * only), 24 bit Port ID and Node and Port WWNs. 116f553351eSMatt Jacob */ 117f553351eSMatt Jacob struct isp_fc_device { 118f553351eSMatt Jacob u_int32_t loopid; /* 0..255 */ 119f553351eSMatt Jacob u_int32_t portid; /* 24 bit Port ID */ 120f553351eSMatt Jacob u_int64_t node_wwn; 121f553351eSMatt Jacob u_int64_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) 130