Fri Jun 8 18:09:43 2018 UTC ()
Provide bs_mmap implementations for bcm283x based boards.

PR:		port-arm/53283
Submitted by:	Nick Hudson


(jmcneill)
diff -r1.3 -r1.4 src/sys/arch/aarch64/aarch64/bus_space.c
diff -r1.4 -r1.5 src/sys/arch/aarch64/include/pmap.h
diff -r1.4 -r1.5 src/sys/arch/arm/broadcom/bcm283x_platform.c

cvs diff -r1.3 -r1.4 src/sys/arch/aarch64/aarch64/bus_space.c (expand / switch to unified diff)

--- src/sys/arch/aarch64/aarch64/bus_space.c 2018/04/09 22:26:15 1.3
+++ src/sys/arch/aarch64/aarch64/bus_space.c 2018/06/08 18:09:43 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: bus_space.c,v 1.3 2018/04/09 22:26:15 jmcneill Exp $ */ 1/* $NetBSD: bus_space.c,v 1.4 2018/06/08 18:09:43 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.3 2018/04/09 22:26:15 jmcneill Exp $"); 30__KERNEL_RCSID(1, "$NetBSD: bus_space.c,v 1.4 2018/06/08 18:09:43 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 */
43bs_protos(generic) 43bs_protos(generic)
@@ -606,31 +606,31 @@ generic_bs_barrier(void *t, bus_space_ha @@ -606,31 +606,31 @@ generic_bs_barrier(void *t, bus_space_ha
606 606
607void * 607void *
608generic_bs_vaddr(void *t, bus_space_handle_t bsh) 608generic_bs_vaddr(void *t, bus_space_handle_t bsh)
609{ 609{
610 return (void *)bsh; 610 return (void *)bsh;
611} 611}
612 612
613paddr_t 613paddr_t
614generic_bs_mmap(void *t, bus_addr_t bpa, off_t offset, int prot, int flags) 614generic_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) != 0) 618 if ((flags & BUS_SPACE_MAP_CACHEABLE) != 0)
619 bus_flags |= (AARCH64_MMAP_WRITEBACK << AARCH64_MMAP_FLAG_SHIFT); 619 bus_flags |= ARM_MMAP_WRITEBACK;
620 else if ((flags & BUS_SPACE_MAP_PREFETCHABLE) != 0) 620 else if ((flags & BUS_SPACE_MAP_PREFETCHABLE) != 0)
621 bus_flags |= (AARCH64_MMAP_WRITECOMBINE << AARCH64_MMAP_FLAG_SHIFT); 621 bus_flags |= ARM_MMAP_WRITECOMBINE;
622 else 622 else
623 bus_flags |= (AARCH64_MMAP_DEVICE << AARCH64_MMAP_FLAG_SHIFT); 623 bus_flags |= ARM_MMAP_DEVICE;
624 624
625 return (atop(bpa + (offset << ((struct bus_space *)t)->bs_stride)) | 625 return (atop(bpa + (offset << ((struct bus_space *)t)->bs_stride)) |
626 bus_flags); 626 bus_flags);
627} 627}
628 628
629int 629int
630generic_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend, 630generic_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend,
631 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,
632 bus_addr_t *bpap, bus_space_handle_t *bshp) 632 bus_addr_t *bpap, bus_space_handle_t *bshp)
633{ 633{
634 panic("%s(): not implemented\n", __func__); 634 panic("%s(): not implemented\n", __func__);
635} 635}
636 636

cvs diff -r1.4 -r1.5 src/sys/arch/aarch64/include/pmap.h (expand / switch to unified diff)

