| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: bus_space.c,v 1.2 2018/04/01 04:35:03 ryo Exp $ */ | | 1 | /* $NetBSD: bus_space.c,v 1.3 2018/04/09 22:26:15 jmcneill Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2017 Ryo Shimizu <ryo@nerv.org> | | 4 | * Copyright (c) 2017 Ryo Shimizu <ryo@nerv.org> |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -17,27 +17,27 @@ | | | @@ -17,27 +17,27 @@ |
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | | 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, | | 19 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, |
20 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | | 20 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | | 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
24 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | | 24 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
25 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 25 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
26 | * POSSIBILITY OF SUCH DAMAGE. | | 26 | * POSSIBILITY OF SUCH DAMAGE. |
27 | */ | | 27 | */ |
28 | | | 28 | |
29 | #include <sys/cdefs.h> | | 29 | #include <sys/cdefs.h> |
30 | __KERNEL_RCSID(1, "$NetBSD: bus_space.c,v 1.2 2018/04/01 04:35:03 ryo Exp $"); | | 30 | __KERNEL_RCSID(1, "$NetBSD: bus_space.c,v 1.3 2018/04/09 22:26:15 jmcneill Exp $"); |
31 | | | 31 | |
32 | #include <sys/param.h> | | 32 | #include <sys/param.h> |
33 | #include <sys/systm.h> | | 33 | #include <sys/systm.h> |
34 | #include <sys/bus.h> | | 34 | #include <sys/bus.h> |
35 | | | 35 | |
36 | #include <uvm/uvm_extern.h> | | 36 | #include <uvm/uvm_extern.h> |
37 | | | 37 | |
38 | #include <aarch64/bus_funcs.h> | | 38 | #include <aarch64/bus_funcs.h> |
39 | #include <aarch64/machdep.h> | | 39 | #include <aarch64/machdep.h> |
40 | | | 40 | |
41 | | | 41 | |
42 | /* Prototypes for all the bus_space structure functions */ | | 42 | /* Prototypes for all the bus_space structure functions */ |
43 | bs_protos(generic) | | 43 | bs_protos(generic) |
| @@ -605,28 +605,32 @@ generic_bs_barrier(void *t, bus_space_ha | | | @@ -605,28 +605,32 @@ generic_bs_barrier(void *t, bus_space_ha |
605 | } | | 605 | } |
606 | | | 606 | |
607 | void * | | 607 | void * |
608 | generic_bs_vaddr(void *t, bus_space_handle_t bsh) | | 608 | generic_bs_vaddr(void *t, bus_space_handle_t bsh) |
609 | { | | 609 | { |
610 | return (void *)bsh; | | 610 | return (void *)bsh; |
611 | } | | 611 | } |
612 | | | 612 | |
613 | paddr_t | | 613 | paddr_t |
614 | generic_bs_mmap(void *t, bus_addr_t bpa, off_t offset, int prot, int flags) | | 614 | generic_bs_mmap(void *t, bus_addr_t bpa, off_t offset, int prot, int flags) |
615 | { | | 615 | { |
616 | paddr_t bus_flags = 0; | | 616 | paddr_t bus_flags = 0; |
617 | | | 617 | |
618 | if ((flags & (BUS_SPACE_MAP_CACHEABLE|BUS_SPACE_MAP_PREFETCHABLE)) != 0) | | 618 | if ((flags & BUS_SPACE_MAP_CACHEABLE) != 0) |
619 | bus_flags |= AARCH64_MMAP_WRITEBACK; | | 619 | bus_flags |= (AARCH64_MMAP_WRITEBACK << AARCH64_MMAP_FLAG_SHIFT); |
| | | 620 | else if ((flags & BUS_SPACE_MAP_PREFETCHABLE) != 0) |
| | | 621 | bus_flags |= (AARCH64_MMAP_WRITECOMBINE << AARCH64_MMAP_FLAG_SHIFT); |
| | | 622 | else |
| | | 623 | bus_flags |= (AARCH64_MMAP_DEVICE << AARCH64_MMAP_FLAG_SHIFT); |
620 | | | 624 | |
621 | return (atop(bpa + (offset << ((struct bus_space *)t)->bs_stride)) | | | 625 | return (atop(bpa + (offset << ((struct bus_space *)t)->bs_stride)) | |
622 | bus_flags); | | 626 | bus_flags); |
623 | } | | 627 | } |
624 | | | 628 | |
625 | int | | 629 | int |
626 | generic_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend, | | 630 | generic_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend, |
627 | bus_size_t size, bus_size_t alignment, bus_size_t boundary, int flags, | | 631 | bus_size_t size, bus_size_t alignment, bus_size_t boundary, int flags, |
628 | bus_addr_t *bpap, bus_space_handle_t *bshp) | | 632 | bus_addr_t *bpap, bus_space_handle_t *bshp) |
629 | { | | 633 | { |
630 | panic("%s(): not implemented\n", __func__); | | 634 | panic("%s(): not implemented\n", __func__); |
631 | } | | 635 | } |
632 | | | 636 | |