This source file includes following definitions.
- NCR5380_i386_dma_setup
- NCR5380_i386_dma_write_setup
- NCR5380_i386_dma_read_setup
- NCR5380_i386_dma_residual
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
39 #ifndef NCR5380_H
40 #define NCR5380_H
41
42 #define NCR5380_PUBLIC_RELEASE 4
43
44 #define NDEBUG_ARBITRATION 0x1
45 #define NDEBUG_AUTOSENSE 0x2
46 #define NDEBUG_DMA 0x4
47 #define NDEBUG_HANDSHAKE 0x8
48 #define NDEBUG_INFORMATION 0x10
49 #define NDEBUG_INIT 0x20
50 #define NDEBUG_INTR 0x40
51 #define NDEBUG_LINKED 0x80
52 #define NDEBUG_MAIN 0x100
53 #define NDEBUG_NO_DATAOUT 0x200
54 #define NDEBUG_NO_WRITE 0x400
55 #define NDEBUG_PIO 0x800
56 #define NDEBUG_PSEUDO_DMA 0x1000
57 #define NDEBUG_QUEUES 0x2000
58 #define NDEBUG_RESELECTION 0x4000
59 #define NDEBUG_SELECTION 0x8000
60 #define NDEBUG_USLEEP 0x10000
61 #define NDEBUG_LAST_BYTE_SENT 0x20000
62
63
64
65
66
67
68
69
70 #define OUTPUT_DATA_REG 0
71 #define CURRENT_SCSI_DATA_REG 0
72
73 #define INITIATOR_COMMAND_REG 1
74 #define ICR_ASSERT_RST 0x80
75 #define ICR_ARBITRATION_PROGRESS 0x40
76 #define ICR_TRI_STATE 0x40
77 #define ICR_ARBITRATION_LOST 0x20
78 #define ICR_DIFF_ENABLE 0x20
79 #define ICR_ASSERT_ACK 0x10
80 #define ICR_ASSERT_BSY 0x08
81 #define ICR_ASSERT_SEL 0x04
82 #define ICR_ASSERT_ATN 0x02
83 #define ICR_ASSERT_DATA 0x01
84
85 #ifdef DIFFERENTIAL
86 #define ICR_BASE ICR_DIFF_ENABLE
87 #else
88 #define ICR_BASE 0
89 #endif
90
91 #define MODE_REG 2
92
93
94
95
96
97 #define MR_BLOCK_DMA_MODE 0x80
98 #define MR_TARGET 0x40
99 #define MR_ENABLE_PAR_CHECK 0x20
100 #define MR_ENABLE_PAR_INTR 0x10
101 #define MR_ENABLE_EOP_INTR 0x08
102 #define MR_MONITOR_BSY 0x04
103 #define MR_DMA_MODE 0x02
104 #define MR_ARBITRATE 0x01
105
106 #ifdef PARITY
107 #define MR_BASE MR_ENABLE_PAR_CHECK
108 #else
109 #define MR_BASE 0
110 #endif
111
112 #define TARGET_COMMAND_REG 3
113 #define TCR_LAST_BYTE_SENT 0x80
114 #define TCR_ASSERT_REQ 0x08
115 #define TCR_ASSERT_MSG 0x04
116 #define TCR_ASSERT_CD 0x02
117 #define TCR_ASSERT_IO 0x01
118
119 #define STATUS_REG 4
120
121
122
123
124 #define SR_RST 0x80
125 #define SR_BSY 0x40
126 #define SR_REQ 0x20
127 #define SR_MSG 0x10
128 #define SR_CD 0x08
129 #define SR_IO 0x04
130 #define SR_SEL 0x02
131 #define SR_DBP 0x01
132
133
134
135
136
137 #define SELECT_ENABLE_REG 4
138
139 #define BUS_AND_STATUS_REG 5
140 #define BASR_END_DMA_TRANSFER 0x80
141 #define BASR_DRQ 0x40
142 #define BASR_PARITY_ERROR 0x20
143 #define BASR_IRQ 0x10
144 #define BASR_PHASE_MATCH 0x08
145 #define BASR_BUSY_ERROR 0x04
146 #define BASR_ATN 0x02
147 #define BASR_ACK 0x01
148
149
150 #define START_DMA_SEND_REG 5
151
152
153
154
155
156 #define INPUT_DATA_REG 6
157
158
159 #define START_DMA_TARGET_RECIEVE_REG 6
160
161
162 #define RESET_PARITY_INTERRUPT_REG 7
163
164
165 #define START_DMA_INITIATOR_RECIEVE_REG 7
166
167
168 #define PHASE_MASK (SR_MSG | SR_CD | SR_IO)
169
170 #define PHASE_DATAOUT 0
171 #define PHASE_DATAIN SR_IO
172 #define PHASE_CMDOUT SR_CD
173 #define PHASE_STATIN (SR_CD | SR_IO)
174 #define PHASE_MSGOUT (SR_MSG | SR_CD)
175 #define PHASE_MSGIN (SR_MSG | SR_CD | SR_IO)
176 #define PHASE_UNKNOWN 0xff
177
178
179
180
181
182
183
184 #define PHASE_SR_TO_TCR(phase) ((phase) >> 2)
185
186
187
188
189
190
191
192 #define DISCONNECT_NONE 0
193 #define DISCONNECT_TIME_TO_DATA 1
194 #define DISCONNECT_LONG 2
195
196
197
198
199
200 #define TAG_NEXT -1
201 #define TAG_NONE -2
202
203
204
205
206
207
208
209
210
211 #define IRQ_NONE 255
212 #define DMA_NONE 255
213 #define IRQ_AUTO 254
214 #define DMA_AUTO 254
215
216 #define FLAG_HAS_LAST_BYTE_SENT 1
217 #define FLAG_CHECK_LAST_BYTE_SENT 2
218
219 #ifndef ASM
220 struct NCR5380_hostdata {
221 NCR5380_implementation_fields;
222 unsigned char id_mask, id_higher_mask;
223 volatile unsigned char busy[8];
224 #if defined(REAL_DMA) || defined(REAL_DMA_POLL)
225 volatile int dma_len;
226 #endif
227 volatile unsigned char last_message;
228 volatile Scsi_Cmnd *connected;
229 volatile Scsi_Cmnd *issue_queue;
230 volatile Scsi_Cmnd *disconnected_queue;
231 int flags;
232 #ifdef USLEEP
233 unsigned long time_expires;
234 struct Scsi_Host *next_timer;
235 #endif
236 };
237
238 #ifdef __KERNEL__
239 static struct Scsi_Host *first_instance;
240
241 #if defined(AUTOPROBE_IRQ)
242 static int NCR5380_probe_irq (struct Scsi_Host *instance, int possible);
243 #endif
244 static void NCR5380_init (struct Scsi_Host *instance);
245 static void NCR5380_information_transfer (struct Scsi_Host *instance);
246 static void NCR5380_intr (int irq);
247 static void NCR5380_main (void);
248 static void NCR5380_print_options (struct Scsi_Host *instance);
249 #ifndef NCR5380_abort
250 static
251 #endif
252 int NCR5380_abort (Scsi_Cmnd *cmd, int code);
253 #ifndef NCR5380_reset
254 static
255 #endif
256 int NCR5380_reset (Scsi_Cmnd *cmd);
257 #ifndef NCR5380_queue_command
258 static
259 #endif
260 int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *));
261
262
263 static void NCR5380_reselect (struct Scsi_Host *instance);
264 static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag);
265 #if defined(PSEUDO_DMA) || defined(REAL_DMA) || defined(REAL_DMA_POLL)
266 static int NCR5380_transfer_dma (struct Scsi_Host *instance,
267 unsigned char *phase, int *count, unsigned char **data);
268 #endif
269 static int NCR5380_transfer_pio (struct Scsi_Host *instance,
270 unsigned char *phase, int *count, unsigned char **data);
271
272 #if (defined(REAL_DMA) || defined(REAL_DMA_POLL)) && defined(i386)
273 static __inline__ int NCR5380_i386_dma_setup (struct Scsi_Host *instance,
274 unsigned char *ptr, unsigned int count, unsigned char mode) {
275 unsigned limit;
276
277 if (instance->dma_channel <=3) {
278 if (count > 65536)
279 count = 65536;
280 limit = 65536 - (((unsigned) ptr) & 0xFFFF);
281 } else {
282 if (count > 65536 * 2)
283 count = 65536 * 2;
284 limit = 65536* 2 - (((unsigned) ptr) & 0x1FFFF);
285 }
286
287 if (count > limit) count = limit;
288
289 if ((count & 1) || (((unsigned) ptr) & 1))
290 panic ("scsi%d : attmpted unaligned DMA transfer\n", instance->host_no);
291 cli();
292 disable_dma(instance->dma_channel);
293 clear_dma_ff(instance->dma_channel);
294 set_dma_addr(instance->dma_channel, (unsigned int) ptr);
295 set_dma_count(instance->dma_channel, count);
296 set_dma_mode(instance->dma_channel, mode);
297 enable_dma(instance->dma_channel);
298 sti();
299 return count;
300 }
301
302 static __inline__ int NCR5380_i386_dma_write_setup (struct Scsi_Host *instance,
303 unsigned char *src, unsigned int count) {
304 return NCR5380_i386_dma_setup (instance, src, count, DMA_MODE_WRITE);
305 }
306
307 static __inline__ int NCR5380_i386_dma_read_setup (struct Scsi_Host *instance,
308 unsigned char *src, unsigned int count) {
309 return NCR5380_i386_dma_setup (instance, src, count, DMA_MODE_READ);
310 }
311
312 static __inline__ int NCR5380_i386_dma_residual (struct Scsi_Host *instance) {
313 register int tmp;
314 cli();
315 clear_dma_ff(instance->dma_channel);
316 tmp = get_dma_residue(instance->dma_channel);
317 sti();
318 return tmp;
319 }
320 #endif
321 #endif __KERNEL_
322 #endif
323 #endif