Module Name: src
Committed By: jdc
Date: Sun Sep 11 14:54:50 UTC 2011
Modified Files:
src/sys/kern: kern_cpu.c
src/sys/sys: cpuio.h
src/usr.sbin/cpuctl: cpuctl.c
Log Message:
Add a cs_hwid field to cpustate and use this to store the ci_cpuid (hardware
ID). Report this as the HwID in cpuctl.
OK jruoho@.
To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/kern/kern_cpu.c
cvs rdiff -u -r1.4 -r1.5 src/sys/sys/cpuio.h
cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/cpuctl/cpuctl.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/kern_cpu.c
diff -u src/sys/kern/kern_cpu.c:1.50 src/sys/kern/kern_cpu.c:1.51
--- src/sys/kern/kern_cpu.c:1.50 Sun Aug 7 21:38:32 2011
+++ src/sys/kern/kern_cpu.c Sun Sep 11 14:54:49 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_cpu.c,v 1.50 2011/08/07 21:38:32 rmind Exp $ */
+/* $NetBSD: kern_cpu.c,v 1.51 2011/09/11 14:54:49 jdc Exp $ */
/*-
* Copyright (c) 2007, 2008, 2009, 2010 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.50 2011/08/07 21:38:32 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.51 2011/09/11 14:54:49 jdc Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -226,6 +226,7 @@
cs->cs_lastmodhi = (int32_t)
(ci->ci_schedstate.spc_lastmod >> 32);
cs->cs_intrcnt = cpu_intr_count(ci) + 1;
+ cs->cs_hwid = ci->ci_cpuid;
break;
case IOC_CPU_MAPID:
Index: src/sys/sys/cpuio.h
diff -u src/sys/sys/cpuio.h:1.4 src/sys/sys/cpuio.h:1.5
--- src/sys/sys/cpuio.h:1.4 Sun Apr 19 14:11:37 2009
+++ src/sys/sys/cpuio.h Sun Sep 11 14:54:49 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: cpuio.h,v 1.4 2009/04/19 14:11:37 ad Exp $ */
+/* $NetBSD: cpuio.h,v 1.5 2011/09/11 14:54:49 jdc Exp $ */
/*-
* Copyright (c) 2007, 2009 The NetBSD Foundation, Inc.
@@ -53,7 +53,8 @@
char cs_name[16]; /* reserved */
int32_t cs_lastmodhi; /* time of last state change */
uint32_t cs_intrcnt; /* count of interrupt handlers + 1 */
- uint32_t cs_reserved[2]; /* reserved */
+ uint32_t cs_hwid; /* hardware id */
+ uint32_t cs_reserved; /* reserved */
} cpustate_t;
#define IOC_CPU_SETSTATE _IOW('c', 0, cpustate_t)
Index: src/usr.sbin/cpuctl/cpuctl.c
diff -u src/usr.sbin/cpuctl/cpuctl.c:1.16 src/usr.sbin/cpuctl/cpuctl.c:1.17
--- src/usr.sbin/cpuctl/cpuctl.c:1.16 Sat Aug 27 22:38:48 2011
+++ src/usr.sbin/cpuctl/cpuctl.c Sun Sep 11 14:54:49 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: cpuctl.c,v 1.16 2011/08/27 22:38:48 joerg Exp $ */
+/* $NetBSD: cpuctl.c,v 1.17 2011/09/11 14:54:49 jdc Exp $ */
/*-
* Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#ifndef lint
#include <sys/cdefs.h>
-__RCSID("$NetBSD: cpuctl.c,v 1.16 2011/08/27 22:38:48 joerg Exp $");
+__RCSID("$NetBSD: cpuctl.c,v 1.17 2011/09/11 14:54:49 jdc Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -266,7 +266,7 @@
((time_t)cs.cs_lastmodhi << 32);
ts = asctime(localtime(&lastmod));
ts[strlen(ts) - 1] = '\0';
- printf("%-4d %-4x %-12s %-10s %s %s\n", i, cs.cs_id, state,
+ printf("%-4d %-4x %-12s %-10s %s %s\n", i, cs.cs_hwid, state,
intr, ts, ibuf);
}
}