isa_machdep.h revision 1.9 1 1.9 simonb /* $NetBSD: isa_machdep.h,v 1.9 2020/07/26 08:08:41 simonb Exp $ */
2 1.1 simonb
3 1.1 simonb /*-
4 1.1 simonb * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
5 1.1 simonb * All rights reserved.
6 1.1 simonb *
7 1.1 simonb * This code is derived from software contributed to The NetBSD Foundation
8 1.1 simonb * by Jason R. Thorpe.
9 1.1 simonb *
10 1.1 simonb * Redistribution and use in source and binary forms, with or without
11 1.1 simonb * modification, are permitted provided that the following conditions
12 1.1 simonb * are met:
13 1.1 simonb * 1. Redistributions of source code must retain the above copyright
14 1.1 simonb * notice, this list of conditions and the following disclaimer.
15 1.1 simonb * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 simonb * notice, this list of conditions and the following disclaimer in the
17 1.1 simonb * documentation and/or other materials provided with the distribution.
18 1.1 simonb *
19 1.1 simonb * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 1.1 simonb * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 1.1 simonb * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 1.1 simonb * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 1.1 simonb * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 1.1 simonb * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 1.1 simonb * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 1.1 simonb * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 1.1 simonb * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 1.1 simonb * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 1.1 simonb * POSSIBILITY OF SUCH DAMAGE.
30 1.1 simonb */
31 1.1 simonb
32 1.1 simonb /*
33 1.1 simonb * Copyright (c) 1996 Carnegie-Mellon University.
34 1.1 simonb * All rights reserved.
35 1.1 simonb *
36 1.1 simonb * Author: Chris G. Demetriou
37 1.1 simonb *
38 1.1 simonb * Permission to use, copy, modify and distribute this software and
39 1.1 simonb * its documentation is hereby granted, provided that both the copyright
40 1.1 simonb * notice and this permission notice appear in all copies of the
41 1.1 simonb * software, derivative works or modified versions, and any portions
42 1.1 simonb * thereof, and that both notices appear in supporting documentation.
43 1.1 simonb *
44 1.1 simonb * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
45 1.1 simonb * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
46 1.1 simonb * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
47 1.1 simonb *
48 1.1 simonb * Carnegie Mellon requests users of this software to return to
49 1.1 simonb *
50 1.1 simonb * Software Distribution Coordinator or Software.Distribution (at) CS.CMU.EDU
51 1.1 simonb * School of Computer Science
52 1.1 simonb * Carnegie Mellon University
53 1.1 simonb * Pittsburgh PA 15213-3890
54 1.1 simonb *
55 1.1 simonb * any improvements or extensions that they make and grant Carnegie the
56 1.1 simonb * rights to redistribute these changes.
57 1.1 simonb */
58 1.1 simonb
59 1.1 simonb #include <dev/isa/isadmavar.h>
60 1.1 simonb
61 1.1 simonb /*
62 1.1 simonb * Types provided to machine-independent ISA code.
63 1.1 simonb */
64 1.1 simonb typedef struct mips_isa_chipset *isa_chipset_tag_t;
65 1.1 simonb
66 1.1 simonb struct mips_isa_chipset {
67 1.1 simonb void *ic_v;
68 1.1 simonb
69 1.1 simonb struct isa_dma_state ic_dmastate;
70 1.1 simonb
71 1.5 matt void (*ic_attach_hook)(device_t, device_t,
72 1.1 simonb struct isabus_attach_args *);
73 1.1 simonb const struct evcnt *(*ic_intr_evcnt)(void *, int);
74 1.1 simonb void *(*ic_intr_establish)(void *, int, int, int,
75 1.1 simonb int (*)(void *), void *);
76 1.1 simonb void (*ic_intr_disestablish)(void *, void *);
77 1.1 simonb int (*ic_intr_alloc)(void *, int, int, int *);
78 1.1 simonb
79 1.7 macallan const char *(*ic_intr_string)(void *, int, char *, size_t);
80 1.4 dyoung void (*ic_detach_hook)(isa_chipset_tag_t, device_t);
81 1.1 simonb };
82 1.1 simonb
83 1.1 simonb
84 1.1 simonb /*
85 1.1 simonb * Functions provided to machine-independent ISA code.
86 1.1 simonb */
87 1.1 simonb #define isa_attach_hook(p, s, a) \
88 1.1 simonb (*(a)->iba_ic->ic_attach_hook)((p), (s), (a))
89 1.4 dyoung #define isa_detach_hook(c, s) \
90 1.4 dyoung (*(c)->ic_detach_hook)((c), (s))
91 1.1 simonb #define isa_intr_evcnt(c, i) \
92 1.1 simonb (*(c)->ic_intr_evcnt)((c)->ic_v, (i))
93 1.1 simonb #define isa_intr_establish(c, i, t, l, f, a) \
94 1.1 simonb (*(c)->ic_intr_establish)((c)->ic_v, (i), (t), (l), (f), (a))
95 1.8 jdolecek #define isa_intr_establish_xname(c, i, t, l, f, a, x) \
96 1.8 jdolecek (*(c)->ic_intr_establish)((c)->ic_v, (i), (t), (l), (f), (a))
97 1.1 simonb #define isa_intr_disestablish(c, h) \
98 1.1 simonb (*(c)->ic_intr_disestablish)((c)->ic_v, (h))
99 1.1 simonb #define isa_intr_alloc(c, m, t, i) \
100 1.1 simonb (*(c)->ic_intr_alloc)((c)->ic_v, (m), (t), (i))
101 1.1 simonb
102 1.1 simonb #define isa_dmainit(ic, bst, dmat, d) \
103 1.1 simonb _isa_dmainit(&(ic)->ic_dmastate, (bst), (dmat), (d))
104 1.4 dyoung #define isa_dmadestroy(ic) \
105 1.4 dyoung _isa_dmadestroy(&(ic)->ic_dmastate)
106 1.1 simonb #define isa_dmacascade(ic, c) \
107 1.1 simonb _isa_dmacascade(&(ic)->ic_dmastate, (c))
108 1.1 simonb #define isa_dmamaxsize(ic, c) \
109 1.1 simonb _isa_dmamaxsize(&(ic)->ic_dmastate, (c))
110 1.1 simonb #define isa_dmamap_create(ic, c, s, f) \
111 1.1 simonb _isa_dmamap_create(&(ic)->ic_dmastate, (c), (s), (f))
112 1.1 simonb #define isa_dmamap_destroy(ic, c) \
113 1.1 simonb _isa_dmamap_destroy(&(ic)->ic_dmastate, (c))
114 1.1 simonb #define isa_dmastart(ic, c, a, n, p, f, bf) \
115 1.1 simonb _isa_dmastart(&(ic)->ic_dmastate, (c), (a), (n), (p), (f), (bf))
116 1.1 simonb #define isa_dmaabort(ic, c) \
117 1.1 simonb _isa_dmaabort(&(ic)->ic_dmastate, (c))
118 1.1 simonb #define isa_dmacount(ic, c) \
119 1.1 simonb _isa_dmacount(&(ic)->ic_dmastate, (c))
120 1.1 simonb #define isa_dmafinished(ic, c) \
121 1.1 simonb _isa_dmafinished(&(ic)->ic_dmastate, (c))
122 1.1 simonb #define isa_dmadone(ic, c) \
123 1.1 simonb _isa_dmadone(&(ic)->ic_dmastate, (c))
124 1.1 simonb #define isa_dmafreeze(ic) \
125 1.1 simonb _isa_dmafreeze(&(ic)->ic_dmastate)
126 1.1 simonb #define isa_dmathaw(ic) \
127 1.1 simonb _isa_dmathaw(&(ic)->ic_dmastate)
128 1.1 simonb #define isa_dmamem_alloc(ic, c, s, ap, f) \
129 1.1 simonb _isa_dmamem_alloc(&(ic)->ic_dmastate, (c), (s), (ap), (f))
130 1.1 simonb #define isa_dmamem_free(ic, c, a, s) \
131 1.1 simonb _isa_dmamem_free(&(ic)->ic_dmastate, (c), (a), (s))
132 1.1 simonb #define isa_dmamem_map(ic, c, a, s, kp, f) \
133 1.1 simonb _isa_dmamem_map(&(ic)->ic_dmastate, (c), (a), (s), (kp), (f))
134 1.1 simonb #define isa_dmamem_unmap(ic, c, k, s) \
135 1.1 simonb _isa_dmamem_unmap(&(ic)->ic_dmastate, (c), (k), (s))
136 1.1 simonb #define isa_dmamem_mmap(ic, c, a, s, o, p, f) \
137 1.1 simonb _isa_dmamem_mmap(&(ic)->ic_dmastate, (c), (a), (s), (o), (p), (f))
138 1.9 simonb #define isa_drq_alloc(ic, c) \
139 1.2 fvdl _isa_drq_alloc(&(ic)->ic_dmastate, c)
140 1.9 simonb #define isa_drq_free(ic, c) \
141 1.2 fvdl _isa_drq_free(&(ic)->ic_dmastate, c)
142 1.1 simonb #define isa_drq_isfree(ic, c) \
143 1.1 simonb _isa_drq_isfree(&(ic)->ic_dmastate, (c))
144 1.1 simonb #define isa_malloc(ic, c, s, p, f) \
145 1.1 simonb _isa_malloc(&(ic)->ic_dmastate, (c), (s), (p), (f))
146 1.1 simonb #define isa_free(a, p) \
147 1.1 simonb _isa_free((a), (p))
148 1.1 simonb #define isa_mappage(m, o, p) \
149 1.1 simonb _isa_mappage((m), (o), (p))
150 1.1 simonb
151 1.1 simonb /*
152 1.1 simonb * mips-specific ISA functions.
153 1.1 simonb * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
154 1.9 simonb */
155 1.6 christos #define isa_intr_string(c, i, buf, len) \
156 1.6 christos (*(c)->ic_intr_string)((c)->ic_v, (i), buf, len)
157 1.1 simonb
158 1.1 simonb #ifdef _MIPS_BUS_DMA_PRIVATE
159 1.1 simonb int isadma_bounce_dmamap_create(bus_dma_tag_t, bus_size_t, int,
160 1.1 simonb bus_size_t, bus_size_t, int, bus_dmamap_t *);
161 1.1 simonb void isadma_bounce_dmamap_destroy(bus_dma_tag_t, bus_dmamap_t);
162 1.1 simonb int isadma_bounce_dmamap_load(bus_dma_tag_t, bus_dmamap_t, void *,
163 1.1 simonb bus_size_t, struct proc *, int);
164 1.1 simonb int isadma_bounce_dmamap_load_mbuf(bus_dma_tag_t, bus_dmamap_t,
165 1.1 simonb struct mbuf *, int);
166 1.1 simonb int isadma_bounce_dmamap_load_uio(bus_dma_tag_t, bus_dmamap_t,
167 1.1 simonb struct uio *, int);
168 1.1 simonb int isadma_bounce_dmamap_load_raw(bus_dma_tag_t, bus_dmamap_t,
169 1.1 simonb bus_dma_segment_t *, int, bus_size_t, int);
170 1.1 simonb void isadma_bounce_dmamap_unload(bus_dma_tag_t, bus_dmamap_t);
171 1.1 simonb void isadma_bounce_dmamap_sync(bus_dma_tag_t, bus_dmamap_t,
172 1.1 simonb bus_addr_t, bus_size_t, int);
173 1.1 simonb
174 1.1 simonb int isadma_bounce_dmamem_alloc(bus_dma_tag_t, bus_size_t, bus_size_t,
175 1.1 simonb bus_size_t, bus_dma_segment_t *, int, int *, int);
176 1.1 simonb #endif /* _MIPS_BUS_DMA_PRIVATE */
177