ispvar.h (128101f3624722d3e46dcb1ffac353075c2d58ec) ispvar.h (cbf57b472d00c6dee3735ddd9d5ce53edea1a5cf)
1/* $Id: ispvar.h,v 1.7 1998/12/28 19:22:27 mjacob Exp $ */
2/* release_12_28_98_A+ */
1/* $Id: ispvar.h,v 1.8 1999/01/10 02:51:48 mjacob Exp $ */
2/* release_01_29_99 */
3/*
4 * Soft Definitions for for Qlogic ISP SCSI adapters.
5 *
6 *---------------------------------------
7 * Copyright (c) 1997, 1998 by Matthew Jacob
8 * NASA/Ames Research Center
9 * All rights reserved.
10 *---------------------------------------

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

46#ifdef __linux__
47#include "ispmbox.h"
48#endif
49
50#define ISP_CORE_VERSION_MAJOR 1
51#define ISP_CORE_VERSION_MINOR 5
52
53/*
3/*
4 * Soft Definitions for for Qlogic ISP SCSI adapters.
5 *
6 *---------------------------------------
7 * Copyright (c) 1997, 1998 by Matthew Jacob
8 * NASA/Ames Research Center
9 * All rights reserved.
10 *---------------------------------------

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

46#ifdef __linux__
47#include "ispmbox.h"
48#endif
49
50#define ISP_CORE_VERSION_MAJOR 1
51#define ISP_CORE_VERSION_MINOR 5
52
53/*
54 * Vector for MD code to provide specific services.
54 * Vector for bus specific code to provide specific services.
55 */
56struct ispsoftc;
57struct ispmdvec {
58 u_int16_t (*dv_rd_reg) __P((struct ispsoftc *, int));
59 void (*dv_wr_reg) __P((struct ispsoftc *, int, u_int16_t));
60 int (*dv_mbxdma) __P((struct ispsoftc *));
61 int (*dv_dmaset) __P((struct ispsoftc *,
62 ISP_SCSI_XFER_T *, ispreq_t *, u_int8_t *, u_int8_t));

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

86#define RESULT_QUEUE_LEN (MAXISPREQUEST/4)
87#define ISP_QUEUE_ENTRY(q, idx) ((q) + ((idx) * QENTRY_LEN))
88#define ISP_QUEUE_SIZE(n) ((n) * QENTRY_LEN)
89#define ISP_NXT_QENTRY(idx, qlen) (((idx) + 1) & ((qlen)-1))
90#define ISP_QAVAIL(in, out, qlen) \
91 ((in == out)? (qlen - 1) : ((in > out)? \
92 ((qlen - 1) - (in - out)) : (out - in - 1)))
93/*
55 */
56struct ispsoftc;
57struct ispmdvec {
58 u_int16_t (*dv_rd_reg) __P((struct ispsoftc *, int));
59 void (*dv_wr_reg) __P((struct ispsoftc *, int, u_int16_t));
60 int (*dv_mbxdma) __P((struct ispsoftc *));
61 int (*dv_dmaset) __P((struct ispsoftc *,
62 ISP_SCSI_XFER_T *, ispreq_t *, u_int8_t *, u_int8_t));

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

86#define RESULT_QUEUE_LEN (MAXISPREQUEST/4)
87#define ISP_QUEUE_ENTRY(q, idx) ((q) + ((idx) * QENTRY_LEN))
88#define ISP_QUEUE_SIZE(n) ((n) * QENTRY_LEN)
89#define ISP_NXT_QENTRY(idx, qlen) (((idx) + 1) & ((qlen)-1))
90#define ISP_QAVAIL(in, out, qlen) \
91 ((in == out)? (qlen - 1) : ((in > out)? \
92 ((qlen - 1) - (in - out)) : (out - in - 1)))
93/*
94 * SCSI (as opposed to FC-PH) Specific Host Adapter Parameters
94 * SCSI Specific Host Adapter Parameters
95 */
96
97typedef struct {
98 u_int isp_req_ack_active_neg : 1,
99 isp_data_line_active_neg: 1,
100 isp_cmd_dma_burst_enable: 1,
101 isp_data_dma_burst_enabl: 1,
102 isp_fifo_threshold : 3,
95 */
96
97typedef struct {
98 u_int isp_req_ack_active_neg : 1,
99 isp_data_line_active_neg: 1,
100 isp_cmd_dma_burst_enable: 1,
101 isp_data_dma_burst_enabl: 1,
102 isp_fifo_threshold : 3,
103 isp_ultramode : 1,
103 isp_diffmode : 1,
104 isp_fast_mttr : 1,
105 isp_initiator_id : 4,
106 isp_async_data_setup : 4;
107 u_int16_t isp_selection_timeout;
108 u_int16_t isp_max_queue_depth;
109 u_int16_t isp_clock;
110 u_int8_t isp_tag_aging;
111 u_int8_t isp_bus_reset_delay;
112 u_int8_t isp_retry_count;
113 u_int8_t isp_retry_delay;
114 struct {
104 isp_diffmode : 1,
105 isp_fast_mttr : 1,
106 isp_initiator_id : 4,
107 isp_async_data_setup : 4;
108 u_int16_t isp_selection_timeout;
109 u_int16_t isp_max_queue_depth;
110 u_int16_t isp_clock;
111 u_int8_t isp_tag_aging;
112 u_int8_t isp_bus_reset_delay;
113 u_int8_t isp_retry_count;
114 u_int8_t isp_retry_delay;
115 struct {
115 u_int dev_update : 1,
116 u_int
116 dev_enable : 1,
117 dev_enable : 1,
118 dev_announced : 1,
119 dev_update : 1,
120 dev_refresh : 1,
117 exc_throttle : 7,
118 sync_offset : 4,
119 sync_period : 8;
120 u_int16_t dev_flags; /* persistent device flags */
121 u_int16_t cur_dflags; /* current device flags */
122 } isp_devparam[MAX_TARGETS];
123} sdparam; /* scsi device parameters */
124

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

267 * Sheer laziness, but it gets us around the problem
268 * where we don't have a clean way of remembering
269 * which transaction is bound to which ISP queue entry.
270 *
271 * There are other more clever ways to do this, but,
272 * jeez, so I blow a couple of KB per host adapter...
273 * and it *is* faster.
274 */
121 exc_throttle : 7,
122 sync_offset : 4,
123 sync_period : 8;
124 u_int16_t dev_flags; /* persistent device flags */
125 u_int16_t cur_dflags; /* current device flags */
126 } isp_devparam[MAX_TARGETS];
127} sdparam; /* scsi device parameters */
128

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

271 * Sheer laziness, but it gets us around the problem
272 * where we don't have a clean way of remembering
273 * which transaction is bound to which ISP queue entry.
274 *
275 * There are other more clever ways to do this, but,
276 * jeez, so I blow a couple of KB per host adapter...
277 * and it *is* faster.
278 */
275 volatile ISP_SCSI_XFER_T *isp_xflist[RQUEST_QUEUE_LEN];
279 ISP_SCSI_XFER_T *isp_xflist[RQUEST_QUEUE_LEN];
276
277 /*
278 * request/result queues and dma handles for them.
279 */
280 volatile caddr_t isp_rquest;
281 volatile caddr_t isp_result;
282 u_int32_t isp_rquest_dma;
283 u_int32_t isp_result_dma;

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

335#define ISP_HA_SCSI_1020A 0x3
336#define ISP_HA_SCSI_1040 0x4
337#define ISP_HA_SCSI_1040A 0x5
338#define ISP_HA_SCSI_1040B 0x6
339#define ISP_HA_FC 0xf0
340#define ISP_HA_FC_2100 0x10
341
342/*
280
281 /*
282 * request/result queues and dma handles for them.
283 */
284 volatile caddr_t isp_rquest;
285 volatile caddr_t isp_result;
286 u_int32_t isp_rquest_dma;
287 u_int32_t isp_result_dma;

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

339#define ISP_HA_SCSI_1020A 0x3
340#define ISP_HA_SCSI_1040 0x4
341#define ISP_HA_SCSI_1040A 0x5
342#define ISP_HA_SCSI_1040B 0x6
343#define ISP_HA_FC 0xf0
344#define ISP_HA_FC_2100 0x10
345
346/*
343 * Macros to read, write ISP registers through MD code
347 * Macros to read, write ISP registers through bus specific code.
344 */
345
346#define ISP_READ(isp, reg) \
347 (*(isp)->isp_mdvec->dv_rd_reg)((isp), (reg))
348
349#define ISP_WRITE(isp, reg, val) \
350 (*(isp)->isp_mdvec->dv_wr_reg)((isp), (reg), (val))
351

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

398int isp_intr __P((void *));
399
400/*
401 * Command Entry Point
402 */
403int32_t ispscsicmd __P((ISP_SCSI_XFER_T *));
404
405/*
348 */
349
350#define ISP_READ(isp, reg) \
351 (*(isp)->isp_mdvec->dv_rd_reg)((isp), (reg))
352
353#define ISP_WRITE(isp, reg, val) \
354 (*(isp)->isp_mdvec->dv_wr_reg)((isp), (reg), (val))
355

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

402int isp_intr __P((void *));
403
404/*
405 * Command Entry Point
406 */
407int32_t ispscsicmd __P((ISP_SCSI_XFER_T *));
408
409/*
406 * Platform Dependent to Internal Control Point
410 * Platform Dependent to External to Internal Control Function
407 *
408 * For: Aborting a running command - arg is an ISP_SCSI_XFER_T *
409 * Resetting a Device - arg is target to reset
410 * Resetting a BUS - arg is ignored
411 * Updating parameters - arg is ignored
412 *
411 *
412 * For: Aborting a running command - arg is an ISP_SCSI_XFER_T *
413 * Resetting a Device - arg is target to reset
414 * Resetting a BUS - arg is ignored
415 * Updating parameters - arg is ignored
416 *
417 * First argument is this instance's softc pointer.
413 * Second argument is an index into xflist array.
414 * Assumes all locks must be held already.
415 */
416typedef enum {
417 ISPCTL_RESET_BUS,
418 ISPCTL_RESET_DEV,
419 ISPCTL_ABORT_CMD,
420 ISPCTL_UPDATE_PARAMS,
421} ispctl_t;
422int isp_control __P((struct ispsoftc *, ispctl_t, void *));
423
418 * Second argument is an index into xflist array.
419 * Assumes all locks must be held already.
420 */
421typedef enum {
422 ISPCTL_RESET_BUS,
423 ISPCTL_RESET_DEV,
424 ISPCTL_ABORT_CMD,
425 ISPCTL_UPDATE_PARAMS,
426} ispctl_t;
427int isp_control __P((struct ispsoftc *, ispctl_t, void *));
428
429
424/*
430/*
431 * Platform Dependent to Internal to External Control Function
432 * (each platform must provide such a function)
433 *
434 * For: Announcing Target Paramter Changes (arg is target)
435 *
436 * Assumes all locks are held.
437 */
438
439typedef enum {
440 ISPASYNC_NEW_TGT_PARAMS
441} ispasync_t;
442int isp_async __P((struct ispsoftc *, ispasync_t, void *));
443
444/*
425 * lost command routine (XXXX IN TRANSITION XXXX)
426 */
427void isp_lostcmd __P((struct ispsoftc *, ISP_SCSI_XFER_T *));
428
429
430#endif /* _ISPVAR_H */
445 * lost command routine (XXXX IN TRANSITION XXXX)
446 */
447void isp_lostcmd __P((struct ispsoftc *, ISP_SCSI_XFER_T *));
448
449
450#endif /* _ISPVAR_H */