[PATCH] ppc64 iSeries: make virtual DVD-RAMs writable again
[linux-2.6] / drivers / char / drm / i915_drv.c
1 /* i915_drv.c -- i830,i845,i855,i865,i915 driver -*- linux-c -*-
2  */
3
4 /**************************************************************************
5  * 
6  * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
7  * All Rights Reserved.
8  * 
9  **************************************************************************/
10
11 #include "drmP.h"
12 #include "drm.h"
13 #include "i915_drm.h"
14 #include "i915_drv.h"
15
16 #include "drm_pciids.h"
17
18 int postinit( struct drm_device *dev, unsigned long flags )
19 {
20         dev->counters += 4;
21         dev->types[6] = _DRM_STAT_IRQ;
22         dev->types[7] = _DRM_STAT_PRIMARY;
23         dev->types[8] = _DRM_STAT_SECONDARY;
24         dev->types[9] = _DRM_STAT_DMA;
25         
26         DRM_INFO( "Initialized %s %d.%d.%d %s on minor %d: %s\n",
27                 DRIVER_NAME,
28                 DRIVER_MAJOR,
29                 DRIVER_MINOR,
30                 DRIVER_PATCHLEVEL,
31                 DRIVER_DATE,
32                 dev->primary.minor,
33                 pci_pretty_name(dev->pdev)
34                 );
35         return 0;
36 }
37
38 static int version( drm_version_t *version )
39 {
40         int len;
41
42         version->version_major = DRIVER_MAJOR;
43         version->version_minor = DRIVER_MINOR;
44         version->version_patchlevel = DRIVER_PATCHLEVEL;
45         DRM_COPY( version->name, DRIVER_NAME );
46         DRM_COPY( version->date, DRIVER_DATE );
47         DRM_COPY( version->desc, DRIVER_DESC );
48         return 0;
49 }
50
51 static struct pci_device_id pciidlist[] = {
52         i915_PCI_IDS
53 };
54
55 extern drm_ioctl_desc_t i915_ioctls[];
56 extern int i915_max_ioctl;
57
58 static struct drm_driver driver = {
59         .driver_features = DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR |
60                                 DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED,
61         .pretakedown = i915_driver_pretakedown,
62         .prerelease = i915_driver_prerelease,
63         .irq_preinstall = i915_driver_irq_preinstall,
64         .irq_postinstall = i915_driver_irq_postinstall,
65         .irq_uninstall = i915_driver_irq_uninstall,
66         .irq_handler = i915_driver_irq_handler,
67         .reclaim_buffers = drm_core_reclaim_buffers,
68         .get_map_ofs = drm_core_get_map_ofs,
69         .get_reg_ofs = drm_core_get_reg_ofs,
70         .postinit = postinit,
71         .version = version,
72         .ioctls = i915_ioctls,
73         .fops = {
74                 .owner = THIS_MODULE,
75                 .open = drm_open,
76                 .release = drm_release,
77                 .ioctl = drm_ioctl,
78                 .mmap = drm_mmap,
79                 .poll = drm_poll,
80                 .fasync = drm_fasync,
81         },
82         .pci_driver = {
83                 .name          = DRIVER_NAME,
84                 .id_table      = pciidlist,
85         }
86 };
87
88 static int __init i915_init(void)
89 {
90         driver.num_ioctls = i915_max_ioctl;
91         return drm_init(&driver);
92 }
93
94 static void __exit i915_exit(void)
95 {
96         drm_exit(&driver);
97 }
98
99 module_init(i915_init);
100 module_exit(i915_exit);
101
102 MODULE_AUTHOR( DRIVER_AUTHOR );
103 MODULE_DESCRIPTION( DRIVER_DESC );
104 MODULE_LICENSE("GPL and additional rights");