This source file includes following definitions.
- lun_entry_t
- in_entry_t
- in_fcentry_t
- na_entry_t
- na_fcentry_t
- at_entry_t
- at2_entry_t
- ct_entry_t
- ct2_entry_t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38 #ifndef _ISP_TARGET_H
39 #define _ISP_TARGET_H
40
41
42
43
44 #define QLTM_SVALID 0x80
45 #define QLTM_SENSELEN 18
46
47
48
49
50 typedef struct {
51 isphdr_t le_header;
52 u_int32_t le_reserved;
53 u_int8_t le_lun;
54 u_int8_t le_rsvd;
55 u_int8_t le_ops;
56 u_int8_t le_tgt;
57 u_int32_t le_flags;
58 u_int8_t le_status;
59 u_int8_t le_reserved2;
60 u_int8_t le_cmd_count;
61 u_int8_t le_in_count;
62 u_int8_t le_cdb6len;
63 u_int8_t le_cdb7len;
64 u_int16_t le_timeout;
65 u_int16_t le_reserved3[20];
66 } lun_entry_t;
67
68
69
70
71 #define LUN_TQAE 0x00000002
72 #define LUN_DSSM 0x01000000
73 #define LUN_DISAD 0x02000000
74 #define LUN_DM 0x40000000
75
76
77
78
79 #define LUN_CCINCR 0x01
80 #define LUN_CCDECR 0x02
81 #define LUN_ININCR 0x40
82 #define LUN_INDECR 0x80
83
84
85
86
87 #define LUN_OK 0x01
88 #define LUN_ERR 0x04
89 #define LUN_INVAL 0x06
90 #define LUN_NOCAP 0x16
91 #define LUN_ENABLED 0x3E
92
93
94
95
96 #define IN_MSGLEN 8
97 #define IN_RSVDLEN 8
98 typedef struct {
99 isphdr_t in_header;
100 u_int32_t in_reserved;
101 u_int8_t in_lun;
102 u_int8_t in_iid;
103 u_int8_t in_reserved2;
104 u_int8_t in_tgt;
105 u_int32_t in_flags;
106 u_int8_t in_status;
107 u_int8_t in_rsvd2;
108 u_int8_t in_tag_val;
109 u_int8_t in_tag_type;
110 u_int16_t in_seqid;
111 u_int8_t in_msg[IN_MSGLEN];
112 u_int16_t in_reserved3[IN_RSVDLEN];
113 u_int8_t in_sense[QLTM_SENSELEN];
114 } in_entry_t;
115
116 typedef struct {
117 isphdr_t in_header;
118 u_int32_t in_reserved;
119 u_int8_t in_lun;
120 u_int8_t in_iid;
121 u_int16_t in_scclun;
122 u_int32_t in_reserved2;
123 u_int16_t in_status;
124 u_int16_t in_task_flags;
125 u_int16_t in_seqid;
126 } in_fcentry_t;
127
128
129
130
131 #define IN_REJECT 0x0D
132 #define IN_RESET 0x0E
133 #define IN_NO_RCAP 0x16
134 #define IN_IDE_RECEIVED 0x33
135 #define IN_RSRC_UNAVAIL 0x34
136 #define IN_MSG_RECEIVED 0x36
137 #define IN_ABORT_TASK 0x20
138 #define IN_PORT_LOGOUT 0x29
139 #define IN_PORT_CHANGED 0x2A
140 #define IN_GLOBAL_LOGO 0x2E
141 #define IN_NO_NEXUS 0x3B
142
143
144
145
146 #define TASK_FLAGS_ABORT_TASK (1<<9)
147 #define TASK_FLAGS_CLEAR_TASK_SET (1<<10)
148 #define TASK_FLAGS_TARGET_RESET (1<<13)
149 #define TASK_FLAGS_CLEAR_ACA (1<<14)
150 #define TASK_FLAGS_TERMINATE_TASK (1<<15)
151
152 #ifndef MSG_ABORT_TAG
153 #define MSG_ABORT_TAG 0x06
154 #endif
155 #ifndef MSG_CLEAR_QUEUE
156 #define MSG_CLEAR_QUEUE 0x0e
157 #endif
158 #ifndef MSG_BUS_DEV_RESET
159 #define MSG_BUS_DEV_RESET 0x0b
160 #endif
161 #ifndef MSG_REL_RECOVERY
162 #define MSG_REL_RECOVERY 0x10
163 #endif
164 #ifndef MSG_TERM_IO_PROC
165 #define MSG_TERM_IO_PROC 0x11
166 #endif
167
168
169
170
171
172 #define NA_RSVDLEN 22
173 typedef struct {
174 isphdr_t na_header;
175 u_int32_t na_reserved;
176 u_int8_t na_lun;
177 u_int8_t na_iid;
178 u_int8_t na_reserved2;
179 u_int8_t na_tgt;
180 u_int32_t na_flags;
181 u_int8_t na_status;
182 u_int8_t na_event;
183 u_int16_t na_seqid;
184 u_int16_t na_reserved3[NA_RSVDLEN];
185 } na_entry_t;
186
187
188
189
190 #define NA_RST_CLRD 0x80
191 #define NA_OK 0x01
192 #define NA_INVALID 0x06
193
194 #define NA2_RSVDLEN 21
195 typedef struct {
196 isphdr_t na_header;
197 u_int32_t na_reserved;
198 u_int8_t na_lun;
199 u_int8_t na_iid;
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;
206 u_int16_t na_reserved3[NA2_RSVDLEN];
207 } na_fcentry_t;
208 #define NAFC_RCOUNT 0x80
209 #define NAFC_RST_CLRD 0x20
210
211
212
213 #define ATIO_CDBLEN 26
214
215 typedef struct {
216 isphdr_t at_header;
217 u_int16_t at_reserved;
218 u_int16_t at_handle;
219 u_int8_t at_lun;
220 u_int8_t at_iid;
221 u_int8_t at_cdblen;
222 u_int8_t at_tgt;
223 u_int32_t at_flags;
224 u_int8_t at_status;
225 u_int8_t at_scsi_status;
226 u_int8_t at_tag_val;
227 u_int8_t at_tag_type;
228 u_int8_t at_cdb[ATIO_CDBLEN];
229 u_int8_t at_sense[QLTM_SENSELEN];
230 } at_entry_t;
231
232
233
234
235 #define AT_NODISC 0x00008000
236 #define AT_TQAE 0x00000002
237
238
239
240
241 #define AT_PATH_INVALID 0x07
242 #define AT_RESET 0x0E
243 #define AT_PHASE_ERROR 0x14
244 #define AT_NOCAP 0x16
245 #define AT_BDR_MSG 0x17
246 #define AT_CDB 0x3D
247
248
249
250
251
252 #define AT_MAKE_TAGID(tid, aep) \
253 tid = ((aep)->at_handle << 16); \
254 if ((aep)->at_flags & AT_TQAE) \
255 (tid) |= ((aep)->at_tag_val + 1)
256
257 #define CT_MAKE_TAGID(tid, ct) \
258 tid = ((ct)->ct_fwhandle << 16); \
259 if ((ct)->ct_flags & CT_TQAE) \
260 (tid) |= ((ct)->ct_tag_val + 1)
261
262 #define AT_HAS_TAG(val) ((val) & 0xffff)
263 #define AT_GET_TAG(val) AT_HAS_TAG(val) - 1
264 #define AT_GET_HANDLE(val) ((val) >> 16)
265
266
267
268
269 #define ATIO2_CDBLEN 16
270
271 typedef struct {
272 isphdr_t at_header;
273 u_int32_t at_reserved;
274 u_int8_t at_lun;
275 u_int8_t at_iid;
276 u_int16_t at_rxid;
277 u_int16_t at_flags;
278 u_int16_t at_status;
279 u_int8_t at_reserved1;
280 u_int8_t at_taskcodes;
281 u_int8_t at_taskflags;
282 u_int8_t at_execodes;
283 u_int8_t at_cdb[ATIO2_CDBLEN];
284 u_int32_t at_datalen;
285 u_int16_t at_scclun;
286 u_int16_t at_wwpn[4];
287 u_int16_t at_reserved2[6];
288 u_int16_t at_oxid;
289 } at2_entry_t;
290
291 #define ATIO2_WWPN_OFFSET 0x2A
292 #define ATIO2_OXID_OFFSET 0x3E
293
294 #define ATIO2_TC_ATTR_MASK 0x7
295 #define ATIO2_TC_ATTR_SIMPLEQ 0
296 #define ATIO2_TC_ATTR_HEADOFQ 1
297 #define ATIO2_TC_ATTR_ORDERED 2
298 #define ATIO2_TC_ATTR_ACAQ 4
299 #define ATIO2_TC_ATTR_UNTAGGED 5
300
301
302
303
304
305
306
307
308 typedef struct {
309 isphdr_t ct_header;
310 u_int16_t ct_reserved;
311 #define ct_syshandle ct_reserved
312 u_int16_t ct_fwhandle;
313 u_int8_t ct_lun;
314 u_int8_t ct_iid;
315 u_int8_t ct_reserved2;
316 u_int8_t ct_tgt;
317 u_int32_t ct_flags;
318 u_int8_t ct_status;
319 u_int8_t ct_scsi_status;
320 u_int8_t ct_tag_val;
321 u_int8_t ct_tag_type;
322 u_int32_t ct_xfrlen;
323 u_int32_t ct_resid;
324 u_int16_t ct_timeout;
325 u_int16_t ct_seg_count;
326
327
328
329
330 union {
331 ispds_t ct_a[ISP_RQDSEG];
332 } _u;
333 #define ct_dataseg _u.ct_a
334 } ct_entry_t;
335
336
337
338
339
340
341
342
343
344 #define GET_IID_VAL(x) (x & 0x3f)
345 #define GET_BUS_VAL(x) ((x >> 7) & 0x1)
346 #define SET_IID_VAL(y, x) y = ((y & ~0x3f) | (x & 0x3f))
347 #define SET_BUS_VAL(y, x) y = ((y & 0x3f) | ((x & 0x1) << 7))
348
349
350
351
352 #define CT_TQAE 0x00000002
353 #define CT_DATA_IN 0x00000040
354 #define CT_DATA_OUT 0x00000080
355 #define CT_NO_DATA 0x000000C0
356 #define CT_CCINCR 0x00000100
357 #define CT_DATAMASK 0x000000C0
358 #define CT_INISYNCWIDE 0x00004000
359 #define CT_NODISC 0x00008000
360 #define CT_DSDP 0x01000000
361 #define CT_SENDRDP 0x04000000
362 #define CT_SENDSTATUS 0x80000000
363
364
365
366
367
368 #define CT_OK 0x01
369 #define CT_ABORTED 0x02
370 #define CT_ERR 0x04
371 #define CT_INVAL 0x06
372 #define CT_NOPATH 0x07
373 #define CT_INVRXID 0x08
374 #define CT_DATA_OVER 0x09
375 #define CT_RSELTMO 0x0A
376 #define CT_TIMEOUT 0x0B
377 #define CT_RESET 0x0E
378 #define CT_PARITY 0x0F
379 #define CT_BUS_ERROR 0x10
380 #define CT_PANIC 0x13
381 #define CT_PHASE_ERROR 0x14
382 #define CT_BDR_MSG 0x17
383 #define CT_DATA_UNDER 0x15
384 #define CT_TERMINATED 0x19
385 #define CT_PORTNOTAVAIL 0x28
386 #define CT_LOGOUT 0x29
387 #define CT_PORTCHANGED 0x2A
388 #define CT_IDE 0x33
389 #define CT_NOACK 0x35
390
391
392
393
394
395
396
397
398 #define CTIO_SENSE_OFFSET 0x2E
399
400
401
402
403
404 #define UINT32_ENTRY_SIZE (sizeof(at_entry_t)/sizeof(u_int32_t))
405
406
407
408
409 #define MAXRESPLEN 26
410 typedef struct {
411 isphdr_t ct_header;
412 u_int16_t ct_reserved;
413 u_int16_t ct_fwhandle;
414 u_int8_t ct_lun;
415 u_int8_t ct_iid;
416 u_int16_t ct_rxid;
417 u_int16_t ct_flags;
418 u_int16_t ct_status;
419 u_int16_t ct_timeout;
420 u_int16_t ct_seg_count;
421 u_int32_t ct_reloff;
422 int32_t ct_resid;
423 union {
424
425
426
427
428
429
430
431
432
433
434
435
436
437 struct {
438 u_int32_t _reserved;
439 u_int16_t _reserved2;
440 u_int16_t ct_scsi_status;
441 u_int32_t ct_xfrlen;
442 union {
443 ispds_t ct_a[ISP_RQDSEG_T2];
444 ispds64_t ct_b[ISP_RQDSEG_T3];
445 ispdslist_t ct_c;
446 } _u;
447 #define ct_dataseg _u.ct_a
448 #define ct_dataseg64 _u.ct_b
449 #define ct_dslist _u.ct_c
450 } m0;
451 struct {
452 u_int16_t _reserved;
453 u_int16_t _reserved2;
454 u_int16_t ct_senselen;
455 u_int16_t ct_scsi_status;
456 u_int16_t ct_resplen;
457 u_int8_t ct_resp[MAXRESPLEN];
458 } m1;
459 struct {
460 u_int32_t _reserved;
461 u_int16_t _reserved2;
462 u_int16_t _reserved3;
463 u_int32_t ct_datalen;
464 ispds_t ct_fcp_rsp_iudata;
465 } m2;
466
467
468
469 struct {
470 u_int32_t _reserved[4];
471 u_int16_t ct_scsi_status;
472 u_int8_t ct_sense[QLTM_SENSELEN];
473 } fw;
474 } rsp;
475 } ct2_entry_t;
476
477
478
479
480 #define CT2_FLAG_MMASK 0x0003
481 #define CT2_FLAG_MODE0 0x0000
482 #define CT2_FLAG_MODE1 0x0001
483 #define CT2_FLAG_MODE2 0x0002
484 #define CT2_DATA_IN CT_DATA_IN
485 #define CT2_DATA_OUT CT_DATA_OUT
486 #define CT2_NO_DATA CT_NO_DATA
487 #define CT2_DATAMASK CT_DATAMASK
488 #define CT2_CCINCR 0x0100
489 #define CT2_FASTPOST 0x0200
490 #define CT2_SENDSTATUS 0x8000
491
492
493
494
495
496
497
498
499
500
501 #define CT2_RSPLEN_VALID 0x0100
502 #define CT2_SNSLEN_VALID 0x0200
503 #define CT2_DATA_OVER 0x0400
504 #define CT2_DATA_UNDER 0x0800
505
506
507
508
509
510 #define ISP_TDQE(isp, msg, idx, arg) \
511 if (isp->isp_dblev & ISP_LOGTDEBUG2) isp_print_qentry(isp, msg, idx, arg)
512
513 #ifdef ISP_TARGET_FUNCTIONS
514
515
516
517
518
519
520
521
522 int isp_target_notify(struct ispsoftc *, void *, u_int16_t *);
523
524
525
526
527
528 #define DFLT_CMND_CNT 0xfe
529 #define DFLT_INOT_CNT 16
530 int isp_lun_cmd(struct ispsoftc *, int, int, int, int, int, int, u_int32_t);
531
532
533
534
535 int isp_target_put_entry(struct ispsoftc *isp, void *);
536
537
538
539
540
541
542
543 int isp_target_put_atio(struct ispsoftc *, void *);
544
545
546
547
548
549 int isp_endcmd(struct ispsoftc *, void *, u_int32_t, u_int16_t);
550 #define ECMD_SVALID 0x100
551
552
553
554
555
556
557
558 int isp_target_async(struct ispsoftc *, int, int);
559 #endif
560 #endif