diff options
author | Owain Ainsworth <oga@cvs.openbsd.org> | 2008-11-19 16:57:21 +0000 |
---|---|---|
committer | Owain Ainsworth <oga@cvs.openbsd.org> | 2008-11-19 16:57:21 +0000 |
commit | ee1b1f927545a3f22c88f5122ec56ecce06d3bd3 (patch) | |
tree | de8c684a641516da438946aca401f5b2ecd59954 /sys/dev | |
parent | f8b255476f6c6d013579f50dcf806de119c80ef9 (diff) |
I'm clever and commited the wrong patch. Here's the correct one.
This should close kernel/5995.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/drm/i915_dma.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/sys/dev/pci/drm/i915_dma.c b/sys/dev/pci/drm/i915_dma.c index 8b2cef262e7..08c96def7ad 100644 --- a/sys/dev/pci/drm/i915_dma.c +++ b/sys/dev/pci/drm/i915_dma.c @@ -804,8 +804,8 @@ int i915_set_status_page(struct drm_device *dev, void *data, int i915_driver_load(struct drm_device *dev, unsigned long flags) { struct drm_i915_private *dev_priv; - unsigned long base, size; - int ret = 0, mmio_bar = IS_I9XX(dev) ? 0 : 1; + struct vga_pci_bar *bar; + int ret; dev_priv = drm_calloc(1, sizeof(drm_i915_private_t), DRM_MEM_DRIVER); if (dev_priv == NULL) @@ -814,12 +814,18 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) dev->dev_private = (void *)dev_priv; /* Add register map (needed for suspend/resume) */ - base = drm_get_resource_start(dev, mmio_bar); - size = drm_get_resource_len(dev, mmio_bar); + bar = vga_pci_bar_info(dev->vga_softc, (IS_I9XX(dev) ? 0 : 1)); + if (bar == NULL) { + printf(": can't get BAR info\n"); + return (EINVAL); + } - dev_priv->regs = vga_pci_bar_map(dev->vga_softc, base, size, 0); - if (dev_priv->regs == NULL) + dev_priv->regs = vga_pci_bar_map(dev->vga_softc, + bar->addr, bar->size, 0); + if (dev_priv->regs == NULL) { + printf(": can't map mmio space\n"); return (ENOMEM); + } /* Init HWS */ if (!I915_NEED_GFX_HWS(dev)) { |