diff options
author | Owain Ainsworth <oga@cvs.openbsd.org> | 2008-11-18 16:08:52 +0000 |
---|---|---|
committer | Owain Ainsworth <oga@cvs.openbsd.org> | 2008-11-18 16:08:52 +0000 |
commit | b9a7e4cb5170126292dad507d7764a69d6ebd3af (patch) | |
tree | 0424c4d41711309de7e34c94af8d35528747140f /sys/dev | |
parent | 6e4b2da84f235d686234ccec866b7862309769a3 (diff) |
instead of going through the drm_map interface, just map the mmio
registers directly (via the memory sharing interface that intagp uses).
It doesn't need to be in a map structure.
Idea taken from some of intel's work.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/drm/i915_dma.c | 9 | ||||
-rw-r--r-- | sys/dev/pci/drm/i915_drv.h | 20 |
2 files changed, 18 insertions, 11 deletions
diff --git a/sys/dev/pci/drm/i915_dma.c b/sys/dev/pci/drm/i915_dma.c index fc5489a2e90..8b2cef262e7 100644 --- a/sys/dev/pci/drm/i915_dma.c +++ b/sys/dev/pci/drm/i915_dma.c @@ -817,8 +817,9 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) base = drm_get_resource_start(dev, mmio_bar); size = drm_get_resource_len(dev, mmio_bar); - ret = drm_addmap(dev, base, size, _DRM_REGISTERS, - _DRM_KERNEL | _DRM_DRIVER, &dev_priv->mmio_map); + dev_priv->regs = vga_pci_bar_map(dev->vga_softc, base, size, 0); + if (dev_priv->regs == NULL) + return (ENOMEM); /* Init HWS */ if (!I915_NEED_GFX_HWS(dev)) { @@ -838,8 +839,8 @@ int i915_driver_unload(struct drm_device *dev) i915_free_hws(dev); - if (dev_priv->mmio_map) - drm_rmmap(dev, dev_priv->mmio_map); + if (dev_priv->regs != NULL) + vga_pci_bar_unmap(dev_priv->regs); DRM_SPINUNINIT(&dev_priv->user_irq_lock); diff --git a/sys/dev/pci/drm/i915_drv.h b/sys/dev/pci/drm/i915_drv.h index f3d97659c33..e9f621ed394 100644 --- a/sys/dev/pci/drm/i915_drv.h +++ b/sys/dev/pci/drm/i915_drv.h @@ -77,8 +77,8 @@ struct mem_block { }; typedef struct drm_i915_private { + struct vga_pci_bar *regs; drm_local_map_t *sarea; - drm_local_map_t *mmio_map; drm_i915_sarea_t *sarea_priv; drm_i915_ring_buffer_t ring; @@ -273,12 +273,18 @@ extern int i915_setparam(struct drm_device *, void *, struct drm_file *); extern int i915_cmdbuffer(struct drm_device *, void *, struct drm_file *); extern int i915_set_status_page(struct drm_device *, void *, struct drm_file *); -#define I915_READ(reg) DRM_READ32(dev_priv->mmio_map, (reg)) -#define I915_WRITE(reg,val) DRM_WRITE32(dev_priv->mmio_map, (reg), (val)) -#define I915_READ16(reg) DRM_READ16(dev_priv->mmio_map, (reg)) -#define I915_WRITE16(reg,val) DRM_WRITE16(dev_priv->mmio_map, (reg), (val)) -#define I915_READ8(reg) DRM_READ8(dev_priv->mmio_map, (reg)) -#define I915_WRITE8(reg,val) DRM_WRITE8(dev_priv->mmio_map, (reg), (val)) +#define I915_READ(reg) bus_space_read_4(dev_priv->regs->bst, \ + dev_priv->regs->bsh, (reg)) +#define I915_WRITE(reg,val) bus_space_write_4(dev_priv->regs->bst, \ + dev_priv->regs->bsh, (reg), (val)) +#define I915_READ16(reg) bus_space_read_2(dev_priv->regs->bst, \ + dev_priv->regs->bsh, (reg)) +#define I915_WRITE16(reg,val) bus_space_write_2(dev_priv->regs->bst, \ + dev_priv->regs->bsh, (reg), (val)) +#define I915_READ8(reg) bus_space_read_1(dev_priv->regs->bst, \ + dev_priv->regs->bsh, (reg)) +#define I915_WRITE8(reg,val) bus_space_write_1(dev_priv->regs->bst, \ + dev_priv->regs->bsh, (reg), (val)) #define I915_VERBOSE 0 |