summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pv/pvbus.c18
-rw-r--r--sys/dev/pv/pvreg.h9
2 files changed, 24 insertions, 3 deletions
diff --git a/sys/dev/pv/pvbus.c b/sys/dev/pv/pvbus.c
index 4ee70ddede5..3871aa4c6b8 100644
--- a/sys/dev/pv/pvbus.c
+++ b/sys/dev/pv/pvbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pvbus.c,v 1.4 2015/07/28 09:48:52 reyk Exp $ */
+/* $OpenBSD: pvbus.c,v 1.5 2015/07/29 17:08:46 mikeb Exp $ */
/*
* Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
@@ -51,6 +51,7 @@ int pvbus_search(struct device *, void *, void *);
void pvbus_kvm(struct pvbus_softc *, struct pvbus_hv *);
void pvbus_hyperv(struct pvbus_softc *, struct pvbus_hv *);
+void pvbus_xen(struct pvbus_softc *, struct pvbus_hv *);
struct cfattach pvbus_ca = {
sizeof(struct pvbus_softc),
@@ -74,7 +75,7 @@ struct pvbus_type {
{ "KVMKVMKVM\0\0\0", "KVM", pvbus_kvm },
{ "Microsoft Hv", "Hyper-V", pvbus_hyperv },
{ "VMwareVMware", "VMware", NULL },
- { "XenVMMXenVMM", "Xen", NULL },
+ { "XenVMMXenVMM", "Xen", pvbus_xen },
{ "bhyve bhyve ", "bhyve", NULL }
};
@@ -219,3 +220,16 @@ pvbus_hyperv(struct pvbus_softc *sc, struct pvbus_hv *hv)
HYPERV_VERSION_EBX_MINOR_S,
regs[0]);
}
+
+void
+pvbus_xen(struct pvbus_softc *sc, struct pvbus_hv *hv)
+{
+ uint32_t regs[4];
+
+ CPUID(hv->hv_base + CPUID_OFFSET_XEN_VERSION,
+ regs[0], regs[1], regs[2], regs[3]);
+ hv->hv_version = regs[0];
+
+ printf(" %u.%u", regs[0] >> XEN_VERSION_MAJOR_S,
+ regs[0] & XEN_VERSION_MINOR_M);
+}
diff --git a/sys/dev/pv/pvreg.h b/sys/dev/pv/pvreg.h
index 41485dd305f..1eb8a0cafa5 100644
--- a/sys/dev/pv/pvreg.h
+++ b/sys/dev/pv/pvreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pvreg.h,v 1.2 2015/07/28 09:48:52 reyk Exp $ */
+/* $OpenBSD: pvreg.h,v 1.3 2015/07/29 17:08:46 mikeb Exp $ */
/*
* Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
@@ -83,4 +83,11 @@
#define HYPERV_FEATURE_EAX_TIMER_FREQ 11
#define HYPERV_FEATURE_EAX_DEBUG 12
+/*
+ * Xen
+ */
+#define CPUID_OFFSET_XEN_VERSION 0x1
+#define XEN_VERSION_MAJOR_S 16
+#define XEN_VERSION_MINOR_M 0xffff
+
#endif /* _DEV_PV_PVBUS_H_ */