Module Name:    src
Committed By:   christos
Date:           Thu Sep 10 18:11:21 UTC 2009

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

Log Message:
PR/42041: Jasper Wallace: Stopgap fix for kernel assert
("(boundary & (boundary - 1)) == 0") triggers with i915drm in recent -5 kernel

Read the comment in the code for a detailed explanation. This should be fixed
properly in the i386 bus code, but it is too intrusive to do for -5.
XXX: pullup for 5.x


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.4 -r1.2 \
    src/sys/external/bsd/drm/dist/shared-core/i915_dma.c
cvs rdiff -u -r1.2 -r1.3 \
    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/shared-core/i915_dma.c
diff -u src/sys/external/bsd/drm/dist/shared-core/i915_dma.c:1.1.1.4 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.1.1.4	Thu Jun 18 23:22:24 2009
+++ src/sys/external/bsd/drm/dist/shared-core/i915_dma.c	Thu Sep 10 14:11:21 2009
@@ -82,8 +82,21 @@
 
 	/* 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, 0xffffffff);
+		drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE, BOUNDARY);
 	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.2 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.2	Tue Jun 23 00:42:01 2009
+++ src/sys/external/bsd/drm/dist/shared-core/mach64_dma.c	Thu Sep 10 14:11:21 2009
@@ -837,8 +837,21 @@
 #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, 0xfffffffful);
+	    drm_pci_alloc(dev, 0x1000, 0x1000, BOUNDARY);
 #ifdef __FreeBSD__
 	DRM_LOCK();
 #endif

Reply via email to