xref: /netbsd-src/sys/arch/hpcmips/include/bus_dma_hpcmips.h (revision 02cdf4d2c869ecfa1ae5484cf77eefe2fbcc6d94)
1*02cdf4d2Sdsl /*	$NetBSD: bus_dma_hpcmips.h,v 1.5 2009/03/14 14:45:59 dsl Exp $	*/
21d1d5c87Stakemura 
31d1d5c87Stakemura /*-
41d1d5c87Stakemura  * Copyright (c) 2001 TAKEMRUA Shin. All rights reserved.
51d1d5c87Stakemura  *
61d1d5c87Stakemura  * Redistribution and use in source and binary forms, with or without
71d1d5c87Stakemura  * modification, are permitted provided that the following conditions
81d1d5c87Stakemura  * are met:
91d1d5c87Stakemura  * 1. Redistributions of source code must retain the above copyright
101d1d5c87Stakemura  *    notice, this list of conditions and the following disclaimer.
111d1d5c87Stakemura  * 2. Redistributions in binary form must reproduce the above copyright
121d1d5c87Stakemura  *    notice, this list of conditions and the following disclaimer in the
131d1d5c87Stakemura  *    documentation and/or other materials provided with the distribution.
141d1d5c87Stakemura  * 3. Neither the name of the project nor the names of its contributors
151d1d5c87Stakemura  *    may be used to endorse or promote products derived from this software
161d1d5c87Stakemura  *    without specific prior written permission.
171d1d5c87Stakemura  *
181d1d5c87Stakemura  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
191d1d5c87Stakemura  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
201d1d5c87Stakemura  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
211d1d5c87Stakemura  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
221d1d5c87Stakemura  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
231d1d5c87Stakemura  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
241d1d5c87Stakemura  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
251d1d5c87Stakemura  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
261d1d5c87Stakemura  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
271d1d5c87Stakemura  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
281d1d5c87Stakemura  * SUCH DAMAGE.
291d1d5c87Stakemura  *
301d1d5c87Stakemura  */
311d1d5c87Stakemura 
321d1d5c87Stakemura #ifndef _BUS_DMA_HPCMIPS_H_
331d1d5c87Stakemura #define _BUS_DMA_HPCMIPS_H_
341d1d5c87Stakemura 
351d1d5c87Stakemura #define	HPCMIPS_DMAMAP_COHERENT	0x100	/* no cache flush necessary on sync */
361d1d5c87Stakemura 
371d1d5c87Stakemura /*
381d1d5c87Stakemura  *	bus_dma_segment
391d1d5c87Stakemura  *
401d1d5c87Stakemura  *	Describes a single contiguous DMA transaction.  Values
411d1d5c87Stakemura  *	are suitable for programming into DMA registers.
421d1d5c87Stakemura  */
431d1d5c87Stakemura struct bus_dma_segment_hpcmips {
441d1d5c87Stakemura 	bus_addr_t	_ds_vaddr;	/* virtual address, 0 if invalid */
451d1d5c87Stakemura };
461d1d5c87Stakemura 
471d1d5c87Stakemura /*
481d1d5c87Stakemura  *	bus_dma_tag
491d1d5c87Stakemura  *
501d1d5c87Stakemura  *	A machine-dependent opaque type describing the implementation of
511d1d5c87Stakemura  *	DMA for a given bus.
521d1d5c87Stakemura  */
531d1d5c87Stakemura struct bus_dma_tag_hpcmips {
541d1d5c87Stakemura 	struct bus_dma_tag	bdt;
551d1d5c87Stakemura 	void	*_dmamap_chipset_v;
561d1d5c87Stakemura };
571d1d5c87Stakemura 
581d1d5c87Stakemura /*
591d1d5c87Stakemura  *	bus_dmamap
601d1d5c87Stakemura  *
611d1d5c87Stakemura  *	Describes a DMA mapping.
621d1d5c87Stakemura  */
631d1d5c87Stakemura struct bus_dmamap_hpcmips {
641d1d5c87Stakemura 	struct bus_dmamap bdm;
651d1d5c87Stakemura 	bus_size_t	_dm_size;	/* largest DMA transfer mappable */
661d1d5c87Stakemura 	int		_dm_segcnt;	/* number of segs this map can map */
67a6db24a4Smatt 	bus_size_t	_dm_maxmaxsegsz;/* fixed largest possible segment */
681d1d5c87Stakemura 	bus_size_t	_dm_boundary;	/* don't cross this */
691d1d5c87Stakemura 	int		_dm_flags;	/* misc. flags */
701d1d5c87Stakemura 	struct bus_dma_segment_hpcmips _dm_segs[1];
711d1d5c87Stakemura };
721d1d5c87Stakemura 
731d1d5c87Stakemura extern struct bus_dma_tag_hpcmips hpcmips_default_bus_dma_tag;
741d1d5c87Stakemura bus_dma_protos(_hpcmips)
751d1d5c87Stakemura 
76*02cdf4d2Sdsl int	_hpcmips_bd_mem_alloc_range(bus_dma_tag_t tag, bus_size_t size,
778f5ef79dStakemura 	    bus_size_t alignment, bus_size_t boundary,
788f5ef79dStakemura 	    bus_dma_segment_t *segs, int nsegs, int *rsegs, int flags,
79*02cdf4d2Sdsl 	    vaddr_t low, vaddr_t high);
808f5ef79dStakemura 
811d1d5c87Stakemura #endif /* _BUS_DMA_HPCMIPS_H_ */
82