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.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/char/drm/mga_drv.c b/drivers/char/drm/mga_drv.c
index 844cca9cb29d..94af13bc66a4 100644
--- a/drivers/char/drm/mga_drv.c
+++ b/drivers/char/drm/mga_drv.c
@@ -38,6 +38,7 @@
38 38
39#include "drm_pciids.h" 39#include "drm_pciids.h"
40 40
41static int mga_driver_device_is_agp(drm_device_t * dev);
41static int postinit( struct drm_device *dev, unsigned long flags ) 42static int postinit( struct drm_device *dev, unsigned long flags )
42{ 43{
43 dev->counters += 3; 44 dev->counters += 3;
@@ -81,6 +82,7 @@ static struct drm_driver driver = {
81 .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 = DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_IRQ_VBL,
82 .pretakedown = mga_driver_pretakedown, 83 .pretakedown = mga_driver_pretakedown,
83 .dma_quiescent = mga_driver_dma_quiescent, 84 .dma_quiescent = mga_driver_dma_quiescent,
85 .device_is_agp = mga_driver_device_is_agp,
84 .vblank_wait = mga_driver_vblank_wait, 86 .vblank_wait = mga_driver_vblank_wait,
85 .irq_preinstall = mga_driver_irq_preinstall, 87 .irq_preinstall = mga_driver_irq_preinstall,
86 .irq_postinstall = mga_driver_irq_postinstall, 88 .irq_postinstall = mga_driver_irq_postinstall,
@@ -128,3 +130,38 @@ module_exit(mga_exit);
128MODULE_AUTHOR( DRIVER_AUTHOR ); 130MODULE_AUTHOR( DRIVER_AUTHOR );
129MODULE_DESCRIPTION( DRIVER_DESC ); 131MODULE_DESCRIPTION( DRIVER_DESC );
130MODULE_LICENSE("GPL and additional rights"); 132MODULE_LICENSE("GPL and additional rights");
133
134/**
135 * Determine if the device really is AGP or not.
136 *
137 * In addition to the usual tests performed by \c drm_device_is_agp, this
138 * function detects PCI G450 cards that appear to the system exactly like
139 * AGP G450 cards.
140 *
141 * \param dev The device to be tested.
142 *
143 * \returns
144 * If the device is a PCI G450, zero is returned. Otherwise 2 is returned.
145 */
146int mga_driver_device_is_agp(drm_device_t * dev)
147{
148 const struct pci_dev * const pdev = dev->pdev;
149
150
151 /* There are PCI versions of the G450. These cards have the
152 * same PCI ID as the AGP G450, but have an additional PCI-to-PCI
153 * bridge chip. We detect these cards, which are not currently
154 * supported by this driver, by looking at the device ID of the
155 * bus the "card" is on. If vendor is 0x3388 (Hint Corp) and the
156 * device is 0x0021 (HB6 Universal PCI-PCI bridge), we reject the
157 * device.
158 */
159
160 if ( (pdev->device == 0x0525)
161 && (pdev->bus->self->vendor == 0x3388)
162 && (pdev->bus->self->device == 0x0021) ) {
163 return 0;
164 }
165
166 return 2;
167}