| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: bcm283x_platform.c,v 1.30 2019/12/30 16:06:29 skrll Exp $ */ | | 1 | /* $NetBSD: bcm283x_platform.c,v 1.31 2019/12/30 16:19:27 skrll 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.30 2019/12/30 16:06:29 skrll Exp $"); | | 30 | __KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.31 2019/12/30 16:19:27 skrll 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" |
| @@ -177,29 +177,29 @@ bcm2836_bus_to_phys(bus_addr_t ba) | | | @@ -177,29 +177,29 @@ bcm2836_bus_to_phys(bus_addr_t ba) |
177 | | | 177 | |
178 | return ba & ~BCM2835_BUSADDR_CACHE_MASK; | | 178 | return ba & ~BCM2835_BUSADDR_CACHE_MASK; |
179 | } | | 179 | } |
180 | | | 180 | |
181 | static paddr_t | | 181 | static paddr_t |
182 | bcm2711_bus_to_phys(bus_addr_t ba) | | 182 | bcm2711_bus_to_phys(bus_addr_t ba) |
183 | { | | 183 | { |
184 | | | 184 | |
185 | /* Attempt to find the PA device mapping */ | | 185 | /* Attempt to find the PA device mapping */ |
186 | if (ba >= BCM283X_PERIPHERALS_BASE_BUS && | | 186 | if (ba >= BCM283X_PERIPHERALS_BASE_BUS && |
187 | ba < BCM283X_PERIPHERALS_BASE_BUS + BCM283X_PERIPHERALS_SIZE) | | 187 | ba < BCM283X_PERIPHERALS_BASE_BUS + BCM283X_PERIPHERALS_SIZE) |
188 | return BCM2711_PERIPHERALS_BUS_TO_PHYS(ba); | | 188 | return BCM2711_PERIPHERALS_BUS_TO_PHYS(ba); |
189 | | | 189 | |
190 | if (ba >= BCM2711_ARM_LOCAL_BASE && | | 190 | if (ba >= BCM2711_ARM_LOCAL_BASE_BUS && |
191 | ba < BCM2711_ARM_LOCAL_BASE + BCM2711_ARM_LOCAL_SIZE) | | 191 | ba < BCM2711_ARM_LOCAL_BASE_BUS + BCM2711_ARM_LOCAL_SIZE) |
192 | return ba; | | 192 | return BCM2711_ARM_LOCAL_BUS_TO_PHYS(ba); |
193 | | | 193 | |
194 | return ba & ~BCM2835_BUSADDR_CACHE_MASK; | | 194 | return ba & ~BCM2835_BUSADDR_CACHE_MASK; |
195 | } | | 195 | } |
196 | | | 196 | |
197 | int | | 197 | int |
198 | bcm2835_bs_map(void *t, bus_addr_t ba, bus_size_t size, int flag, | | 198 | bcm2835_bs_map(void *t, bus_addr_t ba, bus_size_t size, int flag, |
199 | bus_space_handle_t *bshp) | | 199 | bus_space_handle_t *bshp) |
200 | { | | 200 | { |
201 | const paddr_t pa = bcm2835_bus_to_phys(ba); | | 201 | const paddr_t pa = bcm2835_bus_to_phys(ba); |
202 | | | 202 | |
203 | return bus_space_map(&arm_generic_bs_tag, pa, size, flag, bshp); | | 203 | return bus_space_map(&arm_generic_bs_tag, pa, size, flag, bshp); |
204 | } | | 204 | } |
205 | | | 205 | |
| @@ -323,27 +323,27 @@ bcm2836_platform_devmap(void) | | | @@ -323,27 +323,27 @@ bcm2836_platform_devmap(void) |
323 | return devmap; | | 323 | return devmap; |
324 | } | | 324 | } |
325 | | | 325 | |
326 | static const struct pmap_devmap * | | 326 | static const struct pmap_devmap * |
327 | bcm2711_platform_devmap(void) | | 327 | bcm2711_platform_devmap(void) |
328 | { | | 328 | { |
329 | static const struct pmap_devmap devmap[] = { | | 329 | static const struct pmap_devmap devmap[] = { |
330 | DEVMAP_ENTRY(BCM2711_PERIPHERALS_VBASE, BCM2711_PERIPHERALS_BASE, | | 330 | DEVMAP_ENTRY(BCM2711_PERIPHERALS_VBASE, BCM2711_PERIPHERALS_BASE, |
331 | BCM283X_PERIPHERALS_SIZE), /* 16Mb */ | | 331 | BCM283X_PERIPHERALS_SIZE), /* 16Mb */ |
332 | DEVMAP_ENTRY(BCM2711_ARM_LOCAL_VBASE, BCM2711_ARM_LOCAL_BASE, | | 332 | DEVMAP_ENTRY(BCM2711_ARM_LOCAL_VBASE, BCM2711_ARM_LOCAL_BASE, |
333 | BCM2711_ARM_LOCAL_SIZE), | | 333 | BCM2711_ARM_LOCAL_SIZE), |
334 | #if defined(MULTIPROCESSOR) && defined(__aarch64__) | | 334 | #if defined(MULTIPROCESSOR) && defined(__aarch64__) |
335 | /* for fdt cpu spin-table */ | | 335 | /* for fdt cpu spin-table */ |
336 | DEVMAP_ENTRY(BCM2836_ARM_SMP_VBASE, BCM2836_ARM_SMP_BASE, | | 336 | DEVMAP_ENTRY(BCM2711_ARM_SMP_VBASE, BCM2836_ARM_SMP_BASE, |
337 | BCM2836_ARM_SMP_SIZE), | | 337 | BCM2836_ARM_SMP_SIZE), |
338 | #endif | | 338 | #endif |
339 | DEVMAP_ENTRY_END | | 339 | DEVMAP_ENTRY_END |
340 | }; | | 340 | }; |
341 | | | 341 | |
342 | return devmap; | | 342 | return devmap; |
343 | } | | 343 | } |
344 | #endif | | 344 | #endif |
345 | | | 345 | |
346 | /* | | 346 | /* |
347 | * Macros to translate between physical and virtual for a subset of the | | 347 | * Macros to translate between physical and virtual for a subset of the |
348 | * kernel address space. *Not* for general use. | | 348 | * kernel address space. *Not* for general use. |
349 | */ | | 349 | */ |