i810/i830: use drm_core_ioremap instead of drm_ioremap
authorDave Airlie <airlied@linux.ie>
Mon, 8 Jan 2007 10:31:13 +0000 (21:31 +1100)
committerDave Airlie <airlied@linux.ie>
Thu, 8 Feb 2007 02:24:26 +0000 (13:24 +1100)
This makes the i810/i830 use the drm_core_ioremap functions.

Signed-off-by: Dave Airlie <airlied@linux.ie>
drivers/char/drm/i810_dma.c
drivers/char/drm/i810_drv.h
drivers/char/drm/i830_dma.c
drivers/char/drm/i830_drv.h

index fa2de70f7401aded1c300fec6ba4799075348562..60cb4e45a75e52362db30dc19bf47d428324f96a 100644 (file)
@@ -219,8 +219,7 @@ static int i810_dma_cleanup(drm_device_t * dev)
                    (drm_i810_private_t *) dev->dev_private;
 
                if (dev_priv->ring.virtual_start) {
-                       drm_ioremapfree((void *)dev_priv->ring.virtual_start,
-                                       dev_priv->ring.Size, dev);
+                       drm_core_ioremapfree(&dev_priv->ring.map, dev);
                }
                if (dev_priv->hw_status_page) {
                        pci_free_consistent(dev->pdev, PAGE_SIZE,
@@ -236,9 +235,9 @@ static int i810_dma_cleanup(drm_device_t * dev)
                for (i = 0; i < dma->buf_count; i++) {
                        drm_buf_t *buf = dma->buflist[i];
                        drm_i810_buf_priv_t *buf_priv = buf->dev_private;
+
                        if (buf_priv->kernel_virtual && buf->total)
-                               drm_ioremapfree(buf_priv->kernel_virtual,
-                                               buf->total, dev);
+                               drm_core_ioremapfree(&buf_priv->map, dev);
                }
        }
        return 0;
@@ -311,8 +310,15 @@ static int i810_freelist_init(drm_device_t * dev, drm_i810_private_t * dev_priv)
 
                *buf_priv->in_use = I810_BUF_FREE;
 
-               buf_priv->kernel_virtual = drm_ioremap(buf->bus_address,
-                                                      buf->total, dev);
+               buf_priv->map.offset = buf->bus_address;
+               buf_priv->map.size = buf->total;
+               buf_priv->map.type = _DRM_AGP;
+               buf_priv->map.flags = 0;
+               buf_priv->map.mtrr = 0;
+
+               drm_core_ioremap(&buf_priv->map, dev);
+               buf_priv->kernel_virtual = buf_priv->map.handle;
+
        }
        return 0;
 }
