diff options
| author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2017-04-04 15:32:25 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-04-12 06:41:20 -0400 |
| commit | 9ec57c921b9d450520cd25dc52a6affb3a91186e (patch) | |
| tree | 377e2cb7b05357df6ab67b3ca7147e6b5ebb368e /drivers/gpu | |
| parent | ae3a3e209ef1e2fa7efac9bb54c6fe934755bff6 (diff) | |
drm/mga: remove device_is_agp callback
[ Upstream commit 858b2c1bf820ebfba89c5e2867ab882bdb5b2f5a ]
It's only for a device quirk, and we might as well do that in the load
callback.
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170125062657.19270-10-daniel.vetter@ffwll.ch
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/gpu')
| -rw-r--r-- | drivers/gpu/drm/mga/mga_dma.c | 20 | ||||
| -rw-r--r-- | drivers/gpu/drm/mga/mga_drv.c | 37 |
2 files changed, 19 insertions, 38 deletions
diff --git a/drivers/gpu/drm/mga/mga_dma.c b/drivers/gpu/drm/mga/mga_dma.c index 1f2f9ca25901..4556e2b13ac5 100644 --- a/drivers/gpu/drm/mga/mga_dma.c +++ b/drivers/gpu/drm/mga/mga_dma.c | |||
| @@ -392,6 +392,24 @@ int mga_driver_load(struct drm_device *dev, unsigned long flags) | |||
| 392 | drm_mga_private_t *dev_priv; | 392 | drm_mga_private_t *dev_priv; |
| 393 | int ret; | 393 | int ret; |
| 394 | 394 | ||
| 395 | /* There are PCI versions of the G450. These cards have the | ||
| 396 | * same PCI ID as the AGP G450, but have an additional PCI-to-PCI | ||
| 397 | * bridge chip. We detect these cards, which are not currently | ||
| 398 | * supported by this driver, by looking at the device ID of the | ||
| 399 | * bus the "card" is on. If vendor is 0x3388 (Hint Corp) and the | ||
| 400 | * device is 0x0021 (HB6 Universal PCI-PCI bridge), we reject the | ||
| 401 | * device. | ||
| 402 | */ | ||
| 403 | if ((dev->pdev->device == 0x0525) && dev->pdev->bus->self | ||
| 404 | && (dev->pdev->bus->self->vendor == 0x3388) | ||
| 405 | && (dev->pdev->bus->self->device == 0x0021) | ||
| 406 | && dev->agp) { | ||
| 407 | /* FIXME: This should be quirked in the pci core, but oh well | ||
| 408 | * the hw probably stopped existing. */ | ||
| 409 | arch_phys_wc_del(dev->agp->agp_mtrr); | ||
| 410 | kfree(dev->agp); | ||
| 411 | dev->agp = NULL; | ||
| 412 | } | ||
| 395 | dev_priv = kzalloc(sizeof(drm_mga_private_t), GFP_KERNEL); | 413 | dev_priv = kzalloc(sizeof(drm_mga_private_t), GFP_KERNEL); |
| 396 | if (!dev_priv) | 414 | if (!dev_priv) |
| 397 | return -ENOMEM; | 415 | return -ENOMEM; |
| @@ -698,7 +716,7 @@ static int mga_do_pci_dma_bootstrap(struct drm_device *dev, | |||
| 698 | static int mga_do_dma_bootstrap(struct drm_device *dev, | 716 | static int mga_do_dma_bootstrap(struct drm_device *dev, |
| 699 | drm_mga_dma_bootstrap_t *dma_bs) | 717 | drm_mga_dma_bootstrap_t *dma_bs) |
| 700 | { | 718 | { |
| 701 | const int is_agp = (dma_bs->agp_mode != 0) && drm_pci_device_is_agp(dev); | 719 | const int is_agp = (dma_bs->agp_mode != 0) && dev->agp; |
| 702 | int err; | 720 | int err; |
| 703 | drm_mga_private_t *const dev_priv = | 721 | drm_mga_private_t *const dev_priv = |
| 704 | (drm_mga_private_t *) dev->dev_private; | 722 | (drm_mga_private_t *) dev->dev_private; |
diff --git a/drivers/gpu/drm/mga/mga_drv.c b/drivers/gpu/drm/mga/mga_drv.c index 25b2a1a424e6..63ba0699d107 100644 --- a/drivers/gpu/drm/mga/mga_drv.c +++ b/drivers/gpu/drm/mga/mga_drv.c | |||
| @@ -37,8 +37,6 @@ | |||
| 37 | 37 | ||
| 38 | #include <drm/drm_pciids.h> | 38 | #include <drm/drm_pciids.h> |
| 39 | 39 | ||
| 40 | static int mga_driver_device_is_agp(struct drm_device *dev); | ||
| 41 | |||
| 42 | static struct pci_device_id pciidlist[] = { | 40 | static struct pci_device_id pciidlist[] = { |
| 43 | mga_PCI_IDS | 41 | mga_PCI_IDS |
| 44 | }; | 42 | }; |
| @@ -66,7 +64,6 @@ static struct drm_driver driver = { | |||
| 66 | .lastclose = mga_driver_lastclose, | 64 | .lastclose = mga_driver_lastclose, |
| 67 | .set_busid = drm_pci_set_busid, | 65 | .set_busid = drm_pci_set_busid, |
| 68 | .dma_quiescent = mga_driver_dma_quiescent, | 66 | .dma_quiescent = mga_driver_dma_quiescent, |
| 69 | .device_is_agp = mga_driver_device_is_agp, | ||
| 70 | .get_vblank_counter = mga_get_vblank_counter, | 67 | .get_vblank_counter = mga_get_vblank_counter, |
| 71 | .enable_vblank = mga_enable_vblank, | 68 | .enable_vblank = mga_enable_vblank, |
| 72 | .disable_vblank = mga_disable_vblank, | 69 | .disable_vblank = mga_disable_vblank, |
| @@ -107,37 +104,3 @@ module_exit(mga_exit); | |||
| 107 | MODULE_AUTHOR(DRIVER_AUTHOR); | 104 | MODULE_AUTHOR(DRIVER_AUTHOR); |
| 108 | MODULE_DESCRIPTION(DRIVER_DESC); | 105 | MODULE_DESCRIPTION(DRIVER_DESC); |
| 109 | MODULE_LICENSE("GPL and additional rights"); | 106 | MODULE_LICENSE("GPL and additional rights"); |
| 110 | |||
| 111 | /** | ||
| 112 | * Determine if the device really is AGP or not. | ||
| 113 | * | ||
| 114 | * In addition to the usual tests performed by \c drm_device_is_agp, this | ||
| 115 | * function detects PCI G450 cards that appear to the system exactly like | ||
| 116 | * AGP G450 cards. | ||
| 117 | * | ||
| 118 | * \param dev The device to be tested. | ||
| 119 | * | ||
| 120 | * \returns | ||
| 121 | * If the device is a PCI G450, zero is returned. Otherwise 2 is returned. | ||
| 122 | */ | ||
| 123 | static int mga_driver_device_is_agp(struct drm_device *dev) | ||
| 124 | { | ||
| 125 | const struct pci_dev *const pdev = dev->pdev; | ||
| 126 | |||
| 127 | /* There are PCI versions of the G450. These cards have the | ||
| 128 | * same PCI ID as the AGP G450, but have an additional PCI-to-PCI | ||
| 129 | * bridge chip. We detect these cards, which are not currently | ||
| 130 | * supported by this driver, by looking at the device ID of the | ||
| 131 | * bus the "card" is on. If vendor is 0x3388 (Hint Corp) and the | ||
| 132 | * device is 0x0021 (HB6 Universal PCI-PCI bridge), we reject the | ||
| 133 | * device. | ||
| 134 | */ | ||
| 135 | |||
| 136 | if ((pdev->device == 0x0525) && pdev->bus->self | ||
| 137 | && (pdev->bus->self->vendor == 0x3388) | ||
| 138 | && (pdev->bus->self->device == 0x0021)) { | ||
| 139 | return 0; | ||
| 140 | } | ||
| 141 | |||
| 142 | return 2; | ||
| 143 | } | ||
