All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: DRI Development <dri-devel@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	Daniel Vetter <daniel.vetter@intel.com>
Subject: [PATCH 09/15] drm/mga: remove device_is_agp callback
Date: Wed, 25 Jan 2017 07:26:51 +0100	[thread overview]
Message-ID: <20170125062657.19270-10-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <20170125062657.19270-1-daniel.vetter@ffwll.ch>

It's only for a device quirk, and we might as well do that in the load
callback.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 drivers/gpu/drm/mga/mga_dma.c | 20 +++++++++++++++++++-
 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 a1d8dd15b131..1ffdafea27e4 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)
 	drm_mga_private_t *dev_priv;
 	int ret;
 
+	/* There are PCI versions of the G450.  These cards have the
+	 * same PCI ID as the AGP G450, but have an additional PCI-to-PCI
+	 * bridge chip.  We detect these cards, which are not currently
+	 * supported by this driver, by looking at the device ID of the
+	 * bus the "card" is on.  If vendor is 0x3388 (Hint Corp) and the
+	 * device is 0x0021 (HB6 Universal PCI-PCI bridge), we reject the
+	 * device.
+	 */
+	if ((dev->pdev->device == 0x0525) && dev->pdev->bus->self
+	    && (dev->pdev->bus->self->vendor == 0x3388)
+	    && (dev->pdev->bus->self->device == 0x0021)
+	    && dev->agp) {
+		/* FIXME: This should be quirked in the pci core, but oh well
+		 * the hw probably stopped existing. */
+		arch_phys_wc_del(dev->agp->agp_mtrr);
+		kfree(dev->agp);
+		dev->agp = NULL;
+	}
 	dev_priv = kzalloc(sizeof(drm_mga_private_t), GFP_KERNEL);
 	if (!dev_priv)
 		return -ENOMEM;