--- src/sys/arch/aarch64/include/pmap.h 2018/04/27 08:07:08 1.4
+++ src/sys/arch/aarch64/include/pmap.h 2018/06/08 18:09:43 1.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: pmap.h,v 1.4 2018/04/27 08:07:08 ryo Exp $ */ 1/* $NetBSD: pmap.h,v 1.5 2018/06/08 18:09:43 jmcneill Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc. 4 * Copyright (c) 2014 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 Matt Thomas of 3am Software Foundry. 8 * by Matt Thomas of 3am Software Foundry.
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.
@@ -140,30 +140,31 @@ paddr_t pmap_devmap_vtophys(paddr_t); @@ -140,30 +140,31 @@ paddr_t pmap_devmap_vtophys(paddr_t);
140 .pd_prot = VM_PROT_READ|VM_PROT_WRITE, \ 140 .pd_prot = VM_PROT_READ|VM_PROT_WRITE, \
141 .pd_flags = PMAP_NOCACHE \ 141 .pd_flags = PMAP_NOCACHE \
142 } 142 }
143#define DEVMAP_ENTRY_END { 0 } 143#define DEVMAP_ENTRY_END { 0 }
144 144
145/* mmap cookie and flags */ 145/* mmap cookie and flags */
146#define AARCH64_MMAP_FLAG_SHIFT (64 - PGSHIFT) 146#define AARCH64_MMAP_FLAG_SHIFT (64 - PGSHIFT)
147#define AARCH64_MMAP_FLAG_MASK 0xf 147#define AARCH64_MMAP_FLAG_MASK 0xf
148#define AARCH64_MMAP_WRITEBACK 0UL 148#define AARCH64_MMAP_WRITEBACK 0UL
149#define AARCH64_MMAP_NOCACHE 1UL 149#define AARCH64_MMAP_NOCACHE 1UL
150#define AARCH64_MMAP_WRITECOMBINE 2UL 150#define AARCH64_MMAP_WRITECOMBINE 2UL
151#define AARCH64_MMAP_DEVICE 3UL 151#define AARCH64_MMAP_DEVICE 3UL
152 152
153#define ARM_MMAP_WRITECOMBINE AARCH64_MMAP_WRITECOMBINE 153#define ARM_MMAP_MASK __BITS(63, AARCH64_MMAP_FLAG_SHIFT)
154#define ARM_MMAP_WRITEBACK AARCH64_MMAP_WRITEBACK 154#define ARM_MMAP_WRITECOMBINE __SHIFTIN(AARCH64_MMAP_WRITECOMBINE, ARM_MMAP_MASK)
155#define ARM_MMAP_NOCACHE AARCH64_MMAP_NOCACHE 155#define ARM_MMAP_WRITEBACK __SHIFTIN(AARCH64_MMAP_WRITEBACK, ARM_MMAP_MASK)
156#define ARM_MMAP_DEVICE AARCH64_MMAP_DEVICE 156#define ARM_MMAP_NOCACHE __SHIFTIN(AARCH64_MMAP_NOCACHE, ARM_MMAP_MASK)
 157#define ARM_MMAP_DEVICE __SHIFTIN(AARCH64_MMAP_DEVICE, ARM_MMAP_MASK)
