diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2013-10-02 07:55:10 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2013-10-09 05:52:24 -0400 |
commit | 7ad9684721606efbfb9b347346816e1e6baff8bb (patch) | |
tree | 3cbc90799b0c613246fa22c8784f8241c0b9d0f0 /drivers/video | |
parent | 7831b2ae4a348144be95ccac49d67aa54d6f0dc0 (diff) |
hyperv-fb: add pci stub
This patch adds a pci stub driver to hyper-fb. The hyperv framebuffer
driver will bind to the pci device then, so linux kernel and userspace
know there is a proper kernel driver for the device active. lspci shows
this for example:
[root@dhcp231 ~]# lspci -vs8
00:08.0 VGA compatible controller: Microsoft Corporation Hyper-V virtual
VGA (prog-if 00 [VGA controller])
Flags: bus master, fast devsel, latency 0, IRQ 11
Memory at f8000000 (32-bit, non-prefetchable) [size=64M]
Expansion ROM at <unassigned> [disabled]
Kernel driver in use: hyperv_fb
Another effect is that the xorg vesa driver will not attach to the
device and thus the Xorg server will automatically use the fbdev
driver instead.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/hyperv_fb.c | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/drivers/video/hyperv_fb.c b/drivers/video/hyperv_fb.c index 8ac99b87c07e..8d456dc449b8 100644 --- a/drivers/video/hyperv_fb.c +++ b/drivers/video/hyperv_fb.c | |||
@@ -795,12 +795,21 @@ static int hvfb_remove(struct hv_device *hdev) | |||
795 | } | 795 | } |
796 | 796 | ||
797 | 797 | ||
798 | static DEFINE_PCI_DEVICE_TABLE(pci_stub_id_table) = { | ||
799 | { | ||
800 | .vendor = PCI_VENDOR_ID_MICROSOFT, | ||
801 | .device = PCI_DEVICE_ID_HYPERV_VIDEO, | ||
802 | }, | ||
803 | { /* end of list */ } | ||
804 | }; | ||
805 | |||
798 | static const struct hv_vmbus_device_id id_table[] = { | 806 | static const struct hv_vmbus_device_id id_table[] = { |
799 | /* Synthetic Video Device GUID */ | 807 | /* Synthetic Video Device GUID */ |
800 | {HV_SYNTHVID_GUID}, | 808 | {HV_SYNTHVID_GUID}, |
801 | {} | 809 | {} |
802 | }; | 810 | }; |
803 | 811 | ||
812 | MODULE_DEVICE_TABLE(pci, pci_stub_id_table); | ||
804 | MODULE_DEVICE_TABLE(vmbus, id_table); | 813 | MODULE_DEVICE_TABLE(vmbus, id_table); |
805 | 814 | ||
806 | static struct hv_driver hvfb_drv = { | 815 | static struct hv_driver hvfb_drv = { |
@@ -810,14 +819,43 @@ static struct hv_driver hvfb_drv = { | |||
810 | .remove = hvfb_remove, | 819 | .remove = hvfb_remove, |
811 | }; | 820 | }; |
812 | 821 | ||
822 | static int hvfb_pci_stub_probe(struct pci_dev *pdev, | ||
823 | const struct pci_device_id *ent) | ||
824 | { | ||
825 | return 0; | ||
826 | } | ||
827 | |||
828 | static void hvfb_pci_stub_remove(struct pci_dev *pdev) | ||
829 | { | ||
830 | } | ||
831 | |||
832 | static struct pci_driver hvfb_pci_stub_driver = { | ||
833 | .name = KBUILD_MODNAME, | ||
834 | .id_table = pci_stub_id_table, | ||
835 | .probe = hvfb_pci_stub_probe, | ||
836 | .remove = hvfb_pci_stub_remove, | ||
837 | }; | ||
813 | 838 | ||
814 | static int __init hvfb_drv_init(void) | 839 | static int __init hvfb_drv_init(void) |
815 | { | 840 | { |
816 | return vmbus_driver_register(&hvfb_drv); | 841 | int ret; |
842 | |||
843 | ret = vmbus_driver_register(&hvfb_drv); | ||
844 | if (ret != 0) | ||
845 | return ret; | ||
846 | |||
847 | ret = pci_register_driver(&hvfb_pci_stub_driver); | ||
848 | if (ret != 0) { | ||
849 | vmbus_driver_unregister(&hvfb_drv); | ||
850 | return ret; | ||
851 | } | ||
852 | |||
853 | return 0; | ||
817 | } | 854 | } |
818 | 855 | ||
819 | static void __exit hvfb_drv_exit(void) | 856 | static void __exit hvfb_drv_exit(void) |
820 | { | 857 | { |
858 | pci_unregister_driver(&hvfb_pci_stub_driver); | ||
821 | vmbus_driver_unregister(&hvfb_drv); | 859 | vmbus_driver_unregister(&hvfb_drv); |
822 | } | 860 | } |
823 | 861 | ||