ia64/linux-2.6.18-xen.hg

annotate drivers/ieee1394/dma.h @ 893:f994bfe9b93b

linux/blktap2: reduce TLB flush scope

c/s 885 added very coarse TLB flushing. Since these flushes always
follow single page updates, single page flushes (when available) are
sufficient.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jun 04 10:32:57 2009 +0100 (2009-06-04)
parents 831230e53067
children
rev   line source
ian@0 1 /*
ian@0 2 * DMA region bookkeeping routines
ian@0 3 *
ian@0 4 * Copyright (C) 2002 Maas Digital LLC
ian@0 5 *
ian@0 6 * This code is licensed under the GPL. See the file COPYING in the root
ian@0 7 * directory of the kernel sources for details.
ian@0 8 */
ian@0 9
ian@0 10 #ifndef IEEE1394_DMA_H
ian@0 11 #define IEEE1394_DMA_H
ian@0 12
ian@0 13 #include <linux/pci.h>
ian@0 14 #include <asm/scatterlist.h>
ian@0 15
ian@0 16 /* struct dma_prog_region
ian@0 17
ian@0 18 a small, physically-contiguous DMA buffer with random-access,
ian@0 19 synchronous usage characteristics
ian@0 20 */
ian@0 21
ian@0 22 struct dma_prog_region {
ian@0 23 unsigned char *kvirt; /* kernel virtual address */
ian@0 24 struct pci_dev *dev; /* PCI device */
ian@0 25 unsigned int n_pages; /* # of kernel pages */
ian@0 26 dma_addr_t bus_addr; /* base bus address */
ian@0 27 };
ian@0 28
ian@0 29 /* clear out all fields but do not allocate any memory */
ian@0 30 void dma_prog_region_init(struct dma_prog_region *prog);
ian@0 31 int dma_prog_region_alloc(struct dma_prog_region *prog, unsigned long n_bytes, struct pci_dev *dev);
ian@0 32 void dma_prog_region_free(struct dma_prog_region *prog);
ian@0 33
ian@0 34 static inline dma_addr_t dma_prog_region_offset_to_bus(struct dma_prog_region *prog, unsigned long offset)
ian@0 35 {
ian@0 36 return prog->bus_addr + offset;
ian@0 37 }
ian@0 38
ian@0 39 /* struct dma_region
ian@0 40
ian@0 41 a large, non-physically-contiguous DMA buffer with streaming,
ian@0 42 asynchronous usage characteristics
ian@0 43 */
ian@0 44
ian@0 45 struct dma_region {
ian@0 46 unsigned char *kvirt; /* kernel virtual address */
ian@0 47 struct pci_dev *dev; /* PCI device */
ian@0 48 unsigned int n_pages; /* # of kernel pages */
ian@0 49 unsigned int n_dma_pages; /* # of IOMMU pages */
ian@0 50 struct scatterlist *sglist; /* IOMMU mapping */
ian@0 51 int direction; /* PCI_DMA_TODEVICE, etc */
ian@0 52 };
ian@0 53
ian@0 54 /* clear out all fields but do not allocate anything */
ian@0 55 void dma_region_init(struct dma_region *dma);
ian@0 56
ian@0 57 /* allocate the buffer and map it to the IOMMU */
ian@0 58 int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes, struct pci_dev *dev, int direction);
ian@0 59
ian@0 60 /* unmap and free the buffer */
ian@0 61 void dma_region_free(struct dma_region *dma);
ian@0 62
ian@0 63 /* sync the CPU's view of the buffer */
ian@0 64 void dma_region_sync_for_cpu(struct dma_region *dma, unsigned long offset, unsigned long len);
ian@0 65 /* sync the IO bus' view of the buffer */
ian@0 66 void dma_region_sync_for_device(struct dma_region *dma, unsigned long offset, unsigned long len);
ian@0 67
ian@0 68 /* map the buffer into a user space process */
ian@0 69 int dma_region_mmap(struct dma_region *dma, struct file *file, struct vm_area_struct *vma);
ian@0 70
ian@0 71 /* macro to index into a DMA region (or dma_prog_region) */
ian@0 72 #define dma_region_i(_dma, _type, _index) ( ((_type*) ((_dma)->kvirt)) + (_index) )
ian@0 73
ian@0 74 /* return the DMA bus address of the byte with the given offset
ian@0 75 relative to the beginning of the dma_region */
ian@0 76 dma_addr_t dma_region_offset_to_bus(struct dma_region *dma, unsigned long offset);
ian@0 77
ian@0 78 #endif /* IEEE1394_DMA_H */