diff options
Diffstat (limited to 'arch/arm/include/asm/dma-mapping.h')
| -rw-r--r-- | arch/arm/include/asm/dma-mapping.h | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h index ff46dfa68a97..a96300bf83fd 100644 --- a/arch/arm/include/asm/dma-mapping.h +++ b/arch/arm/include/asm/dma-mapping.h | |||
| @@ -15,20 +15,15 @@ | |||
| 15 | * must not be used by drivers. | 15 | * must not be used by drivers. |
| 16 | */ | 16 | */ |
| 17 | #ifndef __arch_page_to_dma | 17 | #ifndef __arch_page_to_dma |
| 18 | |||
| 19 | #if !defined(CONFIG_HIGHMEM) | ||
| 20 | static inline dma_addr_t page_to_dma(struct device *dev, struct page *page) | 18 | static inline dma_addr_t page_to_dma(struct device *dev, struct page *page) |
| 21 | { | 19 | { |
| 22 | return (dma_addr_t)__virt_to_bus((unsigned long)page_address(page)); | 20 | return (dma_addr_t)__pfn_to_bus(page_to_pfn(page)); |
| 23 | } | 21 | } |
| 24 | #elif defined(__pfn_to_bus) | 22 | |
| 25 | static inline dma_addr_t page_to_dma(struct device *dev, struct page *page) | 23 | static inline struct page *dma_to_page(struct device *dev, dma_addr_t addr) |
| 26 | { | 24 | { |
| 27 | return (dma_addr_t)__pfn_to_bus(page_to_pfn(page)); | 25 | return pfn_to_page(__bus_to_pfn(addr)); |
| 28 | } | 26 | } |
| 29 | #else | ||
| 30 | #error "this machine class needs to define __arch_page_to_dma to use HIGHMEM" | ||
| 31 | #endif | ||
| 32 | 27 | ||
| 33 | static inline void *dma_to_virt(struct device *dev, dma_addr_t addr) | 28 | static inline void *dma_to_virt(struct device *dev, dma_addr_t addr) |
| 34 | { | 29 | { |
| @@ -45,6 +40,11 @@ static inline dma_addr_t page_to_dma(struct device *dev, struct page *page) | |||
| 45 | return __arch_page_to_dma(dev, page); | 40 | return __arch_page_to_dma(dev, page); |
| 46 | } | 41 | } |
| 47 | 42 | ||
| 43 | static inline struct page *dma_to_page(struct device *dev, dma_addr_t addr) | ||
| 44 | { | ||
| 45 | return __arch_dma_to_page(dev, addr); | ||
| 46 | } | ||
| 47 | |||
| 48 | static inline void *dma_to_virt(struct device *dev, dma_addr_t addr) | 48 | static inline void *dma_to_virt(struct device *dev, dma_addr_t addr) |
| 49 | { | 49 | { |
| 50 | return __arch_dma_to_virt(dev, addr); | 50 | return __arch_dma_to_virt(dev, addr); |
| @@ -257,9 +257,11 @@ extern int dma_needs_bounce(struct device*, dma_addr_t, size_t); | |||
| 257 | */ | 257 | */ |
| 258 | extern dma_addr_t dma_map_single(struct device *, void *, size_t, | 258 | extern dma_addr_t dma_map_single(struct device *, void *, size_t, |
| 259 | enum dma_data_direction); | 259 | enum dma_data_direction); |
| 260 | extern void dma_unmap_single(struct device *, dma_addr_t, size_t, | ||
| 261 | enum dma_data_direction); | ||
| 260 | extern dma_addr_t dma_map_page(struct device *, struct page *, | 262 | extern dma_addr_t dma_map_page(struct device *, struct page *, |
| 261 | unsigned long, size_t, enum dma_data_direction); | 263 | unsigned long, size_t, enum dma_data_direction); |
| 262 | extern void dma_unmap_single(struct device *, dma_addr_t, size_t, | 264 | extern void dma_unmap_page(struct device *, dma_addr_t, size_t, |
| 263 | enum dma_data_direction); | 265 | enum dma_data_direction); |
| 264 | 266 | ||
| 265 | /* | 267 | /* |
| @@ -352,7 +354,6 @@ static inline void dma_unmap_single(struct device *dev, dma_addr_t handle, | |||
| 352 | { | 354 | { |
| 353 | /* nothing to do */ | 355 | /* nothing to do */ |
| 354 | } | 356 | } |
| 355 | #endif /* CONFIG_DMABOUNCE */ | ||
| 356 | 357 | ||
| 357 | /** | 358 | /** |
| 358 | * dma_unmap_page - unmap a buffer previously mapped through dma_map_page() | 359 | * dma_unmap_page - unmap a buffer previously mapped through dma_map_page() |
| @@ -371,8 +372,9 @@ static inline void dma_unmap_single(struct device *dev, dma_addr_t handle, | |||
| 371 | static inline void dma_unmap_page(struct device *dev, dma_addr_t handle, | 372 | static inline void dma_unmap_page(struct device *dev, dma_addr_t handle, |
| 372 | size_t size, enum dma_data_direction dir) | 373 | size_t size, enum dma_data_direction dir) |
| 373 | { | 374 | { |
| 374 | dma_unmap_single(dev, handle, size, dir); | 375 | /* nothing to do */ |
| 375 | } | 376 | } |
| 377 | #endif /* CONFIG_DMABOUNCE */ | ||
| 376 | 378 | ||
| 377 | /** | 379 | /** |
| 378 | * dma_sync_single_range_for_cpu | 380 | * dma_sync_single_range_for_cpu |
