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#ifndef SUN3_NCR5380_H
37#define SUN3_NCR5380_H
38
39#define SUN3SCSI_PUBLIC_RELEASE 1
40
41
42
43
44
45#define IRQ_SUN3_SCSI 2
46#define IOBASE_SUN3_SCSI 0x00140000
47
48#define IOBASE_SUN3_VMESCSI 0xff200000
49
50static int sun3scsi_abort(struct scsi_cmnd *);
51static int sun3scsi_detect (struct scsi_host_template *);
52static const char *sun3scsi_info (struct Scsi_Host *);
53static int sun3scsi_bus_reset(struct scsi_cmnd *);
54static int sun3scsi_queue_command(struct scsi_cmnd *,
55 void (*done)(struct scsi_cmnd *));
56static int sun3scsi_release (struct Scsi_Host *);
57
58#ifndef CMD_PER_LUN
59#define CMD_PER_LUN 2
60#endif
61
62#ifndef CAN_QUEUE
63#define CAN_QUEUE 16
64#endif
65
66#ifndef SG_TABLESIZE
67#define SG_TABLESIZE SG_NONE
68#endif
69
70#ifndef MAX_TAGS
71#define MAX_TAGS 32
72#endif
73
74#ifndef USE_TAGGED_QUEUING
75#define USE_TAGGED_QUEUING 1
76#endif
77
78#include <scsi/scsicam.h>
79
80#ifdef SUN3_SCSI_VME
81#define SUN3_SCSI_NAME "Sun3 NCR5380 VME SCSI"
82#else
83#define SUN3_SCSI_NAME "Sun3 NCR5380 SCSI"
84#endif
85
86#ifndef HOSTS_C
87
88#define NCR5380_implementation_fields \
89 int port, ctrl
90
91#define NCR5380_local_declare() \
92 struct Scsi_Host *_instance
93
94#define NCR5380_setup(instance) \
95 _instance = instance
96
97#define NCR5380_read(reg) sun3scsi_read(reg)
98#define NCR5380_write(reg, value) sun3scsi_write(reg, value)
99
100#define NCR5380_intr sun3scsi_intr
101#define NCR5380_queue_command sun3scsi_queue_command
102#define NCR5380_bus_reset sun3scsi_bus_reset
103#define NCR5380_abort sun3scsi_abort
104#define NCR5380_proc_info sun3scsi_proc_info
105#define NCR5380_dma_xfer_len(i, cmd, phase) \
106 sun3scsi_dma_xfer_len(cmd->SCp.this_residual,cmd,((phase) & SR_IO) ? 0 : 1)
107
108#define NCR5380_dma_write_setup(instance, data, count) sun3scsi_dma_setup(data, count, 1)
109#define NCR5380_dma_read_setup(instance, data, count) sun3scsi_dma_setup(data, count, 0)
110#define NCR5380_dma_residual sun3scsi_dma_residual
111
112#define BOARD_NORMAL 0
113#define BOARD_NCR53C400 1
114
115
116
117struct sun3_dma_regs {
118 unsigned short dma_addr_hi;
119 unsigned short dma_addr_lo;
120 unsigned short dma_count_hi;
121 unsigned short dma_count_lo;
122 unsigned short udc_data;
123 unsigned short udc_addr;
124 unsigned short fifo_data;
125
126 unsigned short fifo_count;
127 unsigned short csr;
128 unsigned short bpack_hi;
129 unsigned short bpack_lo;
130 unsigned short ivect;
131 unsigned short fifo_count_hi;
132};
133
134
135struct sun3_udc_regs {
136 unsigned short rsel;
137 unsigned short addr_hi;
138 unsigned short addr_lo;
139 unsigned short count;
140 unsigned short mode_hi;
141 unsigned short mode_lo;
142};
143
144
145#define UDC_MODE 0x38
146#define UDC_CSR 0x2e
147#define UDC_CHN_HI 0x26
148#define UDC_CHN_LO 0x22
149#define UDC_CURA_HI 0x1a
150#define UDC_CURA_LO 0x0a
151#define UDC_CURB_HI 0x12
152#define UDC_CURB_LO 0x02
153#define UDC_MODE_HI 0x56
154#define UDC_MODE_LO 0x52
155#define UDC_COUNT 0x32
156
157
158#define UDC_RESET 0
159#define UDC_CHN_START 0xa0
160#define UDC_INT_ENABLE 0x32
161
162
163#define UDC_MODE_HIWORD 0x40
164#define UDC_MODE_LSEND 0xc2
165#define UDC_MODE_LRECV 0xd2
166
167
168#define UDC_RSEL_SEND 0x282
169#define UDC_RSEL_RECV 0x182
170
171
172#define CSR_DMA_ACTIVE 0x8000
173#define CSR_DMA_CONFLICT 0x4000
174#define CSR_DMA_BUSERR 0x2000
175
176#define CSR_FIFO_EMPTY 0x400
177#define CSR_SDB_INT 0x200
178#define CSR_DMA_INT 0x100
179
180#define CSR_LEFT 0xc0
181#define CSR_LEFT_3 0xc0
182#define CSR_LEFT_2 0x80
183#define CSR_LEFT_1 0x40
184#define CSR_PACK_ENABLE 0x20
185
186#define CSR_DMA_ENABLE 0x10
187
188#define CSR_SEND 0x8
189#define CSR_FIFO 0x2
190#define CSR_INTR 0x4
191#define CSR_SCSI 0x1
192
193#define VME_DATA24 0x3d00
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224#include "NCR5380.h"
225
226#if NDEBUG & NDEBUG_ARBITRATION
227#define ARB_PRINTK(format, args...) \
228 printk(KERN_DEBUG format , ## args)
229#else
230#define ARB_PRINTK(format, args...)
231#endif
232#if NDEBUG & NDEBUG_AUTOSENSE
233#define ASEN_PRINTK(format, args...) \
234 printk(KERN_DEBUG format , ## args)
235#else
236#define ASEN_PRINTK(format, args...)
237#endif
238#if NDEBUG & NDEBUG_DMA
239#define DMA_PRINTK(format, args...) \
240 printk(KERN_DEBUG format , ## args)
241#else
242#define DMA_PRINTK(format, args...)
243#endif
244#if NDEBUG & NDEBUG_HANDSHAKE
245#define HSH_PRINTK(format, args...) \
246 printk(KERN_DEBUG format , ## args)
247#else
248#define HSH_PRINTK(format, args...)
249#endif
250#if NDEBUG & NDEBUG_INFORMATION
251#define INF_PRINTK(format, args...) \
252 printk(KERN_DEBUG format , ## args)
253#else
254#define INF_PRINTK(format, args...)
255#endif
256#if NDEBUG & NDEBUG_INIT
257#define INI_PRINTK(format, args...) \
258 printk(KERN_DEBUG format , ## args)
259#else
260#define INI_PRINTK(format, args...)
261#endif
262#if NDEBUG & NDEBUG_INTR
263#define INT_PRINTK(format, args...) \
264 printk(KERN_DEBUG format , ## args)
265#else
266#define INT_PRINTK(format, args...)
267#endif
268#if NDEBUG & NDEBUG_LINKED
269#define LNK_PRINTK(format, args...) \
270 printk(KERN_DEBUG format , ## args)
271#else
272#define LNK_PRINTK(format, args...)
273#endif
274#if NDEBUG & NDEBUG_MAIN
275#define MAIN_PRINTK(format, args...) \
276 printk(KERN_DEBUG format , ## args)
277#else
278#define MAIN_PRINTK(format, args...)
279#endif
280#if NDEBUG & NDEBUG_NO_DATAOUT
281#define NDAT_PRINTK(format, args...) \
282 printk(KERN_DEBUG format , ## args)
283#else
284#define NDAT_PRINTK(format, args...)
285#endif
286#if NDEBUG & NDEBUG_NO_WRITE
287#define NWR_PRINTK(format, args...) \
288 printk(KERN_DEBUG format , ## args)
289#else
290#define NWR_PRINTK(format, args...)
291#endif
292#if NDEBUG & NDEBUG_PIO
293#define PIO_PRINTK(format, args...) \
294 printk(KERN_DEBUG format , ## args)
295#else
296#define PIO_PRINTK(format, args...)
297#endif
298#if NDEBUG & NDEBUG_PSEUDO_DMA
299#define PDMA_PRINTK(format, args...) \
300 printk(KERN_DEBUG format , ## args)
301#else
302#define PDMA_PRINTK(format, args...)
303#endif
304#if NDEBUG & NDEBUG_QUEUES
305#define QU_PRINTK(format, args...) \
306 printk(KERN_DEBUG format , ## args)
307#else
308#define QU_PRINTK(format, args...)
309#endif
310#if NDEBUG & NDEBUG_RESELECTION
311#define RSL_PRINTK(format, args...) \
312 printk(KERN_DEBUG format , ## args)
313#else
314#define RSL_PRINTK(format, args...)
315#endif
316#if NDEBUG & NDEBUG_SELECTION
317#define SEL_PRINTK(format, args...) \
318 printk(KERN_DEBUG format , ## args)
319#else
320#define SEL_PRINTK(format, args...)
321#endif
322#if NDEBUG & NDEBUG_USLEEP
323#define USL_PRINTK(format, args...) \
324 printk(KERN_DEBUG format , ## args)
325#else
326#define USL_PRINTK(format, args...)
327#endif
328#if NDEBUG & NDEBUG_LAST_BYTE_SENT
329#define LBS_PRINTK(format, args...) \
330 printk(KERN_DEBUG format , ## args)
331#else
332#define LBS_PRINTK(format, args...)
333#endif
334#if NDEBUG & NDEBUG_RESTART_SELECT
335#define RSS_PRINTK(format, args...) \
336 printk(KERN_DEBUG format , ## args)
337#else
338#define RSS_PRINTK(format, args...)
339#endif
340#if NDEBUG & NDEBUG_EXTENDED
341#define EXT_PRINTK(format, args...) \
342 printk(KERN_DEBUG format , ## args)
343#else
344#define EXT_PRINTK(format, args...)
345#endif
346#if NDEBUG & NDEBUG_ABORT
347#define ABRT_PRINTK(format, args...) \
348 printk(KERN_DEBUG format , ## args)
349#else
350#define ABRT_PRINTK(format, args...)
351#endif
352#if NDEBUG & NDEBUG_TAGS
353#define TAG_PRINTK(format, args...) \
354 printk(KERN_DEBUG format , ## args)
355#else
356#define TAG_PRINTK(format, args...)
357#endif
358#if NDEBUG & NDEBUG_MERGING
359#define MER_PRINTK(format, args...) \
360 printk(KERN_DEBUG format , ## args)
361#else
362#define MER_PRINTK(format, args...)
363#endif
364
365
366
367#define NCR_PRINT(mask) \
368 ((NDEBUG & (mask)) ? NCR5380_print(instance) : (void)0)
369
370#define NCR_PRINT_PHASE(mask) \
371 ((NDEBUG & (mask)) ? NCR5380_print_phase(instance) : (void)0)
372
373#define NCR_PRINT_STATUS(mask) \
374 ((NDEBUG & (mask)) ? NCR5380_print_status(instance) : (void)0)
375
376
377
378#endif
379#endif
380
381