PERFORCE change 230987 for review

Brooks Davis brooks at FreeBSD.org
Wed Jul 10 22:39:45 UTC 2013


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

Change 230987 by brooks at brooks_zenith on 2013/07/10 22:39:40

	Allow kernels with FDT entries for CPUs or threads are aren't
	present to boot by checking for a properly initalized spin_entry
	struct.  This will simplify configuration managment while we work
	toward a state where the FDT is built with each bitfile.

Affected files ...

.. //depot/projects/ctsrd/beribsd/src/sys/mips/beri/beri_mp.c#4 edit

Differences ...

==== //depot/projects/ctsrd/beribsd/src/sys/mips/beri/beri_mp.c#4 (text+ko) ====

@@ -57,6 +57,8 @@
 {
 	phandle_t cpus, cpu;
 	pcell_t reg;
+	char prop[16];
+	struct spin_entry *se;
 
 	if ((cpus = OF_finddevice("/cpus")) <= 0) {
 		printf("%s: no \"/cpus\" device found in FDT\n", __func__);
@@ -76,8 +78,36 @@
 		if (reg > MAXCPU) {
 			printf("%s: cpu ID too large (%d > %d)\n", __func__,
 			     reg, MAXCPU);
+			continue;
 		}
 		cpu_of_nodes[reg] = cpu;
+
+		if (reg != 0) {
+			if (OF_getprop(cpu, "enable-method", &prop,
+			    sizeof(prop)) <= 0 && OF_getprop(OF_parent(cpu),
+			    "enable-method", &prop, sizeof(prop)) <= 0) {
+				printf("%s: CPU %d has no enable-method "
+				    "property\n", __func__, reg);
+				continue;
+			}
+			if (strcmp("spin-table", prop) != 0) {
+				printf("%s: CPU %d enable-method is '%s' not "
+				    "'spin-table'\n", __func__, reg, prop);
+				continue;
+			}
+
+			if (OF_getprop(cpu, "cpu-release-addr", &se,
+			    sizeof(se)) <= 0) {
+				printf("%s: CPU %d has missing or invalid "
+				    "cpu-release-addr\n", __func__, reg);
+				continue;
+			}
+			if (se->entry_addr != 1) {
+				printf("%s: CPU %d has uninitalized spin "
+				    "entry\n", __func__, reg);
+				continue;
+			}
+		}
 			
 		CPU_SET(reg, mask);
 	} while ((cpu = OF_peer(cpu)) > 0);
@@ -91,7 +121,7 @@
 	 * XXX: panic instead?
 	 */
         CPU_ZERO(mask);
-	CPU_SET(1, mask);
+	CPU_SET(0, mask);
 }
 
 void


More information about the p4-projects mailing list