Sync usage with man page.
[netbsd-mini2440.git] / sys / arch / arm / footbridge / isa / isa_io.c
blob16d5b7d6ece0c198e00bec2928ede6c3d4d6dd9a
1 /* $NetBSD: isa_io.c,v 1.4 2009/03/14 15:36:02 dsl Exp $ */
3 /*
4 * Copyright 1997
5 * Digital Equipment Corporation. All rights reserved.
7 * This software is furnished under license and may be used and
8 * copied only in accordance with the following terms and conditions.
9 * Subject to these conditions, you may download, copy, install,
10 * use, modify and distribute this software in source and/or binary
11 * form. No title or ownership is transferred hereby.
13 * 1) Any source code used, modified or distributed must reproduce
14 * and retain this copyright notice and list of conditions as
15 * they appear in the source file.
17 * 2) No right is granted to use any trade name, trademark, or logo of
18 * Digital Equipment Corporation. Neither the "Digital Equipment
19 * Corporation" name nor any trademark or logo of Digital Equipment
20 * Corporation may be used to endorse or promote products derived
21 * from this software without the prior written permission of
22 * Digital Equipment Corporation.
24 * 3) This software is provided "AS-IS" and any express or implied
25 * warranties, including but not limited to, any implied warranties
26 * of merchantability, fitness for a particular purpose, or
27 * non-infringement are disclaimed. In no event shall DIGITAL be
28 * liable for any damages whatsoever, and in particular, DIGITAL
29 * shall not be liable for special, indirect, consequential, or
30 * incidental damages or damages for lost profits, loss of
31 * revenue or loss of use, whether such damages arise in contract,
32 * negligence, tort, under statute, in equity, at law or otherwise,
33 * even if advised of the possibility of such damage.
37 * bus_space I/O functions for isa
40 #include <sys/cdefs.h>
41 __KERNEL_RCSID(0, "$NetBSD: isa_io.c,v 1.4 2009/03/14 15:36:02 dsl Exp $");
43 #include <sys/param.h>
44 #include <sys/systm.h>
45 #include <machine/bus.h>
46 #include <machine/pio.h>
47 #include <machine/isa_machdep.h>
49 /* Proto types for all the bus_space structure functions */
51 bs_protos(isa);
52 bs_protos(bs_notimpl);
55 * Declare the isa bus space tags
56 * The IO and MEM structs are identical, except for the cookies,
57 * which contain the address space bases.
61 * NOTE: ASSEMBLY LANGUAGE RELIES ON THE COOKIE -- THE FIRST MEMBER OF
62 * THIS STRUCTURE -- TO BE THE VIRTUAL ADDRESS OF ISA/IO!
64 struct bus_space isa_io_bs_tag = {
65 /* cookie */
66 NULL, /* initialized below */
68 /* mapping/unmapping */
69 isa_bs_map,
70 isa_bs_unmap,
71 isa_bs_subregion,
73 /* allocation/deallocation */
74 isa_bs_alloc,
75 isa_bs_free,
77 /* get kernel virtual address */
78 isa_bs_vaddr,
80 /* mmap bus space for userland */
81 bs_notimpl_bs_mmap, /* XXX possible even? XXX */
83 /* barrier */
84 isa_bs_barrier,
86 /* read (single) */
87 isa_bs_r_1,
88 isa_bs_r_2,
89 isa_bs_r_4,
90 bs_notimpl_bs_r_8,
92 /* read multiple */
93 isa_bs_rm_1,
94 isa_bs_rm_2,
95 isa_bs_rm_4,
96 bs_notimpl_bs_rm_8,
98 /* read region */
99 isa_bs_rr_1,
100 isa_bs_rr_2,
101 isa_bs_rr_4,
102 bs_notimpl_bs_rr_8,
104 /* write (single) */
105 isa_bs_w_1,
106 isa_bs_w_2,
107 isa_bs_w_4,
108 bs_notimpl_bs_w_8,
110 /* write multiple */
111 isa_bs_wm_1,
112 isa_bs_wm_2,
113 isa_bs_wm_4,
114 bs_notimpl_bs_wm_8,
116 /* write region */
117 isa_bs_wr_1,
118 isa_bs_wr_2,
119 isa_bs_wr_4,
120 bs_notimpl_bs_wr_8,
122 /* set multiple */
123 bs_notimpl_bs_sm_1,
124 bs_notimpl_bs_sm_2,
125 bs_notimpl_bs_sm_4,
126 bs_notimpl_bs_sm_8,
128 /* set region */
129 bs_notimpl_bs_sr_1,
130 isa_bs_sr_2,
131 bs_notimpl_bs_sr_4,
132 bs_notimpl_bs_sr_8,
134 /* copy */
135 bs_notimpl_bs_c_1,
136 bs_notimpl_bs_c_2,
137 bs_notimpl_bs_c_4,
138 bs_notimpl_bs_c_8,
142 * NOTE: ASSEMBLY LANGUAGE RELIES ON THE COOKIE -- THE FIRST MEMBER OF
143 * THIS STRUCTURE -- TO BE THE VIRTUAL ADDRESS OF ISA/MEMORY!
145 struct bus_space isa_mem_bs_tag = {
146 /* cookie */
147 NULL, /* initialized below */
149 /* mapping/unmapping */
150 isa_bs_map,
151 isa_bs_unmap,
152 isa_bs_subregion,
154 /* allocation/deallocation */
155 isa_bs_alloc,
156 isa_bs_free,
158 /* get kernel virtual address */
159 isa_bs_vaddr,
161 /* mmap bus space for userland */
162 bs_notimpl_bs_mmap, /* XXX open for now ... XXX */
164 /* barrier */
165 isa_bs_barrier,
167 /* read (single) */
168 isa_bs_r_1,
169 isa_bs_r_2,
170 isa_bs_r_4,
171 bs_notimpl_bs_r_8,
173 /* read multiple */
174 isa_bs_rm_1,
175 isa_bs_rm_2,
176 isa_bs_rm_4,
177 bs_notimpl_bs_rm_8,
179 /* read region */
180 isa_bs_rr_1,
181 isa_bs_rr_2,
182 isa_bs_rr_4,
183 bs_notimpl_bs_rr_8,
185 /* write (single) */
186 isa_bs_w_1,
187 isa_bs_w_2,
188 isa_bs_w_4,
189 bs_notimpl_bs_w_8,
191 /* write multiple */
192 isa_bs_wm_1,
193 isa_bs_wm_2,
194 isa_bs_wm_4,
195 bs_notimpl_bs_wm_8,
197 /* write region */
198 isa_bs_wr_1,
199 isa_bs_wr_2,
200 isa_bs_wr_4,
201 bs_notimpl_bs_wr_8,
203 /* set multiple */
204 bs_notimpl_bs_sm_1,
205 bs_notimpl_bs_sm_2,
206 bs_notimpl_bs_sm_4,
207 bs_notimpl_bs_sm_8,
209 /* set region */
210 bs_notimpl_bs_sr_1,
211 isa_bs_sr_2,
212 bs_notimpl_bs_sr_4,
213 bs_notimpl_bs_sr_8,
215 /* copy */
216 bs_notimpl_bs_c_1,
217 bs_notimpl_bs_c_2,
218 bs_notimpl_bs_c_4,
219 bs_notimpl_bs_c_8,
222 /* bus space functions */
224 void
225 isa_io_init(vm_offset_t isa_io_addr, vm_offset_t isa_mem_addr)
227 isa_io_bs_tag.bs_cookie = (void *)isa_io_addr;
228 isa_mem_bs_tag.bs_cookie = (void *)isa_mem_addr;
232 * break the abstraction: sometimes, other parts of the system
233 * (e.g. X servers) need to map ISA space directly. use these
234 * functions sparingly!
236 vm_offset_t
237 isa_io_data_vaddr(void)
239 return (vm_offset_t)isa_io_bs_tag.bs_cookie;
242 vm_offset_t
243 isa_mem_data_vaddr(void)
245 return (vm_offset_t)isa_mem_bs_tag.bs_cookie;
249 isa_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int cacheable, bus_space_handle_t *bshp)
251 *bshp = bpa + (bus_addr_t)t;
252 return(0);
255 void
256 isa_bs_unmap(void *t, bus_space_handle_t bsh, bus_size_t size)
258 /* Nothing to do. */
262 isa_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset, bus_size_t size, bus_space_handle_t *nbshp)
264 /* printf("isa_subregion(tag=%p, bsh=%lx, off=%lx, sz=%lx)\n",
265 t, bsh, offset, size);*/
266 *nbshp = bsh + offset;
267 return(0);
271 isa_bs_alloc(t, rstart, rend, size, alignment, boundary, cacheable,
272 bpap, bshp)
273 void *t;
274 bus_addr_t rstart, rend;
275 bus_size_t size, alignment, boundary;
276 int cacheable;
277 bus_addr_t *bpap;
278 bus_space_handle_t *bshp;
280 panic("isa_alloc(): Help!");
283 void
284 isa_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size)
286 panic("isa_free(): Help!");
289 void *
290 isa_bs_vaddr(void *t, bus_space_handle_t bsh)
293 return ((void *)bsh);
296 void
297 isa_bs_barrier(void *t, bus_space_handle_t bsh, bus_size_t offset, bus_size_t len, int flags)
299 /* just return */