dec_esp.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578
  1. /*
  2. * dec_esp.c: Driver for SCSI chips on IOASIC based TURBOchannel DECstations
  3. * and TURBOchannel PMAZ-A cards
  4. *
  5. * TURBOchannel changes by Harald Koerfgen
  6. * PMAZ-A support by David Airlie
  7. *
  8. * based on jazz_esp.c:
  9. * Copyright (C) 1997 Thomas Bogendoerfer (tsbogend@alpha.franken.de)
  10. *
  11. * jazz_esp is based on David S. Miller's ESP driver and cyber_esp
  12. *
  13. * 20000819 - Small PMAZ-AA fixes by Florian Lohoff <flo@rfc822.org>
  14. * Be warned the PMAZ-AA works currently as a single card.
  15. * Dont try to put multiple cards in one machine - They are
  16. * both detected but it may crash under high load garbling your
  17. * data.
  18. * 20001005 - Initialization fixes for 2.4.0-test9
  19. * Florian Lohoff <flo@rfc822.org>
  20. *
  21. * Copyright (C) 2002, 2003, 2005 Maciej W. Rozycki
  22. */
  23. #include <linux/kernel.h>
  24. #include <linux/delay.h>
  25. #include <linux/types.h>
  26. #include <linux/string.h>
  27. #include <linux/slab.h>
  28. #include <linux/blkdev.h>
  29. #include <linux/proc_fs.h>
  30. #include <linux/spinlock.h>
  31. #include <linux/stat.h>
  32. #include <asm/dma.h>
  33. #include <asm/irq.h>
  34. #include <asm/pgtable.h>
  35. #include <asm/system.h>
  36. #include <asm/dec/interrupts.h>
  37. #include <asm/dec/ioasic.h>
  38. #include <asm/dec/ioasic_addrs.h>
  39. #include <asm/dec/ioasic_ints.h>
  40. #include <asm/dec/machtype.h>
  41. #include <asm/dec/system.h>
  42. #include <asm/dec/tc.h>
  43. #define DEC_SCSI_SREG 0
  44. #define DEC_SCSI_DMAREG 0x40000
  45. #define DEC_SCSI_SRAM 0x80000
  46. #define DEC_SCSI_DIAG 0xC0000
  47. #include "scsi.h"
  48. #include <scsi/scsi_host.h>
  49. #include "NCR53C9x.h"
  50. static int dma_bytes_sent(struct NCR_ESP *esp, int fifo_count);
  51. static void dma_drain(struct NCR_ESP *esp);
  52. static int dma_can_transfer(struct NCR_ESP *esp, struct scsi_cmnd *sp);
  53. static void dma_dump_state(struct NCR_ESP *esp);
  54. static void dma_init_read(struct NCR_ESP *esp, u32 vaddress, int length);
  55. static void dma_init_write(struct NCR_ESP *esp, u32 vaddress, int length);
  56. static void dma_ints_off(struct NCR_ESP *esp);
  57. static void dma_ints_on(struct NCR_ESP *esp);
  58. static int dma_irq_p(struct NCR_ESP *esp);
  59. static int dma_ports_p(struct NCR_ESP *esp);
  60. static void dma_setup(struct NCR_ESP *esp, u32 addr, int count, int write);
  61. static void dma_mmu_get_scsi_one(struct NCR_ESP *esp, struct scsi_cmnd * sp);
  62. static void dma_mmu_get_scsi_sgl(struct NCR_ESP *esp, struct scsi_cmnd * sp);
  63. static void dma_advance_sg(struct scsi_cmnd * sp);
  64. static void pmaz_dma_drain(struct NCR_ESP *esp);
  65. static void pmaz_dma_init_read(struct NCR_ESP *esp, u32 vaddress, int length);
  66. static void pmaz_dma_init_write(struct NCR_ESP *esp, u32 vaddress, int length);
  67. static void pmaz_dma_ints_off(struct NCR_ESP *esp);
  68. static void pmaz_dma_ints_on(struct NCR_ESP *esp);
  69. static void pmaz_dma_setup(struct NCR_ESP *esp, u32 addr, int count, int write);
  70. static void pmaz_dma_mmu_get_scsi_one(struct NCR_ESP *esp, struct scsi_cmnd * sp);
  71. #define TC_ESP_RAM_SIZE 0x20000
  72. #define ESP_TGT_DMA_SIZE ((TC_ESP_RAM_SIZE/7) & ~(sizeof(int)-1))
  73. #define ESP_NCMD 7
  74. #define TC_ESP_DMAR_MASK 0x1ffff
  75. #define TC_ESP_DMAR_WRITE 0x80000000
  76. #define TC_ESP_DMA_ADDR(x) ((unsigned)(x) & TC_ESP_DMAR_MASK)
  77. u32 esp_virt_buffer;
  78. int scsi_current_length;
  79. volatile unsigned char cmd_buffer[16];
  80. volatile unsigned char pmaz_cmd_buffer[16];
  81. /* This is where all commands are put
  82. * before they are trasfered to the ESP chip
  83. * via PIO.
  84. */
  85. static irqreturn_t scsi_dma_merr_int(int, void *, struct pt_regs *);
  86. static irqreturn_t scsi_dma_err_int(int, void *, struct pt_regs *);
  87. static irqreturn_t scsi_dma_int(int, void *, struct pt_regs *);
  88. static int dec_esp_detect(struct scsi_host_template * tpnt);
  89. static int dec_esp_release(struct Scsi_Host *shost)
  90. {
  91. if (shost->irq)
  92. free_irq(shost->irq, NULL);
  93. if (shost->io_port && shost->n_io_port)
  94. release_region(shost->io_port, shost->n_io_port);
  95. scsi_unregister(shost);
  96. return 0;
  97. }
  98. static struct scsi_host_template driver_template = {
  99. .proc_name = "dec_esp",
  100. .proc_info = esp_proc_info,
  101. .name = "NCR53C94",
  102. .detect = dec_esp_detect,
  103. .slave_alloc = esp_slave_alloc,
  104. .slave_destroy = esp_slave_destroy,
  105. .release = dec_esp_release,
  106. .info = esp_info,
  107. .queuecommand = esp_queue,
  108. .eh_abort_handler = esp_abort,
  109. .eh_bus_reset_handler = esp_reset,
  110. .can_queue = 7,
  111. .this_id = 7,
  112. .sg_tablesize = SG_ALL,
  113. .cmd_per_lun = 1,
  114. .use_clustering = DISABLE_CLUSTERING,
  115. };
  116. #include "scsi_module.c"
  117. /***************************************************************** Detection */
  118. static int dec_esp_detect(struct scsi_host_template * tpnt)
  119. {
  120. struct NCR_ESP *esp;
  121. struct ConfigDev *esp_dev;
  122. int slot;
  123. unsigned long mem_start;
  124. if (IOASIC) {
  125. esp_dev = 0;
  126. esp = esp_allocate(tpnt, (void *) esp_dev);
  127. /* Do command transfer with programmed I/O */
  128. esp->do_pio_cmds = 1;
  129. /* Required functions */
  130. esp->dma_bytes_sent = &dma_bytes_sent;
  131. esp->dma_can_transfer = &dma_can_transfer;
  132. esp->dma_dump_state = &dma_dump_state;
  133. esp->dma_init_read = &dma_init_read;
  134. esp->dma_init_write = &dma_init_write;
  135. esp->dma_ints_off = &dma_ints_off;
  136. esp->dma_ints_on = &dma_ints_on;
  137. esp->dma_irq_p = &dma_irq_p;
  138. esp->dma_ports_p = &dma_ports_p;
  139. esp->dma_setup = &dma_setup;
  140. /* Optional functions */
  141. esp->dma_barrier = 0;
  142. esp->dma_drain = &dma_drain;
  143. esp->dma_invalidate = 0;
  144. esp->dma_irq_entry = 0;
  145. esp->dma_irq_exit = 0;
  146. esp->dma_poll = 0;
  147. esp->dma_reset = 0;
  148. esp->dma_led_off = 0;
  149. esp->dma_led_on = 0;
  150. /* virtual DMA functions */
  151. esp->dma_mmu_get_scsi_one = &dma_mmu_get_scsi_one;
  152. esp->dma_mmu_get_scsi_sgl = &dma_mmu_get_scsi_sgl;
  153. esp->dma_mmu_release_scsi_one = 0;
  154. esp->dma_mmu_release_scsi_sgl = 0;
  155. esp->dma_advance_sg = &dma_advance_sg;
  156. /* SCSI chip speed */
  157. esp->cfreq = 25000000;
  158. esp->dregs = 0;
  159. /* ESP register base */
  160. esp->eregs = (void *)CKSEG1ADDR(dec_kn_slot_base +
  161. IOASIC_SCSI);
  162. /* Set the command buffer */
  163. esp->esp_command = (volatile unsigned char *) cmd_buffer;
  164. /* get virtual dma address for command buffer */
  165. esp->esp_command_dvma = virt_to_phys(cmd_buffer);
  166. esp->irq = dec_interrupt[DEC_IRQ_ASC];
  167. esp->scsi_id = 7;
  168. /* Check for differential SCSI-bus */
  169. esp->diff = 0;
  170. esp_initialize(esp);
  171. if (request_irq(esp->irq, esp_intr, SA_INTERRUPT,
  172. "ncr53c94", esp->ehost))
  173. goto err_dealloc;
  174. if (request_irq(dec_interrupt[DEC_IRQ_ASC_MERR],
  175. scsi_dma_merr_int, SA_INTERRUPT,
  176. "ncr53c94 error", esp->ehost))
  177. goto err_free_irq;
  178. if (request_irq(dec_interrupt[DEC_IRQ_ASC_ERR],
  179. scsi_dma_err_int, SA_INTERRUPT,
  180. "ncr53c94 overrun", esp->ehost))
  181. goto err_free_irq_merr;
  182. if (request_irq(dec_interrupt[DEC_IRQ_ASC_DMA],
  183. scsi_dma_int, SA_INTERRUPT,
  184. "ncr53c94 dma", esp->ehost))
  185. goto err_free_irq_err;
  186. }
  187. if (TURBOCHANNEL) {
  188. while ((slot = search_tc_card("PMAZ-AA")) >= 0) {
  189. claim_tc_card(slot);
  190. esp_dev = 0;
  191. esp = esp_allocate(tpnt, (void *) esp_dev);
  192. mem_start = get_tc_base_addr(slot);
  193. /* Store base addr into esp struct */
  194. esp->slot = CPHYSADDR(mem_start);
  195. esp->dregs = 0;
  196. esp->eregs = (void *)CKSEG1ADDR(mem_start +
  197. DEC_SCSI_SREG);
  198. esp->do_pio_cmds = 1;
  199. /* Set the command buffer */
  200. esp->esp_command = (volatile unsigned char *) pmaz_cmd_buffer;
  201. /* get virtual dma address for command buffer */
  202. esp->esp_command_dvma = virt_to_phys(pmaz_cmd_buffer);
  203. esp->cfreq = get_tc_speed();
  204. esp->irq = get_tc_irq_nr(slot);
  205. /* Required functions */
  206. esp->dma_bytes_sent = &dma_bytes_sent;
  207. esp->dma_can_transfer = &dma_can_transfer;
  208. esp->dma_dump_state = &dma_dump_state;
  209. esp->dma_init_read = &pmaz_dma_init_read;
  210. esp->dma_init_write = &pmaz_dma_init_write;
  211. esp->dma_ints_off = &pmaz_dma_ints_off;
  212. esp->dma_ints_on = &pmaz_dma_ints_on;
  213. esp->dma_irq_p = &dma_irq_p;
  214. esp->dma_ports_p = &dma_ports_p;
  215. esp->dma_setup = &pmaz_dma_setup;
  216. /* Optional functions */
  217. esp->dma_barrier = 0;
  218. esp->dma_drain = &pmaz_dma_drain;
  219. esp->dma_invalidate = 0;
  220. esp->dma_irq_entry = 0;
  221. esp->dma_irq_exit = 0;
  222. esp->dma_poll = 0;
  223. esp->dma_reset = 0;
  224. esp->dma_led_off = 0;
  225. esp->dma_led_on = 0;
  226. esp->dma_mmu_get_scsi_one = pmaz_dma_mmu_get_scsi_one;
  227. esp->dma_mmu_get_scsi_sgl = 0;
  228. esp->dma_mmu_release_scsi_one = 0;
  229. esp->dma_mmu_release_scsi_sgl = 0;
  230. esp->dma_advance_sg = 0;
  231. if (request_irq(esp->irq, esp_intr, SA_INTERRUPT,
  232. "PMAZ_AA", esp->ehost)) {
  233. esp_deallocate(esp);
  234. release_tc_card(slot);
  235. continue;
  236. }
  237. esp->scsi_id = 7;
  238. esp->diff = 0;
  239. esp_initialize(esp);
  240. }
  241. }
  242. if(nesps) {
  243. printk("ESP: Total of %d ESP hosts found, %d actually in use.\n", nesps, esps_in_use);
  244. esps_running = esps_in_use;
  245. return esps_in_use;
  246. }
  247. return 0;
  248. err_free_irq_err:
  249. free_irq(dec_interrupt[DEC_IRQ_ASC_ERR], scsi_dma_err_int);
  250. err_free_irq_merr:
  251. free_irq(dec_interrupt[DEC_IRQ_ASC_MERR], scsi_dma_merr_int);
  252. err_free_irq:
  253. free_irq(esp->irq, esp_intr);
  254. err_dealloc:
  255. esp_deallocate(esp);
  256. return 0;
  257. }
  258. /************************************************************* DMA Functions */
  259. static irqreturn_t scsi_dma_merr_int(int irq, void *dev_id, struct pt_regs *regs)
  260. {
  261. printk("Got unexpected SCSI DMA Interrupt! < ");
  262. printk("SCSI_DMA_MEMRDERR ");
  263. printk(">\n");
  264. return IRQ_HANDLED;
  265. }
  266. static irqreturn_t scsi_dma_err_int(int irq, void *dev_id, struct pt_regs *regs)
  267. {
  268. /* empty */
  269. return IRQ_HANDLED;
  270. }
  271. static irqreturn_t scsi_dma_int(int irq, void *dev_id, struct pt_regs *regs)
  272. {
  273. u32 scsi_next_ptr;
  274. scsi_next_ptr = ioasic_read(IO_REG_SCSI_DMA_P);
  275. /* next page */
  276. scsi_next_ptr = (((scsi_next_ptr >> 3) + PAGE_SIZE) & PAGE_MASK) << 3;
  277. ioasic_write(IO_REG_SCSI_DMA_BP, scsi_next_ptr);
  278. fast_iob();
  279. return IRQ_HANDLED;
  280. }
  281. static int dma_bytes_sent(struct NCR_ESP *esp, int fifo_count)
  282. {
  283. return fifo_count;
  284. }
  285. static void dma_drain(struct NCR_ESP *esp)
  286. {
  287. u32 nw, data0, data1, scsi_data_ptr;
  288. u16 *p;
  289. nw = ioasic_read(IO_REG_SCSI_SCR);
  290. /*
  291. * Is there something in the dma buffers left?
  292. */
  293. if (nw) {
  294. scsi_data_ptr = ioasic_read(IO_REG_SCSI_DMA_P) >> 3;
  295. p = phys_to_virt(scsi_data_ptr);
  296. switch (nw) {
  297. case 1:
  298. data0 = ioasic_read(IO_REG_SCSI_SDR0);
  299. p[0] = data0 & 0xffff;
  300. break;
  301. case 2:
  302. data0 = ioasic_read(IO_REG_SCSI_SDR0);
  303. p[0] = data0 & 0xffff;
  304. p[1] = (data0 >> 16) & 0xffff;
  305. break;
  306. case 3:
  307. data0 = ioasic_read(IO_REG_SCSI_SDR0);
  308. data1 = ioasic_read(IO_REG_SCSI_SDR1);
  309. p[0] = data0 & 0xffff;
  310. p[1] = (data0 >> 16) & 0xffff;
  311. p[2] = data1 & 0xffff;
  312. break;
  313. default:
  314. printk("Strange: %d words in dma buffer left\n", nw);
  315. break;
  316. }
  317. }
  318. }
  319. static int dma_can_transfer(struct NCR_ESP *esp, struct scsi_cmnd * sp)
  320. {
  321. return sp->SCp.this_residual;
  322. }
  323. static void dma_dump_state(struct NCR_ESP *esp)
  324. {
  325. }
  326. static void dma_init_read(struct NCR_ESP *esp, u32 vaddress, int length)
  327. {
  328. u32 scsi_next_ptr, ioasic_ssr;
  329. unsigned long flags;
  330. if (vaddress & 3)
  331. panic("dec_esp.c: unable to handle partial word transfers, yet...");
  332. dma_cache_wback_inv((unsigned long) phys_to_virt(vaddress), length);
  333. spin_lock_irqsave(&ioasic_ssr_lock, flags);
  334. fast_mb();
  335. ioasic_ssr = ioasic_read(IO_REG_SSR);
  336. ioasic_ssr &= ~IO_SSR_SCSI_DMA_EN;
  337. ioasic_write(IO_REG_SSR, ioasic_ssr);
  338. fast_wmb();
  339. ioasic_write(IO_REG_SCSI_SCR, 0);
  340. ioasic_write(IO_REG_SCSI_DMA_P, vaddress << 3);
  341. /* prepare for next page */
  342. scsi_next_ptr = ((vaddress + PAGE_SIZE) & PAGE_MASK) << 3;
  343. ioasic_write(IO_REG_SCSI_DMA_BP, scsi_next_ptr);
  344. ioasic_ssr |= (IO_SSR_SCSI_DMA_DIR | IO_SSR_SCSI_DMA_EN);
  345. fast_wmb();
  346. ioasic_write(IO_REG_SSR, ioasic_ssr);
  347. fast_iob();
  348. spin_unlock_irqrestore(&ioasic_ssr_lock, flags);
  349. }
  350. static void dma_init_write(struct NCR_ESP *esp, u32 vaddress, int length)
  351. {
  352. u32 scsi_next_ptr, ioasic_ssr;
  353. unsigned long flags;
  354. if (vaddress & 3)
  355. panic("dec_esp.c: unable to handle partial word transfers, yet...");
  356. dma_cache_wback_inv((unsigned long) phys_to_virt(vaddress), length);
  357. spin_lock_irqsave(&ioasic_ssr_lock, flags);
  358. fast_mb();
  359. ioasic_ssr = ioasic_read(IO_REG_SSR);
  360. ioasic_ssr &= ~(IO_SSR_SCSI_DMA_DIR | IO_SSR_SCSI_DMA_EN);
  361. ioasic_write(IO_REG_SSR, ioasic_ssr);
  362. fast_wmb();
  363. ioasic_write(IO_REG_SCSI_SCR, 0);
  364. ioasic_write(IO_REG_SCSI_DMA_P, vaddress << 3);
  365. /* prepare for next page */
  366. scsi_next_ptr = ((vaddress + PAGE_SIZE) & PAGE_MASK) << 3;
  367. ioasic_write(IO_REG_SCSI_DMA_BP, scsi_next_ptr);
  368. ioasic_ssr |= IO_SSR_SCSI_DMA_EN;
  369. fast_wmb();
  370. ioasic_write(IO_REG_SSR, ioasic_ssr);
  371. fast_iob();
  372. spin_unlock_irqrestore(&ioasic_ssr_lock, flags);
  373. }
  374. static void dma_ints_off(struct NCR_ESP *esp)
  375. {
  376. disable_irq(dec_interrupt[DEC_IRQ_ASC_DMA]);
  377. }
  378. static void dma_ints_on(struct NCR_ESP *esp)
  379. {
  380. enable_irq(dec_interrupt[DEC_IRQ_ASC_DMA]);
  381. }
  382. static int dma_irq_p(struct NCR_ESP *esp)
  383. {
  384. return (esp->eregs->esp_status & ESP_STAT_INTR);
  385. }
  386. static int dma_ports_p(struct NCR_ESP *esp)
  387. {
  388. /*
  389. * FIXME: what's this good for?
  390. */
  391. return 1;
  392. }
  393. static void dma_setup(struct NCR_ESP *esp, u32 addr, int count, int write)
  394. {
  395. /*
  396. * DMA_ST_WRITE means "move data from device to memory"
  397. * so when (write) is true, it actually means READ!
  398. */
  399. if (write)
  400. dma_init_read(esp, addr, count);
  401. else
  402. dma_init_write(esp, addr, count);
  403. }
  404. static void dma_mmu_get_scsi_one(struct NCR_ESP *esp, struct scsi_cmnd * sp)
  405. {
  406. sp->SCp.ptr = (char *)virt_to_phys(sp->request_buffer);
  407. }
  408. static void dma_mmu_get_scsi_sgl(struct NCR_ESP *esp, struct scsi_cmnd * sp)
  409. {
  410. int sz = sp->SCp.buffers_residual;
  411. struct scatterlist *sg = sp->SCp.buffer;
  412. while (sz >= 0) {
  413. sg[sz].dma_address = page_to_phys(sg[sz].page) + sg[sz].offset;
  414. sz--;
  415. }
  416. sp->SCp.ptr = (char *)(sp->SCp.buffer->dma_address);
  417. }
  418. static void dma_advance_sg(struct scsi_cmnd * sp)
  419. {
  420. sp->SCp.ptr = (char *)(sp->SCp.buffer->dma_address);
  421. }
  422. static void pmaz_dma_drain(struct NCR_ESP *esp)
  423. {
  424. memcpy(phys_to_virt(esp_virt_buffer),
  425. (void *)CKSEG1ADDR(esp->slot + DEC_SCSI_SRAM +
  426. ESP_TGT_DMA_SIZE),
  427. scsi_current_length);
  428. }
  429. static void pmaz_dma_init_read(struct NCR_ESP *esp, u32 vaddress, int length)
  430. {
  431. volatile u32 *dmareg =
  432. (volatile u32 *)CKSEG1ADDR(esp->slot + DEC_SCSI_DMAREG);
  433. if (length > ESP_TGT_DMA_SIZE)
  434. length = ESP_TGT_DMA_SIZE;
  435. *dmareg = TC_ESP_DMA_ADDR(ESP_TGT_DMA_SIZE);
  436. iob();
  437. esp_virt_buffer = vaddress;
  438. scsi_current_length = length;
  439. }
  440. static void pmaz_dma_init_write(struct NCR_ESP *esp, u32 vaddress, int length)
  441. {
  442. volatile u32 *dmareg =
  443. (volatile u32 *)CKSEG1ADDR(esp->slot + DEC_SCSI_DMAREG);
  444. memcpy((void *)CKSEG1ADDR(esp->slot + DEC_SCSI_SRAM +
  445. ESP_TGT_DMA_SIZE),
  446. phys_to_virt(vaddress), length);
  447. wmb();
  448. *dmareg = TC_ESP_DMAR_WRITE | TC_ESP_DMA_ADDR(ESP_TGT_DMA_SIZE);
  449. iob();
  450. }
  451. static void pmaz_dma_ints_off(struct NCR_ESP *esp)
  452. {
  453. }
  454. static void pmaz_dma_ints_on(struct NCR_ESP *esp)
  455. {
  456. }
  457. static void pmaz_dma_setup(struct NCR_ESP *esp, u32 addr, int count, int write)
  458. {
  459. /*
  460. * DMA_ST_WRITE means "move data from device to memory"
  461. * so when (write) is true, it actually means READ!
  462. */
  463. if (write)
  464. pmaz_dma_init_read(esp, addr, count);
  465. else
  466. pmaz_dma_init_write(esp, addr, count);
  467. }
  468. static void pmaz_dma_mmu_get_scsi_one(struct NCR_ESP *esp, struct scsi_cmnd * sp)
  469. {
  470. sp->SCp.ptr = (char *)virt_to_phys(sp->request_buffer);
  471. }