x86: pci-gart fix

map_sg could copy the last sg element to another position (if merging
some elements). It breaks sg chaining. This copies only
dma_address/length instead of the whole sg element.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
This commit is contained in:
FUJITA Tomonori 2007-10-25 09:13:32 +02:00 committed by Jens Axboe
parent 82861924a5
commit e88a39dee1

View file

@ -338,7 +338,6 @@ static int __dma_map_cont(struct scatterlist *start, int nelems,
BUG_ON(s != start && s->offset); BUG_ON(s != start && s->offset);
if (s == start) { if (s == start) {
*sout = *s;
sout->dma_address = iommu_bus_base; sout->dma_address = iommu_bus_base;
sout->dma_address += iommu_page*PAGE_SIZE + s->offset; sout->dma_address += iommu_page*PAGE_SIZE + s->offset;
sout->dma_length = s->length; sout->dma_length = s->length;
@ -365,7 +364,7 @@ static inline int dma_map_cont(struct scatterlist *start, int nelems,
{ {
if (!need) { if (!need) {
BUG_ON(nelems != 1); BUG_ON(nelems != 1);
*sout = *start; sout->dma_address = start->dma_address;
sout->dma_length = start->length; sout->dma_length = start->length;
return 0; return 0;
} }