Thu Feb 20 21:45:49 2014 UTC ()
Add support for running BE


(matt)
diff -r1.2 -r1.3 src/sys/arch/arm/allwinner/awin_space.c

cvs diff -r1.2 -r1.3 src/sys/arch/arm/allwinner/Attic/awin_space.c (expand / switch to unified diff)

--- src/sys/arch/arm/allwinner/Attic/awin_space.c 2014/01/23 19:26:55 1.2
+++ src/sys/arch/arm/allwinner/Attic/awin_space.c 2014/02/20 21:45:49 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: awin_space.c,v 1.2 2014/01/23 19:26:55 matt Exp $ */ 1/* $NetBSD: awin_space.c,v 1.3 2014/02/20 21:45:49 matt Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2012 The NetBSD Foundation, Inc. 4 * Copyright (c) 2012 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Nick Hudson 8 * by Nick Hudson
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -21,27 +21,27 @@ @@ -21,27 +21,27 @@
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32 32
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34__KERNEL_RCSID(0, "$NetBSD: awin_space.c,v 1.2 2014/01/23 19:26:55 matt Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: awin_space.c,v 1.3 2014/02/20 21:45:49 matt Exp $");
35 35
36#include <sys/param.h> 36#include <sys/param.h>
37#include <sys/systm.h> 37#include <sys/systm.h>
38 38
39#include <uvm/uvm_extern.h> 39#include <uvm/uvm_extern.h>
40 40
41#include <sys/bus.h> 41#include <sys/bus.h>
42 42
43/* Prototypes for all the bus_space structure functions */ 43/* Prototypes for all the bus_space structure functions */
44bs_protos(awin); 44bs_protos(awin);
45bs_protos(awin_a4x); 45bs_protos(awin_a4x);
46bs_protos(a4x); 46bs_protos(a4x);
47bs_protos(bs_notimpl); 47bs_protos(bs_notimpl);
@@ -183,52 +183,52 @@ struct bus_space awin_a4x_bs_tag = { @@ -183,52 +183,52 @@ struct bus_space awin_a4x_bs_tag = {
183 awin_bs_free, /* not implemented */ 183 awin_bs_free, /* not implemented */
184 184
185 /* get kernel virtual address */ 185 /* get kernel virtual address */
186 awin_bs_vaddr, 186 awin_bs_vaddr,
187 187
188 /* mmap */ 188 /* mmap */
189 awin_a4x_bs_mmap, 189 awin_a4x_bs_mmap,
190 190
191 /* barrier */ 191 /* barrier */
192 awin_bs_barrier, 192 awin_bs_barrier,
193 193
194 /* read (single) */ 194 /* read (single) */
195 a4x_bs_r_1, 195 a4x_bs_r_1,
196 a4x_bs_r_2, 196 NSWAP(a4x_bs_r_2),
197 a4x_bs_r_4, 197 NSWAP(a4x_bs_r_4),
198 bs_notimpl_bs_r_8, 198 bs_notimpl_bs_r_8,
199 199
200 /* read multiple */ 200 /* read multiple */
201 a4x_bs_rm_1, 201 a4x_bs_rm_1,
202 a4x_bs_rm_2, 202 NSWAP(a4x_bs_rm_2),
203 a4x_bs_rm_4, 203 NSWAP(a4x_bs_rm_4),
204 bs_notimpl_bs_rm_8, 204 bs_notimpl_bs_rm_8,
205 205
206 /* read region */ 206 /* read region */
207 bs_notimpl_bs_rr_1, 207 bs_notimpl_bs_rr_1,
208 bs_notimpl_bs_rr_2, 208 bs_notimpl_bs_rr_2,
209 bs_notimpl_bs_rr_4, 209 bs_notimpl_bs_rr_4,
210 bs_notimpl_bs_rr_8, 210 bs_notimpl_bs_rr_8,
211 211
212 /* write (single) */ 212 /* write (single) */
213 a4x_bs_w_1, 213 a4x_bs_w_1,
214 a4x_bs_w_2, 214 NSWAP(a4x_bs_w_2),
215 a4x_bs_w_4, 215 NSWAP(a4x_bs_w_4),
216 bs_notimpl_bs_w_8, 216 bs_notimpl_bs_w_8,
217 217
218 /* write multiple */ 218 /* write multiple */
219 a4x_bs_wm_1, 219 a4x_bs_wm_1,
220 a4x_bs_wm_2, 220 NSWAP(a4x_bs_wm_2),
221 a4x_bs_wm_4, 221 NSWAP(a4x_bs_wm_4),
222 bs_notimpl_bs_wm_8, 222 bs_notimpl_bs_wm_8,
223 223
224 /* write region */ 224 /* write region */
225 bs_notimpl_bs_wr_1, 225 bs_notimpl_bs_wr_1,
226 bs_notimpl_bs_wr_2, 226 bs_notimpl_bs_wr_2,
227 bs_notimpl_bs_wr_4, 227 bs_notimpl_bs_wr_4,
228 bs_notimpl_bs_wr_8, 228 bs_notimpl_bs_wr_8,
229 229
230 /* set multiple */ 230 /* set multiple */
231 bs_notimpl_bs_sm_1, 231 bs_notimpl_bs_sm_1,
232 bs_notimpl_bs_sm_2, 232 bs_notimpl_bs_sm_2,
233 bs_notimpl_bs_sm_4, 233 bs_notimpl_bs_sm_4,
234 bs_notimpl_bs_sm_8, 234 bs_notimpl_bs_sm_8,
@@ -238,58 +238,58 @@ struct bus_space awin_a4x_bs_tag = { @@ -238,58 +238,58 @@ struct bus_space awin_a4x_bs_tag = {
238 bs_notimpl_bs_sr_2, 238 bs_notimpl_bs_sr_2,
239 bs_notimpl_bs_sr_4, 239 bs_notimpl_bs_sr_4,
240 bs_notimpl_bs_sr_8, 240 bs_notimpl_bs_sr_8,
241 241
242 /* copy */ 242 /* copy */
243 bs_notimpl_bs_c_1, 243 bs_notimpl_bs_c_1,
244 bs_notimpl_bs_c_2, 244 bs_notimpl_bs_c_2,
245 bs_notimpl_bs_c_4, 245 bs_notimpl_bs_c_4,
246 bs_notimpl_bs_c_8, 246 bs_notimpl_bs_c_8,
247 247
248#ifdef __BUS_SPACE_HAS_STREAM_METHODS 248#ifdef __BUS_SPACE_HAS_STREAM_METHODS
249 /* read (single) */ 249 /* read (single) */
250 a4x_bs_r_1, 250 a4x_bs_r_1,
251 a4x_bs_r_2, 251 NSWAP(a4x_bs_r_2),
252 a4x_bs_r_4, 252 NSWAP(a4x_bs_r_4),
253 bs_notimpl_bs_r_8, 253 bs_notimpl_bs_r_8,
254 254
255 /* read multiple */ 255 /* read multiple */
256 a4x_bs_rm_1, 256 a4x_bs_rm_1,
257 a4x_bs_rm_2, 257 NSWAP(a4x_bs_rm_2),
258 a4x_bs_rm_4, 258 NSWAP(a4x_bs_rm_4),
259 bs_notimpl_bs_rm_8, 259 bs_notimpl_bs_rm_8,
260 260
261 /* read region */ 261 /* read region */
262 a4x_bs_rr_1, 262 a4x_bs_rr_1,
263 a4x_bs_rr_2, 263 NSWAP(a4x_bs_rr_2),
264 a4x_bs_rr_4, 264 NSWAP(a4x_bs_rr_4),
265 bs_notimpl_bs_rr_8, 265 bs_notimpl_bs_rr_8,
266 266
267 /* write (single) */ 267 /* write (single) */
268 a4x_bs_w_1, 268 a4x_bs_w_1,
269 a4x_bs_w_2, 269 NSWAP(a4x_bs_w_2),
270 a4x_bs_w_4, 270 NSWAP(a4x_bs_w_4),
271 bs_notimpl_bs_w_8, 271 bs_notimpl_bs_w_8,
272 272
273 /* write multiple */ 273 /* write multiple */
274 a4x_bs_wm_1, 274 a4x_bs_wm_1,
275 a4x_bs_wm_2, 275 NSWAP(a4x_bs_wm_2),
276 a4x_bs_wm_4, 276 NSWAP(a4x_bs_wm_4),
277 bs_notimpl_bs_wm_8, 277 bs_notimpl_bs_wm_8,
278 278
279 /* write region */ 279 /* write region */
280 a4x_bs_wr_1, 280 a4x_bs_wr_1,
281 a4x_bs_wr_2, 281 NSWAP(a4x_bs_wr_2),
282 a4x_bs_wr_4, 282 NSWAP(a4x_bs_wr_4),
283 bs_notimpl_bs_wr_8, 283 bs_notimpl_bs_wr_8,
284#endif 284#endif
285}; 285};
286 286
287int 287int
288awin_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flag, 288awin_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flag,
289 bus_space_handle_t *bshp) 289 bus_space_handle_t *bshp)
290{ 290{
291 u_long startpa, endpa, pa; 291 u_long startpa, endpa, pa;
292 const struct pmap_devmap *pd; 292 const struct pmap_devmap *pd;
293 vaddr_t va; 293 vaddr_t va;
294 294
295 if ((pd = pmap_devmap_find_pa(bpa, size)) != NULL) { 295 if ((pd = pmap_devmap_find_pa(bpa, size)) != NULL) {