2 * Copyright 2005 Stephane Marchesin.
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:
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
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.
27 #include "nouveau_drv.h"
29 #include "drm_pciids.h"
31 unsigned int nouveau_modeset = 0; /* kms */
32 module_param_named(modeset, nouveau_modeset, int, 0400);
34 static struct pci_device_id pciidlist[] = {
36 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID),
37 .class = PCI_BASE_CLASS_DISPLAY << 16,
38 .class_mask = 0xff << 16,
41 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA_SGS, PCI_ANY_ID),
42 .class = PCI_BASE_CLASS_DISPLAY << 16,
43 .class_mask = 0xff << 16,
47 extern struct drm_ioctl_desc nouveau_ioctls[];
48 extern int nouveau_max_ioctl;
50 static int probe(struct pci_dev *pdev, const struct pci_device_id *ent);
51 static struct drm_driver driver = {
53 DRIVER_USE_AGP | DRIVER_PCI_DMA | DRIVER_SG |
54 DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED,
56 .firstopen = nouveau_firstopen,
57 .lastclose = nouveau_lastclose,
58 .unload = nouveau_unload,
59 .preclose = nouveau_preclose,
60 .irq_preinstall = nouveau_irq_preinstall,
61 .irq_postinstall = nouveau_irq_postinstall,
62 .irq_uninstall = nouveau_irq_uninstall,
63 .irq_handler = nouveau_irq_handler,
64 .reclaim_buffers = drm_core_reclaim_buffers,
65 .get_map_ofs = drm_core_get_map_ofs,
66 .get_reg_ofs = drm_core_get_reg_ofs,
67 .ioctls = nouveau_ioctls,
71 .release = drm_release,
76 #if defined(CONFIG_COMPAT) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
77 .compat_ioctl = nouveau_compat_ioctl,
82 .id_table = pciidlist,
84 .remove = __devexit_p(drm_cleanup_pci),
87 .bo_driver = &nouveau_bo_driver,
88 .fence_driver = &nouveau_fence_driver,
97 .major = DRIVER_MAJOR,
98 .minor = DRIVER_MINOR,
99 .patchlevel = DRIVER_PATCHLEVEL,
102 static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
104 return drm_get_dev(pdev, ent, &driver);
107 static int __init nouveau_init(void)
109 driver.num_ioctls = nouveau_max_ioctl;
111 if (nouveau_modeset == 1)
112 driver.driver_features |= DRIVER_MODESET;
114 return drm_init(&driver, pciidlist);
117 static void __exit nouveau_exit(void)
122 module_init(nouveau_init);
123 module_exit(nouveau_exit);
125 MODULE_AUTHOR(DRIVER_AUTHOR);
126 MODULE_DESCRIPTION(DRIVER_DESC);
127 MODULE_LICENSE("GPL and additional rights");