Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
2
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
e3d2f92
Documentation
arch
alpha
arm
avr32
blackfin
cris
frv
h8300
ia64
m32r
m68k
m68knommu
mips
mn10300
parisc
configs
hpux
include/asm
Kbuild
agp.h
asmregs.h
assembly.h
atomic.h
auxvec.h
bitops.h
bug.h
bugs.h
byteorder.h
cache.h
cacheflush.h
checksum.h
compat.h
compat_rt_sigframe.h
compat_signal.h
compat_ucontext.h
cputime.h
current.h
delay.h
device.h
div64.h
dma-mapping.h
dma.h
eisa_bus.h
eisa_eeprom.h
elf.h
emergency-restart.h
errno.h
fb.h
fcntl.h
fixmap.h
floppy.h
futex.h
grfioctl.h
hardirq.h
hardware.h
hw_irq.h
ide.h
io.h
ioctl.h
ioctls.h
ipcbuf.h
irq.h
irq_regs.h
kdebug.h
kmap_types.h
led.h
linkage.h
local.h
machdep.h
mc146818rtc.h
mckinley.h
mman.h
mmu.h
mmu_context.h
mmzone.h
module.h
msgbuf.h
mutex.h
page.h
param.h
parisc-device.h
parport.h
pci.h
pdc.h
pdc_chassis.h
pdcpat.h
percpu.h
perf.h
pgalloc.h
pgtable.h
poll.h
posix_types.h
prefetch.h
processor.h
psw.h
ptrace.h
real.h
resource.h
ropes.h
rt_sigframe.h
rtc.h
runway.h
scatterlist.h
sections.h
segment.h
sembuf.h
serial.h
setup.h
shmbuf.h
shmparam.h
sigcontext.h
siginfo.h
signal.h
smp.h
socket.h
sockios.h
spinlock.h
spinlock_types.h
stat.h
statfs.h
string.h
superio.h
system.h
termbits.h
termios.h
thread_info.h
timex.h
tlb.h
tlbflush.h
topology.h
traps.h
types.h
uaccess.h
ucontext.h
unaligned.h
unistd.h
unwind.h
user.h
vga.h
xor.h
kernel
lib
math-emu
mm
oprofile
Kconfig
Kconfig.debug
Makefile
defpalo.conf
install.sh
nm
powerpc
s390
sh
sparc
sparc64
um
x86
xtensa
.gitignore
Kconfig
block
crypto
drivers
firmware
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
usr
virt
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
MAINTAINERS
Makefile
README
REPORTING-BUGS
Breadcrumbs
linux
/
arch
/
parisc
/
include
/
asm
/
dma-mapping.h
Blame
Blame
Latest commit
History
History
253 lines (217 loc) · 8.04 KB
Breadcrumbs
linux
/
arch
/
parisc
/
include
/
asm
/
dma-mapping.h
Top
File metadata and controls
Code
Blame
253 lines (217 loc) · 8.04 KB
Raw
#ifndef _PARISC_DMA_MAPPING_H #define _PARISC_DMA_MAPPING_H #include <linux/mm.h> #include <asm/cacheflush.h> #include <asm/scatterlist.h> /* See Documentation/DMA-mapping.txt */ struct hppa_dma_ops { int (*dma_supported)(struct device *dev, u64 mask); void *(*alloc_consistent)(struct device *dev, size_t size, dma_addr_t *iova, gfp_t flag); void *(*alloc_noncoherent)(struct device *dev, size_t size, dma_addr_t *iova, gfp_t flag); void (*free_consistent)(struct device *dev, size_t size, void *vaddr, dma_addr_t iova); dma_addr_t (*map_single)(struct device *dev, void *addr, size_t size, enum dma_data_direction direction); void (*unmap_single)(struct device *dev, dma_addr_t iova, size_t size, enum dma_data_direction direction); int (*map_sg)(struct device *dev, struct scatterlist *sg, int nents, enum dma_data_direction direction); void (*unmap_sg)(struct device *dev, struct scatterlist *sg, int nhwents, enum dma_data_direction direction); void (*dma_sync_single_for_cpu)(struct device *dev, dma_addr_t iova, unsigned long offset, size_t size, enum dma_data_direction direction); void (*dma_sync_single_for_device)(struct device *dev, dma_addr_t iova, unsigned long offset, size_t size, enum dma_data_direction direction); void (*dma_sync_sg_for_cpu)(struct device *dev, struct scatterlist *sg, int nelems, enum dma_data_direction direction); void (*dma_sync_sg_for_device)(struct device *dev, struct scatterlist *sg, int nelems, enum dma_data_direction direction); }; /* ** We could live without the hppa_dma_ops indirection if we didn't want ** to support 4 different coherent dma models with one binary (they will ** someday be loadable modules): ** I/O MMU consistent method dma_sync behavior ** ============= ====================== ======================= ** a) PA-7x00LC uncachable host memory flush/purge ** b) U2/Uturn cachable host memory NOP ** c) Ike/Astro cachable host memory NOP ** d) EPIC/SAGA memory on EPIC/SAGA flush/reset DMA channel ** ** PA-7[13]00LC processors have a GSC bus interface and no I/O MMU. ** ** Systems (eg PCX-T workstations) that don't fall into the above ** categories will need to modify the needed drivers to perform ** flush/purge and allocate "regular" cacheable pages for everything. */ #ifdef CONFIG_PA11 extern struct hppa_dma_ops pcxl_dma_ops; extern struct hppa_dma_ops pcx_dma_ops; #endif extern struct hppa_dma_ops *hppa_dma_ops; static inline void * dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flag) { return hppa_dma_ops->alloc_consistent(dev, size, dma_handle, flag); } static inline void * dma_alloc_noncoherent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flag) { return hppa_dma_ops->alloc_noncoherent(dev, size, dma_handle, flag); } static inline void dma_free_coherent(struct device *dev, size_t size, void *vaddr, dma_addr_t dma_handle) { hppa_dma_ops->free_consistent(dev, size, vaddr, dma_handle); } static inline void dma_free_noncoherent(struct device *dev, size_t size, void *vaddr, dma_addr_t dma_handle) { hppa_dma_ops->free_consistent(dev, size, vaddr, dma_handle); } static inline dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size, enum dma_data_direction direction) { return hppa_dma_ops->map_single(dev, ptr, size, direction); } static inline void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, enum dma_data_direction direction) { hppa_dma_ops->unmap_single(dev, dma_addr, size, direction); } static inline int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, enum dma_data_direction direction) { return hppa_dma_ops->map_sg(dev, sg, nents, direction); } static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries, enum dma_data_direction direction) { hppa_dma_ops->unmap_sg(dev, sg, nhwentries, direction); } static inline dma_addr_t dma_map_page(struct device *dev, struct page *page, unsigned long offset, size_t size, enum dma_data_direction direction) { return dma_map_single(dev, (page_address(page) + (offset)), size, direction); } static inline void dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size, enum dma_data_direction direction) { dma_unmap_single(dev, dma_address, size, direction); } static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size, enum dma_data_direction direction) { if(hppa_dma_ops->dma_sync_single_for_cpu) hppa_dma_ops->dma_sync_single_for_cpu(dev, dma_handle, 0, size, direction); } static inline void dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size, enum dma_data_direction direction) { if(hppa_dma_ops->dma_sync_single_for_device) hppa_dma_ops->dma_sync_single_for_device(dev, dma_handle, 0, size, direction); } static inline void dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle, unsigned long offset, size_t size, enum dma_data_direction direction) { if(hppa_dma_ops->dma_sync_single_for_cpu) hppa_dma_ops->dma_sync_single_for_cpu(dev, dma_handle, offset, size, direction); } static inline void dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle, unsigned long offset, size_t size, enum dma_data_direction direction) { if(hppa_dma_ops->dma_sync_single_for_device) hppa_dma_ops->dma_sync_single_for_device(dev, dma_handle, offset, size, direction); } static inline void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems, enum dma_data_direction direction) { if(hppa_dma_ops->dma_sync_sg_for_cpu) hppa_dma_ops->dma_sync_sg_for_cpu(dev, sg, nelems, direction); } static inline void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems, enum dma_data_direction direction) { if(hppa_dma_ops->dma_sync_sg_for_device) hppa_dma_ops->dma_sync_sg_for_device(dev, sg, nelems, direction); } static inline int dma_supported(struct device *dev, u64 mask) { return hppa_dma_ops->dma_supported(dev, mask); } static inline int dma_set_mask(struct device *dev, u64 mask) { if(!dev->dma_mask || !dma_supported(dev, mask)) return -EIO; *dev->dma_mask = mask; return 0; } static inline int dma_get_cache_alignment(void) { return dcache_stride; } static inline int dma_is_consistent(struct device *dev, dma_addr_t dma_addr) { return (hppa_dma_ops->dma_sync_single_for_cpu == NULL); } static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size, enum dma_data_direction direction) { if(hppa_dma_ops->dma_sync_single_for_cpu) flush_kernel_dcache_range((unsigned long)vaddr, size); } static inline void * parisc_walk_tree(struct device *dev) { struct device *otherdev; if(likely(dev->platform_data != NULL)) return dev->platform_data; /* OK, just traverse the bus to find it */ for(otherdev = dev->parent; otherdev; otherdev = otherdev->parent) { if(otherdev->platform_data) { dev->platform_data = otherdev->platform_data; break; } } BUG_ON(!dev->platform_data); return dev->platform_data; } #define GET_IOC(dev) (HBA_DATA(parisc_walk_tree(dev))->iommu); #ifdef CONFIG_IOMMU_CCIO struct parisc_device; struct ioc; void * ccio_get_iommu(const struct parisc_device *dev); int ccio_request_resource(const struct parisc_device *dev, struct resource *res); int ccio_allocate_resource(const struct parisc_device *dev, struct resource *res, unsigned long size, unsigned long min, unsigned long max, unsigned long align); #else /* !CONFIG_IOMMU_CCIO */ #define ccio_get_iommu(dev) NULL #define ccio_request_resource(dev, res) insert_resource(&iomem_resource, res) #define ccio_allocate_resource(dev, res, size, min, max, align) \ allocate_resource(&iomem_resource, res, size, min, max, \ align, NULL, NULL) #endif /* !CONFIG_IOMMU_CCIO */ #ifdef CONFIG_IOMMU_SBA struct parisc_device; void * sba_get_iommu(struct parisc_device *dev); #endif /* At the moment, we panic on error for IOMMU resource exaustion */ #define dma_mapping_error(dev, x) 0 #endif
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
You can’t perform that action at this time.