summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjdc <jdc@NetBSD.org>2011-09-11 14:54:49 +0000
committerjdc <jdc@NetBSD.org>2011-09-11 14:54:49 +0000
commit572d0fca3eecd8d8d8d3abb3b854afe307f381ac (patch)
tree6cc46c5eaeff1c482ceab5f4b5a9451e7f73a412
parent8669fab9cb8ea96efc96a2df535d2a8c141725af (diff)
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@.
-rw-r--r--sys/kern/kern_cpu.c5
-rw-r--r--sys/sys/cpuio.h5
-rw-r--r--usr.sbin/cpuctl/cpuctl.c6
3 files changed, 9 insertions, 7 deletions
diff --git a/sys/kern/kern_cpu.c b/sys/kern/kern_cpu.c
index a89776186d4..e3df04296e0 100644
--- a/sys/kern/kern_cpu.c
+++ b/sys/kern/kern_cpu.c
@@ -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 @@ cpuctl_ioctl(dev_t dev, u_long cmd, void *data, int flag, lwp_t *l)
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:
diff --git a/sys/sys/cpuio.h b/sys/sys/cpuio.h
index 3f916822b4b..947674c62b9 100644
--- a/sys/sys/cpuio.h
+++ b/sys/sys/cpuio.h
@@ -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 @@ typedef struct cpustate {
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)
diff --git a/usr.sbin/cpuctl/cpuctl.c b/usr.sbin/cpuctl/cpuctl.c
index 24cbc734308..a2b38913746 100644
--- a/usr.sbin/cpuctl/cpuctl.c
+++ b/usr.sbin/cpuctl/cpuctl.c
@@ -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 @@ cpu_list(char **argv)
((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);
}
}