Mon Dec 30 16:19:27 2019 UTC ()
Fix up ARM_LOCAL for 2711 so that it works now.


(skrll)
diff -r1.28 -r1.29 src/sys/arch/arm/broadcom/bcm2835reg.h
diff -r1.30 -r1.31 src/sys/arch/arm/broadcom/bcm283x_platform.c
diff -r1.4 -r1.5 src/sys/arch/arm/broadcom/bcm283x_platform.h

cvs diff -r1.28 -r1.29 src/sys/arch/arm/broadcom/bcm2835reg.h (expand / switch to unified diff)

--- src/sys/arch/arm/broadcom/bcm2835reg.h 2019/12/26 11:09:11 1.28
+++ src/sys/arch/arm/broadcom/bcm2835reg.h 2019/12/30 16:19:27 1.29
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: bcm2835reg.h,v 1.28 2019/12/26 11:09:11 skrll Exp $ */ 1/* $NetBSD: bcm2835reg.h,v 1.29 2019/12/30 16:19:27 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.
@@ -192,28 +192,34 @@ @@ -192,28 +192,34 @@
192#define BCM2835_INT_BASICBASE (BCM2835_INT_BASE + 64) 192#define BCM2835_INT_BASICBASE (BCM2835_INT_BASE + 64)
193#define BCM2835_INT_ARMTIMER (BCM2835_INT_BASICBASE + 0) 193#define BCM2835_INT_ARMTIMER (BCM2835_INT_BASICBASE + 0)
194#define BCM2835_INT_ARMMAILBOX (BCM2835_INT_BASICBASE + 1) 194#define BCM2835_INT_ARMMAILBOX (BCM2835_INT_BASICBASE + 1)
195#define BCM2835_INT_ARMDOORBELL0 (BCM2835_INT_BASICBASE + 2) 195#define BCM2835_INT_ARMDOORBELL0 (BCM2835_INT_BASICBASE + 2)
196#define BCM2835_INT_ARMDOORBELL1 (BCM2835_INT_BASICBASE + 3) 196#define BCM2835_INT_ARMDOORBELL1 (BCM2835_INT_BASICBASE + 3)
197#define BCM2835_INT_GPU0HALTED (BCM2835_INT_BASICBASE + 4) 197#define BCM2835_INT_GPU0HALTED (BCM2835_INT_BASICBASE + 4)
198#define BCM2835_INT_GPU1HALTED (BCM2835_INT_BASICBASE + 5) 198#define BCM2835_INT_GPU1HALTED (BCM2835_INT_BASICBASE + 5)
199#define BCM2835_INT_ILLEGALTYPE0 (BCM2835_INT_BASICBASE + 6) 199#define BCM2835_INT_ILLEGALTYPE0 (BCM2835_INT_BASICBASE + 6)
200#define BCM2835_INT_ILLEGALTYPE1 (BCM2835_INT_BASICBASE + 7) 200#define BCM2835_INT_ILLEGALTYPE1 (BCM2835_INT_BASICBASE + 7)
201 201
202 202
203#define BCM2835_UART0_CLK 3000000 203#define BCM2835_UART0_CLK 3000000
204 204
 205#define BCM2711_ARM_LOCAL_BASE_BUS 0x40000000
205#define BCM2711_ARM_LOCAL_BASE 0xff800000 206#define BCM2711_ARM_LOCAL_BASE 0xff800000
206#define BCM2711_ARM_LOCAL_SIZE 0x00100000 /* 1MByte */ 207#define BCM2711_ARM_LOCAL_SIZE 0x00100000 /* 1MBytes */
 208
 209#define BCM2711_ARM_LOCAL_PHYS_TO_BUS(a) \
 210 ((a) - BCM2711_ARM_LOCAL_BASE + BCM2711_ARM_LOCAL_BASE_BUS)
 211#define BCM2711_ARM_LOCAL_BUS_TO_PHYS(a) \
 212 ((a) - BCM2711_ARM_LOCAL_BASE_BUS + BCM2711_ARM_LOCAL_BASE)
