svn commit: r325926 - head/sys/powerpc/ofw

Justin Hibbits jhibbits at FreeBSD.org
Fri Nov 17 04:10:54 UTC 2017


Author: jhibbits
Date: Fri Nov 17 04:10:52 2017
New Revision: 325926
URL: https://svnweb.freebsd.org/changeset/base/325926

Log:
  Stop special casing 32-bit AIM in memory parsing
  
  There's no need to special case 32-bit AIM to short circuit processing.
  Some AIM CPUs can handle 36 bit addresses, and 64-bit CPUs can run 32-bit
  OSes, so this will allow us to expand for that in the future if we desire.

Modified:
  head/sys/powerpc/ofw/ofw_machdep.c

Modified: head/sys/powerpc/ofw/ofw_machdep.c
==============================================================================
--- head/sys/powerpc/ofw/ofw_machdep.c	Fri Nov 17 02:59:28 2017	(r325925)
+++ head/sys/powerpc/ofw/ofw_machdep.c	Fri Nov 17 04:10:52 2017	(r325926)
@@ -184,14 +184,6 @@ parse_ofw_memory(phandle_t node, const char *prop, str
 	i = 0;
 	j = 0;
 	while (i < sz/sizeof(cell_t)) {
-	      #if !defined(__powerpc64__) && !defined(BOOKE)
-		/* On 32-bit PPC (OEA), ignore regions starting above 4 GB */
-		if (address_cells > 1 && OFmem[i] > 0) {
-			i += address_cells + size_cells;
-			continue;
-		}
-	      #endif
-
 		output[j].mr_start = OFmem[i++];
 		if (address_cells == 2) {
 			output[j].mr_start <<= 32;
@@ -204,19 +196,20 @@ parse_ofw_memory(phandle_t node, const char *prop, str
 			output[j].mr_size += OFmem[i++];
 		}
 
-	      #if !defined(__powerpc64__) && !defined(BOOKE)
-		/* Book-E can support 36-bit addresses. */
+		if (output[j].mr_start > BUS_SPACE_MAXADDR)
+			continue;
+
 		/*
-		 * Check for memory regions extending above 32-bit
-		 * memory space, and restrict them to stay there.
+		 * Constrain memory to that which we can access.
+		 * 32-bit AIM can only reference 32 bits of address currently,
+		 * but Book-E can access 36 bits.
 		 */
 		if (((uint64_t)output[j].mr_start +
-		    (uint64_t)output[j].mr_size) >
-		    BUS_SPACE_MAXADDR_32BIT) {
-			output[j].mr_size = BUS_SPACE_MAXADDR_32BIT -
-			    output[j].mr_start;
+		    (uint64_t)output[j].mr_size - 1) >
+		    BUS_SPACE_MAXADDR) {
+			output[j].mr_size = BUS_SPACE_MAXADDR -
+			    output[j].mr_start + 1;
 		}
-	      #endif
 
 		j++;
 	}


More information about the svn-src-head mailing list