Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Jun 2012 00:29:34 GMT
From:      Brooks Davis <brooks@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 213107 for review
Message-ID:  <201206190029.q5J0TY7n041524@skunkworks.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@213107?ac=10

Change 213107 by brooks@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. */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206190029.q5J0TY7n041524>