Merge tag 'v3.10.80' into update
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / scsi / atari_scsi.h
CommitLineData
1da177e4
LT
1/*
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
1da177e4
LT
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
d89537e1 50#define NCR5380_show_info atari_scsi_show_info
1da177e4
LT
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
fb810d12
MS
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
1da177e4
LT
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
3130d905
RZ
111#define dprint(flg, format...) \
112({ \
113 if (NDEBUG & (flg)) \
114 printk(KERN_DEBUG format); \
115})
116
1da177e4 117#define ARB_PRINTK(format, args...) \
3130d905 118 dprint(NDEBUG_ARBITRATION, format , ## args)
1da177e4 119#define ASEN_PRINTK(format, args...) \
3130d905 120 dprint(NDEBUG_AUTOSENSE, format , ## args)
1da177e4 121#define DMA_PRINTK(format, args...) \
3130d905 122 dprint(NDEBUG_DMA, format , ## args)
1da177e4 123#define HSH_PRINTK(format, args...) \
3130d905 124 dprint(NDEBUG_HANDSHAKE, format , ## args)
1da177e4 125#define INF_PRINTK(format, args...) \
3130d905 126 dprint(NDEBUG_INFORMATION, format , ## args)
1da177e4 127#define INI_PRINTK(format, args...) \
3130d905 128 dprint(NDEBUG_INIT, format , ## args)
1da177e4 129#define INT_PRINTK(format, args...) \
3130d905 130 dprint(NDEBUG_INTR, format , ## args)
1da177e4 131#define LNK_PRINTK(format, args...) \
3130d905 132 dprint(NDEBUG_LINKED, format , ## args)
1da177e4 133#define MAIN_PRINTK(format, args...) \
3130d905 134 dprint(NDEBUG_MAIN, format , ## args)
1da177e4 135#define NDAT_PRINTK(format, args...) \
3130d905 136 dprint(NDEBUG_NO_DATAOUT, format , ## args)
1da177e4 137#define NWR_PRINTK(format, args...) \
3130d905 138 dprint(NDEBUG_NO_WRITE, format , ## args)
1da177e4 139#define PIO_PRINTK(format, args...) \
3130d905 140 dprint(NDEBUG_PIO, format , ## args)
1da177e4 141#define PDMA_PRINTK(format, args...) \
3130d905 142 dprint(NDEBUG_PSEUDO_DMA, format , ## args)
1da177e4 143#define QU_PRINTK(format, args...) \
3130d905 144 dprint(NDEBUG_QUEUES, format , ## args)
1da177e4 145#define RSL_PRINTK(format, args...) \
3130d905 146 dprint(NDEBUG_RESELECTION, format , ## args)
1da177e4 147#define SEL_PRINTK(format, args...) \
3130d905 148 dprint(NDEBUG_SELECTION, format , ## args)
1da177e4 149#define USL_PRINTK(format, args...) \
3130d905 150 dprint(NDEBUG_USLEEP, format , ## args)
1da177e4 151#define LBS_PRINTK(format, args...) \
3130d905 152 dprint(NDEBUG_LAST_BYTE_SENT, format , ## args)
1da177e4 153#define RSS_PRINTK(format, args...) \
3130d905 154 dprint(NDEBUG_RESTART_SELECT, format , ## args)
1da177e4 155#define EXT_PRINTK(format, args...) \
3130d905 156 dprint(NDEBUG_EXTENDED, format , ## args)
1da177e4 157#define ABRT_PRINTK(format, args...) \
3130d905 158 dprint(NDEBUG_ABORT, format , ## args)
1da177e4 159#define TAG_PRINTK(format, args...) \
3130d905 160 dprint(NDEBUG_TAGS, format , ## args)
1da177e4 161#define MER_PRINTK(format, args...) \
3130d905 162 dprint(NDEBUG_MERGING, format , ## args)
1da177e4
LT
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