aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/mga_drv.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/drm/mga_drv.c')
-rw-r--r--drivers/char/drm/mga_drv.c80
1 files changed, 38 insertions, 42 deletions
diff --git a/drivers/char/drm/mga_drv.c b/drivers/char/drm/mga_drv.c
index daabbba3b297..0cc7c305a7f6 100644
--- a/drivers/char/drm/mga_drv.c
+++ b/drivers/char/drm/mga_drv.c
@@ -35,14 +35,13 @@
35#include "mga_drm.h" 35#include "mga_drm.h"
36#include "mga_drv.h" 36#include "mga_drv.h"
37 37
38
39#include "drm_pciids.h" 38#include "drm_pciids.h"
40 39
41static int mga_driver_device_is_agp(drm_device_t * dev); 40static int mga_driver_device_is_agp(drm_device_t * dev);
42static int postinit( struct drm_device *dev, unsigned long flags ) 41static int postinit(struct drm_device *dev, unsigned long flags)
43{ 42{
44 drm_mga_private_t * const dev_priv = 43 drm_mga_private_t *const dev_priv =
45 (drm_mga_private_t *) dev->dev_private; 44 (drm_mga_private_t *) dev->dev_private;
46 45
47 dev_priv->mmio_base = pci_resource_start(dev->pdev, 1); 46 dev_priv->mmio_base = pci_resource_start(dev->pdev, 1);
48 dev_priv->mmio_size = pci_resource_len(dev->pdev, 1); 47 dev_priv->mmio_size = pci_resource_len(dev->pdev, 1);
@@ -52,28 +51,26 @@ static int postinit( struct drm_device *dev, unsigned long flags )
52 dev->types[7] = _DRM_STAT_PRIMARY; 51 dev->types[7] = _DRM_STAT_PRIMARY;
53 dev->types[8] = _DRM_STAT_SECONDARY; 52 dev->types[8] = _DRM_STAT_SECONDARY;
54 53
55 DRM_INFO( "Initialized %s %d.%d.%d %s on minor %d: %s\n", 54 DRM_INFO("Initialized %s %d.%d.%d %s on minor %d: %s\n",
56 DRIVER_NAME, 55 DRIVER_NAME,
57 DRIVER_MAJOR, 56 DRIVER_MAJOR,
58 DRIVER_MINOR, 57 DRIVER_MINOR,
59 DRIVER_PATCHLEVEL, 58 DRIVER_PATCHLEVEL,
60 DRIVER_DATE, 59 DRIVER_DATE, dev->primary.minor, pci_pretty_name(dev->pdev)
61 dev->primary.minor, 60 );
62 pci_pretty_name(dev->pdev)
63 );
64 return 0; 61 return 0;
65} 62}
66 63
67static int version( drm_version_t *version ) 64static int version(drm_version_t * version)
68{ 65{
69 int len; 66 int len;
70 67
71 version->version_major = DRIVER_MAJOR; 68 version->version_major = DRIVER_MAJOR;
72 version->version_minor = DRIVER_MINOR; 69 version->version_minor = DRIVER_MINOR;
73 version->version_patchlevel = DRIVER_PATCHLEVEL; 70 version->version_patchlevel = DRIVER_PATCHLEVEL;
74 DRM_COPY( version->name, DRIVER_NAME ); 71 DRM_COPY(version->name, DRIVER_NAME);
75 DRM_COPY( version->date, DRIVER_DATE ); 72 DRM_COPY(version->date, DRIVER_DATE);
76 DRM_COPY( version->desc, DRIVER_DESC ); 73 DRM_COPY(version->desc, DRIVER_DESC);
77 return 0; 74 return 0;
78} 75}
79 76
@@ -81,11 +78,11 @@ static struct pci_device_id pciidlist[] = {
81 mga_PCI_IDS 78 mga_PCI_IDS
82}; 79};
83 80
84extern drm_ioctl_desc_t mga_ioctls[];
85extern int mga_max_ioctl;
86
87static struct drm_driver driver = { 81static struct drm_driver driver = {
88 .driver_features = DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_IRQ_VBL, 82 .driver_features =
83 DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR |
84 DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED |
85 DRIVER_IRQ_VBL,
89 .preinit = mga_driver_preinit, 86 .preinit = mga_driver_preinit,
90 .postcleanup = mga_driver_postcleanup, 87 .postcleanup = mga_driver_postcleanup,
91 .pretakedown = mga_driver_pretakedown, 88 .pretakedown = mga_driver_pretakedown,
@@ -104,21 +101,21 @@ static struct drm_driver driver = {
104 .ioctls = mga_ioctls, 101 .ioctls = mga_ioctls,
105 .dma_ioctl = mga_dma_buffers, 102 .dma_ioctl = mga_dma_buffers,
106 .fops = { 103 .fops = {
107 .owner = THIS_MODULE, 104 .owner = THIS_MODULE,
108 .open = drm_open, 105 .open = drm_open,
109 .release = drm_release, 106 .release = drm_release,
110 .ioctl = drm_ioctl, 107 .ioctl = drm_ioctl,
111 .mmap = drm_mmap, 108 .mmap = drm_mmap,
112 .poll = drm_poll, 109 .poll = drm_poll,
113 .fasync = drm_fasync, 110 .fasync = drm_fasync,
114#ifdef CONFIG_COMPAT 111#ifdef CONFIG_COMPAT
115 .compat_ioctl = mga_compat_ioctl, 112 .compat_ioctl = mga_compat_ioctl,
116#endif 113#endif
117 }, 114 },
118 .pci_driver = { 115 .pci_driver = {
119 .name = DRIVER_NAME, 116 .name = DRIVER_NAME,
120 .id_table = pciidlist, 117 .id_table = pciidlist,
121 } 118 }
122}; 119};
123 120
124static int __init mga_init(void) 121static int __init mga_init(void)
@@ -135,8 +132,8 @@ static void __exit mga_exit(void)
135module_init(mga_init); 132module_init(mga_init);
136module_exit(mga_exit); 133module_exit(mga_exit);
137 134
138MODULE_AUTHOR( DRIVER_AUTHOR ); 135MODULE_AUTHOR(DRIVER_AUTHOR);
139MODULE_DESCRIPTION( DRIVER_DESC ); 136MODULE_DESCRIPTION(DRIVER_DESC);
140MODULE_LICENSE("GPL and additional rights"); 137MODULE_LICENSE("GPL and additional rights");
141 138
142/** 139/**
@@ -151,10 +148,9 @@ MODULE_LICENSE("GPL and additional rights");
151 * \returns 148 * \returns
152 * If the device is a PCI G450, zero is returned. Otherwise 2 is returned. 149 * If the device is a PCI G450, zero is returned. Otherwise 2 is returned.
153 */ 150 */
154int mga_driver_device_is_agp(drm_device_t * dev) 151static int mga_driver_device_is_agp(drm_device_t * dev)
155{ 152{
156 const struct pci_dev * const pdev = dev->pdev; 153 const struct pci_dev *const pdev = dev->pdev;
157
158 154
159 /* There are PCI versions of the G450. These cards have the 155 /* There are PCI versions of the G450. These cards have the
160 * same PCI ID as the AGP G450, but have an additional PCI-to-PCI 156 * same PCI ID as the AGP G450, but have an additional PCI-to-PCI
@@ -164,10 +160,10 @@ int mga_driver_device_is_agp(drm_device_t * dev)
164 * device is 0x0021 (HB6 Universal PCI-PCI bridge), we reject the 160 * device is 0x0021 (HB6 Universal PCI-PCI bridge), we reject the
165 * device. 161 * device.
166 */ 162 */
167 163
168 if ( (pdev->device == 0x0525) 164 if ((pdev->device == 0x0525)
169 && (pdev->bus->self->vendor == 0x3388) 165 && (pdev->bus->self->vendor == 0x3388)
170 && (pdev->bus->self->device == 0x0021) ) { 166 && (pdev->bus->self->device == 0x0021)) {
171 return 0; 167 return 0;
172 } 168 }
173 169