[intel] Quirk away MSI support on 945G/GM.
[platform/upstream/libdrm.git] / linux-core / nouveau_drv.c
1 /*
2  * Copyright 2005 Stephane Marchesin.
3  * All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19  * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22  * OTHER DEALINGS IN THE SOFTWARE.
23  */
24
25 #include "drmP.h"
26 #include "drm.h"
27 #include "nouveau_drv.h"
28
29 #include "drm_pciids.h"
30
31 static struct pci_device_id pciidlist[] = {
32         {
33                 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID),
34                 .class = PCI_BASE_CLASS_DISPLAY << 16,
35                 .class_mask  = 0xff << 16,
36         },
37         {
38                 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA_SGS, PCI_ANY_ID),
39                 .class = PCI_BASE_CLASS_DISPLAY << 16,
40                 .class_mask  = 0xff << 16,
41         }
42 };
43
44 extern struct drm_ioctl_desc nouveau_ioctls[];
45 extern int nouveau_max_ioctl;
46
47 static int probe(struct pci_dev *pdev, const struct pci_device_id *ent);
48 static struct drm_driver driver = {
49         .driver_features =
50                 DRIVER_USE_AGP | DRIVER_PCI_DMA | DRIVER_SG |
51                 DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED,
52         .load = nouveau_load,
53         .firstopen = nouveau_firstopen,
54         .lastclose = nouveau_lastclose,
55         .unload = nouveau_unload,
56         .preclose = nouveau_preclose,
57         .irq_preinstall = nouveau_irq_preinstall,
58         .irq_postinstall = nouveau_irq_postinstall,
59         .irq_uninstall = nouveau_irq_uninstall,
60         .irq_handler = nouveau_irq_handler,
61         .reclaim_buffers = drm_core_reclaim_buffers,
62         .get_map_ofs = drm_core_get_map_ofs,
63         .get_reg_ofs = drm_core_get_reg_ofs,
64         .ioctls = nouveau_ioctls,
65         .fops = {
66                 .owner = THIS_MODULE,
67                 .open = drm_open,
68                 .release = drm_release,
69                 .ioctl = drm_ioctl,
70                 .mmap = drm_mmap,
71                 .poll = drm_poll,
72                 .fasync = drm_fasync,
73 #if defined(CONFIG_COMPAT) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
74                 .compat_ioctl = nouveau_compat_ioctl,
75 #endif
76         },
77         .pci_driver = {
78                 .name = DRIVER_NAME,
79                 .id_table = pciidlist,
80                 .probe = probe,
81                 .remove = __devexit_p(drm_cleanup_pci),
82         },
83
84         .bo_driver = &nouveau_bo_driver,
85         .fence_driver = &nouveau_fence_driver,
86
87         .name = DRIVER_NAME,
88         .desc = DRIVER_DESC,
89 #ifdef GIT_REVISION
90         .date = GIT_REVISION,
91 #else
92         .date = DRIVER_DATE,
93 #endif
94         .major = DRIVER_MAJOR,
95         .minor = DRIVER_MINOR,
96         .patchlevel = DRIVER_PATCHLEVEL,
97 };
98
99 static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
100 {
101         return drm_get_dev(pdev, ent, &driver);
102 }
103
104 static int __init nouveau_init(void)
105 {
106         driver.num_ioctls = nouveau_max_ioctl;
107         return drm_init(&driver, pciidlist);
108 }
109
110 static void __exit nouveau_exit(void)
111 {
112         drm_exit(&driver);
113 }
114
115 module_init(nouveau_init);
116 module_exit(nouveau_exit);
117
118 MODULE_AUTHOR(DRIVER_AUTHOR);
119 MODULE_DESCRIPTION(DRIVER_DESC);
120 MODULE_LICENSE("GPL and additional rights");