isp_tpublic.h revision 1.4.2.2 1 1.4.2.2 bouyer /* $NetBSD: isp_tpublic.h,v 1.4.2.2 2000/11/20 11:40:40 bouyer Exp $ */
2 1.4.2.2 bouyer /*
3 1.4.2.2 bouyer * This driver, which is contained in NetBSD in the files:
4 1.4.2.2 bouyer *
5 1.4.2.2 bouyer * sys/dev/ic/isp.c
6 1.4.2.2 bouyer * sys/dev/ic/ic/isp.c
7 1.4.2.2 bouyer * sys/dev/ic/ic/isp_inline.h
8 1.4.2.2 bouyer * sys/dev/ic/ic/isp_netbsd.c
9 1.4.2.2 bouyer * sys/dev/ic/ic/isp_netbsd.h
10 1.4.2.2 bouyer * sys/dev/ic/ic/isp_target.c
11 1.4.2.2 bouyer * sys/dev/ic/ic/isp_target.h
12 1.4.2.2 bouyer * sys/dev/ic/ic/isp_tpublic.h
13 1.4.2.2 bouyer * sys/dev/ic/ic/ispmbox.h
14 1.4.2.2 bouyer * sys/dev/ic/ic/ispreg.h
15 1.4.2.2 bouyer * sys/dev/ic/ic/ispvar.h
16 1.4.2.2 bouyer * sys/microcode/isp/asm_sbus.h
17 1.4.2.2 bouyer * sys/microcode/isp/asm_1040.h
18 1.4.2.2 bouyer * sys/microcode/isp/asm_1080.h
19 1.4.2.2 bouyer * sys/microcode/isp/asm_12160.h
20 1.4.2.2 bouyer * sys/microcode/isp/asm_2100.h
21 1.4.2.2 bouyer * sys/microcode/isp/asm_2200.h
22 1.4.2.2 bouyer * sys/pci/isp_pci.c
23 1.4.2.2 bouyer * sys/sbus/isp_sbus.c
24 1.4.2.2 bouyer *
25 1.4.2.2 bouyer * Is being actively maintained by Matthew Jacob (mjacob (at) netbsd.org).
26 1.4.2.2 bouyer * This driver also is shared source with FreeBSD, OpenBSD, Linux, Solaris,
27 1.4.2.2 bouyer * Linux versions. This tends to be an interesting maintenance problem.
28 1.4.2.2 bouyer *
29 1.4.2.2 bouyer * Please coordinate with Matthew Jacob on changes you wish to make here.
30 1.4.2.2 bouyer */
31 1.4.2.2 bouyer /*
32 1.4.2.2 bouyer * Qlogic ISP Host Adapter Public Target Interface Structures && Routines
33 1.4.2.2 bouyer *---------------------------------------
34 1.4.2.2 bouyer * Copyright (c) 2000 by Matthew Jacob
35 1.4.2.2 bouyer * All rights reserved.
36 1.4.2.2 bouyer *
37 1.4.2.2 bouyer * Redistribution and use in source and binary forms, with or without
38 1.4.2.2 bouyer * modification, are permitted provided that the following conditions
39 1.4.2.2 bouyer * are met:
40 1.4.2.2 bouyer * 1. Redistributions of source code must retain the above copyright
41 1.4.2.2 bouyer * notice, this list of conditions, and the following disclaimer,
42 1.4.2.2 bouyer * without modification, immediately at the beginning of the file.
43 1.4.2.2 bouyer * 2. The name of the author may not be used to endorse or promote products
44 1.4.2.2 bouyer * derived from this software without specific prior written permission.
45 1.4.2.2 bouyer *
46 1.4.2.2 bouyer * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
47 1.4.2.2 bouyer * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
48 1.4.2.2 bouyer * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
49 1.4.2.2 bouyer * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
50 1.4.2.2 bouyer * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
51 1.4.2.2 bouyer * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
52 1.4.2.2 bouyer * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
53 1.4.2.2 bouyer * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
54 1.4.2.2 bouyer * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
55 1.4.2.2 bouyer * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
56 1.4.2.2 bouyer * SUCH DAMAGE.
57 1.4.2.2 bouyer *
58 1.4.2.2 bouyer * Matthew Jacob
59 1.4.2.2 bouyer * Feral Software
60 1.4.2.2 bouyer * mjacob (at) feral.com
61 1.4.2.2 bouyer */
62 1.4.2.2 bouyer
63 1.4.2.2 bouyer /*
64 1.4.2.2 bouyer * Required software target mode message and event handling structures.
65 1.4.2.2 bouyer *
66 1.4.2.2 bouyer * The message and event structures are used by the MI layer
67 1.4.2.2 bouyer * to propagate messages and events upstream.
68 1.4.2.2 bouyer */
69 1.4.2.2 bouyer
70 1.4.2.2 bouyer #ifndef IN_MSGLEN
71 1.4.2.2 bouyer #define IN_MSGLEN 8
72 1.4.2.2 bouyer #endif
73 1.4.2.2 bouyer typedef struct {
74 1.4.2.2 bouyer void * nt_hba; /* HBA tag */
75 1.4.2.2 bouyer u_int64_t nt_iid; /* inititator id */
76 1.4.2.2 bouyer u_int64_t nt_tgt; /* target id */
77 1.4.2.2 bouyer u_int64_t nt_lun; /* logical unit */
78 1.4.2.2 bouyer u_int8_t nt_bus; /* bus */
79 1.4.2.2 bouyer u_int8_t nt_tagtype; /* tag type */
80 1.4.2.2 bouyer u_int16_t nt_tagval; /* tag value */
81 1.4.2.2 bouyer u_int8_t nt_msg[IN_MSGLEN]; /* message content */
82 1.4.2.2 bouyer } tmd_msg_t;
83 1.4.2.2 bouyer
84 1.4.2.2 bouyer typedef struct {
85 1.4.2.2 bouyer void * ev_hba; /* HBA tag */
86 1.4.2.2 bouyer u_int16_t ev_bus; /* bus */
87 1.4.2.2 bouyer u_int16_t ev_event; /* type of async event */
88 1.4.2.2 bouyer } tmd_event_t;
89 1.4.2.2 bouyer
90 1.4.2.2 bouyer /*
91 1.4.2.2 bouyer * Suggested Software Target Mode Command Handling structure.
92 1.4.2.2 bouyer *
93 1.4.2.2 bouyer * A note about terminology:
94 1.4.2.2 bouyer *
95 1.4.2.2 bouyer * MD stands for "Machine Dependent".
96 1.4.2.2 bouyer *
97 1.4.2.2 bouyer * This driver is structured in three layers: Outer MD, core, and inner MD.
98 1.4.2.2 bouyer * The latter also is bus dependent (i.e., is cognizant of PCI bus issues
99 1.4.2.2 bouyer * as well as platform issues).
100 1.4.2.2 bouyer *
101 1.4.2.2 bouyer *
102 1.4.2.2 bouyer * "Outer Layer" means "Other Module"
103 1.4.2.2 bouyer *
104 1.4.2.2 bouyer * Some additional module that actually implements SCSI target command
105 1.4.2.2 bouyer * policy is the recipient of incoming commands and the source of the
106 1.4.2.2 bouyer * disposition for them.
107 1.4.2.2 bouyer *
108 1.4.2.2 bouyer * The command structure below is one suggested possible MD command structure,
109 1.4.2.2 bouyer * but since the handling of thbis is entirely in the MD layer, there is
110 1.4.2.2 bouyer * no explicit or implicit requirement that it be used.
111 1.4.2.2 bouyer *
112 1.4.2.2 bouyer * The cd_private tag should be used by the MD layer to keep a free list
113 1.4.2.2 bouyer * of these structures. Code outside of this driver can then use this
114 1.4.2.2 bouyer * as an to identify it's own unit structures. That is, when not on the MD
115 1.4.2.2 bouyer * layer's freelist, the MD layer should shove into it the identifier
116 1.4.2.2 bouyer * that the outer layer has for it- passed in on an initial QIN_HBA_REG
117 1.4.2.2 bouyer * call (see below).
118 1.4.2.2 bouyer *
119 1.4.2.2 bouyer * The cd_hba tag is a tag that uniquely identifies the HBA this target
120 1.4.2.2 bouyer * mode command is coming from. The outer layer has to pass this back
121 1.4.2.2 bouyer * unchanged to avoid chaos.
122 1.4.2.2 bouyer *
123 1.4.2.2 bouyer * The cd_iid, cd_tgt, cd_lun and cd_bus tags are used to identify the
124 1.4.2.2 bouyer * id of the initiator who sent us a command, the target claim to be, the
125 1.4.2.2 bouyer * lun on the target we claim to be, and the bus instance (for multiple
126 1.4.2.2 bouyer * bus host adapters) that this applies to (consider it an extra Port
127 1.4.2.2 bouyer * parameter). The iid, tgt and lun values are deliberately chosen to be
128 1.4.2.2 bouyer * fat so that, for example, World Wide Names can be used instead of
129 1.4.2.2 bouyer * the units that the Qlogic firmware uses (in the case where the MD
130 1.4.2.2 bouyer * layer maintains a port database, for example).
131 1.4.2.2 bouyer *
132 1.4.2.2 bouyer * The cd_tagtype field specifies what kind of command tag has been
133 1.4.2.2 bouyer * sent with the command. The cd_tagval is the tag's value.
134 1.4.2.2 bouyer *
135 1.4.2.2 bouyer * N.B.: when the MD layer sends this command to outside software
136 1.4.2.2 bouyer * the outside software likely *MUST* return the same cd_tagval that
137 1.4.2.2 bouyer * was in place because this value is likely what the Qlogic f/w uses
138 1.4.2.2 bouyer * to identify a command.
139 1.4.2.2 bouyer *
140 1.4.2.2 bouyer * The cd_cdb contains storage for the passed in command descriptor block.
141 1.4.2.2 bouyer * This is the maximum size we can get out of the Qlogic f/w. There's no
142 1.4.2.2 bouyer * passed in length because whoever decodes the command to act upon it
143 1.4.2.2 bouyer * will know what the appropriate length is.
144 1.4.2.2 bouyer *
145 1.4.2.2 bouyer * The tag cd_lflags are the flags set by the MD driver when it gets
146 1.4.2.2 bouyer * command incoming or when it needs to inform any outside entities
147 1.4.2.2 bouyer * that the last requested action failed.
148 1.4.2.2 bouyer *
149 1.4.2.2 bouyer * The tag cd_hflags should be set by any outside software to indicate
150 1.4.2.2 bouyer * the validity of sense and status fields (defined below) and to indicate
151 1.4.2.2 bouyer * the direction data is expected to move. It is an error to have both
152 1.4.2.2 bouyer * CDFH_DATA_IN and CDFH_DATA_OUT set.
153 1.4.2.2 bouyer *
154 1.4.2.2 bouyer * If the CDFH_STSVALID flag is set, the command should be completed (after
155 1.4.2.2 bouyer * sending any data and/or status). If CDFH_SNSVALID is set and the MD layer
156 1.4.2.2 bouyer * can also handle sending the associated sense data (either back with an
157 1.4.2.2 bouyer * FCP RESPONSE IU for Fibre Channel or otherwise automatically handling a
158 1.4.2.2 bouyer * REQUEST SENSE from the initator for this target/lun), the MD layer will
159 1.4.2.2 bouyer * set the CDFL_SENTSENSE flag on successful transmission of the sense data.
160 1.4.2.2 bouyer * It is an error for the CDFH_SNSVALID bit to be set and CDFH_STSVALID not
161 1.4.2.2 bouyer * to be set. It is an error for the CDFH_SNSVALID be set and the associated
162 1.4.2.2 bouyer * SCSI status (cd_scsi_status) not be set to CHECK CONDITON.
163 1.4.2.2 bouyer *
164 1.4.2.2 bouyer * The tag cd_data points to a data segment to either be filled or
165 1.4.2.2 bouyer * read from depending on the direction of data movement. The tag
166 1.4.2.2 bouyer * is undefined if no data direction is set. The MD layer and outer
167 1.4.2.2 bouyer * layers must agree on the meaning of cd_data.
168 1.4.2.2 bouyer *
169 1.4.2.2 bouyer * The tag cd_totlen is the total data amount expected to be moved
170 1.4.2.2 bouyer * over the life of the command. It *may* be set by the MD layer, possibly
171 1.4.2.2 bouyer * from the datalen field of an FCP CMND IU unit. If it shows up in the outer
172 1.4.2.2 bouyer * layers set to zero and the CDB indicates data should be moved, the outer
173 1.4.2.2 bouyer * layer should set it to the amount expected to be moved.
174 1.4.2.2 bouyer *
175 1.4.2.2 bouyer * The tag cd_resid should be the total residual of data not transferred.
176 1.4.2.2 bouyer * The outer layers need to set this at the begining of command processing
177 1.4.2.2 bouyer * to equal cd_totlen. As data is successfully moved, this value is decreased.
178 1.4.2.2 bouyer * At the end of a command, any nonzero residual indicates the number of bytes
179 1.4.2.2 bouyer * requested but not moved. XXXXXXXXXXXXXXXXXXXXXXX TOO VAGUE!!!
180 1.4.2.2 bouyer *
181 1.4.2.2 bouyer * The tag cd_xfrlen is the length of the currently active data transfer.
182 1.4.2.2 bouyer * This allows several interations between any outside software and the
183 1.4.2.2 bouyer * MD layer to move data.
184 1.4.2.2 bouyer *
185 1.4.2.2 bouyer * The reason that total length and total residual have to be tracked
186 1.4.2.2 bouyer * is that fibre channel FCP DATA IU units have to have a relative
187 1.4.2.2 bouyer * offset field.
188 1.4.2.2 bouyer *
189 1.4.2.2 bouyer * N.B.: there is no necessary 1-to-1 correspondence between any one
190 1.4.2.2 bouyer * data transfer segment and the number of CTIOs that will be generated
191 1.4.2.2 bouyer * satisfy the current data transfer segment. It's not also possible to
192 1.4.2.2 bouyer * predict how big a transfer can be before it will be 'too big'. Be
193 1.4.2.2 bouyer * reasonable- a 64KB transfer is 'reasonable'. A 1MB transfer may not
194 1.4.2.2 bouyer * be. A 32MB transfer is unreasonable. The problem here has to do with
195 1.4.2.2 bouyer * how CTIOs can be used to map passed data pointers. In systems which
196 1.4.2.2 bouyer * have page based scatter-gather requirements, each PAGESIZEd chunk will
197 1.4.2.2 bouyer * consume one data segment descriptor- you get 3 or 4 of them per CTIO.
198 1.4.2.2 bouyer * The size of the REQUEST QUEUE you drop a CTIO onto is finite (typically
199 1.4.2.2 bouyer * it's 256, but on some systems it's even smaller, and note you have to
200 1.4.2.2 bouyer * sure this queue with the initiator side of this driver).
201 1.4.2.2 bouyer *
202 1.4.2.2 bouyer * The tags cd_sense and cd_scsi_status are pretty obvious.
203 1.4.2.2 bouyer *
204 1.4.2.2 bouyer * The tag cd_error is to communicate between the MD layer and outer software
205 1.4.2.2 bouyer * the current error conditions.
206 1.4.2.2 bouyer *
207 1.4.2.2 bouyer * The tag cd_reserved pads out the structure to 128 bytes.
208 1.4.2.2 bouyer */
209 1.4.2.2 bouyer
210 1.4.2.2 bouyer #ifndef _LP64
211 1.4.2.2 bouyer #if defined(__alpha__) || defined(__sparcv9cpu) || defined(__sparc_v9__)
212 1.4.2.2 bouyer #define _LP64
213 1.4.2.2 bouyer #endif
214 1.4.2.2 bouyer #endif
215 1.4.2.2 bouyer
216 1.4.2.2 bouyer #ifndef _TMD_PAD_LEN
217 1.4.2.2 bouyer #ifdef _LP64
218 1.4.2.2 bouyer #define _TMD_PAD_LEN 12
219 1.4.2.2 bouyer #else
220 1.4.2.2 bouyer #define _TMD_PAD_LEN 24
221 1.4.2.2 bouyer #endif
222 1.4.2.2 bouyer #endif
223 1.4.2.2 bouyer #ifndef ATIO_CDBLEN
224 1.4.2.2 bouyer #define ATIO_CDBLEN 26
225 1.4.2.2 bouyer #endif
226 1.4.2.2 bouyer #ifndef QLTM_SENSELEN
227 1.4.2.2 bouyer #define QLTM_SENSELEN 18
228 1.4.2.2 bouyer #endif
229 1.4.2.2 bouyer typedef struct tmd_cmd {
230 1.4.2.2 bouyer void * cd_private; /* layer private data */
231 1.4.2.2 bouyer void * cd_hba; /* HBA tag */
232 1.4.2.2 bouyer void * cd_data; /* 'pointer' to data */
233 1.4.2.2 bouyer u_int64_t cd_iid; /* initiator ID */
234 1.4.2.2 bouyer u_int64_t cd_tgt; /* target id */
235 1.4.2.2 bouyer u_int64_t cd_lun; /* logical unit */
236 1.4.2.2 bouyer u_int8_t cd_bus; /* bus */
237 1.4.2.2 bouyer u_int8_t cd_tagtype; /* tag type */
238 1.4.2.2 bouyer u_int16_t cd_tagval; /* tag value */
239 1.4.2.2 bouyer u_int8_t cd_cdb[ATIO_CDBLEN]; /* Command */
240 1.4.2.2 bouyer u_int8_t cd_lflags; /* flags lower level sets */
241 1.4.2.2 bouyer u_int8_t cd_hflags; /* flags higher level sets */
242 1.4.2.2 bouyer u_int32_t cd_totlen; /* total data requirement */
243 1.4.2.2 bouyer u_int32_t cd_resid; /* total data residual */
244 1.4.2.2 bouyer u_int32_t cd_xfrlen; /* current data requirement */
245 1.4.2.2 bouyer int32_t cd_error; /* current error */
246 1.4.2.2 bouyer u_int8_t cd_sense[QLTM_SENSELEN];
247 1.4.2.2 bouyer u_int16_t cd_scsi_status; /* closing SCSI status */
248 1.4.2.2 bouyer u_int8_t cd_reserved[_TMD_PAD_LEN];
249 1.4.2.2 bouyer } tmd_cmd_t;
250 1.4.2.2 bouyer
251 1.4.2.2 bouyer #define CDFL_BUSY 0x01 /* this command is not on a free list */
252 1.4.2.2 bouyer #define CDFL_NODISC 0x02 /* disconnects disabled */
253 1.4.2.2 bouyer #define CDFL_SENTSENSE 0x04 /* last action sent sense data */
254 1.4.2.2 bouyer #define CDFL_SENTSTATUS 0x08 /* last action sent status */
255 1.4.2.2 bouyer #define CDFL_ERROR 0x10 /* last action ended in error */
256 1.4.2.2 bouyer #define CDFL_PRIVATE_0 0x80 /* private layer flags */
257 1.4.2.2 bouyer
258 1.4.2.2 bouyer #define CDFH_SNSVALID 0x01 /* sense data valid */
259 1.4.2.2 bouyer #define CDFH_STSVALID 0x02 /* status valid */
260 1.4.2.2 bouyer #define CDFH_NODATA 0x00 /* no data transfer expected */
261 1.4.2.2 bouyer #define CDFH_DATA_IN 0x04 /* target (us) -> initiator (them) */
262 1.4.2.2 bouyer #define CDFH_DATA_OUT 0x08 /* initiator (them) -> target (us) */
263 1.4.2.2 bouyer #define CDFH_DATA_MASK 0x0C /* mask to cover data direction */
264 1.4.2.2 bouyer #define CDFH_PRIVATE_0 0x80 /* private layer flags */
265 1.4.2.2 bouyer
266 1.4.2.2 bouyer /*
267 1.4.2.2 bouyer * Action codes set by the Qlogic MD target driver for
268 1.4.2.2 bouyer * the external layer to figure out what to do with.
269 1.4.2.2 bouyer */
270 1.4.2.2 bouyer typedef enum {
271 1.4.2.2 bouyer QOUT_HBA_REG=0, /* the argument is a pointer to a hba_register_t */
272 1.4.2.2 bouyer QOUT_TMD_START, /* the argument is a pointer to a tmd_cmd_t */
273 1.4.2.2 bouyer QOUT_TMD_DONE, /* the argument is a pointer to a tmd_cmd_t */
274 1.4.2.2 bouyer QOUT_TEVENT, /* the argument is a pointer to a tmd_event_t */
275 1.4.2.2 bouyer QOUT_TMSG, /* the argument is a pointer to a tmd_msg_t */
276 1.4.2.2 bouyer QOUT_HBA_UNREG /* the argument is a pointer to a hba_register_t */
277 1.4.2.2 bouyer } tact_e;
278 1.4.2.2 bouyer
279 1.4.2.2 bouyer /*
280 1.4.2.2 bouyer * Action codes set by the external layer for the
281 1.4.2.2 bouyer * MD Qlogic driver to figure out what to do with.
282 1.4.2.2 bouyer */
283 1.4.2.2 bouyer typedef enum {
284 1.4.2.2 bouyer QIN_HBA_REG=6, /* the argument is a pointer to a hba_register_t */
285 1.4.2.2 bouyer QIN_ENABLE, /* the argument is a pointer to a tmd_cmd_t */
286 1.4.2.2 bouyer QIN_DISABLE, /* the argument is a pointer to a tmd_cmd_t */
287 1.4.2.2 bouyer QIN_TMD_CONT, /* the argument is a pointer to a tmd_cmd_t */
288 1.4.2.2 bouyer QIN_TMD_FIN, /* the argument is a pointer to a done tmd_cmd_t */
289 1.4.2.2 bouyer QIN_HBA_UNREG /* the argument is a pointer to a hba_register_t */
290 1.4.2.2 bouyer } qact_e;
291 1.4.2.2 bouyer
292 1.4.2.2 bouyer /*
293 1.4.2.2 bouyer * A word about the START/CONT/DONE/FIN dance:
294 1.4.2.2 bouyer *
295 1.4.2.2 bouyer * When the HBA is enabled for receiving commands, one may show up
296 1.4.2.2 bouyer * without notice. When that happens, the Qlogic target mode driver
297 1.4.2.2 bouyer * gets a tmd_cmd_t, fills it with the info that just arrived, and
298 1.4.2.2 bouyer * calls the outer layer with a QIN_TMD_START code and pointer to
299 1.4.2.2 bouyer * the tmd_cmd_t.
300 1.4.2.2 bouyer *
301 1.4.2.2 bouyer * The outer layer decodes the command, fetches data, prepares stuff,
302 1.4.2.2 bouyer * whatever, and starts by passing back the pointer with a QIN_TMD_CONT
303 1.4.2.2 bouyer * code which causes the Qlogic target mode driver to generate CTIOs to
304 1.4.2.2 bouyer * satisfy whatever action needs to be taken. When those CTIOs complete,
305 1.4.2.2 bouyer * the Qlogic target driver sends the pointer to the cmd_tmd_t back with
306 1.4.2.2 bouyer * a QOUT_TMD_DONE code. This repeats for as long as necessary.
307 1.4.2.2 bouyer *
308 1.4.2.2 bouyer * The outer layer signals it wants to end the command by settings within
309 1.4.2.2 bouyer * the tmd_cmd_t itself. When the final QIN_TMD_CONT is reported completed,
310 1.4.2.2 bouyer * the outer layer frees the tmd_cmd_t by sending the pointer to it
311 1.4.2.2 bouyer * back with a QIN_TMD_FIN code.
312 1.4.2.2 bouyer *
313 1.4.2.2 bouyer * The graph looks like:
314 1.4.2.2 bouyer *
315 1.4.2.2 bouyer * QOUT_TMD_START -> [ QIN_TMD_CONT -> QOUT_TMD_DONE ] * -> QIN_TMD_FIN.
316 1.4.2.2 bouyer *
317 1.4.2.2 bouyer */
318 1.4.2.2 bouyer
319 1.4.2.2 bouyer /*
320 1.4.2.2 bouyer * A word about ENABLE/DISABLE: the argument is a pointer to an tmd_cmd_t
321 1.4.2.2 bouyer * with cd_hba, cd_bus, cd_tgt and cd_lun filled out. If an error occurs
322 1.4.2.2 bouyer * in either enabling or disabling the described lun, cd_lflags is set
323 1.4.2.2 bouyer * with CDFL_ERROR.
324 1.4.2.2 bouyer *
325 1.4.2.2 bouyer * Logical unit zero must be the first enabled and the last disabled.
326 1.4.2.2 bouyer */
327 1.4.2.2 bouyer
328 1.4.2.2 bouyer /*
329 1.4.2.2 bouyer * Target handler functions.
330 1.4.2.2 bouyer * The MD target handler function (the outer layer calls this)
331 1.4.2.2 bouyer * should be be prototyped like:
332 1.4.2.2 bouyer *
333 1.4.2.2 bouyer * void target_action(qact_e, void *arg)
334 1.4.2.2 bouyer *
335 1.4.2.2 bouyer * The outer layer target handler function (the MD layer calls this)
336 1.4.2.2 bouyer * should be be prototyped like:
337 1.4.2.2 bouyer *
338 1.4.2.2 bouyer * void system_action(tact_e, void *arg)
339 1.4.2.2 bouyer */
340 1.4.2.2 bouyer
341 1.4.2.2 bouyer /*
342 1.4.2.2 bouyer * This structure is used to register to other software modules the
343 1.4.2.2 bouyer * binding of an HBA identifier, driver name and instance and the
344 1.4.2.2 bouyer * lun width capapbilities of this target driver. It's up to each
345 1.4.2.2 bouyer * platform to figure out how it wants to do this, but a typical
346 1.4.2.2 bouyer * sequence would be for the MD layer to find some external module's
347 1.4.2.2 bouyer * entry point and start by sending a QOUT_HBA_REG with info filled
348 1.4.2.2 bouyer * in, and the external module to call back with a QIN_HBA_REG that
349 1.4.2.2 bouyer * passes back the corresponding information.
350 1.4.2.2 bouyer */
351 1.4.2.2 bouyer typedef struct {
352 1.4.2.2 bouyer void * r_identity;
353 1.4.2.2 bouyer char r_name[8];
354 1.4.2.2 bouyer int r_inst;
355 1.4.2.2 bouyer int r_lunwidth;
356 1.4.2.2 bouyer int r_buswidth;
357 1.4.2.2 bouyer void (*r_action) __P((int, void *));
358 1.4.2.2 bouyer } hba_register_t;
359