blob: 11c624bb122dcd47078ac74ac4fd6eafbef9bbb6 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * atari_scsi.h -- Header file for the Atari native SCSI driver
3 *
4 * Copyright 1994 Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de>
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
Linus Torvalds1da177e2005-04-16 15:20:36 -070021/* 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
Al Virod89537e2013-03-31 13:24:44 -040050#define NCR5380_show_info atari_scsi_show_info
Linus Torvalds1da177e2005-04-16 15:20:36 -070051#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
Michael Schmitzfb810d12007-05-01 22:32:35 +020057/* 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
Linus Torvalds1da177e2005-04-16 15:20:36 -070083/* 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
Roman Zippel3130d902007-05-01 22:32:37 +0200111#define dprint(flg, format...) \
112({ \
113 if (NDEBUG & (flg)) \
114 printk(KERN_DEBUG format); \
115})
116
Linus Torvalds1da177e2005-04-16 15:20:36 -0700117#define ARB_PRINTK(format, args...) \
Roman Zippel3130d902007-05-01 22:32:37 +0200118 dprint(NDEBUG_ARBITRATION, format , ## args)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700119#define ASEN_PRINTK(format, args...) \
Roman Zippel3130d902007-05-01 22:32:37 +0200120 dprint(NDEBUG_AUTOSENSE, format , ## args)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700121#define DMA_PRINTK(format, args...) \
Roman Zippel3130d902007-05-01 22:32:37 +0200122 dprint(NDEBUG_DMA, format , ## args)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700123#define HSH_PRINTK(format, args...) \
Roman Zippel3130d902007-05-01 22:32:37 +0200124 dprint(NDEBUG_HANDSHAKE, format , ## args)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700125#define INF_PRINTK(format, args...) \
Roman Zippel3130d902007-05-01 22:32:37 +0200126 dprint(NDEBUG_INFORMATION, format , ## args)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700127#define INI_PRINTK(format, args...) \
Roman Zippel3130d902007-05-01 22:32:37 +0200128 dprint(NDEBUG_INIT, format , ## args)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129#define INT_PRINTK(format, args...) \
Roman Zippel3130d902007-05-01 22:32:37 +0200130 dprint(NDEBUG_INTR, format , ## args)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700131#define LNK_PRINTK(format, args...) \
Roman Zippel3130d902007-05-01 22:32:37 +0200132 dprint(NDEBUG_LINKED, format , ## args)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133#define MAIN_PRINTK(format, args...) \
Roman Zippel3130d902007-05-01 22:32:37 +0200134 dprint(NDEBUG_MAIN, format , ## args)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700135#define NDAT_PRINTK(format, args...) \
Roman Zippel3130d902007-05-01 22:32:37 +0200136 dprint(NDEBUG_NO_DATAOUT, format , ## args)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137#define NWR_PRINTK(format, args...) \
Roman Zippel3130d902007-05-01 22:32:37 +0200138 dprint(NDEBUG_NO_WRITE, format , ## args)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700139#define PIO_PRINTK(format, args...) \
Roman Zippel3130d902007-05-01 22:32:37 +0200140 dprint(NDEBUG_PIO, format , ## args)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700141#define PDMA_PRINTK(format, args...) \
Roman Zippel3130d902007-05-01 22:32:37 +0200142 dprint(NDEBUG_PSEUDO_DMA, format , ## args)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143#define QU_PRINTK(format, args...) \
Roman Zippel3130d902007-05-01 22:32:37 +0200144 dprint(NDEBUG_QUEUES, format , ## args)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700145#define RSL_PRINTK(format, args...) \
Roman Zippel3130d902007-05-01 22:32:37 +0200146 dprint(NDEBUG_RESELECTION, format , ## args)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147#define SEL_PRINTK(format, args...) \
Roman Zippel3130d902007-05-01 22:32:37 +0200148 dprint(NDEBUG_SELECTION, format , ## args)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700149#define USL_PRINTK(format, args...) \
Roman Zippel3130d902007-05-01 22:32:37 +0200150 dprint(NDEBUG_USLEEP, format , ## args)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700151#define LBS_PRINTK(format, args...) \
Roman Zippel3130d902007-05-01 22:32:37 +0200152 dprint(NDEBUG_LAST_BYTE_SENT, format , ## args)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700153#define RSS_PRINTK(format, args...) \
Roman Zippel3130d902007-05-01 22:32:37 +0200154 dprint(NDEBUG_RESTART_SELECT, format , ## args)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155#define EXT_PRINTK(format, args...) \
Roman Zippel3130d902007-05-01 22:32:37 +0200156 dprint(NDEBUG_EXTENDED, format , ## args)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157#define ABRT_PRINTK(format, args...) \
Roman Zippel3130d902007-05-01 22:32:37 +0200158 dprint(NDEBUG_ABORT, format , ## args)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700159#define TAG_PRINTK(format, args...) \
Roman Zippel3130d902007-05-01 22:32:37 +0200160 dprint(NDEBUG_TAGS, format , ## args)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700161#define MER_PRINTK(format, args...) \
Roman Zippel3130d902007-05-01 22:32:37 +0200162 dprint(NDEBUG_MERGING, format , ## args)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700163
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