blob: d472805edfa9da0df269effd38c09de607bdd291 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _ASM_IA64_DMA_MAPPING_H
2#define _ASM_IA64_DMA_MAPPING_H
3
4/*
5 * Copyright (C) 2003-2004 Hewlett-Packard Co
6 * David Mosberger-Tang <davidm@hpl.hp.com>
7 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07008#include <asm/machvec.h>
Jens Axboe9b6eccf2007-10-16 11:27:26 +02009#include <linux/scatterlist.h>
Fenghua Yu62fdd762008-10-17 12:14:13 -070010#include <asm/swiotlb.h>
FUJITA Tomonori99162192009-06-17 16:28:14 -070011#include <linux/dma-debug.h>
Fenghua Yu62fdd762008-10-17 12:14:13 -070012
John Keller175add12008-11-24 16:47:17 -060013#define ARCH_HAS_DMA_GET_REQUIRED_MASK
14
Konrad Rzeszutek Wilk9f975352010-12-06 18:24:32 -050015#define DMA_ERROR_CODE 0
16
FUJITA Tomonori160c1d82009-01-05 23:59:02 +090017extern struct dma_map_ops *dma_ops;
Fenghua Yu62fdd762008-10-17 12:14:13 -070018extern struct ia64_machine_vector ia64_mv;
19extern void set_iommu_machvec(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070020
FUJITA Tomonoric2990302009-01-07 02:13:42 +090021extern void machvec_dma_sync_single(struct device *, dma_addr_t, size_t,
22 enum dma_data_direction);
23extern void machvec_dma_sync_sg(struct device *, struct scatterlist *, int,
24 enum dma_data_direction);
25
FUJITA Tomonorid6d0a6a2009-06-17 16:28:13 -070026#define get_dma_ops(dev) platform_dma_get_ops(dev)
FUJITA Tomonorib7ea6e92009-01-05 23:36:13 +090027
FUJITA Tomonoria0b00ca2009-07-10 10:04:56 +090028static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
29{
30 if (!dev->dma_mask)
31 return 0;
32
Jan Beulichac2b3e62009-12-15 16:47:43 -080033 return addr + size - 1 <= *dev->dma_mask;
FUJITA Tomonoria0b00ca2009-07-10 10:04:56 +090034}
35
FUJITA Tomonori8d4f5332009-07-10 10:05:01 +090036static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr)
37{
38 return paddr;
39}
40
41static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr)
42{
43 return daddr;
44}
45
Linus Torvalds1da177e2005-04-16 15:20:36 -070046static inline void
Ralf Baechled3fa72e2006-12-06 20:38:56 -080047dma_cache_sync (struct device *dev, void *vaddr, size_t size,
48 enum dma_data_direction dir)
Linus Torvalds1da177e2005-04-16 15:20:36 -070049{
50 /*
51 * IA-64 is cache-coherent, so this is mostly a no-op. However, we do need to
52 * ensure that dma_cache_sync() enforces order, hence the mb().
53 */
54 mb();
55}
56
Linus Torvalds1da177e2005-04-16 15:20:36 -070057#endif /* _ASM_IA64_DMA_MAPPING_H */