Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/arm32 Make sure ci_{smt,core,package}_id are al...



details:   https://anonhg.NetBSD.org/src/rev/53b686d956d3
branches:  trunk
changeset: 996241:53b686d956d3
user:      skrll <skrll%NetBSD.org@localhost>
date:      Fri Jan 25 18:31:44 2019 +0000

description:
Make sure ci_{smt,core,package}_id are all filled in appropriately.

Previously the BP was missed and __SHIFTOUT wasn't used.

diffstat:

 sys/arch/arm/arm32/arm32_boot.c |  14 +++++++-------
 sys/arch/arm/arm32/cpu.c        |  16 +++++++++++++---
 2 files changed, 20 insertions(+), 10 deletions(-)

diffs (73 lines):

diff -r 529dfd084411 -r 53b686d956d3 sys/arch/arm/arm32/arm32_boot.c
--- a/sys/arch/arm/arm32/arm32_boot.c   Fri Jan 25 15:34:22 2019 +0000
+++ b/sys/arch/arm/arm32/arm32_boot.c   Fri Jan 25 18:31:44 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arm32_boot.c,v 1.30 2019/01/03 15:33:06 skrll Exp $    */
+/*     $NetBSD: arm32_boot.c,v 1.31 2019/01/25 18:31:44 skrll Exp $    */
 
 /*
  * Copyright (c) 2002, 2003, 2005  Genetec Corporation.  All rights reserved.
@@ -122,7 +122,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: arm32_boot.c,v 1.30 2019/01/03 15:33:06 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: arm32_boot.c,v 1.31 2019/01/25 18:31:44 skrll Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_cputypes.h"
@@ -352,12 +352,12 @@
        uint32_t mpidr = armreg_mpidr_read();
        ci->ci_mpidr = mpidr;
        if (mpidr & MPIDR_MT) {
-               ci->ci_smt_id = mpidr & MPIDR_AFF0;
-               ci->ci_core_id = mpidr & MPIDR_AFF1;
-               ci->ci_package_id = mpidr & MPIDR_AFF2;
+               ci->ci_smt_id = __SHIFTOUT(mpidr, MPIDR_AFF0);
+               ci->ci_core_id = __SHIFTOUT(mpidr, MPIDR_AFF1);
+               ci->ci_package_id = __SHIFTOUT(mpidr, MPIDR_AFF2);
        } else {
-               ci->ci_core_id = mpidr & MPIDR_AFF0;
-               ci->ci_package_id = mpidr & MPIDR_AFF1;
+               ci->ci_core_id = __SHIFTOUT(mpidr, MPIDR_AFF0);
+               ci->ci_package_id = __SHIFTOUT(mpidr, MPIDR_AFF1);
        }
 
        ci->ci_arm_cpuid = cpu_idnum();
diff -r 529dfd084411 -r 53b686d956d3 sys/arch/arm/arm32/cpu.c
--- a/sys/arch/arm/arm32/cpu.c  Fri Jan 25 15:34:22 2019 +0000
+++ b/sys/arch/arm/arm32/cpu.c  Fri Jan 25 18:31:44 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.c,v 1.126 2019/01/03 15:12:00 jmcneill Exp $       */
+/*     $NetBSD: cpu.c,v 1.127 2019/01/25 18:31:44 skrll 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.126 2019/01/03 15:12:00 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.127 2019/01/25 18:31:44 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -103,7 +103,17 @@
                ci->ci_arm_cputype = ci->ci_arm_cpuid & CPU_ID_CPU_MASK;
                ci->ci_arm_cpurev = ci->ci_arm_cpuid & CPU_ID_REVISION_MASK;
 #ifdef MULTIPROCESSOR
-               ci->ci_mpidr = armreg_mpidr_read();
+               uint32_t mpidr = armreg_mpidr_read();
+               ci->ci_mpidr = mpidr;
+
+               if (mpidr & MPIDR_MT) {
+                       ci->ci_smt_id = __SHIFTOUT(mpidr, MPIDR_AFF0);
+                       ci->ci_core_id = __SHIFTOUT(mpidr, MPIDR_AFF1);
+                       ci->ci_package_id = __SHIFTOUT(mpidr, MPIDR_AFF2);
+               } else {
+                       ci->ci_core_id = __SHIFTOUT(mpidr, MPIDR_AFF0);
+                       ci->ci_package_id = __SHIFTOUT(mpidr, MPIDR_AFF1);
+               }
 #endif
        } else {
 #ifdef MULTIPROCESSOR



Home | Main Index | Thread Index | Old Index