Deleted Added
sdiff udiff text old ( 140652 ) new ( 154704 )
full compact
1/* $FreeBSD: head/sys/dev/isp/isp_target.h 140652 2005-01-23 06:28:49Z mjacob $ */
2/*-
3 * Qlogic Target Mode Structure and Flag Definitions
4 *
5 * Copyright (c) 1997, 1998
6 * Patrick Stirling
7 * pms@psconsult.com
8 * All rights reserved.
9 *
10 * Additional Copyright (c) 1999, 2000, 2001
11 * Matthew Jacob
12 * mjacob@feral.com
13 * All rights reserved.
14 *
15 *
16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted provided that the following conditions
18 * are met:
19 * 1. Redistributions of source code must retain the above copyright
20 * notice immediately at the beginning of the file, without modification,
21 * this list of conditions, and the following disclaimer.
22 * 2. The name of the author may not be used to endorse or promote products
23 * derived from this software without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
29 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
35 */
36#ifndef _ISP_TARGET_H
37#define _ISP_TARGET_H
38

--- 76 unchanged lines hidden (view full) ---

115 u_int8_t in_iid; /* initiator */
116 u_int16_t in_scclun;
117 u_int32_t in_reserved2;
118 u_int16_t in_status;
119 u_int16_t in_task_flags;
120 u_int16_t in_seqid; /* sequence id */
121} in_fcentry_t;
122
123/*
124 * Values for the in_status field
125 */
126#define IN_REJECT 0x0D /* Message Reject message received */
127#define IN_RESET 0x0E /* Bus Reset occurred */
128#define IN_NO_RCAP 0x16 /* requested capability not available */
129#define IN_IDE_RECEIVED 0x33 /* Initiator Detected Error msg received */
130#define IN_RSRC_UNAVAIL 0x34 /* resource unavailable */

--- 69 unchanged lines hidden (view full) ---

