Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / arch / acorn32 / podulebus / podulebus_io.c
blob4df623720a5b1d2a44518cbcdb6acb85a5f1f169
1 /* $NetBSD: podulebus_io.c,v 1.5 2009/03/14 21:04:01 dsl Exp $ */
3 /*
4 * Copyright (c) 1997 Mark Brinicombe.
5 * All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by Mark Brinicombe.
18 * 4. The name of the company nor the name of the author may be used to
19 * endorse or promote products derived from this software without specific
20 * prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
23 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
26 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
36 * bus_space I/O functions for podulebus
39 #include <sys/cdefs.h>
40 __KERNEL_RCSID(0, "$NetBSD: podulebus_io.c,v 1.5 2009/03/14 21:04:01 dsl Exp $");
42 #include <sys/param.h>
43 #include <sys/systm.h>
44 #include <machine/bus.h>
46 /* Proto types for all the bus_space structure functions */
48 bs_protos(podulebus);
49 bs_protos(bs_notimpl);
51 /* Declare the podulebus bus space tag */
53 struct bus_space podulebus_bs_tag = {
54 /* cookie */
55 (void *) 2, /* Shift to apply to registers */
57 /* mapping/unmapping */
58 podulebus_bs_map,
59 podulebus_bs_unmap,
60 podulebus_bs_subregion,
62 /* allocation/deallocation */
63 podulebus_bs_alloc,
64 podulebus_bs_free,
66 /* get kernel virtual address */
67 0, /* there is no linear mapping */
69 /* mmap bus space for userland */
70 bs_notimpl_bs_mmap, /* there is no bus mapping ... well maybe EASI space? */
72 /* barrier */
73 podulebus_bs_barrier,
75 /* read (single) */
76 podulebus_bs_r_1,
77 podulebus_bs_r_2,
78 podulebus_bs_r_4,
79 bs_notimpl_bs_r_8,
81 /* read multiple */
82 podulebus_bs_rm_1,
83 podulebus_bs_rm_2,
84 bs_notimpl_bs_rm_4,
85 bs_notimpl_bs_rm_8,
87 /* read region */
88 podulebus_bs_rr_1,
89 podulebus_bs_rr_2,
90 bs_notimpl_bs_rr_4,
91 bs_notimpl_bs_rr_8,
93 /* write (single) */
94 podulebus_bs_w_1,
95 podulebus_bs_w_2,
96 podulebus_bs_w_4,
97 bs_notimpl_bs_w_8,
99 /* write multiple */
100 podulebus_bs_wm_1,
101 podulebus_bs_wm_2,
102 bs_notimpl_bs_wm_4,
103 bs_notimpl_bs_wm_8,
105 /* write region */
106 podulebus_bs_wr_1,
107 podulebus_bs_wr_2,
108 bs_notimpl_bs_wr_4,
109 bs_notimpl_bs_wr_8,
111 /* set multiple */
112 bs_notimpl_bs_sm_1,
113 bs_notimpl_bs_sm_2,
114 bs_notimpl_bs_sm_4,
115 bs_notimpl_bs_sm_8,
117 /* set region */
118 podulebus_bs_sr_1,
119 podulebus_bs_sr_2,
120 bs_notimpl_bs_sr_4,
121 bs_notimpl_bs_sr_8,
123 /* copy */
124 bs_notimpl_bs_c_1,
125 bs_notimpl_bs_c_2,
126 bs_notimpl_bs_c_4,
127 bs_notimpl_bs_c_8,
130 /* bus space functions */
133 podulebus_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int cacheable, bus_space_handle_t *bshp)
136 * Temporary implementation as all I/O is already mapped etc.
138 * Eventually this function will do the mapping check for multiple maps
140 *bshp = bpa;
141 return(0);
145 podulebus_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend,
146 bus_size_t size, bus_size_t alignment, bus_size_t boundary,
147 int cacheable, bus_addr_t *bpap, bus_space_handle_t *bshp)
149 panic("podulebus_bs_alloc(): Help!");
153 void
154 podulebus_bs_unmap(void *t, bus_space_handle_t bsh, bus_size_t size)
157 * Temporary implementation
161 void
162 podulebus_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size)
165 panic("podulebus_bs_free(): Help!");
166 /* podulebus_bs_unmap() does all that we need to do. */
167 /* podulebus_bs_unmap(t, bsh, size);*/
171 podulebus_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset, bus_size_t size, bus_space_handle_t *nbshp)
174 *nbshp = bsh + (offset << ((int)t));
175 return (0);
178 void
179 podulebus_bs_barrier(void *t, bus_space_handle_t bsh, bus_size_t offset, bus_size_t len, int flags)
183 /* Rough-and-ready implementations from arm26 */
185 void
186 podulebus_bs_rr_1(void *cookie, bus_space_handle_t bsh,
187 bus_size_t offset, u_int8_t *datap, bus_size_t count)
189 int i;
191 for (i = 0; i < count; i++)
192 datap[i] = podulebus_bs_r_1(cookie, bsh, offset + i);
195 void
196 podulebus_bs_rr_2(void *cookie, bus_space_handle_t bsh,
197 bus_size_t offset, u_int16_t *datap, bus_size_t count)
199 int i;
201 for (i = 0; i < count; i++)
202 datap[i] = podulebus_bs_r_2(cookie, bsh, offset + i);
205 void
206 podulebus_bs_wr_1(void *cookie, bus_space_handle_t bsh,
207 bus_size_t offset, u_int8_t const *datap,
208 bus_size_t count)
210 int i;
212 for (i = 0; i < count; i++)
213 podulebus_bs_w_1(cookie, bsh, offset + i, datap[i]);
216 void
217 podulebus_bs_wr_2(void *cookie, bus_space_handle_t bsh,
218 bus_size_t offset, u_int16_t const *datap,
219 bus_size_t count)
221 int i;
223 for (i = 0; i < count; i++)
224 podulebus_bs_w_2(cookie, bsh, offset + i, datap[i]);
227 void
228 podulebus_bs_sr_1(void *cookie, bus_space_handle_t bsh,
229 bus_size_t offset, u_int8_t value, bus_size_t count)
231 int i;
233 for (i = 0; i < count; i++)
234 podulebus_bs_w_1(cookie, bsh, offset + i, value);
237 void
238 podulebus_bs_sr_2(void *cookie, bus_space_handle_t bsh,
239 bus_size_t offset, u_int16_t value, bus_size_t count)
241 int i;
243 for (i = 0; i < count; i++)
244 podulebus_bs_w_2(cookie, bsh, offset + i, value);