diff options
Diffstat (limited to 'arch/x86/kernel/pci-nommu.c')
-rw-r--r-- | arch/x86/kernel/pci-nommu.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/arch/x86/kernel/pci-nommu.c b/arch/x86/kernel/pci-nommu.c index c70ab5a5d4c8..5a73a824ac1c 100644 --- a/arch/x86/kernel/pci-nommu.c +++ b/arch/x86/kernel/pci-nommu.c | |||
@@ -25,18 +25,25 @@ check_addr(char *name, struct device *hwdev, dma_addr_t bus, size_t size) | |||
25 | return 1; | 25 | return 1; |
26 | } | 26 | } |
27 | 27 | ||
28 | static dma_addr_t | 28 | static dma_addr_t nommu_map_page(struct device *dev, struct page *page, |
29 | nommu_map_single(struct device *hwdev, phys_addr_t paddr, size_t size, | 29 | unsigned long offset, size_t size, |
30 | int direction) | 30 | enum dma_data_direction dir, |
31 | struct dma_attrs *attrs) | ||
31 | { | 32 | { |
32 | dma_addr_t bus = paddr; | 33 | dma_addr_t bus = page_to_phys(page) + offset; |
33 | WARN_ON(size == 0); | 34 | WARN_ON(size == 0); |
34 | if (!check_addr("map_single", hwdev, bus, size)) | 35 | if (!check_addr("map_single", dev, bus, size)) |
35 | return bad_dma_address; | 36 | return bad_dma_address; |
36 | flush_write_buffers(); | 37 | flush_write_buffers(); |
37 | return bus; | 38 | return bus; |
38 | } | 39 | } |
39 | 40 | ||
41 | static dma_addr_t nommu_map_single(struct device *hwdev, phys_addr_t paddr, | ||
42 | size_t size, int direction) | ||
43 | { | ||
44 | return nommu_map_page(hwdev, pfn_to_page(paddr >> PAGE_SHIFT), | ||
45 | paddr & ~PAGE_MASK, size, direction, NULL); | ||
46 | } | ||
40 | 47 | ||
41 | /* Map a set of buffers described by scatterlist in streaming | 48 | /* Map a set of buffers described by scatterlist in streaming |
42 | * mode for DMA. This is the scatter-gather version of the | 49 | * mode for DMA. This is the scatter-gather version of the |
@@ -83,6 +90,7 @@ struct dma_mapping_ops nommu_dma_ops = { | |||
83 | .free_coherent = nommu_free_coherent, | 90 | .free_coherent = nommu_free_coherent, |
84 | .map_single = nommu_map_single, | 91 | .map_single = nommu_map_single, |
85 | .map_sg = nommu_map_sg, | 92 | .map_sg = nommu_map_sg, |
93 | .map_page = nommu_map_page, | ||
86 | .is_phys = 1, | 94 | .is_phys = 1, |
87 | }; | 95 | }; |
88 | 96 | ||