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