xref: /freebsd/sys/arm/include/bus_dma.h (revision 5974e5c71cb4a1d9b23559c1f17f291e911dfb6a)
15974e5c7SScott Long /*	$NetBSD: bus.h,v 1.11 2003/07/28 17:35:54 thorpej Exp $	*/
25974e5c7SScott Long 
35974e5c7SScott Long /*-
45974e5c7SScott Long  * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
55974e5c7SScott Long  * All rights reserved.
65974e5c7SScott Long  *
75974e5c7SScott Long  * This code is derived from software contributed to The NetBSD Foundation
85974e5c7SScott Long  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
95974e5c7SScott Long  * NASA Ames Research Center.
105974e5c7SScott Long  *
115974e5c7SScott Long  * Redistribution and use in source and binary forms, with or without
125974e5c7SScott Long  * modification, are permitted provided that the following conditions
135974e5c7SScott Long  * are met:
145974e5c7SScott Long  * 1. Redistributions of source code must retain the above copyright
155974e5c7SScott Long  *    notice, this list of conditions and the following disclaimer.
165974e5c7SScott Long  * 2. Redistributions in binary form must reproduce the above copyright
175974e5c7SScott Long  *    notice, this list of conditions and the following disclaimer in the
185974e5c7SScott Long  *    documentation and/or other materials provided with the distribution.
195974e5c7SScott Long  * 3. All advertising materials mentioning features or use of this software
205974e5c7SScott Long  *    must display the following acknowledgement:
215974e5c7SScott Long  *	This product includes software developed by the NetBSD
225974e5c7SScott Long  *	Foundation, Inc. and its contributors.
235974e5c7SScott Long  * 4. Neither the name of The NetBSD Foundation nor the names of its
245974e5c7SScott Long  *    contributors may be used to endorse or promote products derived
255974e5c7SScott Long  *    from this software without specific prior written permission.
265974e5c7SScott Long  *
275974e5c7SScott Long  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
285974e5c7SScott Long  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
295974e5c7SScott Long  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
305974e5c7SScott Long  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
315974e5c7SScott Long  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
325974e5c7SScott Long  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
335974e5c7SScott Long  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
345974e5c7SScott Long  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
355974e5c7SScott Long  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
365974e5c7SScott Long  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
375974e5c7SScott Long  * POSSIBILITY OF SUCH DAMAGE.
385974e5c7SScott Long  */
395974e5c7SScott Long 
405974e5c7SScott Long /*-
415974e5c7SScott Long  * Copyright (c) 1996 Charles M. Hannum.  All rights reserved.
425974e5c7SScott Long  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
435974e5c7SScott Long  *
445974e5c7SScott Long  * Redistribution and use in source and binary forms, with or without
455974e5c7SScott Long  * modification, are permitted provided that the following conditions
465974e5c7SScott Long  * are met:
475974e5c7SScott Long  * 1. Redistributions of source code must retain the above copyright
485974e5c7SScott Long  *    notice, this list of conditions and the following disclaimer.
495974e5c7SScott Long  * 2. Redistributions in binary form must reproduce the above copyright
505974e5c7SScott Long  *    notice, this list of conditions and the following disclaimer in the
515974e5c7SScott Long  *    documentation and/or other materials provided with the distribution.
525974e5c7SScott Long  * 3. All advertising materials mentioning features or use of this software
535974e5c7SScott Long  *    must display the following acknowledgement:
545974e5c7SScott Long  *      This product includes software developed by Christopher G. Demetriou
555974e5c7SScott Long  *	for the NetBSD Project.
565974e5c7SScott Long  * 4. The name of the author may not be used to endorse or promote products
575974e5c7SScott Long  *    derived from this software without specific prior written permission
585974e5c7SScott Long  *
595974e5c7SScott Long  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
605974e5c7SScott Long  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
615974e5c7SScott Long  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
625974e5c7SScott Long  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
635974e5c7SScott Long  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
645974e5c7SScott Long  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
655974e5c7SScott Long  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
665974e5c7SScott Long  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
675974e5c7SScott Long  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
685974e5c7SScott Long  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
695974e5c7SScott Long  *
705974e5c7SScott Long  * $FreeBSD$
715974e5c7SScott Long  */
725974e5c7SScott Long 
735974e5c7SScott Long #ifndef _ARM_BUS_DMA_H
745974e5c7SScott Long #define _ARM_BUS_DMA_H
755974e5c7SScott Long 
765974e5c7SScott Long #include <sys/bus_dma.h>
775974e5c7SScott Long 
785974e5c7SScott Long /* Bus Space DMA macros */
795974e5c7SScott Long 
805974e5c7SScott Long #define BUS_DMA_TAG_VALID(t)    ((t) != (bus_dma_tag_t)0)
815974e5c7SScott Long 
825974e5c7SScott Long #ifdef _ARM32_BUS_DMA_PRIVATE
835974e5c7SScott Long /*
845974e5c7SScott Long  *	arm32_dma_range
855974e5c7SScott Long  *
865974e5c7SScott Long  *	This structure describes a valid DMA range.
875974e5c7SScott Long  */
885974e5c7SScott Long struct arm32_dma_range {
895974e5c7SScott Long 	bus_addr_t	dr_sysbase;	/* system base address */
905974e5c7SScott Long 	bus_addr_t	dr_busbase;	/* appears here on bus */
915974e5c7SScott Long 	bus_size_t	dr_len;		/* length of range */
925974e5c7SScott Long };
935974e5c7SScott Long 
945974e5c7SScott Long /* _dm_buftype */
955974e5c7SScott Long #define	ARM32_BUFTYPE_INVALID		0
965974e5c7SScott Long #define	ARM32_BUFTYPE_LINEAR		1
975974e5c7SScott Long #define	ARM32_BUFTYPE_MBUF		2
985974e5c7SScott Long #define	ARM32_BUFTYPE_UIO		3
995974e5c7SScott Long #define	ARM32_BUFTYPE_RAW		4
1005974e5c7SScott Long 
1015974e5c7SScott Long struct arm32_dma_range	*bus_dma_get_range(void);
1025974e5c7SScott Long int	bus_dma_get_range_nb(void);
1035974e5c7SScott Long 
1045974e5c7SScott Long #endif /* _ARM32_BUS_DMA_PRIVATE */
1055974e5c7SScott Long 
1065974e5c7SScott Long #endif /* _ARM_BUS_DMA_H */
107