summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2008-11-24 03:49:20 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2008-11-24 03:49:20 +0000
commita43cdb6fcb92bf96c215850a16e23b90fc13b585 (patch)
treec31b98c028d1caa268eca55ff9307ed0c2c5ebc5
parent960491229bf3a7472733aa63728e937ffb4f73a7 (diff)
make device works out if it's agp and tells the drm driver, not the
other way round. More dev->pa reduction
-rw-r--r--sys/dev/pci/drm/drmP.h17
-rw-r--r--sys/dev/pci/drm/drm_agpsupport.c18
-rw-r--r--sys/dev/pci/drm/drm_drv.c5
-rw-r--r--sys/dev/pci/drm/i915_dma.c17
-rw-r--r--sys/dev/pci/drm/i915_drv.c5
-rw-r--r--sys/dev/pci/drm/mach64_drv.c7
-rw-r--r--sys/dev/pci/drm/mga_dma.c2
-rw-r--r--sys/dev/pci/drm/mga_drv.c5
-rw-r--r--sys/dev/pci/drm/r128_drv.c7
-rw-r--r--sys/dev/pci/drm/radeon_drv.c7
-rw-r--r--sys/dev/pci/drm/savage_drv.c7
-rw-r--r--sys/dev/pci/drm/sis_drv.c7
-rw-r--r--sys/dev/pci/drm/tdfx_drv.c3
13 files changed, 44 insertions, 63 deletions
diff --git a/sys/dev/pci/drm/drmP.h b/sys/dev/pci/drm/drmP.h
index a3ed8cf1acd..d070ee8fa4c 100644
--- a/sys/dev/pci/drm/drmP.h
+++ b/sys/dev/pci/drm/drmP.h
@@ -457,19 +457,6 @@ struct drm_driver_info {
int (*enable_vblank)(struct drm_device *, int);
void (*disable_vblank)(struct drm_device *, int);
- /**
- * 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
- * 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);
-
int buf_priv_size;
int major;
@@ -564,6 +551,7 @@ struct drm_attach_args {
struct pci_attach_args *pa;
struct vga_pci_softc *vga;
bus_dma_tag_t dmat;
+ int is_agp;
};
extern int drm_debug_flag;
@@ -571,7 +559,7 @@ extern int drm_debug_flag;
/* Device setup support (drm_drv.c) */
int drm_pciprobe(struct pci_attach_args *, drm_pci_id_list_t * );
struct device *drm_attach_mi(const struct drm_driver_info *, bus_dma_tag_t,
- struct pci_attach_args *pa, struct device *);
+ struct pci_attach_args *pa, int, struct device *);
dev_type_ioctl(drmioctl);
dev_type_open(drmopen);
dev_type_close(drmclose);
@@ -648,7 +636,6 @@ int drm_modeset_ctl(struct drm_device *, void *, struct drm_file *);
void drm_handle_vblank(struct drm_device *, int);
/* AGP/PCI Express/GART support (drm_agpsupport.c) */
-int drm_device_is_agp(struct drm_device *);
struct drm_agp_head *drm_agp_init(void);
void drm_agp_takedown(struct drm_device *);
int drm_agp_acquire(struct drm_device *);
diff --git a/sys/dev/pci/drm/drm_agpsupport.c b/sys/dev/pci/drm/drm_agpsupport.c
index d33c568a928..9125cde4a7a 100644
--- a/sys/dev/pci/drm/drm_agpsupport.c
+++ b/sys/dev/pci/drm/drm_agpsupport.c
@@ -40,24 +40,6 @@ void drm_agp_remove_entry(struct drm_device *,
struct drm_agp_mem *);
int
-drm_device_is_agp(struct drm_device *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 != DRM_MIGHT_BE_AGP)
- return (ret);
- }
-
- return (pci_get_capability(dev->pa.pa_pc, dev->pa.pa_tag, PCI_CAP_AGP,
- NULL, NULL));
-}
-
-int
drm_agp_info(struct drm_device * dev, struct drm_agp_info *info)
{
struct agp_info *kern;
diff --git a/sys/dev/pci/drm/drm_drv.c b/sys/dev/pci/drm/drm_drv.c
index bb377f67295..b9d292c113a 100644
--- a/sys/dev/pci/drm/drm_drv.c
+++ b/sys/dev/pci/drm/drm_drv.c
@@ -57,13 +57,14 @@ int drmprint(void *, const char *);
struct device *
drm_attach_mi(const struct drm_driver_info *driver, bus_dma_tag_t dmat,
- struct pci_attach_args *pa, struct device *dev)
+ struct pci_attach_args *pa, int is_agp, struct device *dev)
{
struct drm_attach_args arg;
arg.driver = driver;
arg.pa = pa;
arg.dmat = dmat;
+ arg.is_agp = is_agp;
printf("\n");
return (config_found(dev, &arg, drmprint));
@@ -143,7 +144,7 @@ drm_attach(struct device *parent, struct device *self, void *aux)
}
if (dev->driver->flags & DRIVER_AGP) {
- if (drm_device_is_agp(dev))
+ if (da->is_agp)
dev->agp = drm_agp_init();
if (dev->driver->flags & DRIVER_AGP_REQUIRE &&
dev->agp == NULL) {
diff --git a/sys/dev/pci/drm/i915_dma.c b/sys/dev/pci/drm/i915_dma.c
index ea73704030f..83f0954ff86 100644
--- a/sys/dev/pci/drm/i915_dma.c
+++ b/sys/dev/pci/drm/i915_dma.c
@@ -819,20 +819,3 @@ void i915_driver_preclose(struct drm_device * dev, struct drm_file *file_priv)
drm_i915_private_t *dev_priv = dev->dev_private;
i915_mem_release(dev, file_priv, dev_priv->agp_heap);
}
-
-
-/**
- * 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 retured to indictate every i9x5 is AGP.
- */
-int i915_driver_device_is_agp(struct drm_device * dev)
-{
- return 1;
-}
diff --git a/sys/dev/pci/drm/i915_drv.c b/sys/dev/pci/drm/i915_drv.c
index 022ed8254a7..43ab7c12fd1 100644
--- a/sys/dev/pci/drm/i915_drv.c
+++ b/sys/dev/pci/drm/i915_drv.c
@@ -94,7 +94,6 @@ static const struct drm_driver_info inteldrm_driver = {
.ioctl = inteldrm_ioctl,
.preclose = i915_driver_preclose,
.lastclose = i915_driver_lastclose,
- .device_is_agp = i915_driver_device_is_agp,
.vblank_pipes = 2,
.get_vblank_counter = i915_get_vblank_counter,
.enable_vblank = i915_enable_vblank,
@@ -164,7 +163,9 @@ inteldrm_attach(struct device *parent, struct device *self, void *aux)
mtx_init(&dev_priv->user_irq_lock, IPL_BIO);
- dev_priv->drmdev = drm_attach_mi(&inteldrm_driver, pa->pa_dmat, pa, self);
+ /* All intel chipsets need to be treated as agp, so just pass one */
+ dev_priv->drmdev = drm_attach_mi(&inteldrm_driver, pa->pa_dmat,
+ pa, 1, self);
}
int
diff --git a/sys/dev/pci/drm/mach64_drv.c b/sys/dev/pci/drm/mach64_drv.c
index fdfc8a22051..753b9c7c857 100644
--- a/sys/dev/pci/drm/mach64_drv.c
+++ b/sys/dev/pci/drm/mach64_drv.c
@@ -102,6 +102,7 @@ machdrm_attach(struct device *parent, struct device *self, void *aux)
drm_mach64_private_t *dev_priv = (drm_mach64_private_t *)self;
struct pci_attach_args *pa = aux;
struct vga_pci_bar *bar;
+ int is_agp;
dev_priv->pc = pa->pa_pc;
@@ -123,7 +124,11 @@ machdrm_attach(struct device *parent, struct device *self, void *aux)
return;
}
- dev_priv->drmdev = drm_attach_mi(&machdrm_driver, pa->pa_dmat, pa, self);
+ is_agp = pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_AGP,
+ NULL, NULL);
+
+ dev_priv->drmdev = drm_attach_mi(&machdrm_driver, pa->pa_dmat,
+ pa, is_agp, self);
}
int
diff --git a/sys/dev/pci/drm/mga_dma.c b/sys/dev/pci/drm/mga_dma.c
index 5ac71ab2e1d..992e04ce227 100644
--- a/sys/dev/pci/drm/mga_dma.c
+++ b/sys/dev/pci/drm/mga_dma.c
@@ -654,7 +654,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_device_is_agp(dev);
+ const int is_agp = (dma_bs->agp_mode != 0) && dev->agp != NULL;
int err;
drm_mga_private_t *const dev_priv =
(drm_mga_private_t *) dev->dev_private;
diff --git a/sys/dev/pci/drm/mga_drv.c b/sys/dev/pci/drm/mga_drv.c
index 2ec3dbcacec..fbdcbebecbb 100644
--- a/sys/dev/pci/drm/mga_drv.c
+++ b/sys/dev/pci/drm/mga_drv.c
@@ -115,7 +115,6 @@ static const struct drm_driver_info mga_driver = {
.irq_handler = mga_driver_irq_handler,
.dma_ioctl = mga_dma_buffers,
.dma_quiescent = mga_driver_dma_quiescent,
- .device_is_agp = mga_driver_device_is_agp,
.name = DRIVER_NAME,
.desc = DRIVER_DESC,
@@ -141,6 +140,7 @@ mgadrm_attach(struct device *parent, struct device *self, void *aux)
struct pci_attach_args *pa = aux;
struct vga_pci_bar *bar;
drm_pci_id_list_t *id_entry;
+ int is_agp;
dev_priv->usec_timeout = MGA_DEFAULT_USEC_TIMEOUT;
dev_priv->pc = pa->pa_pc;
@@ -168,7 +168,8 @@ mgadrm_attach(struct device *parent, struct device *self, void *aux)
return;
}
- dev_priv->drmdev = drm_attach_mi(&mga_driver, pa->pa_dmat, pa, self);
+ dev_priv->drmdev = drm_attach_mi(&mga_driver, pa->pa_dmat, pa,
+ is_agp, self);
}
int
diff --git a/sys/dev/pci/drm/r128_drv.c b/sys/dev/pci/drm/r128_drv.c
index 06dae98d011..990858cae82 100644
--- a/sys/dev/pci/drm/r128_drv.c
+++ b/sys/dev/pci/drm/r128_drv.c
@@ -119,6 +119,7 @@ ragedrm_attach(struct device *parent, struct device *self, void *aux)
drm_r128_private_t *dev_priv = (drm_r128_private_t *)self;
struct pci_attach_args *pa = aux;
struct vga_pci_bar *bar;
+ int is_agp;
dev_priv->pc = pa->pa_pc;
@@ -140,7 +141,11 @@ ragedrm_attach(struct device *parent, struct device *self, void *aux)
return;
}
- dev_priv->drmdev = drm_attach_mi(&ragedrm_driver, pa->pa_dmat, pa, self);
+ is_agp = pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_AGP,
+ NULL, NULL);
+
+ dev_priv->drmdev = drm_attach_mi(&ragedrm_driver, pa->pa_dmat, pa,
+ is_agp, self);
}
int
diff --git a/sys/dev/pci/drm/radeon_drv.c b/sys/dev/pci/drm/radeon_drv.c
index 387f863353a..789eb6e9647 100644
--- a/sys/dev/pci/drm/radeon_drv.c
+++ b/sys/dev/pci/drm/radeon_drv.c
@@ -517,6 +517,7 @@ radeondrm_attach(struct device *parent, struct device *self, void *aux)
struct pci_attach_args *pa = aux;
struct vga_pci_bar *bar;
drm_pci_id_list_t *id_entry;
+ int is_agp;
id_entry = drm_find_description(PCI_VENDOR(pa->pa_id),
PCI_PRODUCT(pa->pa_id), radeondrm_pciidlist);
@@ -582,7 +583,11 @@ radeondrm_attach(struct device *parent, struct device *self, void *aux)
((dev_priv->flags & RADEON_IS_AGP) ? "AGP" :
(((dev_priv->flags & RADEON_IS_PCIE) ? "PCIE" : "PCI"))));
- dev_priv->drmdev = drm_attach_mi(&radeondrm_driver, pa->pa_dmat, pa, self);
+ is_agp = pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_AGP,
+ NULL, NULL);
+
+ dev_priv->drmdev = drm_attach_mi(&radeondrm_driver, pa->pa_dmat,
+ pa, is_agp, self);
}
int
diff --git a/sys/dev/pci/drm/savage_drv.c b/sys/dev/pci/drm/savage_drv.c
index b809871c80d..55ef7ba25e6 100644
--- a/sys/dev/pci/drm/savage_drv.c
+++ b/sys/dev/pci/drm/savage_drv.c
@@ -95,6 +95,7 @@ savagedrm_attach(struct device *parent, struct device *self, void *aux)
struct vga_pci_bar *bar;
drm_pci_id_list_t *id_entry;
unsigned long mmio_base;
+ int is_agp;
id_entry = drm_find_description(PCI_VENDOR(pa->pa_id),
PCI_PRODUCT(pa->pa_id), savagedrm_pciidlist);
@@ -170,7 +171,11 @@ savagedrm_attach(struct device *parent, struct device *self, void *aux)
}
dev_priv->bst = pa->pa_memt;
- dev_priv->drmdev = drm_attach_mi(&savagedrm_driver, pa->pa_dmat, pa, self);
+ is_agp = pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_AGP,
+ NULL, NULL);
+
+ dev_priv->drmdev = drm_attach_mi(&savagedrm_driver, pa->pa_dmat,
+ pa, is_agp, self);
}
int
diff --git a/sys/dev/pci/drm/sis_drv.c b/sys/dev/pci/drm/sis_drv.c
index 5a8be935eb0..5eec111b76b 100644
--- a/sys/dev/pci/drm/sis_drv.c
+++ b/sys/dev/pci/drm/sis_drv.c
@@ -73,8 +73,13 @@ sisdrm_attach(struct device *parent, struct device *self, void *aux)
{
drm_sis_private_t *dev_priv = (drm_sis_private_t *)self;
struct pci_attach_args *pa = aux;
+ int is_agp;
- dev_priv->drmdev = drm_attach_mi(&sis_driver, pa->pa_dmat, pa, self);
+ is_agp = pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_AGP,
+ NULL, NULL);
+
+ dev_priv->drmdev = drm_attach_mi(&sis_driver, pa->pa_dmat,
+ pa, is_agp, self);
}
int
diff --git a/sys/dev/pci/drm/tdfx_drv.c b/sys/dev/pci/drm/tdfx_drv.c
index ae739197ae4..46ab4a88e82 100644
--- a/sys/dev/pci/drm/tdfx_drv.c
+++ b/sys/dev/pci/drm/tdfx_drv.c
@@ -78,7 +78,8 @@ tdfxdrm_attach(struct device *parent, struct device *self, void *aux)
struct tdfxdrm_softc *dev_priv = (struct tdfxdrm_softc *)self;
struct pci_attach_args *pa = aux;
- dev_priv->drmdev = drm_attach_mi(&tdfxdrm_driver, pa->pa_dmat, pa, self);
+ /* never agp */
+ dev_priv->drmdev = drm_attach_mi(&tdfxdrm_driver, pa->pa_dmat, pa, 0, self);
}
struct cfattach tdfxdrm_ca = {