aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2007-10-22 14:02:46 -0400
committerJens Axboe <jens.axboe@oracle.com>2007-10-22 15:19:59 -0400
commit58b053e4ce9d2fc3023645c1b96e537c72aa8d9a (patch)
tree35fbd72eb62a37375bc06c01e356afd7da0c9693 /arch/x86
parentf9527f121bd42c5d300815fbf12216bc1a63f60f (diff)
Update arch/ to use sg helpers
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kernel/pci-calgary_64.c10
-rw-r--r--arch/x86/kernel/pci-gart_64.c4
-rw-r--r--arch/x86/kernel/pci-nommu_64.c4
3 files changed, 10 insertions, 8 deletions
diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c
index 5098f58063a5..1a20fe31338b 100644
--- a/arch/x86/kernel/pci-calgary_64.c
+++ b/arch/x86/kernel/pci-calgary_64.c
@@ -411,8 +411,10 @@ static int calgary_nontranslate_map_sg(struct device* dev,
411 int i; 411 int i;
412 412
413 for_each_sg(sg, s, nelems, i) { 413 for_each_sg(sg, s, nelems, i) {
414 BUG_ON(!s->page); 414 struct page *p = sg_page(s);
415 s->dma_address = virt_to_bus(page_address(s->page) +s->offset); 415
416 BUG_ON(!p);
417 s->dma_address = virt_to_bus(sg_virt(s));
416 s->dma_length = s->length; 418 s->dma_length = s->length;
417 } 419 }
418 return nelems; 420 return nelems;
@@ -432,9 +434,9 @@ static int calgary_map_sg(struct device *dev, struct scatterlist *sg,
432 return calgary_nontranslate_map_sg(dev, sg, nelems, direction); 434 return calgary_nontranslate_map_sg(dev, sg, nelems, direction);
433 435
434 for_each_sg(sg, s, nelems, i) { 436 for_each_sg(sg, s, nelems, i) {
435 BUG_ON(!s->page); 437 BUG_ON(!sg_page(s));
436 438
437 vaddr = (unsigned long)page_address(s->page) + s->offset; 439 vaddr = (unsigned long) sg_virt(s);
438 npages = num_dma_pages(vaddr, s->length); 440 npages = num_dma_pages(vaddr, s->length);
439 441
440 entry = iommu_range_alloc(tbl, npages); 442 entry = iommu_range_alloc(tbl, npages);
diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
index 5cdfab65e93f..c56e9ee64964 100644
--- a/arch/x86/kernel/pci-gart_64.c
+++ b/arch/x86/kernel/pci-gart_64.c
@@ -302,7 +302,7 @@ static int dma_map_sg_nonforce(struct device *dev, struct scatterlist *sg,
302#endif 302#endif
303 303
304 for_each_sg(sg, s, nents, i) { 304 for_each_sg(sg, s, nents, i) {
305 unsigned long addr = page_to_phys(s->page) + s->offset; 305 unsigned long addr = sg_phys(s);
306 if (nonforced_iommu(dev, addr, s->length)) { 306 if (nonforced_iommu(dev, addr, s->length)) {
307 addr = dma_map_area(dev, addr, s->length, dir); 307 addr = dma_map_area(dev, addr, s->length, dir);
308 if (addr == bad_dma_address) { 308 if (addr == bad_dma_address) {
@@ -397,7 +397,7 @@ static int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents,
397 start_sg = sgmap = sg; 397 start_sg = sgmap = sg;
398 ps = NULL; /* shut up gcc */ 398 ps = NULL; /* shut up gcc */
399 for_each_sg(sg, s, nents, i) { 399 for_each_sg(sg, s, nents, i) {
400 dma_addr_t addr = page_to_phys(s->page) + s->offset; 400 dma_addr_t addr = sg_phys(s);
401 s->dma_address = addr; 401 s->dma_address = addr;
402 BUG_ON(s->length == 0); 402 BUG_ON(s->length == 0);
403 403
diff --git a/arch/x86/kernel/pci-nommu_64.c b/arch/x86/kernel/pci-nommu_64.c
index e85d4360360c..faf70bdca335 100644
--- a/arch/x86/kernel/pci-nommu_64.c
+++ b/arch/x86/kernel/pci-nommu_64.c
@@ -62,8 +62,8 @@ static int nommu_map_sg(struct device *hwdev, struct scatterlist *sg,
62 int i; 62 int i;
63 63
64 for_each_sg(sg, s, nents, i) { 64 for_each_sg(sg, s, nents, i) {
65 BUG_ON(!s->page); 65 BUG_ON(!sg_page(s));
66 s->dma_address = virt_to_bus(page_address(s->page) +s->offset); 66 s->dma_address = virt_to_bus(sg_virt(s));
67 if (!check_addr("map_sg", hwdev, s->dma_address, s->length)) 67 if (!check_addr("map_sg", hwdev, s->dma_address, s->length))
68 return 0; 68 return 0;
69 s->dma_length = s->length; 69 s->dma_length = s->length;