diff options
author | Jon Mason <jdmason@us.ibm.com> | 2006-06-26 07:56:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-26 13:48:15 -0400 |
commit | 7c2d9cd218916276e52a5dae827b84a159fe5c96 (patch) | |
tree | 922891554c06e3a58d99efd9d21095a790d22adb /arch/x86_64 | |
parent | f0f2d6536e3515b5b1b7ae97dc8f176860c8c2ce (diff) |
[PATCH] x86_64: trivial gart clean-up
A trivial change to have gart_unmap_sg call gart_unmap_single directly,
instead of bouncing through the dma_unmap_single wrapper in
dma-mapping.h.
This change required moving the gart_unmap_single above gart_unmap_sg,
and under gart_map_single (which seems a more logical place that its
current location IMHO).
Signed-off-by: Jon Mason <jdmason@us.ibm.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/x86_64')
-rw-r--r-- | arch/x86_64/kernel/pci-gart.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c index e0198da7451d..ea8f4041794e 100644 --- a/arch/x86_64/kernel/pci-gart.c +++ b/arch/x86_64/kernel/pci-gart.c | |||
@@ -289,6 +289,28 @@ dma_addr_t gart_map_single(struct device *dev, void *addr, size_t size, int dir) | |||
289 | } | 289 | } |
290 | 290 | ||
291 | /* | 291 | /* |
292 | * Free a DMA mapping. | ||
293 | */ | ||
294 | void gart_unmap_single(struct device *dev, dma_addr_t dma_addr, | ||
295 | size_t size, int direction) | ||
296 | { | ||
297 | unsigned long iommu_page; | ||
298 | int npages; | ||
299 | int i; | ||
300 | |||
301 | if (dma_addr < iommu_bus_base + EMERGENCY_PAGES*PAGE_SIZE || | ||
302 | dma_addr >= iommu_bus_base + iommu_size) | ||
303 | return; | ||
304 | iommu_page = (dma_addr - iommu_bus_base)>>PAGE_SHIFT; | ||
305 | npages = to_pages(dma_addr, size); | ||
306 | for (i = 0; i < npages; i++) { | ||
307 | iommu_gatt_base[iommu_page + i] = gart_unmapped_entry; | ||
308 | CLEAR_LEAK(iommu_page + i); | ||
309 | } | ||
310 | free_iommu(iommu_page, npages); | ||
311 | } | ||
312 | |||
313 | /* | ||
292 | * Wrapper for pci_unmap_single working with scatterlists. | 314 | * Wrapper for pci_unmap_single working with scatterlists. |
293 | */ | 315 | */ |
294 | void gart_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, int dir) | 316 | void gart_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, int dir) |
@@ -299,7 +321,7 @@ void gart_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, int di | |||
299 | struct scatterlist *s = &sg[i]; | 321 | struct scatterlist *s = &sg[i]; |
300 | if (!s->dma_length || !s->length) | 322 | if (!s->dma_length || !s->length) |
301 | break; | 323 | break; |
302 | dma_unmap_single(dev, s->dma_address, s->dma_length, dir); | 324 | gart_unmap_single(dev, s->dma_address, s->dma_length, dir); |
303 | } | 325 | } |
304 | } | 326 | } |
305 | 327 | ||
@@ -458,28 +480,6 @@ error: | |||
458 | return 0; | 480 | return 0; |
459 | } | 481 | } |
460 | 482 | ||
461 | /* | ||
462 | * Free a DMA mapping. | ||
463 | */ | ||
464 | void gart_unmap_single(struct device *dev, dma_addr_t dma_addr, | ||
465 | size_t size, int direction) | ||
466 | { | ||
467 | unsigned long iommu_page; | ||
468 | int npages; | ||
469 | int i; | ||
470 | |||
471 | if (dma_addr < iommu_bus_base + EMERGENCY_PAGES*PAGE_SIZE || | ||
472 | dma_addr >= iommu_bus_base + iommu_size) | ||
473 | return; | ||
474 | iommu_page = (dma_addr - iommu_bus_base)>>PAGE_SHIFT; | ||
475 | npages = to_pages(dma_addr, size); | ||
476 | for (i = 0; i < npages; i++) { | ||
477 | iommu_gatt_base[iommu_page + i] = gart_unmapped_entry; | ||
478 | CLEAR_LEAK(iommu_page + i); | ||
479 | } | ||
480 | free_iommu(iommu_page, npages); | ||
481 | } | ||
482 | |||
483 | static int no_agp; | 483 | static int no_agp; |
484 | 484 | ||
485 | static __init unsigned long check_iommu_size(unsigned long aper, u64 aper_size) | 485 | static __init unsigned long check_iommu_size(unsigned long aper, u64 aper_size) |