aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/NCR5380.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/NCR5380.h')
-rw-r--r--drivers/scsi/NCR5380.h78
1 files changed, 38 insertions, 40 deletions
diff --git a/drivers/scsi/NCR5380.h b/drivers/scsi/NCR5380.h
index c79ddfa6f53c..162112dd1bf8 100644
--- a/drivers/scsi/NCR5380.h
+++ b/drivers/scsi/NCR5380.h
@@ -7,8 +7,6 @@
7 * drew@colorado.edu 7 * drew@colorado.edu
8 * +1 (303) 666-5836 8 * +1 (303) 666-5836
9 * 9 *
10 * DISTRIBUTION RELEASE 7
11 *
12 * For more information, please consult 10 * For more information, please consult
13 * 11 *
14 * NCR 5380 Family 12 * NCR 5380 Family
@@ -25,13 +23,7 @@
25#define NCR5380_H 23#define NCR5380_H
26 24
27#include <linux/interrupt.h> 25#include <linux/interrupt.h>
28
29#ifdef AUTOSENSE
30#include <scsi/scsi_eh.h> 26#include <scsi/scsi_eh.h>
31#endif
32
33#define NCR5380_PUBLIC_RELEASE 7
34#define NCR53C400_PUBLIC_RELEASE 2
35 27
36#define NDEBUG_ARBITRATION 0x1 28#define NDEBUG_ARBITRATION 0x1
37#define NDEBUG_AUTOSENSE 0x2 29#define NDEBUG_AUTOSENSE 0x2
@@ -224,33 +216,44 @@
224#define DISCONNECT_LONG 2 216#define DISCONNECT_LONG 2
225 217
226/* 218/*
227 * These are "special" values for the tag parameter passed to NCR5380_select. 219 * "Special" value for the (unsigned char) command tag, to indicate
220 * I_T_L nexus instead of I_T_L_Q.
228 */ 221 */
229 222
230#define TAG_NEXT -1 /* Use next free tag */ 223#define TAG_NONE 0xff
231#define TAG_NONE -2 /*
232 * Establish I_T_L nexus instead of I_T_L_Q
233 * even on SCSI-II devices.
234 */
235 224
236/* 225/*
237 * These are "special" values for the irq and dma_channel fields of the 226 * These are "special" values for the irq and dma_channel fields of the
238 * Scsi_Host structure 227 * Scsi_Host structure
239 */ 228 */
240 229
241#define SCSI_IRQ_NONE 255
242#define DMA_NONE 255 230#define DMA_NONE 255
243#define IRQ_AUTO 254 231#define IRQ_AUTO 254
244#define DMA_AUTO 254 232#define DMA_AUTO 254
245#define PORT_AUTO 0xffff /* autoprobe io port for 53c400a */ 233#define PORT_AUTO 0xffff /* autoprobe io port for 53c400a */
246 234
235#ifndef NO_IRQ
236#define NO_IRQ 0
237#endif
238
247#define FLAG_HAS_LAST_BYTE_SENT 1 /* NCR53c81 or better */ 239#define FLAG_HAS_LAST_BYTE_SENT 1 /* NCR53c81 or better */
248#define FLAG_CHECK_LAST_BYTE_SENT 2 /* Only test once */ 240#define FLAG_CHECK_LAST_BYTE_SENT 2 /* Only test once */
249#define FLAG_NCR53C400 4 /* NCR53c400 */ 241#define FLAG_NCR53C400 4 /* NCR53c400 */
250#define FLAG_NO_PSEUDO_DMA 8 /* Inhibit DMA */ 242#define FLAG_NO_PSEUDO_DMA 8 /* Inhibit DMA */
251#define FLAG_DTC3181E 16 /* DTC3181E */ 243#define FLAG_DTC3181E 16 /* DTC3181E */
244#define FLAG_LATE_DMA_SETUP 32 /* Setup NCR before DMA H/W */
245#define FLAG_TAGGED_QUEUING 64 /* as X3T9.2 spelled it */
252 246
253#ifndef ASM 247#ifndef ASM
248
249#ifdef SUPPORT_TAGS
250struct tag_alloc {
251 DECLARE_BITMAP(allocated, MAX_TAGS);
252 int nr_allocated;
253 int queue_size;
254};
255#endif
256
254struct NCR5380_hostdata { 257struct NCR5380_hostdata {
255 NCR5380_implementation_fields; /* implementation specific */ 258 NCR5380_implementation_fields; /* implementation specific */
256 struct Scsi_Host *host; /* Host backpointer */ 259 struct Scsi_Host *host; /* Host backpointer */
@@ -263,9 +266,9 @@ struct NCR5380_hostdata {
263 volatile int dma_len; /* requested length of DMA */ 266 volatile int dma_len; /* requested length of DMA */
264#endif 267#endif
265 volatile unsigned char last_message; /* last message OUT */ 268 volatile unsigned char last_message; /* last message OUT */
266 volatile Scsi_Cmnd *connected; /* currently connected command */ 269 volatile struct scsi_cmnd *connected; /* currently connected command */
267 volatile Scsi_Cmnd *issue_queue; /* waiting to be issued */ 270 volatile struct scsi_cmnd *issue_queue; /* waiting to be issued */
268 volatile Scsi_Cmnd *disconnected_queue; /* waiting for reconnect */ 271 volatile struct scsi_cmnd *disconnected_queue; /* waiting for reconnect */
269 volatile int restart_select; /* we have disconnected, 272 volatile int restart_select; /* we have disconnected,
270 used to restart 273 used to restart
271 NCR5380_select() */ 274 NCR5380_select() */
@@ -273,19 +276,21 @@ struct NCR5380_hostdata {
273 int flags; 276 int flags;
274 unsigned long time_expires; /* in jiffies, set prior to sleeping */ 277 unsigned long time_expires; /* in jiffies, set prior to sleeping */
275 int select_time; /* timer in select for target response */ 278 int select_time; /* timer in select for target response */
276 volatile Scsi_Cmnd *selecting; 279 volatile struct scsi_cmnd *selecting;
277 struct delayed_work coroutine; /* our co-routine */ 280 struct delayed_work coroutine; /* our co-routine */
278#ifdef NCR5380_STATS
279 unsigned timebase; /* Base for time calcs */
280 long time_read[8]; /* time to do reads */
281 long time_write[8]; /* time to do writes */
282 unsigned long bytes_read[8]; /* bytes read */
283 unsigned long bytes_write[8]; /* bytes written */
284 unsigned pendingr;
285 unsigned pendingw;
286#endif
287#ifdef AUTOSENSE
288 struct scsi_eh_save ses; 281 struct scsi_eh_save ses;
282 char info[256];
283 int read_overruns; /* number of bytes to cut from a
284 * transfer to handle chip overruns */
285 int retain_dma_intr;
286 struct work_struct main_task;
287 volatile int main_running;
288#ifdef SUPPORT_TAGS
289 struct tag_alloc TagAlloc[8][8]; /* 8 targets and 8 LUNs */
290#endif
291#ifdef PSEUDO_DMA
292 unsigned spin_max_r;
293 unsigned spin_max_w;
289#endif 294#endif
290}; 295};
291 296
@@ -296,7 +301,8 @@ struct NCR5380_hostdata {
296#endif 301#endif
297 302
298#define dprintk(flg, fmt, ...) \ 303#define dprintk(flg, fmt, ...) \
299 do { if ((NDEBUG) & (flg)) pr_debug(fmt, ## __VA_ARGS__); } while (0) 304 do { if ((NDEBUG) & (flg)) \
305 printk(KERN_DEBUG fmt, ## __VA_ARGS__); } while (0)
300 306
301#if NDEBUG 307#if NDEBUG
302#define NCR5380_dprint(flg, arg) \ 308#define NCR5380_dprint(flg, arg) \
@@ -320,17 +326,9 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance);
320static irqreturn_t NCR5380_intr(int irq, void *dev_id); 326static irqreturn_t NCR5380_intr(int irq, void *dev_id);
321#endif 327#endif
322static void NCR5380_main(struct work_struct *work); 328static void NCR5380_main(struct work_struct *work);
323static void __maybe_unused NCR5380_print_options(struct Scsi_Host *instance); 329static const char *NCR5380_info(struct Scsi_Host *instance);
324static int NCR5380_abort(Scsi_Cmnd * cmd);
325static int NCR5380_bus_reset(Scsi_Cmnd * cmd);
326static int NCR5380_queue_command(struct Scsi_Host *, struct scsi_cmnd *);
327static int __maybe_unused NCR5380_show_info(struct seq_file *,
328 struct Scsi_Host *);
329static int __maybe_unused NCR5380_write_info(struct Scsi_Host *instance,
330 char *buffer, int length);
331
332static void NCR5380_reselect(struct Scsi_Host *instance); 330static void NCR5380_reselect(struct Scsi_Host *instance);
333static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag); 331static int NCR5380_select(struct Scsi_Host *instance, struct scsi_cmnd *cmd);
334#if defined(PSEUDO_DMA) || defined(REAL_DMA) || defined(REAL_DMA_POLL) 332#if defined(PSEUDO_DMA) || defined(REAL_DMA) || defined(REAL_DMA_POLL)
335static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data); 333static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data);
336#endif 334#endif