diff options
author | Christoph Hellwig <hch@lst.de> | 2018-10-13 09:26:27 +0200 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2018-10-16 05:00:38 +0200 |
commit | 3f9295b65ea44194252d60376036a3618d822152 (patch) | |
tree | c08aa217d9c95b10fec4d1b788360cfcfc360afb /drivers/scsi/mac_esp.c | |
parent | scsi: esp_scsi: remove the dev argument to scsi_esp_register (diff) | |
download | linux-3f9295b65ea44194252d60376036a3618d822152.tar.xz linux-3f9295b65ea44194252d60376036a3618d822152.zip |
scsi: esp_scsi: move dma mapping into the core code
Except for the mac_esp driver, which uses PIO or pseudo DMA, all drivers
share the same dma mapping calls. Move the dma mapping into the core
code using the scsi_dma_map / scsi_dma_unmap helpers, with a special
identify mapping variant triggered off a new ESP_FLAG_NO_DMA_MAP flag
for mac_esp.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Tested-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/mac_esp.c')
-rw-r--r-- | drivers/scsi/mac_esp.c | 39 |
1 files changed, 2 insertions, 37 deletions
diff --git a/drivers/scsi/mac_esp.c b/drivers/scsi/mac_esp.c index 9299ff929f7f..2769df5acc07 100644 --- a/drivers/scsi/mac_esp.c +++ b/drivers/scsi/mac_esp.c @@ -70,38 +70,6 @@ static inline u8 mac_esp_read8(struct esp *esp, unsigned long reg) return nubus_readb(esp->regs + reg * 16); } -/* For pseudo DMA and PIO we need the virtual address - * so this address mapping is the identity mapping. - */ - -static dma_addr_t mac_esp_map_single(struct esp *esp, void *buf, - size_t sz, int dir) -{ - return (dma_addr_t)buf; -} - -static int mac_esp_map_sg(struct esp *esp, struct scatterlist *sg, - int num_sg, int dir) -{ - int i; - - for (i = 0; i < num_sg; i++) - sg[i].dma_address = (u32)sg_virt(&sg[i]); - return num_sg; -} - -static void mac_esp_unmap_single(struct esp *esp, dma_addr_t addr, - size_t sz, int dir) -{ - /* Nothing to do. */ -} - -static void mac_esp_unmap_sg(struct esp *esp, struct scatterlist *sg, - int num_sg, int dir) -{ - /* Nothing to do. */ -} - static void mac_esp_reset_dma(struct esp *esp) { /* Nothing to do. */ @@ -469,10 +437,6 @@ static irqreturn_t mac_scsi_esp_intr(int irq, void *dev_id) static struct esp_driver_ops mac_esp_ops = { .esp_write8 = mac_esp_write8, .esp_read8 = mac_esp_read8, - .map_single = mac_esp_map_single, - .map_sg = mac_esp_map_sg, - .unmap_single = mac_esp_unmap_single, - .unmap_sg = mac_esp_unmap_sg, .irq_pending = mac_esp_irq_pending, .dma_length_limit = mac_esp_dma_length_limit, .reset_dma = mac_esp_reset_dma, @@ -552,11 +516,12 @@ static int esp_mac_probe(struct platform_device *dev) } esp->ops = &mac_esp_ops; + esp->flags = ESP_FLAG_NO_DMA_MAP; if (mep->pdma_io == NULL) { printk(KERN_INFO PFX "using PIO for controller %d\n", dev->id); esp_write8(0, ESP_TCLOW); esp_write8(0, ESP_TCMED); - esp->flags = ESP_FLAG_DISABLE_SYNC; + esp->flags |= ESP_FLAG_DISABLE_SYNC; mac_esp_ops.send_dma_cmd = mac_esp_send_pio_cmd; } else { printk(KERN_INFO PFX "using PDMA for controller %d\n", dev->id); |