157 158
158#define PMAP_PTE 0x10000000 /* kenter_pa */ 159#define PMAP_PTE 0x10000000 /* kenter_pa */
159#define PMAP_DEV 0x20000000 /* kenter_pa */ 160#define PMAP_DEV 0x20000000 /* kenter_pa */
160 161
161static inline u_int 162static inline u_int
162aarch64_mmap_flags(paddr_t mdpgno) 163aarch64_mmap_flags(paddr_t mdpgno)
163{ 164{
164 u_int nflag, pflag; 165 u_int nflag, pflag;
165 166
166 /* 167 /*
167 * aarch64 arch has 4 memory attribute: 168 * aarch64 arch has 4 memory attribute:
168 * 169 *
169 * WriteBack - write back cache 170 * WriteBack - write back cache

cvs diff -r1.4 -r1.5 src/sys/arch/arm/broadcom/bcm283x_platform.c (expand / switch to unified diff)

--- src/sys/arch/arm/broadcom/bcm283x_platform.c 2018/04/01 04:35:03 1.4
+++ src/sys/arch/arm/broadcom/bcm283x_platform.c 2018/06/08 18:09:43 1.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: bcm283x_platform.c,v 1.4 2018/04/01 04:35:03 ryo Exp $ */ 1/* $NetBSD: bcm283x_platform.c,v 1.5 2018/06/08 18:09:43 jmcneill Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2017 Jared D. McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2017 Jared D. McNeill <jmcneill@invisible.ca>
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 WARRANTIES 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE. 26 * SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.4 2018/04/01 04:35:03 ryo Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.5 2018/06/08 18:09:43 jmcneill Exp $");
31 31
32#include "opt_arm_debug.h" 32#include "opt_arm_debug.h"
33#include "opt_bcm283x.h" 33#include "opt_bcm283x.h"
34#include "opt_cpuoptions.h" 34#include "opt_cpuoptions.h"
35#include "opt_ddb.h" 35#include "opt_ddb.h"
36#include "opt_evbarm_boardtype.h" 36#include "opt_evbarm_boardtype.h"
37#include "opt_kgdb.h" 37#include "opt_kgdb.h"
38#include "opt_fdt.h" 38#include "opt_fdt.h"
39#include "opt_rpi.h" 39#include "opt_rpi.h"
40#include "opt_vcprop.h" 40#include "opt_vcprop.h"
41 41
42#include "sdhc.h" 42#include "sdhc.h"
43#include "bcmsdhost.h" 43#include "bcmsdhost.h"
@@ -126,61 +126,92 @@ extern struct bus_space arm_generic_a4x_ @@ -126,61 +126,92 @@ extern struct bus_space arm_generic_a4x_
126bs_protos(arm_generic); 126bs_protos(arm_generic);
127bs_protos(arm_generic_a4x); 127bs_protos(arm_generic_a4x);
128bs_protos(bcm2835); 128bs_protos(bcm2835);
129bs_protos(bcm2835_a4x); 129bs_protos(bcm2835_a4x);
130bs_protos(bcm2836); 130bs_protos(bcm2836);
131bs_protos(bcm2836_a4x); 131bs_protos(bcm2836_a4x);
132 132
133struct bus_space bcm2835_bs_tag; 133struct bus_space bcm2835_bs_tag;
134struct bus_space bcm2835_a4x_bs_tag; 134struct bus_space bcm2835_a4x_bs_tag;
135struct bus_space bcm2836_bs_tag; 135struct bus_space bcm2836_bs_tag;
136struct bus_space bcm2836_a4x_bs_tag; 136struct bus_space bcm2836_a4x_bs_tag;
137 137
138int bcm283x_bs_map(void *, bus_addr_t, bus_size_t, int, bus_space_handle_t *); 138int bcm283x_bs_map(void *, bus_addr_t, bus_size_t, int, bus_space_handle_t *);
 139paddr_t bcm283x_bs_mmap(void *, bus_addr_t, off_t, int, int);
 140paddr_t bcm283x_a4x_bs_mmap(void *, bus_addr_t, off_t, int, int);
139 141
140int 142int
141bcm283x_bs_map(void *t, bus_addr_t ba, bus_size_t size, int flag, 143bcm283x_bs_map(void *t, bus_addr_t ba, bus_size_t size, int flag,
142 bus_space_handle_t *bshp) 144 bus_space_handle_t *bshp)
143{ 145{
144 u_long startpa, endpa, pa; 146 u_long startpa, endpa, pa;
145 vaddr_t va; 147 vaddr_t va;
146 148
147 /* Convert BA to PA */ 149 /* Convert BA to PA */
148 pa = ba & ~BCM2835_BUSADDR_CACHE_MASK; 150 pa = ba & ~BCM2835_BUSADDR_CACHE_MASK;
149 151
150 startpa = trunc_page(pa); 152 startpa = trunc_page(pa);
151 endpa = round_page(pa + size); 153 endpa = round_page(pa + size);
152 154
153 /* XXX use extent manager to check duplicate mapping */ 155 /* XXX use extent manager to check duplicate mapping */
154 156
155 va = uvm_km_alloc(kernel_map, endpa - startpa, 0, 157 va = uvm_km_alloc(kernel_map, endpa - startpa, 0,
156 UVM_KMF_VAONLY | UVM_KMF_NOWAIT | UVM_KMF_COLORMATCH); 158 UVM_KMF_VAONLY | UVM_KMF_NOWAIT | UVM_KMF_COLORMATCH);
157 if (!va) 159 if (!va)
158 return ENOMEM; 160 return ENOMEM;
159 161
160 *bshp = (bus_space_handle_t)(va + (pa - startpa)); 162 *bshp = (bus_space_handle_t)(va + (pa - startpa));
161 163
162 const int pmapflags = 164 int pmapflags;
163 (flag & (BUS_SPACE_MAP_CACHEABLE|BUS_SPACE_MAP_PREFETCHABLE)) 165 if (flag & BUS_SPACE_MAP_PREFETCHABLE)
164 ? 0 166 pmapflags = PMAP_WRITE_COMBINE;
165 : PMAP_NOCACHE; 167 else if (flag & BUS_SPACE_MAP_CACHEABLE)
 168 pmapflags = 0;
 169 else
 170 pmapflags = PMAP_NOCACHE;
166 for (pa = startpa; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) { 171 for (pa = startpa; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) {
167 pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE, pmapflags); 172 pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE, pmapflags);
168 } 173 }
169 pmap_update(pmap_kernel()); 174 pmap_update(pmap_kernel());
170 175
171 return 0; 176 return 0;
172} 177}
173 178
 179paddr_t
 180bcm283x_bs_mmap(void *t, bus_addr_t bpa, off_t offset, int prot, int flags)
 181{
 182 /* Convert BA to PA */
 183 const paddr_t pa = bpa & ~BCM2835_BUSADDR_CACHE_MASK;
 184 paddr_t bus_flags = 0;
 185
 186 if (flags & BUS_SPACE_MAP_PREFETCHABLE)
 187 bus_flags |= ARM_MMAP_WRITECOMBINE;
 188
 189 return arm_btop(pa + offset) | bus_flags;
 190}
 191
 192paddr_t
 193bcm283x_a4x_bs_mmap(void *t, bus_addr_t bpa, off_t offset, int prot, int flags)
 194{
 195 /* Convert BA to PA */
 196 const paddr_t pa = bpa & ~BCM2835_BUSADDR_CACHE_MASK;
 197 paddr_t bus_flags = 0;
 198
 199 if (flags & BUS_SPACE_MAP_PREFETCHABLE)
 200 bus_flags |= ARM_MMAP_WRITECOMBINE;
 201
 202 return arm_btop(pa + 4 * offset) | bus_flags;
 203}
 204
