X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=drivers%2Fscsi%2Fu14-34f.c;h=9e8232a1f16966efdd87b2257ac6706560b265b1;hb=03ce11048b3832f5f0c471ccdb3363a870a14ac1;hp=1ce29ba683eb72a8953adb95cd9fa0e2d660d83c;hpb=3133c5e896c0b2509e72ae0c2cb9452c80d47f46;p=mv-sheeva.git diff --git a/drivers/scsi/u14-34f.c b/drivers/scsi/u14-34f.c index 1ce29ba683e..9e8232a1f16 100644 --- a/drivers/scsi/u14-34f.c +++ b/drivers/scsi/u14-34f.c @@ -282,7 +282,7 @@ * clustering is enabled. ENABLE_CLUSTERING provides a performance increase * up to 50% on sequential access. * - * Since the Scsi_Host_Template structure is shared among all 14F and 34F, + * Since the struct scsi_host_template structure is shared among all 14F and 34F, * the last setting of use_clustering is in effect for all of these boards. * * Here a sample configuration using two U14F boards: @@ -405,7 +405,6 @@ * the driver sets host->wish_block = TRUE for all ISA boards. */ -#include #include #include #include @@ -635,7 +634,7 @@ static unsigned long io_port[] = { #define H2DEV(x) cpu_to_le32(x) #define DEV2H(x) le32_to_cpu(x) -static irqreturn_t do_interrupt_handler(int, void *, struct pt_regs *); +static irqreturn_t do_interrupt_handler(int, void *); static void flush_dev(struct scsi_device *, unsigned long, unsigned int, unsigned int); static int do_trace = FALSE; static int setup_done = FALSE; @@ -873,7 +872,7 @@ static int port_detect \ /* Board detected, allocate its IRQ */ if (request_irq(irq, do_interrupt_handler, - SA_INTERRUPT | ((subversion == ESA) ? SA_SHIRQ : 0), + IRQF_DISABLED | ((subversion == ESA) ? IRQF_SHARED : 0), driver_name, (void *) &sha[j])) { printk("%s: unable to allocate IRQ %u, detaching.\n", name, irq); goto freelock; @@ -1112,7 +1111,7 @@ static int u14_34f_detect(struct scsi_host_template *tpnt) { static void map_dma(unsigned int i, unsigned int j) { unsigned int data_len = 0; unsigned int k, count, pci_dir; - struct scatterlist *sgpnt; + struct scatterlist *sg; struct mscp *cpp; struct scsi_cmnd *SCpnt; @@ -1125,33 +1124,28 @@ static void map_dma(unsigned int i, unsigned int j) { cpp->sense_len = sizeof SCpnt->sense_buffer; - if (!SCpnt->use_sg) { - - /* If we get here with PCI_DMA_NONE, pci_map_single triggers a BUG() */ - if (!SCpnt->request_bufflen) pci_dir = PCI_DMA_BIDIRECTIONAL; - - if (SCpnt->request_buffer) - cpp->data_address = H2DEV(pci_map_single(HD(j)->pdev, - SCpnt->request_buffer, SCpnt->request_bufflen, pci_dir)); - - cpp->data_len = H2DEV(SCpnt->request_bufflen); - return; - } - - sgpnt = (struct scatterlist *) SCpnt->request_buffer; - count = pci_map_sg(HD(j)->pdev, sgpnt, SCpnt->use_sg, pci_dir); - - for (k = 0; k < count; k++) { - cpp->sglist[k].address = H2DEV(sg_dma_address(&sgpnt[k])); - cpp->sglist[k].num_bytes = H2DEV(sg_dma_len(&sgpnt[k])); - data_len += sgpnt[k].length; - } - - cpp->sg = TRUE; - cpp->use_sg = SCpnt->use_sg; - cpp->data_address = H2DEV(pci_map_single(HD(j)->pdev, cpp->sglist, - SCpnt->use_sg * sizeof(struct sg_list), pci_dir)); - cpp->data_len = H2DEV(data_len); + if (scsi_bufflen(SCpnt)) { + count = scsi_dma_map(SCpnt); + BUG_ON(count < 0); + + scsi_for_each_sg(SCpnt, sg, count, k) { + cpp->sglist[k].address = H2DEV(sg_dma_address(sg)); + cpp->sglist[k].num_bytes = H2DEV(sg_dma_len(sg)); + data_len += sg->length; + } + + cpp->sg = TRUE; + cpp->use_sg = scsi_sg_count(SCpnt); + cpp->data_address = + H2DEV(pci_map_single(HD(j)->pdev, cpp->sglist, + cpp->use_sg * sizeof(struct sg_list), + pci_dir)); + cpp->data_len = H2DEV(data_len); + + } else { + pci_dir = PCI_DMA_BIDIRECTIONAL; + cpp->data_len = H2DEV(scsi_bufflen(SCpnt)); + } } static void unmap_dma(unsigned int i, unsigned int j) { @@ -1166,8 +1160,7 @@ static void unmap_dma(unsigned int i, unsigned int j) { pci_unmap_single(HD(j)->pdev, DEV2H(cpp->sense_addr), DEV2H(cpp->sense_len), PCI_DMA_FROMDEVICE); - if (SCpnt->use_sg) - pci_unmap_sg(HD(j)->pdev, SCpnt->request_buffer, SCpnt->use_sg, pci_dir); + scsi_dma_unmap(SCpnt); if (!DEV2H(cpp->data_len)) pci_dir = PCI_DMA_BIDIRECTIONAL; @@ -1188,9 +1181,9 @@ static void sync_dma(unsigned int i, unsigned int j) { pci_dma_sync_single_for_cpu(HD(j)->pdev, DEV2H(cpp->sense_addr), DEV2H(cpp->sense_len), PCI_DMA_FROMDEVICE); - if (SCpnt->use_sg) - pci_dma_sync_sg_for_cpu(HD(j)->pdev, SCpnt->request_buffer, - SCpnt->use_sg, pci_dir); + if (scsi_sg_count(SCpnt)) + pci_dma_sync_sg_for_cpu(HD(j)->pdev, scsi_sglist(SCpnt), + scsi_sg_count(SCpnt), pci_dir); if (!DEV2H(cpp->data_len)) pci_dir = PCI_DMA_BIDIRECTIONAL; @@ -1933,8 +1926,7 @@ none: return IRQ_NONE; } -static irqreturn_t do_interrupt_handler(int irq, void *shap, - struct pt_regs *regs) { +static irqreturn_t do_interrupt_handler(int irq, void *shap) { unsigned int j; unsigned long spin_flags; irqreturn_t ret;