1 1.5 dsl /* $NetBSD: bus_dma_hpcmips.h,v 1.5 2009/03/14 14:45:59 dsl Exp $ */ 2 1.1 takemura 3 1.1 takemura /*- 4 1.1 takemura * Copyright (c) 2001 TAKEMRUA Shin. All rights reserved. 5 1.1 takemura * 6 1.1 takemura * Redistribution and use in source and binary forms, with or without 7 1.1 takemura * modification, are permitted provided that the following conditions 8 1.1 takemura * are met: 9 1.1 takemura * 1. Redistributions of source code must retain the above copyright 10 1.1 takemura * notice, this list of conditions and the following disclaimer. 11 1.1 takemura * 2. Redistributions in binary form must reproduce the above copyright 12 1.1 takemura * notice, this list of conditions and the following disclaimer in the 13 1.1 takemura * documentation and/or other materials provided with the distribution. 14 1.1 takemura * 3. Neither the name of the project nor the names of its contributors 15 1.1 takemura * may be used to endorse or promote products derived from this software 16 1.1 takemura * without specific prior written permission. 17 1.1 takemura * 18 1.1 takemura * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19 1.1 takemura * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 1.1 takemura * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 1.1 takemura * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22 1.1 takemura * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 1.1 takemura * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 1.1 takemura * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 1.1 takemura * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 1.1 takemura * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 1.1 takemura * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 1.1 takemura * SUCH DAMAGE. 29 1.1 takemura * 30 1.1 takemura */ 31 1.1 takemura 32 1.1 takemura #ifndef _BUS_DMA_HPCMIPS_H_ 33 1.1 takemura #define _BUS_DMA_HPCMIPS_H_ 34 1.1 takemura 35 1.1 takemura #define HPCMIPS_DMAMAP_COHERENT 0x100 /* no cache flush necessary on sync */ 36 1.1 takemura 37 1.1 takemura /* 38 1.1 takemura * bus_dma_segment 39 1.1 takemura * 40 1.1 takemura * Describes a single contiguous DMA transaction. Values 41 1.1 takemura * are suitable for programming into DMA registers. 42 1.1 takemura */ 43 1.1 takemura struct bus_dma_segment_hpcmips { 44 1.1 takemura bus_addr_t _ds_vaddr; /* virtual address, 0 if invalid */ 45 1.1 takemura }; 46 1.1 takemura 47 1.1 takemura /* 48 1.1 takemura * bus_dma_tag 49 1.1 takemura * 50 1.1 takemura * A machine-dependent opaque type describing the implementation of 51 1.1 takemura * DMA for a given bus. 52 1.1 takemura */ 53 1.1 takemura struct bus_dma_tag_hpcmips { 54 1.1 takemura struct bus_dma_tag bdt; 55 1.1 takemura void *_dmamap_chipset_v; 56 1.1 takemura }; 57 1.1 takemura 58 1.1 takemura /* 59 1.1 takemura * bus_dmamap 60 1.1 takemura * 61 1.1 takemura * Describes a DMA mapping. 62 1.1 takemura */ 63 1.1 takemura struct bus_dmamap_hpcmips { 64 1.1 takemura struct bus_dmamap bdm; 65 1.1 takemura bus_size_t _dm_size; /* largest DMA transfer mappable */ 66 1.1 takemura int _dm_segcnt; /* number of segs this map can map */ 67 1.3 matt bus_size_t _dm_maxmaxsegsz;/* fixed largest possible segment */ 68 1.1 takemura bus_size_t _dm_boundary; /* don't cross this */ 69 1.1 takemura int _dm_flags; /* misc. flags */ 70 1.1 takemura struct bus_dma_segment_hpcmips _dm_segs[1]; 71 1.1 takemura }; 72 1.1 takemura 73 1.1 takemura extern struct bus_dma_tag_hpcmips hpcmips_default_bus_dma_tag; 74 1.1 takemura bus_dma_protos(_hpcmips) 75 1.2 takemura 76 1.5 dsl int _hpcmips_bd_mem_alloc_range(bus_dma_tag_t tag, bus_size_t size, 77 1.2 takemura bus_size_t alignment, bus_size_t boundary, 78 1.2 takemura bus_dma_segment_t *segs, int nsegs, int *rsegs, int flags, 79 1.5 dsl vaddr_t low, vaddr_t high); 80 1.1 takemura 81 1.1 takemura #endif /* _BUS_DMA_HPCMIPS_H_ */ 82