[Bug 205458] 11.0-CURRENT/10-STABLE powerpc64: a PowerMac G5 specific sys/powerpc/ofw/ofw_machdep.c change for reliable PowerMac G5 booting (with lots of RAM)

Mark Millard markmi at dsl-only.net
Sat Sep 17 01:41:17 UTC 2016


Jukka A. Ukkonen jau789 at gmail.com wrote on Fri Sep 16 15:36:05 UTC 2016 :

> it seems my PowerMac G5 is perfectly happy with this...
> 
>         __asm __volatile("mfsprg0 %0\n\t"
>                          : "=&r"(ofw_sprg0_save)
>                          :
>                          );

for the content in ofw_sprg_prepare(void).

Interestingly ofw_sprg0_save's use to save and restore requires that the same processor be in use in the restore side, ofw_sprg_restore(void): SPRG0 content is processor specific.

If the sprg0 save-restore is even required is not obvious to me: being required would imply that that something else is adjusting it between the save and restore code executions.

The following is just in the form of another simplest-local-changes experiment/analysis pass, not a "how it should be coded for general FreeBSD use" form for __powerpc64__ or at least for for PowerMac/iMac/Xserve G5's specifically. .  .

Given what is reported above by Jukka it would appear that the above __asm lines possibly could be removed/disabled if ofw_sprg_restore(void) also had its __asm line removed/disabled: i.e.,

        __asm __volatile("mtsprg0 %0" :: "r"(ofw_sprg0_save));

would no log be in use to access ofw_sprg0_save.

Effectively overall for the intended __powerpc64__ PowerMac(/iMac?/Xserver?) experimental context ofw_sprg_prepare and ofw_sprg_restore are then no-ops.

In effect ofw_sprg0_save and ofmsr[1] to ofmsr[4] would not be in significant use. But. . .

OF_initial_setup(void *fdt_ptr, void *junk, int (*openfirm)(void *))

still would have __asm references to ofmsr[1] through ofmsr[4] where they are initialized.


You might want to try deleting/disabling the __asm statements in ofw_sprg_prepare(void) and in ofw_sprg_restore(void) at the same time to see if it makes any difference. If it does make a difference that would be interesting and important. Otherwise it helps identify some more (PowerMac/. . . context specific) unnecessary code.

===
Mark Millard
markmi at dsl-only.net



More information about the freebsd-ppc mailing list