PERFORCE change 129949 for review

Hans Petter Selasky hselasky at FreeBSD.org
Sat Dec 1 17:23:12 PST 2007


http://perforce.freebsd.org/chv.cgi?CH=129949

Change 129949 by hselasky at hselasky_laptop001 on 2007/12/02 01:22:37

	
	Make sure that the alignment is correct when
	allocating DMA memory.

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb/usb_subr.c#59 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb/usb_subr.c#59 (text+ko) ====

@@ -2082,6 +2082,16 @@
 	bus_dmamap_t map;
 	void *ptr;
 
+	if (align != 1) {
+		/*
+	         * The alignment must be greater or equal to the "size" else the
+	         * object can be split between two memory pages and we get a
+	         * problem!
+	         */
+		while (align < size) {
+			align *= 2;
+		}
+	}
 	/* get the correct DMA tag */
 	tag = usbd_dma_tag_setup(parent_tag, utag, size, align, utag_max);
 	if (tag == NULL) {


More information about the p4-projects mailing list