Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 137436
b: refs/heads/master
c: 58edb51
h: refs/heads/master
v: v3
  • Loading branch information
Nicolas Pitre committed Mar 16, 2009
1 parent 91ddf71 commit 3c5abaf
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 43377453af83b8ff8c1c731da1508bd6b84ebfea
refs/heads/master: 58edb515724f9e63e569536d01ac8d8f8ddb367a
7 changes: 7 additions & 0 deletions trunk/arch/arm/common/dmabounce.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/page-flags.h>
#include <linux/device.h>
#include <linux/dma-mapping.h>
#include <linux/dmapool.h>
Expand Down Expand Up @@ -349,6 +350,12 @@ dma_addr_t dma_map_page(struct device *dev, struct page *page,

BUG_ON(!valid_dma_direction(dir));

if (PageHighMem(page)) {
dev_err(dev, "DMA buffer bouncing of HIGHMEM pages "
"is not supported\n");
return ~0;
}

return map_single(dev, page_address(page) + offset, size, dir);
}
EXPORT_SYMBOL(dma_map_page);
Expand Down
10 changes: 10 additions & 0 deletions trunk/arch/arm/include/asm/dma-mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,20 @@
* must not be used by drivers.
*/
#ifndef __arch_page_to_dma

#if !defined(CONFIG_HIGHMEM)
static inline dma_addr_t page_to_dma(struct device *dev, struct page *page)
{
return (dma_addr_t)__virt_to_bus((unsigned long)page_address(page));
}
#elif defined(__pfn_to_bus)
static inline dma_addr_t page_to_dma(struct device *dev, struct page *page)
{
return (dma_addr_t)__pfn_to_bus(page_to_pfn(page));
}
#else
#error "this machine class needs to define __arch_page_to_dma to use HIGHMEM"
#endif

static inline void *dma_to_virt(struct device *dev, dma_addr_t addr)
{
Expand Down
1 change: 1 addition & 0 deletions trunk/arch/arm/include/asm/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ static inline void *phys_to_virt(unsigned long x)
#ifndef __virt_to_bus
#define __virt_to_bus __virt_to_phys
#define __bus_to_virt __phys_to_virt
#define __pfn_to_bus(x) ((x) << PAGE_SHIFT)
#endif

static inline __deprecated unsigned long virt_to_bus(void *x)
Expand Down
5 changes: 4 additions & 1 deletion trunk/arch/arm/mach-iop13xx/include/mach/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ static inline unsigned long __lbus_to_virt(dma_addr_t x)
})

#define __arch_page_to_dma(dev, page) \
__arch_virt_to_dma(dev, page_address(page))
({ \
/* __is_lbus_virt() can never be true for RAM pages */ \
(dma_addr_t)page_to_phys(page); \
})

#endif /* CONFIG_ARCH_IOP13XX */
#endif /* !ASSEMBLY */
Expand Down
6 changes: 5 additions & 1 deletion trunk/arch/arm/mach-ks8695/include/mach/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ extern struct bus_type platform_bus_type;
__phys_to_virt(x) : __bus_to_virt(x)); })
#define __arch_virt_to_dma(dev, x) ({ is_lbus_device(dev) ? \
(dma_addr_t)__virt_to_phys(x) : (dma_addr_t)__virt_to_bus(x); })
#define __arch_page_to_dma(dev, x) __arch_virt_to_dma(dev, page_address(x))
#define __arch_page_to_dma(dev, x) \
({ dma_addr_t __dma = page_to_phys(page); \
if (!is_lbus_device(dev)) \
__dma = __dma - PHYS_OFFSET + KS8695_PCIMEM_PA; \
__dma; })

#endif

Expand Down
8 changes: 5 additions & 3 deletions trunk/arch/arm/plat-omap/include/mach/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@
#define lbus_to_virt(x) ((x) - OMAP1510_LB_OFFSET + PAGE_OFFSET)
#define is_lbus_device(dev) (cpu_is_omap15xx() && dev && (strncmp(dev_name(dev), "ohci", 4) == 0))

#define __arch_page_to_dma(dev, page) ({is_lbus_device(dev) ? \
(dma_addr_t)virt_to_lbus(page_address(page)) : \
(dma_addr_t)__virt_to_phys(page_address(page));})
#define __arch_page_to_dma(dev, page) \
({ dma_addr_t __dma = page_to_phys(page); \
if (is_lbus_device(dev)) \
__dma = __dma - PHYS_OFFSET + OMAP1510_LB_OFFSET; \
__dma; })

#define __arch_dma_to_virt(dev, addr) ({ (void *) (is_lbus_device(dev) ? \
lbus_to_virt(addr) : \
Expand Down

0 comments on commit 3c5abaf

Please sign in to comment.