2 * Sun3 SCSI stuff by Erik Verbruggen (erik@bigmama.xtdnet.nl)
4 * Sun3 DMA additions by Sam Creasey (sammy@sammy.net)
6 * Adapted from mac_scsinew.h:
9 * Cumana Generic NCR5380 driver defines
11 * Copyright 1993, Drew Eckhardt
13 * (Unix and Linux consulting and custom programming)
19 * For more information, please consult
22 * SCSI Protocol Controller
25 * NCR Microelectronics
26 * 1635 Aeroplaza Drive
27 * Colorado Springs, CO 80916
33 * $Log: cumana_NCR5380.h,v $
36 #ifndef SUN3_NCR5380_H
37 #define SUN3_NCR5380_H
39 #define SUN3SCSI_PUBLIC_RELEASE 1
42 * Int: level 2 autovector
43 * IO: type 1, base 0x00140000, 5 bits phys space: A<4..0>
45 #define IRQ_SUN3_SCSI 2
46 #define IOBASE_SUN3_SCSI 0x00140000
48 #define IOBASE_SUN3_VMESCSI 0xff200000
50 static int sun3scsi_abort(struct scsi_cmnd
*);
51 static int sun3scsi_detect (struct scsi_host_template
*);
52 static const char *sun3scsi_info (struct Scsi_Host
*);
53 static int sun3scsi_bus_reset(struct scsi_cmnd
*);
54 static int sun3scsi_queue_command(struct scsi_cmnd
*,
55 void (*done
)(struct scsi_cmnd
*));
56 static int sun3scsi_release (struct Scsi_Host
*);
67 #define SG_TABLESIZE SG_NONE
74 #ifndef USE_TAGGED_QUEUING
75 #define USE_TAGGED_QUEUING 1
78 #include <scsi/scsicam.h>
81 #define SUN3_SCSI_NAME "Sun3 NCR5380 VME SCSI"
83 #define SUN3_SCSI_NAME "Sun3 NCR5380 SCSI"
88 #define NCR5380_implementation_fields \
91 #define NCR5380_local_declare() \
92 struct Scsi_Host *_instance
94 #define NCR5380_setup(instance) \
97 #define NCR5380_read(reg) sun3scsi_read(reg)
98 #define NCR5380_write(reg, value) sun3scsi_write(reg, value)
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)
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
112 #define BOARD_NORMAL 0
113 #define BOARD_NCR53C400 1
115 /* additional registers - mainly DMA control regs */
116 /* these start at regbase + 8 -- directly after the NCR regs */
117 struct sun3_dma_regs
{
118 unsigned short dma_addr_hi
; /* vme only */
119 unsigned short dma_addr_lo
; /* vme only */
120 unsigned short dma_count_hi
; /* vme only */
121 unsigned short dma_count_lo
; /* vme only */
122 unsigned short udc_data
; /* udc dma data reg (obio only) */
123 unsigned short udc_addr
; /* uda dma addr reg (obio only) */
124 unsigned short fifo_data
; /* fifo data reg, holds extra byte on
126 unsigned short fifo_count
;
127 unsigned short csr
; /* control/status reg */
128 unsigned short bpack_hi
; /* vme only */
129 unsigned short bpack_lo
; /* vme only */
130 unsigned short ivect
; /* vme only */
131 unsigned short fifo_count_hi
; /* vme only */
134 /* ucd chip specific regs - live in dvma space */
135 struct sun3_udc_regs
{
136 unsigned short rsel
; /* select regs to load */
137 unsigned short addr_hi
; /* high word of addr */
138 unsigned short addr_lo
; /* low word */
139 unsigned short count
; /* words to be xfer'd */
140 unsigned short mode_hi
; /* high word of channel mode */
141 unsigned short mode_lo
; /* low word of channel mode */
144 /* addresses of the udc registers */
145 #define UDC_MODE 0x38
146 #define UDC_CSR 0x2e /* command/status */
147 #define UDC_CHN_HI 0x26 /* chain high word */
148 #define UDC_CHN_LO 0x22 /* chain lo word */
149 #define UDC_CURA_HI 0x1a /* cur reg A high */
150 #define UDC_CURA_LO 0x0a /* cur reg A low */
151 #define UDC_CURB_HI 0x12 /* cur reg B high */
152 #define UDC_CURB_LO 0x02 /* cur reg B low */
153 #define UDC_MODE_HI 0x56 /* mode reg high */
154 #define UDC_MODE_LO 0x52 /* mode reg low */
155 #define UDC_COUNT 0x32 /* words to xfer */
157 /* some udc commands */
159 #define UDC_CHN_START 0xa0 /* start chain */
160 #define UDC_INT_ENABLE 0x32 /* channel 1 int on */
163 #define UDC_MODE_HIWORD 0x40
164 #define UDC_MODE_LSEND 0xc2
165 #define UDC_MODE_LRECV 0xd2
167 /* udc reg selections */
168 #define UDC_RSEL_SEND 0x282
169 #define UDC_RSEL_RECV 0x182
171 /* bits in csr reg */
172 #define CSR_DMA_ACTIVE 0x8000
173 #define CSR_DMA_CONFLICT 0x4000
174 #define CSR_DMA_BUSERR 0x2000
176 #define CSR_FIFO_EMPTY 0x400 /* fifo flushed? */
177 #define CSR_SDB_INT 0x200 /* sbc interrupt pending */
178 #define CSR_DMA_INT 0x100 /* dma interrupt pending */
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
186 #define CSR_DMA_ENABLE 0x10
188 #define CSR_SEND 0x8 /* 1 = send 0 = recv */
189 #define CSR_FIFO 0x2 /* reset fifo */
190 #define CSR_INTR 0x4 /* interrupt enable */
193 #define VME_DATA24 0x3d00
195 // debugging printk's, taken from atari_scsi.h
196 /* Debugging printk definitions:
201 * HSH -> PIO handshake
202 * INF -> information transfer
203 * INI -> initialization
205 * LNK -> linked commands
206 * MAIN -> NCR5380_main() control flow
207 * NDAT -> no data-out phase
208 * NWR -> no write commands
209 * PIO -> PIO transfers
210 * PDMA -> pseudo DMA (unused on Atari)
212 * RSL -> reselections
214 * USL -> usleep cpde (unused on Atari)
215 * LBS -> last byte sent (unused on Atari)
216 * RSS -> restarting of selections
217 * EXT -> extended messages
218 * ABRT -> aborting and resetting
219 * TAG -> queue tag handling
220 * MER -> merging of consec. buffers
226 #if NDEBUG & NDEBUG_ARBITRATION
227 #define ARB_PRINTK(format, args...) \
228 printk(KERN_DEBUG format , ## args)
230 #define ARB_PRINTK(format, args...)
232 #if NDEBUG & NDEBUG_AUTOSENSE
233 #define ASEN_PRINTK(format, args...) \
234 printk(KERN_DEBUG format , ## args)
236 #define ASEN_PRINTK(format, args...)
238 #if NDEBUG & NDEBUG_DMA
239 #define DMA_PRINTK(format, args...) \
240 printk(KERN_DEBUG format , ## args)
242 #define DMA_PRINTK(format, args...)
244 #if NDEBUG & NDEBUG_HANDSHAKE
245 #define HSH_PRINTK(format, args...) \
246 printk(KERN_DEBUG format , ## args)
248 #define HSH_PRINTK(format, args...)
250 #if NDEBUG & NDEBUG_INFORMATION
251 #define INF_PRINTK(format, args...) \
252 printk(KERN_DEBUG format , ## args)
254 #define INF_PRINTK(format, args...)
256 #if NDEBUG & NDEBUG_INIT
257 #define INI_PRINTK(format, args...) \
258 printk(KERN_DEBUG format , ## args)
260 #define INI_PRINTK(format, args...)
262 #if NDEBUG & NDEBUG_INTR
263 #define INT_PRINTK(format, args...) \
264 printk(KERN_DEBUG format , ## args)
266 #define INT_PRINTK(format, args...)
268 #if NDEBUG & NDEBUG_LINKED
269 #define LNK_PRINTK(format, args...) \
270 printk(KERN_DEBUG format , ## args)
272 #define LNK_PRINTK(format, args...)
274 #if NDEBUG & NDEBUG_MAIN
275 #define MAIN_PRINTK(format, args...) \
276 printk(KERN_DEBUG format , ## args)
278 #define MAIN_PRINTK(format, args...)
280 #if NDEBUG & NDEBUG_NO_DATAOUT
281 #define NDAT_PRINTK(format, args...) \
282 printk(KERN_DEBUG format , ## args)
284 #define NDAT_PRINTK(format, args...)
286 #if NDEBUG & NDEBUG_NO_WRITE
287 #define NWR_PRINTK(format, args...) \
288 printk(KERN_DEBUG format , ## args)
290 #define NWR_PRINTK(format, args...)
292 #if NDEBUG & NDEBUG_PIO
293 #define PIO_PRINTK(format, args...) \
294 printk(KERN_DEBUG format , ## args)
296 #define PIO_PRINTK(format, args...)
298 #if NDEBUG & NDEBUG_PSEUDO_DMA
299 #define PDMA_PRINTK(format, args...) \
300 printk(KERN_DEBUG format , ## args)
302 #define PDMA_PRINTK(format, args...)
304 #if NDEBUG & NDEBUG_QUEUES
305 #define QU_PRINTK(format, args...) \
306 printk(KERN_DEBUG format , ## args)
308 #define QU_PRINTK(format, args...)
310 #if NDEBUG & NDEBUG_RESELECTION
311 #define RSL_PRINTK(format, args...) \
312 printk(KERN_DEBUG format , ## args)
314 #define RSL_PRINTK(format, args...)
316 #if NDEBUG & NDEBUG_SELECTION
317 #define SEL_PRINTK(format, args...) \
318 printk(KERN_DEBUG format , ## args)
320 #define SEL_PRINTK(format, args...)
322 #if NDEBUG & NDEBUG_USLEEP
323 #define USL_PRINTK(format, args...) \
324 printk(KERN_DEBUG format , ## args)
326 #define USL_PRINTK(format, args...)
328 #if NDEBUG & NDEBUG_LAST_BYTE_SENT
329 #define LBS_PRINTK(format, args...) \
330 printk(KERN_DEBUG format , ## args)
332 #define LBS_PRINTK(format, args...)
334 #if NDEBUG & NDEBUG_RESTART_SELECT
335 #define RSS_PRINTK(format, args...) \
336 printk(KERN_DEBUG format , ## args)
338 #define RSS_PRINTK(format, args...)
340 #if NDEBUG & NDEBUG_EXTENDED
341 #define EXT_PRINTK(format, args...) \
342 printk(KERN_DEBUG format , ## args)
344 #define EXT_PRINTK(format, args...)
346 #if NDEBUG & NDEBUG_ABORT
347 #define ABRT_PRINTK(format, args...) \
348 printk(KERN_DEBUG format , ## args)
350 #define ABRT_PRINTK(format, args...)
352 #if NDEBUG & NDEBUG_TAGS
353 #define TAG_PRINTK(format, args...) \
354 printk(KERN_DEBUG format , ## args)
356 #define TAG_PRINTK(format, args...)
358 #if NDEBUG & NDEBUG_MERGING
359 #define MER_PRINTK(format, args...) \
360 printk(KERN_DEBUG format , ## args)
362 #define MER_PRINTK(format, args...)
365 /* conditional macros for NCR5380_print_{,phase,status} */
367 #define NCR_PRINT(mask) \
368 ((NDEBUG & (mask)) ? NCR5380_print(instance) : (void)0)
370 #define NCR_PRINT_PHASE(mask) \
371 ((NDEBUG & (mask)) ? NCR5380_print_phase(instance) : (void)0)
373 #define NCR_PRINT_STATUS(mask) \
374 ((NDEBUG & (mask)) ? NCR5380_print_status(instance) : (void)0)
378 #endif /* ndef HOSTS_C */
379 #endif /* SUN3_NCR5380_H */
This page took 0.03788 seconds and 5 git commands to generate.