iomd_io.c revision 1.2 1 /* $NetBSD: iomd_io.c,v 1.2 2002/09/27 15:35:46 provos Exp $ */
2
3 /*
4 * Copyright (c) 1997 Mark Brinicombe.
5 * Copyright (c) 1997 Causality Limited.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by Mark Brinicombe.
19 * 4. The name of the company nor the name of the author may be used to
20 * endorse or promote products derived from this software without specific
21 * prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
24 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
27 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 */
35
36 /*
37 * bus_space I/O functions for iomd
38 */
39
40 #include <sys/param.h>
41 #include <sys/systm.h>
42 #include <machine/bus.h>
43
44 /* Proto types for all the bus_space structure functions */
45
46 bs_protos(iomd);
47 bs_protos(bs_notimpl);
48
49 /* Declare the iomd bus space tag */
50
51 struct bus_space iomd_bs_tag = {
52 /* cookie */
53 NULL,
54
55 /* mapping/unmapping */
56 iomd_bs_map,
57 iomd_bs_unmap,
58 iomd_bs_subregion,
59
60 /* allocation/deallocation */
61 iomd_bs_alloc,
62 iomd_bs_free,
63
64 /* get kernel virtual address */
65 0, /* there is no linear mapping */
66
67 /* mmap bus space for userland */
68 bs_notimpl_bs_mmap, /* XXX correct? XXX */
69
70 /* barrier */
71 iomd_bs_barrier,
72
73 /* read (single) */
74 iomd_bs_r_1,
75 iomd_bs_r_2,
76 iomd_bs_r_4,
77 bs_notimpl_bs_r_8,
78
79 /* read multiple */
80 bs_notimpl_bs_rm_1,
81 iomd_bs_rm_2,
82 bs_notimpl_bs_rm_4,
83 bs_notimpl_bs_rm_8,
84
85 /* read region */
86 bs_notimpl_bs_rr_1,
87 bs_notimpl_bs_rr_2,
88 bs_notimpl_bs_rr_4,
89 bs_notimpl_bs_rr_8,
90
91 /* write (single) */
92 iomd_bs_w_1,
93 iomd_bs_w_2,
94 iomd_bs_w_4,
95 bs_notimpl_bs_w_8,
96
97 /* write multiple */
98 bs_notimpl_bs_wm_1,
99 iomd_bs_wm_2,
100 bs_notimpl_bs_wm_4,
101 bs_notimpl_bs_wm_8,
102
103 /* write region */
104 bs_notimpl_bs_wr_1,
105 bs_notimpl_bs_wr_2,
106 bs_notimpl_bs_wr_4,
107 bs_notimpl_bs_wr_8,
108
109 /* set multiple */
110 bs_notimpl_bs_sm_1,
111 bs_notimpl_bs_sm_2,
112 bs_notimpl_bs_sm_4,
113 bs_notimpl_bs_sm_8,
114
115 /* set region */
116 bs_notimpl_bs_sr_1,
117 bs_notimpl_bs_sr_2,
118 bs_notimpl_bs_sr_4,
119 bs_notimpl_bs_sr_8,
120
121 /* copy */
122 bs_notimpl_bs_c_1,
123 bs_notimpl_bs_c_2,
124 bs_notimpl_bs_c_4,
125 bs_notimpl_bs_c_8,
126 };
127
128 /* bus space functions */
129
130 int
131 iomd_bs_map(t, bpa, size, cacheable, bshp)
132 void *t;
133 bus_addr_t bpa;
134 bus_size_t size;
135 int cacheable;
136 bus_space_handle_t *bshp;
137 {
138 /*
139 * Temporary implementation as all I/O is already mapped etc.
140 *
141 * Eventually this function will do the mapping check for multiple maps
142 */
143 *bshp = bpa;
144 return(0);
145 }
146
147 int
148 iomd_bs_alloc(t, rstart, rend, size, alignment, boundary, cacheable,
149 bpap, bshp)
150 void *t;
151 bus_addr_t rstart, rend;
152 bus_size_t size, alignment, boundary;
153 int cacheable;
154 bus_addr_t *bpap;
155 bus_space_handle_t *bshp;
156 {
157 panic("iomd_alloc(): Help!");
158 }
159
160
161 void
162 iomd_bs_unmap(t, bsh, size)
163 void *t;
164 bus_space_handle_t bsh;
165 bus_size_t size;
166 {
167 /*
168 * Temporary implementation
169 */
170 }
171
172 void
173 iomd_bs_free(t, bsh, size)
174 void *t;
175 bus_space_handle_t bsh;
176 bus_size_t size;
177 {
178
179 panic("iomd_free(): Help!");
180 /* iomd_unmap() does all that we need to do. */
181 /* iomd_unmap(t, bsh, size);*/
182 }
183
184 int
185 iomd_bs_subregion(t, bsh, offset, size, nbshp)
186 void *t;
187 bus_space_handle_t bsh;
188 bus_size_t offset, size;
189 bus_space_handle_t *nbshp;
190 {
191
192 *nbshp = bsh + (offset << 2);
193 return (0);
194 }
195
196 void
197 iomd_bs_barrier(t, bsh, offset, len, flags)
198 void *t;
199 bus_space_handle_t bsh;
200 bus_size_t offset, len;
201 int flags;
202 {
203 }
204
205 /* End of iomd_io.c */
206