Module Name:    src
Committed By:   riastradh
Date:           Sun Sep  8 16:22:29 UTC 2013

Modified Files:
        src/sys/external/bsd/drm2/dist/drm/i915 [riastradh-drm2]: i915_dma.c

Log Message:
Use the cached mmio bar information to map the GTT.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.28 -r1.1.1.1.2.29 \
    src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.28 src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.29
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.28	Sun Sep  8 16:03:21 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c	Sun Sep  8 16:22:29 2013
@@ -1599,23 +1599,21 @@ int i915_driver_load(struct drm_device *
 		mmio_size = 2*1024*1024;
 
 #ifdef __NetBSD__
-	/* XXX Maybe it would be better to just use pci_mapreg_map...  */
-	{
-		bus_addr_t addr;
-		bus_size_t size;
-
-		if (pci_mapreg_info(dev->pdev->pd_pa.pa_pc,
-			dev->pdev->pd_pa.pa_tag, PCI_BAR(mmio_bar),
-			PCI_MAPREG_TYPE_MEM,
-			&addr, &size, NULL /* XXX flags? */)) {
-			ret = -EIO;	    /* XXX */
-			goto put_gmch;
-		}
+	if (dev->bus_maps[mmio_bar].bm_size < mmio_size) {
+		DRM_ERROR("MMIO BAR %d is too small"
+		    ": %"PRIxMAX" < %"PRIxMAX"\n",
+		    mmio_bar,
+		    (uintmax_t)dev->bus_maps[mmio_bar].bm_size,
+		    (uintmax_t)mmio_size);
+		ret = -EIO;
+		goto put_gmch;
+	}
 
-		ret = drm_addmap(dev, addr, size, _DRM_REGISTERS,
-		    (_DRM_KERNEL | _DRM_DRIVER), &dev_priv->regs_map);
-		if (ret)
-			goto put_gmch;
+	ret = drm_addmap(dev, dev->bus_maps[mmio_bar].bm_base, mmio_size,
+	    _DRM_REGISTERS, (_DRM_KERNEL | _DRM_DRIVER), &dev_priv->regs_map);
+	if (ret) {
+		DRM_ERROR("Failed to map MMIO BAR %d: %d\n", mmio_bar, ret);
+		goto put_gmch;
 	}
 #else
 	dev_priv->regs = pci_iomap(dev->pdev, mmio_bar, mmio_size);

Reply via email to