@@ -363,18 +369,24 @@ static int i810_dma_initialize(drm_device_t * dev,
        dev_priv->ring.End = init->ring_end;
        dev_priv->ring.Size = init->ring_size;
 
-       dev_priv->ring.virtual_start = drm_ioremap(dev->agp->base +
-                                                  init->ring_start,
-                                                  init->ring_size, dev);
+       dev_priv->ring.map.offset = dev->agp->base + init->ring_start;
+       dev_priv->ring.map.size = init->ring_size;
+       dev_priv->ring.map.type = _DRM_AGP;
+       dev_priv->ring.map.flags = 0;
+       dev_priv->ring.map.mtrr = 0;
 
-       if (dev_priv->ring.virtual_start == NULL) {
+       drm_core_ioremap(&dev_priv->ring.map, dev);
+
+       if (dev_priv->ring.map.handle == NULL) {
                dev->dev_private = (void *)dev_priv;
                i810_dma_cleanup(dev);
                DRM_ERROR("can not ioremap virtual address for"
                          " ring buffer\n");
-               return -ENOMEM;
+               return DRM_ERR(ENOMEM);
        }
 
+       dev_priv->ring.virtual_start = dev_priv->ring.map.handle;
+
        dev_priv->ring.tail_mask = dev_priv->ring.Size - 1;
 
        dev_priv->w = init->w;
index e8cf3ff606f0c000c4955ab4d5e463d577b6e381..e6df49f4928a89b8e7e3187a7e523836c8206421 100644 (file)
@@ -61,6 +61,7 @@ typedef struct drm_i810_buf_priv {
        int currently_mapped;
        void *virtual;
        void *kernel_virtual;
+       drm_local_map_t map;
 } drm_i810_buf_priv_t;
 
 typedef struct _drm_i810_ring_buffer {
@@ -72,6 +73,7 @@ typedef struct _drm_i810_ring_buffer {
        int head;
        int tail;
        int space;
+       drm_local_map_t map;
 } drm_i810_ring_buffer_t;
 
 typedef struct drm_i810_private {
index 4f0e5746ab3382f30ff16e393aabca4f973e025d..95224455ec0cf55078d2598ace38b5730719faff 100644 (file)
@@ -223,8 +223,7 @@ static int i830_dma_cleanup(drm_device_t * dev)
                    (drm_i830_private_t *) dev->dev_private;
 
                if (dev_priv->ring.virtual_start) {
-                       drm_ioremapfree((void *)dev_priv->ring.virtual_start,
-                                       dev_priv->ring.Size, dev);
+                       drm_core_ioremapfree(&dev_priv->ring.map, dev);
                }
                if (dev_priv->hw_status_page) {
                        pci_free_consistent(dev->pdev, PAGE_SIZE,
@@ -242,8 +241,7 @@ static int i830_dma_cleanup(drm_device_t * dev)
                        drm_buf_t *buf = dma->buflist[i];
                        drm_i830_buf_priv_t *buf_priv = buf->dev_private;
                        if (buf_priv->kernel_virtual && buf->total)
-                               drm_ioremapfree(buf_priv->kernel_virtual,
-                                               buf->total, dev);
+                               drm_core_ioremapfree(&buf_priv->map, dev);
                }
        }
        return 0;
@@ -320,8 +318,14 @@ static int i830_freelist_init(drm_device_t * dev, drm_i830_private_t * dev_priv)
 
                *buf_priv->in_use = I830_BUF_FREE;
 
-               buf_priv->kernel_virtual = drm_ioremap(buf->bus_address,
-                                                      buf->total, dev);
+               buf_priv->map.offset = buf->bus_address;
+               buf_priv->map.size = buf->total;
+               buf_priv->map.type = _DRM_AGP;
+               buf_priv->map.flags = 0;
+               buf_priv->map.mtrr = 0;
+
+               drm_core_ioremap(&buf_priv->map, dev);
+               buf_priv->kernel_virtual = buf_priv->map.handle;
        }
        return 0;
 }
@@ -373,18 +377,24 @@ static int i830_dma_initialize(drm_device_t * dev,
        dev_priv->ring.End = init->ring_end;
        dev_priv->ring.Size = init->ring_size;
 
-       dev_priv->ring.virtual_start = drm_ioremap(dev->agp->base +
-                                                  init->ring_start,
-                                                  init->ring_size, dev);
+       dev_priv->ring.map.offset = dev->agp->base + init->ring_start;
+       dev_priv->ring.map.size = init->ring_size;
+       dev_priv->ring.map.type = _DRM_AGP;
+       dev_priv->ring.map.flags = 0;
+       dev_priv->ring.map.mtrr = 0;
+
+       drm_core_ioremap(&dev_priv->ring.map, dev);
 
-       if (dev_priv->ring.virtual_start == NULL) {
+       if (dev_priv->ring.map.handle == NULL) {
                dev->dev_private = (void *)dev_priv;
                i830_dma_cleanup(dev);
                DRM_ERROR("can not ioremap virtual address for"
                          " ring buffer\n");
-               return -ENOMEM;
+               return DRM_ERR(ENOMEM);
        }
 
+       dev_priv->ring.virtual_start = dev_priv->ring.map.handle;
+
        dev_priv->ring.tail_mask = dev_priv->ring.Size - 1;
 
        dev_priv->w = init->w;
index 85bc5be6f91650f9050444cc6accdad9ef9f5e05..e91f94afb4bbfe89c2b4364bb43997d18f45e38f 100644 (file)
@@ -68,6 +68,7 @@ typedef struct drm_i830_buf_priv {
        int currently_mapped;
        void __user *virtual;
        void *kernel_virtual;
+       drm_local_map_t map;
 } drm_i830_buf_priv_t;
 
 typedef struct _drm_i830_ring_buffer {
@@ -79,6 +80,7 @@ typedef struct _drm_i830_ring_buffer {
        int head;
        int tail;
        int space;
+       drm_local_map_t map;
 } drm_i830_ring_buffer_t;
 
 typedef struct drm_i830_private {