Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Feb 2009 18:49:45 GMT
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 157152 for review
Message-ID:  <200902041849.n14Injic079900@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=157152

Change 157152 by nwhitehorn@nwhitehorn_nokia on 2009/02/04 18:49:35

	Fix locking while entering Open Firmware mappings, and change the
	memory regions code to exclude memory above the 4 GB boundary. This
	is sufficient to get an Xserve G5 booting almost the way to single user.
	Probing the hard drives still seems to be stuck in an infinite loop of
	failure, however.

Affected files ...

.. //depot/projects/ppc-g5/sys/powerpc/aim/mmu_oea64.c#14 edit
.. //depot/projects/ppc-g5/sys/powerpc/aim/ofw_machdep.c#10 edit

Differences ...

==== //depot/projects/ppc-g5/sys/powerpc/aim/mmu_oea64.c#14 (text+ko) ====

@@ -917,10 +917,13 @@
 		if (translations[i].om_pa_hi)
 			panic("OFW translations above 32-bit boundary!");
 
-		/* Enter the pages */
-		PMAP_LOCK(&ofw_pmap);
-		PMAP_LOCK(kernel_pmap);
+		/* Now enter the pages for this mapping */
 
+		/*
+		 * Lock the ofw pmap. pmap_kenter(), which we use for the
+		 * pages the kernel also needs, does its own locking.
+		 */
+		PMAP_LOCK(&ofw_pmap); 
 		DISABLE_TRANS(msr);
 		for (off = 0; off < translations[i].om_len; off += PAGE_SIZE) {
 			struct vm_page m;
@@ -940,8 +943,6 @@
 			ofw_mappings++;
 		}
 		ENABLE_TRANS(msr);
-
-		PMAP_UNLOCK(kernel_pmap);
 		PMAP_UNLOCK(&ofw_pmap);
 	    }
 	}

==== //depot/projects/ppc-g5/sys/powerpc/aim/ofw_machdep.c#10 (text+ko) ====

@@ -199,15 +199,25 @@
 		}
 	    }
 
-	    for (i = 0; i < msz/sizeof(OFmem64[0]); i++) {
+	    for (i = 0, j = 0; i < msz/sizeof(OFmem64[0]); i++) {
 		if (OFmem64[i].mr_start_hi == 0) {
 			OFmem[i].mr_start = OFmem64[i].mr_start_lo;
 			OFmem[i].mr_size = OFmem64[i].mr_size;
-		} else {
-			OFmem[i].mr_size = 0;
+
+			/*
+			 * Check for memory regions extending above 32-bit
+			 * memory space, and restrict them to stay there.
+			 */
+			if (((uint64_t)OFmem[i].mr_start +
+			    (uint64_t)OFmem[i].mr_size) >
+			    BUS_SPACE_MAXADDR_32BIT) {
+				OFmem[i].mr_size = BUS_SPACE_MAXADDR_32BIT -
+				    OFmem[i].mr_start;
+			}
+			j++;
 		}
 	    }
-	    msz = i*sizeof(OFmem[0]);
+	    msz = j*sizeof(OFmem[0]);
 	} else {
 	    if ((msz = OF_getprop(phandle, "reg",
 			  OFmem, sizeof OFmem[0] * OFMEM_REGIONS)) <= 0)



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