Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7]: src Pull up following revision(s) (requested by skrll in tick...



details:   https://anonhg.NetBSD.org/src/rev/c553cc6b64c7
branches:  netbsd-7
changeset: 799076:c553cc6b64c7
user:      snj <snj%NetBSD.org@localhost>
date:      Wed Mar 11 20:22:55 2015 +0000

description:
Pull up following revision(s) (requested by skrll in ticket #582):
        distrib/utils/embedded/conf/rpi.conf: revision 1.27
        etc/etc.evbarm/Makefile.inc: revision 1.70
        sys/arch/arm/broadcom/bcm2835_intr.c: revision 1.5-1.7
        sys/arch/arm/broadcom/bcm2835_obio.c: revision 1.23, 1.24
        sys/arch/arm/broadcom/bcm2835_space.c: revision 1.8
        sys/arch/arm/broadcom/bcm2835reg.h: revision 1.14
        sys/arch/arm/broadcom/bcm2835var.h: revision 1.2
        sys/arch/arm/broadcom/files.bcm2835: revision 1.24
        sys/arch/arm/cortex/a9_mpsubr.S: revision 1.30
        sys/arch/arm/cortex/armperiph.c: revision 1.8, 1.9
        sys/arch/arm/cortex/gtmr.c: revision 1.9
        sys/arch/arm/cortex/gtmr_var.h: revision 1.5
        sys/arch/arm/cortex/mpcore_var.h: revision 1.3
        sys/arch/arm/include/cpu.h: revision 1.84
        sys/arch/evbarm/conf/RPI2: revision 1.1, 1.2
        sys/arch/evbarm/conf/RPI2_INSTALL: revision 1.1
        sys/arch/evbarm/conf/RPI: revision 1.59, 1.60
        sys/arch/evbarm/conf/mk.rpi: revision 1.4
        sys/arch/evbarm/conf/std.rpi: revisions 1.16-1.19 via patch
        sys/arch/evbarm/rpi/genassym.cf: revision 1.2
        sys/arch/evbarm/rpi/rpi.h: revision 1.4
        sys/arch/evbarm/rpi/rpi2_start.S: revision 1.1
        sys/arch/evbarm/rpi/rpi_machdep.c: revision 1.57, 1.58 via patch
        sys/arch/evbarm/rpi/rpi_start.S: revision 1.13
Move some options into std.rpi
--
Add __HAVE_MM_MD_CACHE_ALIASING
Pull up following revision(s) (requested by skrll in ticket #582):
Fix TPIDRPRW_IS_CURLWP builds.
--
A MULTIPROCESSOR kernel requires TPIDRPRW_IS_CURCPU.
--
Use TPIDRPRW_IS_CURLWP as it's a slight code reduction and performance
improvement.
Initial RPI2 support - it doesn't work yet. The generic timer gets messed
up somehow.
This commit changes the KVA layout of the RPI.
--
Make this compile where gtmr isn't used.
--
Spin up the non-boot CPUs, but don't allow cpu_boot_secondary_processors
to see them for now.
RPI2 nows works well with only the boot cpu.
--
Appease a KASSERT - will be remove when MULTIPROCESSOR RPI2 is fixed.
--
Add RPI2 to kernels build for both earmv[67].
Use the earmv6 built kernels to create an image that can be used on both
RPI and RPI2
--
Add an RPI2_INSTALL

diffstat:

 distrib/utils/embedded/conf/rpi.conf  |   16 +-
 etc/etc.evbarm/Makefile.inc           |    7 +-
 sys/arch/arm/broadcom/bcm2835_intr.c  |  201 ++++++++++++++++++++++++-
 sys/arch/arm/broadcom/bcm2835_obio.c  |   55 ++++++-
 sys/arch/arm/broadcom/bcm2835_space.c |   11 +-
 sys/arch/arm/broadcom/bcm2835reg.h    |   75 ++++++++-
 sys/arch/arm/broadcom/bcm2835var.h    |    7 +-
 sys/arch/arm/broadcom/files.bcm2835   |   13 +-
 sys/arch/arm/cortex/a9_mpsubr.S       |    6 +-
 sys/arch/arm/cortex/armperiph.c       |    8 +-
 sys/arch/arm/cortex/gtmr.c            |   13 +-
 sys/arch/arm/cortex/gtmr_var.h        |    3 +-
 sys/arch/arm/cortex/mpcore_var.h      |    3 +-
 sys/arch/arm/include/cpu.h            |   13 +-
 sys/arch/evbarm/conf/RPI              |   11 +-
 sys/arch/evbarm/conf/RPI2             |   24 ++
 sys/arch/evbarm/conf/RPI2_INSTALL     |   14 +
 sys/arch/evbarm/conf/mk.rpi           |    6 +-
 sys/arch/evbarm/conf/std.rpi          |   10 +-
 sys/arch/evbarm/rpi/genassym.cf       |    6 +-
 sys/arch/evbarm/rpi/rpi.h             |   20 +-
 sys/arch/evbarm/rpi/rpi2_start.S      |  277 ++++++++++++++++++++++++++++++++++
 sys/arch/evbarm/rpi/rpi_machdep.c     |  109 ++++++++++++-
 sys/arch/evbarm/rpi/rpi_start.S       |   12 +-
 24 files changed, 853 insertions(+), 67 deletions(-)

diffs (truncated from 1563 to 300 lines):

diff -r 93bfc98eea62 -r c553cc6b64c7 distrib/utils/embedded/conf/rpi.conf
--- a/distrib/utils/embedded/conf/rpi.conf      Wed Mar 11 19:49:52 2015 +0000
+++ b/distrib/utils/embedded/conf/rpi.conf      Wed Mar 11 20:22:55 2015 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: rpi.conf,v 1.24.4.2 2015/02/14 07:20:48 snj Exp $
+# $NetBSD: rpi.conf,v 1.24.4.3 2015/03/11 20:22:55 snj Exp $
 # Raspberry Pi customization script used by mkimage
 #
 
@@ -48,6 +48,8 @@
 }
 
 populate() {
+       rpi2_kernel="$(echo $kernel | sed 's/RPI/RPI2/g')"
+
        cat > ${mnt}/boot/cmdline.txt << EOF
 root=ld0a console=fb
 #fb=1280x1024          # to select a mode, otherwise try EDID 
@@ -58,7 +60,7 @@
                exit 1
        fi
 
-       echo "${bar} installing kernel ${bar}"
+       echo "${bar} installing RPI kernel ${bar}"
        case ${kernel} in
        *.gz)
                gzip -dc ${kernel} > ${mnt}/boot/kernel.img
@@ -68,6 +70,16 @@
                ;;
        esac
 
+       echo "${bar} installing RPI2 kernel ${bar}"
+       case ${rpi2_kernel} in
+       *.gz)
+               gzip -dc ${rpi2_kernel} > ${mnt}/boot/kernel7.img
+               ;;
+       *)
+               cp ${rpi_kernel} ${mnt}/boot/kernel7.img
+               ;;
+       esac
+
        echo "${bar} installing firmware files ${bar}"
        (cd ${mnt}/boot &&
                for f in ${firmwarefiles}; do
diff -r 93bfc98eea62 -r c553cc6b64c7 etc/etc.evbarm/Makefile.inc
--- a/etc/etc.evbarm/Makefile.inc       Wed Mar 11 19:49:52 2015 +0000
+++ b/etc/etc.evbarm/Makefile.inc       Wed Mar 11 20:22:55 2015 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.inc,v 1.63.2.2 2014/11/14 10:04:40 martin Exp $
+#      $NetBSD: Makefile.inc,v 1.63.2.3 2015/03/11 20:22:55 snj Exp $
 #
 #      etc.evbarm/Makefile.inc -- evbarm-specific etc Makefile targets
 #
@@ -69,6 +69,8 @@
 #EVBARM_BOARDS.armv6hf+=       IMX31LITE
 EVBARM_BOARDS.armv6+=          RPI
 EVBARM_BOARDS.armv6hf+=                RPI
+KERNEL_SETS.armv6+=            RPI2
+KERNEL_SETS.armv6hf+=          RPI2
 EVBARM_BOARDS.armv6+=          TISDP2420
 EVBARM_BOARDS.armv6hf+=        TISDP2420
 #EVBARM_BOARDS.armv6+=         TISDP2430
@@ -103,6 +105,8 @@
 #EVBARM_BOARDS.armv7+=         OVERO
 EVBARM_BOARDS.armv7+=          PANDABOARD
 EVBARM_BOARDS.armv7hf+=        PANDABOARD
+EVBARM_BOARDS.armv7+=          RPI2
+EVBARM_BOARDS.armv7hf+=                RPI2
 EVBARM_BOARDS.armv7+=          KOBO
 EVBARM_BOARDS.armv7hf+=        KOBO
 .endif
@@ -161,6 +165,7 @@
 
 .if !empty(KERNEL_SETS:MRPI)
 smp_rpi: ${IMAGE.kern}/netbsd-RPI.bin.gz __mkimage
+#            XXX ${IMAGE.kern}/netbsd-RPI2.bin.gz
 .if empty(ALL_KERNELS) || !empty(ALL_KERNELS:MRPI)
 SNAP_MD_POST_DEPS+=    smp_rpi
 .endif
diff -r 93bfc98eea62 -r c553cc6b64c7 sys/arch/arm/broadcom/bcm2835_intr.c
--- a/sys/arch/arm/broadcom/bcm2835_intr.c      Wed Mar 11 19:49:52 2015 +0000
+++ b/sys/arch/arm/broadcom/bcm2835_intr.c      Wed Mar 11 20:22:55 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcm2835_intr.c,v 1.3.12.1 2014/09/11 14:20:11 martin Exp $     */
+/*     $NetBSD: bcm2835_intr.c,v 1.3.12.2 2015/03/11 20:22:55 snj Exp $        */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,21 +30,28 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_intr.c,v 1.3.12.1 2014/09/11 14:20:11 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_intr.c,v 1.3.12.2 2015/03/11 20:22:55 snj Exp $");
 
 #define _INTR_PRIVATE
 
+#include "opt_bcm283x.h"
+
 #include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/cpu.h>
+#include <sys/device.h>
 #include <sys/proc.h>
-#include <sys/device.h>
 
 #include <machine/intr.h>
-#include <sys/bus.h>
+
+#include <arm/locore.h>
 
 #include <arm/pic/picvar.h>
+#include <arm/cortex/gtmr_var.h>
 
 #include <arm/broadcom/bcm_amba.h>
 #include <arm/broadcom/bcm2835reg.h>
+#include <arm/broadcom/bcm2835var.h>
 
 static void bcm2835_pic_unblock_irqs(struct pic_softc *, size_t, uint32_t);
 static void bcm2835_pic_block_irqs(struct pic_softc *, size_t, uint32_t);
@@ -53,6 +60,29 @@
 static void bcm2835_pic_source_name(struct pic_softc *, int, char *,
     size_t);
 
+#if defined(BCM2836)
+static void bcm2836mp_pic_unblock_irqs(struct pic_softc *, size_t, uint32_t);
+static void bcm2836mp_pic_block_irqs(struct pic_softc *, size_t, uint32_t);
+static int bcm2836mp_pic_find_pending_irqs(struct pic_softc *);
+static void bcm2836mp_pic_establish_irq(struct pic_softc *, struct intrsource *);
+static void bcm2836mp_pic_source_name(struct pic_softc *, int, char *,
+    size_t);
+#if 0
+#ifdef MULTIPROCESSOR
+int bcm2836mp_ipi_handler(void *);
+static void bcm2836mp_cpu_init(struct pic_softc *, struct cpu_info *);
+static void bcm2836mp_send_ipi(struct pic_softc *, const kcpuset_t *, u_long);
+#endif
+#endif
+#endif
+
+#ifdef MULTIPROCESSOR
+static void
+bcm2835_dummy(struct pic_softc *pic, const kcpuset_t *kcp, u_long ipi)
+{
+}
+#endif
+
 static int  bcm2835_icu_match(device_t, cfdata_t, void *);
 static void bcm2835_icu_attach(device_t, device_t, void *);
 
@@ -62,6 +92,9 @@
        .pic_find_pending_irqs = bcm2835_pic_find_pending_irqs,
        .pic_establish_irq = bcm2835_pic_establish_irq,
        .pic_source_name = bcm2835_pic_source_name,
+#if defined(MULTIPROCESSOR)
+       .pic_ipi_send = bcm2835_dummy,
+#endif
 };
 
 struct pic_softc bcm2835_pic = {
@@ -70,6 +103,26 @@
        .pic_name = "bcm2835 pic",
 };
 
+#if defined(BCM2836)
+static struct pic_ops bcm2836mp_picops = {
+       .pic_unblock_irqs = bcm2836mp_pic_unblock_irqs,
+       .pic_block_irqs = bcm2836mp_pic_block_irqs,
+       .pic_find_pending_irqs = bcm2836mp_pic_find_pending_irqs,
+       .pic_establish_irq = bcm2836mp_pic_establish_irq,
+       .pic_source_name = bcm2836mp_pic_source_name,
+#if 0 && defined(MULTIPROCESSOR)
+       .pic_cpu_init = bcm2836mp_cpu_init,
+       .pic_ipi_send = bcm2836mp_send_ipi,
+#endif
+};
+
+struct pic_softc bcm2836mp_pic = {
+       .pic_ops = &bcm2836mp_picops,
+       .pic_maxsources = BCM2836MP_NIRQ,
+       .pic_name = "bcm2836 mp pic",
+};
+#endif
+
 struct bcm2835icu_softc {
        device_t                sc_dev;
        bus_space_tag_t         sc_iot;
@@ -111,6 +164,15 @@
        "GPU0 Halted",  "GPU1 Halted",  "Illegal #1",   "Illegal #0"
 };
 
+#if defined(BCM2836)
+static const char * const bcm2836mp_sources[BCM2836MP_NIRQ] = {
+       "cntpsirq",     "cntpnsirq",    "cnthpirq",     "cntvirq",
+       "mailbox0",     "mailbox1",     "mailbox2",     "mailbox3",
+};
+#endif
+
+#define        BCM2836_INTBIT_GPUPENDING       __BIT(8)
+
 #define        BCM2835_INTBIT_PENDING1         __BIT(8)
 #define        BCM2835_INTBIT_PENDING2         __BIT(9)
 #define        BCM2835_INTBIT_ARM              __BITS(0,7)
@@ -148,7 +210,16 @@
        }
 
        bcmicu_sc = sc;
+
        pic_add(sc->sc_pic, 0);
+
+#if defined(BCM2836)
+#if 0 && defined(MULTIPROCESSOR)
+       aprint_normal(": Multiprocessor");
+#endif
+       pic_add(&bcm2836mp_pic, BCM2836_INT_LOCALBASE);
+#endif
+
        aprint_normal("\n");
 }
 
@@ -164,6 +235,9 @@
 
        bcm2835_barrier();
        ipl_mask = bcm2835_pic_find_pending_irqs(&bcm2835_pic);
+#if defined(BCM2836)
+       ipl_mask |= bcm2836mp_pic_find_pending_irqs(&bcm2836mp_pic);
+#endif
 
        /*
         * Record the pending_ipls and deliver them if we can.
@@ -247,3 +321,122 @@
 
        strlcpy(buf, bcm2835_sources[irq], len);
 }
+
+
+#if defined(BCM2836)
+
+#define        BCM2836MP_TIMER_IRQS    __BITS(3,0)
+#define        BCM2836MP_MAILBOX_IRQS  __BITS(4,4)
+
+#define        BCM2836MP_ALL_IRQS      \
+     (BCM2836MP_TIMER_IRQS | BCM2836MP_MAILBOX_IRQS)
+
+static void
+bcm2836mp_pic_unblock_irqs(struct pic_softc *pic, size_t irqbase,
+    uint32_t irq_mask)
+{
+       const int cpuid = 0;
+
+//printf("%s: irqbase %zu irq_mask %08x\n", __func__, irqbase, irq_mask);
+
+       if (irq_mask & BCM2836MP_TIMER_IRQS) {
+               uint32_t mask = __SHIFTOUT(irq_mask, BCM2836MP_TIMER_IRQS);
+               uint32_t val = bus_space_read_4(al_iot, al_ioh,
+                   BCM2836_LOCAL_TIMER_IRQ_CONTROLN(cpuid));
+               val |= mask;
+               bus_space_write_4(al_iot, al_ioh,
+                   BCM2836_LOCAL_TIMER_IRQ_CONTROLN(cpuid),
+                   val);
+               bus_space_barrier(al_iot, al_ioh,
+                   BCM2836_LOCAL_TIMER_IRQ_CONTROL_BASE,
+                   BCM2836_LOCAL_TIMER_IRQ_CONTROL_SIZE,
+                   BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE);
+//printf("%s: val %08x\n", __func__, val);
+       } else if (irq_mask & BCM2836MP_MAILBOX_IRQS) {
+               uint32_t mask = __SHIFTOUT(irq_mask, BCM2836MP_MAILBOX_IRQS);
+               uint32_t val = bus_space_read_4(al_iot, al_ioh,
+                   BCM2836_LOCAL_MAILBOX_IRQ_CONTROLN(cpuid));
+               val |= mask;
+               bus_space_write_4(al_iot, al_ioh,
+                   BCM2836_LOCAL_MAILBOX_IRQ_CONTROLN(cpuid),
+                   val);
+               bus_space_barrier(al_iot, al_ioh,
+                   BCM2836_LOCAL_MAILBOX_IRQ_CONTROL_BASE,
+                   BCM2836_LOCAL_MAILBOX_IRQ_CONTROL_SIZE,
+                   BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE);
+       }
+
+       return;
+}
+
+static void
+bcm2836mp_pic_block_irqs(struct pic_softc *pic, size_t irqbase,
+    uint32_t irq_mask)
+{
+       const int cpuid = 0;
+
+//printf("%s: irqbase %zu irq_mask %08x\n", __func__, irqbase, irq_mask);
+       if (irq_mask & BCM2836MP_TIMER_IRQS) {
+               uint32_t mask = __SHIFTOUT(irq_mask, BCM2836MP_TIMER_IRQS);
+               uint32_t val = bus_space_read_4(al_iot, al_ioh,
+                   BCM2836_LOCAL_TIMER_IRQ_CONTROLN(cpuid));
+               val &= ~mask;
+               bus_space_write_4(al_iot, al_ioh,
+                   BCM2836_LOCAL_TIMER_IRQ_CONTROLN(cpuid),
+                   val);
+//printf("%s: val %08x\n", __func__, val);
+       } else if (irq_mask & BCM2836MP_MAILBOX_IRQS) {
+               uint32_t mask = __SHIFTOUT(irq_mask, BCM2836MP_MAILBOX_IRQS);



Home | Main Index | Thread Index | Old Index