Author: mcayland Date: Sat Apr 3 10:25:47 2010 New Revision: 732 URL: http://tracker.coreboot.org/trac/openbios/changeset/732
Log: Fix two errors related to argument passing in the client interface:
i) client-call-iface did not set a return value of 0 on success; hence the top stack argument was dropped as part of the status check causing an off-by-one error.
ii) instead of setting pb->nret to be the number of arguments returned, the (random) value being passed in was being used to control the number of arguments being returned.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@siriusit.co.uk
Modified: trunk/openbios-devel/forth/system/ciface.fs trunk/openbios-devel/libopenbios/client.c
Modified: trunk/openbios-devel/forth/system/ciface.fs ============================================================================== --- trunk/openbios-devel/forth/system/ciface.fs Fri Apr 2 16:25:37 2010 (r731) +++ trunk/openbios-devel/forth/system/ciface.fs Sat Apr 3 10:25:47 2010 (r732) @@ -341,4 +341,5 @@ : client-call-iface ( [args] name len -- [args] -1 | [rets] 0 ) ciface-ph find-method 0= if -1 exit then execute + 0 ;
Modified: trunk/openbios-devel/libopenbios/client.c ============================================================================== --- trunk/openbios-devel/libopenbios/client.c Fri Apr 2 16:25:37 2010 (r731) +++ trunk/openbios-devel/libopenbios/client.c Sat Apr 3 10:25:47 2010 (r732) @@ -302,11 +302,11 @@ return -1; }
- for( i=0; i<pb->nret && dstackcnt > dstacksave ; i++ ) - pb->args[pb->nargs + i] = POP(); + for( pb->nret=0; dstackcnt > dstacksave ; pb->nret++ ) + pb->args[pb->nargs + pb->nret] = POP();
#ifdef DEBUG_CIF - if( i != pb->nret || dstackcnt != dstacksave ) { + if( dstackcnt != dstacksave ) { printk("service %s: argument count error (%d %d)\n", pb->service, i, dstackcnt - dstacksave ); dstackcnt = dstacksave;
Le samedi 03 avril 2010 à 10:25 +0200, repository service a écrit :
Author: mcayland Date: Sat Apr 3 10:25:47 2010 New Revision: 732 URL: http://tracker.coreboot.org/trac/openbios/changeset/732
Log: Fix two errors related to argument passing in the client interface:
i) client-call-iface did not set a return value of 0 on success; hence the top stack argument was dropped as part of the status check causing an off-by-one error.
ii) instead of setting pb->nret to be the number of arguments returned, the (random) value being passed in was being used to control the number of arguments being returned.
Nice, I was wondering why Morphos on PPC failed to boot, perhaps this corrects the problem... if a day I've time anymore, I'll try ;-)
Regards, Laurent
Laurent Vivier wrote:
Nice, I was wondering why Morphos on PPC failed to boot, perhaps this corrects the problem... if a day I've time anymore, I'll try ;-)
Well, while I'm testing on PPC...
Using the Morphos ISO I managed to fix a stack error in getprop, however it looks like the Morphos boot loader is broken. With DEBUG_CIF enabled I get this:
finddevice("/pci") = 0x05415ff4 getprop(0x05415ff4, "device_type", 0x078efe90, 64) = 4 0x078efe90 70 63 69 00 __ __ __ __ __ __ __ __ __ __ __ __ pci. child(0x05415ff4) = 0x0541643c getprop(0x0541643c, "device_type", 0x078efe90, 64) = 8 0x078efe90 64 69 73 70 6c 61 79 00 __ __ __ __ __ __ __ __ display. peer(0x0541643c) = 0x05416938 getprop(0x05416938, "device_type", 0x078efe90, 64) = 8 0x078efe90 6e 65 74 77 6f 72 6b 00 __ __ __ __ __ __ __ __ network. peer(0x05416938) = 0x05416d0c getprop(0x05416d0c, "device_type", 0x078efe90, 64) = 8 0x078efe90 70 63 69 2d 69 64 65 00 __ __ __ __ __ __ __ __ pci-ide. peer(0x05416d0c) = 0x054177f4 getprop(0x054177f4, "device_type", 0x078efe90, 64) = 7 0x078efe90 6d 61 63 2d 69 6f 00 __ __ __ __ __ __ __ __ __ mac-io. getprop(0x054177f4, "assigned-addresses", 0x078efe70, 20) = 20 0x078efe70 82 00 20 10 00 00 00 00 80 80 00 00 00 00 00 00 ..
.............
0x078efe80 00 08 00 00 __ __ __ __ __ __ __ __ __ __ __ __ .... child(0x054177f4) = 0x05417cc0 getprop(0x05417cc0, "device_type", 0x078efe90, 64) = 9 0x078efe90 76 69 61 2d 63 75 64 61 00 __ __ __ __ __ __ __ via-cuda. peer(0x05417cc0) = 0x05418530 getprop(0x05418530, "device_type", 0x078efe90, 64) = 6 0x078efe90 6e 76 72 61 6d 00 __ __ __ __ __ __ __ __ __ __ nvram. peer(0x05418530) = 0x05418744 getprop(0x05418744, "device_type", 0x078efe90, 64) = 5 0x078efe90 65 73 63 63 00 __ __ __ __ __ __ __ __ __ __ __ escc. peer(0x05418744) = 0x05418d20 getprop(0x05418d20, "device_type", 0x078efe90, 64) = 4 0x078efe90 61 74 61 00 __ __ __ __ __ __ __ __ __ __ __ __ ata. peer(0x05418d20) = 0x00000000 getprop(0x00000000, "device_type", 0x078efe90, 64) = -1 peer(0x00000000) = 0x0540de20 getprop(0x0540de20, "device_type", 0x078efe90, 64) = -1 peer(0x0540de20) = 0x00000000 getprop(0x00000000, "device_type", 0x078efe90, 64) = -1 peer(0x00000000) = 0x0540de20 getprop(0x0540de20, "device_type", 0x078efe90, 64) = -1 peer(0x0540de20) = 0x00000000 getprop(0x00000000, "device_type", 0x078efe90, 64) = -1 peer(0x00000000) = 0x0540de20 getprop(0x0540de20, "device_type", 0x078efe90, 64) = -1 peer(0x0540de20) = 0x00000000 getprop(0x00000000, "device_type", 0x078efe90, 64) = -1 peer(0x00000000) = 0x0540de20
So when Morphos gets to the end of enumerating the PCI bus, "peer" returns a value of 0 which is correct according to the spec. However, Morphos seems to continue to plug this value back into "getprop" to retrieve a device type which of course fails. Finally it calls "peer" again on 0 which again according to spec should return the root node. And so it gets stuck in a loop trying to locate a peer for the root device and failing :(
I guess the only way to solve this would be to find out which bug MacOS firmware has and to emulate it, or ask the Morphos people to change their loader to follow the spec.
ATB,
Mark.