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