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