diff options
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r-- | arch/x86/kernel/pci-gart_64.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c index 00c2bcd41463..e49c6dd0e8c6 100644 --- a/arch/x86/kernel/pci-gart_64.c +++ b/arch/x86/kernel/pci-gart_64.c | |||
@@ -255,10 +255,13 @@ static dma_addr_t dma_map_area(struct device *dev, dma_addr_t phys_mem, | |||
255 | } | 255 | } |
256 | 256 | ||
257 | /* Map a single area into the IOMMU */ | 257 | /* Map a single area into the IOMMU */ |
258 | static dma_addr_t | 258 | static dma_addr_t gart_map_page(struct device *dev, struct page *page, |
259 | gart_map_single(struct device *dev, phys_addr_t paddr, size_t size, int dir) | 259 | unsigned long offset, size_t size, |
260 | enum dma_data_direction dir, | ||
261 | struct dma_attrs *attrs) | ||
260 | { | 262 | { |
261 | unsigned long bus; | 263 | unsigned long bus; |
264 | phys_addr_t paddr = page_to_phys(page) + offset; | ||
262 | 265 | ||
263 | if (!dev) | 266 | if (!dev) |
264 | dev = &x86_dma_fallback_dev; | 267 | dev = &x86_dma_fallback_dev; |
@@ -272,11 +275,19 @@ gart_map_single(struct device *dev, phys_addr_t paddr, size_t size, int dir) | |||
272 | return bus; | 275 | return bus; |
273 | } | 276 | } |
274 | 277 | ||
278 | static dma_addr_t gart_map_single(struct device *dev, phys_addr_t paddr, | ||
279 | size_t size, int dir) | ||
280 | { | ||
281 | return gart_map_page(dev, pfn_to_page(paddr >> PAGE_SHIFT), | ||
282 | paddr & ~PAGE_MASK, size, dir, NULL); | ||
283 | } | ||
284 | |||
275 | /* | 285 | /* |
276 | * Free a DMA mapping. | 286 | * Free a DMA mapping. |
277 | */ | 287 | */ |
278 | static void gart_unmap_single(struct device *dev, dma_addr_t dma_addr, | 288 | static void gart_unmap_page(struct device *dev, dma_addr_t dma_addr, |
279 | size_t size, int direction) | 289 | size_t size, enum dma_data_direction dir, |
290 | struct dma_attrs *attrs) | ||
280 | { | 291 | { |
281 | unsigned long iommu_page; | 292 | unsigned long iommu_page; |
282 | int npages; | 293 | int npages; |
@@ -295,6 +306,12 @@ static void gart_unmap_single(struct device *dev, dma_addr_t dma_addr, | |||
295 | free_iommu(iommu_page, npages); | 306 | free_iommu(iommu_page, npages); |
296 | } | 307 | } |
297 | 308 | ||
309 | static void gart_unmap_single(struct device *dev, dma_addr_t dma_addr, | ||
310 | size_t size, int direction) | ||
311 | { | ||
312 | gart_unmap_page(dev, dma_addr, size, direction, NULL); | ||
313 | } | ||
314 | |||
298 | /* | 315 | /* |
299 | * Wrapper for pci_unmap_single working with scatterlists. | 316 | * Wrapper for pci_unmap_single working with scatterlists. |
300 | */ | 317 | */ |
@@ -712,6 +729,8 @@ static struct dma_mapping_ops gart_dma_ops = { | |||
712 | .unmap_single = gart_unmap_single, | 729 | .unmap_single = gart_unmap_single, |
713 | .map_sg = gart_map_sg, | 730 | .map_sg = gart_map_sg, |
714 | .unmap_sg = gart_unmap_sg, | 731 | .unmap_sg = gart_unmap_sg, |
732 | .map_page = gart_map_page, | ||
733 | .unmap_page = gart_unmap_page, | ||
715 | .alloc_coherent = gart_alloc_coherent, | 734 | .alloc_coherent = gart_alloc_coherent, |
716 | .free_coherent = gart_free_coherent, | 735 | .free_coherent = gart_free_coherent, |
717 | }; | 736 | }; |