[ARM] make page_to_dma() highmem aware
If a machine class has a custom __virt_to_bus() implementation then it must provide a __arch_page_to_dma() implementation as well which is _not_ based on page_address() to support highmem. This patch fixes existing __arch_page_to_dma() and provide a default implementation otherwise. The default implementation for highmem is based on __pfn_to_bus() which is defined only when no custom __virt_to_bus() is provided by the machine class. That leaves only ebsa110 and footbridge which cannot support highmem until they provide their own __arch_page_to_dma() implementation. But highmem support on those legacy platforms with limited memory is certainly not a priority. Signed-off-by: Nicolas Pitre <nico@marvell.com>
This commit is contained in:
@@ -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) : \
|
||||
|
Reference in New Issue
Block a user