summaryrefslogtreecommitdiff
path: root/bsd-core
diff options
context:
space:
mode:
Diffstat (limited to 'bsd-core')
-rw-r--r--bsd-core/drmP.h12
-rw-r--r--bsd-core/drm_agpsupport.c11
-rw-r--r--bsd-core/mga_drv.c27
3 files changed, 50 insertions, 0 deletions
diff --git a/bsd-core/drmP.h b/bsd-core/drmP.h
index 6af29718..9943a4f6 100644
--- a/bsd-core/drmP.h
+++ b/bsd-core/drmP.h
@@ -638,6 +638,18 @@ struct drm_device {
void (*irq_handler)(DRM_IRQ_ARGS);
int (*vblank_wait)(drm_device_t *dev, unsigned int *sequence);
+ /**
+ * Called by \c drm_device_is_agp. Typically used to determine if a
+ * card is really attached to AGP or not.
+ *
+ * \param dev DRM device handle
+ *
+ * \returns true if the card really is attached to AGP, false
+ * otherwise.
+ */
+ int (*device_is_agp) (struct drm_device * dev);
+
+
drm_ioctl_desc_t *driver_ioctls;
int max_driver_ioctl;
diff --git a/bsd-core/drm_agpsupport.c b/bsd-core/drm_agpsupport.c
index 6d58134a..33fb3f0c 100644
--- a/bsd-core/drm_agpsupport.c
+++ b/bsd-core/drm_agpsupport.c
@@ -46,6 +46,12 @@ drm_device_is_agp(drm_device_t *dev)
u_int32_t status;
u_int8_t ptr, next;
+
+ if ( (dev->driver->device_is_agp != NULL)
+ && ! (*dev->driver->device_is_agp)( dev ) ) {
+ return 0;
+ }
+
/*
* Check the CAP_LIST bit of the PCI status register first.
*/
@@ -71,6 +77,11 @@ drm_device_is_agp(drm_device_t *dev)
return 0;
#else
+ if ( (dev->driver->device_is_agp != NULL)
+ && ! (*dev->driver->device_is_agp)( dev ) ) {
+ return 0;
+ }
+
/* XXX: fill me in for non-FreeBSD */
return 1;
#endif
diff --git a/bsd-core/mga_drv.c b/bsd-core/mga_drv.c
index bff8c42f..1dd4c81b 100644
--- a/bsd-core/mga_drv.c
+++ b/bsd-core/mga_drv.c
@@ -37,11 +37,14 @@
#include "mga_drv.h"
#include "drm_pciids.h"
+int mga_driver_device_is_agp(drm_device_t * dev)
/* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */
static drm_pci_id_list_t mga_pciidlist[] = {
mga_PCI_IDS
};
+static int mga_driver_device_is_agp(drm_device_t * dev);
+
extern drm_ioctl_desc_t mga_ioctls[];
extern int mga_max_ioctl;
@@ -58,6 +61,8 @@ static void mga_configure(drm_device_t *dev)
dev->dma_ioctl = mga_dma_buffers;
dev->dma_quiescent = mga_driver_dma_quiescent;
+ dev->device_is_agp = mga_driver_device_is_agp;
+
dev->driver_ioctls = mga_ioctls;
dev->max_driver_ioctl = mga_max_ioctl;
@@ -76,6 +81,28 @@ static void mga_configure(drm_device_t *dev)
dev->use_vbl_irq = 1;
}
+/**
+ * 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 non-zero is
+ * returned.
+ *
+ * \bug
+ * This function needs to be filled in! The implementation in
+ * linux-core/mga_drv.c shows what needs to be done.
+ */
+int mga_driver_device_is_agp(drm_device_t * dev)
+{
+ return 1;
+}
+
#ifdef __FreeBSD__
static int
mga_probe(device_t dev)