Subject: Re: CVS commit: src/sys/arch/macppc/macppc
To: None <matt@netbsd.org>
From: Erik Bertelsen <bertelsen.erik@gmail.com>
List: port-macppc
Date: 07/22/2007 22:01:26
2007/7/21, Matt Thomas <matt@netbsd.org>:

> Modified Files:
>         src/sys/arch/macppc/macppc: cpu.c locore.S
>
> Log Message:
> Make MP kernels build again.  Heck, if I'm lucky, maybe these changes will
> even make one boot.

Well, not here.

On my dual-cpu 450MHz G4, it hangs solidly while trying to start the
secondary CPU.

Looking at the code and tracing it a little with printf's -- and then
looking at the
OF attributes of the secondary CPU, I noticed that the code looks for
a "soft-reset"
property of the second CPU. On my machine, this attribute is not present, but I
have a "gpio-reg" with the value of 24 (and gpio-mask and gpio-value, both 1).

Just for the fun of it (and also because of the XXX in the
initialization of gpio),
I tried this:

cvs -q diff -c
Index: cpu.c
===================================================================
RCS file: /cvsroot/src/sys/arch/macppc/macppc/cpu.c,v
retrieving revision 1.45
diff -c -r1.45 cpu.c
*** cpu.c       21 Jul 2007 19:12:15 -0000      1.45
--- cpu.c       22 Jul 2007 19:52:34 -0000
***************
*** 295,300 ****
--- 295,303 ----
                if (OF_getprop(node, "soft-reset", &off, 4) == 4) {
                        gpio = kl_base + off;
                }
+               if (OF_getprop(node, "gpio-reg", &off, 4) == 4) {
+                       gpio = kl_base + off;
+               }

                /* Start secondary CPU. */
                out8(gpio, 4);

With this patch, the machine no longer hangs, but as seen in the top of the
boot:

total memory = 1024 MB
avail memory = 989 MB
timecounter: Timecounters tick every 10.000 msec
init_interrupt: found OpenPIC @ pa 0x80040000, 0x80040000
mainbus0 (root)
cpu0 at mainbus0: 7400 (Revision 0.9), ID 0 (primary)
cpu0: HID0 8094c0a4<EMCP,DOZE,DPM,EIEC,ICE,DCE,SGE,BTIC,BHT>, powersave: 1
cpu0: 450.00 MHz, no-parity 1MB WB L2 cache (PB SRAM) at 2:1 ratio
cpu1 at mainbus0cpu1: 450.00 MHz
: secondary CPU didn't start
uni_n0 at mainbus0 address 0xf8000000

It now continues after trying to start the cpu, but still thinks that
it did not start. As far
as I can see, this is caused by the unconditional setting of
'h->running = 0;' at the end
of the if (openpic_base) block.

I really don't know whether 0x80000024 is the correct value for gpio
on this machine,
and I also don't understand the handling of h->running -- but someone
understanding
this piece of code may be able to make use of my observations.

regards
- Erik