summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormsaitoh <msaitoh@NetBSD.org>2022-10-12 10:26:09 +0000
committermsaitoh <msaitoh@NetBSD.org>2022-10-12 10:26:09 +0000
commite062da2e49289ae0d38cfccd79e533ba95020cef (patch)
treea0d0eb23c97f341e58b2640b34e3c134d610b15c
parentdfe8f60b3d7644efda1efd11993041880fe7a8f5 (diff)
Use macros. No functional change.
-rw-r--r--sys/arch/x86/x86/cpu_topology.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/arch/x86/x86/cpu_topology.c b/sys/arch/x86/x86/cpu_topology.c
index dfc4a75f8f9..40a2a9626ec 100644
--- a/sys/arch/x86/x86/cpu_topology.c
+++ b/sys/arch/x86/x86/cpu_topology.c
@@ -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 @@ x86_cpu_topology(struct cpu_info *ci)
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 @@ x86_cpu_topology(struct cpu_info *ci)
/* 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);