Lukas Hejtmanek wrote:
drm_stub.c version 1.52 contains check whether device is AGP. I have i915 card that is PCIE and it fails to initialize i915 module. If I comment out check for AGP then everything is OK.
Please try the attached patch. Since I don't have any i9X5 hardware, I haven't run-tested it, but it does compile. This implements a fix similar to the one described by Alan in one of his posts. Note that the i810 and i830 drivers do *not* need to be modified because those devices always show up with the AGP capability correctly set.
Index: bsd-core/drmP.h =================================================================== RCS file: /cvs/dri/drm/bsd-core/drmP.h,v retrieving revision 1.57 diff -u -d -r1.57 drmP.h --- bsd-core/drmP.h 16 May 2005 17:37:10 -0000 1.57 +++ bsd-core/drmP.h 27 May 2005 20:57:05 -0000 @@ -644,8 +644,10 @@ * * \param dev DRM device handle * - * \returns true if the card really is attached to AGP, false - * otherwise. + * \returns + * One of three values is returned depending on whether or not the + * card is absolutely \b not AGP (return of 0), absolutely \b is AGP + * (return of 1), or may or may not be AGP (return of 2). */ int (*device_is_agp) (struct drm_device * dev); Index: bsd-core/drm_agpsupport.c =================================================================== RCS file: /cvs/dri/drm/bsd-core/drm_agpsupport.c,v retrieving revision 1.14 diff -u -d -r1.14 drm_agpsupport.c --- bsd-core/drm_agpsupport.c 16 May 2005 17:37:10 -0000 1.14 +++ bsd-core/drm_agpsupport.c 27 May 2005 20:57:06 -0000 @@ -47,9 +47,12 @@ u_int8_t ptr, next; - if ( (dev->driver->device_is_agp != NULL) - && ! (*dev->driver->device_is_agp)( dev ) ) { - return 0; + if ( dev->driver->device_is_agp != NULL ) { + int err = (*dev->driver->device_is_agp)( dev ); + + if (err != 2) { + return err; + } } /* Index: linux-core/drmP.h =================================================================== RCS file: /cvs/dri/drm/linux-core/drmP.h,v retrieving revision 1.143 diff -u -d -r1.143 drmP.h --- linux-core/drmP.h 16 May 2005 17:37:09 -0000 1.143 +++ linux-core/drmP.h 27 May 2005 20:57:06 -0000 @@ -548,8 +548,10 @@ * * \param dev DRM device handle * - * \returns true if the card really is attached to AGP, false - * otherwise. + * \returns + * One of three values is returned depending on whether or not the + * card is absolutely \b not AGP (return of 0), absolutely \b is AGP + * (return of 1), or may or may not be AGP (return of 2). */ int (*device_is_agp) (struct drm_device * dev); @@ -1028,9 +1030,12 @@ static __inline__ int drm_device_is_agp(drm_device_t *dev) { - if ( (dev->driver->device_is_agp != NULL) - && ! (*dev->driver->device_is_agp)( dev ) ) { - return 0; + if ( dev->driver->device_is_agp != NULL ) { + int err = (*dev->driver->device_is_agp)( dev ); + + if (err != 2) { + return err; + } } return pci_find_capability(dev->pdev, PCI_CAP_ID_AGP); Index: linux-core/i915_drv.c =================================================================== RCS file: /cvs/dri/drm/linux-core/i915_drv.c,v retrieving revision 1.13 diff -u -d -r1.13 i915_drv.c --- linux-core/i915_drv.c 1 Feb 2005 10:43:42 -0000 1.13 +++ linux-core/i915_drv.c 27 May 2005 20:57:06 -0000 @@ -15,6 +15,8 @@ #include "drm_pciids.h" +static int i915_driver_device_is_agp(drm_device_t * dev); + static int postinit(struct drm_device *dev, unsigned long flags) { dev->counters += 4; @@ -60,6 +62,7 @@ DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED, .pretakedown = i915_driver_pretakedown, .prerelease = i915_driver_prerelease, + .device_is_agp = i915_driver_device_is_agp, .irq_preinstall = i915_driver_irq_preinstall, .irq_postinstall = i915_driver_irq_postinstall, .irq_uninstall = i915_driver_irq_uninstall, @@ -109,3 +112,19 @@ MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL and additional rights"); + +/** + * Determine if the device really is AGP or not. + * + * All Intel graphics chipsets are treated as AGP, even if they are really + * PCI-e. + * + * \param dev The device to be tested. + * + * \returns + * A value of 1 is always returned to indicate every i9X5 is AGP. + */ +int i915_driver_device_is_agp(drm_device_t * dev) +{ + return 1; +} Index: linux-core/mga_drv.c =================================================================== RCS file: /cvs/dri/drm/linux-core/mga_drv.c,v retrieving revision 1.51 diff -u -d -r1.51 mga_drv.c --- linux-core/mga_drv.c 21 May 2005 02:27:51 -0000 1.51 +++ linux-core/mga_drv.c 27 May 2005 20:57:06 -0000 @@ -148,8 +148,7 @@ * \param dev The device to be tested. * * \returns - * If the device is a PCI G450, zero is returned. Otherwise non-zero is - * returned. + * If the device is a PCI G450, zero is returned. Otherwise 2 is returned. */ int mga_driver_device_is_agp(drm_device_t * dev) { @@ -176,5 +175,5 @@ return 0; } - return 1; + return 2; }