Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
atari_scsi.h
Go to the documentation of this file.
1 /*
2  * atari_scsi.h -- Header file for the Atari native SCSI driver
3  *
4  * Copyright 1994 Roman Hodek <[email protected]>
5  *
6  * (Loosely based on the work of Robert De Vries' team)
7  *
8  * This file is subject to the terms and conditions of the GNU General Public
9  * License. See the file COPYING in the main directory of this archive
10  * for more details.
11  *
12  */
13 
14 
15 #ifndef ATARI_SCSI_H
16 #define ATARI_SCSI_H
17 
18 /* (I_HAVE_OVERRUNS stuff removed) */
19 
20 #ifndef ASM
21 /* The values for CMD_PER_LUN and CAN_QUEUE are somehow arbitrary. Higher
22  * values should work, too; try it! (but cmd_per_lun costs memory!) */
23 
24 /* But there seems to be a bug somewhere that requires CAN_QUEUE to be
25  * 2*CMD_PER_LUN. At least on a TT, no spurious timeouts seen since
26  * changed CMD_PER_LUN... */
27 
28 /* Note: The Falcon currently uses 8/1 setting due to unsolved problems with
29  * cmd_per_lun != 1 */
30 
31 #define ATARI_TT_CAN_QUEUE 16
32 #define ATARI_TT_CMD_PER_LUN 8
33 #define ATARI_TT_SG_TABLESIZE SG_ALL
34 
35 #define ATARI_FALCON_CAN_QUEUE 8
36 #define ATARI_FALCON_CMD_PER_LUN 1
37 #define ATARI_FALCON_SG_TABLESIZE SG_NONE
38 
39 #define DEFAULT_USE_TAGGED_QUEUING 0
40 
41 
42 #define NCR5380_implementation_fields /* none */
43 
44 #define NCR5380_read(reg) atari_scsi_reg_read( reg )
45 #define NCR5380_write(reg, value) atari_scsi_reg_write( reg, value )
46 
47 #define NCR5380_intr atari_scsi_intr
48 #define NCR5380_queue_command atari_scsi_queue_command
49 #define NCR5380_abort atari_scsi_abort
50 #define NCR5380_proc_info atari_scsi_proc_info
51 #define NCR5380_dma_read_setup(inst,d,c) atari_scsi_dma_setup (inst, d, c, 0)
52 #define NCR5380_dma_write_setup(inst,d,c) atari_scsi_dma_setup (inst, d, c, 1)
53 #define NCR5380_dma_residual(inst) atari_scsi_dma_residual( inst )
54 #define NCR5380_dma_xfer_len(i,cmd,phase) \
55  atari_dma_xfer_len(cmd->SCp.this_residual,cmd,((phase) & SR_IO) ? 0 : 1)
56 
57 /* former generic SCSI error handling stuff */
58 
59 #define SCSI_ABORT_SNOOZE 0
60 #define SCSI_ABORT_SUCCESS 1
61 #define SCSI_ABORT_PENDING 2
62 #define SCSI_ABORT_BUSY 3
63 #define SCSI_ABORT_NOT_RUNNING 4
64 #define SCSI_ABORT_ERROR 5
65 
66 #define SCSI_RESET_SNOOZE 0
67 #define SCSI_RESET_PUNT 1
68 #define SCSI_RESET_SUCCESS 2
69 #define SCSI_RESET_PENDING 3
70 #define SCSI_RESET_WAKEUP 4
71 #define SCSI_RESET_NOT_RUNNING 5
72 #define SCSI_RESET_ERROR 6
73 
74 #define SCSI_RESET_SYNCHRONOUS 0x01
75 #define SCSI_RESET_ASYNCHRONOUS 0x02
76 #define SCSI_RESET_SUGGEST_BUS_RESET 0x04
77 #define SCSI_RESET_SUGGEST_HOST_RESET 0x08
78 
79 #define SCSI_RESET_BUS_RESET 0x100
80 #define SCSI_RESET_HOST_RESET 0x200
81 #define SCSI_RESET_ACTION 0xff
82 
83 /* Debugging printk definitions:
84  *
85  * ARB -> arbitration
86  * ASEN -> auto-sense
87  * DMA -> DMA
88  * HSH -> PIO handshake
89  * INF -> information transfer
90  * INI -> initialization
91  * INT -> interrupt
92  * LNK -> linked commands
93  * MAIN -> NCR5380_main() control flow
94  * NDAT -> no data-out phase
95  * NWR -> no write commands
96  * PIO -> PIO transfers
97  * PDMA -> pseudo DMA (unused on Atari)
98  * QU -> queues
99  * RSL -> reselections
100  * SEL -> selections
101  * USL -> usleep cpde (unused on Atari)
102  * LBS -> last byte sent (unused on Atari)
103  * RSS -> restarting of selections
104  * EXT -> extended messages
105  * ABRT -> aborting and resetting
106  * TAG -> queue tag handling
107  * MER -> merging of consec. buffers
108  *
109  */
110 
111 #define dprint(flg, format...) \
112 ({ \
113  if (NDEBUG & (flg)) \
114  printk(KERN_DEBUG format); \
115 })
116 
117 #define ARB_PRINTK(format, args...) \
118  dprint(NDEBUG_ARBITRATION, format , ## args)
119 #define ASEN_PRINTK(format, args...) \
120  dprint(NDEBUG_AUTOSENSE, format , ## args)
121 #define DMA_PRINTK(format, args...) \
122  dprint(NDEBUG_DMA, format , ## args)
123 #define HSH_PRINTK(format, args...) \
124  dprint(NDEBUG_HANDSHAKE, format , ## args)
125 #define INF_PRINTK(format, args...) \
126  dprint(NDEBUG_INFORMATION, format , ## args)
127 #define INI_PRINTK(format, args...) \
128  dprint(NDEBUG_INIT, format , ## args)
129 #define INT_PRINTK(format, args...) \
130  dprint(NDEBUG_INTR, format , ## args)
131 #define LNK_PRINTK(format, args...) \
132  dprint(NDEBUG_LINKED, format , ## args)
133 #define MAIN_PRINTK(format, args...) \
134  dprint(NDEBUG_MAIN, format , ## args)
135 #define NDAT_PRINTK(format, args...) \
136  dprint(NDEBUG_NO_DATAOUT, format , ## args)
137 #define NWR_PRINTK(format, args...) \
138  dprint(NDEBUG_NO_WRITE, format , ## args)
139 #define PIO_PRINTK(format, args...) \
140  dprint(NDEBUG_PIO, format , ## args)
141 #define PDMA_PRINTK(format, args...) \
142  dprint(NDEBUG_PSEUDO_DMA, format , ## args)
143 #define QU_PRINTK(format, args...) \
144  dprint(NDEBUG_QUEUES, format , ## args)
145 #define RSL_PRINTK(format, args...) \
146  dprint(NDEBUG_RESELECTION, format , ## args)
147 #define SEL_PRINTK(format, args...) \
148  dprint(NDEBUG_SELECTION, format , ## args)
149 #define USL_PRINTK(format, args...) \
150  dprint(NDEBUG_USLEEP, format , ## args)
151 #define LBS_PRINTK(format, args...) \
152  dprint(NDEBUG_LAST_BYTE_SENT, format , ## args)
153 #define RSS_PRINTK(format, args...) \
154  dprint(NDEBUG_RESTART_SELECT, format , ## args)
155 #define EXT_PRINTK(format, args...) \
156  dprint(NDEBUG_EXTENDED, format , ## args)
157 #define ABRT_PRINTK(format, args...) \
158  dprint(NDEBUG_ABORT, format , ## args)
159 #define TAG_PRINTK(format, args...) \
160  dprint(NDEBUG_TAGS, format , ## args)
161 #define MER_PRINTK(format, args...) \
162  dprint(NDEBUG_MERGING, format , ## args)
163 
164 /* conditional macros for NCR5380_print_{,phase,status} */
165 
166 #define NCR_PRINT(mask) \
167  ((NDEBUG & (mask)) ? NCR5380_print(instance) : (void)0)
168 
169 #define NCR_PRINT_PHASE(mask) \
170  ((NDEBUG & (mask)) ? NCR5380_print_phase(instance) : (void)0)
171 
172 #define NCR_PRINT_STATUS(mask) \
173  ((NDEBUG & (mask)) ? NCR5380_print_status(instance) : (void)0)
174 
175 
176 #endif /* ndef ASM */
177 #endif /* ATARI_SCSI_H */
178 
179