diff options
author | gibbs <gibbs@FreeBSD.org> | 1998-05-06 01:45:55 +0000 |
---|---|---|
committer | gibbs <gibbs@FreeBSD.org> | 1998-05-06 01:45:55 +0000 |
commit | 9fcbed6a43dfce2fa8db10c333549f75ccc532f0 (patch) | |
tree | ac25ae7f494d994614b9ce373f8121c967bfaae8 /sys/amd64/include/bus_dma.h | |
parent | d4f3e52d2b2b2af854dc7de9fbadf00af23455f1 (diff) | |
download | FreeBSD-src-9fcbed6a43dfce2fa8db10c333549f75ccc532f0.zip FreeBSD-src-9fcbed6a43dfce2fa8db10c333549f75ccc532f0.tar.gz |
Implement bus_dmamem_* functions and correct a few nits reported by Peter Wemm.
Diffstat (limited to 'sys/amd64/include/bus_dma.h')
-rw-r--r-- | sys/amd64/include/bus_dma.h | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/sys/amd64/include/bus_dma.h b/sys/amd64/include/bus_dma.h index 4a75073..3d1feca 100644 --- a/sys/amd64/include/bus_dma.h +++ b/sys/amd64/include/bus_dma.h @@ -67,7 +67,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* $Id: bus.h,v 1.1 1998/01/15 07:32:54 gibbs Exp $ */ +/* $Id: bus.h,v 1.2 1998/04/19 15:28:30 bde Exp $ */ #ifndef _I386_BUS_H_ #define _I386_BUS_H_ @@ -93,6 +93,8 @@ typedef u_long bus_size_t; #define BUS_SPACE_MAXADDR_32BIT 0xFFFFFFFF #define BUS_SPACE_MAXADDR 0xFFFFFFFF +#define BUS_SPACE_UNRESTRICTED (~0) + /* * Access methods for bus resources and address space. */ @@ -1196,6 +1198,7 @@ typedef int bus_dma_filter_t(void *, bus_addr_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. @@ -1204,25 +1207,25 @@ typedef int bus_dma_filter_t(void *, bus_addr_t); * 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 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_tag_t *dmat); +/* XXX Should probably allow specification of alignment */ +int bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignemnt, + 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_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. - * - * maxsize: Maximum mapping size supported by this handle. - * nsegments: Number of discontinuities allowed in the map. - * maxsegsz: Maximum size of a segment in the map. */ int bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp); @@ -1233,6 +1236,20 @@ int bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp); 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); + +/* + * 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. */ |