| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: bcm2835_space.c,v 1.3 2013/01/13 06:10:25 skrll Exp $ */ | | 1 | /* $NetBSD: bcm2835_space.c,v 1.4 2013/01/23 16:51:14 macallan 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: bcm2835_space.c,v 1.3 2013/01/13 06:10:25 skrll Exp $"); | | 34 | __KERNEL_RCSID(0, "$NetBSD: bcm2835_space.c,v 1.4 2013/01/23 16:51:14 macallan 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 */ |
44 | bs_protos(bcm2835); | | 44 | bs_protos(bcm2835); |
45 | bs_protos(bcm2835_a4x); | | 45 | bs_protos(bcm2835_a4x); |
46 | bs_protos(generic); | | 46 | bs_protos(generic); |
47 | bs_protos(generic_armv4); | | 47 | bs_protos(generic_armv4); |
| @@ -360,28 +360,32 @@ bcm2835_bs_barrier(void *t, bus_space_ha | | | @@ -360,28 +360,32 @@ bcm2835_bs_barrier(void *t, bus_space_ha |
360 | | | 360 | |
361 | } | | 361 | } |
362 | | | 362 | |
363 | void * | | 363 | void * |
364 | bcm2835_bs_vaddr(void *t, bus_space_handle_t bsh) | | 364 | bcm2835_bs_vaddr(void *t, bus_space_handle_t bsh) |
365 | { | | 365 | { |
366 | | | 366 | |
367 | return (void *)bsh; | | 367 | return (void *)bsh; |
368 | } | | 368 | } |
369 | | | 369 | |
370 | paddr_t | | 370 | paddr_t |
371 | bcm2835_bs_mmap(void *t, bus_addr_t paddr, off_t offset, int prot, int flags) | | 371 | bcm2835_bs_mmap(void *t, bus_addr_t paddr, off_t offset, int prot, int flags) |
372 | { | | 372 | { |
| | | 373 | paddr_t bus_flags = 0; |
373 | | | 374 | |
374 | return (arm_btop((paddr + offset))); | | 375 | if (flags & BUS_SPACE_MAP_PREFETCHABLE) |
| | | 376 | bus_flags |= ARM32_MMAP_WRITECOMBINE; |
| | | 377 | |
| | | 378 | return (arm_btop(paddr + offset) | bus_flags); |
375 | } | | 379 | } |
376 | | | 380 | |
377 | int | | 381 | int |
378 | bcm2835_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend, | | 382 | bcm2835_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend, |
379 | bus_size_t size, bus_size_t alignment, bus_size_t boundary, int flags, | | 383 | bus_size_t size, bus_size_t alignment, bus_size_t boundary, int flags, |
380 | bus_addr_t *bpap, bus_space_handle_t *bshp) | | 384 | bus_addr_t *bpap, bus_space_handle_t *bshp) |
381 | { | | 385 | { |
382 | | | 386 | |
383 | panic("%s(): not implemented\n", __func__); | | 387 | panic("%s(): not implemented\n", __func__); |
384 | } | | 388 | } |
385 | | | 389 | |
386 | void | | 390 | void |
387 | bcm2835_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size) | | 391 | bcm2835_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size) |