207 213
208#define BCM2836_ARM_LOCAL_BASE 0x40000000 214#define BCM2836_ARM_LOCAL_BASE 0x40000000
209#define BCM2836_ARM_LOCAL_SIZE 0x00001000 /* 4KBytes */ 215#define BCM2836_ARM_LOCAL_SIZE 0x00001000 /* 4KBytes */
210 216
211#define BCM2836_LOCAL_CONTROL 0x000 217#define BCM2836_LOCAL_CONTROL 0x000
212#define BCM2836_LOCAL_PRESCALER 0x008 218#define BCM2836_LOCAL_PRESCALER 0x008
213#define BCM2836_LOCAL_GPU_INT_ROUTING 0x00c 219#define BCM2836_LOCAL_GPU_INT_ROUTING 0x00c
214#define BCM2836_LOCAL_PM_ROUTING_SET 0x010 220#define BCM2836_LOCAL_PM_ROUTING_SET 0x010
215#define BCM2836_LOCAL_PM_ROUTING_CLR 0x014 221#define BCM2836_LOCAL_PM_ROUTING_CLR 0x014
216#define BCM2836_LOCAL_TIMER_LS 0x01c 222#define BCM2836_LOCAL_TIMER_LS 0x01c
217#define BCM2836_LOCAL_TIMER_MS 0x020 223#define BCM2836_LOCAL_TIMER_MS 0x020
218#define BCM2836_LOCAL_INT_ROUTING 0x024 224#define BCM2836_LOCAL_INT_ROUTING 0x024
219#define BCM2836_LOCAL_AXI_COUNT 0x02c 225#define BCM2836_LOCAL_AXI_COUNT 0x02c

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

--- src/sys/arch/arm/broadcom/bcm283x_platform.c 2019/12/30 16:06:29 1.30
+++ src/sys/arch/arm/broadcom/bcm283x_platform.c 2019/12/30 16:19:27 1.31
@@ -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
181static paddr_t 181static paddr_t
182bcm2711_bus_to_phys(bus_addr_t ba) 182bcm2711_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
197int 197int
198bcm2835_bs_map(void *t, bus_addr_t ba, bus_size_t size, int flag, 198bcm2835_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
326static const struct pmap_devmap * 326static const struct pmap_devmap *
327bcm2711_platform_devmap(void) 327bcm2711_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 */

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

--- src/sys/arch/arm/broadcom/bcm283x_platform.h 2019/12/24 14:10:51 1.4
+++ src/sys/arch/arm/broadcom/bcm283x_platform.h 2019/12/30 16:19:27 1.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: bcm283x_platform.h,v 1.4 2019/12/24 14:10:51 skrll Exp $ */ 1/* $NetBSD: bcm283x_platform.h,v 1.5 2019/12/30 16:19:27 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.
@@ -48,14 +48,17 @@ @@ -48,14 +48,17 @@
48 48
49#define BCM2711_PERIPHERALS_VBASE \ 49#define BCM2711_PERIPHERALS_VBASE \
50 BCM2711_IOPHYSTOVIRT(BCM2711_PERIPHERALS_BASE) 50 BCM2711_IOPHYSTOVIRT(BCM2711_PERIPHERALS_BASE)
51 51
52#define BCM2836_ARM_LOCAL_VBASE \ 52#define BCM2836_ARM_LOCAL_VBASE \
53 BCM2835_IOPHYSTOVIRT(BCM2836_ARM_LOCAL_BASE) 53 BCM2835_IOPHYSTOVIRT(BCM2836_ARM_LOCAL_BASE)
54 54
55#define BCM2836_ARM_SMP_VBASE \ 55#define BCM2836_ARM_SMP_VBASE \
56 BCM2835_IOPHYSTOVIRT(BCM2836_ARM_SMP_BASE) 56 BCM2835_IOPHYSTOVIRT(BCM2836_ARM_SMP_BASE)
57 57
58#define BCM2711_ARM_LOCAL_VBASE \ 58#define BCM2711_ARM_LOCAL_VBASE \
59 BCM2711_IOPHYSTOVIRT(BCM2711_ARM_LOCAL_BASE) 59 BCM2711_IOPHYSTOVIRT(BCM2711_ARM_LOCAL_BASE)
60 60
 61#define BCM2711_ARM_SMP_VBASE \
 62 BCM2711_IOPHYSTOVIRT(BCM2836_ARM_SMP_BASE)
 63
61#endif /* _ARM_BCM2835REG_PLATFORM_H_ */ 64#endif /* _ARM_BCM2835REG_PLATFORM_H_ */