[OpenBIOS] [Qemu-ppc] MorphOS 4.x on QEMU

Olivier Danet odanet at caramail.com
Sun Mar 2 01:46:42 CET 2014


On 01/03/2014 01:49, BALATON Zoltan wrote:
> On Fri, 28 Feb 2014, BALATON Zoltan wrote:
>> On Thu, 27 Feb 2014, Mark Cave-Ayland wrote:
>>> FWIW there is a known issue with PPC's next-property iterator being 
>>> implemented differently to the standard (see Olivier's tentative 
>>> patch at 
>>> http://www.openfirmware.info/pipermail/openbios/2014-February/008141.html). 
>>> It's likely that a broken device tree iteration could be the cause 
>>> of the MorphOS bootloader not being able to locate a suitable 
>>> console mode which could be related to your issue.
>>
>> I think I did not hit this one yet at least the console problem is 
>> surely not caused by this but by MorphOS only supporting some 
>> specific Radeon GPUs that are found in the PPC Macs it is supporting. 
>> It is looking for them by their vendor-id:device-id and fails if not 
>> found, but tries to continue anyway.
>
> While the next property iterator is not the cause of the console 
> failed message it may very well be related to the hang in CPU 
> detection later that I'm currently facing. I see the following 
> openbios debug output with DEBUG_CIF enabled in libopenbios/client.c 
> while MorphOS tries to detect the CPU:
>
>>> finddevice("/cpus") = 0xfff4bbec
>>> child(0xfff4bbec) = 0xfff5194c
>>> nextprop(0xfff5194c, "", 0x07de7e30) = 1
>>> 0x07de7e30  6e __ __ __ __ __ __ __ __ __ __ __ __ __ __ __  n
>>> getprop(0xfff5194c, "name", 0x07de7df0, 64) = 11
>>> 0x07de7df0  50 6f 77 65 72 50 43 2c 47 34 00 __ __ __ __ __ PowerPC,G4.
>>> nextprop(0xfff5194c, "name", 0x07de7e30) = -1
>>> child(0xfff5194c) = 0x00000000
>
> and here it gives up and freezes. This is with Olivier's patch 
> applied, which does not change anything in the above, I'm seeing this 
> with or without this patch. It seems to be a case of nextprop failing 
> which the patch does not correct. Any hints how to debug it further? I 
> don't know how to test or trace forth so I'd need some help with this.
>
I am afraid the patch cannot change anything to that.
The nextprop(..."name"...) behavior is very strange.

It is possible to invoke manually "nextprop" from the OpenBIOS prompt :

-------------------------------------------------------------------
cd /cpus/PowerPC,G4

\ Empty string : Returns 1 "name"= first property
" mmmmmmmmmmmm" drop dup " "(00)" drop ?active-package
" nextprop" client-call-iface .
cr . dup cstrlen cr type cr

\ Nonexistant : Returns -1 ""
" mmmmmmmmmmmm" drop dup " mmmmm"(00)" drop ?active-package
" nextprop" client-call-iface .
cr . dup cstrlen cr type cr

\ Property : Returns 1 and the following one : "device_type"
" mmmmmmmmmmmm" drop dup " name"(00)" drop ?active-package
" nextprop" client-call-iface .
cr . dup cstrlen cr type cr

\ Last  : Returns 0 ""
" mmmmmmmmmmmm" drop dup " translations"(00)" drop ?active-package
" nextprop" client-call-iface .
cr . dup cstrlen cr type cr

-------------------------------------------------------------------
... and it works!

Maybe you could try this :

Index: libopenbios/client.c
===================================================================
--- libopenbios/client.c    (révision 1269)
+++ libopenbios/client.c    (copie de travail)
@@ -189,7 +189,7 @@
              memdump(arg2pointer(pb->args[2]), MIN(pb->args[3], 
pb->args[pb->nargs]));
      } else if (strcmp(service, "nextprop") == 0) {
          printk(FMT_prom_arg "\n", pb->args[pb->nargs]);
-        memdump(arg2pointer(pb->args[2]), pb->args[pb->nargs]);
+        memdump(arg2pointer(pb->args[2]), 32);
      } else if (strcmp(service, "setprop") == 0) {
          printk(FMT_prom_arg "\n", pb->args[pb->nargs]);
      } else if (strcmp(service, "canon") == 0) {
===================================================================

It will not solve the problem, but it will show if nextprop changes the 
memory buffer.

"pb->args[pb->nargs]" is wrong, because the return value of nextprop is 
not the lenght of the property.

Finally, you can also try this  :

Index: forth/system/ciface.fs
===================================================================
--- forth/system/ciface.fs    (révision 1269)
+++ forth/system/ciface.fs    (copie de travail)
@@ -110,18 +110,7 @@
    ( buf prev prev_len )
    0 3 pick c!

-  \ verify that prev exists (overkill...)
-  dup if
-    2dup r@ get-package-property if
-      r> 2drop 2drop -1 exit
-    else
-      2drop
-    then
-  then
-
-  ( buf prev prev_len )
-
-  r> next-property if
+  r> next-property if
      ( buf name name_len )
      dup 1+ -rot ci-strcpy drop 1
    else
===================================================================
(or next-property-std above if you applied my previous patch)

Maybe it will change something.


Olivier








More information about the OpenBIOS mailing list