summaryrefslogtreecommitdiff
path: root/sys/dev/pv/pvbus.c
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2015-07-29 17:08:47 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2015-07-29 17:08:47 +0000
commit4df4f6feefca62a30287f98f59a6d83e202639a5 (patch)
tree8d1abd6a76100036f25bbf4b28e0c65e4a4f6264 /sys/dev/pv/pvbus.c
parent1ae76c11b6e0dbda601282548a24121929c872df (diff)
Determine and print Xen hypervisor version.
ok reyk, with deraadt@'s permission
Diffstat (limited to 'sys/dev/pv/pvbus.c')
-rw-r--r--sys/dev/pv/pvbus.c18
1 files changed, 16 insertions, 2 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);
+}