Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F149244500
D5958.1789741889.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D5958.1789741889.diff
View Options
Index: sys/amd64/conf/GENERIC
===================================================================
--- sys/amd64/conf/GENERIC
+++ sys/amd64/conf/GENERIC
@@ -349,9 +349,6 @@
device virtio_scsi # VirtIO SCSI device
device virtio_balloon # VirtIO Memory Balloon device
-# HyperV drivers and enchancement support
-device hyperv # HyperV drivers
-
# Xen HVM Guest Optimizations
# NOTE: XENHVM depends on xenpci. They must be added or removed together.
options XENHVM # Xen HVM kernel infrastructure
Index: sys/boot/i386/libi386/i386_module.c
===================================================================
--- sys/boot/i386/libi386/i386_module.c
+++ sys/boot/i386/libi386/i386_module.c
@@ -31,6 +31,37 @@
* i386-specific module functionality.
*
*/
+#include <bootstrap.h>
+#include <stand.h>
+#include <string.h>
+#include <machine/cpufunc.h>
+
+#define HV_UNKNOWN 0
+#define HV_XEN 1
+#define HV_HYPERV 2
+
+/* See the kernel's function identify_hypervisor(). */
+static int
+get_hypervisor(void)
+{
+ unsigned int regs[4];
+ char hv_vendor[13];
+
+ do_cpuid(1, regs);
+ if (regs[2] & 0x80000000) {
+ do_cpuid(0x40000000, regs);
+ if (regs[0] >= 0x40000000) {
+ ((u_int *)&hv_vendor)[0] = regs[1];
+ ((u_int *)&hv_vendor)[1] = regs[2];
+ ((u_int *)&hv_vendor)[2] = regs[3];
+ hv_vendor[12] = '\0';
+ if (strcmp(hv_vendor, "Microsoft Hv") == 0)
+ return (HV_HYPERV);
+ }
+ }
+
+ return (HV_UNKNOWN);
+}
/*
* Use voodoo to load modules required by current hardware.
@@ -38,7 +69,14 @@
int
i386_autoload(void)
{
+ switch(get_hypervisor()) {
+ case HV_HYPERV:
+ mod_loadkld("hyperv.ko", 0, NULL);
+ break;
+ default:
+ break;
+ }
- /* XXX use PnP to locate stuff here */
- return(0);
+ /* XXX use PnP to locate stuff here */
+ return(0);
}
Index: sys/i386/conf/GENERIC
===================================================================
--- sys/i386/conf/GENERIC
+++ sys/i386/conf/GENERIC
@@ -366,9 +366,6 @@
device virtio_scsi # VirtIO SCSI device
device virtio_balloon # VirtIO Memory Balloon device
-# HyperV drivers and enchancement support
-device hyperv # HyperV drivers
-
# Xen HVM Guest Optimizations
# NOTE: XENHVM depends on xenpci. They must be added or removed together.
options XENHVM # Xen HVM kernel infrastructure
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Sep 18, 2:31 PM (21 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29758275
Default Alt Text
D5958.1789741889.diff (2 KB)
Attached To
Mode
D5958: hyperv: load hyperv driver from boot loader automatically.
Attached
Detach File
Event Timeline
Log In to Comment