aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/sys/cpu.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/sys/cpu.h b/sys/sys/cpu.h
index 21e79e6db6a4..9156fa9f723d 100644
--- a/sys/sys/cpu.h
+++ b/sys/sys/cpu.h
@@ -51,6 +51,17 @@ cpu_get_pcpu(device_t dev)
return ((struct pcpu *)v);
}
+/*
+ * Assumes the parent bus sets the CPU_IVAR_PCPU instance variable, which most
+ * CPU buses do. A panic will ensure if not the case. Calling devices should
+ * check for that condition (most probably in their attach function).
+ */
+static __inline u_int
+cpu_get_pcpuid(device_t dev)
+{
+ return (cpu_get_pcpu(dev)->pc_cpuid);
+}
+
static __inline int32_t
cpu_get_nominal_mhz(device_t dev)
{