From 1835dff04a69509c0ea5fdb94abe0eaa61e7ab5a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 28 Nov 2005 21:15:46 +0000 Subject: Fix AGP support guessing: Implement the same bridge checking in the MGA driver as Linux uses, and actually use the driver's device_is_agp if available (hopefully fixing i915). --- bsd-core/drm_agpsupport.c | 11 +++++++++++ bsd-core/mga_drv.c | 15 ++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) (limited to 'bsd-core') diff --git a/bsd-core/drm_agpsupport.c b/bsd-core/drm_agpsupport.c index 58293566..0a565105 100644 --- a/bsd-core/drm_agpsupport.c +++ b/bsd-core/drm_agpsupport.c @@ -89,6 +89,17 @@ drm_device_find_capability(drm_device_t *dev, int cap) int drm_device_is_agp(drm_device_t *dev) { + if (dev->driver.device_is_agp != NULL) { + int ret; + + /* device_is_agp returns a tristate, 0 = not AGP, 1 = definitely + * AGP, 2 = fall back to PCI capability + */ + ret = (*dev->driver.device_is_agp)(dev); + if (ret != 2) + return ret; + } + return (drm_device_find_capability(dev, PCIY_AGP)); } diff --git a/bsd-core/mga_drv.c b/bsd-core/mga_drv.c index b3c8345b..1dc146f6 100644 --- a/bsd-core/mga_drv.c +++ b/bsd-core/mga_drv.c @@ -61,7 +61,20 @@ static drm_pci_id_list_t mga_pciidlist[] = { */ static int mga_driver_device_is_agp(drm_device_t * dev) { - return 1; + /* 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 (pci_get_device(dev->device) == 0x0525 && + pci_get_vendor(device_get_parent(dev->device)) == 0x3388 && + pci_get_device(device_get_parent(dev->device)) == 0x0021) + return 0; + else + return 2; } static void mga_configure(drm_device_t *dev) -- cgit v1.2.3