Module Name:    src
Committed By:   drochner
Date:           Sat Sep 12 17:16:41 UTC 2009

Modified Files:
        src/sys/external/bsd/drm/dist/bsd-core: drm_pci.c
        src/sys/external/bsd/drm/dist/shared-core: i915_dma.c mach64_dma.c

Log Message:
fix some confusion between highest DMA address and the boundary not to
be crossed in a transfer,
back out previous fixes which only added to the confusion


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm/dist/bsd-core/drm_pci.c
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm/dist/shared-core/i915_dma.c
cvs rdiff -u -r1.3 -r1.4 \
    src/sys/external/bsd/drm/dist/shared-core/mach64_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/drm/dist/bsd-core/drm_pci.c
diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_pci.c:1.7 src/sys/external/bsd/drm/dist/bsd-core/drm_pci.c:1.8
--- src/sys/external/bsd/drm/dist/bsd-core/drm_pci.c:1.7	Sat Jun 20 01:07:09 2009
+++ src/sys/external/bsd/drm/dist/bsd-core/drm_pci.c	Sat Sep 12 17:16:41 2009
@@ -110,9 +110,10 @@
 		return NULL;
 	}
 #elif   defined(__NetBSD__)
-	dmah->tag = dev->pa.pa_dmat;
+	KASSERT(maxaddr >= 0xffffffffUL); /* no way to tell bus_dma_alloc */
+	dmah->tag = dev->pa.pa_dmat; /* use 32-bit DMA tag */
 
-	if ((ret = bus_dmamem_alloc(dmah->tag, size, align, maxaddr,
+	if ((ret = bus_dmamem_alloc(dmah->tag, size, align, 0,
 	    dmah->segs, 1, &nsegs, BUS_DMA_WAITOK)) != 0) {
 		printf("drm: Unable to allocate %zu bytes of DMA, error %d\n",
 		    size, ret);

Index: src/sys/external/bsd/drm/dist/shared-core/i915_dma.c
diff -u src/sys/external/bsd/drm/dist/shared-core/i915_dma.c:1.2 src/sys/external/bsd/drm/dist/shared-core/i915_dma.c:1.3
--- src/sys/external/bsd/drm/dist/shared-core/i915_dma.c:1.2	Thu Sep 10 18:11:21 2009
+++ src/sys/external/bsd/drm/dist/shared-core/i915_dma.c	Sat Sep 12 17:16:41 2009
@@ -82,21 +82,8 @@
 
 	/* Program Hardware Status Page */
 	DRM_UNLOCK();
-/*
- * This fix is not correct in case where we have i386 and PAE, where
- * unfortunately we have > 32 bit address space, but bus_size_t is still
- * 32 bits. To fix this properly we would have to change bus_size_t to a
- * 64 bit quantity for PAE. Good enough for now. When that is fixed, we
- * should change BOUNDARY to:
- * 	((paddr_t)(sizeof(paddr_t) > 4 ? 0x100000000ULL : 0ULL))
- */
-#ifdef _LP64
-#define        BOUNDARY        0x100000000ULL
-#else
-#define        BOUNDARY        0
-#endif
 	dev_priv->status_page_dmah =
-		drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE, BOUNDARY);
+		drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE, 0xffffffff);
 	DRM_LOCK();
 	if (!dev_priv->status_page_dmah) {
 		DRM_ERROR("Can not allocate hardware status page\n");

Index: src/sys/external/bsd/drm/dist/shared-core/mach64_dma.c
diff -u src/sys/external/bsd/drm/dist/shared-core/mach64_dma.c:1.3 src/sys/external/bsd/drm/dist/shared-core/mach64_dma.c:1.4
--- src/sys/external/bsd/drm/dist/shared-core/mach64_dma.c:1.3	Thu Sep 10 18:11:21 2009
+++ src/sys/external/bsd/drm/dist/shared-core/mach64_dma.c	Sat Sep 12 17:16:41 2009
@@ -837,21 +837,8 @@
 #ifdef __FreeBSD__
 	DRM_UNLOCK();
 #endif
-/*
- * This fix is not correct in case where we have i386 and PAE, where
- * unfortunately we have > 32 bit address space, but bus_size_t is still
- * 32 bits. To fix this properly we would have to change bus_size_t to a
- * 64 bit quantity for PAE. Good enough for now. When that is fixed, we
- * should change BOUNDARY to:
- * 	((paddr_t)(sizeof(paddr_t) > 4 ? 0x100000000ULL : 0ULL))
- */
-#ifdef _LP64
-#define        BOUNDARY        0x100000000ULL
-#else
-#define        BOUNDARY        0
-#endif
 	cpu_addr_dmah =
-	    drm_pci_alloc(dev, 0x1000, 0x1000, BOUNDARY);
+	    drm_pci_alloc(dev, 0x1000, 0x1000, 0xfffffffful);
 #ifdef __FreeBSD__
 	DRM_LOCK();
 #endif

Reply via email to