| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: bcm2835_space.c,v 1.11 2017/11/09 21:37:52 skrll Exp $ */ | | 1 | /* $NetBSD: bcm2835_space.c,v 1.12 2017/11/27 17:27:37 skrll 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.11 2017/11/09 21:37:52 skrll Exp $"); | | 34 | __KERNEL_RCSID(0, "$NetBSD: bcm2835_space.c,v 1.12 2017/11/27 17:27:37 skrll 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 | #include <arm/locore.h> | | 43 | #include <arm/locore.h> |
44 | #include <arm/broadcom/bcm2835reg.h> | | 44 | #include <arm/broadcom/bcm2835reg.h> |
45 | | | 45 | |
46 | /* Prototypes for all the bus_space structure functions */ | | 46 | /* Prototypes for all the bus_space structure functions */ |
47 | bs_protos(bcm2835); | | 47 | bs_protos(bcm2835); |
| @@ -354,27 +354,27 @@ bcm2835_bs_unmap(void *t, bus_space_hand | | | @@ -354,27 +354,27 @@ bcm2835_bs_unmap(void *t, bus_space_hand |
354 | | | 354 | |
355 | pmap_kremove(va, sz); | | 355 | pmap_kremove(va, sz); |
356 | pmap_update(pmap_kernel()); | | 356 | pmap_update(pmap_kernel()); |
357 | uvm_km_free(kernel_map, va, sz, UVM_KMF_VAONLY); | | 357 | uvm_km_free(kernel_map, va, sz, UVM_KMF_VAONLY); |
358 | } | | 358 | } |
359 | | | 359 | |
360 | | | 360 | |
361 | int | | 361 | int |
362 | bcm2835_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset, | | 362 | bcm2835_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset, |
363 | bus_size_t size, bus_space_handle_t *nbshp) | | 363 | bus_size_t size, bus_space_handle_t *nbshp) |
364 | { | | 364 | { |
365 | | | 365 | |
366 | *nbshp = bsh + offset; | | 366 | *nbshp = bsh + offset; |
367 | return (0); | | 367 | return 0; |
368 | } | | 368 | } |
369 | | | 369 | |
370 | void | | 370 | void |
371 | bcm2835_bs_barrier(void *t, bus_space_handle_t bsh, bus_size_t offset, | | 371 | bcm2835_bs_barrier(void *t, bus_space_handle_t bsh, bus_size_t offset, |
372 | bus_size_t len, int flags) | | 372 | bus_size_t len, int flags) |
373 | { | | 373 | { |
374 | flags &= BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE; | | 374 | flags &= BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE; |
375 | | | 375 | |
376 | if (flags) | | 376 | if (flags) |
377 | arm_dsb(); | | 377 | arm_dsb(); |
378 | } | | 378 | } |
379 | | | 379 | |
380 | void * | | 380 | void * |
| @@ -383,27 +383,27 @@ bcm2835_bs_vaddr(void *t, bus_space_hand | | | @@ -383,27 +383,27 @@ bcm2835_bs_vaddr(void *t, bus_space_hand |
383 | | | 383 | |
384 | return (void *)bsh; | | 384 | return (void *)bsh; |
385 | } | | 385 | } |
386 | | | 386 | |
387 | paddr_t | | 387 | paddr_t |
388 | bcm2835_bs_mmap(void *t, bus_addr_t ba, off_t offset, int prot, int flags) | | 388 | bcm2835_bs_mmap(void *t, bus_addr_t ba, off_t offset, int prot, int flags) |
389 | { | | 389 | { |
390 | paddr_t pa = ba & ~BCM2835_BUSADDR_CACHE_MASK; | | 390 | paddr_t pa = ba & ~BCM2835_BUSADDR_CACHE_MASK; |
391 | paddr_t bus_flags = 0; | | 391 | paddr_t bus_flags = 0; |
392 | | | 392 | |
393 | if (flags & BUS_SPACE_MAP_PREFETCHABLE) | | 393 | if (flags & BUS_SPACE_MAP_PREFETCHABLE) |
394 | bus_flags |= ARM32_MMAP_WRITECOMBINE; | | 394 | bus_flags |= ARM32_MMAP_WRITECOMBINE; |
395 | | | 395 | |
396 | return (arm_btop(pa + offset) | bus_flags); | | 396 | return arm_btop(pa + offset) | bus_flags; |
397 | } | | 397 | } |
398 | | | 398 | |
399 | int | | 399 | int |
400 | bcm2835_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend, | | 400 | bcm2835_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend, |
401 | bus_size_t size, bus_size_t alignment, bus_size_t boundary, int flags, | | 401 | bus_size_t size, bus_size_t alignment, bus_size_t boundary, int flags, |
402 | bus_addr_t *bpap, bus_space_handle_t *bshp) | | 402 | bus_addr_t *bpap, bus_space_handle_t *bshp) |
403 | { | | 403 | { |
404 | | | 404 | |
405 | panic("%s(): not implemented\n", __func__); | | 405 | panic("%s(): not implemented\n", __func__); |
406 | } | | 406 | } |
407 | | | 407 | |
408 | void | | 408 | void |
409 | bcm2835_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size) | | 409 | bcm2835_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size) |