Index: boot/arch/sparc64/loader/ofwarch.c
===================================================================
--- boot/arch/sparc64/loader/ofwarch.c	(revision 45b26dad9e99feac8777a9787b017301df054794)
+++ boot/arch/sparc64/loader/ofwarch.c	(revision c23baaba8508e03b530374f43aa8f061ee436dc9)
@@ -36,4 +36,5 @@
 #include <printf.h>
 #include <string.h>
+#include <register.h>
 #include "main.h"
 
@@ -54,9 +55,4 @@
 }
 
-
-#define ASI_UPA_CONFIG		0x4a
-#define UPA_CONFIG_MID_SHIFT 	17
-#define UPA_CONFIG_MID_MASK	0x1f
-
 int ofw_cpu(void)
 {
@@ -75,6 +71,8 @@
 	current_mid >>= UPA_CONFIG_MID_SHIFT;
 	current_mid &= UPA_CONFIG_MID_MASK;
+
+	int cpus;
 	
-	for (; node != 0 && node != -1; node = ofw_get_peer_node(node)) {
+	for (cpus = 0; node != 0 && node != -1; node = ofw_get_peer_node(node), cpus++) {
 		if (ofw_get_property(node, "device_type", type_name, sizeof(type_name)) > 0) {
 			if (strcmp(type_name, "cpu") == 0) {
@@ -94,4 +92,4 @@
 	}
 
-	return 1;
+	return cpus;
 }
Index: boot/arch/sparc64/loader/register.h
===================================================================
--- boot/arch/sparc64/loader/register.h	(revision 45b26dad9e99feac8777a9787b017301df054794)
+++ boot/arch/sparc64/loader/register.h	(revision c23baaba8508e03b530374f43aa8f061ee436dc9)
@@ -33,3 +33,7 @@
 #define PSTATE_AM_BIT   8
 
+#define ASI_UPA_CONFIG          0x4a
+#define UPA_CONFIG_MID_SHIFT    17
+#define UPA_CONFIG_MID_MASK     0x1f
+
 #endif
