1*1b968d3cSsimonb /* $NetBSD: isa_machdep.h,v 1.9 2020/07/26 08:08:41 simonb Exp $ */ 291785659Ssimonb 391785659Ssimonb /*- 491785659Ssimonb * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. 591785659Ssimonb * All rights reserved. 691785659Ssimonb * 791785659Ssimonb * This code is derived from software contributed to The NetBSD Foundation 891785659Ssimonb * by Jason R. Thorpe. 991785659Ssimonb * 1091785659Ssimonb * Redistribution and use in source and binary forms, with or without 1191785659Ssimonb * modification, are permitted provided that the following conditions 1291785659Ssimonb * are met: 1391785659Ssimonb * 1. Redistributions of source code must retain the above copyright 1491785659Ssimonb * notice, this list of conditions and the following disclaimer. 1591785659Ssimonb * 2. Redistributions in binary form must reproduce the above copyright 1691785659Ssimonb * notice, this list of conditions and the following disclaimer in the 1791785659Ssimonb * documentation and/or other materials provided with the distribution. 1891785659Ssimonb * 1991785659Ssimonb * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 2091785659Ssimonb * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2191785659Ssimonb * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2291785659Ssimonb * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 2391785659Ssimonb * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2491785659Ssimonb * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2591785659Ssimonb * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2691785659Ssimonb * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2791785659Ssimonb * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2891785659Ssimonb * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2991785659Ssimonb * POSSIBILITY OF SUCH DAMAGE. 3091785659Ssimonb */ 3191785659Ssimonb 3291785659Ssimonb /* 3391785659Ssimonb * Copyright (c) 1996 Carnegie-Mellon University. 3491785659Ssimonb * All rights reserved. 3591785659Ssimonb * 3691785659Ssimonb * Author: Chris G. Demetriou 3791785659Ssimonb * 3891785659Ssimonb * Permission to use, copy, modify and distribute this software and 3991785659Ssimonb * its documentation is hereby granted, provided that both the copyright 4091785659Ssimonb * notice and this permission notice appear in all copies of the 4191785659Ssimonb * software, derivative works or modified versions, and any portions 4291785659Ssimonb * thereof, and that both notices appear in supporting documentation. 4391785659Ssimonb * 4491785659Ssimonb * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 4591785659Ssimonb * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 4691785659Ssimonb * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 4791785659Ssimonb * 4891785659Ssimonb * Carnegie Mellon requests users of this software to return to 4991785659Ssimonb * 5091785659Ssimonb * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 5191785659Ssimonb * School of Computer Science 5291785659Ssimonb * Carnegie Mellon University 5391785659Ssimonb * Pittsburgh PA 15213-3890 5491785659Ssimonb * 5591785659Ssimonb * any improvements or extensions that they make and grant Carnegie the 5691785659Ssimonb * rights to redistribute these changes. 5791785659Ssimonb */ 5891785659Ssimonb 5991785659Ssimonb #include <dev/isa/isadmavar.h> 6091785659Ssimonb 6191785659Ssimonb /* 6291785659Ssimonb * Types provided to machine-independent ISA code. 6391785659Ssimonb */ 6491785659Ssimonb typedef struct mips_isa_chipset *isa_chipset_tag_t; 6591785659Ssimonb 6691785659Ssimonb struct mips_isa_chipset { 6791785659Ssimonb void *ic_v; 6891785659Ssimonb 6991785659Ssimonb struct isa_dma_state ic_dmastate; 7091785659Ssimonb 71290a34a0Smatt void (*ic_attach_hook)(device_t, device_t, 7291785659Ssimonb struct isabus_attach_args *); 7391785659Ssimonb const struct evcnt *(*ic_intr_evcnt)(void *, int); 7491785659Ssimonb void *(*ic_intr_establish)(void *, int, int, int, 7591785659Ssimonb int (*)(void *), void *); 7691785659Ssimonb void (*ic_intr_disestablish)(void *, void *); 7791785659Ssimonb int (*ic_intr_alloc)(void *, int, int, int *); 7891785659Ssimonb 79381c27a7Smacallan const char *(*ic_intr_string)(void *, int, char *, size_t); 80ab367b5fSdyoung void (*ic_detach_hook)(isa_chipset_tag_t, device_t); 8191785659Ssimonb }; 8291785659Ssimonb 8391785659Ssimonb 8491785659Ssimonb /* 8591785659Ssimonb * Functions provided to machine-independent ISA code. 8691785659Ssimonb */ 8791785659Ssimonb #define isa_attach_hook(p, s, a) \ 8891785659Ssimonb (*(a)->iba_ic->ic_attach_hook)((p), (s), (a)) 89ab367b5fSdyoung #define isa_detach_hook(c, s) \ 90ab367b5fSdyoung (*(c)->ic_detach_hook)((c), (s)) 9191785659Ssimonb #define isa_intr_evcnt(c, i) \ 9291785659Ssimonb (*(c)->ic_intr_evcnt)((c)->ic_v, (i)) 9391785659Ssimonb #define isa_intr_establish(c, i, t, l, f, a) \ 9491785659Ssimonb (*(c)->ic_intr_establish)((c)->ic_v, (i), (t), (l), (f), (a)) 95e1d3e1b0Sjdolecek #define isa_intr_establish_xname(c, i, t, l, f, a, x) \ 96e1d3e1b0Sjdolecek (*(c)->ic_intr_establish)((c)->ic_v, (i), (t), (l), (f), (a)) 9791785659Ssimonb #define isa_intr_disestablish(c, h) \ 9891785659Ssimonb (*(c)->ic_intr_disestablish)((c)->ic_v, (h)) 9991785659Ssimonb #define isa_intr_alloc(c, m, t, i) \ 10091785659Ssimonb (*(c)->ic_intr_alloc)((c)->ic_v, (m), (t), (i)) 10191785659Ssimonb 10291785659Ssimonb #define isa_dmainit(ic, bst, dmat, d) \ 10391785659Ssimonb _isa_dmainit(&(ic)->ic_dmastate, (bst), (dmat), (d)) 104ab367b5fSdyoung #define isa_dmadestroy(ic) \ 105ab367b5fSdyoung _isa_dmadestroy(&(ic)->ic_dmastate) 10691785659Ssimonb #define isa_dmacascade(ic, c) \ 10791785659Ssimonb _isa_dmacascade(&(ic)->ic_dmastate, (c)) 10891785659Ssimonb #define isa_dmamaxsize(ic, c) \ 10991785659Ssimonb _isa_dmamaxsize(&(ic)->ic_dmastate, (c)) 11091785659Ssimonb #define isa_dmamap_create(ic, c, s, f) \ 11191785659Ssimonb _isa_dmamap_create(&(ic)->ic_dmastate, (c), (s), (f)) 11291785659Ssimonb #define isa_dmamap_destroy(ic, c) \ 11391785659Ssimonb _isa_dmamap_destroy(&(ic)->ic_dmastate, (c)) 11491785659Ssimonb #define isa_dmastart(ic, c, a, n, p, f, bf) \ 11591785659Ssimonb _isa_dmastart(&(ic)->ic_dmastate, (c), (a), (n), (p), (f), (bf)) 11691785659Ssimonb #define isa_dmaabort(ic, c) \ 11791785659Ssimonb _isa_dmaabort(&(ic)->ic_dmastate, (c)) 11891785659Ssimonb #define isa_dmacount(ic, c) \ 11991785659Ssimonb _isa_dmacount(&(ic)->ic_dmastate, (c)) 12091785659Ssimonb #define isa_dmafinished(ic, c) \ 12191785659Ssimonb _isa_dmafinished(&(ic)->ic_dmastate, (c)) 12291785659Ssimonb #define isa_dmadone(ic, c) \ 12391785659Ssimonb _isa_dmadone(&(ic)->ic_dmastate, (c)) 12491785659Ssimonb #define isa_dmafreeze(ic) \ 12591785659Ssimonb _isa_dmafreeze(&(ic)->ic_dmastate) 12691785659Ssimonb #define isa_dmathaw(ic) \ 12791785659Ssimonb _isa_dmathaw(&(ic)->ic_dmastate) 12891785659Ssimonb #define isa_dmamem_alloc(ic, c, s, ap, f) \ 12991785659Ssimonb _isa_dmamem_alloc(&(ic)->ic_dmastate, (c), (s), (ap), (f)) 13091785659Ssimonb #define isa_dmamem_free(ic, c, a, s) \ 13191785659Ssimonb _isa_dmamem_free(&(ic)->ic_dmastate, (c), (a), (s)) 13291785659Ssimonb #define isa_dmamem_map(ic, c, a, s, kp, f) \ 13391785659Ssimonb _isa_dmamem_map(&(ic)->ic_dmastate, (c), (a), (s), (kp), (f)) 13491785659Ssimonb #define isa_dmamem_unmap(ic, c, k, s) \ 13591785659Ssimonb _isa_dmamem_unmap(&(ic)->ic_dmastate, (c), (k), (s)) 13691785659Ssimonb #define isa_dmamem_mmap(ic, c, a, s, o, p, f) \ 13791785659Ssimonb _isa_dmamem_mmap(&(ic)->ic_dmastate, (c), (a), (s), (o), (p), (f)) 138d88cf589Sfvdl #define isa_drq_alloc(ic, c) \ 139d88cf589Sfvdl _isa_drq_alloc(&(ic)->ic_dmastate, c) 140d88cf589Sfvdl #define isa_drq_free(ic, c) \ 141d88cf589Sfvdl _isa_drq_free(&(ic)->ic_dmastate, c) 14291785659Ssimonb #define isa_drq_isfree(ic, c) \ 14391785659Ssimonb _isa_drq_isfree(&(ic)->ic_dmastate, (c)) 14491785659Ssimonb #define isa_malloc(ic, c, s, p, f) \ 14591785659Ssimonb _isa_malloc(&(ic)->ic_dmastate, (c), (s), (p), (f)) 14691785659Ssimonb #define isa_free(a, p) \ 14791785659Ssimonb _isa_free((a), (p)) 14891785659Ssimonb #define isa_mappage(m, o, p) \ 14991785659Ssimonb _isa_mappage((m), (o), (p)) 15091785659Ssimonb 15191785659Ssimonb /* 15291785659Ssimonb * mips-specific ISA functions. 15391785659Ssimonb * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE. 15491785659Ssimonb */ 155e58a356cSchristos #define isa_intr_string(c, i, buf, len) \ 156e58a356cSchristos (*(c)->ic_intr_string)((c)->ic_v, (i), buf, len) 15791785659Ssimonb 15891785659Ssimonb #ifdef _MIPS_BUS_DMA_PRIVATE 15991785659Ssimonb int isadma_bounce_dmamap_create(bus_dma_tag_t, bus_size_t, int, 16091785659Ssimonb bus_size_t, bus_size_t, int, bus_dmamap_t *); 16191785659Ssimonb void isadma_bounce_dmamap_destroy(bus_dma_tag_t, bus_dmamap_t); 16291785659Ssimonb int isadma_bounce_dmamap_load(bus_dma_tag_t, bus_dmamap_t, void *, 16391785659Ssimonb bus_size_t, struct proc *, int); 16491785659Ssimonb int isadma_bounce_dmamap_load_mbuf(bus_dma_tag_t, bus_dmamap_t, 16591785659Ssimonb struct mbuf *, int); 16691785659Ssimonb int isadma_bounce_dmamap_load_uio(bus_dma_tag_t, bus_dmamap_t, 16791785659Ssimonb struct uio *, int); 16891785659Ssimonb int isadma_bounce_dmamap_load_raw(bus_dma_tag_t, bus_dmamap_t, 16991785659Ssimonb bus_dma_segment_t *, int, bus_size_t, int); 17091785659Ssimonb void isadma_bounce_dmamap_unload(bus_dma_tag_t, bus_dmamap_t); 17191785659Ssimonb void isadma_bounce_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, 17291785659Ssimonb bus_addr_t, bus_size_t, int); 17391785659Ssimonb 17491785659Ssimonb int isadma_bounce_dmamem_alloc(bus_dma_tag_t, bus_size_t, bus_size_t, 17591785659Ssimonb bus_size_t, bus_dma_segment_t *, int, int *, int); 17691785659Ssimonb #endif /* _MIPS_BUS_DMA_PRIVATE */ 177