Subject: port-sparc/24198: SUN4D does not count processors correctly
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <ssukovich@tampabay.rr.com>
List: netbsd-bugs
Date: 01/22/2004 23:54:41
>Number:         24198
>Category:       port-sparc
>Synopsis:       SUN4D does not count processors correctly
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    port-sparc-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 22 23:55:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Stephen Sukovich
>Release:        1.6ZH
>Organization:
>Environment:
NetBSD foxden 1.6ZH NetBSD 1.6ZH (GENERIC.MP) #0: Tue Jan 20 15:54:51 EST 2004  root@foxden:/usr/obj/sys/arch/i386/compile/GENERIC.MP i386

>Description:
find_cpus() does not count the right number of cpus in a SUN4D machine
>How-To-Repeat:
make a multiprocessor kernel for a SUN4D
boot the kernel on a sparc server 1000 
once the second cpu is detected at lot of garbled text will appear and the server will lock up.
>Fix:
this patch should fix it nicely

--- autoconf.c  2003/08/27 15:59:52     1.201
+++ autoconf.c  2004/01/22 23:46:16
@@ -175,6 +175,7 @@
        int n;
 #if defined(SUN4M) || defined(SUN4D)
        int node;
+       int unitnode;
 #endif

        /*
@@ -191,15 +192,36 @@
                return (1);

        n = 0;
-#if defined(SUN4M) || defined(SUN4D)
-       node = findroot();
-       for (node = firstchild(node); node; node = nextsibling(node)) {
-               if (strcmp(PROM_getpropstring(node, "device_type"), "cpu") != 0)
+#if defined(SUN4M)
+       if(CPU_ISSUN4M) {
+               node = findroot();
+               for (node = firstchild(node); node; node = nextsibling(node)) {
+                       if (strcmp(PROM_getpropstring(node, "device_type"), "cpu") != 0)
                        continue;
-               if (n++ == 0)
-                       cpu_arch = PROM_getpropint(node, "sparc-version", 7);
+                       if (n++ == 0)
+                               cpu_arch = PROM_getpropint(node, "sparc-version", 7);
+               }
        }
-#endif /* SUN4M || SUN4D */
+#endif /* SUN4M */
+
+#if defined(SUN4D)
+       if(CPU_ISSUN4D) {
+               node = findroot();
+               for(node = firstchild(node); node; node = nextsibling(node)) {
+
+                       if(strcmp(PROM_getpropstring(node, "name"), "cpu-unit") != 0)
+                       continue;
+
+                       for(unitnode = firstchild(node); unitnode; unitnode = nextsibling(unitnode)) {
+                               if(strcmp(PROM_getpropstring(unitnode, "device_type"), "cpu") != 0)
+                               continue;
+                               if(n++ == 0)
+                                       cpu_arch = PROM_getpropint(unitnode, "sparc-version", 7);
+                       }
+               }
+       }
+#endif
+
        return (n);
 }


>Release-Note:
>Audit-Trail:
>Unformatted: