Source-Changes-HG archive

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

[src/netbsd-8]: src/sys/arch/arm/fdt Pull up following revision(s) (requested...



details:   https://anonhg.NetBSD.org/src/rev/148996634647
branches:  netbsd-8
changeset: 850745:148996634647
user:      snj <snj%NetBSD.org@localhost>
date:      Wed Jun 21 18:10:40 2017 +0000

description:
Pull up following revision(s) (requested by jmcneill in ticket #49):
        sys/arch/arm/fdt/cpu_fdt.c: revision 1.2
Only try to attach to CPUs with the same cluster ID as the boot processor.

diffstat:

 sys/arch/arm/fdt/cpu_fdt.c |  24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)

diffs (51 lines):

diff -r b42298333f82 -r 148996634647 sys/arch/arm/fdt/cpu_fdt.c
--- a/sys/arch/arm/fdt/cpu_fdt.c        Wed Jun 21 18:09:06 2017 +0000
+++ b/sys/arch/arm/fdt/cpu_fdt.c        Wed Jun 21 18:10:40 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_fdt.c,v 1.1 2017/05/28 00:40:20 jmcneill Exp $ */
+/* $NetBSD: cpu_fdt.c,v 1.1.2.1 2017/06/21 18:10:40 snj Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.1 2017/05/28 00:40:20 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.1.2.1 2017/06/21 18:10:40 snj Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -68,8 +68,23 @@
                NULL
        };
        struct fdt_attach_args * const faa = aux;
+       int is_compatible;
+       bus_addr_t mpidr;
 
-       return of_compatible(faa->faa_phandle, compatible) >= 0;
+       is_compatible = of_match_compatible(faa->faa_phandle, compatible);
+       if (!is_compatible)
+               return 0;
+
+       /* XXX NetBSD requires all CPUs to be in the same cluster */
+       if (fdtbus_get_reg(faa->faa_phandle, 0, &mpidr, NULL) != 0)
+               return 0;
+       const uint32_t bp_mpidr = armreg_mpidr_read();
+       const u_int bp_clid = __SHIFTOUT(bp_mpidr, CORTEXA9_MPIDR_CLID);
+       const u_int clid = __SHIFTOUT(mpidr, CORTEXA9_MPIDR_CLID);
+       if (bp_clid != clid)
+               return 0;
+
+       return is_compatible;
 }
 
 static void
@@ -87,5 +102,6 @@
                return;
        }
 
-       cpu_attach(self, mpidr);
+       /* Attach the CPU */
+       cpu_attach(self, __SHIFTOUT(mpidr, CORTEXA9_MPIDR_CPUID));
 }



Home | Main Index | Thread Index | Old Index