Source-Changes-HG archive

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

[src/netbsd-9]: src/sys Pull up following revision(s) (requested by martin in...



details:   https://anonhg.NetBSD.org/src/rev/4c3ddea82262
branches:  netbsd-9
changeset: 467019:4c3ddea82262
user:      snj <snj%NetBSD.org@localhost>
date:      Thu Jan 09 17:16:47 2020 +0000

description:
Pull up following revision(s) (requested by martin in ticket #614):

        sys/arch/aarch64/aarch64/cpu.c: 1.32
        sys/arch/arm/arm32/cpu.c: 1.138
        sys/dev/fdt/fdtbus.c: 1.31

When attaching the first fdtbus, use the root "comptabile" (or failing that:
"model") property to set the cpu model (in userland aka sysctl hw.model).
When attaching the first cpu, do not overwrite a cpu model if it already
had been set.

diffstat:

 sys/arch/aarch64/aarch64/cpu.c |  12 ++++++++----
 sys/arch/arm/arm32/cpu.c       |   9 ++++++---
 sys/dev/fdt/fdtbus.c           |  14 +++++++++++---
 3 files changed, 25 insertions(+), 10 deletions(-)

diffs (119 lines):

diff -r 4e18bd901bc6 -r 4c3ddea82262 sys/arch/aarch64/aarch64/cpu.c
--- a/sys/arch/aarch64/aarch64/cpu.c    Thu Jan 09 11:17:46 2020 +0000
+++ b/sys/arch/aarch64/aarch64/cpu.c    Thu Jan 09 17:16:47 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.20.2.2 2019/12/29 09:40:59 martin Exp $ */
+/* $NetBSD: cpu.c,v 1.20.2.3 2020/01/09 17:16:47 snj Exp $ */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.20.2.2 2019/12/29 09:40:59 martin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.20.2.3 2020/01/09 17:16:47 snj Exp $");
 
 #include "locators.h"
 #include "opt_arm_debug.h"
@@ -231,10 +231,14 @@
 cpu_identify(device_t self, struct cpu_info *ci)
 {
        char model[128];
+       const char *m;
 
        identify_aarch64_model(ci->ci_id.ac_midr, model, sizeof(model));
-       if (ci->ci_index == 0)
-               cpu_setmodel("%s", model);
+       if (ci->ci_index == 0) { 
+               m = cpu_getmodel();
+               if (m == NULL || *m == 0)
+                       cpu_setmodel("%s", model);
+       }
 
        aprint_naive("\n");
        aprint_normal(": %s\n", model);
diff -r 4e18bd901bc6 -r 4c3ddea82262 sys/arch/arm/arm32/cpu.c
--- a/sys/arch/arm/arm32/cpu.c  Thu Jan 09 11:17:46 2020 +0000
+++ b/sys/arch/arm/arm32/cpu.c  Thu Jan 09 17:16:47 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.c,v 1.129.4.1 2019/10/23 19:14:19 martin Exp $     */
+/*     $NetBSD: cpu.c,v 1.129.4.2 2020/01/09 17:16:47 snj Exp $        */
 
 /*
  * Copyright (c) 1995 Mark Brinicombe.
@@ -46,7 +46,7 @@
 #include "opt_multiprocessor.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.129.4.1 2019/10/23 19:14:19 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.129.4.2 2020/01/09 17:16:47 snj Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -672,6 +672,7 @@
        const uint32_t arm_cpuid = ci->ci_arm_cpuid;
        const char * const xname = device_xname(dv);
        char model[128];
+       const char *m;
 
        if (arm_cpuid == 0) {
                aprint_error("Processor failed probe - no CPU ID\n");
@@ -681,7 +682,9 @@
        const enum cpu_class cpu_class = identify_arm_model(arm_cpuid,
             model, sizeof(model));
        if (ci->ci_cpuid == 0) {
-               cpu_setmodel("%s", model);
+               m = cpu_getmodel();
+               if (m == NULL || *m == 0)
+                       cpu_setmodel("%s", model);
        }
 
        if (ci->ci_data.cpu_cc_freq != 0) {
diff -r 4e18bd901bc6 -r 4c3ddea82262 sys/dev/fdt/fdtbus.c
--- a/sys/dev/fdt/fdtbus.c      Thu Jan 09 11:17:46 2020 +0000
+++ b/sys/dev/fdt/fdtbus.c      Thu Jan 09 17:16:47 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtbus.c,v 1.29.2.1 2019/10/03 17:23:11 martin Exp $ */
+/* $NetBSD: fdtbus.c,v 1.29.2.2 2020/01/09 17:16:47 snj Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,12 +27,13 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.29.2.1 2019/10/03 17:23:11 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.29.2.2 2020/01/09 17:16:47 snj Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/device.h>
 #include <sys/kmem.h>
+#include <sys/cpu.h>
 
 #include <sys/bus.h>
 
@@ -120,7 +121,7 @@
        struct fdt_softc *sc = device_private(self);
        const struct fdt_attach_args *faa = aux;
        const int phandle = faa->faa_phandle;
-       const char *descr;
+       const char *descr, *model;
 
        sc->sc_dev = self;
        sc->sc_phandle = phandle;
@@ -141,6 +142,13 @@
        if (OF_finddevice("/") != faa->faa_phandle)
                return;
 
+       /* Set hw.model if available */
+       model = fdtbus_get_string(phandle, "compatible");
+       if (model)
+               cpu_setmodel(model);
+       else if (descr)
+               cpu_setmodel(descr);
+
        /* Scan devices */
        fdt_rescan(self, NULL, NULL);
 }



Home | Main Index | Thread Index | Old Index