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