mac_esp.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754
  1. /*
  2. * 68k mac 53c9[46] scsi driver
  3. *
  4. * copyright (c) 1998, David Weis weisd3458@uni.edu
  5. *
  6. * debugging on Quadra 800 and 660AV Michael Schmitz, Dave Kilzer 7/98
  7. *
  8. * based loosely on cyber_esp.c
  9. */
  10. /* these are unused for now */
  11. #define myreadl(addr) (*(volatile unsigned int *) (addr))
  12. #define mywritel(b, addr) ((*(volatile unsigned int *) (addr)) = (b))
  13. #include <linux/kernel.h>
  14. #include <linux/delay.h>
  15. #include <linux/types.h>
  16. #include <linux/ctype.h>
  17. #include <linux/string.h>
  18. #include <linux/slab.h>
  19. #include <linux/blkdev.h>
  20. #include <linux/proc_fs.h>
  21. #include <linux/stat.h>
  22. #include <linux/init.h>
  23. #include <linux/interrupt.h>
  24. #include "scsi.h"
  25. #include <scsi/scsi_host.h>
  26. #include "NCR53C9x.h"
  27. #include <asm/io.h>
  28. #include <asm/setup.h>
  29. #include <asm/irq.h>
  30. #include <asm/macints.h>
  31. #include <asm/machw.h>
  32. #include <asm/mac_via.h>
  33. #include <asm/pgtable.h>
  34. #include <asm/macintosh.h>
  35. /* #define DEBUG_MAC_ESP */
  36. #define mac_turnon_irq(x) mac_enable_irq(x)
  37. #define mac_turnoff_irq(x) mac_disable_irq(x)
  38. extern void esp_handle(struct NCR_ESP *esp);
  39. extern void mac_esp_intr(int irq, void *dev_id, struct pt_regs *pregs);
  40. static int dma_bytes_sent(struct NCR_ESP * esp, int fifo_count);
  41. static int dma_can_transfer(struct NCR_ESP * esp, Scsi_Cmnd *sp);
  42. static void dma_dump_state(struct NCR_ESP * esp);
  43. static void dma_init_read(struct NCR_ESP * esp, char * vaddress, int length);
  44. static void dma_init_write(struct NCR_ESP * esp, char * vaddress, int length);
  45. static void dma_ints_off(struct NCR_ESP * esp);
  46. static void dma_ints_on(struct NCR_ESP * esp);
  47. static int dma_irq_p(struct NCR_ESP * esp);
  48. static int dma_irq_p_quick(struct NCR_ESP * esp);
  49. static void dma_led_off(struct NCR_ESP * esp);
  50. static void dma_led_on(struct NCR_ESP *esp);
  51. static int dma_ports_p(struct NCR_ESP *esp);
  52. static void dma_setup(struct NCR_ESP * esp, __u32 addr, int count, int write);
  53. static void dma_setup_quick(struct NCR_ESP * esp, __u32 addr, int count, int write);
  54. static int esp_dafb_dma_irq_p(struct NCR_ESP * espdev);
  55. static int esp_iosb_dma_irq_p(struct NCR_ESP * espdev);
  56. static volatile unsigned char cmd_buffer[16];
  57. /* This is where all commands are put
  58. * before they are transferred to the ESP chip
  59. * via PIO.
  60. */
  61. static int esp_initialized = 0;
  62. static int setup_num_esps = -1;
  63. static int setup_disconnect = -1;
  64. static int setup_nosync = -1;
  65. static int setup_can_queue = -1;
  66. static int setup_cmd_per_lun = -1;
  67. static int setup_sg_tablesize = -1;
  68. #ifdef SUPPORT_TAGS
  69. static int setup_use_tagged_queuing = -1;
  70. #endif
  71. static int setup_hostid = -1;
  72. /*
  73. * Experimental ESP inthandler; check macints.c to make sure dev_id is
  74. * set up properly!
  75. */
  76. void mac_esp_intr(int irq, void *dev_id, struct pt_regs *pregs)
  77. {
  78. struct NCR_ESP *esp = (struct NCR_ESP *) dev_id;
  79. int irq_p = 0;
  80. /* Handle the one ESP interrupt showing at this IRQ level. */
  81. if(((esp)->irq & 0xff) == irq) {
  82. /*
  83. * Debug ..
  84. */
  85. irq_p = esp->dma_irq_p(esp);
  86. printk("mac_esp: irq_p %x current %p disconnected %p\n",
  87. irq_p, esp->current_SC, esp->disconnected_SC);
  88. /*
  89. * Mac: if we're here, it's an ESP interrupt for sure!
  90. */
  91. if((esp->current_SC || esp->disconnected_SC)) {
  92. esp->dma_ints_off(esp);
  93. ESPIRQ(("I%d(", esp->esp_id));
  94. esp_handle(esp);
  95. ESPIRQ((")"));
  96. esp->dma_ints_on(esp);
  97. }
  98. }
  99. }
  100. /*
  101. * Debug hooks; use for playing with the interrupt flag testing and interrupt
  102. * acknowledge on the various machines
  103. */
  104. void scsi_esp_polled(int irq, void *dev_id, struct pt_regs *pregs)
  105. {
  106. if (esp_initialized == 0)
  107. return;
  108. mac_esp_intr(irq, dev_id, pregs);
  109. }
  110. void fake_intr(int irq, void *dev_id, struct pt_regs *pregs)
  111. {
  112. #ifdef DEBUG_MAC_ESP
  113. printk("mac_esp: got irq\n");
  114. #endif
  115. mac_esp_intr(irq, dev_id, pregs);
  116. }
  117. irqreturn_t fake_drq(int irq, void *dev_id, struct pt_regs *pregs)
  118. {
  119. printk("mac_esp: got drq\n");
  120. return IRQ_HANDLED;
  121. }
  122. #define DRIVER_SETUP
  123. /*
  124. * Function : mac_esp_setup(char *str)
  125. *
  126. * Purpose : booter command line initialization of the overrides array,
  127. *
  128. * Inputs : str - parameters, separated by commas.
  129. *
  130. * Currently unused in the new driver; need to add settable parameters to the
  131. * detect function.
  132. *
  133. */
  134. static int __init mac_esp_setup(char *str) {
  135. #ifdef DRIVER_SETUP
  136. /* Format of mac53c9x parameter is:
  137. * mac53c9x=<num_esps>,<disconnect>,<nosync>,<can_queue>,<cmd_per_lun>,<sg_tablesize>,<hostid>,<use_tags>
  138. * Negative values mean don't change.
  139. */
  140. char *this_opt;
  141. long opt;
  142. this_opt = strsep (&str, ",");
  143. if(this_opt) {
  144. opt = simple_strtol( this_opt, NULL, 0 );
  145. if (opt >= 0 && opt <= 2)
  146. setup_num_esps = opt;
  147. else if (opt > 2)
  148. printk( "mac_esp_setup: invalid number of hosts %ld !\n", opt );
  149. this_opt = strsep (&str, ",");
  150. }
  151. if(this_opt) {
  152. opt = simple_strtol( this_opt, NULL, 0 );
  153. if (opt > 0)
  154. setup_disconnect = opt;
  155. this_opt = strsep (&str, ",");
  156. }
  157. if(this_opt) {
  158. opt = simple_strtol( this_opt, NULL, 0 );
  159. if (opt >= 0)
  160. setup_nosync = opt;
  161. this_opt = strsep (&str, ",");
  162. }
  163. if(this_opt) {
  164. opt = simple_strtol( this_opt, NULL, 0 );
  165. if (opt > 0)
  166. setup_can_queue = opt;
  167. this_opt = strsep (&str, ",");
  168. }
  169. if(this_opt) {
  170. opt = simple_strtol( this_opt, NULL, 0 );
  171. if (opt > 0)
  172. setup_cmd_per_lun = opt;
  173. this_opt = strsep (&str, ",");
  174. }
  175. if(this_opt) {
  176. opt = simple_strtol( this_opt, NULL, 0 );
  177. if (opt >= 0) {
  178. setup_sg_tablesize = opt;
  179. /* Must be <= SG_ALL (255) */
  180. if (setup_sg_tablesize > SG_ALL)
  181. setup_sg_tablesize = SG_ALL;
  182. }
  183. this_opt = strsep (&str, ",");
  184. }
  185. if(this_opt) {
  186. opt = simple_strtol( this_opt, NULL, 0 );
  187. /* Must be between 0 and 7 */
  188. if (opt >= 0 && opt <= 7)
  189. setup_hostid = opt;
  190. else if (opt > 7)
  191. printk( "mac_esp_setup: invalid host ID %ld !\n", opt);
  192. this_opt = strsep (&str, ",");
  193. }
  194. #ifdef SUPPORT_TAGS
  195. if(this_opt) {
  196. opt = simple_strtol( this_opt, NULL, 0 );
  197. if (opt >= 0)
  198. setup_use_tagged_queuing = !!opt;
  199. }
  200. #endif
  201. #endif
  202. return 1;
  203. }
  204. __setup("mac53c9x=", mac_esp_setup);
  205. /*
  206. * ESP address 'detection'
  207. */
  208. unsigned long get_base(int chip_num)
  209. {
  210. /*
  211. * using the chip_num and mac model, figure out where the
  212. * chips are mapped
  213. */
  214. unsigned long io_base = 0x50f00000;
  215. unsigned int second_offset = 0x402;
  216. unsigned long scsi_loc = 0;
  217. switch (macintosh_config->scsi_type) {
  218. /* 950, 900, 700 */
  219. case MAC_SCSI_QUADRA2:
  220. scsi_loc = io_base + 0xf000 + ((chip_num == 0) ? 0 : second_offset);
  221. break;
  222. /* av's */
  223. case MAC_SCSI_QUADRA3:
  224. scsi_loc = io_base + 0x18000 + ((chip_num == 0) ? 0 : second_offset);
  225. break;
  226. /* most quadra/centris models are like this */
  227. case MAC_SCSI_QUADRA:
  228. scsi_loc = io_base + 0x10000;
  229. break;
  230. default:
  231. printk("mac_esp: get_base: hit default!\n");
  232. scsi_loc = io_base + 0x10000;
  233. break;
  234. } /* switch */
  235. printk("mac_esp: io base at 0x%lx\n", scsi_loc);
  236. return scsi_loc;
  237. }
  238. /*
  239. * Model dependent ESP setup
  240. */
  241. int mac_esp_detect(Scsi_Host_Template * tpnt)
  242. {
  243. int quick = 0;
  244. int chipnum, chipspresent = 0;
  245. #if 0
  246. unsigned long timeout;
  247. #endif
  248. if (esp_initialized > 0)
  249. return -ENODEV;
  250. /* what do we have in this machine... */
  251. if (MACHW_PRESENT(MAC_SCSI_96)) {
  252. chipspresent ++;
  253. }
  254. if (MACHW_PRESENT(MAC_SCSI_96_2)) {
  255. chipspresent ++;
  256. }
  257. /* number of ESPs present ? */
  258. if (setup_num_esps >= 0) {
  259. if (chipspresent >= setup_num_esps)
  260. chipspresent = setup_num_esps;
  261. else
  262. printk("mac_esp_detect: num_hosts detected %d setup %d \n",
  263. chipspresent, setup_num_esps);
  264. }
  265. /* TODO: add disconnect / nosync flags */
  266. /* setup variables */
  267. tpnt->can_queue =
  268. (setup_can_queue > 0) ? setup_can_queue : 7;
  269. tpnt->cmd_per_lun =
  270. (setup_cmd_per_lun > 0) ? setup_cmd_per_lun : 1;
  271. tpnt->sg_tablesize =
  272. (setup_sg_tablesize >= 0) ? setup_sg_tablesize : SG_ALL;
  273. if (setup_hostid >= 0)
  274. tpnt->this_id = setup_hostid;
  275. else {
  276. /* use 7 as default */
  277. tpnt->this_id = 7;
  278. }
  279. #ifdef SUPPORT_TAGS
  280. if (setup_use_tagged_queuing < 0)
  281. setup_use_tagged_queuing = DEFAULT_USE_TAGGED_QUEUING;
  282. #endif
  283. for (chipnum = 0; chipnum < chipspresent; chipnum ++) {
  284. struct NCR_ESP * esp;
  285. esp = esp_allocate(tpnt, (void *) NULL);
  286. esp->eregs = (struct ESP_regs *) get_base(chipnum);
  287. esp->dma_irq_p = &esp_dafb_dma_irq_p;
  288. if (chipnum == 0) {
  289. if (macintosh_config->scsi_type == MAC_SCSI_QUADRA) {
  290. /* most machines except those below :-) */
  291. quick = 1;
  292. esp->dma_irq_p = &esp_iosb_dma_irq_p;
  293. } else if (macintosh_config->scsi_type == MAC_SCSI_QUADRA3) {
  294. /* mostly av's */
  295. quick = 0;
  296. } else {
  297. /* q950, 900, 700 */
  298. quick = 1;
  299. out_be32(0xf9800024, 0x1d1);
  300. esp->dregs = (void *) 0xf9800024;
  301. }
  302. } else { /* chipnum */
  303. quick = 1;
  304. out_be32(0xf9800028, 0x1d1);
  305. esp->dregs = (void *) 0xf9800028;
  306. } /* chipnum == 0 */
  307. /* use pio for command bytes; pio for message/data: TBI */
  308. esp->do_pio_cmds = 1;
  309. /* Set the command buffer */
  310. esp->esp_command = (volatile unsigned char*) cmd_buffer;
  311. esp->esp_command_dvma = (__u32) cmd_buffer;
  312. /* various functions */
  313. esp->dma_bytes_sent = &dma_bytes_sent;
  314. esp->dma_can_transfer = &dma_can_transfer;
  315. esp->dma_dump_state = &dma_dump_state;
  316. esp->dma_init_read = NULL;
  317. esp->dma_init_write = NULL;
  318. esp->dma_ints_off = &dma_ints_off;
  319. esp->dma_ints_on = &dma_ints_on;
  320. esp->dma_ports_p = &dma_ports_p;
  321. /* Optional functions */
  322. esp->dma_barrier = NULL;
  323. esp->dma_drain = NULL;
  324. esp->dma_invalidate = NULL;
  325. esp->dma_irq_entry = NULL;
  326. esp->dma_irq_exit = NULL;
  327. esp->dma_led_on = NULL;
  328. esp->dma_led_off = NULL;
  329. esp->dma_poll = NULL;
  330. esp->dma_reset = NULL;
  331. /* SCSI chip speed */
  332. /* below esp->cfreq = 40000000; */
  333. if (quick) {
  334. /* 'quick' means there's handshake glue logic like in the 5380 case */
  335. esp->dma_setup = &dma_setup_quick;
  336. } else {
  337. esp->dma_setup = &dma_setup;
  338. }
  339. if (chipnum == 0) {
  340. esp->irq = IRQ_MAC_SCSI;
  341. request_irq(IRQ_MAC_SCSI, esp_intr, 0, "Mac ESP SCSI", esp->ehost);
  342. #if 0 /* conflicts with IOP ADB */
  343. request_irq(IRQ_MAC_SCSIDRQ, fake_drq, 0, "Mac ESP DRQ", esp->ehost);
  344. #endif
  345. if (macintosh_config->scsi_type == MAC_SCSI_QUADRA) {
  346. esp->cfreq = 16500000;
  347. } else {
  348. esp->cfreq = 25000000;
  349. }
  350. } else { /* chipnum == 1 */
  351. esp->irq = IRQ_MAC_SCSIDRQ;
  352. #if 0 /* conflicts with IOP ADB */
  353. request_irq(IRQ_MAC_SCSIDRQ, esp_intr, 0, "Mac ESP SCSI 2", esp->ehost);
  354. #endif
  355. esp->cfreq = 25000000;
  356. }
  357. if (quick) {
  358. printk("esp: using quick version\n");
  359. }
  360. printk("esp: addr at 0x%p\n", esp->eregs);
  361. esp->scsi_id = 7;
  362. esp->diff = 0;
  363. esp_initialize(esp);
  364. } /* for chipnum */
  365. if (chipspresent)
  366. printk("\nmac_esp: %d esp controllers found\n", chipspresent);
  367. esp_initialized = chipspresent;
  368. return chipspresent;
  369. }
  370. static int mac_esp_release(struct Scsi_Host *shost)
  371. {
  372. if (shost->irq)
  373. free_irq(shost->irq, NULL);
  374. if (shost->io_port && shost->n_io_port)
  375. release_region(shost->io_port, shost->n_io_port);
  376. scsi_unregister(shost);
  377. return 0;
  378. }
  379. /*
  380. * I've been wondering what this is supposed to do, for some time. Talking
  381. * to Allen Briggs: These machines have an extra register someplace where the
  382. * DRQ pin of the ESP can be monitored. That isn't useful for determining
  383. * anything else (such as reselect interrupt or other magic) though.
  384. * Maybe make the semantics should be changed like
  385. * if (esp->current_SC)
  386. * ... check DRQ flag ...
  387. * else
  388. * ... disconnected, check pending VIA interrupt ...
  389. *
  390. * There's a problem with using the dabf flag or mac_irq_pending() here: both
  391. * seem to return 1 even though no interrupt is currently pending, resulting
  392. * in esp_exec_cmd() holding off the next command, and possibly infinite loops
  393. * in esp_intr().
  394. * Short term fix: just use esp_status & ESP_STAT_INTR here, as long as we
  395. * use simple PIO. The DRQ status will be important when implementing pseudo
  396. * DMA mode (set up ESP transfer count, return, do a batch of bytes in PIO or
  397. * 'hardware handshake' mode upon DRQ).
  398. * If you plan on changing this (i.e. to save the esp_status register access in
  399. * favor of a VIA register access or a shadow register for the IFR), make sure
  400. * to try a debug version of this first to monitor what registers would be a good
  401. * indicator of the ESP interrupt.
  402. */
  403. static int esp_dafb_dma_irq_p(struct NCR_ESP * esp)
  404. {
  405. unsigned int ret;
  406. int sreg = esp_read(esp->eregs->esp_status);
  407. #ifdef DEBUG_MAC_ESP
  408. printk("mac_esp: esp_dafb_dma_irq_p dafb %d irq %d\n",
  409. readl(esp->dregs), mac_irq_pending(IRQ_MAC_SCSI));
  410. #endif
  411. sreg &= ESP_STAT_INTR;
  412. /*
  413. * maybe working; this is essentially what's used for iosb_dma_irq_p
  414. */
  415. if (sreg)
  416. return 1;
  417. else
  418. return 0;
  419. /*
  420. * didn't work ...
  421. */
  422. #if 0
  423. if (esp->current_SC)
  424. ret = readl(esp->dregs) & 0x200;
  425. else if (esp->disconnected_SC)
  426. ret = 1; /* sreg ?? */
  427. else
  428. ret = mac_irq_pending(IRQ_MAC_SCSI);
  429. return(ret);
  430. #endif
  431. }
  432. /*
  433. * See above: testing mac_irq_pending always returned 8 (SCSI IRQ) regardless
  434. * of the actual ESP status.
  435. */
  436. static int esp_iosb_dma_irq_p(struct NCR_ESP * esp)
  437. {
  438. int ret = mac_irq_pending(IRQ_MAC_SCSI) || mac_irq_pending(IRQ_MAC_SCSIDRQ);
  439. int sreg = esp_read(esp->eregs->esp_status);
  440. #ifdef DEBUG_MAC_ESP
  441. printk("mac_esp: dma_irq_p drq %d irq %d sreg %x curr %p disc %p\n",
  442. mac_irq_pending(IRQ_MAC_SCSIDRQ), mac_irq_pending(IRQ_MAC_SCSI),
  443. sreg, esp->current_SC, esp->disconnected_SC);
  444. #endif
  445. sreg &= ESP_STAT_INTR;
  446. if (sreg)
  447. return (sreg);
  448. else
  449. return 0;
  450. }
  451. /*
  452. * This seems to be OK for PIO at least ... usually 0 after PIO.
  453. */
  454. static int dma_bytes_sent(struct NCR_ESP * esp, int fifo_count)
  455. {
  456. #ifdef DEBUG_MAC_ESP
  457. printk("mac_esp: dma bytes sent = %x\n", fifo_count);
  458. #endif
  459. return fifo_count;
  460. }
  461. /*
  462. * dma_can_transfer is used to switch between DMA and PIO, if DMA (pseudo)
  463. * is ever implemented. Returning 0 here will use PIO.
  464. */
  465. static int dma_can_transfer(struct NCR_ESP * esp, Scsi_Cmnd * sp)
  466. {
  467. unsigned long sz = sp->SCp.this_residual;
  468. #if 0 /* no DMA yet; make conditional */
  469. if (sz > 0x10000000) {
  470. sz = 0x10000000;
  471. }
  472. printk("mac_esp: dma can transfer = 0lx%x\n", sz);
  473. #else
  474. #ifdef DEBUG_MAC_ESP
  475. printk("mac_esp: pio to transfer = %ld\n", sz);
  476. #endif
  477. sz = 0;
  478. #endif
  479. return sz;
  480. }
  481. /*
  482. * Not yet ...
  483. */
  484. static void dma_dump_state(struct NCR_ESP * esp)
  485. {
  486. #ifdef DEBUG_MAC_ESP
  487. printk("mac_esp: dma_dump_state: called\n");
  488. #endif
  489. #if 0
  490. ESPLOG(("esp%d: dma -- cond_reg<%02x>\n",
  491. esp->esp_id, ((struct mac_dma_registers *)
  492. (esp->dregs))->cond_reg));
  493. #endif
  494. }
  495. /*
  496. * DMA setup: should be used to set up the ESP transfer count for pseudo
  497. * DMA transfers; need a DRQ transfer function to do the actual transfer
  498. */
  499. static void dma_init_read(struct NCR_ESP * esp, char * vaddress, int length)
  500. {
  501. printk("mac_esp: dma_init_read\n");
  502. }
  503. static void dma_init_write(struct NCR_ESP * esp, char * vaddress, int length)
  504. {
  505. printk("mac_esp: dma_init_write\n");
  506. }
  507. static void dma_ints_off(struct NCR_ESP * esp)
  508. {
  509. mac_turnoff_irq(esp->irq);
  510. }
  511. static void dma_ints_on(struct NCR_ESP * esp)
  512. {
  513. mac_turnon_irq(esp->irq);
  514. }
  515. /*
  516. * generic dma_irq_p(), unused
  517. */
  518. static int dma_irq_p(struct NCR_ESP * esp)
  519. {
  520. int i = esp_read(esp->eregs->esp_status);
  521. #ifdef DEBUG_MAC_ESP
  522. printk("mac_esp: dma_irq_p status %d\n", i);
  523. #endif
  524. return (i & ESP_STAT_INTR);
  525. }
  526. static int dma_irq_p_quick(struct NCR_ESP * esp)
  527. {
  528. /*
  529. * Copied from iosb_dma_irq_p()
  530. */
  531. int ret = mac_irq_pending(IRQ_MAC_SCSI) || mac_irq_pending(IRQ_MAC_SCSIDRQ);
  532. int sreg = esp_read(esp->eregs->esp_status);
  533. #ifdef DEBUG_MAC_ESP
  534. printk("mac_esp: dma_irq_p drq %d irq %d sreg %x curr %p disc %p\n",
  535. mac_irq_pending(IRQ_MAC_SCSIDRQ), mac_irq_pending(IRQ_MAC_SCSI),
  536. sreg, esp->current_SC, esp->disconnected_SC);
  537. #endif
  538. sreg &= ESP_STAT_INTR;
  539. if (sreg)
  540. return (sreg);
  541. else
  542. return 0;
  543. }
  544. static void dma_led_off(struct NCR_ESP * esp)
  545. {
  546. #ifdef DEBUG_MAC_ESP
  547. printk("mac_esp: dma_led_off: called\n");
  548. #endif
  549. }
  550. static void dma_led_on(struct NCR_ESP * esp)
  551. {
  552. #ifdef DEBUG_MAC_ESP
  553. printk("mac_esp: dma_led_on: called\n");
  554. #endif
  555. }
  556. static int dma_ports_p(struct NCR_ESP * esp)
  557. {
  558. return 0;
  559. }
  560. static void dma_setup(struct NCR_ESP * esp, __u32 addr, int count, int write)
  561. {
  562. #ifdef DEBUG_MAC_ESP
  563. printk("mac_esp: dma_setup\n");
  564. #endif
  565. if (write) {
  566. dma_init_read(esp, (char *) addr, count);
  567. } else {
  568. dma_init_write(esp, (char *) addr, count);
  569. }
  570. }
  571. static void dma_setup_quick(struct NCR_ESP * esp, __u32 addr, int count, int write)
  572. {
  573. #ifdef DEBUG_MAC_ESP
  574. printk("mac_esp: dma_setup_quick\n");
  575. #endif
  576. }
  577. static Scsi_Host_Template driver_template = {
  578. .proc_name = "mac_esp",
  579. .name = "Mac 53C9x SCSI",
  580. .detect = mac_esp_detect,
  581. .slave_alloc = esp_slave_alloc,
  582. .slave_destroy = esp_slave_destroy,
  583. .release = mac_esp_release,
  584. .info = esp_info,
  585. .queuecommand = esp_queue,
  586. .eh_abort_handler = esp_abort,
  587. .eh_bus_reset_handler = esp_reset,
  588. .can_queue = 7,
  589. .this_id = 7,
  590. .sg_tablesize = SG_ALL,
  591. .cmd_per_lun = 1,
  592. .use_clustering = DISABLE_CLUSTERING
  593. };
  594. #include "scsi_module.c"
  595. MODULE_LICENSE("GPL");