Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/x86 Use macros. No functional change.



details:   https://anonhg.NetBSD.org/src/rev/789a7646ed2a
branches:  trunk
changeset: 371806:789a7646ed2a
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Oct 12 10:26:09 2022 +0000

description:
Use macros. No functional change.

diffstat:

 sys/arch/x86/x86/cpu_topology.c |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (43 lines):

diff -r f3ac9f37a936 -r 789a7646ed2a sys/arch/x86/x86/cpu_topology.c
--- a/sys/arch/x86/x86/cpu_topology.c   Wed Oct 12 10:25:41 2022 +0000
+++ b/sys/arch/x86/x86/cpu_topology.c   Wed Oct 12 10:26:09 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu_topology.c,v 1.20 2021/10/27 04:15:41 mrg Exp $    */
+/*     $NetBSD: cpu_topology.c,v 1.21 2022/10/12 10:26:09 msaitoh Exp $        */
 
 /*-
  * Copyright (c) 2009 Mindaugas Rasiukevicius <rmind at NetBSD org>,
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu_topology.c,v 1.20 2021/10/27 04:15:41 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_topology.c,v 1.21 2022/10/12 10:26:09 msaitoh Exp $");
 
 #include "acpica.h"
 
@@ -143,11 +143,11 @@
                        break;
                }
 
-               /* Number of Cores (NC) per package (ecx[7:0]). */
+               /* Number of Cores (NC) per package. */
                x86_cpuid(0x80000008, descs);
-               core_max = (descs[2] & 0xff) + 1;
+               core_max = __SHIFTOUT(descs[2], CPUID_CAPEX_NC) + 1;
                /* Amount of bits representing Core ID (ecx[15:12]). */
-               n = (descs[2] >> 12) & 0x0f;
+               n = __SHIFTOUT(descs[2], CPUID_CAPEX_ApicIdSize);
                if (n != 0) {
                        /*
                         * Extended Method.
@@ -188,7 +188,8 @@
        /* Family 0x17 and above support SMT */
        if (cpu_vendor == CPUVENDOR_AMD && cpu_family >= 0x17) { /* XXX */
                x86_cpuid(0x8000001e, descs);
-               const u_int threads = ((descs[1] >> 8) & 0xff) + 1;
+               const u_int threads = __SHIFTOUT(descs[1],
+                   CPUID_AMD_PROCT_THREADS_PER_CORE) + 1;
 
                KASSERT(smt_bits == 0);
                smt_bits = ilog2(threads);



Home | Main Index | Thread Index | Old Index