Staging: hv: auto-load MSFT PV NIC driver
authorK. Y. Srinivasan <ksrinivasan@novell.com>
Fri, 7 May 2010 23:52:17 +0000 (17:52 -0600)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 14 May 2010 20:11:30 +0000 (13:11 -0700)
Signed-off-by: K. Y. Srinivasan <ksrinivasan@novell.com>
Cc: Hank Janssen <hjanssen@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/hv/netvsc_drv.c

index 30c946c133c20c2f804ca1993120be61cc78f663..1bda2407b49c9f8097d3f66d82e99862f4d28eda 100644 (file)
@@ -30,6 +30,8 @@
 #include <linux/skbuff.h>
 #include <linux/in.h>
 #include <linux/slab.h>
+#include <linux/dmi.h>
+#include <linux/pci.h>
 #include <net/arp.h>
 #include <net/route.h>
 #include <net/sock.h>
@@ -551,6 +553,20 @@ static int netvsc_drv_init(int (*drv_init)(struct hv_driver *drv))
        return ret;
 }
 
+static const struct dmi_system_id __initconst
+hv_netvsc_dmi_table[] __maybe_unused  = {
+       {
+               .ident = "Hyper-V",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"),
+                       DMI_MATCH(DMI_BOARD_NAME, "Virtual Machine"),
+               },
+       },
+       { },
+};
+MODULE_DEVICE_TABLE(dmi, hv_netvsc_dmi_table);
+
 static int __init netvsc_init(void)
 {
        int ret;
@@ -558,6 +574,9 @@ static int __init netvsc_init(void)
        DPRINT_ENTER(NETVSC_DRV);
        DPRINT_INFO(NETVSC_DRV, "Netvsc initializing....");
 
+       if (!dmi_check_system(hv_netvsc_dmi_table))
+               return -ENODEV;
+
        ret = netvsc_drv_init(NetVscInitialize);
 
        DPRINT_EXIT(NETVSC_DRV);
@@ -572,6 +591,13 @@ static void __exit netvsc_exit(void)
        DPRINT_EXIT(NETVSC_DRV);
 }
 
+static const struct pci_device_id __initconst
+hv_netvsc_pci_table[] __maybe_unused = {
+       { PCI_DEVICE(0x1414, 0x5353) }, /* VGA compatible controller */
+       { 0 }
+};
+MODULE_DEVICE_TABLE(pci, hv_netvsc_pci_table);
+
 MODULE_LICENSE("GPL");
 MODULE_VERSION(HV_DRV_VERSION);
 MODULE_DESCRIPTION("Microsoft Hyper-V network driver");