summaryrefslogtreecommitdiff
path: root/sys/dev/pci/drm/i915_dma.c
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2008-11-22 14:42:37 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2008-11-22 14:42:37 +0000
commita714fd2e735156d99ef7b116ecd1a2fdf32cdadb (patch)
tree5dc1408fac391297810faebdba47591d39f9ed56 /sys/dev/pci/drm/i915_dma.c
parent74c8fafc99a7d1c884138462d4f8df03656fbb87 (diff)
reduce the dependancy of drm_pci_alloc upon the drm device softc. Just
pass in the dma tag
Diffstat (limited to 'sys/dev/pci/drm/i915_dma.c')
-rw-r--r--sys/dev/pci/drm/i915_dma.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/sys/dev/pci/drm/i915_dma.c b/sys/dev/pci/drm/i915_dma.c
index 01852eb901a..3c00381f23d 100644
--- a/sys/dev/pci/drm/i915_dma.c
+++ b/sys/dev/pci/drm/i915_dma.c
@@ -31,8 +31,8 @@
#include "i915_drm.h"
#include "i915_drv.h"
-int i915_init_phys_hws(struct drm_device *);
-void i915_free_hws(struct drm_device *);
+int i915_init_phys_hws(drm_i915_private_t *, bus_dma_tag_t);
+void i915_free_hws(drm_i915_private_t *, bus_dma_tag_t);
/* Really want an OS-independent resettable timer. Would like to have
* this loop run for (eg) 3 sec, but have the timer reset every time
@@ -76,12 +76,11 @@ int i915_wait_ring(struct drm_device * dev, int n, const char *caller)
* Sets up the hardware status page for devices that need a physical address
* in the register.
*/
-int i915_init_phys_hws(struct drm_device *dev)
+int i915_init_phys_hws(drm_i915_private_t *dev_priv, bus_dma_tag_t dmat)
{
- drm_i915_private_t *dev_priv = dev->dev_private;
/* Program Hardware Status Page */
dev_priv->status_page_dmah =
- drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE, 0xffffffff);
+ drm_pci_alloc(dmat, PAGE_SIZE, PAGE_SIZE, 0xffffffff);
if (!dev_priv->status_page_dmah) {
DRM_ERROR("Can not allocate hardware status page\n");
@@ -101,17 +100,16 @@ int i915_init_phys_hws(struct drm_device *dev)
* Frees the hardware status page, whether it's a physical address of a virtual
* address set up by the X Server.
*/
-void i915_free_hws(struct drm_device *dev)
+void i915_free_hws(drm_i915_private_t *dev_priv, bus_dma_tag_t dmat)
{
- drm_i915_private_t *dev_priv = dev->dev_private;
if (dev_priv->status_page_dmah) {
- drm_pci_free(dev, dev_priv->status_page_dmah);
+ drm_pci_free(dmat, dev_priv->status_page_dmah);
dev_priv->status_page_dmah = NULL;
}
if (dev_priv->status_gfx_addr) {
dev_priv->status_gfx_addr = 0;
- drm_core_ioremapfree(&dev_priv->hws_map, dev);
+ drm_core_ioremapfree(&dev_priv->hws_map);
}
/* Need to rewrite hardware status page */
@@ -141,7 +139,7 @@ static int i915_dma_cleanup(struct drm_device * dev)
drm_irq_uninstall(dev);
if (dev_priv->ring.virtual_start) {
- drm_core_ioremapfree(&dev_priv->ring.map, dev);
+ drm_core_ioremapfree(&dev_priv->ring.map);
dev_priv->ring.virtual_start = NULL;
dev_priv->ring.map.handle = NULL;
dev_priv->ring.map.size = 0;
@@ -149,7 +147,7 @@ static int i915_dma_cleanup(struct drm_device * dev)
/* Clear the HWS virtual address at teardown */
if (I915_NEED_GFX_HWS(dev_priv))
- i915_free_hws(dev);
+ i915_free_hws(dev_priv, dev->pa.pa_dmat);
return 0;
}
@@ -831,7 +829,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
/* Init HWS */
if (!I915_NEED_GFX_HWS(dev_priv)) {
- ret = i915_init_phys_hws(dev);
+ ret = i915_init_phys_hws(dev_priv, dev->pa.pa_dmat);
if (ret != 0)
return ret;
}
@@ -845,7 +843,7 @@ int i915_driver_unload(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = dev->dev_private;
- i915_free_hws(dev);
+ i915_free_hws(dev_priv, dev->pa.pa_dmat);
if (dev_priv->regs != NULL)
vga_pci_bar_unmap(dev_priv->regs);