SPARC: sg chaining support
This updates the sparc iommu/pci dma mappers to sg chaining. Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
This commit is contained in:
@@ -11,8 +11,8 @@
|
||||
#include <linux/mm.h>
|
||||
#include <linux/highmem.h> /* pte_offset_map => kmap_atomic */
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/scatterlist.h>
|
||||
|
||||
#include <asm/scatterlist.h>
|
||||
#include <asm/pgalloc.h>
|
||||
#include <asm/pgtable.h>
|
||||
#include <asm/sbus.h>
|
||||
@@ -144,8 +144,9 @@ static void iounit_get_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_bus
|
||||
spin_lock_irqsave(&iounit->lock, flags);
|
||||
while (sz != 0) {
|
||||
--sz;
|
||||
sg[sz].dvma_address = iounit_get_area(iounit, (unsigned long)page_address(sg[sz].page) + sg[sz].offset, sg[sz].length);
|
||||
sg[sz].dvma_length = sg[sz].length;
|
||||
sg->dvma_address = iounit_get_area(iounit, (unsigned long)page_address(sg->page) + sg->offset, sg->length);
|
||||
sg->dvma_length = sg->length;
|
||||
sg = sg_next(sg);
|
||||
}
|
||||
spin_unlock_irqrestore(&iounit->lock, flags);
|
||||
}
|
||||
@@ -173,11 +174,12 @@ static void iounit_release_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_
|
||||
spin_lock_irqsave(&iounit->lock, flags);
|
||||
while (sz != 0) {
|
||||
--sz;
|
||||
len = ((sg[sz].dvma_address & ~PAGE_MASK) + sg[sz].length + (PAGE_SIZE-1)) >> PAGE_SHIFT;
|
||||
vaddr = (sg[sz].dvma_address - IOUNIT_DMA_BASE) >> PAGE_SHIFT;
|
||||
len = ((sg->dvma_address & ~PAGE_MASK) + sg->length + (PAGE_SIZE-1)) >> PAGE_SHIFT;
|
||||
vaddr = (sg->dvma_address - IOUNIT_DMA_BASE) >> PAGE_SHIFT;
|
||||
IOD(("iounit_release %08lx-%08lx\n", (long)vaddr, (long)len+vaddr));
|
||||
for (len += vaddr; vaddr < len; vaddr++)
|
||||
clear_bit(vaddr, iounit->bmap);
|
||||
sg = sg_next(sg);
|
||||
}
|
||||
spin_unlock_irqrestore(&iounit->lock, flags);
|
||||
}
|
||||
|
@@ -12,8 +12,8 @@
|
||||
#include <linux/mm.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/highmem.h> /* pte_offset_map => kmap_atomic */
|
||||
#include <linux/scatterlist.h>
|
||||
|
||||
#include <asm/scatterlist.h>
|
||||
#include <asm/pgalloc.h>
|
||||
#include <asm/pgtable.h>
|
||||
#include <asm/sbus.h>
|
||||
@@ -240,7 +240,7 @@ static void iommu_get_scsi_sgl_noflush(struct scatterlist *sg, int sz, struct sb
|
||||
n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT;
|
||||
sg->dvma_address = iommu_get_one(sg->page, n, sbus) + sg->offset;
|
||||
sg->dvma_length = (__u32) sg->length;
|
||||
sg++;
|
||||
sg = sg_next(sg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ static void iommu_get_scsi_sgl_gflush(struct scatterlist *sg, int sz, struct sbu
|
||||
n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT;
|
||||
sg->dvma_address = iommu_get_one(sg->page, n, sbus) + sg->offset;
|
||||
sg->dvma_length = (__u32) sg->length;
|
||||
sg++;
|
||||
sg = sg_next(sg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ static void iommu_get_scsi_sgl_pflush(struct scatterlist *sg, int sz, struct sbu
|
||||
|
||||
sg->dvma_address = iommu_get_one(sg->page, n, sbus) + sg->offset;
|
||||
sg->dvma_length = (__u32) sg->length;
|
||||
sg++;
|
||||
sg = sg_next(sg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -325,7 +325,7 @@ static void iommu_release_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_b
|
||||
n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT;
|
||||
iommu_release_one(sg->dvma_address & PAGE_MASK, n, sbus);
|
||||
sg->dvma_address = 0x21212121;
|
||||
sg++;
|
||||
sg = sg_next(sg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -17,8 +17,8 @@
|
||||
#include <linux/highmem.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/scatterlist.h>
|
||||
|
||||
#include <asm/scatterlist.h>
|
||||
#include <asm/page.h>
|
||||
#include <asm/pgalloc.h>
|
||||
#include <asm/pgtable.h>
|
||||
@@ -1228,8 +1228,9 @@ static void sun4c_get_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_bus *
|
||||
{
|
||||
while (sz != 0) {
|
||||
--sz;
|
||||
sg[sz].dvma_address = (__u32)sun4c_lockarea(page_address(sg[sz].page) + sg[sz].offset, sg[sz].length);
|
||||
sg[sz].dvma_length = sg[sz].length;
|
||||
sg->dvma_address = (__u32)sun4c_lockarea(page_address(sg->page) + sg->offset, sg->length);
|
||||
sg->dvma_length = sg->length;
|
||||
sg = sg_next(sg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1244,7 +1245,8 @@ static void sun4c_release_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_b
|
||||
{
|
||||
while (sz != 0) {
|
||||
--sz;
|
||||
sun4c_unlockarea((char *)sg[sz].dvma_address, sg[sz].length);
|
||||
sun4c_unlockarea((char *)sg->dvma_address, sg->length);
|
||||
sg = sg_next(sg);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user