2 Copyright 1999, Be Incorporated. All Rights Reserved.
3 This file may be used under the terms of the Be Sample Code License.
7 ** 53c8xx Driver - Data structures and shared constants
10 /* status codes signaled from SCRIPTS to driver */
11 #define status_ready 0x10 // idle loop interrupted by driver
12 #define status_reselected 0x11 // select or idle interrupted by reselection
13 #define status_timeout 0x12 // select timed out
14 #define status_selected 0x13 // select succeeded
15 #define status_complete 0x14 // transaction completed
16 #define status_disconnect 0x15 // device disconnected in the middle
17 #define status_badstatus 0x16 // snafu in the status phase
18 #define status_overrun 0x17 // data overrun occurred
19 #define status_underrun 0x18 // data underrun occurred
20 #define status_badphase 0x19 // weird phase transition occurred
21 #define status_badmsg 0x1a // bad msg received
22 #define status_badextmsg 0x1b // bad extended msg received
23 #define status_selftest 0x1c // used by selftest stub
24 #define status_iocomplete 0x1d
25 #define status_syncin 0x1e
26 #define status_widein 0x1f
27 #define status_ignore_residue 0x20
29 /* status codes private to driver */
30 #define status_inactive 0x00 // no request pending
31 #define status_queued 0x01 // start request is in the startqueue
32 #define status_selecting 0x02 // attempting to select
33 #define status_active 0x03 // SCRIPTS is handling it
34 #define status_waiting 0x04 // Waiting for reselection
36 #define OP_NDATA_IN 0x09000000L
37 #define OP_NDATA_OUT 0x08000000L
38 #define OP_WDATA_IN 0x01000000L
39 #define OP_WDATA_OUT 0x00000000L
41 #define OP_END 0x98080000L
42 #define ARG_END (status_iocomplete)
50 #define PATCH_DATAIN ((Ent_do_datain/4) + 1)
51 #define PATCH_DATAOUT ((Ent_do_dataout/4) + 1)
55 #define ctxt_sendmsg 1
56 #define ctxt_recvmsg 2
57 #define ctxt_extdmsg 3
58 #define ctxt_syncmsg 4
60 #define ctxt_command 6
61 #define ctxt_widemsg 7
62 #define ctxt_program 8
66 uchar _command
[12]; /* 0 - 11 */
67 uchar _syncmsg
[2]; /* 12 - 13 */
68 uchar _widemsg
[2]; /* 14 - 15 */
69 uchar _sendmsg
[8]; /* 16 - 23 */
70 uchar _recvmsg
[1]; /* 24 */
71 uchar _extdmsg
[1]; /* 25 */
72 uchar _status
[1]; /* 26 */
73 uchar _padding
[1]; /* 27 */
75 SymInd device
; /* 28 */
76 SymInd sendmsg
; /* 36 */
77 SymInd recvmsg
; /* 44 */
78 SymInd extdmsg
; /* 52 */
79 SymInd syncmsg
; /* 60 */
80 SymInd status
; /* 68 */
81 SymInd command
; /* 76 */
82 SymInd widemsg
; /* 84 */
84 /* MUST be dword aligned! */
85 SymInd table
[131]; /* 92 --- 129 entries, 1 eot, 1 scratch */
88 #define ADJUST_PRIV_TO_DSA 28
89 #define ADJUST_PRIV_TO_TABLE 92
91 typedef struct _SymTarg
93 struct _Symbios
*adapter
;
94 struct _SymTarg
*next
;
96 uchar device
[4]; /* symbios register defs for the device */
97 int sem_targ
; /* mutex allowing only one req per target */
98 int sem_done
; /* notification semaphore */
99 CCB_SCSIIO
*ccb
; /* ccb for the current request for this target or NULL */
101 SymPriv
*priv
; /* priv data area within ccb */
102 uint32 priv_phys
; /* physical address of priv */
103 uint32 table_phys
; /* physical address of sgtable */
107 int inbound
; /* read data from device */
109 uint32 period
; /* sync period */
110 uint32 offset
; /* sync offset */
118 #define tf_ask_sync 0x0001
119 #define tf_ask_wide 0x0002
120 #define tf_is_sync 0x0010
121 #define tf_is_wide 0x0020
122 #define tf_ignore 0x0100
124 typedef struct _Symbios
126 uint32 num
; /* card number */
127 uint32 iobase
; /* io base address */
128 uint32 irq
; /* assigned irq */
130 char *name
; /* device type name */
137 uint32
*script
; /* 1 page of on/offboard scripts ram */
138 uint32 sram_phys
; /* physical address thereof */
140 SymTarg targ
[16]; /* one targ descriptor per target */
141 spinlock hwlock
; /* lock protecting register access */
143 SymTarg
*startqueue
; /* target being started */
144 SymTarg
*startqueuetail
;
145 SymTarg
*active
; /* target currently being interacted with */
146 /* null if IDLE, == startqueue if starting */
149 OFFLINE
, IDLE
, START
, ACTIVE
, TEST
153 uint period
; /* negotiated period */
154 uint period_ns
; /* configured period in ns */
155 uchar scntl3
; /* values for scntl3 SCF and CCF bits */
156 uchar sxfer
; /* values for xfer TP2-0 bits */
158 uint32 syncsize
; /* number of syncinfo entries to look at */
162 uint32 sclk
; /* SCLK in KHz */