200 u_int16_t na_scclun;
201 u_int16_t na_flags;
202 u_int16_t na_reserved2;
203 u_int16_t na_status;
204 u_int16_t na_task_flags;
205 u_int16_t na_seqid; /* sequence id */
206 u_int16_t na_reserved3[NA2_RSVDLEN];
207} na_fcentry_t;
208#define NAFC_RCOUNT 0x80 /* increment resource count */
209#define NAFC_RST_CLRD 0x20 /* Clear LIP Reset */
210/*
211 * Accept Target I/O Entry structure
212 */
213#define ATIO_CDBLEN 26
214
215typedef struct {

--- 33 unchanged lines hidden (view full) ---

249 */
250
251#define AT_MAKE_TAGID(tid, inst, aep) \
252 tid = aep->at_handle; \
253 if (aep->at_flags & AT_TQAE) { \
254 tid |= (aep->at_tag_val << 16); \
255 tid |= (1 << 24); \
256 } \
257 tid |= (inst << 25)
258
259#define CT_MAKE_TAGID(tid, inst, ct) \
260 tid = ct->ct_fwhandle; \
261 if (ct->ct_flags & CT_TQAE) { \
262 tid |= (ct->ct_tag_val << 16); \
263 tid |= (1 << 24); \
264 } \
265 tid |= (inst << 25)
266
267#define AT_HAS_TAG(val) ((val) & (1 << 24))
268#define AT_GET_TAG(val) (((val) >> 16) & 0xff)
269#define AT_GET_INST(val) (((val) >> 25) & 0x7f)
270#define AT_GET_HANDLE(val) ((val) & 0xffff)
271
272#define IN_MAKE_TAGID(tid, inst, inp) \
273 tid = inp->in_seqid; \
274 tid |= (inp->in_tag_val << 16); \
275 tid |= (1 << 24); \
276 tid |= (inst << 25)
277
278#define TAG_INSERT_INST(tid, inst) \
279 tid &= ~(0x1ffffff); \
280 tid |= (inst << 25)
281
282/*
283 * Accept Target I/O Entry structure, Type 2
284 */
285#define ATIO2_CDBLEN 16
286
287typedef struct {
288 isphdr_t at_header;
289 u_int32_t at_reserved;

--- 9 unchanged lines hidden (view full) ---

299 u_int8_t at_cdb[ATIO2_CDBLEN]; /* received CDB */
300 u_int32_t at_datalen; /* allocated data len */
301 u_int16_t at_scclun; /* SCC Lun or reserved */
302 u_int16_t at_wwpn[4]; /* WWPN of initiator */
303 u_int16_t at_reserved2[6];
304 u_int16_t at_oxid;
305} at2_entry_t;
306
307#define ATIO2_WWPN_OFFSET 0x2A
308#define ATIO2_OXID_OFFSET 0x3E
309
310#define ATIO2_TC_ATTR_MASK 0x7
311#define ATIO2_TC_ATTR_SIMPLEQ 0
312#define ATIO2_TC_ATTR_HEADOFQ 1
313#define ATIO2_TC_ATTR_ORDERED 2
314#define ATIO2_TC_ATTR_ACAQ 4

--- 12 unchanged lines hidden (view full) ---

327 tid = ct->ct_rxid; \
328 tid |= (inst << 16)
329
330#define AT2_HAS_TAG(val) 1
331#define AT2_GET_TAG(val) ((val) & 0xffff)
332#define AT2_GET_INST(val) ((val) >> 16)
333#define AT2_GET_HANDLE AT2_GET_TAG
334
335#define IN_FC_MAKE_TAGID(tid, inst, inp) \
336 tid = inp->in_seqid; \
337 tid |= (inst << 16)
338
339#define FC_TAG_INSERT_INST(tid, inst) \
340 tid &= ~0xffff; \
341 tid |= (inst << 16)
342

--- 33 unchanged lines hidden (view full) ---

376#define ct_dataseg _u.ct_a
377} ct_entry_t;
378
379/*
380 * For some of the dual port SCSI adapters, port (bus #) is reported
381 * in the MSbit of ct_iid. Bit fields are a bit too awkward here.
382 *
383 * Note that this does not apply to FC adapters at all which can and
384 * do report IIDs between 129 && 255 (these represent devices that have
385 * logged in across a SCSI fabric).
386 */
387#define GET_IID_VAL(x) (x & 0x3f)
388#define GET_BUS_VAL(x) ((x >> 7) & 0x1)
389#define SET_IID_VAL(y, x) y = ((y & ~0x3f) | (x & 0x3f))
390#define SET_BUS_VAL(y, x) y = ((y & 0x3f) | ((x & 0x1) << 7))
391
392/*
393 * ct_flags values

--- 31 unchanged lines hidden (view full) ---

425#define CT_BDR_MSG 0x17 /* Bus Device Reset msg received */
426#define CT_DATA_UNDER 0x15 /* (FC only) Data Underrun */
427#define CT_TERMINATED 0x19 /* due to Terminate Transfer mbox cmd */
428#define CT_PORTNOTAVAIL 0x28 /* port not available */
429#define CT_LOGOUT 0x29 /* port logout */
430#define CT_PORTCHANGED 0x2A /* port changed */
431#define CT_IDE 0x33 /* Initiator Detected Error */
432#define CT_NOACK 0x35 /* Outstanding Immed. Notify. entry */
433
434/*
435 * When the firmware returns a CTIO entry, it may overwrite the last
436 * part of the structure with sense data. This starts at offset 0x2E
437 * into the entry, which is in the middle of ct_dataseg[1]. Rather
438 * than define a new struct for this, I'm just using the sense data
439 * offset.
440 */

--- 63 unchanged lines hidden (view full) ---

504 u_int16_t _reserved2;
505 u_int16_t _reserved3;
506 u_int32_t ct_datalen;
507 ispds_t ct_fcp_rsp_iudata;
508 } m2;
509 } rsp;
510} ct2_entry_t;
511
512/*
513 * ct_flags values for CTIO2
514 */
515#define CT2_FLAG_MMASK 0x0003
516#define CT2_FLAG_MODE0 0x0000
517#define CT2_FLAG_MODE1 0x0001
518#define CT2_FLAG_MODE2 0x0002
519#define CT2_DATA_IN CT_DATA_IN

--- 32 unchanged lines hidden (view full) ---

552 */
553
554/*
555 * This function handles new response queue entry appropriate for target mode.
556 */
557int isp_target_notify(struct ispsoftc *, void *, u_int16_t *);
558
559/*
560 * Enable/Disable/Modify a logical unit.
561 * (softc, cmd, bus, tgt, lun, cmd_cnt, inotify_cnt, opaque)
562 */
563#define DFLT_CMND_CNT 0xfe /* unmonitored */
564#define DFLT_INOT_CNT 16
565int isp_lun_cmd(struct ispsoftc *, int, int, int, int, int, int, u_int32_t);
566
567/*

--- 16 unchanged lines hidden (view full) ---

584int isp_endcmd(struct ispsoftc *, void *, u_int32_t, u_int16_t);
585#define ECMD_SVALID 0x100
586
587/*
588 * Handle an asynchronous event
589 *
590 * Return nonzero if the interrupt that generated this event has been dismissed.
591 */
592
593int isp_target_async(struct ispsoftc *, int, int);
594#endif /* _ISP_TARGET_H */