blob: ac030d89883c76d24c41320cf3e19514b9806285 [file] [log] [blame]
Dave Airliefef9b302006-08-27 08:55:02 +10001/*
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
Dave Airliefef9b302006-08-27 08:55:02 +100025#include "drmP.h"
26#include "drm.h"
27#include "nouveau_drv.h"
28
29#include "drm_pciids.h"
30
31static struct pci_device_id pciidlist[] = {
32 nouveau_PCI_IDS
33};
34
35extern drm_ioctl_desc_t nouveau_ioctls[];
36extern int nouveau_max_ioctl;
37
38static int probe(struct pci_dev *pdev, const struct pci_device_id *ent);
39static struct drm_driver driver = {
40 .driver_features =
Stephane Marchesinec122092007-01-10 04:42:09 +010041 DRIVER_USE_AGP | DRIVER_PCI_DMA | DRIVER_SG |
Dave Airliefef9b302006-08-27 08:55:02 +100042 DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED,
43 .load = nouveau_load,
44 .firstopen = nouveau_firstopen,
Stephane Marchesin025f2812007-01-05 20:49:34 +010045 .lastclose = nouveau_lastclose,
Dave Airliefef9b302006-08-27 08:55:02 +100046 .unload = nouveau_unload,
47 .preclose = nouveau_preclose,
48 .irq_preinstall = nouveau_irq_preinstall,
49 .irq_postinstall = nouveau_irq_postinstall,
50 .irq_uninstall = nouveau_irq_uninstall,
51 .irq_handler = nouveau_irq_handler,
52 .reclaim_buffers = drm_core_reclaim_buffers,
53 .get_map_ofs = drm_core_get_map_ofs,
54 .get_reg_ofs = drm_core_get_reg_ofs,
55 .ioctls = nouveau_ioctls,
56 .fops = {
57 .owner = THIS_MODULE,
58 .open = drm_open,
59 .release = drm_release,
60 .ioctl = drm_ioctl,
61 .mmap = drm_mmap,
62 .poll = drm_poll,
63 .fasync = drm_fasync,
Dave Airlie94ab96c2006-11-05 20:38:44 +110064#if defined(CONFIG_COMPAT) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
65 .compat_ioctl = nouveau_compat_ioctl,
66#endif
Dave Airliefef9b302006-08-27 08:55:02 +100067 },
68 .pci_driver = {
69 .name = DRIVER_NAME,
70 .id_table = pciidlist,
71 .probe = probe,
72 .remove = __devexit_p(drm_cleanup_pci),
73 },
74
75 .name = DRIVER_NAME,
76 .desc = DRIVER_DESC,
77 .date = DRIVER_DATE,
78 .major = DRIVER_MAJOR,
79 .minor = DRIVER_MINOR,
80 .patchlevel = DRIVER_PATCHLEVEL,
81};
82
83static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
84{
85 return drm_get_dev(pdev, ent, &driver);
86}
87
88static int __init nouveau_init(void)
89{
90 driver.num_ioctls = nouveau_max_ioctl;
91 return drm_init(&driver, pciidlist);
92}
93
94static void __exit nouveau_exit(void)
95{
96 drm_exit(&driver);
97}
98
99module_init(nouveau_init);
100module_exit(nouveau_exit);
101
102MODULE_AUTHOR(DRIVER_AUTHOR);
103MODULE_DESCRIPTION(DRIVER_DESC);
104MODULE_LICENSE("GPL and additional rights");