174int 205int
175bcm2835_bs_map(void *t, bus_addr_t ba, bus_size_t size, int flag, 206bcm2835_bs_map(void *t, bus_addr_t ba, bus_size_t size, int flag,
176 bus_space_handle_t *bshp) 207 bus_space_handle_t *bshp)
177{ 208{
178 const struct pmap_devmap *pd; 209 const struct pmap_devmap *pd;
179 bool match = false; 210 bool match = false;
180 u_long pa; 211 u_long pa;
181 212
182 /* Attempt to find the PA device mapping */ 213 /* Attempt to find the PA device mapping */
183 if (ba >= BCM2835_PERIPHERALS_BASE_BUS && 214 if (ba >= BCM2835_PERIPHERALS_BASE_BUS &&
184 ba < BCM2835_PERIPHERALS_BASE_BUS + BCM2835_PERIPHERALS_SIZE) { 215 ba < BCM2835_PERIPHERALS_BASE_BUS + BCM2835_PERIPHERALS_SIZE) {
185 match = true; 216 match = true;
186 pa = BCM2835_PERIPHERALS_BUS_TO_PHYS(ba); 217 pa = BCM2835_PERIPHERALS_BUS_TO_PHYS(ba);
@@ -1153,46 +1184,50 @@ SYSCTL_SETUP(sysctl_machdep_rpi, "sysctl @@ -1153,46 +1184,50 @@ SYSCTL_SETUP(sysctl_machdep_rpi, "sysctl
1153 CTLTYPE_QUAD, "serial", NULL, NULL, 0, 1184 CTLTYPE_QUAD, "serial", NULL, NULL, 0,
1154 &vb.vbt_serial.sn, 0, CTL_MACHDEP, CTL_CREATE, CTL_EOL); 1185 &vb.vbt_serial.sn, 0, CTL_MACHDEP, CTL_CREATE, CTL_EOL);
1155} 1186}
1156 1187
1157#if defined(SOC_BCM2835) 1188#if defined(SOC_BCM2835)
1158static void 1189static void
1159bcm2835_platform_bootstrap(void) 1190bcm2835_platform_bootstrap(void)
1160{ 1191{
1161 1192
1162 bcm2835_bs_tag = arm_generic_bs_tag; 1193 bcm2835_bs_tag = arm_generic_bs_tag;
1163 bcm2835_a4x_bs_tag = arm_generic_a4x_bs_tag; 1194 bcm2835_a4x_bs_tag = arm_generic_a4x_bs_tag;
1164 1195
1165 bcm2835_bs_tag.bs_map = bcm2835_bs_map; 1196 bcm2835_bs_tag.bs_map = bcm2835_bs_map;
 1197 bcm2835_bs_tag.bs_mmap = bcm283x_bs_mmap;
1166 bcm2835_a4x_bs_tag.bs_map = bcm2835_bs_map; 1198 bcm2835_a4x_bs_tag.bs_map = bcm2835_bs_map;
 1199 bcm2835_a4x_bs_tag.bs_mmap = bcm283x_a4x_bs_mmap;
1167 1200
1168 fdtbus_set_decoderegprop(false); 1201 fdtbus_set_decoderegprop(false);
1169 1202
1170 bcm2835_uartinit(); 1203 bcm2835_uartinit();
1171 1204
1172 bcm2835_bootparams(); 1205 bcm2835_bootparams();
1173} 1206}
1174#endif 1207#endif
1175 1208
1176#if defined(SOC_BCM2836) 1209#if defined(SOC_BCM2836)
1177static void 1210static void
1178bcm2836_platform_bootstrap(void) 1211bcm2836_platform_bootstrap(void)
1179{ 1212{
1180 1213
1181 bcm2836_bs_tag = arm_generic_bs_tag; 1214 bcm2836_bs_tag = arm_generic_bs_tag;
1182 bcm2836_a4x_bs_tag = arm_generic_a4x_bs_tag; 1215 bcm2836_a4x_bs_tag = arm_generic_a4x_bs_tag;
1183 1216
1184 bcm2836_bs_tag.bs_map = bcm2836_bs_map; 1217 bcm2836_bs_tag.bs_map = bcm2836_bs_map;
 1218 bcm2836_bs_tag.bs_mmap = bcm283x_bs_mmap;
1185 bcm2836_a4x_bs_tag.bs_map = bcm2836_bs_map; 1219 bcm2836_a4x_bs_tag.bs_map = bcm2836_bs_map;
 1220 bcm2836_a4x_bs_tag.bs_mmap = bcm283x_a4x_bs_mmap;
1186 1221
1187 fdtbus_set_decoderegprop(false); 1222 fdtbus_set_decoderegprop(false);
1188 1223
1189 bcm2836_uartinit(); 1224 bcm2836_uartinit();
1190 1225
1191 bcm2836_bootparams(); 1226 bcm2836_bootparams();
1192 1227
1193 bcm2836_bootstrap(); 1228 bcm2836_bootstrap();
1194} 1229}
1195#endif 1230#endif
1196 1231
1197#if defined(SOC_BCM2835) 1232#if defined(SOC_BCM2835)
1198static void 1233static void