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