Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/fdt /cpus node may have any nodes except cpu. c...



details:   https://anonhg.NetBSD.org/src/rev/d1750c6dc1a6
branches:  trunk
changeset: 365627:d1750c6dc1a6
user:      ryo <ryo%NetBSD.org@localhost>
date:      Fri Aug 24 21:56:13 2018 +0000

description:
/cpus node may have any nodes except cpu. count only nodes of device_type "cpu"

diffstat:

 sys/arch/arm/fdt/psci_fdt.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (37 lines):

diff -r c12e42ce2738 -r d1750c6dc1a6 sys/arch/arm/fdt/psci_fdt.c
--- a/sys/arch/arm/fdt/psci_fdt.c       Fri Aug 24 20:55:20 2018 +0000
+++ b/sys/arch/arm/fdt/psci_fdt.c       Fri Aug 24 21:56:13 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: psci_fdt.c,v 1.13 2018/08/13 12:28:02 skrll Exp $ */
+/* $NetBSD: psci_fdt.c,v 1.14 2018/08/24 21:56:13 ryo Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 #include "opt_multiprocessor.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: psci_fdt.c,v 1.13 2018/08/13 12:28:02 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: psci_fdt.c,v 1.14 2018/08/24 21:56:13 ryo Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -175,6 +175,7 @@
        extern void cortex_mpstart(void);
        uint64_t mpidr, bp_mpidr;
        int child;
+       const char *devtype;
 
        const int cpus = OF_finddevice("/cpus");
        if (cpus == -1) {
@@ -186,7 +187,9 @@
        /* Count CPUs */
        arm_cpu_max = 0;
        for (child = OF_child(cpus); child; child = OF_peer(child))
-               if (fdtbus_status_okay(child))
+               if (fdtbus_status_okay(child) && ((devtype =
+                   fdtbus_get_string(child, "device_type")) != NULL) &&
+                   (strcmp(devtype, "cpu") == 0))
                        arm_cpu_max++;
 
        if (psci_fdt_preinit() != 0)



Home | Main Index | Thread Index | Old Index