ispvar.h revision 1.32 1 /* $NetBSD: ispvar.h,v 1.32 2000/08/01 23:55:13 mjacob Exp $ */
2 /*
3 * Copyright (C) 1999 National Aeronautics & Space Administration
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29 /*
30 * Soft Definitions for for Qlogic ISP SCSI adapters.
31 * Matthew Jacob <mjacob (at) nas.nasa.gov>
32 */
33 #ifndef _ISPVAR_H
34 #define _ISPVAR_H
35
36 #if defined(__NetBSD__) || defined(__OpenBSD__)
37 #include <dev/ic/ispmbox.h>
38 #ifdef ISP_TARGET_MODE
39 #include <dev/ic/isp_target.h>
40 #include <dev/ic/isp_tpublic.h>
41 #endif
42 #endif
43 #ifdef __FreeBSD__
44 #include <dev/isp/ispmbox.h>
45 #ifdef ISP_TARGET_MODE
46 #include <dev/isp/isp_target.h>
47 #include <dev/isp/isp_tpublic.h>
48 #endif
49 #endif
50 #ifdef __linux__
51 #include "ispmbox.h"
52 #ifdef ISP_TARGET_MODE
53 #include "isp_target.h"
54 #include "isp_tpublic.h"
55 #endif
56 #endif
57
58 #define ISP_CORE_VERSION_MAJOR 2
59 #define ISP_CORE_VERSION_MINOR 0
60
61 /*
62 * Vector for bus specific code to provide specific services.
63 */
64 struct ispsoftc;
65 struct ispmdvec {
66 u_int16_t (*dv_rd_reg) __P((struct ispsoftc *, int));
67 void (*dv_wr_reg) __P((struct ispsoftc *, int, u_int16_t));
68 int (*dv_mbxdma) __P((struct ispsoftc *));
69 int (*dv_dmaset) __P((struct ispsoftc *,
70 XS_T *, ispreq_t *, u_int16_t *, u_int16_t));
71 void (*dv_dmaclr)
72 __P((struct ispsoftc *, XS_T *, u_int32_t));
73 void (*dv_reset0) __P((struct ispsoftc *));
74 void (*dv_reset1) __P((struct ispsoftc *));
75 void (*dv_dregs) __P((struct ispsoftc *, const char *));
76 const u_int16_t *dv_ispfw; /* ptr to f/w */
77 u_int16_t dv_conf1;
78 u_int16_t dv_clock; /* clock frequency */
79 };
80
81 /*
82 * Overall parameters
83 */
84 #define MAX_TARGETS 16
85 #ifdef ISP2100_FABRIC
86 #define MAX_FC_TARG 256
87 #else
88 #define MAX_FC_TARG 126
89 #endif
90
91 #define ISP_MAX_TARGETS(isp) (IS_FC(isp)? MAX_FC_TARG : MAX_TARGETS)
92 #define ISP_MAX_LUNS(isp) (isp)->isp_maxluns
93
94
95 /*
96 * Macros to access ISP registers through bus specific layers-
97 * mostly wrappers to vector through the mdvec structure.
98 */
99
100 #define ISP_READ(isp, reg) \
101 (*(isp)->isp_mdvec->dv_rd_reg)((isp), (reg))
102
103 #define ISP_WRITE(isp, reg, val) \
104 (*(isp)->isp_mdvec->dv_wr_reg)((isp), (reg), (val))
105
106 #define ISP_MBOXDMASETUP(isp) \
107 (*(isp)->isp_mdvec->dv_mbxdma)((isp))
108
109 #define ISP_DMASETUP(isp, xs, req, iptrp, optr) \
110 (*(isp)->isp_mdvec->dv_dmaset)((isp), (xs), (req), (iptrp), (optr))
111
112 #define ISP_DMAFREE(isp, xs, hndl) \
113 if ((isp)->isp_mdvec->dv_dmaclr) \
114 (*(isp)->isp_mdvec->dv_dmaclr)((isp), (xs), (hndl))
115
116 #define ISP_RESET0(isp) \
117 if ((isp)->isp_mdvec->dv_reset0) (*(isp)->isp_mdvec->dv_reset0)((isp))
118 #define ISP_RESET1(isp) \
119 if ((isp)->isp_mdvec->dv_reset1) (*(isp)->isp_mdvec->dv_reset1)((isp))
120 #define ISP_DUMPREGS(isp, m) \
121 if ((isp)->isp_mdvec->dv_dregs) (*(isp)->isp_mdvec->dv_dregs)((isp),(m))
122
123 #define ISP_SETBITS(isp, reg, val) \
124 (*(isp)->isp_mdvec->dv_wr_reg)((isp), (reg), ISP_READ((isp), (reg)) | (val))
125
126 #define ISP_CLRBITS(isp, reg, val) \
127 (*(isp)->isp_mdvec->dv_wr_reg)((isp), (reg), ISP_READ((isp), (reg)) & ~(val))
128
129 /*
130 * The MEMORYBARRIER macro is defined per platform (to provide synchronization
131 * on Request and Response Queues, Scratch DMA areas, and Registers)
132 *
133 * Defined Memory Barrier Synchronization Types
134 */
135 #define SYNC_REQUEST 0 /* request queue synchronization */
136 #define SYNC_RESULT 1 /* result queue synchronization */
137 #define SYNC_SFORDEV 2 /* scratch, sync for ISP */
138 #define SYNC_SFORCPU 3 /* scratch, sync for CPU */
139 #define SYNC_REG 4 /* for registers */
140
141 /*
142 * Request/Response Queue defines and macros.
143 * The maximum is defined per platform (and can be based on board type).
144 */
145 /* This is the size of a queue entry (request and response) */
146 #define QENTRY_LEN 64
147 /* Both request and result queue length must be a power of two */
148 #define RQUEST_QUEUE_LEN(x) MAXISPREQUEST(x)
149 #define RESULT_QUEUE_LEN(x) \
150 (((MAXISPREQUEST(x) >> 2) < 64)? 64 : MAXISPREQUEST(x) >> 2)
151 #define ISP_QUEUE_ENTRY(q, idx) ((q) + ((idx) * QENTRY_LEN))
152 #define ISP_QUEUE_SIZE(n) ((n) * QENTRY_LEN)
153 #define ISP_NXT_QENTRY(idx, qlen) (((idx) + 1) & ((qlen)-1))
154 #define ISP_QAVAIL(in, out, qlen) \
155 ((in == out)? (qlen - 1) : ((in > out)? \
156 ((qlen - 1) - (in - out)) : (out - in - 1)))
157
158 #define ISP_ADD_REQUEST(isp, iptr) \
159 MEMORYBARRIER(isp, SYNC_REQUEST, iptr, QENTRY_LEN); \
160 ISP_WRITE(isp, INMAILBOX4, iptr); \
161 isp->isp_reqidx = iptr
162
163 /*
164 * SCSI Specific Host Adapter Parameters- per bus, per target
165 */
166
167 typedef struct {
168 u_int isp_gotdparms : 1,
169 isp_req_ack_active_neg : 1,
170 isp_data_line_active_neg: 1,
171 isp_cmd_dma_burst_enable: 1,
172 isp_data_dma_burst_enabl: 1,
173 isp_fifo_threshold : 3,
174 isp_ultramode : 1,
175 isp_diffmode : 1,
176 isp_lvdmode : 1,
177 : 1,
178 isp_initiator_id : 4,
179 isp_async_data_setup : 4;
180 u_int16_t isp_selection_timeout;
181 u_int16_t isp_max_queue_depth;
182 u_int8_t isp_tag_aging;
183 u_int8_t isp_bus_reset_delay;
184 u_int8_t isp_retry_count;
185 u_int8_t isp_retry_delay;
186 struct {
187 u_int dev_enable : 1, /* ignored */
188 : 1,
189 dev_update : 1,
190 dev_refresh : 1,
191 exc_throttle : 8,
192 cur_offset : 4,
193 sync_offset : 4;
194 u_int8_t cur_period; /* current sync period */
195 u_int8_t sync_period; /* goal sync period */
196 u_int16_t dev_flags; /* goal device flags */
197 u_int16_t cur_dflags; /* current device flags */
198 } isp_devparam[MAX_TARGETS];
199 } sdparam;
200
201 /*
202 * Device Flags
203 */
204 #define DPARM_DISC 0x8000
205 #define DPARM_PARITY 0x4000
206 #define DPARM_WIDE 0x2000
207 #define DPARM_SYNC 0x1000
208 #define DPARM_TQING 0x0800
209 #define DPARM_ARQ 0x0400
210 #define DPARM_QFRZ 0x0200
211 #define DPARM_RENEG 0x0100
212 #define DPARM_NARROW 0x0080 /* Possibly only available with >= 7.55 fw */
213 #define DPARM_ASYNC 0x0040 /* Possibly only available with >= 7.55 fw */
214 #define DPARM_DEFAULT (0xFF00 & ~DPARM_QFRZ)
215 #define DPARM_SAFE_DFLT (DPARM_DEFAULT & ~(DPARM_WIDE|DPARM_SYNC|DPARM_TQING))
216
217
218 /* technically, not really correct, as they need to be rated based upon clock */
219 #define ISP_40M_SYNCPARMS 0x080a
220 #define ISP_20M_SYNCPARMS 0x080c
221 #define ISP_10M_SYNCPARMS 0x0c19
222 #define ISP_08M_SYNCPARMS 0x0c25
223 #define ISP_05M_SYNCPARMS 0x0c32
224 #define ISP_04M_SYNCPARMS 0x0c41
225
226 /*
227 * Fibre Channel Specifics
228 */
229 #define FL_PORT_ID 0x7e /* FL_Port Special ID */
230 #define FC_PORT_ID 0x7f /* Fabric Controller Special ID */
231 #define FC_SNS_ID 0x80 /* SNS Server Special ID */
232
233 typedef struct {
234 u_int32_t isp_fwoptions : 16,
235 : 4,
236 loop_seen_once : 1,
237 isp_loopstate : 3, /* Current Loop State */
238 isp_fwstate : 3, /* ISP F/W state */
239 isp_gotdparms : 1,
240 isp_topo : 3,
241 isp_onfabric : 1;
242 u_int8_t isp_loopid; /* hard loop id */
243 u_int8_t isp_alpa; /* ALPA */
244 volatile u_int16_t isp_lipseq; /* LIP sequence # */
245 u_int32_t isp_portid;
246 u_int8_t isp_execthrottle;
247 u_int8_t isp_retry_delay;
248 u_int8_t isp_retry_count;
249 u_int8_t isp_reserved;
250 u_int16_t isp_maxalloc;
251 u_int16_t isp_maxfrmlen;
252 u_int64_t isp_nodewwn;
253 u_int64_t isp_portwwn;
254 /*
255 * Port Data Base. This is indexed by 'target', which is invariate.
256 * However, elements within can move around due to loop changes,
257 * so the actual loop ID passed to the F/W is in this structure.
258 * The first time the loop is seen up, loopid will match the index
259 * (except for fabric nodes which are above mapped above FC_SNS_ID
260 * and are completely virtual), but subsequent LIPs can cause things
261 * to move around.
262 */
263 struct lportdb {
264 u_int
265 loopid : 8,
266 : 4,
267 loggedin : 1,
268 roles : 2,
269 valid : 1;
270 u_int32_t portid;
271 u_int64_t node_wwn;
272 u_int64_t port_wwn;
273 } portdb[MAX_FC_TARG], tport[FL_PORT_ID];
274
275 /*
276 * Scratch DMA mapped in area to fetch Port Database stuff, etc.
277 */
278 caddr_t isp_scratch;
279 u_int32_t isp_scdma;
280 } fcparam;
281
282 #define FW_CONFIG_WAIT 0
283 #define FW_WAIT_AL_PA 1
284 #define FW_WAIT_LOGIN 2
285 #define FW_READY 3
286 #define FW_LOSS_OF_SYNC 4
287 #define FW_ERROR 5
288 #define FW_REINIT 6
289 #define FW_NON_PART 7
290
291 #define LOOP_NIL 0
292 #define LOOP_LIP_RCVD 1
293 #define LOOP_PDB_RCVD 2
294 #define LOOP_READY 7
295
296 #define TOPO_NL_PORT 0
297 #define TOPO_FL_PORT 1
298 #define TOPO_N_PORT 2
299 #define TOPO_F_PORT 3
300 #define TOPO_PTP_STUB 4
301
302 /*
303 * Soft Structure per host adapter
304 */
305 struct ispsoftc {
306 /*
307 * Platform (OS) specific data
308 */
309 struct isposinfo isp_osinfo;
310
311 /*
312 * Pointer to bus specific functions and data
313 */
314 struct ispmdvec * isp_mdvec;
315
316 /*
317 * (Mostly) nonvolatile state. Board specific parameters
318 * may contain some volatile state (e.g., current loop state).
319 */
320
321 void * isp_param; /* type specific */
322 u_int16_t isp_fwrev[3]; /* Loaded F/W revision */
323 u_int16_t isp_romfw_rev[3]; /* PROM F/W revision */
324 u_int16_t isp_maxcmds; /* max possible I/O cmds */
325 u_int8_t isp_type; /* HBA Chip Type */
326 u_int8_t isp_revision; /* HBA Chip H/W Revision */
327 u_int32_t isp_maxluns; /* maximum luns supported */
328
329 u_int32_t
330 isp_touched : 1, /* board ever seen? */
331 isp_fast_mttr : 1, /* fast sram */
332 isp_bustype : 1, /* SBus or PCI */
333 : 1,
334 isp_dblev : 12, /* debug log mask */
335 isp_clock : 8, /* input clock */
336 isp_confopts : 8; /* config options */
337
338 /*
339 * Volatile state
340 */
341
342 volatile u_int32_t
343 isp_mboxbsy : 8, /* mailbox command active */
344 : 1,
345 isp_state : 3,
346 isp_sendmarker : 2, /* send a marker entry */
347 isp_update : 2, /* update parameters */
348 isp_nactive : 16; /* how many commands active */
349 volatile u_int16_t isp_reqodx; /* index of last ISP pickup */
350 volatile u_int16_t isp_reqidx; /* index of next request */
351 volatile u_int16_t isp_residx; /* index of next result */
352 volatile u_int16_t isp_lasthdls; /* last handle seed */
353 volatile u_int16_t isp_mboxtmp[MAX_MAILBOX];
354
355 /*
356 * Active commands are stored here, indexed by handle functions.
357 */
358 XS_T **isp_xflist;
359
360 /*
361 * request/result queue pointers and dma handles for them.
362 */
363 caddr_t isp_rquest;
364 caddr_t isp_result;
365 u_int32_t isp_rquest_dma;
366 u_int32_t isp_result_dma;
367 };
368
369 #define SDPARAM(isp) ((sdparam *) (isp)->isp_param)
370 #define FCPARAM(isp) ((fcparam *) (isp)->isp_param)
371
372 /*
373 * ISP Driver Run States
374 */
375 #define ISP_NILSTATE 0
376 #define ISP_RESETSTATE 1
377 #define ISP_INITSTATE 2
378 #define ISP_RUNSTATE 3
379
380 /*
381 * ISP Configuration Options
382 */
383 #define ISP_CFG_NORELOAD 0x80 /* don't download f/w */
384 #define ISP_CFG_NONVRAM 0x40 /* ignore NVRAM */
385 #define ISP_CFG_FULL_DUPLEX 0x01 /* Full Duplex (Fibre Channel only) */
386 #define ISP_CFG_OWNWWN 0x02 /* override NVRAM wwn */
387 #define ISP_CFG_NPORT 0x04 /* try to force N- instead of L-Port */
388
389 /*
390 * Firmware related defines
391 */
392 #define ISP_CODE_ORG 0x1000 /* default f/w code start */
393 #define ISP_FW_REV(maj, min, mic) ((maj << 24) | (min << 16) | mic)
394 #define ISP_FW_REVX(xp) ((xp[0]<<24) | (xp[1] << 16) | xp[2])
395
396 /*
397 * Bus (implementation) types
398 */
399 #define ISP_BT_PCI 0 /* PCI Implementations */
400 #define ISP_BT_SBUS 1 /* SBus Implementations */
401
402 /*
403 * Chip Types
404 */
405 #define ISP_HA_SCSI 0xf
406 #define ISP_HA_SCSI_UNKNOWN 0x1
407 #define ISP_HA_SCSI_1020 0x2
408 #define ISP_HA_SCSI_1020A 0x3
409 #define ISP_HA_SCSI_1040 0x4
410 #define ISP_HA_SCSI_1040A 0x5
411 #define ISP_HA_SCSI_1040B 0x6
412 #define ISP_HA_SCSI_1040C 0x7
413 #define ISP_HA_SCSI_1240 0x8
414 #define ISP_HA_SCSI_1080 0x9
415 #define ISP_HA_SCSI_1280 0xa
416 #define ISP_HA_SCSI_12160 0xb
417 #define ISP_HA_FC 0xf0
418 #define ISP_HA_FC_2100 0x10
419 #define ISP_HA_FC_2200 0x20
420
421 #define IS_SCSI(isp) (isp->isp_type & ISP_HA_SCSI)
422 #define IS_1240(isp) (isp->isp_type == ISP_HA_SCSI_1240)
423 #define IS_1080(isp) (isp->isp_type == ISP_HA_SCSI_1080)
424 #define IS_1280(isp) (isp->isp_type == ISP_HA_SCSI_1280)
425 #define IS_12160(isp) (isp->isp_type == ISP_HA_SCSI_12160)
426
427 #define IS_12X0(isp) (IS_1240(isp) || IS_1280(isp))
428 #define IS_DUALBUS(isp) (IS_12X0(isp) || IS_12160(isp))
429 #define IS_ULTRA2(isp) (IS_1080(isp) || IS_1280(isp) || IS_12160(isp))
430 #define IS_ULTRA3(isp) (IS_12160(isp))
431
432 #define IS_FC(isp) (isp->isp_type & ISP_HA_FC)
433 #define IS_2100(isp) (isp->isp_type == ISP_HA_FC_2100)
434 #define IS_2200(isp) (isp->isp_type == ISP_HA_FC_2200)
435
436 /*
437 * DMA cookie macros
438 */
439 #define DMA_MSW(x) (((x) >> 16) & 0xffff)
440 #define DMA_LSW(x) (((x) & 0xffff))
441
442 /*
443 * Core System Function Prototypes
444 */
445
446 /*
447 * Reset Hardware. Totally. Assumes that you'll follow this with
448 * a call to isp_init.
449 */
450 void isp_reset __P((struct ispsoftc *));
451
452 /*
453 * Initialize Hardware to known state
454 */
455 void isp_init __P((struct ispsoftc *));
456
457 /*
458 * Reset the ISP and call completion for any orphaned commands.
459 */
460 void isp_reinit __P((struct ispsoftc *));
461
462 /*
463 * Interrupt Service Routine
464 */
465 int isp_intr __P((void *));
466
467 /*
468 * Command Entry Point- Platform Dependent layers call into this
469 */
470 int isp_start __P((XS_T *));
471 /* these values are what isp_start returns */
472 #define CMD_COMPLETE 101 /* command completed */
473 #define CMD_EAGAIN 102 /* busy- maybe retry later */
474 #define CMD_QUEUED 103 /* command has been queued for execution */
475 #define CMD_RQLATER 104 /* requeue this command later */
476
477 /*
478 * Command Completion Point- Core layers call out from this with completed cmds
479 */
480 void isp_done __P((XS_T *));
481
482 /*
483 * Platform Dependent to External to Internal Control Function
484 *
485 * Assumes all locks are held and that no reentrancy issues need be dealt with.
486 *
487 */
488 typedef enum {
489 ISPCTL_RESET_BUS, /* Reset Bus */
490 ISPCTL_RESET_DEV, /* Reset Device */
491 ISPCTL_ABORT_CMD, /* Abort Command */
492 ISPCTL_UPDATE_PARAMS, /* Update Operating Parameters */
493 ISPCTL_FCLINK_TEST, /* Test FC Link Status */
494 ISPCTL_PDB_SYNC, /* Synchronize Port Database */
495 ISPCTL_TOGGLE_TMODE /* toggle target mode */
496 } ispctl_t;
497 int isp_control __P((struct ispsoftc *, ispctl_t, void *));
498
499
500 /*
501 * Platform Dependent to Internal to External Control Function
502 * (each platform must provide such a function)
503 *
504 * Assumes all locks are held and that no reentrancy issues need be dealt with.
505 *
506 */
507
508 typedef enum {
509 ISPASYNC_NEW_TGT_PARAMS,
510 ISPASYNC_BUS_RESET, /* Bus Was Reset */
511 ISPASYNC_LOOP_DOWN, /* FC Loop Down */
512 ISPASYNC_LOOP_UP, /* FC Loop Up */
513 ISPASYNC_PDB_CHANGED, /* FC Port Data Base Changed */
514 ISPASYNC_CHANGE_NOTIFY, /* FC SNS Change Notification */
515 ISPASYNC_FABRIC_DEV, /* FC New Fabric Device */
516 ISPASYNC_TARGET_MESSAGE, /* target message */
517 ISPASYNC_TARGET_EVENT, /* target asynchronous event */
518 ISPASYNC_TARGET_ACTION /* other target command action */
519 } ispasync_t;
520 int isp_async __P((struct ispsoftc *, ispasync_t, void *));
521
522 /*
523 * Platform Dependent Error and Debug Printout
524 */
525 void isp_prt __P((struct ispsoftc *, int level, const char *, ...));
526 #define ISP_LOGALL 0x0 /* log always */
527 #define ISP_LOGCONFIG 0x1 /* log configuration messages */
528 #define ISP_LOGINFO 0x2 /* log informational messages */
529 #define ISP_LOGWARN 0x4 /* log warning messages */
530 #define ISP_LOGERR 0x8 /* log error messages */
531 #define ISP_LOGDEBUG0 0x10 /* log simple debug messages */
532 #define ISP_LOGDEBUG1 0x20 /* log intermediate debug messages */
533 #define ISP_LOGDEBUG2 0x40 /* log most debug messages */
534 #define ISP_LOGDEBUG3 0x100 /* log high frequency debug messages */
535 #define ISP_LOGTDEBUG0 0x200 /* log simple debug messages (target mode) */
536 #define ISP_LOGTDEBUG1 0x400 /* log intermediate debug messages (target) */
537 #define ISP_LOGTDEBUG2 0x800 /* log all debug messages (target) */
538
539 /*
540 * Each Platform provides it's own isposinfo substructure of the ispsoftc
541 * defined above.
542 *
543 * Each platform must also provide the following macros/defines:
544 *
545 *
546 * INLINE - platform specific define for 'inline' functions
547 *
548 * ISP2100_FABRIC - defines whether FABRIC support is enabled
549 * ISP2100_SCRLEN - length for the Fibre Channel scratch DMA area
550 *
551 * MEMZERO(dst, src) platform zeroing function
552 * MEMCPY(dst, src, count) platform copying function
553 * SNPRINTF(buf, bufsize, fmt, ...) snprintf
554 * STRNCAT(dstbuf, size, srcbuf) strncat
555 * USEC_DELAY(usecs) microsecond spindelay function
556 *
557 * NANOTIME_T nanosecond time type
558 *
559 * GET_NANOTIME(NANOTIME_T *) get current nanotime.
560 *
561 * GET_NANOSEC(NANOTIME_T *) get u_int64_t from NANOTIME_T
562 *
563 * NANOTIME_SUB(NANOTIME_T *, NANOTIME_T *)
564 * subtract two NANOTIME_T values
565 *
566 *
567 * MAXISPREQUEST(struct ispsoftc *) maximum request queue size
568 * for this particular board type
569 *
570 * MEMORYBARRIER(struct ispsoftc *, barrier_type, offset, size)
571 *
572 * Function/Macro the provides memory synchronization on
573 * various objects so that the ISP's and the system's view
574 * of the same object is consistent.
575 *
576 * MBOX_ACQUIRE(struct ispsoftc *) acquire lock on mailbox regs
577 * MBOX_WAIT_COMPLETE(struct ispsoftc *) wait for mailbox cmd to be done
578 * MBOX_NOTIFY_COMPLETE(struct ispsoftc *) notification of mbox cmd donee
579 * MBOX_RELEASE(struct ispsoftc *) release lock on mailbox regs
580 *
581 *
582 * SCSI_GOOD SCSI 'Good' Status
583 * SCSI_CHECK SCSI 'Check Condition' Status
584 * SCSI_BUSY SCSI 'Busy' Status
585 * SCSI_QFULL SCSI 'Queue Full' Status
586 *
587 * XS_T Platform SCSI transaction type (i.e., command for HBA)
588 * XS_ISP(xs) gets an instance out of an XS_T
589 * XS_CHANNEL(xs) gets the channel (bus # for DUALBUS cards) ""
590 * XS_TGT(xs) gets the target ""
591 * XS_LUN(xs) gets the lun ""
592 * XS_CDBP(xs) gets a pointer to the scsi CDB ""
593 * XS_CDBLEN(xs) gets the CDB's length ""
594 * XS_XFRLEN(xs) gets the associated data transfer length ""
595 * XS_TIME(xs) gets the time (in milliseconds) for this command
596 * XS_RESID(xs) gets the current residual count
597 * XS_STSP(xs) gets a pointer to the SCSI status byte ""
598 * XS_SNSP(xs) gets a pointer to the associate sense data
599 * XS_SNSLEN(xs) gets the length of sense data storage
600 * XS_SNSKEY(xs) dereferences XS_SNSP to get the current stored Sense Key
601 * XS_TAG_P(xs) predicate of whether this command should be tagged
602 * XS_TAG_TYPE(xs) which type of tag to use
603 * XS_SETERR(xs) set error state
604 *
605 * HBA_NOERROR command has no erros
606 * HBA_BOTCH hba botched something
607 * HBA_CMDTIMEOUT command timed out
608 * HBA_SELTIMEOUT selection timed out (also port logouts for FC)
609 * HBA_TGTBSY target returned a BUSY status
610 * HBA_BUSRESET bus reset destroyed command
611 * HBA_ABORTED command was aborted (by request)
612 * HBA_DATAOVR a data overrun was detected
613 * HBA_ARQFAIL Automatic Request Sense failed
614 *
615 * XS_ERR(xs) return current error state
616 * XS_NOERR(xs) there is no error currently set
617 * XS_INITERR(xs) initialize error state
618 *
619 * XS_SAVE_SENSE(xs, sp) save sense data
620 *
621 * XS_SET_STATE_STAT(isp, sp, xs) platform dependent interpreter of
622 * response queue entry status bits
623 *
624 *
625 * DEFAULT_IID(struct ispsoftc *) Default SCSI initiator ID
626 *
627 * DEFAULT_LOOPID(struct ispsoftc *) Default FC Loop ID
628 * DEFAULT_NODEWWN(struct ispsoftc *) Default FC Node WWN
629 * DEFAULT_PORTWWN(struct ispsoftc *) Default FC Port WWN
630 *
631 * PORT_FROM_NODE_WWN(struct ispsoftc *, u_int64_t nwwn)
632 *
633 * Node to Port WWN generator- this needs to be platform
634 * specific so that given a NAA=2 WWN dragged from the Qlogic
635 * card's NVRAM, a Port WWN can be generated that has the
636 * appropriate bits set in bits 48..60 that are likely to be
637 * based on the device instance number.
638 *
639 * (XXX these do endian specific transformations- in transition XXX)
640 * ISP_SWIZZLE_ICB
641 * ISP_UNSWIZZLE_AND_COPY_PDBP
642 * ISP_SWIZZLE_CONTINUATION
643 * ISP_SWIZZLE_REQUEST
644 * ISP_UNSWIZZLE_RESPONSE
645 * ISP_SWIZZLE_SNS_REQ
646 * ISP_UNSWIZZLE_SNS_RSP
647 * ISP_SWIZZLE_NVRAM_WORD
648 *
649 *
650 */
651 #endif /* _ISPVAR_H */
652