PERFORCE change 213107 for review

Brooks Davis brooks at FreeBSD.org
Tue Jun 19 00:29:35 UTC 2012


http://p4web.freebsd.org/@@213107?ac=10

Change 213107 by brooks at brooks_ecr_current on 2012/06/19 00:28:56

	Allow non-PAGE_SIZE sized and aligned regions as long as they are
	smaller than a page.  This allows us to provide trivial access to things
	like the buttons and switches bytes.

Affected files ...

.. //depot/projects/ctsrd/beribsd/src/sys/dev/altera/avgen/altera_avgen.c#4 edit

Differences ...

==== //depot/projects/ctsrd/beribsd/src/sys/dev/altera/avgen/altera_avgen.c#4 (text+ko) ====

@@ -382,16 +382,18 @@
 		device_printf(dev, "couldn't map memory\n");
 		return (ENXIO);
 	}
-	if (rman_get_size(sc->avg_res) % PAGE_SIZE != 0) {
-		device_printf(dev,
-		    "memory region not even multiple of page size\n");
-		error = ENXIO;
-		goto error;
-	}
-	if (rman_get_start(sc->avg_res) % PAGE_SIZE != 0) {
-		device_printf(dev, "memory region not page-aligned\n");
-		error = ENXIO;
-		goto error;
+	if (rman_get_size(sc->avg_res) >= PAGE_SIZE) {
+		if (rman_get_size(sc->avg_res) % PAGE_SIZE != 0) {
+			device_printf(dev,
+			    "memory region not even multiple of page size\n");
+			error = ENXIO;
+			goto error;
+		}
+		if (rman_get_start(sc->avg_res) % PAGE_SIZE != 0) {
+			device_printf(dev, "memory region not page-aligned\n");
+			error = ENXIO;
+			goto error;
+		}
 	}
 
 	/* Device node allocation. */


More information about the p4-projects mailing list