@@ -698,7 +716,7 @@ static int mga_do_pci_dma_bootstrap(struct drm_device *dev,
 static int mga_do_dma_bootstrap(struct drm_device *dev,
 				drm_mga_dma_bootstrap_t *dma_bs)
 {
-	const int is_agp = (dma_bs->agp_mode != 0) && drm_pci_device_is_agp(dev);
+	const int is_agp = (dma_bs->agp_mode != 0) && dev->agp;
 	int err;
 	drm_mga_private_t *const dev_priv =
 	    (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 @@
 
 #include <drm/drm_pciids.h>
 
-static int mga_driver_device_is_agp(struct drm_device *dev);
-
 static struct pci_device_id pciidlist[] = {
 	mga_PCI_IDS
 };
@@ -66,7 +64,6 @@ static struct drm_driver driver = {
 	.lastclose = mga_driver_lastclose,
 	.set_busid = drm_pci_set_busid,
 	.dma_quiescent = mga_driver_dma_quiescent,
-	.device_is_agp = mga_driver_device_is_agp,
 	.get_vblank_counter = mga_get_vblank_counter,
 	.enable_vblank = mga_enable_vblank,
 	.disable_vblank = mga_disable_vblank,
@@ -107,37 +104,3 @@ module_exit(mga_exit);
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE("GPL and additional rights");
-
-/**
- * Determine if the device really is AGP or not.
- *
- * In addition to the usual tests performed by \c drm_device_is_agp, this
- * function detects PCI G450 cards that appear to the system exactly like
- * AGP G450 cards.
- *
- * \param dev   The device to be tested.
- *
- * \returns
- * If the device is a PCI G450, zero is returned.  Otherwise 2 is returned.
- */
-static int mga_driver_device_is_agp(struct drm_device *dev)
-{
-	const struct pci_dev *const pdev = dev->pdev;
-
-	/* There are PCI versions of the G450.  These cards have the
-	 * same PCI ID as the AGP G450, but have an additional PCI-to-PCI
-	 * bridge chip.  We detect these cards, which are not currently
-	 * supported by this driver, by looking at the device ID of the
-	 * bus the "card" is on.  If vendor is 0x3388 (Hint Corp) and the
-	 * device is 0x0021 (HB6 Universal PCI-PCI bridge), we reject the
-	 * device.
-	 */
-
-	if ((pdev->device == 0x0525) && pdev->bus->self
-	    && (pdev->bus->self->vendor == 0x3388)
-	    && (pdev->bus->self->device == 0x0021)) {
-		return 0;
-	}
-
-	return 2;
-}
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2017-01-25  6:26 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-25  6:26 [PATCH 00/15] More kerneldoc cleanup Daniel Vetter
2017-01-25  6:26 ` [PATCH 01/15] drm/kms-helpers: Use recommened kerneldoc for struct member refs Daniel Vetter
2017-01-25 12:48   ` [Intel-gfx] " Gustavo Padovan
2017-01-25 15:19     ` Daniel Vetter
2017-01-25  6:26 ` [PATCH 02/15] drm/bridge: " Daniel Vetter
2017-01-25  9:33   ` Archit Taneja
2017-01-25 12:40     ` Daniel Vetter
2017-01-25  6:26 ` [PATCH 03/15] drm/kms-core: " Daniel Vetter
2017-01-25 13:52   ` Eric Engestrom
2017-01-25  6:26 ` [PATCH 04/15] drm/gem|prime|mm: " Daniel Vetter
2017-01-25 12:51   ` Gustavo Padovan
2017-01-25  6:26 ` [PATCH 05/15] drm/core: " Daniel Vetter
2017-01-25 12:55   ` Gustavo Padovan
2017-01-25 15:23     ` Daniel Vetter
2017-01-25  6:26 ` [PATCH 06/15] drm/doc: Clarify connector overview Daniel Vetter
2017-01-25 12:57   ` [Intel-gfx] " Gustavo Padovan
2017-01-25 15:33     ` Daniel Vetter
2017-01-25 18:08       ` Gustavo Padovan
2017-01-25  6:26 ` [PATCH 07/15] drm/gma500: Nuke device_is_agp callback Daniel Vetter
2017-01-25 12:58   ` Gustavo Padovan
2017-01-26  0:11   ` Patrik Jakobsson
2017-01-25  6:26 ` [PATCH 08/15] drm/i810: drop " Daniel Vetter
2017-01-25 17:36   ` Alex Deucher
2017-01-25  6:26 ` Daniel Vetter [this message]
2017-01-25 17:33   ` [PATCH 09/15] drm/mga: remove " Alex Deucher
2017-01-25  6:26 ` [PATCH 10/15] drm: " Daniel Vetter
2017-01-25 17:34   ` Alex Deucher
2017-01-25  6:26 ` [PATCH 11/15] drm: Nuke ums vgaarb support Daniel Vetter
2017-01-25 17:40   ` Alex Deucher
2017-01-25  6:26 ` [PATCH 12/15] drm/moc: Mark legacy fields in drm_driver as such Daniel Vetter
2017-01-25 17:43   ` Alex Deucher
2017-01-25  6:26 ` [PATCH 13/15] drm/doc: Fix typos for early_unregister doc Daniel Vetter
2017-01-26  9:49   ` Daniel Vetter
2017-01-25  6:26 ` [PATCH 14/15] drm: s/drm_crtc_get_hv_timings/drm_mode_get_hv_timings/ Daniel Vetter
2017-01-25 17:31   ` Alex Deucher
2017-01-26  9:48     ` Daniel Vetter
2017-01-25  6:26 ` [PATCH 15/15] drm: Update kerneldoc for drm_crtc.[hc] Daniel Vetter
2017-01-25 14:26   ` Eric Engestrom
2017-01-25 15:36     ` Daniel Vetter
2017-01-25  7:54 ` ✗ Fi.CI.BAT: warning for More kerneldoc cleanup Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170125062657.19270-10-daniel.vetter@ffwll.ch \
    --to=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.