atari_scsi.c 36 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148
  1. /*
  2. * atari_scsi.c -- Device dependent functions for the Atari generic SCSI port
  3. *
  4. * Copyright 1994 Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de>
  5. *
  6. * Loosely based on the work of Robert De Vries' team and added:
  7. * - working real DMA
  8. * - Falcon support (untested yet!) ++bjoern fixed and now it works
  9. * - lots of extensions and bug fixes.
  10. *
  11. * This file is subject to the terms and conditions of the GNU General Public
  12. * License. See the file COPYING in the main directory of this archive
  13. * for more details.
  14. *
  15. */
  16. /**************************************************************************/
  17. /* */
  18. /* Notes for Falcon SCSI: */
  19. /* ---------------------- */
  20. /* */
  21. /* Since the Falcon SCSI uses the ST-DMA chip, that is shared among */
  22. /* several device drivers, locking and unlocking the access to this */
  23. /* chip is required. But locking is not possible from an interrupt, */
  24. /* since it puts the process to sleep if the lock is not available. */
  25. /* This prevents "late" locking of the DMA chip, i.e. locking it just */
  26. /* before using it, since in case of disconnection-reconnection */
  27. /* commands, the DMA is started from the reselection interrupt. */
  28. /* */
  29. /* Two possible schemes for ST-DMA-locking would be: */
  30. /* 1) The lock is taken for each command separately and disconnecting */
  31. /* is forbidden (i.e. can_queue = 1). */
  32. /* 2) The DMA chip is locked when the first command comes in and */
  33. /* released when the last command is finished and all queues are */
  34. /* empty. */
  35. /* The first alternative would result in bad performance, since the */
  36. /* interleaving of commands would not be used. The second is unfair to */
  37. /* other drivers using the ST-DMA, because the queues will seldom be */
  38. /* totally empty if there is a lot of disk traffic. */
  39. /* */
  40. /* For this reasons I decided to employ a more elaborate scheme: */
  41. /* - First, we give up the lock every time we can (for fairness), this */
  42. /* means every time a command finishes and there are no other commands */
  43. /* on the disconnected queue. */
  44. /* - If there are others waiting to lock the DMA chip, we stop */
  45. /* issuing commands, i.e. moving them onto the issue queue. */
  46. /* Because of that, the disconnected queue will run empty in a */
  47. /* while. Instead we go to sleep on a 'fairness_queue'. */
  48. /* - If the lock is released, all processes waiting on the fairness */
  49. /* queue will be woken. The first of them tries to re-lock the DMA, */
  50. /* the others wait for the first to finish this task. After that, */
  51. /* they can all run on and do their commands... */
  52. /* This sounds complicated (and it is it :-(), but it seems to be a */
  53. /* good compromise between fairness and performance: As long as no one */
  54. /* else wants to work with the ST-DMA chip, SCSI can go along as */
  55. /* usual. If now someone else comes, this behaviour is changed to a */
  56. /* "fairness mode": just already initiated commands are finished and */
  57. /* then the lock is released. The other one waiting will probably win */
  58. /* the race for locking the DMA, since it was waiting for longer. And */
  59. /* after it has finished, SCSI can go ahead again. Finally: I hope I */
  60. /* have not produced any deadlock possibilities! */
  61. /* */
  62. /**************************************************************************/
  63. #include <linux/module.h>
  64. #define NDEBUG (0)
  65. #define NDEBUG_ABORT 0x00100000
  66. #define NDEBUG_TAGS 0x00200000
  67. #define NDEBUG_MERGING 0x00400000
  68. #define AUTOSENSE
  69. /* For the Atari version, use only polled IO or REAL_DMA */
  70. #define REAL_DMA
  71. /* Support tagged queuing? (on devices that are able to... :-) */
  72. #define SUPPORT_TAGS
  73. #define MAX_TAGS 32
  74. #include <linux/types.h>
  75. #include <linux/stddef.h>
  76. #include <linux/ctype.h>
  77. #include <linux/delay.h>
  78. #include <linux/mm.h>
  79. #include <linux/blkdev.h>
  80. #include <linux/interrupt.h>
  81. #include <linux/init.h>
  82. #include <linux/nvram.h>
  83. #include <linux/bitops.h>
  84. #include <asm/setup.h>
  85. #include <asm/atarihw.h>
  86. #include <asm/atariints.h>
  87. #include <asm/page.h>
  88. #include <asm/pgtable.h>
  89. #include <asm/irq.h>
  90. #include <asm/traps.h>
  91. #include "scsi.h"
  92. #include <scsi/scsi_host.h>
  93. #include "atari_scsi.h"
  94. #include "NCR5380.h"
  95. #include <asm/atari_stdma.h>
  96. #include <asm/atari_stram.h>
  97. #include <asm/io.h>
  98. #include <linux/stat.h>
  99. #define IS_A_TT() ATARIHW_PRESENT(TT_SCSI)
  100. #define SCSI_DMA_WRITE_P(elt,val) \
  101. do { \
  102. unsigned long v = val; \
  103. tt_scsi_dma.elt##_lo = v & 0xff; \
  104. v >>= 8; \
  105. tt_scsi_dma.elt##_lmd = v & 0xff; \
  106. v >>= 8; \
  107. tt_scsi_dma.elt##_hmd = v & 0xff; \
  108. v >>= 8; \
  109. tt_scsi_dma.elt##_hi = v & 0xff; \
  110. } while(0)
  111. #define SCSI_DMA_READ_P(elt) \
  112. (((((((unsigned long)tt_scsi_dma.elt##_hi << 8) | \
  113. (unsigned long)tt_scsi_dma.elt##_hmd) << 8) | \
  114. (unsigned long)tt_scsi_dma.elt##_lmd) << 8) | \
  115. (unsigned long)tt_scsi_dma.elt##_lo)
  116. static inline void SCSI_DMA_SETADR(unsigned long adr)
  117. {
  118. st_dma.dma_lo = (unsigned char)adr;
  119. MFPDELAY();
  120. adr >>= 8;
  121. st_dma.dma_md = (unsigned char)adr;
  122. MFPDELAY();
  123. adr >>= 8;
  124. st_dma.dma_hi = (unsigned char)adr;
  125. MFPDELAY();
  126. }
  127. static inline unsigned long SCSI_DMA_GETADR(void)
  128. {
  129. unsigned long adr;
  130. adr = st_dma.dma_lo;
  131. MFPDELAY();
  132. adr |= (st_dma.dma_md & 0xff) << 8;
  133. MFPDELAY();
  134. adr |= (st_dma.dma_hi & 0xff) << 16;
  135. MFPDELAY();
  136. return adr;
  137. }
  138. static inline void ENABLE_IRQ(void)
  139. {
  140. if (IS_A_TT())
  141. atari_enable_irq(IRQ_TT_MFP_SCSI);
  142. else
  143. atari_enable_irq(IRQ_MFP_FSCSI);
  144. }
  145. static inline void DISABLE_IRQ(void)
  146. {
  147. if (IS_A_TT())
  148. atari_disable_irq(IRQ_TT_MFP_SCSI);
  149. else
  150. atari_disable_irq(IRQ_MFP_FSCSI);
  151. }
  152. #define HOSTDATA_DMALEN (((struct NCR5380_hostdata *) \
  153. (atari_scsi_host->hostdata))->dma_len)
  154. /* Time (in jiffies) to wait after a reset; the SCSI standard calls for 250ms,
  155. * we usually do 0.5s to be on the safe side. But Toshiba CD-ROMs once more
  156. * need ten times the standard value... */
  157. #ifndef CONFIG_ATARI_SCSI_TOSHIBA_DELAY
  158. #define AFTER_RESET_DELAY (HZ/2)
  159. #else
  160. #define AFTER_RESET_DELAY (5*HZ/2)
  161. #endif
  162. /***************************** Prototypes *****************************/
  163. #ifdef REAL_DMA
  164. static int scsi_dma_is_ignored_buserr(unsigned char dma_stat);
  165. static void atari_scsi_fetch_restbytes(void);
  166. static long atari_scsi_dma_residual(struct Scsi_Host *instance);
  167. static int falcon_classify_cmd(Scsi_Cmnd *cmd);
  168. static unsigned long atari_dma_xfer_len(unsigned long wanted_len,
  169. Scsi_Cmnd *cmd, int write_flag);
  170. #endif
  171. static irqreturn_t scsi_tt_intr(int irq, void *dummy);
  172. static irqreturn_t scsi_falcon_intr(int irq, void *dummy);
  173. static void falcon_release_lock_if_possible(struct NCR5380_hostdata *hostdata);
  174. static void falcon_get_lock(void);
  175. #ifdef CONFIG_ATARI_SCSI_RESET_BOOT
  176. static void atari_scsi_reset_boot(void);
  177. #endif
  178. static unsigned char atari_scsi_tt_reg_read(unsigned char reg);
  179. static void atari_scsi_tt_reg_write(unsigned char reg, unsigned char value);
  180. static unsigned char atari_scsi_falcon_reg_read(unsigned char reg);
  181. static void atari_scsi_falcon_reg_write(unsigned char reg, unsigned char value);
  182. /************************* End of Prototypes **************************/
  183. static struct Scsi_Host *atari_scsi_host;
  184. static unsigned char (*atari_scsi_reg_read)(unsigned char reg);
  185. static void (*atari_scsi_reg_write)(unsigned char reg, unsigned char value);
  186. #ifdef REAL_DMA
  187. static unsigned long atari_dma_residual, atari_dma_startaddr;
  188. static short atari_dma_active;
  189. /* pointer to the dribble buffer */
  190. static char *atari_dma_buffer;
  191. /* precalculated physical address of the dribble buffer */
  192. static unsigned long atari_dma_phys_buffer;
  193. /* != 0 tells the Falcon int handler to copy data from the dribble buffer */
  194. static char *atari_dma_orig_addr;
  195. /* size of the dribble buffer; 4k seems enough, since the Falcon cannot use
  196. * scatter-gather anyway, so most transfers are 1024 byte only. In the rare
  197. * cases where requests to physical contiguous buffers have been merged, this
  198. * request is <= 4k (one page). So I don't think we have to split transfers
  199. * just due to this buffer size...
  200. */
  201. #define STRAM_BUFFER_SIZE (4096)
  202. /* mask for address bits that can't be used with the ST-DMA */
  203. static unsigned long atari_dma_stram_mask;
  204. #define STRAM_ADDR(a) (((a) & atari_dma_stram_mask) == 0)
  205. /* number of bytes to cut from a transfer to handle NCR overruns */
  206. static int atari_read_overruns;
  207. #endif
  208. static int setup_can_queue = -1;
  209. module_param(setup_can_queue, int, 0);
  210. static int setup_cmd_per_lun = -1;
  211. module_param(setup_cmd_per_lun, int, 0);
  212. static int setup_sg_tablesize = -1;
  213. module_param(setup_sg_tablesize, int, 0);
  214. #ifdef SUPPORT_TAGS
  215. static int setup_use_tagged_queuing = -1;
  216. module_param(setup_use_tagged_queuing, int, 0);
  217. #endif
  218. static int setup_hostid = -1;
  219. module_param(setup_hostid, int, 0);
  220. #if defined(CONFIG_TT_DMA_EMUL)
  221. #include "atari_dma_emul.c"
  222. #endif
  223. #if defined(REAL_DMA)
  224. static int scsi_dma_is_ignored_buserr(unsigned char dma_stat)
  225. {
  226. int i;
  227. unsigned long addr = SCSI_DMA_READ_P(dma_addr), end_addr;
  228. if (dma_stat & 0x01) {
  229. /* A bus error happens when DMA-ing from the last page of a
  230. * physical memory chunk (DMA prefetch!), but that doesn't hurt.
  231. * Check for this case:
  232. */
  233. for (i = 0; i < m68k_num_memory; ++i) {
  234. end_addr = m68k_memory[i].addr + m68k_memory[i].size;
  235. if (end_addr <= addr && addr <= end_addr + 4)
  236. return 1;
  237. }
  238. }
  239. return 0;
  240. }
  241. #if 0
  242. /* Dead code... wasn't called anyway :-) and causes some trouble, because at
  243. * end-of-DMA, both SCSI ints are triggered simultaneously, so the NCR int has
  244. * to clear the DMA int pending bit before it allows other level 6 interrupts.
  245. */
  246. static void scsi_dma_buserr(int irq, void *dummy)
  247. {
  248. unsigned char dma_stat = tt_scsi_dma.dma_ctrl;
  249. /* Don't do anything if a NCR interrupt is pending. Probably it's just
  250. * masked... */
  251. if (atari_irq_pending(IRQ_TT_MFP_SCSI))
  252. return;
  253. printk("Bad SCSI DMA interrupt! dma_addr=0x%08lx dma_stat=%02x dma_cnt=%08lx\n",
  254. SCSI_DMA_READ_P(dma_addr), dma_stat, SCSI_DMA_READ_P(dma_cnt));
  255. if (dma_stat & 0x80) {
  256. if (!scsi_dma_is_ignored_buserr(dma_stat))
  257. printk("SCSI DMA bus error -- bad DMA programming!\n");
  258. } else {
  259. /* Under normal circumstances we never should get to this point,
  260. * since both interrupts are triggered simultaneously and the 5380
  261. * int has higher priority. When this irq is handled, that DMA
  262. * interrupt is cleared. So a warning message is printed here.
  263. */
  264. printk("SCSI DMA intr ?? -- this shouldn't happen!\n");
  265. }
  266. }
  267. #endif
  268. #endif
  269. static irqreturn_t scsi_tt_intr(int irq, void *dummy)
  270. {
  271. #ifdef REAL_DMA
  272. int dma_stat;
  273. dma_stat = tt_scsi_dma.dma_ctrl;
  274. INT_PRINTK("scsi%d: NCR5380 interrupt, DMA status = %02x\n",
  275. atari_scsi_host->host_no, dma_stat & 0xff);
  276. /* Look if it was the DMA that has interrupted: First possibility
  277. * is that a bus error occurred...
  278. */
  279. if (dma_stat & 0x80) {
  280. if (!scsi_dma_is_ignored_buserr(dma_stat)) {
  281. printk(KERN_ERR "SCSI DMA caused bus error near 0x%08lx\n",
  282. SCSI_DMA_READ_P(dma_addr));
  283. printk(KERN_CRIT "SCSI DMA bus error -- bad DMA programming!");
  284. }
  285. }
  286. /* If the DMA is active but not finished, we have the case
  287. * that some other 5380 interrupt occurred within the DMA transfer.
  288. * This means we have residual bytes, if the desired end address
  289. * is not yet reached. Maybe we have to fetch some bytes from the
  290. * rest data register, too. The residual must be calculated from
  291. * the address pointer, not the counter register, because only the
  292. * addr reg counts bytes not yet written and pending in the rest
  293. * data reg!
  294. */
  295. if ((dma_stat & 0x02) && !(dma_stat & 0x40)) {
  296. atari_dma_residual = HOSTDATA_DMALEN - (SCSI_DMA_READ_P(dma_addr) - atari_dma_startaddr);
  297. DMA_PRINTK("SCSI DMA: There are %ld residual bytes.\n",
  298. atari_dma_residual);
  299. if ((signed int)atari_dma_residual < 0)
  300. atari_dma_residual = 0;
  301. if ((dma_stat & 1) == 0) {
  302. /*
  303. * After read operations, we maybe have to
  304. * transport some rest bytes
  305. */
  306. atari_scsi_fetch_restbytes();
  307. } else {
  308. /*
  309. * There seems to be a nasty bug in some SCSI-DMA/NCR
  310. * combinations: If a target disconnects while a write
  311. * operation is going on, the address register of the
  312. * DMA may be a few bytes farer than it actually read.
  313. * This is probably due to DMA prefetching and a delay
  314. * between DMA and NCR. Experiments showed that the
  315. * dma_addr is 9 bytes to high, but this could vary.
  316. * The problem is, that the residual is thus calculated
  317. * wrong and the next transfer will start behind where
  318. * it should. So we round up the residual to the next
  319. * multiple of a sector size, if it isn't already a
  320. * multiple and the originally expected transfer size
  321. * was. The latter condition is there to ensure that
  322. * the correction is taken only for "real" data
  323. * transfers and not for, e.g., the parameters of some
  324. * other command. These shouldn't disconnect anyway.
  325. */
  326. if (atari_dma_residual & 0x1ff) {
  327. DMA_PRINTK("SCSI DMA: DMA bug corrected, "
  328. "difference %ld bytes\n",
  329. 512 - (atari_dma_residual & 0x1ff));
  330. atari_dma_residual = (atari_dma_residual + 511) & ~0x1ff;
  331. }
  332. }
  333. tt_scsi_dma.dma_ctrl = 0;
  334. }
  335. /* If the DMA is finished, fetch the rest bytes and turn it off */
  336. if (dma_stat & 0x40) {
  337. atari_dma_residual = 0;
  338. if ((dma_stat & 1) == 0)
  339. atari_scsi_fetch_restbytes();
  340. tt_scsi_dma.dma_ctrl = 0;
  341. }
  342. #endif /* REAL_DMA */
  343. NCR5380_intr(irq, dummy);
  344. #if 0
  345. /* To be sure the int is not masked */
  346. atari_enable_irq(IRQ_TT_MFP_SCSI);
  347. #endif
  348. return IRQ_HANDLED;
  349. }
  350. static irqreturn_t scsi_falcon_intr(int irq, void *dummy)
  351. {
  352. #ifdef REAL_DMA
  353. int dma_stat;
  354. /* Turn off DMA and select sector counter register before
  355. * accessing the status register (Atari recommendation!)
  356. */
  357. st_dma.dma_mode_status = 0x90;
  358. dma_stat = st_dma.dma_mode_status;
  359. /* Bit 0 indicates some error in the DMA process... don't know
  360. * what happened exactly (no further docu).
  361. */
  362. if (!(dma_stat & 0x01)) {
  363. /* DMA error */
  364. printk(KERN_CRIT "SCSI DMA error near 0x%08lx!\n", SCSI_DMA_GETADR());
  365. }
  366. /* If the DMA was active, but now bit 1 is not clear, it is some
  367. * other 5380 interrupt that finishes the DMA transfer. We have to
  368. * calculate the number of residual bytes and give a warning if
  369. * bytes are stuck in the ST-DMA fifo (there's no way to reach them!)
  370. */
  371. if (atari_dma_active && (dma_stat & 0x02)) {
  372. unsigned long transferred;
  373. transferred = SCSI_DMA_GETADR() - atari_dma_startaddr;
  374. /* The ST-DMA address is incremented in 2-byte steps, but the
  375. * data are written only in 16-byte chunks. If the number of
  376. * transferred bytes is not divisible by 16, the remainder is
  377. * lost somewhere in outer space.
  378. */
  379. if (transferred & 15)
  380. printk(KERN_ERR "SCSI DMA error: %ld bytes lost in "
  381. "ST-DMA fifo\n", transferred & 15);
  382. atari_dma_residual = HOSTDATA_DMALEN - transferred;
  383. DMA_PRINTK("SCSI DMA: There are %ld residual bytes.\n",
  384. atari_dma_residual);
  385. } else
  386. atari_dma_residual = 0;
  387. atari_dma_active = 0;
  388. if (atari_dma_orig_addr) {
  389. /* If the dribble buffer was used on a read operation, copy the DMA-ed
  390. * data to the original destination address.
  391. */
  392. memcpy(atari_dma_orig_addr, phys_to_virt(atari_dma_startaddr),
  393. HOSTDATA_DMALEN - atari_dma_residual);
  394. atari_dma_orig_addr = NULL;
  395. }
  396. #endif /* REAL_DMA */
  397. NCR5380_intr(irq, dummy);
  398. return IRQ_HANDLED;
  399. }
  400. #ifdef REAL_DMA
  401. static void atari_scsi_fetch_restbytes(void)
  402. {
  403. int nr;
  404. char *src, *dst;
  405. unsigned long phys_dst;
  406. /* fetch rest bytes in the DMA register */
  407. phys_dst = SCSI_DMA_READ_P(dma_addr);
  408. nr = phys_dst & 3;
  409. if (nr) {
  410. /* there are 'nr' bytes left for the last long address
  411. before the DMA pointer */
  412. phys_dst ^= nr;
  413. DMA_PRINTK("SCSI DMA: there are %d rest bytes for phys addr 0x%08lx",
  414. nr, phys_dst);
  415. /* The content of the DMA pointer is a physical address! */
  416. dst = phys_to_virt(phys_dst);
  417. DMA_PRINTK(" = virt addr %p\n", dst);
  418. for (src = (char *)&tt_scsi_dma.dma_restdata; nr != 0; --nr)
  419. *dst++ = *src++;
  420. }
  421. }
  422. #endif /* REAL_DMA */
  423. static int falcon_got_lock = 0;
  424. static DECLARE_WAIT_QUEUE_HEAD(falcon_fairness_wait);
  425. static int falcon_trying_lock = 0;
  426. static DECLARE_WAIT_QUEUE_HEAD(falcon_try_wait);
  427. static int falcon_dont_release = 0;
  428. /* This function releases the lock on the DMA chip if there is no
  429. * connected command and the disconnected queue is empty. On
  430. * releasing, instances of falcon_get_lock are awoken, that put
  431. * themselves to sleep for fairness. They can now try to get the lock
  432. * again (but others waiting longer more probably will win).
  433. */
  434. static void falcon_release_lock_if_possible(struct NCR5380_hostdata *hostdata)
  435. {
  436. unsigned long flags;
  437. if (IS_A_TT())
  438. return;
  439. local_irq_save(flags);
  440. if (falcon_got_lock && !hostdata->disconnected_queue &&
  441. !hostdata->issue_queue && !hostdata->connected) {
  442. if (falcon_dont_release) {
  443. #if 0
  444. printk("WARNING: Lock release not allowed. Ignored\n");
  445. #endif
  446. local_irq_restore(flags);
  447. return;
  448. }
  449. falcon_got_lock = 0;
  450. stdma_release();
  451. wake_up(&falcon_fairness_wait);
  452. }
  453. local_irq_restore(flags);
  454. }
  455. /* This function manages the locking of the ST-DMA.
  456. * If the DMA isn't locked already for SCSI, it tries to lock it by
  457. * calling stdma_lock(). But if the DMA is locked by the SCSI code and
  458. * there are other drivers waiting for the chip, we do not issue the
  459. * command immediately but wait on 'falcon_fairness_queue'. We will be
  460. * waked up when the DMA is unlocked by some SCSI interrupt. After that
  461. * we try to get the lock again.
  462. * But we must be prepared that more than one instance of
  463. * falcon_get_lock() is waiting on the fairness queue. They should not
  464. * try all at once to call stdma_lock(), one is enough! For that, the
  465. * first one sets 'falcon_trying_lock', others that see that variable
  466. * set wait on the queue 'falcon_try_wait'.
  467. * Complicated, complicated.... Sigh...
  468. */
  469. static void falcon_get_lock(void)
  470. {
  471. unsigned long flags;
  472. if (IS_A_TT())
  473. return;
  474. local_irq_save(flags);
  475. while (!in_irq() && falcon_got_lock && stdma_others_waiting())
  476. sleep_on(&falcon_fairness_wait);
  477. while (!falcon_got_lock) {
  478. if (in_irq())
  479. panic("Falcon SCSI hasn't ST-DMA lock in interrupt");
  480. if (!falcon_trying_lock) {
  481. falcon_trying_lock = 1;
  482. stdma_lock(scsi_falcon_intr, NULL);
  483. falcon_got_lock = 1;
  484. falcon_trying_lock = 0;
  485. wake_up(&falcon_try_wait);
  486. } else {
  487. sleep_on(&falcon_try_wait);
  488. }
  489. }
  490. local_irq_restore(flags);
  491. if (!falcon_got_lock)
  492. panic("Falcon SCSI: someone stole the lock :-(\n");
  493. }
  494. /* This is the wrapper function for NCR5380_queue_command(). It just
  495. * tries to get the lock on the ST-DMA (see above) and then calls the
  496. * original function.
  497. */
  498. #if 0
  499. int atari_queue_command(Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
  500. {
  501. /* falcon_get_lock();
  502. * ++guenther: moved to NCR5380_queue_command() to prevent
  503. * race condition, see there for an explanation.
  504. */
  505. return NCR5380_queue_command(cmd, done);
  506. }
  507. #endif
  508. int atari_scsi_detect(struct scsi_host_template *host)
  509. {
  510. static int called = 0;
  511. struct Scsi_Host *instance;
  512. if (!MACH_IS_ATARI ||
  513. (!ATARIHW_PRESENT(ST_SCSI) && !ATARIHW_PRESENT(TT_SCSI)) ||
  514. called)
  515. return 0;
  516. host->proc_name = "Atari";
  517. atari_scsi_reg_read = IS_A_TT() ? atari_scsi_tt_reg_read :
  518. atari_scsi_falcon_reg_read;
  519. atari_scsi_reg_write = IS_A_TT() ? atari_scsi_tt_reg_write :
  520. atari_scsi_falcon_reg_write;
  521. /* setup variables */
  522. host->can_queue =
  523. (setup_can_queue > 0) ? setup_can_queue :
  524. IS_A_TT() ? ATARI_TT_CAN_QUEUE : ATARI_FALCON_CAN_QUEUE;
  525. host->cmd_per_lun =
  526. (setup_cmd_per_lun > 0) ? setup_cmd_per_lun :
  527. IS_A_TT() ? ATARI_TT_CMD_PER_LUN : ATARI_FALCON_CMD_PER_LUN;
  528. /* Force sg_tablesize to 0 on a Falcon! */
  529. host->sg_tablesize =
  530. !IS_A_TT() ? ATARI_FALCON_SG_TABLESIZE :
  531. (setup_sg_tablesize >= 0) ? setup_sg_tablesize : ATARI_TT_SG_TABLESIZE;
  532. if (setup_hostid >= 0)
  533. host->this_id = setup_hostid;
  534. else {
  535. /* use 7 as default */
  536. host->this_id = 7;
  537. /* Test if a host id is set in the NVRam */
  538. if (ATARIHW_PRESENT(TT_CLK) && nvram_check_checksum()) {
  539. unsigned char b = nvram_read_byte( 14 );
  540. /* Arbitration enabled? (for TOS) If yes, use configured host ID */
  541. if (b & 0x80)
  542. host->this_id = b & 7;
  543. }
  544. }
  545. #ifdef SUPPORT_TAGS
  546. if (setup_use_tagged_queuing < 0)
  547. setup_use_tagged_queuing = DEFAULT_USE_TAGGED_QUEUING;
  548. #endif
  549. #ifdef REAL_DMA
  550. /* If running on a Falcon and if there's TT-Ram (i.e., more than one
  551. * memory block, since there's always ST-Ram in a Falcon), then allocate a
  552. * STRAM_BUFFER_SIZE byte dribble buffer for transfers from/to alternative
  553. * Ram.
  554. */
  555. if (MACH_IS_ATARI && ATARIHW_PRESENT(ST_SCSI) &&
  556. !ATARIHW_PRESENT(EXTD_DMA) && m68k_num_memory > 1) {
  557. atari_dma_buffer = atari_stram_alloc(STRAM_BUFFER_SIZE, "SCSI");
  558. if (!atari_dma_buffer) {
  559. printk(KERN_ERR "atari_scsi_detect: can't allocate ST-RAM "
  560. "double buffer\n");
  561. return 0;
  562. }
  563. atari_dma_phys_buffer = virt_to_phys(atari_dma_buffer);
  564. atari_dma_orig_addr = 0;
  565. }
  566. #endif
  567. instance = scsi_register(host, sizeof(struct NCR5380_hostdata));
  568. if (instance == NULL) {
  569. atari_stram_free(atari_dma_buffer);
  570. atari_dma_buffer = 0;
  571. return 0;
  572. }
  573. atari_scsi_host = instance;
  574. /*
  575. * Set irq to 0, to avoid that the mid-level code disables our interrupt
  576. * during queue_command calls. This is completely unnecessary, and even
  577. * worse causes bad problems on the Falcon, where the int is shared with
  578. * IDE and floppy!
  579. */
  580. instance->irq = 0;
  581. #ifdef CONFIG_ATARI_SCSI_RESET_BOOT
  582. atari_scsi_reset_boot();
  583. #endif
  584. NCR5380_init(instance, 0);
  585. if (IS_A_TT()) {
  586. /* This int is actually "pseudo-slow", i.e. it acts like a slow
  587. * interrupt after having cleared the pending flag for the DMA
  588. * interrupt. */
  589. if (request_irq(IRQ_TT_MFP_SCSI, scsi_tt_intr, IRQ_TYPE_SLOW,
  590. "SCSI NCR5380", instance)) {
  591. printk(KERN_ERR "atari_scsi_detect: cannot allocate irq %d, aborting",IRQ_TT_MFP_SCSI);
  592. scsi_unregister(atari_scsi_host);
  593. atari_stram_free(atari_dma_buffer);
  594. atari_dma_buffer = 0;
  595. return 0;
  596. }
  597. tt_mfp.active_edge |= 0x80; /* SCSI int on L->H */
  598. #ifdef REAL_DMA
  599. tt_scsi_dma.dma_ctrl = 0;
  600. atari_dma_residual = 0;
  601. #ifdef CONFIG_TT_DMA_EMUL
  602. if (MACH_IS_HADES) {
  603. if (request_irq(IRQ_AUTO_2, hades_dma_emulator,
  604. IRQ_TYPE_PRIO, "Hades DMA emulator",
  605. hades_dma_emulator)) {
  606. printk(KERN_ERR "atari_scsi_detect: cannot allocate irq %d, aborting (MACH_IS_HADES)",IRQ_AUTO_2);
  607. free_irq(IRQ_TT_MFP_SCSI, instance);
  608. scsi_unregister(atari_scsi_host);
  609. atari_stram_free(atari_dma_buffer);
  610. atari_dma_buffer = 0;
  611. return 0;
  612. }
  613. }
  614. #endif
  615. if (MACH_IS_MEDUSA || MACH_IS_HADES) {
  616. /* While the read overruns (described by Drew Eckhardt in
  617. * NCR5380.c) never happened on TTs, they do in fact on the Medusa
  618. * (This was the cause why SCSI didn't work right for so long
  619. * there.) Since handling the overruns slows down a bit, I turned
  620. * the #ifdef's into a runtime condition.
  621. *
  622. * In principle it should be sufficient to do max. 1 byte with
  623. * PIO, but there is another problem on the Medusa with the DMA
  624. * rest data register. So 'atari_read_overruns' is currently set
  625. * to 4 to avoid having transfers that aren't a multiple of 4. If
  626. * the rest data bug is fixed, this can be lowered to 1.
  627. */
  628. atari_read_overruns = 4;
  629. }
  630. #endif /*REAL_DMA*/
  631. } else { /* ! IS_A_TT */
  632. /* Nothing to do for the interrupt: the ST-DMA is initialized
  633. * already by atari_init_INTS()
  634. */
  635. #ifdef REAL_DMA
  636. atari_dma_residual = 0;
  637. atari_dma_active = 0;
  638. atari_dma_stram_mask = (ATARIHW_PRESENT(EXTD_DMA) ? 0x00000000
  639. : 0xff000000);
  640. #endif
  641. }
  642. printk(KERN_INFO "scsi%d: options CAN_QUEUE=%d CMD_PER_LUN=%d SCAT-GAT=%d "
  643. #ifdef SUPPORT_TAGS
  644. "TAGGED-QUEUING=%s "
  645. #endif
  646. "HOSTID=%d",
  647. instance->host_no, instance->hostt->can_queue,
  648. instance->hostt->cmd_per_lun,
  649. instance->hostt->sg_tablesize,
  650. #ifdef SUPPORT_TAGS
  651. setup_use_tagged_queuing ? "yes" : "no",
  652. #endif
  653. instance->hostt->this_id );
  654. NCR5380_print_options(instance);
  655. printk("\n");
  656. called = 1;
  657. return 1;
  658. }
  659. int atari_scsi_release(struct Scsi_Host *sh)
  660. {
  661. if (IS_A_TT())
  662. free_irq(IRQ_TT_MFP_SCSI, sh);
  663. if (atari_dma_buffer)
  664. atari_stram_free(atari_dma_buffer);
  665. return 1;
  666. }
  667. void __init atari_scsi_setup(char *str, int *ints)
  668. {
  669. /* Format of atascsi parameter is:
  670. * atascsi=<can_queue>,<cmd_per_lun>,<sg_tablesize>,<hostid>,<use_tags>
  671. * Defaults depend on TT or Falcon, hostid determined at run time.
  672. * Negative values mean don't change.
  673. */
  674. if (ints[0] < 1) {
  675. printk("atari_scsi_setup: no arguments!\n");
  676. return;
  677. }
  678. if (ints[0] >= 1) {
  679. if (ints[1] > 0)
  680. /* no limits on this, just > 0 */
  681. setup_can_queue = ints[1];
  682. }
  683. if (ints[0] >= 2) {
  684. if (ints[2] > 0)
  685. setup_cmd_per_lun = ints[2];
  686. }
  687. if (ints[0] >= 3) {
  688. if (ints[3] >= 0) {
  689. setup_sg_tablesize = ints[3];
  690. /* Must be <= SG_ALL (255) */
  691. if (setup_sg_tablesize > SG_ALL)
  692. setup_sg_tablesize = SG_ALL;
  693. }
  694. }
  695. if (ints[0] >= 4) {
  696. /* Must be between 0 and 7 */
  697. if (ints[4] >= 0 && ints[4] <= 7)
  698. setup_hostid = ints[4];
  699. else if (ints[4] > 7)
  700. printk("atari_scsi_setup: invalid host ID %d !\n", ints[4]);
  701. }
  702. #ifdef SUPPORT_TAGS
  703. if (ints[0] >= 5) {
  704. if (ints[5] >= 0)
  705. setup_use_tagged_queuing = !!ints[5];
  706. }
  707. #endif
  708. }
  709. int atari_scsi_bus_reset(Scsi_Cmnd *cmd)
  710. {
  711. int rv;
  712. struct NCR5380_hostdata *hostdata =
  713. (struct NCR5380_hostdata *)cmd->device->host->hostdata;
  714. /* For doing the reset, SCSI interrupts must be disabled first,
  715. * since the 5380 raises its IRQ line while _RST is active and we
  716. * can't disable interrupts completely, since we need the timer.
  717. */
  718. /* And abort a maybe active DMA transfer */
  719. if (IS_A_TT()) {
  720. atari_turnoff_irq(IRQ_TT_MFP_SCSI);
  721. #ifdef REAL_DMA
  722. tt_scsi_dma.dma_ctrl = 0;
  723. #endif /* REAL_DMA */
  724. } else {
  725. atari_turnoff_irq(IRQ_MFP_FSCSI);
  726. #ifdef REAL_DMA
  727. st_dma.dma_mode_status = 0x90;
  728. atari_dma_active = 0;
  729. atari_dma_orig_addr = NULL;
  730. #endif /* REAL_DMA */
  731. }
  732. rv = NCR5380_bus_reset(cmd);
  733. /* Re-enable ints */
  734. if (IS_A_TT()) {
  735. atari_turnon_irq(IRQ_TT_MFP_SCSI);
  736. } else {
  737. atari_turnon_irq(IRQ_MFP_FSCSI);
  738. }
  739. if ((rv & SCSI_RESET_ACTION) == SCSI_RESET_SUCCESS)
  740. falcon_release_lock_if_possible(hostdata);
  741. return rv;
  742. }
  743. #ifdef CONFIG_ATARI_SCSI_RESET_BOOT
  744. static void __init atari_scsi_reset_boot(void)
  745. {
  746. unsigned long end;
  747. /*
  748. * Do a SCSI reset to clean up the bus during initialization. No messing
  749. * with the queues, interrupts, or locks necessary here.
  750. */
  751. printk("Atari SCSI: resetting the SCSI bus...");
  752. /* get in phase */
  753. NCR5380_write(TARGET_COMMAND_REG,
  754. PHASE_SR_TO_TCR(NCR5380_read(STATUS_REG)));
  755. /* assert RST */
  756. NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_RST);
  757. /* The min. reset hold time is 25us, so 40us should be enough */
  758. udelay(50);
  759. /* reset RST and interrupt */
  760. NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
  761. NCR5380_read(RESET_PARITY_INTERRUPT_REG);
  762. end = jiffies + AFTER_RESET_DELAY;
  763. while (time_before(jiffies, end))
  764. barrier();
  765. printk(" done\n");
  766. }
  767. #endif
  768. const char *atari_scsi_info(struct Scsi_Host *host)
  769. {
  770. /* atari_scsi_detect() is verbose enough... */
  771. static const char string[] = "Atari native SCSI";
  772. return string;
  773. }
  774. #if defined(REAL_DMA)
  775. unsigned long atari_scsi_dma_setup(struct Scsi_Host *instance, void *data,
  776. unsigned long count, int dir)
  777. {
  778. unsigned long addr = virt_to_phys(data);
  779. DMA_PRINTK("scsi%d: setting up dma, data = %p, phys = %lx, count = %ld, "
  780. "dir = %d\n", instance->host_no, data, addr, count, dir);
  781. if (!IS_A_TT() && !STRAM_ADDR(addr)) {
  782. /* If we have a non-DMAable address on a Falcon, use the dribble
  783. * buffer; 'orig_addr' != 0 in the read case tells the interrupt
  784. * handler to copy data from the dribble buffer to the originally
  785. * wanted address.
  786. */
  787. if (dir)
  788. memcpy(atari_dma_buffer, data, count);
  789. else
  790. atari_dma_orig_addr = data;
  791. addr = atari_dma_phys_buffer;
  792. }
  793. atari_dma_startaddr = addr; /* Needed for calculating residual later. */
  794. /* Cache cleanup stuff: On writes, push any dirty cache out before sending
  795. * it to the peripheral. (Must be done before DMA setup, since at least
  796. * the ST-DMA begins to fill internal buffers right after setup. For
  797. * reads, invalidate any cache, may be altered after DMA without CPU
  798. * knowledge.
  799. *
  800. * ++roman: For the Medusa, there's no need at all for that cache stuff,
  801. * because the hardware does bus snooping (fine!).
  802. */
  803. dma_cache_maintenance(addr, count, dir);
  804. if (count == 0)
  805. printk(KERN_NOTICE "SCSI warning: DMA programmed for 0 bytes !\n");
  806. if (IS_A_TT()) {
  807. tt_scsi_dma.dma_ctrl = dir;
  808. SCSI_DMA_WRITE_P(dma_addr, addr);
  809. SCSI_DMA_WRITE_P(dma_cnt, count);
  810. tt_scsi_dma.dma_ctrl = dir | 2;
  811. } else { /* ! IS_A_TT */
  812. /* set address */
  813. SCSI_DMA_SETADR(addr);
  814. /* toggle direction bit to clear FIFO and set DMA direction */
  815. dir <<= 8;
  816. st_dma.dma_mode_status = 0x90 | dir;
  817. st_dma.dma_mode_status = 0x90 | (dir ^ 0x100);
  818. st_dma.dma_mode_status = 0x90 | dir;
  819. udelay(40);
  820. /* On writes, round up the transfer length to the next multiple of 512
  821. * (see also comment at atari_dma_xfer_len()). */
  822. st_dma.fdc_acces_seccount = (count + (dir ? 511 : 0)) >> 9;
  823. udelay(40);
  824. st_dma.dma_mode_status = 0x10 | dir;
  825. udelay(40);
  826. /* need not restore value of dir, only boolean value is tested */
  827. atari_dma_active = 1;
  828. }
  829. return count;
  830. }
  831. static long atari_scsi_dma_residual(struct Scsi_Host *instance)
  832. {
  833. return atari_dma_residual;
  834. }
  835. #define CMD_SURELY_BLOCK_MODE 0
  836. #define CMD_SURELY_BYTE_MODE 1
  837. #define CMD_MODE_UNKNOWN 2
  838. static int falcon_classify_cmd(Scsi_Cmnd *cmd)
  839. {
  840. unsigned char opcode = cmd->cmnd[0];
  841. if (opcode == READ_DEFECT_DATA || opcode == READ_LONG ||
  842. opcode == READ_BUFFER)
  843. return CMD_SURELY_BYTE_MODE;
  844. else if (opcode == READ_6 || opcode == READ_10 ||
  845. opcode == 0xa8 /* READ_12 */ || opcode == READ_REVERSE ||
  846. opcode == RECOVER_BUFFERED_DATA) {
  847. /* In case of a sequential-access target (tape), special care is
  848. * needed here: The transfer is block-mode only if the 'fixed' bit is
  849. * set! */
  850. if (cmd->device->type == TYPE_TAPE && !(cmd->cmnd[1] & 1))
  851. return CMD_SURELY_BYTE_MODE;
  852. else
  853. return CMD_SURELY_BLOCK_MODE;
  854. } else
  855. return CMD_MODE_UNKNOWN;
  856. }
  857. /* This function calculates the number of bytes that can be transferred via
  858. * DMA. On the TT, this is arbitrary, but on the Falcon we have to use the
  859. * ST-DMA chip. There are only multiples of 512 bytes possible and max.
  860. * 255*512 bytes :-( This means also, that defining READ_OVERRUNS is not
  861. * possible on the Falcon, since that would require to program the DMA for
  862. * n*512 - atari_read_overrun bytes. But it seems that the Falcon doesn't have
  863. * the overrun problem, so this question is academic :-)
  864. */
  865. static unsigned long atari_dma_xfer_len(unsigned long wanted_len,
  866. Scsi_Cmnd *cmd, int write_flag)
  867. {
  868. unsigned long possible_len, limit;
  869. #ifndef CONFIG_TT_DMA_EMUL
  870. if (MACH_IS_HADES)
  871. /* Hades has no SCSI DMA at all :-( Always force use of PIO */
  872. return 0;
  873. #endif
  874. if (IS_A_TT())
  875. /* TT SCSI DMA can transfer arbitrary #bytes */
  876. return wanted_len;
  877. /* ST DMA chip is stupid -- only multiples of 512 bytes! (and max.
  878. * 255*512 bytes, but this should be enough)
  879. *
  880. * ++roman: Aaargl! Another Falcon-SCSI problem... There are some commands
  881. * that return a number of bytes which cannot be known beforehand. In this
  882. * case, the given transfer length is an "allocation length". Now it
  883. * can happen that this allocation length is a multiple of 512 bytes and
  884. * the DMA is used. But if not n*512 bytes really arrive, some input data
  885. * will be lost in the ST-DMA's FIFO :-( Thus, we have to distinguish
  886. * between commands that do block transfers and those that do byte
  887. * transfers. But this isn't easy... there are lots of vendor specific
  888. * commands, and the user can issue any command via the
  889. * SCSI_IOCTL_SEND_COMMAND.
  890. *
  891. * The solution: We classify SCSI commands in 1) surely block-mode cmd.s,
  892. * 2) surely byte-mode cmd.s and 3) cmd.s with unknown mode. In case 1)
  893. * and 3), the thing to do is obvious: allow any number of blocks via DMA
  894. * or none. In case 2), we apply some heuristic: Byte mode is assumed if
  895. * the transfer (allocation) length is < 1024, hoping that no cmd. not
  896. * explicitly known as byte mode have such big allocation lengths...
  897. * BTW, all the discussion above applies only to reads. DMA writes are
  898. * unproblematic anyways, since the targets aborts the transfer after
  899. * receiving a sufficient number of bytes.
  900. *
  901. * Another point: If the transfer is from/to an non-ST-RAM address, we
  902. * use the dribble buffer and thus can do only STRAM_BUFFER_SIZE bytes.
  903. */
  904. if (write_flag) {
  905. /* Write operation can always use the DMA, but the transfer size must
  906. * be rounded up to the next multiple of 512 (atari_dma_setup() does
  907. * this).
  908. */
  909. possible_len = wanted_len;
  910. } else {
  911. /* Read operations: if the wanted transfer length is not a multiple of
  912. * 512, we cannot use DMA, since the ST-DMA cannot split transfers
  913. * (no interrupt on DMA finished!)
  914. */
  915. if (wanted_len & 0x1ff)
  916. possible_len = 0;
  917. else {
  918. /* Now classify the command (see above) and decide whether it is
  919. * allowed to do DMA at all */
  920. switch (falcon_classify_cmd(cmd)) {
  921. case CMD_SURELY_BLOCK_MODE:
  922. possible_len = wanted_len;
  923. break;
  924. case CMD_SURELY_BYTE_MODE:
  925. possible_len = 0; /* DMA prohibited */
  926. break;
  927. case CMD_MODE_UNKNOWN:
  928. default:
  929. /* For unknown commands assume block transfers if the transfer
  930. * size/allocation length is >= 1024 */
  931. possible_len = (wanted_len < 1024) ? 0 : wanted_len;
  932. break;
  933. }
  934. }
  935. }
  936. /* Last step: apply the hard limit on DMA transfers */
  937. limit = (atari_dma_buffer && !STRAM_ADDR(virt_to_phys(cmd->SCp.ptr))) ?
  938. STRAM_BUFFER_SIZE : 255*512;
  939. if (possible_len > limit)
  940. possible_len = limit;
  941. if (possible_len != wanted_len)
  942. DMA_PRINTK("Sorry, must cut DMA transfer size to %ld bytes "
  943. "instead of %ld\n", possible_len, wanted_len);
  944. return possible_len;
  945. }
  946. #endif /* REAL_DMA */
  947. /* NCR5380 register access functions
  948. *
  949. * There are separate functions for TT and Falcon, because the access
  950. * methods are quite different. The calling macros NCR5380_read and
  951. * NCR5380_write call these functions via function pointers.
  952. */
  953. static unsigned char atari_scsi_tt_reg_read(unsigned char reg)
  954. {
  955. return tt_scsi_regp[reg * 2];
  956. }
  957. static void atari_scsi_tt_reg_write(unsigned char reg, unsigned char value)
  958. {
  959. tt_scsi_regp[reg * 2] = value;
  960. }
  961. static unsigned char atari_scsi_falcon_reg_read(unsigned char reg)
  962. {
  963. dma_wd.dma_mode_status= (u_short)(0x88 + reg);
  964. return (u_char)dma_wd.fdc_acces_seccount;
  965. }
  966. static void atari_scsi_falcon_reg_write(unsigned char reg, unsigned char value)
  967. {
  968. dma_wd.dma_mode_status = (u_short)(0x88 + reg);
  969. dma_wd.fdc_acces_seccount = (u_short)value;
  970. }
  971. #include "atari_NCR5380.c"
  972. static struct scsi_host_template driver_template = {
  973. .proc_info = atari_scsi_proc_info,
  974. .name = "Atari native SCSI",
  975. .detect = atari_scsi_detect,
  976. .release = atari_scsi_release,
  977. .info = atari_scsi_info,
  978. .queuecommand = atari_scsi_queue_command,
  979. .eh_abort_handler = atari_scsi_abort,
  980. .eh_bus_reset_handler = atari_scsi_bus_reset,
  981. .can_queue = 0, /* initialized at run-time */
  982. .this_id = 0, /* initialized at run-time */
  983. .sg_tablesize = 0, /* initialized at run-time */
  984. .cmd_per_lun = 0, /* initialized at run-time */
  985. .use_clustering = DISABLE_CLUSTERING
  986. };
  987. #include "scsi_module.c"
  988. MODULE_LICENSE("GPL");