jcs's openbsd hax
openbsd
1/* Public domain. */
2
3#ifndef _LINUX_DMA_MAPPING_H
4#define _LINUX_DMA_MAPPING_H
5
6#include <linux/sizes.h>
7#include <linux/scatterlist.h>
8#include <linux/dma-direction.h>
9
10struct device;
11
12#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : (1ULL<<(n)) -1)
13
14#define DMA_MAPPING_ERROR (dma_addr_t)-1
15
16static inline int
17dma_set_coherent_mask(struct device *dev, uint64_t m)
18{
19 return 0;
20}
21
22static inline int
23dma_set_max_seg_size(struct device *dev, unsigned int sz)
24{
25 return 0;
26}
27
28static inline int
29dma_set_mask(struct device *dev, uint64_t m)
30{
31 return 0;
32}
33
34static inline int
35dma_set_mask_and_coherent(void *dev, uint64_t m)
36{
37 return 0;
38}
39
40static inline bool
41dma_addressing_limited(void *dev)
42{
43 return false;
44}
45
46static inline dma_addr_t
47dma_map_page(void *dev, struct vm_page *page, size_t offset,
48 size_t size, enum dma_data_direction dir)
49{
50 return VM_PAGE_TO_PHYS(page);
51}
52
53static inline void
54dma_unmap_page(void *dev, dma_addr_t addr, size_t size,
55 enum dma_data_direction dir)
56{
57}
58
59static inline int
60dma_mapping_error(void *dev, dma_addr_t addr)
61{
62 return 0;
63}
64
65void *dma_alloc_coherent(struct device *, size_t, dma_addr_t *, int);
66void dma_free_coherent(struct device *, size_t, void *, dma_addr_t);
67
68static inline void *
69dmam_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dva, int gfp)
70{
71 return dma_alloc_coherent(dev, size, dva, gfp);
72}
73
74int dma_get_sgtable(struct device *, struct sg_table *, void *,
75 dma_addr_t, size_t);
76int dma_map_sgtable(struct device *, struct sg_table *,
77 enum dma_data_direction, u_long);
78void dma_unmap_sgtable(struct device *, struct sg_table *,
79 enum dma_data_direction, u_long);
80
81dma_addr_t dma_map_resource(struct device *, phys_addr_t, size_t,
82 enum dma_data_direction, u_long);
83
84#endif