diff options
Diffstat (limited to 'drivers/scsi/libata-core.c')
-rw-r--r-- | drivers/scsi/libata-core.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index ee9b96da841e..30a88f0e7bd6 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -2071,7 +2071,7 @@ void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf, unsigned int buflen) | |||
2071 | sg = qc->sg; | 2071 | sg = qc->sg; |
2072 | sg->page = virt_to_page(buf); | 2072 | sg->page = virt_to_page(buf); |
2073 | sg->offset = (unsigned long) buf & ~PAGE_MASK; | 2073 | sg->offset = (unsigned long) buf & ~PAGE_MASK; |
2074 | sg_dma_len(sg) = buflen; | 2074 | sg->length = buflen; |
2075 | } | 2075 | } |
2076 | 2076 | ||
2077 | void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, | 2077 | void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, |
@@ -2101,11 +2101,12 @@ static int ata_sg_setup_one(struct ata_queued_cmd *qc) | |||
2101 | dma_addr_t dma_address; | 2101 | dma_addr_t dma_address; |
2102 | 2102 | ||
2103 | dma_address = dma_map_single(ap->host_set->dev, qc->buf_virt, | 2103 | dma_address = dma_map_single(ap->host_set->dev, qc->buf_virt, |
2104 | sg_dma_len(sg), dir); | 2104 | sg->length, dir); |
2105 | if (dma_mapping_error(dma_address)) | 2105 | if (dma_mapping_error(dma_address)) |
2106 | return -1; | 2106 | return -1; |
2107 | 2107 | ||
2108 | sg_dma_address(sg) = dma_address; | 2108 | sg_dma_address(sg) = dma_address; |
2109 | sg_dma_len(sg) = sg->length; | ||
2109 | 2110 | ||
2110 | DPRINTK("mapped buffer of %d bytes for %s\n", sg_dma_len(sg), | 2111 | DPRINTK("mapped buffer of %d bytes for %s\n", sg_dma_len(sg), |
2111 | qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read"); | 2112 | qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read"); |
@@ -2310,7 +2311,7 @@ static void ata_pio_sector(struct ata_queued_cmd *qc) | |||
2310 | qc->cursect++; | 2311 | qc->cursect++; |
2311 | qc->cursg_ofs++; | 2312 | qc->cursg_ofs++; |
2312 | 2313 | ||
2313 | if ((qc->cursg_ofs * ATA_SECT_SIZE) == sg_dma_len(&sg[qc->cursg])) { | 2314 | if ((qc->cursg_ofs * ATA_SECT_SIZE) == (&sg[qc->cursg])->length) { |
2314 | qc->cursg++; | 2315 | qc->cursg++; |
2315 | qc->cursg_ofs = 0; | 2316 | qc->cursg_ofs = 0; |
2316 | } | 2317 | } |
@@ -2347,7 +2348,7 @@ next_page: | |||
2347 | page = nth_page(page, (offset >> PAGE_SHIFT)); | 2348 | page = nth_page(page, (offset >> PAGE_SHIFT)); |
2348 | offset %= PAGE_SIZE; | 2349 | offset %= PAGE_SIZE; |
2349 | 2350 | ||
2350 | count = min(sg_dma_len(sg) - qc->cursg_ofs, bytes); | 2351 | count = min(sg->length - qc->cursg_ofs, bytes); |
2351 | 2352 | ||
2352 | /* don't cross page boundaries */ | 2353 | /* don't cross page boundaries */ |
2353 | count = min(count, (unsigned int)PAGE_SIZE - offset); | 2354 | count = min(count, (unsigned int)PAGE_SIZE - offset); |
@@ -2358,7 +2359,7 @@ next_page: | |||
2358 | qc->curbytes += count; | 2359 | qc->curbytes += count; |
2359 | qc->cursg_ofs += count; | 2360 | qc->cursg_ofs += count; |
2360 | 2361 | ||
2361 | if (qc->cursg_ofs == sg_dma_len(sg)) { | 2362 | if (qc->cursg_ofs == sg->length) { |
2362 | qc->cursg++; | 2363 | qc->cursg++; |
2363 | qc->cursg_ofs = 0; | 2364 | qc->cursg_ofs = 0; |
2364 | } | 2365 | } |
@@ -2371,7 +2372,7 @@ next_page: | |||
2371 | kunmap(page); | 2372 | kunmap(page); |
2372 | 2373 | ||
2373 | if (bytes) { | 2374 | if (bytes) { |
2374 | if (qc->cursg_ofs < sg_dma_len(sg)) | 2375 | if (qc->cursg_ofs < sg->length) |
2375 | goto next_page; | 2376 | goto next_page; |
2376 | goto next_sg; | 2377 | goto next_sg; |
2377 | } | 2378 | } |
@@ -3321,6 +3322,13 @@ void ata_port_stop (struct ata_port *ap) | |||
3321 | dma_free_coherent(dev, ATA_PRD_TBL_SZ, ap->prd, ap->prd_dma); | 3322 | dma_free_coherent(dev, ATA_PRD_TBL_SZ, ap->prd, ap->prd_dma); |
3322 | } | 3323 | } |
3323 | 3324 | ||
3325 | void ata_host_stop (struct ata_host_set *host_set) | ||
3326 | { | ||
3327 | if (host_set->mmio_base) | ||
3328 | iounmap(host_set->mmio_base); | ||
3329 | } | ||
3330 | |||
3331 | |||
3324 | /** | 3332 | /** |
3325 | * ata_host_remove - Unregister SCSI host structure with upper layers | 3333 | * ata_host_remove - Unregister SCSI host structure with upper layers |
3326 | * @ap: Port to unregister | 3334 | * @ap: Port to unregister |
@@ -3877,10 +3885,6 @@ void ata_pci_remove_one (struct pci_dev *pdev) | |||
3877 | } | 3885 | } |
3878 | 3886 | ||
3879 | free_irq(host_set->irq, host_set); | 3887 | free_irq(host_set->irq, host_set); |
3880 | if (host_set->ops->host_stop) | ||
3881 | host_set->ops->host_stop(host_set); | ||
3882 | if (host_set->mmio_base) | ||
3883 | iounmap(host_set->mmio_base); | ||
3884 | 3888 | ||
3885 | for (i = 0; i < host_set->n_ports; i++) { | 3889 | for (i = 0; i < host_set->n_ports; i++) { |
3886 | ap = host_set->ports[i]; | 3890 | ap = host_set->ports[i]; |
@@ -3899,6 +3903,9 @@ void ata_pci_remove_one (struct pci_dev *pdev) | |||
3899 | scsi_host_put(ap->host); | 3903 | scsi_host_put(ap->host); |
3900 | } | 3904 | } |
3901 | 3905 | ||
3906 | if (host_set->ops->host_stop) | ||
3907 | host_set->ops->host_stop(host_set); | ||
3908 | |||
3902 | kfree(host_set); | 3909 | kfree(host_set); |
3903 | 3910 | ||
3904 | pci_release_regions(pdev); | 3911 | pci_release_regions(pdev); |
@@ -3996,6 +4003,7 @@ EXPORT_SYMBOL_GPL(ata_chk_err); | |||
3996 | EXPORT_SYMBOL_GPL(ata_exec_command); | 4003 | EXPORT_SYMBOL_GPL(ata_exec_command); |
3997 | EXPORT_SYMBOL_GPL(ata_port_start); | 4004 | EXPORT_SYMBOL_GPL(ata_port_start); |
3998 | EXPORT_SYMBOL_GPL(ata_port_stop); | 4005 | EXPORT_SYMBOL_GPL(ata_port_stop); |
4006 | EXPORT_SYMBOL_GPL(ata_host_stop); | ||
3999 | EXPORT_SYMBOL_GPL(ata_interrupt); | 4007 | EXPORT_SYMBOL_GPL(ata_interrupt); |
4000 | EXPORT_SYMBOL_GPL(ata_qc_prep); | 4008 | EXPORT_SYMBOL_GPL(ata_qc_prep); |
4001 | EXPORT_SYMBOL_GPL(ata_bmdma_setup); | 4009 | EXPORT_SYMBOL_GPL(ata_bmdma_setup); |