- Make sure that alignment constraint is at least 1 (no alignment constraint).
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Mon, 5 Jan 2009 12:07:09 +0000 (20:07 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Tue, 17 Feb 2009 10:34:55 +0000 (18:34 +0800)
- Add commented out code, which inherits alignment constraint from parent
  dma tag. (need to fix some drivers, e.g. bfe(4), before uncomment it)

sys/platform/pc32/i386/busdma_machdep.c

index 0ed3c72..6faef88 100644 (file)
@@ -146,6 +146,9 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
        bus_dma_tag_t newtag;
        int error = 0;
 
+       if (alignment == 0)
+               alignment = 1;
+
        /* Return a NULL tag on failure */
        *dmat = NULL;
 
@@ -178,6 +181,10 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
                                               newtag->boundary);
                }
 
+#ifdef notyet
+               newtag->alignment = MAX(parent->alignment, newtag->alignment);
+#endif
+
                if (newtag->filter == NULL) {
                        /*
                         * Short circuit looking at our parent directly
@@ -390,8 +397,7 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
                 *     multi-seg allocations yet though.
                 */
                *vaddr = contigmalloc(dmat->maxsize, M_DEVBUF, mflags,
-                   0ul, dmat->lowaddr, dmat->alignment? dmat->alignment : 1ul,
-                   dmat->boundary);
+                   0ul, dmat->lowaddr, dmat->alignment, dmat->boundary);
        }
        if (*vaddr == NULL)
                return (ENOMEM);