summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/include/bus.h
diff options
context:
space:
mode:
authorscottl <scottl@FreeBSD.org>2005-03-14 16:46:28 +0000
committerscottl <scottl@FreeBSD.org>2005-03-14 16:46:28 +0000
commit7be505a03503a9dccdb399c376062a7cf246a8b4 (patch)
treeea782fb9f8249533af78a2cb005772cd4ace3515 /sys/powerpc/include/bus.h
parent8bd55ce9cb3337410e70e9ad26691e99128d0852 (diff)
downloadFreeBSD-src-7be505a03503a9dccdb399c376062a7cf246a8b4.zip
FreeBSD-src-7be505a03503a9dccdb399c376062a7cf246a8b4.tar.gz
Refactor the bus_dma header files so that the interface is described in
sys/bus_dma.h instead of being copied in every single arch. This slightly reorders a flag that was specific to AXP and thus changes the ABI there. The interface still relies on bus_space definitions found in <machine/bus.h> so it cannot be included on its own yet, but that will be fixed at a later date. Add an MD <machine/bus_dma.h> for ever arch for consistency and to allow for future MD augmentation of the API. sparc64 makes heavy use of this right now due to its different bus_dma implemenation.
Diffstat (limited to 'sys/powerpc/include/bus.h')
-rw-r--r--sys/powerpc/include/bus.h183
1 files changed, 1 insertions, 182 deletions
diff --git a/sys/powerpc/include/bus.h b/sys/powerpc/include/bus.h
index af47fc6..5892eef 100644
--- a/sys/powerpc/include/bus.h
+++ b/sys/powerpc/include/bus.h
@@ -740,187 +740,6 @@ bus_space_barrier(bus_space_tag_t tag __unused,
#define BUS_SPACE_ALIGNED_POINTER(p, t) ALIGNED_POINTER(p, t)
-/*
- * Bus DMA methods.
- */
-
-/*
- * Flags used in various bus DMA methods.
- */
-#define BUS_DMA_WAITOK 0x00 /* safe to sleep (pseudo-flag) */
-#define BUS_DMA_NOWAIT 0x01 /* not safe to sleep */
-#define BUS_DMA_ALLOCNOW 0x02 /* perform resource allocation now */
-#define BUS_DMA_COHERENT 0x04 /* hint: map memory DMA coherent */
-#define BUS_DMA_ZERO 0x08 /* allocate zero'ed memory */
-#define BUS_DMA_BUS1 0x10 /* placeholders for bus functions... */
-#define BUS_DMA_BUS2 0x20
-#define BUS_DMA_BUS3 0x40
-#define BUS_DMA_BUS4 0x80
-
-/* Forwards needed by prototypes below. */
-struct mbuf;
-struct uio;
-
-/*
- * Operations performed by bus_dmamap_sync().
- */
-typedef int bus_dmasync_op_t;
-#define BUS_DMASYNC_PREREAD 1
-#define BUS_DMASYNC_POSTREAD 2
-#define BUS_DMASYNC_PREWRITE 4
-#define BUS_DMASYNC_POSTWRITE 8
-
-/*
- * bus_dma_tag_t
- *
- * A machine-dependent opaque type describing the characteristics
- * of how to perform DMA mappings. This structure encapsultes
- * information concerning address and alignment restrictions, number
- * of S/G segments, amount of data per S/G segment, etc.
- */
-typedef struct bus_dma_tag *bus_dma_tag_t;
-
-/*
- * bus_dmamap_t
- *
- * DMA mapping instance information.
- */
-typedef struct bus_dmamap *bus_dmamap_t;
-
-/*
- * bus_dma_segment_t
- *
- * Describes a single contiguous DMA transaction. Values
- * are suitable for programming into DMA registers.
- */
-typedef struct bus_dma_segment {
- bus_addr_t ds_addr; /* DMA address */
- bus_size_t ds_len; /* length of transfer */
-} bus_dma_segment_t;
-
-/*
- * A function that returns 1 if the address cannot be accessed by
- * a device and 0 if it can be.
- */
-typedef int bus_dma_filter_t(void *, bus_addr_t);
-
-/*
- * A function that performs driver-specific syncronization on behalf of
- * busdma.
- */
-typedef enum {
- BUS_DMA_LOCK = 0x01,
- BUS_DMA_UNLOCK = 0x02,
-} bus_dma_lock_op_t;
-
-typedef void bus_dma_lock_t(void *, bus_dma_lock_op_t);
-
-/*
- * Allocate a device specific dma_tag encapsulating the constraints of
- * the parent tag in addition to other restrictions specified:
- *
- * alignment: alignment for segments.
- * boundary: Boundary that segments cannot cross.
- * lowaddr: Low restricted address that cannot appear in a mapping.
- * highaddr: High restricted address that cannot appear in a mapping.
- * filtfunc: An optional function to further test if an address
- * within the range of lowaddr and highaddr cannot appear
- * in a mapping.
- * filtfuncarg: An argument that will be passed to filtfunc in addition
- * to the address to test.
- * maxsize: Maximum mapping size supported by this tag.
- * nsegments: Number of discontinuities allowed in maps.
- * maxsegsz: Maximum size of a segment in the map.
- * flags: Bus DMA flags.
- * dmat: A pointer to set to a valid dma tag should the return
- * value of this function indicate success.
- */
-int bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
- bus_size_t boundary, bus_addr_t lowaddr,
- bus_addr_t highaddr, bus_dma_filter_t *filtfunc,
- void *filtfuncarg, bus_size_t maxsize, int nsegments,
- bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc,
- void *lockfuncarg, bus_dma_tag_t *dmat);
-
-int bus_dma_tag_destroy(bus_dma_tag_t dmat);
-
-/*
- * Allocate a handle for mapping from kva/uva/physical
- * address space into bus device space.
- */
-int bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp);
-
-/*
- * Destroy a handle for mapping from kva/uva/physical
- * address space into bus device space.
- */
-int bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmamap_t map);
-
-/*
- * Allocate a piece of memory that can be efficiently mapped into
- * bus device space based on the constraints lited in the dma tag.
- * A dmamap to for use with dmamap_load is also allocated.
- */
-int bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
- bus_dmamap_t *mapp);
+#include <machine/bus_dma.h>
-/*
- * Free a piece of memory and it's allociated dmamap, that was allocated
- * via bus_dmamem_alloc.
- */
-void bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map);
-
-/*
- * A function that processes a successfully loaded dma map or an error
- * from a delayed load map.
- */
-typedef void bus_dmamap_callback_t(void *, bus_dma_segment_t *, int, int);
-
-/*
- * Map the buffer buf into bus space using the dmamap map.
- */
-int bus_dmamap_load(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf,
- bus_size_t buflen, bus_dmamap_callback_t *callback,
- void *callback_arg, int flags);
-
-/*
- * Like bus_dmamap_callback but includes map size in bytes. This is
- * defined as a separate interface to maintain compatiiblity for users
- * of bus_dmamap_callback_t--at some point these interfaces should be merged.
- */
-typedef void bus_dmamap_callback2_t(void *, bus_dma_segment_t *, int, bus_size_t, int);
-/*
- * Like bus_dmamap_load but for mbufs. Note the use of the
- * bus_dmamap_callback2_t interface.
- */
-int bus_dmamap_load_mbuf(bus_dma_tag_t dmat, bus_dmamap_t map,
- struct mbuf *mbuf,
- bus_dmamap_callback2_t *callback, void *callback_arg,
- int flags);
-int bus_dmamap_load_mbuf_sg(bus_dma_tag_t dmat, bus_dmamap_t map,
- struct mbuf *mbuf, bus_dma_segment_t *segs,
- int *nsegs, int flags);
-/*
- * Like bus_dmamap_load but for uios. Note the use of the
- * bus_dmamap_callback2_t interface.
- */
-int bus_dmamap_load_uio(bus_dma_tag_t dmat, bus_dmamap_t map,
- struct uio *ui,
- bus_dmamap_callback2_t *callback, void *callback_arg,
- int flags);
-
-/*
- * Perform a syncronization operation on the given map.
- */
-void bus_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_dmasync_op_t);
-
-/*
- * Release the mapping held by map.
- */
-void bus_dmamap_unload(bus_dma_tag_t dmat, bus_dmamap_t map);
-
-/*
- * Generic helper function for manipulating mutexes.
- */
-void busdma_lock_mutex(void *arg, bus_dma_lock_op_t op);
#endif /* _MACPPC_BUS_H_ */
OpenPOWER on IntegriCloud